forked from OSchip/llvm-project
parent
2603ee0dc6
commit
606de60163
|
@ -1295,6 +1295,22 @@ TSAN_INTERCEPTOR(int, connect, int fd, void *addr, unsigned addrlen) {
|
|||
return res;
|
||||
}
|
||||
|
||||
TSAN_INTERCEPTOR(int, bind, int fd, void *addr, unsigned addrlen) {
|
||||
SCOPED_TSAN_INTERCEPTOR(bind, fd, addr, addrlen);
|
||||
int res = REAL(bind)(fd, addr, addrlen);
|
||||
if (fd > 0 && res == 0)
|
||||
FdAccess(thr, pc, fd);
|
||||
return res;
|
||||
}
|
||||
|
||||
TSAN_INTERCEPTOR(int, listen, int fd, int backlog) {
|
||||
SCOPED_TSAN_INTERCEPTOR(listen, fd, backlog);
|
||||
int res = REAL(listen)(fd, backlog);
|
||||
if (fd > 0 && res == 0)
|
||||
FdAccess(thr, pc, fd);
|
||||
return res;
|
||||
}
|
||||
|
||||
TSAN_INTERCEPTOR(int, accept, int fd, void *addr, unsigned *addrlen) {
|
||||
SCOPED_TSAN_INTERCEPTOR(accept, fd, addr, addrlen);
|
||||
int fd2 = REAL(accept)(fd, addr, addrlen);
|
||||
|
@ -1909,6 +1925,8 @@ void InitializeInterceptors() {
|
|||
TSAN_INTERCEPT(socket);
|
||||
TSAN_INTERCEPT(socketpair);
|
||||
TSAN_INTERCEPT(connect);
|
||||
TSAN_INTERCEPT(bind);
|
||||
TSAN_INTERCEPT(listen);
|
||||
TSAN_INTERCEPT(accept);
|
||||
TSAN_INTERCEPT(accept4);
|
||||
TSAN_INTERCEPT(epoll_create);
|
||||
|
|
|
@ -207,6 +207,8 @@ void StatOutput(u64 *stat) {
|
|||
name[StatInt_socket] = " socket ";
|
||||
name[StatInt_socketpair] = " socketpair ";
|
||||
name[StatInt_connect] = " connect ";
|
||||
name[StatInt_bind] = " bind ";
|
||||
name[StatInt_listen] = " listen ";
|
||||
name[StatInt_accept] = " accept ";
|
||||
name[StatInt_accept4] = " accept4 ";
|
||||
name[StatInt_epoll_create] = " epoll_create ";
|
||||
|
@ -301,6 +303,7 @@ void StatOutput(u64 *stat) {
|
|||
name[StatMtxAnnotations] = " Annotations ";
|
||||
name[StatMtxMBlock] = " MBlock ";
|
||||
name[StatMtxJavaMBlock] = " JavaMBlock ";
|
||||
name[StatMtxFD] = " FD ";
|
||||
|
||||
Printf("Statistics:\n");
|
||||
for (int i = 0; i < StatCnt; i++)
|
||||
|
|
|
@ -202,6 +202,8 @@ enum StatType {
|
|||
StatInt_socket,
|
||||
StatInt_socketpair,
|
||||
StatInt_connect,
|
||||
StatInt_bind,
|
||||
StatInt_listen,
|
||||
StatInt_accept,
|
||||
StatInt_accept4,
|
||||
StatInt_epoll_create,
|
||||
|
@ -303,6 +305,7 @@ enum StatType {
|
|||
StatMtxAtExit,
|
||||
StatMtxMBlock,
|
||||
StatMtxJavaMBlock,
|
||||
StatMtxFD,
|
||||
|
||||
// This must be the last.
|
||||
StatCnt
|
||||
|
|
Loading…
Reference in New Issue