summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorraf <none@none>2007-10-24 14:14:53 -0700
committerraf <none@none>2007-10-24 14:14:53 -0700
commit289b68b2ec2b2c951db19012779e24a98f520cda (patch)
tree08c6ab7d0d80a65fa05ced8d6689eb71f5704d06 /usr/src
parent247dbb3dce2b3c91028d81f969cfcf2129562c36 (diff)
downloadillumos-gate-289b68b2ec2b2c951db19012779e24a98f520cda.tar.gz
PSARC 2007/592 dirfd
6614468 libc should provide a dirfd()
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/head/dirent.h11
-rw-r--r--usr/src/lib/common/inc/c_synonyms.h1
-rw-r--r--usr/src/lib/libc/inc/synonyms.h1
-rw-r--r--usr/src/lib/libc/port/gen/fdopendir.c9
-rw-r--r--usr/src/lib/libc/port/mapfile-vers2
5 files changed, 18 insertions, 6 deletions
diff --git a/usr/src/head/dirent.h b/usr/src/head/dirent.h
index b4e32d9719..56bbc4f018 100644
--- a/usr/src/head/dirent.h
+++ b/usr/src/head/dirent.h
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -19,15 +18,15 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
-
#ifndef _DIRENT_H
#define _DIRENT_H
@@ -102,6 +101,7 @@ extern DIR *opendir(const char *);
#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \
defined(_ATFILE_SOURCE)
extern DIR *fdopendir(int);
+extern int dirfd(DIR *);
#endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) ... */
#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX)
extern int scandir(const char *, struct dirent *(*[]),
@@ -139,6 +139,7 @@ extern DIR *opendir();
#if defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) || \
defined(_ATFILE_SOURCE)
extern DIR *fdopendir();
+extern int dirfd();
#endif /* defined(__EXTENSIONS__) || !defined(__XOPEN_OR_POSIX) ... */
extern struct dirent *readdir();
#if defined(__EXTENSIONS__) || !defined(_POSIX_C_SOURCE) || \
diff --git a/usr/src/lib/common/inc/c_synonyms.h b/usr/src/lib/common/inc/c_synonyms.h
index 57030f98d4..50bb091a58 100644
--- a/usr/src/lib/common/inc/c_synonyms.h
+++ b/usr/src/lib/common/inc/c_synonyms.h
@@ -229,6 +229,7 @@ extern "C" {
#define defopen _defopen
#define defread _defread
#define dgettext _dgettext
+#define dirfd _dirfd
#define dladdr1 _dladdr1
#define dladdr _dladdr
#define dlamd64getunwind _dlamd64getunwind
diff --git a/usr/src/lib/libc/inc/synonyms.h b/usr/src/lib/libc/inc/synonyms.h
index a9af340145..4b4ce263f0 100644
--- a/usr/src/lib/libc/inc/synonyms.h
+++ b/usr/src/lib/libc/inc/synonyms.h
@@ -270,6 +270,7 @@ extern "C" {
#define defopen _defopen
#define defread _defread
#define dgettext _dgettext
+#define dirfd _dirfd
#define dirname _dirname
#define dladdr1 _dladdr1
#define dladdr _dladdr
diff --git a/usr/src/lib/libc/port/gen/fdopendir.c b/usr/src/lib/libc/port/gen/fdopendir.c
index 7e251b8f55..237d6a59ff 100644
--- a/usr/src/lib/libc/port/gen/fdopendir.c
+++ b/usr/src/lib/libc/port/gen/fdopendir.c
@@ -27,7 +27,7 @@
#pragma ident "%Z%%M% %I% %E% SMI"
/*
- * fdopendir -- C library extension routine
+ * fdopendir, dirfd -- C library extension routines
*
* We use lmalloc()/lfree() rather than malloc()/free() in
* order to allow opendir()/readdir()/closedir() to be called
@@ -35,6 +35,7 @@
*/
#pragma weak fdopendir = _fdopendir
+#pragma weak dirfd = _dirfd
#include "synonyms.h"
#include <mtlib.h>
@@ -87,3 +88,9 @@ fail:
errno = error;
return (NULL);
}
+
+int
+dirfd(DIR *dirp)
+{
+ return (dirp->dd_fd);
+}
diff --git a/usr/src/lib/libc/port/mapfile-vers b/usr/src/lib/libc/port/mapfile-vers
index 161df2efb8..3e658f68e6 100644
--- a/usr/src/lib/libc/port/mapfile-vers
+++ b/usr/src/lib/libc/port/mapfile-vers
@@ -48,6 +48,7 @@ SUNW_1.23 { # SunOS 5.11 (Solaris 11)
clock_gettime;
clock_nanosleep;
clock_settime;
+ dirfd;
door_bind;
door_call;
door_create;
@@ -1484,6 +1485,7 @@ SUNWprivate_1.1 {
_defread;
_delete;
_dgettext;
+ _dirfd;
_door_bind = NODYNSORT;
_door_call = NODYNSORT;
_door_create;