feat: add cwd tracking to kernel, remove shell hack, update system utilities to use getcwd, fix tcc libc stub, fix nonexistent directory issue
This commit is contained in:
@@ -123,6 +123,9 @@ namespace Montauk {
|
||||
// User management
|
||||
static constexpr uint64_t SYS_SETUSER = 92;
|
||||
static constexpr uint64_t SYS_GETUSER = 93;
|
||||
static constexpr uint64_t SYS_FRENAME = 94;
|
||||
static constexpr uint64_t SYS_GETCWD = 95;
|
||||
static constexpr uint64_t SYS_CHDIR = 96;
|
||||
|
||||
// Audio control commands (for SYS_AUDIOCTL)
|
||||
static constexpr int AUDIO_CTL_SET_VOLUME = 0;
|
||||
|
||||
@@ -97,6 +97,8 @@ extern "C" {
|
||||
#define MTK_SYS_AUDIOCTL 83
|
||||
#define MTK_SYS_SETTZ 90
|
||||
#define MTK_SYS_GETTZ 91
|
||||
#define MTK_SYS_GETCWD 95
|
||||
#define MTK_SYS_CHDIR 96
|
||||
|
||||
#define MTK_SOCK_TCP 1
|
||||
#define MTK_SOCK_UDP 2
|
||||
@@ -318,6 +320,14 @@ static inline int mtk_getargs(char *buf, unsigned long max_len) {
|
||||
return (int)_mtk_syscall2(MTK_SYS_GETARGS, (long)buf, (long)max_len);
|
||||
}
|
||||
|
||||
static inline int mtk_chdir(const char *path) {
|
||||
return (int)_mtk_syscall1(MTK_SYS_CHDIR, (long)path);
|
||||
}
|
||||
|
||||
static inline int mtk_getcwd(char *buf, unsigned long max_len) {
|
||||
return (int)_mtk_syscall2(MTK_SYS_GETCWD, (long)buf, (long)max_len);
|
||||
}
|
||||
|
||||
/* ====================================================================
|
||||
Console I/O
|
||||
==================================================================== */
|
||||
|
||||
@@ -13,6 +13,8 @@ int read(int fd, void *buf, size_t count);
|
||||
int write(int fd, const void *buf, size_t count);
|
||||
int close(int fd);
|
||||
long lseek(int fd, long offset, int whence);
|
||||
int chdir(const char *path);
|
||||
char *getcwd(char *buf, size_t size);
|
||||
|
||||
unsigned int sleep(unsigned int seconds);
|
||||
|
||||
|
||||
@@ -120,6 +120,12 @@ namespace montauk {
|
||||
inline int spawn(const char* path, const char* args = nullptr) {
|
||||
return (int)syscall2(Montauk::SYS_SPAWN, (uint64_t)path, (uint64_t)args);
|
||||
}
|
||||
inline int chdir(const char* path) {
|
||||
return (int)syscall1(Montauk::SYS_CHDIR, (uint64_t)path);
|
||||
}
|
||||
inline int getcwd(char* buf, uint64_t maxLen) {
|
||||
return (int)syscall2(Montauk::SYS_GETCWD, (uint64_t)buf, maxLen);
|
||||
}
|
||||
|
||||
// Console
|
||||
inline void print(const char* text) { syscall1(Montauk::SYS_PRINT, (uint64_t)text); }
|
||||
|
||||
Reference in New Issue
Block a user