cvs: /php4/ext/sysvsem sysvsem.c
| From: | Sascha Schumann | Date: | Wed, 25 Aug 1999 16:53:58 +0000 |
| Subject: | cvs: /php4/ext/sysvsem sysvsem.c | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-3724@lists.php.net to get a copy of this message | ||
sas Wed Aug 25 12:53:58 1999 EDT
Modified files:
/php4/ext/sysvsem sysvsem.c
Log:
AIX wants the value, not the pointer to the value.
Fixes #2149
Index: php4/ext/sysvsem/sysvsem.c
diff -u php4/ext/sysvsem/sysvsem.c:1.7 php4/ext/sysvsem/sysvsem.c:1.8
--- php4/ext/sysvsem/sysvsem.c:1.7 Mon Aug 2 15:16:51 1999
+++ php4/ext/sysvsem/sysvsem.c Wed Aug 25 12:53:57 1999
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sysvsem.c,v 1.7 1999/08/02 19:16:51 zeev Exp $ */
+/* $Id: sysvsem.c,v 1.8 1999/08/25 16:53:57 sas Exp $ */
/* This has been built and tested on Solaris 2.6 and Linux 2.1.122.
* It may not compile or execute correctly on other systems.
@@ -121,7 +121,12 @@
return SUCCESS;
}
+#define SETVAL_WANTS_PTR
+#if defined(_AIX)
+#undef SETVAL_WANTS_PTR
+#endif
+
/* {{{ proto int sem_get(int key [, int max_acquire [, int perm]])
Return an id for the semaphore with the given key, and allow max_acquire (default 1) processes
to acquire it simultaneously. */
PHP_FUNCTION(sysvsem_get)
@@ -237,9 +242,14 @@
if (semctl(semid, SYSVSEM_SEM, SETVAL, semarg) == -1) {
php_error(E_WARNING, "semctl(SETVAL) failed for key 0x%x: %s", key, strerror(errno));
}
-#else
+#elif defined(SETVAL_WANTS_PTR)
/* This is correct for Solaris 2.6 which does not have union semun. */
if (semctl(semid, SYSVSEM_SEM, SETVAL, &max_acquire) == -1) {
+ php_error(E_WARNING, "semctl(SETVAL) failed for key 0x%x: %s", key, strerror(errno));
+ }
+#else
+ /* This works for i.e. AIX */
+ if (semctl(semid, SYSVSEM_SEM, SETVAL, max_acquire) == -1) {
php_error(E_WARNING, "semctl(SETVAL) failed for key 0x%x: %s", key, strerror(errno));
}
#endif