home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!usc!news.service.uci.edu!ka.reg.uci.edu!bmarlowe
- From: bmarlowe@ka.reg.uci.edu (Brett Marlowe)
- Subject: syscall arguments: Can't seem to get 'em to work
- Nntp-Posting-Host: ka.reg.uci.edu
- Message-ID: <bmarlowe.722292146@ka>
- Summary: Having trouble returning value through pointer to integer argument
- Newsgroups: comp.lang.perl
- Keywords: syscall int* argument
- Lines: 57
- Distribution: usa
- Date: 20 Nov 92 20:51:52 GMT
-
- I am developing an interface to the advanced signal handling
- facilities.
-
- SunOS 4.1.1
- SPARCstation 2 (sun4c)
-
- This is perl, version 4.0
-
- $RCSfile: perl.c,v $$Revision: 4.0.1.6 $$Date: 91/11/11 16:38:45 $
- Patch level: 19
-
- Copyright (c) 1989, 1990, 1991, Larry Wall
-
- Perl may be copied only under the terms of either the Artistic License or the
- GNU General Public License, which may be found in the Perl 4.0 source kit.
-
-
- The following program should print:
-
- Sleeping...^C
- 00000002
- SIGINT
-
- but it prints:
-
- Sleeping...^C
- 00000000
- SIGINT
-
- Can anybody tell me what I'm doing wrong? I wrote the equivalent
- program in C and it worked just fine. It appears that the syscall is
- not placing the sigmask in the string buffer. I think it may be that
- the system call has a library wrapper, but I can't seem to figure out
- how to check.
-
-
- #!/usr/bin/perl
-
- $| = 1;
- $SIG{'INT'} = 'sig_handler';
- sub sig_handler { print "SIG$_[0]\n"; }
-
- $sm = syscall(&SYS_sigblock,2);
- print "Sleeping...";
- sleep 5; # press control-c during this sleep
- print "\n";
-
- $sigmask = pack("I",0);
- syscall(&SYS_sigpending,$sigmask) == 0 || die $!;
- printf("%08x\n",$sigmask);
-
- syscall(&SYS_sigsetmask,$sm);
-
- --
- -------------------------------------------------------------------------------
- Brett Marlowe | University of California, Irvine
- bmarlowe@uci.edu | Office of the Registrar (making sure you get your bills)
-