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 */ 7 module core.sys.linux.sys.eventfd; 8 9 version (linux): 10 extern (C): 11 @nogc: 12 @system: 13 nothrow: 14 15 version (ARM) version = ARM_Any; 16 version (AArch64) version = ARM_Any; 17 version (HPPA) version = HPPA_Any; 18 version (MIPS32) version = MIPS_Any; 19 version (MIPS64) version = MIPS_Any; 20 version (PPC) version = PPC_Any; 21 version (PPC64) version = PPC_Any; 22 version (RISCV32) version = RISCV_Any; 23 version (RISCV64) version = RISCV_Any; 24 version (S390) version = IBMZ_Any; 25 version (SPARC) version = SPARC_Any; 26 version (SPARC64) version = SPARC_Any; 27 version (SystemZ) version = IBMZ_Any; 28 version (X86) version = X86_Any; 29 version (X86_64) version = X86_Any; 30 31 import core.stdc.stdint: uint64_t; 32 33 /// Type for the event counter 34 alias uint64_t eventfd_t; 35 36 /* Return file descriptor for generic event channel. Set initial 37 value to count. */ 38 int eventfd (uint count, int flags); 39 40 /* Read event counter and possibly wait for events. */ 41 int eventfd_read (int fd, eventfd_t* value); 42 43 /* Increment event counter. */ 44 int eventfd_write (int fd, eventfd_t value); 45 version(CRuntime_UClibc)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 } version(X86_Any)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 } version(HPPA_Any)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 } version(MIPS_Any)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 } version(PPC_Any)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 } version(ARM_Any)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 } version(RISCV_Any)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 } version(SPARC_Any)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 } version(IBMZ_Any)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 } 115 else 116 static assert(0, "unimplemented"); 117