Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2016-04

Problem using ipc with OSX and fpc 3.0.0

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Tony Whyman

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;

{$endif}

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
MWA

Reply by email

Jonas Maebe
to Tony Whyman

Tony Whyman wrote on Wed, 20 Apr 2016:

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).

That's indeed a bug in FPC 3.0, where these constants were accidentally disabled for Darwin. They have been re-enabled in svn already, and this fix will be in FPC 3.0.2.

To work around this bug, you can copy the constants to your own source file for now.

Jonas

Reply by email