summaryrefslogtreecommitdiff
path: root/src/ot_fdstate.c
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2026-11-12 22:28:39 +0100
committerDirk Engling <erdgeist@erdgeist.org>2026-11-12 22:28:39 +0100
commitbfef6800268cdcf0b9118d89f1ce7c3541bd0309 (patch)
treec43a44135953914a42dfe9666e85552fa4a35d17 /src/ot_fdstate.c
parent530d3ee20a06f2a128b1eddaf2398011d3f1d119 (diff)
Stop forcing 64 bit variables on 32 bit targets where a long would do just fineHEADmaster
Diffstat (limited to 'src/ot_fdstate.c')
-rw-r--r--src/ot_fdstate.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/ot_fdstate.c b/src/ot_fdstate.c
index 8e4bd89..bbb25d2 100644
--- a/src/ot_fdstate.c
+++ b/src/ot_fdstate.c
@@ -24,7 +24,7 @@ enum { FD_FREE, FD_IDLE, FD_BUSY, FD_CLOSING };
24typedef struct { 24typedef struct {
25 _Atomic uint64_t state; 25 _Atomic uint64_t state;
26 _Atomic(void *) cookie; 26 _Atomic(void *) cookie;
27 _Atomic ot_time expiry; 27 _Atomic unsigned long expiry;
28} ot_fdslot; 28} ot_fdslot;
29 29
30/* A descriptor the kernel can hand out is below the limit it was handed out 30/* A descriptor the kernel can hand out is below the limit it was handed out
@@ -72,7 +72,7 @@ static ot_fdslot *fdstate_slot(int fd) {
72 return g_slots + fd; 72 return g_slots + fd;
73} 73}
74 74
75uint32_t fdstate_open(int fd, void *cookie, ot_time expiry) { 75uint32_t fdstate_open(int fd, void *cookie, unsigned long expiry) {
76 ot_fdslot *slot = fdstate_slot(fd); 76 ot_fdslot *slot = fdstate_slot(fd);
77 uint64_t word; 77 uint64_t word;
78 78
@@ -132,10 +132,10 @@ void fdstate_release(int fd) {
132 atomic_store_explicit(&slot->state, FD_SET_ST(word, FD_IDLE), memory_order_release); 132 atomic_store_explicit(&slot->state, FD_SET_ST(word, FD_IDLE), memory_order_release);
133} 133}
134 134
135int fdstate_claim_expired(int fd, ot_time now) { 135int fdstate_claim_expired(int fd, unsigned long now) {
136 ot_fdslot *slot = fdstate_slot(fd); 136 ot_fdslot *slot = fdstate_slot(fd);
137 uint64_t word; 137 uint64_t word;
138 ot_time expiry; 138 unsigned long expiry;
139 139
140 if (!slot) 140 if (!slot)
141 return 0; 141 return 0;
@@ -168,7 +168,7 @@ void fdstate_close(int fd) {
168 atomic_store_explicit(&slot->state, FD_WORD(FD_GEN(word) + 1, FD_FREE), memory_order_release); 168 atomic_store_explicit(&slot->state, FD_WORD(FD_GEN(word) + 1, FD_FREE), memory_order_release);
169} 169}
170 170
171int fdstate_next_expired(ot_time now, int *cursor) { 171int fdstate_next_expired(unsigned long now, int *cursor) {
172 size_t highest = atomic_load_explicit(&g_slot_highest, memory_order_relaxed); 172 size_t highest = atomic_load_explicit(&g_slot_highest, memory_order_relaxed);
173 173
174 for (; (size_t)*cursor <= highest; ++*cursor) 174 for (; (size_t)*cursor <= highest; ++*cursor)
@@ -194,7 +194,7 @@ void fdstate_set_cookie(int fd, void *cookie) {
194 atomic_store_explicit(&slot->cookie, cookie, memory_order_release); 194 atomic_store_explicit(&slot->cookie, cookie, memory_order_release);
195} 195}
196 196
197void fdstate_set_expiry(int fd, ot_time expiry) { 197void fdstate_set_expiry(int fd, unsigned long expiry) {
198 ot_fdslot *slot = fdstate_slot(fd); 198 ot_fdslot *slot = fdstate_slot(fd);
199 199
200 if (slot) 200 if (slot)