Lines Matching refs:fd
45 static bool bogusfd(int fd) { in bogusfd() argument
47 return fd < 0 || fd >= kTableSize; in bogusfd()
74 static FdDesc *fddesc(ThreadState *thr, uptr pc, int fd) { in fddesc() argument
75 CHECK_GE(fd, 0); in fddesc()
76 CHECK_LT(fd, kTableSize); in fddesc()
77 atomic_uintptr_t *pl1 = &fdctx.tab[fd / kTableSizeL2]; in fddesc()
90 return &((FdDesc*)l1)[fd % kTableSizeL2]; // NOLINT in fddesc()
94 static void init(ThreadState *thr, uptr pc, int fd, FdSync *s, in init() argument
96 FdDesc *d = fddesc(thr, pc, fd); in init()
143 bool FdLocation(uptr addr, int *fd, int *tid, u32 *stack) { in FdLocation() argument
151 *fd = l1 * kTableSizeL1 + l2; in FdLocation()
160 void FdAcquire(ThreadState *thr, uptr pc, int fd) { in FdAcquire() argument
161 if (bogusfd(fd)) in FdAcquire()
163 FdDesc *d = fddesc(thr, pc, fd); in FdAcquire()
165 DPrintf("#%d: FdAcquire(%d) -> %p\n", thr->tid, fd, s); in FdAcquire()
171 void FdRelease(ThreadState *thr, uptr pc, int fd) { in FdRelease() argument
172 if (bogusfd(fd)) in FdRelease()
174 FdDesc *d = fddesc(thr, pc, fd); in FdRelease()
176 DPrintf("#%d: FdRelease(%d) -> %p\n", thr->tid, fd, s); in FdRelease()
182 void FdAccess(ThreadState *thr, uptr pc, int fd) { in FdAccess() argument
183 DPrintf("#%d: FdAccess(%d)\n", thr->tid, fd); in FdAccess()
184 if (bogusfd(fd)) in FdAccess()
186 FdDesc *d = fddesc(thr, pc, fd); in FdAccess()
190 void FdClose(ThreadState *thr, uptr pc, int fd, bool write) { in FdClose() argument
191 DPrintf("#%d: FdClose(%d)\n", thr->tid, fd); in FdClose()
192 if (bogusfd(fd)) in FdClose()
194 FdDesc *d = fddesc(thr, pc, fd); in FdClose()
218 void FdFileCreate(ThreadState *thr, uptr pc, int fd) { in FdFileCreate() argument
219 DPrintf("#%d: FdFileCreate(%d)\n", thr->tid, fd); in FdFileCreate()
220 if (bogusfd(fd)) in FdFileCreate()
222 init(thr, pc, fd, &fdctx.filesync); in FdFileCreate()
244 void FdEventCreate(ThreadState *thr, uptr pc, int fd) { in FdEventCreate() argument
245 DPrintf("#%d: FdEventCreate(%d)\n", thr->tid, fd); in FdEventCreate()
246 if (bogusfd(fd)) in FdEventCreate()
248 init(thr, pc, fd, allocsync(thr, pc)); in FdEventCreate()
251 void FdSignalCreate(ThreadState *thr, uptr pc, int fd) { in FdSignalCreate() argument
252 DPrintf("#%d: FdSignalCreate(%d)\n", thr->tid, fd); in FdSignalCreate()
253 if (bogusfd(fd)) in FdSignalCreate()
255 init(thr, pc, fd, 0); in FdSignalCreate()
258 void FdInotifyCreate(ThreadState *thr, uptr pc, int fd) { in FdInotifyCreate() argument
259 DPrintf("#%d: FdInotifyCreate(%d)\n", thr->tid, fd); in FdInotifyCreate()
260 if (bogusfd(fd)) in FdInotifyCreate()
262 init(thr, pc, fd, 0); in FdInotifyCreate()
265 void FdPollCreate(ThreadState *thr, uptr pc, int fd) { in FdPollCreate() argument
266 DPrintf("#%d: FdPollCreate(%d)\n", thr->tid, fd); in FdPollCreate()
267 if (bogusfd(fd)) in FdPollCreate()
269 init(thr, pc, fd, allocsync(thr, pc)); in FdPollCreate()
272 void FdSocketCreate(ThreadState *thr, uptr pc, int fd) { in FdSocketCreate() argument
273 DPrintf("#%d: FdSocketCreate(%d)\n", thr->tid, fd); in FdSocketCreate()
274 if (bogusfd(fd)) in FdSocketCreate()
277 init(thr, pc, fd, &fdctx.socksync); in FdSocketCreate()
280 void FdSocketAccept(ThreadState *thr, uptr pc, int fd, int newfd) { in FdSocketAccept() argument
281 DPrintf("#%d: FdSocketAccept(%d, %d)\n", thr->tid, fd, newfd); in FdSocketAccept()
282 if (bogusfd(fd)) in FdSocketAccept()
289 void FdSocketConnecting(ThreadState *thr, uptr pc, int fd) { in FdSocketConnecting() argument
290 DPrintf("#%d: FdSocketConnecting(%d)\n", thr->tid, fd); in FdSocketConnecting()
291 if (bogusfd(fd)) in FdSocketConnecting()
297 void FdSocketConnect(ThreadState *thr, uptr pc, int fd) { in FdSocketConnect() argument
298 DPrintf("#%d: FdSocketConnect(%d)\n", thr->tid, fd); in FdSocketConnect()
299 if (bogusfd(fd)) in FdSocketConnect()
301 init(thr, pc, fd, &fdctx.socksync); in FdSocketConnect()