diff options
Diffstat (limited to 'vlib')
-rw-r--r-- | vlib/vlib/threads.c | 12 | ||||
-rw-r--r-- | vlib/vlib/unix/main.c | 5 |
2 files changed, 12 insertions, 5 deletions
diff --git a/vlib/vlib/threads.c b/vlib/vlib/threads.c index 72f340ea205..302e201397b 100644 --- a/vlib/vlib/threads.c +++ b/vlib/vlib/threads.c @@ -77,6 +77,18 @@ os_get_cpu_number (void) return n; } +uword +os_get_ncpus (void) +{ + u32 len; + + len = vec_len (vlib_thread_stacks); + if (len == 0) + return 1; + else + return len; +} + void vlib_set_thread_name (char *name) { diff --git a/vlib/vlib/unix/main.c b/vlib/vlib/unix/main.c index 3c17031b884..efa4f20f03f 100644 --- a/vlib/vlib/unix/main.c +++ b/vlib/vlib/unix/main.c @@ -439,8 +439,6 @@ int vlib_unix_main (int argc, char *argv[]) { vlib_main_t *vm = &vlib_global_main; /* one and only time for this! */ - - clib_smp_main_t *sm = &clib_smp_main; vlib_thread_main_t *tm = &vlib_thread_main; unformat_input_t input; u8 *thread_stacks; @@ -472,9 +470,6 @@ vlib_unix_main (int argc, char *argv[]) ((uword) tm->n_thread_stacks * VLIB_THREAD_STACK_SIZE, (VLIB_MAX_CPUS << VLIB_LOG2_THREAD_STACK_SIZE)); - sm->vm_base = thread_stacks; - sm->log2_n_per_cpu_vm_bytes = VLIB_LOG2_THREAD_STACK_SIZE; - vec_validate (vlib_thread_stacks, tm->n_thread_stacks - 1); for (i = 0; i < vec_len (vlib_thread_stacks); i++) { |