1111317Srwatson/*-
2111317Srwatson * Copyright (c) 2003 Networks Associates Technology, Inc.
3111317Srwatson * All rights reserved.
4111317Srwatson *
5111517Srwatson * This software was developed for the FreeBSD Project by Network
6111517Srwatson * Associates Laboratories, the Security Research Division of Network
7111517Srwatson * Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035
8111517Srwatson * ("CBOSS"), as part of the DARPA CHATS research program.
9111317Srwatson *
10111317Srwatson * Redistribution and use in source and binary forms, with or without
11111317Srwatson * modification, are permitted provided that the following conditions
12111317Srwatson * are met:
13111317Srwatson * 1. Redistributions of source code must retain the above copyright
14111317Srwatson *    notice, this list of conditions and the following disclaimer.
15111317Srwatson * 2. Redistributions in binary form must reproduce the above copyright
16111317Srwatson *    notice, this list of conditions and the following disclaimer in the
17111317Srwatson *    documentation and/or other materials provided with the distribution.
18111317Srwatson *
19111317Srwatson * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20111317Srwatson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21111317Srwatson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22111317Srwatson * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23111317Srwatson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24111317Srwatson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25111317Srwatson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26111317Srwatson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27111317Srwatson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28111317Srwatson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29111317Srwatson * SUCH DAMAGE.
30111317Srwatson */
31111317Srwatson
32116189Sobrien#include <sys/cdefs.h>
33116189Sobrien__FBSDID("$FreeBSD$");
34116189Sobrien
35111317Srwatson#include <sys/param.h>
36111317Srwatson#include <sys/kernel.h>
37111317Srwatson#include <sys/libkern.h>
38111317Srwatson#include <sys/malloc.h>
39111317Srwatson
40111317Srwatsonchar *
41111506Srwatsonstrdup(const char *string, struct malloc_type *type)
42111317Srwatson{
43111317Srwatson	size_t len;
44111317Srwatson	char *copy;
45111317Srwatson
46111317Srwatson	len = strlen(string) + 1;
47111506Srwatson	copy = malloc(len, type, M_WAITOK);
48111317Srwatson	bcopy(string, copy, len);
49111317Srwatson	return (copy);
50111317Srwatson}
51