提交 6fcd60dd 编写于 作者: R Rich Felker

move and deduplicate declarations of __procfdname to make it checkable

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.
上级 c221d3e5
#include "syscall.h"
void __procfdname(char *buf, unsigned fd) void __procfdname(char *buf, unsigned fd)
{ {
unsigned i, j; unsigned i, j;
......
...@@ -244,4 +244,6 @@ hidden long __syscall_ret(unsigned long), __syscall(syscall_arg_t, ...), ...@@ -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_DISP(__sys_open_cp,,__VA_ARGS__)
#define sys_open_cp(...) __syscall_ret(__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 #endif
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
#include <string.h> #include <string.h>
#include "syscall.h" #include "syscall.h"
void __procfdname(char *, unsigned);
char *realpath(const char *restrict filename, char *restrict resolved) char *realpath(const char *restrict filename, char *restrict resolved)
{ {
int fd; int fd;
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
#include <fcntl.h> #include <fcntl.h>
#include "syscall.h" #include "syscall.h"
void __procfdname(char *, unsigned);
int fexecve(int fd, char *const argv[], char *const envp[]) int fexecve(int fd, char *const argv[], char *const envp[])
{ {
int r = __syscall(SYS_execveat, fd, "", argv, envp, AT_EMPTY_PATH); int r = __syscall(SYS_execveat, fd, "", argv, envp, AT_EMPTY_PATH);
......
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
#include <fcntl.h> #include <fcntl.h>
#include "syscall.h" #include "syscall.h"
void __procfdname(char *, unsigned);
int fchmod(int fd, mode_t mode) int fchmod(int fd, mode_t mode)
{ {
int ret = __syscall(SYS_fchmod, fd, mode); int ret = __syscall(SYS_fchmod, fd, mode);
......
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
#include <errno.h> #include <errno.h>
#include "syscall.h" #include "syscall.h"
void __procfdname(char *, unsigned);
int fchmodat(int fd, const char *path, mode_t mode, int flag) int fchmodat(int fd, const char *path, mode_t mode, int flag)
{ {
if (!flag) return syscall(SYS_fchmodat, fd, path, mode, flag); if (!flag) return syscall(SYS_fchmodat, fd, path, mode, flag);
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
#include "syscall.h" #include "syscall.h"
#include "libc.h" #include "libc.h"
void __procfdname(char *, unsigned);
int fstat(int fd, struct stat *st) int fstat(int fd, struct stat *st)
{ {
int ret = __syscall(SYS_fstat, fd, st); int ret = __syscall(SYS_fstat, fd, st);
......
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
#include <fcntl.h> #include <fcntl.h>
#include "syscall.h" #include "syscall.h"
void __procfdname(char *, unsigned);
int fchdir(int fd) int fchdir(int fd)
{ {
int ret = __syscall(SYS_fchdir, fd); int ret = __syscall(SYS_fchdir, fd);
......
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
#include <fcntl.h> #include <fcntl.h>
#include "syscall.h" #include "syscall.h"
void __procfdname(char *, unsigned);
int fchown(int fd, uid_t uid, gid_t gid) int fchown(int fd, uid_t uid, gid_t gid)
{ {
int ret = __syscall(SYS_fchown, fd, uid, gid); int ret = __syscall(SYS_fchown, fd, uid, gid);
......
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#include <sys/stat.h> #include <sys/stat.h>
#include "syscall.h"
void __procfdname(char *, unsigned);
int ttyname_r(int fd, char *name, size_t size) int ttyname_r(int fd, char *name, size_t size)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册