summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTobias Stoeckmann <tobias@cvs.openbsd.org>2015-04-02 21:04:07 +0000
committerTobias Stoeckmann <tobias@cvs.openbsd.org>2015-04-02 21:04:07 +0000
commit64ee1cd4a192376e6745215bef44b3ea6d27cd5a (patch)
treef1202d460e252404cb6b8ed58f5eddd7682bebe5 /usr.bin
parent52f47df93eb084f158fd9bc0d4e05c50b862c070 (diff)
Global variable free_memory is only used in sort.c's set_hw_params,
so turn it into a local one. ok millert@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/sort/file.c3
-rw-r--r--usr.bin/sort/file.h3
-rw-r--r--usr.bin/sort/sort.c7
3 files changed, 7 insertions, 6 deletions
diff --git a/usr.bin/sort/file.c b/usr.bin/sort/file.c
index cd7a2aa1886..79e4018ce12 100644
--- a/usr.bin/sort/file.c
+++ b/usr.bin/sort/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.17 2015/04/02 12:48:28 millert Exp $ */
+/* $OpenBSD: file.c,v 1.18 2015/04/02 21:04:06 tobias Exp $ */
/*-
* Copyright (C) 2009 Gabor Kovesdan <gabor@FreeBSD.org>
@@ -46,7 +46,6 @@
#include "file.h"
#include "radixsort.h"
-unsigned long long free_memory = 1000000;
unsigned long long available_free_memory = 1000000;
bool use_mmap;
diff --git a/usr.bin/sort/file.h b/usr.bin/sort/file.h
index 017221524e7..8a8eab784e1 100644
--- a/usr.bin/sort/file.h
+++ b/usr.bin/sort/file.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.h,v 1.2 2015/03/20 00:26:38 millert Exp $ */
+/* $OpenBSD: file.h,v 1.3 2015/04/02 21:04:06 tobias Exp $ */
/*-
* Copyright (C) 2009 Gabor Kovesdan <gabor@FreeBSD.org>
@@ -72,7 +72,6 @@ struct file_list {
/**/
-extern unsigned long long free_memory;
extern unsigned long long available_free_memory;
/* Are we using mmap ? */
diff --git a/usr.bin/sort/sort.c b/usr.bin/sort/sort.c
index 01b8e114ba1..a6d07cdbe59 100644
--- a/usr.bin/sort/sort.c
+++ b/usr.bin/sort/sort.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sort.c,v 1.72 2015/04/02 21:00:08 tobias Exp $ */
+/* $OpenBSD: sort.c,v 1.73 2015/04/02 21:04:06 tobias Exp $ */
/*-
* Copyright (C) 2009 Gabor Kovesdan <gabor@FreeBSD.org>
@@ -200,6 +200,7 @@ read_fns_from_file0(const char *fn)
static void
set_hw_params(void)
{
+ unsigned long long free_memory;
long long user_memory;
struct rlimit rl;
size_t len;
@@ -219,8 +220,10 @@ set_hw_params(void)
} else {
warn("Can't set resource limit to max data size");
}
- } else
+ } else {
+ free_memory = 1000000;
warn("Can't get resource limit for data size");
+ }
/* We prefer to use temp files rather than swap space. */
if (user_memory != -1 && free_memory > user_memory)