[fpc-pascal] Problem using ipc with OSX and fpc 3.0.0

Tony Whyman tony.whyman at mccallumwhyman.com
Wed Apr 20 10:15:40 CEST 2016

I have a problem with some existing code that compiled with fpc 2.6.4 
under OSX and does not compile with fpc 3.0.0.

The problem is that the code makes a direct call to the semctl function 
(defined in ipc.pp) and uses the SEM_GETVAL constant as the command 
value. "Identifier not found errors" are returned for SEM_GETVAL (and 
SEM_SETVAL as well).

Checking the ipc.pp source, both SEM_GETVAL and SEM_SETVAL are defined 
for Linux, but when it comes to alternative flavours of unix you now see:

{$if not defined(aix) and not defined(darwin)}
   SEM_GETNCNT = 3;   { Return the value of sempid (READ)  }
   SEM_GETPID  = 4;   { Return the value of semval (READ)  }
   SEM_GETVAL  = 5;   { Return semvals into arg.array (READ)  }
   SEM_GETALL  = 6;   { Return the value of semzcnt (READ)  }
   SEM_GETZCNT = 7;   { Set the value of semval to arg.val (ALTER)  }
   SEM_SETVAL  = 8;   { Set semvals from arg.array (ALTER)  }
   SEM_SETALL  = 9;

That is these identifiers appear to have been removed for OSX and with 
no alternative given. This was not the case with 2.6.4.

Does anyone know why this was done and, if so, how calls to semctl 
should have their command value given under OSX (preferably in a 
platform independent manner).

Tony Whyman

More information about the fpc-pascal mailing list