From: Christian Brauner Date: Tue, 21 Jul 2020 10:44:09 +0000 (+0200) Subject: terminal: hide unnecessary symbols X-Git-Tag: lxc-5.0.0~384^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd6b82e44c9cb6d2b473aaca7015831d29d7bb59;p=thirdparty%2Flxc.git terminal: hide unnecessary symbols Signed-off-by: Christian Brauner --- diff --git a/src/lxc/Makefile.am b/src/lxc/Makefile.am index 71c45ffa9..57b953636 100644 --- a/src/lxc/Makefile.am +++ b/src/lxc/Makefile.am @@ -151,7 +151,7 @@ liblxc_la_SOURCES = af_unix.c af_unix.h \ sync.c sync.h \ syscall_numbers.h \ syscall_wrappers.h \ - terminal.c \ + terminal.c terminal.h \ utils.c utils.h \ uuid.c uuid.h \ version.h \ @@ -355,7 +355,8 @@ lxc_attach_SOURCES = tools/lxc_attach.c \ start.c start.h \ state.c state.h \ string_utils.c string_utils.h \ - sync.c sync.h + sync.c sync.h \ + terminal.c terminal.h if ENABLE_SECCOMP lxc_attach_SOURCES += seccomp.c lxcseccomp.h endif @@ -385,7 +386,8 @@ lxc_autostart_SOURCES = tools/lxc_autostart.c \ start.c start.h \ state.c state.h \ string_utils.c string_utils.h \ - sync.c sync.h + sync.c sync.h \ + terminal.c terminal.h if ENABLE_SECCOMP lxc_autostart_SOURCES += seccomp.c lxcseccomp.h endif @@ -415,7 +417,8 @@ lxc_cgroup_SOURCES = tools/lxc_cgroup.c \ start.c start.h \ state.c state.h \ string_utils.c string_utils.h \ - sync.c sync.h + sync.c sync.h \ + terminal.c terminal.h if ENABLE_SECCOMP lxc_cgroup_SOURCES += seccomp.c lxcseccomp.h endif @@ -445,7 +448,8 @@ lxc_config_SOURCES = tools/lxc_config.c \ start.c start.h \ state.c state.h \ string_utils.c string_utils.h \ - sync.c sync.h + sync.c sync.h \ + terminal.c terminal.h if ENABLE_SECCOMP lxc_config_SOURCES += seccomp.c lxcseccomp.h endif @@ -475,7 +479,8 @@ lxc_console_SOURCES = tools/lxc_console.c \ start.c start.h \ state.c state.h \ string_utils.c string_utils.h \ - sync.c sync.h + sync.c sync.h \ + terminal.c terminal.h if ENABLE_SECCOMP lxc_console_SOURCES += seccomp.c lxcseccomp.h endif @@ -505,7 +510,8 @@ lxc_destroy_SOURCES = tools/lxc_destroy.c \ start.c start.h \ state.c state.h \ string_utils.c string_utils.h \ - sync.c sync.h + sync.c sync.h \ + terminal.c terminal.h if ENABLE_SECCOMP lxc_destroy_SOURCES += seccomp.c lxcseccomp.h endif @@ -535,7 +541,8 @@ lxc_device_SOURCES = tools/lxc_device.c \ start.c start.h \ state.c state.h \ string_utils.c string_utils.h \ - sync.c sync.h + sync.c sync.h \ + terminal.c terminal.h if ENABLE_SECCOMP lxc_device_SOURCES += seccomp.c lxcseccomp.h endif @@ -565,7 +572,8 @@ lxc_execute_SOURCES = tools/lxc_execute.c \ start.c start.h \ state.c state.h \ string_utils.c string_utils.h \ - sync.c sync.h + sync.c sync.h \ + terminal.c terminal.h if ENABLE_SECCOMP lxc_execute_SOURCES += seccomp.c lxcseccomp.h endif @@ -595,7 +603,8 @@ lxc_freeze_SOURCES = tools/lxc_freeze.c \ start.c start.h \ state.c state.h \ string_utils.c string_utils.h \ - sync.c sync.h + sync.c sync.h \ + terminal.c terminal.h if ENABLE_SECCOMP lxc_freeze_SOURCES += seccomp.c lxcseccomp.h endif @@ -625,7 +634,8 @@ lxc_info_SOURCES = tools/lxc_info.c \ start.c start.h \ state.c state.h \ string_utils.c string_utils.h \ - sync.c sync.h + sync.c sync.h \ + terminal.c terminal.h if ENABLE_SECCOMP lxc_info_SOURCES += seccomp.c lxcseccomp.h endif @@ -656,7 +666,8 @@ lxc_monitor_SOURCES = tools/lxc_monitor.c \ start.c start.h \ state.c state.h \ string_utils.c string_utils.h \ - sync.c sync.h + sync.c sync.h \ + terminal.c terminal.h if ENABLE_SECCOMP lxc_monitor_SOURCES += seccomp.c lxcseccomp.h endif @@ -687,7 +698,8 @@ lxc_ls_SOURCES = tools/lxc_ls.c \ start.c start.h \ state.c state.h \ string_utils.c string_utils.h \ - sync.c sync.h + sync.c sync.h \ + terminal.c terminal.h if ENABLE_SECCOMP lxc_ls_SOURCES += seccomp.c lxcseccomp.h endif @@ -718,7 +730,8 @@ lxc_copy_SOURCES = tools/lxc_copy.c \ state.c state.h \ storage/storage_utils.c storage/storage_utils.h \ string_utils.c string_utils.h \ - sync.c sync.h + sync.c sync.h \ + terminal.c terminal.h if ENABLE_SECCOMP lxc_copy_SOURCES += seccomp.c lxcseccomp.h endif @@ -748,7 +761,8 @@ lxc_start_SOURCES = tools/lxc_start.c \ start.c start.h \ state.c state.h \ string_utils.c string_utils.h \ - sync.c sync.h + sync.c sync.h \ + terminal.c terminal.h if ENABLE_SECCOMP lxc_start_SOURCES += seccomp.c lxcseccomp.h endif @@ -778,7 +792,8 @@ lxc_stop_SOURCES = tools/lxc_stop.c \ start.c start.h \ state.c state.h \ string_utils.c string_utils.h \ - sync.c sync.h + sync.c sync.h \ + terminal.c terminal.h if ENABLE_SECCOMP lxc_stop_SOURCES += seccomp.c lxcseccomp.h endif @@ -808,7 +823,8 @@ lxc_top_SOURCES = tools/lxc_top.c \ start.c start.h \ state.c state.h \ string_utils.c string_utils.h \ - sync.c sync.h + sync.c sync.h \ + terminal.c terminal.h if ENABLE_SECCOMP lxc_top_SOURCES += seccomp.c lxcseccomp.h endif @@ -838,7 +854,8 @@ lxc_unfreeze_SOURCES = tools/lxc_unfreeze.c \ start.c start.h \ state.c state.h \ string_utils.c string_utils.h \ - sync.c sync.h + sync.c sync.h \ + terminal.c terminal.h if ENABLE_SECCOMP lxc_unfreeze_SOURCES += seccomp.c lxcseccomp.h endif @@ -870,7 +887,8 @@ lxc_unshare_SOURCES = tools/lxc_unshare.c \ string_utils.c string_utils.h \ sync.c sync.h \ syscall_numbers.h \ - syscall_wrappers.h + syscall_wrappers.h \ + terminal.c terminal.h if ENABLE_SECCOMP lxc_unshare_SOURCES += seccomp.c lxcseccomp.h endif @@ -900,7 +918,8 @@ lxc_wait_SOURCES = tools/lxc_wait.c \ start.c start.h \ state.c state.h \ string_utils.c string_utils.h \ - sync.c sync.h + sync.c sync.h \ + terminal.c terminal.h if ENABLE_SECCOMP lxc_wait_SOURCES += seccomp.c lxcseccomp.h endif @@ -931,7 +950,8 @@ lxc_create_SOURCES = tools/lxc_create.c \ state.c state.h \ storage/storage_utils.c storage/storage_utils.h \ string_utils.c string_utils.h \ - sync.c sync.h + sync.c sync.h \ + terminal.c terminal.h if ENABLE_SECCOMP lxc_create_SOURCES += seccomp.c lxcseccomp.h endif @@ -961,7 +981,8 @@ lxc_snapshot_SOURCES = tools/lxc_snapshot.c \ start.c start.h \ state.c state.h \ string_utils.c string_utils.h \ - sync.c sync.h + sync.c sync.h \ + terminal.c terminal.h if ENABLE_SECCOMP lxc_snapshot_SOURCES += seccomp.c lxcseccomp.h endif @@ -991,7 +1012,8 @@ lxc_checkpoint_SOURCES = tools/lxc_checkpoint.c \ start.c start.h \ state.c state.h \ string_utils.c string_utils.h \ - sync.c sync.h + sync.c sync.h \ + terminal.c terminal.h if ENABLE_SECCOMP lxc_checkpoint_SOURCES += seccomp.c lxcseccomp.h endif @@ -1045,6 +1067,7 @@ lxc_monitord_SOURCES = cmd/lxc_monitord.c \ string_utils.c string_utils.h \ sync.c sync.h \ syscall_numbers.h \ + terminal.c terminal.h \ utils.c utils.h if ENABLE_SECCOMP lxc_monitord_SOURCES += seccomp.c lxcseccomp.h @@ -1078,7 +1101,8 @@ lxc_user_nic_SOURCES = cmd/lxc_user_nic.c \ string_utils.c string_utils.h \ sync.c sync.h \ syscall_numbers.h \ - syscall_wrappers.h + syscall_wrappers.h \ + terminal.c terminal.h if ENABLE_SECCOMP lxc_user_nic_SOURCES += seccomp.c lxcseccomp.h endif @@ -1112,6 +1136,7 @@ lxc_usernsexec_SOURCES = cmd/lxc_usernsexec.c \ string_utils.c string_utils.h \ sync.c sync.h \ syscall_wrappers.h \ + terminal.c terminal.h \ utils.c utils.h if ENABLE_SECCOMP lxc_usernsexec_SOURCES += seccomp.c lxcseccomp.h diff --git a/src/lxc/terminal.h b/src/lxc/terminal.h index 0b652001d..e17a7a9fe 100644 --- a/src/lxc/terminal.h +++ b/src/lxc/terminal.h @@ -6,6 +6,7 @@ #include #include +#include "compiler.h" #include "list.h" #include "macro.h" #include "ringbuf.h" @@ -98,7 +99,7 @@ struct lxc_terminal { * indication that the console or tty is no longer in use * @ttyreq : the tty requested to be opened, -1 for any, 0 for the console */ -extern int lxc_terminal_allocate(struct lxc_conf *conf, int sockfd, int *ttynum); +__hidden extern int lxc_terminal_allocate(struct lxc_conf *conf, int sockfd, int *ttynum); /** * Create a new terminal: @@ -109,19 +110,19 @@ extern int lxc_terminal_allocate(struct lxc_conf *conf, int sockfd, int *ttynum * - sets up SIGWINCH handler, winsz, and new terminal settings * (Handlers for SIGWINCH and I/O are not registered in a mainloop.) */ -extern int lxc_terminal_create(struct lxc_terminal *console); +__hidden extern int lxc_terminal_create(struct lxc_terminal *console); /** * lxc_terminal_setup: Create a new terminal. * - In addition to lxc_terminal_create() also sets up logging. */ -extern int lxc_terminal_setup(struct lxc_conf *); +__hidden extern int lxc_terminal_setup(struct lxc_conf *); /** * Delete a terminal created via lxc_terminal_create() or lxc_terminal_setup(): * Note, registered handlers are not automatically deleted. */ -extern void lxc_terminal_delete(struct lxc_terminal *); +__hidden extern void lxc_terminal_delete(struct lxc_terminal *); /** * lxc_terminal_free: mark the terminal as unallocated and free any resources @@ -132,17 +133,17 @@ extern void lxc_terminal_delete(struct lxc_terminal *); * the terminal is no longer in use. this is used to match * which terminal is being freed. */ -extern void lxc_terminal_free(struct lxc_conf *conf, int fd); +__hidden extern void lxc_terminal_free(struct lxc_conf *conf, int fd); /** * Register terminal event handlers in an open mainloop. */ -extern int lxc_terminal_mainloop_add(struct lxc_epoll_descr *, struct lxc_terminal *); +__hidden extern int lxc_terminal_mainloop_add(struct lxc_epoll_descr *, struct lxc_terminal *); /** * Handle SIGWINCH events on the allocated terminals. */ -extern void lxc_terminal_sigwinch(int sig); +__hidden extern void lxc_terminal_sigwinch(int sig); /** * Connect to one of the ttys given to the container via lxc.tty.max. @@ -153,9 +154,8 @@ extern void lxc_terminal_sigwinch(int sig); * - registers SIGWINCH, I/O handlers in the mainloop * - performs all necessary cleanup operations */ -extern int lxc_console(struct lxc_container *c, int ttynum, - int stdinfd, int stdoutfd, int stderrfd, - int escape); +__hidden extern int lxc_console(struct lxc_container *c, int ttynum, int stdinfd, int stdoutfd, + int stderrfd, int escape); /** * Allocate one of the tty given to the container via lxc.tty.max. Returns an @@ -163,15 +163,14 @@ extern int lxc_console(struct lxc_container *c, int ttynum, * Set ttynum to -1 to allocate the first available tty, or to a value within * the range specified by lxc.tty.max to allocate a specific tty. */ -extern int lxc_terminal_getfd(struct lxc_container *c, int *ttynum, - int *ptxfd); +__hidden extern int lxc_terminal_getfd(struct lxc_container *c, int *ttynum, int *ptxfd); /** * Make fd a duplicate of the standard file descriptors. The fd is made a * duplicate of a specific standard file descriptor iff the standard file * descriptor refers to a terminal. */ -extern int lxc_terminal_set_stdfds(int fd); +__hidden extern int lxc_terminal_set_stdfds(int fd); /** * Handler for events on the stdin fd of the terminal. To be registered via the @@ -179,8 +178,8 @@ extern int lxc_terminal_set_stdfds(int fd); * lxc_terminal_mainloop_add(). * This function exits the loop cleanly when an EPOLLHUP event is received. */ -extern int lxc_terminal_stdin_cb(int fd, uint32_t events, void *cbdata, - struct lxc_epoll_descr *descr); +__hidden extern int lxc_terminal_stdin_cb(int fd, uint32_t events, void *cbdata, + struct lxc_epoll_descr *descr); /** * Handler for events on the ptx fd of the terminal. To be registered via @@ -188,15 +187,14 @@ extern int lxc_terminal_stdin_cb(int fd, uint32_t events, void *cbdata, * lxc_terminal_mainloop_add(). * This function exits the loop cleanly when an EPOLLHUP event is received. */ -extern int lxc_terminal_ptx_cb(int fd, uint32_t events, void *cbdata, - struct lxc_epoll_descr *descr); +__hidden extern int lxc_terminal_ptx_cb(int fd, uint32_t events, void *cbdata, + struct lxc_epoll_descr *descr); /** * Setup new terminal properties. The old terminal settings are stored in * oldtios. */ -extern int lxc_setup_tios(int fd, struct termios *oldtios); - +__hidden extern int lxc_setup_tios(int fd, struct termios *oldtios); /** * lxc_terminal_winsz: propagate winsz from one terminal to another @@ -206,7 +204,7 @@ extern int lxc_setup_tios(int fd, struct termios *oldtios); * @dstfd * - terminal to set size on (typically a ptx pty) */ -extern void lxc_terminal_winsz(int srcfd, int dstfd); +__hidden extern void lxc_terminal_winsz(int srcfd, int dstfd); /* * lxc_terminal_signal_init: install signal handler @@ -232,26 +230,25 @@ extern void lxc_terminal_winsz(int srcfd, int dstfd); * * This function allocates memory. It is up to the caller to free it. */ -extern struct lxc_terminal_state *lxc_terminal_signal_init(int srcfd, int dstfd); +__hidden extern struct lxc_terminal_state *lxc_terminal_signal_init(int srcfd, int dstfd); /** * Handler for signal events. To be registered via the corresponding functions * declared and defined in mainloop.{c,h} or lxc_terminal_mainloop_add(). */ -extern int lxc_terminal_signalfd_cb(int fd, uint32_t events, void *cbdata, - struct lxc_epoll_descr *descr); - -extern int lxc_terminal_write_ringbuffer(struct lxc_terminal *terminal); -extern int lxc_terminal_create_log_file(struct lxc_terminal *terminal); -extern int lxc_terminal_io_cb(int fd, uint32_t events, void *data, - struct lxc_epoll_descr *descr); - -extern int lxc_make_controlling_terminal(int fd); -extern int lxc_terminal_prepare_login(int fd); -extern void lxc_terminal_conf_free(struct lxc_terminal *terminal); -extern void lxc_terminal_info_init(struct lxc_terminal_info *terminal); -extern void lxc_terminal_init(struct lxc_terminal *terminal); -extern int lxc_terminal_map_ids(struct lxc_conf *c, - struct lxc_terminal *terminal); +__hidden extern int lxc_terminal_signalfd_cb(int fd, uint32_t events, void *cbdata, + struct lxc_epoll_descr *descr); + +__hidden extern int lxc_terminal_write_ringbuffer(struct lxc_terminal *terminal); +__hidden extern int lxc_terminal_create_log_file(struct lxc_terminal *terminal); +__hidden extern int lxc_terminal_io_cb(int fd, uint32_t events, void *data, + struct lxc_epoll_descr *descr); + +__hidden extern int lxc_make_controlling_terminal(int fd); +__hidden extern int lxc_terminal_prepare_login(int fd); +__hidden extern void lxc_terminal_conf_free(struct lxc_terminal *terminal); +__hidden extern void lxc_terminal_info_init(struct lxc_terminal_info *terminal); +__hidden extern void lxc_terminal_init(struct lxc_terminal *terminal); +__hidden extern int lxc_terminal_map_ids(struct lxc_conf *c, struct lxc_terminal *terminal); #endif /* __LXC_TERMINAL_H */ diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am index ffec3e36b..1fdcee07a 100644 --- a/src/tests/Makefile.am +++ b/src/tests/Makefile.am @@ -31,7 +31,8 @@ lxc_test_api_reboot_SOURCES = api_reboot.c \ ../lxc/start.c ../lxc/start.h \ ../lxc/state.c ../lxc/state.h \ ../lxc/sync.c ../lxc/sync.h \ - ../lxc/string_utils.c ../lxc/string_utils.h + ../lxc/string_utils.c ../lxc/string_utils.h \ + ../lxc/terminal.c ../lxc/terminal.h if ENABLE_SECCOMP lxc_test_api_reboot_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h endif @@ -61,7 +62,8 @@ lxc_test_attach_SOURCES = attach.c \ ../lxc/start.c ../lxc/start.h \ ../lxc/state.c ../lxc/state.h \ ../lxc/sync.c ../lxc/sync.h \ - ../lxc/string_utils.c ../lxc/string_utils.h + ../lxc/string_utils.c ../lxc/string_utils.h \ + ../lxc/terminal.c ../lxc/terminal.h if ENABLE_SECCOMP lxc_test_attach_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h endif @@ -91,7 +93,8 @@ lxc_test_cgpath_SOURCES = cgpath.c \ ../lxc/start.c ../lxc/start.h \ ../lxc/state.c ../lxc/state.h \ ../lxc/sync.c ../lxc/sync.h \ - ../lxc/string_utils.c ../lxc/string_utils.h + ../lxc/string_utils.c ../lxc/string_utils.h \ + ../lxc/terminal.c ../lxc/terminal.h if ENABLE_SECCOMP lxc_test_cgpath_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h endif @@ -123,7 +126,8 @@ lxc_test_config_jump_table_SOURCES = config_jump_table.c \ ../lxc/start.c ../lxc/start.h \ ../lxc/state.c ../lxc/state.h \ ../lxc/sync.c ../lxc/sync.h \ - ../lxc/string_utils.c ../lxc/string_utils.h + ../lxc/string_utils.c ../lxc/string_utils.h \ + ../lxc/terminal.c ../lxc/terminal.h if ENABLE_SECCOMP lxc_test_config_jump_table_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h endif @@ -176,7 +180,8 @@ lxc_test_parse_config_file_SOURCES = parse_config_file.c \ ../lxc/start.c ../lxc/start.h \ ../lxc/state.c ../lxc/state.h \ ../lxc/sync.c ../lxc/sync.h \ - ../lxc/string_utils.c ../lxc/string_utils.h + ../lxc/string_utils.c ../lxc/string_utils.h \ + ../lxc/terminal.c ../lxc/terminal.h if ENABLE_SECCOMP lxc_test_parse_config_file_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h endif @@ -229,7 +234,8 @@ lxc_test_utils_SOURCES = lxc-test-utils.c \ ../lxc/start.c ../lxc/start.h \ ../lxc/state.c ../lxc/state.h \ ../lxc/sync.c ../lxc/sync.h \ - ../lxc/string_utils.c ../lxc/string_utils.h + ../lxc/string_utils.c ../lxc/string_utils.h \ + ../lxc/terminal.c ../lxc/terminal.h if ENABLE_SECCOMP lxc_test_utils_SOURCES += ../lxc/seccomp.c ../lxc/lxcseccomp.h endif