2 ms·
Are you sure getpid() is doing a system call and not reading TLS?
by ajross 18y ago
Are you sure getpid() is doing a system call and not reading TLS?
- tptacek 18y agoWhat a great question! I just checked. Nope: Breakpoint 1, 0x96210c44 in getpid () (gdb) disp/i $eip 2: x/i $eip 0x96210c44 <getpid>: call 0x96210c49 <getpid+5> (gdb) stepi 0x96210c49 in getpid () 2: x/i $eip 0x96210c49 <getpid+5>: pop %ecx 0x96210c4a in getpid () 2: x/i $eip 0x96210c4a <getpid+6>: lea 0xa6427a3(%ecx),%ecx 0x96210c50 in getpid () 2: x/i $eip 0x96210c50 <getpid+12>: mov (%ecx),%eax 0x96210c52 in getpid () 2: x/i $eip 0x96210c52 <getpid+14>: test %eax,%eax 0x96210c54 in getpid () 2: x/i $eip 0x96210c54 <getpid+16>: jle 0x96210c57 <getpid+19> 0x96210c57 in getpid () 2: x/i $eip 0x96210c57 <getpid+19>: mov $0x14,%eax 0x96210c5c in getpid () 2: x/i $eip 0x96210c5c <getpid+24>: call 0x961e8cf4 <_sysenter_trap>