The Linux Kernel: System Calls S-T

D

DevynCJohnson

Guest
Series Index - http://www.linux.org/threads/linux-kernel-reading-guide.5384/

Aloha and welcome to the next system call article. Most of these calls in this article will probably be more easily understood than most we have discussed.

setsid() - The process group ID and session ID of the calling process are set to the PID of the calling process.

setsockopt() - Options for a specified socket are set using this syscall.

settimeofday() - The timezone and time are set via settimeofday().

setuid() - The User ID (UID) is set with this call.

setup() - This deprecated syscall was once used to prepare devices and filesystems on the system and mount the root filesystem.

setxattr() - Extended attributes are set using this kernel call.

shutdown() - Many of you may think this system call shuts down the system. Well, guess what? It does not. Rather, this system call closes a socket or at least part of the socket.

NOTE: reboot() is the system call that reboots or powers off the system.

sigaction() - Signals can be viewed and changed with this syscall.

signalfd() - Signals can be accepted by a process via a file descriptor. However, such a file descriptor must be created first using this syscall.

sigpending() - The calling thread can view pending signals coming to it using this syscall.

sigprocmask() - A process's blocked signals can be changed via sigprocmask().

socket() - The commonly discussed sockets are created with this syscall. A socket is a named pipe with additional abilities. The sockets commonly discussed in these syscall articles are sometimes called Unix Domain Sockets.

socketpair() - A pair of sockets are created using this system call.

splice() - Sockets can be spliced either for input or output.

stat() - This syscall returns the "status" of a file. The "status" is information such as the number of blocks owned by the file, the IDs of the owning group and owner, the storage device's ID, file size, number of hardlinks, and a few other pieces of information.

statfs() - Use this kernel call to get the "status" of a filesystem. Such status includes the number of free and total blocks, filesystem type, and other information pertaining to the filesystem itself.

stime() - This syscall sets the time in seconds since January 1st, 1970 (epoch).

subpage_prot() - Pages can be divided into subpages on memory. This system call allows permissions to be set to specific subpages, but only on PowerPC processors.

NOTE: Remember that blocks are to hard-drives as pages are to memory.

swapon() and swapoff() - These kernel calls turn the swap area on and off, respectively. Turning swap off may be done when the admin is changing its size on a live/active system or for various other reasons.

symlink() - Shortcuts (or soft-links) are made using this system call.

sync() - When files are changed, the edits are held in memory. The changes are written to the hard-drive after the sync() call is executed.

syncfs() - Like sync(), syncfs() causes changes to be written to the storage unit. However, only one file is changed while sync() tells all modifications to be written.

sync_file_range() - Like syncfs(), not all synchronizations are executed. However, only a portion of a single file is synchronized with the memory.

NOTE: When you make changes to a file (like opening a text file in Gedit), the changes are held in the buffer cache on memory.

sysfs() - Information about the current/present filesystems can be viewed with this syscall.

sysinfo() - An overview of the systems information (system statistics or sys stats) can be viewed with sysinfo(). Specifically, this data contains various memory space info, time since booting, buffer data, and some other helpful information.

syslog() - Kernel messages are viewed by syslog() which is also the system call that gives syslogd (a daemon) the data it places into logs.

tee() - The "tee" command used in shells is a system call that splits a pipe into two data pipes.

tgkill() - Many users are aware that kill() kills a process, but few people know that individual threads can be killed. Such a task can be done with the syscall tgkill().

time() - The current system time will be returned by the syscall in the form of seconds since January 1st, 1970.

NOTE: January 1st, 1970 is commonly referred to as "The Epoch". Now, when you read about some software (like a syscall) returning time in seconds since the Epoch, you know that that is what it means.

timer_create() - This syscall creates a per-process timer, which is a timer for each process.

timer_delete() - Timers can be deleted via timer_delete().

NOTE: Timers are identified by "timerid".

timer_getoverrun() - This syscall is used for expiration notices (like stating a backup is three days late). This call calculates the time interval between the time the timer was due up to the time timer_getoverrun() is called. This time range is the overrun.

timer_gettime() and timer_settime() - These syscalls allow the time on timers to be set or viewed.


We are almost done discussing system calls. As you have probably noticed, system calls are very important in managing some common tasks (like time and system logs). Other system calls (like tee()) are used like commands in a terminal. Then, there are the system calls that only the kernel can use (like setup()). All of these kernel call work together to give the user a functioning system.

Further Reading
 

Attachments

  • slide.JPG
    slide.JPG
    104.2 KB · Views: 42,215
Last edited:

Members online


Top