Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F154936015
D2616.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D2616.id.diff
View Options
Index: head/usr.bin/xargs/xargs.1
===================================================================
--- head/usr.bin/xargs/xargs.1
+++ head/usr.bin/xargs/xargs.1
@@ -33,7 +33,7 @@
.\" $FreeBSD$
.\" $xMach: xargs.1,v 1.2 2002/02/23 05:23:37 tim Exp $
.\"
-.Dd March 16, 2012
+.Dd August 4, 2015
.Dt XARGS 1
.Os
.Sh NAME
@@ -207,6 +207,11 @@
invocations of
.Ar utility
at once.
+If
+.Ar maxprocs
+is set to 0,
+.Nm
+will run as many processes as possible.
.It Fl p
Echo each command to be executed and ask the user whether it should be
executed.
Index: head/usr.bin/xargs/xargs.c
===================================================================
--- head/usr.bin/xargs/xargs.c
+++ head/usr.bin/xargs/xargs.c
@@ -46,9 +46,11 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/wait.h>
-
+#include <sys/time.h>
+#include <sys/limits.h>
+#include <sys/resource.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
@@ -100,6 +102,7 @@
long arg_max;
int ch, Jflag, nargs, nflag, nline;
size_t linelen;
+ struct rlimit rl;
char *endptr;
const char *errstr;
@@ -166,6 +169,14 @@
maxprocs = strtonum(optarg, 1, INT_MAX, &errstr);
if (errstr)
errx(1, "-P %s: %s", optarg, errstr);
+ if (getrlimit(RLIMIT_NPROC, &rl) != 0)
+ errx(1, "getrlimit failed");
+ if (*endptr != '\0')
+ errx(1, "invalid number for -P option");
+ if (maxprocs < 0)
+ errx(1, "value for -P option should be >= 0");
+ if (maxprocs == 0 || maxprocs > rl.rlim_cur)
+ maxprocs = rl.rlim_cur;
break;
case 'p':
pflag = 1;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, May 1, 4:25 AM (6 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32554313
Default Alt Text
D2616.id.diff (1 KB)
Attached To
Mode
D2616: Make xargs -P0 create as many processes as possible
Attached
Detach File
Event Timeline
Log In to Comment