2 * (c) The GHC Team 2001
4 * $Id: tcSetAttr.c,v 1.1 2001/01/16 14:06:14 simonmar Exp $
6 * A wrapper around tcsetattr() which works for a background process.
24 /* tcsetattr() when invoked by a background process causes the process
25 * to be sent SIGTTOU regardless of whether the process has TOSTOP set
26 * in its terminal flags (try it...). This function provides a
27 * wrapper which temporarily blocks SIGTTOU around the call, making it
30 tcSetAttr( int fd, int options, const struct termios *tp )
33 sigset_t block_ttou, old_sigset;
35 sigemptyset (&block_ttou);
36 sigaddset (&block_ttou, SIGTTOU);
37 sigprocmask(SIG_BLOCK, &block_ttou, &old_sigset);
38 res = tcsetattr(fd, options, tp);
39 sigprocmask(SIG_SETMASK, &old_sigset, NULL);