diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2015-09-12 13:34:23 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2015-09-12 13:34:23 +0000 |
commit | 67cafd92bf92ebd7dbd6eb244464a2266392935d (patch) | |
tree | 66866166d0bf56d04879705d02db13a60fb26514 | |
parent | a1fc86fc8aa7ab8b4acc2911516d1ba1ca1ff242 (diff) |
Wrap <dirent.h> so that internal calls go direct and they're all weak symbols
-rw-r--r-- | lib/libc/gen/closedir.c | 3 | ||||
-rw-r--r-- | lib/libc/gen/dirfd.c | 1 | ||||
-rw-r--r-- | lib/libc/gen/opendir.c | 4 | ||||
-rw-r--r-- | lib/libc/gen/readdir.c | 3 | ||||
-rw-r--r-- | lib/libc/gen/seekdir.c | 3 | ||||
-rw-r--r-- | lib/libc/gen/telldir.c | 3 | ||||
-rw-r--r-- | lib/libc/hidden/dirent.h | 36 |
7 files changed, 48 insertions, 5 deletions
diff --git a/lib/libc/gen/closedir.c b/lib/libc/gen/closedir.c index 86b7de13430..d5e228014a1 100644 --- a/lib/libc/gen/closedir.c +++ b/lib/libc/gen/closedir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: closedir.c,v 1.9 2013/08/13 05:52:12 guenther Exp $ */ +/* $OpenBSD: closedir.c,v 1.10 2015/09/12 13:34:22 guenther Exp $ */ /* * Copyright (c) 1983, 1993 * Regents of the University of California. All rights reserved. @@ -52,3 +52,4 @@ closedir(DIR *dirp) free(dirp); return (close(fd)); } +DEF_WEAK(closedir); diff --git a/lib/libc/gen/dirfd.c b/lib/libc/gen/dirfd.c index 3188a7cf5a7..843f22093fe 100644 --- a/lib/libc/gen/dirfd.c +++ b/lib/libc/gen/dirfd.c @@ -11,3 +11,4 @@ dirfd(DIR *dirp) { return (dirp->dd_fd); } +DEF_WEAK(dirfd); diff --git a/lib/libc/gen/opendir.c b/lib/libc/gen/opendir.c index 36896280a19..38662ae4457 100644 --- a/lib/libc/gen/opendir.c +++ b/lib/libc/gen/opendir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: opendir.c,v 1.28 2015/03/18 15:11:31 tedu Exp $ */ +/* $OpenBSD: opendir.c,v 1.29 2015/09/12 13:34:22 guenther Exp $ */ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -57,6 +57,7 @@ opendir(const char *name) close(fd); return (dirp); } +DEF_WEAK(opendir); /* * Open a directory specified by file descriptor. @@ -86,6 +87,7 @@ fdopendir(int fd) } return (dirp); } +DEF_WEAK(fdopendir); static DIR * __fdopendir(int fd) diff --git a/lib/libc/gen/readdir.c b/lib/libc/gen/readdir.c index 2f586d11b61..283a9daff9d 100644 --- a/lib/libc/gen/readdir.c +++ b/lib/libc/gen/readdir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: readdir.c,v 1.21 2014/03/10 07:54:14 schwarze Exp $ */ +/* $OpenBSD: readdir.c,v 1.22 2015/09/12 13:34:22 guenther Exp $ */ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -79,3 +79,4 @@ readdir(DIR *dirp) return (dp); } +DEF_WEAK(readdir); diff --git a/lib/libc/gen/seekdir.c b/lib/libc/gen/seekdir.c index 222645acae3..bd4ca49ecc2 100644 --- a/lib/libc/gen/seekdir.c +++ b/lib/libc/gen/seekdir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: seekdir.c,v 1.12 2014/03/10 07:54:14 schwarze Exp $ */ +/* $OpenBSD: seekdir.c,v 1.13 2015/09/12 13:34:22 guenther Exp $ */ /* * Copyright (c) 2013 Ingo Schwarze <schwarze@openbsd.org> * @@ -72,3 +72,4 @@ seekdir(DIR *dirp, long loc) dirp->dd_bufpos = dirp->dd_curpos = lseek(dirp->dd_fd, loc, SEEK_SET); _MUTEX_UNLOCK(&dirp->dd_lock); } +DEF_WEAK(seekdir); diff --git a/lib/libc/gen/telldir.c b/lib/libc/gen/telldir.c index c12f0f56298..7432d029d95 100644 --- a/lib/libc/gen/telldir.c +++ b/lib/libc/gen/telldir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: telldir.c,v 1.17 2013/11/05 20:36:51 schwarze Exp $ */ +/* $OpenBSD: telldir.c,v 1.18 2015/09/12 13:34:22 guenther Exp $ */ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -46,3 +46,4 @@ telldir(DIR *dirp) return (i); } +DEF_WEAK(telldir); diff --git a/lib/libc/hidden/dirent.h b/lib/libc/hidden/dirent.h new file mode 100644 index 00000000000..1e8398291c8 --- /dev/null +++ b/lib/libc/hidden/dirent.h @@ -0,0 +1,36 @@ +/* $OpenBSD: dirent.h,v 1.1 2015/09/12 13:34:22 guenther Exp $ */ +/* + * Copyright (c) 2015 Philip Guenther <guenther@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LIBC_DIRENT_H_ +#define _LIBC_DIRENT_H_ + +#include_next <dirent.h> + +PROTO_DEPRECATED(alphasort); +PROTO_NORMAL(closedir); +PROTO_NORMAL(dirfd); +PROTO_NORMAL(fdopendir); +PROTO_NORMAL(getdents); +PROTO_NORMAL(opendir); +PROTO_NORMAL(readdir); +PROTO_DEPRECATED(readdir_r); +PROTO_DEPRECATED(rewinddir); +PROTO_DEPRECATED(scandir); +PROTO_NORMAL(seekdir); +PROTO_NORMAL(telldir); + +#endif /* !_LIBC_DIRENT_H_ */ |