The Linux Kernel: System Calls G-M

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

  1. DevynCJohnson

    DevynCJohnson Well-Known Member Staff Member Staff Writer

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

    Okay, here we have more system calls to discuss.

    getrusage() - The amount of resources used by the specified process is given by this syscall.

    getsid() - This returns the session ID. "sid" stands for Session ID.

    getsockname() - The address (name) of the socket is returned by this kernel call.

    getsockopt() - The options for a specified socket is listed by getsockopt().

    gettid() - The TID of a thread can be seen with this syscall. TID stands for thread identification.

    gettimeofday() - The current time and timezone can be seen with this call.

    getxattr() - With a given inode, this system call retrieves the extended attributes associated with the inode.

    NOTE: Extended attributes are attributes not normally supported by the filesystem.

    init_module() - Kernel modules are loaded with this syscall. This system call loads the module into the kernel space and then performs other needed tasks to prepare the module for runtime.

    inotify_add_watch() - Given a file-path, this syscall creates or modifies an inotify watch.

    inotify_init() - After an inotify watch is created, it must be started via inotify_init().

    inotify_rm_watch() - When an inotify watch is no longer needed, this syscall removes the watch specified by a watch descriptor (wd). When watches are made with inotify_init(), the wd is given.

    io_cancel() - Asynchronous IO tasks are canceled with this syscall.

    io_destroy() - Instead of canceling asynchronous IO tasks, they can be destroyed, meaning all asynchronous IO tasks associated with the given identifier will be canceled.

    io_getevents() - The asynchronous IO events listed in the completion queue can be seen with this syscall.

    io_setup() - Asynchronous IO contexts are made using io_setup().

    io_submit() - To queue asynchronous IO blocks, use this kernel call.

    ioctl() - With a file descriptor for a device-file, the device's parameters can be changed.

    ioperm() - The IO permission of ports are set with this call.

    iopl() - This kernel call changes the IO privilege level of the process that executed this call.

    ioprio_get() - The priority and IO scheduling class of threads can be seen with this call. This call can return this information for one or multiple threads.

    ioprio_set() - The priority and IO scheduling class of a thread can be set with this call.

    ipc() - To execute System V IPC system calls, the Linux kernel uses ipc() to start a System V IPC call. Not all architectures support ipc(). For instance, this call is not seen in ARM systems. Obviously, when making cross-platform software, do not use ipc().

    kcmp() - With two PIDs, this system call can identify what kernel resources (if any) are shared between two processes.

    kexec_load() - This syscall sets up a kernel to be executed after the next reboot. This is useful for running a diagnostic kernel after a system crash.


    keyctl() - Changes to the key management facility of the kernel is made via keyctl().

    kill() - A kill signal is sent to the specified process. As you may have noticed, many system calls require a pid, file descriptor, or some other low-level (closer to the hardware/inner-workings) identification to know on what to do work. Since kill is like other syscalls, that is why it uses a pid. Yes, in a command-line users are using a system call (kill) to perform a low-level operation on the system.

    lgetxattr() - This is just like getxattr() except this system call is used on links to get the extended attributes of the link itself.

    link() - Hard links are created using link().

    listen() - This is the system call that listens for connections on a socket.

    lookup_dcookie() - Using a cookie, the full path of a directory entry can be seen. A cookie is a directory entry identifier.

    lremovexattr() - The extended attributes of a symbolic link can be removed. The extended attributes are untouched in the file to which the link points.

    lseek() - A file's offset is changed. This syscall identifies the file based on file descriptor (fd).

    lsetxattr() - This syscall sets extended attributes on links.

    lstat() - This call provides information about the specified link.

    madvise() - This system call is used by applications to give the kernel advice on how the application wishes to use memory. The kernel typically maps out memory as it is needed and as the kernel sees fit. The madvise() syscall comes form an application that can probably run more efficiently if its memory usage is managed in a particular way. Notice that the syscall is advice, meaning the kernel may disregard the application's request.

    mbind() - This syscall sets the NUMA memory policy.

    migrate_pages() - All of the memory pages belonging to the specified node will be moved to another node in memory.

    mincore() - This kernel call checks to ensure the needed pages of memory (a page of memory is like a block of data on a hard-drive) exist where they are expected. If memory is accessed but is missing, a page fault will result, thus causing some severe errors. Thanks to this syscall, such errors can be prevented when the syscall is used.

    mkdir() - This commonly known shell command is actually a system call that creates a directory. (You probably already knew that)

    mknod() - This syscall can make a file, device file, or a named pipe.

    mlock() - A specified portion of a processes virtual address space can be set to remain on the RAM and not go to the swap area. mlockall() is used to lock all of the virtual address space and munlock() and munlockall() can undo those syscalls.

    mmap() - This maps memory for processes. munmap() unmaps the memory.

    mount() - Here is another shell command that is actually a syscall. As you all may know, this mounts filesystems whether virtual (pseudo filesystems like tmpfs), real (ext4, fat32), network filesystems (NFS), files (iso files like DVD images).

    move_pages() - This is another syscall that moves pages, but this syscall moves the memory page-by-page rather than in bulk or whole nodes.

    mprotect() - This syscall changes the protection of the calling process's memory. In memory, "protection" is analogous (just like/equal) to permissions of files on hard-drives.

    mq_notify() - Processes can "subscribe" to certain system messages (notifications). This system call allows processes to do so to specific types of notifications in the message queue.

    mq_open() - POSIX message queues can be made or opened using this kernel call.

    mq_send() - Messages are sent to the message queue using this system call.

    mq_unlink() - Message queues can be deleted using this syscall.


    In the next article, we will continue discussing system calls.

    Attached Files:

    Last edited: May 11, 2014

Share This Page