A system call is used by programs to request services from the operating system's kernel.
Questions tagged [system-calls]
3690 questions
43
votes
3 answers
Golang catch signals
I want to implement a "process wrapper" in Go. Basically what it will do, is launch a process (lets say a node server) and monitor it (catch signals like SIGKILL, SIGTERM ...)
I think the way to do is to launch the node server in a go routine using…

rmonjo
- 2,675
- 5
- 30
- 37
41
votes
1 answer
What is the purpose of MAP_ANONYMOUS flag in mmap system call?
From the man page,
MAP_ANONYMOUS
The mapping is not backed by any file; its contents are initialized to zero. The fd and offset arguments are ignored; however, some implementations require
fd to be -1 if …

Jagdish
- 1,848
- 3
- 22
- 33
40
votes
1 answer
What is the difference between FUTEX_WAIT and FUTEX_WAIT_PRIVATE?
I have been tracing a process with strace and have seen entries such as:
futex(0x7ffff79b3e00, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x7ffff79b3e00, FUTEX_WAIT_PRIVATE, 2, NULL) = 0…

Gabriel Southern
- 9,602
- 12
- 56
- 95
39
votes
10 answers
System call vs Function call
What is the difference between a system call and a function call? Is fopen() a system call or a function call?

Ankur
- 1,189
- 4
- 12
- 12
39
votes
3 answers
Where can I find system call source code?
In Linux where can I find the source code for all system calls given that I have the source tree? Also if I were to want to look up the source code and assembly for a particular system call is there something that I can type in terminal like …

Dr.Knowitall
- 10,080
- 23
- 82
- 133
37
votes
3 answers
How do sites like codepad.org and ideone.com sandbox your program?
I need to compile and run user-submitted scripts on my site, similar to what codepad and ideone do. How can I sandbox these programs so that malicious users don't take down my server?
Specifically, I want to lock them inside an empty directory and…

mpen
- 272,448
- 266
- 850
- 1,236
36
votes
4 answers
How to Dynamically Allocate Memory Using Assembly and System Calls Under Linux
I'm looking for some good code examples of dynamic memory allocation using an assembly language under Linux and using system calls, not malloc and friends.
What are some of the simplest but effective ways to do this?
On Intel 386+ computers.

mudgen
- 7,213
- 11
- 46
- 46
35
votes
2 answers
What do these strace system calls mean?
I need to profile the performance of an application for which I am using strace. However, I do not really know how to interpret the various system calls the strace emits. Examples of a few of them are below:
(A) lseek(3, 1600, SEEK_SET) …

Ketan Maheshwari
- 2,002
- 3
- 25
- 31
34
votes
1 answer
Why does write continuously leave 4K bytes in the buffer?
I have essentially the following code:
int fileWrite(int file, void * pBuffer, size_t size)
{
size_t bytesWritten = (size_t)write( file, pBuffer, size ) ;
if (bytesWritten != size)
{
return -1;
}
return 0;
}
It works if…

TreeWater
- 761
- 6
- 13
34
votes
1 answer
Make syscall in Python
I want to make syscall in Python and the function is not in libc, is there a way to do it in Python?
More specifically, I want to call getdents, whose manpage says
Note: There are no glibc wrappers for these system calls;
All existing related…

Kan Li
- 8,557
- 8
- 53
- 93
32
votes
3 answers
How do I reimplement (or wrap) a syscall function on Linux?
Suppose I want to completely take over the open() system call, maybe to wrap the actual syscall and perform some logging. One way to do this is to use LD_PRELOAD to load a (user-made) shared object library that takes over the open() entry point.
The…

Stefano Borini
- 138,652
- 96
- 297
- 431
32
votes
1 answer
How do 32-bit applications make system calls on 64-bit Linux?
Some (many? all?) 64-bit1 Linux distros allow running 32-bit applications by shipping parallel collections of 32-bit and 64-bit libraries (including libc). So a 32-bit application can link against 32-bit libs and be run by a 64-bit kernel.
I'd like…

Alex B
- 82,554
- 44
- 203
- 280
31
votes
1 answer
wait3 (waitpid alias) returns -1 with errno set to ECHILD when it should not
Context is this Redis issue. We have a wait3() call that waits for the AOF rewriting child to create the new AOF version on disk. When the child is done, the parent is notified via wait3() in order to substitute the old AOF with the new one.
However…

antirez
- 18,314
- 5
- 50
- 44
31
votes
2 answers
In an operating system, what is the difference between a system call and an interrupt?
In an operating system, what is the difference between a system call and an interrupt? Are all system calls interrupts? Are all interrupts system calls?

Brad Penney
- 421
- 1
- 4
- 6
31
votes
4 answers
What is meant by "blocking system call"?
What is the meaning of "blocking system call"?
In my operating systems course, we are studying multithreaded programming. I'm unsure what is meant when I read in my textbook "it can allow another thread to run when a thread make a blocking system…

sam
- 311
- 1
- 3
- 4