1

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 can you find out the numbers for your machine?

One common place is /usr/include/asm*, but this folder does not exist.

Joey
  • 342
  • 5
  • 13
  • If you're missing /usr/include/asm, you might be missing some devel package or other. For me (Fedora 22) it's in either kernel-devel or kernel-headers, and the file is /usr/include/asm/unistd_64.h. Presumably the same file is also in the kernel source tree somewhere, if you look. – Tom Hunt Nov 30 '15 at 18:15

1 Answers1

-1

On most OS, the numbers are in /usr/include/sys/syscall.h

You usually can call syscall(number, rest of parameters).

Note that some "syscalls" may not be in syscalls.h as several syscall interfaces are implemented by a single syscall that uses a sub-number for selecting on call from a group of calls.

The syscall numbers are only valid for a specific version of a specific OS.

On Solaris, there is no stable syscall interface but a stable interface above libc. This is fully POSIX compliant as POSIX intentionally does not distinct between syscalls and library functions.

schily
  • 19,173
  • The problem is there is no include folder at all. Are the numbers for every i586 machine the same? Is there any resource for i586 mentioning all the numbers? – Joey Nov 30 '15 at 18:35
  • 2
    @Joey The number of system calls depends on the kernel version and on compilation options. If the headers aren't there, install them. – Gilles 'SO- stop being evil' Nov 30 '15 at 22:48
  • @Gilles How can you install them? – Joey Dec 01 '15 at 10:19
  • Compilation options are a relict from the 1980s, a modern OS autoconfigures at runtime and auto-loads all requested modules that are available in the kernels search PATH. – schily Dec 01 '15 at 10:34
  • 1
    @Joey With your distribution's package manager. For example, on Ubuntu, kernels are provided by packages linux-image-XXX and the headers needed to compile additional modules are in linux-headers-XXX. – Gilles 'SO- stop being evil' Dec 01 '15 at 10:46
  • @schily I think you're confusing operating systems and kernels. An operating system is something like Ubuntu or FreeBSD, which do indeed load drivers at runtime based on detected hardware. A kernel like the Linux kernel, which is intended for a very wide range of devices with amounts of memory varying in a ratio of at least 1:100000 and is used by multiple operating systems (the best known being the Linux and Android families), inevitably has many compile-time configuration options. The object of the current discussion if the Linux kernel, not an operating system based on the Linux kernel. – Gilles 'SO- stop being evil' Dec 01 '15 at 10:49
  • Linux is very outdated with it's demand to configure the kernel. Solaris removed this need in 1991 already and all parameters since are automatically extended until the kernel memory ends. On the other side, what Linux does, may be a reason for success as the people are given the illusion that they can control the kernel. This is a similar concept as backing mixtures where you need to add milk and butter even though this could have been made part of the kit. – schily Dec 01 '15 at 11:07