Add some scheduler API stubs

#461
This commit is contained in:
Theodore Dubois
2019-11-25 15:32:02 -08:00
parent 2704f6779d
commit 3eaedbb935
4 changed files with 30 additions and 2 deletions
-2
View File
@@ -34,8 +34,6 @@ struct linux_dirent64_ {
char name[];
} __attribute__((packed));
#define MAX_RECLEN sizeof(struct linux_dirent64_) + NAME_MAX +
size_t fill_dirent_32(void *dirent_data, ino_t inode, off_t_ offset, const char *name, int type) {
struct linux_dirent_ *dirent = dirent_data;
dirent->inode = inode;
+3
View File
@@ -98,6 +98,9 @@ syscall_t syscall_table[] = {
[147] = (syscall_t) sys_getsid,
[148] = (syscall_t) sys_fsync, // fdatasync
[150] = (syscall_t) sys_mlock,
[155] = (syscall_t) sys_sched_getparam,
[156] = (syscall_t) sys_sched_setscheduler,
[157] = (syscall_t) sys_sched_getscheduler,
[158] = (syscall_t) sys_sched_yield,
[162] = (syscall_t) sys_nanosleep,
[163] = (syscall_t) sys_mremap,
+23
View File
@@ -217,6 +217,7 @@ int_t sys_sched_setaffinity(pid_t_ UNUSED(pid), dword_t UNUSED(cpusetsize), addr
// meh
return 0;
}
int_t sys_getpriority(int_t which, pid_t_ who) {
STRACE("getpriority(%d, %d)", which, who);
return 20;
@@ -225,3 +226,25 @@ int_t sys_setpriority(int_t which, pid_t_ who, int_t prio) {
STRACE("setpriority(%d, %d, %d)", which, who, prio);
return 0;
}
// realtime scheduling stubs
int_t sys_sched_getparam(pid_t_ UNUSED(pid), addr_t param_addr) {
int_t sched_priority = 0;
if (user_put(param_addr, sched_priority))
return _EFAULT;
return 0;
}
#define SCHED_OTHER_ 0
int_t sys_sched_getscheduler(pid_t_ UNUSED(pid)) {
return SCHED_OTHER_;
}
int_t sys_sched_setscheduler(pid_t_ UNUSED(pid), int_t policy, addr_t param_addr) {
if (policy != SCHED_OTHER_)
return _EINVAL;
int_t sched_priority;
if (user_get(param_addr, sched_priority))
return _EFAULT;
if (sched_priority != 0)
return _EINVAL;
return 0;
}
+4
View File
@@ -71,4 +71,8 @@ int_t sys_sched_setaffinity(pid_t_ pid, dword_t cpusetsize, addr_t cpuset_addr);
int_t sys_getpriority(int_t which, pid_t_ who);
int_t sys_setpriority(int_t which, pid_t_ who, int_t prio);
int_t sys_sched_getparam(pid_t_ pid, addr_t param_addr);
int_t sys_sched_getscheduler(pid_t_ UNUSED(pid));
int_t sys_sched_setscheduler(pid_t_ UNUSED(pid), int_t policy, addr_t param_addr);
#endif