Linux System API

Source: Internet
Author: User

The following is a list of Linux system calls that contain most of the common system calls and functions derived from system calls. This is probably the only list of Linux system calls you can see on the Internet, even if it's a simple alphabetical list, it's very rare to be able to do so completely.

By convention, this list is modelled on the Man Pages section 2nd, the System invocation section. According to the author's understanding, the general classification, but also made some minor changes, deleted a few for the kernel, not allow users to call the system calls, the individual I slightly feel inappropriate place made some minor changes, and all listed system calls attached a brief comment.

Some of these functions work exactly the same way, except for different parameters. (maybe a lot of familiar C + + friends can immediately associate with the function overload, but do not forget that the Linux core is written in C, so it can only be used for different function names). Some of the functions are obsolete, replaced by new better functions (GCC warns when linking these functions), but because of the reasons for compatibility, these functions will be marked with "*" on the front.

First, Process Control:
Fork Create a new process
Clone Create child processes by specified criteria
Execve Run the executable file
Exit Abort process
_exit Abort Current process immediately
Getdtablesize Maximum number of files that the process can open
Getpgid Gets the specified process group identification number
Setpgid Sets the specified process group flag number
Getpgrp Gets the current process group identification number
Setpgrp Set the current Process group flag number
Getpid Get process identification number
Getppid Gets the parent process identification number
GetPriority Get scheduling priority
SetPriority Set scheduling priority
Modify_ldt Local description table for read and write processes
Nanosleep Make process sleep Specify the time
Nice Change the priority of the time-sharing process
Pause Suspend process, wait for signal
Personality Set process Run domain
Prctl To perform specific actions on a process
Ptrace Process tracking
Sched_get_priority_max Get the upper limit of the static priority
Sched_get_priority_min Get the lower bound of the static priority
Sched_getparam Get scheduling parameters for a process
Sched_getscheduler Gets the scheduling policy for the specified process
Sched_rr_get_interval Get the time slice length of real-time process scheduled by RR algorithm
Sched_setparam Set scheduling parameters for a process
Sched_setscheduler To set scheduling policies and parameters for a specified process
Sched_yield The process proactively yields the processor and waits for the queue to dispatch itself
Vfork Create a sub-process for executing new programs, often with EXECVE, etc.
Wait Wait for the child process to terminate
Wait3 See wait
Waitpid Waits for the specified child process to terminate
Wait4 See Waitpid
Capget Get Process Permissions
Capset Set process Permissions
GetSID Get a meeting identification number
Setsid Set up meeting identification number



Back to top of page

Second, file system control 1, file read and write operation
Fcntl File control
Open Open File
creat Create a new file
Close Close File Description Word
Read Read the file
Write Write a file
Readv Reading data from a file into a buffer array
Writev Writes the data in the buffer array to the file
Pread Random Read of files
Pwrite Random Write to File
Lseek Move file pointer
_llseek Move the file pointer in the 64-bit address space
Dup Copy an open file description word
Dup2 Copy a file description word by specified criteria
Flock File Add/Unlock
Poll I/o multi-channel conversion
Truncate Truncate file
Ftruncate See truncate
Umask Set File Permission Mask
Fsync Write the file back to disk in the memory section
2. File System operation
Access Determining the accessibility of a file
ChDir Change the current working directory
Fchdir See ChDir
chmod Change file Mode
Fchmod See chmod
Chown Change the owner or user group of a file
Fchown See Chown
Lchown See Chown
Chroot Changing the root directory
Stat Fetching File status information
Lstat See Stat
Fstat See Stat
Statfs Fetching File System Information
Fstatfs See Statfs
Readdir Reading directory entries
Getdents Reading directory entries
Mkdir Create a Directory
Mknod Create an index node
RmDir Delete Directory
Rename File renaming
Link Create a link
Symlink Creating Symbolic Links
Unlink Delete link
Readlink Read the value of a symbolic link
Mount Installing the file system
Umount Removing the file system
Ustat Fetching File System Information
Utime Change the file's access modification time
Utimes See Utime
Quotactl Controlling disk quotas



Back to top of page

Third, System control
Ioctl I/O Total control function
_sysctl Read/write system parameters
Acct Enable or disable process accounting
Getrlimit Get System Resource Cap
Setrlimit Set System Resource Caps
Getrusage Get System Resource Usage
Uselib Select the binary library you want to use
Ioperm Set Port I/O permissions
Iopl Change the process I/O permission level
Outb Low-level port operation
Reboot Restart
Swapon Open swap files and devices
Swapoff Close swap files and devices
Bdflush Controlling the Bdflush daemon
Sysfs File system type supported by core
SysInfo Get System Information
Adjtimex Adjusting the system clock
Alarm Set the alarm for a process
Getitimer Get timer value
Setitimer Set Timer value
Gettimeofday Take time and time zone
Settimeofday Set time and time zone
Stime Set the system date and time
Time Get system time
Times Take process run time
Uname Get information about the name, version, and host of the current UNIX system
Vhangup Suspend current terminal
Nfsservctl Controlling the NFS Daemon
Vm86 Enter analog 8086 mode
Create_module To create a loadable module item
Delete_module To delete a loadable module item
Init_module Initializing the module
Query_module Querying module information
Iv. Memory Management
Brk Change the allocation of data segment space
Sbrk See BRK
Mlock Memory page Lock
Munlock Memory Pages Unlocked
Mlockall Call Process all memory page lock
Munlockall Call Process all memory page unlocked
Mmap Mapping Virtual Memory Pages
Munmap removing memory page mappings
Mremap Remap Virtual memory addresses
Msync Write data from mapped memory back to disk
Mprotect Set Memory image protection
GetPageSize Get page size
Sync Write memory buffer data back to the hard disk
Cacheflush Writes the contents of the specified buffer back to disk



Back to top of page

Five, network management
Getdomainname Take domain
Setdomainname Set the domain name
Gethostid Get host identification number
Sethostid Set the host identification number
GetHostName Get the host name
SetHostName Set host name



Back to top of page

Six, Socket control
Socketcall Socket system Call
Socket Creating sockets
Bind Bind socket to Port
Connect Connecting to a remote host
Accept Responding to a socket connection request
Send Send message via socket
SendTo Send UDP message
Sendmsg See Send
Recv Receiving information through the socket
Recvfrom Receiving UDP information
Recvmsg See recv
Listen Monitor socket port
Select Polling for multi-channel synchronous I/O
Shutdown Close the connection on the socket
GetSockName Get the local socket name
Getpeername Get the socket name of the communication partner
GetSockOpt Fetch Port Settings
SetSockOpt Setting Port Parameters
Sendfile Transferring data between files or ports
Socketpair Create a pair of nameless sockets that have been joined



Back to top of page

VII. User Management
Getuid Get the User ID number
Setuid Set User flag number
Getgid Get group identification number
Setgid Set the group flag number
Getegid Get Valid group identification number
Setegid Set Valid group identification number
Geteuid Get a valid user identification number
Seteuid Set a valid user identification number
Setregid Set a real and valid group identification number, respectively
Setreuid Set a real and valid user identification number separately
Getresgid Get real, valid, and saved group identification numbers, respectively
Setresgid Set the actual, valid, and saved group identification numbers separately
Getresuid Get real, valid, and saved user identification numbers, respectively
Setresuid Set up real, valid, and saved user identification numbers, respectively
Setfsgid Set the group identification number to use when setting up file system checks
Setfsuid Set the user identification number used when file system checks
GetGroups Get list of post-complement group flags
Setgroups Set up post-complement Group flag list
VIII. Inter-process communication
Ipc Inter-process communication total Control call



1. Signal
Sigaction Set the processing method for the specified signal
Sigprocmask Operation of blocking/unblocking of signals in signal set according to parameters
Sigpending Sets the queue for the specified blocked signal
Sigsuspend Suspend process waits for a specific signal
Signal See Signal
Kill Signaling to a process or process group
*sigblock Adds a signal to the blocked signal mask that has been replaced by Sigprocmask
*siggetmask Get an existing blocking signal mask that has been replaced by Sigprocmask
*sigsetmask Replacing an existing blocking signal mask with a given signal mask, replaced by Sigprocmask
*sigmask Converts a given signal to a mask that has been replaced by Sigprocmask
*sigpause function with Sigsuspend, has been replaced by sigsuspend
Sigvec For BSD-compliant signal processing functions, similar to Sigaction
Ssetmask The signal processing function of ANSI C, acting like sigaction



2. Message
Msgctl Message control operations
Msgget Get Message Queuing
Msgsnd Send Message
Msgrcv Cancellation interest



3. Pipeline
Pipe Creating pipelines



4. Signal Volume
Semctl Signal Volume Control
Semget Get a set of semaphores
Semop Semaphore operation



5. Shared Memory
Shmctl Controlling shared memory
Shmget Get shared memory
Shmat Connecting shared memory
Shmdt removing shared memory
Resources
    • Linux Mans pages
    • Advanced programming in the UNIX environment, W. Richard Stevens, 1993

Linux System API

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.