httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <>
Subject Re: pid or proc
Date Thu, 18 May 2000 10:46:11 GMT
> Mailing-List: contact; run by ezmlm
> Precedence: bulk
> X-No-Archive: yes
> Reply-To:
> list-help: <>
> list-unsubscribe: <>
> list-post: <>
> Date: Wed, 17 May 2000 22:34:57 -0700
> From: "Roy T. Fielding" <fielding@kiwi.ICS.UCI.EDU>
> X-Spam-Rating: 1.6.2 0/1000/N
> X-UIDL: f32525db53d0604290c155d144b3a130
> I started to fix a bug in mpmt_pthread.c where a pid variable is being
> printed as an int even though it is actually a pointer to a proc which
> points to an incomplete struct type that contains a pid.  

I fixed the same bug in prefork.c recently (assuming that we're
talking about the same one), and I noticed yesterday that it needs to
be fixed in dexter.c.  I didn't realize that it was in mpmt_pthread.c


>                                                           Unfortunately,
> the easy fix wouldn't work because you can't just dereference an
> incomplete type to get the pid from the proc.  Bummer.  

Note that there is an ap_get_os_proc() function to get the
platform-specific process id from an ap_proc_t.

>                                                          Then I noticed
> that there are several cases where a pid variable is used and defined as
> an int, even though it should always be defined as a pid_t.  Well, that
> sucks.  So I continued on to see if I should change the pid type of the
> first pid to be complete so that I can access it directly, or define an
> access function like
>    long ap_pid_long(ap_proc_t *pid);
> which just seemed to go one pid further than was worth piddling over.
> Of course, I'd prefer that it just return pid_t, but that would require
> adding another formatting variable to snprintf in order to avoid that
> other warning on Solaris (which, after all, doesn't have int pids).

One could define AP_PID_FMT to "%d" or something else as appropriate.

Another disturbing aspect of this problem is the duplication of it
across the Unix MPMs.  I should have fixed the pointer-as-int problem
when I fixed it in prefork (assuming we're talking about the same
one), but for one reason or another it didn't occur to me to look; I
was just reacting to the compile warning that was in front of me.

If somebody will tell me where to put common code for Unix MPMs I'll
start moving code there.  I made some changes last night spread across
the three, and I need to do some more today to get rid of a storage
leak in the use of ap_proc_t with ap_wait_all_procs().

I'd be happy to have a .c and a .h for common code in
modules/mpm/mpmt_pthread/ and have those referenced directly from
dexter and prefork.  Alternatively, we could have modules/mpm/mpm_util
with a module and a header file in there.

Jeff Trawick | | PGP public key at web site:
          Born in Roswell... married an alien...

View raw message