/** * Exit - cause normal process termination with specified status code */ void __attr_noreturn___ __attr_used___ exit (int status) /**< status code */ { syscall_1 (__NR_close, (long int) stdin); syscall_1 (__NR_close, (long int) stdout); syscall_1 (__NR_close, (long int) stderr); syscall_1 (__NR_exit_group, status); while (true) { /* unreachable */ } } /* exit */
/** * Abort current process, producing an abnormal program termination. * The function raises the SIGABRT signal. */ void __attr_noreturn___ __attr_used___ abort (void) { syscall_1 (SYSCALL_NO (close), (long int) stdin); syscall_1 (SYSCALL_NO (close), (long int) stdout); syscall_1 (SYSCALL_NO (close), (long int) stderr); raise (SIGABRT); while (true) { /* unreachable */ } } /* abort */
/** * Abort current process, producing an abnormal program termination. * The function raises the SIGABRT signal. */ void __attr_noreturn___ __attr_used___ abort (void) { syscall_1 (__NR_close, (long int) stdin); syscall_1 (__NR_close, (long int) stdout); syscall_1 (__NR_close, (long int) stderr); syscall_2 (__NR_kill, syscall_0 (__NR_getpid), SIGABRT); while (true) { /* unreachable */ } } /* abort */
int list_process(int flag) { int ret; ret = (int) syscall_1(SYS_listprocess,(uint64_t)flag); return ret; }
void kill(int pid_t) { int ret; ret = (int)syscall_1(SYS_killprocess,(uint64_t)pid_t); if (ret < 0) errno = ESRCH; }
void* sbrk(signed increment) { void* ret; ret =(void*)syscall_1((uint64_t)(12), ((uint64_t)(increment)) ); printf("here in user sbrk\n"); return ret; }
/** * Exit - cause normal process termination with specified status code */ void __attr_noreturn___ __attr_used___ exit (int status) /**< status code */ { #ifdef ENABLE_INIT_FINI libc_fini_array (); #endif /* ENABLE_INIT_FINI */ syscall_1 (SYSCALL_NO (close), (long int) stdin); syscall_1 (SYSCALL_NO (close), (long int) stdout); syscall_1 (SYSCALL_NO (close), (long int) stderr); syscall_1 (SYSCALL_NO (exit_group), status); while (true) { /* unreachable */ } } /* exit */
unsigned int sleep( unsigned int seconds) { unsigned int ret; unsigned int ticks = seconds*1000; ret =(unsigned int)syscall_1(SYS_nanosleep,(uint64_t)ticks); return ret; }
unsigned int alarm( unsigned int seconds) { unsigned int retSec; retSec = (unsigned int)syscall_1(SYS_alarm,(uint64_t)seconds); return retSec; }
unsigned int alarm(unsigned int seconds) { unsigned int ret; ret = syscall_1(SYS_alarm, seconds); /* __asm__ __volatile__( "syscall" : "=r" (ret) : "a"(SYS_alarm), "D"((uint64_t)seconds) );*/ return ret; }
int close(int fd) { int retvalue; retvalue = syscall_1(SYS_close, fd); if(retvalue >=0){ return retvalue; } return -1; }
int chdir(const char* path) { int r; r = syscall_1(SYS_chdir, (uint64_t)path); if (r < 0) { printf("chdir failed\n"); return -1; } return 0; }
int kill(int pid) { int result = 0; result = (int) syscall_1(SYS_kill, (uint64_t)pid); if(result < 0) { errno = (-1) * result; return -1; } return result; }
unsigned int sleep(unsigned int seconds) { unsigned int ret; uint64_t input_ns=seconds; ret = syscall_1(SYS_nanosleep, input_ns); /* __asm__ __volatile__( "syscall" : "=a" (ret) : "a"(SYS_nanosleep), "D"(input_ns) );*/ return ret; }
unsigned int sleep(unsigned int sec) { //printf("calling sleep"); int retvalue; struct timespec t= {0,0}; t.tv_sec = sec; t.tv_nsec = (sec - t.tv_sec)*1000000000; retvalue = syscall_1(SYS_nanosleep, (uint64_t)&t); //printf("sleep ret:%d",-retvalue); if(retvalue >=0){ return retvalue; } return -1; }
int chdir(const char *path){ int retvalue; //char pathToSend[100]; //strcpy(pathToSend,path); //printf("In libc PATH: %s\n", pathToSend ); retvalue=syscall_1(SYS_chdir,(uint64_t)path); if(retvalue >=0){ return retvalue; } //errno = -retvalue; return -1; }
unsigned int alarm(unsigned int seconds) { unsigned int ret; ret =syscall_1(SYS_alarm,((long)seconds)); return ret; }
int kill(int pid){ return syscall_1(SYS_kill, pid); }
unsigned int alarm(unsigned int seconds) { return (unsigned int) syscall_1(SYS_alarm, (uint64_t) seconds); }
void exit(int status) { syscall_1((long)(SYS_exit),((long)(status))); }
void exit(int status) { syscall_1(SYS_exit, status); }