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:

The tcsetpgrp() function returns zero if successful; otherwise, it returns (-1), and sets errno.

Errors:

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

See also:

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

Examples:

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

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

Classification:

POSIX 1003.1

Systems:

QNX