Bug #4143: Using SysV shared memory leads to crash.

From: Date: Fri, 14 Apr 2000 07:12:44 +0000
Subject: Bug #4143: Using SysV shared memory leads to crash.
Groups: php.dev 
Request: Send a blank email to php-dev+get-17898@lists.php.net to get a copy of this message
From: kir@astrive.ru Operating system: Sun Solaris 7 PHP version: 3.0.16 PHP Bug Type: Reproduceable crash Bug description: Using SysV shared memory leads to crash. This problem didn't exists in 3.0.15. But in 3.0.15 shared memory didn't work on Solaris 7 x86 (Bug #3621) Configure line: ./configure \ --with-oracle=/opt/oracle/product/8.0.4 \ --with-config-file-path=/usr/local/apache/conf \ --with-apxs=/usr/local/apache/bin/apxs \ --enable-magic-quotes=yes --disable-debug \ --enable-memory-limit=yes --enable-url-fopen-wrapper=no \ --enable-sysvsem=yes --enable-sysvshm=yes \ --enable-track-vars=yes --with-system-regex With this configuration code like this: <?php $semid = sem_get(0x123754); sem_acquire($semid); Echo "aaa"; sem_release($semid); ?> gives "Document contains no data" and Bus error in error_log. After some investigation, I've found the following: From the man page for semctl on Solaris: ------------------------------------------------------------- The semctl() function provides a variety of semaphore con- trol operations as specified by cmd. The fourth argument is optional, depending upon the operation requested. If required, it is of type union semun, which must be expli- citly declared by the application program. union semun { int val; struct semid_ds *buf; ushort_t *array; } arg ; ------------------------------------------------------------- There is already definition of this structure in semvsem.c: #if !HAVE_SEMUN && defined(__GNU_LIBRARY__) && __GNU_LIBRARY__ == 6 union semun { int val; /* value for SETVAL */ struct semid_ds *buf; /* buffer for IPC_STAT, IPC_SET */ unsigned short int *array; /* array for GETALL, SETALL */ struct seminfo *__buf; /* buffer for IPC_INFO */ }; #undef HAVE_SEMUN #define HAVE_SEMUN 1 #endif So, I changed the line #if !HAVE_SEMUN && defined(__GNU_LIBRARY__) && __GNU_LIBRARY__ == 6 with #if !HAVE_SEMUN and recompiled php with union semun defined - it compiled smoothly, and worked on Solaris 7 [Sun|x86]. The same problem exists in PHP4 tree.

« previous php.dev (#17898) next »