summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/libglusterfs.sym1
-rw-r--r--libglusterfs/src/syscall.c14
-rw-r--r--libglusterfs/src/syscall.h3
3 files changed, 18 insertions, 0 deletions
diff --git a/libglusterfs/src/libglusterfs.sym b/libglusterfs/src/libglusterfs.sym
index 63022d6d92e..18c9fff34a2 100644
--- a/libglusterfs/src/libglusterfs.sym
+++ b/libglusterfs/src/libglusterfs.sym
@@ -1051,6 +1051,7 @@ sys_unlink
sys_utimensat
sys_write
sys_writev
+sys_socket
tbf_init
tbf_throttle
timespec_now
diff --git a/libglusterfs/src/syscall.c b/libglusterfs/src/syscall.c
index a3bc9189257..dd504f734fc 100644
--- a/libglusterfs/src/syscall.c
+++ b/libglusterfs/src/syscall.c
@@ -727,3 +727,17 @@ sys_fallocate(int fd, int mode, off_t offset, off_t len)
errno = ENOSYS;
return -1;
}
+
+int
+sys_socket(int domain, int type, int protocol)
+{
+#ifdef SOCK_CLOEXEC
+ return socket(domain, type | SOCK_CLOEXEC, protocol);
+#endif
+ int fd = -1;
+
+ fd = socket(domain, type, protocol);
+ if (fd >= 0)
+ fcntl(fd, F_SETFD, FD_CLOEXEC);
+ return fd;
+}
diff --git a/libglusterfs/src/syscall.h b/libglusterfs/src/syscall.h
index f691ebdaa53..9bad49edb7c 100644
--- a/libglusterfs/src/syscall.h
+++ b/libglusterfs/src/syscall.h
@@ -221,4 +221,7 @@ sys_pread(int fd, void *buf, size_t count, off_t offset);
ssize_t
sys_pwrite(int fd, const void *buf, size_t count, off_t offset);
+int
+sys_socket(int domain, int type, int protocol);
+
#endif /* __SYSCALL_H__ */