#include #ifndef CONFIG_DEBUG_STREAMS #define CONFIG_DEBUG_STREAMS #endif #ifndef CONFIG_DEBUG_ISDN #define CONFIG_DEBUG_ISDN #endif #ifndef _LINUX_SYSCOMPAT_H_ #define _LINUX_SYSCOMPAT_H_ #include #ifdef __KERNEL__ #include #include #include #include #include #include #ifndef COMPAT_C #ifdef interruptible_sleep_on #undef interruptible_sleep_on extern void interruptible_sleep_on(struct wait_queue ** p); #endif #ifdef sleep_on #undef sleep_on extern void sleep_on(struct wait_queue ** p); #endif #endif #else #include #endif #include #include #include #include #ifndef MAX_PATH #define MAX_PATH PATH_MAX #endif #define IRQ_BH 31 #define STREAMS_BH 30 #if 1 typedef unsigned char uchar_t; typedef unsigned short ushort_t; typedef unsigned int uint_t; typedef unsigned long ulong_t; #endif #ifdef __KERNEL__ /* * splx(XXX) sets the interrupt mask to XXX. * * spl(XXX) adds XXX to the current interrupt mask. * Note that all mask bits mean "enabled"! */ #ifdef CONFIG_DEBUG_LATENCY #include struct offtime setter_off[32]; #endif extern inline unsigned long get_bh_mask(void) { unsigned long flags; save_flags(flags); if(flags & 0x200) return bh_mask | (1< b ? a : b); } extern inline unsigned int min(unsigned int a, unsigned int b) { return (a < b ? a : b); } extern inline unsigned int max(unsigned int a, unsigned int b) { return (a > b ? a : b); } extern inline long lmin(long a, long b) { return (a < b ? a : b); } extern inline long lmax(long a, long b) { return (a > b ? a : b); } extern inline unsigned long ulmin(unsigned long a, unsigned long b) { return (a < b ? a : b); } extern inline unsigned long ulmax(unsigned long a, unsigned long b) { return (a > b ? a : b); } /* U-area defines, for starters. If you need more, add them */ #ifdef UAREA #define u (*current) #endif #define u_uid fsuid #define u_gid fsgid #define u_error errno #define printf printk #define log(a,x...) printk(x) #define curproc current #define proc task_struct /* ugliness... */ #define p_pid pid /* add as necessary */ extern inline void psignal(int sig, struct proc *p) { send_sig(sig,p,1); } extern inline void gsignal(int sig, int pg) { kill_pg(pg, sig, 1); } extern inline void microtime(struct timeval *tv) { void do_gettimeofday(struct timeval *tv); do_gettimeofday(tv); } extern inline long kvtop(void *addr) { return (long)addr; } #endif /* __KERNEL__ */ /* The following code is lifted from NetBSD. */ /* * Copyright (c) 1993 Christopher G. Demetriou * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software withough specific prior written permission * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * select.h,v 1.1 1993/05/18 18:20:36 cgd Exp * * Hacked for Linux. 1.0 -M.U- */ /* definiton of info needed to do select on behalf of a device */ struct selinfo { struct wait_queue *queue; }; #ifdef __KERNEL__ #if 0 extern inline void selrecord(struct proc *p, struct selinfo *si) { select_wait(&si->queue,current->selwait); } #else #define selrecord(a,b,c,d,e,f,g) WrongNumberOfArgumentsBreak #endif extern inline void selwakeup(struct selinfo *si) { wake_up_interruptible(&si->queue); } struct prochd { struct prochd *ph_link; /* linked list of running processes */ struct prochd *ph_rlink; }; extern inline void _insque(struct prochd *element, struct prochd *head) { unsigned long s = spl6(); element->ph_link = head->ph_link; head->ph_link = element; element->ph_rlink = head; element->ph_link->ph_rlink = element; splx(s); } #define insque(a,b) _insque((struct prochd *)(a),(struct prochd *)(b)) extern inline void _remque(struct prochd *element) { unsigned long s = spl6(); element->ph_link->ph_rlink = element->ph_rlink; element->ph_rlink->ph_link = element->ph_link; element->ph_rlink = NULL; splx(s); } #define remque(a) _remque((struct prochd *)(a)) void sysdump(const char *msg, struct pt_regs *regs, unsigned long err); #endif /* __KERNEL__ */ #endif /* _LINUX_SYSCOMPAT_H_ */