您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ sys_reboot函数代码示例

51自学网 2021-06-03 08:37:29
  C++
这篇教程C++ sys_reboot函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中sys_reboot函数的典型用法代码示例。如果您正苦于以下问题:C++ sys_reboot函数的具体用法?C++ sys_reboot怎么用?C++ sys_reboot使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了sys_reboot函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: do_upgrade_cgi

void// do_upgrade_cgi(char *url, FILE *stream)do_upgrade_cgi(struct mime_handler *handler, char *url, webs_t streamm, char *query)	// jimmy,								// https,								// 8/6/2003{#ifndef ANTI_FLASH	fprintf(stderr, "do post/n");	if (upgrade_ret)		do_ej(handler, "Fail_u_s.asp", stream, NULL);	else		do_ej(handler, "Success_u_s.asp", stream, NULL);	fprintf(stderr, "websdone/n");	websDone(stream, 200);	fprintf(stderr, "reboot/n");	/*	 * Reboot if successful 	 */	if (upgrade_ret == 0) {		sleep(5);		sys_reboot();	}#else	do_ej(handler, "Fail_u_s.asp", stream, NULL);	websDone(stream, 200);#endif}
开发者ID:ebichu,项目名称:dd-wrt,代码行数:29,


示例2: geo_check_master_reset

void geo_check_master_reset( void ){    // Read reset messages from master    can_fullcan_msg_t *can_rst_msg_ptr = NULL;    can_fullcan_msg_t can_rst_msg;    rst_msg *geo_rst_msg;    can_rst_msg_ptr = CAN_fullcan_get_entry_ptr(can_id_rst);    bool status = CAN_fullcan_read_msg_copy(can_rst_msg_ptr, &can_rst_msg);    if( !status )        return;         // There is no reset message    LE.off(GEO_CAN_ERR_LED);    geo_rst_msg = (rst_msg *)&(can_rst_msg.data.bytes[0]);    if( geo_rst_msg->reset_geo == RESET )    {        LOG_ERROR("ERROR!!! Received a reset request from master/n");        sys_reboot();    }}
开发者ID:dhruvkakadiya,项目名称:Self_Driving_Car_TopGun,代码行数:25,


示例3: main

void main(){	unsigned char *data;	allocDoubleBuffer_vbe();		sys_VBEstart();	SCREEN =sys_giveSCREEN();	    allocDoubleBuffer_vbe();   	memset(SCREEN, 10, 1024*768*4);   		    OSMesaContext gl_ctx = OSMesaCreateContext(OSMESA_BGRA, NULL);	if(!OSMesaMakeCurrent(gl_ctx, DOUBLEBUFFER_vbe, GL_UNSIGNED_BYTE, 1024,768))		sys_reboot();			OSMesaPixelStore(OSMESA_Y_UP, 0);	reshape(1024,768);		init();		int i;	for(i = 0; i < 20000; i++)	{		angle += 6;		draw();		SwapBuffers_vbe();	}	fps(); }
开发者ID:s1mme,项目名称:ChiffOS,代码行数:29,


示例4: vApplicationMallocFailedHook

void vApplicationMallocFailedHook( void ){    u0_dbg_put("HALTING SYSTEM: Your system ran out of memory (RAM)!/n");    delay_us(3000 * 1000);    sys_reboot();}
开发者ID:PWDawgy,项目名称:lpc1758_freertos,代码行数:7,


示例5: isr_hard_fault_handler

/** * This is called from the HardFault_HandlerAsm with a pointer the Fault stack as the parameter. * We can then read the values from the stack and place them into local variables for ease of reading. * We then read the various Fault Status and Address Registers to help decode cause of the fault. * The function ends with a BKPT instruction to force control back into the debugger */void isr_hard_fault_handler(unsigned long *hardfault_args){    volatile unsigned int stacked_r0 ;    volatile unsigned int stacked_r1 ;    volatile unsigned int stacked_r2 ;    volatile unsigned int stacked_r3 ;    volatile unsigned int stacked_r12 ;    volatile unsigned int stacked_lr ;    volatile unsigned int stacked_pc ;    volatile unsigned int stacked_psr ;    stacked_r0 = ((unsigned long)hardfault_args[0]) ;    stacked_r1 = ((unsigned long)hardfault_args[1]) ;    stacked_r2 = ((unsigned long)hardfault_args[2]) ;    stacked_r3 = ((unsigned long)hardfault_args[3]) ;    stacked_r12 = ((unsigned long)hardfault_args[4]) ;    stacked_lr = ((unsigned long)hardfault_args[5]) ;    stacked_pc = ((unsigned long)hardfault_args[6]) ;    stacked_psr = ((unsigned long)hardfault_args[7]) ;    FAULT_EXISTS = FAULT_PRESENT_VAL;    FAULT_PC = stacked_pc;    FAULT_LR = stacked_lr - 1;    FAULT_PSR = stacked_psr;    sys_reboot();    /* Prevent compiler warnings */    (void) stacked_r0 ;    (void) stacked_r1 ;    (void) stacked_r2 ;    (void) stacked_r3 ;    (void) stacked_r12 ;}
开发者ID:liveusr,项目名称:selfdriving,代码行数:40,


示例6: main

int main(int argc, char *argv[]){  const char *cmd = "";  if(argc > 1) {    cmd = argv[1];  }  sys_reboot(cmd);}
开发者ID:Maddoc112,项目名称:moslo-1,代码行数:9,


示例7: vApplicationStackOverflowHook

void vApplicationStackOverflowHook( TaskHandle_t *pxTask, char *pcTaskName ){    u0_dbg_put("HALTING SYSTEM: Stack overflow by task: ");    u0_dbg_put((char*)pcTaskName);    u0_dbg_put("/nTry increasing stack memory of this task./n");	delay_us(3000 * 1000);	sys_reboot();}
开发者ID:PWDawgy,项目名称:lpc1758_freertos,代码行数:9,


示例8: cmd_quit

/* * Command for shutting down. */staticint cmd_quit(int nargs, char **args) {	(void) nargs;	(void) args;	vfs_sync();	sys_reboot(RB_POWEROFF);	thread_exit();	return 0;}
开发者ID:krnprdp,项目名称:os161-src,代码行数:13,


示例9: cmd_quit

/* * Command for shutting down. */staticintcmd_quit(int nargs, char **args){	(void)nargs;	(void)args;	vfs_sync();	sys_reboot(RB_POWEROFF);	#if OPT_A2	thread_exit(0);	#endif /* OPT_A2 */	return 0;}
开发者ID:1337codeMonkey,项目名称:OS-NNN,代码行数:17,


示例10: scheduler_start

void scheduler_start(bool register_internal_tlm){    /* If no failure, start the FreeRTOS scheduler */    if (!scheduler_init_all(register_internal_tlm)) {        puts("Starting scheduler ...");        vTaskStartScheduler();        // vTaskStartScheduler() should not return        puts("ERROR: Someone killed the scheduler");    }    else {        puts("ERROR: Refusing to start OS scheduler due to error(s)");        delay_ms(3000);        sys_reboot();    }}
开发者ID:kotoran,项目名称:RedhotAlarm,代码行数:16,


示例11: wdog_cmsdk_apb_isr

static void wdog_cmsdk_apb_isr(void){	/*	 * Check if the watchdog was the reason of the NMI interrupt	 * and if not, exit immediately	 */	if (!wdog_cmsdk_apb_has_fired()) {		printk("NMI received! Rebooting.../n");		/* In ARM implementation sys_reboot ignores the parameter */		sys_reboot(0);	} else {		if (user_cb != NULL) {			user_cb(wdog_r, 0);		}	}}
开发者ID:loicpoulain,项目名称:zephyr,代码行数:16,


示例12: syscall

/* * System call dispatcher. * * A pointer to the trapframe created during exception entry (in * exception.S) is passed in. * * The calling conventions for syscalls are as follows: Like ordinary * function calls, the first 4 32-bit arguments are passed in the 4 * argument registers a0-a3. 64-bit arguments are passed in *aligned* * pairs of registers, that is, either a0/a1 or a2/a3. This means that * if the first argument is 32-bit and the second is 64-bit, a1 is * unused. * * This much is the same as the calling conventions for ordinary * function calls. In addition, the system call number is passed in * the v0 register. * * On successful return, the return value is passed back in the v0 * register, or v0 and v1 if 64-bit. This is also like an ordinary * function call, and additionally the a3 register is also set to 0 to * indicate success. * * On an error return, the error code is passed back in the v0 * register, and the a3 register is set to 1 to indicate failure. * (Userlevel code takes care of storing the error code in errno and * returning the value -1 from the actual userlevel syscall function. * See src/user/lib/libc/arch/mips/syscalls-mips.S and related files.) * * Upon syscall return the program counter stored in the trapframe * must be incremented by one instruction; otherwise the exception * return code will restart the "syscall" instruction and the system * call will repeat forever. * * If you run out of registers (which happens quickly with 64-bit * values) further arguments must be fetched from the user-level * stack, starting at sp+16 to skip over the slots for the * registerized values, with copyin(). */voidsyscall(struct trapframe *tf){	int callno;	int32_t retval;	int err;	KASSERT(curthread != NULL);	KASSERT(curthread->t_curspl == 0);	KASSERT(curthread->t_iplhigh_count == 0);	callno = tf->tf_v0;	/*	 * Initialize retval to 0. Many of the system calls don't	 * really return a value, just 0 for success and -1 on	 * error. Since retval is the value returned on success,	 * initialize it to 0 by default; thus it's not necessary to	 * deal with it except for calls that return other values,	 * like write.	 */	retval = 0;	/* note the casts to userptr_t */	switch (callno) {	    case SYS_reboot:		err = sys_reboot(tf->tf_a0);		break;	    case SYS___time:		err = sys___time((userptr_t)tf->tf_a0,				 (userptr_t)tf->tf_a1);		break;	    /* process calls */	    case SYS_fork:		err = sys_fork(tf, &retval);		break;	    case SYS_execv:		err = sys_execv(			(userptr_t)tf->tf_a0,			(userptr_t)tf->tf_a1);		break;	    case SYS__exit:		sys__exit(tf->tf_a0);		panic("Returning from exit/n");	    case SYS_waitpid:		err = sys_waitpid(			tf->tf_a0,			(userptr_t)tf->tf_a1,			tf->tf_a2, 			&retval);		break;	    case SYS_getpid://.........这里部分代码省略.........
开发者ID:zSakare,项目名称:eos-asst3,代码行数:101,


示例13: mips_syscall

voidmips_syscall(struct trapframe *tf){	int callno;	int32_t retval;	int err;	assert(curspl==0);	/*	 * Initialize retval to 0. Many of the system calls don't	 * really return a value, just 0 for success and -1 on	 * error. Since retval is the value returned on success,	 * initialize it to 0 by default; thus it's not necessary to	 * deal with it except for calls that return other values, 	 * like write.	 */	retval = 0;	callno=tf->tf_v0;    char ch;	switch (callno) {	    case SYS_reboot:		err = sys_reboot(tf->tf_a0);		break;        case SYS__exit:         thread_exit();        break;	    /* Add stuff here */	    /*calls for assignment 0*/	    case SYS__helloworld:		//err = sys_helloworld(tf->tf_a0);		break; 	    case SYS__printint:		//err=sys_printint(tf->tf_a0,tf->tf_a1);		break;	    case SYS_getpid:		err=sys_getpid(&retval);				break;	    case SYS__printchar:		err=sys_printchar(tf->tf_a0);		break;	    case SYS__readchar:		err=sys_readchar(&ch);		//kprintf("/nin syscall::%c",ch);		break;		    case SYS_fork:		//kprintf("/n ::current addr space::%x",curthread->t_vmspace);		err=sys_fork(tf,curthread->t_vmspace);		break;			    case SYS_execv:		err=sys_execv(tf->tf_a0,tf->tf_a1);		//(const char *prog, char *const *args);		//prog points to a const string, const char pointer pointing to a const string		break;	    default:		kprintf("Unknown syscall %d/n", callno);		//kprintf("/ncallno::%d",tf->tf_v0);		err = ENOSYS;		break;	}	if (err) {		/*		 * Return the error code. This gets converted at		 * userlevel to a return value of -1 and the error		 * code in errno.		 */		tf->tf_v0 = err;		tf->tf_a3 = 1;      /* signal an error */	}	else {		/* Success. */		if(callno==SYS__readchar){			tf->tf_v0=ch;			tf->tf_a0=0;		}		else{			tf->tf_v0 = retval;			tf->tf_a3 = 0;      /* signal no error */		}	}		/*	 * Now, advance the program counter, to avoid restarting	 * the syscall over and over again.	 */		tf->tf_epc += 4;	/* Make sure the syscall code didn't forget to lower spl *///.........这里部分代码省略.........
开发者ID:aditi-d,项目名称:csci340,代码行数:101,


示例14: syscall

/* * System call dispatcher. * * A pointer to the trapframe created during exception entry (in * exception.S) is passed in. * * The calling conventions for syscalls are as follows: Like ordinary * function calls, the first 4 32-bit arguments are passed in the 4 * argument registers a0-a3. 64-bit arguments are passed in *aligned* * pairs of registers, that is, either a0/a1 or a2/a3. This means that * if the first argument is 32-bit and the second is 64-bit, a1 is * unused. * * This much is the same as the calling conventions for ordinary * function calls. In addition, the system call number is passed in * the v0 register. * * On successful return, the return value is passed back in the v0 * register, or v0 and v1 if 64-bit. This is also like an ordinary * function call, and additionally the a3 register is also set to 0 to * indicate success. * * On an error return, the error code is passed back in the v0 * register, and the a3 register is set to 1 to indicate failure. * (Userlevel code takes care of storing the error code in errno and * returning the value -1 from the actual userlevel syscall function. * See src/user/lib/libc/arch/mips/syscalls-mips.S and related files.) * * Upon syscall return the program counter stored in the trapframe * must be incremented by one instruction; otherwise the exception * return code will restart the "syscall" instruction and the system * call will repeat forever. * * If you run out of registers (which happens quickly with 64-bit * values) further arguments must be fetched from the user-level * stack, starting at sp+16 to skip over the slots for the * registerized values, with copyin(). */voidsyscall(struct trapframe *tf){	int callno;	int32_t retval;	int err;	KASSERT(curthread != NULL);	KASSERT(curthread->t_curspl == 0);	KASSERT(curthread->t_iplhigh_count == 0);	callno = tf->tf_v0;	/*	 * Initialize retval to 0. Many of the system calls don't	 * really return a value, just 0 for success and -1 on	 * error. Since retval is the value returned on success,	 * initialize it to 0 by default; thus it's not necessary to	 * deal with it except for calls that return other values, 	 * like write.	 */	retval = 0;	switch (callno) {	    case SYS_reboot:		    err = sys_reboot(tf->tf_a0);		    break;	    case SYS___time:		    err = sys___time((userptr_t)tf->tf_a0,				     (userptr_t)tf->tf_a1);		    break;            /* ASST2: These implementations of read and write only work for             * console I/O (stdin, stdout and stderr file descriptors)             */            case SYS_read:                err = sys_read(tf->tf_a0, (userptr_t)tf->tf_a1, tf->tf_a2,                               &retval);                break;            case SYS_write:                err = sys_write(tf->tf_a0, (userptr_t)tf->tf_a1, tf->tf_a2,                                &retval);                break;            /* process calls */            case SYS__exit:            	thread_exit(_MKWAIT_EXIT(tf->tf_a0));            	panic("Returning from exit/n");	            case SYS_fork:            	err = sys_fork(tf, &retval);            	break;            /* ASST2 - You need to fill in the code for each of these cases */            case SYS_getpid:            	err = sys_getpid(&retval);                break;//.........这里部分代码省略.........
开发者ID:SamuelChien,项目名称:OS161-ThreadMonitor,代码行数:101,


示例15: mips_syscall

voidmips_syscall(struct trapframe *tf){	int callno;	int32_t retval;	int err;	assert(curspl==0);	callno = tf->tf_v0;	/*	 * Initialize retval to 0. Many of the system calls don't	 * really return a value, just 0 for success and -1 on	 * error. Since retval is the value returned on success,	 * initialize it to 0 by default; thus it's not necessary to	 * deal with it except for calls that return other values, 	 * like write.	 */	retval = 0; 	DEBUG(DB_SYSCALL, "The syscall number is %d/n", callno);	switch (callno) {	    case SYS_reboot:		err = sys_reboot(tf->tf_a0);		break;	    /* Add stuff here */ 	    default:		kprintf("Unknown syscall %d/n", callno);		err = ENOSYS;		break;	}	if (err) {		/*		 * Return the error code. This gets converted at		 * userlevel to a return value of -1 and the error		 * code in errno.		 */		tf->tf_v0 = err;		tf->tf_a3 = 1;      /* signal an error */	}	else {		/* Success. */		tf->tf_v0 = retval;		tf->tf_a3 = 0;      /* signal no error */	}		/*	 * Now, advance the program counter, to avoid restarting	 * the syscall over and over again.	 */		tf->tf_epc += 4;	/* Make sure the syscall code didn't forget to lower spl */	assert(curspl==0);}
开发者ID:xwang1109,项目名称:os161.11,代码行数:62,


示例16: syscall

voidsyscall(struct trapframe *tf){	int callno;	int32_t retval;	int err;	KASSERT(curthread != NULL);	KASSERT(curthread->t_curspl == 0);	KASSERT(curthread->t_iplhigh_count == 0);	callno = tf->tf_v0;	/*	 * Initialize retval to 0. Many of the system calls don't	 * really return a value, just 0 for success and -1 on	 * error. Since retval is the value returned on success,	 * initialize it to 0 by default; thus it's not necessary to	 * deal with it except for calls that return other values, 	 * like write.	 */	retval = 0;	uint32_t v0, v1;	off_t pos;	int whence;	//userptr_t *status;	struct stat statbuf;	switch (callno) {	    case SYS_reboot:		err = sys_reboot(tf->tf_a0);		break;	    case SYS___time:		err = sys___time((userptr_t)tf->tf_a0,				 (userptr_t)tf->tf_a1);	 /* the syscall ov*/		break;	    case SYS_open:	    err = sys_open((const_userptr_t)tf->tf_a0, tf->tf_a1, (mode_t)tf ->tf_a2, &retval);	    break;	    case SYS_close:	    err = sys_close((tf->tf_a0),&retval);	    break;	    case SYS_read:	    	err = sys_read(tf->tf_a0, (userptr_t)tf->tf_a1, (size_t)tf -> tf_a2, &retval);	    	//retval = (int32_t)bytes;	    	break;	    case SYS_write:	   	    err = sys_write(tf->tf_a0, (userptr_t)tf->tf_a1, (size_t)tf -> tf_a2, &retval);	   	    //retval = (int32_t)bytes;	   	    break;	    case SYS_lseek:	    	pos = tf->tf_a2;	    	pos = pos << 32;	    	pos += tf -> tf_a3;	    	err = copyin((const_userptr_t)tf->tf_sp+16,&whence,sizeof(int));	    	if(err)	    	{	    		break;	    	}	    	err = sys_lseek(tf->tf_a0, pos, whence, &v0, &v1);	    	if(err)	    	{	    		break;	    	}	    	retval = v0;	    	tf->tf_v1 = v1;	    	break;	    case SYS__exit:	    	sys__exit(tf->tf_a0);//			We are only here because of one of 2 reasons. We tried to kill the initial thread//			while there was/were (an) immediate child(ren) of it running.//			*NOTE* I'm actually NOT sure if that's a valid reason to be here//			Second reason? Something went horribly, horribly wrong	    	err = 0;	    	break; 	    case SYS_dup2:	    	err = sys_dup2(tf->tf_a0,tf->tf_a1,&retval);	    	break;	    case SYS_fstat:	    	err = sys_fstat(tf->tf_a0, &statbuf);//.........这里部分代码省略.........
开发者ID:pd-smith,项目名称:os161,代码行数:101,


示例17: syscall

/* * System call dispatcher. * * A pointer to the trapframe created during exception entry (in * exception-*.S) is passed in. * * The calling conventions for syscalls are as follows: Like ordinary * function calls, the first 4 32-bit arguments are passed in the 4 * argument registers a0-a3. 64-bit arguments are passed in *aligned* * pairs of registers, that is, either a0/a1 or a2/a3. This means that * if the first argument is 32-bit and the second is 64-bit, a1 is * unused. * * This much is the same as the calling conventions for ordinary * function calls. In addition, the system call number is passed in * the v0 register. * * On successful return, the return value is passed back in the v0 * register, or v0 and v1 if 64-bit. This is also like an ordinary * function call, and additionally the a3 register is also set to 0 to * indicate success. * * On an error return, the error code is passed back in the v0 * register, and the a3 register is set to 1 to indicate failure. * (Userlevel code takes care of storing the error code in errno and * returning the value -1 from the actual userlevel syscall function. * See src/user/lib/libc/arch/mips/syscalls-mips.S and related files.) * * Upon syscall return the program counter stored in the trapframe * must be incremented by one instruction; otherwise the exception * return code will restart the "syscall" instruction and the system * call will repeat forever. * * If you run out of registers (which happens quickly with 64-bit * values) further arguments must be fetched from the user-level * stack, starting at sp+16 to skip over the slots for the * registerized values, with copyin(). */void syscall(struct trapframe *tf) {	int callno;	int32_t retval;	int err;	KASSERT(curthread != NULL);	KASSERT(curthread->t_curspl == 0);	KASSERT(curthread->t_iplhigh_count == 0);	callno = tf->tf_v0;	/*	 * Initialize retval to 0. Many of the system calls don't	 * really return a value, just 0 for success and -1 on	 * error. Since retval is the value returned on success,	 * initialize it to 0 by default; thus it's not necessary to	 * deal with it except for calls that return other values,	 * like write.	 */	retval = 0;	off_t pos, new_pos;	switch (callno) {	case SYS_reboot:		err = sys_reboot(tf->tf_a0);		break;	case SYS___time:		err = sys___time((userptr_t) tf->tf_a0, (userptr_t) tf->tf_a1);		break;	case SYS_open:		err = sys_open((userptr_t) tf->tf_a0, (int) tf->tf_a1,				(int) tf->tf_a2, &retval);		break;	case SYS_read:		err = sys_read((int) tf->tf_a0, (userptr_t) tf->tf_a1,				(int) tf->tf_a2, &retval);		break;	case SYS_write:		err = sys_write((int) tf->tf_a0, (userptr_t) tf->tf_a1,				(int) tf->tf_a2, &retval);		break;	case SYS_lseek:		pos = (((off_t)tf->tf_a2 << 32) | tf->tf_a3);		err = sys_lseek((userptr_t) tf->tf_a0, pos,				(userptr_t)(tf->tf_sp+16), &new_pos);		if (err == 0)		{			retval = (int32_t)(new_pos >> 32);			tf->tf_v1 = (int32_t)(new_pos & 0xFFFFFFFF);		}		break;//.........这里部分代码省略.........
开发者ID:barrylanceleo,项目名称:Operating-system-abstractions-in-OS161,代码行数:101,


示例18: process_mon_chains

/***********************************************************************F* Function:     static int process_mon_chains(void) P*A*Z* *P* Parameters:   noneP*P* Returnvalue:  intP*                - 0 if the function returns at all *Z* Intention:    This is the core function of the chain functionality.Z*               The list with the monitored chain is processed andZ*               expired entries handled appropriately by stepping upZ*               the escalation ladder.  The escalation actions areZ*               triggered from here. *D* Design:       [email
C++ sys_safecopyfrom函数代码示例
C++ sys_read函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。