Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
vlib: unix trivial- clean up typos in docs
[vpp.git]
/
src
/
vlib
/
unix
/
main.c
diff --git
a/src/vlib/unix/main.c
b/src/vlib/unix/main.c
index
24ae416
..
f306b2e
100755
(executable)
--- a/
src/vlib/unix/main.c
+++ b/
src/vlib/unix/main.c
@@
-67,10
+67,15
@@
unix_main_init (vlib_main_t * vm)
{
unix_main_t *um = &unix_main;
um->vlib_main = vm;
{
unix_main_t *um = &unix_main;
um->vlib_main = vm;
- return
vlib_call_init_function (vm, unix_input_init)
;
+ return
0
;
}
}
-VLIB_INIT_FUNCTION (unix_main_init);
+/* *INDENT-OFF* */
+VLIB_INIT_FUNCTION (unix_main_init) =
+{
+ .runs_before = VLIB_INITS ("unix_input_init"),
+};
+/* *INDENT-ON* */
static int
unsetup_signal_handlers (int sig)
static int
unsetup_signal_handlers (int sig)
@@
-86,7
+91,7
@@
unsetup_signal_handlers (int sig)
/* allocate this buffer from mheap when setting up the signal handler.
dangerous to vec_resize it when crashing, mheap itself might have been
/* allocate this buffer from mheap when setting up the signal handler.
dangerous to vec_resize it when crashing, mheap itself might have been
- corrupt
t
ed already */
+ corrupted already */
static u8 *syslog_msg = 0;
static int last_signum = 0;
static uword last_faulting_address = 0;
static u8 *syslog_msg = 0;
static int last_signum = 0;
static uword last_faulting_address = 0;
@@
-139,6
+144,17
@@
unix_signal_handler (int signum, siginfo_t * si, ucontext_t * uc)
break;
}
break;
}
+#ifdef CLIB_GCOV
+ /*
+ * Test framework sends SIGTERM, so we need to flush the
+ * code coverage stats here.
+ */
+ {
+ void __gcov_flush (void);
+ __gcov_flush ();
+ }
+#endif
+
/* Null terminate. */
vec_add1 (syslog_msg, 0);
/* Null terminate. */
vec_add1 (syslog_msg, 0);
@@
-161,7
+177,7
@@
unix_signal_handler (int signum, siginfo_t * si, ucontext_t * uc)
syslog (LOG_ERR | LOG_DAEMON, "%s", syslog_msg);
}
syslog (LOG_ERR | LOG_DAEMON, "%s", syslog_msg);
}
- /* have to remove SIGABRT to avoid recusive - os_exit calling abort() */
+ /* have to remove SIGABRT to avoid recu
r
sive - os_exit calling abort() */
unsetup_signal_handlers (SIGABRT);
os_exit (1);
unsetup_signal_handlers (SIGABRT);
os_exit (1);
@@
-484,6
+500,11
@@
unix_config (vlib_main_t * vm, unformat_input_t * input)
vlib_default_runtime_dir, 0);
}
vlib_default_runtime_dir, 0);
}
+ /* Ensure the runtime directory is created */
+ error = vlib_unix_recursive_mkdir ((char *) um->runtime_dir);
+ if (error)
+ return error;
+
error = setup_signal_handlers (um);
if (error)
return error;
error = setup_signal_handlers (um);
if (error)
return error;
@@
-630,9
+651,9
@@
thread0 (uword arg)
u8 *
vlib_thread_stack_init (uword thread_index)
{
u8 *
vlib_thread_stack_init (uword thread_index)
{
-
vec_validate (vlib_thread_stacks, thread_index
);
+
ASSERT (thread_index < vec_len (vlib_thread_stacks)
);
vlib_thread_stacks[thread_index] = clib_mem_alloc_aligned
vlib_thread_stacks[thread_index] = clib_mem_alloc_aligned
- (VLIB_THREAD_STACK_SIZE,
VLIB_THREAD_STACK_SIZE
);
+ (VLIB_THREAD_STACK_SIZE,
clib_mem_get_page_size ()
);
/*
* Disallow writes to the bottom page of the stack, to
/*
* Disallow writes to the bottom page of the stack, to
@@
-685,6
+706,7
@@
vlib_unix_main (int argc, char *argv[])
/* always load symbols, for signal handler and mheap memory get/put backtrace */
clib_elf_main_init (vm->name);
/* always load symbols, for signal handler and mheap memory get/put backtrace */
clib_elf_main_init (vm->name);
+ vec_validate (vlib_thread_stacks, 0);
vlib_thread_stack_init (0);
__os_thread_index = 0;
vlib_thread_stack_init (0);
__os_thread_index = 0;