aboutsummaryrefslogtreecommitdiff
path: root/libsanitizer/tsan/tsan_fd.h
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2013-01-10 12:44:08 +0000
committerKostya Serebryany <kcc@gcc.gnu.org>2013-01-10 12:44:08 +0000
commite9772e16b39885fb70f6e3651a0b98d6de8655c3 (patch)
tree23cebf7ab15836f70e055aee309f853c0c377de6 /libsanitizer/tsan/tsan_fd.h
parente1f674e4c21be4834cfad53666b5b7a9492cf0a5 (diff)
downloadgcc-e9772e16b39885fb70f6e3651a0b98d6de8655c3.zip
gcc-e9772e16b39885fb70f6e3651a0b98d6de8655c3.tar.gz
gcc-e9772e16b39885fb70f6e3651a0b98d6de8655c3.tar.bz2
libsanitizer mege from upstream r171973
From-SVN: r195083
Diffstat (limited to 'libsanitizer/tsan/tsan_fd.h')
-rw-r--r--libsanitizer/tsan/tsan_fd.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/libsanitizer/tsan/tsan_fd.h b/libsanitizer/tsan/tsan_fd.h
new file mode 100644
index 0000000..b4189a3
--- /dev/null
+++ b/libsanitizer/tsan/tsan_fd.h
@@ -0,0 +1,62 @@
+//===-- tsan_fd.h -----------------------------------------------*- C++ -*-===//
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file is a part of ThreadSanitizer (TSan), a race detector.
+//
+// This file handles synchronization via IO.
+// People use IO for synchronization along the lines of:
+//
+// int X;
+// int client_socket; // initialized elsewhere
+// int server_socket; // initialized elsewhere
+//
+// Thread 1:
+// X = 42;
+// send(client_socket, ...);
+//
+// Thread 2:
+// if (recv(server_socket, ...) > 0)
+// assert(X == 42);
+//
+// This file determines the scope of the file descriptor (pipe, socket,
+// all local files, etc) and executes acquire and release operations on
+// the scope as necessary. Some scopes are very fine grained (e.g. pipe
+// operations synchronize only with operations on the same pipe), while
+// others are corse-grained (e.g. all operations on local files synchronize
+// with each other).
+//===----------------------------------------------------------------------===//
+#ifndef TSAN_FD_H
+#define TSAN_FD_H
+
+#include "tsan_rtl.h"
+
+namespace __tsan {
+
+void FdInit();
+void FdAcquire(ThreadState *thr, uptr pc, int fd);
+void FdRelease(ThreadState *thr, uptr pc, int fd);
+void FdClose(ThreadState *thr, uptr pc, int fd);
+void FdFileCreate(ThreadState *thr, uptr pc, int fd);
+void FdDup(ThreadState *thr, uptr pc, int oldfd, int newfd);
+void FdPipeCreate(ThreadState *thr, uptr pc, int rfd, int wfd);
+void FdEventCreate(ThreadState *thr, uptr pc, int fd);
+void FdSignalCreate(ThreadState *thr, uptr pc, int fd);
+void FdInotifyCreate(ThreadState *thr, uptr pc, int fd);
+void FdPollCreate(ThreadState *thr, uptr pc, int fd);
+void FdSocketCreate(ThreadState *thr, uptr pc, int fd);
+void FdSocketAccept(ThreadState *thr, uptr pc, int fd, int newfd);
+void FdSocketConnecting(ThreadState *thr, uptr pc, int fd);
+void FdSocketConnect(ThreadState *thr, uptr pc, int fd);
+bool FdLocation(uptr addr, int *fd, int *tid, u32 *stack);
+void FdOnFork(ThreadState *thr, uptr pc);
+
+uptr File2addr(char *path);
+uptr Dir2addr(char *path);
+
+} // namespace __tsan
+
+#endif // TSAN_INTERFACE_H