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:
Gregory Nutt
2019-03-01 10:50:02 -06:00
parent 4942867fcf
commit f914ec6e2b
28 changed files with 362 additions and 233 deletions
+9
View File
@@ -903,15 +903,24 @@ o pthreads (sched/pthreads libs/libc/pthread)
1. The Use is not fully verified. How are these interfaces 1. The Use is not fully verified. How are these interfaces
used? How should they be tested? used? How should they be tested?
2. These interfaces depend on architecture specific support 2. These interfaces depend on architecture specific support
support fraom each architecture that support is not be support fraom each architecture that support is not be
fully available to the pthread library in all cases. 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 3. It is also restricted to CONFIG_BUILD_FLAT because the
critical test and set function (up_testset()) as critical test and set function (up_testset()) as
prototyped in include/nuttx/spinlock() does not permit an prototyped in include/nuttx/spinlock() does not permit an
inline function or macro to be used in user-mode inline function or macro to be used in user-mode
application space. 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. For these reasons, the selection is marked EXPERIMENTAL.
Status: Open Status: Open
Priority: Low. These are new interfaces and not yet in wide use. The Priority: Low. These are new interfaces and not yet in wide use. The
+1 -1
View File
@@ -74,7 +74,7 @@
/* Stack alignment macros */ /* 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_DOWN(a) ((a) & ~STACK_ALIGN_MASK)
#define STACK_ALIGN_UP(a) (((a) + STACK_ALIGN_MASK) & ~STACK_ALIGN_MASK) #define STACK_ALIGN_UP(a) (((a) + STACK_ALIGN_MASK) & ~STACK_ALIGN_MASK)
+4 -1
View File
@@ -51,7 +51,10 @@
/* 23 * (month + 1) / 9, month = 0..11 */ /* 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 * Public Functions
+3 -1
View File
@@ -293,7 +293,9 @@ void clock_synchronize(void)
#if defined(CONFIG_RTC) && !defined(CONFIG_SCHED_TICKLESS) #if defined(CONFIG_RTC) && !defined(CONFIG_SCHED_TICKLESS)
void clock_resynchronize(FAR struct timespec *rtc_diff) 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; struct timespec rtc_diff_tmp;
irqstate_t flags; irqstate_t flags;
int32_t carry; int32_t carry;
-3
View File
@@ -137,6 +137,3 @@ int env_dup(FAR struct task_group_s *group)
} }
#endif /* CONFIG_DISABLE_ENVIRON */ #endif /* CONFIG_DISABLE_ENVIRON */
-3
View File
@@ -114,6 +114,3 @@ errout:
} }
#endif /* CONFIG_DISABLE_ENVIRON */ #endif /* CONFIG_DISABLE_ENVIRON */
-3
View File
@@ -95,6 +95,3 @@ void env_release(FAR struct task_group_s *group)
} }
#endif /* CONFIG_DISABLE_ENVIRON */ #endif /* CONFIG_DISABLE_ENVIRON */
-3
View File
@@ -115,6 +115,3 @@ int env_removevar(FAR struct task_group_s *group, FAR char *pvar)
} }
#endif /* CONFIG_DISABLE_ENVIRON */ #endif /* CONFIG_DISABLE_ENVIRON */
-3
View File
@@ -133,6 +133,3 @@ int unsetenv(FAR const char *name)
} }
#endif /* CONFIG_DISABLE_ENVIRON */ #endif /* CONFIG_DISABLE_ENVIRON */
+1
View File
@@ -56,6 +56,7 @@
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* Is this worth making a configuration option? */ /* Is this worth making a configuration option? */
#define GROUP_REALLOC_MEMBERS 4 #define GROUP_REALLOC_MEMBERS 4
+1 -1
View File
@@ -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; return OK;
} }
+1 -1
View File
@@ -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; return OK;
} }
+2 -2
View File
@@ -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? */ if (msgq->nmsgs >= msgq->maxmsgs) /* Message queue not-FULL? */
{ {
/* Yes.. the message queue is full. Wait for space to become /* Yes.. the message queue is full. Wait for space to become
* available in the message queue. * available in the message queue.
*/ */
ret = nxmq_wait_send(mqdes); ret = nxmq_wait_send(mqdes);
-2
View File
@@ -121,5 +121,3 @@ int pthread_cond_broadcast(FAR pthread_cond_t *cond)
sinfo("Returning %d\n", ret); sinfo("Returning %d\n", ret);
return ret; return ret;
} }
-2
View File
@@ -113,5 +113,3 @@ int pthread_cond_signal(FAR pthread_cond_t *cond)
sinfo("Returning %d\n", ret); sinfo("Returning %d\n", ret);
return ret; return ret;
} }
-3
View File
@@ -211,6 +211,3 @@ int pthread_mutex_trylock(FAR pthread_mutex_t *mutex)
sinfo("Returning %d\n", ret); sinfo("Returning %d\n", ret);
return ret; return ret;
} }
+25 -27
View File
@@ -199,45 +199,43 @@ int pthread_mutex_unlock(FAR pthread_mutex_t *mutex)
#endif /* !CONFIG_PTHREAD_MUTEX_UNSAFE || CONFIG_PTHREAD_MUTEX_TYPES */ #endif /* !CONFIG_PTHREAD_MUTEX_UNSAFE || CONFIG_PTHREAD_MUTEX_TYPES */
#ifdef 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) if (mutex->type == PTHREAD_MUTEX_RECURSIVE && mutex->nlocks > 1)
{ {
/* This is a recursive mutex and we there are multiple locks held. Retain /* 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 * the mutex lock, just decrement the count of locks held, and return
* success. * success.
*/ */
mutex->nlocks--; mutex->nlocks--;
ret = OK; ret = OK;
} }
else else
#endif /* CONFIG_PTHREAD_MUTEX_TYPES */ #endif /* CONFIG_PTHREAD_MUTEX_TYPES */
/* This is either a non-recursive mutex or is the outermost unlock of /* This is either a non-recursive mutex or is the outermost unlock of
* a recursive mutex. * a recursive mutex.
* *
* In the case where the calling thread is NOT the holder of the thread, * 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: * 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 * We allow the other thread to release the mutex even though it does
* not own it. * 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 #ifdef CONFIG_PTHREAD_MUTEX_TYPES
mutex->nlocks = 0; mutex->nlocks = 0;
#endif #endif
ret = pthread_mutex_give(mutex); ret = pthread_mutex_give(mutex);
} }
} }
sched_unlock(); sched_unlock();
sinfo("Returning %d\n", ret); sinfo("Returning %d\n", ret);
return ret; return ret;
} }
-2
View File
@@ -90,5 +90,3 @@ void sched_foreach(sched_foreach_t handler, FAR void *arg)
leave_critical_section(flags); leave_critical_section(flags);
} }
} }
-2
View File
@@ -72,5 +72,3 @@ FAR struct socketlist *sched_getsockets(void)
return &group->tg_socketlist; return &group->tg_socketlist;
} }
#endif #endif
+2 -1
View File
@@ -83,7 +83,8 @@ FAR sigq_t *nxsig_alloc_pendingsigaction(void)
} }
/* If we were not called from an interrupt handler, then we are /* 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 else
{ {
+3 -2
View File
@@ -512,8 +512,9 @@ bool nxsig_iscatchable(int signo)
if (handler == SIG_IGN) if (handler == SIG_IGN)
{ {
/* We are unsetting the default action */ /* We are unsetting the default action. NOTE that sigdelset() is not
/* sigdelset() is not atomic (but neither is sigaction()) */ * atomic (but neither is sigaction()).
*/
flags = spin_lock_irqsave(); flags = spin_lock_irqsave();
(void)sigdelset(&group->tg_sigdefault, signo); (void)sigdelset(&group->tg_sigdefault, signo);
+2 -1
View File
@@ -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: /* Allocate a new element for the signal queue. NOTE:
* nxsig_alloc_pendingsigaction will force a system crash if it is * 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(); sigq = nxsig_alloc_pendingsigaction();
if (!sigq) if (!sigq)
+4 -2
View File
@@ -68,7 +68,8 @@ void nxsig_release_pendingsigaction(FAR sigq_t *sigq)
if (sigq->type == SIG_ALLOC_FIXED) if (sigq->type == SIG_ALLOC_FIXED)
{ {
/* Make sure we avoid concurrent access to the free /* Make sure we avoid concurrent access to the free
* list from interrupt handlers. */ * list from interrupt handlers.
*/
flags = enter_critical_section(); flags = enter_critical_section();
sq_addlast((FAR sq_entry_t *)sigq, &g_sigpendingaction); 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) else if (sigq->type == SIG_ALLOC_IRQ)
{ {
/* Make sure we avoid concurrent access to the free /* Make sure we avoid concurrent access to the free
* list from interrupt handlers. */ * list from interrupt handlers.
*/
flags = enter_critical_section(); flags = enter_critical_section();
sq_addlast((FAR sq_entry_t *)sigq, &g_sigpendingirqaction); sq_addlast((FAR sq_entry_t *)sigq, &g_sigpendingirqaction);
+7 -7
View File
@@ -434,14 +434,14 @@ int nxsig_timedwait(FAR const sigset_t *set, FAR struct siginfo *info,
} }
else else
#endif #endif
{ {
/* We were awakened by a timeout. Set EAGAIN and return an /* We were awakened by a timeout. Set EAGAIN and return an
* error. * error.
*/ */
DEBUGASSERT(rtcb->sigunbinfo.si_signo == SIG_WAIT_TIMEOUT); DEBUGASSERT(rtcb->sigunbinfo.si_signo == SIG_WAIT_TIMEOUT);
ret = -EAGAIN; ret = -EAGAIN;
} }
} }
/* Return the signal info to the caller if so requested */ /* Return the signal info to the caller if so requested */
-2
View File
@@ -152,5 +152,3 @@ int atexit(void (*func)(void))
} }
#endif /* CONFIG_SCHED_ATEXIT */ #endif /* CONFIG_SCHED_ATEXIT */
-2
View File
@@ -149,5 +149,3 @@ int on_exit(CODE void (*func)(int, FAR void *), FAR void *arg)
} }
#endif /* CONFIG_SCHED_ONEXIT */ #endif /* CONFIG_SCHED_ONEXIT */
+2 -1
View File
@@ -324,7 +324,8 @@ void work_notifier_signal(enum work_evtype_e evtype,
sched_lock(); sched_lock();
/* Process the notification at the head of the pending list until the /* 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); for (entry = dq_peek(&g_notifier_pending);
entry != NULL; entry != NULL;
+295 -155
View File
File diff suppressed because it is too large Load Diff