Kernel: Remove SYS_OPEN
This can be done with SYS_OPENAT with fd set to AT_FDCWD
This commit is contained in:
@@ -15,7 +15,7 @@ int open(const char* path, int oflag, ...)
|
||||
mode_t mode = va_arg(args, mode_t);
|
||||
va_end(args);
|
||||
|
||||
return syscall(SYS_OPEN, path, oflag, __UMASKED_MODE(mode));
|
||||
return openat(AT_FDCWD, path, oflag, mode);
|
||||
}
|
||||
|
||||
int openat(int fd, const char* path, int oflag, ...)
|
||||
|
||||
@@ -11,7 +11,6 @@ __BEGIN_DECLS
|
||||
O(SYS_WRITE, write) \
|
||||
O(SYS_TERMID, termid) \
|
||||
O(SYS_CLOSE, close) \
|
||||
O(SYS_OPEN, open) \
|
||||
O(SYS_OPENAT, openat) \
|
||||
O(SYS_SEEK, seek) \
|
||||
O(SYS_TELL, tell) \
|
||||
|
||||
@@ -557,7 +557,7 @@ static void handle_dynamic(LoadedElf& elf)
|
||||
if (auto ret = syscall(SYS_REALPATH, path_buffer, realpath); ret < 0)
|
||||
print_error_and_exit("realpath", ret);
|
||||
|
||||
int library_fd = syscall(SYS_OPEN, realpath, O_RDONLY);
|
||||
int library_fd = syscall(SYS_OPENAT, AT_FDCWD, realpath, O_RDONLY);
|
||||
if (library_fd < 0)
|
||||
print_error_and_exit("could not open library", library_fd);
|
||||
|
||||
@@ -882,7 +882,7 @@ int _entry(int argc, char** argv, char** envp, int fd)
|
||||
argc--;
|
||||
argv++;
|
||||
|
||||
fd = syscall(SYS_OPEN, argv[0], O_RDONLY);
|
||||
fd = syscall(SYS_OPENAT, AT_FDCWD, argv[0], O_RDONLY);
|
||||
if (fd < 0)
|
||||
print_error_and_exit("could not open program", fd);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ static int s_random_fd;
|
||||
|
||||
void init_random()
|
||||
{
|
||||
s_random_fd = syscall(SYS_OPEN, "/dev/random", O_RDONLY);
|
||||
s_random_fd = syscall(SYS_OPENAT, AT_FDCWD, "/dev/random", O_RDONLY);
|
||||
if (s_random_fd < 0)
|
||||
print_error_and_exit("could not open /dev/random", s_random_fd);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user