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

1
vote
2answers
127 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"); ...
-2
votes
0answers
19 views

I get an error testing my new system call on Ubuntu Server 12.04 [on hold]

As title said, i get an error when i try to create a new System Call. The error i get it when i try to test the new system call with a "C" code. After execute the C code i get the following message ...
1
vote
0answers
7 views

Get scandir system call to work properly for user-defined compare functions? [migrated]

I have a task to scan a dir and sort it according to several criterias like size, modified time, etc. Looking at man page of scandir, shows SYNOPSIS #include <dirent.h> int ...
4
votes
3answers
393 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
20 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
25 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
167 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? ...
1
vote
1answer
564 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 ...
3
votes
2answers
180 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 ...
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 ...
3
votes
1answer
44 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 ...
1
vote
1answer
65 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
67 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
55 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
3k 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 ...
6
votes
5answers
4k 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.
1
vote
1answer
154 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 ...
0
votes
1answer
80 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
15 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
114 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
3answers
1k 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?
0
votes
1answer
134 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
121 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
2k 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
61 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
121 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
251 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
257 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
8k 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?
5
votes
3answers
516 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
212 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
116 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
208 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
45 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
63 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 ...
21
votes
2answers
3k views

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 ...
7
votes
1answer
344 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
99 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
507 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 ...
1
vote
1answer
84 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), ...
2
votes
2answers
255 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 ?
0
votes
1answer
180 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). ...
9
votes
2answers
308 views

How a piped shell programs balance their output/input rates? [duplicate]

Possible Duplicate: Bash while loop and reading from pipe I come from web programming background, and find myself interested in one peculiarity of using a local shell. I understand that ...
3
votes
1answer
132 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 ...
25
votes
5answers
100k views

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?
11
votes
5answers
2k 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 ...
2
votes
2answers
5k views

Calculating total CPU system usage in C [closed]

I found this answer on StackOverflow for calculating total CPU usage: http://stackoverflow.com/questions/1420426/calculating-cpu-usage-of-a-process-in-linux/4497769#4497769 But how do I calculate ...
1
vote
1answer
118 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 ...
2
votes
2answers
408 views