this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add several syscalls, include openssl crash fix

+220 -11
+7
src/kernel/emulation/linux/CMakeLists.txt
··· 67 67 unistd/setgroups.c 68 68 unistd/getgroups.c 69 69 unistd/pipe.c 70 + unistd/chmod_extended.c 71 + unistd/fchmod_extended.c 72 + unistd/fchflags.c 73 + unistd/chflags.c 70 74 select/select.c 71 75 select/poll.c 72 76 process/vfork.c ··· 87 91 misc/proc_info.c 88 92 misc/sysctl.c 89 93 misc/getrlimit.c 94 + misc/setrlimit.c 90 95 misc/gethostuuid.c 91 96 misc/getrusage.c 92 97 misc/getlogin.c ··· 164 169 psynch/psynch_cvwait.c 165 170 psynch/psynch_cvbroad.c 166 171 psynch/psynch_cvsignal.c 172 + conf/pathconf.c 173 + conf/fpathconf.c 167 174 syscalls-table.S 168 175 ) 169 176
-11
src/kernel/emulation/linux/base.c
··· 18 18 __attribute__((naked)) 19 19 long linux_syscall(long a1, long a2, long a3, long a4, long a5, long a6, int nr) 20 20 { 21 - /* 22 - __asm__("push %%ecx\n" 23 - "push %%edx\n" 24 - "push %%ebp\n" 25 - "movl %%esp, %%ebp\n" 26 - "sysenter\n" 27 - "ret\n" 28 - :: "a"(nr), "b" (a1), "c"(a2), "d"(a3), 29 - "S"(a4), "D"(a5), "ebp"(a6)); 30 - __builtin_unreachable(); 31 - */ 32 21 __asm__("push %ebp\n" 33 22 "push %ebx\n" 34 23 "push %esi\n"
+38
src/kernel/emulation/linux/conf/fpathconf.c
··· 1 + #include "fpathconf.h" 2 + #include "../base.h" 3 + #include "../errno.h" 4 + #include <asm/unistd.h> 5 + #include "../../../../../platform-include/sys/errno.h" 6 + 7 + enum { 8 + BSD_PC_LINK_MAX = 1, 9 + BSD_PC_MAX_CANON, 10 + BSD_PC_MAX_INPUT, 11 + BSD_PC_NAME_MAX, 12 + BSD_PC_PATH_MAX, 13 + BSD_PC_PIPE_BUF, 14 + BSD_PC_CHOWN_RESTRICTED, 15 + BSD_PC_NO_TRUNC, 16 + BSD_PC_VDISABLE 17 + }; 18 + 19 + long sys_fpathconf(int fd, int name) 20 + { 21 + static const short values[] = { 22 + [BSD_PC_LINK_MAX] = 8, 23 + [BSD_PC_MAX_CANON] = 255, 24 + [BSD_PC_MAX_INPUT] = 255, 25 + [BSD_PC_NAME_MAX] = 255, 26 + [BSD_PC_PATH_MAX] = 4096, 27 + [BSD_PC_PIPE_BUF] = 4096, 28 + [BSD_PC_CHOWN_RESTRICTED] = 1, 29 + [BSD_PC_NO_TRUNC] = 1, 30 + [BSD_PC_VDISABLE] = 0 31 + }; 32 + 33 + if (name < 1 || name >= sizeof(values) / sizeof(values[0])) 34 + return -EINVAL; 35 + else 36 + return values[name]; 37 + } 38 +
+7
src/kernel/emulation/linux/conf/fpathconf.h
··· 1 + #ifndef LINUX_FPATHCONF_H 2 + #define LINUX_FPATHCONF_H 3 + 4 + long sys_fpathconf(int fd, int name); 5 + 6 + #endif 7 +
+11
src/kernel/emulation/linux/conf/pathconf.c
··· 1 + #include "pathconf.h" 2 + #include "fpathconf.h" 3 + #include "../base.h" 4 + #include "../errno.h" 5 + #include <asm/unistd.h> 6 + 7 + long sys_pathconf(const char* file, int name) 8 + { 9 + return sys_fpathconf(-1, name); 10 + } 11 +
+7
src/kernel/emulation/linux/conf/pathconf.h
··· 1 + #ifndef LINUX_PATHCONF_H 2 + #define LINUX_PATHCONF_H 3 + 4 + long sys_pathconf(const char* file, int name); 5 + 6 + #endif 7 +
+21
src/kernel/emulation/linux/misc/setrlimit.c
··· 1 + #include "setrlimit.h" 2 + #include "../base.h" 3 + #include "../errno.h" 4 + #include "../../../../../platform-include/sys/errno.h" 5 + #include <asm/unistd.h> 6 + 7 + long sys_setrlimit(unsigned int which, const struct rlimit* rlp) 8 + { 9 + int ret; 10 + 11 + which = rlimit_bsd_to_linux(which); 12 + if (which == -1) 13 + return -EINVAL; 14 + 15 + ret = LINUX_SYSCALL(__NR_prlimit64, 0, which, rlp, 0); 16 + if (ret < 0) 17 + ret = errno_linux_to_bsd(ret); 18 + 19 + return ret; 20 + } 21 +
+8
src/kernel/emulation/linux/misc/setrlimit.h
··· 1 + #ifndef LINUX_SETRLIMIT_H 2 + #define LINUX_SETRLIMIT_H 3 + #include "getrlimit.h" 4 + 5 + long sys_setrlimit(unsigned int which, const struct rlimit* rlp); 6 + 7 + #endif 8 +
+2
src/kernel/emulation/linux/stat/common.c
··· 19 19 stat->st_mtimespec.tv_nsec = lstat->st_mtime_nsec; 20 20 stat->st_ctimespec.tv_sec = lstat->st_ctime; 21 21 stat->st_ctimespec.tv_nsec = lstat->st_ctime_nsec; 22 + stat->st_flags = 0; 22 23 } 23 24 24 25 void stat_linux_to_bsd64(const struct linux_stat* lstat, struct stat64* stat) ··· 39 40 stat->st_mtimespec.tv_nsec = lstat->st_mtime_nsec; 40 41 stat->st_ctimespec.tv_sec = lstat->st_ctime; 41 42 stat->st_ctimespec.tv_nsec = lstat->st_ctime_nsec; 43 + stat->st_flags = 0; 42 44 } 43 45 44 46 void statfs_linux_to_bsd(const struct linux_statfs64* lstat, struct bsd_statfs* stat)
+14
src/kernel/emulation/linux/syscalls.c
··· 51 51 #include "unistd/getgroups.h" 52 52 #include "unistd/setgroups.h" 53 53 #include "unistd/pipe.h" 54 + #include "unistd/chmod_extended.h" 55 + #include "unistd/fchmod_extended.h" 56 + #include "unistd/fchflags.h" 57 + #include "unistd/chflags.h" 54 58 #include "signal/kill.h" 55 59 #include "signal/sigaltstack.h" 56 60 #include "signal/sigaction.h" ··· 63 67 #include "misc/getlogin.h" 64 68 #include "misc/ioctl.h" 65 69 #include "misc/getrlimit.h" 70 + #include "misc/setrlimit.h" 66 71 #include "misc/thread_selfid.h" 67 72 #include "misc/sysctl.h" 68 73 #include "misc/proc_info.h" ··· 122 127 #include "bsdthread/workq_kernreturn.h" 123 128 #include "bsdthread/workq_open.h" 124 129 #include "bsdthread/pthread_kill.h" 130 + #include "conf/pathconf.h" 131 + #include "conf/fpathconf.h" 125 132 126 133 void* __bsd_syscall_table[512] = { 127 134 [1] = sys_exit, ··· 150 157 [31] = sys_getpeername, 151 158 [32] = sys_getsockname, 152 159 [33] = sys_access, 160 + [34] = sys_chflags, 161 + [35] = sys_fchflags, 153 162 [36] = sys_sync, 154 163 [37] = sys_kill, 155 164 [39] = sys_getppid, ··· 211 220 [188] = sys_stat, 212 221 [189] = sys_fstat, 213 222 [190] = sys_lstat, 223 + [191] = sys_pathconf, 224 + [192] = sys_fpathconf, 214 225 [194] = sys_getrlimit, 226 + [195] = sys_setrlimit, 215 227 [196] = sys_getdirentries, 216 228 [197] = sys_mmap, 217 229 [199] = sys_lseek, ··· 241 253 [240] = sys_listxattr, 242 254 [241] = sys_flistxattr, 243 255 [244] = sys_posix_spawn, 256 + [282] = sys_chmod_extended, 257 + [283] = sys_fchmod_extended, 244 258 [301] = sys_psynch_mutexwait, 245 259 [302] = sys_psynch_mutexdrop, 246 260 [303] = sys_psynch_cvbroad,
+16
src/kernel/emulation/linux/unistd/chflags.c
··· 1 + #include "chflags.h" 2 + #include "../base.h" 3 + #include "../errno.h" 4 + #include <asm/unistd.h> 5 + #include "../../../../../platform-include/sys/errno.h" 6 + 7 + long sys_chflags(const char* file, int flags) 8 + { 9 + // TODO: We could implement this via ioctl(fd, FS_IOC_GETFLAGS/FS_IOC_SETFLAGS), 10 + // but it requires root and this functionality is not all that important. 11 + // 12 + // Returning ENOTSUP indicates that this filesystem doesn't support file flags, 13 + // which is true on NFS for example, so applications must accept this error return. 14 + return -ENOTSUP; 15 + } 16 +
+7
src/kernel/emulation/linux/unistd/chflags.h
··· 1 + #ifndef LINUX_CHFLAGS_H 2 + #define LINUX_CHFLAGS_H 3 + 4 + long sys_chflags(const char* file, int flags); 5 + 6 + #endif 7 +
+24
src/kernel/emulation/linux/unistd/chmod_extended.c
··· 1 + #include "chmod_extended.h" 2 + #include "../base.h" 3 + #include "../errno.h" 4 + #include <asm/unistd.h> 5 + #include <libdyld/VirtualPrefix.h> 6 + 7 + long sys_chmod_extended(const char* path, int uid, int gid, int mode, void* xsec) 8 + { 9 + int ret; 10 + const char* xpath; 11 + 12 + xpath = __prefix_translate_path(path); 13 + 14 + ret = LINUX_SYSCALL(__NR_chmod, xpath, mode); 15 + if (ret < 0) 16 + return errno_linux_to_bsd(ret); 17 + 18 + ret = LINUX_SYSCALL(__NR_chown, xpath, uid, gid); 19 + if (ret < 0) 20 + return errno_linux_to_bsd(ret); 21 + 22 + return ret; 23 + } 24 +
+7
src/kernel/emulation/linux/unistd/chmod_extended.h
··· 1 + #ifndef LINUX_CHMOD_EXTENDED_H 2 + #define LINUX_CHMOD_EXTENDED_H 3 + 4 + long sys_chmod_extended(const char* path, int uid, int gid, int mode, void* xsec); 5 + 6 + #endif 7 +
+16
src/kernel/emulation/linux/unistd/fchflags.c
··· 1 + #include "fchflags.h" 2 + #include "../base.h" 3 + #include "../errno.h" 4 + #include <asm/unistd.h> 5 + #include "../../../../../platform-include/sys/errno.h" 6 + 7 + long sys_fchflags(int fd, int flags) 8 + { 9 + // TODO: We could implement this via ioctl(fd, FS_IOC_GETFLAGS/FS_IOC_SETFLAGS), 10 + // but it requires root and this functionality is not all that important. 11 + // 12 + // Returning ENOTSUP indicates that this filesystem doesn't support file flags, 13 + // which is true on NFS for example, so applications must accept this error return. 14 + return -ENOTSUP; 15 + } 16 +
+7
src/kernel/emulation/linux/unistd/fchflags.h
··· 1 + #ifndef LINUX_FCHFLAGS_H 2 + #define LINUX_FCHFLAGS_H 3 + 4 + long sys_fchflags(int fd, int flags); 5 + 6 + #endif 7 +
+20
src/kernel/emulation/linux/unistd/fchmod_extended.c
··· 1 + #include "fchmod_extended.h" 2 + #include "../base.h" 3 + #include "../errno.h" 4 + #include <asm/unistd.h> 5 + 6 + long sys_fchmod_extended(int fd, int uid, int gid, int mode, void* xsec) 7 + { 8 + int ret; 9 + 10 + ret = LINUX_SYSCALL2(__NR_fchmod, fd, mode); 11 + if (ret < 0) 12 + return errno_linux_to_bsd(ret); 13 + 14 + ret = LINUX_SYSCALL(__NR_fchown, fd, uid, gid); 15 + if (ret < 0) 16 + return errno_linux_to_bsd(ret); 17 + 18 + return ret; 19 + } 20 +
+7
src/kernel/emulation/linux/unistd/fchmod_extended.h
··· 1 + #ifndef LINUX_FCHMOD_EXTENDED_H 2 + #define LINUX_FCHMOD_EXTENDED_H 3 + 4 + long sys_fchmod_extended(int fd, int uid, int gid, int mode, void* xsec); 5 + 6 + #endif 7 +
+1
src/kernel/emulation/linux/unistd/rename.c
··· 3 3 #include "../errno.h" 4 4 #include <asm/unistd.h> 5 5 #include "../../../../../platform-include/sys/errno.h" 6 + #include <libdyld/VirtualPrefix.h> 6 7 7 8 extern char* strcpy(char* dst, const char* src); 8 9