in reply to drifting IO::File offset

In Solaris, the child process when exiting, messes up the tell() position of the file handle it inherited from the parent. One not very satisfactory workaround is to make the child exit using POSIX::_exit() rather than the usual exit().

Dave.

Replies are listed 'Best First'.
Re^2: drifting IO::File offset
by jfroebe (Parson) on Sep 29, 2004 at 11:21 UTC

    Hi Dave,

    Why would the posix _exit() be unsatisfactory?

    thanks :-)

    Jason L. Froebe

    No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1

      Why would the posix _exit() be unsatisfactory?
      Because if for any reason whatsoever, a child process somehow accidently exits in any other way, the parent is screwed. So it's a bit of a fragile mechanism.

      Dave.

      Why would the posix _exit() be unsatisfactory?

      One word. Kludge.

      Fixing the underlying OS bug would be satisfactory, everything else is a workaround and therefore not very satisfactory. That said something that works is by definition beter than something that does not.

      cheers

      tachyon

Re^2: drifting IO::File offset
by ezra (Scribe) on Sep 29, 2004 at 13:39 UTC
    Hey Dave, just out of curiousity, do you have any documentation on this Solaris 'feature'? Also, do you know offhand if calling POSIX::_exit() will honor DESTROY hints like DBH's InactiveDestroy? I'll test all this later today when I get to work, but any heads-up on specifics would be great. Thanks...

    Ezra

      do you have any documentation on this Solaris 'feature'?
      Well, I know about it because of a Perl bug report from a few weeks ago. I'm not sure whether we got as far as resolving whether it's Perl's or Solaris's fault, and I haven't had time yet to go back and look at it further. Solaris is trying to backout of a stdio buffered read before exiting.
      do you know offhand if calling POSIX::_exit() will honor DESTROY
      _exit() does an immediate process exit without doing any cleanup of any kind, either at the Perl or C level.

      Dave.

Re^2: drifting IO::File offset
by ezra (Scribe) on Sep 29, 2004 at 12:19 UTC
    Very interesting, and near what I was expecting. I need further testing with this. Thanks...