IBM Books

MPI Programming Guide

mpc_isatty

Purpose

Determines whether a device is a terminal on the home node.

Library

libmpi.a

C synopsis

#include <pm_util.h>
int mpc_isatty(int FileDescriptor);

Parameters

FileDescriptor
is the file descriptor number of the device. Valid values are:

0 or STDIN
specifies STDIN as the device to be checked.

1 or STDOUT
specifies STDOUT as the device to be checked.

2 or STDERR
specifies STDERR as the device to be checked.

Description

This parallel utility subroutine determines whether the file descriptor specified by the FileDescriptor parameter is associated with a terminal device on the home node. In a parallel operating environment partition, these three file descriptors are implemented as pipes to the partition manager daemon. Therefore, the AIX isatty() subroutine will always return false for each of them. This subroutine is provided for use by remote tasks that may want to know whether one of these devices is actually a terminal on the home node, for example, to determine whether or not to output a prompt.

Notes

This subroutine has a C version only. Also, it is thread safe.

Return values

In C and C++ calls, the following applies:

0
indicates that the device is not associated with a terminal on the home node.

1
indicates that the device is associated with a terminal on the home node.

-1
indicates an invalid FileDescriptor parameter.

Examples

C Example

/*
 * Running this program, after compiling with mpcc,
 * without redirecting STDIN, produces the following output:
 *
 *     isatty() reports STDIN as a non-terminal device
 *     mpc_isatty() reports STDIN as a terminal device
 */
 
#include "pm_util.h"
 
main()
{
 if (isatty(STDIN)) {
  printf("isatty() reports STDIN as a terminal device\n");
 } else {
  printf("isatty() reports STDIN as a non-terminal device\n");
  if (mpc_isatty(STDIN)) {
   printf("mpc_isatty() reports STDIN as a terminal device\n");
  } else {
   printf("mpc_isatty() reports STDIN as a non-terminal device\n");
  }
 }
}


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]