Skip to content

Commit

Permalink
chdir
Browse files Browse the repository at this point in the history
  • Loading branch information
tyfkda committed Oct 24, 2023
1 parent 25728da commit 2f70c0d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/unistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ int pipe(int *);
int pipe2(int *pipefd, int flag);
int isatty(int fd);
char *getcwd(char *buffer, size_t size);
int chdir(const char *path);

pid_t fork(void);
long clone3(struct clone_args *cl_args, size_t size);
Expand Down
2 changes: 2 additions & 0 deletions libsrc/unistd/_syscall.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#define __NR_wait4 61
#define __NR_kill 62
#define __NR_getcwd 79
#define __NR_chdir 80
#define __NR_unlink 87
#define __NR_chmod 90
#define __NR_time 201
Expand Down Expand Up @@ -68,6 +69,7 @@
#define __NR_wait4 260
#define __NR_kill 129
#define __NR_getcwd 17
#define __NR_chdir 49
#define __NR_unlinkat 35
#define __NR_fchmodat 53
#define __NR_clock_gettime 113
Expand Down
10 changes: 10 additions & 0 deletions libsrc/unistd/chdir.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#if !defined(__APPLE__) && !defined(__WASM)
#include "unistd.h"
#include "_syscall.h"

int chdir(const char *path) {
int ret;
SYSCALL_RET(__NR_chdir, ret);
return ret;
}
#endif

0 comments on commit 2f70c0d

Please sign in to comment.