MCPcopy Create free account
hub / github.com/apache/trafficserver / TSPluginInit

Function TSPluginInit

tests/tools/plugins/cont_schedule.cc:357–408  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

355}
356
357void
358TSPluginInit(int argc, const char *argv[])
359{
360 if (argc == 2) {
361 int len = strlen(argv[1]);
362 if (len == 8 && strncmp(argv[1], "affinity", 8) == 0) {
363 Dbg(dbg_ctl_init, "initializing plugin for testing TSContThreadAffinity");
364 test_flag = 1;
365 } else if (len == 4 && strncmp(argv[1], "pool", 4) == 0) {
366 Dbg(dbg_ctl_init, "initializing plugin for testing TSContScheduleOnPool");
367 test_flag = 2;
368 } else if (len == 6 && strncmp(argv[1], "thread", 6) == 0) {
369 Dbg(dbg_ctl_init, "initializing plugin for testing TSContScheduleOnThread");
370 test_flag = 3;
371 } else if (len == 6 && strncmp(argv[1], "entire", 6) == 0) {
372 Dbg(dbg_ctl_init, "initializing plugin for testing TSContScheduleOnEntirePool");
373 test_flag = 4;
374 } else if (len == 10 && strncmp(argv[1], "every_pool", 10) == 0) {
375 Dbg(dbg_ctl_init, "initializing plugin for testing TSContScheduleEveryOnPool");
376 test_flag = 5;
377 } else if (len == 12 && strncmp(argv[1], "every_thread", 12) == 0) {
378 Dbg(dbg_ctl_init, "initializing plugin for testing TSContScheduleEveryOnThread");
379 test_flag = 6;
380 } else if (len == 12 && strncmp(argv[1], "every_entire", 12) == 0) {
381 Dbg(dbg_ctl_init, "initializing plugin for testing TSContScheduleEveryOnEntirePool");
382 test_flag = 7;
383 } else {
384 goto Lerror;
385 }
386 } else {
387 goto Lerror;
388 }
389
390 TSPluginRegistrationInfo info;
391
392 info.plugin_name = plugin_name;
393 info.vendor_name = vendor_name;
394 info.support_email = support_email;
395
396 if (TSPluginRegister(&info) != TS_SUCCESS) {
397 Dbg(dbg_ctl_init, "[%s] plugin registration failed", plugin_name);
398 abort();
399 }
400
401 TSLifecycleHookAdd(TS_LIFECYCLE_TASK_THREADS_READY_HOOK, TSContCreate(LifecycleHookTracer, TSMutexCreate()));
402
403 return;
404
405Lerror:
406 Dbg(dbg_ctl_init, "[%s] plugin invalid argument", plugin_name);
407 abort();
408}

Callers

nothing calls this directly

Calls 5

TSPluginRegisterFunction · 0.85
abortFunction · 0.85
TSLifecycleHookAddFunction · 0.85
TSContCreateFunction · 0.85
TSMutexCreateFunction · 0.85

Tested by

no test coverage detected