From 4e6d5117b839cef41cd3919966f95bf25d24d8d9 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Wed, 12 Mar 2008 22:14:34 +0000 Subject: inetd: make it NOMMU-capable and IPv6-friendly. Lots of renames of variable/function names Total: -2474 bytes text data bss dec hex filename 802215 661 7452 810328 c5d58 busybox_old 800120 661 7428 808209 c5511 busybox_unstripped --- include/libbb.h | 17 +++++++++++------ include/usage.h | 18 ++++++++++-------- 2 files changed, 21 insertions(+), 14 deletions(-) (limited to 'include') diff --git a/include/libbb.h b/include/libbb.h index 6e10cdc41..3c53e5e68 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -390,6 +390,7 @@ typedef struct len_and_sockaddr { } u; } len_and_sockaddr; enum { + LSA_LEN_SIZE = offsetof(len_and_sockaddr, u), LSA_SIZEOF_SA = sizeof( union { struct sockaddr sa; @@ -405,7 +406,12 @@ enum { * af == AF_UNSPEC will result in trying to create IPv6 socket, * and if kernel doesn't support it, IPv4. */ -int xsocket_type(len_and_sockaddr **lsap, USE_FEATURE_IPV6(int af,) int sock_type); +#if ENABLE_FEATURE_IPV6 +int xsocket_type(len_and_sockaddr **lsap, int af, int sock_type); +#else +int xsocket_type(len_and_sockaddr **lsap, int sock_type); +#define xsocket_type(lsap, af, sock_type) xsocket_type((lsap), (sock_type)) +#endif int xsocket_stream(len_and_sockaddr **lsap); /* Create server socket bound to bindaddr:port. bindaddr can be NULL, * numeric IP ("N.N.N.N") or numeric IPv6 address, @@ -430,14 +436,13 @@ len_and_sockaddr* host2sockaddr(const char *host, int port); /* Version which dies on error */ len_and_sockaddr* xhost2sockaddr(const char *host, int port); len_and_sockaddr* xdotted2sockaddr(const char *host, int port); -#if ENABLE_FEATURE_IPV6 /* Same, useful if you want to force family (e.g. IPv6) */ +#if !ENABLE_FEATURE_IPV6 +#define host_and_af2sockaddr(host, port, af) host2sockaddr((host), (port)) +#define xhost_and_af2sockaddr(host, port, af) xhost2sockaddr((host), (port)) +#else len_and_sockaddr* host_and_af2sockaddr(const char *host, int port, sa_family_t af); len_and_sockaddr* xhost_and_af2sockaddr(const char *host, int port, sa_family_t af); -#else -/* [we evaluate af: think about "host_and_af2sockaddr(..., af++)"] */ -#define host_and_af2sockaddr(host, port, af) ((void)(af), host2sockaddr((host), (port))) -#define xhost_and_af2sockaddr(host, port, af) ((void)(af), xhost2sockaddr((host), (port))) #endif /* Assign sin[6]_port member if the socket is an AF_INET[6] one, * otherwise no-op. Useful for ftp. diff --git a/include/usage.h b/include/usage.h index a6d970de6..76beb176f 100644 --- a/include/usage.h +++ b/include/usage.h @@ -1597,7 +1597,7 @@ USE_FEATURE_BRCTL_FANCY("\n" \ " -a De/configure all interfaces automatically\n" \ " -i FILE Use FILE for interface definitions\n" \ " -n Print out what would happen, but don't do it\n" \ - " (note that this option doesn't disable mappings)\n" \ + " (note: doesn't disable mappings)\n" \ " -v Print out what would happen before doing it\n" \ " -m Don't run any mappings\n" \ " -f Force de/configuration" @@ -1609,19 +1609,21 @@ USE_FEATURE_BRCTL_FANCY("\n" \ " -a De/configure all interfaces automatically\n" \ " -i FILE Use FILE for interface definitions\n" \ " -n Print out what would happen, but don't do it\n" \ - " (note that this option doesn't disable mappings)\n" \ + " (note: doesn't disable mappings)\n" \ " -v Print out what would happen before doing it\n" \ " -m Don't run any mappings\n" \ " -f Force de/configuration" #define inetd_trivial_usage \ - "[-f] [-q len] [conf]" + "[-fe] [-q N] [-R N] [CONFFILE]" #define inetd_full_usage \ - "Listen for network connections and launch programs" \ - "\n\nOptions:\n" \ - " -f Run in foreground\n" \ - " -q N Set the size of the socket listen queue to N\n" \ - " (default: 128)" + "Listen for network connections and launch programs\n" \ + "\nOptions:" \ + "\n -f Run in foreground" \ + "\n -e Log to stderr" \ + "\n -q N Socket listen queue (default: 128)" \ + "\n -R N Pause services after N connects/min" \ + "\n (default: 0 - disabled)" #define init_trivial_usage \ "" -- cgit v1.2.3