Skip to content
Advertisement

How to find which type of system call is used by a program

I am working on x86_64 machine. My linux kernel is also 64 bit kernel. As there are different ways to implement a system call (int 80, syscall, sysenter), i wanted to know what type of system call my machine is using. I am newbie to linux. I have written a demo program.

JavaScript

getpid() does one system call. Can anybody give me a method to find which type of system call will be used by my machine for this program.. Thank you….

Advertisement

Answer

JavaScript

Looks like our call to getpid() is actually a library call. Let’s set a breakpoint there and continue.

JavaScript

Buried in the getpid() library is the syscall assembler instruction. This is an AMD64 instruction that supports a fast context switch to ring0 for the purpose of system calls.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement