mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-28 20:40:37 +02:00
* FPC_USE_LIBC and uuidgen(2) support under IFDEF FREEBSD5.
git-svn-id: trunk@72 -
This commit is contained in:
parent
cc6d13cca4
commit
1efce6412b
@ -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
|
Const
|
||||||
RandomDevice = '/dev/urandom';
|
RandomDevice = '/dev/urandom';
|
||||||
@ -54,3 +77,4 @@ begin
|
|||||||
GetRandomBytes(GUID,SizeOf(Guid));
|
GetRandomBytes(GUID,SizeOf(Guid));
|
||||||
Result:=0;
|
Result:=0;
|
||||||
end;
|
end;
|
||||||
|
{$ENDIF}
|
Loading…
Reference in New Issue
Block a user