FreeBSD system call implementation

Ravi Krishna ravikrish at gmail.com
Wed Dec 15 06:49:07 PST 2004


Hi !
I am new to bsd internals and was looking at the implementation of syscall
in sys/i386/i386/trap.c
here its seems we get the handler for the syscall by 
if (p->p_sysent->sv_mask)
                code &= p->p_sysent->sv_mask;

        if (code >= p->p_sysent->sv_size)
                callp = &p->p_sysent->sv_table[0];
        else
                callp = &p->p_sysent->sv_table[code];

and call using 

if (error == 0) {
                td->td_retval[0] = 0;
                td->td_retval[1] = frame.tf_edx;

                STOPEVENT(p, S_SCE, narg);

                PTRACESTOP_SC(p, td, S_PT_SCE);

                error = (*callp->sy_call)(td, args);
        }
My question is why we store the p->p_sysent->sv_table
for each process. What is the reason for keeping this per process?
Are there some situations where two processes can have different system calls
available?

Regards,
Ravi


More information about the freebsd-hackers mailing list