Move more files into subdirectories under lib/

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3445 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2011-03-31 01:42:50 +00:00
parent dfcc5fe5fd
commit a521443817
38 changed files with 293 additions and 184 deletions

View File

@ -1628,3 +1628,8 @@
the named app's /bin directory.
* lib/: Move all source files into a subdirectory of lib/ named after
the header file in which the library function is prototyped.
* sched/ and lib/pthread/: Move pthread attribute-related interfaces
from sched/ to lib/pthread where they more appropriately belong.
* sched/ and lib/semaphore/: Move some semaphore-related interfaces
from sched/ to lib/pthread where they more appropriately belong.
* syscall/: The beginnings of an options syscall interface.

View File

@ -916,7 +916,7 @@ include/
</p>
<ul><pre>
tools/
|-- Makefile.mkconfig
|-- Makefile.host
|-- configure.sh
|-- incdir.sh
|-- indent.sh

View File

@ -199,7 +199,7 @@ all: $(BIN)
# Build the mkconfig tool used to create include/nuttx/config.h
tools/mkconfig:
@$(MAKE) -C tools -f Makefile.mkconfig TOPDIR="$(TOPDIR)" 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
@ -353,7 +353,7 @@ subdir_clean:
$(MAKE) -C $$dir TOPDIR="$(TOPDIR)" clean ; \
fi \
done
@$(MAKE) -C tools -f Makefile.mkconfig TOPDIR="$(TOPDIR)" clean
@$(MAKE) -C tools -f Makefile.host TOPDIR="$(TOPDIR)" clean
@$(MAKE) -C mm -f Makefile.test TOPDIR="$(TOPDIR)" clean
ifeq ($(CONFIG_BUILD_2PASS),y)
@$(MAKE) -C $(CONFIG_PASS1_BUILDIR) TOPDIR="$(TOPDIR)" clean

85
include/nuttx/pthread.h Normal file
View File

@ -0,0 +1,85 @@
/****************************************************************************
* include/nuttx/pthread.h
* Non-standard, NuttX-specific pthread-related declarations.
*
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef __INCLUDE_NUTTX_PTHREAD_H
#define __INCLUDE_NUTTX_PTHREAD_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <pthread.h>
/****************************************************************************
* Pre-Processor Definitions
****************************************************************************/
/* Default pthread attribute initializer */
#define PTHREAD_ATTR_INITIALIZER \
{ \
PTHREAD_STACK_DEFAULT, /* stacksize */ \
PTHREAD_DEFAULT_PRIORITY, /* priority */ \
SCHED_RR, /* policy */ \
PTHREAD_EXPLICIT_SCHED, /* inheritsched */ \
}
/****************************************************************************
* Public Data
****************************************************************************/
/* Default pthread attributes (see sched/pthread_create.c) */
extern pthread_attr_t g_default_pthread_attr;
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C" {
#else
#define EXTERN extern
#endif
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif /* __INCLUDE_NUTTX_PTHREAD_H */

View File

@ -1,5 +1,5 @@
/********************************************************************************
* pthread.h
* include/pthread.h
*
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
@ -33,8 +33,8 @@
*
********************************************************************************/
#ifndef __PTHREAD_H
#define __PTHREAD_H
#ifndef __INCLUDE_PTHREAD_H
#define __INCLUDE_PTHREAD_H
/********************************************************************************
* Included Files
@ -147,9 +147,7 @@ extern "C" {
#define EXTERN extern
#endif
/*----------------------------------------------------------*
PTHREAD-SPECIFIC TYPES
*----------------------------------------------------------*/
/* pthread-specific types */
typedef int pthread_key_t;
typedef FAR void *pthread_addr_t;
@ -393,5 +391,5 @@ EXTERN int pthread_sigmask(int how, FAR const sigset_t *set, FAR sigset_t *oset)
}
#endif
#endif /* __PTHREAD_H */
#endif /* __INCLUDE_PTHREAD_H */

View File

@ -38,6 +38,8 @@ include stdio/Make.defs
include stdlib/Make.defs
include unistd/Make.defs
include string/Make.defs
include pthread/Make.defs
include semaphore/Make.defs
include math/Make.defs
include net/Make.defs
include time/Make.defs
@ -49,8 +51,9 @@ ASRCS =
AOBJS = $(ASRCS:.S=$(OBJEXT))
CSRCS = $(STDIO_SRCS) $(STDLIB_SRCS) $(UNISTD_SRCS) $(STRING_SRCS) \
$(MATH_SRCS) $(NET_SRCS) $(TIME_SRCS) $(LIBGEN_SRCS) \
$(QUEUE_SRCS) $(MISC_SRCS) $(REGEX_SRCS) $(CRC_SRCS) $(DBG_SRCS)
$(PTHREAD_SRCS) $(SEM_SRCS) $(MATH_SRCS) $(NET_SRCS) \
$(TIME_SRCS) $(LIBGEN_SRCS) $(QUEUE_SRCS) $(MISC_SRCS) \
$(REGEX_SRCS) $(CRC_SRCS) $(DBG_SRCS)
COBJS = $(CSRCS:.c=$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS)
@ -61,13 +64,15 @@ STDIODEPPATH = --dep-path stdio
STDLIBDEPPATH = --dep-path stdlib
UNISTDDEPPATH = --dep-path unistd
STRINGDEPPATH = --dep-path string
PTHREADDEPPATH = --dep-path pthread
SEMDEPPATH = --dep-path semaphore
MATHDEPPATH = --dep-path math
NETDEPPATH = --dep-path net
TIMEDEPPATH = --dep-path time
LIBGENDEPPATH = --dep-path libgen
QUEUEDEPPATH = --dep-path queue
MISCDEPPATH = --dep-path misc
VPATH = stdio:stdlib:unistd:string:math:net:time:libgen:queue:misc
VPATH = stdio:stdlib:unistd:string:pthread:semaphore:math:net:time:libgen:queue:misc
BIN = liblib$(LIBEXT)
@ -86,8 +91,9 @@ $(BIN): $(OBJS)
.depend: Makefile $(SRCS)
@$(MKDEP) $(ROOTDEPPATH) $(STDIODEPPATH) $(STDLIBDEPPATH) \
$(UNISTDDEPPATH) $(STRINGDEPPATH) $(MATHDEPPATH) $(NETDEPPATH) \
$(TIMEDEPPATH) $(LIBGENDEPPATH) $(QUEUEDEPPATH) $(MISCDEPPATH) \
$(UNISTDDEPPATH) $(STRINGDEPPATH) $(PTHREADDEPPATH) $(SEMDEPPATH) \
$(MATHDEPPATH) $(NETDEPPATH) $(TIMEDEPPATH) $(LIBGENDEPPATH) \
$(QUEUEDEPPATH) $(MISCDEPPATH) \
$(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
@touch $@

49
lib/pthread/Make.defs Normal file
View File

@ -0,0 +1,49 @@
############################################################################
# lib/pthread/Make.defs
#
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
PTHREAD_SRCS = pthread_attrinit.c pthread_attrdestroy.c \
pthread_attrsetschedpolicy.c pthread_attrgetschedpolicy.c \
pthread_attrsetinheritsched.c pthread_attrgetinheritsched.c \
pthread_attrsetstacksize.c pthread_attrgetstacksize.c \
pthread_attrsetschedparam.c pthread_attrgetschedparam.c \
pthread_barrierattrinit.c pthread_barrierattrdestroy.c \
pthread_barrierattrgetpshared.c pthread_barrierattrsetpshared.c \
pthread_condattrinit.c pthread_condattrdestroy.c \
pthread_mutexattrinit.c pthread_mutexattrdestroy.c \
pthread_mutexattrgetpshared.c pthread_mutexattrsetpshared.c
ifeq ($(CONFIG_MUTEX_TYPES),y)
PTHREAD_SRCS += pthread_mutexattrsettype.c pthread_mutexattrgettype.c
endif

View File

@ -1,7 +1,7 @@
/****************************************************************************
* sched/pthread_attrdestroy.c
* lib/pthread/pthread_attrdestroy.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
@ -43,7 +43,6 @@
#include <string.h>
#include <debug.h>
#include <errno.h>
#include "pthread_internal.h"
/****************************************************************************
* Definitions

View File

@ -1,7 +1,7 @@
/****************************************************************************
* sched/pthread_attrgetinheritsched.c
* lib/pthread/pthread_attrgetinheritsched.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
@ -43,7 +43,6 @@
#include <string.h>
#include <debug.h>
#include <errno.h>
#include "pthread_internal.h"
/****************************************************************************
* Definitions

View File

@ -1,7 +1,7 @@
/****************************************************************************
* sched/pthread_attrgetschedparam.c
* lib/pthread/pthread_attrgetschedparam.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
@ -44,7 +44,6 @@
#include <sched.h>
#include <debug.h>
#include <errno.h>
#include "pthread_internal.h"
/****************************************************************************
* Definitions

View File

@ -1,7 +1,7 @@
/****************************************************************************
* pthread_attrgetschedpolicy.c
* lib/pthread/pthread_attrgetschedpolicy.c
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -42,7 +42,6 @@
#include <string.h>
#include <debug.h>
#include <errno.h>
#include "pthread_internal.h"
/****************************************************************************
* Definitions

View File

@ -1,7 +1,7 @@
/****************************************************************************
* sched/pthread_attrgetstacksize.c
* lib/pthread/pthread_attrgetstacksize.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
@ -42,7 +42,6 @@
#include <string.h>
#include <debug.h>
#include <errno.h>
#include "pthread_internal.h"
/****************************************************************************
* Definitions

View File

@ -1,7 +1,7 @@
/****************************************************************************
* sched/pthread_attrinit.c
* lib/pthread/pthread_attrinit.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
@ -44,7 +44,7 @@
#include <debug.h>
#include <errno.h>
#include "pthread_internal.h"
#include <nuttx/pthread.h>
/****************************************************************************
* Definitions

View File

@ -1,7 +1,7 @@
/****************************************************************************
* sched/pthread_attrsetinheritsched.c
* lib/pthread/pthread_attrsetinheritsched.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
@ -45,8 +45,6 @@
#include <debug.h>
#include <errno.h>
#include "pthread_internal.h"
/****************************************************************************
* Definitions
****************************************************************************/

View File

@ -1,7 +1,7 @@
/****************************************************************************
* sched/pthread_attrsetschedparam.c
* lib/pthread/pthread_attrsetschedparam.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
@ -44,7 +44,6 @@
#include <sched.h>
#include <debug.h>
#include <errno.h>
#include "pthread_internal.h"
/****************************************************************************
* Definitions

View File

@ -1,7 +1,7 @@
/****************************************************************************
* sched/pthread_attrsetschedpolicy.c
* lib/pthread/pthread_attrsetschedpolicy.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
@ -44,7 +44,6 @@
#include <sched.h>
#include <debug.h>
#include <errno.h>
#include "pthread_internal.h"
/****************************************************************************
* Definitions

View File

@ -1,7 +1,7 @@
/****************************************************************************
* sched/pthread_attrsetstacksize.c
* lib/pthread/pthread_attrsetstacksize.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
@ -44,8 +44,6 @@
#include <debug.h>
#include <errno.h>
#include "pthread_internal.h"
/****************************************************************************
* Definitions
****************************************************************************/

View File

@ -1,7 +1,7 @@
/********************************************************************************
* sched/pthread_barrierattrdestroy.c
* lib/pthread/pthread_barrierattrdestroy.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

View File

@ -1,7 +1,7 @@
/********************************************************************************
* sched/pthread_barrierattrgetpshared.c
* lib/pthread/pthread_barrierattrgetpshared.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

View File

@ -1,7 +1,7 @@
/********************************************************************************
* sched/pthread_barrierattrinit.c
* lib/pthread/pthread_barrierattrinit.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

View File

@ -1,7 +1,7 @@
/********************************************************************************
* sched/pthread_barrierattrsetpshared.c
* lib/pthread/pthread_barrierattrsetpshared.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

View File

@ -1,7 +1,7 @@
/****************************************************************************
* sched/pthread_condattrdestroy.c
* lib/pthread/pthread_condattrdestroy.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
@ -42,7 +42,6 @@
#include <pthread.h>
#include <debug.h>
#include <errno.h>
#include "pthread_internal.h"
/****************************************************************************
* Global Functions

View File

@ -1,7 +1,7 @@
/****************************************************************************
* sched/pthread_condattrinit.c
* lib/pthread/pthread_condattrinit.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
@ -42,7 +42,6 @@
#include <pthread.h>
#include <debug.h>
#include <errno.h>
#include "pthread_internal.h"
/****************************************************************************
* Global Functions

View File

@ -1,7 +1,7 @@
/****************************************************************************
* sched/pthread_mutexattrdestroy.c
* lib/pthread/pthread_mutexattrdestroy.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
@ -43,8 +43,6 @@
#include <errno.h>
#include <debug.h>
#include "pthread_internal.h"
/****************************************************************************
* Definitions
****************************************************************************/

View File

@ -1,7 +1,7 @@
/****************************************************************************
* sched/pthread_mutexattrgetpshared.c
* lib/pthread/pthread_mutexattrgetpshared.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
@ -43,8 +43,6 @@
#include <errno.h>
#include <debug.h>
#include "pthread_internal.h"
/****************************************************************************
* Definitions
****************************************************************************/

View File

@ -1,7 +1,7 @@
/****************************************************************************
* sched/pthread_mutexattrgettype.c
* lib/pthread/pthread_mutexattrgettype.c
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008, 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,8 +41,6 @@
#include <pthread.h>
#include <errno.h>
#include "pthread_internal.h"
#ifdef CONFIG_MUTEX_TYPES
/****************************************************************************

View File

@ -1,7 +1,7 @@
/****************************************************************************
* pthread_mutexattrinit.c
* lib/pthread/pthread_mutexattrinit.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
@ -43,8 +43,6 @@
#include <errno.h>
#include <debug.h>
#include "pthread_internal.h"
/****************************************************************************
* Definitions
****************************************************************************/

View File

@ -1,7 +1,7 @@
/****************************************************************************
* sched/pthread_mutexattrsetpshared.c
* lib/pthread/pthread_mutexattrsetpshared.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
@ -43,8 +43,6 @@
#include <errno.h>
#include <debug.h>
#include "pthread_internal.h"
/****************************************************************************
* Definitions
****************************************************************************/

View File

@ -1,7 +1,7 @@
/****************************************************************************
* sched/pthread_mutexattrsettype.c
* lib/pthread/pthread_mutexattrsettype.c
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008, 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,8 +41,6 @@
#include <pthread.h>
#include <errno.h>
#include "pthread_internal.h"
#ifdef CONFIG_MUTEX_TYPES
/****************************************************************************

View File

@ -1,7 +1,7 @@
############################################################################
# Makefile.mkconfig
# lib/semaphore/Make.defs
#
# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# Redistribution and use in source and binary forms, with or without
@ -33,11 +33,4 @@
#
############################################################################
all: mkconfig
default: mkconfig
mkconfig: mkconfig.c
@gcc -O2 -Wall -o mkconfig mkconfig.c
clean:
@rm -f mkconfig mkconfig.exe *~
SEM_SRCS = sem_init.c sem_getvalue.c sem_destroy.c

View File

@ -1,7 +1,7 @@
/****************************************************************************
* sched/sem_destroy.c
* lib/semaphore/sem_destroy.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
@ -40,8 +40,7 @@
#include <nuttx/config.h>
#include <semaphore.h>
#include "sem_internal.h"
#include <errno.h>
/****************************************************************************
* Definitions
@ -93,8 +92,6 @@
int sem_destroy (FAR sem_t *sem)
{
int ret = ERROR;
/* Assure a valid semaphore is specified */
if (sem)
@ -117,8 +114,11 @@ int sem_destroy (FAR sem_t *sem)
/* Release holders of the semaphore */
sem_destroyholder(sem);
ret = OK;
return OK;
}
else
{
errno = -EINVAL;
return ERROR;
}
return ret;
}

View File

@ -1,7 +1,7 @@
/****************************************************************************
* sched/sem_getvalue.c
* lib/semaphore/sem_getvalue.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
@ -40,8 +40,7 @@
#include <nuttx/config.h>
#include <semaphore.h>
#include "sem_internal.h"
#include <errno.h>
/****************************************************************************
* Definitions
@ -95,13 +94,14 @@
int sem_getvalue(FAR sem_t *sem, FAR int *sval)
{
int ret = ERROR;
if (sem && sval)
{
*sval = sem->semcount;
ret = OK;
return OK;
}
else
{
errno = -EINVAL;
return ERROR;
}
return ret;
}

View File

@ -1,7 +1,7 @@
/****************************************************************************
* sched/sem_init.c
* lib/sem/sem_init.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,11 +39,9 @@
#include <nuttx/config.h>
#include <stdint.h>
#include <limits.h>
#include <semaphore.h>
#include "sem_internal.h"
#include <errno.h>
/****************************************************************************
* Definitions
@ -96,8 +94,6 @@
int sem_init (FAR sem_t *sem, int pshared, unsigned int value)
{
int ret = ERROR;
if (sem && value <= SEM_VALUE_MAX)
{
sem->semcount = (int16_t)value;
@ -108,8 +104,11 @@ int sem_init (FAR sem_t *sem, int pshared, unsigned int value)
sem->hlist.holder = NULL;
sem->hlist.counts = 0;
#endif
ret = OK;
return OK;
}
else
{
errno = -EINVAL;
return ERROR;
}
return ret;
}

View File

@ -100,22 +100,12 @@ ifneq ($(CONFIG_DISABLE_SIGNALS),y)
MQUEUE_SRCS += mq_notify.c
endif
PTHREAD_SRCS = pthread_attrinit.c pthread_attrdestroy.c \
pthread_attrsetschedpolicy.c pthread_attrgetschedpolicy.c \
pthread_attrsetinheritsched.c pthread_attrgetinheritsched.c \
pthread_attrsetstacksize.c pthread_attrgetstacksize.c \
pthread_attrsetschedparam.c pthread_attrgetschedparam.c \
pthread_create.c pthread_exit.c pthread_join.c pthread_detach.c \
PTHREAD_SRCS = pthread_create.c pthread_exit.c pthread_join.c pthread_detach.c \
pthread_yield.c pthread_getschedparam.c pthread_setschedparam.c \
pthread_mutexattrinit.c pthread_mutexattrdestroy.c \
pthread_mutexattrgetpshared.c pthread_mutexattrsetpshared.c \
pthread_mutexinit.c pthread_mutexdestroy.c \
pthread_mutexlock.c pthread_mutextrylock.c pthread_mutexunlock.c \
pthread_condinit.c pthread_conddestroy.c \
pthread_condattrinit.c pthread_condattrdestroy.c \
pthread_condwait.c pthread_condsignal.c pthread_condbroadcast.c \
pthread_barrierattrinit.c pthread_barrierattrdestroy.c \
pthread_barrierattrgetpshared.c pthread_barrierattrsetpshared.c \
pthread_barrierinit.c pthread_barrierdestroy.c pthread_barrierwait.c \
pthread_cancel.c pthread_setcancelstate.c \
pthread_keycreate.c pthread_setspecific.c pthread_getspecific.c pthread_keydelete.c \
@ -124,14 +114,9 @@ PTHREAD_SRCS = pthread_attrinit.c pthread_attrdestroy.c \
ifneq ($(CONFIG_DISABLE_SIGNALS),y)
PTHREAD_SRCS += pthread_condtimedwait.c pthread_kill.c pthread_sigmask.c
endif
ifeq ($(CONFIG_MUTEX_TYPES),y)
PTHREAD_SRCS += pthread_mutexattrsettype.c pthread_mutexattrgettype.c
endif
SEM_SRCS = sem_initialize.c sem_init.c sem_destroy.c\
sem_open.c sem_close.c sem_unlink.c \
sem_wait.c sem_trywait.c sem_post.c sem_getvalue.c \
sem_findnamed.c
SEM_SRCS = sem_initialize.c sem_open.c sem_close.c sem_unlink.c \
sem_wait.c sem_trywait.c sem_post.c sem_findnamed.c
ifneq ($(CONFIG_DISABLE_SIGNALS),y)
SEM_SRCS += sem_waitirq.c
endif

View File

@ -47,7 +47,9 @@
#include <debug.h>
#include <errno.h>
#include <queue.h>
#include <nuttx/kmalloc.h>
#include <nuttx/pthread.h>
#include <nuttx/arch.h>
#include "os_internal.h"
@ -69,13 +71,7 @@
/* Default pthread attributes */
FAR pthread_attr_t g_default_pthread_attr =
{
PTHREAD_STACK_DEFAULT, /* stacksize */
PTHREAD_DEFAULT_PRIORITY, /* priority */
SCHED_RR, /* policy */
PTHREAD_EXPLICIT_SCHED, /* inheritsched */
};
pthread_attr_t g_default_pthread_attr = PTHREAD_ATTR_INITIALIZER;
/****************************************************************************
* Private Variables

View File

@ -1,7 +1,7 @@
/****************************************************************************
* pthread_internal.h
* sched/pthread_internal.h
*
* 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
@ -33,8 +33,8 @@
*
****************************************************************************/
#ifndef __PTHREAD_INTERNAL_H
#define __PTHREAD_INTERNAL_H
#ifndef __SCHED_PTHREAD_INTERNAL_H
#define __SCHED_PTHREAD_INTERNAL_H
/****************************************************************************
* Included Files
@ -46,6 +46,7 @@
#include <stdint.h>
#include <stdbool.h>
#include <pthread.h>
#include <nuttx/compiler.h>
/****************************************************************************
@ -103,10 +104,6 @@ extern sem_t g_join_semaphore;
extern uint8_t g_pthread_num_keys;
/* Default pthread attributes */
extern FAR pthread_attr_t g_default_pthread_attr;
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
@ -135,5 +132,5 @@ EXTERN int pthread_mutexattr_verifytype(int type);
}
#endif
#endif /* __PTHREAD_INTERNAL_H */
#endif /* __SCHED_PTHREAD_INTERNAL_H */

View File

@ -3,7 +3,6 @@
"accept","sys/socket.h","int","int","struct sockaddr*","socklen_t*"
"atexit","stdlib.h","int","void *(*)(void)"
"bind","sys/socket.h","int","int","FAR const struct sockaddr*","socklen_t"
"chdir","unistd.h","int","FAR const char*"
"clearenv","stdlib.h","int"
"clock_getres","time.h","int","clockid_t","struct timespec*"
"clock_gettime","time.h","int","clockid_t","struct timespec*"
@ -21,7 +20,6 @@
"fsync","unistd.h","int","int"
"get_environ_ptr","stdlib.h","FAR char**"," void "
"get_errno_ptr","errno.h","FAR int*"
"getcwd","unistd.h","FAR char*","FAR char*","size_t"
"getenv","stdlib.h","FAR char*","FAR const char*"
"getpid","unistd.h","pidt_t"
"getsockopt","sys/socket.h","int","int","int","int","FAR void*","FAR socklen_t*"
@ -48,23 +46,9 @@
"opendir","dirent.h","FAR DIR*","FAR const char*"
"pipe","unistd.h","int","int[2]"
"poll","poll.h","int","FAR struct pollfd*","nfds_t","int"
"pthread_attr_destroy","pthread.h","int","pthread_attr_t*"
"pthread_attr_getinheritsched","pthread.h","int","FAR const pthread_attr_t*","FAR int*"
"pthread_attr_getschedparam","pthread.h","int","FAR pthread_attr_t*","FAR struct sched_param*"
"pthread_attr_getschedpolicy","pthread.h","int","FAR pthread_attr_t*","int*"
"pthread_attr_getstacksize","pthread.h","int","FAR pthread_attr_t*","long*"
"pthread_attr_init","pthread.h","int","FAR pthread_attr_t*"
"pthread_attr_setinheritsched","pthread.h","int","FAR pthread_attr_t*","int"
"pthread_attr_setschedparam","pthread.h","int","FAR pthread_attr_t*","FAR const struct sched_param*"
"pthread_attr_setschedpolicy","pthread.h","int","FAR pthread_attr_t*","int"
"pthread_attr_setstacksize","pthread.h","int","FAR pthread_attr_t*","long"
"pthread_barrier_destroy","pthread.h","int","FAR pthread_barrier_t*"
"pthread_barrier_init","pthread.h","int","FAR pthread_barrier_t*","FAR const pthread_barrierattr_t*","unsigned int"
"pthread_barrier_wait","pthread.h","int","FAR pthread_barrier_t*"
"pthread_barrierattr_destroy","pthread.h","int","FAR pthread_barrierattr_t*"
"pthread_barrierattr_getpshared","pthread.h","int","FAR const pthread_barrierattr_t*","FAR int*"
"pthread_barrierattr_init","pthread.h","int","FAR pthread_barrierattr_t*"
"pthread_barrierattr_setpshared","pthread.h","int","FAR pthread_barrierattr_t*","int"
"pthread_cancel","pthread.h","int","pthread_t"
"pthread_cond_broadcast","pthread.h","int","FAR pthread_cond_t*"
"pthread_cond_destroy","pthread.h","int","FAR pthread_cond_t*"
@ -72,8 +56,6 @@
"pthread_cond_signal","pthread.h","int","FAR pthread_cond_t*"
"pthread_cond_timedwait","pthread.h","int","FAR pthread_cond_t*","FAR pthread_mutex_t*","FAR const struct timespec*"
"pthread_cond_wait","pthread.h","int","FAR pthread_cond_t*","FAR pthread_mutex_t*"
"pthread_condattr_destroy","pthread.h","int","FAR pthread_condattr_t*"
"pthread_condattr_init","pthread.h","int","FAR pthread_condattr_t*"
"pthread_create","pthread.h","int","FAR pthread_t*","FAR pthread_attr_t*","pthread_startroutine_t","pthread_addr_t"
"pthread_detach","pthread.h","int","pthread_t"
"pthread_exit","pthread.h","void","pthread_addr_t"
@ -88,12 +70,6 @@
"pthread_mutex_lock","pthread.h","int","FAR pthread_mutex_t*"
"pthread_mutex_trylock","pthread.h","int","FAR pthread_mutex_t*"
"pthread_mutex_unlock","pthread.h","int","FAR pthread_mutex_t*"
"pthread_mutexattr_destroy","pthread.h","int","FAR pthread_mutexattr_t*"
"pthread_mutexattr_getpshared","pthread.h","int","FAR pthread_mutexattr_t*","FAR int*"
"pthread_mutexattr_gettype","pthread.h","int","const pthread_mutexattr_t*","int*"
"pthread_mutexattr_init","pthread.h","int","FAR pthread_mutexattr_t*"
"pthread_mutexattr_setpshared","pthread.h","int","FAR pthread_mutexattr_t*","int"
"pthread_mutexattr_settype","pthread.h","int","pthread_mutexattr_t*","int"
"pthread_once","pthread.h","int","FAR pthread_once_t*","CODE void (*)(void)"
"pthread_setcancelstate","pthread.h","int","int","FAR int*"
"pthread_setschedparam","pthread.h","int","pthread_t","int","FAR const struct sched_param*"
@ -128,9 +104,6 @@
"seekdir","dirent.h","void","FAR DIR*","off_t"
"select","sys/select.h","int","int","FAR fd_set*","FAR fd_set*","FAR fd_set*","FAR struct timeval*"
"sem_close","semaphore.h","int","FAR sem_t*"
"sem_destroy","semaphore.h","int","FAR sem_t*"
"sem_getvalue","semaphore.h","int","FAR sem_t*","FAR int*"
"sem_init","semaphore.h","int","FAR sem_t*","int","unsigned int value"
"sem_open","semaphore.h","FAR sem_t*","FAR const char*","int","..."
"sem_post","semaphore.h","int","FAR sem_t*"
"sem_trywait","semaphore.h","int","FAR sem_t*"

Can't render this file because it has a wrong number of fields in line 2.

48
tools/Makefile.host Normal file
View File

@ -0,0 +1,48 @@
############################################################################
# Makefile.host
#
# Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
all: mkconfig mksyscall
default: mkconfig mksyscall
CFLAGS = -O2 -Wall
mkconfig: mkconfig.c
@gcc $(CFLAGS) -o mkconfig mkconfig.c
mksyscall: mksyscall.c
@gcc $(CFLAGS) -o mksyscall mksyscall.c
clean:
@rm -f mkconfig mksyscall mkconfig.exe mksyscall.exe *~