summaryrefslogtreecommitdiffstats
path: root/defines.h
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2001-02-16 12:34:57 +1100
committerDamien Miller <djm@mindrot.org>2001-02-16 12:34:57 +1100
commit79438cc03040e22a053f2cb02e42483272b458df (patch)
treecbc85e2742e20db8ed40835b087523f78eb4e9a8 /defines.h
parent217f567187a9b1d32019666151d702c87332c72b (diff)
- (djm) OpenBSD CVS:
- markus@cvs.openbsd.org 2001/02/15 16:19:59 [channels.c channels.h serverloop.c sshconnect.c sshconnect.h] [sshconnect1.c sshconnect2.c] genericize password padding function for SSH1 and SSH2. add stylized echo to 2, too. - (djm) Add roundup() macro to defines.h
Diffstat (limited to 'defines.h')
-rw-r--r--defines.h24
1 files changed, 14 insertions, 10 deletions
diff --git a/defines.h b/defines.h
index 9f1ab3d7..635bfad2 100644
--- a/defines.h
+++ b/defines.h
@@ -1,7 +1,7 @@
#ifndef _DEFINES_H
#define _DEFINES_H
-/* $Id: defines.h,v 1.54 2001/02/09 11:55:17 djm Exp $ */
+/* $Id: defines.h,v 1.55 2001/02/16 01:34:57 djm Exp $ */
/* Some platforms need this for the _r() functions */
#if !defined(_REENTRANT) && !defined(SNI)
@@ -12,7 +12,7 @@
#include <sys/types.h> /* For [u]intxx_t */
#include <sys/socket.h> /* For SHUT_XXXX */
-#include <sys/param.h> /* For MAXPATHLEN */
+#include <sys/param.h> /* For MAXPATHLEN and roundup() */
#include <netinet/in_systm.h> /* For typedefs */
#include <netinet/in.h> /* For IPv6 macros */
#include <netinet/ip.h> /* For IPTOS macros */
@@ -318,15 +318,19 @@ struct winsize {
# define MIN(a,b) (((a)<(b))?(a):(b))
#endif
+#ifndef roundup
+# define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
+#endif
+
#ifndef timersub
-#define timersub(a, b, result) \
- do { \
- (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
- (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
- if ((result)->tv_usec < 0) { \
- --(result)->tv_sec; \
- (result)->tv_usec += 1000000; \
- } \
+#define timersub(a, b, result) \
+ do { \
+ (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
+ (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
+ if ((result)->tv_usec < 0) { \
+ --(result)->tv_sec; \
+ (result)->tv_usec += 1000000; \
+ } \
} while (0)
#endif