59
59
// TODO(skg) Address FT case at some point. Need to have a broader conversion
60
60
// about how we go about doing this. Ralph has some ideas.
61
61
62
+ // TODO(skg) Consider using mprotect.
63
+ // TODO(skg) We way need to implement a different hash table.
64
+
62
65
/* *
63
66
* Key names used to find shared-memory segment info.
64
67
*/
@@ -270,6 +273,7 @@ job_construct(
270
273
) {
271
274
job->nspace_id = NULL ;
272
275
job->nspace = NULL ;
276
+ job->ffgds = NULL ;
273
277
job->shmem = PMIX_NEW (pmix_shmem_t );
274
278
job->smdata = NULL ;
275
279
}
@@ -284,6 +288,7 @@ job_destruct(
284
288
if (job->nspace ) {
285
289
PMIX_RELEASE (job->nspace );
286
290
}
291
+ job->ffgds = NULL ;
287
292
// This will release the memory for the structures located in the
288
293
// shared-memory segment.
289
294
if (job->shmem ) {
@@ -959,6 +964,13 @@ store_job_info(
959
964
// Update the TMA to point to its local function pointers.
960
965
tma_init_function_pointers (&job->smdata ->tma );
961
966
pmix_gds_shmem_vout_smdata (job);
967
+ // Proctect memory: clients can only read from here.
968
+ #if 0
969
+ mprotect(
970
+ job->shmem->base_address,
971
+ job->shmem->size, PROT_READ
972
+ );
973
+ #endif
962
974
// Done. Before this point the server should have populated the
963
975
// shared-memory segment with the relevant data.
964
976
return rc;
@@ -970,9 +982,18 @@ store(
970
982
pmix_scope_t scope,
971
983
pmix_kval_t *kval
972
984
) {
973
- PMIX_HIDE_UNUSED_PARAMS (proc, scope, kval);
974
985
PMIX_GDS_SHMEM_VOUT_HERE ();
975
- return PMIX_ERR_NOT_SUPPORTED;
986
+
987
+ pmix_status_t rc = PMIX_SUCCESS;
988
+ // Setup a job tracker for this peer's nspace.
989
+ pmix_gds_shmem_job_t *job;
990
+ rc = pmix_gds_shmem_get_job_tracker (proc->nspace , false , &job);
991
+ if (PMIX_SUCCESS != rc) {
992
+ PMIX_ERROR_LOG (rc);
993
+ return rc;
994
+ }
995
+ // Let a full-featured gds module handle this.
996
+ return job->ffgds ->store (proc, scope, kval);
976
997
}
977
998
978
999
/* *
@@ -982,13 +1003,23 @@ store(
982
1003
*/
983
1004
static pmix_status_t
984
1005
store_modex (
985
- struct pmix_namespace_t *nspace ,
1006
+ struct pmix_namespace_t *nspace_struct ,
986
1007
pmix_buffer_t *buff,
987
1008
void *cbdata
988
1009
) {
989
- PMIX_HIDE_UNUSED_PARAMS (nspace, buff, cbdata);
990
1010
PMIX_GDS_SHMEM_VOUT_HERE ();
991
- return PMIX_ERR_NOT_SUPPORTED;
1011
+
1012
+ pmix_status_t rc = PMIX_SUCCESS;
1013
+ pmix_namespace_t *nspace = (pmix_namespace_t *)nspace_struct;
1014
+ // Setup a job tracker for this peer's nspace.
1015
+ pmix_gds_shmem_job_t *job;
1016
+ rc = pmix_gds_shmem_get_job_tracker (nspace->nspace , false , &job);
1017
+ if (PMIX_SUCCESS != rc) {
1018
+ PMIX_ERROR_LOG (rc);
1019
+ return rc;
1020
+ }
1021
+ // Let a full-featured gds module handle this.
1022
+ return job->ffgds ->store_modex (nspace_struct, buff, cbdata);
992
1023
}
993
1024
994
1025
static pmix_status_t
@@ -998,6 +1029,7 @@ server_setup_fork(
998
1029
) {
999
1030
PMIX_HIDE_UNUSED_PARAMS (peer, env);
1000
1031
PMIX_GDS_SHMEM_VOUT_HERE ();
1032
+ // Nothing to do here.
1001
1033
return PMIX_SUCCESS;
1002
1034
}
1003
1035
@@ -1010,9 +1042,11 @@ server_add_nspace(
1010
1042
) {
1011
1043
PMIX_HIDE_UNUSED_PARAMS (nspace, nlocalprocs, info, ninfo);
1012
1044
PMIX_GDS_SHMEM_VOUT_HERE ();
1045
+ // Nothing to do here.
1013
1046
return PMIX_SUCCESS;
1014
1047
}
1015
1048
1049
+ // TODO(skg) Implement.
1016
1050
static pmix_status_t
1017
1051
del_nspace (
1018
1052
const char *nspace
@@ -1029,18 +1063,37 @@ assemb_kvs_req(
1029
1063
pmix_buffer_t *buff,
1030
1064
void *cbdata
1031
1065
) {
1032
- PMIX_HIDE_UNUSED_PARAMS (proc, kvs, buff, cbdata);
1033
1066
PMIX_GDS_SHMEM_VOUT_HERE ();
1034
- return PMIX_ERR_NOT_SUPPORTED;
1067
+
1068
+ pmix_status_t rc = PMIX_SUCCESS;
1069
+ // Setup a job tracker for this peer's nspace.
1070
+ pmix_gds_shmem_job_t *job;
1071
+ rc = pmix_gds_shmem_get_job_tracker (proc->nspace , false , &job);
1072
+ if (PMIX_SUCCESS != rc) {
1073
+ PMIX_ERROR_LOG (rc);
1074
+ return rc;
1075
+ }
1076
+ // Let a full-featured gds module handle this.
1077
+ return job->ffgds ->assemb_kvs_req (proc, kvs, buff, cbdata);
1035
1078
}
1036
1079
1037
1080
static pmix_status_t
1038
1081
accept_kvs_resp (
1039
1082
pmix_buffer_t *buff
1040
1083
) {
1041
- PMIX_HIDE_UNUSED_PARAMS (buff);
1042
1084
PMIX_GDS_SHMEM_VOUT_HERE ();
1043
- return PMIX_SUCCESS;
1085
+
1086
+ pmix_status_t rc = PMIX_SUCCESS;
1087
+ const char *nspace = pmix_globals.mypeer ->nptr ->nspace ;
1088
+ // Setup a job tracker for this peer's nspace.
1089
+ pmix_gds_shmem_job_t *job;
1090
+ rc = pmix_gds_shmem_get_job_tracker (nspace, false , &job);
1091
+ if (PMIX_SUCCESS != rc) {
1092
+ PMIX_ERROR_LOG (rc);
1093
+ return rc;
1094
+ }
1095
+ // Let a full-featured gds module handle this.
1096
+ return job->ffgds ->accept_kvs_resp (buff);
1044
1097
}
1045
1098
1046
1099
pmix_gds_base_module_t pmix_shmem_module = {
0 commit comments