gensigset.inc 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. (c) 2002 by Marco van de Voort
  5. members of the Free Pascal development team.
  6. Generic POSIX signal functions draft. Based on a few constants.
  7. See the file COPYING.FPC, included in this distribution,
  8. for details about the copyright.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY;without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. **********************************************************************}
  13. function fpsigaddset(var nset : tsigset;signo:cint): cint;
  14. Begin
  15. if (signo<=0) or (signo > SIG_MAXSIG) Then
  16. Begin
  17. seterrno(ESysEINVAL);
  18. exit(-1);
  19. End;
  20. nset[(signo-1) shr ln2bitsinword]:=nset[(signo-1) shr ln2bitsinword] OR (1 shl ((signo-1) and ln2bitmask));
  21. fpsigaddset:=0;
  22. End;
  23. function fpsigdelset(var nset : tsigset;signo:cint): cint;
  24. Begin
  25. if (signo<=0) or (signo > SIG_MAXSIG) Then
  26. Begin
  27. seterrno(ESysEINVAL);
  28. exit(-1);
  29. End;
  30. nset[(signo-1) shr ln2bitsinword]:=nset[(signo-1) shr ln2bitsinword] AND NOT (1 shl ((signo-1) and ln2bitmask));
  31. fpsigdelset:=0;
  32. End;
  33. function fpsigemptyset(var nset : tsigset):cint;
  34. var i :longint;
  35. Begin
  36. for i:=0 to wordsinsigset-1 DO nset[i]:=0;
  37. fpsigemptyset:=0;
  38. End;
  39. function fpsigfillset(var nset : tsigset):cint;
  40. var i :longint;
  41. Begin
  42. for i:=0 to wordsinsigset DO nset[i]:=NOT 0;
  43. fpsigfillset:=0;
  44. End;
  45. function fpsigismember(const nset : tsigset;signo:cint): cint;
  46. Begin
  47. if (signo<=0) or (signo > SIG_MAXSIG) Then
  48. Begin
  49. seterrno(ESysEINVAL);
  50. exit(-1);
  51. End;
  52. if ((nset[(signo-1) shr ln2bitsinword]) and (1 shl ((signo-1) and ln2bitmask)))>0 Then
  53. fpsigismember:=1
  54. else
  55. fpsigismember:=0;
  56. End;
  57. {
  58. $Log$
  59. Revision 1.3 2003-06-01 16:28:41 marco
  60. * Enhancements to make the compiler baseunix using.
  61. Revision 1.2 2002/12/18 16:50:39 marco
  62. * Unix RTL generic parts. Linux working, *BSD will follow shortly
  63. Revision 1.1 2002/11/14 12:20:30 marco
  64. * initial version, taken from bsdfunc.inc, since both linux and bsd use it
  65. }