The Linux Kernel: System Calls R-S

Discussion in 'Linux Kernel' started by DevynCJohnson, Apr 27, 2014.

  1. DevynCJohnson

    DevynCJohnson Well-Known Member Staff Member Staff Writer

    Messages:
    1,345
    Likes Received:
    1,083
    Trophy Points:
    113
    Series Index - http://www.linux.org/threads/linux-kernel-reading-guide.5384/

    There are still many more kernel calls, as you will see. Each one is important to the functioning of the kernel and system as a whole. Some of these syscalls are defined by the POSIX standard and are used by other systems (like *BSD). Some systems use a system call that has the same name and performs the same function. However, such calls may use different code even between architectures of the same operating system.

    recv(), recvfrom(), recvmsg() - These three syscalls are nearly the same. They all receive messages from connected sockets, but these calls do so in a different way.

    recvmmsg() - Like the three calls mentioned previously, recvmmsg() gets messages from sockets. However, this syscall can receive multiple messages at once, while the other calls get one at a time. The code used to make recvmmsg() came from recvmsg(). (Notice the number of "m"s)

    remap_file_pages() - This system call creates a new mapping on memory. Specifically, remap_file_pages() sets up a nonlinear mapping, meaning the pages are not placed in order on memory.

    removexattr() - The extended attributes of files are removed with this syscall. The needed parameters include the path of the file and the name of the attribute.

    rename() - This syscall renames a file.

    request_key() - Keys can be retrieved from the kernel's key-ring by using this system call.

    restart_syscall() - Sometimes, syscalls are temporarily paused by a stop signal (typically SIGSTOP). To resume such syscalls, use restart_syscall().


    rmdir() - Empty directories can be deleted with rmdir().

    rt_sigqueueinfo(), rt_tgsigqueueinfo() - A signal and data are sent to the specified process using one of these system calls. Both of these calls are the same, but they differ in the accepted parameters. rt_sigqueueinfo() needs to know the tgid (Thread Group ID) while rt_tgsigqueueinfo() needs to know both the tgid and tid (Thread ID).

    sigaction() - Signals sent to processes may need to be modified. This kernel call allows the calling process to change the desired result of a signal sent to a process.

    sigpending() - This syscall allows the calling process to view pending signals.

    sigprocmask() - This kernel call allows the calling process to view its masked signals.

    NOTE: Masked signals are signals that are blocked.

    sigsuspend() - This syscall is used to pause a process.

    sched_get_priority_max(), sched_get_priority_min() - Every scheduling policy (or scheduling algorithm) has a set priority range. These two syscalls return the maximum and minimum priority numbers (respectively) accepted by a policy.

    sched_setaffinity(), sched_getaffinity() - The CPU affinity (CPU pinning) of a thread can be set or viewed with these syscalls, respectively. CPU affinity assigns a thread or process to a processor. For instance, on systems with multiple processors, processes and threads may not be processed by many CPU chips at once. Instead, code may stay with one CPU.

    sched_setparam(), sched_getparam() - These syscalls allow the parameters of a schedule to be set and viewed for a process specified by its PID.

    sched_setscheduler(), sched_getscheduler() - With a given PID, a processes scheduling policy (algorithm) can be set or viewed.

    sched_yield() - The calling process will be placed at the end of the processor's task queue.

    select() - This is another syscall used to monitor multiple file descriptors so that an IO task can be performed on the next available descriptor.

    send(), sendto(), and sendmsg() - These syscalls perform nearly the same task, but they each have a slightly different method of functioning. send() is the same as write() except that the system call accepts flags while write() cannot. These send syscalls all use sockets, but different arguments.

    sendfile() - This syscall copies data from one file descriptor to another. This is a faster way to copy files since this action is performed within the kernel. Most tasks completed in the kernel space complete faster than they do in the userspace.

    FUN FACT: Are you wondering how many system calls are being made on your system right now? To figure out how many system calls are made per second system wide (on all processors), use the vmstat command and look at the “sy” column. For my system at the time of executing vmstat, I had five system calls running.

    vmstat.png

    sendmmsg() - More than one message can be sent down a socket using this kernel call. Most message-sending syscalls can only send one message down a socket at a time.

    set_mempolicy() - This syscall is used by the calling process to change their NUMA-memory policy.

    set_thread_area() - This syscall writes an entry on the local storage array of a thread (TLS = Thread Local Storage).

    set_tid_address() - A pointer is created by this kernel call that points to the specified TID (Thread ID).

    setdomainname() - This syscall sets the domain name and saves it as an array with each character in their own field. This value can be retrieved with getdomainname().

    setfsgid() - This kernel call changes the FileSystem Group ID (FSGID) which is a GID used when accessing network filesystems.

    setfsuid() - setfsuid() is a lot like setfsgid() except that setfsuid() changes the User ID (UID).

    setgid() - The calling process is given a Group ID.

    setgroups() - The supplementary Group IDs are set for the calling process.

    sethostname() - The hostname is set in the form of an array with one character per field.

    setns() - A thread can be given a namespace by using this syscall.

    setpgid() - The GID of a process is set with this kernel call.

    setpriority() - The schedule priority of a process is set.

    setreuid(), setregid() - These syscalls set the real and effective User or Group IDs.

    setresuid(), setresgid() - These two syscalls are like their equivalent kernels calls above, but with the additional ability to set the Saved-User-ID (SUID) or Saved-Group-ID (SGID).

    setrlimit() - A resource limit is set with this kernel call.

    There are some more syscalls to be discussed. We are almost done.

    SNEAK PEEK: After syscalls, we will discuss the different types of ID, like PID, GUID, and many other that I hope you never heard about. (I have also been getting some ideas from the readers that email me {I give thanks to those readers.})

    Attached Files:

    Last edited: May 11, 2014

Share This Page