2 * (c) The GHC Team 2001
4 * $Id: tcSetAttr.c,v 1.2 2001/01/26 17:51:40 rrt Exp $
6 * A wrapper around tcsetattr() which works for a background process.
24 #ifndef mingw32_TARGET_OS
25 /* tcsetattr() when invoked by a background process causes the process
26 * to be sent SIGTTOU regardless of whether the process has TOSTOP set
27 * in its terminal flags (try it...). This function provides a
28 * wrapper which temporarily blocks SIGTTOU around the call, making it
31 tcSetAttr( int fd, int options, const struct termios *tp )
34 sigset_t block_ttou, old_sigset;
36 sigemptyset (&block_ttou);
37 sigaddset (&block_ttou, SIGTTOU);
38 sigprocmask(SIG_BLOCK, &block_ttou, &old_sigset);
39 res = tcsetattr(fd, options, tp);
40 sigprocmask(SIG_SETMASK, &old_sigset, NULL);
45 #define tcSetAttr(f,o,t) tcsetattr((f),(o),(t))