* Jordan Brown <Jordan.Brown at Sun.COM> [2009-10-15 00:21]: > Stephen Hahn wrote: >> While we wait for the system call proposal, why wouldn't >> >> loop: >> stat >> copy speculatively >> mandatory lock >> stat >> if stat changed >> unlock >> goto loop # (or reinsert in work queue and break) >> endif >> truncate >> unlock >> rename speculative copy into log sequence >> >> be a sufficient enhancement to logadm(1M)'s current logic for -c? > > I'm not familiar enough with Solaris file locking semantics to be sure, > but that sequence looks like it might well work. (Do mandatory locks > cause writers to block, or to get errors?)
Blocking writers block; non-blocking are supposed to get EAGAIN. I expect svc.startd(1M) doesn't open(2) log files with O_NONBLOCK, but that should be checked. > Copying megabytes of data instead of renaming seems heavyweight, but in > the grand scheme of things a few megabytes of copying every once in a > while just isn't that much. I mentioned this idea to Dan Price in the hallway, and he quickly pointed out that the copy scheme should be written as catching up--copy the new portion, as opposed to a full copy as above. - Stephen -- sch at sun.com http://blogs.sun.com/sch/