PostgreSQL IpcSemaphoreCreate problem on IRIX 6.x - Mailing list pgsql-ports

From Matthew Plec
Subject PostgreSQL IpcSemaphoreCreate problem on IRIX 6.x
Date
Msg-id 19990607115939.018664@mail.cinenet.net
Whole thread Raw
List pgsql-ports
  I have successfully compiled and installed PostgresSQL 6.4.2 on Irix
6.5.2 using gcc 2.8.1 (from the SGI freeware binaries distribution).  My
system is O2/R5000 and uname -aR returns "IRIX easy 6.5 6.5.2f 11051214
IP32".
  As several others have posted as well, I get the IpcSemaphoreCreate
problem when attempting to createdb.  After chasing around in the code a
bit, the problem seems to be with the semun.array pointer passed to
semctl in ipc.c:IpcSemaphoreCreate().  The error returned seems to
indicate that the array address passed is bad, which it clearly isn't,
at least in the ipc.c code.  So, I can't see anything wrong with the
code!  In fact, it very closely follows SGI's own examples:
(at
https://toolbox.sgi.com/toolbox/documents/irix6.5/TIP/IRIX_Prog_32.html#M
ARKER-9-237)

which you need to sign on to their developer program (free) to access.
It is also available in the insight docs online (search for semctl).
Compiling this example code with gcc and running with the semId that ipc.c
is using also results in the same error.
  I am beginning to suspect it's a compilation issue.  Perhaps something
is not ending up on the right boundaries?  I came across the following:

----------
Caution: Some operations of the semctl() function use only three
argments, but some operations require a fourth argument (see reference
page semctl(2) for details). When passing a fourth argument to semctl(),
it is extremely important that you pass a union semun, as specified in
the reference page. You might look at the contents of the union and
think that, since all its fields are addresses, there is no effective
difference between passing a union and passing a plain address of a
buffer or array. However, if your program is compiled with the -n32 or
-64 options, the alignment of the two kinds of arguments is different.
Always pass an address as shown in the example programs in this chapter:

union semun arg4;
...
arg4.buffer = &ds_buffer;
semctl(a,b,c,arg4);

If your program passes only the address, as in

semctl(a,b,c,&ds_buffer);

the code will not work correctly when compiled -n32 or -64

----------
(at https://toolbox.sgi.com/toolbox/documents/irix6.5/TIP/IRIX_Prog_32.html)

  Although the ipc.c code doesn't do this, it seems that either a
similar problem is occuring, or there is a problem with the semctl()
function itself, because (as far as I can tell!) all the arguments
passed it are ok.  I don't have SGI's C compiler to see if the code
works compiled with it and, unfortunately, I don't know my way around
gcc well enough to know what options to select to fiddle with this sort
of problem.  Does anyone with knowledge of Irix/gcc have any
suggestions?  I have seen two or three other people post about this
problem and never any response.  Is there anybody at all out there with
PostgreSQL working on Irix 6.x?  Or even anyone with some knowledge of
Irix 6.x/gcc or PostgreSQL on previous Irix versions that could offer
some suggestions as to what to try?  I'll be happy to try whatever suggestions
I receive and report back a summary of the results (and hopefully a fix).
  Thanks very much for any help.

  ...Matt Plec.


pgsql-ports by date:

Previous
From: Matthew Plec
Date:
Subject: PostgreSQL IpcSemaphoreCreate problem on IRIX 6.x
Next
From: "Mehul J. Bhatt"
Date:
Subject: Postgres installation troubles