From 0e092897a321e32f6eca6a6c37fc489a8f1ba1ef Mon Sep 17 00:00:00 2001 From: Florian Obser Date: Mon, 26 Dec 2022 18:57:51 +0000 Subject: Re-order libraries in parallel to netstart. While netstart is busy setting up the network and waiting for a default route we can already start with reordering libraries since this does not depend on running network, speeding things up. Idea & input deraadt Input & OK kn --- etc/rc | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'etc') diff --git a/etc/rc b/etc/rc index 6edf56e48ef..7ea51ef2427 100644 --- a/etc/rc +++ b/etc/rc @@ -1,4 +1,4 @@ -# $OpenBSD: rc,v 1.565 2022/11/28 14:56:31 cheloha Exp $ +# $OpenBSD: rc,v 1.566 2022/12/26 18:57:50 florian Exp $ # System startup script run by init on autoboot or after single-user. # Output and error are redirected to console by init, and the console is the @@ -188,7 +188,7 @@ reorder_libs() { fi done - echo -n 'reordering libraries:' + echo 'reordering libraries:' # Remount the (read-only) filesystems in _ro_list as read-write. for _mp in $_ro_list; do @@ -215,7 +215,7 @@ reorder_libs() { cd $_tmpdir ar x $_liba if [[ $_lib == ld.so ]]; then - echo -n " $_lib" + echo " $_lib" args="-g -x -e _dl_start \ --version-script=Symbols.map --shared -Bsymbolic \ --no-undefined" @@ -226,7 +226,7 @@ reorder_libs() { $_install /usr/libexec/ld.so /usr/libexec/ld.so.save $_install ld.so.test $_lib_dir/ld.so else - echo -n " ${_lib%%.*}" + echo " ${_lib%%.*}" cc -shared -o $_lib $(ls *.so | sort -R) $(<.ldadd) [[ -s $_lib ]] && file $_lib | fgrep -q 'shared object' LD_BIND_NOW=1 LD_LIBRARY_PATH=$_tmpdir awk 'BEGIN {exit 0}' @@ -251,6 +251,15 @@ reorder_libs() { fi } +# Read output of reorder_libs co-process and output on console. +wait_reorder_libs() { + local _line + while IFS= read -p _line; do + echo -n "$_line" + done + echo +} + # Run rc.* script and email output to root. # Usage: run_upgrade_script firsttime|sysmerge run_upgrade_script() { @@ -452,6 +461,8 @@ mount -s /var >/dev/null 2>&1 # cannot be on NFS mount -s /var/log >/dev/null 2>&1 # cannot be on NFS mount -s /usr >/dev/null 2>&1 # if NFS, fstab must use IP address +reorder_libs 2>&1 |& + start_daemon slaacd dhcpleased resolvd >/dev/null 2>&1 echo 'starting network' @@ -466,7 +477,7 @@ start_daemon unwind >/dev/null 2>&1 random_seed -reorder_libs +wait_reorder_libs # Load pf rules and bring up pfsync interface. if [[ $pf != NO ]]; then -- cgit v1.2.3