rishiba/doc_syscalls

How __libc_open calls __open_nocancel

Opened this issue · 0 comments

Good job!

From the chapter "Setting Up Arguments"1, it is stated that:

From the objdump we saw that __libc_open was called. This called
__open_nocancel and it had a syscall instruction.

however I check the source code of __libc_open2 and found that __libc_open()
does not directly call __open_nocancel():

26 /* Open FILE with access OFLAG. If O_CREAT or O_TMPFILE is in OFLAG,
27 a third argument is the file protection. */
28 int
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)

I note previously that there are some scripts used to handle this when
building glibc, but never be able to see how this go through (cannot get its
intermediate form). Do you know how to do that?

    Yubin