1700 Add SCSI UNMAP support
[unleashed.git] / usr / src / uts / common / sys / eventfd.h
blob1b0d961b0bce42d70cee7a1aba95a3d65c0d2b46
1 /*
2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
5 * 1.0 of the CDDL.
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.
13 * Copyright (c) 2015 Joyent, Inc. All rights reserved.
17 * Header file to support for the eventfd facility. Note that this facility
18 * is designed to be binary compatible with the Linux eventfd facility; values
19 * for constants here should therefore exactly match those found in Linux, and
20 * this facility shouldn't be extended independently of Linux.
23 #ifndef _SYS_EVENTFD_H
24 #define _SYS_EVENTFD_H
26 #include <sys/types.h>
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
32 typedef uint64_t eventfd_t;
35 * To assure binary compatibility with Linux, these values are fixed at their
36 * Linux equivalents, not their native ones.
38 #define EFD_CLOEXEC 02000000 /* LX_O_CLOEXEC */
39 #define EFD_NONBLOCK 04000 /* LX_O_NONBLOCK */
40 #define EFD_SEMAPHORE 1
43 * These ioctl values are specific to the native implementation; applications
44 * shouldn't be using them directly, and they should therefore be safe to
45 * change without breaking apps.
47 #define EVENTFDIOC (('e' << 24) | ('f' << 16) | ('d' << 8))
48 #define EVENTFDIOC_SEMAPHORE (EVENTFDIOC | 1) /* toggle sem state */
50 #ifndef _KERNEL
52 extern int eventfd(unsigned int, int);
53 extern int eventfd_read(int, eventfd_t *);
54 extern int eventfd_write(int, eventfd_t);
56 #else
58 #define EVENTFDMNRN_EVENTFD 0
59 #define EVENTFDMNRN_CLONE 1
60 #define EVENTFD_VALMAX (ULLONG_MAX - 1ULL)
62 #endif /* _KERNEL */
64 #ifdef __cplusplus
66 #endif
68 #endif /* _SYS_EVENTFD_H */