Technical article 109613

Using semctl(2) in a UODK compiled binary on SCO OpenServer 5.0.4 causes a core dump.

OpenServer 5.0.4OpenServer 5.0.5OpenServer 5.0.6

Written · Last revised

Problem

If I use semctl(2) in a program compiled using the C compiler
included with the UnixWare/OpenServer Development Kit (UDK) 7.0.0,
it will dump core.  For example:
#include <stdio.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
main ()
{
        int             id, key, nbEntry, ret;
        struct semid_ds ds;

union semun { int val; struct semid_ds *buf; ushort *array; } arg ;

key = 4000; nbEntry = 6 ; arg.buf = &ds ;

id = semget(key, nbEntry, IPC_CREAT | 0666);

ret = semctl(id, 0, IPC_STAT, arg.buf) ;

        printf("semctl returns (%d)\n", ret);
}

If the above code is compiled with /udk/usr/ccs/bin/cc, and then run, it should print:

semctl returns (0)
Instead, it fails with:
Memory fault(coredump)

Solution

This problem has been in fixed in OSS495b.

This is availble for download from:
https://ftp.scoexpert.com/SLS

See also

TA109827 "What problems are addressed by OSS495B, the OSRcompat Patch,and how is it installed?".

The manual pages for semctl(2) and semget(2).

From the Xinuos technical article database, record 109613. Reproduced with permission. The original is at www.sco.com/ta/109613, which is reachable but blocked from search engines. Xinuos marks this article against a retired product line. That refers to the product’s lifecycle, not to whether the advice still works — plenty of it still applies to running systems.

Next step

Need this fixed rather than explained?

Tell us the release, what the system runs and what it is doing. We will reply by email with what we would do next.

  • You deal with the people who do the work
  • No obligation, and no upgrade required before we will help
  • We tell you plainly if something is not worth doing

Send an enquiry

We reply by email. If a server is down, say so in the first line. You can also write to help@scoexpert.com.