Few clean-ups, few indentations. Nothing really important.
This commit was SVN r15767.
Этот коммит содержится в:
родитель
629bacbb07
Коммит
31dfa5592e
@ -152,8 +152,9 @@ opal_init_util(void)
|
|||||||
opal_output_init();
|
opal_output_init();
|
||||||
|
|
||||||
/* register handler for errnum -> string converstion */
|
/* register handler for errnum -> string converstion */
|
||||||
if (OPAL_SUCCESS != (ret = opal_error_register("OPAL",
|
if (OPAL_SUCCESS !=
|
||||||
OPAL_ERR_BASE, OPAL_ERR_MAX, opal_err2str))) {
|
(ret = opal_error_register("OPAL",
|
||||||
|
OPAL_ERR_BASE, OPAL_ERR_MAX, opal_err2str))) {
|
||||||
error = "opal_error_register";
|
error = "opal_error_register";
|
||||||
goto return_error;
|
goto return_error;
|
||||||
}
|
}
|
||||||
@ -201,7 +202,7 @@ opal_init_util(void)
|
|||||||
error = "opal_util_init_sys_limits";
|
error = "opal_util_init_sys_limits";
|
||||||
goto return_error;
|
goto return_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
return OPAL_SUCCESS;
|
return OPAL_SUCCESS;
|
||||||
|
|
||||||
return_error:
|
return_error:
|
||||||
|
@ -35,8 +35,6 @@
|
|||||||
|
|
||||||
int opal_register_params(void)
|
int opal_register_params(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This string is going to be used in opal/util/stacktrace.c
|
* This string is going to be used in opal/util/stacktrace.c
|
||||||
*/
|
*/
|
||||||
|
@ -176,10 +176,6 @@ opal_net_samenetwork(const struct sockaddr *addr1,
|
|||||||
uint32_t prefixlen)
|
uint32_t prefixlen)
|
||||||
{
|
{
|
||||||
if(addr1->sa_family != addr2->sa_family) {
|
if(addr1->sa_family != addr2->sa_family) {
|
||||||
#if 0
|
|
||||||
/* very annoying debug output */
|
|
||||||
opal_output(0, "opal_samenetwork: uncomparable");
|
|
||||||
#endif
|
|
||||||
return false; /* address families must be equal */
|
return false; /* address families must be equal */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -634,98 +634,95 @@ static void output(int output_id, const char *format, va_list arglist)
|
|||||||
/* Setup */
|
/* Setup */
|
||||||
|
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
opal_output_init();
|
opal_output_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If it's valid, used, and enabled, output */
|
/* If it's valid, used, and enabled, output */
|
||||||
|
|
||||||
if (output_id >= 0 && output_id < OPAL_OUTPUT_MAX_STREAMS &&
|
if (output_id >= 0 && output_id < OPAL_OUTPUT_MAX_STREAMS &&
|
||||||
info[output_id].ldi_used && info[output_id].ldi_enabled) {
|
info[output_id].ldi_used && info[output_id].ldi_enabled) {
|
||||||
ldi = &info[output_id];
|
ldi = &info[output_id];
|
||||||
|
|
||||||
/* Make the formatted string */
|
/* Make the formatted string */
|
||||||
|
|
||||||
OPAL_THREAD_LOCK(&mutex);
|
OPAL_THREAD_LOCK(&mutex);
|
||||||
vasprintf(&str, format, arglist);
|
vasprintf(&str, format, arglist);
|
||||||
total_len = len = strlen(str);
|
total_len = len = strlen(str);
|
||||||
if ('\n' != str[len - 1]) {
|
if ('\n' != str[len - 1]) {
|
||||||
want_newline = true;
|
want_newline = true;
|
||||||
++total_len;
|
++total_len;
|
||||||
}
|
}
|
||||||
if (NULL != ldi->ldi_prefix) {
|
if (NULL != ldi->ldi_prefix) {
|
||||||
total_len += strlen(ldi->ldi_prefix);
|
total_len += strlen(ldi->ldi_prefix);
|
||||||
}
|
}
|
||||||
if (temp_str_len < total_len + want_newline) {
|
if (temp_str_len < total_len + want_newline) {
|
||||||
if (NULL != temp_str) {
|
if (NULL != temp_str) {
|
||||||
free(temp_str);
|
free(temp_str);
|
||||||
}
|
}
|
||||||
temp_str = (char *) malloc(total_len * 2);
|
temp_str = (char *) malloc(total_len * 2);
|
||||||
temp_str_len = total_len * 2;
|
temp_str_len = total_len * 2;
|
||||||
}
|
}
|
||||||
if (NULL != ldi->ldi_prefix) {
|
if (NULL != ldi->ldi_prefix) {
|
||||||
if (want_newline) {
|
if (want_newline) {
|
||||||
snprintf(temp_str, temp_str_len, "%s%s\n", ldi->ldi_prefix,
|
snprintf(temp_str, temp_str_len, "%s%s\n", ldi->ldi_prefix,
|
||||||
str);
|
str);
|
||||||
} else {
|
} else {
|
||||||
snprintf(temp_str, temp_str_len, "%s%s", ldi->ldi_prefix,
|
snprintf(temp_str, temp_str_len, "%s%s", ldi->ldi_prefix,
|
||||||
str);
|
str);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (want_newline) {
|
if (want_newline) {
|
||||||
snprintf(temp_str, temp_str_len, "%s\n", str);
|
snprintf(temp_str, temp_str_len, "%s\n", str);
|
||||||
} else {
|
} else {
|
||||||
snprintf(temp_str, temp_str_len, "%s", str);
|
snprintf(temp_str, temp_str_len, "%s", str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Syslog output */
|
/* Syslog output */
|
||||||
|
|
||||||
if (ldi->ldi_syslog) {
|
|
||||||
|
|
||||||
#if defined(HAVE_SYSLOG)
|
#if defined(HAVE_SYSLOG)
|
||||||
syslog(ldi->ldi_syslog_priority, "%s", str);
|
if (ldi->ldi_syslog) {
|
||||||
|
syslog(ldi->ldi_syslog_priority, "%s", str);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
/* stdout output */
|
/* stdout output */
|
||||||
|
if (ldi->ldi_stdout) {
|
||||||
if (ldi->ldi_stdout) {
|
|
||||||
write(fileno(stdout), temp_str, (int)strlen(temp_str));
|
write(fileno(stdout), temp_str, (int)strlen(temp_str));
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* stderr output */
|
/* stderr output */
|
||||||
|
if (ldi->ldi_stderr) {
|
||||||
if (ldi->ldi_stderr) {
|
|
||||||
write(fileno(stderr),temp_str, (int)strlen(temp_str));
|
write(fileno(stderr),temp_str, (int)strlen(temp_str));
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* File output -- first check to see if the file opening was
|
/* File output -- first check to see if the file opening was
|
||||||
* delayed. If so, try to open it. If we failed to open it,
|
* delayed. If so, try to open it. If we failed to open it,
|
||||||
* then just discard (there are big warnings in the
|
* then just discard (there are big warnings in the
|
||||||
* opal_output.h docs about this!). */
|
* opal_output.h docs about this!). */
|
||||||
|
|
||||||
if (ldi->ldi_file) {
|
if (ldi->ldi_file) {
|
||||||
if (ldi->ldi_fd == -1) {
|
if (ldi->ldi_fd == -1) {
|
||||||
if (OPAL_SUCCESS != open_file(output_id)) {
|
if (OPAL_SUCCESS != open_file(output_id)) {
|
||||||
++ldi->ldi_file_num_lines_lost;
|
++ldi->ldi_file_num_lines_lost;
|
||||||
} else if (ldi->ldi_file_num_lines_lost > 0) {
|
} else if (ldi->ldi_file_num_lines_lost > 0) {
|
||||||
char buffer[BUFSIZ];
|
char buffer[BUFSIZ];
|
||||||
memset(buffer, 0, BUFSIZ);
|
memset(buffer, 0, BUFSIZ);
|
||||||
snprintf(buffer, BUFSIZ - 1,
|
snprintf(buffer, BUFSIZ - 1,
|
||||||
"[WARNING: %d lines lost because the Open MPI process session directory did\n not exist when opal_output() was invoked]\n",
|
"[WARNING: %d lines lost because the Open MPI process session directory did\n not exist when opal_output() was invoked]\n",
|
||||||
ldi->ldi_file_num_lines_lost);
|
ldi->ldi_file_num_lines_lost);
|
||||||
write(ldi->ldi_fd, buffer, (int)strlen(buffer));
|
write(ldi->ldi_fd, buffer, (int)strlen(buffer));
|
||||||
ldi->ldi_file_num_lines_lost = 0;
|
ldi->ldi_file_num_lines_lost = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ldi->ldi_fd != -1) {
|
if (ldi->ldi_fd != -1) {
|
||||||
write(ldi->ldi_fd, temp_str, (int)total_len);
|
write(ldi->ldi_fd, temp_str, (int)total_len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OPAL_THREAD_UNLOCK(&mutex);
|
OPAL_THREAD_UNLOCK(&mutex);
|
||||||
|
|
||||||
free(str);
|
free(str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user