ReviewRequest of a booklet on System Concepts

Yubin Ruan ablacktshirt at gmail.com
Tue Dec 26 14:19:58 EST 2017


On Tue, Dec 26, 2017 at 10:20:21AM +0530, Rishi Agrawal wrote:
> Hi All,
> 
> I have written this booklet http://sys.readthedocs.io/en/latest/ explaining
> some concepts related to "glibc and system calls ". This will be useful for
> the newbies who are learning Linux System Programming.
> 
> I request the members of the group to kindly review it once and let me know
> if anything is incorrect or can be written and explained in a better way.
> If someone wants to add more contents he/she can surely do by raising a
> "pull request" in the github repo.
> 
> My apologies if this is not the right group for it as I do not know of any
> other group with this level of expertise.

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_open[2] 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

[1]: https://sys.readthedocs.io/en/latest/doc/06_setting_up_arguements.html
[2]: https://code.woboq.org/userspace/glibc/io/open.c.html



More information about the Kernelnewbies mailing list