DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

tcpgrp(S-osr5)


tcgetpgrp, tcsetpgrp -- process group id functions

Syntax

cc . . . -lc

#include <sys/types.h>

pid_t tcgetpgrp (fildes); int fildes;

int tcsetpgrp (fildes, pgrp_id); int fildes; pid_t pgrp_id;

Description

tcgetpgrp- gets process group ID for tty foreground process

tcsetpgrp- sets the foreground process ID group

These routines identify and set the parent process group ID when job control is defined. The tcgetpgrp function returns the value of the process group ID of the foreground process group associated with the terminal.

tcgetpgrp is allowed only from a process that is part of a background process group. However, this information can be changed by a process that is part of the foreground process group by means of the tcsetpgrp call.

tcsetpgrp sets the foreground process ID group associated with the terminal to the value of pgrp_id. fildes must be the file associated with the controlling terminal of the calling process. The controlling terminal must also be currently associated with the session of the calling process. The value of pgrp_id must match a process group ID of a process in the same session as the calling process. Any other value of pgrp_id causes an error.

Return value

If successful, tcgetpgrp returns the process ID of the foreground process group associated with the calling terminal. Otherwise, -1 is returned and errno is set to indicate the error.

tcsetpgrp returns a value of zero upon success. Otherwise, -1 is returned and errno is set to indicate the error.

Errors

If any of the following conditions occur, tcgetpgrp returns -1 and sets errno to the corresponding value:


[EBADF]
The fildes argument is not a valid file descriptor.

[ENOSYS]
The tcgetpgrp function is not supported.

[ENOTTY]
The calling process does not have a controlling terminal or the file described in fildes is not the controlling terminal.

If any of the following conditions occur, tcsetpgrp returns -1 and sets errno to the corresponding value:


[EBADF]
The fildes argument is not a valid file descriptor.

[EINVAL]
The value of pgrp_id is not supported.

[ENOSYS]
The tcsetpgrp function is not supported.

[ENOTTY]
The calling process does not have a controlling terminal or the file described in fildes is not the controlling terminal.

[EPERM]
The value of pgrp_id is a value supported by the implementation but does not match the process group ID of a process in the same session as the calling process.

See also

tcflow(S-osr5), tcattr(S-osr5)

Standards conformance

tcgetpgrp and tcsetpgrp are conformant with:

IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1) and X/Open Portability Guide, Issue 3, 1989 .


© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005