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 <stdint.h>
0037 #include <stdlib.h>
0038 #include <memory.h>
0039 #include <errno.h>
0040 #include <dlfcn.h>
0041
0042 #include <atmi.h>
0043 #include <atmi_tls.h>
0044 #include <ndrstandard.h>
0045 #include <ndebug.h>
0046 #include <ndrxdcmn.h>
0047 #include <userlog.h>
0048 #include <xa_cmn.h>
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060 expublic int Otpadvertise_full(TPCONTEXT_T *p_ctxt, char *svc_nm, void (*p_func)(TPSVCINFO *), char *fn_nm)
0061 {
0062 int ret = EXSUCCEED;
0063 int did_set = EXFALSE;
0064
0065
0066 #ifdef NDRX_OAPI_DEBUG
0067 NDRX_LOG(log_debug, "ENTRY: tpadvertise_full() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
0068 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
0069 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
0070
0071 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
0072 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
0073
0074 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
0075 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
0076
0077 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
0078 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
0079
0080 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
0081 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
0082
0083 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
0084 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
0085
0086 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
0087 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
0088 #endif
0089
0090
0091
0092
0093 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
0094 {
0095 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
0096 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0097 {
0098 userlog("ERROR! tpadvertise_full() failed to set context");
0099 EXFAIL_OUT(ret);
0100 }
0101 did_set = EXTRUE;
0102 }
0103 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
0104 {
0105 userlog("WARNING! tpadvertise_full() context %p thinks that it is assocated "
0106 "with current thread, but thread is associated with %p context!",
0107 p_ctxt, G_atmi_tls);
0108 }
0109
0110 ret = tpadvertise_full(svc_nm, p_func, fn_nm);
0111
0112 if (did_set)
0113 {
0114 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
0115 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0116 {
0117 userlog("ERROR! tpadvertise_full() failed to get context");
0118 EXFAIL_OUT(ret);
0119 }
0120 }
0121 out:
0122
0123 #ifdef NDRX_OAPI_DEBUG
0124 NDRX_LOG(log_debug, "RETURN: tpadvertise_full() returns, context: %p, current: %p",
0125 *p_ctxt, G_atmi_tls);
0126 #endif
0127
0128
0129 return ret;
0130 }
0131
0132
0133
0134
0135 expublic void Otpreturn(TPCONTEXT_T *p_ctxt, int rval, long rcode, char *data, long len, long flags)
0136 {
0137 int did_set = EXFALSE;
0138
0139
0140 #ifdef NDRX_OAPI_DEBUG
0141 NDRX_LOG(log_debug, "ENTRY: tpreturn() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
0142 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
0143 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
0144
0145 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
0146 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NSTD );
0147
0148 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
0149 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_UBF );
0150
0151 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
0152 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_ATMI );
0153
0154 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
0155 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_TRAN );
0156
0157 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
0158 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_NOCHK );
0159
0160 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
0161 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN) & CTXT_PRIV_IGN );
0162 #endif
0163
0164
0165
0166
0167 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
0168 {
0169
0170 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
0171 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
0172 {
0173 userlog("ERROR! tpreturn() failed to set context");
0174 }
0175 did_set = EXTRUE;
0176 }
0177 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
0178 {
0179 userlog("WARNING! tpreturn() context %p thinks that it is assocated "
0180 "with current thread, but thread is associated with %p context!",
0181 p_ctxt, G_atmi_tls);
0182 }
0183
0184 tpreturn(rval, rcode, data, len, flags);
0185
0186 if (did_set)
0187 {
0188 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
0189 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN| CTXT_PRIV_TRAN))
0190 {
0191 userlog("ERROR! tpreturn() failed to get context");
0192 }
0193 }
0194 out:
0195
0196 #ifdef NDRX_OAPI_DEBUG
0197 NDRX_LOG(log_debug, "RETURN: tpreturn() returns, context: %p, current: %p",
0198 *p_ctxt, G_atmi_tls);
0199 #endif
0200
0201
0202 return;
0203 }
0204
0205
0206
0207
0208
0209 expublic int Otpunadvertise(TPCONTEXT_T *p_ctxt, char *svcname)
0210 {
0211 int ret = EXSUCCEED;
0212 int did_set = EXFALSE;
0213
0214
0215 #ifdef NDRX_OAPI_DEBUG
0216 NDRX_LOG(log_debug, "ENTRY: tpunadvertise() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
0217 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
0218 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
0219
0220 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
0221 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
0222
0223 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
0224 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
0225
0226 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
0227 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
0228
0229 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
0230 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
0231
0232 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
0233 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
0234
0235 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
0236 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
0237 #endif
0238
0239
0240
0241
0242 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
0243 {
0244 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
0245 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0246 {
0247 userlog("ERROR! tpunadvertise() failed to set context");
0248 EXFAIL_OUT(ret);
0249 }
0250 did_set = EXTRUE;
0251 }
0252 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
0253 {
0254 userlog("WARNING! tpunadvertise() context %p thinks that it is assocated "
0255 "with current thread, but thread is associated with %p context!",
0256 p_ctxt, G_atmi_tls);
0257 }
0258
0259 ret = tpunadvertise(svcname);
0260
0261 if (did_set)
0262 {
0263 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
0264 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0265 {
0266 userlog("ERROR! tpunadvertise() failed to get context");
0267 EXFAIL_OUT(ret);
0268 }
0269 }
0270 out:
0271
0272 #ifdef NDRX_OAPI_DEBUG
0273 NDRX_LOG(log_debug, "RETURN: tpunadvertise() returns, context: %p, current: %p",
0274 *p_ctxt, G_atmi_tls);
0275 #endif
0276
0277
0278 return ret;
0279 }
0280
0281
0282
0283
0284 expublic void Otpforward(TPCONTEXT_T *p_ctxt, char *svc, char *data, long len, long flags)
0285 {
0286 int did_set = EXFALSE;
0287
0288
0289 #ifdef NDRX_OAPI_DEBUG
0290 NDRX_LOG(log_debug, "ENTRY: tpforward() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
0291 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
0292 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
0293
0294 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
0295 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
0296
0297 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
0298 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
0299
0300 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
0301 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
0302
0303 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
0304 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
0305
0306 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
0307 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
0308
0309 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
0310 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
0311 #endif
0312
0313
0314
0315
0316 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
0317 {
0318
0319 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
0320 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0321 {
0322 userlog("ERROR! tpforward() failed to set context");
0323 }
0324 did_set = EXTRUE;
0325 }
0326 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
0327 {
0328 userlog("WARNING! tpforward() context %p thinks that it is assocated "
0329 "with current thread, but thread is associated with %p context!",
0330 p_ctxt, G_atmi_tls);
0331 }
0332
0333 tpforward(svc, data, len, flags);
0334
0335 if (did_set)
0336 {
0337 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
0338 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0339 {
0340 userlog("ERROR! tpforward() failed to get context");
0341 }
0342 }
0343 out:
0344
0345 #ifdef NDRX_OAPI_DEBUG
0346 NDRX_LOG(log_debug, "RETURN: tpforward() returns, context: %p, current: %p",
0347 *p_ctxt, G_atmi_tls);
0348 #endif
0349
0350
0351 return;
0352 }
0353
0354
0355
0356
0357 expublic void Otpexit(TPCONTEXT_T *p_ctxt)
0358 {
0359 int did_set = EXFALSE;
0360
0361
0362 #ifdef NDRX_OAPI_DEBUG
0363 NDRX_LOG(log_debug, "ENTRY: tpexit() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
0364 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
0365 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
0366
0367 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
0368 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
0369
0370 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
0371 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
0372
0373 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
0374 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
0375
0376 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
0377 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
0378
0379 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
0380 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
0381
0382 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
0383 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
0384 #endif
0385
0386
0387
0388
0389 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
0390 {
0391
0392 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
0393 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0394 {
0395 userlog("ERROR! tpexit() failed to set context");
0396 }
0397 did_set = EXTRUE;
0398 }
0399 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
0400 {
0401 userlog("WARNING! tpexit() context %p thinks that it is assocated "
0402 "with current thread, but thread is associated with %p context!",
0403 p_ctxt, G_atmi_tls);
0404 }
0405
0406 tpexit();
0407
0408 if (did_set)
0409 {
0410 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
0411 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0412 {
0413 userlog("ERROR! tpexit() failed to get context");
0414 }
0415 }
0416 out:
0417
0418 #ifdef NDRX_OAPI_DEBUG
0419 NDRX_LOG(log_debug, "RETURN: tpexit() returns, context: %p, current: %p",
0420 *p_ctxt, G_atmi_tls);
0421 #endif
0422
0423
0424 return;
0425 }
0426
0427
0428
0429
0430
0431 expublic char * Otpsrvgetctxdata(TPCONTEXT_T *p_ctxt)
0432 {
0433 int did_set = EXFALSE;
0434 char * ret = NULL;
0435
0436
0437 #ifdef NDRX_OAPI_DEBUG
0438 NDRX_LOG(log_debug, "ENTRY: tpsrvgetctxdata() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
0439 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
0440 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
0441
0442 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
0443 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
0444
0445 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
0446 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
0447
0448 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
0449 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
0450
0451 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
0452 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
0453
0454 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
0455 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
0456
0457 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
0458 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
0459 #endif
0460
0461
0462
0463 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
0464 {
0465
0466 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
0467 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0468 {
0469 userlog("ERROR! tpsrvgetctxdata() failed to set context");
0470 ret = NULL;
0471 goto out;
0472 }
0473 did_set = EXTRUE;
0474 }
0475 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
0476 {
0477 userlog("WARNING! tpsrvgetctxdata() context %p thinks that it is assocated "
0478 "with current thread, but thread is associated with %p context!",
0479 p_ctxt, G_atmi_tls);
0480 }
0481
0482 ret = tpsrvgetctxdata();
0483
0484 if (did_set)
0485 {
0486 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
0487 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0488 {
0489 userlog("ERROR! tpsrvgetctxdata() failed to get context");
0490 ret = NULL;
0491 goto out;
0492 }
0493 }
0494 out:
0495
0496 #ifdef NDRX_OAPI_DEBUG
0497 NDRX_LOG(log_debug, "RETURN: tpsrvgetctxdata() returns, context: %p, current: %p",
0498 *p_ctxt, G_atmi_tls);
0499 #endif
0500
0501
0502 return ret;
0503 }
0504
0505
0506
0507
0508
0509 expublic char * Otpsrvgetctxdata2(TPCONTEXT_T *p_ctxt, char *p_buf, long *p_len)
0510 {
0511 int did_set = EXFALSE;
0512 char * ret = NULL;
0513
0514
0515 #ifdef NDRX_OAPI_DEBUG
0516 NDRX_LOG(log_debug, "ENTRY: tpsrvgetctxdata2() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
0517 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
0518 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
0519
0520 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
0521 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
0522
0523 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
0524 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
0525
0526 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
0527 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
0528
0529 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
0530 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
0531
0532 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
0533 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
0534
0535 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
0536 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
0537 #endif
0538
0539
0540
0541 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
0542 {
0543
0544 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
0545 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0546 {
0547 userlog("ERROR! tpsrvgetctxdata2() failed to set context");
0548 ret = NULL;
0549 goto out;
0550 }
0551 did_set = EXTRUE;
0552 }
0553 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
0554 {
0555 userlog("WARNING! tpsrvgetctxdata2() context %p thinks that it is assocated "
0556 "with current thread, but thread is associated with %p context!",
0557 p_ctxt, G_atmi_tls);
0558 }
0559
0560 ret = tpsrvgetctxdata2(p_buf, p_len);
0561
0562 if (did_set)
0563 {
0564 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
0565 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0566 {
0567 userlog("ERROR! tpsrvgetctxdata2() failed to get context");
0568 ret = NULL;
0569 goto out;
0570 }
0571 }
0572 out:
0573
0574 #ifdef NDRX_OAPI_DEBUG
0575 NDRX_LOG(log_debug, "RETURN: tpsrvgetctxdata2() returns, context: %p, current: %p",
0576 *p_ctxt, G_atmi_tls);
0577 #endif
0578
0579
0580 return ret;
0581 }
0582
0583
0584
0585
0586 expublic void Otpsrvfreectxdata(TPCONTEXT_T *p_ctxt, char *p_buf)
0587 {
0588 int did_set = EXFALSE;
0589
0590
0591 #ifdef NDRX_OAPI_DEBUG
0592 NDRX_LOG(log_debug, "ENTRY: tpsrvfreectxdata() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
0593 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
0594 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
0595
0596 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
0597 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
0598
0599 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
0600 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
0601
0602 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
0603 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
0604
0605 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
0606 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
0607
0608 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
0609 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
0610
0611 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
0612 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
0613 #endif
0614
0615
0616
0617
0618 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
0619 {
0620
0621 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
0622 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0623 {
0624 userlog("ERROR! tpsrvfreectxdata() failed to set context");
0625 }
0626 did_set = EXTRUE;
0627 }
0628 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
0629 {
0630 userlog("WARNING! tpsrvfreectxdata() context %p thinks that it is assocated "
0631 "with current thread, but thread is associated with %p context!",
0632 p_ctxt, G_atmi_tls);
0633 }
0634
0635 tpsrvfreectxdata(p_buf);
0636
0637 if (did_set)
0638 {
0639 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
0640 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0641 {
0642 userlog("ERROR! tpsrvfreectxdata() failed to get context");
0643 }
0644 }
0645 out:
0646
0647 #ifdef NDRX_OAPI_DEBUG
0648 NDRX_LOG(log_debug, "RETURN: tpsrvfreectxdata() returns, context: %p, current: %p",
0649 *p_ctxt, G_atmi_tls);
0650 #endif
0651
0652
0653 return;
0654 }
0655
0656
0657
0658
0659
0660 expublic int Otpsrvsetctxdata(TPCONTEXT_T *p_ctxt, char *data, long flags)
0661 {
0662 int ret = EXSUCCEED;
0663 int did_set = EXFALSE;
0664
0665
0666 #ifdef NDRX_OAPI_DEBUG
0667 NDRX_LOG(log_debug, "ENTRY: tpsrvsetctxdata() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
0668 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
0669 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
0670
0671 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
0672 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
0673
0674 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
0675 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
0676
0677 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
0678 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
0679
0680 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
0681 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
0682
0683 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
0684 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
0685
0686 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
0687 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
0688 #endif
0689
0690
0691
0692
0693 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
0694 {
0695 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
0696 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0697 {
0698 userlog("ERROR! tpsrvsetctxdata() failed to set context");
0699 EXFAIL_OUT(ret);
0700 }
0701 did_set = EXTRUE;
0702 }
0703 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
0704 {
0705 userlog("WARNING! tpsrvsetctxdata() context %p thinks that it is assocated "
0706 "with current thread, but thread is associated with %p context!",
0707 p_ctxt, G_atmi_tls);
0708 }
0709
0710 ret = tpsrvsetctxdata(data, flags);
0711
0712 if (did_set)
0713 {
0714 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
0715 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0716 {
0717 userlog("ERROR! tpsrvsetctxdata() failed to get context");
0718 EXFAIL_OUT(ret);
0719 }
0720 }
0721 out:
0722
0723 #ifdef NDRX_OAPI_DEBUG
0724 NDRX_LOG(log_debug, "RETURN: tpsrvsetctxdata() returns, context: %p, current: %p",
0725 *p_ctxt, G_atmi_tls);
0726 #endif
0727
0728
0729 return ret;
0730 }
0731
0732
0733
0734
0735 expublic void Otpcontinue(TPCONTEXT_T *p_ctxt)
0736 {
0737 int did_set = EXFALSE;
0738
0739
0740 #ifdef NDRX_OAPI_DEBUG
0741 NDRX_LOG(log_debug, "ENTRY: tpcontinue() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
0742 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
0743 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
0744
0745 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
0746 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
0747
0748 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
0749 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
0750
0751 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
0752 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
0753
0754 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
0755 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
0756
0757 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
0758 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
0759
0760 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
0761 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
0762 #endif
0763
0764
0765
0766
0767 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
0768 {
0769
0770 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
0771 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0772 {
0773 userlog("ERROR! tpcontinue() failed to set context");
0774 }
0775 did_set = EXTRUE;
0776 }
0777 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
0778 {
0779 userlog("WARNING! tpcontinue() context %p thinks that it is assocated "
0780 "with current thread, but thread is associated with %p context!",
0781 p_ctxt, G_atmi_tls);
0782 }
0783
0784 tpcontinue();
0785
0786 if (did_set)
0787 {
0788 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
0789 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0790 {
0791 userlog("ERROR! tpcontinue() failed to get context");
0792 }
0793 }
0794 out:
0795
0796 #ifdef NDRX_OAPI_DEBUG
0797 NDRX_LOG(log_debug, "RETURN: tpcontinue() returns, context: %p, current: %p",
0798 *p_ctxt, G_atmi_tls);
0799 #endif
0800
0801
0802 return;
0803 }
0804
0805
0806
0807
0808
0809 expublic int Otpext_addpollerfd(TPCONTEXT_T *p_ctxt, int fd, uint32_t events, void *ptr1,int (*p_pollevent)(int fd, uint32_t events, void *ptr1))
0810 {
0811 int ret = EXSUCCEED;
0812 int did_set = EXFALSE;
0813
0814
0815 #ifdef NDRX_OAPI_DEBUG
0816 NDRX_LOG(log_debug, "ENTRY: tpext_addpollerfd() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
0817 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
0818 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
0819
0820 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
0821 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
0822
0823 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
0824 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
0825
0826 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
0827 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
0828
0829 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
0830 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
0831
0832 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
0833 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
0834
0835 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
0836 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
0837 #endif
0838
0839
0840
0841
0842 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
0843 {
0844 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
0845 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0846 {
0847 userlog("ERROR! tpext_addpollerfd() failed to set context");
0848 EXFAIL_OUT(ret);
0849 }
0850 did_set = EXTRUE;
0851 }
0852 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
0853 {
0854 userlog("WARNING! tpext_addpollerfd() context %p thinks that it is assocated "
0855 "with current thread, but thread is associated with %p context!",
0856 p_ctxt, G_atmi_tls);
0857 }
0858
0859 ret = tpext_addpollerfd(fd, events, ptr1, p_pollevent);
0860
0861 if (did_set)
0862 {
0863 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
0864 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0865 {
0866 userlog("ERROR! tpext_addpollerfd() failed to get context");
0867 EXFAIL_OUT(ret);
0868 }
0869 }
0870 out:
0871
0872 #ifdef NDRX_OAPI_DEBUG
0873 NDRX_LOG(log_debug, "RETURN: tpext_addpollerfd() returns, context: %p, current: %p",
0874 *p_ctxt, G_atmi_tls);
0875 #endif
0876
0877
0878 return ret;
0879 }
0880
0881
0882
0883
0884
0885 expublic int Otpext_delpollerfd(TPCONTEXT_T *p_ctxt, int fd)
0886 {
0887 int ret = EXSUCCEED;
0888 int did_set = EXFALSE;
0889
0890
0891 #ifdef NDRX_OAPI_DEBUG
0892 NDRX_LOG(log_debug, "ENTRY: tpext_delpollerfd() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
0893 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
0894 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
0895
0896 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
0897 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
0898
0899 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
0900 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
0901
0902 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
0903 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
0904
0905 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
0906 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
0907
0908 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
0909 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
0910
0911 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
0912 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
0913 #endif
0914
0915
0916
0917
0918 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
0919 {
0920 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
0921 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0922 {
0923 userlog("ERROR! tpext_delpollerfd() failed to set context");
0924 EXFAIL_OUT(ret);
0925 }
0926 did_set = EXTRUE;
0927 }
0928 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
0929 {
0930 userlog("WARNING! tpext_delpollerfd() context %p thinks that it is assocated "
0931 "with current thread, but thread is associated with %p context!",
0932 p_ctxt, G_atmi_tls);
0933 }
0934
0935 ret = tpext_delpollerfd(fd);
0936
0937 if (did_set)
0938 {
0939 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
0940 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0941 {
0942 userlog("ERROR! tpext_delpollerfd() failed to get context");
0943 EXFAIL_OUT(ret);
0944 }
0945 }
0946 out:
0947
0948 #ifdef NDRX_OAPI_DEBUG
0949 NDRX_LOG(log_debug, "RETURN: tpext_delpollerfd() returns, context: %p, current: %p",
0950 *p_ctxt, G_atmi_tls);
0951 #endif
0952
0953
0954 return ret;
0955 }
0956
0957
0958
0959
0960
0961 expublic int Otpext_addperiodcb(TPCONTEXT_T *p_ctxt, int secs, int (*p_periodcb)(void))
0962 {
0963 int ret = EXSUCCEED;
0964 int did_set = EXFALSE;
0965
0966
0967 #ifdef NDRX_OAPI_DEBUG
0968 NDRX_LOG(log_debug, "ENTRY: tpext_addperiodcb() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
0969 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
0970 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
0971
0972 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
0973 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
0974
0975 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
0976 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
0977
0978 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
0979 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
0980
0981 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
0982 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
0983
0984 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
0985 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
0986
0987 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
0988 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
0989 #endif
0990
0991
0992
0993
0994 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
0995 {
0996 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
0997 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
0998 {
0999 userlog("ERROR! tpext_addperiodcb() failed to set context");
1000 EXFAIL_OUT(ret);
1001 }
1002 did_set = EXTRUE;
1003 }
1004 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
1005 {
1006 userlog("WARNING! tpext_addperiodcb() context %p thinks that it is assocated "
1007 "with current thread, but thread is associated with %p context!",
1008 p_ctxt, G_atmi_tls);
1009 }
1010
1011 ret = tpext_addperiodcb(secs, p_periodcb);
1012
1013 if (did_set)
1014 {
1015 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
1016 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
1017 {
1018 userlog("ERROR! tpext_addperiodcb() failed to get context");
1019 EXFAIL_OUT(ret);
1020 }
1021 }
1022 out:
1023
1024 #ifdef NDRX_OAPI_DEBUG
1025 NDRX_LOG(log_debug, "RETURN: tpext_addperiodcb() returns, context: %p, current: %p",
1026 *p_ctxt, G_atmi_tls);
1027 #endif
1028
1029
1030 return ret;
1031 }
1032
1033
1034
1035
1036
1037 expublic int Otpext_delperiodcb(TPCONTEXT_T *p_ctxt)
1038 {
1039 int ret = EXSUCCEED;
1040 int did_set = EXFALSE;
1041
1042
1043 #ifdef NDRX_OAPI_DEBUG
1044 NDRX_LOG(log_debug, "ENTRY: tpext_delperiodcb() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
1045 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
1046 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
1047
1048 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
1049 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
1050
1051 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
1052 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
1053
1054 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
1055 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
1056
1057 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
1058 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
1059
1060 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
1061 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
1062
1063 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
1064 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
1065 #endif
1066
1067
1068
1069
1070 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
1071 {
1072 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
1073 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
1074 {
1075 userlog("ERROR! tpext_delperiodcb() failed to set context");
1076 EXFAIL_OUT(ret);
1077 }
1078 did_set = EXTRUE;
1079 }
1080 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
1081 {
1082 userlog("WARNING! tpext_delperiodcb() context %p thinks that it is assocated "
1083 "with current thread, but thread is associated with %p context!",
1084 p_ctxt, G_atmi_tls);
1085 }
1086
1087 ret = tpext_delperiodcb();
1088
1089 if (did_set)
1090 {
1091 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
1092 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
1093 {
1094 userlog("ERROR! tpext_delperiodcb() failed to get context");
1095 EXFAIL_OUT(ret);
1096 }
1097 }
1098 out:
1099
1100 #ifdef NDRX_OAPI_DEBUG
1101 NDRX_LOG(log_debug, "RETURN: tpext_delperiodcb() returns, context: %p, current: %p",
1102 *p_ctxt, G_atmi_tls);
1103 #endif
1104
1105
1106 return ret;
1107 }
1108
1109
1110
1111
1112
1113 expublic int Otpext_addb4pollcb(TPCONTEXT_T *p_ctxt, int (*p_b4pollcb)(void))
1114 {
1115 int ret = EXSUCCEED;
1116 int did_set = EXFALSE;
1117
1118
1119 #ifdef NDRX_OAPI_DEBUG
1120 NDRX_LOG(log_debug, "ENTRY: tpext_addb4pollcb() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
1121 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
1122 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
1123
1124 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
1125 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
1126
1127 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
1128 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
1129
1130 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
1131 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
1132
1133 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
1134 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
1135
1136 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
1137 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
1138
1139 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
1140 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
1141 #endif
1142
1143
1144
1145
1146 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
1147 {
1148 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
1149 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
1150 {
1151 userlog("ERROR! tpext_addb4pollcb() failed to set context");
1152 EXFAIL_OUT(ret);
1153 }
1154 did_set = EXTRUE;
1155 }
1156 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
1157 {
1158 userlog("WARNING! tpext_addb4pollcb() context %p thinks that it is assocated "
1159 "with current thread, but thread is associated with %p context!",
1160 p_ctxt, G_atmi_tls);
1161 }
1162
1163 ret = tpext_addb4pollcb(p_b4pollcb);
1164
1165 if (did_set)
1166 {
1167 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
1168 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
1169 {
1170 userlog("ERROR! tpext_addb4pollcb() failed to get context");
1171 EXFAIL_OUT(ret);
1172 }
1173 }
1174 out:
1175
1176 #ifdef NDRX_OAPI_DEBUG
1177 NDRX_LOG(log_debug, "RETURN: tpext_addb4pollcb() returns, context: %p, current: %p",
1178 *p_ctxt, G_atmi_tls);
1179 #endif
1180
1181
1182 return ret;
1183 }
1184
1185
1186
1187
1188
1189 expublic int Otpext_delb4pollcb(TPCONTEXT_T *p_ctxt)
1190 {
1191 int ret = EXSUCCEED;
1192 int did_set = EXFALSE;
1193
1194
1195 #ifdef NDRX_OAPI_DEBUG
1196 NDRX_LOG(log_debug, "ENTRY: tpext_delb4pollcb() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
1197 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
1198 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
1199
1200 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
1201 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
1202
1203 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
1204 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
1205
1206 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
1207 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
1208
1209 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
1210 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
1211
1212 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
1213 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
1214
1215 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
1216 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
1217 #endif
1218
1219
1220
1221
1222 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
1223 {
1224 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
1225 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
1226 {
1227 userlog("ERROR! tpext_delb4pollcb() failed to set context");
1228 EXFAIL_OUT(ret);
1229 }
1230 did_set = EXTRUE;
1231 }
1232 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
1233 {
1234 userlog("WARNING! tpext_delb4pollcb() context %p thinks that it is assocated "
1235 "with current thread, but thread is associated with %p context!",
1236 p_ctxt, G_atmi_tls);
1237 }
1238
1239 ret = tpext_delb4pollcb();
1240
1241 if (did_set)
1242 {
1243 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
1244 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
1245 {
1246 userlog("ERROR! tpext_delb4pollcb() failed to get context");
1247 EXFAIL_OUT(ret);
1248 }
1249 }
1250 out:
1251
1252 #ifdef NDRX_OAPI_DEBUG
1253 NDRX_LOG(log_debug, "RETURN: tpext_delb4pollcb() returns, context: %p, current: %p",
1254 *p_ctxt, G_atmi_tls);
1255 #endif
1256
1257
1258 return ret;
1259 }
1260
1261
1262
1263
1264
1265 expublic int Otpgetsrvid(TPCONTEXT_T *p_ctxt)
1266 {
1267 int ret = EXSUCCEED;
1268 int did_set = EXFALSE;
1269
1270
1271 #ifdef NDRX_OAPI_DEBUG
1272 NDRX_LOG(log_debug, "ENTRY: tpgetsrvid() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
1273 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
1274 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
1275
1276 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
1277 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
1278
1279 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
1280 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
1281
1282 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
1283 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
1284
1285 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
1286 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
1287
1288 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
1289 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
1290
1291 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
1292 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
1293 #endif
1294
1295
1296
1297
1298 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
1299 {
1300 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
1301 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
1302 {
1303 userlog("ERROR! tpgetsrvid() failed to set context");
1304 EXFAIL_OUT(ret);
1305 }
1306 did_set = EXTRUE;
1307 }
1308 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
1309 {
1310 userlog("WARNING! tpgetsrvid() context %p thinks that it is assocated "
1311 "with current thread, but thread is associated with %p context!",
1312 p_ctxt, G_atmi_tls);
1313 }
1314
1315 ret = tpgetsrvid();
1316
1317 if (did_set)
1318 {
1319 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
1320 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
1321 {
1322 userlog("ERROR! tpgetsrvid() failed to get context");
1323 EXFAIL_OUT(ret);
1324 }
1325 }
1326 out:
1327
1328 #ifdef NDRX_OAPI_DEBUG
1329 NDRX_LOG(log_debug, "RETURN: tpgetsrvid() returns, context: %p, current: %p",
1330 *p_ctxt, G_atmi_tls);
1331 #endif
1332
1333
1334 return ret;
1335 }
1336
1337
1338
1339
1340
1341 expublic int Ondrx_main(TPCONTEXT_T *p_ctxt, int argc, char **argv)
1342 {
1343 int ret = EXSUCCEED;
1344 int did_set = EXFALSE;
1345
1346
1347 #ifdef NDRX_OAPI_DEBUG
1348 NDRX_LOG(log_debug, "ENTRY: ndrx_main() enter, context: %p, current: %p", *p_ctxt, G_atmi_tls);
1349 NDRX_LOG(log_debug, "ENTRY: is_associated_with_thread = %d",
1350 ((atmi_tls_t *)*p_ctxt)->is_associated_with_thread);
1351
1352 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NSTD = %d",
1353 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NSTD );
1354
1355 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_UBF = %d",
1356 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_UBF );
1357
1358 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_ATMI = %d",
1359 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_ATMI );
1360
1361 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_TRAN = %d",
1362 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_TRAN );
1363
1364 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_NOCHK = %d",
1365 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_NOCHK );
1366
1367 NDRX_LOG(log_debug, "ENTRY: CTXT_PRIV_IGN = %d",
1368 (CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN) & CTXT_PRIV_IGN );
1369 #endif
1370
1371
1372
1373
1374 if (!((atmi_tls_t *)*p_ctxt)->is_associated_with_thread)
1375 {
1376 if (EXSUCCEED!=ndrx_tpsetctxt(*p_ctxt, 0,
1377 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
1378 {
1379 userlog("ERROR! ndrx_main() failed to set context");
1380 EXFAIL_OUT(ret);
1381 }
1382 did_set = EXTRUE;
1383 }
1384 else if ((atmi_tls_t *)*p_ctxt != G_atmi_tls)
1385 {
1386 userlog("WARNING! ndrx_main() context %p thinks that it is assocated "
1387 "with current thread, but thread is associated with %p context!",
1388 p_ctxt, G_atmi_tls);
1389 }
1390
1391 ret = ndrx_main(argc, argv);
1392
1393 if (did_set)
1394 {
1395 if (TPMULTICONTEXTS!=ndrx_tpgetctxt(p_ctxt, 0,
1396 CTXT_PRIV_NSTD|CTXT_PRIV_UBF| CTXT_PRIV_ATMI | CTXT_PRIV_IGN))
1397 {
1398 userlog("ERROR! ndrx_main() failed to get context");
1399 EXFAIL_OUT(ret);
1400 }
1401 }
1402 out:
1403
1404 #ifdef NDRX_OAPI_DEBUG
1405 NDRX_LOG(log_debug, "RETURN: ndrx_main() returns, context: %p, current: %p",
1406 *p_ctxt, G_atmi_tls);
1407 #endif
1408
1409
1410 return ret;
1411 }
1412
1413