Date: Sun, 28 Oct 2001 20:23:45 -0800 From: "David O'Brien" <obrien@FreeBSD.ORG> To: Terry Lambert <tlambert2@mindspring.com> Cc: Mike Barcroft <mike@FreeBSD.ORG>, void <float@firedrake.org>, Kris Kennaway <kris@obsecurity.org>, hackers@FreeBSD.ORG Subject: Re: syslogd and kqueue Message-ID: <20011028202345.A60175@dragon.nuxi.com> In-Reply-To: <3BDCCFB2.1E5CFC49@mindspring.com>; from tlambert2@mindspring.com on Sun, Oct 28, 2001 at 07:40:34PM -0800 References: <20011026233957.A9925@parhelion.firedrake.org> <20011026200436.A61058@xor.obsecurity.org> <20011027043342.A18231@parhelion.firedrake.org> <20011027001704.B2586@coffee.q9media.com> <20011027002622.C2586@coffee.q9media.com> <20011028180643.B59388@dragon.nuxi.com> <3BDCCFB2.1E5CFC49@mindspring.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Oct 28, 2001 at 07:40:34PM -0800, Terry Lambert wrote: > By using the rename/create/signal approach, syslogd is > guaranteed to log new messages to the old file, despite the > rename, until signalled to close and reopen the file (or a > new file of another name, if syslog.conf is changed). > > If it created the file itself, there would be a potential > race issue that would remain unresolved, which is hidden by > the seperation of the create and the subsequent signal. Come again? 1. syslogd calls open(2) with O_CREAT. At this point syslogd happily keeps the file open and writes to it. 2. I rename the file. As we all know, syslogd keeps writing to its open file. 3. syslogd is HUP'ed, goto #1. No muss, no fuss. So where is the race? Mike had the only justification so far -- that of permissions of the file. -- -- David (obrien@FreeBSD.org) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011028202345.A60175>