#include #include #include // CODE FOR Stack Smashing Protector, TODO: MOVE / and do not duplicate // with kernel.c // http://wiki.osdev.org/Stack_Smashing_Protector #include #include #if UINT32_MAX == UINTPTR_MAX #define STACK_CHK_GUARD 0xe2dee396 #else #define STACK_CHK_GUARD 0x595e9fbd94fda766 #endif uintptr_t __stack_chk_guard = STACK_CHK_GUARD; __attribute__((noreturn)) void __stack_chk_fail(void) { write(1,"stack smashing!\n",16); exit(99); } /////////////////// // required by binutils! long sysconf(int name) { printf("SYSCONF CALLED WITH : %s",name); return 0; } // set file mode creation mask mode_t umask(mode_t mask) { return mask; } // chmod int chmod(const char * path, mode_t mode) { return -1; } // manipulating file descriptor int fcntl(int fd, int cmd, ...) { return -1; } // working directory char *getwd(char *buf) { static char wd[]="/"; buf=wd; return buf; } // check if access allowed int access(const char *pathname, int mode) { //TODO: at leas check if this file exists! return 0; } // update time int utime(const char *filename, const int *x) { return -1; } // rmdir int rmdir (const char *pathname) { return -1; } // chonw int chown(const char *path, uid_t owner, gid_t group) { return -1; }