Clean kernel-/user-mode module build
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3469 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
4388221844
commit
38fd6e5317
27
Makefile
27
Makefile
@ -175,7 +175,7 @@ endif
|
||||
# USERLIBS is the list of libraries used to build the final user-space
|
||||
# application
|
||||
|
||||
NUTTXLIBS = sched/libsched$(LIBEXT) $(ARCH_SRC)/libarch$(LIBEXT) lib/liblib$(LIBEXT)
|
||||
NUTTXLIBS = sched/libsched$(LIBEXT) $(ARCH_SRC)/libarch$(LIBEXT)
|
||||
USERLIBS =
|
||||
|
||||
# Add libraries for syscall support. The C library will be needed by
|
||||
@ -183,10 +183,10 @@ USERLIBS =
|
||||
# is placed in user space (only).
|
||||
|
||||
ifeq ($(CONFIG_NUTTX_KERNEL),y)
|
||||
NUTTXLIBS += syscall/libstubs$(LIBEXT)
|
||||
USERLIBS += syscall/libproxies$(LIBEXT) lib/liblib$(LIBEXT) mm/libmm$(LIBEXT)
|
||||
NUTTXLIBS += syscall/libstubs$(LIBEXT) lib/libklib$(LIBEXT)
|
||||
USERLIBS += syscall/libproxies$(LIBEXT) lib/libulib$(LIBEXT) mm/libmm$(LIBEXT)
|
||||
else
|
||||
NUTTXLIBS += mm/libmm$(LIBEXT)
|
||||
NUTTXLIBS += mm/libmm$(LIBEXT) lib/liblib$(LIBEXT)
|
||||
endif
|
||||
|
||||
# Add libraries for network support. CXX, CXXFLAGS, and COMPILEXX must
|
||||
@ -246,6 +246,7 @@ NUTTXLIBS += graphics/libgraphics$(LIBEXT)
|
||||
endif
|
||||
|
||||
# This is the name of the final target
|
||||
|
||||
BIN = nuttx$(EXEEXT)
|
||||
|
||||
all: $(BIN)
|
||||
@ -256,28 +257,34 @@ tools/mkconfig:
|
||||
@$(MAKE) -C tools -f Makefile.host TOPDIR="$(TOPDIR)" mkconfig
|
||||
|
||||
# Create the include/nuttx/config.h file
|
||||
|
||||
include/nuttx/config.h: $(TOPDIR)/.config tools/mkconfig
|
||||
tools/mkconfig $(TOPDIR) > include/nuttx/config.h
|
||||
|
||||
# link the arch/<arch-name>/include dir to include/arch
|
||||
|
||||
include/arch: Make.defs
|
||||
@$(DIRLINK) $(TOPDIR)/$(ARCH_DIR)/include include/arch
|
||||
|
||||
# Link the configs/<board-name>/include dir to include/arch/board
|
||||
|
||||
include/arch/board: include/arch Make.defs include/arch
|
||||
@$(DIRLINK) $(TOPDIR)/$(BOARD_DIR)/include include/arch/board
|
||||
|
||||
# Link the configs/<board-name>/src dir to arch/<arch-name>/src/board
|
||||
|
||||
$(ARCH_SRC)/board: Make.defs
|
||||
@$(DIRLINK) $(TOPDIR)/$(BOARD_DIR)/src $(ARCH_SRC)/board
|
||||
|
||||
# Link arch/<arch-name>/include/<chip-name> to arch/<arch-name>/include/chip
|
||||
|
||||
$(ARCH_SRC)/chip: Make.defs
|
||||
ifneq ($(CONFIG_ARCH_CHIP),)
|
||||
@$(DIRLINK) $(TOPDIR)/$(ARCH_SRC)/$(CONFIG_ARCH_CHIP) $(ARCH_SRC)/chip
|
||||
endif
|
||||
|
||||
# Link arch/<arch-name>/src/<chip-name> to arch/<arch-name>/src/chip
|
||||
|
||||
include/arch/chip: include/arch Make.defs
|
||||
ifneq ($(CONFIG_ARCH_CHIP),)
|
||||
@$(DIRLINK) $(TOPDIR)/$(ARCH_INC)/$(CONFIG_ARCH_CHIP) include/arch/chip
|
||||
@ -307,6 +314,9 @@ check_context:
|
||||
|
||||
# Possible kernel-mode builds
|
||||
|
||||
lib/libklib$(LIBEXT): context
|
||||
@$(MAKE) -C lib TOPDIR="$(TOPDIR)" libklib$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
||||
|
||||
sched/libsched$(LIBEXT): context
|
||||
@$(MAKE) -C sched TOPDIR="$(TOPDIR)" libsched$(LIBEXT) EXTRADEFINES=$(KDEFINE)
|
||||
|
||||
@ -336,8 +346,8 @@ syscall/libstubs$(LIBEXT): context
|
||||
|
||||
# Possible user-mode builds
|
||||
|
||||
lib/liblib$(LIBEXT): context
|
||||
@$(MAKE) -C lib TOPDIR="$(TOPDIR)" liblib$(LIBEXT)
|
||||
lib/libulib$(LIBEXT): context
|
||||
@$(MAKE) -C lib TOPDIR="$(TOPDIR)" libulib$(LIBEXT)
|
||||
|
||||
libxx/liblibxx$(LIBEXT): context
|
||||
@$(MAKE) -C libxx TOPDIR="$(TOPDIR)" liblibxx$(LIBEXT)
|
||||
@ -351,6 +361,11 @@ $(APPDIR)/libapps$(LIBEXT): context
|
||||
syscall/libproxies$(LIBEXT): context
|
||||
@$(MAKE) -C syscall TOPDIR="$(TOPDIR)" libproxies$(LIBEXT)
|
||||
|
||||
# Possible non-kernel builds
|
||||
|
||||
lib/liblib$(LIBEXT): context
|
||||
@$(MAKE) -C lib TOPDIR="$(TOPDIR)" liblib$(LIBEXT)
|
||||
|
||||
# If the 2 pass build option is selected, then this pass1 target is
|
||||
# configured to built before the pass2 target. This pass1 target may, as an
|
||||
# example, build an extra link object (CONFIG_PASS1_OBJECT) which may be an
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/src/common/up_createstack.c
|
||||
*
|
||||
* Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -41,7 +41,6 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <sched.h>
|
||||
#include <debug.h>
|
||||
|
||||
@ -97,9 +96,9 @@ int up_create_stack(_TCB *tcb, size_t stack_size)
|
||||
if (!tcb->stack_alloc_ptr)
|
||||
{
|
||||
#ifdef CONFIG_DEBUG
|
||||
tcb->stack_alloc_ptr = (uint32_t*)zalloc(stack_size);
|
||||
tcb->stack_alloc_ptr = (uint32_t*)kzalloc(stack_size);
|
||||
#else
|
||||
tcb->stack_alloc_ptr = (uint32_t*)malloc(stack_size);
|
||||
tcb->stack_alloc_ptr = (uint32_t*)kmalloc(stack_size);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@
|
||||
* Configuration:
|
||||
* CONFIG_USBHOST_OHCIRAM_SIZE 1536
|
||||
* CONFIG_USBHOST_NEDS 2
|
||||
* CONFIG_USBHOST_NEDS 3
|
||||
* CONFIG_USBHOST_NTDS 3
|
||||
* CONFIG_USBHOST_TDBUFFERS 3
|
||||
* CONFIG_USBHOST_TDBUFSIZE 128
|
||||
* CONFIG_USBHOST_IOBUFSIZE 512
|
||||
|
@ -2596,7 +2596,7 @@ FAR struct usbhost_driver_s *usbhost_initialize(int controller)
|
||||
/* Initialize user-configurable request/descriptor transfer buffers */
|
||||
|
||||
buffer = (uint8_t *)LPC17_TBFREE_BASE;
|
||||
for (i = 0; i < CONFIG_USBHOST_NEDS; i++)
|
||||
for (i = 0; i < CONFIG_USBHOST_TDBUFFERS; i++)
|
||||
{
|
||||
/* Put the TD buffer in a free list */
|
||||
|
||||
|
@ -66,17 +66,19 @@ all: $(TOPDIR)/nuttx_user.elf $(TOPDIR)/User.map $(BOARD_INCLUDE)/user_map.h
|
||||
# Create the nuttx_user.elf file containing all of the user-mode code
|
||||
|
||||
nuttx_user.elf:
|
||||
@echo "LD: nuttx_user.elf"
|
||||
@$(LD) -o $@ $(USER_LDFLAGS) $(USER_LIBPATHS) --start-group $(USER_LDLIBS) --end-group $(USER_LIBGCC)
|
||||
|
||||
$(TOPDIR)/nuttx_user.elf: nuttx_user.elf
|
||||
@echo "LD: nuttx_user.elf"
|
||||
@cp -a nuttx_user.elf $(TOPDIR)/nuttx_user.elf
|
||||
|
||||
$(TOPDIR)/User.map: nuttx_user.elf
|
||||
@echo "MK: User.map"
|
||||
@$(NM) nuttx_user.elf >$(TOPDIR)/User.map
|
||||
@$(CROSSDEV)size nuttx_user.elf
|
||||
|
||||
$(BOARD_INCLUDE)/user_map.h: $(TOPDIR)/User.map
|
||||
@echo "MK: user_map.h"
|
||||
@echo "/* configs/$(CONFIG_ARCH_BOARD)/include/user_map.h" > $(BOARD_INCLUDE)/user_map.h
|
||||
@echo " *" >> $(BOARD_INCLUDE)/user_map.h
|
||||
@echo " * This is an auto-generated file.. Do not edit this file!" >> $(BOARD_INCLUDE)/user_map.h
|
||||
|
@ -39,10 +39,10 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/fs.h>
|
||||
#include <nuttx/dirent.h>
|
||||
|
||||
@ -134,17 +134,17 @@ int closedir(FAR DIR *dirp)
|
||||
|
||||
/* Then release the container */
|
||||
|
||||
free(idir);
|
||||
kfree(idir);
|
||||
return OK;
|
||||
|
||||
#ifndef CONFIG_DISABLE_MOUNTPOINT
|
||||
errout_with_inode:
|
||||
inode_release(inode);
|
||||
free(idir);
|
||||
kfree(idir);
|
||||
#endif
|
||||
|
||||
errout:
|
||||
*get_errno_ptr() = ret;
|
||||
errno = ret;
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
|
@ -40,12 +40,12 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <semaphore.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/fs.h>
|
||||
|
||||
/****************************************************************************
|
||||
@ -145,7 +145,7 @@ FAR struct file_struct *fs_fdopen(int fd, int oflags, FAR _TCB *tcb)
|
||||
|
||||
/* Allocate the IO buffer */
|
||||
|
||||
stream->fs_bufstart = malloc(CONFIG_STDIO_BUFFER_SIZE);
|
||||
stream->fs_bufstart = kmalloc(CONFIG_STDIO_BUFFER_SIZE);
|
||||
if (!stream)
|
||||
{
|
||||
err = ENOMEM;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* fs_inode.c
|
||||
* fs/fs_inode.c
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -179,7 +179,7 @@ void inode_semtake(void)
|
||||
* the wait was awakened by a signal.
|
||||
*/
|
||||
|
||||
ASSERT(*get_errno_ptr() == EINTR);
|
||||
ASSERT(errno == EINTR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -308,7 +308,7 @@ void inode_free(FAR struct inode *node)
|
||||
{
|
||||
inode_free(node->i_peer);
|
||||
inode_free(node->i_child);
|
||||
free(node);
|
||||
kfree(node);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,8 +39,9 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/fs.h>
|
||||
|
||||
#include "fs_internal.h"
|
||||
@ -95,7 +96,7 @@ void inode_release(FAR struct inode *node)
|
||||
{
|
||||
inode_semgive();
|
||||
inode_free(node->i_child);
|
||||
free(node);
|
||||
kfree(node);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -39,8 +39,9 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/fs.h>
|
||||
|
||||
#include "fs_internal.h"
|
||||
@ -144,7 +145,7 @@ int inode_remove(const char *path)
|
||||
/* And delete it now -- recursively to delete all of its children */
|
||||
|
||||
inode_free(node->i_child);
|
||||
free(node);
|
||||
kfree(node);
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* fs/fs_registerreserve.c
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -39,8 +39,9 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/fs.h>
|
||||
|
||||
#include "fs_internal.h"
|
||||
@ -89,7 +90,7 @@ static void inode_namecpy(char *dest, const char *src)
|
||||
static FAR struct inode *inode_alloc(const char *name)
|
||||
{
|
||||
int namelen = inode_namelen(name);
|
||||
FAR struct inode *node = (FAR struct inode*)zalloc(FSNODE_SIZE(namelen));
|
||||
FAR struct inode *node = (FAR struct inode*)kzalloc(FSNODE_SIZE(namelen));
|
||||
if (node)
|
||||
{
|
||||
inode_namecpy(node->i_name, name);
|
||||
|
@ -39,13 +39,13 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <dirent.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/fs.h>
|
||||
#include <nuttx/dirent.h>
|
||||
|
||||
@ -235,7 +235,7 @@ FAR DIR *opendir(FAR const char *path)
|
||||
* container.
|
||||
*/
|
||||
|
||||
dir = (FAR struct fs_dirent_s *)zalloc(sizeof(struct fs_dirent_s));
|
||||
dir = (FAR struct fs_dirent_s *)kzalloc(sizeof(struct fs_dirent_s));
|
||||
if (!dir)
|
||||
{
|
||||
/* Insufficient memory to complete the operation.*/
|
||||
@ -306,7 +306,7 @@ FAR DIR *opendir(FAR const char *path)
|
||||
/* Nasty goto's make error handling simpler */
|
||||
|
||||
errout_with_direntry:
|
||||
free(dir);
|
||||
kfree(dir);
|
||||
|
||||
errout_with_semaphore:
|
||||
inode_semgive();
|
||||
|
@ -41,7 +41,6 @@
|
||||
|
||||
#include <sys/select.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <poll.h>
|
||||
#include <time.h>
|
||||
@ -49,6 +48,7 @@
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include <nuttx/fs.h>
|
||||
|
||||
#include "fs_internal.h"
|
||||
@ -111,7 +111,7 @@ int select(int nfds, FAR fd_set *readfds, FAR fd_set *writefds,
|
||||
|
||||
/* Allocate the descriptor list for poll() */
|
||||
|
||||
pollset = (struct pollfd *)zalloc(nfds * sizeof(struct pollfd));
|
||||
pollset = (struct pollfd *)kzalloc(nfds * sizeof(struct pollfd));
|
||||
if (!pollset)
|
||||
{
|
||||
errno = ENOMEM;
|
||||
@ -208,7 +208,7 @@ int select(int nfds, FAR fd_set *readfds, FAR fd_set *writefds,
|
||||
}
|
||||
}
|
||||
|
||||
free(pollset);
|
||||
kfree(pollset);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
30
lib/Makefile
30
lib/Makefile
@ -80,7 +80,9 @@ QUEUEDEPPATH = --dep-path queue
|
||||
MISCDEPPATH = --dep-path misc
|
||||
VPATH = stdio:stdlib:unistd:sched:string:pthread:semaphore:signal:mqueue:math:net:time:libgen:queue:misc
|
||||
|
||||
BIN = liblib$(LIBEXT)
|
||||
UBIN = libulib$(LIBEXT)
|
||||
KBIN = libklib$(LIBEXT)
|
||||
BIN = liblib$(LIBEXT)
|
||||
|
||||
all: $(BIN)
|
||||
|
||||
@ -95,6 +97,22 @@ $(BIN): $(OBJS)
|
||||
$(call ARCHIVE, $@, $${obj}); \
|
||||
done ; )
|
||||
|
||||
ifneq ($(BIN),$(UBIN))
|
||||
.userlib:
|
||||
@$(MAKE) $(UBIN) BIN=$(UBIN) TOPDIR=$(TOPDIR) EXTRADEFINES=$(EXTRADEFINES)
|
||||
@touch .userlib
|
||||
|
||||
$(UBIN): kclean .userlib
|
||||
endif
|
||||
|
||||
ifneq ($(BIN),$(KBIN))
|
||||
.kernlib:
|
||||
@$(MAKE) $(KBIN) BIN=$(KBIN) TOPDIR=$(TOPDIR) EXTRADEFINES=$(EXTRADEFINES)
|
||||
@touch .kernlib
|
||||
|
||||
$(KBIN): uclean .kernlib
|
||||
endif
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
@$(MKDEP) $(ROOTDEPPATH) $(STDIODEPPATH) $(STDLIBDEPPATH) \
|
||||
$(UNISTDDEPPATH) $(SCHEDDEPPATH) $(STRINGDEPPATH) $(PTHREADDEPPATH) \
|
||||
@ -105,7 +123,15 @@ $(BIN): $(OBJS)
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
uclean:
|
||||
@rm -f $(UBIN) .userlib *~ .*.swp
|
||||
$(call CLEAN)
|
||||
|
||||
kclean:
|
||||
@rm -f $(KBIN) .kernlib *~ .*.swp
|
||||
$(call CLEAN)
|
||||
|
||||
clean: uclean kclean
|
||||
@rm -f $(BIN) *~ .*.swp
|
||||
$(call CLEAN)
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* lib/lib_internal.h
|
||||
*
|
||||
* Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -47,6 +47,7 @@
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#include <semaphore.h>
|
||||
|
||||
#include <nuttx/streams.h>
|
||||
|
||||
/****************************************************************************
|
||||
@ -57,10 +58,35 @@
|
||||
# define CONFIG_LIB_HOMEDIR "/"
|
||||
#endif
|
||||
|
||||
/* If C std I/O buffering is not supported, then we don't need its semaphore
|
||||
* protection.
|
||||
*/
|
||||
|
||||
#if CONFIG_STDIO_BUFFER_SIZE <= 0
|
||||
# define lib_sem_initialize(s)
|
||||
# define lib_take_semaphore(s)
|
||||
# define lib_give_semaphore(s)
|
||||
# define lib_sem_initialize(s)
|
||||
# define lib_take_semaphore(s)
|
||||
# define lib_give_semaphore(s)
|
||||
#endif
|
||||
|
||||
/* 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 <stdlib.h>
|
||||
# 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
|
||||
|
||||
#define LIB_BUFLEN_UNKNOWN INT_MAX
|
||||
|
@ -40,7 +40,6 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
@ -83,7 +82,7 @@ void weak_const_function lib_initialize(void)
|
||||
FAR struct streamlist *lib_alloclist(void)
|
||||
{
|
||||
FAR struct streamlist *list;
|
||||
list = (FAR struct streamlist*)zalloc(sizeof(struct streamlist));
|
||||
list = (FAR struct streamlist*)lib_zalloc(sizeof(struct streamlist));
|
||||
if (list)
|
||||
{
|
||||
int i;
|
||||
|
@ -45,10 +45,11 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "lib_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
@ -142,7 +143,7 @@ static Bigint *Balloc(int k)
|
||||
else
|
||||
{
|
||||
x = 1 << k;
|
||||
rv = (Bigint *) malloc(sizeof(Bigint) + (x - 1) * sizeof(long));
|
||||
rv = (Bigint *)lib_malloc(sizeof(Bigint) + (x - 1) * sizeof(long));
|
||||
rv->k = k;
|
||||
rv->maxwds = x;
|
||||
}
|
||||
|
@ -39,12 +39,13 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "lib_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Global Functions
|
||||
****************************************************************************/
|
||||
@ -68,7 +69,7 @@ int fclose(FAR FILE *stream)
|
||||
|
||||
if (stream->fs_bufstart)
|
||||
{
|
||||
free(stream->fs_bufstart);
|
||||
lib_free(stream->fs_bufstart);
|
||||
}
|
||||
|
||||
/* Clear the whole structure */
|
||||
|
@ -39,9 +39,10 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "lib_internal.h"
|
||||
|
||||
/************************************************************************
|
||||
* Global Functions
|
||||
************************************************************************/
|
||||
@ -51,7 +52,7 @@ FAR char *strdup(const char *s)
|
||||
FAR char *news = NULL;
|
||||
if (s)
|
||||
{
|
||||
news = (FAR char*)malloc(strlen(s) + 1);
|
||||
news = (FAR char*)lib_malloc(strlen(s) + 1);
|
||||
if (news)
|
||||
{
|
||||
strcpy(news, s);
|
||||
|
@ -164,7 +164,7 @@ int chdir(FAR const char *path)
|
||||
|
||||
alloc = strdup(oldpwd); /* kludge needed because environment is realloc'ed */
|
||||
setenv("OLDPWD", alloc, TRUE);
|
||||
free(alloc);
|
||||
lib_free(alloc);
|
||||
|
||||
/* Set the cwd to the input 'path' */
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* tools/mkconfig.c
|
||||
*
|
||||
* Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -288,6 +288,15 @@ int main(int argc, char **argv, char **envp)
|
||||
printf("# undef CONFIG_STDIO_BUFFER_SIZE\n");
|
||||
printf("# define CONFIG_STDIO_BUFFER_SIZE 0\n");
|
||||
printf("#endif\n\n");
|
||||
printf("/* We are building a kernel version of the C library, then some user-space features\n");
|
||||
printf(" * need to be disabled\n");
|
||||
printf(" */\n\n");
|
||||
printf("#if defined(CONFIG_NUTTX_KERNEL) && defined(__KERNEL__)\n");
|
||||
printf("# undef CONFIG_STDIO_BUFFER_SIZE\n");
|
||||
printf("# define CONFIG_STDIO_BUFFER_SIZE 0\n");
|
||||
printf("# undef CONFIG_NUNGET_CHARS\n");
|
||||
printf("# define CONFIG_NUNGET_CHARS 0\n");
|
||||
printf("#endif\n\n");
|
||||
printf("/* If the maximum message size is zero, then we assume that message queues\n");
|
||||
printf(" * support should be disabled\n");
|
||||
printf(" */\n\n");
|
||||
|
Loading…
Reference in New Issue
Block a user