From 2856dab4770e521a87c18b04ae8ebc209a9b95f9 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Sun, 1 Apr 2007 01:18:20 +0000 Subject: tcpsvd: new applet It's a GPL-ed 'clone' of Dan Bernstein's tcpserver. Author: Gerrit Pape http://smarden.sunsite.dk/ipsvd/ size tcpsvd.o text data bss dec hex filename 2571 4 16 2591 a1f tcpsvd.o --- include/applets.h | 1 + include/libbb.h | 21 ++++++++++++++++++++- include/usage.h | 5 +++++ 3 files changed, 26 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/applets.h b/include/applets.h index 77258be..8073c15 100644 --- a/include/applets.h +++ b/include/applets.h @@ -293,6 +293,7 @@ USE_SYSLOGD(APPLET(syslogd, _BB_DIR_SBIN, _BB_SUID_NEVER)) USE_TAIL(APPLET(tail, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) USE_TAR(APPLET(tar, _BB_DIR_BIN, _BB_SUID_NEVER)) USE_TASKSET(APPLET(taskset, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) +USE_TCPSVD(APPLET(tcpsvd, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) USE_TEE(APPLET(tee, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) USE_TELNET(APPLET(telnet, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) USE_TELNETD(APPLET(telnetd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER)) diff --git a/include/libbb.h b/include/libbb.h index 7f0ad2c..794049d 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -266,6 +266,7 @@ char *xrealloc_getcwd_or_warn(char *cwd); char *xmalloc_readlink_or_warn(const char *path); char *xmalloc_realpath(const char *path); extern void xstat(const char *filename, struct stat *buf); + /* Unlike waitpid, waits ONLY for one process, * It's safe to pass negative 'pids' from failed [v]fork - * wait4pid will return -1 and ECHILD in errno. @@ -274,6 +275,24 @@ extern void xstat(const char *filename, struct stat *buf); * if (rc > 0) bb_error_msg("exit code: %d", rc); */ extern int wait4pid(int pid); +extern int wait_pid(int *wstat, int pid); +extern int wait_nohang(int *wstat); +//TODO: signal(sid, f) is the same? then why? +extern void sig_catch(int,void (*)(int)); +//#define sig_ignore(s) (sig_catch((s), SIG_IGN)) +//#define sig_uncatch(s) (sig_catch((s), SIG_DFL)) +extern void sig_block(int); +extern void sig_unblock(int); +/* UNUSED: extern void sig_blocknone(void);*/ +extern void sig_pause(void); + +#define wait_crashed(w) ((w) & 127) +#define wait_exitcode(w) ((w) >> 8) +#define wait_stopsig(w) ((w) >> 8) +#define wait_stopped(w) (((w) & 127) == 127) + + + extern void xsetgid(gid_t gid); extern void xsetuid(uid_t uid); extern void xchdir(const char *path); @@ -340,7 +359,7 @@ len_and_sockaddr* xhost_and_af2sockaddr(const char *host, int port, sa_family_t * NB: does NOT do htons() internally, just direct assignment. */ void set_nport(len_and_sockaddr *lsa, unsigned port); /* Retrieve sin[6]_port or return -1 for non-INET[6] lsa's */ -int get_nport(const len_and_sockaddr *lsa); +int get_nport(const struct sockaddr *sa); /* Reverse DNS. Returns NULL on failure. */ char* xmalloc_sockaddr2host(const struct sockaddr *sa, socklen_t salen); /* This one doesn't append :PORTNUM */ diff --git a/include/usage.h b/include/usage.h index a19bcf7..09b6908 100644 --- a/include/usage.h +++ b/include/usage.h @@ -3325,6 +3325,11 @@ USE_FEATURE_RUN_PARTS_FANCY("\n -l Prints names of all matching files even when "$ echo $?\n" \ "1\n" +#define tcpsvd_trivial_usage \ + "TODO" +#define tcpsvd_full_usage \ + "TODO" + #define tftp_trivial_usage \ "[OPTION]... HOST [PORT]" #define tftp_full_usage \ -- cgit v1.1