mirror of
https://https.git.savannah.gnu.org/git/gnulib.git
synced 2026-05-13 15:13:36 +00:00
renameat2: new module
Although the Linux syscall renameat2 is not in glibc (yet?), it is useful to have access to its RENAME_NOREPLACE flag. * MODULES.html.sh (func_all_modules): Add renameat2. * lib/renameat2.c, lib/renameat2.h, modules/renameat2: * modules/renameat2-tests, tests/test-renameat2.c: New files. * lib/renameat.c (renameat): Move most of the implementation to renameat2, and just call renameat2. * modules/renameat (Files): Remove lib/at-func2.c. (Depends-on): Depend only on renameat2. (Include): Remove <fcntl.h>. * modules/renameat-tests (test_renameat_LDADD): Add $(LIB_EACCESS), since renameat (via renameat2) might use faccessat.
This commit is contained in:
@@ -2,25 +2,11 @@ Description:
|
||||
renameat() function: rename a file, relative to two directories
|
||||
|
||||
Files:
|
||||
lib/at-func2.c
|
||||
lib/renameat.c
|
||||
m4/renameat.m4
|
||||
|
||||
Depends-on:
|
||||
stdio
|
||||
extensions
|
||||
fcntl-h
|
||||
filenamecat-lgpl [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1]
|
||||
openat-h [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1]
|
||||
statat [test $REPLACE_RENAMEAT = 1]
|
||||
stdbool [test $REPLACE_RENAMEAT = 1]
|
||||
at-internal [test $HAVE_RENAMEAT = 0]
|
||||
dosname [test $HAVE_RENAMEAT = 0]
|
||||
getcwd-lgpl [test $HAVE_RENAMEAT = 0]
|
||||
openat-die [test $HAVE_RENAMEAT = 0]
|
||||
rename [test $HAVE_RENAMEAT = 0]
|
||||
same-inode [test $HAVE_RENAMEAT = 0]
|
||||
save-cwd [test $HAVE_RENAMEAT = 0]
|
||||
renameat2 [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1]
|
||||
|
||||
configure.ac:
|
||||
gl_FUNC_RENAMEAT
|
||||
@@ -35,7 +21,6 @@ gl_STDIO_MODULE_INDICATOR([renameat])
|
||||
Makefile.am:
|
||||
|
||||
Include:
|
||||
<fcntl.h>
|
||||
<stdio.h>
|
||||
|
||||
License:
|
||||
|
||||
@@ -17,4 +17,4 @@ configure.ac:
|
||||
Makefile.am:
|
||||
TESTS += test-renameat
|
||||
check_PROGRAMS += test-renameat
|
||||
test_renameat_LDADD = $(LDADD) @LIBINTL@
|
||||
test_renameat_LDADD = $(LDADD) $(LIB_EACCESS) @LIBINTL@
|
||||
|
||||
43
modules/renameat2
Normal file
43
modules/renameat2
Normal file
@@ -0,0 +1,43 @@
|
||||
Description:
|
||||
renameat2() function: rename a file, relative to two directories
|
||||
|
||||
Files:
|
||||
lib/at-func2.c
|
||||
lib/renameat2.c
|
||||
lib/renameat2.h
|
||||
m4/renameat.m4
|
||||
|
||||
Depends-on:
|
||||
stdio
|
||||
extensions
|
||||
faccessat
|
||||
fcntl-h
|
||||
filenamecat-lgpl [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1]
|
||||
openat-h [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1]
|
||||
statat [test $REPLACE_RENAMEAT = 1]
|
||||
stdbool [test $REPLACE_RENAMEAT = 1]
|
||||
at-internal [test $HAVE_RENAMEAT = 0]
|
||||
dosname [test $HAVE_RENAMEAT = 0]
|
||||
getcwd-lgpl [test $HAVE_RENAMEAT = 0]
|
||||
openat-die [test $HAVE_RENAMEAT = 0]
|
||||
rename [test $HAVE_RENAMEAT = 0]
|
||||
same-inode [test $HAVE_RENAMEAT = 0]
|
||||
save-cwd [test $HAVE_RENAMEAT = 0]
|
||||
|
||||
configure.ac:
|
||||
gl_FUNC_RENAMEAT
|
||||
if test $HAVE_RENAMEAT = 0; then
|
||||
AC_LIBOBJ([at-func2])
|
||||
fi
|
||||
|
||||
Makefile.am:
|
||||
lib_SOURCES += renameat2.c
|
||||
|
||||
Include:
|
||||
"renameat2.h"
|
||||
|
||||
License:
|
||||
GPL
|
||||
|
||||
Maintainer:
|
||||
Jim Meyering, Eric Blake
|
||||
20
modules/renameat2-tests
Normal file
20
modules/renameat2-tests
Normal file
@@ -0,0 +1,20 @@
|
||||
Files:
|
||||
tests/test-rename.h
|
||||
tests/test-renameat2.c
|
||||
tests/signature.h
|
||||
tests/macros.h
|
||||
|
||||
Depends-on:
|
||||
ignore-value
|
||||
filenamecat
|
||||
getcwd-lgpl
|
||||
opendir
|
||||
readdir
|
||||
closedir
|
||||
|
||||
configure.ac:
|
||||
|
||||
Makefile.am:
|
||||
TESTS += test-renameat2
|
||||
check_PROGRAMS += test-renameat2
|
||||
test_renameat2_LDADD = $(LDADD) $(LIB_EACCESS) @LIBINTL@
|
||||
Reference in New Issue
Block a user