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.

learn more… | top users | synonyms

3
votes
2answers
231 views

Why can the waitpid system call only be used with child processes?

The man page wait(2) states that the waitpid system call returns the ECHILD error if the specified process is not a child of the calling process. Why is this? Would waiting on a non-child process ...
0
votes
1answer
1k views

Occasional error from bash on AIX: Interrupted system call

I am experiencing problems with process substitution in bash on AIX It happens very rarely, apparently only when the server is loaded. An example error message is: line 9: /tmp//sh-np-7841523: ...
1
vote
1answer
72 views

Implicit system calls in UNIX commands

I've been studying UNIX and system calls and I came across a low-level and tricky questions. The question asks what system calls are called for this command: grep word1 word2 > file.txt I did ...
3
votes
2answers
61 views

Defer *all* disk writes, keep them in memory

How to temporarily stop synchronizing of dirty data with disk, instead just keeping it in memory. Clarification: I want to sync it later.
0
votes
2answers
50 views

How is redirection implemented?

Is redirection a concept of the shell, not of the OS kernel? How is redirection implemented in terms of system calls? Is redirection implemented similarly to pipe?
0
votes
2answers
55 views

How can I crash the kernel?

I was writing a system call, done that and its working correctly. but I'm now looking for a way to crash the kernel somehow, and when does the kernel actually crash? I managed to put some pieces of ...
0
votes
1answer
23 views

What happens when writing to a device driver? [duplicate]

What happens when writing to a device driver? For example: echo "some text" > /proc/device_driver I'm guessing that echo has a write-call that somehow invokes the write-function in the driver. ...
0
votes
2answers
44 views

Parent process always printing output after child

Consider the following code running under Solaris 11.3: int main(void) { pid_t pid = fork(); if (pid > 0) { printf("[%ld]: Writing from parent process\n", getpid()); } if ...
0
votes
0answers
26 views

perl script stall nanosleep() call in strace output

I have perl base SIP client which calling for SIP REGISTRATION process but i am seeing it stall for 10 second at nanosleep() call send(4, "REGISTER sip:sip.example.com S"..., 513, 0) = 513 select(8, ...
3
votes
2answers
55 views

Why are privs required to setgid() to supplementary groups

The various set*gid() system calls require privileges to change groups except in a very few cases. Changing primary group to one of the processes' supplementary groups does not appear to be one of ...
-2
votes
1answer
25 views

Is the kernel module made before or after a new system call? [closed]

I'm trying to incorporate a new system call in the kernel source. However, on checking some resources over the web, I cam across this term called "kernel module". I am confused how to go about it : ...
0
votes
5answers
651 views

Why Samba needs the VFS module?

I came across this picture when learning samba. I am confused with the VFS module in this image. Why we need this VFS module in samba server instead of passing directly the intend system call to ...
3
votes
1answer
63 views

`EINTR`: is there a rationale behind it?

Small talk as background EINTR is the error which so-called interruptible system calls may return. If a signal occurs while a system call is running, that signal is not ignored and a signal handler ...
1
vote
1answer
29 views

Find the command the application has spawned

Is there a way to find the command by which an application has launched an external process? Motivation: I'm using an IDE Qt Creators which at some point calls a SFTP to transfer a file to a remote ...
11
votes
2answers
6k views

What's the difference between fork() and vfork()?

I would like to understand in detail the difference between fork() and vfork(). I was not able to digest the man page completely. I would also like to clarify one of my colleagues comment "In ...
0
votes
1answer
74 views

How can you find out which registers are used for system calls? [closed]

How do you know which registers you need to use for the system calls? Is this for every machine different? So why is it eax, ebx, etc.? How can I find out for my machine? Will it be different for ...
0
votes
1answer
46 views

How to find the numbers of system calls?

Are the numbers for the system calls for every machine different? Does it depend on the processor, I mean will there be a difference for i586 and i386? If they are different for every machine, how ...
3
votes
1answer
46 views

How does ssh always manage to reset the terminal attributes?

If I run strace -e trace=ioctl -v ssh some_remote_host I see a line like this: ioctl(0, SNDCTL_TMR_STOP or TCSETSW, {c_iflags=0x6006, c_oflags=0x4, c_cflags=0x 4bf, c_lflags=0xa00, c_line=0, ...
1
vote
0answers
42 views

code generating /proc file system

In my assignment, I have added "casper" flag to task descriptor and it takes only 0, 1, 2 and 3 (default 0). I asked to "modify the code that generates the /proc filesystem so that its behavior is ...
1
vote
1answer
36 views

Ext3 system calls during file creation and modification [closed]

I'm trying to learn more about Linux and its file system and I'm stuck on understanding the difference between the ext3 and ext2 file systems with regards to system calls during file creation and ...
2
votes
0answers
58 views

What hardware support is needed for linux to do `gettimeofday` / `clock_gettime` in userspace using `hped`?

On reasonably modern systems Linux can service "system" calls like gettimeofday and clock_gettime entirely in userspace through the linux-vdso.so (or linux-gate.so) virtual library, so it does not ...
0
votes
0answers
98 views

system user + kernel time using /proc/stat

user: normal processes executing in user mode nice: niced processes executing in user mode system: processes executing in kernel mode idle: twiddling thumbs iowait: waiting for I/O to complete irq: ...
1
vote
1answer
41 views

Failing close system call

The manpage for close and this http://pubs.opengroup.org/onlinepubs/009695399/functions/close.html (which looks authoritative) say the close system call may fail. How is an IO library supposed to ...
0
votes
0answers
43 views

Find system idle time using any system call in microseconds

For the perf analysis and to make decision based on system and app performance I need to find the idle time of system. I want the precise value in microseconds. I know that I can get the value in ...
2
votes
1answer
661 views

Why system call hooking produces different result everytime in Linux/Android 2.6.29?

I have implemented system call hooking for Android 2.6.29 kernel through a LKM module. I am tracing down one Android app for system calls. But interestingly, it returns different results every time I ...
1
vote
2answers
446 views

Linux System calls in C on OSX

So I did a quick test and #include <sys/types.h> #include <unistd.h> #include <stdio.h> int main (int argc, char *argv[]) { printf("Hello World\n"); ...
6
votes
3answers
815 views

How does getpid work?

The getpid system call returns the process id of the invoking process. How does the kernel figure out which process is invoking the system call ?
0
votes
0answers
28 views

strace | Who's making syscalls ? | Where are the instructions?

I've been told that strace is used to track all the system calls made while running an application. I see that there are a lot of system calls made even before the first printf ( now write ) call. ...
0
votes
1answer
38 views

Does MySQL processes run in user or kernel modes?

I try to count IOPS and I/O size with SystemTap script and use MySQL to be workload. I found mysqld doesn't call systemcall but mysqld has read/write on VFS. So, do MySQL processes run in user or ...
1
vote
2answers
2k views

How to add a system call in linux kernel 4.x

I'm trying to add a system call using linux kernel 4.1.6 but all the documentation I can find is for older versions. Does anyone know how it's done in the newer kernels or have any good references? ...
4
votes
2answers
212 views

What does p and e denote in exec family of calls?

l and v in exec calls denote whether the arguments are provided via list or array(vector). I read it somewhere that p denotes the user's path and e denote the environment but did not understand what ...
34
votes
4answers
4k views

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 ...
1
vote
1answer
356 views

How can a file descriptor be reclaimed and reused later?

In context of C and C++, is the close() system call the only way for kernel to reclaim the fd and reuse it later when calling open() in the same process lifetime? What about multi-threaded programs?
2
votes
2answers
146 views

Is there any Syscall table just like Interrupt Table?

Are the system calls like fork(), exit() saved in some kind of function pointer table , just like the Interrupt Descriptor Table ? where does my OS go when I call my fork() or exit() ? I guess this ...
1
vote
2answers
108 views

What are unimplemented system calls?

I was revising Linux system calls. I found that a few calls are unimplemented system calls. For example: afs_syscall. I don't understand why they are included in man pages if they are not yet ...
9
votes
2answers
4k views

Adding a new System call to Linux 3.2.x with a loadable kernel module [closed]

I want to add a particular new system call in the linux kernel 3.2.x but as a loadable kernel module (as I don't want to recompile the kernel again and again) I read through many posts on internet ...
7
votes
5answers
7k views

What is the difference between a Library call and a System call in Linux?

I would like to know what is the difference between a Library call and a System call in Linux. Any pointers for a good understanding of the concepts behind both will be greatly appreciated.
2
votes
1answer
472 views

Relation between system calls and shell commands/utilities

In POSIX, Does a system call function often but not always have a command or utility in shell? Is there some rule of thumb about what kinds of system calls have corresponding commands or utilities ...
1
vote
1answer
154 views

Is the PTTY inside the Kernel or Userspace?

I read, that drivers are a way to expand the Kernels abilities to communicate with hardware devices, since there are so many and will be even more the Kernel has to be expandable. In order to ...
1
vote
3answers
124 views

What is the reason for having numbers within the brackets of a function ? [duplicate]

I have seen on many occasions a name of a function (frankly speaking I just call it function because of it typical appearance, they are though sometimes named commands or system calls but I do not ...
1
vote
3answers
3k views

System calls source code

C library provides functions such as write(),read(),open()...that we can use in our C program to make system calls. where can I find source code for these functions?
1
vote
1answer
391 views

Few questions about system calls and kernel modules (kernel services in parallel)

I have few questions about system calls and kernel modules. Let's assume we have two applications (A and B) and each of them is running on a different core. (A-CPU 0, B-CPU 1) When two applications ...
0
votes
2answers
217 views

do processes access cpu and memory by system calls to the kernel?

If I am correct, processes access devices by system calls to the kernel. CPU and memory are also devices. when a process starts to run, does it get cpu and memory by system calls to the kernel? ...
3
votes
1answer
3k views

Program stall under user but runs under root

I am running R job under a normal user john and root. Interestingly, the program stalls under john user but runs quickly under root. Using strace, I found that when john runs the R, the process stalls ...
1
vote
1answer
98 views

How do I get linux-gate.dso on a newer linux system?

I would like to find out which method my 32bit QEMU guest is using for system calls. There's an excellent article explaining linux-gate.dso (http://www.trilithium.com/johan/2005/08/linux-gate/). ...
1
vote
2answers
200 views

Is system call the only way that a user program can intentionally affect the state of a Linux kernel?

I think there are several ways that a user program can intentionally affect the state of a Linux kernel. By invoking a system call; By invoking mmap() and writing the memory that has been mapped to ...
7
votes
1answer
292 views

Some basic questions about Linux kernel's security [closed]

I don't know much about Linux kernel, and I have some questions. What is the main purpose of separating kernel memory from user-space memory? To make sure that a user application cannot do anything ...
1
vote
1answer
462 views

open() return new file descriptor posix [closed]

I have to set the return values for open() in posix. How do I return "the new file descriptor" as it is said in the Linux man pages: RETURN VALUE open(), openat(), and creat() return the new ...
6
votes
4answers
12k views

Difference between system calls and library functions

I have been through the answer of this question but do not quite understand the difference between system calls and library functions. Conceptually, what is the difference between the two?
6
votes
3answers
959 views

System calls supported in running Kernel

Is there a way to get the number of or list of system calls supported by currently running Linux Kernel? So I want to find a way to 'read' the syscall table of a running kernel.