1
1

Per Paul Hargrove's suggestion, create an opal_pagesize function to abstract the various ways of obtaining that value. Rather than creating a separate file for only that one function, put it in a convenient place that is at least somewhat related.

Refs trac:4826

This commit was SVN r32407.

The following Trac tickets were found above:
  Ticket 4826 --> https://svn.open-mpi.org/trac/ompi/ticket/4826
Этот коммит содержится в:
Ralph Castain 2014-08-02 18:38:16 +00:00
родитель a347b19dc1
Коммит 61bf7af9d2
3 изменённых файлов: 28 добавлений и 8 удалений

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

@ -3,6 +3,7 @@
* Copyright (c) 2012 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2014 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2014 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -17,6 +18,7 @@
#include "ompi/mca/osc/base/osc_base_obj_convert.h"
#include "ompi/request/request.h"
#include "opal/class/ompi_free_list.h"
#include "opal/util/sys_limits.h"
#include "osc_sm.h"
@ -213,11 +215,8 @@ component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit
OPAL_OUTPUT_VERBOSE((1, ompi_osc_base_framework.framework_output,
"allocating shared memory region of size %ld\n", (long) size));
#ifdef HAVE_GETPAGESIZE
pagesize = getpagesize();
#else
pagesize = 4096;
#endif
/* get the pagesize */
pagesize = opal_getpagesize();
rbuf = malloc(sizeof(unsigned long) * ompi_comm_size(module->comm));
if (NULL == rbuf) return OMPI_ERR_TEMP_OUT_OF_RESOURCE;

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

@ -12,14 +12,12 @@
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2014 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
* This file is only here because some platforms have a broken strncpy
* (e.g., Itanium with RedHat Advanced Server glibc).
*/
#include "opal_config.h"
@ -38,6 +36,9 @@
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "opal/constants.h"
#include "opal/runtime/opal_params.h"
@ -224,3 +225,16 @@ int opal_util_init_sys_limits(char **errmsg)
return OPAL_SUCCESS;
}
int opal_getpagesize(void)
{
#ifdef HAVE_GETPAGESIZE
return getpagesize();
#elif defined(_SC_PAGESIZE )
return sysconf(_SC_PAGESIZE);
#elif defined(_SC_PAGE_SIZE)
return sysconf(_SC_PAGE_SIZE);
#else
return 65536; /* safer to overestimate than under */
#endif
}

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

@ -11,6 +11,7 @@
* All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2014 Intel, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -49,6 +50,12 @@ OPAL_DECLSPEC extern opal_sys_limits_t opal_sys_limits;
*/
OPAL_DECLSPEC int opal_util_init_sys_limits(char **errmsg);
/**
* Get pagesize
*/
OPAL_DECLSPEC int opal_getpagesize(void);
END_C_DECLS
#endif /* OPAL_STRNCPY_H */