nxt_application.c (549:42b904605f6b) nxt_application.c (564:762f8c976ead)
1
2/*
3 * Copyright (C) Max Romanov
4 * Copyright (C) Igor Sysoev
5 * Copyright (C) Valentin V. Bartenev
6 * Copyright (C) NGINX, Inc.
7 */
8

--- 182 unchanged lines hidden (view full) ---

191 * Only memory allocation failure should return NXT_ERROR.
192 * Any module processing errors are ignored.
193 */
194 ret = NXT_ERROR;
195
196 dl = dlopen(name, RTLD_GLOBAL | RTLD_NOW);
197
198 if (dl == NULL) {
1
2/*
3 * Copyright (C) Max Romanov
4 * Copyright (C) Igor Sysoev
5 * Copyright (C) Valentin V. Bartenev
6 * Copyright (C) NGINX, Inc.
7 */
8

--- 182 unchanged lines hidden (view full) ---

191 * Only memory allocation failure should return NXT_ERROR.
192 * Any module processing errors are ignored.
193 */
194 ret = NXT_ERROR;
195
196 dl = dlopen(name, RTLD_GLOBAL | RTLD_NOW);
197
198 if (dl == NULL) {
199 nxt_log(task, NXT_LOG_CRIT, "dlopen(\"%s\"), failed: \"%s\"",
200 name, dlerror());
199 nxt_alert(task, "dlopen(\"%s\"), failed: \"%s\"", name, dlerror());
201 return NXT_OK;
202 }
203
204 app = dlsym(dl, "nxt_app_module");
205
206 if (app != NULL) {
207 nxt_log(task, NXT_LOG_NOTICE, "module: %V %V \"%s\"",
208 &app->type, &app->version, name);

--- 48 unchanged lines hidden (view full) ---

257 module->file.start = nxt_mp_alloc(mp, module->file.length);
258 if (module->file.start == NULL) {
259 goto fail;
260 }
261
262 nxt_memcpy(module->file.start, name, module->file.length);
263
264 } else {
200 return NXT_OK;
201 }
202
203 app = dlsym(dl, "nxt_app_module");
204
205 if (app != NULL) {
206 nxt_log(task, NXT_LOG_NOTICE, "module: %V %V \"%s\"",
207 &app->type, &app->version, name);

--- 48 unchanged lines hidden (view full) ---

256 module->file.start = nxt_mp_alloc(mp, module->file.length);
257 if (module->file.start == NULL) {
258 goto fail;
259 }
260
261 nxt_memcpy(module->file.start, name, module->file.length);
262
263 } else {
265 nxt_log(task, NXT_LOG_CRIT, "dlsym(\"%s\"), failed: \"%s\"",
266 name, dlerror());
264 nxt_alert(task, "dlsym(\"%s\"), failed: \"%s\"", name, dlerror());
267 }
268
269done:
270
271 ret = NXT_OK;
272
273fail:
274
275 if (dlclose(dl) != 0) {
265 }
266
267done:
268
269 ret = NXT_OK;
270
271fail:
272
273 if (dlclose(dl) != 0) {
276 nxt_log(task, NXT_LOG_CRIT, "dlclose(\"%s\"), failed: \"%s\"",
277 name, dlerror());
274 nxt_alert(task, "dlclose(\"%s\"), failed: \"%s\"", name, dlerror());
278 }
279
280 return ret;
281}
282
283
284static void
285nxt_discovery_completion_handler(nxt_task_t *task, void *obj, void *data)

--- 21 unchanged lines hidden (view full) ---

307 nxt_int_t ret;
308 nxt_app_lang_module_t *lang;
309 nxt_common_app_conf_t *app_conf;
310
311 app_conf = data;
312
313 lang = nxt_app_lang_module(task->thread->runtime, &app_conf->type);
314 if (nxt_slow_path(lang == NULL)) {
275 }
276
277 return ret;
278}
279
280
281static void
282nxt_discovery_completion_handler(nxt_task_t *task, void *obj, void *data)

--- 21 unchanged lines hidden (view full) ---

304 nxt_int_t ret;
305 nxt_app_lang_module_t *lang;
306 nxt_common_app_conf_t *app_conf;
307
308 app_conf = data;
309
310 lang = nxt_app_lang_module(task->thread->runtime, &app_conf->type);
311 if (nxt_slow_path(lang == NULL)) {
315 nxt_log(task, NXT_LOG_CRIT, "unknown application type: \"%V\"",
316 &app_conf->type);
312 nxt_alert(task, "unknown application type: \"%V\"", &app_conf->type);
317 return NXT_ERROR;
318 }
319
320 nxt_app = lang->module;
321
322 if (nxt_app == NULL) {
323 nxt_debug(task, "application language module: %s \"%s\"",
324 lang->version, lang->file);

--- 41 unchanged lines hidden (view full) ---

366 void *dl;
367
368 dl = dlopen(name, RTLD_GLOBAL | RTLD_LAZY);
369
370 if (dl != NULL) {
371 return dlsym(dl, "nxt_app_module");
372 }
373
313 return NXT_ERROR;
314 }
315
316 nxt_app = lang->module;
317
318 if (nxt_app == NULL) {
319 nxt_debug(task, "application language module: %s \"%s\"",
320 lang->version, lang->file);

--- 41 unchanged lines hidden (view full) ---

362 void *dl;
363
364 dl = dlopen(name, RTLD_GLOBAL | RTLD_LAZY);
365
366 if (dl != NULL) {
367 return dlsym(dl, "nxt_app_module");
368 }
369
374 nxt_log(task, NXT_LOG_CRIT, "dlopen(\"%s\"), failed: \"%s\"",
375 name, dlerror());
370 nxt_alert(task, "dlopen(\"%s\"), failed: \"%s\"", name, dlerror());
376
377 return NULL;
378}
379
380
381void
382nxt_app_quit_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg)
383{

--- 503 unchanged lines hidden ---
371
372 return NULL;
373}
374
375
376void
377nxt_app_quit_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg)
378{

--- 503 unchanged lines hidden ---