mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Added stubs for rmdir(2) and mkdir(2).
This commit is contained in:
parent
c5ddc6923a
commit
0519af33ee
5 changed files with 35 additions and 2 deletions
|
@ -31,8 +31,11 @@
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
@include(mode_t.h)
|
||||||
@include(mode_t_values.h)
|
@include(mode_t_values.h)
|
||||||
|
|
||||||
|
int mkdir(const char *path, mode_t mode);
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -127,7 +127,6 @@ ssize_t pread(int, void*, size_t, off_t);
|
||||||
ssize_t pwrite(int, const void*, size_t, off_t);
|
ssize_t pwrite(int, const void*, size_t, off_t);
|
||||||
ssize_t readlink(const char* restrict, char* restrict, size_t);
|
ssize_t readlink(const char* restrict, char* restrict, size_t);
|
||||||
ssize_t readlinkat(int, const char* restrict, char* restrict, size_t);
|
ssize_t readlinkat(int, const char* restrict, char* restrict, size_t);
|
||||||
int rmdir(const char*);
|
|
||||||
int setegid(gid_t);
|
int setegid(gid_t);
|
||||||
int seteuid(uid_t);
|
int seteuid(uid_t);
|
||||||
int setgid(gid_t);
|
int setgid(gid_t);
|
||||||
|
@ -168,6 +167,7 @@ int isatty(int);
|
||||||
off_t lseek(int, off_t, int);
|
off_t lseek(int, off_t, int);
|
||||||
int pipe(int [2]);
|
int pipe(int [2]);
|
||||||
ssize_t read(int, void*, size_t);
|
ssize_t read(int, void*, size_t);
|
||||||
|
int rmdir(const char*);
|
||||||
unsigned sleep(unsigned);
|
unsigned sleep(unsigned);
|
||||||
#if __POSIX_OBSOLETE <= 200112 || defined(SORTIX_EXTENSIONS)
|
#if __POSIX_OBSOLETE <= 200112 || defined(SORTIX_EXTENSIONS)
|
||||||
int usleep(useconds_t useconds);
|
int usleep(useconds_t useconds);
|
||||||
|
|
|
@ -51,6 +51,8 @@ namespace Maxsi
|
||||||
DEFN_SYSCALL1(int, SysUnlink, SYSCALL_UNLINK, const char*);
|
DEFN_SYSCALL1(int, SysUnlink, SYSCALL_UNLINK, const char*);
|
||||||
DEFN_SYSCALL1(int, SysIsATTY, SYSCALL_ISATTY, int);
|
DEFN_SYSCALL1(int, SysIsATTY, SYSCALL_ISATTY, int);
|
||||||
DEFN_SYSCALL3_VOID(SysSeek, SYSCALL_SEEK, int, off_t*, int);
|
DEFN_SYSCALL3_VOID(SysSeek, SYSCALL_SEEK, int, off_t*, int);
|
||||||
|
DEFN_SYSCALL2(int, SysMkDir, SYSCALL_MKDIR, const char*, mode_t);
|
||||||
|
DEFN_SYSCALL1(int, SysRmDir, SYSCALL_RMDIR, const char*);
|
||||||
|
|
||||||
size_t Print(const char* string)
|
size_t Print(const char* string)
|
||||||
{
|
{
|
||||||
|
@ -256,6 +258,16 @@ namespace Maxsi
|
||||||
return SysUnlink(pathname);
|
return SysUnlink(pathname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" int mkdir(const char* pathname, mode_t mode)
|
||||||
|
{
|
||||||
|
return SysMkDir(pathname, mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" int rmdir(const char* pathname)
|
||||||
|
{
|
||||||
|
return SysRmDir(pathname);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" int isatty(int fd)
|
extern "C" int isatty(int fd)
|
||||||
{
|
{
|
||||||
return SysIsATTY(fd);
|
return SysIsATTY(fd);
|
||||||
|
|
|
@ -83,10 +83,26 @@ namespace Sortix
|
||||||
return Unlink(path) ? 0 : -1;
|
return Unlink(path) ? 0 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int SysMkDir(const char* pathname, mode_t mode)
|
||||||
|
{
|
||||||
|
// TODO: Add the proper filesystem support!
|
||||||
|
Error::Set(ENOSYS);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SysRmDir(const char* pathname)
|
||||||
|
{
|
||||||
|
// TODO: Add the proper filesystem support!
|
||||||
|
Error::Set(ENOSYS);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
void Init()
|
void Init()
|
||||||
{
|
{
|
||||||
Syscall::Register(SYSCALL_OPEN, (void*) SysOpen);
|
Syscall::Register(SYSCALL_OPEN, (void*) SysOpen);
|
||||||
Syscall::Register(SYSCALL_UNLINK, (void*) SysUnlink);
|
Syscall::Register(SYSCALL_UNLINK, (void*) SysUnlink);
|
||||||
|
Syscall::Register(SYSCALL_MKDIR, (void*) SysMkDir);
|
||||||
|
Syscall::Register(SYSCALL_RMDIR, (void*) SysRmDir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,9 @@
|
||||||
#define SYSCALL_SBRK 35
|
#define SYSCALL_SBRK 35
|
||||||
#define SYSCALL_SEEK 36
|
#define SYSCALL_SEEK 36
|
||||||
#define SYSCALL_GET_PAGE_SIZE 37
|
#define SYSCALL_GET_PAGE_SIZE 37
|
||||||
#define SYSCALL_MAX_NUM 38 /* index of highest constant + 1 */
|
#define SYSCALL_MKDIR 38
|
||||||
|
#define SYSCALL_RMDIR 39
|
||||||
|
#define SYSCALL_MAX_NUM 40 /* index of highest constant + 1 */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue