* FPC_USE_LIBC and uuidgen(2) support under IFDEF FREEBSD5.

git-svn-id: trunk@72 -
This commit is contained in:
marco 2005-05-22 14:24:55 +00:00
parent cc6d13cca4
commit 1efce6412b

View File

@ -15,6 +15,29 @@
**********************************************************************}
{$IFDEF FREEBSD5}
{$IFDEF FPC_USE_LIBC}
function cuuidgen(p:PGUID;x:cint):cint; external clib name 'uuidgen';
{$ELSE}
function cuuidgen(p:pguid;x:cint):cint;
begin
result:=do_syscall(syscall_nr_uuidgen,tsysparam(p),tsysparam(x));
end;
{$ENDIF}
Function SysCreateGUID(out GUID : TGUID) : Integer;
begin
result:=0;
if cuuidgen(@guid,1)=-1 then
GetRandomBytes(GUID,SizeOf(Guid));
end;
{$ELSE}
Const
RandomDevice = '/dev/urandom';
@ -54,3 +77,4 @@ begin
GetRandomBytes(GUID,SizeOf(Guid));
Result:=0;
end;
{$ENDIF}