|
Message-ID: <alpine.LNX.2.02.1209221409130.12327@laas.mine.nu> Date: Sat, 22 Sep 2012 14:14:48 +0200 (CEST) From: Jens <jensl@...s.mine.nu> To: musl@...ts.openwall.com Subject: Re: semtcl for x86_64 This is dependent on kernel config option ARCH_WANT_IPC_PARSE_VERSION. Looks like it is not set for x86_64. select ARCH_WANT_IPC_PARSE_VERSION if X86_32 Looking at the code: #ifndef CONFIG_ARCH_WANT_IPC_PARSE_VERSION /* On IA-64, we always use the "64-bit version" of the IPC structures. */ # define ipc_parse_version(cmd) IPC_64 #else int ipc_parse_version (int *cmd); #endif SYSCALL_DEFINE(semctl)(int semid, int semnum, int cmd, union semun arg) { int err = -EINVAL; int version; struct ipc_namespace *ns; if (semid < 0) return -EINVAL; version = ipc_parse_version(&cmd); ... switch(cmd) { ... case SETVAL: case SETALL: err = semctl_main(ns,semid,semnum,cmd,version,arg); return err; ... default: return -EINVAL; } } So IPC_64 will not be cleared from cmd since parse_version do not remove the bit since its only a macro that returns IPC_64. Hence EINVAL. Regards, Jens On Sat, 22 Sep 2012, Jens wrote: > > Hello I have some trouble getting semctl working: > > Tried in both musl and uclibc to compare. > See below. > > The only difference I can see is the IPC_64 flag. > > (I haven't tried 32-bit). > > Regards, > Jens > > program: > bash-4.1# cat t.c > #include <sys/types.h> > #include <sys/ipc.h> > #include <sys/sem.h> > > main() { > int sem; > // semget(IPC_PRIVATE, 1, IPC_CREAT|0600) = 131076 > sem = semget(IPC_PRIVATE, 1, IPC_CREAT); > semctl(sem, 0, SETVAL, 0x1); > > } > > musl: > > bash-4.1# /bin64/strace ./m > execve("./m", ["./m"], [/* 19 vars */]) = 0 > semget(IPC_PRIVATE, 1, IPC_CREAT|0) = 327688 > semctl(327688, 0, IPC_64|SETVAL, 0x1) = -1 EINVAL (Invalid argument) > exit_group(-1) = ? > bash-4.1# > > > uclibc: > > semget(IPC_PRIVATE, 1, IPC_CREAT|0) = 262150 > semctl(262150, 0, SETVAL, 0x1) = 0 > _exit(0) = ? > bash-4.1# >
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.