aboutsummaryrefslogtreecommitdiffstats
path: root/tethereal.c
diff options
context:
space:
mode:
authorLaurent Deniel <laurent.deniel@free.fr>2003-06-22 16:09:04 +0000
committerLaurent Deniel <laurent.deniel@free.fr>2003-06-22 16:09:04 +0000
commit0afce7ca814a6fe60032a9b4178831dfb4eb3762 (patch)
treef3e3d0937ff44b3b9ecb0d03d7fd4274e63adcb9 /tethereal.c
parentc150ac467bfcd36b162baa1f918ac05d68e377cc (diff)
Ringbuffer rework.
Almost completely rewritten in order to: - be able to use a unlimited number of ringbuffer files 0 specified with -b argument or in the GUI, means that the number of file is unlimited. else the maximum number of ring buffer files is arbitrarily set to 1024. - close the current file and open (truncating it) the next file at switch - set the final file name once open (or reopen) - avoid the deletion of files that could not be truncated (can't arise now) and do not erase empty files The idea behind that is to remove the limitation of the maximum # of ringbuffer files being less than the maximum # of open fd per process and to be able to reduce the amount of virtual memory usage (having only one file open at most) or the amount of file system usage (by truncating the files at switch and not the capture stop, and by closing them which makes possible their move or deletion after a switch). svn path=/trunk/; revision=7912
Diffstat (limited to 'tethereal.c')
-rw-r--r--tethereal.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/tethereal.c b/tethereal.c
index 07a0c89ec9..4d3835fca9 100644
--- a/tethereal.c
+++ b/tethereal.c
@@ -1,6 +1,6 @@
/* tethereal.c
*
- * $Id: tethereal.c,v 1.187 2003/06/13 03:44:36 guy Exp $
+ * $Id: tethereal.c,v 1.188 2003/06/22 16:06:03 deniel Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -255,7 +255,7 @@ print_usage(gboolean print_ver)
#ifdef HAVE_LIBPCAP
static int
-get_positive_int(const char *string, const char *name)
+get_natural_int(const char *string, const char *name)
{
long number;
char *p;
@@ -271,11 +271,6 @@ get_positive_int(const char *string, const char *name)
name);
exit(1);
}
- if (number == 0) {
- fprintf(stderr, "tethereal: The specified %s is zero\n",
- name);
- exit(1);
- }
if (number > INT_MAX) {
fprintf(stderr, "tethereal: The specified %s is too large (greater than %d)\n",
name, INT_MAX);
@@ -284,6 +279,22 @@ get_positive_int(const char *string, const char *name)
return number;
}
+static int
+get_positive_int(const char *string, const char *name)
+{
+ long number;
+
+ number = get_natural_int(string, name);
+
+ if (number == 0) {
+ fprintf(stderr, "tethereal: The specified %s is zero\n",
+ name);
+ exit(1);
+ }
+
+ return number;
+}
+
/*
* Given a string of the form "<autostop criterion>:<value>", as might appear
* as an argument to a "-a" option, parse it and set the criterion in
@@ -350,7 +361,7 @@ get_ring_arguments(const char *arg)
}
capture_opts.ringbuffer_num_files =
- get_positive_int(arg, "number of ring buffer files");
+ get_natural_int(arg, "number of ring buffer files");
if (colonp == NULL)
return TRUE;