Questions tagged [system-calls]

Questions concerning the details of how a program uses system calls to interact with the kernel API, what calls are available, how they work etc.

A system call is how a program requests a service from an operating system's kernel.

System calls can be roughly grouped into five major categories:

  1. Process Control

    • load
    • execute
    • end, abort
    • create process (for example, fork on Unix-like systems, or NtCreateProcess in the Windows NT Native API)
    • terminate process
    • get/set process attributes
    • wait for time, wait event, signal event
    • allocate, free memory
  2. File management

    • create file, delete file
    • open, close
    • read, write, reposition
    • get/set file attributes
  3. Device Management

    • request device, release device
    • read, write, reposition
    • get/set device attributes
    • logically attach or detach devices
  4. Information Maintenance

    • get/set time or date
    • get/set system data
    • get/set process, file, or device attributes
  5. Communication

    • create, delete communication connection
    • send, receive messages
    • transfer status information
    • attach or detach remote devices

Useful links System call @ wiki

341 questions
378
votes
7 answers

How can I find the implementations of Linux kernel system calls?

I am trying to understand how a function, say mkdir, works by looking at the kernel source. This is an attempt to understand the kernel internals and navigate between various functions. I know mkdir is defined in sys/stat.h. I found the…
Navaneeth K N
  • 3,988
  • 3
  • 17
  • 13
162
votes
5 answers

How to find application's path from command line?

For example, I have git installed on my system. But I don't remember where I installed it, so which command is fit to find this out?
Anders Lind
  • 2,315
  • 3
  • 21
  • 16
54
votes
4 answers

How does a linux GUI work at the lowest level?

I'm basically trying to figure out how one would go about making a GUI from absolute scratch with nothing but the linux kernel and programming in C. I am not looking to create a GUI desktop environment from scratch, but I would like to create some…
poopoopeepee123
  • 667
  • 6
  • 5
48
votes
2 answers

What did the system call "tuxcall" do?

In include/x86_64-linux-gnu/asm/unistd_64.h, I see a system call named tuxcall, #define __NR_tuxcall 184 There is nothing about it in man tuxcall except to say that it's an unimplemented system calls. What did it do? Was it never implemented, or…
Evan Carroll
  • 28,578
  • 45
  • 164
  • 290
47
votes
4 answers

Why are UNIX/POSIX system call namings so illegible?

What is the reason to use such untelling system call names like time and creat instead of getCurrentTimeSecs and createFile or, maybe more suitable on Unix get_current_time_secs and create_file. Which brings me to the next point: why should someone…
Benjoyo
  • 589
  • 4
  • 5
40
votes
3 answers

Why are Linux system call numbers in x86 and x86_64 different?

I know that the system call interface is implemented on a low level and hence architecture/platform dependent, not "generic" code. Yet, I cannot clearly see the reason why system calls in Linux 32-bit x86 kernels have numbers that are not kept the…
humanityANDpeace
  • 13,722
  • 13
  • 61
  • 107
36
votes
2 answers

Interruption of system calls when a signal is caught

From reading the man pages on the read() and write() calls it appears that these calls get interrupted by signals regardless of whether they have to block or not. In particular, assume a process establishes a handler for some signal. a device is…
darbehdar
  • 847
  • 2
  • 8
  • 9
28
votes
1 answer

getrusage system call: what is "maximum resident set size"

man getrusage 2 says ru_maxrss (since Linux 2.6.32) This is the maximum resident set size used (in kilobytes). For RUSAGE_CHILDREN, this is the resident set size of the largest child, not the maximum resident set size of…
ren
  • 1,005
  • 3
  • 11
  • 16
27
votes
2 answers

Where is the fork() on the fork bomb :(){ :|: & };:?

Warning: Running this command in most shells will result in a broken system that will need a forced shutdown to fix I understand the recursive function :(){ :|: & };: and what it does. But I don't know where is the fork system call. I'm not sure,…
mavillan
  • 3,067
  • 4
  • 22
  • 27
25
votes
2 answers

What's the purpose of the first argument to select system call?

From man select int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); nfds is the highest-numbered file descriptor in any of the three sets, plus 1. What is the purpose of nfds, when we…
phunehehe
  • 20,030
  • 27
  • 99
  • 151
23
votes
4 answers

flock(2) versus fcntl(2) over a NFS

The Perl 5.x documentation states that its implementation of flock(..) will use one of the following native calls, starting at 1 and working toward 3 if unavailable: flock(2) fcntl(2) lockf(3) That's fine. However, you may have noticed their…
Jmoney38
  • 546
  • 2
  • 5
  • 13
21
votes
4 answers

How to understand pipes

When I just used pipe in bash, I didn't think more about this. But when I read some C code example using system call pipe() together with fork(), I wonder how to understand pipes, including both anonymous pipes and named pipes. It is often heard…
Tim
  • 98,580
  • 191
  • 570
  • 977
18
votes
6 answers

What is meant by "a system call" if not the implementation in the programing language?

I would like to understand the term "system call". I am familiar that system calls are used to get kernel services from a userspace application. The part i need clarification with is the difference between a "system call" and a "C implementation of…
TheMeaningfulEngineer
  • 5,735
  • 15
  • 64
  • 113
15
votes
1 answer

Is the vdso shared library (linux-vdso.so) the library that contains the kernel object code (system calls)?

I noticed that all my programs compiled to gcc are linked to vdso library. Is this the library that contain the system calls to the kernel, like mmap() and fork() and other system calls? I know that system calls are not functions of the GNU C…
15
votes
1 answer

Where to get "/etc/ld.so.nohwcap" file from?

When I run a command through strace utility I can see access errors such as access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) Now I've read somewhere that what's happening on the above line is that a linker is looking…
Shady Programmer
  • 365
  • 1
  • 3
  • 9
1
2 3
22 23