0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 #include <string.h>
0035 #include <stdio.h>
0036 #include <stdlib.h>
0037 #include <memory.h>
0038 #include <utlist.h>
0039
0040 #include <ndrstandard.h>
0041
0042 #include <ndebug.h>
0043 #include <userlog.h>
0044 #include <ndrxd.h>
0045 #include <ndrxdcmn.h>
0046
0047 #include "cmd_processor.h"
0048 #include <atmi_shm.h>
0049
0050 extern ndrx_shm_t G_srvinfo;
0051 extern int G_max_servers;
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064 expublic void shm_psrv_reply_mod(command_reply_t *reply, size_t *send_size, mod_param_t *params)
0065 {
0066 command_reply_shm_psrv_t * shm_psrv_info = (command_reply_shm_psrv_t *)reply;
0067 shm_srvinfo_t *p_shm = (shm_srvinfo_t *)params->mod_param1;
0068
0069 reply->msg_type = NDRXD_CALL_TYPE_PM_SHM_PSRV;
0070
0071 *send_size += (sizeof(command_reply_shm_psrv_t) - sizeof(command_reply_t));
0072
0073
0074 shm_psrv_info->execerr = p_shm->execerr;
0075 shm_psrv_info->last_command_id = p_shm->last_command_id;
0076 NDRX_STRCPY_SAFE(shm_psrv_info->last_reply_q, p_shm->last_reply_q);
0077 shm_psrv_info->slot = params->param2;
0078 shm_psrv_info->srvid =p_shm->srvid;
0079 shm_psrv_info->status = p_shm->status;
0080
0081 NDRX_LOG(log_debug, "magic: %ld", shm_psrv_info->rply.magic);
0082 }
0083
0084
0085
0086
0087
0088
0089
0090 exprivate void shm_psrv_progress(command_call_t * call, shm_srvinfo_t *p_shm, int slot)
0091 {
0092 int ret=EXSUCCEED;
0093 mod_param_t params;
0094
0095 NDRX_LOG(log_debug, "startup_progress enter");
0096 memset(¶ms, 0, sizeof(mod_param_t));
0097
0098
0099 params.mod_param1 = (void *)p_shm;
0100 params.param2 = slot;
0101
0102 if (EXSUCCEED!=simple_command_reply(call, ret, NDRXD_CALL_FLAGS_RSPHAVE_MORE,
0103
0104 ¶ms, shm_psrv_reply_mod, 0L, 0, NULL))
0105 {
0106 userlog("Failed to send progress back to [%s]", call->reply_queue);
0107 }
0108
0109 NDRX_LOG(log_debug, "startup_progress exit");
0110 }
0111
0112
0113
0114
0115
0116
0117 expublic int cmd_shm_psrv (command_call_t * call, char *data, size_t len, int context)
0118 {
0119 int ret=EXSUCCEED;
0120 int i;
0121 shm_srvinfo_t *srvinfo = (shm_srvinfo_t *) G_srvinfo.mem;
0122
0123
0124 for (i=0; i<G_max_servers; i++)
0125 {
0126 if (srvinfo[i].srvid)
0127 {
0128 shm_psrv_progress(call, &srvinfo[i], i);
0129 }
0130 }
0131
0132 if (EXSUCCEED!=simple_command_reply(call, ret, 0L, NULL, NULL, 0L, 0, NULL))
0133 {
0134 userlog("Failed to send reply back to [%s]", call->reply_queue);
0135 }
0136 NDRX_LOG(log_warn, "cmd_shm_psrv returns with status %d", ret);
0137
0138 out:
0139 return ret;
0140 }
0141
0142