summaryrefslogtreecommitdiff
path: root/ULibc.pas
diff options
context:
space:
mode:
Diffstat (limited to 'ULibc.pas')
-rw-r--r--ULibc.pas171
1 files changed, 105 insertions, 66 deletions
diff --git a/ULibc.pas b/ULibc.pas
index a01b573..63902f5 100644
--- a/ULibc.pas
+++ b/ULibc.pas
@@ -21,6 +21,9 @@ unit ULibc;
interface
+{$IFDEF FPC}
+ {$PACKRECORDS C}
+{$ENDIF}
const GLIBC_LIB = 'libc.so.6';
DL_LIB = 'libdl.so.2';
@@ -30,8 +33,24 @@ type
{$IFDEF KYLIX}
DWORD = Cardinal;
QWORD = Int64;
+ LongWord = LongInt;
+{$ENDIF}
+
+ cUShort = Word;
+ cInt = LongInt;
+ cuInt = LongWord;
+ cLongLong = Int64;
+ cuLongLong = QWord;
+ cuChar = Byte;
+{$IFDEF CPU64}
+ cLong = Int64;
+ cuLong = QWord;
+{$ELSE}
+ cLong = Longint;
+ cuLong = Cardinal;
{$ENDIF}
+
sig_atomic_t = Longint;
size_t = Cardinal;
ssize_t = Longint;
@@ -50,8 +69,8 @@ type
__blksize_t = Longint;
__blkcnt_t = Longint;
__blkcnt64_t = Int64;
-
-
+
+
Pidtype_t = ^idtype_t;
idtype_t = (P_ALL,P_PID,P_PGID);
@@ -89,7 +108,7 @@ type
end;
Pdirent64 = ^Tdirent64;
- Tdirent64 = record
+ Tdirent64 = packed record
d_ino : QWORD;
d_off : Int64;
d_reclen : word;
@@ -98,59 +117,88 @@ type
end;
Pstat64 = ^Tstat64;
- Tstat64 = packed record
-{$IFNDEF CPU64} // 32-bit platform
-{$IFNDEF CPUPOWERPC}
- st_dev : __dev_t;
- __pad1 : dword;
- __st_ino : __ino_t;
- st_mode : __mode_t;
- st_nlink : __nlink_t;
- st_uid : __uid_t;
- st_gid : __gid_t;
- st_rdev : __dev_t;
- __pad2 : dword;
- st_size : __off64_t;
- st_blksize : __blksize_t;
- st_blocks : __blkcnt64_t;
- st_atim : Ttimespec;
- st_mtim : Ttimespec;
- st_ctim : Ttimespec;
- st_ino : __ino64_t;
-{$ELSE} // 32-bit PPC
- st_dev : __dev_t;
- st_ino : __ino64_t;
- st_mode : __mode_t;
- st_nlink : __nlink_t;
- st_uid : __uid_t;
- st_gid : __gid_t;
- st_rdev : __dev_t;
- __pad2 : ShortInt;
- st_size : __off64_t;
- st_blksize : __blksize_t;
- st_blocks : __blkcnt64_t;
- st_atim : Ttimespec;
- st_mtim : Ttimespec;
- st_ctim : Ttimespec;
- __unused4 : DWORD;
- __unused5 : DWORD;
+ Tstat64 = record
+{$IFNDEF CPU64}
+{$IFNDEF CPUPOWERPC} // i386
+ st_dev: cuLongLong;
+ __pad0_: array[0..3] of cuChar;
+ __st_ino: cuLong;
+ st_mode: cuInt;
+ st_nlink: cuInt;
+ st_uid: cuLong;
+ st_gid: cuLong;
+ st_rdev: cuLongLong;
+ __pad3_: array[0..3] of cuChar;
+ st_size: cLongLong;
+ st_blksize: cuLong;
+ st_blocks: cuLongLong; //* Number 512-byte blocks allocated. */
+ st_atime: cuLong;
+ st_atime_nsec: cuLong;
+ st_mtime: cuLong;
+ st_mtime_nsec: cuInt;
+ st_ctime: cuLong;
+ st_ctime_nsec: cuLong;
+ st_ino: cuLongLong
+{$ELSE} // PPC32
+ st_dev : cULongLong;
+ st_ino : cULongLong;
+ st_mode : cUInt;
+ st_nlink : cUInt;
+ st_uid : cUInt;
+ st_gid : cUInt;
+ st_rdev : cULongLong;
+ __pad2 : cUShort;
+ st_size : cLongLong;
+ st_blksize : cInt;
+ st_blocks : cULongLong;
+ st_atime,
+ st_atime_nsec,
+ st_mtime,
+ st_mtime_nsec,
+ st_ctime,
+ st_ctime_nsec,
+ __unused4,
+ __unused5 : cULong;
+{$ENDIF}
+{$ELSE}
+{$IFNDEF CPUPOWERPC} // x86_64
+ st_dev: cuLong;
+ st_ino: cuLong;
+ st_nlink: cuLong;
+ st_mode: cuInt;
+ st_uid: cuInt;
+ st_gid: cuInt;
+ __pad1: cuInt;
+ st_rdev: cuLong;
+ st_size: cLong;
+ st_blksize: cLong;
+ st_blocks: cLong; //* Number 512-byte blocks allocated. */
+ st_atime: cuLong;
+ st_atime_nsec: cuLong;
+ st_mtime: cuLong;
+ st_mtime_nsec: cuLong;
+ st_ctime: cuLong;
+ st_ctime_nsec: cuLong;
+ __unused2: array[0..2] of cLong;
+{$ELSE} // PPC64
+ st_dev : cULong;
+ st_ino : cULong; { wrongly defined in RTL? }
+ st_nlink : cULong; { wrongly defined in RTL? }
+ st_mode : mode_t;
+ st_uid : uid_t;
+ st_gid : gid_t;
+ st_rdev : cULong;
+ st_size : off_t;
+ st_blksize : cULong;
+ st_blocks : cULong; { Number 512-byte blocks allocated. }
+ st_atime : cULong;
+ st_atime_nsec : cULong;
+ st_mtime : cULong;
+ st_mtime_nsec : cULong;
+ st_ctime : cULong;
+ st_ctime_nsec : cULong;
+ __unused : array[0..2] of cULong;
{$ENDIF}
-{$ELSE} // 64-bit platform
- st_dev : QWORD;
- st_ino : Int64;
- st_nlink : QWORD;
- st_mode : DWORD;
- st_uid : DWORD;
- st_gid : DWORD;
- pad0 : DWORD;
- st_rdev : QWORD;
- st_size : Int64;
- st_blksize : Int64;
- st_blocks : Int64;
- st_atim : Ttimespec;
- st_mtim : Ttimespec;
- st_ctim : Ttimespec;
- __unused : array[1..3] of QWORD;
{$ENDIF}
end;
@@ -194,28 +242,19 @@ type
Ptime_t = ^time_t;
Putimbuf = ^Tutimbuf;
- Tutimbuf = packed record
+ Tutimbuf = record
actime : time_t;
modtime : time_t;
end;
Pmntent = ^Tmntent;
- Tmntent = packed record
-{$IFNDEF CPU64} // 32-bit platform
+ Tmntent = record
mnt_fsname : PChar;
mnt_dir : PChar;
mnt_type : PChar;
mnt_opts : PChar;
mnt_freq : Longint;
mnt_passno : Longint;
-{$ELSE} // 64-bit platform
- mnt_fsname : PChar;
- mnt_dir : PChar;
- mnt_type : PChar;
- mnt_opts : PChar;
- mnt_freq : Longint;
- mnt_passno : Longint;
-{$ENDIF}
end;
PPasswd = ^TPasswd;