From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,283a7b1811f3f2ad X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Sat, 24 Feb 2007 18:01:58 -0600 Date: Sat, 24 Feb 2007 19:01:01 -0500 From: Jeffrey Creem User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: pragma importing sem_init gives me a segmentation fault References: <1172350370.771564.253920@q2g2000cwa.googlegroups.com> In-Reply-To: <1172350370.771564.253920@q2g2000cwa.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 24.147.74.171 X-Trace: sv3-CCOG8C70OKTAqEX4xwW/PJhpCPBHvCg82ffbre2n17I80aDtQ6F4DwhO3dfNKQ0VvCdb5SB2a1rLE2k!Z6qGmyh0q9xUV0ro1Ms3/61I9YdNGBgNYiJo+YSV06aTpBFI/mvUrOYRd2eJYRQUWF5VvfpDKGJ1!jO4= X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news2.google.com comp.lang.ada:9508 Date: 2007-02-24T19:01:01-05:00 List-Id: laforge2001@gmail.com 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.