This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Get the real system call wrappers
- From: Yubin Ruan <ablacktshirt at gmail dot com>
- To: libc-help at sourceware dot org
- Date: Sat, 19 Aug 2017 22:34:48 +0800
- Subject: Get the real system call wrappers
- Authentication-results: sourceware.org; auth=none
Hi,
How can I get the complete glibc system call wrappers?
I know that glibc implement most system call wrappers but they are not
exposed explicitly in the glibc source. Rather, the complete system
call wrappers are generated on the fly when glibc is built, probably
using some scripts. For example, the "open(2)" system call is now
defined in io/open.c:
29 __libc_open (const char *file, int oflag)
30 {
31 int mode;
32
33 if (file == NULL)
34 {
35 __set_errno (EINVAL);
36 return -1;
37 }
38
39 if (__OPEN_NEEDS_MODE (oflag))
40 {
41 va_list arg;
42 va_start(arg, oflag);
43 mode = va_arg(arg, int);
44 va_end(arg);
45 }
46
47 __set_errno (ENOSYS);
48 return -1;
49 }
50 libc_hidden_def (__libc_open)
51 weak_alias (__libc_open, __open)
52 libc_hidden_weak (__open)
53 weak_alias (__libc_open, open)
54
55 stub_warning (open)
56
57 /* __open_2 is a generic wrapper that calls __open.
58 So give a stub warning for that symbol too. */
59 stub_warning (__open_2)
After some replacement (I guess), we will get a complete open(2)
system call wrapper.
But all methods I found on the web to generate the complete wrappers
seem to be obsolete (can't find those scripts). Do I have to built the
whole glibc completely to obtain those? Or is there any lightweight
method?
Thanks,
Yubin