Add getwd().

This commit is contained in:
Andreas Kling 2018-11-06 15:59:57 +01:00
parent 7c3746592b
commit e5e0bffd76
Notes: sideshowbarker 2024-07-19 18:32:57 +09:00
4 changed files with 11 additions and 1 deletions

View file

@ -0,0 +1,3 @@
#pragma once
#define PATH_MAX 4096

View file

@ -1,4 +1,4 @@
#pragma once
#include <endian.h>
#include <limits.h>

View file

@ -156,6 +156,11 @@ char* getcwd(char* buffer, size_t size)
__RETURN_WITH_ERRNO(rc, buffer, nullptr);
}
char* getwd(char* buf)
{
return getcwd(buf, PATH_MAX);
}
int sleep(unsigned seconds)
{
return Syscall::invoke(Syscall::SC_sleep, (dword)seconds);

View file

@ -2,6 +2,7 @@
#include <sys/cdefs.h>
#include <sys/types.h>
#include <limits.h>
__BEGIN_DECLS
@ -29,6 +30,7 @@ int close(int fd);
pid_t waitpid(pid_t, int* wstatus, int options);
int chdir(const char* path);
char* getcwd(char* buffer, size_t size);
char* getwd(char* buffer);
int lstat(const char* path, struct stat* statbuf);
int stat(const char* path, struct stat* statbuf);
int sleep(unsigned seconds);