move and deduplicate declarations of __procfdname to make it checkable
authorRich Felker <dalias@aerifal.cx>
Thu, 6 Sep 2018 17:39:08 +0000 (13:39 -0400)
committerRich Felker <dalias@aerifal.cx>
Wed, 12 Sep 2018 18:34:27 +0000 (14:34 -0400)
syscall.h was chosen as the header to declare it, since its intended
usage is alongside syscalls as a fallback for operations the direct
syscall does not support.

src/internal/procfdname.c
src/internal/syscall.h
src/misc/realpath.c
src/process/fexecve.c
src/stat/fchmod.c
src/stat/fchmodat.c
src/stat/fstat.c
src/unistd/fchdir.c
src/unistd/fchown.c
src/unistd/ttyname_r.c

index 697e0bd..fd7306a 100644 (file)
@@ -1,3 +1,5 @@
+#include "syscall.h"
+
 void __procfdname(char *buf, unsigned fd)
 {
        unsigned i, j;
index c12a46c..5737f3a 100644 (file)
@@ -244,4 +244,6 @@ hidden long __syscall_ret(unsigned long), __syscall(syscall_arg_t, ...),
 #define __sys_open_cp(...) __SYSCALL_DISP(__sys_open_cp,,__VA_ARGS__)
 #define sys_open_cp(...) __syscall_ret(__sys_open_cp(__VA_ARGS__))
 
+void __procfdname(char [static 15+3*sizeof(int)], unsigned);
+
 #endif
index 88c849c..d2708e5 100644 (file)
@@ -7,8 +7,6 @@
 #include <string.h>
 #include "syscall.h"
 
-void __procfdname(char *, unsigned);
-
 char *realpath(const char *restrict filename, char *restrict resolved)
 {
        int fd;
index 8be3f76..554c198 100644 (file)
@@ -4,8 +4,6 @@
 #include <fcntl.h>
 #include "syscall.h"
 
-void __procfdname(char *, unsigned);
-
 int fexecve(int fd, char *const argv[], char *const envp[])
 {
        int r = __syscall(SYS_execveat, fd, "", argv, envp, AT_EMPTY_PATH);
index 93e1b64..7a503ee 100644 (file)
@@ -3,8 +3,6 @@
 #include <fcntl.h>
 #include "syscall.h"
 
-void __procfdname(char *, unsigned);
-
 int fchmod(int fd, mode_t mode)
 {
        int ret = __syscall(SYS_fchmod, fd, mode);
index d94667a..be61bdf 100644 (file)
@@ -3,8 +3,6 @@
 #include <errno.h>
 #include "syscall.h"
 
-void __procfdname(char *, unsigned);
-
 int fchmodat(int fd, const char *path, mode_t mode, int flag)
 {
        if (!flag) return syscall(SYS_fchmodat, fd, path, mode, flag);
index ab4afc0..f6d1652 100644 (file)
@@ -4,8 +4,6 @@
 #include "syscall.h"
 #include "libc.h"
 
-void __procfdname(char *, unsigned);
-
 int fstat(int fd, struct stat *st)
 {
        int ret = __syscall(SYS_fstat, fd, st);
index 72c3915..dee45ba 100644 (file)
@@ -3,8 +3,6 @@
 #include <fcntl.h>
 #include "syscall.h"
 
-void __procfdname(char *, unsigned);
-
 int fchdir(int fd)
 {
        int ret = __syscall(SYS_fchdir, fd);
index 75075ee..737b367 100644 (file)
@@ -3,8 +3,6 @@
 #include <fcntl.h>
 #include "syscall.h"
 
-void __procfdname(char *, unsigned);
-
 int fchown(int fd, uid_t uid, gid_t gid)
 {
        int ret = __syscall(SYS_fchown, fd, uid, gid);
index 33aa4ae..cb364c2 100644 (file)
@@ -1,8 +1,7 @@
 #include <unistd.h>
 #include <errno.h>
 #include <sys/stat.h>
-
-void __procfdname(char *, unsigned);
+#include "syscall.h"
 
 int ttyname_r(int fd, char *name, size_t size)
 {