1ualarm(3)                  Library Functions Manual                  ualarm(3)
2
3
4

NAME

6       ualarm - schedule signal after given number of microseconds
7

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUE

39       This function returns the number  of  microseconds  remaining  for  any
40       alarm that was previously set, or 0 if no alarm was pending.
41

ERRORS

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

ATTRIBUTES

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

STANDARDS

59       None.
60

HISTORY

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

SEE ALSO

86       alarm(2),   getitimer(2),   nanosleep(2),   select(2),    setitimer(2),
87       usleep(3), time(7)
88
89
90
91Linux man-pages 6.05              2023-07-20                         ualarm(3)
Impressum