Indirect system call

David Elliott dce at sony.com
Thu Nov 9 16:14:46 AEST 1989


In article <28945 at shemp.CS.UCLA.EDU> dieter at lynn.cs.ucla.edu (Dieter Rothmeier) writes:
>While browsing through section 2 of the Unix manual,
>I came upon the concept of an indirect system call,
>as in syscall(2). Now that puzzled me. What might be
>the use for such a facility?

1. You're adding a system call to the kernel and you want to be able to
   test it without having to make a new libc.

2. You're modifying a common system call and you want to be able to
   test it without other software (i.e., ls, cat, your editor) possibly
   crashing.

3. You want to be able to print out the arguments to a certain system call
   or set of calls without having to mess around with macros.  (This is
   a lame one, but it has happened).

4. You have a set of object files or a library but no source, and you
   have found a bug that you can work around if you can wrap one or
   more system calls with special-case code.  (I actually had to do this
   once with a package that used curses.  I couldn't rebuild the library
   for some reason, but screen redraw and shell escapes were broken, so
   I made a shell for read() that called syscall(READ) and then handled
   ^L and ! specially.)

Now, none of these are really that big a deal, and, as has been said
here before, a system doesn't need this mechanism to be useable.  On
the other hand, many people would assume that a system without adb
or sdb but with an improved dbx would be acceptable, but checkoff
items being what they are...
-- 
David Elliott
dce at sony.com | ...!{uunet,mips}!sonyusa!dce
(408)944-4073
"You can lead a robot to water, but you can not make him compute."



More information about the Comp.unix.wizards mailing list