File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / libpdel / util / kernelglue.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:25:53 2012 UTC (13 years, 1 month ago) by misho
Branches: libpdel, MAIN
CVS tags: v0_5_3, HEAD
libpdel

    1: 
    2: /*
    3:  * Copyright (c) 2001-2002 Packet Design, LLC.
    4:  * All rights reserved.
    5:  * 
    6:  * Subject to the following obligations and disclaimer of warranty,
    7:  * use and redistribution of this software, in source or object code
    8:  * forms, with or without modifications are expressly permitted by
    9:  * Packet Design; provided, however, that:
   10:  * 
   11:  *    (i)  Any and all reproductions of the source or object code
   12:  *         must include the copyright notice above and the following
   13:  *         disclaimer of warranties; and
   14:  *    (ii) No rights are granted, in any manner or form, to use
   15:  *         Packet Design trademarks, including the mark "PACKET DESIGN"
   16:  *         on advertising, endorsements, or otherwise except as such
   17:  *         appears in the above copyright notice or in the software.
   18:  * 
   19:  * THIS SOFTWARE IS BEING PROVIDED BY PACKET DESIGN "AS IS", AND
   20:  * TO THE MAXIMUM EXTENT PERMITTED BY LAW, PACKET DESIGN MAKES NO
   21:  * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING
   22:  * THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED
   23:  * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
   24:  * OR NON-INFRINGEMENT.  PACKET DESIGN DOES NOT WARRANT, GUARANTEE,
   25:  * OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS
   26:  * OF THE USE OF THIS SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY,
   27:  * RELIABILITY OR OTHERWISE.  IN NO EVENT SHALL PACKET DESIGN BE
   28:  * LIABLE FOR ANY DAMAGES RESULTING FROM OR ARISING OUT OF ANY USE
   29:  * OF THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY DIRECT,
   30:  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE, OR CONSEQUENTIAL
   31:  * DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, LOSS OF
   32:  * USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY THEORY OF
   33:  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   34:  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
   35:  * THE USE OF THIS SOFTWARE, EVEN IF PACKET DESIGN IS ADVISED OF
   36:  * THE POSSIBILITY OF SUCH DAMAGE.
   37:  *
   38:  * Author: Archie Cobbs <archie@freebsd.org>
   39:  */
   40: 
   41: #ifndef _PDEL_UTIL_KERNELGLUE_H_
   42: #define _PDEL_UTIL_KERNELGLUE_H_
   43: 
   44: #ifndef _KERNEL
   45: #error This #include file is only for use within a kernel compilation
   46: #endif
   47: 
   48: #ifdef _PDEL_UTIL_TYPED_MEM_H_
   49: #error kernelglue.h must be included before typed_mem.h
   50: #endif
   51: 
   52: /*
   53:  * Undefine kernel MALLOC() and FREE() macros
   54:  */
   55: #undef MALLOC
   56: #undef FREE
   57: 
   58: /*
   59:  * Declare memory type for typed memory chunks
   60:  */
   61: MALLOC_DECLARE(M_LIBPDEL);
   62: 
   63: /*
   64:  * Kernel glue for 'errno'
   65:  */
   66: extern int errno;
   67: 
   68: /*
   69:  * Kernel glue for misc user-land macros
   70:  */
   71: #define MAX(x,y)	max(x,y)
   72: #define MIN(x,y)	min(x,y)
   73: #define assert(x) 	KASSERT((x), \
   74: 			    ("%s: assert failed: %s", __FUNCTION__, #x))
   75: 
   76: /*
   77:  * Kernel glue for misc user-land functions
   78:  */
   79: extern char		*strchr(const char *s, int c);
   80: extern char		*strdup(const char *s);
   81: extern int		asprintf(char **ret, const char *format, ...);
   82: extern int		vasprintf(char **ret, const char *format, va_list ap);
   83: extern int		strcasecmp(const char *s1, const char *s2);
   84: extern size_t		strlcpy(char *dst, const char *src, size_t siz);
   85: extern char		*strerror(int errnum);
   86: extern time_t		time(time_t *);
   87: extern void		*memmove(void *dst, const void *src, size_t len);
   88: extern void		*kern_malloc(size_t size);
   89: extern void		*kern_realloc(void *mem, size_t size);
   90: extern void		kern_free(void *mem);
   91: 
   92: #endif	/* _PDEL_UTIL_KERNELGLUE_H_ */
   93: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>