Merge pull request #1847 from rhc54/topic/updatepmix
Update pmix2x to track upstream changes
Этот коммит содержится в:
Коммит
b7122963e1
@ -30,7 +30,7 @@ greek=
|
|||||||
# command, or with the date (if "git describe" fails) in the form of
|
# command, or with the date (if "git describe" fails) in the form of
|
||||||
# "date<date>".
|
# "date<date>".
|
||||||
|
|
||||||
repo_rev=git4940b48
|
repo_rev=git92df386
|
||||||
|
|
||||||
# If tarball_version is not empty, it is used as the version string in
|
# If tarball_version is not empty, it is used as the version string in
|
||||||
# the tarball filename, regardless of all other versions listed in
|
# the tarball filename, regardless of all other versions listed in
|
||||||
@ -44,7 +44,7 @@ tarball_version=
|
|||||||
|
|
||||||
# The date when this release was created
|
# The date when this release was created
|
||||||
|
|
||||||
date="Jun 29, 2016"
|
date="Jul 05, 2016"
|
||||||
|
|
||||||
# The shared library version of each of PMIx's public libraries.
|
# The shared library version of each of PMIx's public libraries.
|
||||||
# These versions are maintained in accordance with the "Library
|
# These versions are maintained in accordance with the "Library
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
|
# Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
|
||||||
# Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved.
|
# Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved.
|
||||||
# Copyright (c) 2013-2015 Intel, Inc. All rights reserved
|
# Copyright (c) 2013-2016 Intel, Inc. All rights reserved
|
||||||
# $COPYRIGHT$
|
# $COPYRIGHT$
|
||||||
#
|
#
|
||||||
# Additional copyrights may follow
|
# Additional copyrights may follow
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
|
# Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
|
||||||
# Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved.
|
# Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved.
|
||||||
# Copyright (c) 2013-2015 Intel, Inc. All rights reserved
|
# Copyright (c) 2013-2016 Intel, Inc. All rights reserved
|
||||||
# $COPYRIGHT$
|
# $COPYRIGHT$
|
||||||
#
|
#
|
||||||
# Additional copyrights may follow
|
# Additional copyrights may follow
|
||||||
|
@ -206,12 +206,12 @@ BEGIN_C_DECLS
|
|||||||
#define PMIX_EVENT_CUSTOM_RANGE "pmix.evrange" // (pmix_proc_t*) array of pmix_proc_t defining range of event notification
|
#define PMIX_EVENT_CUSTOM_RANGE "pmix.evrange" // (pmix_proc_t*) array of pmix_proc_t defining range of event notification
|
||||||
#define PMIX_EVENT_AFFECTED_PROCS "pmix.evaffected" // (pmix_proc_t*) array of pmix_proc_t defining affected procs
|
#define PMIX_EVENT_AFFECTED_PROCS "pmix.evaffected" // (pmix_proc_t*) array of pmix_proc_t defining affected procs
|
||||||
#define PMIX_EVENT_NON_DEFAULT "pmix.evnondef" // (bool) event is not to be delivered to default event handlers
|
#define PMIX_EVENT_NON_DEFAULT "pmix.evnondef" // (bool) event is not to be delivered to default event handlers
|
||||||
/* fault tolerance-related events */
|
/* fault tolerance-related events */
|
||||||
#define PMIX_EVENT_TERMINATE_SESSION "pmix.evterm.sess" // (bool) RM intends to terminate session
|
#define PMIX_EVENT_TERMINATE_SESSION "pmix.evterm.sess" // (bool) RM intends to terminate session
|
||||||
#define PMIX_EVENT_TERMINATE_JOB "pmix.evterm.job" // (bool) RM intends to terminate this job
|
#define PMIX_EVENT_TERMINATE_JOB "pmix.evterm.job" // (bool) RM intends to terminate this job
|
||||||
#define PMIX_EVENT_TERMINATE_NODE "pmix.evterm.node" // (bool) RM intends to terminate all procs on this node
|
#define PMIX_EVENT_TERMINATE_NODE "pmix.evterm.node" // (bool) RM intends to terminate all procs on this node
|
||||||
#define PMIX_EVENT_TERMINATE_PROC "pmix.evterm.proc" // (bool) RM intends to terminate just this process
|
#define PMIX_EVENT_TERMINATE_PROC "pmix.evterm.proc" // (bool) RM intends to terminate just this process
|
||||||
#define PMIX_EVENT_ACTION_TIMEOUT "pmix.evtimeout" // (int) time in sec before RM will execute error response
|
#define PMIX_EVENT_ACTION_TIMEOUT "pmix.evtimeout" // (int) time in sec before RM will execute error response
|
||||||
|
|
||||||
/* attributes used to describe "spawn" attributes */
|
/* attributes used to describe "spawn" attributes */
|
||||||
#define PMIX_PERSONALITY "pmix.pers" // (char*) name of personality to use
|
#define PMIX_PERSONALITY "pmix.pers" // (char*) name of personality to use
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
|
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
|
||||||
* Copyright (c) 2016 Research Organization for Information Science
|
|
||||||
* and Technology (RIST). All rights reserved.
|
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
* Additional copyrights may follow
|
* Additional copyrights may follow
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
|
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
|
||||||
* Copyright (c) 2014-2015 Research Organization for Information Science
|
* Copyright (c) 2014-2016 Research Organization for Information Science
|
||||||
* and Technology (RIST). All rights reserved.
|
* and Technology (RIST). All rights reserved.
|
||||||
* Copyright (c) 2014-2015 Artem Y. Polyakov <artpol84@gmail.com>.
|
* Copyright (c) 2014-2015 Artem Y. Polyakov <artpol84@gmail.com>.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@ -227,7 +227,8 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module,
|
|||||||
size_t n, m;
|
size_t n, m;
|
||||||
pmix_kval_t kv;
|
pmix_kval_t kv;
|
||||||
pmix_listener_t *lt;
|
pmix_listener_t *lt;
|
||||||
int myhostnamelen = 10;
|
bool need_listener;
|
||||||
|
int myhostnamelen = 30;
|
||||||
char myhostname[myhostnamelen];
|
char myhostname[myhostnamelen];
|
||||||
char *pmix_pid, *tdir;
|
char *pmix_pid, *tdir;
|
||||||
char **protected = NULL;
|
char **protected = NULL;
|
||||||
@ -291,8 +292,10 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module,
|
|||||||
pmix_listener_t *tl = PMIX_NEW(pmix_listener_t);
|
pmix_listener_t *tl = PMIX_NEW(pmix_listener_t);
|
||||||
tl -> address.sun_family = AF_UNIX;
|
tl -> address.sun_family = AF_UNIX;
|
||||||
tl->protocol = PMIX_PROTOCOL_TOOL;
|
tl->protocol = PMIX_PROTOCOL_TOOL;
|
||||||
/* Get up to 10 chars of hostname.*/
|
/* Get up to 30 chars of hostname.*/
|
||||||
gethostname(myhostname, myhostnamelen);
|
gethostname(myhostname, myhostnamelen);
|
||||||
|
/* ensure it is NULL terminated */
|
||||||
|
myhostname[myhostnamelen-1] = '\0';
|
||||||
/* need to put this in the global tmpdir as opposed to
|
/* need to put this in the global tmpdir as opposed to
|
||||||
* where the server tmpdir might be */
|
* where the server tmpdir might be */
|
||||||
if (NULL == (tdir = getenv("TMPDIR"))) {
|
if (NULL == (tdir = getenv("TMPDIR"))) {
|
||||||
@ -328,8 +331,15 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module,
|
|||||||
pmix_list_append(&pmix_usock_globals.posted_recvs, &req->super);
|
pmix_list_append(&pmix_usock_globals.posted_recvs, &req->super);
|
||||||
|
|
||||||
/* start listening */
|
/* start listening */
|
||||||
|
need_listener = false;
|
||||||
PMIX_LIST_FOREACH(lt, &pmix_server_globals.listeners, pmix_listener_t) {
|
PMIX_LIST_FOREACH(lt, &pmix_server_globals.listeners, pmix_listener_t) {
|
||||||
if (PMIX_SUCCESS != pmix_start_listening(lt)) {
|
if (PMIX_SUCCESS != pmix_prepare_listening(lt, &need_listener)) {
|
||||||
|
PMIx_server_finalize();
|
||||||
|
return PMIX_ERR_INIT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (need_listener) {
|
||||||
|
if (PMIX_SUCCESS != pmix_start_listening()) {
|
||||||
PMIx_server_finalize();
|
PMIx_server_finalize();
|
||||||
return PMIX_ERR_INIT;
|
return PMIX_ERR_INIT;
|
||||||
}
|
}
|
||||||
@ -2007,6 +2017,7 @@ static void notifyerror_cbfunc (pmix_status_t status, void *cbdata)
|
|||||||
PMIX_RELEASE(cd);
|
PMIX_RELEASE(cd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void query_cbfunc(pmix_status_t status,
|
static void query_cbfunc(pmix_status_t status,
|
||||||
pmix_info_t *info, size_t ninfo,
|
pmix_info_t *info, size_t ninfo,
|
||||||
void *cbdata,
|
void *cbdata,
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
#include "src/util/argv.h"
|
#include "src/util/argv.h"
|
||||||
#include "src/util/error.h"
|
#include "src/util/error.h"
|
||||||
#include "src/util/fd.h"
|
#include "src/util/fd.h"
|
||||||
|
#include "src/util/getid.h"
|
||||||
#include "src/util/output.h"
|
#include "src/util/output.h"
|
||||||
#include "src/util/pmix_environ.h"
|
#include "src/util/pmix_environ.h"
|
||||||
#include "src/util/progress_threads.h"
|
#include "src/util/progress_threads.h"
|
||||||
@ -73,7 +74,7 @@ static pthread_t engine;
|
|||||||
/*
|
/*
|
||||||
* start listening on our rendezvous file
|
* start listening on our rendezvous file
|
||||||
*/
|
*/
|
||||||
pmix_status_t pmix_start_listening(pmix_listener_t *lt)
|
pmix_status_t pmix_prepare_listening(pmix_listener_t *lt, bool *need_listener)
|
||||||
{
|
{
|
||||||
int flags;
|
int flags;
|
||||||
pmix_status_t rc;
|
pmix_status_t rc;
|
||||||
@ -95,7 +96,6 @@ pmix_status_t pmix_start_listening(pmix_listener_t *lt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
addrlen = sizeof(struct sockaddr_un);
|
addrlen = sizeof(struct sockaddr_un);
|
||||||
if (bind(lt->socket, (struct sockaddr*)address, addrlen) < 0) {
|
if (bind(lt->socket, (struct sockaddr*)address, addrlen) < 0) {
|
||||||
printf("%s:%d bind() failed\n", __FILE__, __LINE__);
|
printf("%s:%d bind() failed\n", __FILE__, __LINE__);
|
||||||
@ -137,6 +137,7 @@ pmix_status_t pmix_start_listening(pmix_listener_t *lt)
|
|||||||
goto sockerror;
|
goto sockerror;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (NULL == myversion) {
|
||||||
/* setup my version for validating connections - we
|
/* setup my version for validating connections - we
|
||||||
* only check the major version numbers */
|
* only check the major version numbers */
|
||||||
myversion = strdup(PMIX_VERSION);
|
myversion = strdup(PMIX_VERSION);
|
||||||
@ -149,6 +150,7 @@ pmix_status_t pmix_start_listening(pmix_listener_t *lt)
|
|||||||
*ptr = '\0';
|
*ptr = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* if the server will listen for us, then ask it to do so now */
|
/* if the server will listen for us, then ask it to do so now */
|
||||||
rc = PMIX_ERR_NOT_SUPPORTED;
|
rc = PMIX_ERR_NOT_SUPPORTED;
|
||||||
@ -157,6 +159,18 @@ pmix_status_t pmix_start_listening(pmix_listener_t *lt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (PMIX_SUCCESS != rc && !pmix_server_globals.listen_thread_active) {
|
if (PMIX_SUCCESS != rc && !pmix_server_globals.listen_thread_active) {
|
||||||
|
*need_listener = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return PMIX_SUCCESS;
|
||||||
|
|
||||||
|
sockerror:
|
||||||
|
(void)close(lt->socket);
|
||||||
|
lt->socket = -1;
|
||||||
|
return PMIX_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
pmix_status_t pmix_start_listening(void) {
|
||||||
/*** spawn internal listener thread */
|
/*** spawn internal listener thread */
|
||||||
if (0 > pipe(pmix_server_globals.stop_thread)) {
|
if (0 > pipe(pmix_server_globals.stop_thread)) {
|
||||||
PMIX_ERROR_LOG(PMIX_ERR_IN_ERRNO);
|
PMIX_ERROR_LOG(PMIX_ERR_IN_ERRNO);
|
||||||
@ -172,20 +186,13 @@ pmix_status_t pmix_start_listening(pmix_listener_t *lt)
|
|||||||
return PMIX_ERR_OUT_OF_RESOURCE;
|
return PMIX_ERR_OUT_OF_RESOURCE;
|
||||||
}
|
}
|
||||||
/* fork off the listener thread */
|
/* fork off the listener thread */
|
||||||
|
pmix_server_globals.listen_thread_active = true;
|
||||||
if (0 > pthread_create(&engine, NULL, listen_thread, NULL)) {
|
if (0 > pthread_create(&engine, NULL, listen_thread, NULL)) {
|
||||||
pmix_server_globals.listen_thread_active = false;
|
pmix_server_globals.listen_thread_active = false;
|
||||||
return PMIX_ERROR;
|
return PMIX_ERROR;
|
||||||
} else {
|
|
||||||
pmix_server_globals.listen_thread_active = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return PMIX_SUCCESS;
|
return PMIX_SUCCESS;
|
||||||
|
|
||||||
sockerror:
|
|
||||||
(void)close(lt->socket);
|
|
||||||
lt->socket = -1;
|
|
||||||
return PMIX_ERROR;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void pmix_stop_listening(void)
|
void pmix_stop_listening(void)
|
||||||
@ -533,6 +540,8 @@ static pmix_status_t pmix_server_authenticate(pmix_pending_connection_t *pnd,
|
|||||||
pmix_peer_t *psave = NULL;
|
pmix_peer_t *psave = NULL;
|
||||||
bool found;
|
bool found;
|
||||||
pmix_proc_t proc;
|
pmix_proc_t proc;
|
||||||
|
uid_t uid;
|
||||||
|
gid_t gid;
|
||||||
|
|
||||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||||
"RECV CONNECT ACK FROM PEER ON SOCKET %d",
|
"RECV CONNECT ACK FROM PEER ON SOCKET %d",
|
||||||
@ -720,9 +729,24 @@ static pmix_status_t pmix_server_authenticate(pmix_pending_connection_t *pnd,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
/* get the tool socket's uid and gid so we can pass them to
|
||||||
|
* the host RM for validation */
|
||||||
|
if (PMIX_SUCCESS != (rc = pmix_util_getid(pnd->sd, &uid, &gid))) {
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
/* we pass this info in an array of pmix_info_t structs,
|
||||||
|
* so set that up here */
|
||||||
|
pnd->ninfo = 2;
|
||||||
|
PMIX_INFO_CREATE(pnd->info, pnd->ninfo);
|
||||||
|
(void)strncpy(pnd->info[0].key, PMIX_USERID, PMIX_MAX_KEYLEN);
|
||||||
|
pnd->info[0].value.type = PMIX_UINT32;
|
||||||
|
pnd->info[0].value.data.uint32 = uid;
|
||||||
|
(void)strncpy(pnd->info[1].key, PMIX_GRPID, PMIX_MAX_KEYLEN);
|
||||||
|
pnd->info[0].value.type = PMIX_UINT32;
|
||||||
|
pnd->info[0].value.data.uint32 = gid;
|
||||||
/* request an nspace for this requestor - it will
|
/* request an nspace for this requestor - it will
|
||||||
* automatically be assigned rank=0 */
|
* automatically be assigned rank=0 */
|
||||||
pmix_host_server.tool_connected(NULL, 0, cnct_cbfunc, pnd);
|
pmix_host_server.tool_connected(pnd->info, pnd->ninfo, cnct_cbfunc, pnd);
|
||||||
return PMIX_ERR_OPERATION_IN_PROGRESS;
|
return PMIX_ERR_OPERATION_IN_PROGRESS;
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
@ -799,7 +823,6 @@ static void tool_handler(int sd, short flags, void* cbdata)
|
|||||||
|
|
||||||
/* initiate the authentication handshake */
|
/* initiate the authentication handshake */
|
||||||
if (PMIX_ERR_OPERATION_IN_PROGRESS != pmix_server_authenticate(pnd, NULL, NULL)) {
|
if (PMIX_ERR_OPERATION_IN_PROGRESS != pmix_server_authenticate(pnd, NULL, NULL)) {
|
||||||
pmix_output(0, "SHOOT");
|
|
||||||
CLOSE_THE_SOCKET(pnd->sd);
|
CLOSE_THE_SOCKET(pnd->sd);
|
||||||
PMIX_RELEASE(pnd);
|
PMIX_RELEASE(pnd);
|
||||||
}
|
}
|
||||||
|
17
opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_ops.c
Исполняемый файл → Обычный файл
17
opal/mca/pmix/pmix2x/pmix/src/server/pmix_server_ops.c
Исполняемый файл → Обычный файл
@ -1118,7 +1118,7 @@ pmix_status_t pmix_server_register_events(pmix_peer_t *peer,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||||
"server register events: ninfo =%lu rc =%d", ninfo, rc);
|
"server register events: ninfo =%lu rc =%d", ninfo, rc);
|
||||||
/* be sure to execute the callback */
|
/* be sure to execute the callback */
|
||||||
@ -1175,7 +1175,8 @@ void pmix_server_deregister_events(pmix_peer_t *peer,
|
|||||||
{
|
{
|
||||||
int32_t cnt;
|
int32_t cnt;
|
||||||
pmix_status_t rc, *codes = NULL, *cdptr, maxcode = PMIX_MAX_ERR_CONSTANT;
|
pmix_status_t rc, *codes = NULL, *cdptr, maxcode = PMIX_MAX_ERR_CONSTANT;
|
||||||
size_t ncodes, ncds, n;
|
pmix_info_t *info = NULL;
|
||||||
|
size_t ninfo=0, ncodes, ncds, n;
|
||||||
pmix_regevents_info_t *reginfo = NULL;
|
pmix_regevents_info_t *reginfo = NULL;
|
||||||
pmix_regevents_info_t *reginfo_next;
|
pmix_regevents_info_t *reginfo_next;
|
||||||
pmix_peer_events_info_t *prev;
|
pmix_peer_events_info_t *prev;
|
||||||
@ -1230,11 +1231,13 @@ void pmix_server_deregister_events(pmix_peer_t *peer,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (NULL != codes) {
|
if (NULL != codes) {
|
||||||
free(codes);
|
free(codes);
|
||||||
}
|
}
|
||||||
|
if (NULL != info) {
|
||||||
|
PMIX_INFO_FREE(info, ninfo);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1384,7 +1387,6 @@ pmix_status_t pmix_server_query(pmix_peer_t *peer,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***** INSTANCE SERVER LIBRARY CLASSES *****/
|
/***** INSTANCE SERVER LIBRARY CLASSES *****/
|
||||||
static void tcon(pmix_server_trkr_t *t)
|
static void tcon(pmix_server_trkr_t *t)
|
||||||
{
|
{
|
||||||
@ -1520,13 +1522,14 @@ PMIX_CLASS_INSTANCE(pmix_dmdx_local_t,
|
|||||||
|
|
||||||
static void pccon(pmix_pending_connection_t *p)
|
static void pccon(pmix_pending_connection_t *p)
|
||||||
{
|
{
|
||||||
p->msg = NULL;
|
|
||||||
memset(p->nspace, 0, PMIX_MAX_NSLEN+1);
|
memset(p->nspace, 0, PMIX_MAX_NSLEN+1);
|
||||||
|
p->info = NULL;
|
||||||
|
p->ninfo = 0;
|
||||||
}
|
}
|
||||||
static void pcdes(pmix_pending_connection_t *p)
|
static void pcdes(pmix_pending_connection_t *p)
|
||||||
{
|
{
|
||||||
if (NULL != p->msg) {
|
if (NULL != p->info) {
|
||||||
free(p->msg);
|
PMIX_INFO_FREE(p->info, p->ninfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PMIX_CLASS_INSTANCE(pmix_pending_connection_t,
|
PMIX_CLASS_INSTANCE(pmix_pending_connection_t,
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
* Copyright (c) 2015 Mellanox Technologies, Inc.
|
* Copyright (c) 2015 Mellanox Technologies, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
* Copyright (c) 2016 IBM Corporation. All rights reserved.
|
* Copyright (c) 2016 IBM Corporation. All rights reserved.
|
||||||
|
* Copyright (c) 2016 Research Organization for Information Science
|
||||||
|
* and Technology (RIST). All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -97,7 +99,8 @@ typedef struct {
|
|||||||
pmix_listener_protocol_t protocol;
|
pmix_listener_protocol_t protocol;
|
||||||
int sd;
|
int sd;
|
||||||
char nspace[PMIX_MAX_NSLEN+1];
|
char nspace[PMIX_MAX_NSLEN+1];
|
||||||
char *msg;
|
pmix_info_t *info;
|
||||||
|
size_t ninfo;
|
||||||
pmix_status_t status;
|
pmix_status_t status;
|
||||||
struct sockaddr_storage addr;
|
struct sockaddr_storage addr;
|
||||||
} pmix_pending_connection_t;
|
} pmix_pending_connection_t;
|
||||||
@ -212,7 +215,8 @@ PMIX_CLASS_DECLARATION(pmix_usock_queue_t);
|
|||||||
event_active(&queue->ev, EV_WRITE, 1); \
|
event_active(&queue->ev, EV_WRITE, 1); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
pmix_status_t pmix_start_listening(pmix_listener_t *lt);
|
pmix_status_t pmix_prepare_listening(pmix_listener_t *lt, bool *need_listener);
|
||||||
|
pmix_status_t pmix_start_listening(void);
|
||||||
void pmix_stop_listening(void);
|
void pmix_stop_listening(void);
|
||||||
|
|
||||||
bool pmix_server_trk_update(pmix_server_trkr_t *trk);
|
bool pmix_server_trk_update(pmix_server_trkr_t *trk);
|
||||||
@ -279,15 +283,15 @@ pmix_status_t pmix_server_register_events(pmix_peer_t *peer,
|
|||||||
void pmix_server_deregister_events(pmix_peer_t *peer,
|
void pmix_server_deregister_events(pmix_peer_t *peer,
|
||||||
pmix_buffer_t *buf);
|
pmix_buffer_t *buf);
|
||||||
|
|
||||||
pmix_status_t pmix_server_event_recvd_from_client(pmix_peer_t *peer,
|
|
||||||
pmix_buffer_t *buf,
|
|
||||||
pmix_op_cbfunc_t cbfunc,
|
|
||||||
void *cbdata);
|
|
||||||
pmix_status_t pmix_server_query(pmix_peer_t *peer,
|
pmix_status_t pmix_server_query(pmix_peer_t *peer,
|
||||||
pmix_buffer_t *buf,
|
pmix_buffer_t *buf,
|
||||||
pmix_info_cbfunc_t cbfunc,
|
pmix_info_cbfunc_t cbfunc,
|
||||||
void *cbdata);
|
void *cbdata);
|
||||||
|
|
||||||
|
pmix_status_t pmix_server_event_recvd_from_client(pmix_peer_t *peer,
|
||||||
|
pmix_buffer_t *buf,
|
||||||
|
pmix_op_cbfunc_t cbfunc,
|
||||||
|
void *cbdata);
|
||||||
void pmix_server_execute_collective(int sd, short args, void *cbdata);
|
void pmix_server_execute_collective(int sd, short args, void *cbdata);
|
||||||
|
|
||||||
void pmix_server_queue_message(int fd, short args, void *cbdata);
|
void pmix_server_queue_message(int fd, short args, void *cbdata);
|
||||||
|
@ -190,12 +190,11 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc,
|
|||||||
pmix_status_t rc;
|
pmix_status_t rc;
|
||||||
pmix_nspace_t *nptr, *nsptr;
|
pmix_nspace_t *nptr, *nsptr;
|
||||||
int server_pid = -1;
|
int server_pid = -1;
|
||||||
int hostnamelen = 10;
|
int hostnamelen = 30;
|
||||||
char hostname[hostnamelen];
|
char hostname[hostnamelen];
|
||||||
DIR *cur_dirp = NULL;
|
DIR *cur_dirp = NULL;
|
||||||
struct dirent * dir_entry;
|
struct dirent * dir_entry;
|
||||||
|
|
||||||
pmix_output(0, "TOOL INIT");
|
|
||||||
if (NULL == proc) {
|
if (NULL == proc) {
|
||||||
return PMIX_ERR_BAD_PARAM;
|
return PMIX_ERR_BAD_PARAM;
|
||||||
}
|
}
|
||||||
@ -260,8 +259,10 @@ pmix_output(0, "TOOL INIT");
|
|||||||
/* setup the path to the daemon rendezvous point */
|
/* setup the path to the daemon rendezvous point */
|
||||||
memset(&address, 0, sizeof(struct sockaddr_un));
|
memset(&address, 0, sizeof(struct sockaddr_un));
|
||||||
address.sun_family = AF_UNIX;
|
address.sun_family = AF_UNIX;
|
||||||
/* Get first 10 char's of hostname to match what the server is doing */
|
/* Get hostname to match what the server is doing */
|
||||||
gethostname(hostname, hostnamelen);
|
gethostname(hostname, hostnamelen);
|
||||||
|
/* ensure it is NULL terminated */
|
||||||
|
hostname[hostnamelen-1] = '\0';
|
||||||
|
|
||||||
/* if they gave us a specific pid, then look for that
|
/* if they gave us a specific pid, then look for that
|
||||||
* particular server - otherwise, see if there is only
|
* particular server - otherwise, see if there is only
|
||||||
@ -787,7 +788,6 @@ static pmix_status_t recv_connect_ack(int sd)
|
|||||||
|
|
||||||
if (sockopt) {
|
if (sockopt) {
|
||||||
if (0 != setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, &save, sz)) {
|
if (0 != setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, &save, sz)) {
|
||||||
pmix_output(0, "FAILURE");
|
|
||||||
return PMIX_ERR_UNREACH;
|
return PMIX_ERR_UNREACH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -227,7 +227,7 @@ void pmix_usock_send_handler(int sd, short flags, void *cbdata)
|
|||||||
pmix_output_verbose(2, pmix_globals.debug_output,
|
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||||
"sock:send_handler SENDING TO PEER %s:%d tag %d with %s msg",
|
"sock:send_handler SENDING TO PEER %s:%d tag %d with %s msg",
|
||||||
peer->info->nptr->nspace, peer->info->rank,
|
peer->info->nptr->nspace, peer->info->rank,
|
||||||
(NULL == msg) ? -1 : msg->hdr.tag,
|
(NULL == msg) ? UINT_MAX : msg->hdr.tag,
|
||||||
(NULL == msg) ? "NULL" : "NON-NULL");
|
(NULL == msg) ? "NULL" : "NON-NULL");
|
||||||
if (NULL != msg) {
|
if (NULL != msg) {
|
||||||
if (!msg->hdr_sent) {
|
if (!msg->hdr_sent) {
|
||||||
|
@ -35,7 +35,8 @@ headers += \
|
|||||||
src/util/os_path.h \
|
src/util/os_path.h \
|
||||||
src/util/basename.h \
|
src/util/basename.h \
|
||||||
src/util/hash.h \
|
src/util/hash.h \
|
||||||
src/util/strnlen.h
|
src/util/strnlen.h \
|
||||||
|
src/util/getid.h
|
||||||
|
|
||||||
sources += \
|
sources += \
|
||||||
src/util/argv.c \
|
src/util/argv.c \
|
||||||
@ -49,4 +50,5 @@ sources += \
|
|||||||
src/util/timings.c \
|
src/util/timings.c \
|
||||||
src/util/os_path.c \
|
src/util/os_path.c \
|
||||||
src/util/basename.c \
|
src/util/basename.c \
|
||||||
src/util/hash.c
|
src/util/hash.c \
|
||||||
|
src/util/getid.c
|
||||||
|
86
opal/mca/pmix/pmix2x/pmix/src/util/getid.c
Обычный файл
86
opal/mca/pmix/pmix2x/pmix/src/util/getid.c
Обычный файл
@ -0,0 +1,86 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||||
|
* University Research and Technology
|
||||||
|
* Corporation. All rights reserved.
|
||||||
|
* Copyright (c) 2004-2013 The University of Tennessee and The University
|
||||||
|
* of Tennessee Research Foundation. 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 (c) 2007 Cisco Systems, Inc. All rights reserved.
|
||||||
|
* Copyright (c) 2015 Intel, Inc. All rights reserved.
|
||||||
|
* $COPYRIGHT$
|
||||||
|
*
|
||||||
|
* Additional copyrights may follow
|
||||||
|
*
|
||||||
|
* $HEADER$
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Buffer safe printf functions for portability to archaic platforms.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <src/include/pmix_config.h>
|
||||||
|
#include "include/pmix/pmix_common.h"
|
||||||
|
#include "src/include/pmix_socket_errno.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_SYS_TYPES_H
|
||||||
|
#include <sys/types.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "src/include/pmix_globals.h"
|
||||||
|
#include "src/util/error.h"
|
||||||
|
#include "src/util/output.h"
|
||||||
|
|
||||||
|
#include "src/util/getid.h"
|
||||||
|
|
||||||
|
pmix_status_t pmix_util_getid(int sd, uid_t *uid, gid_t *gid)
|
||||||
|
{
|
||||||
|
#if defined(SO_PEERCRED)
|
||||||
|
#ifdef HAVE_STRUCT_SOCKPEERCRED_UID
|
||||||
|
#define HAVE_STRUCT_UCRED_UID
|
||||||
|
struct sockpeercred ucred;
|
||||||
|
#else
|
||||||
|
struct ucred ucred;
|
||||||
|
#endif
|
||||||
|
socklen_t crlen = sizeof (ucred);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(SO_PEERCRED) && (defined(HAVE_STRUCT_UCRED_UID) || defined(HAVE_STRUCT_UCRED_CR_UID))
|
||||||
|
/* Ignore received 'cred' and validate ucred for socket instead. */
|
||||||
|
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||||
|
"getid: checking getsockopt for peer credentials");
|
||||||
|
if (getsockopt(sd, SOL_SOCKET, SO_PEERCRED, &ucred, &crlen) < 0) {
|
||||||
|
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||||
|
"getid: getsockopt SO_PEERCRED failed: %s",
|
||||||
|
strerror (pmix_socket_errno));
|
||||||
|
return PMIX_ERR_INVALID_CRED;
|
||||||
|
}
|
||||||
|
#if defined(HAVE_STRUCT_UCRED_UID)
|
||||||
|
*uid = ucred.uid;
|
||||||
|
*gid = ucred.gid;
|
||||||
|
#else
|
||||||
|
*uid = ucred.cr_uid;
|
||||||
|
*gid = ucred.cr_gid;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#elif defined(HAVE_GETPEEREID)
|
||||||
|
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||||
|
"getid: checking getpeereid for peer credentials");
|
||||||
|
if (0 != getpeereid(sd, uid, gid)) {
|
||||||
|
pmix_output_verbose(2, pmix_globals.debug_output,
|
||||||
|
"getid: getsockopt getpeereid failed: %s",
|
||||||
|
strerror (pmix_socket_errno));
|
||||||
|
return PMIX_ERR_INVALID_CRED;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return PMIX_ERR_NOT_SUPPORTED;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return PMIX_SUCCESS;
|
||||||
|
}
|
31
opal/mca/pmix/pmix2x/pmix/src/util/getid.h
Обычный файл
31
opal/mca/pmix/pmix2x/pmix/src/util/getid.h
Обычный файл
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2016 Intel, Inc. All rights reserved.
|
||||||
|
* $COPYRIGHT$
|
||||||
|
*
|
||||||
|
* Additional copyrights may follow
|
||||||
|
*
|
||||||
|
* $HEADER$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PMIX_GETID_H
|
||||||
|
#define PMIX_GETID_H
|
||||||
|
|
||||||
|
#include <src/include/pmix_config.h>
|
||||||
|
#include "include/pmix/pmix_common.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_SYS_TYPES_H
|
||||||
|
#include <sys/types.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
BEGIN_C_DECLS
|
||||||
|
|
||||||
|
/* lookup the effective uid and gid of a socket */
|
||||||
|
pmix_status_t pmix_util_getid(int sd, uid_t *uid, gid_t *gid);
|
||||||
|
|
||||||
|
END_C_DECLS
|
||||||
|
|
||||||
|
#endif /* PMIX_PRINTF_H */
|
||||||
|
|
@ -83,7 +83,7 @@ static pmix_status_t disconnect_fn(const pmix_proc_t procs[], size_t nprocs,
|
|||||||
static pmix_status_t register_event_fn(pmix_status_t *codes, size_t ncodes,
|
static pmix_status_t register_event_fn(pmix_status_t *codes, size_t ncodes,
|
||||||
const pmix_info_t info[], size_t ninfo,
|
const pmix_info_t info[], size_t ninfo,
|
||||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||||
static pmix_status_t deregister_event_fn(pmix_status_t *codes, size_t ncodes,
|
static pmix_status_t deregister_events(pmix_status_t *codes, size_t ncodes,
|
||||||
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
pmix_op_cbfunc_t cbfunc, void *cbdata);
|
||||||
static pmix_status_t notify_event(pmix_status_t code,
|
static pmix_status_t notify_event(pmix_status_t code,
|
||||||
const pmix_proc_t *source,
|
const pmix_proc_t *source,
|
||||||
@ -112,7 +112,7 @@ static pmix_server_module_t mymodule = {
|
|||||||
.connect = connect_fn,
|
.connect = connect_fn,
|
||||||
.disconnect = disconnect_fn,
|
.disconnect = disconnect_fn,
|
||||||
.register_events = register_event_fn,
|
.register_events = register_event_fn,
|
||||||
.deregister_events = deregister_event_fn,
|
.deregister_events = deregister_events,
|
||||||
.notify_event = notify_event,
|
.notify_event = notify_event,
|
||||||
.query = query_fn,
|
.query = query_fn,
|
||||||
.tool_connected = tool_connect_fn
|
.tool_connected = tool_connect_fn
|
||||||
@ -687,13 +687,9 @@ static pmix_status_t register_event_fn(pmix_status_t *codes, size_t ncodes,
|
|||||||
return PMIX_SUCCESS;
|
return PMIX_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static pmix_status_t deregister_event_fn(pmix_status_t *codes, size_t ncodes,
|
static pmix_status_t deregister_events(pmix_status_t *codes, size_t ncodes,
|
||||||
pmix_op_cbfunc_t cbfunc, void *cbdata)
|
pmix_op_cbfunc_t cbfunc, void *cbdata)
|
||||||
{
|
{
|
||||||
pmix_output(0, "SERVER: DEREGISTER EVENT");
|
|
||||||
if (NULL != cbfunc) {
|
|
||||||
cbfunc(PMIX_SUCCESS, cbdata);
|
|
||||||
}
|
|
||||||
return PMIX_SUCCESS;
|
return PMIX_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user