⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 alarm.c

📁 ucLinux is a very good embeded sytem. Most of company use this as their development OS.
💻 C
字号:
/* vi: set sw=4 ts=4: *//* * alarm() for uClibc * * Copyright (C) 2000-2004 by Erik Andersen <andersen@codepoet.org> * * GNU Library General Public License (LGPL) version 2 or later. */#include "syscalls.h"#include <unistd.h>#ifdef __NR_alarm_syscall1(unsigned int, alarm, unsigned int, seconds);#else#include <sys/time.h>unsigned int alarm(unsigned int seconds){	struct itimerval old, new;	unsigned int retval;	new.it_value.tv_usec = 0;	new.it_interval.tv_sec = 0;	new.it_interval.tv_usec = 0;	new.it_value.tv_sec = (long int) seconds;	if (setitimer(ITIMER_REAL, &new, &old) < 0) {		return 0;	}	retval = old.it_value.tv_sec;	if (old.it_value.tv_usec) {		++retval;	}	return retval;}#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -