Closed. This question is off-topic. It is not currently accepting answers. Learn more
想改进这个问题吗?Update the question所以堆栈溢出的值小于aa>。
四年前关闭。
我发现glibc在mmap.S中有mmap,代码如下:
...
movl 20(%esp), %ebx
cfi_rel_offset (ebx, 8)
movl 24(%esp), %ecx
movl 28(%esp), %edx
movl 32(%esp), %esi
cfi_rel_offset (esi, 4)
movl 36(%esp), %edi
cfi_rel_offset (edi, 0)
movl 40(%esp), %ebp
cfi_rel_offset (ebp, 12)
testl $0xfff, %ebp
movl $-EINVAL, %eax
jne L(skip)
shrl $12, %ebp               /* mmap2 takes the offset in pages.  */

movl $SYS_ify(mmap2), %eax  /* System call number in %eax.  */

ENTER_KERNEL                /* Do the system call trap.  */

...

看起来mmap2的真正部分在内核中。那么在哪里可以找到它的源代码呢?

最佳答案

你可以从这里开始挖掘:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/mm/mmap.c
SYSCALL_定义搜索。

关于linux - 在哪里可以找到mmap(系统调用)的源代码? ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/33601847/

10-10 14:13