working of syscall handling

Mehul Chadha mehulc87 at gmail.com
Wed Apr 8 07:04:10 PDT 2009


Hello all,

            I have a doubt in understanding the working of the freebsd OS.

In the program given below the function readlink gets called up when
printf is executed and the program ends without any output.

readlink is a system call (syscall number = 58) which is being made by
the printf function, but according to my understanding of system call,
it is made by putting the handler number in eax register and then
interrupting the processor, so that it can enter the kernel mode and
execute the required function, but in this case(dont know why) my
readlink function gets called up which should not have happened.

I will be very thankful if you can help me with it.


#include<stdio.h>

int readlink(void *a, void *b)
{
 exit(0);
}

int main(int argc, char **argv)
{
  printf("Hello World");
}


More information about the freebsd-hackers mailing list