diff -ur --unidirectional-new-file skipsrc-1.0.orig/skip/freebsd/skip_os.h work.new/skip/freebsd/skip_os.h --- skipsrc-1.0.orig/skip/freebsd/skip_os.h Fri Oct 25 13:12:43 1996 +++ work.new/skip/freebsd/skip_os.h Tue Feb 1 10:02:28 2000 @@ -51,10 +51,9 @@ /* * FreeBSD */ -#ifndef KERNEL +#if !defined(KERNEL) && !defined(_KERNEL) #include #include -#include #include #include #include @@ -69,6 +68,12 @@ #include #endif +#include + +#if defined(KERNEL) || defined(_KERNEL) +#include +#endif + #include #include #include @@ -77,16 +82,19 @@ #include #include #include +#include #include #include #include #include #include #include +#include #ifndef __cplusplus #include #include +#include #include #endif #include @@ -94,8 +102,9 @@ #include #include #include -#include +#include #endif +#include /* * Basic required types and constants @@ -108,34 +117,54 @@ #define B_FALSE 0 #endif -#ifdef KERNEL +#if defined(KERNEL) || defined(_KERNEL) #include #include #include #include #include #include +#if __FreeBSD_version < 400004 #include +#endif +#include #include #include #include #include #include #include +#if __FreeBSD_version < 400012 #include +#endif +#include +#include +#include +#include #define PANIC(s) panic(s) /* + * SKIP malloc type + */ +MALLOC_DECLARE(M_SKIP); + +/* * 4.x memory management macros */ -#define SYSMEM_ALLOC(size) malloc((u_long)size, M_PCB, M_NOWAIT) -#define SYSMEM_FREE(m, n) free(m, M_PCB) -#define BCOPY(s, d, n) bcopy((caddr_t) s, (caddr_t) d, n) -#define BZERO(s, n) bzero((caddr_t) s, n) -#define BCMP(s, d, n) bcmp((caddr_t) s, (caddr_t) d, n) +#define SYSMEM_ALLOC(size) malloc((u_long)size, M_SKIP, M_NOWAIT) +#define SYSMEM_FREE(m, n) free(m, M_SKIP) #define STATIC static +/* + * The kernel doesn't have memcpy() or memcmp(), but gcc will inline them + */ +#if defined(KERNEL) || defined(_KERNEL) +extern int memcmp(const void *, const void *, size_t); +#endif +#define BCOPY(s, d, n) memcpy((caddr_t) (d), (caddr_t) (s), n) +#define BCMP(s, d, n) memcmp((caddr_t) (d), (caddr_t) (s), n) +#define BZERO(s, n) bzero((caddr_t) (s), n) #define ALIGNED(x) (((unsigned int)(x)&(skip_alignment - 1)) == 0) @@ -182,7 +211,7 @@ /* * 4.x timing defines */ -#define SKIP_ES_CURRENTTIME (time.tv_sec) +#define SKIP_ES_CURRENTTIME ((long)time_second) #define SKIP_ES_DELTATIME(then) (SKIP_ES_CURRENTTIME - then) /* @@ -204,28 +233,7 @@ len = IPHLEN(ip); \ } -/* - * ANSI prototypes for system routines - */ -extern int splimp(); -extern int splnet(); -extern void splx(int); -extern void m_freem(struct mbuf *); -extern void panic(const char *, ...); -extern int tsleep(void *, int, char *, int); -extern void wakeup(void *); -extern int uiomove(caddr_t, int, struct uio *); -extern int copyin(void *, void *, u_int ); -extern int copyout(void *, void *, u_int); -extern int mclget(struct mbuf *); -extern int m_cpytoc(struct mbuf *, int, int, caddr_t); - -extern void log(int, const char *, ...); - -extern char *strncpy(char *, const char *, size_t); - -extern void printf(const char *, ...); -#else /* KERNEL */ +#else /* KERNEL || _KERNEL */ /* * User space buffer management macros @@ -251,37 +259,12 @@ #endif #define STATIC -/* - * ANSI prototypes for C library routines and syscalls - */ -extern int gethostname(char *, int); -extern int fprintf(FILE *, const char *, ...); -extern int fflush(FILE *); -extern int fgetc(FILE *); -extern int fseek(FILE *, long, int); -extern size_t fread(void *, size_t, size_t, FILE *); -extern int fclose(FILE *); -extern int socket(int, int, int); -extern int ioctl(int, int, ...); -extern int pclose(FILE *); -/*extern int getrlimit(int, struct rlimit *); */ -extern void perror(const char *); -extern time_t time(time_t *); -extern int getopt(int, char * const *, const char *); -extern int sscanf(const char *, const char *, ...); - #endif /* KERNEL */ -/* XXX Bad IPPROTO_ENCAP define ? */ -#ifdef IPPROTO_ENCAP -#undef IPPROTO_ENCAP -#endif -#define IPPROTO_ENCAP 4 - /* SKIP specific */ -#define SKIP_DIR "/etc/skip/" -#define SKIP_BIN "/usr/skip/bin" +#define SKIP_DIR "@@PREFIX@@/etc/skip/" +#define SKIP_BIN "@@PREFIX@@/bin" #define KEYMGR "/dev/skip_key" /* @@ -306,12 +289,6 @@ /* General purpose */ typedef unsigned char byte; - -#if 0 -extern void bcopy(void *, void *, int); -extern void bzero(void *, int); -extern int bcmp(void *, void *, int); -#endif #define SKIP_IFCMP(if1, if2) strcmp(if1, if2)