-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
67 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...approval-tests.Syscalls.Open.approved.txt → ...oval-tests.SyscallTests.Open.approved.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...tests.Syscalls.OpenAt2_FDCWD.approved.txt → ...l-tests.SyscallTests.OpenAt2.approved.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
RF ./tests_syscalls_openat2_fdcwd.c | ||
RF ./tests_syscalls_openat2.c | ||
RX /etc/ld.so.preload | ||
RF /etc/ld.so.cache | ||
RF /etc/ld.so.cache | ||
RF /lib/x86_64-linux-gnu/libc.so.6 | ||
RF /tmp | ||
RD /tmp/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#include <sys/types.h> | ||
#include <sys/stat.h> | ||
#include <linux/fcntl.h> | ||
#include <linux/openat2.h> | ||
#include <unistd.h> | ||
#include <sys/syscall.h> | ||
|
||
// int openat2(int dirfd, const char *pathname, const struct open_how *how, size_t size); | ||
|
||
int dirfd1() | ||
{ | ||
int dirfd = open("/tmp", O_RDONLY); | ||
|
||
const char *pathname = "/tmp"; | ||
struct open_how how = {.flags = O_PATH, .mode = 0}; | ||
int size = sizeof(struct open_how); | ||
syscall(SYS_openat2, dirfd, pathname, &how, size); | ||
} | ||
|
||
int dirfd2() | ||
{ | ||
int dirfd = open("/tmp", O_RDONLY); | ||
const char *pathname = "./"; | ||
struct open_how how = {.flags = O_PATH, .mode = 0}; | ||
int size = sizeof(struct open_how); | ||
syscall(SYS_openat2, dirfd, pathname, &how, size); | ||
} | ||
|
||
int atfdcwd1() | ||
{ | ||
int dirfd = AT_FDCWD; | ||
const char *pathname = "/tmp"; | ||
struct open_how how = {.flags = O_PATH, .mode = 0}; | ||
int size = sizeof(struct open_how); | ||
syscall(SYS_openat2, dirfd, pathname, &how, size); | ||
} | ||
|
||
int atfdcwd2() | ||
{ | ||
int dirfd = AT_FDCWD; | ||
chdir("/tmp"); | ||
const char *pathname = "./"; | ||
struct open_how how = {.flags = O_PATH, .mode = 0}; | ||
int size = sizeof(struct open_how); | ||
syscall(SYS_openat2, dirfd, pathname, &how, size); | ||
} | ||
|
||
int main() | ||
{ | ||
// dirfd1(); | ||
dirfd2(); | ||
// atfdcwd1(); | ||
// atfdcwd2(); | ||
return 0; | ||
} |
This file was deleted.
Oops, something went wrong.