Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Ethereal-dev: [Ethereal-dev] large-file support?

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Ben Greear <greearb@xxxxxxxxxxxxxxx>
Date: Wed, 23 Jul 2003 00:34:08 -0700
Any particular reason why tethereal does not try to open
files with O_LARGEFILE?

I've implemented this in my own little packet capture reader
(for a hacked up capture format of my own making), and it seems
to work fine (at least on modern Linux).  When I convert
my 4GB file to pcap format though, nothing can read it!

In case someone is curious, here is how I open:

   if ((fname == 0) || (strcmp(fname, "-") == 0)) {
      in_fd = STDIN_FILENO;
   }
   else {
      in_fd = open(fname, O_RDONLY|O_LARGEFILE);
      if (in_fd < 0) {
         fprintf(stderr, "ERROR:  Could not open file: %s, error: %s\n",
                 fname, strerror(errno));
         exit(errno);
      }
   }

   if (ofname == 0) {
      out_fd = STDOUT_FILENO;
   }
   else {
      out_fd = open(ofname, O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE);
      if (out_fd < 0) {
         fprintf(stderr, "ERROR:  Could not open output file: %s, error: %s\n",
                 ofname, strerror(errno));
         exit(errno);
      }
   }


Thanks,
Ben

--
Ben Greear <greearb@xxxxxxxxxxxxxxx>       <Ben_Greear AT excite.com>
President of Candela Technologies Inc      http://www.candelatech.com
ScryMUD:  http://scry.wanfear.com     http://scry.wanfear.com/~greear