... hence your CB comment - with which I wholeheartedly agree :D

I've seen code such as your 2nd example fail if there's no __DATA__ section in the file.

As to the 1st example, well that's a different kettle of fish...

Given a simple script (tst.pl):

>cat tst.pl use warnings; use strict; use Fcntl qw/:flock/; open SELF, "< $0" or die ; flock SELF, LOCK_EX | LOCK_NB or die "$!";
A simple run results in...
>perl tst.pl A file descriptor does not refer to an open file. at tst.pl line 7.
Re-ruuning and generating a truss log, using >truss -f perl tst.pl  > log 2>&1, the (business) end of which is...
. . . 389372: open("tst.pl", O_RDONLY|O_LARGEFILE) = 3 389372: kioctl(3, 22528, 0x00000000, 0x00000000) Err#25 ENOTTY 389372: fstatx(3, 0x30020848, 128, 010) = 0 389372: kfcntl(3, F_SETFD, 0x00000001) = 0 389372: kfcntl(3, F_SETLK, 0x2FF222A0) Err#9 EBADF 389372: access("/usr/lib/nls/msg/en_GB/libc.cat", 0) Err#2 ENOENT 389372: access("/usr/lib/nls/msg/en_US/libc.cat", 0) = 0 389372: _getpid() = 389372 389372: open("/usr/lib/nls/msg/en_US/libc.cat", O_RDONLY) = 4 389372: kioctl(4, 22528, 0x00000000, 0x00000000) Err#25 ENOTTY 389372: kfcntl(4, F_SETFD, 0x00000001) = 0 389372: kioctl(4, 22528, 0x00000000, 0x00000000) Err#25 ENOTTY 389372: kread(4, "\0\001 &#65533;\007\007 I S O 8".., 4096) = 4096 389372: lseek(4, 0, 1) = 4096 389372: lseek(4, 0, 1) = 4096 389372: lseek(4, 0, 1) = 4096 389372: _getpid() = 389372 389372: lseek(4, 0, 1) = 4096 389372: close(4) = 0 A file descriptor does not refer to an open file. at tst.pl line 7. 389372: kwrite(2, " A f i l e d e s c r".., 68) = 68 389372: kfcntl(2, F_GETFL, 0x00000008) = 1 389372: kfcntl(1, F_GETFL, 0x00000008) = 1 389372: kfcntl(2, F_GETFL, 0x00000008) = 1 389372: close(3) = 0 389372: kfcntl(2, F_GETFL, 0x00000008) = 1
We see, from 389372: open("tst.pl", O_RDONLY|O_LARGEFILE)        = 3 that the script is successfully opened on file descriptor 3.

Later, we see that the file on descriptor 3 is both open, the operations are valid and the file will/should close across an exec call...

389372: fstatx(3, 0x30020848, 128, 010) = 0 389372: kfcntl(3, F_SETFD, 0x00000001) = 0
From 389372: kfcntl(3, F_SETLK, 0x2FF222A0)          Err#9  EBADF, we can see that the kernel considers FD3 to refer to a closed file - but we haven't seen a close - either explicitly (via a call to close()) or implicitly (via an intervening call to exec()).

Thus we can only conclude that there is an underlying problem with AIX.

As to a suitable answer ... I'm afraid I can't help you (aside from the fact that there is, in perl 5.8, nothing untoward mentioned in perlaix - but I expect you already know that! :-) :-((

A user level that continues to overstate my experience :-))

In reply to Re: Lightweight Solution To "Only 1 Process Running" On AIX by Bloodnok
in thread Lightweight Solution To "Only 1 Process Running" On AIX by Limbic~Region

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.