Browse Source

+ Added example 57

michael 27 years ago
parent
commit
e2ee811d74
3 changed files with 40 additions and 2 deletions
  1. 2 2
      docs/linuxex/Makefile
  2. 2 0
      docs/linuxex/README
  3. 36 0
      docs/linuxex/ex57.pp

+ 2 - 2
docs/linuxex/Makefile

@@ -36,8 +36,8 @@ OBJECTS=ex1 ex2 ex3 ex4 ex5 ex6 ex7 ex8 ex9 ex10 ex11 ex12 ex13 ex14 \
         ex15 ex16 ex17 ex18 ex19 ex20 ex21 ex22 ex23 ex24 ex25 ex26 ex27 \
         ex15 ex16 ex17 ex18 ex19 ex20 ex21 ex22 ex23 ex24 ex25 ex26 ex27 \
         ex28 ex29 ex30 ex31 ex32 ex33 ex34 ex35 ex36 ex37 ex38 ex39 ex40 \
         ex28 ex29 ex30 ex31 ex32 ex33 ex34 ex35 ex36 ex37 ex38 ex39 ex40 \
         ex41 ex42 ex43 ex44 ex45 ex46 ex47 ex48 ex49 ex51 ex52 ex53 ex54 ex55 \
         ex41 ex42 ex43 ex44 ex45 ex46 ex47 ex48 ex49 ex51 ex52 ex53 ex54 ex55 \
-        ex56
-#        ex57 ex58 ex59 ex60 ex61 ex62 ex63 ex64 ex65 ex66 \
+        ex56 ex57
+#        ex58 ex59 ex60 ex61 ex62 ex63 ex64 ex65 ex66 \
 #        ex67 ex68 ex69 ex70 ex71 ex72 ex73 ex74 ex75 ex76 ex77
 #        ex67 ex68 ex69 ex70 ex71 ex72 ex73 ex74 ex75 ex76 ex77
 
 
 TEXOBJECTS=$(addsuffix .tex, $(OBJECTS))
 TEXOBJECTS=$(addsuffix .tex, $(OBJECTS))

+ 2 - 0
docs/linuxex/README

@@ -56,3 +56,5 @@ ex52.pp contains an example of the GetFS function.
 ex53.pp contains an example of the S_ISLNK and related functions.
 ex53.pp contains an example of the S_ISLNK and related functions.
 ex54.pp contains an example of the IOCtl function.
 ex54.pp contains an example of the IOCtl function.
 ex55.pp contains an example of the TCGetAttr,TCSetAttr,CFMakeRaw functions.
 ex55.pp contains an example of the TCGetAttr,TCSetAttr,CFMakeRaw functions.
+ex56.pp contains an example of the Shell function.
+ex57.pp contains an example of the SigAction function.

+ 36 - 0
docs/linuxex/ex57.pp

@@ -0,0 +1,36 @@
+Program example57;
+
+{ Program to demonstrate the SigAction function.}
+
+{ 
+do a kill -USR1 pid from another terminal to see what happens.
+replace pid with the real pid of this program. 
+You can get this pid by running 'ps'.
+}
+
+uses Linux;
+
+Var
+   oa,na : PSigActionRec;
+   
+Procedure DoSig(sig : Longint);cdecl;
+
+begin
+   writeln('Receiving signal: ',sig);
+end; 
+
+begin
+   new(na);
+   new(oa);
+   na^.Sa_Handler:=@DoSig;
+   na^.Sa_Mask:=0;
+   na^.Sa_Flags:=0;
+   na^.Sa_Restorer:=Nil;
+   SigAction(SigUsr1,na,oa);
+   if LinuxError<>0 then
+     begin
+     writeln('Error: ',linuxerror,'.');
+     halt(1);
+     end;
+   readln;
+end.