Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^4: HPUX corruption of file handle after fork

by Abe (Acolyte)
on Dec 10, 2007 at 17:45 UTC ( [id://656183]=note: print w/replies, xml ) Need Help??


in reply to Re^3: HPUX corruption of file handle after fork
in thread HPUX corruption of file handle after fork

Aha - so it's not the perl version but it's probably perl on HPUX.

I'm not into this enough to look at perl source code, but I find it hard to imagine it's got something special about the way it calls close() for HPUX.

H'm. To me it means I have to be careful with explicitly opened files when calling fork(). perl open() is probably safe.

If you find out more do let me know, but I'm willing to use fork() now, just I know what to expect.

Thanks - Abe

Replies are listed 'Best First'.
Re^5: HPUX corruption of file handle after fork
by sgt (Deacon) on Dec 10, 2007 at 22:50 UTC

    There are lots of issues at hand.

    At the Un*x/POSIX level exit() does lots of cleaning. To be on the safe side it is usually better to _exit() in the child. IO buffering can get in the way as exit() will usually flush the streams before closing them.

    perl will usually show its un*x heritage (except in some places and/or platforms in recent years where it was considered better to "fix" that un*x behaviour). Recently while translating C code for a system(3) with time-out I needed low-level IO and POSIX::_exit() to be close to the old behaviour.

    Even at the perl level don't forget that exit() does call END blocks ...

    5.8.0 was very buggy, so it would be better to use another version. cheers hth --stephan

      Thanks sgt - sorry I didn't notice for a bit. I'd solved it and didn't check the thread again. I was a chicken and just stuck to STDIN, though I'd understood what had gone wrong. Regards, Abe

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://656183]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2024-03-28 11:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found