summaryrefslogtreecommitdiff
path: root/blktrace.c
diff options
context:
space:
mode:
authorAlan D. Brunelle <alan.brunelle@hp.com>2009-02-11 11:42:09 -0500
committerAlan D. Brunelle <alan.brunelle@hp.com>2009-02-11 11:42:09 -0500
commitd5302b03b2728a27f14c4f260ce6a5247ea87c6e (patch)
tree8749ec96232a5649c2baf8b53888d63a068abcc8 /blktrace.c
parent3fe0b570b01622e329b9c999ebf867b1f1cb2e20 (diff)
downloadblktrace-d5302b03b2728a27f14c4f260ce6a5247ea87c6e.tar.gz
blktrace-d5302b03b2728a27f14c4f260ce6a5247ea87c6e.tar.bz2
Added accept as a system call needing resource increases
accept(2) opens a socket, and thus needs to handle EMFILE/ENFILE errors like other system calls.
Diffstat (limited to 'blktrace.c')
-rw-r--r--blktrace.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/blktrace.c b/blktrace.c
index 7d78e13..8e2d47b 100644
--- a/blktrace.c
+++ b/blktrace.c
@@ -599,6 +599,17 @@ static int my_socket(int domain, int type, int protocol)
return fd;
}
+static int my_accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
+{
+ int fd;
+
+ do {
+ fd = accept(sockfd, addr, addrlen);
+ } while (fd < 0 && handle_open_failure());
+
+ return fd;
+}
+
static void *my_mmap(void *addr, size_t length, int prot, int flags, int fd,
off_t offset)
{
@@ -2133,7 +2144,7 @@ static void net_add_connection(struct net_server_s *ns)
struct cl_host *ch;
socklen_t socklen = sizeof(ns->addr);
- fd = accept(ns->listen_fd, (struct sockaddr *)&ns->addr, &socklen);
+ fd = my_accept(ns->listen_fd, (struct sockaddr *)&ns->addr, &socklen);
if (fd < 0) {
/*
* This is OK: we just won't accept this connection,