mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-20 07:33:34 +08:00
Fix STM32 F2/F4 SDIO clocking; Clean-up files in sched/ directory
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4940 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
@@ -80,7 +80,7 @@
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Function: atexit
|
||||
* Name: atexit
|
||||
*
|
||||
* Description:
|
||||
* Registers a function to be called at program exit.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* clock_abstime2ticks.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -69,7 +69,7 @@
|
||||
********************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
* Function: clock_abstime2ticks
|
||||
* Name: clock_abstime2ticks
|
||||
*
|
||||
* Description:
|
||||
* Convert an absolute timespec delay to system timer ticks.
|
||||
@@ -95,8 +95,8 @@ int clock_abstime2ticks(clockid_t clockid, FAR const struct timespec *abstime,
|
||||
struct timespec reltime;
|
||||
int ret;
|
||||
|
||||
/* Convert the timespec to clock ticks. NOTE: Here we use
|
||||
* internal knowledge that CLOCK_REALTIME is defined to be zero!
|
||||
/* Convert the timespec to clock ticks. NOTE: Here we use internal knowledge
|
||||
* that CLOCK_REALTIME is defined to be zero!
|
||||
*/
|
||||
|
||||
ret = clock_gettime(clockid, &currtime);
|
||||
@@ -105,15 +105,13 @@ int clock_abstime2ticks(clockid_t clockid, FAR const struct timespec *abstime,
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
/* The relative time to wait is the absolute time minus the
|
||||
* current time.
|
||||
*/
|
||||
/* The relative time to wait is the absolute time minus the current time. */
|
||||
|
||||
reltime.tv_nsec = (abstime->tv_nsec - currtime.tv_nsec);
|
||||
reltime.tv_sec = (abstime->tv_sec - currtime.tv_sec);
|
||||
|
||||
/* Check if we were supposed to borrow from the seconds to
|
||||
* borrow from the seconds
|
||||
/* Check if we were supposed to borrow from the seconds to borrow from the
|
||||
* seconds
|
||||
*/
|
||||
|
||||
if (reltime.tv_nsec < 0)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/clock_getres.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -79,7 +79,7 @@
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Function: clock_getres
|
||||
* Name: clock_getres
|
||||
*
|
||||
* Description:
|
||||
* Clock Functions based on POSIX APIs
|
||||
@@ -98,7 +98,7 @@ int clock_getres(clockid_t clock_id, struct timespec *res)
|
||||
if (clock_id != CLOCK_REALTIME)
|
||||
{
|
||||
sdbg("Returning ERROR\n");
|
||||
*get_errno_ptr() = EINVAL;
|
||||
set_errno(EINVAL);
|
||||
ret = ERROR;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Function: clock_gettime
|
||||
* Name: clock_gettime
|
||||
*
|
||||
* Description:
|
||||
* Clock Functions based on POSIX APIs
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/clock_gettimeofday.c
|
||||
*
|
||||
* Copyright (C) 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -38,10 +38,11 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include "clock_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
@@ -77,7 +78,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: gettimeofday
|
||||
* Name: gettimeofday
|
||||
*
|
||||
* Description:
|
||||
* Get the current time
|
||||
@@ -107,5 +108,6 @@ int gettimeofday(struct timeval *tp, void *tzp)
|
||||
tp->tv_sec = ts.tv_sec;
|
||||
tp->tv_usec = ts.tv_nsec / NSEC_PER_USEC;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ struct timespec g_basetime;
|
||||
**************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: clock_basetime
|
||||
* Name: clock_basetime
|
||||
*
|
||||
* Description:
|
||||
* Get the initial time value from the best source available.
|
||||
@@ -170,7 +170,7 @@ static inline void clock_basetime(FAR struct timespec *tp)
|
||||
#endif /* CONFIG_RTC */
|
||||
|
||||
/****************************************************************************
|
||||
* Function: clock_inittime
|
||||
* Name: clock_inittime
|
||||
*
|
||||
* Description:
|
||||
* Get the initial time value from the best source available.
|
||||
@@ -191,7 +191,7 @@ static void clock_inittime(void)
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: clock_initialize
|
||||
* Name: clock_initialize
|
||||
*
|
||||
* Description:
|
||||
* Perform one-time initialization of the timing facilities.
|
||||
@@ -212,7 +212,7 @@ void clock_initialize(void)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Function: clock_synchronize
|
||||
* Name: clock_synchronize
|
||||
*
|
||||
* Description:
|
||||
* Synchronize the system timer to a hardware RTC. This operation is
|
||||
@@ -253,12 +253,12 @@ void clock_synchronize(void)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Function: clock_timer
|
||||
* Name: clock_timer
|
||||
*
|
||||
* Description:
|
||||
* This function must be called once every time the real
|
||||
* time clock interrupt occurs. The interval of this
|
||||
* clock interrupt must be MSEC_PER_TICK
|
||||
* This function must be called once every time the real time clock
|
||||
* interrupt occurs. The interval of this clock interrupt must be
|
||||
* MSEC_PER_TICK
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/********************************************************************************
|
||||
* clock_internal.h
|
||||
* sched/clock_internal.h
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -33,8 +33,8 @@
|
||||
*
|
||||
********************************************************************************/
|
||||
|
||||
#ifndef __CLOCK_INTERNAL_H
|
||||
#define __CLOCK_INTERNAL_H
|
||||
#ifndef __SCHED_CLOCK_INTERNAL_H
|
||||
#define __SCHED_CLOCK_INTERNAL_H
|
||||
|
||||
/********************************************************************************
|
||||
* Included Files
|
||||
@@ -79,13 +79,13 @@ extern struct timespec g_basetime;
|
||||
* Public Function Prototypes
|
||||
********************************************************************************/
|
||||
|
||||
extern void weak_function clock_initialize(void);
|
||||
extern void weak_function clock_timer(void);
|
||||
void weak_function clock_initialize(void);
|
||||
void weak_function clock_timer(void);
|
||||
|
||||
extern int clock_abstime2ticks(clockid_t clockid,
|
||||
FAR const struct timespec *abstime,
|
||||
FAR int *ticks);
|
||||
extern int clock_time2ticks(FAR const struct timespec *reltime, FAR int *ticks);
|
||||
extern int clock_ticks2time(int ticks, FAR struct timespec *reltime);
|
||||
int clock_abstime2ticks(clockid_t clockid,
|
||||
FAR const struct timespec *abstime,
|
||||
FAR int *ticks);
|
||||
int clock_time2ticks(FAR const struct timespec *reltime, FAR int *ticks);
|
||||
int clock_ticks2time(int ticks, FAR struct timespec *reltime);
|
||||
|
||||
#endif /* __CLOCK_INTERNAL_H */
|
||||
#endif /* __SCHED_CLOCK_INTERNAL_H */
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Function: clock_settime
|
||||
* Name: clock_settime
|
||||
*
|
||||
* Description:
|
||||
* Clock Functions based on POSIX APIs
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/clock_systimer.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -58,7 +58,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: clock_systimer
|
||||
* Name: clock_systimer
|
||||
*
|
||||
* Description:
|
||||
* Return the current value of the 32-bit system timer counter
|
||||
@@ -85,7 +85,7 @@ uint32_t clock_systimer(void)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Function: clock_systimer64
|
||||
* Name: clock_systimer64
|
||||
*
|
||||
* Description:
|
||||
* Return the current value of the 64-bit system timer counter
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* clock_ticks2time.c
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -67,7 +67,7 @@
|
||||
********************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
* Function: clock_ticks2time
|
||||
* Name: clock_ticks2time
|
||||
*
|
||||
* Description:
|
||||
* Convert the system time tick value to a relative time.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/clock_time2ticks.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -69,7 +69,7 @@
|
||||
********************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
* Function: clock_time2ticks
|
||||
* Name: clock_time2ticks
|
||||
*
|
||||
* Description:
|
||||
* Convert a timespec delay to system timer ticks. This function is suitable
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/env_clearenv.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -55,7 +55,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: clearenv
|
||||
* Name: clearenv
|
||||
*
|
||||
* Description:
|
||||
* The clearenv() function clears the environment of all name-value pairs
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/env_dup.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -60,7 +60,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: env_dup
|
||||
* Name: env_dup
|
||||
*
|
||||
* Description:
|
||||
* Copy the internal environment structure of a task. This is the action
|
||||
@@ -122,6 +122,7 @@ int env_dup(FAR _TCB *ptcb)
|
||||
ptcb->envp = envp;
|
||||
sched_unlock();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* eched/env_dupenv.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -57,7 +57,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: dupenv
|
||||
* Name: dupenv
|
||||
*
|
||||
* Description:
|
||||
* Copy the internal environment structure of a task. This is the action
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/env_findvar.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -54,7 +54,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: env_cmpname
|
||||
* Name: env_cmpname
|
||||
****************************************************************************/
|
||||
|
||||
static bool env_cmpname(const char *pszname, const char *peqname)
|
||||
@@ -69,6 +69,7 @@ static bool env_cmpname(const char *pszname, const char *peqname)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -77,7 +78,7 @@ static bool env_cmpname(const char *pszname, const char *peqname)
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: env_findvar
|
||||
* Name: env_findvar
|
||||
*
|
||||
* Description:
|
||||
* Search the provided environment structure for the variable of the
|
||||
@@ -109,7 +110,9 @@ FAR char *env_findvar(environ_t *envp, const char *pname)
|
||||
|
||||
/* Search for a name=value string with matching name */
|
||||
|
||||
for (ptr = envp->ev_env; ptr < end && !env_cmpname( pname, ptr); ptr += (strlen(ptr) + 1));
|
||||
for (ptr = envp->ev_env;
|
||||
ptr < end && !env_cmpname( pname, ptr);
|
||||
ptr += (strlen(ptr) + 1));
|
||||
|
||||
/* Check for success */
|
||||
|
||||
@@ -118,6 +121,7 @@ FAR char *env_findvar(environ_t *envp, const char *pname)
|
||||
ret = ptr;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* env_getenv.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -58,7 +58,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: getenv
|
||||
* Name: getenv
|
||||
*
|
||||
* Description:
|
||||
* The getenv() function searches the environment list for a string that
|
||||
@@ -91,7 +91,6 @@ FAR char *getenv(const char *name)
|
||||
goto errout;
|
||||
}
|
||||
|
||||
|
||||
/* Get a reference to the thread-private environ in the TCB.*/
|
||||
|
||||
sched_lock();
|
||||
@@ -126,7 +125,7 @@ FAR char *getenv(const char *name)
|
||||
errout_with_lock:
|
||||
sched_unlock();
|
||||
errout:
|
||||
*get_errno_ptr() = ret;
|
||||
set_errno(ret);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* env_getenvironptr.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -56,7 +56,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: get_environ_ptr
|
||||
* Name: get_environ_ptr
|
||||
*
|
||||
* Description:
|
||||
* Return a pointer to the thread specific environ variable.
|
||||
@@ -75,9 +75,9 @@ FAR char **get_environ_ptr( void )
|
||||
{
|
||||
#if 1
|
||||
|
||||
/* Type of internal representation of environment is incompatible with
|
||||
* char ** return value.
|
||||
*/
|
||||
/* Type of internal representation of environment is incompatible with
|
||||
* char ** return value.
|
||||
*/
|
||||
|
||||
return NULL;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/env_internal.h
|
||||
*
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/env_putenv.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -57,7 +57,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: putenv
|
||||
* Name: putenv
|
||||
*
|
||||
* Description:
|
||||
* The putenv() function adds or changes the value of environment variables.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/env_clearenv.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -55,12 +55,12 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: env_release
|
||||
* Name: env_release
|
||||
*
|
||||
* Description:
|
||||
* The env_release() function clears the environment of all name-value pairs
|
||||
* and sets the value of the external variable environ to NULL.
|
||||
|
||||
* The env_release() function clears the environment of all name-value
|
||||
* pairs and sets the value of the external variable environ to NULL.
|
||||
*
|
||||
* Parameters:
|
||||
* ptcb Identifies the TCB containing the environment structure
|
||||
*
|
||||
@@ -75,6 +75,7 @@
|
||||
int env_release(FAR _TCB *ptcb)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
if (!ptcb)
|
||||
{
|
||||
ret = -EINVAL;
|
||||
@@ -111,8 +112,10 @@ int env_release(FAR _TCB *ptcb)
|
||||
|
||||
ptcb->envp = NULL;
|
||||
}
|
||||
|
||||
sched_unlock();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/env_removevar.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -53,7 +53,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: env_removevar
|
||||
* Name: env_removevar
|
||||
*
|
||||
* Description:
|
||||
* Remove the referenced name=value pair from the environment
|
||||
@@ -109,6 +109,7 @@ int env_removevar(environ_t *envp, char *pvar)
|
||||
ret = OK;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/env_setenv.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -61,7 +61,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: setenv
|
||||
* Name: setenv
|
||||
*
|
||||
* Description:
|
||||
* The setenv() function adds the variable name to the environment with the
|
||||
@@ -148,8 +148,8 @@ int setenv(const char *name, const char *value, int overwrite)
|
||||
}
|
||||
|
||||
/* Get the size of the new name=value string. The +2 is for the '=' and for
|
||||
* null terminator
|
||||
*/
|
||||
* null terminator
|
||||
*/
|
||||
|
||||
varlen = strlen(name) + strlen(value) + 2;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/env_share.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -43,6 +43,7 @@
|
||||
|
||||
#include <sched.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "os_internal.h"
|
||||
#include "env_internal.h"
|
||||
|
||||
@@ -55,7 +56,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: env_share
|
||||
* Name: env_share
|
||||
*
|
||||
* Description:
|
||||
* Increment the reference count on the internal environment structure of
|
||||
@@ -106,6 +107,7 @@ int env_share(FAR _TCB *ptcb)
|
||||
ptcb->envp = envp;
|
||||
sched_unlock();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/env_unsetenv.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -59,7 +59,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: unsetenv
|
||||
* Name: unsetenv
|
||||
*
|
||||
* Description:
|
||||
* The unsetenv() function deletes the variable name from the environment.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/errno_get.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -58,7 +58,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: get_errno
|
||||
* Name: get_errno
|
||||
*
|
||||
* Description:
|
||||
* Return the value of the thread specific errno. This function is only
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/errno_getptr.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -61,7 +61,7 @@ static int g_irqerrno;
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: get_errno_ptr
|
||||
* Name: get_errno_ptr
|
||||
*
|
||||
* Description:
|
||||
* Return a pointer to the thread specific errno.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/errno_set.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -58,7 +58,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: set_errno
|
||||
* Name: set_errno
|
||||
*
|
||||
* Description:
|
||||
* Set the value of the thread specific errno. This function is only
|
||||
|
||||
+3
-1
@@ -43,7 +43,9 @@
|
||||
#include <unistd.h>
|
||||
#include <debug.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
|
||||
#include "os_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
@@ -75,7 +77,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: exit
|
||||
* Name: exit
|
||||
*
|
||||
* Description:
|
||||
* The exit() function causes normal process termination and the value of
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/getpid.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <sched.h>
|
||||
|
||||
#include "os_internal.h"
|
||||
|
||||
/************************************************************************
|
||||
@@ -76,9 +77,9 @@
|
||||
|
||||
pid_t getpid(void)
|
||||
{
|
||||
/* Return the task ID from the TCB at the head of the
|
||||
* ready-to-run task list
|
||||
*/
|
||||
/* Return the task ID from the TCB at the head of the
|
||||
* ready-to-run task list
|
||||
*/
|
||||
|
||||
return ((FAR _TCB*)g_readytorun.head)->pid;
|
||||
return ((FAR _TCB*)g_readytorun.head)->pid;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,9 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include "irq_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
@@ -69,8 +71,8 @@
|
||||
* Name: irq_attach
|
||||
*
|
||||
* Description:
|
||||
* Configure the IRQ subsystem so that IRQ number 'irq'
|
||||
* is dispatched to 'isr'
|
||||
* Configure the IRQ subsystem so that IRQ number 'irq' is dispatched to
|
||||
* 'isr'
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -123,5 +125,3 @@ int irq_attach(int irq, xcpt_t isr)
|
||||
return OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/irq_dispatch.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -73,9 +73,9 @@
|
||||
* Name: irq_dispatch
|
||||
*
|
||||
* Description:
|
||||
* This function must be called from the achitecture-
|
||||
* specific logic in order to dispaly an interrupt to
|
||||
* the appropriate, registered handling logic.
|
||||
* This function must be called from the achitecture-specific logic in
|
||||
* order to dispatch an interrupt to the appropriate, registered handling
|
||||
* logic.
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/irq_initialize.c
|
||||
*
|
||||
* Copyright (C) 2007-2008, 2010 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include "irq_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
@@ -69,7 +70,7 @@ FAR xcpt_t g_irqvector[NR_IRQS+1];
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: irq_initialize
|
||||
* Name: irq_initialize
|
||||
*
|
||||
* Description:
|
||||
* Configure the IRQ subsystem
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/irq_internal.h
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -33,8 +33,8 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __IRQ_INTERNAL_H
|
||||
#define __IRQ_INTERNAL_H
|
||||
#ifndef __SCHED_IRQ_INTERNAL_H
|
||||
#define __SCHED_IRQ_INTERNAL_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
@@ -79,5 +79,5 @@ EXTERN int irq_unexpected_isr(int irq, FAR void *context);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __IRQ_INTERNAL_H */
|
||||
#endif /* __SCHED_IRQ_INTERNAL_H */
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/irq_unexpectedisr.c
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -38,8 +38,11 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include "os_internal.h"
|
||||
#include "irq_internal.h"
|
||||
|
||||
@@ -68,11 +71,11 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: irq_unexpected_isr
|
||||
* Name: irq_unexpected_isr
|
||||
*
|
||||
* Description:
|
||||
* An interrupt has been received for an IRQ that was
|
||||
* never registered with the system.
|
||||
* An interrupt has been received for an IRQ that was never registered
|
||||
* with the system.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/kmm_addregion.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -84,7 +84,7 @@ typedef void (*kmaddregion_t)(FAR void*, size_t);
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Function: kmm_addregion
|
||||
* Name: kmm_addregion
|
||||
*
|
||||
* Description:
|
||||
* This is a simple redirection to the user-space mm_addregion()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/kmm_initialize.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -84,7 +84,7 @@ typedef void (*kminitialize_t)(FAR void*, size_t);
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Function: kmm_initialize
|
||||
* Name: kmm_initialize
|
||||
*
|
||||
* Description:
|
||||
* This is a simple redirection to the user-space mm_initialize()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/kmm_kfree.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -84,7 +84,7 @@ typedef void (*kfree_t)(FAR void *);
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Function: kfree
|
||||
* Name: kfree
|
||||
*
|
||||
* Description:
|
||||
* This is a simple redirection to the user-space free() function.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/kmm_kmalloc.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -84,7 +84,7 @@ typedef FAR void *(*kmalloc_t)(size_t);
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Function: kmalloc
|
||||
* Name: kmalloc
|
||||
*
|
||||
* Description:
|
||||
* This is a simple redirection to the user-space malloc() function.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/kmm_krealloc.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -84,7 +84,7 @@ typedef FAR void *(*krealloc_t)(FAR void*, size_t);
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Function: krealloc
|
||||
* Name: krealloc
|
||||
*
|
||||
* Description:
|
||||
* This is a simple redirection to the user-space realloc() function.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/kmm_kzalloc.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -84,7 +84,7 @@ typedef FAR void *(*kzalloc_t)(size_t);
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Function: kzalloc
|
||||
* Name: kzalloc
|
||||
*
|
||||
* Description:
|
||||
* This is a simple redirection to the user-space zalloc() function.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/kmm_semaphore.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -86,7 +86,7 @@ typedef void (*kmgivesemaphore_t)(void);
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Function: kmm_trysemaphore
|
||||
* Name: kmm_trysemaphore
|
||||
*
|
||||
* Description:
|
||||
* This is a simple redirection to the user-space mm_trysemaphore()
|
||||
@@ -112,7 +112,7 @@ int kmm_trysemaphore(void)
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function: kmm_givesemaphore
|
||||
* Name: kmm_givesemaphore
|
||||
*
|
||||
* Description:
|
||||
* This is a simple redirection to the user-space mm_givesemaphore()
|
||||
|
||||
+36
-38
@@ -1,8 +1,8 @@
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* sched/mq_close.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -31,71 +31,69 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <mqueue.h>
|
||||
#include <sched.h>
|
||||
|
||||
#include "os_internal.h"
|
||||
#include "mq_internal.h"
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Global Variables
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Function: mq_desfree
|
||||
/****************************************************************************
|
||||
* Name: mq_desfree
|
||||
*
|
||||
* Description:
|
||||
* Deallocate a message queue descriptor but returning it
|
||||
* to the free liest
|
||||
* Deallocate a message queue descriptor but returning it to the free list
|
||||
*
|
||||
* Inputs:
|
||||
* mqdes - message queue descriptor to free
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#define mq_desfree(mqdes) sq_addlast((FAR sq_entry_t*)mqdes, &g_desfree)
|
||||
|
||||
/************************************************************
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Function: mq_close
|
||||
/****************************************************************************
|
||||
* Name: mq_close
|
||||
*
|
||||
* Description:
|
||||
* This function is used to indicate that the calling task
|
||||
* is finished with the specified message queued mqdes.
|
||||
* The mq_close() deallocates any system resources
|
||||
* allocated by the system for use by this task for its
|
||||
* message queue.
|
||||
* This function is used to indicate that the calling task is finished
|
||||
* with the specified message queued mqdes. The mq_close() deallocates
|
||||
* any system resources allocated by the system for use by this task for
|
||||
* its message queue.
|
||||
*
|
||||
* If the calling task has attached a notification to the
|
||||
* message queue via this mqdes, this attachment will be
|
||||
* removed and the message queue is available for another
|
||||
* process to attach a notification.
|
||||
* If the calling task has attached a notification to the message queue
|
||||
* via this mqdes, this attachment will be removed and the message queue
|
||||
* is available for another process to attach a notification.
|
||||
*
|
||||
* Parameters:
|
||||
* mqdes - Message queue descriptor.
|
||||
@@ -105,12 +103,12 @@
|
||||
* otherwise, -1 (ERROR).
|
||||
*
|
||||
* Assumptions:
|
||||
* - The behavior of a task that is blocked on either a mq_send()
|
||||
* or mq_receive is undefined when mq_close() is called.
|
||||
* - The results of using this message queue descriptor after a
|
||||
* a successful return from mq_close() is undefined.
|
||||
* - The behavior of a task that is blocked on either a mq_send() or
|
||||
* mq_receive() is undefined when mq_close() is called.
|
||||
* - The results of using this message queue descriptor after a successful
|
||||
* return from mq_close() is undefined.
|
||||
*
|
||||
************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
int mq_close(mqd_t mqdes)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/mq_descreate.c
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -39,19 +39,21 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdarg.h> /* va_list */
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <mqueue.h>
|
||||
#include <sched.h>
|
||||
#include <queue.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
|
||||
#include "os_internal.h"
|
||||
#include "sig_internal.h"
|
||||
|
||||
#include <queue.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
#include "mq_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
@@ -75,7 +77,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: mq_desalloc
|
||||
* Name: mq_desalloc
|
||||
*
|
||||
* Description:
|
||||
* Allocate a message queue descriptor.
|
||||
@@ -117,7 +119,7 @@ static mqd_t mq_desalloc(void)
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: mq_descreate
|
||||
* Name: mq_descreate
|
||||
*
|
||||
* Description:
|
||||
* Create a message queue descriptor for the specified TCB
|
||||
@@ -128,7 +130,8 @@ static mqd_t mq_desalloc(void)
|
||||
* oflags - access rights for the descriptor
|
||||
*
|
||||
* Return Value:
|
||||
*
|
||||
* On success, the message queue descriptor is returned. NULL is returned
|
||||
* on a failure to allocate.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/mq_findnamed.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "mq_internal.h"
|
||||
|
||||
/************************************************************************
|
||||
@@ -67,18 +68,18 @@
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Function: mq_findnamed
|
||||
* Name: mq_findnamed
|
||||
*
|
||||
* Description:
|
||||
* This function finds the named message queue with the
|
||||
* specified name in the list of message queues.
|
||||
* This function finds the named message queue with the specified name
|
||||
* in the list of message queues.
|
||||
*
|
||||
* Inputs:
|
||||
* mq_name - the name of the message queue to find
|
||||
*
|
||||
* Return Value:
|
||||
* A reference to the matching named message queue
|
||||
* structure (or NULL if none was found).
|
||||
* A reference to the matching named message queue structure (or NULL
|
||||
* if none was found).
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
|
||||
+24
-30
@@ -2,7 +2,7 @@
|
||||
* sched/mq_initialize.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -53,9 +53,7 @@
|
||||
* Private Type Declarations
|
||||
************************************************************************/
|
||||
|
||||
/* This is a container for a list of message queue
|
||||
* descriptors.
|
||||
*/
|
||||
/* This is a container for a list of message queue descriptors. */
|
||||
|
||||
struct mq_des_block_s
|
||||
{
|
||||
@@ -71,22 +69,22 @@ struct mq_des_block_s
|
||||
|
||||
sq_queue_t g_msgqueues;
|
||||
|
||||
/* The g_msgfree is a list of messages that are available
|
||||
* for general use. The number of messages in this list is a
|
||||
* system configuration item.
|
||||
/* The g_msgfree is a list of messages that are available for general
|
||||
* use. The number of messages in this list is a system configuration
|
||||
* item.
|
||||
*/
|
||||
|
||||
sq_queue_t g_msgfree;
|
||||
|
||||
/* The g_msgfreeInt is a list of messages that are reserved
|
||||
* for use by interrupt handlers.
|
||||
/* The g_msgfreeInt is a list of messages that are reserved for use by
|
||||
* interrupt handlers.
|
||||
*/
|
||||
|
||||
sq_queue_t g_msgfreeirq;
|
||||
|
||||
/* The g_desfree data structure is a list of message
|
||||
* descriptors available to the operating system for general use.
|
||||
* The number of messages in the pool is a constant.
|
||||
/* The g_desfree data structure is a list of message descriptors available
|
||||
* to the operating system for general use. The number of messages in the
|
||||
* pool is a constant.
|
||||
*/
|
||||
|
||||
sq_queue_t g_desfree;
|
||||
@@ -95,21 +93,19 @@ sq_queue_t g_desfree;
|
||||
* Private Variables
|
||||
************************************************************************/
|
||||
|
||||
/* g_msgalloc is a pointer to the start of the allocated
|
||||
* block of messages.
|
||||
/* g_msgalloc is a pointer to the start of the allocated block of
|
||||
* messages.
|
||||
*/
|
||||
|
||||
static mqmsg_t *g_msgalloc;
|
||||
|
||||
/* g_msgfreeirqalloc is a pointer to the start of the
|
||||
* allocated block of messages.
|
||||
/* g_msgfreeirqalloc is a pointer to the start of the allocated block of
|
||||
* messages.
|
||||
*/
|
||||
|
||||
static mqmsg_t *g_msgfreeirqalloc;
|
||||
|
||||
/* g_desalloc is a list of allocated block of message queue
|
||||
* descriptors.
|
||||
*/
|
||||
/* g_desalloc is a list of allocated block of message queue descriptors. */
|
||||
|
||||
static sq_queue_t g_desalloc;
|
||||
|
||||
@@ -118,15 +114,14 @@ static sq_queue_t g_desalloc;
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Function: mq_msgblockalloc
|
||||
* Name: mq_msgblockalloc
|
||||
*
|
||||
* Description:
|
||||
* Allocate a block of messages and place them on the free
|
||||
* list.
|
||||
* Allocate a block of messages and place them on the free list.
|
||||
*
|
||||
*
|
||||
* Inputs:
|
||||
* Inputs Parameters:
|
||||
* queue
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
static mqmsg_t *mq_msgblockalloc(sq_queue_t *queue, uint16_t nmsgs,
|
||||
@@ -159,13 +154,12 @@ static mqmsg_t *mq_msgblockalloc(sq_queue_t *queue, uint16_t nmsgs,
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Function: mq_initialize
|
||||
* Name: mq_initialize
|
||||
*
|
||||
* Description:
|
||||
* This function initializes the messasge system. This
|
||||
* function must be called early in the initialization
|
||||
* sequence before any of the other message interfaces
|
||||
* execute.
|
||||
* This function initializes the messasge system. This function must
|
||||
* be called early in the initialization sequence before any of the
|
||||
* other message interfaces execute.
|
||||
*
|
||||
* Inputs:
|
||||
* None
|
||||
@@ -207,7 +201,7 @@ void mq_initialize(void)
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function: mq_desblockalloc
|
||||
* Name: mq_desblockalloc
|
||||
*
|
||||
* Description:
|
||||
* Allocate a block of message descriptors and place them on the free
|
||||
|
||||
+14
-13
@@ -2,7 +2,7 @@
|
||||
* sched/mq_internal.h
|
||||
*
|
||||
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -63,14 +63,14 @@
|
||||
#define MQ_MAX_MSGS 16
|
||||
#define MQ_PRIO_MAX _POSIX_MQ_PRIO_MAX
|
||||
|
||||
/* This defines the number of messages descriptors to allocate
|
||||
* at each "gulp."
|
||||
/* This defines the number of messages descriptors to allocate at each
|
||||
* "gulp."
|
||||
*/
|
||||
|
||||
#define NUM_MSG_DESCRIPTORS 24
|
||||
|
||||
/* This defines the number of messages to set aside for
|
||||
* exclusive use by interrupt handlers
|
||||
/* This defines the number of messages to set aside for exclusive use by
|
||||
* interrupt handlers
|
||||
*/
|
||||
|
||||
#define NUM_INTERRUPT_MSGS 8
|
||||
@@ -85,6 +85,7 @@ enum mqalloc_e
|
||||
MQ_ALLOC_DYN, /* dynamically allocated; free when unused */
|
||||
MQ_ALLOC_IRQ /* Preallocated, reserved for interrupt handling */
|
||||
};
|
||||
|
||||
typedef enum mqalloc_e mqalloc_t;
|
||||
|
||||
/* This structure describes one buffered POSIX message. */
|
||||
@@ -101,6 +102,7 @@ struct mqmsg
|
||||
#endif
|
||||
uint8_t mail[MQ_MAX_BYTES]; /* Message data */
|
||||
};
|
||||
|
||||
typedef struct mqmsg mqmsg_t;
|
||||
|
||||
/****************************************************************************
|
||||
@@ -111,22 +113,21 @@ typedef struct mqmsg mqmsg_t;
|
||||
|
||||
extern sq_queue_t g_msgqueues;
|
||||
|
||||
/* The g_msgfree is a list of messages that are available
|
||||
* for general use. The number of messages in this list is a
|
||||
* system configuration item.
|
||||
/* The g_msgfree is a list of messages that are available for general use.
|
||||
* The number of messages in this list is a system configuration item.
|
||||
*/
|
||||
|
||||
extern sq_queue_t g_msgfree;
|
||||
|
||||
/* The g_msgfreeInt is a list of messages that are reserved
|
||||
* for use by interrupt handlers.
|
||||
/* The g_msgfreeInt is a list of messages that are reserved for use by
|
||||
* interrupt handlers.
|
||||
*/
|
||||
|
||||
extern sq_queue_t g_msgfreeirq;
|
||||
|
||||
/* The g_desfree data structure is a list of message
|
||||
* descriptors available to the operating system for general use.
|
||||
* The number of messages in the pool is a constant.
|
||||
/* The g_desfree data structure is a list of message descriptors available
|
||||
* to the operating system for general use. The number of messages in the
|
||||
* pool is a constant.
|
||||
*/
|
||||
|
||||
extern sq_queue_t g_desfree;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/mq_msgfree.c
|
||||
*
|
||||
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -69,13 +69,12 @@
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Function: mq_msgfree
|
||||
* Name: mq_msgfree
|
||||
*
|
||||
* Description:
|
||||
* The mq_msgfree function will return a message to the
|
||||
* free pool of messages if it was a pre-allocated message.
|
||||
* If the message was allocated dynamically it will be
|
||||
* deallocated.
|
||||
* The mq_msgfree function will return a message to the free pool of
|
||||
* messages if it was a pre-allocated message. If the message was
|
||||
* allocated dynamically it will be deallocated.
|
||||
*
|
||||
* Inputs:
|
||||
* mqmsg - message to free
|
||||
@@ -128,7 +127,6 @@ void mq_msgfree(FAR mqmsg_t *mqmsg)
|
||||
{
|
||||
sched_free(mqmsg);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
PANIC(OSERR_BADMSGTYPE);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/mq_msgqfree.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -68,7 +68,7 @@
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Function: mq_msgqfree
|
||||
* Name: mq_msgqfree
|
||||
*
|
||||
* Description:
|
||||
* This function deallocates an initialized message queue
|
||||
|
||||
+11
-12
@@ -72,22 +72,21 @@
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Function: mq_notify
|
||||
* Name: mq_notify
|
||||
*
|
||||
* Description:
|
||||
* If "notification" is not NULL, this function connects
|
||||
* the task with the message queue such that the specified
|
||||
* signal will be sent to the task whenever the message
|
||||
* changes from empty to non-empty. One one notification
|
||||
* can be attached to a message queue.
|
||||
* If "notification" is not NULL, this function connects the task with
|
||||
* the message queue such that the specified signal will be sent to the
|
||||
* task whenever the message changes from empty to non-empty. Only one
|
||||
* notification can be attached to a message queue.
|
||||
*
|
||||
* If "notification" is NULL, the attached notification is
|
||||
* detached (if it was held by the calling task) and the
|
||||
* queue is available to attach another notification.
|
||||
* If "notification" is NULL, the attached notification is detached (if
|
||||
* it was held by the calling task) and the queue is available to attach
|
||||
* another notification.
|
||||
*
|
||||
* When the notification is sent to the registered process,
|
||||
* its registration will be removed. The message queue
|
||||
* will then be available for registration.
|
||||
* When the notification is sent to the registered process, its
|
||||
* registration will be removed. The message queue will then be
|
||||
* available for registration.
|
||||
*
|
||||
* Parameters:
|
||||
* mqdes - Message queue descriptor
|
||||
|
||||
+11
-10
@@ -2,7 +2,7 @@
|
||||
* sched/mq_open.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -79,21 +79,21 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: mq_open
|
||||
* Name: mq_open
|
||||
*
|
||||
* Description:
|
||||
* This function establish a connection between a named
|
||||
* message queue and the calling task. After a successful
|
||||
* call of mq_open(), the task can reference the message
|
||||
* queue using the address returned by the call. The
|
||||
* message queue remains usable until it is closed by a
|
||||
* successful call to mq_close().
|
||||
* This function establish a connection between a named message queue and
|
||||
* the calling task. After a successful call of mq_open(), the task can
|
||||
* reference the message queue using the address returned by the call. The
|
||||
* message queue remains usable until it is closed by a successful call to
|
||||
* mq_close().
|
||||
*
|
||||
* Parameters:
|
||||
* mq_name - Name of the queue to open
|
||||
* oflags - open flags
|
||||
* Optional parameters. When the O_CREAT flag is
|
||||
* specified, two optional parameters are expected:
|
||||
* Optional parameters. When the O_CREAT flag is specified, two optional
|
||||
* parameters are expected:
|
||||
*
|
||||
* 1. mode_t mode (ignored), and
|
||||
* 2. struct mq_attr *attr. The mq_maxmsg attribute
|
||||
* is used at the time that the message queue is
|
||||
@@ -221,6 +221,7 @@ mqd_t mq_open(const char *mq_name, int oflags, ...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sched_unlock();
|
||||
}
|
||||
|
||||
|
||||
@@ -81,9 +81,9 @@
|
||||
* Name: mq_verifyreceive
|
||||
*
|
||||
* Description:
|
||||
* This is internal, common logic shared by both mq_receive
|
||||
* and mq_timedreceive. This function verifies the
|
||||
* input parameters that are common to both functions.
|
||||
* This is internal, common logic shared by both mq_receive and
|
||||
* mq_timedreceive. This function verifies the input parameters that are
|
||||
* common to both functions.
|
||||
*
|
||||
* Parameters:
|
||||
* mqdes - Message Queue Descriptor
|
||||
@@ -91,12 +91,12 @@
|
||||
* msglen - Size of the buffer in bytes
|
||||
*
|
||||
* Return Value:
|
||||
* One success, 0 (OK) is returned. On failure, -1 (ERROR) is
|
||||
* returned and the errno is set appropriately:
|
||||
* One success, 0 (OK) is returned. On failure, -1 (ERROR) is returned and
|
||||
* the errno is set appropriately:
|
||||
*
|
||||
* EPERM Message queue opened not opened for reading.
|
||||
* EMSGSIZE 'msglen' was less than the maxmsgsize attribute of the
|
||||
* message queue.
|
||||
* EMSGSIZE 'msglen' was less than the maxmsgsize attribute of the message
|
||||
* queue.
|
||||
* EINVAL Invalid 'msg' or 'mqdes'
|
||||
*
|
||||
* Assumptions:
|
||||
@@ -129,30 +129,28 @@ int mq_verifyreceive(mqd_t mqdes, void *msg, size_t msglen)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Function: mq_waitreceive
|
||||
* Name: mq_waitreceive
|
||||
*
|
||||
* Description:
|
||||
* This is internal, common logic shared by both mq_receive
|
||||
* and mq_timedreceive. This function waits for a message to
|
||||
* be received on the specified message queue, removes the
|
||||
* message from the queue, and returns it.
|
||||
* This is internal, common logic shared by both mq_receive and
|
||||
* mq_timedreceive. This function waits for a message to be received on
|
||||
* the specified message queue, removes the message from the queue, and
|
||||
* returns it.
|
||||
*
|
||||
* Parameters:
|
||||
* mqdes - Message queue descriptor
|
||||
*
|
||||
* Return Value:
|
||||
* On success, a reference to the received message. If the
|
||||
* wait was interrupted by a signal or a timeout, then the
|
||||
* errno will be set appropriately and NULL will be returned.
|
||||
* On success, a reference to the received message. If the wait was
|
||||
* interrupted by a signal or a timeout, then the errno will be set
|
||||
* appropriately and NULL will be returned.
|
||||
*
|
||||
* Assumptions:
|
||||
* - The caller has provided all validity checking of the
|
||||
* input parameters using mq_verifyreceive.
|
||||
* - Interrupts should be disabled throughout this call. This
|
||||
* is necessary because messages can be sent from interrupt
|
||||
* level processing.
|
||||
* - For mq_timedreceive, setting of the timer and this wait
|
||||
* must be atomic.
|
||||
* - The caller has provided all validity checking of the input parameters
|
||||
* using mq_verifyreceive.
|
||||
* - Interrupts should be disabled throughout this call. This is necessary
|
||||
* because messages can be sent from interrupt level processing.
|
||||
* - For mq_timedreceive, setting of the timer and this wait must be atomic.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -215,38 +213,34 @@ FAR mqmsg_t *mq_waitreceive(mqd_t mqdes)
|
||||
{
|
||||
msgq->nmsgs--;
|
||||
}
|
||||
|
||||
return rcvmsg;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Function: mq_doreceive
|
||||
* Name: mq_doreceive
|
||||
*
|
||||
* Description:
|
||||
* This is internal, common logic shared by both mq_receive
|
||||
* and mq_timedreceive. This function accepts the message
|
||||
* obtained by mq_waitmsg, provides the message content to
|
||||
* the user, notifies any threads that were waiting for
|
||||
* the message queue to become non-full, and disposes of the
|
||||
* message structure
|
||||
* This is internal, common logic shared by both mq_receive and
|
||||
* mq_timedreceive. This function accepts the message obtained by
|
||||
* mq_waitmsg, provides the message content to the user, notifies any
|
||||
* threads that were waiting for the message queue to become non-full,
|
||||
* and disposes of the message structure
|
||||
*
|
||||
* Parameters:
|
||||
* mqdes - Message queue descriptor
|
||||
* mqmsg - The message obtained by mq_waitmsg()
|
||||
* ubuffer - The address of the user provided buffer to
|
||||
* receive the message
|
||||
* prio - The user-provided location to return the
|
||||
* message priority.
|
||||
* ubuffer - The address of the user provided buffer to receive the message
|
||||
* prio - The user-provided location to return the message priority.
|
||||
*
|
||||
* Return Value:
|
||||
* Returns the length of the received message. This
|
||||
* function does not fail.
|
||||
* Returns the length of the received message. This function does not fail.
|
||||
*
|
||||
* Assumptions:
|
||||
* - The caller has provided all validity checking of the
|
||||
* input parameters using mq_verifyreceive.
|
||||
* - The user buffer, ubuffer, is known to be large enough
|
||||
* to accept the largest message that an be sent on this
|
||||
* message queue
|
||||
* - The caller has provided all validity checking of the input parameters
|
||||
* using mq_verifyreceive.
|
||||
* - The user buffer, ubuffer, is known to be large enough to accept the
|
||||
* largest message that an be sent on this message queue
|
||||
* - Pre-emption should be disabled throughout this call.
|
||||
*
|
||||
****************************************************************************/
|
||||
@@ -308,6 +302,7 @@ ssize_t mq_doreceive(mqd_t mqdes, mqmsg_t *mqmsg, void *ubuffer, int *prio)
|
||||
msgq->nwaitnotfull--;
|
||||
up_unblock_task(btcb);
|
||||
}
|
||||
|
||||
irqrestore(saved_state);
|
||||
}
|
||||
|
||||
|
||||
+15
-19
@@ -2,7 +2,7 @@
|
||||
* sched/mq_receive.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -73,25 +73,22 @@
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Function: mq_receive
|
||||
* Name: mq_receive
|
||||
*
|
||||
* Description:
|
||||
* This function receives the oldest of the highest
|
||||
* priority messages from the message queue specified by
|
||||
* "mqdes." If the size of the buffer in bytes (msglen) is
|
||||
* less than the "mq_msgsize" attribute of the message
|
||||
* queue, mq_receive will return an error. Otherwise, the
|
||||
* selected message is removed from the queue and copied to
|
||||
* "msg."
|
||||
* This function receives the oldest of the highest priority messages
|
||||
* from the message queue specified by "mqdes." If the size of the
|
||||
* buffer in bytes (msglen) is less than the "mq_msgsize" attribute of
|
||||
* the message queue, mq_receive will return an error. Otherwise, the
|
||||
* selected message is removed from the queue and copied to "msg."
|
||||
*
|
||||
* If the message queue is empty and O_NONBLOCK was not
|
||||
* set, mq_receive() will block until a message is added
|
||||
* to the message queue. If more than one task is waiting
|
||||
* to receive a message, only the task with the highest
|
||||
* priority that has waited the longest will be unblocked.
|
||||
* If the message queue is empty and O_NONBLOCK was not set,
|
||||
* mq_receive() will block until a message is added to the message
|
||||
* queue. If more than one task is waiting to receive a message, only
|
||||
* the task with the highest priority that has waited the longest will
|
||||
* be unblocked.
|
||||
*
|
||||
* If the queue is empty and O_NONBLOCK is set, ERROR will
|
||||
* be returned.
|
||||
* If the queue is empty and O_NONBLOCK is set, ERROR will be returned.
|
||||
*
|
||||
* Parameters:
|
||||
* mqdes - Message Queue Descriptor
|
||||
@@ -100,9 +97,8 @@
|
||||
* prio - If not NULL, the location to store message priority.
|
||||
*
|
||||
* Return Value:
|
||||
* One success, the length of the selected message in bytes.is
|
||||
* returned. On failure, -1 (ERROR) is returned and the errno
|
||||
* is set appropriately:
|
||||
* One success, the length of the selected message in bytes is returned.
|
||||
* On failure, -1 (ERROR) is returned and the errno is set appropriately:
|
||||
*
|
||||
* EAGAIN The queue was empty, and the O_NONBLOCK flag was set
|
||||
* for the message queue description referred to by 'mqdes'.
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: mq_send
|
||||
* Name: mq_send
|
||||
*
|
||||
* Description:
|
||||
* This function adds the specificied message (msg) to the message queue
|
||||
|
||||
@@ -134,11 +134,12 @@ int mq_verifysend(mqd_t mqdes, const void *msg, size_t msglen, int prio)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Function: mq_msgalloc
|
||||
* Name: mq_msgalloc
|
||||
*
|
||||
* Description:
|
||||
* The mq_msgalloc function will get a free message for use by the
|
||||
* operating system. The message will be allocated from the g_msgfree list.
|
||||
* operating system. The message will be allocated from the g_msgfree
|
||||
* list.
|
||||
*
|
||||
* If the list is empty AND the message is NOT being allocated from the
|
||||
* interrupt level, then the message will be allocated. If a message
|
||||
@@ -221,7 +222,7 @@ FAR mqmsg_t *mq_msgalloc(void)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Function: mq_waitsend
|
||||
* Name: mq_waitsend
|
||||
*
|
||||
* Description:
|
||||
* This is internal, common logic shared by both mq_send and mq_timesend.
|
||||
@@ -311,7 +312,7 @@ int mq_waitsend(mqd_t mqdes)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Function: mq_dosend
|
||||
* Name: mq_dosend
|
||||
*
|
||||
* Description:
|
||||
* This is internal, common logic shared by both mq_send and mq_timesend.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/mq_timedreceive.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -47,6 +47,7 @@
|
||||
#include <mqueue.h>
|
||||
#include <wdog.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
|
||||
#include "os_internal.h"
|
||||
@@ -74,7 +75,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: mq_rcvtimeout
|
||||
* Name: mq_rcvtimeout
|
||||
*
|
||||
* Description:
|
||||
* This function is called if the timeout elapses before the message queue
|
||||
@@ -96,15 +97,14 @@ static void mq_rcvtimeout(int argc, uint32_t pid)
|
||||
FAR _TCB *wtcb;
|
||||
irqstate_t saved_state;
|
||||
|
||||
/* Disable interrupts. This is necessary because an
|
||||
* interrupt handler may attempt to send a message while we are
|
||||
* doing this.
|
||||
/* Disable interrupts. This is necessary because an interrupt handler may
|
||||
* attempt to send a message while we are doing this.
|
||||
*/
|
||||
|
||||
saved_state = irqsave();
|
||||
|
||||
/* Get the TCB associated with this pid. It is possible that
|
||||
* task may no longer be active when this watchdog goes off.
|
||||
/* Get the TCB associated with this pid. It is possible that task may no
|
||||
* longer be active when this watchdog goes off.
|
||||
*/
|
||||
|
||||
wtcb = sched_gettcb((pid_t)pid);
|
||||
@@ -130,35 +130,30 @@ static void mq_rcvtimeout(int argc, uint32_t pid)
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: mq_timedreceive
|
||||
* Name: mq_timedreceive
|
||||
*
|
||||
* Description:
|
||||
* This function receives the oldest of the highest
|
||||
* priority messages from the message queue specified by
|
||||
* "mqdes." If the size of the buffer in bytes (msglen) is
|
||||
* less than the "mq_msgsize" attribute of the message
|
||||
* queue, mq_timedreceive will return an error. Otherwise, the
|
||||
* selected message is removed from the queue and copied to
|
||||
* "msg."
|
||||
* This function receives the oldest of the highest priority messages from
|
||||
* the message queue specified by "mqdes." If the size of the buffer in
|
||||
* bytes (msglen) is less than the "mq_msgsize" attribute of the message
|
||||
* queue, mq_timedreceive will return an error. Otherwise, the selected
|
||||
* message is removed from the queue and copied to "msg."
|
||||
*
|
||||
* If the message queue is empty and O_NONBLOCK was not
|
||||
* set, mq_timedreceive() will block until a message is added
|
||||
* to the message queue (or until a timeout occurs). If more
|
||||
* than one task is waiting to receive a message, only the
|
||||
* task with the highest priority that has waited the longest
|
||||
* will be unblocked.
|
||||
* If the message queue is empty and O_NONBLOCK was not set,
|
||||
* mq_timedreceive() will block until a message is added to the message
|
||||
* queue (or until a timeout occurs). If more than one task is waiting
|
||||
* to receive a message, only the task with the highest priority that has
|
||||
* waited the longest will be unblocked.
|
||||
*
|
||||
* mq_timedreceive() behaves just like mq_receive(), except
|
||||
* that if the queue is empty and the O_NONBLOCK flag is not
|
||||
* enabled for the message queue description, then abstime
|
||||
* points to a structure which specifies a ceiling on the time
|
||||
* for which the call will block. This ceiling is an absolute
|
||||
* timeout in seconds and nanoseconds since the Epoch (midnight
|
||||
* mq_timedreceive() behaves just like mq_receive(), except that if the
|
||||
* queue is empty and the O_NONBLOCK flag is not enabled for the message
|
||||
* queue description, then abstime points to a structure which specifies a
|
||||
* ceiling on the time for which the call will block. This ceiling is an
|
||||
* absolute timeout in seconds and nanoseconds since the Epoch (midnight
|
||||
* on the morning of 1 January 1970).
|
||||
*
|
||||
* If no message is available, and the timeout has already
|
||||
* expired by the time of the call, mq_timedreceive() returns
|
||||
* immediately.
|
||||
* If no message is available, and the timeout has already expired by the
|
||||
* time of the call, mq_timedreceive() returns immediately.
|
||||
*
|
||||
* Parameters:
|
||||
* mqdes - Message Queue Descriptor
|
||||
@@ -168,9 +163,8 @@ static void mq_rcvtimeout(int argc, uint32_t pid)
|
||||
* abstime - the absolute time to wait until a timeout is declared.
|
||||
*
|
||||
* Return Value:
|
||||
* One success, the length of the selected message in bytes.is
|
||||
* returned. On failure, -1 (ERROR) is returned and the errno
|
||||
* is set appropriately:
|
||||
* One success, the length of the selected message in bytes is returned.
|
||||
* On failure, -1 (ERROR) is returned and the errno is set appropriately:
|
||||
*
|
||||
* EAGAIN The queue was empty, and the O_NONBLOCK flag was set
|
||||
* for the message queue description referred to by 'mqdes'.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/mq_timedsend.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -74,7 +74,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: mq_sndtimeout
|
||||
* Name: mq_sndtimeout
|
||||
*
|
||||
* Description:
|
||||
* This function is called if the timeout elapses before the message queue
|
||||
@@ -96,15 +96,14 @@ static void mq_sndtimeout(int argc, uint32_t pid)
|
||||
FAR _TCB *wtcb;
|
||||
irqstate_t saved_state;
|
||||
|
||||
/* Disable interrupts. This is necessary because an
|
||||
* interrupt handler may attempt to send a message while we are
|
||||
* doing this.
|
||||
/* Disable interrupts. This is necessary because an interrupt handler may
|
||||
* attempt to send a message while we are doing this.
|
||||
*/
|
||||
|
||||
saved_state = irqsave();
|
||||
|
||||
/* Get the TCB associated with this pid. It is possible that
|
||||
* task may no longer be active when this watchdog goes off.
|
||||
/* Get the TCB associated with this pid. It is possible that task may no
|
||||
* longer be active when this watchdog goes off.
|
||||
*/
|
||||
|
||||
wtcb = sched_gettcb((pid_t)pid);
|
||||
@@ -130,7 +129,7 @@ static void mq_sndtimeout(int argc, uint32_t pid)
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: mq_send
|
||||
* Name: mq_send
|
||||
*
|
||||
* Description:
|
||||
* This function adds the specificied message (msg) to the message queue
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched.mq_unlink.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -71,14 +71,13 @@
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Function: mq_unlink
|
||||
* Name: mq_unlink
|
||||
*
|
||||
* Description:
|
||||
* This function removes the message queue named by
|
||||
* "mq_name." If one or more tasks have the message queue
|
||||
* open when mq_unlink() is called, removal of the message
|
||||
* queue is postponed until all references to the message
|
||||
* queue have been closed.
|
||||
* This function removes the message queue named by "mq_name." If one
|
||||
* or more tasks have the message queue open when mq_unlink() is called,
|
||||
* removal of the message queue is postponed until all references to the
|
||||
* message queue have been closed.
|
||||
*
|
||||
* Parameters:
|
||||
* mq_name - Name of the message queue
|
||||
@@ -138,6 +137,7 @@ int mq_unlink(const char *mq_name)
|
||||
|
||||
ret = OK;
|
||||
}
|
||||
|
||||
sched_unlock();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/mq_waitirq.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -72,7 +72,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: sem_waitirq
|
||||
* Name: sem_waitirq
|
||||
*
|
||||
* Description:
|
||||
* This function is called when a signal or a timeout is received by a
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Function: atexit
|
||||
* Name: atexit
|
||||
*
|
||||
* Description:
|
||||
* Registers a function to be called at program exit.
|
||||
|
||||
+55
-56
@@ -33,8 +33,8 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __OS_INTERNAL_H
|
||||
#define __OS_INTERNAL_H
|
||||
#ifndef __SCHED_OS_INTERNAL_H
|
||||
#define __SCHED_OS_INTERNAL_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
@@ -46,6 +46,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <queue.h>
|
||||
#include <sched.h>
|
||||
|
||||
#include <nuttx/kmalloc.h>
|
||||
|
||||
/****************************************************************************
|
||||
@@ -141,6 +142,7 @@ struct pidhash_s
|
||||
FAR _TCB *tcb;
|
||||
pid_t pid;
|
||||
};
|
||||
|
||||
typedef struct pidhash_s pidhash_t;
|
||||
|
||||
/* This structure defines an element of the g_tasklisttable[].
|
||||
@@ -153,6 +155,7 @@ struct tasklist_s
|
||||
DSEG volatile dq_queue_t *list; /* Pointer to the task list */
|
||||
bool prioritized; /* true if the list is prioritized */
|
||||
};
|
||||
|
||||
typedef struct tasklist_s tasklist_t;
|
||||
|
||||
/****************************************************************************
|
||||
@@ -161,27 +164,25 @@ typedef struct tasklist_s tasklist_t;
|
||||
|
||||
/* Declared in os_start.c ***************************************************/
|
||||
|
||||
/* The state of a task is indicated both by the task_state field
|
||||
* of the TCB and by a series of task lists. All of these
|
||||
* tasks lists are declared below. Although it is not always
|
||||
* necessary, most of these lists are prioritized so that common
|
||||
* list handling logic can be used (only the g_readytorun,
|
||||
* the g_pendingtasks, and the g_waitingforsemaphore lists need
|
||||
/* The state of a task is indicated both by the task_state field of the TCB
|
||||
* and by a series of task lists. All of these tasks lists are declared
|
||||
* below. Although it is not always necessary, most of these lists are
|
||||
* prioritized so that common list handling logic can be used (only the
|
||||
* g_readytorun, the g_pendingtasks, and the g_waitingforsemaphore lists need
|
||||
* to be prioritized).
|
||||
*/
|
||||
|
||||
/* This is the list of all tasks that are ready to run. The head
|
||||
* of this list is the currently active task; the tail of this
|
||||
* list is always the idle task.
|
||||
/* This is the list of all tasks that are ready to run. The head of this
|
||||
* list is the currently active task; the tail of this list is always the
|
||||
* IDLE task.
|
||||
*/
|
||||
|
||||
extern volatile dq_queue_t g_readytorun;
|
||||
|
||||
/* This is the list of all tasks that are ready-to-run, but
|
||||
* cannot be placed in the g_readytorun list because: (1) They
|
||||
* are higher priority than the currently active task at the head
|
||||
* of the g_readytorun list, and (2) the currenly active task has
|
||||
* disabled pre-emption.
|
||||
/* This is the list of all tasks that are ready-to-run, but cannot be placed
|
||||
* in the g_readytorun list because: (1) They are higher priority than the
|
||||
* currently active task at the head of the g_readytorun list, and (2) the
|
||||
* currently active task has disabled pre-emption.
|
||||
*/
|
||||
|
||||
extern volatile dq_queue_t g_pendingtasks;
|
||||
@@ -238,21 +239,20 @@ extern volatile pid_t g_lastpid;
|
||||
|
||||
/* The following hash table is used for two things:
|
||||
*
|
||||
* 1. This hash table greatly speeds the determination of
|
||||
* a new unique process ID for a task, and
|
||||
* 1. This hash table greatly speeds the determination of a new unique
|
||||
* process ID for a task, and
|
||||
* 2. Is used to quickly map a process ID into a TCB.
|
||||
*
|
||||
* It has the side effects of using more memory and limiting
|
||||
* the number of tasks to CONFIG_MAX_TASKS.
|
||||
* It has the side effects of using more memory and limiting the number
|
||||
* of tasks to CONFIG_MAX_TASKS.
|
||||
*/
|
||||
|
||||
extern pidhash_t g_pidhash[CONFIG_MAX_TASKS];
|
||||
|
||||
/* This is a table of task lists. This table is indexed by
|
||||
* the task state enumeration type (tstate_t) and provides
|
||||
* a pointer to the associated static task list (if there
|
||||
* is one) as well as a boolean indication as to if the list
|
||||
* is an ordered list or not.
|
||||
/* This is a table of task lists. This table is indexed by the task state
|
||||
* enumeration type (tstate_t) and provides a pointer to the associated
|
||||
* static task list (if there is one) as well as a boolean indication as to
|
||||
* if the list is an ordered list or not.
|
||||
*/
|
||||
|
||||
extern const tasklist_t g_tasklisttable[NUM_TASK_STATES];
|
||||
@@ -261,47 +261,46 @@ extern const tasklist_t g_tasklisttable[NUM_TASK_STATES];
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
extern int os_bringup(void);
|
||||
extern void task_start(void);
|
||||
extern int task_schedsetup(FAR _TCB *tcb, int priority, start_t start,
|
||||
main_t main);
|
||||
extern int task_argsetup(FAR _TCB *tcb, const char *name, const char *argv[]);
|
||||
extern void task_exithook(FAR _TCB *tcb, int status);
|
||||
extern int task_deletecurrent(void);
|
||||
int os_bringup(void);
|
||||
void task_start(void);
|
||||
int task_schedsetup(FAR _TCB *tcb, int priority, start_t start,
|
||||
main_t main);
|
||||
int task_argsetup(FAR _TCB *tcb, FAR const char *name, FAR const char *argv[]);
|
||||
void task_exithook(FAR _TCB *tcb, int status);
|
||||
int task_deletecurrent(void);
|
||||
#ifndef CONFIG_CUSTOM_STACK
|
||||
extern int kernel_thread(const char *name, int priority,
|
||||
int stack_size, main_t entry, const char *argv[]);
|
||||
int kernel_thread(FAR const char *name, int priority, int stack_size,
|
||||
main_t entry, FAR const char *argv[]);
|
||||
#else
|
||||
extern int kernel_thread(const char *name, int priority,
|
||||
main_t entry, const char *argv[]);
|
||||
int kernel_thread(FAR const char *name, int priority, main_t entry,
|
||||
FAR const char *argv[]);
|
||||
#endif
|
||||
extern bool sched_addreadytorun(FAR _TCB *rtrtcb);
|
||||
extern bool sched_removereadytorun(FAR _TCB *rtrtcb);
|
||||
extern bool sched_addprioritized(FAR _TCB *newTcb, DSEG dq_queue_t *list);
|
||||
extern bool sched_mergepending(void);
|
||||
extern void sched_addblocked(FAR _TCB *btcb, tstate_t task_state);
|
||||
extern void sched_removeblocked(FAR _TCB *btcb);
|
||||
extern int sched_setpriority(FAR _TCB *tcb, int sched_priority);
|
||||
bool sched_addreadytorun(FAR _TCB *rtrtcb);
|
||||
bool sched_removereadytorun(FAR _TCB *rtrtcb);
|
||||
bool sched_addprioritized(FAR _TCB *newTcb, DSEG dq_queue_t *list);
|
||||
bool sched_mergepending(void);
|
||||
void sched_addblocked(FAR _TCB *btcb, tstate_t task_state);
|
||||
void sched_removeblocked(FAR _TCB *btcb);
|
||||
int sched_setpriority(FAR _TCB *tcb, int sched_priority);
|
||||
#ifdef CONFIG_PRIORITY_INHERITANCE
|
||||
extern int sched_reprioritize(FAR _TCB *tcb, int sched_priority);
|
||||
int sched_reprioritize(FAR _TCB *tcb, int sched_priority);
|
||||
#else
|
||||
# define sched_reprioritize(tcb,sched_priority) sched_setpriority(tcb,sched_priority)
|
||||
#endif
|
||||
extern FAR _TCB *sched_gettcb(pid_t pid);
|
||||
extern bool sched_verifytcb(FAR _TCB *tcb);
|
||||
FAR _TCB *sched_gettcb(pid_t pid);
|
||||
bool sched_verifytcb(FAR _TCB *tcb);
|
||||
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 || CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||
extern int sched_setupidlefiles(FAR _TCB *tcb);
|
||||
extern int sched_setuptaskfiles(FAR _TCB *tcb);
|
||||
extern int sched_setuppthreadfiles(FAR _TCB *tcb);
|
||||
#if CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0
|
||||
extern int sched_setupstreams(FAR _TCB *tcb);
|
||||
extern int sched_flushfiles(FAR _TCB *tcb);
|
||||
int sched_setupidlefiles(FAR _TCB *tcb);
|
||||
int sched_setuptaskfiles(FAR _TCB *tcb);
|
||||
int sched_setuppthreadfiles(FAR _TCB *tcb);
|
||||
#if CONFIG_NFILE_STREAMS > 0
|
||||
int sched_setupstreams(FAR _TCB *tcb);
|
||||
#endif
|
||||
extern int sched_releasefiles(FAR _TCB *tcb);
|
||||
int sched_releasefiles(FAR _TCB *tcb);
|
||||
#endif
|
||||
|
||||
extern int sched_releasetcb(FAR _TCB *tcb);
|
||||
extern void sched_garbagecollection(void);
|
||||
int sched_releasetcb(FAR _TCB *tcb);
|
||||
void sched_garbagecollection(void);
|
||||
|
||||
#endif /* __OS_INTERNAL_H */
|
||||
#endif /* __SCHED_OS_INTERNAL_H */
|
||||
|
||||
+22
-23
@@ -77,27 +77,25 @@
|
||||
****************************************************************************/
|
||||
|
||||
/* Task Lists ***************************************************************/
|
||||
/* The state of a task is indicated both by the task_state field
|
||||
* of the TCB and by a series of task lists. All of these
|
||||
* tasks lists are declared below. Although it is not always
|
||||
* necessary, most of these lists are prioritized so that common
|
||||
* list handling logic can be used (only the g_readytorun,
|
||||
* the g_pendingtasks, and the g_waitingforsemaphore lists need
|
||||
/* The state of a task is indicated both by the task_state field of the TCB
|
||||
* and by a series of task lists. All of these tasks lists are declared
|
||||
* below. Although it is not always necessary, most of these lists are
|
||||
* prioritized so that common list handling logic can be used (only the
|
||||
* g_readytorun, the g_pendingtasks, and the g_waitingforsemaphore lists need
|
||||
* to be prioritized).
|
||||
*/
|
||||
|
||||
/* This is the list of all tasks that are ready to run. The head
|
||||
* of this list is the currently active task; the tail of this
|
||||
* list is always the idle task.
|
||||
/* This is the list of all tasks that are ready to run. The head of this
|
||||
* list is the currently active task; the tail of this list is always the
|
||||
* IDLE task.
|
||||
*/
|
||||
|
||||
volatile dq_queue_t g_readytorun;
|
||||
|
||||
/* This is the list of all tasks that are ready-to-run, but
|
||||
* cannot be placed in the g_readytorun list because: (1) They
|
||||
* are higher priority than the currently active task at the head
|
||||
* of the g_readytorun list, and (2) the currenly active task has
|
||||
* disabled pre-emption.
|
||||
/* This is the list of all tasks that are ready-to-run, but cannot be placed
|
||||
* in the g_readytorun list because: (1) They are higher priority than the
|
||||
* currently active task at the head of the g_readytorun list, and (2) the
|
||||
* currently active task has disabled pre-emption.
|
||||
*/
|
||||
|
||||
volatile dq_queue_t g_pendingtasks;
|
||||
@@ -197,11 +195,10 @@ const tasklist_t g_tasklisttable[NUM_TASK_STATES] =
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
****************************************************************************/
|
||||
/* This is the task control block for this thread of execution.
|
||||
* This thread of execution is the idle task. NOTE: the
|
||||
* system boots into the idle task. The idle task spawns
|
||||
* the user init task and the user init task is responsible
|
||||
* for bringing up the rest of the system
|
||||
/* This is the task control block for this thread of execution. This thread
|
||||
* of execution is the IDLE task. NOTE: the system boots into the IDLE
|
||||
* task. The IDLE task spawns the user initialization task (user_start) and
|
||||
* that user init task is responsible for bringing up the rest of the system
|
||||
*/
|
||||
|
||||
static FAR _TCB g_idletcb;
|
||||
@@ -219,10 +216,12 @@ static FAR const char g_idlename[] = "Idle Task";
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: os_start
|
||||
* Description: This function is called to initialize the
|
||||
* operating system and to spawn the user init thread of
|
||||
* execution
|
||||
* Name: os_start
|
||||
*
|
||||
* Description:
|
||||
* This function is called to initialize the operating system and to spawn
|
||||
* the user initization thread of execution
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void os_start(void)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/pg_internal.h
|
||||
*
|
||||
* Copyright (C) 2010 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -119,7 +119,7 @@ extern FAR _TCB *g_pftcb;
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
extern int pg_worker(int argc, char *argv[]);
|
||||
int pg_worker(int argc, char *argv[]);
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* CONFIG_PAGING */
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/pg_miss.c
|
||||
*
|
||||
* Copyright (C) 2010 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
+63
-60
@@ -3,7 +3,7 @@
|
||||
* Page fill worker thread implementation.
|
||||
*
|
||||
* Copyright (C) 2010-2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -81,10 +81,9 @@
|
||||
|
||||
pid_t g_pgworker;
|
||||
|
||||
/* The page fill worker thread maintains a static variable called
|
||||
* g_pftcb. If no fill is in progress, g_pftcb will be NULL.
|
||||
* Otherwise, g_pftcb will point to the TCB of the task which is
|
||||
* receiving the fill that is in progess.
|
||||
/* The page fill worker thread maintains a static variable called g_pftcb.
|
||||
* If no fill is in progress, g_pftcb will be NULL. Otherwise, g_pftcb will
|
||||
* point to the TCB of the task which is receiving the fill that is in progess.
|
||||
*
|
||||
* NOTE: I think that this is the only state in which a TCB does not reside
|
||||
* in some list. Here is it in limbo, outside of the normally queuing while
|
||||
@@ -178,26 +177,27 @@ static void pg_callback(FAR _TCB *tcb, int result)
|
||||
priority = htcb->sched_priority;
|
||||
}
|
||||
|
||||
/* If this higher priority is higher than current page fill worker
|
||||
* thread, then boost worker thread's priority to that level. Thus,
|
||||
* the page fill worker thread will always run at the priority of
|
||||
* the highest priority task that is waiting for a fill.
|
||||
*/
|
||||
/* If this higher priority is higher than current page fill worker
|
||||
* thread, then boost worker thread's priority to that level. Thus,
|
||||
* the page fill worker thread will always run at the priority of
|
||||
* the highest priority task that is waiting for a fill.
|
||||
*/
|
||||
|
||||
if (priority > wtcb->sched_priority)
|
||||
{
|
||||
pgllvdbg("New worker priority. %d->%d\n",
|
||||
wtcb->sched_priority, priority);
|
||||
sched_setpriority(wtcb, priority);
|
||||
}
|
||||
if (priority > wtcb->sched_priority)
|
||||
{
|
||||
pgllvdbg("New worker priority. %d->%d\n",
|
||||
wtcb->sched_priority, priority);
|
||||
sched_setpriority(wtcb, priority);
|
||||
}
|
||||
|
||||
/* Save the page fill result (don't permit the value -EBUSY) */
|
||||
/* Save the page fill result (don't permit the value -EBUSY) */
|
||||
|
||||
if (result == -EBUSY)
|
||||
{
|
||||
result = -ENOSYS;
|
||||
}
|
||||
g_fillresult = result;
|
||||
if (result == -EBUSY)
|
||||
{
|
||||
result = -ENOSYS;
|
||||
}
|
||||
|
||||
g_fillresult = result;
|
||||
}
|
||||
|
||||
/* Signal the page fill worker thread (in any event) */
|
||||
@@ -262,50 +262,50 @@ static inline bool pg_dequeue(void)
|
||||
|
||||
if (!up_checkmapping(g_pftcb))
|
||||
{
|
||||
/* This page needs to be filled. pg_miss bumps up
|
||||
* the priority of the page fill worker thread as each
|
||||
* TCB is added to the g_waitingforfill list. So we
|
||||
* may need to also drop the priority of the worker
|
||||
* thread as the next TCB comes off of the list.
|
||||
*
|
||||
* If wtcb->sched_priority > CONFIG_PAGING_DEFPRIO,
|
||||
* then the page fill worker thread is executing at
|
||||
* an elevated priority that may be reduced.
|
||||
*
|
||||
* If wtcb->sched_priority > g_pftcb->sched_priority
|
||||
* then the page fill worker thread is executing at
|
||||
* a higher priority than is appropriate for this
|
||||
* fill (this priority can get re-boosted by pg_miss()
|
||||
* if a new higher priority fill is required).
|
||||
*/
|
||||
/* This page needs to be filled. pg_miss bumps up
|
||||
* the priority of the page fill worker thread as each
|
||||
* TCB is added to the g_waitingforfill list. So we
|
||||
* may need to also drop the priority of the worker
|
||||
* thread as the next TCB comes off of the list.
|
||||
*
|
||||
* If wtcb->sched_priority > CONFIG_PAGING_DEFPRIO,
|
||||
* then the page fill worker thread is executing at
|
||||
* an elevated priority that may be reduced.
|
||||
*
|
||||
* If wtcb->sched_priority > g_pftcb->sched_priority
|
||||
* then the page fill worker thread is executing at
|
||||
* a higher priority than is appropriate for this
|
||||
* fill (this priority can get re-boosted by pg_miss()
|
||||
* if a new higher priority fill is required).
|
||||
*/
|
||||
|
||||
FAR _TCB *wtcb = (FAR _TCB *)g_readytorun.head;
|
||||
if (wtcb->sched_priority > CONFIG_PAGING_DEFPRIO &&
|
||||
wtcb->sched_priority > g_pftcb->sched_priority)
|
||||
{
|
||||
/* Don't reduce the priority of the page fill
|
||||
* worker thread lower than the configured
|
||||
* minimum.
|
||||
*/
|
||||
FAR _TCB *wtcb = (FAR _TCB *)g_readytorun.head;
|
||||
if (wtcb->sched_priority > CONFIG_PAGING_DEFPRIO &&
|
||||
wtcb->sched_priority > g_pftcb->sched_priority)
|
||||
{
|
||||
/* Don't reduce the priority of the page fill
|
||||
* worker thread lower than the configured
|
||||
* minimum.
|
||||
*/
|
||||
|
||||
int priority = g_pftcb->sched_priority;
|
||||
if (priority < CONFIG_PAGING_DEFPRIO)
|
||||
{
|
||||
priority = CONFIG_PAGING_DEFPRIO;
|
||||
}
|
||||
int priority = g_pftcb->sched_priority;
|
||||
if (priority < CONFIG_PAGING_DEFPRIO)
|
||||
{
|
||||
priority = CONFIG_PAGING_DEFPRIO;
|
||||
}
|
||||
|
||||
/* Reduce the priority of the page fill worker thread */
|
||||
/* Reduce the priority of the page fill worker thread */
|
||||
|
||||
pgllvdbg("New worker priority. %d->%d\n",
|
||||
wtcb->sched_priority, priority);
|
||||
sched_setpriority(wtcb, priority);
|
||||
}
|
||||
pgllvdbg("New worker priority. %d->%d\n",
|
||||
wtcb->sched_priority, priority);
|
||||
sched_setpriority(wtcb, priority);
|
||||
}
|
||||
|
||||
/* Return with g_pftcb holding the pointer to
|
||||
* the TCB associated with task that requires the page fill.
|
||||
*/
|
||||
/* Return with g_pftcb holding the pointer to
|
||||
* the TCB associated with task that requires the page fill.
|
||||
*/
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* The page need by this task has already been mapped into the
|
||||
@@ -317,6 +317,7 @@ static inline bool pg_dequeue(void)
|
||||
}
|
||||
}
|
||||
while (g_pftcb != NULL);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -421,6 +422,7 @@ static inline bool pg_startfill(void)
|
||||
* task must still be available to run.
|
||||
*/
|
||||
#endif /* CONFIG_PAGING_BLOCKINGFILL */
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -670,6 +672,7 @@ int pg_worker(int argc, char *argv[])
|
||||
pg_alldone();
|
||||
#endif
|
||||
}
|
||||
|
||||
return OK; /* To keep some compilers happy */
|
||||
}
|
||||
#endif /* CONFIG_PAGING */
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/sched.h>
|
||||
|
||||
#include "os_internal.h"
|
||||
|
||||
/************************************************************************
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/pthread_barriedestroy.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -69,7 +69,7 @@
|
||||
********************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
* Function: pthread_barrier_destroy
|
||||
* Name: pthread_barrier_destroy
|
||||
*
|
||||
* Description:
|
||||
* The pthread_barrier_destroy() function destroys the barrier referenced by
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/pthread_barrieinit.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -69,7 +69,7 @@
|
||||
********************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
* Function: pthread_barrier_init
|
||||
* Name: pthread_barrier_init
|
||||
*
|
||||
* Description:
|
||||
* The pthread_barrier_init() function allocates any resources required to use
|
||||
@@ -117,5 +117,6 @@ int pthread_barrier_init(FAR pthread_barrier_t *barrier,
|
||||
sem_init(&barrier->sem, 0, 0);
|
||||
barrier->count = count;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/pthread_barrierwait.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -70,7 +70,7 @@
|
||||
********************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
* Function: pthread_barrier_wait
|
||||
* Name: pthread_barrier_wait
|
||||
*
|
||||
* Description:
|
||||
* The pthread_barrier_wait() function synchronizse participating threads at
|
||||
@@ -159,7 +159,7 @@ int pthread_barrier_wait(FAR pthread_barrier_t *barrier)
|
||||
{
|
||||
/* If the thread is awakened by a signal, just continue to wait */
|
||||
|
||||
int errornumber = *get_errno_ptr();
|
||||
int errornumber = get_errno();
|
||||
if (errornumber != EINTR)
|
||||
{
|
||||
/* If it is awakened by some other error, then there is a
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/pthread_cancel.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -123,6 +123,7 @@ int pthread_cancel(pthread_t thread)
|
||||
sched_unlock();
|
||||
return OK;
|
||||
}
|
||||
|
||||
sched_unlock();
|
||||
|
||||
/* Check to see if the ID refers to ourselves.. this would be the
|
||||
|
||||
@@ -69,12 +69,12 @@
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Function: pthread_notifywaiters
|
||||
* Name: pthread_notifywaiters
|
||||
*
|
||||
* Description:
|
||||
* Notify all other threads waiting in phread join for this
|
||||
* thread's exit data. This must be done by the child
|
||||
* at child thread destruction time.
|
||||
* Notify all other threads waiting in phread join for this thread's
|
||||
* exit data. This must be done by the child at child thread
|
||||
* destruction time.
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
@@ -117,6 +117,7 @@ static bool pthread_notifywaiters(FAR join_t *pjoin)
|
||||
(void)pthread_takesemaphore(&pjoin->data_sem);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -125,20 +126,20 @@ static bool pthread_notifywaiters(FAR join_t *pjoin)
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Function: pthread_completejoin
|
||||
* Name: pthread_completejoin
|
||||
*
|
||||
* Description:
|
||||
* A thread has been terminated -- either by returning,
|
||||
* calling pthread_exit(), or through pthread_cancel().
|
||||
* In any event, we must complete any pending join events.
|
||||
* A thread has been terminated -- either by returning, calling
|
||||
* pthread_exit(), or through pthread_cancel(). In any event, we must
|
||||
* complete any pending join events.
|
||||
*
|
||||
* Parameters:
|
||||
* exit_value
|
||||
*
|
||||
* Returned Value:
|
||||
* OK unless there is no join information associated with
|
||||
* the pid. This could happen, for example, if a task
|
||||
* started with task_create() calls pthread_exit().
|
||||
* OK unless there is no join information associated with the pid.
|
||||
* This could happen, for example, if a task started with task_create()
|
||||
* calls pthread_exit().
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
@@ -195,16 +196,15 @@ int pthread_completejoin(pid_t pid, FAR void *exit_value)
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function: pthread_destroyjoin
|
||||
* Name: pthread_destroyjoin
|
||||
*
|
||||
* Description:
|
||||
* This is called from pthread_completejoin if the join
|
||||
* info was detached or from pthread_join when the last
|
||||
* waiting thread has received the thread exit info.
|
||||
* This is called from pthread_completejoin if the join info was
|
||||
* detached or from pthread_join when the last waiting thread has
|
||||
* received the thread exit info.
|
||||
*
|
||||
* Or it may never be called if the join info was never
|
||||
* detached or if no thread ever calls pthread_join. In
|
||||
* case, there is a memory leak!
|
||||
* Or it may never be called if the join info was never detached or if
|
||||
* no thread ever calls pthread_join. In case, there is a memory leak!
|
||||
*
|
||||
* Assumptions:
|
||||
* The caller holds g_join_semaphore
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/pthread_condbroadcast.c
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -71,7 +71,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: pthread_cond_broadcast
|
||||
* Name: pthread_cond_broadcast
|
||||
*
|
||||
* Description:
|
||||
* A thread broadcast on a condition variable.
|
||||
@@ -99,9 +99,9 @@ int pthread_cond_broadcast(FAR pthread_cond_t *cond)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Disable pre-emption until all of the waiting threads have
|
||||
* been restarted. This is necessary to assure that the sval
|
||||
* behaves as expected in the following while loop
|
||||
/* Disable pre-emption until all of the waiting threads have been
|
||||
* restarted. This is necessary to assure that the sval behaves as
|
||||
* expected in the following while loop
|
||||
*/
|
||||
|
||||
sched_lock();
|
||||
@@ -109,8 +109,9 @@ int pthread_cond_broadcast(FAR pthread_cond_t *cond)
|
||||
/* Get the current value of the semaphore */
|
||||
|
||||
if (sem_getvalue((sem_t*)&cond->sem, &sval) != OK)
|
||||
ret = EINVAL;
|
||||
|
||||
{
|
||||
ret = EINVAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Loop until all of the waiting threads have been restarted. */
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/pthread_conddestroy.c
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -49,7 +49,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: pthread_cond_destroy
|
||||
* Name: pthread_cond_destroy
|
||||
*
|
||||
* Description:
|
||||
* A thread can delete condition variables.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/pthread_condinit.c
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -50,7 +50,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: pthread_cond_init
|
||||
* Name: pthread_cond_init
|
||||
*
|
||||
* Description:
|
||||
* A thread can create condition variables.
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: pthread_cond_signal
|
||||
* Name: pthread_cond_signal
|
||||
*
|
||||
* Description:
|
||||
* A thread can signal on a condition variable.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/pthread_condtimedwait.c
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -74,7 +74,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: pthread_condtimedout
|
||||
* Name: pthread_condtimedout
|
||||
*
|
||||
* Description:
|
||||
* This function is called if the timeout elapses before
|
||||
@@ -111,7 +111,7 @@ static void pthread_condtimedout(int argc, uint32_t pid, uint32_t signo)
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: pthread_cond_timedwait
|
||||
* Name: pthread_cond_timedwait
|
||||
*
|
||||
* Description:
|
||||
* A thread can perform a timed wait on a condition variable.
|
||||
@@ -255,7 +255,7 @@ int pthread_cond_timedwait(FAR pthread_cond_t *cond, FAR pthread_mutex_t *mutex,
|
||||
* signal posted by pthread_condtimedout().
|
||||
*/
|
||||
|
||||
if (*get_errno_ptr() == EINTR)
|
||||
if (get_errno() == EINTR)
|
||||
{
|
||||
sdbg("Timedout!\n");
|
||||
ret = ETIMEDOUT;
|
||||
|
||||
@@ -72,11 +72,10 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: int pthread_cond_wait
|
||||
* Name: int pthread_cond_wait
|
||||
*
|
||||
* Description:
|
||||
* A thread can wait for a condition variable to be
|
||||
* signalled or broadcast.
|
||||
* A thread can wait for a condition variable to be signalled or broadcast.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
@@ -107,7 +106,6 @@ int pthread_cond_wait(FAR pthread_cond_t *cond, FAR pthread_mutex_t *mutex)
|
||||
{
|
||||
ret = EPERM;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
/* Give up the mutex */
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/pthread_create.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -89,23 +89,22 @@ static const char g_pthreadname[] = "<pthread>";
|
||||
* Name: pthread_argsetup
|
||||
*
|
||||
* Description:
|
||||
* This functions sets up parameters in the Task Control
|
||||
* Block (TCB) in preparation for starting a new thread.
|
||||
* This functions sets up parameters in the Task Control Block (TCB) in
|
||||
* preparation for starting a new thread.
|
||||
*
|
||||
* pthread_argsetup() is called from task_init() and task_start()
|
||||
* to create a new task (with arguments cloned via strdup)
|
||||
* or pthread_create() which has one argument passed by
|
||||
* value (distinguished by the pthread boolean argument).
|
||||
* pthread_argsetup() is called from task_init() and task_start() to create
|
||||
* a new task (with arguments cloned via strdup) or pthread_create() which
|
||||
* has one argument passed by value (distinguished by the pthread boolean
|
||||
* argument).
|
||||
*
|
||||
* Input Parameters:
|
||||
* tcb - Address of the new task's TCB
|
||||
* name - Name of the new task (not used)
|
||||
* argv - A pointer to an array of input parameters.
|
||||
* Up to CONFIG_MAX_TASK_ARG parameters may be
|
||||
* provided. If fewer than CONFIG_MAX_TASK_ARG
|
||||
* parameters are passed, the list should be
|
||||
* terminated with a NULL argv[] value.
|
||||
* If no parameters are required, argv may be NULL.
|
||||
* argv - A pointer to an array of input parameters. Up to
|
||||
* CONFIG_MAX_TASK_ARG parameters may be provided. If fewer
|
||||
* than CONFIG_MAX_TASK_ARG parameters are passed, the list
|
||||
* should be terminated with a NULL argv[] value. If no
|
||||
* parameters are required, argv may be NULL.
|
||||
*
|
||||
* Return Value:
|
||||
* None
|
||||
@@ -145,7 +144,7 @@ static void pthread_argsetup(FAR _TCB *tcb, pthread_addr_t arg)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Function: pthread_addjoininfo
|
||||
* Name: pthread_addjoininfo
|
||||
*
|
||||
* Description:
|
||||
* Add a join_t to the local data set.
|
||||
@@ -172,6 +171,7 @@ static void pthread_addjoininfo(FAR join_t *pjoin)
|
||||
{
|
||||
g_pthread_tail->next = pjoin;
|
||||
}
|
||||
|
||||
g_pthread_tail = pjoin;
|
||||
}
|
||||
|
||||
@@ -226,8 +226,8 @@ static void pthread_start(void)
|
||||
* Name: pthread_create
|
||||
*
|
||||
* Description:
|
||||
* This function creates and activates a new thread with a
|
||||
* specified attributes.
|
||||
* This function creates and activates a new thread with a specified
|
||||
* attributes.
|
||||
*
|
||||
* Input Parameters:
|
||||
* thread
|
||||
@@ -430,5 +430,6 @@ int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr,
|
||||
sched_free(pjoin);
|
||||
return EIO;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/pthread_detach.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -73,11 +73,11 @@
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Function: pthread_detach
|
||||
* Name: pthread_detach
|
||||
*
|
||||
* Description:
|
||||
* A thread object may be "detached" to specify that the return
|
||||
* value and completion status will not be requested.
|
||||
* A thread object may be "detached" to specify that the return value
|
||||
* and completion status will not be requested.
|
||||
*
|
||||
* Parameters:
|
||||
* thread
|
||||
@@ -129,6 +129,7 @@ int pthread_detach(pthread_t thread)
|
||||
|
||||
ret = OK;
|
||||
}
|
||||
|
||||
(void)pthread_givesemaphore(&g_join_semaphore);
|
||||
|
||||
sdbg("Returning %d\n", ret);
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Function: pthread_exit
|
||||
* Name: pthread_exit
|
||||
*
|
||||
* Description:
|
||||
* Terminate execution of a thread started with pthread_create.
|
||||
@@ -124,6 +124,7 @@ void pthread_exit(FAR void *exit_value)
|
||||
{
|
||||
error_code = EXIT_FAILURE;
|
||||
}
|
||||
|
||||
exit(error_code);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* pthread_findjoininfo.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -38,7 +38,9 @@
|
||||
************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "pthread_internal.h"
|
||||
|
||||
/************************************************************************
|
||||
@@ -66,7 +68,7 @@
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Function: thread_findjoininfo
|
||||
* Name: thread_findjoininfo
|
||||
*
|
||||
* Description:
|
||||
* Find a join_t to the local data set.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/********************************************************************************************
|
||||
/****************************************************************************
|
||||
* pthread_getschedparam.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -31,11 +31,11 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
********************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/********************************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
********************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <pthread.h>
|
||||
@@ -44,46 +44,46 @@
|
||||
#include <debug.h>
|
||||
#include "pthread_internal.h"
|
||||
|
||||
/********************************************************************************************
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
********************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/********************************************************************************************
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
********************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/********************************************************************************************
|
||||
/****************************************************************************
|
||||
* Global Variables
|
||||
********************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/********************************************************************************************
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
********************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/********************************************************************************************
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
********************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/********************************************************************************************
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
*********************************************************************************************/
|
||||
*****************************************************************************/
|
||||
|
||||
/********************************************************************************************
|
||||
* Function: pthread_getschedparam
|
||||
/****************************************************************************
|
||||
* Name: pthread_getschedparam
|
||||
*
|
||||
* Description:
|
||||
* The pthread_getschedparam() functions will get the scheduling policy and
|
||||
* parameters of threads. For SCHED_FIFO and SCHED_RR, the only required
|
||||
* member of the sched_param structure is the priority sched_priority.
|
||||
*
|
||||
* The pthread_getschedparam() function will retrieve the scheduling policy
|
||||
* and scheduling parameters for the thread whose thread ID is given by
|
||||
* 'thread' and will store those values in 'policy' and 'param',
|
||||
* The pthread_getschedparam() function will retrieve the scheduling
|
||||
* policy and scheduling parameters for the thread whose thread ID is
|
||||
* given by 'thread' and will store those values in 'policy' and 'param',
|
||||
* respectively. The priority value returned from pthread_getschedparam()
|
||||
* will be the value specified by the most recent pthread_setschedparam(),
|
||||
* pthread_setschedprio(), or pthread_create() call affecting the target
|
||||
* thread. It will not reflect any temporary adjustments to its priority (such
|
||||
* as might result of any priority inheritance, for example).
|
||||
* thread. It will not reflect any temporary adjustments to its priority
|
||||
* (such as might result of any priority inheritance, for example).
|
||||
*
|
||||
* The policy parameter may have the value SCHED_FIFO, or SCHED_RR
|
||||
* (SCHED_OTHER and SCHED_SPORADIC, in particular, are not supported).
|
||||
@@ -101,9 +101,10 @@
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
********************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
int pthread_getschedparam(pthread_t thread, FAR int *policy, FAR struct sched_param *param)
|
||||
int pthread_getschedparam(pthread_t thread, FAR int *policy,
|
||||
FAR struct sched_param *param)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -128,7 +129,7 @@ int pthread_getschedparam(pthread_t thread, FAR int *policy, FAR struct sched_pa
|
||||
*policy = sched_getscheduler((pid_t)thread);
|
||||
if (*policy == ERROR)
|
||||
{
|
||||
ret = *get_errno_ptr();
|
||||
ret = get_errno();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/pthread_getspecific.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -71,26 +71,23 @@
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Function: pthread_getspecific
|
||||
* Name: pthread_getspecific
|
||||
*
|
||||
* Description:
|
||||
* The pthread_getspecific() function returns the value
|
||||
* currently bound to the specified key on behalf of the
|
||||
* calling thread.
|
||||
* The pthread_getspecific() function returns the value currently
|
||||
* bound to the specified key on behalf of the calling thread.
|
||||
*
|
||||
* The effect of calling pthread_getspecific() with
|
||||
* with a key value not obtained from pthread_create() or
|
||||
* after a key has been deleted with pthread_key_delete()
|
||||
* is undefined.
|
||||
* The effect of calling pthread_getspecific() with with a key value
|
||||
* not obtained from pthread_create() or after a key has been deleted
|
||||
* with pthread_key_delete() is undefined.
|
||||
*
|
||||
* Parameters:
|
||||
* key = The data key to get or set
|
||||
*
|
||||
* Return Value:
|
||||
* The function pthread_getspecific() returns the thread-
|
||||
* specific data associated with the given key. If no
|
||||
* thread specific data is associated with the key, then
|
||||
* the value NULL is returned.
|
||||
* The function pthread_getspecific() returns the thread-specific data
|
||||
* associated with the given key. If no thread specific data is
|
||||
* associated with the key, then the value NULL is returned.
|
||||
*
|
||||
* EINVAL - The key value is invalid.
|
||||
*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/pthread_initialize.c
|
||||
*
|
||||
* Copyright (C) 2007-2010 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -89,11 +89,10 @@ uint8_t g_pthread_num_keys;
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: pthread_initialize
|
||||
* Name: pthread_initialize
|
||||
*
|
||||
* Description:
|
||||
* This is an internal OS function called only at power-up
|
||||
* boot time.
|
||||
* This is an internal OS function called only at power-up boot time.
|
||||
*
|
||||
* Parameters:
|
||||
* None
|
||||
@@ -121,7 +120,7 @@ void pthread_initialize(void)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Function: pthread_takesemaphore and pthread_givesemaphore
|
||||
* Name: pthread_takesemaphore and pthread_givesemaphore
|
||||
*
|
||||
* Description:
|
||||
* Support managed access to the private data sets.
|
||||
@@ -151,9 +150,9 @@ int pthread_takesemaphore(sem_t *sem)
|
||||
* awakened by the receipt of a signal.
|
||||
*/
|
||||
|
||||
if (*get_errno_ptr() != EINTR)
|
||||
if (get_errno() != EINTR)
|
||||
{
|
||||
*get_errno_ptr() = EINVAL;
|
||||
set_errno(EINVAL);
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
@@ -163,7 +162,7 @@ int pthread_takesemaphore(sem_t *sem)
|
||||
{
|
||||
/* NULL semaphore pointer! */
|
||||
|
||||
*get_errno_ptr() = EINVAL;
|
||||
set_errno(EINVAL);
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
@@ -184,7 +183,7 @@ int pthread_givesemaphore(sem_t *sem)
|
||||
{
|
||||
/* sem_post() reported an error */
|
||||
|
||||
*get_errno_ptr() = EINVAL;
|
||||
set_errno(EINVAL);
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
@@ -192,7 +191,7 @@ int pthread_givesemaphore(sem_t *sem)
|
||||
{
|
||||
/* NULL semaphore pointer! */
|
||||
|
||||
*get_errno_ptr() = EINVAL;
|
||||
set_errno(EINVAL);
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/pthread_internal.h
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -57,13 +57,11 @@
|
||||
* Public Type Declarations
|
||||
****************************************************************************/
|
||||
|
||||
/* The following defines an entry in the pthread logic's
|
||||
* local data set. Note that this structure is used to
|
||||
* implemented a singly linked list. This structure
|
||||
* is used (instead of, say, a binary search tree) because
|
||||
* the data set will be searched using the pid as
|
||||
* a key -- a process IDs will always be created in a
|
||||
* montonically increasing fashion.
|
||||
/* The following defines an entry in the pthread logic's local data set.
|
||||
* Note that this structure is used to implemented a singly linked list.
|
||||
* This structure is used (instead of, say, a binary search tree) because
|
||||
* the data set will be searched using the pid as a key -- a process IDs will
|
||||
* always be created in a montonically increasing fashion.
|
||||
*/
|
||||
|
||||
struct join_s
|
||||
@@ -79,28 +77,27 @@ struct join_s
|
||||
pthread_addr_t exit_value; /* Returned data */
|
||||
|
||||
};
|
||||
|
||||
typedef struct join_s join_t;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Variables
|
||||
****************************************************************************/
|
||||
|
||||
/* This is the head of a private singly linked list. It
|
||||
* is used to retain information about the spawned threads.
|
||||
/* This is the head of a private singly linked list. It is used to retain
|
||||
* information about the spawned threads.
|
||||
*/
|
||||
|
||||
extern FAR join_t *g_pthread_head;
|
||||
extern FAR join_t *g_pthread_tail;
|
||||
|
||||
/* Mutually exclusive access to this data set is enforced with
|
||||
* the following (un-named) semaphore.
|
||||
/* Mutually exclusive access to this data set is enforced with the following
|
||||
* (un-named) semaphore.
|
||||
*/
|
||||
|
||||
extern sem_t g_join_semaphore;
|
||||
|
||||
/* This keys track of the number of global keys that have been
|
||||
* allocated.
|
||||
*/
|
||||
/* This keys track of the number of global keys that have been allocated. */
|
||||
|
||||
extern uint8_t g_pthread_num_keys;
|
||||
|
||||
|
||||
+11
-10
@@ -42,6 +42,7 @@
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include "os_internal.h"
|
||||
#include "pthread_internal.h"
|
||||
|
||||
@@ -70,11 +71,11 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: pthread_join
|
||||
* Name: pthread_join
|
||||
*
|
||||
* Description:
|
||||
* A thread can await termination of another thread and
|
||||
* retrieve the return value of the thread.
|
||||
* A thread can await termination of another thread and retrieve the
|
||||
* return value of the thread.
|
||||
*
|
||||
* Parameters:
|
||||
* thread
|
||||
@@ -83,12 +84,12 @@
|
||||
* Return Value:
|
||||
* 0 if successful. Otherwise, one of the following error codes:
|
||||
*
|
||||
* EINVAL The value specified by thread does not refer to a
|
||||
* joinable thread.
|
||||
* ESRCH No thread could be found corresponding to that
|
||||
* specified by the given thread ID.
|
||||
* EDEADLK A deadlock was detected or the value of thread
|
||||
* specifies the calling thread.
|
||||
* EINVAL The value specified by thread does not refer to ajoinable
|
||||
* thread.
|
||||
* ESRCH No thread could be found corresponding to thatspecified by the
|
||||
* given thread ID.
|
||||
* EDEADLK A deadlock was detected or the value of thread specifies the
|
||||
* calling thread.
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
@@ -236,8 +237,8 @@ int pthread_join(pthread_t thread, FAR pthread_addr_t *pexit_value)
|
||||
{
|
||||
(void)pthread_destroyjoin(pjoin);
|
||||
}
|
||||
(void)pthread_givesemaphore(&g_join_semaphore);
|
||||
|
||||
(void)pthread_givesemaphore(&g_join_semaphore);
|
||||
ret = OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/pthread_keycreate.c
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -70,45 +70,39 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: pthread_key_create
|
||||
* Name: pthread_key_create
|
||||
*
|
||||
* Description:
|
||||
* This function creates a thread-specific data key visible
|
||||
* to all threads in the system. Although the same key value
|
||||
* may be used by different threads, the values bound to
|
||||
* the key by pthread_setspecific() are maintained on a
|
||||
* per-thread basis and persist for the life of the calling
|
||||
* This function creates a thread-specific data key visible to all threads
|
||||
* in the system. Although the same key value may be used by different
|
||||
* threads, the values bound to the key by pthread_setspecific() are
|
||||
* maintained on a per-thread basis and persist for the life of the calling
|
||||
* thread.
|
||||
*
|
||||
* Upon key creation, the value NULL will be associated with
|
||||
* the new key in all active threads. Upon thread
|
||||
* creation, the value NULL will be associated with all
|
||||
* defined keys in the new thread.
|
||||
* Upon key creation, the value NULL will be associated with the new key
|
||||
* in all active threads. Upon thread creation, the value NULL will be
|
||||
* associated with all defined keys in the new thread.
|
||||
*
|
||||
* Parameters:
|
||||
* key = A pointer to the key to create.
|
||||
* destructor = An optional destructor() function that may
|
||||
* be associated with each key that is invoked when a
|
||||
* thread exits. However, this argument is ignored in
|
||||
* the current implementation.
|
||||
* destructor = An optional destructor() function that may be associated
|
||||
* with each key that is invoked when a thread exits. However, this
|
||||
* argument is ignored in the current implementation.
|
||||
*
|
||||
* Return Value:
|
||||
* If successful, the pthread_key_create() function will
|
||||
* store the newly created key value at *key and return
|
||||
* zero (OK). Otherwise, an error number will be
|
||||
* returned to indicate the error:
|
||||
* If successful, the pthread_key_create() function will store the newly
|
||||
* created key value at *key and return zero (OK). Otherwise, an error
|
||||
* number will bereturned to indicate the error:
|
||||
*
|
||||
* EAGAIN - The system lacked sufficient resources
|
||||
* to create another thread-specific data key, or the
|
||||
* system-imposed limit on the total number of keys
|
||||
* pers process {PTHREAD_KEYS_MAX} has been exceeded
|
||||
* EAGAIN - The system lacked sufficient resources to create another
|
||||
* thread-specific data key, or the system-imposed limit on the total
|
||||
* number of keys pers process {PTHREAD_KEYS_MAX} has been exceeded
|
||||
* ENONMEM - Insufficient memory exists to create the key.
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
* POSIX Compatibility:
|
||||
* - The present implementation ignores the destructor
|
||||
* argument.
|
||||
* - The present implementation ignores the destructor argument.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/pthread_keydelete.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -70,12 +70,12 @@
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Function: pthread_key_delete
|
||||
* Name: pthread_key_delete
|
||||
*
|
||||
* Description:
|
||||
* This POSIX function should delete a thread-specific data
|
||||
* key previously returned by pthread_key_create(). However,
|
||||
* this function does nothing in the present implementation.
|
||||
* This POSIX function should delete a thread-specific data key
|
||||
* previously returned by pthread_key_create(). However, this function
|
||||
* does nothing in the present implementation.
|
||||
*
|
||||
* Parameters:
|
||||
* key = the key to delete
|
||||
|
||||
+11
-11
@@ -50,23 +50,22 @@
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Function: pthread_kill
|
||||
* Name: pthread_kill
|
||||
*
|
||||
* Description:
|
||||
* The pthread_kill() system call can be used to send any
|
||||
* signal to a thread. See kill() for further information
|
||||
* as this is just a simple wrapper around the kill()
|
||||
* function.
|
||||
* The pthread_kill() system call can be used to send any signal to a
|
||||
* thread. See kill() for further information as this is just a simple
|
||||
* wrapper around the kill() function.
|
||||
*
|
||||
* Parameters:
|
||||
* thread - The id of the thread to receive the signal. Only
|
||||
* positive, non-zero values of 'thread' are supported.
|
||||
* signo - The signal number to send. If 'signo' is zero,
|
||||
* no signal is sent, but all error checking is performed.
|
||||
* thread - The id of the thread to receive the signal. Only positive,
|
||||
* non-zero values of 'thread' are supported.
|
||||
* signo - The signal number to send. If 'signo' is zero, no signal is
|
||||
* sent, but all error checking is performed.
|
||||
*
|
||||
* Return Value:
|
||||
* On success the signal was send and zero is returned.
|
||||
* On error one of the following error numbers is returned.
|
||||
* On success the signal was send and zero is returned. On error one
|
||||
* of the following error numbers is returned.
|
||||
*
|
||||
* EINVAL An invalid signal was specified.
|
||||
* EPERM The thread does not have permission to send the
|
||||
@@ -89,6 +88,7 @@ int pthread_kill(pthread_t thread, int signo)
|
||||
{
|
||||
ret = get_errno();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/pthread_mutexdestroy.c
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -44,6 +44,7 @@
|
||||
#include <sched.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include "pthread_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
@@ -71,7 +72,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: pthread_mutex_destroy
|
||||
* Name: pthread_mutex_destroy
|
||||
*
|
||||
* Description:
|
||||
* Destroy a mutex.
|
||||
@@ -121,6 +122,7 @@ int pthread_mutex_destroy(FAR pthread_mutex_t *mutex)
|
||||
ret = EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
sched_unlock();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/pthread_mutexinit.c
|
||||
*
|
||||
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -71,7 +71,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: pthread_mutex_init
|
||||
* Name: pthread_mutex_init
|
||||
*
|
||||
* Description:
|
||||
* Create a mutex
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/pthread_mutexlock.c
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -72,35 +72,38 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: pthread_mutex_lock
|
||||
* Name: pthread_mutex_lock
|
||||
*
|
||||
* Description:
|
||||
* The mutex object referenced by mutex is locked by calling pthread_mutex_lock().
|
||||
* If the mutex is already locked, the calling thread blocks until the mutex
|
||||
* becomes available. This operation returns with the mutex object referenced
|
||||
* by mutex in the locked state with the calling thread as its owner.
|
||||
* The mutex object referenced by mutex is locked by calling
|
||||
* pthread_mutex_lock(). If the mutex is already locked, the calling thread
|
||||
* blocks until the mutex becomes available. This operation returns with the
|
||||
* mutex object referenced by mutex in the locked state with the calling
|
||||
* thread as its owner.
|
||||
*
|
||||
* If the mutex type is PTHREAD_MUTEX_NORMAL, deadlock detection is not provided.
|
||||
* Attempting to relock the mutex causes deadlock. If a thread attempts to unlock
|
||||
* a mutex that it has not locked or a mutex which is unlocked, undefined behavior
|
||||
* results.
|
||||
* If the mutex type is PTHREAD_MUTEX_NORMAL, deadlock detection is not
|
||||
* provided. Attempting to relock the mutex causes deadlock. If a thread
|
||||
* attempts to unlock a mutex that it has not locked or a mutex which is
|
||||
* unlocked, undefined behavior results.
|
||||
*
|
||||
* If the mutex type is PTHREAD_MUTEX_ERRORCHECK, then error checking is provided.
|
||||
* If a thread attempts to relock a mutex that it has already locked, an error
|
||||
* will be returned. If a thread attempts to unlock a mutex that it has not
|
||||
* locked or a mutex which is unlocked, an error will be returned.
|
||||
* If the mutex type is PTHREAD_MUTEX_ERRORCHECK, then error checking is
|
||||
* provided. If a thread attempts to relock a mutex that it has already
|
||||
* locked, an error will be returned. If a thread attempts to unlock a
|
||||
* mutex that it has not locked or a mutex which is unlocked, an error will
|
||||
* be returned.
|
||||
*
|
||||
* If the mutex type is PTHREAD_MUTEX_RECURSIVE, then the mutex maintains the concept
|
||||
* of a lock count. When a thread successfully acquires a mutex for the first time,
|
||||
* the lock count is set to one. Every time a thread relocks this mutex, the lock count
|
||||
* is incremented by one. Each time the thread unlocks the mutex, the lock count is
|
||||
* decremented by one. When the lock count reaches zero, the mutex becomes available
|
||||
* for other threads to acquire. If a thread attempts to unlock a mutex that it has
|
||||
* not locked or a mutex which is unlocked, an error will be returned.
|
||||
* If the mutex type is PTHREAD_MUTEX_RECURSIVE, then the mutex maintains
|
||||
* the concept of a lock count. When a thread successfully acquires a mutex
|
||||
* for the first time, the lock count is set to one. Every time a thread
|
||||
* relocks this mutex, the lock count is incremented by one. Each time the
|
||||
* thread unlocks the mutex, the lock count is decremented by one. When the
|
||||
* lock count reaches zero, the mutex becomes available for other threads to
|
||||
* acquire. If a thread attempts to unlock a mutex that it has not locked or
|
||||
* a mutex which is unlocked, an error will be returned.
|
||||
*
|
||||
* If a signal is delivered to a thread waiting for a mutex, upon return from
|
||||
* the signal handler the thread resumes waiting for the mutex as if it was
|
||||
* not interrupted.
|
||||
* If a signal is delivered to a thread waiting for a mutex, upon return
|
||||
* from the signal handler the thread resumes waiting for the mutex as if
|
||||
* it was not interrupted.
|
||||
*
|
||||
* Parameters:
|
||||
* mutex - A reference to the mutex to be locked.
|
||||
@@ -141,16 +144,16 @@ int pthread_mutex_lock(FAR pthread_mutex_t *mutex)
|
||||
#ifdef CONFIG_MUTEX_TYPES
|
||||
if (mutex->type == PTHREAD_MUTEX_RECURSIVE)
|
||||
{
|
||||
/* Yes... just increment the number of locks held and return success */
|
||||
|
||||
mutex->nlocks++;
|
||||
/* Yes... just increment the number of locks held and return success */
|
||||
|
||||
mutex->nlocks++;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
/* No, then we would deadlock... return an error (default behavior
|
||||
* is like PTHREAD_MUTEX_ERRORCHECK)
|
||||
*/
|
||||
/* No, then we would deadlock... return an error (default behavior
|
||||
* is like PTHREAD_MUTEX_ERRORCHECK)
|
||||
*/
|
||||
|
||||
sdbg("Returning EDEADLK\n");
|
||||
ret = EDEADLK;
|
||||
@@ -174,6 +177,7 @@ int pthread_mutex_lock(FAR pthread_mutex_t *mutex)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
sched_unlock();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/pthread_mutextrylock.c
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -45,6 +45,7 @@
|
||||
#include <sched.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include "pthread_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
@@ -72,7 +73,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: pthread_mutex_trylock
|
||||
* Name: pthread_mutex_trylock
|
||||
*
|
||||
* Description:
|
||||
* The function pthread_mutex_trylock() is identical to pthread_mutex_lock()
|
||||
@@ -126,7 +127,7 @@ int pthread_mutex_trylock(FAR pthread_mutex_t *mutex)
|
||||
|
||||
/* Was it not available? */
|
||||
|
||||
else if (*get_errno_ptr() == EAGAIN)
|
||||
else if (get_errno() == EAGAIN)
|
||||
{
|
||||
ret = EBUSY;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/pthread_mutexunlock.c
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -72,7 +72,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: pthread_mutex_unlock
|
||||
* Name: pthread_mutex_unlock
|
||||
*
|
||||
* Description:
|
||||
* The pthread_mutex_unlock() function releases the mutex object referenced
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/pthread_once.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -70,7 +70,7 @@
|
||||
********************************************************************************/
|
||||
|
||||
/********************************************************************************
|
||||
* Function: pthread_once
|
||||
* Name: pthread_once
|
||||
*
|
||||
* Description:
|
||||
* The first call to pthread_once() by any thread with a given once_control,
|
||||
@@ -88,13 +88,15 @@
|
||||
* init_routine - The initialization routine that will be called once.
|
||||
*
|
||||
* Return Value:
|
||||
* 0 (OK) on success or EINVAL if either once_control or init_routine are invalid
|
||||
* 0 (OK) on success or EINVAL if either once_control or init_routine are
|
||||
* invalid
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
********************************************************************************/
|
||||
|
||||
int pthread_once(FAR pthread_once_t *once_control, CODE void (*init_routine)(void))
|
||||
int pthread_once(FAR pthread_once_t *once_control,
|
||||
CODE void (*init_routine)(void))
|
||||
{
|
||||
/* Sanity checks */
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/pthread_removejoininfo.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -65,7 +65,7 @@
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Function: pthread_removejoininfo
|
||||
* Name: pthread_removejoininfo
|
||||
*
|
||||
* Description:
|
||||
* Remove a join_t from the local data set.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* pthread_setcancelstate.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -69,6 +69,10 @@
|
||||
* Public Functions
|
||||
******************************************************************************************/
|
||||
|
||||
/******************************************************************************************
|
||||
* Name: pthread_setcancelstate
|
||||
******************************************************************************************/
|
||||
|
||||
int pthread_setcancelstate(int state, FAR int *oldstate)
|
||||
{
|
||||
_TCB *tcb = (_TCB*)g_readytorun.head;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/********************************************************************************************
|
||||
/****************************************************************************
|
||||
* pthread_setschedparam.c
|
||||
*
|
||||
* Copyright (C) 2007, 2008, 2012 Gregory Nutt. All rights reserved.
|
||||
@@ -31,55 +31,57 @@
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
********************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/********************************************************************************************
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
********************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <pthread.h>
|
||||
#include <sched.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include "pthread_internal.h"
|
||||
|
||||
/********************************************************************************************
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
********************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/********************************************************************************************
|
||||
/****************************************************************************
|
||||
* Private Type Declarations
|
||||
********************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/********************************************************************************************
|
||||
/****************************************************************************
|
||||
* Global Variables
|
||||
********************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/********************************************************************************************
|
||||
/****************************************************************************
|
||||
* Private Variables
|
||||
********************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/********************************************************************************************
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
********************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/********************************************************************************************
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
********************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
/********************************************************************************************
|
||||
* Function: pthread_setschedparam
|
||||
/****************************************************************************
|
||||
* Name: pthread_setschedparam
|
||||
*
|
||||
* Description:
|
||||
* The pthread_setschedparam() functions will set the scheduling policy and
|
||||
* parameters of threads. For SCHED_FIFO and SCHED_RR, the only required
|
||||
* member of the sched_param structure is the priority sched_priority.
|
||||
* The pthread_setschedparam() functions will set the scheduling policy
|
||||
* and parameters of threads. For SCHED_FIFO and SCHED_RR, the only
|
||||
* required member of the sched_param structure is the priority
|
||||
* sched_priority.
|
||||
*
|
||||
* The pthread_setschedparam() function will set the scheduling policy and
|
||||
* associated scheduling parameters for the thread whose thread ID is
|
||||
* given by 'thread' to the policy and associated parameters provided in
|
||||
* 'policy' and 'param', respectively.
|
||||
* The pthread_setschedparam() function will set the scheduling policy
|
||||
* and associated scheduling parameters for the thread whose thread ID
|
||||
* is given by 'thread' to the policy and associated parameters provided
|
||||
* in 'policy' and 'param', respectively.
|
||||
*
|
||||
* The policy parameter may have the value SCHED_FIFO, or SCHED_RR
|
||||
* (SCHED_OTHER and SCHED_SPORADIC, in particular, are not supported).
|
||||
@@ -99,8 +101,9 @@
|
||||
* 0 if successful. Otherwise, an error code identifying the cause of the
|
||||
* failure:
|
||||
*
|
||||
* EINVAL The value specified by 'policy' or one of the scheduling parameters
|
||||
* associated with the scheduling policy 'policy' is invalid.
|
||||
* EINVAL The value specified by 'policy' or one of the scheduling
|
||||
* parameters associated with the scheduling policy 'policy' is
|
||||
* invalid.
|
||||
* ENOTSUP An attempt was made to set the policy or scheduling parameters
|
||||
* to an unsupported value (SCHED_OTHER and SCHED_SPORADIC in
|
||||
* particular are not supported)
|
||||
@@ -113,7 +116,7 @@
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
********************************************************************************************/
|
||||
****************************************************************************/
|
||||
|
||||
int pthread_setschedparam(pthread_t thread, int policy, FAR const struct sched_param *param)
|
||||
{
|
||||
@@ -123,7 +126,7 @@ int pthread_setschedparam(pthread_t thread, int policy, FAR const struct sched_p
|
||||
|
||||
/* Set the errno to some non-zero value (failsafe) */
|
||||
|
||||
*get_errno_ptr() = EINVAL;
|
||||
set_errno(EINVAL);
|
||||
|
||||
/* Let sched_setscheduler do all of the work */
|
||||
|
||||
@@ -132,8 +135,8 @@ int pthread_setschedparam(pthread_t thread, int policy, FAR const struct sched_p
|
||||
{
|
||||
/* If sched_setscheduler() fails, return the errno */
|
||||
|
||||
ret = *get_errno_ptr();
|
||||
ret = get_errno();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* pthread_schedsetprio.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/pthread_setspecific.c
|
||||
*
|
||||
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -70,7 +70,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: pthread_setspecific
|
||||
* Name: pthread_setspecific
|
||||
*
|
||||
* Description:
|
||||
* The pthread_setspecific() function associates a thread-
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* sched/pthread_sigmask.c
|
||||
*
|
||||
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -69,7 +69,7 @@
|
||||
************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* Function: pthread_sigmask
|
||||
* Name: pthread_sigmask
|
||||
*
|
||||
* Description:
|
||||
* This function is a simple wrapper around sigprocmask().
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user