Lniux system calls common functions

Source: Internet
Author: User
Tags close close create directory
A system call is a collection of all system calls implemented by the operating system, namely, application programming interfaces (APIS ). Is the interface between applications and systems.
The main function of the operating system is to create a good environment for application running. To achieve this, the kernel provides a series of kernel functions with predefined functions, it is presented to users through a group of System Call APIs. The system calls the application request to the kernel, calls the corresponding kernel function to complete the required processing, and returns the processing result to the application. If there is no system call or kernel function, you cannot write large applications.
Linux system calls include most common system calls and functions derived from system calls.
I. Process Control:
Fork creates a new process
Clone creates sub-processes based on specified conditions
Execve run executable files
Exit to stop the process
_ Exit: stop the current process immediately.
Maximum number of files that can be opened by the getdtablesize Process
Getpgid: obtains the ID of a specified process group.
Setpgid: Set the flag number of the specified process group
Getpgrp get the ID of the current process group
Setpgrp: Set the flag number of the current process group
Getpid
Getppid: Get the ID of the parent process
Getpriority get scheduling priority
Setpriority: set Scheduling Priority
Modify_ldt local description table of the read/write process
The time specified by nanosleep to sleep the process
Nice changes the priority of time-based processes
PAUSE Suspends the process and waits for a signal
Personality sets the process running domain
Prctl performs specific operations on the Process
Ptrace process tracing
Sched_get_priority_max obtains the maximum static priority.
Sched_get_priority_min obtains the lower limit of the static priority.
Sched_getparam obtains the scheduling parameters of a process.
Sched_getscheduler get the scheduling policy of the specified process
Sched_rr_get_interval gets the length of time slice of the real-time process scheduled by RR Algorithm
Sched_setparam
Sched_setscheduler set the Scheduling Policies and parameters of the specified process
The sched_yield process takes the initiative to let out the processor and waits for itself to be at the end of the scheduling queue
Vfork creates a sub-process for executing new programs. It is often used together with execve.
Wait waits for the sub-process to terminate
For more information about wait3, see wait.
Waitpid waits for the specified sub-process to terminate
For more information about wait4, see waitpid.
Capget
Capset sets process Permissions
Getsid
Setsid: set the meeting ID
Ii. File System Control
1. file read/write operations
Fcntl file control
Open File
Creat create a new file
Close close file description
Read a file
Write a file
Readv reads data from a file into a buffer Array
Writev writes data in the buffer array to a file.
Pread random File Read
Pwrite random write to files
Lseek move file pointer
_ Llseek move the file pointer in a 64-bit address space
DUP copies the description of an opened file.
Dup2 copies the file Description Based on specified conditions
Flock file addition/unlock
Poll I/O multiplexing
Truncate
For more information about ftruncate, see truncate.
Umask sets the File Permission mask
Fsync writes part of the file in the memory back to the disk
2. File System Operations
Access determines the file accessibility
Chdir changes the current working directory
For more information about fchdir, see chdir.
Chmod changes file Mode
For more information about fchmod, see CHMOD.
Chown changes the owner or user group of the file
For more information about fchown, see chown.
For more information about lchown, see chown.
Chroot changes the root directory
Stat obtains the File status information.
For lstat, see stat.
For fstat, see stat.
Statfs obtains the file system information
For more information about fstatfs, see statfs.
Readdir
Getdents reads directory items
Mkdir create directory
Mknod
Rmdir Delete directory
Rename file name
Link creation Link
Symlink
Unlink deletion Link
Readlink read symbolic link value
Mount the File System
Umount detaches the File System
Ustat obtains the file system information
Utime changes the file access modification time
For more information about utimes, see utime.
Quotactl controls the disk quota
Iii. System Control
Ioctl I/O Total Control Function
_ Sysctl read/write System Parameters
Enable or disable process accounting by Acct
Getrlimit
Setrlimit
Getrusage
Uselib: select the binary function library to use
Set port I/O permissions for ioperm
Iopl changes the process I/O permission level
Outb low-level port operations
Reboot restart
Swapon open swap files and devices
Swapoff disable swap files and devices
Bdflush controls the bdflush daemon
Sysfs obtains the file system types supported by the core.
Sysinfo
Adjtimex adjusts the system clock
Alarm sets the process's alarm clock
Getitimer get timer Value
Setitimer sets the timer Value
Gettimeofday: Time and time zone
Settimeofday
Stime: set the system date and time
Time gets the system time
Times obtains the running time of the process.
Uname: obtains the name, version, host, and other information of the current UNIX system.
Vhangup suspends the current terminal
Nfsservctl controls the NFS Daemon
Vm86 enters analog 8086 Mode
Create_module
Delete_module Delete the module items that can be loaded
Init_module initialization module
Query_module query module information
* Get_kernel_syms obtains the core symbol, which has been replaced by query_module.
Iv. Memory Management
BRK changes data segment space allocation
For more information about sbrk, see BRK.
Mlock Memory Page lock
Unlock the munlock Memory Page
Mlockall calls the process to lock all memory pages
Munlockall calls the process to unlock all memory pages
MMAP ing Virtual Memory Page
Munmap removes Memory Page ing
Mremap re-maps virtual memory addresses
Msync writes data in the ing memory back to the disk
Mprotect sets memory image protection
Getpagesize: Get the page size
Sync writes memory buffer data back to Hard Disk
Cacheflush writes the content in the specified buffer back to the disk.
V. Network Management
Getdomainname: Get Domain Name
Setdomainname: Set Domain Name
Gethostid
Sethostid: Set the host ID
Gethostname: Get the Host Name
Sethostname set Host Name
Vi. Socket Control
Socketcall Socket System Call
Socket establish socket
Bind the socket to the port
Connect to a remote host
Accept responds to socket connection requests
Send messages through socket
Sendto sends UDP messages
For sendmsg, see send
Recv receives information through socket
Recvfrom receives UDP Information
For recvmsg, see Recv
Listen listens to socket ports
Select Round Robin for multiple synchronous I/O
Shutdown to close the connection on the socket
Getsockname: Get the local socket name
Getpeername: Get the socket name of the contact.
Getsockopt port settings
Setsockopt
Sendfile transfers data between files or ports
Socketpair
VII. User Management
Getuid
Setuid
Getgid
Setgid
Getegid
Setegid
Geteuid
Seteuid
Setregid: Set the real and valid group ID numbers respectively.
Setreuid: Set the real and valid user ID numbers respectively.
Getresgid obtains the true, valid, and saved group ID respectively.
Setresgid: Set the true, valid, and saved group ID respectively.
Getresuid obtains the real, valid, and saved user ID numbers respectively.
Setresuid: Set the real, valid, and saved user ID respectively.
Setfsgid sets the group ID used for file system check
Setfsuid: Specifies the user ID used for file system check.
Getgroups
Setgroups
8. inter-process communication
IPC inter-process communication control call
1. Signal
Set the processing method for the specified signal in sigaction
Sigprocmask blocks/unblocks signals in the signal set based on parameters.
Sigpending sets a queue for the specified blocked Signal
Sigsuspend pending process waiting for specific signal
For more information about signal, see signal.
Kill sends a signal to a process or process group
* Sigblock adds a signal to the blocked signal mask, which has been replaced by sigprocmask
* Siggetmask obtains the existing blocking signal mask, which has been replaced by sigprocmask.
* Sigsetmask replaces the existing blocking signal mask with the given signal mask, which has been replaced by sigprocmask
* Sigmask converts the given signal into a mask, which has been replaced by sigprocmask
* Sigpause acts the same as sigsuspend and has been replaced by sigsuspend.
Sigvec is a signal processing function designed to be compatible with BSD. It works similar to sigaction.
Ssetmask ansi c signal processing function, similar to sigaction
2. Messages
Msgctl message control operation
Msgget get message queue
Msgsnd send message
Msgrcv
3. Pipelines
Pipe
4. semaphores
Semctl semaphore Control
Semget obtains a set of semaphores
Semop semaphore operation
5. Shared Memory
Shmctl controls shared memory
Shmget obtains the shared memory.
Shmat connection to shared memory
Remove shared memory from shmdt

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.