Received: (from majordom@localhost) by hyperreal.com (8.8.5/8.8.5) id SAA03028; Sat, 28 Jun 1997 18:17:16 -0700 (PDT) Received: from devsys.jaguNET.com (devsys.jaguNET.com [206.156.208.6]) by hyperreal.com (8.8.5/8.8.5) with ESMTP id SAA03023 for ; Sat, 28 Jun 1997 18:17:12 -0700 (PDT) Received: (from jim@localhost) by devsys.jaguNET.com (8.8.6/jag-2.4) id VAA21903 for new-httpd@apache.org; Sat, 28 Jun 1997 21:17:08 -0400 (EDT) From: Jim Jagielski Message-Id: <199706290117.VAA21903@devsys.jaguNET.com> Subject: Re: [PATCH] LockFile Directive To: new-httpd@apache.org Date: Sat, 28 Jun 1997 21:17:07 -0400 (EDT) In-Reply-To: <199706282219.RAA24150@sierra.zyzzyva.com> from "Randy Terbush" at Jun 28, 97 05:19:38 pm X-Mailer: ELM [version 2.4 PL25] Content-Type: text Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org Randy Terbush wrote: > > You know, the though occurs to me that with multiple parent server > processes on the same machine, there is going to be unnecessary > lock contention. No? I think that we should be generating a unique > lockfile name. You're right... It should add the pid or something > > > > What the hell... > > > > > > Index: apache/src/http_conf_globals.h > > =================================================================== > > RCS file: /export/home/cvs/apache/src/http_conf_globals.h,v > > retrieving revision 1.9 > > diff -c -r1.9 http_conf_globals.h > > *** http_conf_globals.h 1997/01/01 18:10:16 1.9 > > --- http_conf_globals.h 1997/06/28 21:29:26 > > *************** > > *** 72,77 **** > > --- 72,78 ---- > > > > extern char *pid_fname; > > extern char *scoreboard_fname; > > + extern char *lock_fname; > > extern char *server_argv0; > > > > /* Trying to allocate these in the config pool gets us into some *nasty* > > Index: apache/src/http_config.c > > =================================================================== > > RCS file: /export/home/cvs/apache/src/http_config.c,v > > retrieving revision 1.49.2.1 > > diff -c -r1.49.2.1 http_config.c > > *** http_config.c 1997/06/27 01:47:45 1.49.2.1 > > --- http_config.c 1997/06/28 21:29:27 > > *************** > > *** 1040,1045 **** > > --- 1040,1046 ---- > > daemons_limit = HARD_SERVER_LIMIT; > > pid_fname = DEFAULT_PIDLOG; > > scoreboard_fname = DEFAULT_SCOREBOARD; > > + lock_fname = DEFAULT_LOCKFILE; > > max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD; > > bind_address.s_addr = htonl(INADDR_ANY); > > listeners = NULL; > > Index: apache/src/http_core.c > > =================================================================== > > RCS file: /export/home/cvs/apache/src/http_core.c,v > > retrieving revision 1.81 > > diff -c -r1.81 http_core.c > > *** http_core.c 1997/05/08 13:09:24 1.81 > > --- http_core.c 1997/06/28 21:29:28 > > *************** > > *** 953,958 **** > > --- 953,963 ---- > > return NULL; > > } > > > > + const char *set_lockfile (cmd_parms *cmd, void *dummy, char *arg) { > > + lock_fname = pstrdup (cmd->pool, arg); > > + return NULL; > > + } > > + > > const char *set_idcheck (cmd_parms *cmd, core_dir_config *d, int arg) { > > d->do_rfc1413 = arg; > > return NULL; > > *************** > > *** 1202,1207 **** > > --- 1207,1214 ---- > > "A file for logging the server process ID"}, > > { "ScoreBoardFile", set_scoreboard, NULL, RSRC_CONF, TAKE1, > > "A file for Apache to maintain runtime process management information"}, > > + { "LockFile", set_lockfile, NULL, RSRC_CONF, TAKE1, > > + "The lockfile used when Apache needs to lock the accept() call"}, > > { "AccessConfig", set_server_string_slot, > > (void *)XtOffsetOf (server_rec, access_confname), RSRC_CONF, TAKE1, > > "The filename of the access config file" }, > > Index: apache/src/http_main.c > > =================================================================== > > RCS file: /export/home/cvs/apache/src/http_main.c,v > > retrieving revision 1.149.2.3 > > diff -c -r1.149.2.3 http_main.c > > *** http_main.c 1997/06/27 02:31:14 1.149.2.3 > > --- http_main.c 1997/06/28 21:29:30 > > *************** > > *** 138,143 **** > > --- 138,144 ---- > > int max_requests_per_child; > > char *pid_fname; > > char *scoreboard_fname; > > + char *lock_fname; > > char *server_argv0; > > struct in_addr bind_address; > > listen_rec *listeners; > > *************** > > *** 194,200 **** > > void > > accept_mutex_init(pool *p) > > { > > - char lock_fname[256]; > > > > lock_it.l_whence = SEEK_SET; /* from current point */ > > lock_it.l_start = 0; /* -"- */ > > --- 195,200 ---- > > *************** > > *** 207,225 **** > > unlock_it.l_type = F_UNLCK; /* set exclusive/write lock */ > > unlock_it.l_pid = 0; /* pid not actually interesting */ > > > > ! #ifdef __MACHTEN__ > > ! strncpy(lock_fname, "/var/tmp/htlock.XXXXXX", sizeof(lock_fname)-1); > > ! #else > > ! strncpy(lock_fname, "/usr/tmp/htlock.XXXXXX", sizeof(lock_fname)-1); > > ! #endif > > ! lock_fname[sizeof(lock_fname)-1] = '\0'; > > ! > > ! if (mktemp(lock_fname) == NULL || lock_fname[0] == '\0') > > ! { > > ! fprintf (stderr, "Cannot assign name to lock file!\n"); > > ! exit (1); > > ! } > > ! > > lock_fd = popenf(p, lock_fname, O_CREAT | O_WRONLY | O_EXCL, 0644); > > if (lock_fd == -1) > > { > > --- 207,213 ---- > > unlock_it.l_type = F_UNLCK; /* set exclusive/write lock */ > > unlock_it.l_pid = 0; /* pid not actually interesting */ > > > > ! lock_fname = server_root_relative (p, lock_fname); > > lock_fd = popenf(p, lock_fname, O_CREAT | O_WRONLY | O_EXCL, 0644); > > if (lock_fd == -1) > > { > > *************** > > *** 264,280 **** > > void > > accept_mutex_init(pool *p) > > { > > - char lock_fname[256]; > > - > > - strncpy(lock_fname, "/usr/tmp/htlock.XXXXXX", sizeof(lock_fname)-1); > > - lock_fname[sizeof(lock_fname)-1] = '\0'; > > - > > - if (mktemp(lock_fname) == NULL || lock_fname[0] == '\0') > > - { > > - fprintf (stderr, "Cannot assign name to lock file!\n"); > > - exit (1); > > - } > > > > lock_fd = popenf(p, lock_fname, O_CREAT | O_WRONLY | O_EXCL, 0644); > > if (lock_fd == -1) > > { > > --- 252,259 ---- > > void > > accept_mutex_init(pool *p) > > { > > > > + lock_fname = server_root_relative (p, lock_fname); > > lock_fd = popenf(p, lock_fname, O_CREAT | O_WRONLY | O_EXCL, 0644); > > if (lock_fd == -1) > > { > > Index: apache/src/httpd.h > > =================================================================== > > RCS file: /export/home/cvs/apache/src/httpd.h,v > > retrieving revision 1.111.2.1 > > diff -c -r1.111.2.1 httpd.h > > *** httpd.h 1997/06/27 01:47:47 1.111.2.1 > > --- httpd.h 1997/06/28 21:29:31 > > *************** > > *** 126,131 **** > > --- 126,132 ---- > > #endif > > #define DEFAULT_PIDLOG "logs/httpd.pid" > > #define DEFAULT_SCOREBOARD "logs/apache_runtime_status" > > + #define DEFAULT_LOCKFILE "logs/accept.lock" > > > > /* Define this to be what your HTML directory content files are called */ > > #define DEFAULT_INDEX "index.html" > > -- > > ==================================================================== > > Jim Jagielski | jaguNET Access Services > > jim@jaguNET.com | http://www.jaguNET.com/ > > "Look at me! I'm wearing a cardboard belt!" > > > > -- ==================================================================== Jim Jagielski | jaguNET Access Services jim@jaguNET.com | http://www.jaguNET.com/ "Look at me! I'm wearing a cardboard belt!"