Live data from Hacker News

Linux System Call Table

thevivekpandey.github.io

11–20 of 65 posts

Re: Linux System Call Table

#12
post #9
post #6

If man pages were up to date, this should be the index of chapter 2. I have discover unix with sun in the 90s and I am very nostalgic of the quality of man pages. At that time, man pages were complete and up to date. My latest frustration was with the option -m of df command. Chapter 2 should be updated each time a new version of kernel is installed.

It's very strange that adding/updating documentation isn't treated as a basic requirement for a patch that adds to or modifies Linux's public interfaces.

For the BSDs, incorrect or missing man pages are considered a serious bug.

Re: Linux System Call Table

#14

What is the use case for this? Is it for someone trying to write their own syscall wrappers?

Sometimes, yes, you'll need to write your own syscall wrappers. For example, there isn't a gettid (get thread ID) function in Glibc, but you can work around this by calling the syscall directly.

The other case where this is useful is if you're wanting to write userspace assembly without calling a C library. This may be especially useful when you're writing a compiler, or if you're trying to write small shellcodes for some reason.

Re: Linux System Call Table

#15
post #6

If man pages were up to date, this should be the index of chapter 2. I have discover unix with sun in the 90s and I am very nostalgic of the quality of man pages. At that time, man pages were complete and up to date. My latest frustration was with the option -m of df command. Chapter 2 should be updated each time a new version of kernel is installed.

If you want that level of quality, don't use Linux, use instead FreeBSD or OpenBSD.

Re: Linux System Call Table

#18
Actually, the syscall numbers are wrong! This reference seems better: http://blog.rchapman.org/posts/Linux_System_Call_Table_for_x...

Consider simple C program:

    #define _GNU_SOURCE
    #include 
    
    int main(){
        syscall(276);
    }
Strace'ing it shows the syscall used is tee, just as the reference I linked shows, and not pwritev as in OP's table.

Re: Linux System Call Table

#19
post #14

What is the use case for this? Is it for someone trying to write their own syscall wrappers?

Sometimes, yes, you'll need to write your own syscall wrappers. For example, there isn't a gettid (get thread ID) function in Glibc, but you can work around this by calling the syscall directly. The other case where this is useful is if you're wanting to write userspace assembly without calling a C library. This may be especially useful when you're writing a compiler, or if you're trying to write small shellcodes for…

[deleted]

Re: Linux System Call Table

#20

What is the use case for this? Is it for someone trying to write their own syscall wrappers?

You might need that when you want to reimplement Linux, the Joyent team did that on their OS (derived from solaris) so that user can run linux binaries on a solaris kernel (so thay have dtrace, zfs, mdb, ...) Bryan Cantrill did a bunch of conferences on that (one here: https://youtu.be/TrfD3pC0VSs)

The idea behind is that Linux is only a list of syscalls, if you are able to reimplement them, you reimplement linux, you don't need anything else. On the contrary if you want to reimplement a BSD you need to reimplement their libc (and perhaps some other libraries)

Post reply on HN