source: rtems-libbsd/rtemsbsd/src/rtems-bsd-malloc.c @ 129579c

4.1155-freebsd-126-freebsd-12freebsd-9.3
Last change on this file since 129579c was 129579c, checked in by Jennifer Averett <jennifer.averett@…>, on 03/23/12 at 18:09:05

Add M_IP6... symbols to resolve linker errors using the RealTek? Nic.

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup rtems_bsd_rtems
5 *
6 * @brief TODO.
7 */
8
9/*
10 * Copyright (c) 2009, 2010 embedded brains GmbH.  All rights reserved.
11 *
12 *  embedded brains GmbH
13 *  Obere Lagerstr. 30
14 *  82178 Puchheim
15 *  Germany
16 *  <rtems@embedded-brains.de>
17 *
18 * The license and distribution terms for this file may be
19 * found in the file LICENSE in this distribution or at
20 * http://www.rtems.com/license/LICENSE.
21 */
22
23#include <freebsd/machine/rtems-bsd-config.h>
24
25#include <freebsd/sys/param.h>
26#include <freebsd/sys/types.h>
27#include <freebsd/sys/systm.h>
28#include <freebsd/sys/malloc.h>
29#include <freebsd/sys/kernel.h>
30
31MALLOC_DEFINE(M_DEVBUF, "devbuf", "device driver memory");
32
33MALLOC_DEFINE(M_TEMP, "temp", "misc temporary data buffers");
34
35MALLOC_DEFINE(M_IP6OPT, "ip6opt", "IPv6 options");
36MALLOC_DEFINE(M_IP6NDP, "ip6ndp", "IPv6 Neighbor Discovery");
37
38void
39malloc_init(void *data)
40{
41        struct malloc_type *mtp = data;
42}
43
44void
45malloc_uninit(void *data)
46{
47        struct malloc_type *mtp = data;
48
49        BSD_PRINTF( "desc = %s\n", mtp->ks_shortdesc);
50}
51
52#undef malloc
53
54void *
55_bsd_malloc(unsigned long size, struct malloc_type *mtp, int flags)
56{
57        void *p = malloc(size);
58
59        if ((flags & M_ZERO) != 0 && p != NULL) {
60                memset(p, 0, size);
61        }
62
63        return p;
64}
65
66#undef free
67
68void
69_bsd_free(void *addr, struct malloc_type *mtp)
70{
71        free(addr);
72}
73
74#undef strdup
75
76char *
77_bsd_strdup(const char *__restrict s, struct malloc_type *type)
78{
79        return strdup(s);
80}
Note: See TracBrowser for help on using the repository browser.