1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-05 06:27:37 +00:00

The previous patch I made alters a function to call "getconf ARG_MAX" to get the

maximum command line length. However I failed to realize that the rest of the
program called this function a lot. I have now altered the patch file to call
getconf once on program run instead of multiple times, greatly reducing
execution time.

PR:		154560
Submitted by:	maintainer
This commit is contained in:
Martin Wilke 2011-02-12 04:55:12 +00:00
parent db426675f0
commit 59b17e6fff
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=268965
2 changed files with 13 additions and 12 deletions

View File

@ -7,6 +7,7 @@
PORTNAME= parallel
PORTVERSION= 20110122
PORTREVISION= 1
CATEGORIES= sysutils
MASTER_SITES= GNU

View File

@ -1,5 +1,5 @@
--- ./src/parallel.orig 2011-01-22 15:37:41.000000000 -0700
+++ ./src/parallel 2011-01-30 11:39:53.000000000 -0700
+++ ./src/parallel 2011-02-06 14:56:46.000000000 -0700
@@ -2077,14 +2077,20 @@
sub no_of_cpus_freebsd {
# Returns:
@ -23,14 +23,15 @@
return $no_of_cores;
}
@@ -3455,28 +3461,40 @@
@@ -3455,28 +3461,42 @@
# Maximal command line length (for -m and -X)
sub max_length {
- # Find the max_length of a command line
- # Returns:
- # number of chars on the longest command line allowed
- if(not $Limits::Command::line_max_len) {
+ # FreeBSD code:
if(not $Limits::Command::line_max_len) {
- if($::opt_s) {
- if(is_acceptable_command_line_length($::opt_s)) {
- $Limits::Command::line_max_len = $::opt_s;
@ -47,17 +48,16 @@
- } else {
- $Limits::Command::line_max_len = real_max_length();
- }
+ # FreeBSD code:
+ my $limit = `getconf ARG_MAX` - 1024;
+ if ($::opt_s) {
+ if ($::opt_s > $limit) {
+ print STDERR "$Global::progname: ",
+ "you are setting value for -s greater than $limit\n";
+ $Limits::Command::line_max_len = `getconf ARG_MAX` - 1024;
+ if ($::opt_s) {
+ if ($::opt_s > $Limits::Command::line_max_len) {
+ print STDERR "$Global::progname: ",
+ "you are setting value for -s greater than $Limits::Command::line_max_len\n";
+ }
+ $Limits::Command::line_max_len = $::opt_s;
+ }
+ $limit = $::opt_s;
}
- return $Limits::Command::line_max_len;
+ return $limit;
return $Limits::Command::line_max_len;
+
+# ORIGINAL code:
+# # Find the max_length of a command line