getcwd.c 222 B

1234567891011
  1. #include <unistd.h>
  2. #include <string.h>
  3. #include <syscall.h>
  4. DEFN_SYSCALL2(getcwd, 29, char *, size_t);
  5. char *getcwd(char *buf, size_t size) {
  6. if (!buf) buf = malloc(size);
  7. return (char *)syscall_getcwd(buf, size);
  8. }