X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=modules%2Fppp_ahdlc.c;h=4254bd70296e843a39b0d5ab30d84ca5c5313199;hp=c39e48ce65712a4b74142392c29a274876ae1c4d;hb=128c40d244bb66c4567098ebd20dff64f80b083c;hpb=45225e9561dbcc5bba2c90ca34b7f6a72271e0e0 diff --git a/modules/ppp_ahdlc.c b/modules/ppp_ahdlc.c index c39e48c..4254bd7 100644 --- a/modules/ppp_ahdlc.c +++ b/modules/ppp_ahdlc.c @@ -41,7 +41,7 @@ * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, * OR MODIFICATIONS. * - * $Id: ppp_ahdlc.c,v 1.14 2000/02/16 20:39:24 masputra Exp $ + * $Id: ppp_ahdlc.c,v 1.16 2000/03/06 19:38:12 masputra Exp $ */ /* @@ -68,10 +68,6 @@ #include #include "ppp_mod.h" -#if !defined(clock32_t) -typedef clock_t clock32_t; -#endif /* clock32_t */ - /* * Right now, mutex is only enabled for Solaris 2.x */ @@ -79,6 +75,21 @@ typedef clock_t clock32_t; #define USE_MUTEX #endif /* SOL2 */ +/* + * intpointer_t and uintpointer_t are signed and unsigned integer types + * large enough to hold any data pointer; that is, data pointers can be + * assigned into or from these integer types without losing precision. + * On recent Solaris releases, these types are defined in sys/int_types.h, + * but not on SunOS 4.x or the earlier Solaris versions. + */ +#if defined(_LP64) || defined(_I32LPx) +typedef long intpointer_t; +typedef unsigned long uintpointer_t; +#else +typedef int intpointer_t; +typedef unsigned int uintpointer_t; +#endif + MOD_OPEN_DECL(ahdlc_open); MOD_CLOSE_DECL(ahdlc_close); static int ahdlc_wput __P((queue_t *, mblk_t *)); @@ -595,7 +606,7 @@ ahdlc_encode(q, mp) * the system's LBOLT value in clock ticks */ if (drv_getparm(LBOLT, &lbolt) != -1) { - if (ABS((clock32_t)lbolt - state->lbolt) > state->flag_time) { + if (ABS((clock_t)lbolt - state->lbolt) > state->flag_time) { *outmp->b_wptr++ = PPP_FLAG; } state->lbolt = lbolt; @@ -692,14 +703,6 @@ ahdlc_encode(q, mp) #define IN_RX_MAP(c, m) ((((unsigned int) (uchar_t) (c)) < 0x20) && \ (m) & (1 << (c))) -/* - * SunOS 4.x does not have intptr_t or uintptr_t defined, so - * declare them here - */ -#if defined(SUNOS4) -typedef int intptr_t; -typedef unsigned int uintptr_t; -#endif /* SUNOS4 */ /* * Process received characters. @@ -723,7 +726,7 @@ ahdlc_decode(q, mp) * data upstream in one message block, concatenate everything */ if (!((mp->b_wptr - mp->b_rptr == msgdsize(mp)) && - ((intptr_t)mp->b_rptr % sizeof(intptr_t) == 0))) { + ((intpointer_t)mp->b_rptr % sizeof(intpointer_t) == 0))) { zmp = msgpullup(mp, -1); freemsg(mp);