[Previous]
[Contents]
[Next]

tcsetpgrp()

set the process group ID for a device

Synopsis:

#include <sys/types.h>
#include <unistd.h>
int tcsetpgrp( int fildes, pid_t pgrp_id );

Description:

The tcsetpgrp() function sets the process group ID associated with the device indicated by fildes to be pgrp_id.

If successful, the tcsetpgrp() function will cause subsequent breaks on the indicated terminal device to generate a SIGINT on all process in the given process group.

Returns:

0
Success
-1
An error occurred. errno is set to indicate the error.

Errors:

EBADF
The argument fildes is invalid.
EINVAL
The argument pgrp_id is invalid.
ENOSYS
The resource manager associated with fildes doesn't support this call.
ENOTTY
The argument fildes isn't associated with a terminal device.
EPERM
pgrp_id isn't part of the same session as the calling process.

Examples:

#include <sys/types.h>
#include <unistd.h>

void main()
  {
    /*
     * Direct breaks on stdin to me
     */
    tcsetpgrp( 0, getpid() );
  }

Classification:

POSIX 1003.1

Safety:
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

errno, signal(), tcgetpgrp(), tcsetct()


[Previous]
[Contents]
[Next]