diff options
-rw-r--r-- | include/dirent.h | 5 | ||||
-rw-r--r-- | lib/libc/gen/Makefile.inc | 4 | ||||
-rw-r--r-- | lib/libc/gen/dirfd.c | 12 |
3 files changed, 18 insertions, 3 deletions
diff --git a/include/dirent.h b/include/dirent.h index 6e6cf55f847..c59fc1e0461 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dirent.h,v 1.24 2011/07/18 17:29:49 matthew Exp $ */ +/* $OpenBSD: dirent.h,v 1.25 2012/03/22 01:13:40 matthew Exp $ */ /* $NetBSD: dirent.h,v 1.9 1995/03/26 20:13:37 jtc Exp $ */ /*- @@ -119,6 +119,9 @@ int scandir(const char *, struct dirent ***, int (*)(struct dirent *), int (*)(const void *, const void *)); int alphasort(const void *, const void *); #endif +#if __POSIX_VISIBLE >= 200809 || __XPG_VISIBLE > 600 +int (dirfd)(DIR *); +#endif __END_DECLS #endif /* !_KERNEL */ 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); +} |