mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Remove obsolete system calls.
This commit is contained in:
parent
234f186a7d
commit
933720e0b0
5 changed files with 29 additions and 152 deletions
|
@ -27,48 +27,52 @@
|
|||
|
||||
#define SYSCALL_BAD_SYSCALL 0
|
||||
#define SYSCALL_EXIT 1 /* OBSOLETE */
|
||||
#define SYSCALL_SLEEP 2
|
||||
#define SYSCALL_USLEEP 3
|
||||
#define SYSCALL_PRINT_STRING 4
|
||||
#define SYSCALL_CREATE_FRAME 5
|
||||
#define SYSCALL_CHANGE_FRAME 6
|
||||
#define SYSCALL_DELETE_FRAME 7
|
||||
#define SYSCALL_SET_FREQUENCY 9
|
||||
#define SYSCALL_SLEEP 2 /* OBSOLETE */
|
||||
#define SYSCALL_USLEEP 3 /* OBSOLETE */
|
||||
#define SYSCALL_PRINT_STRING 4 /* OBSOLETE */
|
||||
#define SYSCALL_CREATE_FRAME 5 /* OBSOLETE */
|
||||
#define SYSCALL_CHANGE_FRAME 6 /* OBSOLETE */
|
||||
#define SYSCALL_DELETE_FRAME 7 /* OBSOLETE */
|
||||
#define SYSCALL_RECEIVE_KEYSTROKE 8 /* OBSOLETE */
|
||||
#define SYSCALL_SET_FREQUENCY 9 /* OBSOLETE */
|
||||
#define SYSCALL_EXECVE 10
|
||||
#define SYSCALL_PRINT_PATH_FILES 11
|
||||
#define SYSCALL_PRINT_PATH_FILES 11 /* OBSOLETE */
|
||||
#define SYSCALL_FORK 12 /* OBSOLETE */
|
||||
#define SYSCALL_GETPID 13
|
||||
#define SYSCALL_GETPPID 14
|
||||
#define SYSCALL_GET_FILEINFO 15
|
||||
#define SYSCALL_GET_NUM_FILES 16
|
||||
#define SYSCALL_GET_FILEINFO 15 /* OBSOLETE */
|
||||
#define SYSCALL_GET_NUM_FILES 16 /* OBSOLETE */
|
||||
#define SYSCALL_WAITPID 17
|
||||
#define SYSCALL_READ 18
|
||||
#define SYSCALL_WRITE 19
|
||||
#define SYSCALL_PIPE 20
|
||||
#define SYSCALL_PIPE 20 /* OBSOLETE */
|
||||
#define SYSCALL_CLOSE 21
|
||||
#define SYSCALL_DUP 22
|
||||
#define SYSCALL_OPEN 23
|
||||
#define SYSCALL_OPEN 23 /* OBSOLETE */
|
||||
#define SYSCALL_READDIRENTS 24
|
||||
#define SYSCALL_CHDIR 25
|
||||
#define SYSCALL_UNLINK 27
|
||||
#define SYSCALL_REGISTER_ERRNO 28
|
||||
#define SYSCALL_REGISTER_SIGNAL_HANDLER 29
|
||||
#define SYSCALL_CHDIR 25 /* OBSOLETE */
|
||||
#define SYSCALL_GETCWD 26 /* OBSOLETE */
|
||||
#define SYSCALL_UNLINK 27 /* OBSOLETE */
|
||||
#define SYSCALL_REGISTER_ERRNO 28 /* OBSOLETE */
|
||||
#define SYSCALL_REGISTER_SIGNAL_HANDLER 29 /* OBSOLETE */
|
||||
#define SYSCALL_SIGRETURN /* OBSOLETE */
|
||||
#define SYSCALL_KILL 31
|
||||
#define SYSCALL_MEMSTAT 32
|
||||
#define SYSCALL_ISATTY 33
|
||||
#define SYSCALL_UPTIME 34
|
||||
#define SYSCALL_UPTIME 34 /* OBSOLETE */
|
||||
#define SYSCALL_SBRK 35
|
||||
#define SYSCALL_LSEEK 36
|
||||
#define SYSCALL_GETPAGESIZE 37
|
||||
#define SYSCALL_MKDIR 38
|
||||
#define SYSCALL_RMDIR 39
|
||||
#define SYSCALL_TRUNCATE 40
|
||||
#define SYSCALL_MKDIR 38 /* OBSOLETE */
|
||||
#define SYSCALL_RMDIR 39 /* OBSOLETE */
|
||||
#define SYSCALL_TRUNCATE 40 /* OBSOLETE */
|
||||
#define SYSCALL_FTRUNCATE 41
|
||||
#define SYSCALL_SETTERMMODE 42
|
||||
#define SYSCALL_GETTERMMODE 43
|
||||
#define SYSCALL_STAT 44
|
||||
#define SYSCALL_STAT 44 /* OBSOLETE */
|
||||
#define SYSCALL_FSTAT 45
|
||||
#define SYSCALL_FCNTL 46
|
||||
#define SYSCALL_ACCESS 47
|
||||
#define SYSCALL_ACCESS 47 /* OBSOLETE */
|
||||
#define SYSCALL_KERNELINFO 48
|
||||
#define SYSCALL_PREAD 49
|
||||
#define SYSCALL_PWRITE 50
|
||||
|
@ -78,9 +82,9 @@
|
|||
#define SYSCALL_OPENAT 54
|
||||
#define SYSCALL_DISPMSG_ISSUE 55
|
||||
#define SYSCALL_FSTATAT 56
|
||||
#define SYSCALL_CHMOD 57
|
||||
#define SYSCALL_CHOWN 58
|
||||
#define SYSCALL_LINK 59
|
||||
#define SYSCALL_CHMOD 57 /* OBSOLETE */
|
||||
#define SYSCALL_CHOWN 58 /* OBSOLETE */
|
||||
#define SYSCALL_LINK 59 /* OBSOLETE */
|
||||
#define SYSCALL_DUP2 60
|
||||
#define SYSCALL_UNLINKAT 61
|
||||
#define SYSCALL_FACCESSAT 62
|
||||
|
|
|
@ -178,12 +178,6 @@ static int sys_openat(int dirfd, const char* path, int flags, mode_t mode)
|
|||
return dtable->Allocate(desc, fdflags);
|
||||
}
|
||||
|
||||
// TODO: This system call is replaced by openat, will be removed soon.
|
||||
static int sys_open(const char* path, int flags, mode_t mode)
|
||||
{
|
||||
return sys_openat(AT_FDCWD, path, flags, mode);
|
||||
}
|
||||
|
||||
// TODO: This is a hack! Stat the file in some manner and check permissions.
|
||||
static int sys_faccessat(int dirfd, const char* path, int /*mode*/, int flags)
|
||||
{
|
||||
|
@ -202,12 +196,6 @@ static int sys_faccessat(int dirfd, const char* path, int /*mode*/, int flags)
|
|||
return desc ? 0 : -1;
|
||||
}
|
||||
|
||||
// TODO: This system call is replaced by faccessat, will be removed soon.
|
||||
static int sys_access(const char* path, int mode)
|
||||
{
|
||||
return sys_faccessat(AT_FDCWD, path, mode, 0);
|
||||
}
|
||||
|
||||
static int sys_unlinkat(int dirfd, const char* path, int flags)
|
||||
{
|
||||
if ( !(flags & (AT_REMOVEFILE | AT_REMOVEDIR)) )
|
||||
|
@ -228,12 +216,6 @@ static int sys_unlinkat(int dirfd, const char* path, int flags)
|
|||
return ret;
|
||||
}
|
||||
|
||||
// TODO: This system call is replaced by unlinkat, will be removed soon.
|
||||
static int sys_unlink(const char* path)
|
||||
{
|
||||
return sys_unlinkat(AT_FDCWD, path, 0);
|
||||
}
|
||||
|
||||
static int sys_mkdirat(int dirfd, const char* path, mode_t mode)
|
||||
{
|
||||
char* pathcopy = GetStringFromUser(path);
|
||||
|
@ -248,18 +230,6 @@ static int sys_mkdirat(int dirfd, const char* path, mode_t mode)
|
|||
return ret;
|
||||
}
|
||||
|
||||
// TODO: This system call is replaced by mkdirat, will be removed soon.
|
||||
static int sys_mkdir(const char* path, mode_t mode)
|
||||
{
|
||||
return sys_mkdirat(AT_FDCWD, path, mode);
|
||||
}
|
||||
|
||||
// TODO: This system call is replaced by unlinkat, will be removed soon.
|
||||
static int sys_rmdir(const char* path)
|
||||
{
|
||||
return sys_unlinkat(AT_FDCWD, path, AT_REMOVEDIR);
|
||||
}
|
||||
|
||||
static int sys_truncateat(int dirfd, const char* path, off_t length)
|
||||
{
|
||||
char* pathcopy = GetStringFromUser(path);
|
||||
|
@ -276,12 +246,6 @@ static int sys_truncateat(int dirfd, const char* path, off_t length)
|
|||
return desc->truncate(&ctx, length);
|
||||
}
|
||||
|
||||
// TODO: This system call is replaced by truncateat, will be removed soon.
|
||||
static int sys_truncate(const char* path, off_t length)
|
||||
{
|
||||
return sys_truncateat(AT_FDCWD, path, length);
|
||||
}
|
||||
|
||||
static int sys_ftruncate(int fd, off_t length)
|
||||
{
|
||||
Ref<Descriptor> desc = CurrentProcess()->GetDescriptor(fd);
|
||||
|
@ -310,12 +274,6 @@ static int sys_fstatat(int dirfd, const char* path, struct stat* st, int flags)
|
|||
return desc->stat(&ctx, st);
|
||||
}
|
||||
|
||||
// TODO: This system call is replaced by fstatat, will be removed soon.
|
||||
static int sys_stat(const char* path, struct stat* st)
|
||||
{
|
||||
return sys_fstatat(AT_FDCWD, path, st, 0);
|
||||
}
|
||||
|
||||
static int sys_fstat(int fd, struct stat* st)
|
||||
{
|
||||
Ref<Descriptor> desc = CurrentProcess()->GetDescriptor(fd);
|
||||
|
@ -438,12 +396,6 @@ static int sys_fchdirat(int dirfd, const char* path)
|
|||
return 0;
|
||||
}
|
||||
|
||||
// TODO: This system call is replaced by sys_fchownat, will be removed soon.
|
||||
static int sys_chdir(const char* path)
|
||||
{
|
||||
return sys_fchdirat(AT_FDCWD, path);
|
||||
}
|
||||
|
||||
static int sys_fchroot(int fd)
|
||||
{
|
||||
Process* process = CurrentProcess();
|
||||
|
@ -502,12 +454,6 @@ static int sys_fchownat(int dirfd, const char* path, uid_t owner, gid_t group, i
|
|||
return desc->chown(&ctx, owner, group);
|
||||
}
|
||||
|
||||
// TODO: This system call is replaced by fchownat, will be removed soon.
|
||||
static int sys_chown(const char* path, uid_t owner, gid_t group)
|
||||
{
|
||||
return sys_fchownat(AT_FDCWD, path, owner, group, 0);
|
||||
}
|
||||
|
||||
static int sys_fchmod(int fd, mode_t mode)
|
||||
{
|
||||
Ref<Descriptor> desc = CurrentProcess()->GetDescriptor(fd);
|
||||
|
@ -537,12 +483,6 @@ static int sys_fchmodat(int dirfd, const char* path, mode_t mode, int flags)
|
|||
return desc->chmod(&ctx, mode);
|
||||
}
|
||||
|
||||
// TODO: This system call is replaced by fchmodat, will be removed soon.
|
||||
static int sys_chmod(const char* path, mode_t mode)
|
||||
{
|
||||
return sys_fchmodat(AT_FDCWD, path, mode, 0);
|
||||
}
|
||||
|
||||
static int sys_futimens(int fd, const struct timespec user_times[2])
|
||||
{
|
||||
struct timespec times[2];
|
||||
|
@ -618,12 +558,6 @@ static int sys_linkat(int olddirfd, const char* oldpath,
|
|||
return ret;
|
||||
}
|
||||
|
||||
// TODO: This system call is replaced by linkat, will be removed soon.
|
||||
static int sys_link(const char* oldpath, const char* newpath)
|
||||
{
|
||||
return sys_linkat(AT_FDCWD, oldpath, AT_FDCWD, newpath, 0);
|
||||
}
|
||||
|
||||
static int sys_symlinkat(const char* oldpath, int newdirfd, const char* newpath)
|
||||
{
|
||||
ioctx_t ctx; SetupUserIOCtx(&ctx);
|
||||
|
@ -1037,11 +971,7 @@ static int sys_mkpartition(int fd, off_t start, off_t length, int flags)
|
|||
void Init()
|
||||
{
|
||||
Syscall::Register(SYSCALL_ACCEPT4, (void*) sys_accept4);
|
||||
Syscall::Register(SYSCALL_ACCESS, (void*) sys_access);
|
||||
Syscall::Register(SYSCALL_BIND, (void*) sys_bind);
|
||||
Syscall::Register(SYSCALL_CHDIR, (void*) sys_chdir);
|
||||
Syscall::Register(SYSCALL_CHMOD, (void*) sys_chmod);
|
||||
Syscall::Register(SYSCALL_CHOWN, (void*) sys_chown);
|
||||
Syscall::Register(SYSCALL_CLOSE, (void*) sys_close);
|
||||
Syscall::Register(SYSCALL_CONNECT, (void*) sys_connect);
|
||||
Syscall::Register(SYSCALL_DUP2, (void*) sys_dup2);
|
||||
|
@ -1068,14 +998,11 @@ void Init()
|
|||
Syscall::Register(SYSCALL_IOCTL, (void*) sys_ioctl);
|
||||
Syscall::Register(SYSCALL_ISATTY, (void*) sys_isatty);
|
||||
Syscall::Register(SYSCALL_LINKAT, (void*) sys_linkat);
|
||||
Syscall::Register(SYSCALL_LINK, (void*) sys_link);
|
||||
Syscall::Register(SYSCALL_LISTEN, (void*) sys_listen);
|
||||
Syscall::Register(SYSCALL_LSEEK, (void*) sys_lseek);
|
||||
Syscall::Register(SYSCALL_MKDIRAT, (void*) sys_mkdirat);
|
||||
Syscall::Register(SYSCALL_MKDIR, (void*) sys_mkdir);
|
||||
Syscall::Register(SYSCALL_MKPARTITION, (void*) sys_mkpartition);
|
||||
Syscall::Register(SYSCALL_OPENAT, (void*) sys_openat);
|
||||
Syscall::Register(SYSCALL_OPEN, (void*) sys_open);
|
||||
Syscall::Register(SYSCALL_PREAD, (void*) sys_pread);
|
||||
Syscall::Register(SYSCALL_PREADV, (void*) sys_preadv);
|
||||
Syscall::Register(SYSCALL_PWRITE, (void*) sys_pwrite);
|
||||
|
@ -1086,19 +1013,15 @@ void Init()
|
|||
Syscall::Register(SYSCALL_READV, (void*) sys_readv);
|
||||
Syscall::Register(SYSCALL_RECV, (void*) sys_recv);
|
||||
Syscall::Register(SYSCALL_RENAMEAT, (void*) sys_renameat);
|
||||
Syscall::Register(SYSCALL_RMDIR, (void*) sys_rmdir);
|
||||
Syscall::Register(SYSCALL_SEND, (void*) sys_send);
|
||||
Syscall::Register(SYSCALL_SETTERMMODE, (void*) sys_settermmode);
|
||||
Syscall::Register(SYSCALL_STAT, (void*) sys_stat);
|
||||
Syscall::Register(SYSCALL_SYMLINKAT, (void*) sys_symlinkat);
|
||||
Syscall::Register(SYSCALL_TCGETPGRP, (void*) sys_tcgetpgrp);
|
||||
Syscall::Register(SYSCALL_TCGETWINCURPOS, (void*) sys_tcgetwincurpos);
|
||||
Syscall::Register(SYSCALL_TCGETWINSIZE, (void*) sys_tcgetwinsize);
|
||||
Syscall::Register(SYSCALL_TCSETPGRP, (void*) sys_tcsetpgrp);
|
||||
Syscall::Register(SYSCALL_TRUNCATEAT, (void*) sys_truncateat);
|
||||
Syscall::Register(SYSCALL_TRUNCATE, (void*) sys_truncate);
|
||||
Syscall::Register(SYSCALL_UNLINKAT, (void*) sys_unlinkat);
|
||||
Syscall::Register(SYSCALL_UNLINK, (void*) sys_unlink);
|
||||
Syscall::Register(SYSCALL_UTIMENSAT, (void*) sys_utimensat);
|
||||
Syscall::Register(SYSCALL_WRITE, (void*) sys_write);
|
||||
Syscall::Register(SYSCALL_WRITEV, (void*) sys_writev);
|
||||
|
|
|
@ -418,15 +418,8 @@ static int sys_pipe2(int pipefd[2], int flags)
|
|||
return -1;
|
||||
}
|
||||
|
||||
// TODO: This system call is replaced by pipe2, will be removed soon.
|
||||
static int sys_pipe(int pipefd[2])
|
||||
{
|
||||
return sys_pipe2(pipefd, 0);
|
||||
}
|
||||
|
||||
void Init()
|
||||
{
|
||||
Syscall::Register(SYSCALL_PIPE, (void*) sys_pipe);
|
||||
Syscall::Register(SYSCALL_PIPE2, (void*) sys_pipe2);
|
||||
}
|
||||
|
||||
|
|
|
@ -198,32 +198,6 @@ ThreadState GetThreadState(Thread* thread)
|
|||
return thread->state;
|
||||
}
|
||||
|
||||
static void SleepUntil(struct timespec wakeat)
|
||||
{
|
||||
while ( timespec_lt(Time::Get(CLOCK_BOOT), wakeat) )
|
||||
Yield();
|
||||
}
|
||||
|
||||
// TODO: This function has been obsoleted by the clock_nanosleep system call.
|
||||
static int sys_sleep(size_t secs)
|
||||
{
|
||||
struct timespec delay = timespec_make(secs, 0);
|
||||
struct timespec now = Time::Get(CLOCK_BOOT);
|
||||
SleepUntil(timespec_add(now, delay));
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TODO: This function has been obsoleted by the clock_nanosleep system call.
|
||||
static int sys_usleep(size_t usecs)
|
||||
{
|
||||
size_t secs = usecs / 1000000;
|
||||
size_t nsecs = (usecs % 1000000) * 1000;
|
||||
struct timespec delay = timespec_make(secs, nsecs);
|
||||
struct timespec now = Time::Get(CLOCK_BOOT);
|
||||
SleepUntil(timespec_add(now, delay));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sys_sched_yield(void)
|
||||
{
|
||||
return kthread_yield(), 0;
|
||||
|
@ -235,8 +209,6 @@ void Init()
|
|||
first_sleeping_thread = NULL;
|
||||
idle_thread = NULL;
|
||||
|
||||
Syscall::Register(SYSCALL_SLEEP, (void*) sys_sleep);
|
||||
Syscall::Register(SYSCALL_USLEEP, (void*) sys_usleep);
|
||||
Syscall::Register(SYSCALL_SCHED_YIELD, (void*) sys_sched_yield);
|
||||
}
|
||||
|
||||
|
|
|
@ -268,20 +268,6 @@ static int sys_clock_nanosleep(clockid_t clockid, int flags,
|
|||
return timespec_eq(time, timespec_nul()) ? 0 : (errno = EINTR, -1);
|
||||
}
|
||||
|
||||
// TODO: Made obsolete by cloc_gettimeres.
|
||||
static int sys_uptime(uintmax_t* usecssinceboot)
|
||||
{
|
||||
struct timespec now;
|
||||
Clock* clock = Time::GetClock(CLOCK_BOOT);
|
||||
clock->Get(&now, NULL);
|
||||
|
||||
uintmax_t seconds = now.tv_sec;
|
||||
uintmax_t nano_seconds = now.tv_nsec;
|
||||
uintmax_t ret = seconds * 1000000 + nano_seconds / 1000;
|
||||
|
||||
return CopyToUser(usecssinceboot, &ret, sizeof(ret)) ? 0 : -1;
|
||||
}
|
||||
|
||||
static int sys_timens(struct tmns* user_tmns)
|
||||
{
|
||||
Clock* execute_clock = Time::GetClock(CLOCK_PROCESS_CPUTIME_ID);
|
||||
|
@ -314,7 +300,6 @@ void UserTimer::Init()
|
|||
Syscall::Register(SYSCALL_TIMER_GETOVERRUN, (void*) sys_timer_getoverrun);
|
||||
Syscall::Register(SYSCALL_TIMER_GETTIME, (void*) sys_timer_gettime);
|
||||
Syscall::Register(SYSCALL_TIMER_SETTIME, (void*) sys_timer_settime);
|
||||
Syscall::Register(SYSCALL_UPTIME, (void*) sys_uptime);
|
||||
}
|
||||
|
||||
} // namespace Sortix
|
||||
|
|
Loading…
Reference in a new issue