1system_data_types(7)   Miscellaneous Information Manual   system_data_types(7)
2
3
4

NAME

6       system_data_types - overview of system data types
7

DESCRIPTION

9       sigevent
10              Include:  <signal.h>.   Alternatively,  <aio.h>,  <mqueue.h>, or
11              <time.h>.
12
13              struct sigevent {
14                  int             sigev_notify; /* Notification type */
15                  int             sigev_signo;  /* Signal number */
16                  union sigval    sigev_value;  /* Signal value */
17                  void          (*sigev_notify_function)(union sigval);
18                                                /* Notification function */
19                  pthread_attr_t *sigev_notify_attributes;
20                                                /* Notification attributes */
21              };
22
23              For further details about this type, see sigevent(7).
24
25              Versions:   <aio.h>   and   <time.h>   define   sigevent   since
26              POSIX.1-2008.
27
28              Conforming to: POSIX.1-2001 and later.
29
30              See   also:  timer_create(2),  getaddrinfo_a(3),  lio_listio(3),
31              mq_notify(3)
32
33              See also the aiocb structure in this page.
34
35       siginfo_t
36              Include: <signal.h>.  Alternatively, <sys/wait.h>.
37
38              typedef struct {
39                  int      si_signo;  /* Signal number */
40                  int      si_code;   /* Signal code */
41                  pid_t    si_pid;    /* Sending process ID */
42                  uid_t    si_uid;    /* Real user ID of sending process */
43                  void    *si_addr;   /* Address of faulting instruction */
44                  int      si_status; /* Exit value or signal */
45                  union sigval si_value;  /* Signal value */
46              } siginfo_t;
47
48              Information associated with a signal.  For  further  details  on
49              this  structure  (including  additional, Linux-specific fields),
50              see sigaction(2).
51
52              Conforming to: POSIX.1-2001 and later.
53
54              See  also:  pidfd_send_signal(2),   rt_sigqueueinfo(2),   sigac‐
55              tion(2), sigwaitinfo(2), psiginfo(3)
56
57       sigset_t
58              Include:  <signal.h>.   Alternatively,  <spawn.h>,  or  <sys/se‐
59              lect.h>.
60
61              This is a type that represents a set of signals.   According  to
62              POSIX, this shall be an integer or structure type.
63
64              Conforming to: POSIX.1-2001 and later.
65
66              See  also:  epoll_pwait(2),  ppoll(2), pselect(2), sigaction(2),
67              signalfd(2), sigpending(2), sigprocmask(2), sigsuspend(2),  sig‐
68              waitinfo(2), signal(7)
69
70       sigval
71              Include: <signal.h>.
72
73              union sigval {
74                  int     sigval_int; /* Integer value */
75                  void   *sigval_ptr; /* Pointer value */
76              };
77
78              Data passed with a signal.
79
80              Conforming to: POSIX.1-2001 and later.
81
82              See also: pthread_sigqueue(3), sigqueue(3), sigevent(7)
83
84              See  also  the sigevent structure and the siginfo_t type in this
85              page.
86

NOTES

88       The structures described in this manual page shall contain,  at  least,
89       the members shown in their definition, in no particular order.
90
91       Most  of  the  integer types described in this page don't have a corre‐
92       sponding length modifier for the printf(3) and the scanf(3) families of
93       functions.   To  print  a  value of an integer type that doesn't have a
94       length modifier, it should be converted to intmax_t or uintmax_t by  an
95       explicit cast.  To scan into a variable of an integer type that doesn't
96       have a length modifier, an intermediate temporary variable of type int‐
97       max_t  or  uintmax_t  should  be used.  When copying from the temporary
98       variable to the destination variable, the value could overflow.  If the
99       type  has  upper and lower limits, the user should check that the value
100       is within those limits, before actually copying the value.  The example
101       below shows how these conversions should be done.
102
103   Conventions used in this page
104       In  "Conforming  to"  we  only concern ourselves with C99 and later and
105       POSIX.1-2001 and later.  Some types may be specified  in  earlier  ver‐
106       sions  of one of these standards, but in the interests of simplicity we
107       omit details from earlier standards.
108
109       In "Include", we first note the "primary"  header(s)  that  define  the
110       type  according  to either the C or POSIX.1 standards.  Under "Alterna‐
111       tively", we note additional headers that the  standards  specify  shall
112       define the type.
113

EXAMPLES

115       The  program  shown below scans from a string and prints a value stored
116       in a variable of an integer type that doesn't have a  length  modifier.
117       The  appropriate  conversions from and to intmax_t, and the appropriate
118       range checks, are used as explained in the notes section above.
119
120       #include <stdint.h>
121       #include <stdio.h>
122       #include <stdlib.h>
123       #include <sys/types.h>
124
125       int
126       main (void)
127       {
128           static const char *const str = "500000 us in half a second";
129           suseconds_t us;
130           intmax_t    tmp;
131
132           /* Scan the number from the string into the temporary variable. */
133
134           sscanf(str, "%jd", &tmp);
135
136           /* Check that the value is within the valid range of suseconds_t. */
137
138           if (tmp < -1 || tmp > 1000000) {
139               fprintf(stderr, "Scanned value outside valid range!\n");
140               exit(EXIT_FAILURE);
141           }
142
143           /* Copy the value to the suseconds_t variable 'us'. */
144
145           us = tmp;
146
147           /* Even though suseconds_t can hold the value -1, this isn't
148              a sensible number of microseconds. */
149
150           if (us < 0) {
151               fprintf(stderr, "Scanned value shouldn't be negative!\n");
152               exit(EXIT_FAILURE);
153           }
154
155           /* Print the value. */
156
157           printf("There are %jd microseconds in half a second.\n",
158                   (intmax_t) us);
159
160           exit(EXIT_SUCCESS);
161       }
162

SEE ALSO

164       feature_test_macros(7), standards(7)
165
166
167
168Linux man-pages 6.04              2023-02-05              system_data_types(7)
Impressum