+ Restore "stat" data structure in backward compatible state

git-svn-id: trunk@6963 -
This commit is contained in:
daniel 2007-03-23 22:23:24 +00:00
parent 59a972ec9c
commit d030103742
6 changed files with 320 additions and 142 deletions

View File

@ -59,7 +59,38 @@ TYPE
{ file characteristics services } { file characteristics services }
stat = record { the types are real} stat = record { the types are real}
st_dev : dev_t; // inode's device case byte of
0:
(dev : dev_t; // inode's device
ino : ino_t; // inode's number
mode : mode_t; // inode protection mode
nlink : nlink_t; // number of hard links
uid : uid_t; // user ID of the file's owner
gid : gid_t; // group ID of the file's group
rdev : dev_t; // device type
atime : time_t; // time of last access
atimensec : clong; // nsec of last access
mtime : time_t; // time of last data modification
mtimensec : clong; // nsec of last data modification
ctime : time_t; // time of last file status change
ctimensec : clong; // nsec of last file status change
{$ifdef netbsdPowerpc}
padd1 : cint;
{$endif}
size : off_t; // file size, in bytes
blocks : cint64; // blocks allocated for file
blksize : cuint32; // optimal blocksize for I/O
flags : cuint32; // user defined flags for file
gen : cuint32; // file generation number
{$ifdef netbsdPowerpc}
padd2 : cint;
{$endif}
{$ifndef NetBSD}
lspare : cint32;
{$endif}
qspare : array[0..1] Of cint64;);
1:
(st_dev : dev_t; // inode's device
st_ino : ino_t; // inode's number st_ino : ino_t; // inode's number
st_mode : mode_t; // inode protection mode st_mode : mode_t; // inode protection mode
st_nlink : nlink_t; // number of hard links st_nlink : nlink_t; // number of hard links
@ -86,7 +117,7 @@ TYPE
{$ifndef NetBSD} {$ifndef NetBSD}
st_lspare : cint32; st_lspare : cint32;
{$endif} {$endif}
st_qspare : array[0..1] Of cint64; st_qspare : array[0..1] Of cint64;);
end; end;
TStat = stat; TStat = stat;
pStat = ^stat; pStat = ^stat;

View File

@ -15,34 +15,91 @@
{$ifndef FPC_USE_LIBC} // kernel record {$ifndef FPC_USE_LIBC} // kernel record
Stat = packed record // No unix typing because of differences Stat = packed record // No unix typing because of differences
st_dev : culonglong; case byte of
__pad0 : array[0..3] of cuchar; 0:
__st_ino : culong; (dev : qword;
st_mode : cuint; __pad0 : array[0..3] of byte;
st_nlink : cuint; __ino,
st_uid : culong; mode,
st_gid : culong; nlink,
st_rdev : culonglong; uid,
__pad3 : array[0..3] of cuchar; gid : cardinal;
st_size : culonglong; rdev : qword;
st_blksize: culong; __pad3 : array[0..3] of byte;
st_blocks : culonglong; size : qword;
st_atime : culong; blksize : cardinal;
st_atime_nsec : culong; blocks : qword;
st_mtime : culong; atime,
st_mtime_nsec : cuint; atime_nsec,
st_ctime : culong; mtime,
st_ctime_nsec : culong; mtime_nsec,
st_ino : culonglong; ctime,
ctime_nsec : cardinal;
ino : qword);
1:
(st_dev : qword;
__pad0_ : array[0..3] of byte;
__st_ino_,
st_mode,
st_nlink,
st_uid,
st_gid : cardinal;
st_rdev : qword;
__pad3_ : array[0..3] of byte;
st_size : qword;
st_blksize: cardinal;
st_blocks : qword;
st_atime,
st_atime_nsec,
st_mtime,
st_mtime_nsec,
st_ctime,
st_ctime_nsec : cardinal;
st_ino : qword);
end; end;
{$else} {$else}
{$packrecords C} {$packrecords C}
Stat = Record // No unix typing because of differences Stat = Record
case byte of
0:
// kernel <->libc // kernel <->libc
st_dev : dev_t; (dev : dev_t;
pad1 : word; pad1 : word;
{$ifdef fs32bit}
ino : ino_t;
{$else}
__ino : ino_t;
{$endif}
mode : mode_t;
nlink : nlink_t;
uid : uid_t;
gid : gid_t;
rdev : dev_t;
pad2 : word;
size : off_t;
blksize : blksize_t;
{$ifdef fs32bit}
blocks : blkcnt_t;
{$else}
blocks : blkcnt64_t;
{$endif}
atime,
atime_nsec,
mtime,
mtime_nsec,
ctime,
ctime_nsec : cardinal;
{$ifdef fs32bit}
unused4, unused5: cardinal;
{$else}
ino : ino64_t;
{$endif});
1:
// kernel <->libc
(st_dev : dev_t;
pad1_ : word;
{$ifdef fs32bit} {$ifdef fs32bit}
st_ino : ino_t; st_ino : ino_t;
{$else} {$else}
@ -53,7 +110,7 @@
st_uid : uid_t; st_uid : uid_t;
st_gid : gid_t; st_gid : gid_t;
st_rdev : dev_t; st_rdev : dev_t;
pad2 : word; pad2_ : word;
st_size : off_t; st_size : off_t;
st_blksize : blksize_t; st_blksize : blksize_t;
{$ifdef fs32bit} {$ifdef fs32bit}
@ -68,10 +125,10 @@
st_ctime, st_ctime,
st_ctime_nsec : culong; st_ctime_nsec : culong;
{$ifdef fs32bit} {$ifdef fs32bit}
unused4, unused5: culong; unused4_, unused5_: culong;
{$else} {$else}
st_ino : ino64_t; st_ino : ino64_t;
{$endif} {$endif});
end; end;

View File

@ -13,24 +13,45 @@
**********************************************************************} **********************************************************************}
Stat = packed record // No unix typing because of differences Stat = packed record // No unix typing because of differences
st_dev : culonglong; case byte of
__pad0 : array[0..1] of cuchar; 0:
__st_ino : culong; (dev : qword;
st_mode : cuint; __pad0 : array[0..3] of byte;
st_nlink : cuint; __ino,
st_uid : culong; mode,
st_gid : culong; nlink,
st_rdev : culonglong; uid,
__pad3 : array[0..1] of cuchar; gid : cardinal;
st_size : clonglong; rdev : qword;
st_blksize: culong; __pad3 : array[0..3] of byte;
st_blocks : culonglong; size : qword;
st_atime : culong; blksize : cardinal;
st_atime_nsec : culong; blocks : qword;
st_mtime : culong; atime,
st_mtime_nsec : culong; atime_nsec,
st_ctime : culong; mtime,
st_ctime_nsec : culong; mtime_nsec,
st_ino : culonglong; ctime,
ctime_nsec : cardinal;
ino : qword);
1:
(st_dev : qword;
__pad0_ : array[0..3] of byte;
__st_ino_,
st_mode,
st_nlink,
st_uid,
st_gid : cardinal;
st_rdev : qword;
__pad3_ : array[0..3] of byte;
st_size : qword;
st_blksize: cardinal;
st_blocks : qword;
st_atime,
st_atime_nsec,
st_mtime,
st_mtime_nsec,
st_ctime,
st_ctime_nsec : cardinal;
st_ino : qword);
end; end;

View File

@ -26,14 +26,37 @@
{$IFNDEF FPC_USE_LIBC} {$IFNDEF FPC_USE_LIBC}
Stat = record // No unix typing because of differences Stat = record // No unix typing because of differences
st_dev : culonglong; case byte of
0:
(dev : culonglong;
ino : culonglong;
mode : cuint;
nlink : cuint;
uid : cuint;
gid : cuint;
rdev : culonglong;
__pad2 : cushort;
size : clonglong;
blksize: clong;
blocks : clonglong;
atime : clong;
atime_nsec : culong;
mtime : clong;
mtime_nsec : culong;
ctime : clong;
__unused3 : culong;
__unused4 : culong;
__unused5 : culong;);
1:
(st_dev : culonglong;
st_ino : culonglong; st_ino : culonglong;
st_mode : cuint; st_mode : cuint;
st_nlink : cuint; st_nlink : cuint;
st_uid : cuint; st_uid : cuint;
st_gid : cuint; st_gid : cuint;
st_rdev : culonglong; st_rdev : culonglong;
__pad2 : cushort; __pad2_ : cushort;
st_size : clonglong; st_size : clonglong;
st_blksize: clong; st_blksize: clong;
@ -43,9 +66,9 @@
st_mtime : clong; st_mtime : clong;
st_mtime_nsec : culong; st_mtime_nsec : culong;
st_ctime : clong; st_ctime : clong;
__unused3 : culong; __unused3_ : culong;
__unused4 : culong; __unused4_ : culong;
__unused5 : culong; __unused5_ : culong;);
end; end;
{$ELSE FPC_USE_LIBC} {$ELSE FPC_USE_LIBC}

View File

@ -15,27 +15,49 @@
{$ifndef FPC_USE_LIBC} // kernel record {$ifndef FPC_USE_LIBC} // kernel record
stat = packed record // No unix typing because of differences stat = packed record // No unix typing because of differences
st_dev : culong; case byte of
st_ino : culong; 0:
st_nlink : culong; (dev,
ino,
nlink : qword;
st_mode : cuint; mode,
st_uid : cuint; uid,
st_gid : cuint; gid,
__pad0 : cuint; __pad0 : cardinal;
st_rdev : culong; rdev : qword;
st_size : clong; size,
st_blksize: clong; blksize,
st_blocks : clong; blocks : int64;
st_atime : culong; atime,
st_atime_nsec : culong; atime_nsec,
st_mtime : culong; mtime,
st_mtime_nsec : culong; mtime_nsec,
st_ctime : culong; ctime,
st_ctime_nsec : culong; ctime_nsec : qword
__unused : array[0..2] of qword);
1:
(st_dev,
st_ino,
st_nlink : qword;
__unused : array[0..2] of clong; st_mode,
st_uid,
st_gid,
__pad0 : cardinal;
st_rdev : qword;
st_size,
st_blksize,
st_blocks : int64;
st_atime,
st_atime_nsec,
st_mtime,
st_mtime_nsec,
st_ctime,
st_ctime_nsec : qword;
__unused : array[0..2] of qword;);
end; end;
{$else} {$else}

View File

@ -40,7 +40,31 @@ TYPE
{ file characteristics services } { file characteristics services }
stat = packed record { verify the alignment of the members } stat = packed record { verify the alignment of the members }
st_dev : dev_t; case byte of
0:
(dev : dev_t;
pad1 : array[1..3] of longint; { reserve for dev expansion }
ino : ino_t;
mode : mode_t;
nlink : nlink_t;
uid : uid_t;
gid : gid_t;
rdev : dev_t;
pad2 : array[1..2] of longint;
size : off_t;
pad3 : longint; {* reserve pad for future off_t expansion *}
atime : time_t;
atimens : longint; { access time nanosecond field }
mtime : time_t;
mtimens : longint; { modification time nanosecond field }
ctime : time_t;
ctimens : longint; { modification time nanosecond field }
blksize : blksize_t;
blocks : blkcnt_t;
fstype : array[0..ST_FSTYPSZ-1] of char;
pad4 : array[1..8] of longint);
1:
(st_dev : dev_t;
st_pad1 : array[1..3] of longint; { reserve for dev expansion } st_pad1 : array[1..3] of longint; { reserve for dev expansion }
st_ino : ino_t; st_ino : ino_t;
st_mode : mode_t; st_mode : mode_t;
@ -60,7 +84,7 @@ TYPE
st_blksize : blksize_t; st_blksize : blksize_t;
st_blocks : blkcnt_t; st_blocks : blkcnt_t;
st_fstype : array[0..ST_FSTYPSZ-1] of char; st_fstype : array[0..ST_FSTYPSZ-1] of char;
st_pad4 : array[1..8] of longint; st_pad4 : array[1..8] of longint);
end; end;
TStat = Stat; TStat = Stat;
PStat = ^Stat; PStat = ^Stat;