1/** 2 * D header file for GNU/Linux. 3 * 4 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) 5 * Authors: Nemanja Boric 6 */ 7module core.sys.linux.sys.eventfd; 8 9version (linux): 10extern (C): 11@nogc: 12@system: 13nothrow: 14 15version (ARM) version = ARM_Any; 16version (AArch64) version = ARM_Any; 17version (HPPA) version = HPPA_Any; 18version (MIPS32) version = MIPS_Any; 19version (MIPS64) version = MIPS_Any; 20version (PPC) version = PPC_Any; 21version (PPC64) version = PPC_Any; 22version (RISCV32) version = RISCV_Any; 23version (RISCV64) version = RISCV_Any; 24version (S390) version = IBMZ_Any; 25version (SPARC) version = SPARC_Any; 26version (SPARC64) version = SPARC_Any; 27version (SystemZ) version = IBMZ_Any; 28version (X86) version = X86_Any; 29version (X86_64) version = X86_Any; 30 31import core.stdc.stdint: uint64_t; 32 33/// Type for the event counter 34alias uint64_t eventfd_t; 35 36/* Return file descriptor for generic event channel. Set initial 37 value to count. */ 38int eventfd (uint count, int flags); 39 40/* Read event counter and possibly wait for events. */ 41int eventfd_read (int fd, eventfd_t* value); 42 43/* Increment event counter. */ 44int eventfd_write (int fd, eventfd_t value); 45 46version (CRuntime_UClibc) 47{ 48 version (MIPS_Any) 49 { 50 enum EFD_SEMAPHORE = 1; 51 enum EFD_CLOEXEC = 0x80000; // octal!02000000 52 enum EFD_NONBLOCK = 0x80; // octal!00000200 53 } 54 else version (SPARC_Any) 55 { 56 enum EFD_SEMAPHORE = 1; 57 enum EFD_CLOEXEC = 0x400000; 58 enum EFD_NONBLOCK = 0x004000; 59 } 60 else 61 { 62 enum EFD_SEMAPHORE = 1; 63 enum EFD_CLOEXEC = 0x80000; // octal!02000000 64 enum EFD_NONBLOCK = 0x800; // octal!00004000 65 } 66} 67else version (X86_Any) 68{ 69 enum EFD_SEMAPHORE = 1; 70 enum EFD_CLOEXEC = 0x80000; // octal!2000000 71 enum EFD_NONBLOCK = 0x800; // octal!4000 72} 73else version (HPPA_Any) 74{ 75 enum EFD_SEMAPHORE = 1; 76 enum EFD_CLOEXEC = 0x200000; // octal!10000000 77 enum EFD_NONBLOCK = 0x10004; // octal!00200004 78} 79else version (MIPS_Any) 80{ 81 enum EFD_SEMAPHORE = 1; 82 enum EFD_CLOEXEC = 0x80000; // octal!2000000 83 enum EFD_NONBLOCK = 0x80; // octal!200 84} 85else version (PPC_Any) 86{ 87 enum EFD_SEMAPHORE = 1; 88 enum EFD_CLOEXEC = 0x80000; // octal!2000000 89 enum EFD_NONBLOCK = 0x800; // octal!4000 90} 91else version (ARM_Any) 92{ 93 enum EFD_SEMAPHORE = 1; 94 enum EFD_CLOEXEC = 0x80000; // octal!2000000 95 enum EFD_NONBLOCK = 0x800; // octal!4000 96} 97else version (RISCV_Any) 98{ 99 enum EFD_SEMAPHORE = 1; 100 enum EFD_CLOEXEC = 0x80000; // octal!2000000 101 enum EFD_NONBLOCK = 0x800; // octal!4000 102} 103else version (SPARC_Any) 104{ 105 enum EFD_SEMAPHORE = 1; 106 enum EFD_CLOEXEC = 0x80000; // octal!2000000 107 enum EFD_NONBLOCK = 0x800; // octal!4000 108} 109else version (IBMZ_Any) 110{ 111 enum EFD_SEMAPHORE = 1; 112 enum EFD_CLOEXEC = 0x80000; // octal!2000000 113 enum EFD_NONBLOCK = 0x800; // octal!4000 114} 115else 116 static assert(0, "unimplemented"); 117