From: Ismael Luceno <ismael@iodev.co.uk>
To: musl@lists.openwall.com
Cc: Rich Felker <dalias@libc.org>, Ismael Luceno <ismael@iodev.co.uk>
Subject: [musl] [PATCH v6 2/3] add internal aliases __opendir, __readdir and __closedir
Date: Sat, 28 Aug 2021 01:22:40 +0200 [thread overview]
Message-ID: <20210827232241.23229-2-ismael@iodev.co.uk> (raw)
In-Reply-To: <20210827232241.23229-1-ismael@iodev.co.uk>
Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
---
src/dirent/closedir.c | 4 +++-
src/dirent/opendir.c | 4 +++-
src/dirent/readdir.c | 5 +++--
src/include/dirent.h | 10 ++++++++++
4 files changed, 19 insertions(+), 4 deletions(-)
create mode 100644 src/include/dirent.h
diff --git a/src/dirent/closedir.c b/src/dirent/closedir.c
index e794ae9ca44b..f4249f56e210 100644
--- a/src/dirent/closedir.c
+++ b/src/dirent/closedir.c
@@ -3,9 +3,11 @@
#include <stdlib.h>
#include "__dirent.h"
-int closedir(DIR *dir)
+int __closedir(DIR *dir)
{
int ret = close(dir->fd);
free(dir);
return ret;
}
+
+weak_alias(__closedir, closedir);
diff --git a/src/dirent/opendir.c b/src/dirent/opendir.c
index 5cb84e303fee..4123c81994cd 100644
--- a/src/dirent/opendir.c
+++ b/src/dirent/opendir.c
@@ -5,7 +5,7 @@
#include "__dirent.h"
#include "syscall.h"
-DIR *opendir(const char *name)
+DIR *__opendir(const char *name)
{
int fd;
DIR *dir;
@@ -19,3 +19,5 @@ DIR *opendir(const char *name)
dir->fd = fd;
return dir;
}
+
+weak_alias(__opendir, opendir);
diff --git a/src/dirent/readdir.c b/src/dirent/readdir.c
index 569fc7057737..cb34a258569c 100644
--- a/src/dirent/readdir.c
+++ b/src/dirent/readdir.c
@@ -7,7 +7,7 @@
typedef char dirstream_buf_alignment_check[1-2*(int)(
offsetof(struct __dirstream, buf) % sizeof(off_t))];
-struct dirent *readdir(DIR *dir)
+struct dirent *__readdir(DIR *dir)
{
struct dirent *de;
@@ -26,4 +26,5 @@ struct dirent *readdir(DIR *dir)
return de;
}
-weak_alias(readdir, readdir64);
+weak_alias(__readdir, readdir64);
+weak_alias(__readdir, readdir);
diff --git a/src/include/dirent.h b/src/include/dirent.h
new file mode 100644
index 000000000000..918e123566d4
--- /dev/null
+++ b/src/include/dirent.h
@@ -0,0 +1,10 @@
+#ifndef DIRENT_H
+#define DIRENT_H
+
+#include "../../include/dirent.h"
+
+hidden int __closedir(DIR *);
+hidden DIR *__opendir(const char *);
+hidden struct dirent *__readdir(DIR *);
+
+#endif
--
2.33.0
next prev parent reply other threads:[~2021-08-27 23:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-27 23:22 [musl] [PATCH v6 1/3] glob: introduce context struct for do_glob Ismael Luceno
2021-08-27 23:22 ` Ismael Luceno [this message]
2021-08-27 23:22 ` [musl] [PATCH v6 3/3] glob: implement GLOB_ALTDIRFUNC et al Ismael Luceno
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210827232241.23229-2-ismael@iodev.co.uk \
--to=ismael@iodev.co.uk \
--cc=dalias@libc.org \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).