This commit is contained in:
Pavel 2023-03-22 16:59:06 +03:00
parent f850dff674
commit db4ccea408
4 changed files with 66 additions and 11 deletions

View File

@ -559,7 +559,7 @@ begin
Exit(SCE_KERNEL_ERROR_EINVAL);
end;
info^:=Default(t_get_authinfo);
info^:=Default(t_authinfo);
_set_errno(0);
Result:=0;

View File

@ -23,13 +23,16 @@ type
le_prev:PPointer;
end;
procedure TAILQ_INIT (head:Pointer); inline;
function TAILQ_EMPTY (head:Pointer):Boolean; inline;
function TAILQ_FIRST (head:Pointer):Pointer; inline;
function TAILQ_NEXT (elm,field:Pointer):Pointer; inline;
procedure TAILQ_INSERT_HEAD(head,elm,field:Pointer); inline;
procedure TAILQ_INSERT_TAIL(head,elm,field:Pointer); inline;
procedure TAILQ_REMOVE (head,elm,field:Pointer); inline;
procedure TAILQ_INIT (head:Pointer); inline;
function TAILQ_EMPTY (head:Pointer):Boolean; inline;
function TAILQ_FIRST (head:Pointer):Pointer; inline;
function TAILQ_NEXT (elm,field:Pointer):Pointer; inline;
function TAILQ_PREV (elm,headname,field:Pointer):Pointer; inline;
procedure TAILQ_INSERT_HEAD (head,elm,field:Pointer); inline;
procedure TAILQ_INSERT_TAIL (head,elm,field:Pointer); inline;
procedure TAILQ_INSERT_AFTER (head,listelm,elm,field:Pointer); inline;
procedure TAILQ_INSERT_BEFORE(listelm,elm,field:Pointer); inline;
procedure TAILQ_REMOVE (head,elm,field:Pointer); inline;
procedure LIST_INIT (head:Pointer); inline;
function LIST_EMPTY (head:Pointer):Boolean; inline;
@ -61,6 +64,11 @@ begin
Result:=P_TAILQ_ENTRY(field)^.tqe_next;
end;
function TAILQ_PREV(elm,headname,field:Pointer):Pointer; inline;
begin
Result:=P_TAILQ_HEAD(P_TAILQ_ENTRY(field)^.tqe_prev+ptruint(headname))^.tqh_last;
end;
procedure TAILQ_INSERT_HEAD(head,elm,field:Pointer); inline;
var
offset:ptruint;
@ -86,6 +94,34 @@ begin
P_TAILQ_HEAD(head)^.tqh_last:=@P_TAILQ_ENTRY(field)^.tqe_next;
end;
procedure TAILQ_INSERT_AFTER(head,listelm,elm,field:Pointer); inline;
var
offset:ptruint;
begin
offset:=ptruint(field-elm);
P_TAILQ_ENTRY(field)^.tqe_next:=P_TAILQ_ENTRY(listelm+offset)^.tqe_next;
if (P_TAILQ_ENTRY(field)^.tqe_next<>nil) then
begin
P_TAILQ_ENTRY(P_TAILQ_ENTRY(field)^.tqe_next+offset)^.tqe_prev:=@P_TAILQ_ENTRY(field)^.tqe_next;
end else
begin
P_TAILQ_HEAD(head)^.tqh_last:=@P_TAILQ_ENTRY(field)^.tqe_next;
end;
P_TAILQ_ENTRY(listelm+offset)^.tqe_next:=(elm);
P_TAILQ_ENTRY(field)^.tqe_prev:=@P_TAILQ_ENTRY(listelm+offset)^.tqe_next;
end;
procedure TAILQ_INSERT_BEFORE(listelm,elm,field:Pointer); inline;
var
offset:ptruint;
begin
offset:=ptruint(field-elm);
P_TAILQ_ENTRY(field)^.tqe_prev:=P_TAILQ_ENTRY(listelm+offset)^.tqe_prev;
P_TAILQ_ENTRY(field)^.tqe_next:=listelm;
P_TAILQ_ENTRY(listelm+offset)^.tqe_prev^:=elm;
P_TAILQ_ENTRY(listelm+offset)^.tqe_prev:=@P_TAILQ_ENTRY(field)^.tqe_next;
end;
procedure TAILQ_REMOVE(head,elm,field:Pointer); inline;
var
offset:ptruint;

View File

@ -90,6 +90,8 @@ const
ViewShare=1;
ViewUnmap=2;
SECTION_MAP_EXECUTE=$8;
type
PIO_STATUS_BLOCK=^IO_STATUS_BLOCK;
IO_STATUS_BLOCK=packed record

View File

@ -9,10 +9,13 @@ type
p_mtx=^mtx;
mtx=TRTLCriticalSection;
procedure mtx_init(var m:mtx);
procedure mtx_init (var m:mtx);
procedure mtx_destroy(var m:mtx);
procedure mtx_lock(var m:mtx);
procedure mtx_unlock(var m:mtx);
procedure mtx_lock (var m:mtx);
function mtx_trylock(var m:mtx):Boolean;
procedure mtx_unlock (var m:mtx);
function mtx_owned (var m:mtx):Boolean;
procedure mtx_assert (var m:mtx);
implementation
@ -31,11 +34,25 @@ begin
EnterCriticalSection(m);
end;
function mtx_trylock(var m:mtx):Boolean; inline;
begin
Result:=TryEnterCriticalSection(m)<>0;
end;
procedure mtx_unlock(var m:mtx); inline;
begin
LeaveCriticalSection(m);
end;
function mtx_owned(var m:mtx):Boolean; inline;
begin
Result:=m.OwningThread=GetCurrentThreadId;
end;
procedure mtx_assert(var m:mtx); inline;
begin
Assert(mtx_owned(m));
end;
end.