1
1

Check for all the RLIMIT_foo constants that we use, and update the limit checks to use the new #define values. Fix a bug where failure of some might lead to incorrect bracketing.

Refs trac:4010

This commit was SVN r30009.

The following Trac tickets were found above:
  Ticket 4010 --> https://svn.open-mpi.org/trac/ompi/ticket/4010
Этот коммит содержится в:
Ralph Castain 2013-12-20 14:09:43 +00:00
родитель 4739850931
Коммит 6e6351959d
2 изменённых файлов: 49 добавлений и 9 удалений

Просмотреть файл

@ -1053,6 +1053,46 @@ AC_INCLUDES_DEFAULT
#include <sys/resource.h>
#endif])
#
# Do we have RLIMIT_NOFILE in <sys/resources.h>? (e.g., Solaris does not)
#
AC_CHECK_DECLS([RLIMIT_NOFILE], [], [], [
AC_INCLUDES_DEFAULT
#if HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif])
#
# Do we have RLIMIT_MEMLOCK in <sys/resources.h>? (e.g., Solaris does not)
#
AC_CHECK_DECLS([RLIMIT_FSIZE], [], [], [
AC_INCLUDES_DEFAULT
#if HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif])
#
# Do we have RLIMIT_CORE in <sys/resources.h>? (e.g., Solaris does not)
#
AC_CHECK_DECLS([RLIMIT_CORE], [], [], [
AC_INCLUDES_DEFAULT
#if HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif])
#
# Do we have RLIMIT_STACK in <sys/resources.h>? (e.g., Solaris does not)
#
AC_CHECK_DECLS([RLIMIT_STACK], [], [], [
AC_INCLUDES_DEFAULT
#if HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif])
# checkpoint results
AC_CACHE_SAVE

Просмотреть файл

@ -130,8 +130,8 @@ int opal_util_init_sys_limits(char **errmsg)
* that we set the limits on #files, #children,
* and max file size
*/
#ifdef RLIMIT_NOFILE
if (0 == strcmp(lim[0], "1")) {
#ifdef HAVE_DECL_RLIMIT_NOFILE
if (OPAL_SUCCESS !=
opal_setlimit(RLIMIT_NOFILE, "max", &value)) {
*errmsg = opal_show_help_string("help-opal-util.txt", "sys-limit-failed", true, "openfiles", "max");
@ -146,30 +146,30 @@ int opal_util_init_sys_limits(char **errmsg)
}
opal_sys_limits.num_procs = value;
#endif
#ifdef RLIMIT_FSIZE
#ifdef HAVE_DECL_RLIMIT_FSIZE
if (OPAL_SUCCESS !=
opal_setlimit(RLIMIT_FSIZE, "max", &value)) {
*errmsg = opal_show_help_string("help-opal-util.txt", "sys-limit-failed", true, "filesize", "max");
return OPAL_ERROR;
}
opal_sys_limits.file_size = value;
#endif
break;
} else if (0 == strcmp(lim[0], "0")) {
/* user didn't want anything set */
goto cleanup;
break;
}
#endif
/* process them separately */
if (0 == strcmp(lim[0], "core")) {
#ifdef RLIMIT_CORE
#ifdef HAVE_DECL_RLIMIT_CORE
if (OPAL_SUCCESS != opal_setlimit(RLIMIT_CORE, setlim, &value)) {
*errmsg = opal_show_help_string("help-opal-util.txt", "sys-limit-failed", true, "openfiles", setlim);
return OPAL_ERROR;
}
#endif
} else if (0 == strcmp(lim[0], "filesize")) {
#ifdef RLIMIT_FSIZE
#ifdef HAVE_DECL_RLIMIT_FSIZE
if (OPAL_SUCCESS != opal_setlimit(RLIMIT_FSIZE, setlim, &value)) {
*errmsg = opal_show_help_string("help-opal-util.txt", "sys-limit-failed", true, "filesize", setlim);
return OPAL_ERROR;
@ -177,14 +177,14 @@ int opal_util_init_sys_limits(char **errmsg)
opal_sys_limits.file_size = value;
#endif
} else if (0 == strcmp(lim[0], "maxmem")) {
#ifdef RLIMIT_AS
#ifdef HAVE_DECL_RLIMIT_AS
if (OPAL_SUCCESS != opal_setlimit(RLIMIT_AS, setlim, &value)) {
*errmsg = opal_show_help_string("help-opal-util.txt", "sys-limit-failed", true, "maxmem", setlim);
return OPAL_ERROR;
}
#endif
} else if (0 == strcmp(lim[0], "openfiles")) {
#ifdef RLIMIT_NOFILE
#ifdef HAVE_DECL_RLIMIT_NOFILE
if (OPAL_SUCCESS != opal_setlimit(RLIMIT_NOFILE, setlim, &value)) {
*errmsg = opal_show_help_string("help-opal-util.txt", "sys-limit-failed", true, "openfiles", setlim);
return OPAL_ERROR;
@ -192,7 +192,7 @@ int opal_util_init_sys_limits(char **errmsg)
opal_sys_limits.num_files = value;
#endif
} else if (0 == strcmp(lim[0], "stacksize")) {
#ifdef RLIMIT_STACK
#ifdef HAVE_DECL_RLIMIT_STACK
if (OPAL_SUCCESS != opal_setlimit(RLIMIT_STACK, setlim, &value)) {
*errmsg = opal_show_help_string("help-opal-util.txt", "sys-limit-failed", true, "stacksize", setlim);
return OPAL_ERROR;