1UALARM(3)                  Linux Programmer's Manual                 UALARM(3)
2
3
4

NAME

6       ualarm - schedule signal after given number of microseconds
7

SYNOPSIS

9       #include <unistd.h>
10
11       useconds_t ualarm(useconds_t usecs, useconds_t interval);
12
13   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
14
15       ualarm():
16           Since glibc 2.12:
17               (_XOPEN_SOURCE >= 500) && ! (_POSIX_C_SOURCE >= 200809L)
18                   || /* Glibc since 2.19: */ _DEFAULT_SOURCE
19                   || /* Glibc versions <= 2.19: */ _BSD_SOURCE
20           Before glibc 2.12:
21               _BSD_SOURCE || _XOPEN_SOURCE >= 500
22

DESCRIPTION

24       The  ualarm()  function causes the signal SIGALRM to be sent to the in‐
25       voking process after (not less than) usecs microseconds.  The delay may
26       be lengthened slightly by any system activity or by the time spent pro‐
27       cessing the call or by the granularity of system timers.
28
29       Unless caught  or  ignored,  the  SIGALRM  signal  will  terminate  the
30       process.
31
32       If  the  interval  argument is nonzero, further SIGALRM signals will be
33       sent every interval microseconds after the first.
34

RETURN VALUE

36       This function returns the number  of  microseconds  remaining  for  any
37       alarm that was previously set, or 0 if no alarm was pending.
38

ERRORS

40       EINTR  Interrupted by a signal; see signal(7).
41
42       EINVAL usecs  or  interval  is  not  smaller than 1000000.  (On systems
43              where that is considered an error.)
44

ATTRIBUTES

46       For an  explanation  of  the  terms  used  in  this  section,  see  at‐
47       tributes(7).
48
49       ┌──────────┬───────────────┬─────────┐
50Interface Attribute     Value   
51       ├──────────┼───────────────┼─────────┤
52ualarm()  │ Thread safety │ MT-Safe │
53       └──────────┴───────────────┴─────────┘

CONFORMING TO

55       4.3BSD,   POSIX.1-2001.    POSIX.1-2001  marks  ualarm()  as  obsolete.
56       POSIX.1-2008 removes the specification of ualarm().  4.3BSD, SUSv2, and
57       POSIX do not define any errors.
58

NOTES

60       POSIX.1-2001  does not specify what happens if the usecs argument is 0.
61       On Linux (and probably most other systems), the effect is to cancel any
62       pending alarm.
63
64       The  type useconds_t is an unsigned integer type capable of holding in‐
65       tegers in the range [0,1000000].  On the original  BSD  implementation,
66       and in glibc before version 2.1, the arguments to ualarm() were instead
67       typed as unsigned int.  Programs will be more portable  if  they  never
68       mention useconds_t explicitly.
69
70       The  interaction  of  this  function with other timer functions such as
71       alarm(2),  sleep(3),   nanosleep(2),   setitimer(2),   timer_create(2),
72       timer_delete(2),   timer_getoverrun(2),   timer_gettime(2),  timer_set‐
73       time(2), usleep(3) is unspecified.
74
75       This function is obsolete.  Use setitimer(2) or POSIX  interval  timers
76       (timer_create(2), etc.)  instead.
77

SEE ALSO

79       alarm(2),    getitimer(2),   nanosleep(2),   select(2),   setitimer(2),
80       usleep(3), time(7)
81

COLOPHON

83       This page is part of release 5.10 of the Linux  man-pages  project.   A
84       description  of  the project, information about reporting bugs, and the
85       latest    version    of    this    page,    can     be     found     at
86       https://www.kernel.org/doc/man-pages/.
87
88
89
90                                  2017-09-15                         UALARM(3)
Impressum