From: wessels <> Date: Wed, 11 Feb 1998 04:44:30 +0000 (+0000) Subject: Merged fdstat.c into fd.c X-Git-Tag: SQUID_3_0_PRE1~4121 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=22f5d1ca3f1f1ac9381a1e4c8aebf287a683dca1;p=thirdparty%2Fsquid.git Merged fdstat.c into fd.c --- diff --git a/src/Makefile.in b/src/Makefile.in index 70372baaef..75fa4b5433 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -1,7 +1,7 @@ # # Makefile for the Squid Object Cache server # -# $Id: Makefile.in,v 1.120 1998/02/05 21:37:49 wessels Exp $ +# $Id: Makefile.in,v 1.121 1998/02/10 21:44:30 wessels Exp $ # # Uncomment and customize the following to suit your needs: # @@ -81,7 +81,6 @@ OBJS = \ errorpage.o \ event.o \ fd.o \ - fdstat.o \ filemap.o \ fqdncache.o \ ftp.o \ diff --git a/src/client_side.cc b/src/client_side.cc index ac8360c548..caa628a42a 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side.cc,v 1.205 1998/02/04 23:33:37 wessels Exp $ + * $Id: client_side.cc,v 1.206 1998/02/10 21:44:30 wessels Exp $ * * DEBUG: section 33 Client-side Routines * AUTHOR: Duane Wessels @@ -1792,7 +1792,7 @@ requestTimeout(int fd, void *data) int httpAcceptDefer(int fdnotused, void *notused) { - return !fdstat_are_n_free_fd(RESERVED_FD); + return fdNFree() < RESERVED_FD; } /* Handle a new connection on HTTP socket. */ diff --git a/src/comm.cc b/src/comm.cc index f3185971e9..e32cba8739 100644 --- a/src/comm.cc +++ b/src/comm.cc @@ -1,6 +1,6 @@ /* - * $Id: comm.cc,v 1.226 1998/02/06 17:30:51 wessels Exp $ + * $Id: comm.cc,v 1.227 1998/02/10 21:44:31 wessels Exp $ * * DEBUG: section 5 Socket Functions * AUTHOR: Harvest Derived @@ -961,7 +961,7 @@ comm_poll(time_t sec) close_handler *ch; fde *F = &fd_table[fd]; debug(5, 0) ("WARNING: FD %d has handlers, but it's invalid.\n", fd); - debug(5, 0) ("FD %d is a %s\n", fd, fdstatTypeStr[fd_table[fd].type]); + debug(5, 0) ("FD %d is a %s\n", fd, fdTypeStr[fd_table[fd].type]); debug(5, 0) ("--> %s\n", fd_table[fd].desc); debug(5, 0) ("tmout:%p read:%p write:%p\n", F->timeout_handler, @@ -1302,7 +1302,7 @@ examine_select(fd_set * readfds, fd_set * writefds) debug(5, 0) ("WARNING: FD %d has handlers, but it's invalid.\n", fd); debug(5, 0) ("FD %d is a %s called '%s'\n", fd, - fdstatTypeStr[fd_table[fd].type], + fdTypeStr[fd_table[fd].type], F->desc); debug(5, 0) ("tmout:%p read:%p write:%p\n", F->timeout_handler, diff --git a/src/fd.cc b/src/fd.cc index 7f2c5287ee..1096b29e49 100644 --- a/src/fd.cc +++ b/src/fd.cc @@ -1,6 +1,6 @@ /* - * $Id: fd.cc,v 1.19 1998/02/02 21:16:24 wessels Exp $ + * $Id: fd.cc,v 1.20 1998/02/10 21:44:33 wessels Exp $ * * DEBUG: section 51 Filedescriptor Functions * AUTHOR: Duane Wessels @@ -31,6 +31,16 @@ #include "squid.h" +const char *fdTypeStr[] = +{ + "None", + "Log", + "File", + "Socket", + "Pipe", + "Unknown" +}; + static void fdUpdateBiggest(int fd, unsigned int status); static void @@ -124,3 +134,9 @@ fdDumpOpen(void) debug(51, 1) ("Open FD %4d %s\n", i, F->desc); } } + +int +fdNFree(void) +{ + return Squid_MaxFD - Number_FD; +} diff --git a/src/globals.h b/src/globals.h index 20d6932450..f182a72111 100644 --- a/src/globals.h +++ b/src/globals.h @@ -1,6 +1,6 @@ /* - * $Id: globals.h,v 1.35 1998/02/07 08:13:37 wessels Exp $ + * $Id: globals.h,v 1.36 1998/02/10 21:44:33 wessels Exp $ */ extern FILE *debug_log; /* NULL */ @@ -27,7 +27,7 @@ extern const char *const localhost; /* "127.0.0.1" */ extern const char *const null_string; /* "" */ extern const char *const version_string; /* SQUID_VERSION */ extern const char *const w_space; /* " \t\n\r" */ -extern const char *fdstatTypeStr[]; +extern const char *fdTypeStr[]; extern const char *hier_strings[]; extern const char *memStatusStr[]; extern const char *pingStatusStr[]; diff --git a/src/main.cc b/src/main.cc index 6ccd5042fb..397ff690e1 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,6 +1,6 @@ /* - * $Id: main.cc,v 1.215 1998/02/06 23:58:04 wessels Exp $ + * $Id: main.cc,v 1.216 1998/02/10 21:44:34 wessels Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -558,7 +558,6 @@ main(int argc, char **argv) comm_init(); /* we have to init fdstat here. */ - fdstat_init(); fd_open(0, FD_LOG, "stdin"); fd_open(1, FD_LOG, "stdout"); fd_open(2, FD_LOG, "stderr"); diff --git a/src/protos.h b/src/protos.h index 1a2d0e047d..b4e7ebc833 100644 --- a/src/protos.h +++ b/src/protos.h @@ -147,9 +147,7 @@ extern void fd_note(int fd, const char *); extern void fd_bytes(int fd, int len, unsigned int type); extern void fdFreeMemory(void); extern void fdDumpOpen(void); - -extern void fdstat_init(void); -extern int fdstat_are_n_free_fd(int); +extern int fdNFree(void); extern fileMap *file_map_create(int); extern int file_map_allocate(fileMap *, int); diff --git a/src/stat.cc b/src/stat.cc index 645cdaeaff..eba57cb501 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -1,6 +1,6 @@ /* - * $Id: stat.cc,v 1.194 1998/02/07 08:13:41 wessels Exp $ + * $Id: stat.cc,v 1.195 1998/02/10 21:44:35 wessels Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -429,7 +429,7 @@ statFiledescriptors(StoreEntry * sentry) continue; storeAppendPrintf(sentry, "%4d %-6.6s %4d %7d %7d %-21s %s\n", i, - fdstatTypeStr[f->type], + fdTypeStr[f->type], f->timeout_handler ? (f->timeout - squid_curtime) / 60 : 0, f->bytes_read, f->bytes_written,