diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-03-09 21:12:20 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-03-09 21:12:20 +0000 |
commit | dda5be5c1fc672b5d9cb3a910b5e0cb0a41046c5 (patch) | |
tree | 0af32db840a032a50312791977b7d129def1d5b3 /nuttx/libxx/libxx_internal.hxx | |
parent | 2ac33dcffabd9422659c3b013ed8624c09ae90e4 (diff) | |
download | nuttx-dda5be5c1fc672b5d9cb3a910b5e0cb0a41046c5.tar.gz nuttx-dda5be5c1fc672b5d9cb3a910b5e0cb0a41046c5.tar.bz2 nuttx-dda5be5c1fc672b5d9cb3a910b5e0cb0a41046c5.zip |
More changes for a kernel-mode allocator (more to be done)
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5724 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/libxx/libxx_internal.hxx')
-rw-r--r-- | nuttx/libxx/libxx_internal.hxx | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/nuttx/libxx/libxx_internal.hxx b/nuttx/libxx/libxx_internal.hxx index fe84c763e..74d5526ce 100644 --- a/nuttx/libxx/libxx_internal.hxx +++ b/nuttx/libxx/libxx_internal.hxx @@ -1,7 +1,7 @@ //*************************************************************************** // lib/libxx_internal.h // -// Copyright (C) 2012 Gregory Nutt. All rights reserved. +// Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. // Author: Gregory Nutt <gnutt@nuttx.org> // // Redistribution and use in source and binary forms, with or without @@ -46,6 +46,26 @@ // Definitions //*************************************************************************** +// The NuttX C library an be build in two modes: (1) as a standard, C-libary +// that can be used by normal, user-space applications, or (2) as a special, +// kernel-mode C-library only used within the OS. If NuttX is not being +// built as separated kernel- and user-space modules, then only the first +// mode is supported. + +#if defined(CONFIG_NUTTX_KERNEL) && defined(__KERNEL__) +# include <nuttx/kmalloc.h> +# define lib_malloc(s) kmalloc(s) +# define lib_zalloc(s) kzalloc(s) +# define lib_realloc(p,s) krealloc(p,s) +# define lib_free(p) kfree(p) +#else +# include <cstdlib> +# define lib_malloc(s) malloc(s) +# define lib_zalloc(s) zalloc(s) +# define lib_realloc(p,s) realloc(p,s) +# define lib_free(p) free(p) +#endif + //*************************************************************************** // Public Types //***************************************************************************/ |