Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* Re: timeout printing bug in ipfwadm
@ 1996-07-28 23:41 David Mosberger-Tang
  0 siblings, 0 replies; 2+ messages in thread
From: David Mosberger-Tang @ 1996-07-28 23:41 UTC (permalink / raw)


Richard> Enclosed is a patch to ipfwadm.c to deal with system
 Richard> clocks not running at 100Hz.

 Richard> --- ipfwadm.c.orig	Mon Jun 17 05:33:11 1996
 Richard> +++ ipfwadm.c	Thu Jul 25 18:35:24 1996
 Richard> @@ -100,6 +100,10 @@
 Richard>  #include <linux/ip_fw.h>
 Richard>  #include <asm/param.h>
 Richard>  
 Richard> +#ifndef HZ
 Richard> +#define HZ __KERNEL_HZ
 Richard> +#endif
 Richard> +
 Richard>  #ifndef	IP_FW_F_REDIR
 Richard>  #define IPFWADM_NO_REDIR
 Richard>  #define IP_FW_F_REDIR		0

Please do not refer to __KERNEL_* macros in any applications---ever.
The correct solution in this case is to include <sys/param.h> instead
of <asm/param.h>.  As far as I know, this will work both for the "old"
libc and GNU libc.

I realize that ipfwadm.c is Linux specific (if there is such a thing),
but I'm worried about setting a bad example.  The __KERNEL_* macros
are only for communicating system-specific information to libc.

	--david

--
To unsubscribe: mail -s unsubscribe axp-list-request@redhat.com < /dev/null

^ permalink raw reply	[flat|nested] 2+ messages in thread
* timeout printing bug in ipfwadm
@ 1996-07-25 23:54 Richard Henderson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 1996-07-25 23:54 UTC (permalink / raw)


Enclosed is a patch to ipfwadm.c to deal with system
clocks not running at 100Hz.

r~

--- ipfwadm.c.orig	Mon Jun 17 05:33:11 1996
+++ ipfwadm.c	Thu Jul 25 18:35:24 1996
@@ -100,6 +100,10 @@
 #include <linux/ip_fw.h>
 #include <asm/param.h>
 
+#ifndef HZ
+#define HZ __KERNEL_HZ
+#endif
+
 #ifndef	IP_FW_F_REDIR
 #define IPFWADM_NO_REDIR
 #define IP_FW_F_REDIR		0
@@ -1548,9 +1552,9 @@
 		break;
 	}
 
-	sec100s = ms->expires % 100L;
-	seconds = (ms->expires / 100L) % 60;
-	minutes = ms->expires / 6000L;
+	sec100s = ms->expires % HZ * 100 / HZ;
+	seconds = ms->expires / HZ % 60;
+	minutes = ms->expires / (HZ * 60);
 
 	fprintf(fp, "%02ld:%02ld.%02ld ", minutes, seconds, sec100s);
 

--
To unsubscribe: mail -s unsubscribe axp-list-request@redhat.com < /dev/null

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1996-07-28 23:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-07-28 23:41 timeout printing bug in ipfwadm David Mosberger-Tang
  -- strict thread matches above, loose matches on Subject: below --
1996-07-25 23:54 Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox