mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-06 18:08:08 +02:00
* fix IPC for FPC_USE_LIBS
* fix shmget to use size_t as per manpage * directly use external, don't depend on ipccdecl.inc (may be removed if confirmed) git-svn-id: trunk@7973 -
This commit is contained in:
parent
1fa4e17c87
commit
5baca0cfd3
@ -25,7 +25,7 @@ begin
|
||||
ftok:=key_t( byte(id) shl 24 + ((st.st_dev and 255) shl 16) + (st.st_ino and $ffff));
|
||||
end;
|
||||
|
||||
function shmget(key:key_t;size:cint;flag:cint):cint;
|
||||
function shmget(key:key_t;size:size_t;flag:cint):cint;
|
||||
begin
|
||||
{$ifdef NetBSD}
|
||||
shmget:=do_syscall(syscall_nr_shmget,3, key, size, flag);
|
||||
|
@ -46,7 +46,7 @@ begin
|
||||
// ipcerror:=fpgetErrno;
|
||||
end;
|
||||
|
||||
function shmget(key: Tkey; size:cint; flag:cint):cint;
|
||||
function shmget(key: Tkey; size:size_t; flag:cint):cint;
|
||||
begin
|
||||
shmget:=ipccall (CALL_SHMGET,key,size,flag,nil);
|
||||
end;
|
||||
|
@ -26,7 +26,7 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
function shmget(key: Tkey; size:cint; flag:cint):cint;
|
||||
function shmget(key: Tkey; size:size_t; flag:cint):cint;
|
||||
begin
|
||||
shmget:=do_syscall (syscall_nr_SHMGET,TSysParam(key),TSysParam(size),TSysParam(flag));
|
||||
end;
|
||||
|
@ -13,12 +13,7 @@
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
{$ifdef linux}
|
||||
{$ifdef FPC_USE_LIBC}
|
||||
{$fatal This unit must be completely overhauled for use with libc on linux}
|
||||
{$endif}
|
||||
{$endif linux}
|
||||
Unit ipc;
|
||||
unit ipc;
|
||||
|
||||
interface
|
||||
|
||||
@ -106,7 +101,7 @@ type
|
||||
{$endif}
|
||||
|
||||
{ Function to generate a IPC key. }
|
||||
Function ftok (Path : pchar; ID : cint) : TKey;
|
||||
Function ftok (Path : pchar; ID : cint) : TKey; {$ifdef FPC_USE_LIBC} cdecl; external name 'ftok'; {$endif}
|
||||
|
||||
{ ----------------------------------------------------------------------
|
||||
Sys V Shared memory stuff
|
||||
@ -203,10 +198,10 @@ type // the shm*info kind is "kernel" only.
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
Function shmget(key: Tkey; size:cint; flag:cint):cint;
|
||||
Function shmat (shmid:cint; shmaddr:pointer; shmflg:cint):pointer;
|
||||
Function shmdt (shmaddr:pointer):cint;
|
||||
Function shmctl(shmid:cint; cmd:cint; buf: pshmid_ds): cint;
|
||||
Function shmget(key: Tkey; size:size_t; flag:cint):cint; {$ifdef FPC_USE_LIBC} cdecl; external name 'shmget'; {$endif}
|
||||
Function shmat (shmid:cint; shmaddr:pointer; shmflg:cint):pointer; {$ifdef FPC_USE_LIBC} cdecl; external name 'shmat'; {$endif}
|
||||
Function shmdt (shmaddr:pointer):cint; {$ifdef FPC_USE_LIBC} cdecl; external name 'shmdt'; {$endif}
|
||||
Function shmctl(shmid:cint; cmd:cint; buf: pshmid_ds): cint; {$ifdef FPC_USE_LIBC} cdecl; external name 'shmctl'; {$endif}
|
||||
|
||||
{ ----------------------------------------------------------------------
|
||||
Message queue stuff
|
||||
@ -306,10 +301,10 @@ type
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
Function msgget(key: TKey; msgflg:cint):cint;
|
||||
Function msgsnd(msqid:cint; msgp: PMSGBuf; msgsz: size_t; msgflg:cint): cint;
|
||||
Function msgrcv(msqid:cint; msgp: PMSGBuf; msgsz: size_t; msgtyp:cint; msgflg:cint):cint;
|
||||
Function msgctl(msqid:cint; cmd: cint; buf: PMSQid_ds): cint;
|
||||
Function msgget(key: TKey; msgflg:cint):cint; {$ifdef FPC_USE_LIBC} cdecl; external name 'msgget'; {$endif}
|
||||
Function msgsnd(msqid:cint; msgp: PMSGBuf; msgsz: size_t; msgflg:cint): cint; {$ifdef FPC_USE_LIBC} cdecl; external name 'msgsnd'; {$endif}
|
||||
Function msgrcv(msqid:cint; msgp: PMSGBuf; msgsz: size_t; msgtyp:cint; msgflg:cint):cint; {$ifdef FPC_USE_LIBC} cdecl; external name 'msgrcv'; {$endif}
|
||||
Function msgctl(msqid:cint; cmd: cint; buf: PMSQid_ds): cint; {$ifdef FPC_USE_LIBC} cdecl; external name 'msgctl'; {$endif}
|
||||
|
||||
{ ----------------------------------------------------------------------
|
||||
Semaphores stuff
|
||||
@ -422,17 +417,15 @@ Type
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
Function semget(key:Tkey; nsems:cint; semflg:cint): cint;
|
||||
Function semop(semid:cint; sops: psembuf; nsops: cuint): cint;
|
||||
Function semctl(semid:cint; semnum:cint; cmd:cint; var arg: tsemun): longint;
|
||||
Function semget(key:Tkey; nsems:cint; semflg:cint): cint; {$ifdef FPC_USE_LIBC} cdecl; external name 'semget'; {$endif}
|
||||
Function semop(semid:cint; sops: psembuf; nsops: cuint): cint; {$ifdef FPC_USE_LIBC} cdecl; external name 'semop'; {$endif}
|
||||
Function semctl(semid:cint; semnum:cint; cmd:cint; var arg: tsemun): cint; {$ifdef FPC_USE_LIBC} cdecl; external name 'semctl'; {$endif}
|
||||
|
||||
implementation
|
||||
|
||||
uses Syscall;
|
||||
|
||||
{$ifdef FPC_USE_LIBC}
|
||||
{$i ipccdecl.inc}
|
||||
{$else}
|
||||
{$ifndef FPC_USE_LIBC}
|
||||
{$ifdef Linux}
|
||||
{$ifdef cpux86_64}
|
||||
{$i ipcsys.inc}
|
||||
|
@ -15,7 +15,7 @@
|
||||
**********************************************************************}
|
||||
|
||||
|
||||
function cshmget(key:key_t;size:cint;shmflg:cint):cint; cdecl; external;
|
||||
function cshmget(key:key_t;size:size_t;shmflg:cint):cint; cdecl; external;
|
||||
Function cshmat (shmid:cint; shmaddr:pointer; shmflg:cint):pointer; cdecl;external;
|
||||
Function cshmdt (shmaddr:pointer):cint; cdecl; external;
|
||||
Function cshmctl(shmid:cint; cmd:cint; buf: pshmid_ds): cint; cdecl; external;
|
||||
@ -37,7 +37,7 @@ begin
|
||||
ftok:=cftok(path,id);
|
||||
end;
|
||||
|
||||
function shmget(key:key_t;size:cint;flag:cint):cint;
|
||||
function shmget(key:key_t;size:size_t;flag:cint):cint;
|
||||
begin
|
||||
shmget:=cshmget(key, size, flag);
|
||||
end;
|
||||
@ -69,7 +69,7 @@ begin
|
||||
semop:=csemop(semid, sops, nsops);
|
||||
end;
|
||||
|
||||
Function semctl(semid:cint; semnum:cint; cmd:cint; var arg: tsemun): longint;
|
||||
Function semctl(semid:cint; semnum:cint; cmd:cint; var arg: tsemun): cint;
|
||||
begin
|
||||
semctl:=csemctl(semid, semnum, cmd, arg);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user