~ubuntu-branches/ubuntu/hardy/openmpi/hardy-updates

« back to all changes in this revision

Viewing changes to orte/mca/rmgr/base/rmgr_base_pack.c

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2006-10-15 00:46:11 UTC
  • Revision ID: james.westby@ubuntu.com-20061015004611-uuhxnaxyjmuxfd5h
Tags: upstream-1.1
ImportĀ upstreamĀ versionĀ 1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
 
3
 *                         University Research and Technology
 
4
 *                         Corporation.  All rights reserved.
 
5
 * Copyright (c) 2004-2005 The University of Tennessee and The University
 
6
 *                         of Tennessee Research Foundation.  All rights
 
7
 *                         reserved.
 
8
 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, 
 
9
 *                         University of Stuttgart.  All rights reserved.
 
10
 * $COPYRIGHT$
 
11
 * 
 
12
 * Additional copyrights may follow
 
13
 * 
 
14
 * $HEADER$
 
15
 */
 
16
#include "orte_config.h"
 
17
#include <errno.h>
 
18
#ifdef HAVE_UNISTD_H
 
19
#include <unistd.h>
 
20
#endif
 
21
#include <string.h>
 
22
 
 
23
#include "opal/util/trace.h"
 
24
 
 
25
#include "orte/orte_constants.h"
 
26
#include "orte/dss/dss.h"
 
27
#include "orte/mca/rmgr/base/base.h"
 
28
#include "orte/mca/errmgr/errmgr.h"
 
29
 
 
30
 
 
31
/*
 
32
 * 
 
33
 */
 
34
 
 
35
int orte_rmgr_base_pack_cmd(orte_buffer_t* buffer, orte_rmgr_cmd_t cmd, orte_jobid_t jobid)
 
36
{
 
37
     int rc;
 
38
     
 
39
     OPAL_TRACE(4);
 
40
    
 
41
     rc = orte_dss.pack(buffer, &cmd, 1, ORTE_RMGR_CMD);
 
42
     if(ORTE_SUCCESS != rc) {
 
43
         ORTE_ERROR_LOG(rc);
 
44
         return rc;
 
45
     }
 
46
 
 
47
     rc = orte_dss.pack(buffer, &jobid, 1, ORTE_JOBID);
 
48
     if(ORTE_SUCCESS != rc) {
 
49
         ORTE_ERROR_LOG(rc);
 
50
         return rc;
 
51
     }
 
52
     return ORTE_SUCCESS;
 
53
}
 
54
 
 
55
/*
 
56
 *
 
57
 */
 
58
 
 
59
int orte_rmgr_base_pack_create_cmd(
 
60
    orte_buffer_t* buffer,
 
61
    orte_app_context_t** context,
 
62
    size_t num_context)
 
63
{
 
64
     int rc;
 
65
     
 
66
     orte_rmgr_cmd_t cmd = ORTE_RMGR_CMD_CREATE;
 
67
 
 
68
     OPAL_TRACE(4);
 
69
    
 
70
     rc = orte_dss.pack(buffer, &cmd, 1, ORTE_RMGR_CMD);
 
71
     if(ORTE_SUCCESS != rc) {
 
72
         ORTE_ERROR_LOG(rc);
 
73
         return rc;
 
74
     }
 
75
 
 
76
     rc = orte_dss.pack(buffer, &num_context, 1, ORTE_SIZE);
 
77
     if(ORTE_SUCCESS != rc) {
 
78
         ORTE_ERROR_LOG(rc);
 
79
         return rc;
 
80
     }
 
81
     rc = orte_dss.pack(buffer, context, num_context, ORTE_APP_CONTEXT);
 
82
     if(ORTE_SUCCESS != rc) {
 
83
         ORTE_ERROR_LOG(rc);
 
84
         return rc;
 
85
     }
 
86
     return ORTE_SUCCESS;
 
87
}
 
88
 
 
89
                                                                                                                           
 
90
int orte_rmgr_base_pack_terminate_proc_cmd(
 
91
    orte_buffer_t* buffer,
 
92
    const orte_process_name_t* name)
 
93
{
 
94
     int rc;
 
95
     
 
96
     orte_rmgr_cmd_t cmd = ORTE_RMGR_CMD_CREATE;
 
97
 
 
98
     OPAL_TRACE(4);
 
99
    
 
100
     rc = orte_dss.pack(buffer, &cmd, 1, ORTE_RMGR_CMD);
 
101
     if(ORTE_SUCCESS != rc) {
 
102
         ORTE_ERROR_LOG(rc);
 
103
         return rc;
 
104
     }
 
105
 
 
106
     rc = orte_dss.pack(buffer, (void*)name, 1, ORTE_NAME);
 
107
     if(ORTE_SUCCESS != rc) {
 
108
         ORTE_ERROR_LOG(rc);
 
109
         return rc;
 
110
     }
 
111
     return ORTE_SUCCESS;
 
112
}
 
113
 
 
114
                                                                                                                           
 
115
int orte_rmgr_base_unpack_rsp(
 
116
    orte_buffer_t* buffer)
 
117
{
 
118
    int32_t rc;
 
119
    size_t cnt = 1;
 
120
 
 
121
    OPAL_TRACE(4);
 
122
    
 
123
    if(ORTE_SUCCESS != (rc = orte_dss.unpack(buffer,&rc,&cnt,ORTE_INT32))) {
 
124
        ORTE_ERROR_LOG(rc);
 
125
        return rc;
 
126
    }
 
127
    return rc;
 
128
}
 
129
                                                                                                                           
 
130
int orte_rmgr_base_unpack_create_rsp(
 
131
    orte_buffer_t* buffer,
 
132
    orte_jobid_t* jobid)
 
133
{
 
134
    int32_t rc;
 
135
    size_t cnt;
 
136
 
 
137
    OPAL_TRACE(4);
 
138
    
 
139
    cnt = 1;
 
140
    if(ORTE_SUCCESS != (rc = orte_dss.unpack(buffer,jobid,&cnt,ORTE_JOBID))) {
 
141
        ORTE_ERROR_LOG(rc);
 
142
        return rc;
 
143
    }
 
144
    cnt = 1;
 
145
    if(ORTE_SUCCESS != (rc = orte_dss.unpack(buffer,&rc,&cnt,ORTE_INT32))) {
 
146
        ORTE_ERROR_LOG(rc);
 
147
        return rc;
 
148
    }
 
149
    return rc;
 
150
}
 
151
 
 
152