Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F133628525
D50980.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
6 KB
Referenced Files
None
Subscribers
None
D50980.id.diff
View Options
diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -51,6 +51,10 @@
# xargs -n1 | sort | uniq -d;
# done
+# 20250623: fscandir() renamed to fdscandir()
+OLD_FILES+=usr/share/man/man3/fscandir.3.gz
+OLD_FILES+=usr/share/man/man3/fscandir_b.3.gz
+
# 20250615: don't install man page for absent function
OLD_FILES+=usr/share/man/man9/vm_map_simplify_entry.9.gz
diff --git a/include/dirent.h b/include/dirent.h
--- a/include/dirent.h
+++ b/include/dirent.h
@@ -130,11 +130,11 @@
#endif
#endif
#if __BSD_VISIBLE
-int fscandir(int, struct dirent ***,
+int fdscandir(int, struct dirent ***,
int (*)(const struct dirent *), int (*)(const struct dirent **,
const struct dirent **));
#ifdef __BLOCKS__
-int fscandir_b(int, struct dirent ***,
+int fdscandir_b(int, struct dirent ***,
int (^)(const struct dirent *),
int (^)(const struct dirent **, const struct dirent **));
#endif
diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc
--- a/lib/libc/gen/Makefile.inc
+++ b/lib/libc/gen/Makefile.inc
@@ -499,8 +499,8 @@
MLINKS+=rtld_get_var.3 \
rtld_set_var.3
MLINKS+=scandir.3 alphasort.3 \
- scandir.3 fscandir.3 \
- scandir.3 fscandir_b.3 \
+ scandir.3 fdscandir.3 \
+ scandir.3 fdscandir_b.3 \
scandir.3 scandir_b.3 \
scandir.3 scandirat.3 \
scandir.3 scandirat_b.3 \
diff --git a/lib/libc/gen/Symbol.map b/lib/libc/gen/Symbol.map
--- a/lib/libc/gen/Symbol.map
+++ b/lib/libc/gen/Symbol.map
@@ -460,6 +460,8 @@
execvpe;
fscandir;
fscandir_b;
+ fdscandir;
+ fdscandir_b;
fts_open_b;
glob_b;
psiginfo;
diff --git a/lib/libc/gen/scandir.3 b/lib/libc/gen/scandir.3
--- a/lib/libc/gen/scandir.3
+++ b/lib/libc/gen/scandir.3
@@ -30,11 +30,11 @@
.Os
.Sh NAME
.Nm scandir ,
-.Nm fscandir ,
+.Nm fdscandir ,
.Nm scandirat ,
.Nm scandir_b ,
-.Nm fscandir_b ,
-.Nm fscandirat_b ,
+.Nm fdscandir_b ,
+.Nm fdscandirat_b ,
.Nm alphasort ,
.Nm versionsort
.Nd scan a directory
@@ -50,7 +50,7 @@
.Fa "int \*(lp*compar\*(rp\*(lpconst struct dirent **, const struct dirent **\*(rp"
.Fc
.Ft int
-.Fo fscandir
+.Fo fdscandir
.Fa "int dirfd"
.Fa "struct dirent ***namelist"
.Fa "int \*(lp*select\*(rp\*(lpconst struct dirent *\*(rp"
@@ -72,7 +72,7 @@
.Fa "int \*(lp^compar\*(rp\*(lpconst struct dirent **, const struct dirent **\*(rp"
.Fc
.Ft int
-.Fo fscandir_b
+.Fo fdscandir_b
.Fa "int dirfd"
.Fa "struct dirent ***namelist"
.Fa "int \*(lp^select\*(rp\*(lpconst struct dirent *\*(rp"
@@ -144,7 +144,7 @@
by freeing each pointer in the array and then the array itself.
.Pp
The
-.Fn fscandir
+.Fn fdscandir
function is similar to
.Fn scandir ,
but takes a file descriptor referencing a directory instead of a path.
@@ -185,12 +185,12 @@
.Pp
The
.Fn scandir_b ,
-.Fn fscandir_b ,
+.Fn fdscandir_b ,
and
.Fn scandirat_b
functions behave in the same way as
.Fn scandir ,
-.Fn fscandir ,
+.Fn fdscandir ,
and
.Fn scandirat ,
respectively,
@@ -201,10 +201,10 @@
.Sh DIAGNOSTICS
The
.Fn scandir ,
-.Fn fscandir ,
+.Fn fdscandir ,
.Fn scandirat ,
.Fn scandir_b ,
-.Fn fscandir_b ,
+.Fn fdscandir_b ,
and
.Fn scandirat_b
functions return the number of directory entries found on succes.
@@ -236,9 +236,9 @@
.Fn versionsort
functions are GNU extensions and conform to no standard.
The
-.Fn fscandir ,
+.Fn fdscandir ,
.Fn scandir_b ,
-.Fn fscandir_b ,
+.Fn fdscandir_b ,
and
.Fn scandirat_b
functions are
@@ -262,8 +262,8 @@
functions were added in
.Fx 13.2 .
The
-.Fn fscandir ,
-.Fn fscandir_b ,
+.Fn fdscandir ,
+.Fn fdscandir_b ,
and
.Fn scandirat_b
functions were added in
diff --git a/lib/libc/gen/scandir.c b/lib/libc/gen/scandir.c
--- a/lib/libc/gen/scandir.c
+++ b/lib/libc/gen/scandir.c
@@ -159,10 +159,10 @@
int
#ifdef I_AM_SCANDIR_B
-fscandir_b(int dirfd, struct dirent ***namelist, select_block select,
+fdscandir_b(int dirfd, struct dirent ***namelist, select_block select,
dcomp_block dcomp)
#else
-fscandir(int dirfd, struct dirent ***namelist,
+fdscandir(int dirfd, struct dirent ***namelist,
int (*select)(const struct dirent *), int (*dcomp)(const struct dirent **,
const struct dirent **))
#endif
@@ -203,9 +203,9 @@
return (-1);
ret =
#ifdef I_AM_SCANDIR_B
- fscandir_b
+ fdscandir_b
#else
- fscandir
+ fdscandir
#endif
(fd, namelist, select, dcomp);
serrno = errno;
@@ -242,3 +242,9 @@
return (dc((const struct dirent **)p1, (const struct dirent **)p2));
}
#endif
+
+#ifdef I_AM_SCANDIR_B
+__weak_reference(fdscandir_b, fscandir_b);
+#else
+__weak_reference(fdscandir, fscandir);
+#endif
diff --git a/lib/libc/tests/gen/scandir_blocks_test.c b/lib/libc/tests/gen/scandir_blocks_test.c
--- a/lib/libc/tests/gen/scandir_blocks_test.c
+++ b/lib/libc/tests/gen/scandir_blocks_test.c
@@ -57,19 +57,19 @@
free(namelist);
}
-ATF_TC(fscandir_b_test);
-ATF_TC_HEAD(fscandir_b_test, tc)
+ATF_TC(fdscandir_b_test);
+ATF_TC_HEAD(fdscandir_b_test, tc)
{
- atf_tc_set_md_var(tc, "descr", "Test fscandir_b()");
+ atf_tc_set_md_var(tc, "descr", "Test fdscandir_b()");
}
-ATF_TC_BODY(fscandir_b_test, tc)
+ATF_TC_BODY(fdscandir_b_test, tc)
{
struct dirent **namelist = NULL;
int fd, i, ret;
scandir_blocks_prepare(tc);
ATF_REQUIRE((fd = open("dir", O_DIRECTORY | O_RDONLY)) >= 0);
- ret = fscandir_b(fd, &namelist,
+ ret = fdscandir_b(fd, &namelist,
^(const struct dirent *ent) {
return (strcmp(ent->d_name, "skip") != 0);
},
@@ -112,7 +112,7 @@
ATF_TP_ADD_TCS(tp)
{
ATF_TP_ADD_TC(tp, scandir_b_test);
- ATF_TP_ADD_TC(tp, fscandir_b_test);
+ ATF_TP_ADD_TC(tp, fdscandir_b_test);
ATF_TP_ADD_TC(tp, scandirat_b_test);
return (atf_no_error());
}
diff --git a/lib/libc/tests/gen/scandir_test.c b/lib/libc/tests/gen/scandir_test.c
--- a/lib/libc/tests/gen/scandir_test.c
+++ b/lib/libc/tests/gen/scandir_test.c
@@ -63,19 +63,19 @@
free(namelist);
}
-ATF_TC(fscandir_test);
-ATF_TC_HEAD(fscandir_test, tc)
+ATF_TC(fdscandir_test);
+ATF_TC_HEAD(fdscandir_test, tc)
{
- atf_tc_set_md_var(tc, "descr", "Test fscandir()");
+ atf_tc_set_md_var(tc, "descr", "Test fdscandir()");
}
-ATF_TC_BODY(fscandir_test, tc)
+ATF_TC_BODY(fdscandir_test, tc)
{
struct dirent **namelist = NULL;
int fd, i, ret;
scandir_prepare(tc);
ATF_REQUIRE((fd = open("dir", O_DIRECTORY | O_RDONLY)) >= 0);
- ret = fscandir(fd, &namelist, scandir_select, scandir_compare);
+ ret = fdscandir(fd, &namelist, scandir_select, scandir_compare);
scandir_verify(tc, ret, namelist);
for (i = 0; i < ret; i++)
free(namelist[i]);
@@ -127,7 +127,7 @@
ATF_TP_ADD_TCS(tp)
{
ATF_TP_ADD_TC(tp, scandir_test);
- ATF_TP_ADD_TC(tp, fscandir_test);
+ ATF_TP_ADD_TC(tp, fdscandir_test);
ATF_TP_ADD_TC(tp, scandirat_test);
ATF_TP_ADD_TC(tp, scandir_none);
return (atf_no_error());
diff --git a/usr.bin/diff/diffdir.c b/usr.bin/diff/diffdir.c
--- a/usr.bin/diff/diffdir.c
+++ b/usr.bin/diff/diffdir.c
@@ -83,7 +83,7 @@
*dirp = NULL;
return (0);
}
- if ((ret = fscandir(fd, dirp, selectf, comparf)) < 0)
+ if ((ret = fdscandir(fd, dirp, selectf, comparf)) < 0)
goto fail;
RB_INSERT(inodetree, tree, ino);
close(fd);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Oct 28, 3:24 AM (11 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24334179
Default Alt Text
D50980.id.diff (6 KB)
Attached To
Mode
D50980: libc: Rename fscandir{,_b}() to fdscandir{,_b}().
Attached
Detach File
Event Timeline
Log In to Comment