File: alarm.c

package info (click to toggle)
systemtap 2.6-0.2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 21,220 kB
  • ctags: 10,944
  • sloc: cpp: 53,239; ansic: 50,615; exp: 33,694; sh: 9,906; xml: 7,665; perl: 2,089; python: 1,534; tcl: 1,236; makefile: 797; java: 148; lisp: 104; awk: 94; asm: 91; sed: 16
file content (59 lines) | stat: -rw-r--r-- 1,216 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* COVERAGE: alarm nanosleep pause */
#include <sys/types.h>
#include <unistd.h>
#include <time.h>
#include <string.h>
#include <signal.h>

static void
sigrt_act_handler(int signo, siginfo_t *info, void *context)
{
}

int main()
{
  struct timespec rem, t = {0,789};
  struct sigaction sigrt_act;
  memset(&sigrt_act, 0, sizeof(sigrt_act));
  sigrt_act.sa_handler = (void *)sigrt_act_handler;
  sigaction(SIGALRM, &sigrt_act, NULL);

  alarm(1);
#if defined(__ia64__) || defined(__arm__)
  //staptest// setitimer (ITIMER_REAL, \[0.000000,1.000000\], XXXX) = 0
#else
  //staptest// alarm (1) = 0
#endif

  pause();
#if defined(__ia64__)
  //staptest// rt_sigsuspend () =
#else
  //staptest// pause () =
#endif

  alarm(0);
#if defined(__ia64__) || defined(__arm__)
  //staptest// setitimer (ITIMER_REAL, \[0.000000,0.000000\], XXXX) = 0
#else
  //staptest// alarm (0) = 0
#endif

  alarm(-1);
  alarm(0);

  sleep(1);
  //staptest// nanosleep (\[1.000000000\], XXXX) = 0

  usleep(1234);
  //staptest// nanosleep (\[0.001234000\], 0x[0]+) = 0

  nanosleep(&t, &rem); 
  //staptest// nanosleep (\[0.000000789\], XXXX) = 0

  nanosleep(&t, NULL); 
  //staptest// nanosleep (\[0.000000789\], 0x[0]+) = 0

  return 0;
}