[PATCH 12/13] build: bring SOLARIS up to the same standard as other OSes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Fabio M. Di Nitto" <fdinitto@xxxxxxxxxx>

drop all SOLARIS specific ifdefs and replace them with feature checks

Signed-off-by: Fabio M. Di Nitto <fdinitto@xxxxxxxxxx>
---
:100644 100644 0857932... 1993b03... M	configure.ac
:100644 100644 98878d5... d730d02... M	exec/cfg.c
:100644 100644 9ae4a87... f4b688d... M	exec/cmap.c
:100644 100644 209aaaa... 95eb847... M	exec/cpg.c
:100644 100644 feb8332... 6cbfef6... M	exec/main.c
:100644 100644 d645132... 49c46b4... M	exec/mon.c
:100644 100644 55332a7... 206338d... M	exec/pload.c
:100644 100644 0c4bb0b... d7d7d2b... M	exec/totemudp.c
:100644 100644 314d186... 20715b7... M	exec/totemudpu.c
:100644 100644 30404a5... 253f649... M	exec/votequorum.c
:100644 100644 9cab2d2... 7a20a45... M	exec/vsf_quorum.c
:100644 100644 cb8b34f... 093747f... M	exec/wd.c
:100644 100644 d5a7d01... 801a61a... M	include/corosync/corotypes.h
:100644 100644 47edf09... 622bbec... M	include/corosync/mar_gen.h
 configure.ac                 |   20 +++++++++++++++---
 exec/cfg.c                   |    4 ---
 exec/cmap.c                  |    4 ---
 exec/cpg.c                   |    3 --
 exec/main.c                  |    9 ++++---
 exec/mon.c                   |    4 ---
 exec/pload.c                 |    4 ---
 exec/totemudp.c              |   44 ++++++++++++++++++++++++++++++++++-------
 exec/totemudpu.c             |   44 ++++++++++++++++++++++++++++++++++-------
 exec/votequorum.c            |    4 ---
 exec/vsf_quorum.c            |    3 --
 exec/wd.c                    |    4 +--
 include/corosync/corotypes.h |    4 ---
 include/corosync/mar_gen.h   |    4 ---
 14 files changed, 94 insertions(+), 61 deletions(-)

diff --git a/configure.ac b/configure.ac
index 0857932..1993b03 100644
--- a/configure.ac
+++ b/configure.ac
@@ -96,12 +96,28 @@ AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netdb.h netinet/in.h stdint.h \
 		  sys/time.h syslog.h unistd.h sys/types.h getopt.h malloc.h \
 		  utmpx.h ifaddrs.h stddef.h sys/file.h sys/uio.h])
 
+# Check entries in specific structs
 AC_CHECK_MEMBER([struct sockaddr_in.sin_len],
 		[AC_DEFINE_UNQUOTED([HAVE_SOCK_SIN_LEN], [1], [sockaddr_in needs sin_len])],
 		[], [[#include <netinet/in.h>]])
 AC_CHECK_MEMBER([struct sockaddr_in6.sin6_len],
 		[AC_DEFINE_UNQUOTED([HAVE_SOCK_SIN6_LEN], [1], [sockaddr_in6 needs sin6_len])],
 		[], [[#include <netinet/in.h>]])
+AC_CHECK_MEMBER([struct msghdr.msg_control],
+		[AC_DEFINE_UNQUOTED([HAVE_MSGHDR_CONTROL], [1], [msghdr has msg_control])],
+		[], [[#include <sys/socket.h>]])
+AC_CHECK_MEMBER([struct msghdr.msg_controllen],
+		[AC_DEFINE_UNQUOTED([HAVE_MSGHDR_CONTROLLEN], [1], [msghdr has msg_controllen])],
+		[], [[#include <sys/socket.h>]])
+AC_CHECK_MEMBER([struct msghdr.msg_flags],
+		[AC_DEFINE_UNQUOTED([HAVE_MSGHDR_FLAGS], [1], [msghdr has msg_flags])],
+		[], [[#include <sys/socket.h>]])
+AC_CHECK_MEMBER([struct msghdr.msg_accrights],
+		[AC_DEFINE_UNQUOTED([HAVE_MSGHDR_ACCRIGHTS], [1], [msghdr has msg_accrights])],
+		[], [[#include <sys/socket.h>]])
+AC_CHECK_MEMBER([struct msghdr.msg_accrightslen],
+		[AC_DEFINE_UNQUOTED([HAVE_MSGHDR_ACCRIGHTSLEN], [1], [msghdr has msg_accrightslen])],
+		[], [[#include <sys/socket.h>]])
 
 # Checks for typedefs.
 AC_TYPE_UID_T
@@ -343,10 +359,6 @@ case "$host_os" in
 			     -current_version ${SONAME} \
 			     -compatibility_version ${SONAME} -install_name \$(libdir)/\$(@)"
 	;;
-	*solaris*)
-		AC_DEFINE_UNQUOTED([COROSYNC_SOLARIS], [1],
-				   [Compiling for Solaris platform])
-	;;
 esac
 
 # *FLAGS handling goes here
diff --git a/exec/cfg.c b/exec/cfg.c
index 98878d5..d730d02 100644
--- a/exec/cfg.c
+++ b/exec/cfg.c
@@ -246,10 +246,6 @@ struct req_exec_cfg_shutdown {
 static char *cfg_exec_init_fn (
 	struct corosync_api_v1 *corosync_api_v1)
 {
-#ifdef COROSYNC_SOLARIS
-	logsys_subsys_init();
-#endif
-
 	api = corosync_api_v1;
 
 	list_init(&trackers_list);
diff --git a/exec/cmap.c b/exec/cmap.c
index 9ae4a87..f4b688d 100644
--- a/exec/cmap.c
+++ b/exec/cmap.c
@@ -169,10 +169,6 @@ static int cmap_exec_exit_fn(void)
 static char *cmap_exec_init_fn (
 	struct corosync_api_v1 *corosync_api)
 {
-
-#ifdef COROSYNC_SOLARIS
-	logsys_subsys_init();
-#endif
 	api = corosync_api;
 
 	return (NULL);
diff --git a/exec/cpg.c b/exec/cpg.c
index 209aaaa..95eb847 100644
--- a/exec/cpg.c
+++ b/exec/cpg.c
@@ -990,9 +990,6 @@ static void joinlist_messages_delete (void)
 
 static char *cpg_exec_init_fn (struct corosync_api_v1 *corosync_api)
 {
-#ifdef COROSYNC_SOLARIS
-	logsys_subsys_init();
-#endif
 	list_init (&downlist_messages_head);
 	list_init (&joinlist_messages_head);
 	api = corosync_api;
diff --git a/exec/main.c b/exec/main.c
index feb8332..6cbfef6 100644
--- a/exec/main.c
+++ b/exec/main.c
@@ -438,12 +438,13 @@ static void corosync_mlockall (void)
 
 	rlimit.rlim_cur = RLIM_INFINITY;
 	rlimit.rlim_max = RLIM_INFINITY;
-#ifndef COROSYNC_SOLARIS
-	setrlimit (RLIMIT_MEMLOCK, &rlimit);
-#else
-	setrlimit (RLIMIT_VMEM, &rlimit);
+
+#ifndef RLIMIT_MEMLOCK
+#define RLIMIT_MEMLOCK RLIMIT_VMEM
 #endif
 
+	setrlimit (RLIMIT_MEMLOCK, &rlimit);
+
 	res = mlockall (MCL_CURRENT | MCL_FUTURE);
 	if (res == -1) {
 		LOGSYS_PERROR (errno, LOGSYS_LEVEL_WARNING,
diff --git a/exec/mon.c b/exec/mon.c
index d645132..49c46b4 100644
--- a/exec/mon.c
+++ b/exec/mon.c
@@ -463,12 +463,8 @@ static void mon_instance_init (struct resource_instance* inst)
 
 static char *mon_exec_init_fn (struct corosync_api_v1 *corosync_api)
 {
-
 	sg_init();
 
-#ifdef COROSYNC_SOLARIS
-	logsys_subsys_init();
-#endif
 	api = corosync_api;
 
 	mon_instance_init (&memory_used_inst);
diff --git a/exec/pload.c b/exec/pload.c
index 55332a7..206338d 100644
--- a/exec/pload.c
+++ b/exec/pload.c
@@ -270,10 +270,6 @@ static char *pload_exec_init_fn (struct corosync_api_v1 *corosync_api)
 {
 	icmap_track_t pload_track = NULL;
 
-#ifdef COROSYNC_SOLARIS
-	logsys_subsys_init();
-#endif
-
 	api = corosync_api;
 
 	/*
diff --git a/exec/totemudp.c b/exec/totemudp.c
index 0c4bb0b..d7d7d2b 100644
--- a/exec/totemudp.c
+++ b/exec/totemudp.c
@@ -285,12 +285,19 @@ static inline void ucast_sendmsg (
 	msg_ucast.msg_namelen = addrlen;
 	msg_ucast.msg_iov = (void *)&iovec;
 	msg_ucast.msg_iovlen = 1;
-#if !defined(COROSYNC_SOLARIS)
+#ifdef HAVE_MSGHDR_CONTROL
 	msg_ucast.msg_control = 0;
+#endif
+#ifdef HAVE_MSGHDR_CONTROLLEN
 	msg_ucast.msg_controllen = 0;
+#endif
+#ifdef HAVE_MSGHDR_FLAGS
 	msg_ucast.msg_flags = 0;
-#else
+#endif
+#ifdef HAVE_MSGHDR_ACCRIGHTS
 	msg_ucast.msg_accrights = NULL;
+#endif
+#ifdef HAVE_MSGHDR_ACCRIGHTSLEN
 	msg_ucast.msg_accrightslen = 0;
 #endif
 
@@ -345,12 +352,19 @@ static inline void mcast_sendmsg (
 	msg_mcast.msg_namelen = addrlen;
 	msg_mcast.msg_iov = (void *)&iovec;
 	msg_mcast.msg_iovlen = 1;
-#if !defined(COROSYNC_SOLARIS)
+#ifdef HAVE_MSGHDR_CONTROL
 	msg_mcast.msg_control = 0;
+#endif
+#ifdef HAVE_MSGHDR_CONTROLLEN
 	msg_mcast.msg_controllen = 0;
+#endif
+#ifdef HAVE_MSGHDR_FLAGS
 	msg_mcast.msg_flags = 0;
-#else
+#endif
+#ifdef HAVE_MSGHDR_ACCRIGHTS
 	msg_mcast.msg_accrights = NULL;
+#endif
+#ifdef HAVE_MSGHDR_ACCRIGHTSLEN
 	msg_mcast.msg_accrightslen = 0;
 #endif
 
@@ -420,12 +434,19 @@ static int net_deliver_fn (
 	msg_recv.msg_namelen = sizeof (struct sockaddr_storage);
 	msg_recv.msg_iov = iovec;
 	msg_recv.msg_iovlen = 1;
-#if !defined(COROSYNC_SOLARIS)
+#ifdef HAVE_MSGHDR_CONTROL
 	msg_recv.msg_control = 0;
+#endif
+#ifdef HAVE_MSGHDR_CONTROLLEN
 	msg_recv.msg_controllen = 0;
+#endif
+#ifdef HAVE_MSGHDR_FLAGS
 	msg_recv.msg_flags = 0;
-#else
+#endif
+#ifdef HAVE_MSGHDR_ACCRIGHTS
 	msg_recv.msg_accrights = NULL;
+#endif
+#ifdef HAVE_MSGHDR_ACCRIGHTSLEN
 	msg_recv.msg_accrightslen = 0;
 #endif
 
@@ -1232,12 +1253,19 @@ extern int totemudp_recv_mcast_empty (
 	msg_recv.msg_namelen = sizeof (struct sockaddr_storage);
 	msg_recv.msg_iov = &instance->totemudp_iov_recv_flush;
 	msg_recv.msg_iovlen = 1;
-#if !defined(COROSYNC_SOLARIS)
+#ifdef HAVE_MSGHDR_CONTROL
 	msg_recv.msg_control = 0;
+#endif
+#ifdef HAVE_MSGHDR_CONTROLLEN
 	msg_recv.msg_controllen = 0;
+#endif
+#ifdef HAVE_MSGHDR_FLAGS
 	msg_recv.msg_flags = 0;
-#else
+#endif
+#ifdef HAVE_MSGHDR_ACCRIGHTS
 	msg_recv.msg_accrights = NULL;
+#endif
+#ifdef HAVE_MSGHDR_ACCRIGHTSLEN
 	msg_recv.msg_accrightslen = 0;
 #endif
 
diff --git a/exec/totemudpu.c b/exec/totemudpu.c
index 314d186..20715b7 100644
--- a/exec/totemudpu.c
+++ b/exec/totemudpu.c
@@ -280,12 +280,19 @@ static inline void ucast_sendmsg (
 	msg_ucast.msg_namelen = addrlen;
 	msg_ucast.msg_iov = (void *)&iovec;
 	msg_ucast.msg_iovlen = 1;
-#if !defined(COROSYNC_SOLARIS)
+#ifdef HAVE_MSGHDR_CONTROL
 	msg_ucast.msg_control = 0;
+#endif
+#ifdef HAVE_MSGHDR_CONTROLLEN
 	msg_ucast.msg_controllen = 0;
+#endif
+#ifdef HAVE_MSGHDR_FLAGS
 	msg_ucast.msg_flags = 0;
-#else
+#endif
+#ifdef HAVE_MSGHDR_ACCRIGHTS
 	msg_ucast.msg_accrights = NULL;
+#endif
+#ifdef HAVE_MSGHDR_ACCRIGHTSLEN
 	msg_ucast.msg_accrightslen = 0;
 #endif
 
@@ -349,12 +356,19 @@ static inline void mcast_sendmsg (
 		msg_mcast.msg_namelen = addrlen;
 		msg_mcast.msg_iov = (void *)&iovec;
 		msg_mcast.msg_iovlen = 1;
-	#if !defined(COROSYNC_SOLARIS)
+	#ifdef HAVE_MSGHDR_CONTROL
 		msg_mcast.msg_control = 0;
+	#endif
+	#ifdef HAVE_MSGHDR_CONTROLLEN
 		msg_mcast.msg_controllen = 0;
+	#endif
+	#ifdef HAVE_MSGHDR_FLAGS
 		msg_mcast.msg_flags = 0;
-	#else
+	#endif
+	#ifdef HAVE_MSGHDR_ACCRIGHTS
 		msg_mcast.msg_accrights = NULL;
+	#endif
+	#ifdef HAVE_MSGHDR_ACCRIGHTSLEN
 		msg_mcast.msg_accrightslen = 0;
 	#endif
 
@@ -406,12 +420,19 @@ static int net_deliver_fn (
 	msg_recv.msg_namelen = sizeof (struct sockaddr_storage);
 	msg_recv.msg_iov = iovec;
 	msg_recv.msg_iovlen = 1;
-#if !defined(COROSYNC_SOLARIS)
+#ifdef HAVE_MSGHDR_CONTROL
 	msg_recv.msg_control = 0;
+#endif
+#ifdef HAVE_MSGHDR_CONTROLLEN
 	msg_recv.msg_controllen = 0;
+#endif
+#ifdef HAVE_MSGHDR_FLAGS
 	msg_recv.msg_flags = 0;
-#else
+#endif
+#ifdef HAVE_MSGHDR_ACCRIGHTS
 	msg_recv.msg_accrights = NULL;
+#endif 
+#ifdef HAVE_MSGHDR_ACCRIGHTSLEN
 	msg_recv.msg_accrightslen = 0;
 #endif
 
@@ -949,12 +970,19 @@ extern int totemudpu_recv_mcast_empty (
 	msg_recv.msg_namelen = sizeof (struct sockaddr_storage);
 	msg_recv.msg_iov = &instance->totemudpu_iov_recv;
 	msg_recv.msg_iovlen = 1;
-#if !defined(COROSYNC_SOLARIS)
+#ifdef HAVE_MSGHDR_CONTROL
 	msg_recv.msg_control = 0;
+#endif
+#ifdef HAVE_MSGHDR_CONTROLLEN
 	msg_recv.msg_controllen = 0;
+#endif
+#ifdef HAVE_MSGHDR_FLAGS
 	msg_recv.msg_flags = 0;
-#else
+#endif
+#ifdef HAVE_MSGHDR_ACCRIGHTS
 	msg_recv.msg_accrights = NULL;
+#endif
+#ifdef HAVE_MSGHDR_ACCRIGHTSLEN
 	msg_recv.msg_accrightslen = 0;
 #endif
 
diff --git a/exec/votequorum.c b/exec/votequorum.c
index 30404a5..253f649 100644
--- a/exec/votequorum.c
+++ b/exec/votequorum.c
@@ -1751,10 +1751,6 @@ static char *votequorum_exec_init_fn (struct corosync_api_v1 *api)
 {
 	char *error = NULL;
 
-#ifdef COROSYNC_SOLARIS
-	logsys_subsys_init();
-#endif
-
 	ENTER();
 
 	/*
diff --git a/exec/vsf_quorum.c b/exec/vsf_quorum.c
index 9cab2d2..7a20a45 100644
--- a/exec/vsf_quorum.c
+++ b/exec/vsf_quorum.c
@@ -257,9 +257,6 @@ static char *quorum_exec_init_fn (struct corosync_api_v1 *api)
 	char *quorum_module = NULL;
 	char *error;
 
-#ifdef COROSYNC_SOLARIS
-	logsys_subsys_init();
-#endif
 	corosync_api = api;
 	list_init (&lib_trackers_list);
 	list_init (&internal_trackers_list);
diff --git a/exec/wd.c b/exec/wd.c
index cb8b34f..093747f 100644
--- a/exec/wd.c
+++ b/exec/wd.c
@@ -708,9 +708,7 @@ static char *wd_exec_init_fn (struct corosync_api_v1 *corosync_api)
 {
 
 	ENTER();
-#ifdef COROSYNC_SOLARIS
-	logsys_subsys_init();
-#endif
+
 	api = corosync_api;
 
 	watchdog_timeout_get_initial();
diff --git a/include/corosync/corotypes.h b/include/corosync/corotypes.h
index d5a7d01..801a61a 100644
--- a/include/corosync/corotypes.h
+++ b/include/corosync/corotypes.h
@@ -36,11 +36,7 @@
 #ifndef COROTYPES_H_DEFINED
 #define COROTYPES_H_DEFINED
 
-#ifndef COROSYNC_SOLARIS
 #include <stdint.h>
-#else
-#include <sys/types.h>
-#endif
 #include <errno.h>
 #include <time.h>
 #include <sys/time.h>
diff --git a/include/corosync/mar_gen.h b/include/corosync/mar_gen.h
index 47edf09..622bbec 100644
--- a/include/corosync/mar_gen.h
+++ b/include/corosync/mar_gen.h
@@ -35,11 +35,7 @@
 #ifndef MAR_GEN_H_DEFINED
 #define MAR_GEN_H_DEFINED
 
-#ifndef COROSYNC_SOLARIS
 #include <stdint.h>
-#else
-#include <sys/types.h>
-#endif
 #include <string.h>
 
 #include <corosync/corotypes.h>
-- 
1.7.7.6

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss


[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux