Newsgroups: comp.os.linux
From: miquels@htsa.aha.nl (Miquel van Smoorenburg)
Subject: Re: sigblock, sigpause...
Organization: Algemene Hogeschool Amsterdam, The Netherlands
Date: Mon, 27 Jul 1992 21:09:33 GMT

In article <14p8neINNpr0@matt.ksu.ksu.edu> kxb@matt.ksu.ksu.edu (Karl Buck) writes:
>Are sigblock and sigpause implemented in the latest version of the
>compiler and/or kernel?
>-- 
>Karl Buck         O, Freddled Gruntbuggly      
>Grain Marketing   Thy Nicturations are to me   
>Research Lab      As Plurdled Gabbleblotchits  
>(913)776-2745	  On a lurgid bee.       -- Chief Prostetnic Vogon Jeltz

#define sigblock(what) sigsetmask(siggetmask()|(what))
#define sigpause(what) sigsuspend(&what)

That's all.. (Could someone put this in the official  ? )

Mike.

-- 
%     Miquel van Smoorenburg, Baljuwstraat 20, 2461SL Langeraar, Holland.     %
%   miquels@htsa.aha.nl (school)       miquels@drinkel.nl.mugnet.org (home)   %
%                   Calm down - it's just ones and zeros                      %

From: hlu@phys1.physics.wsu.edu (Hongjiu Lu)
Newsgroups: comp.os.linux
Subject: Re: sigblock, sigpause...
Date: 27 Jul 92 23:22:46 GMT
Organization: Washington State University

In article <1992Jul27.210933.29135@htsa.aha.nl>, miquels@htsa.aha.nl 
(Miquel van Smoorenburg) writes:
|> In article <14p8neINNpr0@matt.ksu.ksu.edu> kxb@matt.ksu.ksu.edu (Karl Buck) 
writes:
|> >Are sigblock and sigpause implemented in the latest version of the
|> >compiler and/or kernel?
|> >-- 
|> >Karl Buck         O, Freddled Gruntbuggly      
|> >Grain Marketing   Thy Nicturations are to me   
|> >Research Lab      As Plurdled Gabbleblotchits  
|> >(913)776-2745	  On a lurgid bee.       -- Chief Prostetnic Vogon Jeltz
|> 
|> #define sigblock(what) sigsetmask(siggetmask()|(what))
|> #define sigpause(what) sigsuspend(&what)

They are wrong. How about

sigpause (sigmask(SIGUSER1));

|> 
|> That's all.. (Could someone put this in the official  ? )

sigblock/sigpause are from BSD. Linux uses POSIX, which can do the equivalent
thing. You just have to use POSIX signals. THERE ARE NO ONE TO ONE CONVERSIONS.
I take this out of zsh port.

-----------------
#ifdef _POSIX_SOURCE
#define blockchld()  {  sigset_t set; \
                        sigemptyset (&set); \
                        sigaddset (&set, SIGCHLD); \
                        sigprocmask (SIG_BLOCK, &set, (sigset_t *)NULL); }
#define unblockchld() { sigset_t set; \
                        sigemptyset (&set); \
                        sigprocmask (SIG_SETMASK, &set, (sigset_t *)NULL); }
#define chldsuspend() { sigset_t set; \
                        sigemptyset (&set); \
                        sigsuspend (&set);}
#else
#define blockchld() sigblock(sigmask(SIGCHLD))
#define unblockchld() sigsetmask(0)
#define chldsuspend() sigpause(0)
#endif
-----------------

Please get a book on POSIX (any suggestions?) That is a simple one. Sometimes,
you need more than that. Again POSIX can do most but not all BSD signals with
very different signal functions.

-- 
H.J.
Gcc/libc maintainer for Linux.