clean up the error code situation - ensure that OMPI_ERROR == ORTE_ERROR ==
OPAL_ERROR, same for all the other error codes. Also, make sure that there are never conflicts between OPAL anr ORTE error codes (for example). Finally, provide opal_perror(), opal_strerror(), and opal_strerror_r() to give stringified error messages for the different error codes This commit was SVN r6969.
Этот коммит содержится в:
родитель
9fa52317b6
Коммит
f48968d8f4
@ -17,61 +17,71 @@
|
||||
#ifndef OMPI_CONSTANTS_H
|
||||
#define OMPI_CONSTANTS_H
|
||||
|
||||
#include "orte/include/orte_constants.h"
|
||||
|
||||
#define OMPI_ERR_BASE ORTE_ERR_MAX
|
||||
|
||||
/* error codes */
|
||||
enum {
|
||||
OMPI_SUCCESS = 0,
|
||||
OMPI_ERROR = -1,
|
||||
OMPI_ERR_OUT_OF_RESOURCE = -2, /* fatal error */
|
||||
OMPI_ERR_TEMP_OUT_OF_RESOURCE = -3, /* try again later */
|
||||
OMPI_ERR_RESOURCE_BUSY = -4,
|
||||
OMPI_ERR_BAD_PARAM = -5, /* equivalent to MPI_ERR_ARG error code */
|
||||
OMPI_ERR_RECV_LESS_THAN_POSTED = -6,
|
||||
OMPI_ERR_RECV_MORE_THAN_POSTED = -7,
|
||||
OMPI_ERR_NO_MATCH_YET = -8,
|
||||
OMPI_ERR_FATAL = -9,
|
||||
OMPI_ERR_NOT_IMPLEMENTED = -10,
|
||||
OMPI_ERR_NOT_SUPPORTED = -11,
|
||||
OMPI_ERR_INTERUPTED = -12,
|
||||
OMPI_ERR_WOULD_BLOCK = -13,
|
||||
OMPI_ERR_IN_ERRNO = -14,
|
||||
OMPI_ERR_UNREACH = -15,
|
||||
OMPI_ERR_NOT_FOUND = -16,
|
||||
OMPI_ERR_BUFFER = -17, /* equivalent to MPI_ERR_BUFFER */
|
||||
OMPI_ERR_REQUEST = -18, /* equivalent to MPI_ERR_REQUEST */
|
||||
OMPI_EXISTS = -19, /* indicates that the specified object already exists */
|
||||
OMPI_ERR_NO_CONNECTION_ALLOWED = -20, /* indicates that the receiving process does not allow connections */
|
||||
OMPI_ERR_CONNECTION_REFUSED = -21, /* contact made with process, but it refuses any further communication */
|
||||
OMPI_ERR_CONNECTION_FAILED = -22, /* message sent, but delivery failed */
|
||||
OMPI_ERR_TIMEOUT = -23,
|
||||
OMPI_STARTUP_DETECTED = -24,
|
||||
OMPI_SHUTDOWN_DETECTED = -25,
|
||||
OMPI_PROC_STARTING = -26,
|
||||
OMPI_PROC_STOPPED = -27,
|
||||
OMPI_PROC_TERMINATING = -28,
|
||||
OMPI_PROC_ALIVE = -29,
|
||||
OMPI_PROC_RUNNING = -30,
|
||||
OMPI_PROC_KILLED = -31,
|
||||
OMPI_PROC_EXITED = -32,
|
||||
OMPI_NODE_UP = -33,
|
||||
OMPI_NODE_DOWN = -34,
|
||||
OMPI_NODE_BOOTING = -35,
|
||||
OMPI_NODE_ERROR = -36,
|
||||
OMPI_PACK_MISMATCH = -37,
|
||||
OMPI_ERR_PACK_FAILURE = -38,
|
||||
OMPI_ERR_UNPACK_FAILURE = -39,
|
||||
OMPI_ERR_COMM_FAILURE = -40,
|
||||
OMPI_UNPACK_INADEQUATE_SPACE = -41,
|
||||
OMPI_UNPACK_READ_PAST_END_OF_BUFFER = -42,
|
||||
OMPI_ERR_NOT_AVAILABLE = -43,
|
||||
OMPI_ERR_GPR_DATA_CORRUPT = -44,
|
||||
OMPI_ERR_PERM = -45, /* no permission */
|
||||
OMPI_ERR_TYPE_MISMATCH = -46,
|
||||
OMPI_ERR_VALUE_OUT_OF_BOUNDS = -47,
|
||||
OMPI_ERR_FILE_READ_FAILURE = -48,
|
||||
OMPI_ERR_FILE_WRITE_FAILURE = -49,
|
||||
OMPI_ERR_FILE_OPEN_FAILURE = -50
|
||||
/* Error codes inherited from ORTE/OPAL. Still enum values so
|
||||
that we might get nice debugger help */
|
||||
OMPI_SUCCESS = ORTE_SUCCESS,
|
||||
|
||||
OMPI_ERROR = ORTE_ERROR,
|
||||
OMPI_ERR_OUT_OF_RESOURCE = ORTE_ERR_OUT_OF_RESOURCE,
|
||||
OMPI_ERR_TEMP_OUT_OF_RESOURCE = ORTE_ERR_TEMP_OUT_OF_RESOURCE,
|
||||
OMPI_ERR_RESOURCE_BUSY = ORTE_ERR_RESOURCE_BUSY,
|
||||
OMPI_ERR_BAD_PARAM = ORTE_ERR_BAD_PARAM,
|
||||
OMPI_ERR_FATAL = ORTE_ERR_FATAL,
|
||||
OMPI_ERR_NOT_IMPLEMENTED = ORTE_ERR_NOT_IMPLEMENTED,
|
||||
OMPI_ERR_NOT_SUPPORTED = ORTE_ERR_NOT_SUPPORTED,
|
||||
OMPI_ERR_INTERUPTED = ORTE_ERR_INTERUPTED,
|
||||
OMPI_ERR_WOULD_BLOCK = ORTE_ERR_WOULD_BLOCK,
|
||||
OMPI_ERR_IN_ERRNO = ORTE_ERR_IN_ERRNO,
|
||||
OMPI_ERR_UNREACH = ORTE_ERR_UNREACH,
|
||||
OMPI_ERR_NOT_FOUND = ORTE_ERR_NOT_FOUND,
|
||||
OMPI_EXISTS = ORTE_EXISTS, /* indicates that the specified object already exists */
|
||||
OMPI_ERR_TIMEOUT = ORTE_ERR_TIMEOUT,
|
||||
OMPI_ERR_NOT_AVAILABLE = ORTE_ERR_NOT_AVAILABLE,
|
||||
OMPI_ERR_PERM = ORTE_ERR_PERM,
|
||||
OMPI_ERR_VALUE_OUT_OF_BOUNDS = ORTE_ERR_VALUE_OUT_OF_BOUNDS,
|
||||
OMPI_ERR_FILE_READ_FAILURE = ORTE_ERR_FILE_READ_FAILURE,
|
||||
OMPI_ERR_FILE_WRITE_FAILURE = ORTE_ERR_FILE_WRITE_FAILURE,
|
||||
OMPI_ERR_FILE_OPEN_FAILURE = ORTE_ERR_FILE_OPEN_FAILURE,
|
||||
|
||||
OMPI_ERR_RECV_LESS_THAN_POSTED = ORTE_ERR_RECV_LESS_THAN_POSTED,
|
||||
OMPI_ERR_RECV_MORE_THAN_POSTED = ORTE_ERR_RECV_MORE_THAN_POSTED,
|
||||
OMPI_ERR_NO_MATCH_YET = ORTE_ERR_NO_MATCH_YET,
|
||||
OMPI_ERR_BUFFER = ORTE_ERR_BUFFER,
|
||||
OMPI_ERR_REQUEST = ORTE_ERR_REQUEST,
|
||||
OMPI_ERR_NO_CONNECTION_ALLOWED = ORTE_ERR_NO_CONNECTION_ALLOWED,
|
||||
OMPI_ERR_CONNECTION_REFUSED = ORTE_ERR_CONNECTION_REFUSED ,
|
||||
OMPI_ERR_CONNECTION_FAILED = ORTE_ERR_CONNECTION_FAILED,
|
||||
OMPI_STARTUP_DETECTED = ORTE_STARTUP_DETECTED,
|
||||
OMPI_SHUTDOWN_DETECTED = ORTE_SHUTDOWN_DETECTED,
|
||||
OMPI_PROC_STARTING = ORTE_PROC_STARTING,
|
||||
OMPI_PROC_STOPPED = ORTE_PROC_STOPPED,
|
||||
OMPI_PROC_TERMINATING = ORTE_PROC_TERMINATING,
|
||||
OMPI_PROC_ALIVE = ORTE_PROC_ALIVE,
|
||||
OMPI_PROC_RUNNING = ORTE_PROC_RUNNING,
|
||||
OMPI_PROC_KILLED = ORTE_PROC_KILLED,
|
||||
OMPI_PROC_EXITED = ORTE_PROC_EXITED,
|
||||
OMPI_NODE_UP = ORTE_NODE_UP,
|
||||
OMPI_NODE_DOWN = ORTE_NODE_DOWN,
|
||||
OMPI_NODE_BOOTING = ORTE_NODE_BOOTING,
|
||||
OMPI_NODE_ERROR = ORTE_NODE_ERROR,
|
||||
OMPI_PACK_MISMATCH = ORTE_PACK_MISMATCH,
|
||||
OMPI_ERR_PACK_FAILURE = ORTE_ERR_PACK_FAILURE,
|
||||
OMPI_ERR_UNPACK_FAILURE = ORTE_ERR_UNPACK_FAILURE,
|
||||
OMPI_ERR_COMM_FAILURE = ORTE_ERR_COMM_FAILURE,
|
||||
OMPI_UNPACK_INADEQUATE_SPACE = ORTE_UNPACK_INADEQUATE_SPACE,
|
||||
OMPI_UNPACK_READ_PAST_END_OF_BUFFER = ORTE_UNPACK_READ_PAST_END_OF_BUFFER,
|
||||
OMPI_ERR_GPR_DATA_CORRUPT = ORTE_ERR_GPR_DATA_CORRUPT,
|
||||
OMPI_ERR_TYPE_MISMATCH = ORTE_ERR_TYPE_MISMATCH
|
||||
};
|
||||
|
||||
#define OMPI_ERR_MAX (OMPI_ERR_BASE - 1)
|
||||
|
||||
#define OMPI_NAMESPACE_SEGMENT "ompi-namespace"
|
||||
|
||||
/*
|
||||
|
@ -16,16 +16,38 @@
|
||||
|
||||
#ifndef OPAL_CONSTANTS_H
|
||||
#define OPAL_CONSTANTS_H
|
||||
|
||||
/* error codes - don't forget to update opal/rutime/opal_init.c when
|
||||
adding to this list */
|
||||
#define OPAL_ERR_BASE 0 /* internal use only */
|
||||
|
||||
enum {
|
||||
OPAL_SUCCESS = (OPAL_ERR_BASE),
|
||||
|
||||
/* error codes */
|
||||
OPAL_ERROR = (OPAL_ERR_BASE - 1),
|
||||
OPAL_ERR_OUT_OF_RESOURCE = (OPAL_ERR_BASE - 2), /* fatal error */
|
||||
OPAL_ERR_TEMP_OUT_OF_RESOURCE = (OPAL_ERR_BASE - 3), /* try again later */
|
||||
OPAL_ERR_RESOURCE_BUSY = (OPAL_ERR_BASE - 4),
|
||||
OPAL_ERR_BAD_PARAM = (OPAL_ERR_BASE - 5), /* equivalent to MPI_ERR_ARG error code */
|
||||
OPAL_ERR_FATAL = (OPAL_ERR_BASE - 6),
|
||||
OPAL_ERR_NOT_IMPLEMENTED = (OPAL_ERR_BASE - 7),
|
||||
OPAL_ERR_NOT_SUPPORTED = (OPAL_ERR_BASE - 8),
|
||||
OPAL_ERR_INTERUPTED = (OPAL_ERR_BASE - 9),
|
||||
OPAL_ERR_WOULD_BLOCK = (OPAL_ERR_BASE - 10),
|
||||
OPAL_ERR_IN_ERRNO = (OPAL_ERR_BASE - 11),
|
||||
OPAL_ERR_UNREACH = (OPAL_ERR_BASE - 12),
|
||||
OPAL_ERR_NOT_FOUND = (OPAL_ERR_BASE - 13),
|
||||
OPAL_EXISTS = (OPAL_ERR_BASE - 14), /* indicates that the specified object already exists */
|
||||
OPAL_ERR_TIMEOUT = (OPAL_ERR_BASE - 15),
|
||||
OPAL_ERR_NOT_AVAILABLE = (OPAL_ERR_BASE - 16),
|
||||
OPAL_ERR_PERM = (OPAL_ERR_BASE - 17), /* no permission */
|
||||
OPAL_ERR_VALUE_OUT_OF_BOUNDS = (OPAL_ERR_BASE - 18),
|
||||
OPAL_ERR_FILE_READ_FAILURE = (OPAL_ERR_BASE - 19),
|
||||
OPAL_ERR_FILE_WRITE_FAILURE = (OPAL_ERR_BASE - 20),
|
||||
OPAL_ERR_FILE_OPEN_FAILURE = (OPAL_ERR_BASE - 21)
|
||||
};
|
||||
|
||||
#define OPAL_SUCCESS 0
|
||||
#define OPAL_ERROR -1
|
||||
#define OPAL_ERR_OUT_OF_RESOURCE -2
|
||||
#define OPAL_ERR_IN_ERRNO -3
|
||||
#define OPAL_ERR_NOT_FOUND -4
|
||||
#define OPAL_ERR_BAD_PARAM -5
|
||||
#define OPAL_ERR_NOT_IMPLEMENTED -6
|
||||
#define OPAL_ERR_MAX (OPAL_ERR_BASE - 21)
|
||||
|
||||
#endif /* OPAL_CONSTANTS_H */
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
#include "orte_config.h"
|
||||
|
||||
#include "orte/include/orte_constants.h"
|
||||
#include "opal/util/malloc.h"
|
||||
#include "opal/util/output.h"
|
||||
#include "opal/memory/memory.h"
|
||||
@ -27,13 +26,44 @@
|
||||
#include "opal/mca/memory/base/base.h"
|
||||
#include "opal/mca/paffinity/base/base.h"
|
||||
#include "opal/mca/timer/base/base.h"
|
||||
#include "opal/include/constants.h"
|
||||
#include "opal/util/error.h"
|
||||
|
||||
|
||||
static const char *
|
||||
opal_err2str(int errnum)
|
||||
{
|
||||
const char *retval;
|
||||
|
||||
switch (errnum) {
|
||||
case OPAL_SUCCESS:
|
||||
retval = "Success";
|
||||
break;
|
||||
case OPAL_ERROR:
|
||||
retval = "Error";
|
||||
break;
|
||||
case OPAL_ERR_OUT_OF_RESOURCE:
|
||||
retval = "Out of resource";
|
||||
break;
|
||||
case OPAL_ERR_NOT_FOUND:
|
||||
retval = "Not found";
|
||||
break;
|
||||
case OPAL_ERR_BAD_PARAM:
|
||||
retval = "Bad parameter";
|
||||
break;
|
||||
default:
|
||||
retval = NULL;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the OPAL utilities
|
||||
*
|
||||
* @retval ORTE_SUCCESS Upon success.
|
||||
* @retval ORTE_ERROR Upon failure.
|
||||
* @retval OPAL_SUCCESS Upon success.
|
||||
* @retval OPAL_ERROR Upon failure.
|
||||
*
|
||||
* This function performs
|
||||
*/
|
||||
@ -47,6 +77,9 @@ int opal_init(void)
|
||||
|
||||
/* initialize the output system */
|
||||
opal_output_init();
|
||||
|
||||
/* register handler for errnum -> string converstion */
|
||||
opal_error_register(opal_err2str);
|
||||
|
||||
/* initialize the mca */
|
||||
mca_base_open();
|
||||
@ -63,6 +96,6 @@ int opal_init(void)
|
||||
|
||||
opal_timer_base_open();
|
||||
|
||||
return ORTE_SUCCESS;
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -31,6 +31,7 @@ headers = \
|
||||
cmd_line.h \
|
||||
convert.h \
|
||||
daemon_init.h \
|
||||
error.h \
|
||||
few.h \
|
||||
if.h \
|
||||
malloc.h \
|
||||
@ -56,6 +57,7 @@ libopalutil_la_SOURCES = \
|
||||
cmd_line.c \
|
||||
convert.c \
|
||||
daemon_init.c \
|
||||
error.c \
|
||||
few.c \
|
||||
if.c \
|
||||
malloc.c \
|
||||
|
135
opal/util/error.c
Обычный файл
135
opal/util/error.c
Обычный файл
@ -0,0 +1,135 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "opal/util/error.h"
|
||||
#include "opal/include/constants.h"
|
||||
|
||||
#define MAX_CONVERTERS 5
|
||||
/* all default to NULL */
|
||||
opal_err2str_fn_t converters[MAX_CONVERTERS];
|
||||
|
||||
static const char *
|
||||
opal_strerror_int(int errnum)
|
||||
{
|
||||
int i;
|
||||
const char *ret = NULL;
|
||||
|
||||
for (i = 0 ; i < MAX_CONVERTERS ; ++i) {
|
||||
if (NULL != converters[i]) {
|
||||
ret = converters[i](errnum);
|
||||
if (NULL != ret) break;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
opal_perror(int errnum, const char *msg)
|
||||
{
|
||||
const char* errmsg = opal_strerror_int(errnum);
|
||||
|
||||
if (NULL != msg && errnum != OPAL_ERR_IN_ERRNO) {
|
||||
fprintf(stderr, "%s: ", msg);
|
||||
}
|
||||
|
||||
if (NULL == errmsg) {
|
||||
if (errnum == OPAL_ERR_IN_ERRNO) {
|
||||
perror(msg);
|
||||
} else {
|
||||
fprintf(stderr, "Unknown error: %d\n", errnum);
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "%s\n", errmsg);
|
||||
}
|
||||
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
/* size of "Unknow error: " + 3 digits of errnumber */
|
||||
static char unknown_retbuf[20];
|
||||
|
||||
const char *
|
||||
opal_strerror(int errnum)
|
||||
{
|
||||
const char* errmsg = opal_strerror_int(errnum);
|
||||
|
||||
if (NULL == errmsg) {
|
||||
if (errnum == OPAL_ERR_IN_ERRNO) {
|
||||
return strerror(errno);
|
||||
} else {
|
||||
errno = EINVAL;
|
||||
snprintf(unknown_retbuf, 20, "Unknown error: %d", errnum);
|
||||
return (const char*) unknown_retbuf;
|
||||
}
|
||||
} else {
|
||||
return errmsg;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
opal_strerror_r(int errnum, char *strerrbuf, size_t buflen)
|
||||
{
|
||||
const char* errmsg = opal_strerror_int(errnum);
|
||||
int ret;
|
||||
|
||||
if (NULL == errmsg) {
|
||||
if (errnum == OPAL_ERR_IN_ERRNO) {
|
||||
return strerror_r(errno, strerrbuf, buflen);
|
||||
} else {
|
||||
errno = EINVAL;
|
||||
ret = snprintf(strerrbuf, buflen, "Unknown error: %d", errnum);
|
||||
if (ret > (int) buflen) {
|
||||
errno = ERANGE;
|
||||
return OPAL_ERR_OUT_OF_RESOURCE;
|
||||
} else {
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ret = snprintf(strerrbuf, buflen, "%s", errmsg);
|
||||
if (ret > (int) buflen) {
|
||||
errno = ERANGE;
|
||||
return OPAL_ERR_OUT_OF_RESOURCE;
|
||||
} else {
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
opal_error_register(opal_err2str_fn_t converter)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0 ; i < MAX_CONVERTERS ; ++i) {
|
||||
if (NULL == converters[i]) {
|
||||
converters[i] = converter;
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return OPAL_ERR_OUT_OF_RESOURCE;
|
||||
}
|
86
opal/util/error.h
Обычный файл
86
opal/util/error.h
Обычный файл
@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#ifndef OPAL_UTIL_ERROR_H
|
||||
#define OPAL_UTIL_ERROR_H
|
||||
|
||||
/**
|
||||
* Prints error message for errnum on stderr
|
||||
*
|
||||
* Print the error message corresponding to the value of \c errnum and
|
||||
* writes it, followed by a newline, to the standard error file
|
||||
* descriptor. If the argument \c msg is non-NULL, this string is
|
||||
* prepended to the message string and separated from it by a colon
|
||||
* and a space. Otherwise, only the error message string is printed.
|
||||
*
|
||||
* If errnum is OPAL_ERR_IN_ERRNO, the system perror is called with
|
||||
* the argument \c msg.
|
||||
*/
|
||||
OMPI_DECLSPEC void opal_perror(int errnum, const char *msg);
|
||||
|
||||
/**
|
||||
* Return string for given error message
|
||||
*
|
||||
* Accepts an error number argument \c errnum and returns a pointer to
|
||||
* the corresponding message string. The result is returned in a
|
||||
* static buffer that should not be released with free().
|
||||
*
|
||||
* If errnum is \c OPAL_ERR_IN_ERRNO, the system strerror is called
|
||||
* with an argument of the current value of \c errno and the resulting
|
||||
* string is returned.
|
||||
*
|
||||
* If the errnum is not a known value, the returned value may be
|
||||
* overwritten by subsequent calls to opal_strerror.
|
||||
*/
|
||||
OMPI_DECLSPEC const char *opal_strerror(int errnum);
|
||||
|
||||
/**
|
||||
* Return string for given error message
|
||||
*
|
||||
* Similar to opal_strerror, but a buffer is passed in which is filled
|
||||
* with a string (up to buflen - 1 characters long) containing the
|
||||
* error message corresponding to \c errnum. Unlike opal_strerror(),
|
||||
* if an unknown value for \c errnum is passed, the returned buffer
|
||||
* will not be overwritten by subsequent calls to opal_strerror_r().
|
||||
*/
|
||||
OMPI_DECLSPEC int opal_strerror_r(int errnum, char *strerrbuf, size_t buflen);
|
||||
|
||||
|
||||
typedef const char * (*opal_err2str_fn_t)(int errnum);
|
||||
|
||||
/**
|
||||
* \internal
|
||||
*
|
||||
* Register a handler for converting errnums to error strings
|
||||
*
|
||||
* Handlers will be invoked by opal_perror() , opal_strerror(), and
|
||||
* opal_strerror_r() to return the appropriate values.
|
||||
*
|
||||
* \note A maximum of 5 converters can be registered. The 6th
|
||||
* converter registration attempt will return OPAL_ERR_OUT_OF_RESOURCE
|
||||
*/
|
||||
OMPI_DECLSPEC int opal_error_register(opal_err2str_fn_t converter);
|
||||
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OPAL_UTIL_ERROR_H */
|
@ -17,65 +17,73 @@
|
||||
#ifndef ORTE_CONSTANTS_H
|
||||
#define ORTE_CONSTANTS_H
|
||||
|
||||
/* error codes
|
||||
*
|
||||
* ANY CHANGES TO THESE DEFINITIONS MUST BE REFLECTED IN THE TEXT ARRAY
|
||||
* orte_error_strings DEFINED IN src/runtime/orte_init.c.
|
||||
*
|
||||
*/
|
||||
#include "opal/include/constants.h"
|
||||
|
||||
#define ORTE_ERR_BASE OPAL_ERR_MAX
|
||||
|
||||
enum {
|
||||
ORTE_SUCCESS = 0,
|
||||
ORTE_ERROR = -1,
|
||||
ORTE_ERR_OUT_OF_RESOURCE = -2, /* fatal error */
|
||||
ORTE_ERR_TEMP_OUT_OF_RESOURCE = -3, /* try again later */
|
||||
ORTE_ERR_RESOURCE_BUSY = -4,
|
||||
ORTE_ERR_BAD_PARAM = -5, /* equivalent to MPI_ERR_ARG error code */
|
||||
ORTE_ERR_RECV_LESS_THAN_POSTED = -6,
|
||||
ORTE_ERR_RECV_MORE_THAN_POSTED = -7,
|
||||
ORTE_ERR_NO_MATCH_YET = -8,
|
||||
ORTE_ERR_FATAL = -9,
|
||||
ORTE_ERR_NOT_IMPLEMENTED = -10,
|
||||
ORTE_ERR_NOT_SUPPORTED = -11,
|
||||
ORTE_ERR_INTERUPTED = -12,
|
||||
ORTE_ERR_WOULD_BLOCK = -13,
|
||||
ORTE_ERR_IN_ERRNO = -14,
|
||||
ORTE_ERR_UNREACH = -15,
|
||||
ORTE_ERR_NOT_FOUND = -16,
|
||||
ORTE_ERR_BUFFER = -17, /* equivalent to MPI_ERR_BUFFER */
|
||||
ORTE_ERR_REQUEST = -18, /* equivalent to MPI_ERR_REQUEST */
|
||||
ORTE_EXISTS = -19, /* indicates that the specified object already exists */
|
||||
ORTE_ERR_NO_CONNECTION_ALLOWED = -20, /* indicates that the receiving process does not allow connections */
|
||||
ORTE_ERR_CONNECTION_REFUSED = -21, /* contact made with process, but it refuses any further communication */
|
||||
ORTE_ERR_CONNECTION_FAILED = -22, /* message sent, but delivery failed */
|
||||
ORTE_ERR_TIMEOUT = -23,
|
||||
ORTE_STARTUP_DETECTED = -24,
|
||||
ORTE_SHUTDOWN_DETECTED = -25,
|
||||
ORTE_PROC_STARTING = -26,
|
||||
ORTE_PROC_STOPPED = -27,
|
||||
ORTE_PROC_TERMINATING = -28,
|
||||
ORTE_PROC_ALIVE = -29,
|
||||
ORTE_PROC_RUNNING = -30,
|
||||
ORTE_PROC_KILLED = -31,
|
||||
ORTE_PROC_EXITED = -32,
|
||||
ORTE_NODE_UP = -33,
|
||||
ORTE_NODE_DOWN = -34,
|
||||
ORTE_NODE_BOOTING = -35,
|
||||
ORTE_NODE_ERROR = -36,
|
||||
ORTE_PACK_MISMATCH = -37,
|
||||
ORTE_ERR_PACK_FAILURE = -38,
|
||||
ORTE_ERR_UNPACK_FAILURE = -39,
|
||||
ORTE_ERR_COMM_FAILURE = -40,
|
||||
ORTE_UNPACK_INADEQUATE_SPACE = -41,
|
||||
ORTE_UNPACK_READ_PAST_END_OF_BUFFER = -42,
|
||||
ORTE_ERR_NOT_AVAILABLE = -43,
|
||||
ORTE_ERR_GPR_DATA_CORRUPT = -44,
|
||||
ORTE_ERR_PERM = -45, /* no permission */
|
||||
ORTE_ERR_TYPE_MISMATCH = -46,
|
||||
ORTE_ERR_VALUE_OUT_OF_BOUNDS = -47,
|
||||
ORTE_ERR_FILE_READ_FAILURE = -48,
|
||||
ORTE_ERR_FILE_WRITE_FAILURE = -49,
|
||||
ORTE_ERR_FILE_OPEN_FAILURE = -50
|
||||
/* Error codes inherited from OPAL. Still enum values so that we
|
||||
get the nice debugger help. */
|
||||
|
||||
ORTE_SUCCESS = OPAL_SUCCESS,
|
||||
|
||||
ORTE_ERROR = OPAL_ERROR,
|
||||
ORTE_ERR_OUT_OF_RESOURCE = OPAL_ERR_OUT_OF_RESOURCE,
|
||||
ORTE_ERR_TEMP_OUT_OF_RESOURCE = OPAL_ERR_TEMP_OUT_OF_RESOURCE,
|
||||
ORTE_ERR_RESOURCE_BUSY = OPAL_ERR_RESOURCE_BUSY,
|
||||
ORTE_ERR_BAD_PARAM = OPAL_ERR_BAD_PARAM,
|
||||
ORTE_ERR_FATAL = OPAL_ERR_FATAL,
|
||||
ORTE_ERR_NOT_IMPLEMENTED = OPAL_ERR_NOT_IMPLEMENTED,
|
||||
ORTE_ERR_NOT_SUPPORTED = OPAL_ERR_NOT_SUPPORTED,
|
||||
ORTE_ERR_INTERUPTED = OPAL_ERR_INTERUPTED,
|
||||
ORTE_ERR_WOULD_BLOCK = OPAL_ERR_WOULD_BLOCK,
|
||||
ORTE_ERR_IN_ERRNO = OPAL_ERR_IN_ERRNO,
|
||||
ORTE_ERR_UNREACH = OPAL_ERR_UNREACH,
|
||||
ORTE_ERR_NOT_FOUND = OPAL_ERR_NOT_FOUND,
|
||||
ORTE_EXISTS = OPAL_EXISTS,
|
||||
ORTE_ERR_TIMEOUT = OPAL_ERR_TIMEOUT,
|
||||
ORTE_ERR_NOT_AVAILABLE = OPAL_ERR_NOT_AVAILABLE,
|
||||
ORTE_ERR_PERM = OPAL_ERR_PERM,
|
||||
ORTE_ERR_VALUE_OUT_OF_BOUNDS = OPAL_ERR_VALUE_OUT_OF_BOUNDS,
|
||||
ORTE_ERR_FILE_READ_FAILURE = OPAL_ERR_FILE_READ_FAILURE,
|
||||
ORTE_ERR_FILE_WRITE_FAILURE = OPAL_ERR_FILE_WRITE_FAILURE,
|
||||
ORTE_ERR_FILE_OPEN_FAILURE = OPAL_ERR_FILE_OPEN_FAILURE,
|
||||
|
||||
/* error codes specific to ORTE - don't forget to update
|
||||
orte/rutime/orte_init.c when adding new error codes */
|
||||
ORTE_ERR_RECV_LESS_THAN_POSTED = (ORTE_ERR_BASE - 1),
|
||||
ORTE_ERR_RECV_MORE_THAN_POSTED = (ORTE_ERR_BASE - 2),
|
||||
ORTE_ERR_NO_MATCH_YET = (ORTE_ERR_BASE - 3),
|
||||
ORTE_ERR_BUFFER = (ORTE_ERR_BASE - 4),
|
||||
ORTE_ERR_REQUEST = (ORTE_ERR_BASE - 5),
|
||||
ORTE_ERR_NO_CONNECTION_ALLOWED = (ORTE_ERR_BASE - 6),
|
||||
ORTE_ERR_CONNECTION_REFUSED = (ORTE_ERR_BASE - 7),
|
||||
ORTE_ERR_CONNECTION_FAILED = (ORTE_ERR_BASE - 8),
|
||||
ORTE_STARTUP_DETECTED = (ORTE_ERR_BASE - 9),
|
||||
ORTE_SHUTDOWN_DETECTED = (ORTE_ERR_BASE - 10),
|
||||
ORTE_PROC_STARTING = (ORTE_ERR_BASE - 11),
|
||||
ORTE_PROC_STOPPED = (ORTE_ERR_BASE - 12),
|
||||
ORTE_PROC_TERMINATING = (ORTE_ERR_BASE - 13),
|
||||
ORTE_PROC_ALIVE = (ORTE_ERR_BASE - 14),
|
||||
ORTE_PROC_RUNNING = (ORTE_ERR_BASE - 15),
|
||||
ORTE_PROC_KILLED = (ORTE_ERR_BASE - 16),
|
||||
ORTE_PROC_EXITED = (ORTE_ERR_BASE - 17),
|
||||
ORTE_NODE_UP = (ORTE_ERR_BASE - 18),
|
||||
ORTE_NODE_DOWN = (ORTE_ERR_BASE - 19),
|
||||
ORTE_NODE_BOOTING = (ORTE_ERR_BASE - 21),
|
||||
ORTE_NODE_ERROR = (ORTE_ERR_BASE - 22),
|
||||
ORTE_PACK_MISMATCH = (ORTE_ERR_BASE - 23),
|
||||
ORTE_ERR_PACK_FAILURE = (ORTE_ERR_BASE - 24),
|
||||
ORTE_ERR_UNPACK_FAILURE = (ORTE_ERR_BASE - 25),
|
||||
ORTE_ERR_COMM_FAILURE = (ORTE_ERR_BASE - 26),
|
||||
ORTE_UNPACK_INADEQUATE_SPACE = (ORTE_ERR_BASE - 27),
|
||||
ORTE_UNPACK_READ_PAST_END_OF_BUFFER = (ORTE_ERR_BASE - 28),
|
||||
ORTE_ERR_GPR_DATA_CORRUPT = (ORTE_ERR_BASE - 29),
|
||||
ORTE_ERR_TYPE_MISMATCH = (ORTE_ERR_BASE - 30)
|
||||
};
|
||||
|
||||
#define ORTE_ERR_MAX (ORTE_ERR_BASE - 30)
|
||||
|
||||
|
||||
#endif /* ORTE_CONSTANTS_H */
|
||||
|
||||
|
@ -19,18 +19,14 @@
|
||||
|
||||
#include "orte_config.h"
|
||||
#include "mca/ns/ns_types.h"
|
||||
#include "opal/util/error.h"
|
||||
|
||||
/*
|
||||
* This macro and array are used to output intelligible error
|
||||
* messages. It is disturbing to think that we are still outputing error numbers and
|
||||
* expecting users to look them up in the "big book" to find out what they represent.
|
||||
* This macro allows the user to output an actual string representation of the error.
|
||||
*
|
||||
* * THE ACTUAL ARRAY IS INSTANTIATED IN runtime/ompi_init.c
|
||||
* messages.
|
||||
*/
|
||||
|
||||
#define ORTE_ERROR_NAME(n) orte_error_strings[-1*n]
|
||||
extern char *orte_error_strings[];
|
||||
#define ORTE_ERROR_NAME(n) opal_strerror(n)
|
||||
|
||||
/*
|
||||
* ORTE SEGMENT NAMES
|
||||
|
@ -34,6 +34,8 @@
|
||||
/* globals used by RTE */
|
||||
int orte_debug_flag=(int)false;
|
||||
|
||||
static const char * orte_err2str(int errnum);
|
||||
|
||||
int orte_init(void)
|
||||
{
|
||||
int rc;
|
||||
@ -42,6 +44,9 @@ int orte_init(void)
|
||||
ORTE_ERROR_LOG(rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* register handler for errnum -> string converstion */
|
||||
opal_error_register(orte_err2str);
|
||||
|
||||
if (ORTE_SUCCESS != (rc = orte_system_init())) {
|
||||
ORTE_ERROR_LOG(rc);
|
||||
@ -51,67 +56,103 @@ int orte_init(void)
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* This array is used to output intelligible error
|
||||
* messages. It is disturbing to think that we are still outputing error numbers and
|
||||
* expecting users to look them up in the "big book" to find out what they represent.
|
||||
* This array allows the user to output an actual string representation of the error.
|
||||
*
|
||||
* THE CORRESPONDING MACRO IS DEFINED IN include/orte_schema.h
|
||||
* AS IS THE EXTERN STATEMENT FOR ACCESSING THIS ARRAY
|
||||
*/
|
||||
static const char *
|
||||
orte_err2str(int errnum)
|
||||
{
|
||||
const char *retval;
|
||||
|
||||
char *orte_error_strings[] = {
|
||||
"ORTE_SUCCESS",
|
||||
"ORTE_ERROR",
|
||||
"ORTE_ERR_OUT_OF_RESOURCE", /* fatal error */
|
||||
"ORTE_ERR_TEMP_OUT_OF_RESOURCE", /* try again later */
|
||||
"ORTE_ERR_RESOURCE_BUSY",
|
||||
"ORTE_ERR_BAD_PARAM", /* equivalent to MPI_ERR_ARG error code */
|
||||
"ORTE_ERR_RECV_LESS_THAN_POSTED",
|
||||
"ORTE_ERR_RECV_MORE_THAN_POSTED",
|
||||
"ORTE_ERR_NO_MATCH_YET",
|
||||
"ORTE_ERR_FATAL",
|
||||
"ORTE_ERR_NOT_IMPLEMENTED",
|
||||
"ORTE_ERR_NOT_SUPPORTED",
|
||||
"ORTE_ERR_INTERUPTED",
|
||||
"ORTE_ERR_WOULD_BLOCK",
|
||||
"ORTE_ERR_IN_ERRNO",
|
||||
"ORTE_ERR_UNREACH",
|
||||
"ORTE_ERR_NOT_FOUND",
|
||||
"ORTE_ERR_BUFFER", /* equivalent to MPI_ERR_BUFFER */
|
||||
"ORTE_ERR_REQUEST", /* equivalent to MPI_ERR_REQUEST */
|
||||
"ORTE_EXISTS", /* indicates that the specified object already exists */
|
||||
"ORTE_ERR_NO_CONNECTION_ALLOWED", /* indicates that the receiving process does not allow connections */
|
||||
"ORTE_ERR_CONNECTION_REFUSED", /* contact made with process, but it refuses any further communication */
|
||||
"ORTE_ERR_CONNECTION_FAILED", /* message sent, but delivery failed */
|
||||
"ORTE_ERR_TIMEOUT",
|
||||
"ORTE_STARTUP_DETECTED",
|
||||
"ORTE_SHUTDOWN_DETECTED",
|
||||
"ORTE_PROC_STARTING",
|
||||
"ORTE_PROC_STOPPED",
|
||||
"ORTE_PROC_TERMINATING",
|
||||
"ORTE_PROC_ALIVE",
|
||||
"ORTE_PROC_RUNNING",
|
||||
"ORTE_PROC_KILLED",
|
||||
"ORTE_PROC_EXITED",
|
||||
"ORTE_NODE_UP",
|
||||
"ORTE_NODE_DOWN",
|
||||
"ORTE_NODE_BOOTING",
|
||||
"ORTE_NODE_ERROR",
|
||||
"ORTE_PACK_MISMATCH",
|
||||
"ORTE_ERR_PACK_FAILURE",
|
||||
"ORTE_ERR_UNPACK_FAILURE",
|
||||
"ORTE_ERR_COMM_FAILURE",
|
||||
"ORTE_UNPACK_INADEQUATE_SPACE",
|
||||
"ORTE_UNPACK_READ_PAST_END_OF_BUFFER",
|
||||
"ORTE_ERR_NOT_AVAILABLE",
|
||||
"ORTE_ERR_GPR_DATA_CORRUPT",
|
||||
"ORTE_ERR_PERM",
|
||||
"ORTE_ERR_TYPE_MISMATCH",
|
||||
"ORTE_ERR_VALUE_OUT_OF_BOUNDS",
|
||||
"ORTE_ERR_FILE_READ_FAILURE",
|
||||
"ORTE_ERR_FILE_WRITE_FAILURE",
|
||||
"ORTE_ERR_FILE_OPEN_FAILURE"
|
||||
};
|
||||
switch (errnum) {
|
||||
case ORTE_ERR_RECV_LESS_THAN_POSTED:
|
||||
retval = "Receive was less than posted size";
|
||||
break;
|
||||
case ORTE_ERR_RECV_MORE_THAN_POSTED:
|
||||
retval = "Receive was greater than posted size";
|
||||
break;
|
||||
case ORTE_ERR_NO_MATCH_YET:
|
||||
retval = "No match for receive posted";
|
||||
break;
|
||||
case ORTE_ERR_BUFFER:
|
||||
retval = "Buffer error";
|
||||
break;
|
||||
case ORTE_ERR_REQUEST:
|
||||
retval = "Request error";
|
||||
break;
|
||||
case ORTE_ERR_NO_CONNECTION_ALLOWED:
|
||||
retval = "No connection allowed";
|
||||
break;
|
||||
case ORTE_ERR_CONNECTION_REFUSED:
|
||||
retval = "Connection refused";
|
||||
break;
|
||||
case ORTE_ERR_CONNECTION_FAILED:
|
||||
retval = "Connection failed";
|
||||
break;
|
||||
case ORTE_STARTUP_DETECTED:
|
||||
retval = "Startup detected";
|
||||
break;
|
||||
case ORTE_SHUTDOWN_DETECTED:
|
||||
retval = "Shutdown detected";
|
||||
break;
|
||||
case ORTE_PROC_STARTING:
|
||||
retval = "Proccess starting";
|
||||
break;
|
||||
case ORTE_PROC_STOPPED:
|
||||
retval = "Proccess stopped";
|
||||
break;
|
||||
case ORTE_PROC_TERMINATING:
|
||||
retval = "Proccess terminating";
|
||||
break;
|
||||
case ORTE_PROC_ALIVE:
|
||||
retval = "Proccess alive";
|
||||
break;
|
||||
case ORTE_PROC_RUNNING:
|
||||
retval = "Process running";
|
||||
break;
|
||||
case ORTE_PROC_KILLED:
|
||||
retval = "Process killed";
|
||||
break;
|
||||
case ORTE_PROC_EXITED:
|
||||
retval = "Process exited";
|
||||
break;
|
||||
case ORTE_NODE_UP:
|
||||
retval = "Node is up";
|
||||
break;
|
||||
case ORTE_NODE_DOWN:
|
||||
retval = "Node is down";
|
||||
break;
|
||||
case ORTE_NODE_BOOTING:
|
||||
retval = "Node is booting";
|
||||
break;
|
||||
case ORTE_NODE_ERROR:
|
||||
retval = "Node is in error condition";
|
||||
break;
|
||||
case ORTE_PACK_MISMATCH:
|
||||
retval = "Pack data mismatch";
|
||||
break;
|
||||
case ORTE_ERR_PACK_FAILURE:
|
||||
retval = "Data pack failed";
|
||||
break;
|
||||
case ORTE_ERR_UNPACK_FAILURE:
|
||||
retval = "Data unpack failed";
|
||||
break;
|
||||
case ORTE_ERR_COMM_FAILURE:
|
||||
retval = "Communication failure";
|
||||
break;
|
||||
case ORTE_UNPACK_INADEQUATE_SPACE:
|
||||
retval = "Data unpack had inadequate space";
|
||||
break;
|
||||
case ORTE_UNPACK_READ_PAST_END_OF_BUFFER:
|
||||
retval = "Data unpack would read past end of buffer";
|
||||
break;
|
||||
case ORTE_ERR_GPR_DATA_CORRUPT:
|
||||
retval = "GPR data corruption";
|
||||
break;
|
||||
case ORTE_ERR_TYPE_MISMATCH:
|
||||
retval = "Type mismatch";
|
||||
break;
|
||||
default:
|
||||
retval = NULL;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ include $(top_srcdir)/test/support/Makefile.options
|
||||
|
||||
check_PROGRAMS = \
|
||||
ompi_numtostr \
|
||||
opal_error \
|
||||
opal_if \
|
||||
opal_os_path \
|
||||
opal_timer \
|
||||
@ -37,6 +38,11 @@ ompi_numtostr_LDADD = \
|
||||
$(top_builddir)/test/support/libsupport.a
|
||||
ompi_numtostr_DEPENDENCIES = $(ompi_numtostr_LDADD)
|
||||
|
||||
opal_error_SOURCES = opal_error.c
|
||||
opal_error_LDADD = \
|
||||
$(top_builddir)/opal/libopal.la
|
||||
opal_error_DEPENDENCIES = $(opal_error_LDADD)
|
||||
|
||||
opal_if_SOURCES = opal_if.c
|
||||
opal_if_LDADD = \
|
||||
$(top_builddir)/opal/libopal.la \
|
||||
|
76
test/util/opal_error.c
Обычный файл
76
test/util/opal_error.c
Обычный файл
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
*
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETDB_H
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
#include "opal/util/error.h"
|
||||
#include "opal/include/constants.h"
|
||||
#include "opal/runtime/opal.h"
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
int errors[] = { OPAL_SUCCESS,
|
||||
OPAL_ERROR,
|
||||
OPAL_ERR_OUT_OF_RESOURCE,
|
||||
OPAL_ERR_NOT_FOUND,
|
||||
OPAL_ERR_BAD_PARAM,
|
||||
OPAL_ERR_MAX + 10, /* bad value */
|
||||
1 }; /* sentinal */
|
||||
char buf[1024];
|
||||
|
||||
opal_init();
|
||||
|
||||
for (i = 0 ; errors[i] <= 0 ; ++i) {
|
||||
printf("--> error code: %d\n", errors[i]);
|
||||
opal_perror(errors[i], "perror test");
|
||||
printf("strerror test: %s\n", opal_strerror(errors[i]));
|
||||
opal_strerror_r(errors[i], buf, sizeof(buf));
|
||||
printf("strerror_r test: %s\n", buf);
|
||||
}
|
||||
|
||||
printf("--> error in errno test\n");
|
||||
errno = EINVAL;
|
||||
opal_perror(OPAL_ERR_IN_ERRNO, "perror test");
|
||||
errno = EINVAL;
|
||||
printf("strerror test: %s\n", opal_strerror(OPAL_ERR_IN_ERRNO));
|
||||
errno = EINVAL;
|
||||
opal_strerror_r(OPAL_ERR_IN_ERRNO, buf, sizeof(buf));
|
||||
printf("strerror_r test: %s\n", buf);
|
||||
|
||||
opal_finalize();
|
||||
|
||||
return 0;
|
||||
}
|
Загрузка…
x
Ссылка в новой задаче
Block a user