msopacua Sun Oct 27 06:56:06 2002 EDT
Modified files:
/php4/ext/sysvmsg config.m4 sysvmsg.c php_sysvmsg.h
Log:
Avoid possible clash with mysql, but still make it work for BSD's.
Struct verified to be compatible with Linux, FreeBSD, BSDi, AIX 4.3.3 and
Solaris 5.7.
Index: php4/ext/sysvmsg/config.m4
diff -u php4/ext/sysvmsg/config.m4:1.4 php4/ext/sysvmsg/config.m4:1.5
--- php4/ext/sysvmsg/config.m4:1.4 Tue Oct 8 12:20:20 2002
+++ php4/ext/sysvmsg/config.m4 Sun Oct 27 06:56:06 2002
@@ -1,35 +1,9 @@
-dnl $Id: config.m4,v 1.4 2002/10/08 16:20:20 msopacua Exp $
+dnl $Id: config.m4,v 1.5 2002/10/27 11:56:06 msopacua Exp $
PHP_ARG_ENABLE(sysvmsg,whether to enable System V IPC support,
[ --enable-sysvmsg Enable sysvmsg support])
if test "$PHP_SYSVMSG" != "no"; then
- AC_MSG_CHECKING([whether sys/msg.h defines struct msgbuf or mymsg])
- AC_TRY_COMPILE(
- [#include <sys/types.h>
- #include <sys/ipc.h>
- #include <sys/msg.h>],
- [size_t i;
-
- i = sizeof(struct msgbuf);
- return 1;],
- [AC_MSG_RESULT(msgbuf)],
- [AC_TRY_COMPILE(
- [#include <sys/types.h>
- #include <sys/ipc.h>
- #include <sys/msg.h>
- ],
- [size_t i;
-
- i = sizeof(struct mymsg);
- return 1;
- ],
- [AC_DEFINE(msgbuf, mymsg, [msgbuf is called mymsg])
- AC_MSG_RESULT(mymsg)
- ],
- [AC_MSG_ERROR([none. Cannot make sysvmsg module])
- ])
- ])
AC_DEFINE(HAVE_SYSVMSG, 1, [ ])
PHP_NEW_EXTENSION(sysvmsg, sysvmsg.c, $ext_shared)
fi
Index: php4/ext/sysvmsg/sysvmsg.c
diff -u php4/ext/sysvmsg/sysvmsg.c:1.3 php4/ext/sysvmsg/sysvmsg.c:1.4
--- php4/ext/sysvmsg/sysvmsg.c:1.3 Tue Sep 10 09:04:08 2002
+++ php4/ext/sysvmsg/sysvmsg.c Sun Oct 27 06:56:06 2002
@@ -15,7 +15,7 @@
| Authors: Wez Furlong <[EMAIL PROTECTED] |
+----------------------------------------------------------------------+
*/
-/* $Id: sysvmsg.c,v 1.3 2002/09/10 13:04:08 wez Exp $ */
+/* $Id: sysvmsg.c,v 1.4 2002/10/27 11:56:06 msopacua Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -120,7 +120,7 @@
{
php_info_print_table_start();
php_info_print_table_header(2, "sysvmsg support", "enabled");
- php_info_print_table_row(2, "Revision", "$Revision: 1.3 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.4 $");
php_info_print_table_end();
}
/* }}} */
@@ -262,7 +262,7 @@
long realflags = 0;
zend_bool do_unserialize = 1;
sysvmsg_queue_t *mq = NULL;
- struct msgbuf *messagebuffer = NULL; /* buffer to transmit */
+ struct php_msgbuf *messagebuffer = NULL; /* buffer to transmit */
int result;
RETVAL_FALSE;
@@ -289,7 +289,7 @@
ZEND_FETCH_RESOURCE(mq, sysvmsg_queue_t *, &queue, -1, "sysvmsg queue",
le_sysvmsg);
- messagebuffer = (struct msgbuf*)emalloc(sizeof(struct msgbuf) + maxsize);
+ messagebuffer = (struct php_msgbuf*)emalloc(sizeof(struct php_msgbuf) +
+maxsize);
result = msgrcv(mq->id, messagebuffer, maxsize, desiredmsgtype, realflags);
@@ -340,7 +340,7 @@
long msgtype;
zend_bool do_serialize = 1, blocking = 1;
sysvmsg_queue_t * mq = NULL;
- struct msgbuf * messagebuffer = NULL; /* buffer to transmit */
+ struct php_msgbuf * messagebuffer = NULL; /* buffer to transmit */
int result;
int message_len = 0;
@@ -360,15 +360,15 @@
php_var_serialize(&msg_var, &message, &var_hash TSRMLS_CC);
PHP_VAR_SERIALIZE_DESTROY(var_hash);
- /* NB: msgbuf is 1 char bigger than a long, so there is no need to
+ /* NB: php_msgbuf is 1 char bigger than a long, so there is no need to
* allocate the extra byte. */
- messagebuffer = emalloc(sizeof(struct msgbuf) + msg_var.len);
+ messagebuffer = emalloc(sizeof(struct php_msgbuf) + msg_var.len);
memcpy(messagebuffer->mtext, msg_var.c, msg_var.len + 1);
message_len = msg_var.len;
smart_str_free(&msg_var);
} else {
convert_to_string_ex(&message);
- messagebuffer = emalloc(sizeof(struct msgbuf) + Z_STRLEN_P(message));
+ messagebuffer = emalloc(sizeof(struct php_msgbuf) +
+Z_STRLEN_P(message));
memcpy(messagebuffer->mtext, Z_STRVAL_P(message), Z_STRLEN_P(message)
+ 1);
message_len = Z_STRLEN_P(message);
}
Index: php4/ext/sysvmsg/php_sysvmsg.h
diff -u php4/ext/sysvmsg/php_sysvmsg.h:1.1 php4/ext/sysvmsg/php_sysvmsg.h:1.2
--- php4/ext/sysvmsg/php_sysvmsg.h:1.1 Thu Apr 25 19:14:43 2002
+++ php4/ext/sysvmsg/php_sysvmsg.h Sun Oct 27 06:56:06 2002
@@ -55,6 +55,11 @@
long id;
} sysvmsg_queue_t;
+struct php_msgbuf {
+ long mtype;
+ char mtext[1];
+};
+
#endif /* HAVE_SYSVMSG */
#endif /* PHP_SYSVMSG_H */
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php