.SS Current details
Now that you have been warned, some current kernel details.
The structures are defined as follows.
-.sp
-.nf
+.PP
.in +4n
+.EX
#define _LINUX_CAPABILITY_VERSION_1 0x19980330
#define _LINUX_CAPABILITY_U32S_1 1
__u32 permitted;
__u32 inheritable;
} *cap_user_data_t;
-.fi
+.EE
.in -4n
-.sp
+.PP
The
.IR effective ,
.IR permitted ,
.I timespec
structures, as specified in
.IR <time.h> :
-.sp
+.PP
.in +4n
-.nf
+.EX
struct timespec {
time_t tv_sec; /* seconds */
long tv_nsec; /* nanoseconds */
};
-.fi
+.EE
.in
.PP
The
The time values passed to and returned by this call are specified using
.I timespec
structures, defined as follows:
-.sp
+.PP
.in +4n
-.nf
+.EX
struct timespec {
time_t tv_sec; /* seconds */
long tv_nsec; /* nanoseconds [0 .. 999999999] */
};
-.fi
+.EE
.in
.PP
The
The
.I struct epoll_event
is defined as:
-.sp
+.PP
.in +4n
-.nf
+.EX
typedef union epoll_data {
void *ptr;
int fd;
uint32_t events; /* Epoll events */
epoll_data_t data; /* User data variable */
};
-.fi
+.EE
.in
.PP
The
The
.I struct epoll_event
is defined as:
-.sp
+.PP
.in +4n
-.nf
+.EX
typedef union epoll_data {
void *ptr;
int fd;
uint32_t events; /* Epoll events */
epoll_data_t data; /* User data variable */
};
-.fi
+.EE
.in
.PP
The
The GNU C library defines an additional type,
and two functions that attempt to abstract some of the details of
reading and writing on an eventfd file descriptor:
+.PP
.in +4n
-.nf
-
+.EX
typedef uint64_t eventfd_t;
int eventfd_read(int fd, eventfd_t *value);
int eventfd_write(int fd, eventfd_t value);
-.fi
+.EE
.in
.PP
The functions perform the read and write operations on an
it reads from the eventfd file descriptor.
.PP
The following shell session shows a sample run of the program:
+.PP
.in +4n
-.nf
-
+.EX
.RB "$" " ./a.out 1 2 4 7 14"
Child writing 1 to efd
Child writing 2 to efd
Child completed write loop
Parent about to read
Parent read 28 (0x1c) from efd
-.fi
+.EE
.in
.SS Program source
\&