X-Git-Url: https://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=modules%2Fbsd-comp.c;h=d30e0d25f69da08dc4781cdfc6e1b58e85f0e9c0;hp=d6b1c3c45b52b8531af86d41255e20cdae2d39f1;hb=c3c8051cf96ed66e210e114813cc5de8eb6d122e;hpb=f4d5a87c725be4efd3ab91a49498d548ebe0e91c diff --git a/modules/bsd-comp.c b/modules/bsd-comp.c index d6b1c3c..d30e0d2 100644 --- a/modules/bsd-comp.c +++ b/modules/bsd-comp.c @@ -38,20 +38,40 @@ */ /* - * This version is for use with STREAMS under SunOS 4.x. + * This version is for use with STREAMS under SunOS 4.x, + * DEC Alpha OSF/1, and AIX 4.x. * - * $Id: bsd-comp.c,v 1.7 1994/11/30 05:29:36 paulus Exp $ + * $Id: bsd-comp.c,v 1.8 1994/12/08 00:35:33 paulus Exp $ */ +#ifdef __aix4__ +#include +#endif #include #include #include -#include #include #include #include #include +#ifdef sun +#include +#define ALLOCATE(n) kmem_alloc((n), KMEM_NOSLEEP) +#define FREE(p, n) kmem_free((p), (n)) +#endif + +#ifdef __osf__ +#include +#define ALLOCATE(n) kalloc((n)) +#define FREE(p, n) kfree((p), (n)) +#endif + +#ifdef __aix4__ +#define ALLOCATE(n) xmalloc((n), 0, pinned_heap) +#define FREE(p, n) xmfree((p), pinned_heap) +#endif + #define PACKETPTR mblk_t * #include @@ -352,7 +372,7 @@ bsd_alloc(options, opt_len, decomp) maxmaxcode = MAXCODE(bits); newlen = sizeof(*db) + (hsize-1) * (sizeof(db->dict[0])); - db = (struct bsd_db *) kmem_alloc(newlen, KMEM_NOSLEEP); + db = (struct bsd_db *) ALLOCATE(newlen); if (!db) return NULL; bzero(db, sizeof(*db) - sizeof(db->dict)); @@ -360,10 +380,9 @@ bsd_alloc(options, opt_len, decomp) if (!decomp) { db->lens = NULL; } else { - db->lens = (u_short *) kmem_alloc((maxmaxcode+1) * sizeof(db->lens[0]), - KMEM_NOSLEEP); + db->lens = (u_short *) ALLOCATE((maxmaxcode+1) * sizeof(db->lens[0])); if (!db->lens) { - kmem_free(db, newlen); + FREE(db, newlen); return NULL; } } @@ -384,8 +403,8 @@ bsd_free(state) struct bsd_db *db = (struct bsd_db *) state; if (db->lens) - kmem_free(db->lens, (db->maxmaxcode+1) * sizeof(db->lens[0])); - kmem_free(db, db->totlen); + FREE(db->lens, (db->maxmaxcode+1) * sizeof(db->lens[0])); + FREE(db, db->totlen); } static void *