mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 07:12:54 +08:00
tools/nxstyle.c: Fix logic that detects if an operator is correctly delimited with spaces. sched/: Various changes because sched/ C files were used as Guinea Pigs to test nstyle.c.
This commit is contained in:
@@ -903,15 +903,24 @@ o pthreads (sched/pthreads libs/libc/pthread)
|
||||
|
||||
1. The Use is not fully verified. How are these interfaces
|
||||
used? How should they be tested?
|
||||
|
||||
2. These interfaces depend on architecture specific support
|
||||
support fraom each architecture that support is not be
|
||||
fully available to the pthread library in all cases.
|
||||
|
||||
There should a setting, say CONFIG_ARCH_HAVE_TESTSET=y
|
||||
that indicates if the architect provides up_testset().
|
||||
|
||||
3. It is also restricted to CONFIG_BUILD_FLAT because the
|
||||
critical test and set function (up_testset()) as
|
||||
prototyped in include/nuttx/spinlock() does not permit an
|
||||
inline function or macro to be used in user-mode
|
||||
application space.
|
||||
|
||||
Update: A better alternative would be to move the CPU-
|
||||
depending up_testset() implementation from the arch/
|
||||
directories and into libs/libc/machine.
|
||||
|
||||
For these reasons, the selection is marked EXPERIMENTAL.
|
||||
Status: Open
|
||||
Priority: Low. These are new interfaces and not yet in wide use. The
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
|
||||
/* Stack alignment macros */
|
||||
|
||||
#define STACK_ALIGN_MASK (CONFIG_STACK_ALIGNMENT-1)
|
||||
#define STACK_ALIGN_MASK (CONFIG_STACK_ALIGNMENT - 1)
|
||||
#define STACK_ALIGN_DOWN(a) ((a) & ~STACK_ALIGN_MASK)
|
||||
#define STACK_ALIGN_UP(a) (((a) + STACK_ALIGN_MASK) & ~STACK_ALIGN_MASK)
|
||||
|
||||
|
||||
@@ -51,7 +51,10 @@
|
||||
|
||||
/* 23 * (month + 1) / 9, month = 0..11 */
|
||||
|
||||
static const uint8_t g_lookup[12] = {2, 5, 7, 10, 12, 15, 17, 20, 23, 25, 28, 30};
|
||||
static const uint8_t g_lookup[12] =
|
||||
{
|
||||
2, 5, 7, 10, 12, 15, 17, 20, 23, 25, 28, 30
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
|
||||
@@ -293,7 +293,9 @@ void clock_synchronize(void)
|
||||
#if defined(CONFIG_RTC) && !defined(CONFIG_SCHED_TICKLESS)
|
||||
void clock_resynchronize(FAR struct timespec *rtc_diff)
|
||||
{
|
||||
struct timespec rtc_time, bias, curr_ts;
|
||||
struct timespec rtc_time;
|
||||
struct timespec bias;
|
||||
struct timespec curr_ts;
|
||||
struct timespec rtc_diff_tmp;
|
||||
irqstate_t flags;
|
||||
int32_t carry;
|
||||
|
||||
@@ -137,6 +137,3 @@ int env_dup(FAR struct task_group_s *group)
|
||||
}
|
||||
|
||||
#endif /* CONFIG_DISABLE_ENVIRON */
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -114,6 +114,3 @@ errout:
|
||||
}
|
||||
|
||||
#endif /* CONFIG_DISABLE_ENVIRON */
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -95,6 +95,3 @@ void env_release(FAR struct task_group_s *group)
|
||||
}
|
||||
|
||||
#endif /* CONFIG_DISABLE_ENVIRON */
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -115,6 +115,3 @@ int env_removevar(FAR struct task_group_s *group, FAR char *pvar)
|
||||
}
|
||||
|
||||
#endif /* CONFIG_DISABLE_ENVIRON */
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -133,6 +133,3 @@ int unsetenv(FAR const char *name)
|
||||
}
|
||||
|
||||
#endif /* CONFIG_DISABLE_ENVIRON */
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Is this worth making a configuration option? */
|
||||
|
||||
#define GROUP_REALLOC_MEMBERS 4
|
||||
|
||||
@@ -116,7 +116,7 @@ static int group_killchildren_handler(pid_t pid, FAR void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
/* Always return zero. We need to visit each member of the group*/
|
||||
/* Always return zero. We need to visit each member of the group. */
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ static int group_suspendchildren_handler(pid_t pid, FAR void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
/* Always return zero. We need to visit each member of the group*/
|
||||
/* Always return zero. We need to visit each member of the group. */
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -122,8 +122,8 @@ int nxmq_send(mqd_t mqdes, FAR const char *msg, size_t msglen,
|
||||
|
||||
if (msgq->nmsgs >= msgq->maxmsgs) /* Message queue not-FULL? */
|
||||
{
|
||||
/* Yes.. the message queue is full. Wait for space to become
|
||||
* available in the message queue.
|
||||
/* Yes.. the message queue is full. Wait for space to become
|
||||
* available in the message queue.
|
||||
*/
|
||||
|
||||
ret = nxmq_wait_send(mqdes);
|
||||
|
||||
@@ -121,5 +121,3 @@ int pthread_cond_broadcast(FAR pthread_cond_t *cond)
|
||||
sinfo("Returning %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -113,5 +113,3 @@ int pthread_cond_signal(FAR pthread_cond_t *cond)
|
||||
sinfo("Returning %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -211,6 +211,3 @@ int pthread_mutex_trylock(FAR pthread_mutex_t *mutex)
|
||||
sinfo("Returning %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -199,45 +199,43 @@ int pthread_mutex_unlock(FAR pthread_mutex_t *mutex)
|
||||
#endif /* !CONFIG_PTHREAD_MUTEX_UNSAFE || CONFIG_PTHREAD_MUTEX_TYPES */
|
||||
|
||||
#ifdef CONFIG_PTHREAD_MUTEX_TYPES
|
||||
/* Yes, the caller owns the semaphore.. Is this a recursive mutex? */
|
||||
/* Yes, the caller owns the semaphore.. Is this a recursive mutex? */
|
||||
|
||||
if (mutex->type == PTHREAD_MUTEX_RECURSIVE && mutex->nlocks > 1)
|
||||
{
|
||||
/* This is a recursive mutex and we there are multiple locks held. Retain
|
||||
* the mutex lock, just decrement the count of locks held, and return
|
||||
* success.
|
||||
*/
|
||||
if (mutex->type == PTHREAD_MUTEX_RECURSIVE && mutex->nlocks > 1)
|
||||
{
|
||||
/* This is a recursive mutex and we there are multiple locks held. Retain
|
||||
* the mutex lock, just decrement the count of locks held, and return
|
||||
* success.
|
||||
*/
|
||||
|
||||
mutex->nlocks--;
|
||||
ret = OK;
|
||||
}
|
||||
else
|
||||
mutex->nlocks--;
|
||||
ret = OK;
|
||||
}
|
||||
else
|
||||
|
||||
#endif /* CONFIG_PTHREAD_MUTEX_TYPES */
|
||||
|
||||
/* This is either a non-recursive mutex or is the outermost unlock of
|
||||
* a recursive mutex.
|
||||
*
|
||||
* In the case where the calling thread is NOT the holder of the thread,
|
||||
* the behavior is undefined per POSIX. Here we do the same as GLIBC:
|
||||
* We allow the other thread to release the mutex even though it does
|
||||
* not own it.
|
||||
*/
|
||||
/* This is either a non-recursive mutex or is the outermost unlock of
|
||||
* a recursive mutex.
|
||||
*
|
||||
* In the case where the calling thread is NOT the holder of the thread,
|
||||
* the behavior is undefined per POSIX. Here we do the same as GLIBC:
|
||||
* We allow the other thread to release the mutex even though it does
|
||||
* not own it.
|
||||
*/
|
||||
|
||||
{
|
||||
/* Nullify the pid and lock count then post the semaphore */
|
||||
{
|
||||
/* Nullify the pid and lock count then post the semaphore */
|
||||
|
||||
mutex->pid = -1;
|
||||
mutex->pid = -1;
|
||||
#ifdef CONFIG_PTHREAD_MUTEX_TYPES
|
||||
mutex->nlocks = 0;
|
||||
mutex->nlocks = 0;
|
||||
#endif
|
||||
ret = pthread_mutex_give(mutex);
|
||||
}
|
||||
ret = pthread_mutex_give(mutex);
|
||||
}
|
||||
}
|
||||
|
||||
sched_unlock();
|
||||
sinfo("Returning %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -90,5 +90,3 @@ void sched_foreach(sched_foreach_t handler, FAR void *arg)
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -72,5 +72,3 @@ FAR struct socketlist *sched_getsockets(void)
|
||||
return &group->tg_socketlist;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -83,7 +83,8 @@ FAR sigq_t *nxsig_alloc_pendingsigaction(void)
|
||||
}
|
||||
|
||||
/* If we were not called from an interrupt handler, then we are
|
||||
* free to allocate pending signal action structures if necessary. */
|
||||
* free to allocate pending signal action structures if necessary.
|
||||
*/
|
||||
|
||||
else
|
||||
{
|
||||
|
||||
@@ -512,8 +512,9 @@ bool nxsig_iscatchable(int signo)
|
||||
|
||||
if (handler == SIG_IGN)
|
||||
{
|
||||
/* We are unsetting the default action */
|
||||
/* sigdelset() is not atomic (but neither is sigaction()) */
|
||||
/* We are unsetting the default action. NOTE that sigdelset() is not
|
||||
* atomic (but neither is sigaction()).
|
||||
*/
|
||||
|
||||
flags = spin_lock_irqsave();
|
||||
(void)sigdelset(&group->tg_sigdefault, signo);
|
||||
|
||||
@@ -93,7 +93,8 @@ static int nxsig_queue_action(FAR struct tcb_s *stcb, siginfo_t *info)
|
||||
{
|
||||
/* Allocate a new element for the signal queue. NOTE:
|
||||
* nxsig_alloc_pendingsigaction will force a system crash if it is
|
||||
* unable to allocate memory for the signal data */
|
||||
* unable to allocate memory for the signal data.
|
||||
*/
|
||||
|
||||
sigq = nxsig_alloc_pendingsigaction();
|
||||
if (!sigq)
|
||||
|
||||
@@ -68,7 +68,8 @@ void nxsig_release_pendingsigaction(FAR sigq_t *sigq)
|
||||
if (sigq->type == SIG_ALLOC_FIXED)
|
||||
{
|
||||
/* Make sure we avoid concurrent access to the free
|
||||
* list from interrupt handlers. */
|
||||
* list from interrupt handlers.
|
||||
*/
|
||||
|
||||
flags = enter_critical_section();
|
||||
sq_addlast((FAR sq_entry_t *)sigq, &g_sigpendingaction);
|
||||
@@ -82,7 +83,8 @@ void nxsig_release_pendingsigaction(FAR sigq_t *sigq)
|
||||
else if (sigq->type == SIG_ALLOC_IRQ)
|
||||
{
|
||||
/* Make sure we avoid concurrent access to the free
|
||||
* list from interrupt handlers. */
|
||||
* list from interrupt handlers.
|
||||
*/
|
||||
|
||||
flags = enter_critical_section();
|
||||
sq_addlast((FAR sq_entry_t *)sigq, &g_sigpendingirqaction);
|
||||
|
||||
@@ -434,14 +434,14 @@ int nxsig_timedwait(FAR const sigset_t *set, FAR struct siginfo *info,
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
/* We were awakened by a timeout. Set EAGAIN and return an
|
||||
* error.
|
||||
*/
|
||||
{
|
||||
/* We were awakened by a timeout. Set EAGAIN and return an
|
||||
* error.
|
||||
*/
|
||||
|
||||
DEBUGASSERT(rtcb->sigunbinfo.si_signo == SIG_WAIT_TIMEOUT);
|
||||
ret = -EAGAIN;
|
||||
}
|
||||
DEBUGASSERT(rtcb->sigunbinfo.si_signo == SIG_WAIT_TIMEOUT);
|
||||
ret = -EAGAIN;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return the signal info to the caller if so requested */
|
||||
|
||||
@@ -152,5 +152,3 @@ int atexit(void (*func)(void))
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SCHED_ATEXIT */
|
||||
|
||||
|
||||
|
||||
@@ -149,5 +149,3 @@ int on_exit(CODE void (*func)(int, FAR void *), FAR void *arg)
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SCHED_ONEXIT */
|
||||
|
||||
|
||||
|
||||
@@ -324,7 +324,8 @@ void work_notifier_signal(enum work_evtype_e evtype,
|
||||
sched_lock();
|
||||
|
||||
/* Process the notification at the head of the pending list until the
|
||||
* pending list is empty */
|
||||
* pending list is empty
|
||||
*/
|
||||
|
||||
for (entry = dq_peek(&g_notifier_pending);
|
||||
entry != NULL;
|
||||
|
||||
+295
-155
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user