aboutsummaryrefslogtreecommitdiffstats
path: root/gtk
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 /gtk
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 'gtk')
-rw-r--r--gtk/main.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/gtk/main.c b/gtk/main.c
index e0fe09d081..a792b84e64 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -1,6 +1,6 @@
/* main.c
*
- * $Id: main.c,v 1.297 2003/06/09 07:54:11 guy Exp $
+ * $Id: main.c,v 1.298 2003/06/22 16:07:23 deniel Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -1208,7 +1208,7 @@ show_version(void)
}
static int
-get_positive_int(const char *string, const char *name)
+get_natural_int(const char *string, const char *name)
{
long number;
char *p;
@@ -1224,11 +1224,6 @@ get_positive_int(const char *string, const char *name)
name, string);
exit(1);
}
- if (number == 0) {
- fprintf(stderr, "ethereal: The specified %s \"%s\" is zero\n",
- name, string);
- exit(1);
- }
if (number > INT_MAX) {
fprintf(stderr, "ethereal: The specified %s \"%s\" is too large (greater than %d)\n",
name, string, INT_MAX);
@@ -1237,6 +1232,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, "ethereal: The specified %s is zero\n",
+ name);
+ exit(1);
+ }
+
+ return number;
+}
+
#ifdef HAVE_LIBPCAP
/*
* Given a string of the form "<autostop criterion>:<value>", as might appear
@@ -1304,7 +1315,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;