From 94e5217d0898f0f0f661d8f3e79627025ee9295d Mon Sep 17 00:00:00 2001 From: matthew Date: Thu, 22 Mar 2012 01:13:40 +0000 Subject: 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 --- lib/libc/gen/Makefile.inc | 4 ++-- lib/libc/gen/dirfd.c | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 lib/libc/gen/dirfd.c (limited to 'lib/libc') 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 + +int +(dirfd)(DIR *dirp) +{ + return (dirp->dd_fd); +} -- cgit v1.2.3-59-g8ed1b