Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-ID: <3C032753.2000708@ece.gatech.edu> Date: Tue, 27 Nov 2001 00:40:35 -0500 From: Charles Wilson User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.4) Gecko/20011019 Netscape6/6.2 X-Accept-Language: en-us MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: [ANN][RFC] cygipc-1.11 at cygutils Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit I've updated cygipc to version 1.11. You can download it from: http://www.neuro.gatech.edu/users/cwilson/cygutils/index.html The main changes here are: 1) remove definition of 'union semun' from sem.h 2) changed signature of semctl(): OLD int semctl(int, int, int, union semun) NEW int semctl(int, int, int, ...) These changes are according to the SUSv2 spec: http://www.opengroup.org/onlinepubs/007908799/xsh/semctl.html And were necessary to address these concerns: http://cygwin.com/ml/cygwin/2001-10/msg00955.html http://cygwin.com/ml/cygwin/2001-10/msg00961.html http://cygwin.com/ml/cygwin/2001-11/msg01586.html http://cygwin.com/ml/cygwin/2001-11/msg01589.html However, Linux *DOESN'T* do it that way. Linux DOES define 'union semun' in sem.h. Linux REQUIRES all four arguments to semctl. So, did I do the right thing? Should I try to match SUSv2 or Linux? Also, I have some concerns about passing a union as a variable arg...can you really DO that? I mean, it compiles and all, and SEEMS to work, but... Questions: 1) postgresql folks: does this work for you? 2) should I go back to Linux style (define union semun in sem.h, require four args on semctl()) I'm even a bit confused by the SUSv2 spec: it says that client code MUST define union semun -- and then SPECIFIES exactly how it should be defined. Why leave it up to the client code, if there's no freedom? Just do it in the header! What am I missing? (Obviouly Linux agrees with me, but...) 3) is this code below okay (the whole vararg union thing...)? (I parse the va_arg list INSIDE the switch (cmd), because the fourth arg is only required to be there for certain cmd's, and va_* behavior is indeterminate when you 'run out' of actual varargs.) --Chuck int semctl (int semid, int semnum, int cmd, ... ) { struct semid_ds *buf = NULL; struct semid_ds tbuf; union semun arg; int val; int i, id; struct semid_ds *sma; struct ipc_perm *ipcp; unsigned int nsems; ushort *array = NULL; char LBuff[100] ; HANDLE LHandle ; long LPrevious ; va_list ap; .... switch (cmd) { case IPC_INFO: case SEM_INFO: { struct seminfo * tmp; struct seminfo seminfo; va_start(ap, cmd); arg = va_arg(ap, union semun); tmp = arg.__buf; va_end(ap); ... (use 'tmp') } -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/