UNIX Free Pascal


         


uses linux;

Function FStat(Path:Pathstr;Var Info:tstat):Boolean;

Function FStat(Fd:longint;Var Info:tstat):Boolean;

Function FStat(var F:Text;Var Info:tstat):Boolean;

Function FStat(var F:File;Var Info:tstat):Boolean;

Function LStat(Path:Pathstr; Var Info:tstat):Boolean;

fstat : path, , . info tstat (stat). . .

.

.

.

var

s:tstat;

filedes:integer;

retval:boolean;

filedes := fdopen('/tmp/dina', Open_RDWR);

(* s ... *)

retval := fstat('/tmp/dina', s);

/* ... */

retval := fstat(filedes, @s);

tstat linux :

stat=record

dev : word;

pad1 : word;

ino : longint;

mode : word;

nlink : word;

uid : word;

gid : word;

rdev : word;

pad2 : word;

size : longint;

blksze : Longint;

blocks : Longint;

atime : Longint;

unused1 : longint;

mtime : Longint;

unused2 : longint;

ctime : Longint;

unused3 : longint;

unused4 : longint;

unused5 : longint;

end;

lstat . :

uses linux;

var f : text;

i : byte;

info : stat;

begin

{ Make a file }

assign (f,'test.fil');

rewrite (f);

for i:=1 to 10 do writeln (f,'Testline # ',i);

close (f);

{ Do the call on made file. }

if not fstat ('test.fil',info) then

begin

writeln('Fstat failed. Errno : ',linuxerror);

halt (1);

end;

writeln;

writeln ('Result of fstat on file ''test.fil''.');

writeln ('Inode : ',info.ino);