我找到了x86-64模式下系统调用列表(带参数):http://filippo.io/linux-syscall-table/。但是我在哪里可以获得这些系统调用的详细描述呢?
例如下面这个例子,除了0102o(读写,创建)之外,还有哪些标志可以用于“open”系统调用,在其他情况下:只读、只写等。
基于来源(可能是)https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/fs/open.c,如何理解它?可以使用哪些标志(open的所有标志列表)?
例如下面这个例子,除了0102o(读写,创建)之外,还有哪些标志可以用于“open”系统调用,在其他情况下:只读、只写等。
SECTION .data
message: db 'Hello, world!',0x0a
length: equ $-message
fname db "result"
fd dq 0
SECTION .text
global _start
_start:
mov rax, 2 ; 'open' syscall
mov rdi, fname ; file name
mov rsi, 0102o ; read and write mode, create if not
mov rdx, 0666o ; permissions set
syscall
mov [fd], rax
mov rax, 1 ; 'write' syscall
mov rdi, [fd] ; file descriptor
mov rsi, message ; message address
mov rdx, length ; message string length
syscall
mov rax, 3 ; 'close' syscall
mov rdi, [fd] ; file descriptor
syscall
mov rax, 60
mov rdi, 0
syscall
基于来源(可能是)https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/fs/open.c,如何理解它?可以使用哪些标志(open的所有标志列表)?
/usr/include/bits/fcntl.h
中,其中0102显然是O_RDWR | O_CREAT
(至少在Fedora 17-64中)。 - wallyk