home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / os / linux / 6813 < prev    next >
Encoding:
Text File  |  1992-07-27  |  2.4 KB  |  62 lines

  1. Path: sparky!uunet!darwin.sura.net!mips!sdd.hp.com!uakari.primate.wisc.edu!usenet.coe.montana.edu!news.u.washington.edu!serval!phys1.physics.wsu.edu!hlu
  2. From: hlu@phys1.physics.wsu.edu (Hongjiu Lu)
  3. Newsgroups: comp.os.linux
  4. Subject: Re: sigblock, sigpause...
  5. Message-ID: <1992Jul27.232246.29715@serval.net.wsu.edu>
  6. Date: 27 Jul 92 23:22:46 GMT
  7. References: <14p8neINNpr0@matt.ksu.ksu.edu> <1992Jul27.210933.29135@htsa.aha.nl>
  8. Sender: news@serval.net.wsu.edu (USENET News System)
  9. Organization: Washington State University
  10. Lines: 50
  11.  
  12. In article <1992Jul27.210933.29135@htsa.aha.nl>, miquels@htsa.aha.nl (Miquel van Smoorenburg) writes:
  13. |> In article <14p8neINNpr0@matt.ksu.ksu.edu> kxb@matt.ksu.ksu.edu (Karl Buck) writes:
  14. |> >Are sigblock and sigpause implemented in the latest version of the
  15. |> >compiler and/or kernel?
  16. |> >-- 
  17. |> >Karl Buck         O, Freddled Gruntbuggly      
  18. |> >Grain Marketing   Thy Nicturations are to me   
  19. |> >Research Lab      As Plurdled Gabbleblotchits  
  20. |> >(913)776-2745      On a lurgid bee.       -- Chief Prostetnic Vogon Jeltz
  21. |> 
  22. |> #define sigblock(what) sigsetmask(siggetmask()|(what))
  23. |> #define sigpause(what) sigsuspend(&what)
  24.  
  25. They are wrong. How about
  26.  
  27. sigpause (sigmask(SIGUSER1));
  28.  
  29. |> 
  30. |> That's all.. (Could someone put this in the official <signal.h> ? )
  31.  
  32. sigblock/sigpause are from BSD. Linux uses POSIX, which can do the equivalent
  33. thing. You just have to use POSIX signals. THERE ARE NO ONE TO ONE CONVERSIONS.
  34. I take this out of zsh port.
  35.  
  36. -----------------
  37. #ifdef _POSIX_SOURCE
  38. #define blockchld()  {  sigset_t set; \
  39.                         sigemptyset (&set); \
  40.                         sigaddset (&set, SIGCHLD); \
  41.                         sigprocmask (SIG_BLOCK, &set, (sigset_t *)NULL); }
  42. #define unblockchld() { sigset_t set; \
  43.                         sigemptyset (&set); \
  44.                         sigprocmask (SIG_SETMASK, &set, (sigset_t *)NULL); }
  45. #define chldsuspend() { sigset_t set; \
  46.                         sigemptyset (&set); \
  47.                         sigsuspend (&set);}
  48. #else
  49. #define blockchld() sigblock(sigmask(SIGCHLD))
  50. #define unblockchld() sigsetmask(0)
  51. #define chldsuspend() sigpause(0)
  52. #endif
  53. -----------------
  54.  
  55. Please get a book on POSIX (any suggestions?) That is a simple one. Sometimes,
  56. you need more than that. Again POSIX can do most but not all BSD signals with
  57. very different signal functions.
  58.  
  59. -- 
  60. H.J.
  61. Gcc/libc maintainer for Linux.
  62.