diff options
author | Guy Harris <guy@alum.mit.edu> | 1999-09-30 06:50:01 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 1999-09-30 06:50:01 +0000 |
commit | bab015f5e50f6966a6f944b08d669e11736d5d2c (patch) | |
tree | 598656f67b782d216a43b74971951a4bf69012f0 /globals.h | |
parent | 062cb007f187984acdf6e9ba3f9ee4b647deadc2 (diff) | |
download | wireshark-bab015f5e50f6966a6f944b08d669e11736d5d2c.tar.gz wireshark-bab015f5e50f6966a6f944b08d669e11736d5d2c.tar.bz2 wireshark-bab015f5e50f6966a6f944b08d669e11736d5d2c.zip |
Add a new global flag "capture_child", which is TRUE if we're a child
process for a sync mode or fork mode capture.
Have that flag control whether we do things that *only* the parent or
*only* the child should do, rather than basing it solely on the setting
of "sync_mode" or "fork_mode" (or, in the case of stuff done in the
child process either in sync mode or fork mode, rather than basing it on
the setting of those flags at all).
Split "do_capture()" into a "run_capture()" routine that starts a
capture (possibly by forking off and execing a child process, if we're
supposed to do sync mode or fork mode captures), and that assumes the
file to which the capture is to write has already been opened and that
"cf.save_file_fd" is the file descriptor for that file, and a
"do_capture()" routine that creates a temporary file, getting an FD for
it, and calls "run_capture()".
Use "run_capture()", rather than "capture()", for "-k" captures, so that
it'll do the capture in a child process if "-S" or "-F" was specified
("do_capture()" won't do because "-k" captures should write to the file
specified by the "-w" flag, not some random temporary file).
For child process captures, however, just use "capture()" - the child
process shouldn't itself fork off a child if we're in sync or fork mode,
and should just write to the file whose file descriptor was specified by
the "-W" flag on the command line.
All this allows you to do "ethereal -S -w <file> -i <interface> -k" to
start a sync mode capture from the command line.
svn path=/trunk/; revision=740
Diffstat (limited to 'globals.h')
-rw-r--r-- | globals.h | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1,7 +1,7 @@ /* globals.h * Global defines, etc. * - * $Id: globals.h,v 1.8 1999/09/29 22:19:13 guy Exp $ + * $Id: globals.h,v 1.9 1999/09/30 06:49:54 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -89,7 +89,6 @@ extern GtkWidget *file_sel, *packet_list, *tree_view, *byte_view, *prog_bar, *info_bar; extern GdkFont *m_r_font, *m_b_font; extern guint main_ctx, file_ctx; -extern gint start_capture; extern gchar comp_info_str[256]; extern gchar *ethereal_path; extern gchar *medium_font; @@ -107,6 +106,7 @@ extern int sync_mode; /* allow sync */ extern int sync_pipe[2]; /* used to sync father */ extern int fork_mode; /* fork a child to do the capture */ extern int quit_after_cap; /* Makes a "capture only mode". Implies -k */ +extern gboolean capture_child; /* if this is the child for "-F"/"-S" */ #endif #define PF_DIR ".ethereal" |