Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.

Commit ec2b0cf

Browse files
committed
Merge pull request #997 from rhc54/cmr2.0/suicide
Repair the application suicide code for 2.0 - requires custom patch.
2 parents 4310b3f + 220da9c commit ec2b0cf

File tree

4 files changed

+66
-13
lines changed

4 files changed

+66
-13
lines changed

opal/mca/pmix/base/pmix_base_fns.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
44
* reserved.
5-
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
5+
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
66
* Copyright (c) 2014-2015 Research Organization for Information Science
77
* and Technology (RIST). All rights reserved.
88
* $COPYRIGHT$
@@ -31,6 +31,7 @@
3131
#include "opal/util/output.h"
3232
#include "opal/util/proc.h"
3333
#include "opal/util/show_help.h"
34+
#include "opal/errhandler/opal_errhandler.h"
3435

3536
#include "opal/mca/pmix/base/base.h"
3637
#include "opal/mca/pmix/base/pmix_base_fns.h"
@@ -61,6 +62,8 @@ void opal_pmix_base_errhandler(int status,
6162
{
6263
if (NULL != errhandler) {
6364
errhandler(status, procs, info, cbfunc, cbdata);
65+
} else {
66+
opal_invoke_errhandler(OPAL_ERROR, NULL);
6467
}
6568
}
6669

opal/mca/pmix/pmix112/pmix/src/client/pmix_client.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
22
/*
3-
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
3+
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
44
* Copyright (c) 2014-2015 Research Organization for Information Science
55
* and Technology (RIST). All rights reserved.
66
* Copyright (c) 2014 Artem Y. Polyakov <[email protected]>.
@@ -68,13 +68,6 @@ static const char pmix_version_string[] = PMIX_VERSION;
6868
#define PMIX_MAX_RETRIES 10
6969

7070
static int usock_connect(struct sockaddr *address);
71-
static void myerrhandler(pmix_status_t status,
72-
pmix_proc_t procs[], size_t nprocs,
73-
pmix_info_t info[], size_t ninfo)
74-
{
75-
pmix_output_verbose(2, pmix_globals.debug_output,
76-
"pmix:client default errhandler activated");
77-
}
7871

7972
static void pmix_client_notify_recv(struct pmix_peer_t *peer, pmix_usock_hdr_t *hdr,
8073
pmix_buffer_t *buf, void *cbdata)
@@ -262,7 +255,7 @@ int PMIx_Init(pmix_proc_t *proc)
262255
pmix_globals.uid = geteuid();
263256
pmix_globals.gid = getegid();
264257
/* default to our internal errhandler */
265-
pmix_globals.errhandler = myerrhandler;
258+
pmix_globals.errhandler = pmix_default_errhdlr;
266259

267260
/* initialize the output system */
268261
if (!pmix_output_init()) {

opal/mca/pmix/pmix112/pmix/src/common/pmix_common.c

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
22
/*
3-
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
3+
* Copyright (c) 2014-2016 Intel, Inc. All rights reserved.
44
* $COPYRIGHT$
55
*
66
* Additional copyrights may follow
@@ -18,19 +18,73 @@
1818
#include <pmix_server.h>
1919
#include "src/include/pmix_globals.h"
2020

21+
typedef struct {
22+
pmix_event_t ev;
23+
pmix_notification_fn_t errhandler;
24+
pmix_errhandler_reg_cbfunc_t cbfunc;
25+
int ref;
26+
pmix_op_cbfunc_t opcbfunc;
27+
void *cbdata;
28+
} shifter_t;
29+
30+
#define PMIX_THREADSHIFT(r, c) \
31+
do { \
32+
event_assign(&((r)->ev), pmix_globals.evbase, \
33+
-1, EV_WRITE, (c), (r)); \
34+
event_active(&((r)->ev), EV_WRITE, 1); \
35+
} while(0);
36+
37+
38+
void pmix_default_errhdlr(pmix_status_t status,
39+
pmix_proc_t procs[], size_t nprocs,
40+
pmix_info_t info[], size_t ninfo)
41+
{
42+
pmix_output_verbose(2, pmix_globals.debug_output,
43+
"pmix:client default errhandler activated");
44+
}
45+
46+
static void _register_err(int sd, short args, void *cbdata)
47+
{
48+
shifter_t *st = (shifter_t*)cbdata;
49+
50+
pmix_globals.errhandler = st->errhandler;
51+
if (NULL != st->cbfunc) {
52+
st->cbfunc(PMIX_SUCCESS, 1, st->cbdata);
53+
}
54+
free(st);
55+
}
2156
void PMIx_Register_errhandler(pmix_info_t info[], size_t ninfo,
2257
pmix_notification_fn_t errhandler,
2358
pmix_errhandler_reg_cbfunc_t cbfunc,
2459
void *cbdata)
2560
{
26-
/* common err handler registration to be added */
61+
shifter_t *st;
62+
st = (shifter_t*)malloc(sizeof(shifter_t));
63+
st->errhandler = errhandler;
64+
st->cbfunc = cbfunc;
65+
st->cbdata = cbdata;
66+
PMIX_THREADSHIFT(st, _register_err);
2767
}
2868

69+
static void _dereg_err(int sd, short args, void *cbdata)
70+
{
71+
shifter_t *st = (shifter_t*)cbdata;
72+
73+
pmix_globals.errhandler = pmix_default_errhdlr;
74+
if (NULL != st->opcbfunc) {
75+
st->opcbfunc(PMIX_SUCCESS, st->cbdata);
76+
}
77+
free(st);
78+
}
2979
void PMIx_Deregister_errhandler(int errhandler_ref,
3080
pmix_op_cbfunc_t cbfunc,
3181
void *cbdata)
3282
{
33-
/* common err handler deregistration goes here */
83+
shifter_t *st;
84+
st = (shifter_t*)malloc(sizeof(shifter_t));
85+
st->opcbfunc = cbfunc;
86+
st->cbdata = cbdata;
87+
PMIX_THREADSHIFT(st, _dereg_err);
3488
}
3589

3690
pmix_status_t PMIx_Notify_error(pmix_status_t status,

opal/mca/pmix/pmix112/pmix/src/include/pmix_globals.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ void pmix_globals_init(void);
108108
void pmix_globals_finalize(void);
109109

110110
extern pmix_globals_t pmix_globals;
111+
void pmix_default_errhdlr(pmix_status_t status,
112+
pmix_proc_t procs[], size_t nprocs,
113+
pmix_info_t info[], size_t ninfo);
111114

112115
END_C_DECLS
113116

0 commit comments

Comments
 (0)