mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 10:39:39 +02:00
Add code to test Linux version, try statx syscall only if version is >= to 4.11
git-svn-id: trunk@47850 -
This commit is contained in:
parent
6190258f5d
commit
8b34e11da3
@ -3,11 +3,52 @@ uses
|
|||||||
ctypes,baseunix,linux;
|
ctypes,baseunix,linux;
|
||||||
|
|
||||||
var
|
var
|
||||||
|
un : utsname;
|
||||||
mystatx : statx;
|
mystatx : statx;
|
||||||
res : cint;
|
res : cint;
|
||||||
f : text;
|
f : text;
|
||||||
|
st,major,minor : string;
|
||||||
|
i,p,e : longint;
|
||||||
|
err : word;
|
||||||
|
major_release, minor_release : longint;
|
||||||
begin
|
begin
|
||||||
|
fpuname(un);
|
||||||
|
st:=un.release;
|
||||||
|
for i:=1 to UTSNAME_LENGTH do
|
||||||
|
if st[i]='.' then
|
||||||
|
begin
|
||||||
|
p:=i;
|
||||||
|
major:=system.copy(st,1,p-1);
|
||||||
|
system.val(major,major_release,err);
|
||||||
|
if err<>0 then
|
||||||
|
begin
|
||||||
|
writeln('Unable to parse first part of linux version ',st,'(',major,') correctly');
|
||||||
|
halt(2);
|
||||||
|
end;
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
|
||||||
|
for i:=p+1 to UTSNAME_LENGTH do
|
||||||
|
if st[i]='.' then
|
||||||
|
begin
|
||||||
|
e:=i;
|
||||||
|
minor:=system.copy(st,p+1,e-p-1);
|
||||||
|
system.val(minor,minor_release,err);
|
||||||
|
if err<>0 then
|
||||||
|
begin
|
||||||
|
writeln('Unable to second part of parse linux version ',st,'i(',minor,') correctly');
|
||||||
|
halt(2);
|
||||||
|
end;
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
if (major_release<4) or (minor_release<11) then
|
||||||
|
begin
|
||||||
|
writeln('This version of Linux: ',st,' does not have fstatx syscall');
|
||||||
|
halt(0);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
writeln('This linux version ',st,' should support statx syscall');
|
||||||
|
|
||||||
assign(f,'test.txt');
|
assign(f,'test.txt');
|
||||||
rewrite(f);
|
rewrite(f);
|
||||||
write(f,'ccccc');
|
write(f,'ccccc');
|
||||||
|
Loading…
Reference in New Issue
Block a user