Revision e25db98d9ae542f95d139e316a6d490ceddd141e authored by Andi Kleen on 16 January 2006, 00:56:42 UTC, committed by Linus Torvalds on 16 January 2006, 19:27:59 UTC
To avoid mistakes. I got a few reports where people got broken timing because they didn't have the PMTIMER fallback. Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 5f8efbb
util.c
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/module.h>
/**
* kzalloc - allocate memory. The memory is set to zero.
* @size: how many bytes of memory are required.
* @flags: the type of memory to allocate.
*/
void *kzalloc(size_t size, gfp_t flags)
{
void *ret = kmalloc(size, flags);
if (ret)
memset(ret, 0, size);
return ret;
}
EXPORT_SYMBOL(kzalloc);
/*
* kstrdup - allocate space for and copy an existing string
*
* @s: the string to duplicate
* @gfp: the GFP mask used in the kmalloc() call when allocating memory
*/
char *kstrdup(const char *s, gfp_t gfp)
{
size_t len;
char *buf;
if (!s)
return NULL;
len = strlen(s) + 1;
buf = kmalloc(len, gfp);
if (buf)
memcpy(buf, s, len);
return buf;
}
EXPORT_SYMBOL(kstrdup);
Computing file changes ...