我正在浏览一些装配演示(在Mac上使用NASM,我对组装很陌生),并看到了这样的情况:
; read a byte from stdin
mov eax, 3 ; 3 is recognized by the system as meaning "read"
mov ebx, 0 ; read from standard input
mov ecx, variable ; address to pass to
mov edx, 1 ; input length (one byte)
int 0x80 ; call the k
我知道read是系统调用。但当我读到man 2 and man 3 of read时,它给出了不同的解释。因此,我怀疑read具有库函数和系统调用。在这种情况下,如果我在我的c程序中使用read,编译器是否会认为read as library function或system call,请解释一下这种混淆。
我想在glibc-2.14.1包中找到暂停和σ挂起的源文件。I grep包并找到文件sysdeps/posix/pause.c有函数暂停的定义,代码是
int
__libc_pause (void)
{
sigset_t set;
__sigemptyset (&set);
__sigprocmask (SIG_BLOCK, NULL, &set);
/* pause is a cancellation point, but so is sigsuspend.
So no need for anything special