📄 1423-1424.html
字号:
<HTML>
<HEAD>
<TITLE>Linux Complete Command Reference:Kernel Reference Guide:EarthWeb Inc.-</TITLE>
</HEAD>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!-- ISBN=0672311046 //-->
<!-- TITLE=Linux Complete Command Reference//-->
<!-- AUTHOR=Red Hat//-->
<!-- PUBLISHER=Macmillan Computer Publishing//-->
<!-- IMPRINT=Sams//-->
<!-- CHAPTER=09 //-->
<!-- PAGES=1423-1432 //-->
<!-- UNASSIGNED1 //-->
<!-- UNASSIGNED2 //-->
<P><CENTER>
<a href="../ch08/1421-1422.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="1425-1431.html">Next</A></CENTER></P>
<A NAME="PAGENUM-1423"><P>Page 1423</P></A>
<H3><A NAME="ch09_ 1">
Part IX:
</A></H3>
<H2>
Kernel Reference Guide
</H2>
<A NAME="PAGENUM-1424"><P>Page 1424</P></A>
<H3><A NAME="ch09_ 2">
add_timer, del_timer, init_timer
</A></H3>
<P>
add_timer, del_timer, init_timer—Manage event timers.
</P>
<P><B>
SYNOPSIS
</B></P>
<!-- CODE //-->
<PRE>
#include <asm/param.h>
#include <linux/timer.h>
extern void add_timer(struct timer_list * timer);
extern int del_timer(struct timer_list * timer);
extern inline void init_timer(struct timer_list * timer);
</PRE>
<!-- END CODE //-->
<P><B>
DESCRIPTION
</B></P>
<P>add_timer schedules an event, adding it to a linked list of events maintained by the kernel.
del_timer deletes a scheduled event. timer points to a
</P>
<!-- CODE //-->
<PRE>
struct timer_list {
struct timer_list *next;
struct timer_list *prev;
unsigned long expires;
unsigned long data;
void (*function)(unsigned long);
};
</PRE>
<!-- END CODE //-->
<P>init_timer sets next and prev to NULL. This is required for the argument of
add_timer. expires is the desired duration of the timer in jiffies, where there are
HZ (typically 100) jiffies per second. When the timer expires,
function is called with data as <BR>
its argument. It is the responsibility of function to delete the event. If the same function is managing several timers,
the argument can be used to distinguish which one expired.
<P><B>
RETURN VALUE
</B></P>
<P>del_timer returns zero on error—if next or
prev are not NULL, but the timer was not found.
del_timer also sets expires to the time remaining before the timer expires and sets
next and prev to NULL. Thus, calling del_timer followed immediately
by add_timer is a no-op provided a kernel tick does not occur between the two calls.
<P><B>
AUTHOR
</B></P>
<P>Linus Torvalds
</P>
<P>Linux 1.2.8, 31 May 1995
</P>
<H3><A NAME="ch09_ 3">
adjust_clock
</A></H3>
<P>adjust_clock—Adjusts startup time counter to tick in GMT.
</P>
<P><B>
SYNOPSIS
</B></P>
<!-- CODE SNIP //-->
<PRE>
linux/kernel/sys.c
void adjust_clock();
</PRE>
<!-- END CODE SNIP //-->
<P><B>
DESCRIPTION
</B></P>
<P>This routine adjusts the startup time by adding the time zone information to it. The goal is to get the startup time ticking
in GMT time.
<P><B>
NOTE
</B></P>
<P>This routine is called from settimeofday(2) when the time-zone information is first set.
</P>
<P><CENTER>
<a href="../ch08/1421-1422.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="1425-1431.html">Next</A></CENTER></P>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -