Re: open() magicary?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks,

What I learned was if flag contain O_CREAT, you should be supplying a 
mode argument (I also learned that I should read man pages more 
carefully :). Otherwise mode gets some garbage. What confused me was 
Linux man pages, Solaris man page gives the declaration as
open(char *path, int flags, ...)



Seth Arnold wrote:

> On Thu, Nov 22, 2001 at 07:11:07AM +0000, Muzaffer Ozakca wrote:
> 
>>As you know, there are 2 different open() calls:
>>
>>a) open(char *path, int flags, mode_t mode)
>>b) open(char *path, int flags)
>>
> 
> This was bothering me too; luckily, I managed to corner phillips and
> hald about this. The gist is: in fcntl.h (glibc)
> 
> extern int open (__const char *__file, int __oflag, ...) __THROW;
> 
> It surprised me to learn that open() is actually using the varargs
> stuff, the same as printf(). (Don't ask me why, but I always figure
> varargs is going to break *something* horribly... :)
> 
> cdub chimed in, and said the definitions could be found in glibc source
> with file names such as "sysdeps/generic/open.c". I didn't poke around
> too much, but that seems to be the case. :)
> 
> Cheers!
> 
> 


-- 
Muzaffer Ozakca
Researcher/Software Engineer  -  muzaffer.ozakca@bilten.metu.edu.tr
TUBITAK-Bilten-ODTU - Communication Systems and Comp. Networks Group
ODTU, Ankara, Turkey
http://www.bilten.metu.edu.tr/   tel: +90-312-210 1311

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux