This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Fix argument passing in sysvipc/test-sysvsem
- From: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- To: Florian Weimer <fweimer at redhat dot com>, Tulio Magno Quites Machado Filho <tuliom at linux dot vnet dot ibm dot com>, libc-alpha at sourceware dot org
- Date: Mon, 2 Jan 2017 14:44:47 -0200
- Subject: Re: [PATCH] Fix argument passing in sysvipc/test-sysvsem
- Authentication-results: sourceware.org; auth=none
- References: <1482847286-29933-13-git-send-email-adhemerval.zanella@linaro.org> <1483130610-2500-1-git-send-email-tuliom@linux.vnet.ibm.com> <11a5f5d5-b6af-d22b-b93e-9d8750ef927f@redhat.com>
On 31/12/2016 07:07, Florian Weimer wrote:
> On 12/30/2016 09:43 PM, Tulio Magno Quites Machado Filho wrote:
>> +/* Confirm if sys/sem.h defines semun. */
>> +#ifdef _SEM_SEMUN_UNDEFINED
>> +union semun
>> +{
>> + int val;
>> + struct semid_ds *buf;
>> + unsigned short int *array;
>> + struct seminfo *__buf;
>> +};
>> +#endif
>
> Sorry, I don't understand the comment. Why is this definition not provided by the installed headers if IPC_STAT needs it?
It is not really necessary to check to semun definition since we are always
building the tests against a sem.h header that do not define it. I will
push this fix, it should follow the correct api contract and fix the
powerpc32 issue (make check at least passes on build and simulated
run):
diff --git a/sysvipc/test-sysvsem.c b/sysvipc/test-sysvsem.c
index 92396a6..279eca9 100644
--- a/sysvipc/test-sysvsem.c
+++ b/sysvipc/test-sysvsem.c
@@ -55,6 +55,13 @@ do_prepare (int argc, char *argv[])
#define SEM_MODE 0644
+union semun
+{
+ int val;
+ struct semid_ds *buf;
+ unsigned short *array;
+};
+
static int
do_test (void)
{
@@ -74,7 +81,7 @@ do_test (void)
/* Get semaphore kernel information and do some sanity checks. */
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);
if (seminfo.sem_perm.__key != key)