summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2004-09-08 20:45:23 +0000
committerEric S. Raymond <esr@thyrsus.com>2004-09-08 20:45:23 +0000
commitca6a1c219a607c3603d723f0db36d02d1b1f6dca (patch)
tree250ac6f73e3fb1d96d76dcec493c1ff00bf78fe1
parenta0c8d9b3b8101ff86067d5cc486fd0ff363b44d1 (diff)
downloadgpsd-ca6a1c219a607c3603d723f0db36d02d1b1f6dca.tar.gz
Commiytted a patch that should stop the flood of getrlimit() calls.
-rw-r--r--gpsd.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gpsd.c b/gpsd.c
index 65e5e84e..eb198a1c 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -60,6 +60,7 @@ static fd_set all_fds;
static fd_set nmea_fds;
static fd_set watcher_fds;
static int debuglevel;
+static int nfds;
static jmp_buf restartbuf;
#define THROW_SIGHUP 1
@@ -404,7 +405,7 @@ static void notify_watchers(char *sentence)
{
int fd;
- for (fd = 0; fd < getdtablesize(); fd++) {
+ for (fd = 0; fd < nfds; fd++) {
if (FD_ISSET(fd, &watcher_fds)) {
throttled_write(fd, sentence, strlen(sentence));
}
@@ -416,7 +417,7 @@ static void raw_hook(char *sentence)
{
int fd;
- for (fd = 0; fd < getdtablesize(); fd++)
+ for (fd = 0; fd < nfds; fd++)
{
/* copy raw NMEA sentences from GPS to clients in raw mode */
if (FD_ISSET(fd, &nmea_fds))
@@ -520,7 +521,7 @@ int main(int argc, char *argv[])
char *dgpsserver = NULL;
struct sockaddr_in fsin;
fd_set rfds;
- int msock, nfds;
+ int msock;
int alen;
extern char *optarg;
int option, gpsd_speed = 0;