summaryrefslogtreecommitdiffstats
path: root/bin/sh/bltin
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2010-12-21 22:47:34 +0000
committerjilles <jilles@FreeBSD.org>2010-12-21 22:47:34 +0000
commitae2aabc34981e0a4fc74b41bde3cfd6ff4166022 (patch)
tree571f5b4935a3ac4f69aff2b5cfb327687b1f59fe /bin/sh/bltin
parent0a77d10ec99ee3d8cfd396b81e6fb1d1a9c4e1de (diff)
downloadFreeBSD-src-ae2aabc34981e0a4fc74b41bde3cfd6ff4166022.zip
FreeBSD-src-ae2aabc34981e0a4fc74b41bde3cfd6ff4166022.tar.gz
sh: Add kill builtin.
This allows specifying a %job (which is equivalent to the corresponding process group). Additionally, it improves reliability of kill from sh in high-load situations and ensures "kill" finds the correct utility regardless of PATH, as required by POSIX (unless the undocumented %builtin mechanism is used). Side effect: fatal errors (any error other than kill(2) failure) now return exit status 2 instead of 1. (This is consistent with other sh builtins, but not in NetBSD.) Code size increases about 1K on i386. Obtained from: NetBSD
Diffstat (limited to 'bin/sh/bltin')
-rw-r--r--bin/sh/bltin/bltin.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/bin/sh/bltin/bltin.h b/bin/sh/bltin/bltin.h
index f6e7883..e449673 100644
--- a/bin/sh/bltin/bltin.h
+++ b/bin/sh/bltin/bltin.h
@@ -43,6 +43,7 @@
#include "../mystring.h"
#ifdef SHELL
#include "../output.h"
+#define FILE struct output
#undef stdout
#define stdout out1
#undef stderr
@@ -58,6 +59,7 @@
#define fflush flushout
#define INITARGS(argv)
#define warnx warning
+#define warn(fmt, ...) warning(fmt ": %s", __VA_ARGS__, strerror(errno))
#define errx(exitstatus, ...) error(__VA_ARGS__)
#else
@@ -67,8 +69,11 @@
#define INITARGS(argv) if ((commandname = argv[0]) == NULL) {fputs("Argc is zero\n", stderr); exit(2);} else
#endif
+#include <unistd.h>
+
pointer stalloc(int);
void error(const char *, ...) __printf0like(1, 2);
+pid_t getjobpgrp(char *);
int echocmd(int, char **);
int testcmd(int, char **);
OpenPOWER on IntegriCloud