Steve Watt wrote:
In <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] wrote:
Knowing if Apache could possibly write interleaved logs when writing to
a pipe is critical to a program I'm developing which receives log
entries from Apache via a pipe.
That's another layer of indirection, though. If all of the children
have separate pipes to the parent, and then the parent logs to your
program, all should be fine.
But at the kernel level, yes, writes longer than PIPE_BUF might get
interleaved. The longer the write, the higher the probability, so
for your test, if you can generate, say, 10K writes over and over,
you can probably trip it.
That's an interesting idea about each child having a pipe open back to
the parent, but I don't think that's what is happening. I'm pretty sure
each child has the logging pipe open directly. Here is an fstat:
There is a grouping like this for each Apache child process that's runing:
genie httpd 61320 root / 2 drwxr-xr-x 512 r
genie httpd 61320 wd / 2 drwxr-xr-x 512 r
genie httpd 61320 text /usr 5110792 -rwxr-xr-x 9766440 r
genie httpd 61320 0 /dev 8 crw-rw-rw- null r
genie httpd 61320 1 /dev 8 crw-rw-rw- null w
genie httpd 61320 2 /usr 5110968 -rw-r--r-- 494192 w
genie httpd 61320 15 /usr 5110968 -rw-r--r-- 494192 w
genie httpd 61320 16 /usr 5110969 -rw-r--r-- 451616 w
genie httpd 61320 17 /usr 5110981 -rw-r--r-- 1056219 w
genie httpd 61320 18 /usr 5111084 -rw-r--r-- 3886425 w
genie httpd 61320 19* internet stream tcp c5d1e2d0
genie httpd 61320 20 /usr 5111178 prw-rw-rw- 0 w
genie httpd 61320 21 /usr 5111178 prw-rw-rw- 0 w
genie httpd 61320 22 /usr 5111178 prw-rw-rw- 0 w
genie httpd 61320 23 /usr 5111178 prw-rw-rw- 0 w
genie httpd 61320 24 /usr 5110835 -rw-r--r-- 573236 w
My pipe listener (fd 0), which each child has open 4 times on fd 20 - 23:
root pglogd 519 root / 2 drwxr-xr-x 512 r
root pglogd 519 wd / 2 drwxr-xr-x 512 r
root pglogd 519 text /usr 8528219 -rwxr-xr-x 22793 r
root pglogd 519 0 /usr 5111178 prw-rw-rw- 0 rw
root pglogd 519 1 /usr 5111198 -rw-r--r-- 0 r
root pglogd 519 2 /usr 5111198 -rw-r--r-- 0 w
root pglogd 519 3* local stream c5dcb7a8 <-> c5dcb71c
Matthew
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"