On Fri, 27 Jan 2017 14:53:58 -0500, Rick Troth wrote:

>On 01/27/17 14:48, Charles Mills wrote:
>> I*think*  that generally that message is output by the application.
>> The application calls strerror() which returns that string,
>> and then the application prints it. I think your argument
>> is with the application, not LE.
>
>Sure, except the application in question is *ours* and there's no
>strerror() or perror() or sprintf() for this condition. What we're
>dealing with here is a call to stat() or equivalent against a file that
>is not there which we will then create.
> 
What's "equivalent" to stat()?

I agree with Charles.  System calls rarely issue messages; that's not kernel's
job.  System calls set ERRNO and the caller issues the message.

Does the problem occur with a minimal program that does only a stat() and
reports the error?  If so, numerous users would be reporting it and creating
SRs.

Google (and my experience) tells me that a frequent cause of ENOENT is
nonexistence of a directory along the path.

If the file is about to be created anyway, just do it: open( file, O_CREAT ... )

If you need to know whether the file is actually being created (perhaps you
intend to write a preamble the first time), stat() leaves a timing hazard:
two jobs running at the same time might both get ENOENT from stat()
and both create the preamble.  Better:

    open( file, O_EXCL O_CREAT O_WRONLY ... )
    if no error then
        create preamble
    else if EEXIST then
        open( file, O_WRONLY ... )

(But you may still get the undesired message.)

-- gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to