annotate libsanitizer/tsan/tsan_fd.h @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 //===-- tsan_fd.h -----------------------------------------------*- C++ -*-===//
kono
parents:
diff changeset
2 //
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
4 // See https://llvm.org/LICENSE.txt for license information.
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
111
kono
parents:
diff changeset
6 //
kono
parents:
diff changeset
7 //===----------------------------------------------------------------------===//
kono
parents:
diff changeset
8 //
kono
parents:
diff changeset
9 // This file is a part of ThreadSanitizer (TSan), a race detector.
kono
parents:
diff changeset
10 //
kono
parents:
diff changeset
11 // This file handles synchronization via IO.
kono
parents:
diff changeset
12 // People use IO for synchronization along the lines of:
kono
parents:
diff changeset
13 //
kono
parents:
diff changeset
14 // int X;
kono
parents:
diff changeset
15 // int client_socket; // initialized elsewhere
kono
parents:
diff changeset
16 // int server_socket; // initialized elsewhere
kono
parents:
diff changeset
17 //
kono
parents:
diff changeset
18 // Thread 1:
kono
parents:
diff changeset
19 // X = 42;
kono
parents:
diff changeset
20 // send(client_socket, ...);
kono
parents:
diff changeset
21 //
kono
parents:
diff changeset
22 // Thread 2:
kono
parents:
diff changeset
23 // if (recv(server_socket, ...) > 0)
kono
parents:
diff changeset
24 // assert(X == 42);
kono
parents:
diff changeset
25 //
kono
parents:
diff changeset
26 // This file determines the scope of the file descriptor (pipe, socket,
kono
parents:
diff changeset
27 // all local files, etc) and executes acquire and release operations on
kono
parents:
diff changeset
28 // the scope as necessary. Some scopes are very fine grained (e.g. pipe
kono
parents:
diff changeset
29 // operations synchronize only with operations on the same pipe), while
kono
parents:
diff changeset
30 // others are corse-grained (e.g. all operations on local files synchronize
kono
parents:
diff changeset
31 // with each other).
kono
parents:
diff changeset
32 //===----------------------------------------------------------------------===//
kono
parents:
diff changeset
33 #ifndef TSAN_FD_H
kono
parents:
diff changeset
34 #define TSAN_FD_H
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 #include "tsan_rtl.h"
kono
parents:
diff changeset
37
kono
parents:
diff changeset
38 namespace __tsan {
kono
parents:
diff changeset
39
kono
parents:
diff changeset
40 void FdInit();
kono
parents:
diff changeset
41 void FdAcquire(ThreadState *thr, uptr pc, int fd);
kono
parents:
diff changeset
42 void FdRelease(ThreadState *thr, uptr pc, int fd);
kono
parents:
diff changeset
43 void FdAccess(ThreadState *thr, uptr pc, int fd);
kono
parents:
diff changeset
44 void FdClose(ThreadState *thr, uptr pc, int fd, bool write = true);
kono
parents:
diff changeset
45 void FdFileCreate(ThreadState *thr, uptr pc, int fd);
kono
parents:
diff changeset
46 void FdDup(ThreadState *thr, uptr pc, int oldfd, int newfd, bool write);
kono
parents:
diff changeset
47 void FdPipeCreate(ThreadState *thr, uptr pc, int rfd, int wfd);
kono
parents:
diff changeset
48 void FdEventCreate(ThreadState *thr, uptr pc, int fd);
kono
parents:
diff changeset
49 void FdSignalCreate(ThreadState *thr, uptr pc, int fd);
kono
parents:
diff changeset
50 void FdInotifyCreate(ThreadState *thr, uptr pc, int fd);
kono
parents:
diff changeset
51 void FdPollCreate(ThreadState *thr, uptr pc, int fd);
kono
parents:
diff changeset
52 void FdSocketCreate(ThreadState *thr, uptr pc, int fd);
kono
parents:
diff changeset
53 void FdSocketAccept(ThreadState *thr, uptr pc, int fd, int newfd);
kono
parents:
diff changeset
54 void FdSocketConnecting(ThreadState *thr, uptr pc, int fd);
kono
parents:
diff changeset
55 void FdSocketConnect(ThreadState *thr, uptr pc, int fd);
kono
parents:
diff changeset
56 bool FdLocation(uptr addr, int *fd, int *tid, u32 *stack);
kono
parents:
diff changeset
57 void FdOnFork(ThreadState *thr, uptr pc);
kono
parents:
diff changeset
58
kono
parents:
diff changeset
59 uptr File2addr(const char *path);
kono
parents:
diff changeset
60 uptr Dir2addr(const char *path);
kono
parents:
diff changeset
61
kono
parents:
diff changeset
62 } // namespace __tsan
kono
parents:
diff changeset
63
kono
parents:
diff changeset
64 #endif // TSAN_INTERFACE_H