summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>1996-06-26 00:53:17 +0000
committerPaul Mackerras <paulus@samba.org>1996-06-26 00:53:17 +0000
commita51ffdeea95fdbbb21555408d3e5002ad7069c8a (patch)
tree981af59908d9dbed47965d39a14523999d3e8988 /modules
parentf0929f9c62155287b8e1162d080f1913ae8c31b9 (diff)
downloadppp-a51ffdeea95fdbbb21555408d3e5002ad7069c8a.tar.gz
mods for OSF/1
Diffstat (limited to 'modules')
-rw-r--r--modules/bsd-comp.c15
-rw-r--r--modules/deflate.c27
-rw-r--r--modules/ppp_mod.h59
-rw-r--r--modules/vjcompress.c8
4 files changed, 75 insertions, 34 deletions
diff --git a/modules/bsd-comp.c b/modules/bsd-comp.c
index d9e9fe9..3d89d70 100644
--- a/modules/bsd-comp.c
+++ b/modules/bsd-comp.c
@@ -39,9 +39,9 @@
/*
* This version is for use with STREAMS under SunOS 4.x,
- * DEC Alpha OSF/1, AIX 4.x, and SVR4 systems including Solaris 2.
+ * Digital UNIX, AIX 4.x, and SVR4 systems including Solaris 2.
*
- * $Id: bsd-comp.c,v 1.18 1996/01/18 03:12:53 paulus Exp $
+ * $Id: bsd-comp.c,v 1.19 1996/06/26 00:53:15 paulus Exp $
*/
#ifdef AIX4
@@ -60,7 +60,7 @@
#endif
#endif
-#ifdef OSF1
+#ifdef __osf__
#undef FIRST
#undef LAST
#define BSD_LITTLE_ENDIAN
@@ -326,6 +326,7 @@ bsd_alloc(options, opt_len, decomp)
if (opt_len != 3 || options[0] != CI_BSD_COMPRESS || options[1] != 3
|| BSD_VERSION(options[2]) != BSD_CURRENT_VERSION)
return NULL;
+
bits = BSD_NBITS(options[2]);
switch (bits) {
case 9: /* needs 82152 for both directions */
@@ -357,7 +358,11 @@ bsd_alloc(options, opt_len, decomp)
maxmaxcode = MAXCODE(bits);
newlen = sizeof(*db) + (hsize-1) * (sizeof(db->dict[0]));
+#ifdef __osf__
+ db = (struct bsd_db *) ALLOC_SLEEP(newlen);
+#else
db = (struct bsd_db *) ALLOC_NOSLEEP(newlen);
+#endif
if (!db)
return NULL;
bzero(db, sizeof(*db) - sizeof(db->dict));
@@ -365,7 +370,11 @@ bsd_alloc(options, opt_len, decomp)
if (!decomp) {
db->lens = NULL;
} else {
+#ifdef __osf__
+ db->lens = (u_short *) ALLOC_SLEEP((maxmaxcode+1) * sizeof(db->lens[0]));
+#else
db->lens = (u_short *) ALLOC_NOSLEEP((maxmaxcode+1) * sizeof(db->lens[0]));
+#endif
if (!db->lens) {
FREE(db, newlen);
return NULL;
diff --git a/modules/deflate.c b/modules/deflate.c
index 57294a9..c285b47 100644
--- a/modules/deflate.c
+++ b/modules/deflate.c
@@ -27,7 +27,7 @@
* OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
* OR MODIFICATIONS.
*
- * $Id: deflate.c,v 1.2 1996/04/04 02:44:56 paulus Exp $
+ * $Id: deflate.c,v 1.3 1996/06/26 00:53:16 paulus Exp $
*/
#ifdef AIX4
@@ -41,7 +41,12 @@
#define PACKETPTR mblk_t *
#include <net/ppp-comp.h>
+
+#ifdef __osf__
+#include "zlib.h"
+#else
#include "common/zlib.h"
+#endif
#if DO_DEFLATE
@@ -61,8 +66,8 @@ struct deflate_state {
#define DEFLATE_OVHD 2 /* Deflate overhead/packet */
-static void *zalloc __P((void *, u_int items, u_int size));
-static void zfree __P((void *, void *ptr, u_int nb));
+static void *z_alloc __P((void *, u_int items, u_int size));
+static void z_free __P((void *, void *ptr, u_int nb));
static void *z_comp_alloc __P((u_char *options, int opt_len));
static void *z_decomp_alloc __P((u_char *options, int opt_len));
static void z_comp_free __P((void *state));
@@ -106,15 +111,19 @@ struct compressor ppp_deflate = {
* Space allocation and freeing routines for use by zlib routines.
*/
static void *
-zalloc(notused, items, size)
+z_alloc(notused, items, size)
void *notused;
u_int items, size;
{
+#ifdef __osf__
+ return ALLOC_SLEEP(items * size);
+#else
return ALLOC_NOSLEEP(items * size);
+#endif
}
static void
-zfree(notused, ptr, nbytes)
+z_free(notused, ptr, nbytes)
void *notused;
void *ptr;
u_int nbytes;
@@ -147,8 +156,8 @@ z_comp_alloc(options, opt_len)
return NULL;
state->strm.next_in = NULL;
- state->strm.zalloc = (alloc_func) zalloc;
- state->strm.zfree = (free_func) zfree;
+ state->strm.zalloc = (alloc_func) z_alloc;
+ state->strm.zfree = (free_func) z_free;
if (deflateInit2(&state->strm, Z_DEFAULT_COMPRESSION, DEFLATE_METHOD_VAL,
-w_size, 8, Z_DEFAULT_STRATEGY, DEFLATE_OVHD+2) != Z_OK) {
FREE(state, sizeof(*state));
@@ -379,8 +388,8 @@ z_decomp_alloc(options, opt_len)
return NULL;
state->strm.next_out = NULL;
- state->strm.zalloc = (alloc_func) zalloc;
- state->strm.zfree = (free_func) zfree;
+ state->strm.zalloc = (alloc_func) z_alloc;
+ state->strm.zfree = (free_func) z_free;
if (inflateInit2(&state->strm, -w_size) != Z_OK) {
FREE(state, sizeof(*state));
return NULL;
diff --git a/modules/ppp_mod.h b/modules/ppp_mod.h
index e647a63..59b940f 100644
--- a/modules/ppp_mod.h
+++ b/modules/ppp_mod.h
@@ -2,10 +2,6 @@
* Miscellaneous definitions for PPP STREAMS modules.
*/
-#if defined(osf) || defined(__osf__)
-#define OSF1
-#endif
-
/*
* Macros for allocating and freeing kernel memory.
*/
@@ -14,6 +10,7 @@
#define ALLOC_SLEEP(n) kmem_alloc((n), KM_SLEEP)
#define ALLOC_NOSLEEP(n) kmem_alloc((n), KM_NOSLEEP)
#define FREE(p, n) kmem_free((p), (n))
+#define NOTSUSER() (suser()? 0: EPERM)
#endif
#ifdef SUNOS4
@@ -21,27 +18,58 @@
#define ALLOC_SLEEP(n) kmem_alloc((n), KMEM_SLEEP)
#define ALLOC_NOSLEEP(n) kmem_alloc((n), KMEM_NOSLEEP)
#define FREE(p, n) kmem_free((p), (n))
+#define NOTSUSER() (suser()? 0: EPERM)
#endif /* SunOS 4 */
-#ifdef OSF1
-#include <kern/kalloc.h> /* OSF/1 */
+#ifdef __osf__
+#include <sys/malloc.h>
+
+/* caution: this mirrors macros in sys/malloc.h, and uses interfaces
+ * which are subject to change.
+ * The problems are that:
+ * - the official MALLOC macro wants the lhs of the assignment as an argument,
+ * and it takes care of the assignment itself (yuck.)
+ * - PPP insists on using "FREE" which conflicts with a macro of the same name.
+ *
+ */
+#ifdef BUCKETINDX /* V2.0 */
+#define ALLOC_SLEEP(n) (void *)malloc((u_long)(n), BUCKETP(n), M_DEVBUF, M_WAITOK)
+#define ALLOC_NOSLEEP(n) (void *)malloc((u_long)(n), BUCKETP(n), M_DEVBUF, M_NOWAIT)
+#else
+#define ALLOC_SLEEP(n) (void *)malloc((u_long)(n), BUCKETINDEX(n), M_DEVBUF, M_WAITOK)
+#define ALLOC_NOSLEEP(n) (void *)malloc((u_long)(n), BUCKETINDEX(n), M_DEVBUF, M_NOWAIT)
+#endif
+
+#ifdef FREE
#undef FREE
-#define ALLOC_SLEEP(n) kalloc((n))
-#define ALLOC_NOSLEEP(n) kalloc((n))
-#define FREE(p, n) kfree((p), (n))
-#endif /* OSF/1 */
+#endif
+#define FREE(p, n) free((void *)(p), M_DEVBUF)
+
+#define NO_DLPI 1
+
+#ifndef IFT_PPP
+#define IFT_PPP 0x17
+#endif
+
+#include <sys/proc.h>
+#define NOTSUSER() (suser(u.u_procp->p_rcred, &u.u_acflag) ? EPERM : 0)
+
+#include "ppp_osf.h"
+
+#endif /* __osf__ */
#ifdef AIX4
#define ALLOC_SLEEP(n) xmalloc((n), 0, pinned_heap) /* AIX V4.x */
#define ALLOC_NOSLEEP(n) xmalloc((n), 0, pinned_heap) /* AIX V4.x */
#define FREE(p, n) xmfree((p), pinned_heap)
+#define NOTSUSER() (suser()? 0: EPERM)
#endif /* AIX */
/*
* Macros for printing debugging stuff.
*/
#ifdef DEBUG
-#ifdef SVR4
+#if defined(SVR4) || defined(__osf__)
#define DPRINT(f) cmn_err(CE_CONT, f)
#define DPRINT1(f, a1) cmn_err(CE_CONT, f, a1)
#define DPRINT2(f, a1, a2) cmn_err(CE_CONT, f, a1, a2)
@@ -63,8 +91,10 @@
#ifndef SVR4
typedef unsigned char uchar_t;
typedef unsigned short ushort_t;
+#ifndef __osf__
typedef int minor_t;
#endif
+#endif
/*
* If we don't have multithreading support, define substitutes.
@@ -146,11 +176,4 @@ static int name(q, flag) \
#define OPEN_ERROR(x) { u.u_error = (x); return OPENFAIL; }
#define DRV_OPEN_OK(dev) return (dev)
-#ifdef OSF1
-#include <sys/proc.h>
-#define NOTSUSER() (suser(u.u_procp->p_rcred, &u.u_acflag))
-#else
-#define NOTSUSER() (suser()? 0: EPERM)
-#endif
-
#endif /* SVR4 */
diff --git a/modules/vjcompress.c b/modules/vjcompress.c
index eecbef5..66d3402 100644
--- a/modules/vjcompress.c
+++ b/modules/vjcompress.c
@@ -26,10 +26,10 @@
*/
/*
- * This version is used under SunOS 4.x, DEC Alpha OSF/1, AIX 4.x,
+ * This version is used under SunOS 4.x, Digital UNIX, AIX 4.x,
* and SVR4 systems including Solaris 2.
*
- * $Id: vjcompress.c,v 1.8 1996/05/24 07:04:26 paulus Exp $
+ * $Id: vjcompress.c,v 1.9 1996/06/26 00:53:17 paulus Exp $
*/
#include <sys/types.h>
@@ -44,7 +44,7 @@
#endif
#endif
-#ifdef OSF1
+#ifdef __osf__
#include <net/net_globals.h>
#endif
#include <netinet/in.h>
@@ -75,7 +75,7 @@ typedef u_long n_long;
#define ovbcopy bcopy
#endif
-#ifdef OSF1
+#ifdef __osf__
#define getip_hl(base) (((base).ip_vhl)&0xf)
#define getth_off(base) ((((base).th_xoff)&0xf0)>>4)