syscall trace at kernel land

Rajat Sharma fs.rajat at gmail.com
Tue Jan 11 05:10:20 EST 2011


> is there any procedure in kernel to check for the interrupt vector number which caused it to be invoked?
Its actually very architecture dependent, on x86, its 'int $0x80'
which causes user space to call system calls handlers. Recent intel
architectures have callgate mechanism to enter into system call, look
for sysenter instruction.
Anyways, are you interested in interrupt number or the system call number?

> i mean like one of my friends said that when  kernel is about to restart a
> syscall then it raises signal -ERESTARTSYS signal for signal handler.

Thats totally wrong. Like any other error code, its just an error code
which waiting API return if process was interrupted while waiting on
semaphore, e.g.

rc = wait_event_inetrruptible(..);
if (rc == -ERESTARTSYS) {
    /*
     * your driver should take corrective measure, may be to retry the
code path again,
     * or do some error recovery and send appropriate error code to user space.
     * Note that conventionally -ERESTARTSYS should never be returned
to user space
     */
}

Although name is misleading, its an internal kernel error and is not
at all related to system call restart.

Rajat

On Tue, Jan 11, 2011 at 1:09 PM, Mulyadi Santosa
<mulyadi.santosa at gmail.com> wrote:
> just to avoid confusion 1st...
>
> On Tue, Jan 11, 2011 at 14:06, mohit verma <mohit89mlnc at gmail.com> wrote:
>> i mean like one of my friends said that when  kernel is about to restart a
>> syscall then it raises signal -ERESTARTSYS signal for signal handler. but i
>> think it is for
>> something went wrong and kernel wanna start the syscall again. but in
>> between a syscall  routine is it possible to get vector number (i repeat
>> ,sorry) ??
>
> allow me to rephrase it: if an interrupt crosses by during the
> execution of that code path, you wanna find out the interrupt number?
>
> --
> regards,
>
> Mulyadi Santosa
> Freelance Linux trainer and consultant
>
> blog: the-hydra.blogspot.com
> training: mulyaditraining.blogspot.com
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>



More information about the Kernelnewbies mailing list