1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 08:47:34 +00:00

Add getwd().

This commit is contained in:
Andreas Kling 2018-11-06 15:59:57 +01:00
parent 7c3746592b
commit e5e0bffd76
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 #pragma once
#include <endian.h> #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); __RETURN_WITH_ERRNO(rc, buffer, nullptr);
} }
char* getwd(char* buf)
{
return getcwd(buf, PATH_MAX);
}
int sleep(unsigned seconds) int sleep(unsigned seconds)
{ {
return Syscall::invoke(Syscall::SC_sleep, (dword)seconds); return Syscall::invoke(Syscall::SC_sleep, (dword)seconds);

View file

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