Explorar el Código

- solaris fixes:
- because _XOPEN_SOURCE was defined, struct timeval was not defined
anymore (strange solaris "feature")
- SUN_LEN is not defined on solaris

Andrei Pelinescu-Onciul hace 21 años
padre
commit
852abad5b0
Se han modificado 3 ficheros con 24 adiciones y 3 borrados
  1. 1 1
      Makefile.defs
  2. 6 2
      daemonize.c
  3. 17 0
      unixsock_server.c

+ 1 - 1
Makefile.defs

@@ -48,7 +48,7 @@ MAIN_NAME=ser
 VERSION = 0
 VERSION = 0
 PATCHLEVEL = 8
 PATCHLEVEL = 8
 SUBLEVEL =   99
 SUBLEVEL =   99
-EXTRAVERSION = -dev
+EXTRAVERSION = -dev1
 
 
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]")
 OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]")

+ 6 - 2
daemonize.c

@@ -34,8 +34,12 @@
  *  2004-05-03  applied pgid patch from janakj
  *  2004-05-03  applied pgid patch from janakj
  */
  */
 
 
-#define _XOPEN_SOURCE
-#define _XOPEN_SOURCE_EXTENDED
+#define _XOPEN_SOURCE   /* needed on linux for the  getpgid prototype */
+#define _XOPEN_SOURCE_EXTENDED /* same as above */
+#define __EXTENSIONS__ /* needed on solaris: if XOPEN_SOURCE is defined
+                          struct timeval defintion from <sys/time.h> won't
+                          be included => workarround define _EXTENSIONS_
+                           -andrei */
 
 
 #include <sys/types.h>
 #include <sys/types.h>
 #include <unistd.h>
 #include <unistd.h>

+ 17 - 0
unixsock_server.c

@@ -53,6 +53,23 @@
 #include "unixsock_server.h"
 #include "unixsock_server.h"
 #include "tsend.h"
 #include "tsend.h"
 
 
+
+/* AF_LOCAL is not defined on solaris */
+#if !defined(AF_LOCAL)
+#define AF_LOCAL AF_UNIX
+#endif
+#if !defined(PF_LOCAL)
+#define PF_LOCAL PF_UNIX
+#endif
+
+
+/* solaris doesn't have SUN_LEN */
+#ifndef SUN_LEN
+#define SUN_LEN(sa)	 ( strlen((sa)->sun_path) + \
+					 (size_t)(((struct sockaddr_un*)0)->sun_path) )
+#endif
+
+
 #define UNIXSOCK_BUF_SIZE BUF_SIZE
 #define UNIXSOCK_BUF_SIZE BUF_SIZE
 
 
 char* unixsock_name = 0;
 char* unixsock_name = 0;