Re: pragma importing sem_init gives me a segmentation fault



laforge2001@xxxxxxxxx wrote:
Hi,

I'm an ADA noob so please be gentle :) Anyways, I am trying to use
POSIX semaphores by pragma importing sem_init, sem_post, sem_wait,
etc. and it seems everytime I hit sem_init, the program seg faults.
Has anyone ever tried doing this before with any success ?

These semaphores are in shared memory and I believe I'm allocating the
same space in memory as a sem_t type. We are actually trying to
convert from an SGI platform to a Linux based platform, so all the
previous semaphore calls were SGI specific and we were looking to move
to POSIX based semaphores. Does anyone have any ideas how to go about
this ?

Thanks,
Eric


POSIX.5 specifies a standard Ada binding to many of the services of POSIX.

IBM Ada Developer (formally Rational Apex) comes with a POSIX.5 interface.

There is a package available for GNAT called florist. You don't mention what compiler you are using but since you are coming from SGI it is probably a fairly safe bet that it is GNAT based.

In any case, florist does have an existing binding to sem_init so you can either look to it for guidance or actually consider using it.
.



Relevant Pages

  • Re: process safe communication
    ... SunOs 5.7 - POSIX semaphores and shared memory supported, ... >> queue no longer empty) and Mutexes. ...
    (comp.unix.programmer)
  • Re: Why is sem_wait() not undone when my program crashes?
    ... no. POSIX semaphores don't reset what you have done ... You might consider using SysV semaphores, ... If file locking is slower or faster I can't tell. ... file locks are actually faster. ...
    (comp.os.linux.development.apps)
  • Re: Semaphore tutorial?
    ... I've read the description in Stevens' ... > Unix Network Programming several times, ... > versions of message queues, semaphores, and shared memory, in addition to ... Given that the posix semaphores look a whole lot ...
    (comp.unix.programmer)
  • Re: Unnamed POSIX shared semaphores
    ... process-private semaphores should continue to have most of their stuff ... There was an inadvertent race in FreeBSD's POSIX semaphores which I fixed in HEAD and STABLE about 6 weeks before 7.2 was released. ... I believe process-shared POSIX semaphores now work -- the Python 'multiprocessing' regression test now runs to completion with no errors on both HEAD and STABLE. ... structs. ...
    (freebsd-stable)
  • Re: pragma importing sem_init gives me a segmentation fault
    ... POSIX semaphores by pragma importing sem_init, sem_post, sem_wait, ... previous semaphore calls were SGI specific and we were looking to move ... There is a package available for GNAT called florist. ...
    (comp.lang.ada)