unlinkat, symlinkat in wrong headers

Eric Blake ebb9@byu.net
Thu Dec 10 12:20:00 GMT 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Corinna Vinschen on 12/8/2009 3:42 AM:
> On Dec  8 00:05, Eric Blake wrote:
>> Per POSIX, unlinkat should be declared in <unistd.h>; but cygwin only declares 
>> it in <fcntl.h>:
>>
>> $ echo '#include <unistd.h>' | gcc -E - | grep unlink
>> int __attribute__((__cdecl__)) unlink (const char *__path );
>> $ echo '#include <fcntl.h>' | gcc -E - | grep unlink
>> extern int unlinkat (int, const char *, int);
>>
>> Likewise, symlinkat should be in <unistd.h>; but cygwin only declares it in 
>> <stdio.h>:
> 
> That's how it's defined in the Linux man pages.  Apparently I took that
> for granted since the declarations are actually in unistd.h, contrary to
> the man pages.  Dunno if we should really fix that for 1.7.1, but if you
> can come up with a patch for newlib ASAP...

I took the liberty of applying this, since it is cygwin-specific.  I also
fired off an email to the Linux man page maintainer.

2009-12-08  Eric Blake  <ebb9@byu.net>

	Fix some *at declarations.
	* libc/include/stdio.h (symlinkat): Move this...
	* libc/include/sys/_default_fcntl.h (unlinkat): ...and this...
	* libc/include/sys/unistd.h (symlinkat, unlinkat): ...here, to
	match POSIX.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkseWaEACgkQ84KuGfSFAYBDpQCffS/VmwdXh/1FGJ5W846iac6H
zSYAn0VHpIAnZZp6brFMv0YTmnsCMy3O
=GUox
-----END PGP SIGNATURE-----
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: newlib.patch44
URL: <http://sourceware.org/pipermail/newlib/attachments/20091210/593a202c/attachment.ksh>


More information about the Newlib mailing list