这篇教程C++ sys_exit函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中sys_exit函数的典型用法代码示例。如果您正苦于以下问题:C++ sys_exit函数的具体用法?C++ sys_exit怎么用?C++ sys_exit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了sys_exit函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: startvoidstart(void){ int i; sys_share(SHARE); sys_priority(PRIORITY); #ifdef __EXERCISE_4A__ sys_yield();//for 4a #endif for (i = 0; i < RUNCOUNT; i++) { // Write characters to the console, yielding after each one. //cursorpos++ = PRINTCHAR; //atomic_swap(uint32_t *addr, uint32_t val); #ifdef __EXERCISE_8__ // exercise 8 sync method sys_atomic_print(PRINTCHAR); #else // exercise 6 sync method while(atomic_swap(&lock,1)!= 0) { //return 0 means get the lock; continue; } *cursorpos++ = PRINTCHAR; atomic_swap(&lock,0); #endif sys_yield(); //release the lock } // Yield forever. sys_exit(0);}
开发者ID:qinyiyan,项目名称:CS111,代码行数:32,
示例2: mainint main(char **argv, char **environ){ int input = open("/dev/tty0", O_RDONLY); printf("/x1B[12h"); char c = NULL; while(read(0, &c, 1) > 0) { printf("%c", c); int x, y; get_pos(input, &x, &y); if(y == 24) { printf("/x1B[0;24r"); printf("/x1B[0;24f/x1B[1;47;2;30m--- More ---"); printf("/x1B[8m"); fflush(stdout); char c; read(input, &c, 1); printf("/x1B[0m"); printf("/x1B[%d;23f", x); fflush(stdout); } } printf("/x1B[12l/n"); fflush(stdout); sys_exit(0);}
开发者ID:GruntTheDivine,项目名称:infinity,代码行数:26,
示例3: sys_statvoid sys_stat(char * pathname, struct stat * stat_buf){ if (stat(pathname,stat_buf) < 0) { log_err("error while stating file -- bailing out/n"); sys_exit(); }}
开发者ID:smillaedler,项目名称:rr,代码行数:7,
示例4: sys_closevoid sys_close(int filedes){ if (close(filedes) < 0) { log_err("error while closing file -- bailing out/n"); sys_exit(); }}
开发者ID:smillaedler,项目名称:rr,代码行数:7,
示例5: sys_fstatvoid sys_fstat(int filedes, struct stat * stat_buf){ if (fstat(filedes,stat_buf) < 0) { log_err("error while fstating file (fd = %d) -- bailing out/n",filedes); sys_exit(); }}
开发者ID:smillaedler,项目名称:rr,代码行数:7,
示例6: sys_munmapvoid sys_munmap(void* addr, size_t length){ if (munmap(addr, length) == -1) { log_err("cannot un-map file"); sys_exit(); }}
开发者ID:smillaedler,项目名称:rr,代码行数:7,
示例7: startvoidstart(void){ sys_priority(PRIORITY); sys_share(SHARE); sys_yield(); int i; for (i = 0; i < RUNCOUNT; i++) { // Write characters to the console, yielding after each one. //*cursorpos++ = PRINTCHAR; //call system call instead #ifndef __EXERCISE_8__ sys_print(PRINTCHAR); #endif #ifdef __EXERCISE_8__ while(atomic_swap(&spin_lock, 1) != 0){ //run 4ever until locked continue; } *cursorpos++ = PRINTCHAR; atomic_swap(&spin_lock, 0); //free #endif sys_yield(); } // Yield forever. while (1) //sys_yield(); sys_exit(0);}
开发者ID:kimsvatos,项目名称:cs111,代码行数:34,
示例8: startvoidstart(void){ int i; for (i = 0; i < RUNCOUNT; i++) { // Write characters to the console, yielding after each one. //*cursorpos++ = PRINTCHAR; // Atomic syscall version #ifdef __EXERCISE_6__ sys_print(PRINTCHAR); #endif // Atomic lock version #ifdef __EXERCISE_8__ while (atomic_swap(&lock, 1) != 0) continue; *cursorpos++ = PRINTCHAR; atomic_swap(&lock, 0); #endif sys_yield(); } /*// Yield forever. while (1) sys_yield();*/ sys_exit(0);}
开发者ID:ajinoc,项目名称:weensyos2,代码行数:32,
示例9: sys_open/* Open a file. */static intsys_open (const char *file){ struct file *sys_f; struct user_file *f;#if PRINT_DEBUG printf ("[SYSCALL] SYS_OPEN: file: %s/n", file);#endif if (file == NULL || !is_user_vaddr (file)) sys_exit (-1); lock_acquire (&file_lock); sys_f = filesys_open (file); lock_release (&file_lock); if (sys_f == NULL) return -1; f = (struct user_file *) malloc (sizeof (struct user_file)); if (f == NULL) { lock_acquire (&file_lock); file_close (sys_f); lock_release (&file_lock); return -1; } f->file = sys_f; f->fid = allocate_fid (); list_push_back (&thread_current ()->files, &f->thread_elem); return f->fid;}
开发者ID:roooot,项目名称:pintos,代码行数:35,
示例10: os_errorvoidos_error (const char *message){ recursion_check (); st_printf ("Operating system error: %s/n%s/n", get_oserror (), message); sys_exit (1);}
开发者ID:IntegerCompany,项目名称:linaro-android-gcc,代码行数:7,
示例11: startvoidstart(void){ int i; sys_set_priority(__PRIORITY__); sys_set_share(__SHARE__); sys_set_lottery_tickets(__LOTTERY_TICKETS__); for (i = 0; i < RUNCOUNT; i++) { // Write characters to the console, yielding after each one. #ifdef __PRINT_METHOD_LOCK__ while(atomic_swap(&lock, 1) != 0) continue; *cursorpos++ = PRINTCHAR; atomic_swap(&lock, 0); #else sys_atomic_print(PRINTCHAR); #endif sys_yield(); } // Yield forever. //while (1) // sys_yield(); sys_exit(0);}
开发者ID:TLutton,项目名称:Weensy-OS-2,代码行数:33,
示例12: sys_write/* Write to a file. */static intsys_write (int fd, const void *buffer, unsigned size){ struct user_file *f; int ret = -1;#if PRINT_DEBUG printf ("[SYSCALL] SYS_WRITE: fd: %d, buffer: %p, size: %u/n", fd, buffer, size);#endif if (fd == STDIN_FILENO) ret = -1; else if (fd == STDOUT_FILENO) { putbuf (buffer, size); ret = size; } else if (!is_user_vaddr (buffer) || !is_user_vaddr (buffer + size)) sys_exit (-1); else { f = file_by_fid (fd); if (f == NULL) ret = -1; else { lock_acquire (&file_lock); ret = file_write (f->file, buffer, size); lock_release (&file_lock); } } return ret;}
开发者ID:roooot,项目名称:pintos,代码行数:34,
示例13: sys_fclosevoid sys_fclose(FILE* file){ if (fclose(file) < 0) { log_err("error while closing file -- bailing out/n"); sys_exit(); }}
开发者ID:smillaedler,项目名称:rr,代码行数:7,
示例14: startvoidstart(void){ int i; for (i = 0; i < RUNCOUNT; i++) { #ifndef __EXERCISE_8__ /* EXERCISE 6: use a system call to print characters *****************/ sys_print(PRINTCHAR); #endif #ifdef __EXERCISE_8__ /* EXERCISE 8: use a lock to prevent race conditions *****************/ // spinlock until we obtain write lock while (atomic_swap(&spinlock, 1) != 0) continue; // write *cursorpos++ = PRINTCHAR; // release write lock atomic_swap(&spinlock, 0); #endif sys_yield(); } // Yield forever. while (1) sys_exit(0);}
开发者ID:zhucchini,项目名称:cs111-minilab2,代码行数:30,
示例15: signal_defaultstatic void signal_default(struct task *current, int signum){ /* Init ignores every signal */ if (current->pid == 1) return ; switch (signum) { case SIGCHLD: case SIGCONT: case SIGWINCH: /* Ignore */ break; case SIGSTOP: case SIGTSTP: case SIGTTIN: case SIGTTOU: kp(KP_TRACE, "task %d: Handling stop (%d)/n", current->pid, signum); current->ret_signal = TASK_SIGNAL_STOP | signum; current->state = TASK_STOPPED; if (current->parent) scheduler_task_wake(current->parent); scheduler_task_yield(); break; default: current->ret_signal = signum; sys_exit(0); }}
开发者ID:DSMan195276,项目名称:protura,代码行数:32,
示例16: startvoidstart(void){ int i; proc_priority(PRIORITYCHECK); proc_share(PRIORITYCHECK); sys_yield(); for (i = 0; i < RUNCOUNT; i++) {#ifdef USE_SYSTEM_SYNC // use a safe system call to print character to avoid a race condition proc_print(PRINTCHAR);#else // use atomic_swap to get a lock while (atomic_swap(&lock, 1) !=0 ) { continue; } // Write characters to the console, yielding after each one. *cursorpos++ = PRINTCHAR; // use atomic_swap to release lock atomic_swap(&lock, 0);#endif sys_yield(); } // Yield forever. // while (1) // sys_yield(); sys_exit(0);}
开发者ID:ChrisLaganiere,项目名称:Operating-Systems,代码行数:32,
示例17: SYS_WRITE_handlerint SYS_WRITE_handler(int32_t* esp){ // Default to error... int retVal = -1; int fd = *(esp + 1); char* buffer = (char*)*(esp + 2); int len = *(esp + 3); if(verify_fix_length(esp[2], esp[3]) == false){ sys_exit(-1); } if(fd == STDOUT_FILENO){ putbuf(buffer, len); // Since we wrote data, set return value to bytes written. retVal = len; } else if(fd > 1){ // A file descriptor has been used. struct file* file = flist_get_process_file(fd); if(file != NULL){ retVal = file_write(file, buffer, len); } } return retVal;}
开发者ID:posijon,项目名称:PintOS,代码行数:29,
示例18: exitvoidexit(int error_code) { cprintf("/n==> exit/n"); sys_exit(error_code); cprintf("BUG: exit failed./n"); while (1);}
开发者ID:lishuhuakai,项目名称:CS,代码行数:7,
示例19: _startvoid _start(int argc, char *argv[], char *envp[]){ int res; res = main(argc, argv, envp); sys_exit(res);}
开发者ID:StonyBrookUniversity,项目名称:SBUnix,代码行数:7,
示例20: startvoidstart(void){ int i; //exercise 4A //sys_priority (PRIORITY); //exercise 7 queue_t frontground = initQueue(); queue_t background = initQueue(); sys_multilevelq (QUEUE); sys_yield(); for (i = 0; i < RUNCOUNT; i++) { if (current->queue_name == q_foreground) { enQueue (frontground, pid_t current->p_pid); } else if (current->queue_name == q_background) { enQueue (background, pid_t current->p_pid); } else { console_printf(cursorpos, 0x100, "error on enqueue"); } // Write characters to the console, yielding after each one. *cursorpos++ = PRINTCHAR; sys_yield(); } // Yield forever. //while (1) //sys_yield(); sys_exit(0);}
开发者ID:summerxuan,项目名称:cs111,代码行数:34,
示例21: btn_check_resetstatic intbtn_check_reset(void){ unsigned int i_button_value = !BTN_PRESSED;#if defined (BOARD_GPIO_LED_POWER) int i_led;#endif#if defined (BOARD_GPIO_BTN_WPS) /* check WPS pressed */ if (btn_count_wps > 0) return 0;#endif#if defined (BOARD_GPIO_BTN_WLTOG) /* check WLTOG pressed */ if (btn_count_wlt > 0) return 0;#endif if (cpu_gpio_get_pin(BOARD_GPIO_BTN_RESET, &i_button_value) < 0) return 0; if (i_button_value == BTN_PRESSED) { /* "RESET" pressed */ btn_count_reset++;#if defined (BOARD_GPIO_LED_POWER) /* flash power LED */ i_led = get_state_led_pwr(); if (btn_count_reset == 1) cpu_gpio_set_pin(BOARD_GPIO_LED_POWER, i_led); else if (btn_count_reset > BTN_RESET_WAIT_COUNT) { cpu_gpio_set_pin(BOARD_GPIO_LED_POWER, (btn_count_reset % 2) ? !i_led : i_led); dbg("You can release RESET button now!/n"); }#endif } else { /* "RESET" released */ int press_count = btn_count_reset; btn_count_reset = 0; if (press_count > BTN_RESET_WAIT_COUNT) { /* pressed >= 5sec, reset! */ wd_alarmtimer(0, 0);#if defined (BOARD_GPIO_LED_POWER) cpu_gpio_set_pin(BOARD_GPIO_LED_POWER, LED_OFF);#endif erase_nvram(); erase_storage(); sys_exit(); } else if (press_count > 0) {#if defined (BOARD_GPIO_LED_POWER) LED_CONTROL(BOARD_GPIO_LED_POWER, LED_ON);#endif } } return (i_button_value != BTN_PRESSED) ? 0 : 1;}
开发者ID:jing-git,项目名称:rt-n56u,代码行数:58,
示例22: pmainvoidpmain(void){ volatile int checker = 30; /* This variable checks for some common stack errors. */ pid_t p; int i, status; app_printf("About to start a new process.../n"); p = sys_fork(); if (p == 0) { // Check that the kernel correctly copied the parent's stack. check(checker, 30, "new child"); checker = 30 + sys_getpid(); // Yield several times to help test Exercise 3 app_printf("Child process %d!/n", sys_getpid()); for (i = 0; i < 20; i++) sys_yield(); // Check that no one else corrupted our stack. check(checker, 30 + sys_getpid(), "end child"); sys_exit(1000); } else if (p > 0) { // Check that the child didn't corrupt our stack. check(checker, 30, "main parent"); app_printf("Main process %d!/n", sys_getpid()); do { status = sys_wait(p); } while (status == WAIT_TRYAGAIN); app_printf("Child %d exited with status %d!/n", p, status); check(status, 1000, "sys_wait for child"); // Check again that the child didn't corrupt our stack. check(checker, 30, "end parent"); sys_exit(0); } else { app_printf("Error!/n"); sys_exit(1); }}
开发者ID:js6450,项目名称:Operating-Systems,代码行数:45,
示例23: valid_addressstatic void valid_address(void *addr){ if(!is_user_vaddr(addr) || addr<0x8048000) sys_exit(-1);/* else if( pagedir_get_page( thread_current()->pagedir , addr) == NULL ) { sys_exit(-1); }*/}
开发者ID:goodahn,项目名称:cs330_OperatingSystem,代码行数:9,
示例24: mainvoid main (){ video_mode = 8; fps_max = 60; wait(2); bmap_zbuffer ( bmap_createblack(2048,2048,32) ); mouse_mode = 4; mouse_map = bmap_create ( "arrow_yellow.pcx" ); vec_fill ( &screen_color, 128 ); level_load ( "" ); camera->pan = -40; camera->tilt = -30; evnCameraLocate (); vec_set ( &colCameraBG, vector(150,150,150) ); camera->bg = pixel_for_vec ( &colCameraBG, 100, 8888 ); ENTITY *ent = ent_create ( CUBE_MDL, nullvector, NULL ); // Create style for the menues // CMMEMBER *myMenuStyle = cmstyle_create ( FONT *font, COLOR *colText, COLOR *colBack, COLOR *colOver ) FONT *fntTTF = font_create("Arial#16"); CMStyle *myMenuStyle01 = cmstyle_create ( fntTTF, vector(40,40,40), vector(250,250,250), vector(210,210,210) ); FONT *fntBitmap = font_create("ackfont.pcx"); CMStyle *myMenuStyle02 = cmstyle_create ( fntBitmap, vector(170,170,255), vector(30,20,0), vector(0,0,185) ); // Create a compact menu panel // PANEL *cmenu_create ( char *chrMember, var pos_x, var pos_y, var size_x, var layer, var flags, CMStyle *style ) PANEL *myMenu01 = cmenu_create ( "menu name.submenu=txtMain", 110, 20, 200, 1, SHOW, myMenuStyle01 ); PANEL *myMenu02 = cmenu_create ( "debug & statics.submenu=txtCMDebug", 500, 20, 200, 1, SHOW, myMenuStyle01 ); cmenu_modify ( myMenu02, 120, myMenuStyle02 ); bmpSky = bmap_create ( "sky_fu_256+6.tga" ); while ( !key_esc && !nExit ) { str_setchr ( strString, 1, random(32)+32 ); wait(1); } bmap_remove ( bmpSky ); bmpSky = NULL; bmap_remove ( mouse_map ); mouse_map = NULL; cmenu_remove ( myMenu01 ); sys_free ( myMenuStyle01 ); font_remove ( fntTTF ); cmenu_remove ( myMenu02 ); sys_free ( myMenuStyle02 ); font_remove ( fntBitmap ); sys_exit ( NULL );}
开发者ID:Acknex,项目名称:TUST,代码行数:57,
示例25: SYS_EXEC_handlerint SYS_EXEC_handler(int32_t* esp){ if(verify_variable_length(esp[1]) == false){ sys_exit(-1); } char *command_line = esp[1];//(char*)*(esp + 1); int retVal = process_execute(command_line); return retVal;}
开发者ID:posijon,项目名称:PintOS,代码行数:9,
示例26: trap_disk_handlervoid trap_disk_handler(struct user_context *user_ctx){ _enter(); sys_exit(ERROR, user_ctx); _leave(); return;}
开发者ID:jiayisuse,项目名称:kernel,代码行数:9,
示例27: sys_penguin_exitintsys_penguin_exit(struct penguin_exit_args *args){ kprintf("sys_exit/n"); int error = sys_exit((void*)args); kprintf("sys_exit returns error %d/n", error); args->sysmsg_result64 = error; return 0;}
开发者ID:sinetek,项目名称:penguin,代码行数:9,
示例28: checkstatic voidcheck(int actual_value, int expected_value, const char *type){ if (actual_value != expected_value) { app_printf("Problem at %s (got %d, expected %d)!/n", type, actual_value, expected_value); sys_exit(1); }}
开发者ID:js6450,项目名称:Operating-Systems,代码行数:9,
示例29: sys_memsetvoid* sys_memset(void * block, int c, size_t size){ void* tmp; if ((tmp = memset(block,c,size)) == NULL) { log_err("malloc failed, size is: %d/n",size); sys_exit(); } return tmp;}
开发者ID:smillaedler,项目名称:rr,代码行数:9,
注:本文中的sys_exit函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ sys_exofork函数代码示例 C++ sys_error函数代码示例 |