mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-20 14:29:21 +02:00
* Unix RTL generic parts. Linux working, *BSD will follow shortly
This commit is contained in:
parent
193994c0a5
commit
3e33642794
@ -19,205 +19,208 @@
|
|||||||
}
|
}
|
||||||
Const
|
Const
|
||||||
|
|
||||||
Sys_EPERM = 1; { Operation not permitted }
|
ESysEPERM = 1; { Operation not permitted }
|
||||||
Sys_ENOENT = 2; { No such file or directory }
|
ESysENOENT = 2; { No such file or directory }
|
||||||
Sys_ESRCH = 3; { No such process }
|
ESysESRCH = 3; { No such process }
|
||||||
Sys_EINTR = 4; { Interrupted system call }
|
ESysEINTR = 4; { Interrupted system call }
|
||||||
Sys_EIO = 5; { I/O error }
|
ESysEIO = 5; { I/O error }
|
||||||
Sys_ENXIO = 6; { No such device or address }
|
ESysENXIO = 6; { No such device or address }
|
||||||
Sys_E2BIG = 7; { Arg list too long }
|
ESysE2BIG = 7; { Arg list too long }
|
||||||
Sys_ENOEXEC = 8; { Exec format error }
|
ESysENOEXEC = 8; { Exec format error }
|
||||||
Sys_EBADF = 9; { Bad file number }
|
ESysEBADF = 9; { Bad file number }
|
||||||
Sys_ECHILD = 10; { No child processes }
|
ESysECHILD = 10; { No child processes }
|
||||||
{$ifdef FreeBSD}
|
{$ifdef FreeBSD}
|
||||||
Sys_EDEADLK = 11; { Deadlock avoided}
|
ESysEDEADLK = 11; { Deadlock avoided}
|
||||||
{$else}
|
{$else}
|
||||||
Sys_EAGAIN = 11; { Try again }
|
ESysEAGAIN = 11; { Try again }
|
||||||
{$endif}
|
{$endif}
|
||||||
Sys_ENOMEM = 12; { Out of memory }
|
ESysENOMEM = 12; { Out of memory }
|
||||||
Sys_EACCES = 13; { Permission denied }
|
ESysEACCES = 13; { Permission denied }
|
||||||
Sys_EFAULT = 14; { Bad address }
|
ESysEFAULT = 14; { Bad address }
|
||||||
Sys_ENOTBLK = 15; { Block device required, NOT POSIX! }
|
ESysENOTBLK = 15; { Block device required, NOT POSIX! }
|
||||||
Sys_EBUSY = 16; { Device or resource busy }
|
ESysEBUSY = 16; { Device or resource busy }
|
||||||
Sys_EEXIST = 17; { File exists }
|
ESysEEXIST = 17; { File exists }
|
||||||
Sys_EXDEV = 18; { Cross-device link }
|
ESysEXDEV = 18; { Cross-device link }
|
||||||
Sys_ENODEV = 19; { No such device }
|
ESysENODEV = 19; { No such device }
|
||||||
Sys_ENOTDIR = 20; { Not a directory }
|
ESysENOTDIR = 20; { Not a directory }
|
||||||
Sys_EISDIR = 21; { Is a directory }
|
ESysEISDIR = 21; { Is a directory }
|
||||||
Sys_EINVAL = 22; { Invalid argument }
|
ESysEINVAL = 22; { Invalid argument }
|
||||||
Sys_ENFILE = 23; { File table overflow }
|
ESysENFILE = 23; { File table overflow }
|
||||||
Sys_EMFILE = 24; { Too many open files }
|
ESysEMFILE = 24; { Too many open files }
|
||||||
Sys_ENOTTY = 25; { Not a typewriter }
|
ESysENOTTY = 25; { Not a typewriter }
|
||||||
Sys_ETXTBSY = 26; { Text file busy }
|
ESysETXTBSY = 26; { Text file busy }
|
||||||
Sys_EFBIG = 27; { File too large }
|
ESysEFBIG = 27; { File too large }
|
||||||
Sys_ENOSPC = 28; { No space left on device }
|
ESysENOSPC = 28; { No space left on device }
|
||||||
Sys_ESPIPE = 29; { Illegal seek }
|
ESysESPIPE = 29; { Illegal seek }
|
||||||
Sys_EROFS = 30; { Read-only file system }
|
ESysEROFS = 30; { Read-only file system }
|
||||||
Sys_EMLINK = 31; { Too many links }
|
ESysEMLINK = 31; { Too many links }
|
||||||
Sys_EPIPE = 32; { Broken pipe }
|
ESysEPIPE = 32; { Broken pipe }
|
||||||
Sys_EDOM = 33; { Math argument out of domain of func }
|
ESysEDOM = 33; { Math argument out of domain of func }
|
||||||
Sys_ERANGE = 34; { Math result not representable }
|
ESysERANGE = 34; { Math result not representable }
|
||||||
{$ifdef FreeBSD}
|
{$ifdef FreeBSD}
|
||||||
{ non-blocking and interrupt i/o }
|
{ non-blocking and interrupt i/o }
|
||||||
Sys_EAGAIN = 35; { Resource temporarily unavailable }
|
ESysEAGAIN = 35; { Resource temporarily unavailable }
|
||||||
|
|
||||||
// non posix from here on.
|
// non posix from here on.
|
||||||
|
|
||||||
Sys_EWOULDBLOCK = SYS_EAGAIN; { Operation would block }
|
ESysEWOULDBLOCK = SYS_EAGAIN; { Operation would block }
|
||||||
Sys_EINPROGRESS = 36; { Operation now in progress }
|
ESysEINPROGRESS = 36; { Operation now in progress }
|
||||||
Sys_EALREADY = 37; { Operation already in progress }
|
ESysEALREADY = 37; { Operation already in progress }
|
||||||
|
|
||||||
{ ipc/network software -- argument errors }
|
{ ipc/network software -- argument errors }
|
||||||
Sys_ENOTSOCK = 38; { Socket operation on non-socket }
|
ESysENOTSOCK = 38; { Socket operation on non-socket }
|
||||||
Sys_EDESTADDRREQ= 39; { Destination address required }
|
ESysEDESTADDRREQ= 39; { Destination address required }
|
||||||
Sys_EMSGSIZE = 40; { Message too long }
|
ESysEMSGSIZE = 40; { Message too long }
|
||||||
Sys_EPROTOTYPE = 41; { Protocol wrong type for socket }
|
ESysEPROTOTYPE = 41; { Protocol wrong type for socket }
|
||||||
Sys_ENOPROTOOPT = 42; { Protocol not available }
|
ESysENOPROTOOPT = 42; { Protocol not available }
|
||||||
Sys_EPROTONOSUPPORT= 43;{ Protocol not supported }
|
ESysEPROTONOSUPPORT= 43;{ Protocol not supported }
|
||||||
Sys_ESOCKTNOSUPPORT= 44;{ Socket type not supported }
|
ESysESOCKTNOSUPPORT= 44;{ Socket type not supported }
|
||||||
Sys_EOPNOTSUPP = 45; { Operation not supported }
|
ESysEOPNOTSUPP = 45; { Operation not supported }
|
||||||
Sys_ENOTSUP = SYS_EOPNOTSUPP; { Operation not supported }
|
ESysENOTSUP = SYS_EOPNOTSUPP; { Operation not supported }
|
||||||
Sys_EPFNOSUPPORT= 46; { Protocol family not supported }
|
ESysEPFNOSUPPORT= 46; { Protocol family not supported }
|
||||||
Sys_EAFNOSUPPORT= 47; { Address family not supported by protocol family }
|
ESysEAFNOSUPPORT= 47; { Address family not supported by protocol family }
|
||||||
Sys_EADDRINUSE = 48; { Address already in use }
|
ESysEADDRINUSE = 48; { Address already in use }
|
||||||
Sys_EADDRNOTAVAIL= 49; { Can't assign requested address }
|
ESysEADDRNOTAVAIL= 49; { Can't assign requested address }
|
||||||
|
|
||||||
{ ipc/network software -- operational errors }
|
{ ipc/network software -- operational errors }
|
||||||
Sys_ENETDOWN = 50; { Network is down }
|
ESysENETDOWN = 50; { Network is down }
|
||||||
Sys_ENETUNREACH = 51; { Network is unreachable }
|
ESysENETUNREACH = 51; { Network is unreachable }
|
||||||
Sys_ENETRESET = 52; { Network dropped connection on reset }
|
ESysENETRESET = 52; { Network dropped connection on reset }
|
||||||
Sys_ECONNABORTED= 53; { Software caused connection abort }
|
ESysECONNABORTED= 53; { Software caused connection abort }
|
||||||
Sys_ECONNRESET = 54; { Connection reset by peer }
|
ESysECONNRESET = 54; { Connection reset by peer }
|
||||||
Sys_ENOBUFS = 55; { No buffer space available }
|
ESysENOBUFS = 55; { No buffer space available }
|
||||||
Sys_EISCONN = 56; { Socket is already connected }
|
ESysEISCONN = 56; { Socket is already connected }
|
||||||
Sys_ENOTCONN = 57; { Socket is not connected }
|
ESysENOTCONN = 57; { Socket is not connected }
|
||||||
Sys_ESHUTDOWN = 58; { Can't send after socket shutdown }
|
ESysESHUTDOWN = 58; { Can't send after socket shutdown }
|
||||||
Sys_ETOOMANYREFS= 59; { Too many references: can't splice }
|
ESysETOOMANYREFS= 59; { Too many references: can't splice }
|
||||||
Sys_ETIMEDOUT = 60; { Operation timed out }
|
ESysETIMEDOUT = 60; { Operation timed out }
|
||||||
Sys_ECONNREFUSED= 61; { Connection refused }
|
ESysECONNREFUSED= 61; { Connection refused }
|
||||||
Sys_ELOOP = 62; { Too many levels of symbolic links }
|
ESysELOOP = 62; { Too many levels of symbolic links }
|
||||||
Sys_ENAMETOOLONG= 63; { File name too long }
|
ESysENAMETOOLONG= 63; { File name too long }
|
||||||
Sys_EHOSTDOWN = 64; { Host is down }
|
ESysEHOSTDOWN = 64; { Host is down }
|
||||||
Sys_EHOSTUNREACH= 65; { No route to host }
|
ESysEHOSTUNREACH= 65; { No route to host }
|
||||||
Sys_ENOTEMPTY = 66; { Directory not empty }
|
ESysENOTEMPTY = 66; { Directory not empty }
|
||||||
{ quotas & mush }
|
{ quotas & mush }
|
||||||
Sys_EPROCLIM = 67; { Too many processes }
|
ESysEPROCLIM = 67; { Too many processes }
|
||||||
Sys_EUSERS = 68; { Too many users }
|
ESysEUSERS = 68; { Too many users }
|
||||||
Sys_EDQUOT = 69; { Disc quota exceeded }
|
ESysEDQUOT = 69; { Disc quota exceeded }
|
||||||
{ Network File System }
|
{ Network File System }
|
||||||
Sys_ESTALE = 70; { Stale NFS file handle }
|
ESysESTALE = 70; { Stale NFS file handle }
|
||||||
Sys_EREMOTE = 71; { Too many levels of remote in path }
|
ESysEREMOTE = 71; { Too many levels of remote in path }
|
||||||
Sys_EBADRPC = 72; { RPC struct is bad }
|
ESysEBADRPC = 72; { RPC struct is bad }
|
||||||
Sys_ERPCMISMATCH= 73; { RPC version wrong }
|
ESysERPCMISMATCH= 73; { RPC version wrong }
|
||||||
Sys_EPROGUNAVAIL= 74; { RPC prog. not avail }
|
ESysEPROGUNAVAIL= 74; { RPC prog. not avail }
|
||||||
Sys_EPROGMISMATCH= 75; { Program version wrong }
|
ESysEPROGMISMATCH= 75; { Program version wrong }
|
||||||
Sys_EPROCUNAVAIL= 76; { Bad procedure for program }
|
ESysEPROCUNAVAIL= 76; { Bad procedure for program }
|
||||||
Sys_ENOLCK = 77; { No locks available }
|
ESysENOLCK = 77; { No locks available }
|
||||||
Sys_ENOSYS = 78; { Function not implemented }
|
ESysENOSYS = 78; { Function not implemented }
|
||||||
Sys_EFTYPE = 79; { Inappropriate file type or format }
|
ESysEFTYPE = 79; { Inappropriate file type or format }
|
||||||
Sys_EAUTH = 80; { Authentication error }
|
ESysEAUTH = 80; { Authentication error }
|
||||||
Sys_ENEEDAUTH = 81; { Need authenticator }
|
ESysENEEDAUTH = 81; { Need authenticator }
|
||||||
Sys_EIDRM = 82; { Identifier removed }
|
ESysEIDRM = 82; { Identifier removed }
|
||||||
Sys_ENOMSG = 83; { No message of desired type }
|
ESysENOMSG = 83; { No message of desired type }
|
||||||
Sys_EOVERFLOW = 84; { Value too large to be stored in data type }
|
ESysEOVERFLOW = 84; { Value too large to be stored in data type }
|
||||||
Sys_ECANCELED = 85; { Operation canceled }
|
ESysECANCELED = 85; { Operation canceled }
|
||||||
Sys_EILSEQ = 86; { Illegal byte sequence }
|
ESysEILSEQ = 86; { Illegal byte sequence }
|
||||||
Sys_ELAST = 86; { Must be equal largest errno }
|
ESysELAST = 86; { Must be equal largest errno }
|
||||||
|
|
||||||
{$else}
|
{$else}
|
||||||
Sys_EDEADLK = 35; { Resource deadlock would occur }
|
ESysEDEADLK = 35; { Resource deadlock would occur }
|
||||||
Sys_ENAMETOOLONG= 36; { File name too long }
|
ESysENAMETOOLONG= 36; { File name too long }
|
||||||
Sys_ENOLCK = 37; { No record locks available }
|
ESysENOLCK = 37; { No record locks available }
|
||||||
Sys_ENOSYS = 38; { Function not implemented }
|
ESysENOSYS = 38; { Function not implemented }
|
||||||
Sys_ENOTEMPTY= 39; { Directory not empty }
|
ESysENOTEMPTY= 39; { Directory not empty }
|
||||||
Sys_ELOOP = 40; { Too many symbolic links encountered }
|
ESysELOOP = 40; { Too many symbolic links encountered }
|
||||||
Sys_EWOULDBLOCK = Sys_EAGAIN; { Operation would block }
|
ESysEWOULDBLOCK = ESysEAGAIN; { Operation would block }
|
||||||
Sys_ENOMSG = 42; { No message of desired type }
|
ESysENOMSG = 42; { No message of desired type }
|
||||||
Sys_EIDRM = 43; { Identifier removed }
|
ESysEIDRM = 43; { Identifier removed }
|
||||||
Sys_ECHRNG = 44; { Channel number out of range }
|
ESysECHRNG = 44; { Channel number out of range }
|
||||||
Sys_EL2NSYNC= 45; { Level 2 not synchronized }
|
ESysEL2NSYNC= 45; { Level 2 not synchronized }
|
||||||
Sys_EL3HLT = 46; { Level 3 halted }
|
ESysEL3HLT = 46; { Level 3 halted }
|
||||||
Sys_EL3RST = 47; { Level 3 reset }
|
ESysEL3RST = 47; { Level 3 reset }
|
||||||
Sys_ELNRNG = 48; { Link number out of range }
|
ESysELNRNG = 48; { Link number out of range }
|
||||||
Sys_EUNATCH = 49; { Protocol driver not attached }
|
ESysEUNATCH = 49; { Protocol driver not attached }
|
||||||
Sys_ENOCSI = 50; { No CSI structure available }
|
ESysENOCSI = 50; { No CSI structure available }
|
||||||
Sys_EL2HLT = 51; { Level 2 halted }
|
ESysEL2HLT = 51; { Level 2 halted }
|
||||||
Sys_EBADE = 52; { Invalid exchange }
|
ESysEBADE = 52; { Invalid exchange }
|
||||||
Sys_EBADR = 53; { Invalid request descriptor }
|
ESysEBADR = 53; { Invalid request descriptor }
|
||||||
Sys_EXFULL = 54; { Exchange full }
|
ESysEXFULL = 54; { Exchange full }
|
||||||
Sys_ENOANO = 55; { No anode }
|
ESysENOANO = 55; { No anode }
|
||||||
Sys_EBADRQC = 56; { Invalid request code }
|
ESysEBADRQC = 56; { Invalid request code }
|
||||||
Sys_EBADSLT = 57; { Invalid slot }
|
ESysEBADSLT = 57; { Invalid slot }
|
||||||
Sys_EDEADLOCK= 58; { File locking deadlock error }
|
ESysEDEADLOCK= 58; { File locking deadlock error }
|
||||||
Sys_EBFONT = 59; { Bad font file format }
|
ESysEBFONT = 59; { Bad font file format }
|
||||||
Sys_ENOSTR = 60; { Device not a stream }
|
ESysENOSTR = 60; { Device not a stream }
|
||||||
Sys_ENODATA = 61; { No data available }
|
ESysENODATA = 61; { No data available }
|
||||||
Sys_ETIME = 62; { Timer expired }
|
ESysETIME = 62; { Timer expired }
|
||||||
Sys_ENOSR = 63; { Out of streams resources }
|
ESysENOSR = 63; { Out of streams resources }
|
||||||
Sys_ENONET = 64; { Machine is not on the network }
|
ESysENONET = 64; { Machine is not on the network }
|
||||||
Sys_ENOPKG = 65; { Package not installed }
|
ESysENOPKG = 65; { Package not installed }
|
||||||
Sys_EREMOTE = 66; { Object is remote }
|
ESysEREMOTE = 66; { Object is remote }
|
||||||
Sys_ENOLINK = 67; { Link has been severed }
|
ESysENOLINK = 67; { Link has been severed }
|
||||||
Sys_EADV = 68; { Advertise error }
|
ESysEADV = 68; { Advertise error }
|
||||||
Sys_ESRMNT = 69; { Srmount error }
|
ESysESRMNT = 69; { Srmount error }
|
||||||
Sys_ECOMM = 70; { Communication error on send }
|
ESysECOMM = 70; { Communication error on send }
|
||||||
Sys_EPROTO = 71; { Protocol error }
|
ESysEPROTO = 71; { Protocol error }
|
||||||
Sys_EMULTIHOP= 72; { Multihop attempted }
|
ESysEMULTIHOP= 72; { Multihop attempted }
|
||||||
Sys_EDOTDOT = 73; { RFS specific error }
|
ESysEDOTDOT = 73; { RFS specific error }
|
||||||
Sys_EBADMSG = 74; { Not a data message }
|
ESysEBADMSG = 74; { Not a data message }
|
||||||
Sys_EOVERFLOW= 75; { Value too large for defined data type }
|
ESysEOVERFLOW= 75; { Value too large for defined data type }
|
||||||
Sys_ENOTUNIQ= 76; { Name not unique on network }
|
ESysENOTUNIQ= 76; { Name not unique on network }
|
||||||
Sys_EBADFD = 77; { File descriptor in bad state }
|
ESysEBADFD = 77; { File descriptor in bad state }
|
||||||
Sys_EREMCHG = 78; { Remote address changed }
|
ESysEREMCHG = 78; { Remote address changed }
|
||||||
Sys_ELIBACC = 79; { Can not access a needed shared library }
|
ESysELIBACC = 79; { Can not access a needed shared library }
|
||||||
Sys_ELIBBAD = 80; { Accessing a corrupted shared library }
|
ESysELIBBAD = 80; { Accessing a corrupted shared library }
|
||||||
Sys_ELIBSCN = 81; { .lib section in a.out corrupted }
|
ESysELIBSCN = 81; { .lib section in a.out corrupted }
|
||||||
Sys_ELIBMAX = 82; { Attempting to link in too many shared libraries }
|
ESysELIBMAX = 82; { Attempting to link in too many shared libraries }
|
||||||
Sys_ELIBEXEC= 83; { Cannot exec a shared library directly }
|
ESysELIBEXEC= 83; { Cannot exec a shared library directly }
|
||||||
Sys_EILSEQ = 84; { Illegal byte sequence }
|
ESysEILSEQ = 84; { Illegal byte sequence }
|
||||||
Sys_ERESTART= 85; { Interrupted system call should be restarted }
|
ESysERESTART= 85; { Interrupted system call should be restarted }
|
||||||
Sys_ESTRPIPE= 86; { Streams pipe error }
|
ESysESTRPIPE= 86; { Streams pipe error }
|
||||||
Sys_EUSERS = 87; { Too many users }
|
ESysEUSERS = 87; { Too many users }
|
||||||
Sys_ENOTSOCK= 88; { Socket operation on non-socket }
|
ESysENOTSOCK= 88; { Socket operation on non-socket }
|
||||||
Sys_EDESTADDRREQ= 89; { Destination address required }
|
ESysEDESTADDRREQ= 89; { Destination address required }
|
||||||
Sys_EMSGSIZE= 90; { Message too long }
|
ESysEMSGSIZE= 90; { Message too long }
|
||||||
Sys_EPROTOTYPE= 91; { Protocol wrong type for socket }
|
ESysEPROTOTYPE= 91; { Protocol wrong type for socket }
|
||||||
Sys_ENOPROTOOPT= 92; { Protocol not available }
|
ESysENOPROTOOPT= 92; { Protocol not available }
|
||||||
Sys_EPROTONOSUPPORT= 93; { Protocol not supported }
|
ESysEPROTONOSUPPORT= 93; { Protocol not supported }
|
||||||
Sys_ESOCKTNOSUPPORT= 94; { Socket type not supported }
|
ESysESOCKTNOSUPPORT= 94; { Socket type not supported }
|
||||||
Sys_EOPNOTSUPP= 95; { Operation not supported on transport endpoint }
|
ESysEOPNOTSUPP= 95; { Operation not supported on transport endpoint }
|
||||||
Sys_EPFNOSUPPORT= 96; { Protocol family not supported }
|
ESysEPFNOSUPPORT= 96; { Protocol family not supported }
|
||||||
Sys_EAFNOSUPPORT= 97; { Address family not supported by protocol }
|
ESysEAFNOSUPPORT= 97; { Address family not supported by protocol }
|
||||||
Sys_EADDRINUSE= 98; { Address already in use }
|
ESysEADDRINUSE= 98; { Address already in use }
|
||||||
Sys_EADDRNOTAVAIL= 99; { Cannot assign requested address }
|
ESysEADDRNOTAVAIL= 99; { Cannot assign requested address }
|
||||||
Sys_ENETDOWN= 100; { Network is down }
|
ESysENETDOWN= 100; { Network is down }
|
||||||
Sys_ENETUNREACH= 101; { Network is unreachable }
|
ESysENETUNREACH= 101; { Network is unreachable }
|
||||||
Sys_ENETRESET= 102; { Network dropped connection because of reset }
|
ESysENETRESET= 102; { Network dropped connection because of reset }
|
||||||
Sys_ECONNABORTED= 103; { Software caused connection abort }
|
ESysECONNABORTED= 103; { Software caused connection abort }
|
||||||
Sys_ECONNRESET= 104; { Connection reset by peer }
|
ESysECONNRESET= 104; { Connection reset by peer }
|
||||||
Sys_ENOBUFS = 105; { No buffer space available }
|
ESysENOBUFS = 105; { No buffer space available }
|
||||||
Sys_EISCONN = 106; { Transport endpoint is already connected }
|
ESysEISCONN = 106; { Transport endpoint is already connected }
|
||||||
Sys_ENOTCONN= 107; { Transport endpoint is not connected }
|
ESysENOTCONN= 107; { Transport endpoint is not connected }
|
||||||
Sys_ESHUTDOWN= 108; { Cannot send after transport endpoint shutdown }
|
ESysESHUTDOWN= 108; { Cannot send after transport endpoint shutdown }
|
||||||
Sys_ETOOMANYREFS= 109; { Too many references: cannot splice }
|
ESysETOOMANYREFS= 109; { Too many references: cannot splice }
|
||||||
Sys_ETIMEDOUT= 110; { Connection timed out }
|
ESysETIMEDOUT= 110; { Connection timed out }
|
||||||
Sys_ECONNREFUSED= 111; { Connection refused }
|
ESysECONNREFUSED= 111; { Connection refused }
|
||||||
Sys_EHOSTDOWN= 112; { Host is down }
|
ESysEHOSTDOWN= 112; { Host is down }
|
||||||
Sys_EHOSTUNREACH= 113; { No route to host }
|
ESysEHOSTUNREACH= 113; { No route to host }
|
||||||
Sys_EALREADY= 114; { Operation already in progress }
|
ESysEALREADY= 114; { Operation already in progress }
|
||||||
Sys_EINPROGRESS= 115; { Operation now in progress }
|
ESysEINPROGRESS= 115; { Operation now in progress }
|
||||||
Sys_ESTALE = 116; { Stale NFS file handle }
|
ESysESTALE = 116; { Stale NFS file handle }
|
||||||
Sys_EUCLEAN = 117; { Structure needs cleaning }
|
ESysEUCLEAN = 117; { Structure needs cleaning }
|
||||||
Sys_ENOTNAM = 118; { Not a XENIX named type file }
|
ESysENOTNAM = 118; { Not a XENIX named type file }
|
||||||
Sys_ENAVAIL = 119; { No XENIX semaphores available }
|
ESysENAVAIL = 119; { No XENIX semaphores available }
|
||||||
Sys_EISNAM = 120; { Is a named type file }
|
ESysEISNAM = 120; { Is a named type file }
|
||||||
Sys_EREMOTEIO= 121; { Remote I/O error }
|
ESysEREMOTEIO= 121; { Remote I/O error }
|
||||||
Sys_EDQUOT = 122; { Quota exceeded }
|
ESysEDQUOT = 122; { Quota exceeded }
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.4 2002-09-07 16:01:27 peter
|
Revision 1.5 2002-12-18 16:50:39 marco
|
||||||
|
* Unix RTL generic parts. Linux working, *BSD will follow shortly
|
||||||
|
|
||||||
|
Revision 1.4 2002/09/07 16:01:27 peter
|
||||||
* old logs removed and tabs fixed
|
* old logs removed and tabs fixed
|
||||||
|
|
||||||
Revision 1.3 2002/03/11 19:10:33 peter
|
Revision 1.3 2002/03/11 19:10:33 peter
|
||||||
|
126
rtl/unix/genfuncs.inc
Normal file
126
rtl/unix/genfuncs.inc
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
{
|
||||||
|
$Id$
|
||||||
|
This file is part of the Free Pascal run time library.
|
||||||
|
Copyright (c) 2002 by Marco van de Voort.
|
||||||
|
|
||||||
|
A few general purpose routines. General purpose enough for *BSD
|
||||||
|
and Linux at least.
|
||||||
|
|
||||||
|
See the file COPYING.FPC, included in this distribution,
|
||||||
|
for details about the copyright.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
**********************************************************************}
|
||||||
|
|
||||||
|
function InternalCreateShellArgV(cmd:pChar; len:longint):ppchar;
|
||||||
|
{
|
||||||
|
Create an argv which executes a command in a shell using /bin/sh -c
|
||||||
|
}
|
||||||
|
const Shell = '/bin/sh'#0'-c'#0;
|
||||||
|
var
|
||||||
|
pp,p : ppchar;
|
||||||
|
// temp : string; !! Never pass a local var back!!
|
||||||
|
begin
|
||||||
|
getmem(pp,4*4);
|
||||||
|
p:=pp;
|
||||||
|
p^:=@Shell[1];
|
||||||
|
inc(p);
|
||||||
|
p^:=@Shell[9];
|
||||||
|
inc(p);
|
||||||
|
getmem(p^,len+1);
|
||||||
|
move(cmd^,p^^,len);
|
||||||
|
pchar(p^)[len]:=#0;
|
||||||
|
inc(p);
|
||||||
|
p^:=Nil;
|
||||||
|
InternalCreateShellArgV:=pp;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function CreateShellArgV(const prog:string):ppchar;
|
||||||
|
begin
|
||||||
|
CreateShellArgV:=InternalCreateShellArgV(@prog[1],length(prog));
|
||||||
|
end;
|
||||||
|
|
||||||
|
function CreateShellArgV(const prog:Ansistring):ppchar;
|
||||||
|
{
|
||||||
|
Create an argv which executes a command in a shell using /bin/sh -c
|
||||||
|
using a AnsiString;
|
||||||
|
}
|
||||||
|
begin
|
||||||
|
CreateShellArgV:=InternalCreateShellArgV(@prog[1],length(prog)); // if ppc works like delphi this also work when @prog[1] is invalid (len=0)
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure FreeShellArgV(p:ppchar);
|
||||||
|
begin
|
||||||
|
if (p<>nil) then begin
|
||||||
|
freemem(p[2]);
|
||||||
|
freemem(p);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Function fpgetenv(name:pchar):pchar;
|
||||||
|
|
||||||
|
var
|
||||||
|
p : ppchar;
|
||||||
|
found : boolean;
|
||||||
|
np,cp : pchar;
|
||||||
|
len,i : longint;
|
||||||
|
Begin
|
||||||
|
if (name=nil) or (envp=NIL) Then
|
||||||
|
exit(NIL);
|
||||||
|
np:=name;
|
||||||
|
while (np^<>#0) and (np^<>'=') DO
|
||||||
|
inc(np);
|
||||||
|
len:=np-name;
|
||||||
|
p:=envp;
|
||||||
|
while (p^<>NIL) DO
|
||||||
|
Begin
|
||||||
|
cp:=p^;
|
||||||
|
np:=name;
|
||||||
|
i:=len;
|
||||||
|
while (i<>0) and (cp^<>#0) DO
|
||||||
|
Begin
|
||||||
|
if cp^<>np^ Then
|
||||||
|
Begin
|
||||||
|
inc(cp); inc(np);
|
||||||
|
break;
|
||||||
|
End;
|
||||||
|
inc(cp); inc(np);
|
||||||
|
dec(i)
|
||||||
|
End;
|
||||||
|
if (i=0) and (cp^='=') Then
|
||||||
|
exit(cp+1);
|
||||||
|
inc(p);
|
||||||
|
end;
|
||||||
|
End;
|
||||||
|
|
||||||
|
Function fpgetenv(name:string):Pchar;
|
||||||
|
{
|
||||||
|
Searches the environment for a string with name p and
|
||||||
|
returns a pchar to it's value.
|
||||||
|
A pchar is used to accomodate for strings of length > 255
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Begin
|
||||||
|
name:=name+'='; {Else HOST will also find HOSTNAME, etc}
|
||||||
|
fpgetenv:=fpgetenv(@name[1]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{
|
||||||
|
$Log$
|
||||||
|
Revision 1.1 2002-12-18 16:50:39 marco
|
||||||
|
* Unix RTL generic parts. Linux working, *BSD will follow shortly
|
||||||
|
|
||||||
|
Revision 1.2 2002/10/27 17:21:30 marco
|
||||||
|
* Only "difficult" functions + execvp + termios + rewinddir left to do
|
||||||
|
|
||||||
|
Revision 1.1 2002/10/27 13:16:54 marco
|
||||||
|
* Routines that certainly will be shared between Linux and *BSD
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -15,65 +15,68 @@
|
|||||||
|
|
||||||
**********************************************************************}
|
**********************************************************************}
|
||||||
|
|
||||||
function sys_sigaddset(var _set : sigset_t;signo:cint): cint;
|
function fpsigaddset(var nset : sigset_t;signo:cint): cint;
|
||||||
|
|
||||||
Begin
|
Begin
|
||||||
if (signo<=0) or (signo > SIG_MAXSIG) Then
|
if (signo<=0) or (signo > SIG_MAXSIG) Then
|
||||||
Begin
|
Begin
|
||||||
seterrno(sys_EINVAL);
|
seterrno(ESysEINVAL);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
End;
|
End;
|
||||||
_set[(signo-1) shr ln2bitsinword]:=_set[(signo-1) shr ln2bitsinword] OR (1 shl ((signo-1) and ln2bitmask));
|
nset[(signo-1) shr ln2bitsinword]:=nset[(signo-1) shr ln2bitsinword] OR (1 shl ((signo-1) and ln2bitmask));
|
||||||
sys_sigaddset:=0;
|
fpsigaddset:=0;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
function sys_sigdelset(var _set : sigset_t;signo:cint): cint;
|
function fpsigdelset(var nset : sigset_t;signo:cint): cint;
|
||||||
|
|
||||||
Begin
|
Begin
|
||||||
if (signo<=0) or (signo > SIG_MAXSIG) Then
|
if (signo<=0) or (signo > SIG_MAXSIG) Then
|
||||||
Begin
|
Begin
|
||||||
seterrno(sys_EINVAL);
|
seterrno(ESysEINVAL);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
End;
|
End;
|
||||||
_set[(signo-1) shr ln2bitsinword]:=_set[(signo-1) shr ln2bitsinword] AND NOT (1 shl ((signo-1) and ln2bitmask));
|
nset[(signo-1) shr ln2bitsinword]:=nset[(signo-1) shr ln2bitsinword] AND NOT (1 shl ((signo-1) and ln2bitmask));
|
||||||
sys_sigdelset:=0;
|
fpsigdelset:=0;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
function sys_sigemptyset(var _set : sigset_t):cint;
|
function fpsigemptyset(var nset : sigset_t):cint;
|
||||||
|
|
||||||
var i :longint;
|
var i :longint;
|
||||||
|
|
||||||
Begin
|
Begin
|
||||||
for i:=0 to wordsinsigset-1 DO _set[i]:=0;
|
for i:=0 to wordsinsigset-1 DO nset[i]:=0;
|
||||||
sys_sigemptyset:=0;
|
fpsigemptyset:=0;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
function sys_sigfillset(var _set : sigset_t):cint;
|
function fpsigfillset(var nset : sigset_t):cint;
|
||||||
|
|
||||||
var i :longint;
|
var i :longint;
|
||||||
|
|
||||||
Begin
|
Begin
|
||||||
for i:=0 to wordsinsigset DO _set[i]:=NOT 0;
|
for i:=0 to wordsinsigset DO nset[i]:=NOT 0;
|
||||||
sys_sigfillset:=0;
|
fpsigfillset:=0;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
function sys_sigismember(const _set : sigset_t;signo:cint): cint;
|
function fpsigismember(const nset : sigset_t;signo:cint): cint;
|
||||||
|
|
||||||
Begin
|
Begin
|
||||||
if (signo<=0) or (signo > SIG_MAXSIG) Then
|
if (signo<=0) or (signo > SIG_MAXSIG) Then
|
||||||
Begin
|
Begin
|
||||||
seterrno(sys_EINVAL);
|
seterrno(ESysEINVAL);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
End;
|
End;
|
||||||
if ((_set[(signo-1) shr ln2bitsinword]) and (1 shl ((signo-1) and ln2bitmask)))>0 Then
|
if ((nset[(signo-1) shr ln2bitsinword]) and (1 shl ((signo-1) and ln2bitmask)))>0 Then
|
||||||
sys_sigismember:=1
|
fpsigismember:=1
|
||||||
else
|
else
|
||||||
sys_sigismember:=0;
|
fpsigismember:=0;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.1 2002-11-14 12:20:30 marco
|
Revision 1.2 2002-12-18 16:50:39 marco
|
||||||
|
* Unix RTL generic parts. Linux working, *BSD will follow shortly
|
||||||
|
|
||||||
|
Revision 1.1 2002/11/14 12:20:30 marco
|
||||||
* initial version, taken from bsdfunc.inc, since both linux and bsd use it
|
* initial version, taken from bsdfunc.inc, since both linux and bsd use it
|
||||||
|
|
||||||
|
|
||||||
|
@ -497,7 +497,7 @@ Function S_ISSOCK(m:word):boolean;
|
|||||||
|
|
||||||
Implementation
|
Implementation
|
||||||
|
|
||||||
Uses Strings;
|
Uses Strings,baseunix;
|
||||||
|
|
||||||
|
|
||||||
{ Get the definitions of textrec and filerec }
|
{ Get the definitions of textrec and filerec }
|
||||||
@ -521,7 +521,7 @@ begin
|
|||||||
repeat
|
repeat
|
||||||
s:=$7F00;
|
s:=$7F00;
|
||||||
r:=WaitPid(Pid,@s,0);
|
r:=WaitPid(Pid,@s,0);
|
||||||
until (r<>-1) or (LinuxError<>Sys_EINTR);
|
until (r<>-1) or (LinuxError<>ESysEINTR);
|
||||||
if (r=-1) or (r=0) then // 0 is not a valid return and should never occur (it means status invalid when using WNOHANG)
|
if (r=-1) or (r=0) then // 0 is not a valid return and should never occur (it means status invalid when using WNOHANG)
|
||||||
WaitProcess:=-1 // return -1 to indicate an error
|
WaitProcess:=-1 // return -1 to indicate an error
|
||||||
else
|
else
|
||||||
@ -619,7 +619,7 @@ begin
|
|||||||
else
|
else
|
||||||
Path:='';
|
Path:='';
|
||||||
if Path='' then
|
if Path='' then
|
||||||
linuxerror:=Sys_enoent
|
linuxerror:=ESysenoent
|
||||||
else
|
else
|
||||||
Execve(Path,args,ep);{On error linuxerror will get set there}
|
Execve(Path,args,ep);{On error linuxerror will get set there}
|
||||||
end;
|
end;
|
||||||
@ -654,7 +654,7 @@ begin
|
|||||||
else
|
else
|
||||||
Path:='';
|
Path:='';
|
||||||
if Path='' then
|
if Path='' then
|
||||||
linuxerror:=Sys_enoent
|
linuxerror:=ESysenoent
|
||||||
else
|
else
|
||||||
Execve(Path,args,ep);{On error linuxerror will get set there}
|
Execve(Path,args,ep);{On error linuxerror will get set there}
|
||||||
end;
|
end;
|
||||||
@ -1012,7 +1012,7 @@ end;
|
|||||||
Function fdOpen(pathname:string;flags:longint):longint;
|
Function fdOpen(pathname:string;flags:longint):longint;
|
||||||
begin
|
begin
|
||||||
pathname:=pathname+#0;
|
pathname:=pathname+#0;
|
||||||
fdOpen:=Sys_Open(@pathname[1],flags,438);
|
fdOpen:=FpOpen(@pathname[1],flags,438);
|
||||||
LinuxError:=Errno;
|
LinuxError:=Errno;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1020,7 +1020,7 @@ end;
|
|||||||
Function fdOpen(pathname:string;flags,mode:longint):longint;
|
Function fdOpen(pathname:string;flags,mode:longint):longint;
|
||||||
begin
|
begin
|
||||||
pathname:=pathname+#0;
|
pathname:=pathname+#0;
|
||||||
fdOpen:=Sys_Open(@pathname[1],flags,mode);
|
fdOpen:=FpOpen(@pathname[1],flags,mode);
|
||||||
LinuxError:=Errno;
|
LinuxError:=Errno;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1028,7 +1028,7 @@ end;
|
|||||||
|
|
||||||
Function fdOpen(pathname:pchar;flags:longint):longint;
|
Function fdOpen(pathname:pchar;flags:longint):longint;
|
||||||
begin
|
begin
|
||||||
fdOpen:=Sys_Open(pathname,flags,0);
|
fdOpen:=FpOpen(pathname,flags,0);
|
||||||
LinuxError:=Errno;
|
LinuxError:=Errno;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1036,7 +1036,7 @@ end;
|
|||||||
|
|
||||||
Function fdOpen(pathname:pchar;flags,mode:longint):longint;
|
Function fdOpen(pathname:pchar;flags,mode:longint):longint;
|
||||||
begin
|
begin
|
||||||
fdOpen:=Sys_Open(pathname,flags,mode);
|
fdOpen:=FpOpen(pathname,flags,mode);
|
||||||
LinuxError:=Errno;
|
LinuxError:=Errno;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1044,7 +1044,7 @@ end;
|
|||||||
|
|
||||||
Function fdClose(fd:longint):boolean;
|
Function fdClose(fd:longint):boolean;
|
||||||
begin
|
begin
|
||||||
fdClose:=(Sys_Close(fd)=0);
|
fdClose:=(FpClose(fd)=0);
|
||||||
LinuxError:=Errno;
|
LinuxError:=Errno;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1052,7 +1052,7 @@ end;
|
|||||||
|
|
||||||
Function fdRead(fd:longint;var buf;size:longint):longint;
|
Function fdRead(fd:longint;var buf;size:longint):longint;
|
||||||
begin
|
begin
|
||||||
fdRead:=Sys_Read(fd,pchar(@buf),size);
|
fdRead:=FpRead(fd,pchar(@buf),size);
|
||||||
LinuxError:=Errno;
|
LinuxError:=Errno;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1060,7 +1060,7 @@ end;
|
|||||||
|
|
||||||
Function fdWrite(fd:longint;const buf;size:longint):longint;
|
Function fdWrite(fd:longint;const buf;size:longint):longint;
|
||||||
begin
|
begin
|
||||||
fdWrite:=Sys_Write(fd,pchar(@buf),size);
|
fdWrite:=FpWrite(fd,pchar(@buf),size);
|
||||||
LinuxError:=Errno;
|
LinuxError:=Errno;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1073,7 +1073,7 @@ Function fdSeek (fd,pos,seektype :longint): longint;
|
|||||||
|
|
||||||
}
|
}
|
||||||
begin
|
begin
|
||||||
fdseek:=Sys_LSeek (fd,pos,seektype);
|
fdseek:=FpLSeek (fd,pos,seektype);
|
||||||
LinuxError:=Errno;
|
LinuxError:=Errno;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1084,13 +1084,13 @@ Function Fcntl(Fd:longint;Cmd:longint):longint;
|
|||||||
Possible values for Cmd are :
|
Possible values for Cmd are :
|
||||||
F_GetFd,F_GetFl,F_GetOwn
|
F_GetFd,F_GetFl,F_GetOwn
|
||||||
Errors are reported in Linuxerror;
|
Errors are reported in Linuxerror;
|
||||||
If Cmd is different from the allowed values, linuxerror=Sys_eninval.
|
If Cmd is different from the allowed values, linuxerror=ESyseninval.
|
||||||
}
|
}
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if (cmd in [F_GetFd,F_GetFl,F_GetOwn]) then
|
if (cmd in [F_GetFd,F_GetFl,F_GetOwn]) then
|
||||||
begin
|
begin
|
||||||
Linuxerror:=sys_fcntl(fd,cmd,0);
|
Linuxerror:=fdfcntl(fd,cmd,0);
|
||||||
if linuxerror=-1 then
|
if linuxerror=-1 then
|
||||||
begin
|
begin
|
||||||
linuxerror:=errno;
|
linuxerror:=errno;
|
||||||
@ -1104,7 +1104,7 @@ begin
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
linuxerror:=Sys_einval;
|
linuxerror:=ESyseinval;
|
||||||
Fcntl:=0;
|
Fcntl:=0;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -1122,11 +1122,11 @@ Procedure Fcntl(Fd:longint;Cmd:longint;Arg:Longint);
|
|||||||
begin
|
begin
|
||||||
if (cmd in [F_SetFd,F_SetFl,F_GetLk,F_SetLk,F_SetLkw,F_SetOwn]) then
|
if (cmd in [F_SetFd,F_SetFl,F_GetLk,F_SetLk,F_SetLkw,F_SetOwn]) then
|
||||||
begin
|
begin
|
||||||
sys_fcntl(fd,cmd,arg);
|
fpfcntl(fd,cmd,arg);
|
||||||
LinuxError:=ErrNo;
|
LinuxError:=ErrNo;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
linuxerror:=Sys_einval;
|
linuxerror:=ESyseinval;
|
||||||
end;
|
end;
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
@ -1361,7 +1361,7 @@ Var
|
|||||||
begin
|
begin
|
||||||
if textrec(t).mode=fmclosed then
|
if textrec(t).mode=fmclosed then
|
||||||
begin
|
begin
|
||||||
LinuxError:=Sys_EBADF;
|
LinuxError:=ESysEBadf;
|
||||||
exit(-1);
|
exit(-1);
|
||||||
end;
|
end;
|
||||||
FD_Zero(f);
|
FD_Zero(f);
|
||||||
@ -1406,7 +1406,7 @@ procedure SeekDir(p:pdir;off:longint);
|
|||||||
begin
|
begin
|
||||||
if p=nil then
|
if p=nil then
|
||||||
begin
|
begin
|
||||||
errno:=Sys_EBADF;
|
errno:=ESysEBadf;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
{$ifndef bsd} {Should be ifdef Linux, but can't because
|
{$ifndef bsd} {Should be ifdef Linux, but can't because
|
||||||
@ -1424,7 +1424,7 @@ function TellDir(p:pdir):longint;
|
|||||||
begin
|
begin
|
||||||
if p=nil then
|
if p=nil then
|
||||||
begin
|
begin
|
||||||
errno:=Sys_EBADF;
|
errno:=ESysEBadf;
|
||||||
telldir:=-1;
|
telldir:=-1;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
@ -1590,7 +1590,7 @@ begin
|
|||||||
rw:=upcase(rw);
|
rw:=upcase(rw);
|
||||||
if not (rw in ['R','W']) then
|
if not (rw in ['R','W']) then
|
||||||
begin
|
begin
|
||||||
LinuxError:=Sys_enoent;
|
LinuxError:=ESysENOENT;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
AssignPipe(pipi,pipo);
|
AssignPipe(pipi,pipo);
|
||||||
@ -1669,7 +1669,7 @@ begin
|
|||||||
rw:=upcase(rw);
|
rw:=upcase(rw);
|
||||||
if not (rw in ['R','W']) then
|
if not (rw in ['R','W']) then
|
||||||
begin
|
begin
|
||||||
LinuxError:=Sys_enoent;
|
LinuxError:=ESysENOENT;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
AssignPipe(pipi,pipo);
|
AssignPipe(pipi,pipo);
|
||||||
@ -2011,7 +2011,7 @@ begin
|
|||||||
{$endif}
|
{$endif}
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
ErrNo:=Sys_EINVAL;
|
ErrNo:=ESysEINVAL;
|
||||||
TCSetAttr:=false;
|
TCSetAttr:=false;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
@ -2275,7 +2275,7 @@ begin
|
|||||||
StringToPPChar:=p;
|
StringToPPChar:=p;
|
||||||
if p=nil then
|
if p=nil then
|
||||||
begin
|
begin
|
||||||
LinuxError:=sys_enomem;
|
LinuxError:=ESysENOMEM;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
buf:=s;
|
buf:=s;
|
||||||
@ -2586,7 +2586,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
if current=nil then
|
if current=nil then
|
||||||
begin
|
begin
|
||||||
linuxerror:=Sys_ENOMEM;
|
linuxerror:=ESysENOMEM;
|
||||||
globfree(root);
|
globfree(root);
|
||||||
break;
|
break;
|
||||||
end;
|
end;
|
||||||
@ -2594,7 +2594,7 @@ begin
|
|||||||
getmem(current^.name,length(temp2)+1);
|
getmem(current^.name,length(temp2)+1);
|
||||||
if current^.name=nil then
|
if current^.name=nil then
|
||||||
begin
|
begin
|
||||||
linuxerror:=Sys_ENOMEM;
|
linuxerror:=ESysENOMEM;
|
||||||
globfree(root);
|
globfree(root);
|
||||||
break;
|
break;
|
||||||
end;
|
end;
|
||||||
@ -3032,7 +3032,10 @@ End.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.24 2002-09-13 13:03:27 jonas
|
Revision 1.25 2002-12-18 16:50:39 marco
|
||||||
|
* Unix RTL generic parts. Linux working, *BSD will follow shortly
|
||||||
|
|
||||||
|
Revision 1.24 2002/09/13 13:03:27 jonas
|
||||||
* fixed buffer overflow error in StringToPPChar(), detected using
|
* fixed buffer overflow error in StringToPPChar(), detected using
|
||||||
DIOTA (http://www.elis/rug.ac.be/~ronsse/diota) (which I also work on :)
|
DIOTA (http://www.elis/rug.ac.be/~ronsse/diota) (which I also work on :)
|
||||||
(merged)
|
(merged)
|
||||||
|
@ -515,7 +515,7 @@ begin
|
|||||||
repeat
|
repeat
|
||||||
s:=$7F00;
|
s:=$7F00;
|
||||||
r:=WaitPid(Pid,@s,0);
|
r:=WaitPid(Pid,@s,0);
|
||||||
until (r<>-1) or (LinuxError<>Sys_EINTR);
|
until (r<>-1) or (LinuxError<>ESysEINTR);
|
||||||
if (r=-1) or (r=0) then // 0 is not a valid return and should never occur (it means status invalid when using WNOHANG)
|
if (r=-1) or (r=0) then // 0 is not a valid return and should never occur (it means status invalid when using WNOHANG)
|
||||||
WaitProcess:=-1 // return -1 to indicate an error
|
WaitProcess:=-1 // return -1 to indicate an error
|
||||||
else
|
else
|
||||||
@ -613,7 +613,7 @@ begin
|
|||||||
else
|
else
|
||||||
Path:='';
|
Path:='';
|
||||||
if Path='' then
|
if Path='' then
|
||||||
linuxerror:=Sys_enoent
|
linuxerror:=ESysEnoent
|
||||||
else
|
else
|
||||||
Execve(Path,args,ep);{On error linuxerror will get set there}
|
Execve(Path,args,ep);{On error linuxerror will get set there}
|
||||||
end;
|
end;
|
||||||
@ -648,7 +648,7 @@ begin
|
|||||||
else
|
else
|
||||||
Path:='';
|
Path:='';
|
||||||
if Path='' then
|
if Path='' then
|
||||||
linuxerror:=Sys_enoent
|
linuxerror:=ESysEnoent
|
||||||
else
|
else
|
||||||
Execve(Path,args,ep);{On error linuxerror will get set there}
|
Execve(Path,args,ep);{On error linuxerror will get set there}
|
||||||
end;
|
end;
|
||||||
@ -1116,7 +1116,7 @@ Function Fcntl(Fd:longint;Cmd:longint):longint;
|
|||||||
Possible values for Cmd are :
|
Possible values for Cmd are :
|
||||||
F_GetFd,F_GetFl,F_GetOwn
|
F_GetFd,F_GetFl,F_GetOwn
|
||||||
Errors are reported in Linuxerror;
|
Errors are reported in Linuxerror;
|
||||||
If Cmd is different from the allowed values, linuxerror=Sys_eninval.
|
If Cmd is different from the allowed values, linuxerror=ESysEninval.
|
||||||
}
|
}
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -1136,7 +1136,7 @@ begin
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
linuxerror:=Sys_einval;
|
linuxerror:=ESysEinval;
|
||||||
Fcntl:=0;
|
Fcntl:=0;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -1148,7 +1148,7 @@ Procedure Fcntl(Fd:longint;Cmd:longint;Arg:Longint);
|
|||||||
Possible values for Cmd are :
|
Possible values for Cmd are :
|
||||||
F_setFd,F_SetFl,F_GetLk,F_SetLk,F_SetLkW,F_SetOwn;
|
F_setFd,F_SetFl,F_GetLk,F_SetLk,F_SetLkW,F_SetOwn;
|
||||||
Errors are reported in Linuxerror;
|
Errors are reported in Linuxerror;
|
||||||
If Cmd is different from the allowed values, linuxerror=Sys_eninval.
|
If Cmd is different from the allowed values, linuxerror=ESysEninval.
|
||||||
F_DupFD is not allowed, due to the structure of Files in Pascal.
|
F_DupFD is not allowed, due to the structure of Files in Pascal.
|
||||||
}
|
}
|
||||||
begin
|
begin
|
||||||
@ -1158,7 +1158,7 @@ begin
|
|||||||
LinuxError:=ErrNo;
|
LinuxError:=ErrNo;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
linuxerror:=Sys_einval;
|
linuxerror:=ESysEinval;
|
||||||
end;
|
end;
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
@ -1394,7 +1394,7 @@ Var
|
|||||||
begin
|
begin
|
||||||
if textrec(t).mode=fmclosed then
|
if textrec(t).mode=fmclosed then
|
||||||
begin
|
begin
|
||||||
LinuxError:=Sys_EBADF;
|
LinuxError:=ESysEBADF;
|
||||||
exit(-1);
|
exit(-1);
|
||||||
end;
|
end;
|
||||||
FD_Zero(f);
|
FD_Zero(f);
|
||||||
@ -1439,7 +1439,7 @@ procedure SeekDir(p:pdir;off:longint);
|
|||||||
begin
|
begin
|
||||||
if p=nil then
|
if p=nil then
|
||||||
begin
|
begin
|
||||||
errno:=Sys_EBADF;
|
errno:=ESysEBADF;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
{$ifndef bsd}
|
{$ifndef bsd}
|
||||||
@ -1454,7 +1454,7 @@ function TellDir(p:pdir):longint;
|
|||||||
begin
|
begin
|
||||||
if p=nil then
|
if p=nil then
|
||||||
begin
|
begin
|
||||||
errno:=Sys_EBADF;
|
errno:=ESysEBADF;
|
||||||
telldir:=-1;
|
telldir:=-1;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
@ -1620,7 +1620,7 @@ begin
|
|||||||
rw:=upcase(rw);
|
rw:=upcase(rw);
|
||||||
if not (rw in ['R','W']) then
|
if not (rw in ['R','W']) then
|
||||||
begin
|
begin
|
||||||
LinuxError:=Sys_enoent;
|
LinuxError:=ESysEnoent;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
AssignPipe(pipi,pipo);
|
AssignPipe(pipi,pipo);
|
||||||
@ -1699,7 +1699,7 @@ begin
|
|||||||
rw:=upcase(rw);
|
rw:=upcase(rw);
|
||||||
if not (rw in ['R','W']) then
|
if not (rw in ['R','W']) then
|
||||||
begin
|
begin
|
||||||
LinuxError:=Sys_enoent;
|
LinuxError:=ESysEnoent;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
AssignPipe(pipi,pipo);
|
AssignPipe(pipi,pipo);
|
||||||
@ -2041,7 +2041,7 @@ begin
|
|||||||
{$endif}
|
{$endif}
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
ErrNo:=Sys_EINVAL;
|
ErrNo:=ESysEINVAL;
|
||||||
TCSetAttr:=false;
|
TCSetAttr:=false;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
@ -2305,7 +2305,7 @@ begin
|
|||||||
StringToPPChar:=p;
|
StringToPPChar:=p;
|
||||||
if p=nil then
|
if p=nil then
|
||||||
begin
|
begin
|
||||||
LinuxError:=sys_enomem;
|
LinuxError:=ESysEnomem;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
buf:=s;
|
buf:=s;
|
||||||
@ -2612,7 +2612,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
if current=nil then
|
if current=nil then
|
||||||
begin
|
begin
|
||||||
linuxerror:=Sys_ENOMEM;
|
linuxerror:=ESysENOMEM;
|
||||||
globfree(root);
|
globfree(root);
|
||||||
break;
|
break;
|
||||||
end;
|
end;
|
||||||
@ -2620,7 +2620,7 @@ begin
|
|||||||
getmem(current^.name,length(temp2)+1);
|
getmem(current^.name,length(temp2)+1);
|
||||||
if current^.name=nil then
|
if current^.name=nil then
|
||||||
begin
|
begin
|
||||||
linuxerror:=Sys_ENOMEM;
|
linuxerror:=ESysENOMEM;
|
||||||
globfree(root);
|
globfree(root);
|
||||||
break;
|
break;
|
||||||
end;
|
end;
|
||||||
@ -3058,7 +3058,10 @@ End.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.24 2002-09-07 16:01:28 peter
|
Revision 1.25 2002-12-18 16:50:39 marco
|
||||||
|
* Unix RTL generic parts. Linux working, *BSD will follow shortly
|
||||||
|
|
||||||
|
Revision 1.24 2002/09/07 16:01:28 peter
|
||||||
* old logs removed and tabs fixed
|
* old logs removed and tabs fixed
|
||||||
|
|
||||||
Revision 1.23 2002/08/06 13:30:46 sg
|
Revision 1.23 2002/08/06 13:30:46 sg
|
||||||
|
Loading…
Reference in New Issue
Block a user