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
1answer
40 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
25 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 ...
0
votes
1answer
56 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
42 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
32 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
40 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 ...
2
votes
0answers
40 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
62 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
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 ...
1
vote
1answer
35 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
36 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 ...
1
vote
2answers
348 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
627 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
24 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
35 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 ...
0
votes
2answers
1k 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
199 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 ...
3
votes
1answer
164 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 ...
33
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
200 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
92 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
87 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 ...
2
votes
1answer
347 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
130 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 ...
0
votes
0answers
16 views

using man command for a system call close [duplicate]

So if we have an executable program called close on linux, and theres also a system call close. How can i generate a command that makes sure i get the manual for the system call "close" rather than ...
1
vote
3answers
118 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 ...
0
votes
1answer
262 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
168 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? ...
1
vote
1answer
85 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
168 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 ...
6
votes
1answer
275 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
395 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
3answers
759 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.
2
votes
1answer
316 views

Strace Hello World program

So I am trying to understand systemcalls with the following "Hello World!" program: #include <stdio.h> int main(){ printf("Hello World!\n"); return 0; } and then I run strace on the ...
2
votes
1answer
155 views

How to log all the system calls made by a program, say chrome, using linux auditing?

autrace can log the system calls made by a program by running it. I want to log the system calls of already running programs. It can be done by finding the process id, but is there any other elegant ...
0
votes
1answer
294 views

List the system calls used in an application

Is there any way to get a list of all system calls used in an application without running through all possible scenarios in the app?
1
vote
1answer
54 views

Table or list of system call failure modes?

I am wondering if there is a table or list of system call failure modes. A few examples: Can exit() fail due to the system being out of memory? Can open() fail due to the system reaching the max open ...
0
votes
0answers
70 views

Are system calls available in a chroot environment?

I'm experiencing a lot of compilation errors regarding missing system calls (e.g. error: '__NR_name_to_handle_at' undeclared (first use in this function)) with different projects (ganesha 2.1.0 ...
7
votes
1answer
515 views

Why are rmdir and unlink two separate system calls?

Here's something that kept me wondering for a while: [15:40:50][/tmp]$ mkdir a [15:40:52][/tmp]$ strace rmdir a execve("/usr/bin/rmdir", ["rmdir", "a"], [/* 78 vars */]) = 0 brk(0) ...
2
votes
1answer
124 views

Is there a system call to bind a file descriptor directly into another?

A read() & write() loop would probably be as good as what I'm looking for, but nevertheless is anything like that around or is it impossible because of an obstacle I didn't envisage ? I'm curious
7
votes
2answers
1k views

Which is more efficient, ls or ls -l?

As I understand, the ls command calls getdents, which returns up to x number of directory entries. Are there any other system calls involved? If I run ls -l, are there any more system calls? I am ...
3
votes
1answer
723 views

What is the use of “magic arguments” in Linux reboot system call?

As I was reading Linux source code, and more specifically the system calls code, I came across sys_reboot implementation: http://lxr.free-electrons.com/source/kernel/reboot.c#L199. 199 ...
3
votes
2answers
335 views

Low level system call [closed]

C provides library functions such as write(),read().. for system calls.How to make a system call without using any library in linux in C ?
1
vote
3answers
2k 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?
2
votes
1answer
92 views

System calls in linux

Generally, systems provide a library or API that sits between normal programs and the operating system. On Unix-like systems, that API is usually part of an implementation of the C library (libc), ...
0
votes
1answer
352 views

Process's father after setpgid(0,0);

I have a process P1 (child of some parent process P0) both in the same process group. P1 somewhere in his code runs: setpgid(0,0); then a new process group is created (where the group leader is P1). ...
3
votes
1answer
178 views

Get device with major number 0 (btrfs subvolume)

When I stat a file on a btrfs subvolume I get a major device number of 0. Is there a reliable way to find the mount point of this device, without knowing in advance it is a btrfs subvolume? e.g. I'd ...
1
vote
1answer
162 views

Capture information of system-call

I have a QEMU-KVM hypervisor (ubuntu) with several VMs. What I want to do is capture all information of VMs system call to hypervisor (without any intervention to VM whatsoever) in real time within a ...
12
votes
5answers
3k views

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 ...
3
votes
2answers
615 views

Are system calls the only way to interact with the Linux kernel from user land?

Are there any other interfaces, e.g. the /proc filesystem?