~ubuntu-branches/ubuntu/feisty/fpc/feisty

« back to all changes in this revision

Viewing changes to docs/bunixex/ex57.pp

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2007-01-27 20:08:50 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070127200850-9mrptaqqjsx9nwa7
Tags: 2.0.4-5
* Fixed Build-Depends.
* Add myself to Uploaders in debian/control.
* Make sure that the sources are really patched before building them.
* Build unit 'libc' on powerpc too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Program example57;
2
 
 
3
 
{ Program to demonstrate the SigAction function.}
4
 
 
5
 
{
6
 
do a kill -USR1 pid from another terminal to see what happens.
7
 
replace pid with the real pid of this program.
8
 
You can get this pid by running 'ps'.
9
 
}
10
 
 
11
 
uses BaseUnix;
12
 
 
13
 
Var
14
 
   oa,na : PSigActionRec;
15
 
 
16
 
Procedure DoSig(sig : cint);cdecl;
17
 
 
18
 
begin
19
 
   writeln('Receiving signal: ',sig);
20
 
end;
21
 
 
22
 
begin
23
 
   new(na);
24
 
   new(oa);
25
 
   na^.sa_Handler:=SigActionHandler(@DoSig);
26
 
   fillchar(na^.Sa_Mask,sizeof(na^.sa_mask),#0);
27
 
   na^.Sa_Flags:=0;
28
 
   {$ifdef Linux}               // Linux specific
29
 
     na^.Sa_Restorer:=Nil;
30
 
   {$endif}
31
 
   if fpSigAction(SigUsr1,na,oa)<>0 then
32
 
     begin
33
 
     writeln('Error: ',fpgeterrno,'.');
34
 
     halt(1);
35
 
     end;
36
 
   Writeln ('Send USR1 signal or press <ENTER> to exit');
37
 
   readln;
38
 
end.