summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorgjb <gjb@FreeBSD.org>2016-03-02 16:14:46 +0000
committergjb <gjb@FreeBSD.org>2016-03-02 16:14:46 +0000
commit955ce29ea33f5aa2d5477a1fe1a2735ac278cd0d (patch)
tree9c83d6fb30867514fbcff33f80605a1fb118d720 /bin
parent4719e40f5bedd0f88591120e071741635f07993b (diff)
parent774a6245596e60bf04f03e8cccab06a3194504f5 (diff)
downloadFreeBSD-src-955ce29ea33f5aa2d5477a1fe1a2735ac278cd0d.zip
FreeBSD-src-955ce29ea33f5aa2d5477a1fe1a2735ac278cd0d.tar.gz
MFH
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'bin')
-rw-r--r--bin/csh/Makefile.depend222
-rw-r--r--bin/dd/args.c9
-rw-r--r--bin/dd/dd.18
-rw-r--r--bin/dd/dd.c27
-rw-r--r--bin/dd/extern.h2
-rw-r--r--bin/dd/misc.c21
-rw-r--r--bin/expr/Makefile.depend2
-rw-r--r--bin/pax/pax.12
-rw-r--r--bin/rmail/Makefile.depend2
-rw-r--r--bin/sh/Makefile.depend94
-rw-r--r--bin/sh/miscbltin.c3
11 files changed, 64 insertions, 328 deletions
diff --git a/bin/csh/Makefile.depend b/bin/csh/Makefile.depend
index ab84f40..c7bb5b0 100644
--- a/bin/csh/Makefile.depend
+++ b/bin/csh/Makefile.depend
@@ -18,226 +18,4 @@ DIRDEPS = \
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
-ed.chared.o: ed.defns.h
-ed.chared.o: sh.err.h
-ed.chared.o: tc.const.h
-ed.chared.po: ed.defns.h
-ed.chared.po: sh.err.h
-ed.chared.po: tc.const.h
-ed.defns.o: sh.err.h
-ed.defns.o: tc.const.h
-ed.defns.po: sh.err.h
-ed.defns.po: tc.const.h
-ed.init.o: ed.defns.h
-ed.init.o: sh.err.h
-ed.init.o: tc.const.h
-ed.init.po: ed.defns.h
-ed.init.po: sh.err.h
-ed.init.po: tc.const.h
-ed.inputl.o: ed.defns.h
-ed.inputl.o: sh.err.h
-ed.inputl.o: tc.const.h
-ed.inputl.po: ed.defns.h
-ed.inputl.po: sh.err.h
-ed.inputl.po: tc.const.h
-ed.refresh.o: sh.err.h
-ed.refresh.o: tc.const.h
-ed.refresh.po: sh.err.h
-ed.refresh.po: tc.const.h
-ed.screen.o: ed.defns.h
-ed.screen.o: sh.err.h
-ed.screen.o: tc.const.h
-ed.screen.po: ed.defns.h
-ed.screen.po: sh.err.h
-ed.screen.po: tc.const.h
-ed.term.o: sh.err.h
-ed.term.o: tc.const.h
-ed.term.po: sh.err.h
-ed.term.po: tc.const.h
-ed.xmap.o: ed.defns.h
-ed.xmap.o: sh.err.h
-ed.xmap.o: tc.const.h
-ed.xmap.po: ed.defns.h
-ed.xmap.po: sh.err.h
-ed.xmap.po: tc.const.h
-glob.o: sh.err.h
-glob.o: tc.const.h
-glob.po: sh.err.h
-glob.po: tc.const.h
-mi.termios.o: sh.err.h
-mi.termios.o: tc.const.h
-mi.termios.po: sh.err.h
-mi.termios.po: tc.const.h
-sh.char.o: sh.err.h
-sh.char.o: tc.const.h
-sh.char.po: sh.err.h
-sh.char.po: tc.const.h
-sh.dir.o: sh.err.h
-sh.dir.o: tc.const.h
-sh.dir.po: sh.err.h
-sh.dir.po: tc.const.h
-sh.dol.o: sh.err.h
-sh.dol.o: tc.const.h
-sh.dol.po: sh.err.h
-sh.dol.po: tc.const.h
-sh.err.o: sh.err.h
-sh.err.o: tc.const.h
-sh.err.po: sh.err.h
-sh.err.po: tc.const.h
-sh.exec.o: sh.err.h
-sh.exec.o: tc.const.h
-sh.exec.po: sh.err.h
-sh.exec.po: tc.const.h
-sh.exp.o: sh.err.h
-sh.exp.o: tc.const.h
-sh.exp.po: sh.err.h
-sh.exp.po: tc.const.h
-sh.file.o: sh.err.h
-sh.file.o: tc.const.h
-sh.file.po: sh.err.h
-sh.file.po: tc.const.h
-sh.func.o: sh.err.h
-sh.func.o: tc.const.h
-sh.func.po: sh.err.h
-sh.func.po: tc.const.h
-sh.glob.o: sh.err.h
-sh.glob.o: tc.const.h
-sh.glob.po: sh.err.h
-sh.glob.po: tc.const.h
-sh.hist.o: sh.err.h
-sh.hist.o: tc.const.h
-sh.hist.po: sh.err.h
-sh.hist.po: tc.const.h
-sh.init.o: sh.err.h
-sh.init.o: tc.const.h
-sh.init.po: sh.err.h
-sh.init.po: tc.const.h
-sh.lex.o: sh.err.h
-sh.lex.o: tc.const.h
-sh.lex.po: sh.err.h
-sh.lex.po: tc.const.h
-sh.misc.o: sh.err.h
-sh.misc.o: tc.const.h
-sh.misc.po: sh.err.h
-sh.misc.po: tc.const.h
-sh.o: sh.err.h
-sh.o: tc.const.h
-sh.parse.o: sh.err.h
-sh.parse.o: tc.const.h
-sh.parse.po: sh.err.h
-sh.parse.po: tc.const.h
-sh.po: sh.err.h
-sh.po: tc.const.h
-sh.print.o: sh.err.h
-sh.print.o: tc.const.h
-sh.print.po: sh.err.h
-sh.print.po: tc.const.h
-sh.proc.o: sh.err.h
-sh.proc.o: tc.const.h
-sh.proc.po: sh.err.h
-sh.proc.po: tc.const.h
-sh.sem.o: sh.err.h
-sh.sem.o: tc.const.h
-sh.sem.po: sh.err.h
-sh.sem.po: tc.const.h
-sh.set.o: sh.err.h
-sh.set.o: tc.const.h
-sh.set.po: sh.err.h
-sh.set.po: tc.const.h
-sh.time.o: sh.err.h
-sh.time.o: tc.const.h
-sh.time.po: sh.err.h
-sh.time.po: tc.const.h
-tc.alloc.o: sh.err.h
-tc.alloc.o: tc.const.h
-tc.alloc.po: sh.err.h
-tc.alloc.po: tc.const.h
-tc.bind.o: ed.defns.h
-tc.bind.o: sh.err.h
-tc.bind.o: tc.const.h
-tc.bind.po: ed.defns.h
-tc.bind.po: sh.err.h
-tc.bind.po: tc.const.h
-tc.const.o: sh.err.h
-tc.const.o: tc.const.h
-tc.const.po: sh.err.h
-tc.const.po: tc.const.h
-tc.defs.o: sh.err.h
-tc.defs.o: tc.const.h
-tc.defs.o: tc.defs.c
-tc.defs.po: sh.err.h
-tc.defs.po: tc.const.h
-tc.defs.po: tc.defs.c
-tc.disc.o: sh.err.h
-tc.disc.o: tc.const.h
-tc.disc.po: sh.err.h
-tc.disc.po: tc.const.h
-tc.func.o: ed.defns.h
-tc.func.o: sh.err.h
-tc.func.o: tc.const.h
-tc.func.po: ed.defns.h
-tc.func.po: sh.err.h
-tc.func.po: tc.const.h
-tc.nls.o: sh.err.h
-tc.nls.o: tc.const.h
-tc.nls.po: sh.err.h
-tc.nls.po: tc.const.h
-tc.os.o: ed.defns.h
-tc.os.o: sh.err.h
-tc.os.o: tc.const.h
-tc.os.po: ed.defns.h
-tc.os.po: sh.err.h
-tc.os.po: tc.const.h
-tc.printf.o: sh.err.h
-tc.printf.o: tc.const.h
-tc.printf.po: sh.err.h
-tc.printf.po: tc.const.h
-tc.prompt.o: sh.err.h
-tc.prompt.o: tc.const.h
-tc.prompt.po: sh.err.h
-tc.prompt.po: tc.const.h
-tc.sched.o: sh.err.h
-tc.sched.o: tc.const.h
-tc.sched.po: sh.err.h
-tc.sched.po: tc.const.h
-tc.sig.o: sh.err.h
-tc.sig.o: tc.const.h
-tc.sig.po: sh.err.h
-tc.sig.po: tc.const.h
-tc.str.o: sh.err.h
-tc.str.o: tc.const.h
-tc.str.po: sh.err.h
-tc.str.po: tc.const.h
-tc.vers.o: sh.err.h
-tc.vers.o: tc.const.h
-tc.vers.po: sh.err.h
-tc.vers.po: tc.const.h
-tc.who.o: sh.err.h
-tc.who.o: tc.const.h
-tc.who.po: sh.err.h
-tc.who.po: tc.const.h
-tw.color.o: sh.err.h
-tw.color.o: tc.const.h
-tw.color.po: sh.err.h
-tw.color.po: tc.const.h
-tw.comp.o: sh.err.h
-tw.comp.o: tc.const.h
-tw.comp.po: sh.err.h
-tw.comp.po: tc.const.h
-tw.help.o: sh.err.h
-tw.help.o: tc.const.h
-tw.help.po: sh.err.h
-tw.help.po: tc.const.h
-tw.init.o: sh.err.h
-tw.init.o: tc.const.h
-tw.init.po: sh.err.h
-tw.init.po: tc.const.h
-tw.parse.o: sh.err.h
-tw.parse.o: tc.const.h
-tw.parse.po: sh.err.h
-tw.parse.po: tc.const.h
-tw.spell.o: sh.err.h
-tw.spell.o: tc.const.h
-tw.spell.po: sh.err.h
-tw.spell.po: tc.const.h
.endif
diff --git a/bin/dd/args.c b/bin/dd/args.c
index 4607d67..27d4a9a 100644
--- a/bin/dd/args.c
+++ b/bin/dd/args.c
@@ -66,6 +66,7 @@ static void f_obs(char *);
static void f_of(char *);
static void f_seek(char *);
static void f_skip(char *);
+static void f_speed(char *);
static void f_status(char *);
static uintmax_t get_num(const char *);
static off_t get_off_t(const char *);
@@ -89,6 +90,7 @@ static const struct arg {
{ "oseek", f_seek, C_SEEK, C_SEEK },
{ "seek", f_seek, C_SEEK, C_SEEK },
{ "skip", f_skip, C_SKIP, C_SKIP },
+ { "speed", f_speed, 0, 0 },
{ "status", f_status, C_STATUS,C_STATUS },
};
@@ -295,6 +297,13 @@ f_skip(char *arg)
}
static void
+f_speed(char *arg)
+{
+
+ speed = get_num(arg);
+}
+
+static void
f_status(char *arg)
{
diff --git a/bin/dd/dd.1 b/bin/dd/dd.1
index 4047cdc..64d1acae 100644
--- a/bin/dd/dd.1
+++ b/bin/dd/dd.1
@@ -32,7 +32,7 @@
.\" @(#)dd.1 8.2 (Berkeley) 1/13/94
.\" $FreeBSD$
.\"
-.Dd February 4, 2016
+.Dd February 28, 2016
.Dt DD 1
.Os
.Sh NAME
@@ -156,6 +156,10 @@ Otherwise, input data is read and discarded.
For pipes, the correct number of bytes is read.
For all other devices, the correct number of blocks is read without
distinguishing between a partial or complete block being read.
+.It Cm speed Ns = Ns Ar n
+Limit the copying speed to
+.Ar n
+bytes per second.
.It Cm status Ns = Ns Ar value
Where
.Cm value
@@ -325,7 +329,7 @@ appended.
.El
.El
.Pp
-Where sizes are specified, a decimal, octal, or hexadecimal number of
+Where sizes or speed are specified, a decimal, octal, or hexadecimal number of
bytes is expected.
If the number ends with a
.Dq Li b ,
diff --git a/bin/dd/dd.c b/bin/dd/dd.c
index 4c31a5e..56f8efe 100644
--- a/bin/dd/dd.c
+++ b/bin/dd/dd.c
@@ -82,6 +82,7 @@ size_t cbsz; /* conversion block size */
uintmax_t files_cnt = 1; /* # of files to copy */
const u_char *ctab; /* conversion table */
char fill_char; /* Character to fill with if defined */
+size_t speed = 0; /* maximum speed, in bytes per second */
volatile sig_atomic_t need_summary;
int
@@ -276,6 +277,29 @@ getfdtype(IO *io)
io->flags |= ISSEEK;
}
+/*
+ * Limit the speed by adding a delay before every block read.
+ * The delay (t_usleep) is equal to the time computed from block
+ * size and the specified speed limit (t_target) minus the time
+ * spent on actual read and write operations (t_io).
+ */
+static void
+speed_limit(void)
+{
+ static double t_prev, t_usleep;
+ double t_now, t_io, t_target;
+
+ t_now = secs_elapsed();
+ t_io = t_now - t_prev - t_usleep;
+ t_target = (double)in.dbsz / (double)speed;
+ t_usleep = t_target - t_io;
+ if (t_usleep > 0)
+ usleep(t_usleep * 1000000);
+ else
+ t_usleep = 0;
+ t_prev = t_now;
+}
+
static void
dd_in(void)
{
@@ -293,6 +317,9 @@ dd_in(void)
break;
}
+ if (speed > 0)
+ speed_limit();
+
/*
* Zero the buffer first if sync; if doing block operations,
* use spaces.
diff --git a/bin/dd/extern.h b/bin/dd/extern.h
index 6984f6d..25440ca 100644
--- a/bin/dd/extern.h
+++ b/bin/dd/extern.h
@@ -42,6 +42,7 @@ void def_close(void);
void jcl(char **);
void pos_in(void);
void pos_out(void);
+double secs_elapsed(void);
void summary(void);
void siginfo_handler(int);
void terminate(int);
@@ -54,6 +55,7 @@ extern void (*cfunc)(void);
extern uintmax_t cpy_cnt;
extern size_t cbsz;
extern u_int ddflags;
+extern size_t speed;
extern uintmax_t files_cnt;
extern const u_char *ctab;
extern const u_char a2e_32V[], a2e_POSIX[];
diff --git a/bin/dd/misc.c b/bin/dd/misc.c
index eb1227b..ea0f8d3 100644
--- a/bin/dd/misc.c
+++ b/bin/dd/misc.c
@@ -54,15 +54,12 @@ __FBSDID("$FreeBSD$");
#include "dd.h"
#include "extern.h"
-void
-summary(void)
+double
+secs_elapsed(void)
{
struct timespec end, ts_res;
double secs, res;
- if (ddflags & C_NOINFO)
- return;
-
if (clock_gettime(CLOCK_MONOTONIC, &end))
err(1, "clock_gettime");
if (clock_getres(CLOCK_MONOTONIC, &ts_res))
@@ -72,6 +69,20 @@ summary(void)
res = ts_res.tv_sec + ts_res.tv_nsec * 1e-9;
if (secs < res)
secs = res;
+
+ return (secs);
+}
+
+void
+summary(void)
+{
+ double secs;
+
+ if (ddflags & C_NOINFO)
+ return;
+
+ secs = secs_elapsed();
+
(void)fprintf(stderr,
"%ju+%ju records in\n%ju+%ju records out\n",
st.in_full, st.in_part, st.out_full, st.out_part);
diff --git a/bin/expr/Makefile.depend b/bin/expr/Makefile.depend
index 9d55364..ca0b2f9 100644
--- a/bin/expr/Makefile.depend
+++ b/bin/expr/Makefile.depend
@@ -16,6 +16,4 @@ DIRDEPS = \
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
-expr.o: expr.c
-expr.po: expr.c
.endif
diff --git a/bin/pax/pax.1 b/bin/pax/pax.1
index c2e1731..412094f 100644
--- a/bin/pax/pax.1
+++ b/bin/pax/pax.1
@@ -595,7 +595,7 @@ are not understood by
however
.Xr tar 1
and
-.Xr dump 1
+.Xr dump 8
will preserve these.
.It Fl s Ar replstr
Modify the file or archive member names specified by the
diff --git a/bin/rmail/Makefile.depend b/bin/rmail/Makefile.depend
index de5f45e..0cb1420 100644
--- a/bin/rmail/Makefile.depend
+++ b/bin/rmail/Makefile.depend
@@ -16,6 +16,4 @@ DIRDEPS = \
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
-rmail.o: sm_os.h
-rmail.po: sm_os.h
.endif
diff --git a/bin/sh/Makefile.depend b/bin/sh/Makefile.depend
index 9eb4fba..3d92039 100644
--- a/bin/sh/Makefile.depend
+++ b/bin/sh/Makefile.depend
@@ -17,98 +17,4 @@ DIRDEPS = \
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
-alias.o: builtins.h
-alias.po: builtins.h
-arith_yylex.o: syntax.h
-arith_yylex.po: syntax.h
-builtins.o: builtins.c
-builtins.o: builtins.h
-builtins.po: builtins.c
-builtins.po: builtins.h
-cd.o: builtins.h
-cd.o: nodes.h
-cd.po: builtins.h
-cd.po: nodes.h
-echo.o: builtins.h
-echo.po: builtins.h
-error.o: nodes.h
-error.po: nodes.h
-eval.o: builtins.h
-eval.o: nodes.h
-eval.o: syntax.h
-eval.po: builtins.h
-eval.po: nodes.h
-eval.po: syntax.h
-exec.o: builtins.h
-exec.o: nodes.h
-exec.o: syntax.h
-exec.po: builtins.h
-exec.po: nodes.h
-exec.po: syntax.h
-expand.o: builtins.h
-expand.o: nodes.h
-expand.o: syntax.h
-expand.po: builtins.h
-expand.po: nodes.h
-expand.po: syntax.h
-histedit.o: builtins.h
-histedit.po: builtins.h
-input.o: syntax.h
-input.po: syntax.h
-jobs.o: builtins.h
-jobs.o: nodes.h
-jobs.o: syntax.h
-jobs.po: builtins.h
-jobs.po: nodes.h
-jobs.po: syntax.h
-kill.o: builtins.h
-kill.po: builtins.h
-main.o: builtins.h
-main.o: nodes.h
-main.po: builtins.h
-main.po: nodes.h
-miscbltin.o: syntax.h
-miscbltin.po: syntax.h
-mystring.o: syntax.h
-mystring.po: syntax.h
-nodes.o: nodes.c
-nodes.o: nodes.h
-nodes.po: nodes.c
-nodes.po: nodes.h
-options.o: builtins.h
-options.o: nodes.h
-options.po: builtins.h
-options.po: nodes.h
-output.o: syntax.h
-output.po: syntax.h
-parser.o: nodes.h
-parser.o: syntax.h
-parser.o: token.h
-parser.po: nodes.h
-parser.po: syntax.h
-parser.po: token.h
-printf.o: builtins.h
-printf.po: builtins.h
-redir.o: nodes.h
-redir.po: nodes.h
-show.o: nodes.h
-show.po: nodes.h
-syntax.o: syntax.c
-syntax.o: syntax.h
-syntax.po: syntax.c
-syntax.po: syntax.h
-test.o: builtins.h
-test.po: builtins.h
-trap.o: builtins.h
-trap.o: nodes.h
-trap.o: syntax.h
-trap.po: builtins.h
-trap.po: nodes.h
-trap.po: syntax.h
-var.o: builtins.h
-var.o: nodes.h
-var.o: syntax.h
-var.po: builtins.h
-var.po: nodes.h
-var.po: syntax.h
.endif
diff --git a/bin/sh/miscbltin.c b/bin/sh/miscbltin.c
index 4de1276..9dae4cb 100644
--- a/bin/sh/miscbltin.c
+++ b/bin/sh/miscbltin.c
@@ -414,6 +414,9 @@ static const struct limits limits[] = {
#ifdef RLIMIT_KQUEUES
{ "kqueues", (char *)0, RLIMIT_KQUEUES, 1, 'k' },
#endif
+#ifdef RLIMIT_UMTXP
+ { "umtxp", (char *)0, RLIMIT_UMTXP, 1, 'o' },
+#endif
{ (char *) 0, (char *)0, 0, 0, '\0' }
};
OpenPOWER on IntegriCloud