aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2026-01-24 05:21:10 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2026-01-24 05:22:33 +0100
commit43982ed49962526f7f042bcd9c5eb05ab4e586de (patch)
treef4ae8a35c49117808a833cd1ddc1a6280e71ed5c /include
parent1a64fe3594b80dabcc7ccb7dce5b3391b27b0d24 (diff)
downloadbusybox-w32-43982ed49962526f7f042bcd9c5eb05ab4e586de.tar.gz
busybox-w32-43982ed49962526f7f042bcd9c5eb05ab4e586de.tar.bz2
busybox-w32-43982ed49962526f7f042bcd9c5eb05ab4e586de.zip
httpd: code shrink via "split-globals" trick
function old new delta httpd_main 957 968 +11 log_and_exit 25 26 +1 send_headers 712 708 -4 handle_incoming_and_exit 2292 2285 -7 sigalrm_handler 102 93 -9 parse_conf 1332 1323 -9 send_cgi_and_exit 803 790 -13 cgi_io_loop_and_exit 656 635 -21 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/6 up/down: 12/-63) Total: -51 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'include')
-rw-r--r--include/libbb.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 8d252d455..17c9bc785 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -457,6 +457,11 @@ void *xmmap_anon(size_t size) FAST_FUNC;
457//sparc64,alpha,openrisc: fixed 8k pages 457//sparc64,alpha,openrisc: fixed 8k pages
458#endif 458#endif
459 459
460#if defined(__x86_64__) || defined(i386)
461/* 0x7f would be better, but it causes alignment problems */
462# define ARCH_GLOBAL_PTR_OFF 0x80
463#endif
464
460#if defined BB_ARCH_FIXED_PAGESIZE 465#if defined BB_ARCH_FIXED_PAGESIZE
461# define IF_VARIABLE_ARCH_PAGESIZE(...) /*nothing*/ 466# define IF_VARIABLE_ARCH_PAGESIZE(...) /*nothing*/
462# define bb_getpagesize() BB_ARCH_FIXED_PAGESIZE 467# define bb_getpagesize() BB_ARCH_FIXED_PAGESIZE
@@ -2423,6 +2428,16 @@ void XZALLOC_CONST_PTR(const void *pptr, size_t size) FAST_FUNC;
2423 } \ 2428 } \
2424} while (0) 2429} while (0)
2425 2430
2431#if defined(ARCH_GLOBAL_PTR_OFF)
2432# define SET_OFFSET_PTR_TO_GLOBALS(x) \
2433 ASSIGN_CONST_PTR(&ptr_to_globals, (char*)(x) + ARCH_GLOBAL_PTR_OFF)
2434# define OFFSET_PTR_TO_GLOBALS \
2435 ((struct globals*)((char*)ptr_to_globals - ARCH_GLOBAL_PTR_OFF))
2436#else
2437# define SET_OFFSET_PTR_TO_GLOBALS(x) SET_PTR_TO_GLOBALS(x)
2438# define OFFSET_PTR_TO_GLOBALS ptr_to_globals
2439#endif
2440
2426 2441
2427/* You can change LIBBB_DEFAULT_LOGIN_SHELL, but don't use it, 2442/* You can change LIBBB_DEFAULT_LOGIN_SHELL, but don't use it,
2428 * use bb_default_login_shell and following defines. 2443 * use bb_default_login_shell and following defines.