Skip to content

Commit 47cd520

Browse files
committed
Disable syslog support on OSX 10.13
Fix OSX 10.13 syslog.h issue with gcc 7.x Backport 8f32b34. Signed-off-by: George Bosilca <[email protected]>
1 parent b628b8c commit 47cd520

File tree

5 files changed

+69
-10
lines changed

5 files changed

+69
-10
lines changed

opal/mca/base/mca_base_open.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
44
* University Research and Technology
55
* Corporation. All rights reserved.
6-
* Copyright (c) 2004-2008 The University of Tennessee and The University
6+
* Copyright (c) 2004-2017 The University of Tennessee and The University
77
* of Tennessee Research Foundation. All rights
88
* reserved.
99
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@@ -165,8 +165,10 @@ static void set_defaults(opal_output_stream_t *lds)
165165
/* Load up defaults */
166166

167167
OBJ_CONSTRUCT(lds, opal_output_stream_t);
168+
#if defined(HAVE_SYSLOG) && defined(HAVE_SYSLOG_H)
168169
lds->lds_syslog_priority = LOG_INFO;
169170
lds->lds_syslog_ident = "ompi";
171+
#endif
170172
lds->lds_want_stderr = true;
171173
}
172174

@@ -196,10 +198,15 @@ static void parse_verbose(char *e, opal_output_stream_t *lds)
196198
}
197199

198200
if (0 == strcasecmp(ptr, "syslog")) {
201+
#if defined(HAVE_SYSLOG) && defined(HAVE_SYSLOG_H)
199202
lds->lds_want_syslog = true;
200203
have_output = true;
204+
#else
205+
opal_output(0, "syslog support requested but not available on this system");
206+
#endif /* defined(HAVE_SYSLOG) && defined(HAVE_SYSLOG_H) */
201207
}
202208
else if (strncasecmp(ptr, "syslogpri:", 10) == 0) {
209+
#if defined(HAVE_SYSLOG) && defined(HAVE_SYSLOG_H)
203210
lds->lds_want_syslog = true;
204211
have_output = true;
205212
if (strcasecmp(ptr + 10, "notice") == 0)
@@ -208,9 +215,16 @@ static void parse_verbose(char *e, opal_output_stream_t *lds)
208215
lds->lds_syslog_priority = LOG_INFO;
209216
else if (strcasecmp(ptr + 10, "DEBUG") == 0)
210217
lds->lds_syslog_priority = LOG_DEBUG;
218+
#else
219+
opal_output(0, "syslog support requested but not available on this system");
220+
#endif /* defined(HAVE_SYSLOG) && defined(HAVE_SYSLOG_H) */
211221
} else if (strncasecmp(ptr, "syslogid:", 9) == 0) {
222+
#if defined(HAVE_SYSLOG) && defined(HAVE_SYSLOG_H)
212223
lds->lds_want_syslog = true;
213224
lds->lds_syslog_ident = ptr + 9;
225+
#else
226+
opal_output(0, "syslog support requested but not available on this system");
227+
#endif /* defined(HAVE_SYSLOG) && defined(HAVE_SYSLOG_H) */
214228
}
215229

216230
else if (strcasecmp(ptr, "stdout") == 0) {

opal/mca/pmix/pmix112/pmix/src/util/output.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
33
* University Research and Technology
44
* Corporation. All rights reserved.
5-
* Copyright (c) 2004-2008 The University of Tennessee and The University
5+
* Copyright (c) 2004-2017 The University of Tennessee and The University
66
* of Tennessee Research Foundation. All rights
77
* reserved.
88
* Copyright (c) 2004-2006 High Performance Computing Center Stuttgart,
@@ -143,6 +143,7 @@ bool pmix_output_init(void)
143143
}
144144
}
145145
str = getenv("PMIX_OUTPUT_SYSLOG_PRI");
146+
#ifdef HAVE_SYSLOG_H
146147
if (NULL != str) {
147148
if (0 == strcasecmp(str, "info")) {
148149
pmix_output_redirected_syslog_pri = LOG_INFO;
@@ -156,6 +157,7 @@ bool pmix_output_init(void)
156157
} else {
157158
pmix_output_redirected_syslog_pri = LOG_ERR;
158159
}
160+
#endif
159161

160162
str = getenv("PMIX_OUTPUT_SYSLOG_IDENT");
161163
if (NULL != str) {

opal/util/output.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
44
* University Research and Technology
55
* Corporation. All rights reserved.
6-
* Copyright (c) 2004-2008 The University of Tennessee and The University
6+
* Copyright (c) 2004-2017 The University of Tennessee and The University
77
* of Tennessee Research Foundation. All rights
88
* reserved.
99
* Copyright (c) 2004-2006 High Performance Computing Center Stuttgart,
@@ -147,6 +147,7 @@ bool opal_output_init(void)
147147
}
148148
}
149149
str = getenv("OPAL_OUTPUT_SYSLOG_PRI");
150+
#ifdef HAVE_SYSLOG_H
150151
if (NULL != str) {
151152
if (0 == strcasecmp(str, "info")) {
152153
opal_output_redirected_syslog_pri = LOG_INFO;
@@ -160,7 +161,7 @@ bool opal_output_init(void)
160161
} else {
161162
opal_output_redirected_syslog_pri = LOG_ERR;
162163
}
163-
164+
#endif /* HAVE_SYSLOG_H */
164165
str = getenv("OPAL_OUTPUT_SYSLOG_IDENT");
165166
if (NULL != str) {
166167
redirect_syslog_ident = strdup(str);
@@ -349,7 +350,7 @@ void opal_output_close(int output_id)
349350
}
350351
}
351352

352-
#if defined(HAVE_SYSLOG)
353+
#if defined(HAVE_SYSLOG) && defined(HAVE_SYSLOG_H)
353354
if (i >= OPAL_OUTPUT_MAX_STREAMS && syslog_opened) {
354355
closelog();
355356
}
@@ -612,7 +613,7 @@ static int do_open(int output_id, opal_output_stream_t * lds)
612613
info[i].ldi_verbose_level = lds->lds_verbose_level;
613614

614615
#if USE_SYSLOG
615-
#if defined(HAVE_SYSLOG)
616+
#if defined(HAVE_SYSLOG) && defined(HAVE_SYSLOG_H)
616617
if (opal_output_redirected_to_syslog) {
617618
info[i].ldi_syslog = true;
618619
info[i].ldi_syslog_priority = opal_output_redirected_syslog_pri;
@@ -629,7 +630,7 @@ static int do_open(int output_id, opal_output_stream_t * lds)
629630
info[i].ldi_syslog = lds->lds_want_syslog;
630631
if (lds->lds_want_syslog) {
631632

632-
#if defined(HAVE_SYSLOG)
633+
#if defined(HAVE_SYSLOG) && defined(HAVE_SYSLOG_H)
633634
if (NULL != lds->lds_syslog_ident) {
634635
info[i].ldi_syslog_ident = strdup(lds->lds_syslog_ident);
635636
openlog(lds->lds_syslog_ident, LOG_PID, LOG_USER);
@@ -642,7 +643,7 @@ static int do_open(int output_id, opal_output_stream_t * lds)
642643
info[i].ldi_syslog_priority = lds->lds_syslog_priority;
643644
}
644645

645-
#if defined(HAVE_SYSLOG)
646+
#if defined(HAVE_SYSLOG) && defined(HAVE_SYSLOG_H)
646647
}
647648
#endif
648649

@@ -951,7 +952,7 @@ static int output(int output_id, const char *format, va_list arglist)
951952
}
952953

953954
/* Syslog output -- does not use the newline-appended string */
954-
#if defined(HAVE_SYSLOG)
955+
#if defined(HAVE_SYSLOG) && defined(HAVE_SYSLOG_H)
955956
if (ldi->ldi_syslog) {
956957
syslog(ldi->ldi_syslog_priority, "%s", str);
957958
}

orte/mca/notifier/notifier.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana
44
* University Research and Technology
55
* Corporation. All rights reserved.
6-
* Copyright (c) 2004-2005 The University of Tennessee and The University
6+
* Copyright (c) 2004-2017 The University of Tennessee and The University
77
* of Tennessee Research Foundation. All rights
88
* reserved.
99
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@@ -67,6 +67,7 @@ ORTE_DECLSPEC extern int orte_notifier_debug_output;
6767

6868
/* Severities */
6969
typedef enum {
70+
#ifdef HAVE_SYSLOG_H
7071
ORTE_NOTIFIER_EMERG = LOG_EMERG,
7172
ORTE_NOTIFIER_ALERT = LOG_ALERT,
7273
ORTE_NOTIFIER_CRIT = LOG_CRIT,
@@ -75,6 +76,16 @@ typedef enum {
7576
ORTE_NOTIFIER_NOTICE = LOG_NOTICE,
7677
ORTE_NOTIFIER_INFO = LOG_INFO,
7778
ORTE_NOTIFIER_DEBUG = LOG_DEBUG
79+
#else
80+
ORTE_NOTIFIER_EMERG,
81+
ORTE_NOTIFIER_ALERT,
82+
ORTE_NOTIFIER_CRIT,
83+
ORTE_NOTIFIER_ERROR,
84+
ORTE_NOTIFIER_WARN,
85+
ORTE_NOTIFIER_NOTICE,
86+
ORTE_NOTIFIER_INFO,
87+
ORTE_NOTIFIER_DEBUG
88+
#endif
7889
} orte_notifier_severity_t;
7990

8091
typedef struct {
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# -*- shell-script -*-
2+
#
3+
# Copyright (c) 2017 Cisco Systems, Inc. All rights reserved.
4+
# $COPYRIGHT$
5+
#
6+
# Additional copyrights may follow
7+
#
8+
# $HEADER$
9+
#
10+
11+
# MCA_notifier_syslog_CONFIG([action-if-found], [action-if-not-found])
12+
# -----------------------------------------------------------
13+
AC_DEFUN([MCA_orte_notifier_syslog_CONFIG], [
14+
AC_CONFIG_FILES([orte/mca/notifier/syslog/Makefile])
15+
16+
OPAL_VAR_SCOPE_PUSH([orte_notifier_syslog_happy])
17+
18+
# Per https://github.com/open-mpi/ompi/issues/4373 and
19+
# https://github.com/open-mpi/ompi/pull/4374, we need to check
20+
# that syslog.h is compilable. If syslog.h is not compilable,
21+
# disable this component.
22+
AC_CHECK_HEADER([syslog.h],
23+
[orte_notifier_syslog_happy=1],
24+
[orte_notifier_syslog_happy=0])
25+
26+
AS_IF([test $orte_notifier_syslog_happy -eq 1],
27+
[$1],
28+
[$2])
29+
30+
OPAL_VAR_SCOPE_POP
31+
])dnl

0 commit comments

Comments
 (0)