Set the process group ID for a device
#include <sys/types.h> #include <unistd.h> int tcsetpgrp( int fildes, pid_t pgrp_id );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The tcsetpgrp() function sets the process group ID associated with the device indicated by fildes to be pgrp_id.
If successful, the tcsetpgrp() function causes subsequent breaks on the indicated terminal device to generate a SIGINT on all process in the given process group.
#include <sys/types.h> #include <unistd.h> #include <stdlib.h> int main( void ) { /* * Direct breaks on stdin to me */ tcsetpgrp( 0, getpid() ); return EXIT_SUCCESS; }
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |