diff options
author | Matthew Dempsky <matthew@cvs.openbsd.org> | 2012-03-22 01:13:41 +0000 |
---|---|---|
committer | Matthew Dempsky <matthew@cvs.openbsd.org> | 2012-03-22 01:13:41 +0000 |
commit | 5355e6d8a9a2671b309e00cfdc851fb980d3a108 (patch) | |
tree | 5c816bcef13dbccca44509af8a074e8395120eb5 /lib | |
parent | fed1f899d0cef05aa0cc7a96d5e12ba1a53ee484 (diff) |
Add dirfd() as a function to libc per POSIX requirement; dirfd() macro
to be pruned later when DIR is made an opaque type.
ok guenther@; prodding by brad@ for VLC and other ports
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/gen/Makefile.inc | 4 | ||||
-rw-r--r-- | lib/libc/gen/dirfd.c | 12 |
2 files changed, 14 insertions, 2 deletions
diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc index de2874f3163..56eb0518850 100644 --- a/lib/libc/gen/Makefile.inc +++ b/lib/libc/gen/Makefile.inc @@ -1,11 +1,11 @@ -# $OpenBSD: Makefile.inc,v 1.55 2012/03/21 23:20:35 matthew Exp $ +# $OpenBSD: Makefile.inc,v 1.56 2012/03/22 01:13:40 matthew Exp $ # gen sources .PATH: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/gen ${LIBCSRCDIR}/gen SRCS+= alarm.c assert.c auth_subr.c authenticate.c \ basename.c clock.c closedir.c confstr.c ctermid.c ctype_.c \ - daemon.c devname.c dirname.c disklabel.c elf_hash.c err.c \ + daemon.c devname.c dirfd.c dirname.c disklabel.c elf_hash.c err.c \ errx.c errlist.c errno.c exec.c fnmatch.c fpclassify.c frexp.c \ fstab.c ftok.c fts.c ftw.c getbsize.c getcap.c getcwd.c \ getdomainname.c getgrent.c getgrouplist.c gethostname.c \ diff --git a/lib/libc/gen/dirfd.c b/lib/libc/gen/dirfd.c new file mode 100644 index 00000000000..5e3123c0fdc --- /dev/null +++ b/lib/libc/gen/dirfd.c @@ -0,0 +1,12 @@ +/* + * Written by Matthew Dempsky, 2011. + * Public domain. + */ + +#include <dirent.h> + +int +(dirfd)(DIR *dirp) +{ + return (dirp->dd_fd); +} |