Fix test-sysvsem on some platforms
The command IPC_STAT of semctl expects an union semun in its fourth argument instead of struct semid_ds *. This can cause failures on powerpc32-linux-gnu. Checked on x86_64-linux-gnu, i686-linux-gnu, and powerpc32-linux-gnu (qemu system emulation).
This commit is contained in:
parent
e082ac7533
commit
cbce12d22b
|
@ -1,3 +1,8 @@
|
||||||
|
2017-01-02 Adhemerval Zanella <adhemerval.zanella@linaro.org>
|
||||||
|
|
||||||
|
* sysvipc/test-sysvsem.c (do_test): Define and use union semun on
|
||||||
|
semctl.
|
||||||
|
|
||||||
2017-01-02 Joseph Myers <joseph@codesourcery.com>
|
2017-01-02 Joseph Myers <joseph@codesourcery.com>
|
||||||
|
|
||||||
* math/test-nearbyint-except.c: Include <stdbool.h>.
|
* math/test-nearbyint-except.c: Include <stdbool.h>.
|
||||||
|
|
|
@ -55,6 +55,13 @@ do_prepare (int argc, char *argv[])
|
||||||
|
|
||||||
#define SEM_MODE 0644
|
#define SEM_MODE 0644
|
||||||
|
|
||||||
|
union semun
|
||||||
|
{
|
||||||
|
int val;
|
||||||
|
struct semid_ds *buf;
|
||||||
|
unsigned short *array;
|
||||||
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
do_test (void)
|
do_test (void)
|
||||||
{
|
{
|
||||||
|
@ -74,7 +81,7 @@ do_test (void)
|
||||||
|
|
||||||
/* Get semaphore kernel information and do some sanity checks. */
|
/* Get semaphore kernel information and do some sanity checks. */
|
||||||
struct semid_ds seminfo;
|
struct semid_ds seminfo;
|
||||||
if (semctl (semid, 0, IPC_STAT, &seminfo) == -1)
|
if (semctl (semid, 0, IPC_STAT, (union semun) { .buf = &seminfo }) == -1)
|
||||||
FAIL_EXIT1 ("semctl with IPC_STAT failed (errno=%d)", errno);
|
FAIL_EXIT1 ("semctl with IPC_STAT failed (errno=%d)", errno);
|
||||||
|
|
||||||
if (seminfo.sem_perm.__key != key)
|
if (seminfo.sem_perm.__key != key)
|
||||||
|
|
Loading…
Reference in a new issue