diff options
-rw-r--r-- | Kernel/Process.cpp | 1 | ||||
-rw-r--r-- | Launcher/.gitignore | 2 | ||||
-rwxr-xr-x | Launcher/Launcher | bin | 67172 -> 0 bytes | |||
-rw-r--r-- | LibC/Makefile | 1 | ||||
-rw-r--r-- | LibC/fcntl.h | 25 | ||||
-rw-r--r-- | LibC/float.h | 0 | ||||
-rw-r--r-- | LibC/locale.cpp | 13 | ||||
-rw-r--r-- | LibC/locale.h | 1 | ||||
-rw-r--r-- | LibC/setjmp.asm | 4 | ||||
-rw-r--r-- | LibC/stat.cpp | 8 | ||||
-rw-r--r-- | LibC/stdbool.h | 13 | ||||
-rw-r--r-- | LibC/stdint.h | 2 | ||||
-rw-r--r-- | LibC/stdio.cpp | 6 | ||||
-rw-r--r-- | LibC/stdio.h | 1 | ||||
-rw-r--r-- | LibC/stdlib.cpp | 11 | ||||
-rw-r--r-- | LibC/stdlib.h | 3 | ||||
-rw-r--r-- | LibC/string.cpp | 10 | ||||
-rw-r--r-- | LibC/string.h | 1 | ||||
-rw-r--r-- | LibC/sys/stat.h | 9 | ||||
-rw-r--r-- | LibC/time.cpp | 5 | ||||
-rw-r--r-- | LibC/time.h | 3 | ||||
-rw-r--r-- | LibC/ulimit.cpp | 1 | ||||
-rw-r--r-- | LibC/unistd.cpp | 5 | ||||
-rw-r--r-- | LibC/unistd.h | 35 | ||||
-rw-r--r-- | Userland/ls.cpp | 1 | ||||
-rw-r--r-- | Userland/sh.cpp | 1 |
26 files changed, 125 insertions, 37 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index e1244c2d14..5eb3116beb 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -1678,7 +1678,6 @@ bool Process::validate_write(void* address, size_t size) const if (check_kernel_memory_access(LinearAddress((dword)address), true)) return true; } - ASSERT(size); if (!size) return false; LinearAddress first_address((dword)address); diff --git a/Launcher/.gitignore b/Launcher/.gitignore index ea286a24a6..3065890cba 100644 --- a/Launcher/.gitignore +++ b/Launcher/.gitignore @@ -1,3 +1,3 @@ *.o *.d -FontEditor +Launcher diff --git a/Launcher/Launcher b/Launcher/Launcher Binary files differdeleted file mode 100755 index 80b31262b4..0000000000 --- a/Launcher/Launcher +++ /dev/null diff --git a/LibC/Makefile b/LibC/Makefile index 3254a55339..e7758391b4 100644 --- a/LibC/Makefile +++ b/LibC/Makefile @@ -44,6 +44,7 @@ LIBC_OBJS = \ gui.o \ sys/select.o \ poll.o \ + locale.o \ entry.o ASM_OBJS = setjmp.no diff --git a/LibC/fcntl.h b/LibC/fcntl.h index 5181ff22df..fd6b710823 100644 --- a/LibC/fcntl.h +++ b/LibC/fcntl.h @@ -25,6 +25,31 @@ __BEGIN_DECLS #define O_NOFOLLOW 00400000 #define O_CLOEXEC 02000000 +#define S_IFMT 0170000 +#define S_IFDIR 0040000 +#define S_IFCHR 0020000 +#define S_IFBLK 0060000 +#define S_IFREG 0100000 +#define S_IFIFO 0010000 +#define S_IFLNK 0120000 +#define S_IFSOCK 0140000 + +#define S_ISUID 04000 +#define S_ISGID 02000 +#define S_ISVTX 01000 +#define S_IRUSR 0400 +#define S_IWUSR 0200 +#define S_IXUSR 0100 +#define S_IRGRP 0040 +#define S_IWGRP 0020 +#define S_IXGRP 0010 +#define S_IROTH 0004 +#define S_IWOTH 0002 +#define S_IXOTH 0001 + +#define S_IRWXG (S_IRWXU >> 3) +#define S_IRWXO (S_IRWXG >> 3) + int fcntl(int fd, int cmd, ...); __END_DECLS diff --git a/LibC/float.h b/LibC/float.h new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/LibC/float.h diff --git a/LibC/locale.cpp b/LibC/locale.cpp new file mode 100644 index 0000000000..8b7eb312dd --- /dev/null +++ b/LibC/locale.cpp @@ -0,0 +1,13 @@ +#include <locale.h> +#include <assert.h> +#include <stdio.h> + +extern "C" { + +char* setlocale(int category, const char* locale) +{ + dbgprintf("FIXME(LibC): setlocale(%d, %s)\n", category, locale); + return nullptr; +} + +} diff --git a/LibC/locale.h b/LibC/locale.h index d5e4530d09..5243769a83 100644 --- a/LibC/locale.h +++ b/LibC/locale.h @@ -5,6 +5,7 @@ enum { LC_ALL, LC_NUMERIC, + LC_CTYPE, }; __BEGIN_DECLS diff --git a/LibC/setjmp.asm b/LibC/setjmp.asm index 7f1f13feec..68d08ef7d9 100644 --- a/LibC/setjmp.asm +++ b/LibC/setjmp.asm @@ -3,7 +3,7 @@ global setjmp setjmp: mov eax, [esp + 4] - mov [eax * 4], ebx + mov [eax + 0 * 4], ebx mov [eax + 1 * 4], esi mov [eax + 2 * 4], edi mov [eax + 3 * 4], ebp @@ -18,7 +18,7 @@ global longjmp longjmp: mov edx, [esp + 4] mov eax, [esp + 8] - mov ebx, [edx * 4] + mov ebx, [edx + 0 * 4] mov esi, [edx + 1 * 4] mov edi, [edx + 2 * 4] mov ebp, [edx + 3 * 4] diff --git a/LibC/stat.cpp b/LibC/stat.cpp index 47bfe01e6a..22414cda4e 100644 --- a/LibC/stat.cpp +++ b/LibC/stat.cpp @@ -1,5 +1,7 @@ #include <sys/stat.h> #include <errno.h> +#include <assert.h> +#include <stdio.h> #include <Kernel/Syscall.h> extern "C" { @@ -21,5 +23,11 @@ int chmod(const char* pathname, mode_t mode) __RETURN_WITH_ERRNO(rc, rc, -1); } +int fchmod(int fd, mode_t mode) +{ + dbgprintf("FIXME(LibC): fchmod(%d, %o)\n", fd, mode); + ASSERT_NOT_REACHED(); +} + } diff --git a/LibC/stdbool.h b/LibC/stdbool.h new file mode 100644 index 0000000000..aa00f3430a --- /dev/null +++ b/LibC/stdbool.h @@ -0,0 +1,13 @@ +#pragma once + +#include <sys/cdefs.h> + +__BEGIN_DECLS + +#define bool _Bool +#define true 1 +#define false 0 +#define __bool_true_false_are_Defined 1 + +__END_DECLS + diff --git a/LibC/stdint.h b/LibC/stdint.h index 29af12f654..4ff57745be 100644 --- a/LibC/stdint.h +++ b/LibC/stdint.h @@ -14,6 +14,8 @@ typedef signed int int32_t; typedef signed short int16_t; typedef signed char int8_t; +typedef uint32_t uintptr_t; + #define INT8_MIN (-128) #define INT16_MIN (-32767-1) #define INT32_MIN (-2147483647-1) diff --git a/LibC/stdio.cpp b/LibC/stdio.cpp index ca9cd549b3..d3d4f6df52 100644 --- a/LibC/stdio.cpp +++ b/LibC/stdio.cpp @@ -365,5 +365,11 @@ int fclose(FILE* stream) return rc; } +int rename(const char* oldpath, const char* newpath) +{ + dbgprintf("FIXME(LibC): rename(%s, %s)\n", oldpath, newpath); + ASSERT_NOT_REACHED(); +} + } diff --git a/LibC/stdio.h b/LibC/stdio.h index 11816f6182..fac01d731b 100644 --- a/LibC/stdio.h +++ b/LibC/stdio.h @@ -70,6 +70,7 @@ int fscanf(FILE*, const char* fmt, ...); int setvbuf(FILE*, char* buf, int mode, size_t); void setbuf(FILE*, char* buf); void setlinebuf(FILE*); +int rename(const char* oldpath, const char* newpath); __END_DECLS diff --git a/LibC/stdlib.cpp b/LibC/stdlib.cpp index 7afa23b98a..06e48cf4cf 100644 --- a/LibC/stdlib.cpp +++ b/LibC/stdlib.cpp @@ -267,6 +267,17 @@ int system(const char* command) return execl("/bin/sh", "sh", "-c", command, nullptr); } +char* mktemp(char*) +{ + ASSERT_NOT_REACHED(); +} + +void* bsearch(const void* key, const void* base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) +{ + dbgprintf("FIXME(LibC): bsearch(%p, %p, %u, %u, %p)\n", key, base, nmemb, size, compar); + ASSERT_NOT_REACHED(); +} + div_t div(int numerator, int denominator) { div_t result; diff --git a/LibC/stdlib.h b/LibC/stdlib.h index 27f4d2dc81..bc673b0a02 100644 --- a/LibC/stdlib.h +++ b/LibC/stdlib.h @@ -7,6 +7,7 @@ __BEGIN_DECLS #define EXIT_SUCCESS 0 #define EXIT_FAILURE 1 +#define MB_CUR_MAX 1 void* malloc(size_t) __MALLOC; void free(void*); @@ -22,6 +23,8 @@ char* ptsname(int fd); int ptsname_r(int fd, char* buffer, size_t); int abs(int); int system(const char* command); +char* mktemp(char*); +void* bsearch(const void* key, const void* base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)); #define RAND_MAX 32767 int rand(); diff --git a/LibC/string.cpp b/LibC/string.cpp index 2c0ea87753..dbea2a5b3b 100644 --- a/LibC/string.cpp +++ b/LibC/string.cpp @@ -285,5 +285,15 @@ char* strstr(const char* haystack, const char* needle) return const_cast<char*>(haystack); } +char* strpbrk(const char* s, const char* accept) +{ + while (*s) + if(strchr(accept, *s++)) + return (char*)--s; + return nullptr; +} + + + } diff --git a/LibC/string.h b/LibC/string.h index 7783731d91..bfeca32abc 100644 --- a/LibC/string.h +++ b/LibC/string.h @@ -28,6 +28,7 @@ size_t strspn(const char*, const char* accept); size_t strcspn(const char*, const char* reject); char* strerror(int errnum); char* strsignal(int signum); +char* strpbrk(const char*, const char* accept); __END_DECLS diff --git a/LibC/sys/stat.h b/LibC/sys/stat.h index b1f6d860a7..f5a8980fe5 100644 --- a/LibC/sys/stat.h +++ b/LibC/sys/stat.h @@ -2,11 +2,20 @@ #include <sys/cdefs.h> #include <sys/types.h> +#include <fcntl.h> __BEGIN_DECLS +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) +#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) +#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) +#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) +#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) + mode_t umask(mode_t); int chmod(const char* pathname, mode_t); +int fchmod(int fd, mode_t); int mkdir(const char* pathname, mode_t); inline dev_t makedev(unsigned int major, unsigned int minor) { return (minor & 0xffu) | (major << 8u) | ((minor & ~0xffu) << 12u); } diff --git a/LibC/time.cpp b/LibC/time.cpp index cecc161f44..9c3ddaa0dd 100644 --- a/LibC/time.cpp +++ b/LibC/time.cpp @@ -83,7 +83,10 @@ struct tm* localtime(const time_t* t) return &tm_buf; } -long timezone = 0; +long timezone; +long altzone; +char* tzname[2]; +int daylight; void tzset() { diff --git a/LibC/time.h b/LibC/time.h index 45f17cd4f5..9433f276c6 100644 --- a/LibC/time.h +++ b/LibC/time.h @@ -23,6 +23,9 @@ struct tm { }; extern long timezone; +extern long altzone; +extern char* tzname[2]; +extern int daylight; int gettimeofday(struct timeval*, struct timezone* tz); struct tm* localtime(const time_t*); diff --git a/LibC/ulimit.cpp b/LibC/ulimit.cpp index cfc3d82433..77f551498a 100644 --- a/LibC/ulimit.cpp +++ b/LibC/ulimit.cpp @@ -11,4 +11,3 @@ long ulimit(int cmd, long newlimit) } } - diff --git a/LibC/unistd.cpp b/LibC/unistd.cpp index 71a57a290e..e0123fe63a 100644 --- a/LibC/unistd.cpp +++ b/LibC/unistd.cpp @@ -6,6 +6,7 @@ #include <grp.h> #include <pwd.h> #include <stdio.h> +#include <stdlib.h> #include <sys/ioctl.h> #include <sys/types.h> #include <Kernel/Syscall.h> @@ -186,6 +187,10 @@ int chdir(const char* path) char* getcwd(char* buffer, size_t size) { + if (!buffer) { + size = size ? size : PATH_MAX; + buffer = (char*)malloc(size); + } int rc = syscall(SC_getcwd, buffer, size); __RETURN_WITH_ERRNO(rc, buffer, nullptr); } diff --git a/LibC/unistd.h b/LibC/unistd.h index a3355cbc99..99f18bad67 100644 --- a/LibC/unistd.h +++ b/LibC/unistd.h @@ -73,37 +73,10 @@ enum { #define HOST_NAME_MAX 64 -#define S_IFMT 0170000 -#define S_IFDIR 0040000 -#define S_IFCHR 0020000 -#define S_IFBLK 0060000 -#define S_IFREG 0100000 -#define S_IFIFO 0010000 -#define S_IFLNK 0120000 -#define S_IFSOCK 0140000 - -#define S_ISUID 04000 -#define S_ISGID 02000 -#define S_ISVTX 01000 -#define S_IRUSR 0400 -#define S_IWUSR 0200 -#define S_IXUSR 0100 -#define S_IRGRP 0040 -#define S_IWGRP 0020 -#define S_IXGRP 0010 -#define S_IROTH 0004 -#define S_IWOTH 0002 -#define S_IXOTH 0001 - -#define S_IRWXG (S_IRWXU >> 3) -#define S_IRWXO (S_IRWXG >> 3) - -#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) -#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) -#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) -#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) -#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) +#define R_OK 4 +#define W_OK 2 +#define X_OK 1 +#define F_OK 0 __END_DECLS diff --git a/Userland/ls.cpp b/Userland/ls.cpp index 80ca15bd64..d5969b1e36 100644 --- a/Userland/ls.cpp +++ b/Userland/ls.cpp @@ -5,6 +5,7 @@ #include <string.h> #include <getopt.h> #include <time.h> +#include <fcntl.h> #include <sys/ioctl.h> #include <sys/stat.h> #include <AK/AKString.h> diff --git a/Userland/sh.cpp b/Userland/sh.cpp index 0e49297420..0cd80c8628 100644 --- a/Userland/sh.cpp +++ b/Userland/sh.cpp @@ -8,6 +8,7 @@ #include <fcntl.h> #include <termios.h> #include <sys/mman.h> +#include <sys/stat.h> #include <sys/utsname.h> #include <AK/FileSystemPath.h> |