Tag Info

Hot answers tagged

3

Ambition or a overly severe urge for purity can lead you to do in-line assembly. For example, on x86_64 systems, you can do an open(2) system call like this: #include <sys/syscall.h> int linux_open(const char *pathname, unsigned long flags, unsigned long mode) { long ret; asm volatile ("syscall" : "=a" (ret) : "a" (__NR_open), ...


2

This question has been answered in this Super User question: What is the purpose of the magic numbers in Linux reboot? Basically, a bit flip in an address can cause a program to think it is calling one system call when, in fact, it's calling the reboot() system call. Because reboot() is a very destructive, non-syncing operation that erases the state of ...


2

In order to do system calls you normally have to execute some functions on the CPU that are not part of the C language specification. The system calls are either written in assembly for the CPU, and linked against, or some CPU specific inline assembly within a C function is used. Within the Linux kernel there are various macros defined to support this, ...


2

Most of the time your language of choice will provide functions (of some sort) that eventually map to the relevant syscalls. In those cases, just use those and call it a day; no need to consider syscall interfaces at all. In fact, I'd argue that unless you're writing a standard library, there should be no need to consider the lower-level details in the first ...


1

Changing process groups has no effect on the process hierarchy. The parent is still P0. It's important that the process hierarchy stays the same. When a shell implements job control, each job is put in its own process group. But the shell must still be the parent of the process group leader, so that the shell gets a SIGCHLD signal when it exits.



Only top voted, non community-wiki answers of a minimum length are eligible