summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2020-08-10 21:41:49 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2020-08-10 21:41:49 +0000
commitcc321ccd753c1be80e689e5c30057963154ba66c (patch)
treec861b69d88a53ffaa1a15e7564cca2d7e353cc8f
parentaf32cefd7ce83d5eb62d7f392146386518d07bc0 (diff)
Notes
-rw-r--r--lib/libc/gen/Makefile.inc1
-rw-r--r--lib/libc/gen/Symbol.map2
-rw-r--r--lib/libc/gen/scandir-compat11.c31
-rw-r--r--lib/libc/gen/scandir.c5
4 files changed, 14 insertions, 25 deletions
diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc
index f86c7b04b92b..779b418e9340 100644
--- a/lib/libc/gen/Makefile.inc
+++ b/lib/libc/gen/Makefile.inc
@@ -120,6 +120,7 @@ SRCS+= __getosreldate.c \
recvmmsg.c \
rewinddir.c \
scandir.c \
+ scandir_b.c \
scandir-compat11.c \
seed48.c \
seekdir.c \
diff --git a/lib/libc/gen/Symbol.map b/lib/libc/gen/Symbol.map
index f9d4f158ed30..e17d74d1a151 100644
--- a/lib/libc/gen/Symbol.map
+++ b/lib/libc/gen/Symbol.map
@@ -416,7 +416,6 @@ FBSD_1.5 {
readdir;
readdir_r;
scandir;
- scandir_b;
sem_clockwait_np;
setproctitle_fast;
timespec_get;
@@ -424,6 +423,7 @@ FBSD_1.5 {
FBSD_1.6 {
memalign;
+ scandir_b;
sigandset;
sigisemptyset;
sigorset;
diff --git a/lib/libc/gen/scandir-compat11.c b/lib/libc/gen/scandir-compat11.c
index 712d14ee9c04..b1c0ecb83622 100644
--- a/lib/libc/gen/scandir-compat11.c
+++ b/lib/libc/gen/scandir-compat11.c
@@ -49,32 +49,25 @@ __FBSDID("$FreeBSD$");
#include "gen-compat.h"
-#ifdef I_AM_SCANDIR_B
-#include "block_abi.h"
-#define SELECT(x) CALL_BLOCK(select, x)
-#ifndef __BLOCKS__
-void
-qsort_b(void *, size_t, size_t, void*);
-#endif
-#else
+/*
+ * scandir_b@FBSD_1.4 was never exported from libc.so.7 due to a
+ * mistake, so there is no use of exporting it now with some earlier
+ * symbol version. As result, we do not need to implement compat
+ * function freebsd11_scandir_b().
+ */
+
#define SELECT(x) select(x)
-#endif
+
+void qsort_b(void *, size_t, size_t, void *);
static int freebsd11_alphasort_thunk(void *thunk, const void *p1,
const void *p2);
int
-#ifdef I_AM_SCANDIR_B
-freebsd11_scandir_b(const char *dirname, struct freebsd11_dirent ***namelist,
- DECLARE_BLOCK(int, select, const struct freebsd11_dirent *),
- DECLARE_BLOCK(int, dcomp, const struct freebsd11_dirent **,
- const struct freebsd11_dirent **))
-#else
freebsd11_scandir(const char *dirname, struct freebsd11_dirent ***namelist,
int (*select)(const struct freebsd11_dirent *),
int (*dcomp)(const struct freebsd11_dirent **,
const struct freebsd11_dirent **))
-#endif
{
struct freebsd11_dirent *d, *p, **names = NULL;
size_t arraysz, numitems;
@@ -124,13 +117,8 @@ freebsd11_scandir(const char *dirname, struct freebsd11_dirent ***namelist,
}
closedir(dirp);
if (numitems && dcomp != NULL)
-#ifdef I_AM_SCANDIR_B
- qsort_b(names, numitems, sizeof(struct freebsd11_dirent *),
- (void*)dcomp);
-#else
qsort_r(names, numitems, sizeof(struct freebsd11_dirent *),
&dcomp, freebsd11_alphasort_thunk);
-#endif
*namelist = names;
return (numitems);
@@ -168,4 +156,3 @@ freebsd11_alphasort_thunk(void *thunk, const void *p1, const void *p2)
__sym_compat(alphasort, freebsd11_alphasort, FBSD_1.0);
__sym_compat(scandir, freebsd11_scandir, FBSD_1.0);
-__sym_compat(scandir_b, freebsd11_scandir_b, FBSD_1.4);
diff --git a/lib/libc/gen/scandir.c b/lib/libc/gen/scandir.c
index 036a0166d48b..7e5bcce905fb 100644
--- a/lib/libc/gen/scandir.c
+++ b/lib/libc/gen/scandir.c
@@ -50,8 +50,7 @@ __FBSDID("$FreeBSD$");
#include "block_abi.h"
#define SELECT(x) CALL_BLOCK(select, x)
#ifndef __BLOCKS__
-void
-qsort_b(void *, size_t, size_t, void*);
+void qsort_b(void *, size_t, size_t, void *);
#endif
#else
#define SELECT(x) select(x)
@@ -134,6 +133,7 @@ fail:
return (-1);
}
+#ifndef I_AM_SCANDIR_B
/*
* Alphabetic order comparison routine for those who want it.
* POSIX 2008 requires that alphasort() uses strcoll().
@@ -153,3 +153,4 @@ alphasort_thunk(void *thunk, const void *p1, const void *p2)
dc = *(int (**)(const struct dirent **, const struct dirent **))thunk;
return (dc((const struct dirent **)p1, (const struct dirent **)p2));
}
+#endif