rpms/kernel/devel linux-2.6-debug-account-kmalloc.patch,1.4,1.5

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Thu Dec 29 00:05:56 UTC 2005


Author: davej

Update of /cvs/dist/rpms/kernel/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv7764

Modified Files:
	linux-2.6-debug-account-kmalloc.patch 
Log Message:
account kstrdup too


linux-2.6-debug-account-kmalloc.patch:
 linux-2.6.14/include/linux/slab.h |   29 +++++-
 linux-2.6.14/mm/slab.c            |   36 -------
 tiny/fs/proc/proc_misc.c          |   21 ++++
 tiny/include/linux/slab.h         |   19 +++
 tiny/init/Kconfig                 |    7 +
 tiny/mm/Makefile                  |    1 
 tiny/mm/kmallocacct.c             |  182 ++++++++++++++++++++++++++++++++++++++
 tiny/mm/slab.c                    |    8 +
 8 files changed, 265 insertions(+), 38 deletions(-)

Index: linux-2.6-debug-account-kmalloc.patch
===================================================================
RCS file: /cvs/dist/rpms/kernel/devel/linux-2.6-debug-account-kmalloc.patch,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- linux-2.6-debug-account-kmalloc.patch	28 Dec 2005 21:54:15 -0000	1.4
+++ linux-2.6-debug-account-kmalloc.patch	29 Dec 2005 00:05:42 -0000	1.5
@@ -385,3 +385,61 @@
  /**
   * kcalloc - allocate memory for an array. The memory is set to zero.
 
+--- linux-2.6.14/include/linux/slab.h~	2005-12-28 19:04:06.000000000 -0500
++++ linux-2.6.14/include/linux/slab.h	2005-12-28 19:04:47.000000000 -0500
+@@ -126,6 +126,27 @@ static inline void *kzalloc(size_t size,
+ 	return ret;
+ }
+ 
++/*
++ * 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
++ */
++static inline 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;
++}
++
+ /**
+  * kcalloc - allocate memory for an array. The memory is set to zero.
+  * @n: number of elements.
+--- linux-2.6.14/mm/slab.c~	2005-12-28 19:04:54.000000000 -0500
++++ linux-2.6.14/mm/slab.c	2005-12-28 19:04:59.000000000 -0500
+@@ -3669,25 +3669,3 @@ unsigned int ksize(const void *objp)
+ 	return obj_reallen(page_get_cache(virt_to_page(objp)));
+ }
+ 
+-
+-/*
+- * 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);




More information about the fedora-cvs-commits mailing list