Linux 系统调用号

本文介绍了Linux系统在x86平台上的32位和64位系统调用号,详细列出了它们在不同头文件的位置,分别是unistd_32.h和unistd_64.h。
摘要由CSDN通过智能技术生成

1、 x86平台32位Linux系统调用号

位置 : include/asm-x86/unistd_32.h

#define __NR_restart_syscall      0
#define __NR_exit         1
#define __NR_fork         2
#define __NR_read         3
#define __NR_write        4
#define __NR_open         5
#define __NR_close        6
#define __NR_waitpid          7
#define __NR_creat        8
#define __NR_link         9
#define __NR_unlink      10
#define __NR_execve      11
#define __NR_chdir       12
#define __NR_time        13
#define __NR_mknod       14
#define __NR_chmod       15
#define __NR_lchown      16
#define __NR_break       17
#define __NR_oldstat         18
#define __NR_lseek       19
#define __NR_getpid      20
#define __NR_mount       21
#define __NR_umount      22
#define __NR_setuid      23
#define __NR_getuid      24
#define __NR_stime       25
#define __NR_ptrace      26
#define __NR_alarm       27
#define __NR_oldfstat        28
#define __NR_pause       29
#define __NR_utime       30
#define __NR_stty        31
#define __NR_gtty        32
#define __NR_access      33
#define __NR_nice        34
#define __NR_ftime       35
#define __NR_sync        36
#define __NR_kill        37
#define __NR_rename      38
#define __NR_mkdir       39
#define __NR_rmdir       40
#define __NR_dup         41
#define __NR_pipe        42
#define __NR_times       43
#define __NR_prof        44
#define __NR_brk         45
#define __NR_setgid      46
#define __NR_getgid      47
#define __NR_signal      48
#define __NR_geteuid         49
#define __NR_getegid         50
#define __NR_acct        51
#define __NR_umount2         52
#define __NR_lock        53
#define __NR_ioctl       54
#define __NR_fcntl       55
#define __NR_mpx         56
#define __NR_setpgid         57
#define __NR_ulimit      58
#define __NR_oldolduname     59
#define __NR_umask       60
#define __NR_chroot      61
#define __NR_ustat       62
#define __NR_dup2        63
#define __NR_getppid         64
#define __NR_getpgrp         65
#define __NR_setsid      66
#define __NR_sigaction       67
#define __NR_sgetmask        68
#define __NR_ssetmask        69
#define __NR_setreuid        70
#define __NR_setregid        71
#define __NR_sigsuspend      72
#define __NR_sigpending      73
#define __NR_sethostname     74
#define __NR_setrlimit       75
#define __NR_getrlimit       76 /* Back compatible 2Gig limited rlimit */
#define __NR_getrusage       77
#define __NR_gettimeofday    78
#define __NR_settimeofday    79
#define __NR_getgroups       80
#define __NR_setgroups       81
#define __NR_select      82
#define __NR_symlink         83
#define __NR_oldlstat        84
#define __NR_readlink        85
#define __NR_uselib      86
#define __NR_swapon      87
#define __NR_reboot      88
#define __NR_readdir         89
#define __NR_mmap        90
#define __NR_munmap      91
#define __NR_truncate        92
#define __NR_ftruncate       93
#define __NR_fchmod      94
#define __NR_fchown      95
#define __NR_getpriority     96
#define __NR_setpriority     97
#define __NR_profil      98
#define __NR_statfs      99
#define __NR_fstatfs        100
#define __NR_ioperm     101
#define __NR_socketcall     102
#define __NR_syslog     103
#define __NR_setitimer      104
#define __NR_getitimer      105
#define __NR_stat       106
#define __NR_lstat      107
#define __NR_fstat      108
#define __NR_olduname       109
#define __NR_iopl       110
#define __NR_vhangup        111
#define __NR_idle       112
#define __NR_vm86old        113
#define __NR_wait4      114
#define __NR_swapoff        115
#define __NR_sysinfo        116
#define __NR_ipc        117
#define __NR_fsync      118
#define __NR_sigreturn      119
#define __NR_clone      120
#define __NR_setdomainname  121
#define __NR_uname      122
#define __NR_modify_ldt     123
#define __NR_adjtimex       124
#define __NR_mprotect       125
#define __NR_sigprocmask    126
#define __NR_create_module  127
#define __NR_init_module    128
#define __NR_delete_module  129
#define __NR_get_kernel_syms    130
#define __NR_quotactl       131
#define __NR_getpgid        132
#define __NR_fchdir     133
#define __NR_bdflush        134
#define __NR_sysfs      135
#define __NR_personality    136
#define __NR_afs_syscall    137 /* Syscall for Andrew File System */
#define __NR_setfsuid       138
#define __NR_setfsgid       139
#define __NR__llseek        140
#define __NR_getdents       141
#define __NR__newselect     142
#define __NR_flock      143
#define __NR_msync      144
#define __NR_readv      145
#define __NR_writev     146
#define __NR_getsid     147
#define __NR_fdatasync      148
#define __NR__sysctl        149
#define</
### 回答1: Linux系统调用是指操作系统提供给用户程序调用的接口函数的编。每个系统调用都有一个唯一的调用,用于标识该函数。在Linux中,系统调用是通过一个整数来表示的,不同的系统调用对应不同的整数值。用户程序可以通过系统调用调用相应的系统调用,从而实现对操作系统的各种功能的访问和控制。常见的Linux系统调用包括open、read、write、close、fork、execve等。 ### 回答2: Linux系统调用是一个唯一的标识符,用于标识操作系统提供给用户程序调用的各种功能和服务。通过系统调用,用户程序可以请求操作系统执行特定的操作,如打开文件、创建进程、读取网络数据等。 在Linux中,每个系统调用都有一个特定的码,这个码是由操作系统内核分配的。这些码是在系统的头文件中定义的,例如unistd.h文件中包含了系统调用的定义。 系统调用调用系统调用时使用,用户程序可以使用相关的系统调用接口来执行操作系统提供的功能。用户程序通常会使用C语言的库函数封装系统调用,以提供更方便的接口给开发者使用。 系统调用的分配通常是由操作系统的开发者决定的,他们会根据不同的功能和服务进行划分和分配。在Linux中,常见的系统调用包括打开文件(open)、读取文件(read)、写入文件(write)、关闭文件(close)等。 系统调用的使用可以在用户程序中通过系统调用指令实现,用户程序将需要执行的系统调用存放在相应的寄存器中,并调用int 0x80或sysenter指令触发系统调用。 总之,Linux系统调用是一种用于标识和调用操作系统功能的机制,它允许用户程序直接访问操作系统提供的各种服务和功能。这种机制使得用户程序可以与操作系统交互,实现更加强大和灵活的应用程序开发。 ### 回答3: Linux系统调用是用于在用户空间程序和内核空间之间进行交互的接口标识符。当用户空间程序需要执行某些操作时,如创建进程、读写文件、网络通信等,就会调用相应的系统调用系统调用是一个整数,每个系统调用都有一个唯一的码与之对应。Linux内核通过系统调用来识别用户空间程序请求的具体操作。系统调用由内核定义并存储在一个表中,用户程序通过中断指令或软中断指令触发系统调用,将调用传递给内核。 对于不同的操作,有不同的系统调用。例如: 1. 创建进程的系统调用是`fork`,对应的调用是2; 2. 打开文件的系统调用是`open`,对应的调用是5; 3. 写入文件的系统调用是`write`,对应的调用是1; 4. 进程退出的系统调用是`exit`,对应的调用是60。 用户程序通过指定正确的系统调用,将自己的请求传递给内核。内核收到请求后,根据调用执行相应的操作,完成后再返回结果给用户程序。系统调用的定义与使用遵循一定的规范,保证了用户程序与内核之间的正确通信和操作,是Linux系统中非常重要的一个概念。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值