+ 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,34 +59,65 @@ 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
st_ino : ino_t; // inode's number 0:
st_mode : mode_t; // inode protection mode (dev : dev_t; // inode's device
st_nlink : nlink_t; // number of hard links ino : ino_t; // inode's number
st_uid : uid_t; // user ID of the file's owner mode : mode_t; // inode protection mode
st_gid : gid_t; // group ID of the file's group nlink : nlink_t; // number of hard links
st_rdev : dev_t; // device type uid : uid_t; // user ID of the file's owner
st_atime : time_t; // time of last access gid : gid_t; // group ID of the file's group
st_atimensec : clong; // nsec of last access rdev : dev_t; // device type
st_mtime : time_t; // time of last data modification atime : time_t; // time of last access
st_mtimensec : clong; // nsec of last data modification atimensec : clong; // nsec of last access
st_ctime : time_t; // time of last file status change mtime : time_t; // time of last data modification
st_ctimensec : clong; // nsec of last file status change 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} {$ifdef netbsdPowerpc}
st_padd1 : cint; padd1 : cint;
{$endif} {$endif}
st_size : off_t; // file size, in bytes size : off_t; // file size, in bytes
st_blocks : cint64; // blocks allocated for file blocks : cint64; // blocks allocated for file
st_blksize : cuint32; // optimal blocksize for I/O blksize : cuint32; // optimal blocksize for I/O
st_flags : cuint32; // user defined flags for file flags : cuint32; // user defined flags for file
st_gen : cuint32; // file generation number gen : cuint32; // file generation number
{$ifdef netbsdPowerpc} {$ifdef netbsdPowerpc}
st_padd2 : cint; padd2 : cint;
{$endif} {$endif}
{$ifndef NetBSD} {$ifndef NetBSD}
st_lspare : cint32; lspare : cint32;
{$endif} {$endif}
st_qspare : array[0..1] Of cint64; qspare : array[0..1] Of cint64;);
1:
(st_dev : dev_t; // inode's device
st_ino : ino_t; // inode's number
st_mode : mode_t; // inode protection mode
st_nlink : nlink_t; // number of hard links
st_uid : uid_t; // user ID of the file's owner
st_gid : gid_t; // group ID of the file's group
st_rdev : dev_t; // device type
st_atime : time_t; // time of last access
st_atimensec : clong; // nsec of last access
st_mtime : time_t; // time of last data modification
st_mtimensec : clong; // nsec of last data modification
st_ctime : time_t; // time of last file status change
st_ctimensec : clong; // nsec of last file status change
{$ifdef netbsdPowerpc}
st_padd1 : cint;
{$endif}
st_size : off_t; // file size, in bytes
st_blocks : cint64; // blocks allocated for file
st_blksize : cuint32; // optimal blocksize for I/O
st_flags : cuint32; // user defined flags for file
st_gen : cuint32; // file generation number
{$ifdef netbsdPowerpc}
st_padd2 : cint;
{$endif}
{$ifndef NetBSD}
st_lspare : cint32;
{$endif}
st_qspare : array[0..1] Of cint64;);
end; end;
TStat = stat; TStat = stat;
pStat = ^stat; pStat = ^stat;

View File

@ -15,63 +15,120 @@
{$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} {$ifdef fs32bit}
st_ino : ino_t; ino : ino_t;
{$else} {$else}
__st_ino : ino_t; __ino : ino_t;
{$endif} {$endif}
st_mode : mode_t; mode : mode_t;
st_nlink : nlink_t; nlink : nlink_t;
st_uid : uid_t; uid : uid_t;
st_gid : gid_t; gid : gid_t;
st_rdev : dev_t; rdev : dev_t;
pad2 : word; pad2 : word;
st_size : off_t; size : off_t;
st_blksize : blksize_t; blksize : blksize_t;
{$ifdef fs32bit} {$ifdef fs32bit}
st_blocks : blkcnt_t; blocks : blkcnt_t;
{$else} {$else}
st_blocks : blkcnt64_t; blocks : blkcnt64_t;
{$endif} {$endif}
st_atime, atime,
st_atime_nsec, atime_nsec,
st_mtime, mtime,
st_mtime_nsec, mtime_nsec,
st_ctime, ctime,
st_ctime_nsec : culong; ctime_nsec : cardinal;
{$ifdef fs32bit} {$ifdef fs32bit}
unused4, unused5: culong; unused4, unused5: cardinal;
{$else} {$else}
st_ino : ino64_t; ino : ino64_t;
{$endif});
1:
// kernel <->libc
(st_dev : dev_t;
pad1_ : word;
{$ifdef fs32bit}
st_ino : ino_t;
{$else}
__st_ino : ino_t;
{$endif} {$endif}
st_mode : mode_t;
st_nlink : nlink_t;
st_uid : uid_t;
st_gid : gid_t;
st_rdev : dev_t;
pad2_ : word;
st_size : off_t;
st_blksize : blksize_t;
{$ifdef fs32bit}
st_blocks : blkcnt_t;
{$else}
st_blocks : blkcnt64_t;
{$endif}
st_atime,
st_atime_nsec,
st_mtime,
st_mtime_nsec,
st_ctime,
st_ctime_nsec : culong;
{$ifdef fs32bit}
unused4_, unused5_: culong;
{$else}
st_ino : ino64_t;
{$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,26 +26,49 @@
{$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
st_ino : culonglong; 0:
st_mode : cuint; (dev : culonglong;
st_nlink : cuint; ino : culonglong;
st_uid : cuint; mode : cuint;
st_gid : cuint; nlink : cuint;
st_rdev : culonglong; uid : cuint;
__pad2 : cushort; gid : cuint;
st_size : clonglong; rdev : culonglong;
st_blksize: clong; __pad2 : cushort;
size : clonglong;
blksize: clong;
st_blocks : clonglong; blocks : clonglong;
st_atime : clong; atime : clong;
st_atime_nsec : culong; atime_nsec : culong;
st_mtime : clong; mtime : clong;
st_mtime_nsec : culong; mtime_nsec : culong;
st_ctime : clong; ctime : clong;
__unused3 : culong; __unused3 : culong;
__unused4 : culong; __unused4 : culong;
__unused5 : culong; __unused5 : culong;);
1:
(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: clong;
st_blocks : clonglong;
st_atime : clong;
st_atime_nsec : culong;
st_mtime : clong;
st_mtime_nsec : culong;
st_ctime : clong;
__unused3_ : culong;
__unused4_ : 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,27 +40,51 @@ 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
st_pad1 : array[1..3] of longint; { reserve for dev expansion } 0:
st_ino : ino_t; (dev : dev_t;
st_mode : mode_t; pad1 : array[1..3] of longint; { reserve for dev expansion }
st_nlink : nlink_t; ino : ino_t;
st_uid : uid_t; mode : mode_t;
st_gid : gid_t; nlink : nlink_t;
st_rdev : dev_t; uid : uid_t;
st_pad2 : array[1..2] of longint; gid : gid_t;
st_size : off_t; rdev : dev_t;
st_pad3 : longint; {* reserve pad for future off_t expansion *} pad2 : array[1..2] of longint;
st_atime : time_t; size : off_t;
st_atimens : longint; { access time nanosecond field } pad3 : longint; {* reserve pad for future off_t expansion *}
st_mtime : time_t; atime : time_t;
st_mtimens : longint; { modification time nanosecond field } atimens : longint; { access time nanosecond field }
st_ctime : time_t; mtime : time_t;
st_ctimens : longint; { modification time nanosecond field } mtimens : longint; { modification time nanosecond field }
st_blksize : blksize_t; ctime : time_t;
st_blocks : blkcnt_t; ctimens : longint; { modification time nanosecond field }
st_fstype : array[0..ST_FSTYPSZ-1] of char; blksize : blksize_t;
st_pad4 : array[1..8] of longint; 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_ino : ino_t;
st_mode : mode_t;
st_nlink : nlink_t;
st_uid : uid_t;
st_gid : gid_t;
st_rdev : dev_t;
st_pad2 : array[1..2] of longint;
st_size : off_t;
st_pad3 : longint; {* reserve pad for future off_t expansion *}
st_atime : time_t;
st_atimens : longint; { access time nanosecond field }
st_mtime : time_t;
st_mtimens : longint; { modification time nanosecond field }
st_ctime : time_t;
st_ctimens : longint; { modification time nanosecond field }
st_blksize : blksize_t;
st_blocks : blkcnt_t;
st_fstype : array[0..ST_FSTYPSZ-1] of char;
st_pad4 : array[1..8] of longint);
end; end;
TStat = Stat; TStat = Stat;
PStat = ^Stat; PStat = ^Stat;