home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / aix / 8033 < prev    next >
Encoding:
Text File  |  1992-07-21  |  1.1 KB  |  33 lines

  1. Path: sparky!uunet!dtix!darwin.sura.net!mips!swrinde!cs.utexas.edu!torn!watserv1!watmath!rbutterw
  2. From: rbutterw@math.waterloo.edu (Ray Butterworth [MFCF])
  3. Newsgroups: comp.unix.aix
  4. Subject: AIX 3.2 equivalent of syscall(2) and <syscall.h>?
  5. Message-ID: <1992Jul21.203837.9228@math.waterloo.edu>
  6. Date: 21 Jul 92 20:38:37 GMT
  7. Sender: rbutterw@math.waterloo.edu (Ray Butterworth [MFCF])
  8. Organization: Math Faculty Computing Facility, University of Waterloo
  9. Lines: 22
  10.  
  11. Does anyone know what AIX 3.2 provides as an equivalent of syscall(2),
  12. and <syscall.h> that is on all our other architectures?
  13.  
  14. It's used to allow one to trap kernel system calls and then call
  15. the real one.
  16.  
  17. e.g. if one wanted to guarantee that a program would never open
  18. anything but an absolute pathname, they could compile the program
  19. with this and it would replace the "open" function in libc.
  20.  
  21.     #include <syscalls.h>
  22.         int
  23.     open(path, flags, mode)
  24.         char *path;
  25.     {
  26.         if (path[0] != '/') {
  27.             errno = EPERM;
  28.             return -1;
  29.         }
  30.     
  31.         return syscall(SYS_open, path, flags, mode);
  32.     }
  33.