Re: gzipped crashdumps

2001-09-04 Thread Michael Sinz

John Polstra wrote:
 
 In article [EMAIL PROTECTED],
 Kris Kennaway  [EMAIL PROTECTED] wrote:
 
  Anyone else think this patch from NetBSD is worthwhile?
 
 Yes yes yes yes yes!  That's 5 votes in favor of it already. :-)

Add in another 50 here (the number of machines here that produce
dumps in our test lab :-()

-- 
Michael Sinz  Worldgate Communications  [EMAIL PROTECTED]
A master's secrets are only as good as
the master's ability to explain them to others.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-hackers in the body of the message



Re: gzipped crashdumps

2001-09-03 Thread Kris Kennaway

On Sun, Sep 02, 2001 at 10:22:14AM -0700, David O'Brien wrote:

  --- /dev/null   Sat Sep  1 01:13:34 2001
  +++ zopen.c Sat Sep  1 01:10:14 2001
  @@ -0,0 +1,39 @@
  +/*
  + * Public domain stdio wrapper for libz, written by Johan Danielsson.
  + */
 
 Can we add this to libz or some other lib?  These are general bits that I
 could see other programs wanting to use.

libz seems the most natural place, although it's a vendor library.

Kris

 PGP signature


Re: gzipped crashdumps

2001-09-03 Thread David O'Brien

On Mon, Sep 03, 2001 at 02:04:08PM -0700, Kris Kennaway wrote:
 On Sun, Sep 02, 2001 at 10:22:14AM -0700, David O'Brien wrote:
 
   --- /dev/null Sat Sep  1 01:13:34 2001
   +++ zopen.c   Sat Sep  1 01:10:14 2001
   @@ -0,0 +1,39 @@
   +/*
   + * Public domain stdio wrapper for libz, written by Johan Danielsson.
   + */
  
  Can we add this to libz or some other lib?  These are general bits that I
  could see other programs wanting to use.
 
 libz seems the most natural place, although it's a vendor library.

Doesn't really matter.  Just drop the file into src/lib/libz and modify
src/lib/libz/Makefile.

-- 
-- David  ([EMAIL PROTECTED])

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-hackers in the body of the message



Re: gzipped crashdumps

2001-09-02 Thread David O'Brien

On Sat, Sep 01, 2001 at 01:16:31AM -0700, Kris Kennaway wrote:
 Anyone else think this patch from NetBSD is worthwhile?

As JDP said, YES!.
 
 --- /dev/null Sat Sep  1 01:13:34 2001
 +++ zopen.c   Sat Sep  1 01:10:14 2001
 @@ -0,0 +1,39 @@
 +/*
 + * Public domain stdio wrapper for libz, written by Johan Danielsson.
 + */

Can we add this to libz or some other lib?  These are general bits that I
could see other programs wanting to use.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-hackers in the body of the message



gzipped crashdumps

2001-09-01 Thread Kris Kennaway

Anyone else think this patch from NetBSD is worthwhile?

Should I also extend it to support bzip2'ed dumps now that that's in
the base system, or would that be overkill?

Kris

Index: Makefile
===
RCS file: /mnt/ncvs/src/sbin/savecore/Makefile,v
retrieving revision 1.5
diff -u -r1.5 Makefile
--- Makefile2001/03/26 14:33:23 1.5
+++ Makefile2001/09/01 08:15:14
@@ -5,8 +5,7 @@
 SRCS=  savecore.c zopen.c
 MAN=   savecore.8
 
-ZOPENPATH= ${.CURDIR}/../../usr.bin/compress
-.PATH: ${ZOPENPATH}
-CFLAGS+= -I${ZOPENPATH}
+DPADD+=${LIBZ}
+LDADD+=-lz
 
 .include bsd.prog.mk
Index: savecore.8
===
RCS file: /mnt/ncvs/src/sbin/savecore/savecore.8,v
retrieving revision 1.12
diff -u -r1.12 savecore.8
--- savecore.8  2001/07/10 11:02:27 1.12
+++ savecore.8  2001/09/01 08:11:50
@@ -72,7 +72,7 @@
 Print out some additional debugging information.
 .It Fl z
 Compress the core dump and kernel (see
-.Xr compress 1 ) .
+.Xr gzip 1 ) .
 .El
 .Pp
 .Nm Savecore
@@ -113,8 +113,8 @@
 .Sh BUGS
 The minfree code does not consider the effect of compression.
 .Sh SEE ALSO
-.Xr compress 1 ,
 .Xr getbootfile 3 ,
+.Xr gzip 1 ,
 .Xr syslogd 8
 .Sh HISTORY
 The
Index: savecore.c
===
RCS file: /mnt/ncvs/src/sbin/savecore/savecore.c,v
retrieving revision 1.41
diff -u -r1.41 savecore.c
--- savecore.c  2001/06/09 01:41:03 1.41
+++ savecore.c  2001/09/01 08:06:48
@@ -63,8 +63,9 @@
 #include stdlib.h
 #include string.h
 #include unistd.h
-#include zopen.h
 
+extern FILE *zopen(const char *fname, const char *mode);
+
 #ifdef __alpha__
 #define ok(number) ALPHA_K0SEG_TO_PHYS(number)
 #endif
@@ -131,7 +132,7 @@
 int get_crashtime __P((void));
 voidget_dumpsize __P((void));
 voidkmem_setup __P((void));
-voidlog __P((int, char *, ...));
+voidlog __P((int, char *, ...)) __printf0like(2, 3);
 voidLseek __P((int, off_t, int));
 int Open __P((const char *, int rw));
 int Read __P((int, void *, int));
@@ -384,9 +385,9 @@
/* Create the core file. */
oumask = umask(S_IRWXG|S_IRWXO); /* Restrict access to the core file.*/
(void)snprintf(path, sizeof(path), %s/vmcore.%d%s,
-   savedir, bounds, compress ? .Z : );
+   savedir, bounds, compress ? .gz : );
if (compress)
-   fp = zopen(path, w, 0);
+   fp = zopen(path, w);
else
fp = fopen(path, w);
if (fp == NULL) {
@@ -463,9 +464,9 @@
/* Copy the kernel. */
ifd = Open(kernel ? kernel : getbootfile(), O_RDONLY);
(void)snprintf(path, sizeof(path), %s/kernel.%d%s,
-   savedir, bounds, compress ? .Z : );
+   savedir, bounds, compress ? .gz : );
if (compress)
-   fp = zopen(path, w, 0);
+   fp = zopen(path, w);
else
fp = fopen(path, w);
if (fp == NULL) {
--- /dev/null   Sat Sep  1 01:13:34 2001
+++ zopen.c Sat Sep  1 01:10:14 2001
@@ -0,0 +1,39 @@
+/*
+ * Public domain stdio wrapper for libz, written by Johan Danielsson.
+ */
+
+#ifndef lint
+static const char rcsid[] = 
+  $FreeBSD$;
+#endif /* not lint */
+
+#include stdio.h
+#include zlib.h
+
+FILE *zopen(const char *fname, const char *mode);
+
+/* convert arguments */
+static int
+xgzread(void *cookie, char *data, int size)
+{
+return gzread(cookie, data, size);
+}
+
+static int
+xgzwrite(void *cookie, const char *data, int size)
+{
+return gzwrite(cookie, (void*)data, size);
+}
+
+FILE *
+zopen(const char *fname, const char *mode)
+{
+gzFile gz = gzopen(fname, mode);
+if(gz == NULL)
+   return NULL;
+
+if(*mode == 'r')
+   return (funopen(gz, xgzread, NULL, NULL, gzclose));
+else
+   return (funopen(gz, NULL, xgzwrite, NULL, gzclose));
+}

 PGP signature


Re: gzipped crashdumps

2001-09-01 Thread John Polstra

In article [EMAIL PROTECTED],
Kris Kennaway  [EMAIL PROTECTED] wrote:
 
 Anyone else think this patch from NetBSD is worthwhile?

Yes yes yes yes yes!  That's 5 votes in favor of it already. :-)

 Should I also extend it to support bzip2'ed dumps now that that's in
 the base system, or would that be overkill?

I'm more or less neutral on that, but since the files are so big I
bet bzip2 would be almost too slow to bear at reboot time.

John
-- 
  John Polstra   [EMAIL PROTECTED]
  John D. Polstra  Co., Inc.Seattle, Washington USA
  Disappointment is a good sign of basic intelligence.  -- Chögyam Trungpa


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-hackers in the body of the message



Re: gzipped crashdumps

2001-09-01 Thread Kris Kennaway

On Sat, Sep 01, 2001 at 12:29:18PM -0700, John Polstra wrote:
 In article [EMAIL PROTECTED],
 Kris Kennaway  [EMAIL PROTECTED] wrote:
  
  Anyone else think this patch from NetBSD is worthwhile?
 
 Yes yes yes yes yes!  That's 5 votes in favor of it already. :-)

:-)

  Should I also extend it to support bzip2'ed dumps now that that's in
  the base system, or would that be overkill?
 
 I'm more or less neutral on that, but since the files are so big I
 bet bzip2 would be almost too slow to bear at reboot time.

Yes.  Maybe I'll do some testing to see how much space it saves -- it
might be useful as a non-default option for people who are low on disk
space.

Kris

 PGP signature