Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2007-11

errno codes fpOpen

4 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

afpTeam

Hi,

I'm maybe lost in the doc searches, but is there a reference explaining the extended err codes for fpOpen and friends?
I could not find one.

The effort is a Linux/Pentium fifo read by cgi but fails to read a piped fifo built with RW permission / shared.

cgi:

Program pipe_read;
 uses BaseUnix,Unix;
 var FD: Cint;
 s:string[255];
    begin
        writeln ('Content-type: text/html');
        writeln;
        FD:=fpOpen ('/tmp/BlaBla,O_RdOnly or O_NonBlock);
        writeln ('start...');
        if FD>=0 then
            begin
                fpread(FD,s,255);
                writeln(s);
            end
    else
        Writeln ('Error : ',fpgeterrno);
        Writeln ('The script exited with status : ',fpClose (FD));
        writeln ('done');
end.

Results...
FpMkfifo : -1<- setup fifo pipe,ok
start...3(handle to pipe)
PID > 0<-server returned
The script exited with status : 0

Thanks,

Mike

Jonas Maebe
to afpTeam
afpTeam wrote
I'm maybe lost in the doc searches, but is there a reference explaining the extended err codes for fpOpen and friends? I could not find one.

They are documented in the man pages of the *nix functions you are calling (man open), and the actual values corresponding to the symbolic errno numbers can be found in /usr/include/errno.h (or in one of the files it includes). The actual numerical values differ however from OS to OS, so it's best to use the symbolic constants in your program (they are all prefixed with ESys in FPC, so e.g. ESysEPERM, ESysEBUSY, etc).

Just like with the win32 api, I don't think it would be worth the effort to duplicate all that information in our own manuals.

Jonas

Marco van de Voort
to Jonas Maebe
Show quoted text 14 lines
On 08 Nov 2007, at 20:43, afpTeam wrote: > I'm maybe lost in the doc searches, but is there a reference > explaining the > extended err codes for fpOpen and friends? > I could not find one. They are documented in the man pages of the *nix functions you are calling (man open), and the actual values corresponding to the symbolic errno numbers can be found in /usr/include/errno.h (or in one of the files it includes). The actual numerical values differ however from OS to OS, so it's best to use the symbolic constants in your program (they are all prefixed with ESys in FPC, so e.g. ESysEPERM, ESysEBUSY, etc).

Note that there can be slight differences between the FPC definitions and the C file on some platforms. (kernel <-> libc. Mostly caused by redistribution of functionality between kernel and libc).

So to obtain a number -> identifier (EPerm, EBusy) mapping, it might be wisest to check the FPC .inc first, since that is more likely to correspond to whatever interface the pascal code is using.

afpTeam
to Jonas Maebe: They are documented in the man pages of the *nix functions you are calling (man open),…
Show quoted text 25 lines
On 08 Nov 2007, at 20:43, afpTeam wrote: > I'm maybe lost in the doc searches, but is there a reference explaining > the > extended err codes for fpOpen and friends? > I could not find one. They are documented in the man pages of the *nix functions you are calling (man open), and the actual values corresponding to the symbolic errno numbers can be found in /usr/include/errno.h (or in one of the files it includes). Just like with the win32 api, I don't think it would be worth the effort to duplicate all that information in our own manuals. Jonas Marko wrote: Note that there can be slight differences between the FPC definitions and the C file on some platforms. (kernel <-> libc. Mostly caused by redistribution of functionality between kernel and libc). So to obtain a number -> identifier (EPerm, EBusy) mapping, it might be wisest to check the FPC .inc first, since that is more likely to correspond to whatever interface the pascal code is using.

This makes perfect sense.

Moving from w32 to *Nix has some noobish moments, (duh) The sun was in my eys... I had a cold yesterday, yeah that's it.

Thanks guys. :)

Mike