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 <= 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       └────────────────────────────────────────────┴───────────────┴─────────┘
54

CONFORMING TO

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

NOTES

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

SEE ALSO

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

COLOPHON

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