diff options
author | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2007-02-20 22:39:56 +0000 |
---|---|---|
committer | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2007-02-20 22:39:56 +0000 |
commit | 560c075bdd4e219ade2299ccdcd032e314d626b8 (patch) | |
tree | f640e5eab1ce66cdeadd0ab3684ea326f56db8a5 /nuttx/sched | |
parent | 93d21048f12d9196232562508f4a8c9002432613 (diff) |
Eliminating GCC dependencies
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@14 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/sched')
55 files changed, 129 insertions, 244 deletions
diff --git a/nuttx/sched/Makefile b/nuttx/sched/Makefile index ebc27785d5..9872c7f02b 100644 --- a/nuttx/sched/Makefile +++ b/nuttx/sched/Makefile @@ -76,8 +76,7 @@ PTHREAD_SRCS = pthread_attrinit.c pthread_attrdestroy.c \ pthread_attrsetstacksize.c pthread_attrgetstacksize.c \ pthread_attrsetschedparam.c pthread_attrgetschedparam.c \ pthread_create.c pthread_exit.c pthread_join.c pthread_detach.c \ - pthread_yield.c pthread_self.c \ - pthread_getschedparam.c pthread_setschedparam.c \ + pthread_yield.c pthread_getschedparam.c pthread_setschedparam.c \ pthread_mutexattrinit.c pthread_mutexattrdestroy.c \ pthread_mutexattrgetpshared.c pthread_mutexattrsetpshared.c \ pthread_mutexinit.c pthread_mutexdestroy.c \ diff --git a/nuttx/sched/clock_getres.c b/nuttx/sched/clock_getres.c index 5cf07f2499..b3d6247db6 100644 --- a/nuttx/sched/clock_getres.c +++ b/nuttx/sched/clock_getres.c @@ -88,13 +88,13 @@ int clock_getres(clockid_t clock_id, struct timespec *res) uint32 time_res; int ret = OK; - dbg("%s: clock_id=%d\n", __FUNCTION__, clock_id); + dbg("clock_id=%d\n", clock_id); /* Only CLOCK_REALTIME is supported */ if (clock_id != CLOCK_REALTIME) { - dbg("%s: Returning ERROR\n", __FUNCTION__); + dbg("Returning ERROR\n"); *get_errno_ptr() = EINVAL; ret = ERROR; } @@ -109,8 +109,7 @@ int clock_getres(clockid_t clock_id, struct timespec *res) res->tv_sec = 0; res->tv_nsec = time_res; - dbg("%s: Returning res=(%d,%d) time_res=%d\n", - __FUNCTION__, + dbg("Returning res=(%d,%d) time_res=%d\n", (int)res->tv_sec, (int)res->tv_nsec, (int)time_res); } diff --git a/nuttx/sched/clock_gettime.c b/nuttx/sched/clock_gettime.c index ac9270975c..941d49e297 100644 --- a/nuttx/sched/clock_gettime.c +++ b/nuttx/sched/clock_gettime.c @@ -90,13 +90,13 @@ int clock_gettime(clockid_t clock_id, struct timespec *tp) uint32 nsecs; int ret = OK; - dbg("%s: clock_id=%d\n", __FUNCTION__, clock_id); + dbg("clock_id=%d\n", clock_id); /* Only CLOCK_REALTIME is supported */ if (clock_id != CLOCK_REALTIME) { - dbg("%s: Returning ERROR\n", __FUNCTION__); + dbg("Returning ERROR\n"); *get_errno_ptr() = EINVAL; ret = ERROR; @@ -109,7 +109,7 @@ int clock_gettime(clockid_t clock_id, struct timespec *tp) msecs = MSEC_PER_TICK * (g_system_timer - g_tickbias); - dbg("%s: msecs = %d g_tickbias=%d\n", __FUNCTION__, + dbg("msecs = %d g_tickbias=%d\n", (int)msecs, (int)g_tickbias); /* Get the elapsed time in seconds and nanoseconds. */ @@ -117,7 +117,7 @@ int clock_gettime(clockid_t clock_id, struct timespec *tp) secs = msecs / MSEC_PER_SEC; nsecs = (msecs - (secs * MSEC_PER_SEC)) * NSEC_PER_MSEC; - dbg("%s: secs = %d + %d nsecs = %d + %d\n", __FUNCTION__, + dbg("secs = %d + %d nsecs = %d + %d\n", (int)msecs, (int)g_basetime.tv_sec, (int)nsecs, (int)g_basetime.tv_nsec); @@ -140,7 +140,7 @@ int clock_gettime(clockid_t clock_id, struct timespec *tp) tp->tv_sec = (time_t)secs; tp->tv_nsec = (long)nsecs; - dbg("%s: Returning tp=(%d,%d)\n", __FUNCTION__, + dbg("Returning tp=(%d,%d)\n", (int)tp->tv_sec, (int)tp->tv_nsec); } diff --git a/nuttx/sched/clock_settime.c b/nuttx/sched/clock_settime.c index c57fb28088..5f565ea36b 100644 --- a/nuttx/sched/clock_settime.c +++ b/nuttx/sched/clock_settime.c @@ -87,13 +87,13 @@ int clock_settime(clockid_t clock_id, const struct timespec *tp) { int ret = OK; - dbg("%s: clock_id=%d\n", __FUNCTION__, clock_id); + dbg("clock_id=%d\n", clock_id); /* Only CLOCK_REALTIME is supported */ if (clock_id != CLOCK_REALTIME || !tp) { - dbg("%s: Returning ERROR\n", __FUNCTION__); + dbg("Returning ERROR\n"); *get_errno_ptr() = EINVAL; ret = ERROR; } @@ -109,8 +109,7 @@ int clock_settime(clockid_t clock_id, const struct timespec *tp) g_tickbias = g_system_timer; - dbg("%s: basetime=(%d,%d) tickbias=%d\n", - __FUNCTION__, + dbg("basetime=(%d,%d) tickbias=%d\n", (int)g_basetime.tv_sec, (int)g_basetime.tv_nsec, (int)g_tickbias); } diff --git a/nuttx/sched/gmtime_r.c b/nuttx/sched/gmtime_r.c index 8661d73b7b..bf9923bb34 100644 --- a/nuttx/sched/gmtime_r.c +++ b/nuttx/sched/gmtime_r.c @@ -177,7 +177,7 @@ struct tm *gmtime_r(const time_t *clock, struct tm *result) /* Get the seconds since the EPOCH */ time = *clock; - dbg("%s: clock=%d\n", __FUNCTION__, (int)time); + dbg("clock=%d\n", (int)time); /* Convert to days, hours, minutes, and seconds since the EPOCH */ @@ -192,14 +192,14 @@ struct tm *gmtime_r(const time_t *clock, struct tm *result) sec = time; - dbg("%s: hour=%d min=%d sec=%d\n", __FUNCTION__, + dbg("hour=%d min=%d sec=%d\n", (int)hour, (int)min, (int)sec); /* Convert the days since the EPOCH to calendar day */ clock_utc2calendar(jdn, &year, &month, &day); - dbg("%s: jdn=%d year=%d month=%d day=%d\n", __FUNCTION__, + dbg("jdn=%d year=%d month=%d day=%d\n", (int)jdn, (int)year, (int)month, (int)day); /* Then return the struct tm contents */ diff --git a/nuttx/sched/irq_dispatch.c b/nuttx/sched/irq_dispatch.c index f783b2f54d..d6466cbc0d 100644 --- a/nuttx/sched/irq_dispatch.c +++ b/nuttx/sched/irq_dispatch.c @@ -76,7 +76,7 @@ * ***********************************************************/ -void irq_dispatch(int irq, struct xcptcontext *xcp) +void irq_dispatch(int irq, void *context) { xcpt_t vector; @@ -93,6 +93,6 @@ void irq_dispatch(int irq, struct xcptcontext *xcp) /* Then dispatch to the interrupt handler */ - vector(irq, xcp); + vector(irq, context); } diff --git a/nuttx/sched/irq_internal.h b/nuttx/sched/irq_internal.h index a11120f55c..211779bc37 100644 --- a/nuttx/sched/irq_internal.h +++ b/nuttx/sched/irq_internal.h @@ -71,7 +71,7 @@ extern "C" { #endif EXTERN void weak_function irq_initialize(void); -EXTERN int irq_unexpected_isr(int irq, struct xcptcontext *xcp); +EXTERN int irq_unexpected_isr(int irq, void *context); #undef EXTERN #ifdef __cplusplus diff --git a/nuttx/sched/irq_unexpectedisr.c b/nuttx/sched/irq_unexpectedisr.c index c235c53a88..6ca3e1da83 100644 --- a/nuttx/sched/irq_unexpectedisr.c +++ b/nuttx/sched/irq_unexpectedisr.c @@ -75,7 +75,7 @@ * ************************************************************/ -int irq_unexpected_isr(int irq, struct xcptcontext *xcp) +int irq_unexpected_isr(int irq, void *context) { (void)irqsave(); PANIC(OSERR_UNEXPECTEDISR); diff --git a/nuttx/sched/mktime.c b/nuttx/sched/mktime.c index 9c84964633..a0ed379f1a 100644 --- a/nuttx/sched/mktime.c +++ b/nuttx/sched/mktime.c @@ -126,14 +126,14 @@ time_t mktime(struct tm *tp) */ jdn = clock_calendar2utc(tp->tm_year+1900, tp->tm_mon+1, tp->tm_mday); - dbg("%s: jdn=%d tm_year=%d tm_mon=%d tm_mday=%d\n", - __FUNCTION__, (int)jdn, tp->tm_year, tp->tm_mon, tp->tm_mday); + dbg("jdn=%d tm_year=%d tm_mon=%d tm_mday=%d\n", + (int)jdn, tp->tm_year, tp->tm_mon, tp->tm_mday); /* Return the seconds into the julian day. */ ret = ((jdn*24 + tp->tm_hour)*60 + tp->tm_min)*60 + tp->tm_sec; dbg("%s:\tret=%d tm_hour=%d tm_min=%d tm_sec=%d\n", - __FUNCTION__, (int)ret, tp->tm_hour, tp->tm_min, tp->tm_sec); + (int)ret, tp->tm_hour, tp->tm_min, tp->tm_sec); return ret; } diff --git a/nuttx/sched/mq_internal.h b/nuttx/sched/mq_internal.h index 5768bbd706..226835d21e 100644 --- a/nuttx/sched/mq_internal.h +++ b/nuttx/sched/mq_internal.h @@ -138,10 +138,6 @@ struct mq_des int oflags; /* Flags set when message queue was opened */ }; -/* This is the handle used to reference a message queue */ - -typedef struct mq_des *mqd_t; - /************************************************************ * Global Variables ************************************************************/ diff --git a/nuttx/sched/mq_send.c b/nuttx/sched/mq_send.c index b5dda82786..431d8613c9 100644 --- a/nuttx/sched/mq_send.c +++ b/nuttx/sched/mq_send.c @@ -145,7 +145,7 @@ mqmsg_t *mq_msgalloc(void) else { - dbg("%s: Out of messages\n", __FUNCTION__); + dbg("Out of messages\n"); PANIC((uint32)OSERR_OUTOFMESSAGES); } } diff --git a/nuttx/sched/os_start.c b/nuttx/sched/os_start.c index 1b249a5b91..b96a650cbe 100644 --- a/nuttx/sched/os_start.c +++ b/nuttx/sched/os_start.c @@ -192,7 +192,7 @@ void os_start(void) int init_taskid; int i; - lldbg("%s: Entry\n", __FUNCTION__); + lldbg("Entry\n"); /* Initialize all task lists */ @@ -349,7 +349,7 @@ void os_start(void) * started by spawning the user init thread of execution. */ - dbg("%s: Starting init thread\n", __FUNCTION__); + dbg("Starting init thread\n"); init_taskid = task_create("init", SCHED_PRIORITY_DEFAULT, CONFIG_PROC_STACK_SIZE, (main_t)user_start, 0, 0, 0, 0); @@ -357,7 +357,7 @@ void os_start(void) /* When control is return to this point, the system is idle. */ - dbg("%s: Beginning Idle Loop\n", __FUNCTION__); + dbg("Beginning Idle Loop\n"); for (;;) { /* Check if there is anything in the delayed deallocation list. */ diff --git a/nuttx/sched/pthread_attrdestroy.c b/nuttx/sched/pthread_attrdestroy.c index 9bb86268c6..c71fa6271f 100644 --- a/nuttx/sched/pthread_attrdestroy.c +++ b/nuttx/sched/pthread_attrdestroy.c @@ -89,7 +89,7 @@ int pthread_attr_destroy(pthread_attr_t *attr) { int ret; - dbg("%s: attr=0x%p\n", __FUNCTION__, attr); + dbg("attr=0x%p\n", attr); if (!attr) { @@ -101,7 +101,7 @@ int pthread_attr_destroy(pthread_attr_t *attr) ret = OK; } - dbg("%s: Returning %d\n", __FUNCTION__, ret); + dbg("Returning %d\n", ret); return ret; } diff --git a/nuttx/sched/pthread_attrgetinheritsched.c b/nuttx/sched/pthread_attrgetinheritsched.c index d0d3143e75..e1c69346cb 100644 --- a/nuttx/sched/pthread_attrgetinheritsched.c +++ b/nuttx/sched/pthread_attrgetinheritsched.c @@ -92,8 +92,7 @@ int pthread_attr_getinheritsched(const pthread_attr_t *attr, { int ret; - dbg("%s: attr=0x%p inheritsched=0x%p\n", - __FUNCTION__, attr, inheritsched); + dbg("attr=0x%p inheritsched=0x%p\n", attr, inheritsched); if (!attr || !inheritsched) { @@ -105,7 +104,7 @@ int pthread_attr_getinheritsched(const pthread_attr_t *attr, ret = OK; } - dbg("%s: Returning %d\n", __FUNCTION__, ret); + dbg("Returning %d\n", ret); return ret; } diff --git a/nuttx/sched/pthread_attrgetschedparam.c b/nuttx/sched/pthread_attrgetschedparam.c index 2285895e7f..defed57e61 100644 --- a/nuttx/sched/pthread_attrgetschedparam.c +++ b/nuttx/sched/pthread_attrgetschedparam.c @@ -89,7 +89,7 @@ int pthread_attr_getschedparam(pthread_attr_t *attr, { int ret; - dbg("%s: attr=0x%p param=0x%p\n", __FUNCTION__, attr, param); + dbg("attr=0x%p param=0x%p\n", attr, param); if (!attr || !param) { @@ -101,7 +101,7 @@ int pthread_attr_getschedparam(pthread_attr_t *attr, ret = OK; } - dbg("%s: Returning %d\n", __FUNCTION__, ret); + dbg("Returning %d\n", ret); return ret; } diff --git a/nuttx/sched/pthread_attrgetschedpolicy.c b/nuttx/sched/pthread_attrgetschedpolicy.c index 801226c982..67948cd953 100644 --- a/nuttx/sched/pthread_attrgetschedpolicy.c +++ b/nuttx/sched/pthread_attrgetschedpolicy.c @@ -89,7 +89,7 @@ int pthread_attr_getschedpolicy(pthread_attr_t *attr, int *policy) { int ret; - dbg("%s: attr=0x%p policy=0x%p\n", __FUNCTION__, attr, policy); + dbg("attr=0x%p policy=0x%p\n", attr, policy); if (!attr || !policy) { @@ -101,6 +101,6 @@ int pthread_attr_getschedpolicy(pthread_attr_t *attr, int *policy) ret = OK; } - dbg("%s: Returning %d\n", __FUNCTION__, ret); + dbg("Returning %d\n", ret); return ret; } diff --git a/nuttx/sched/pthread_attrgetstacksize.c b/nuttx/sched/pthread_attrgetstacksize.c index d36ae172e8..9b160ead63 100644 --- a/nuttx/sched/pthread_attrgetstacksize.c +++ b/nuttx/sched/pthread_attrgetstacksize.c @@ -88,7 +88,7 @@ int pthread_attr_getstacksize(pthread_attr_t *attr, long *stacksize) { int ret; - dbg("%s: attr=0x%p stacksize=0x%p\n", __FUNCTION__, attr, stacksize); + dbg("attr=0x%p stacksize=0x%p\n", attr, stacksize); if (!stacksize) { @@ -100,7 +100,7 @@ int pthread_attr_getstacksize(pthread_attr_t *attr, long *stacksize) ret = OK; } - dbg("%s: Returning %d\n", __FUNCTION__, ret); + dbg("Returning %d\n", ret); return ret; } diff --git a/nuttx/sched/pthread_attrinit.c b/nuttx/sched/pthread_attrinit.c index 51d2ea5250..7f6639b9c4 100644 --- a/nuttx/sched/pthread_attrinit.c +++ b/nuttx/sched/pthread_attrinit.c @@ -90,7 +90,7 @@ int pthread_attr_init(pthread_attr_t *attr) { int ret = OK; - dbg("%s: attr=0x%p\n", __FUNCTION__, attr); + dbg("attr=0x%p\n", attr); if (!attr) { ret = ENOMEM; @@ -105,7 +105,7 @@ int pthread_attr_init(pthread_attr_t *attr) memcpy(attr, &g_default_pthread_attr, sizeof(pthread_attr_t)); } - dbg("%s: Returning %d\n", __FUNCTION__, ret); + dbg("Returning %d\n", ret); return ret; } diff --git a/nuttx/sched/pthread_attrsetinheritsched.c b/nuttx/sched/pthread_attrsetinheritsched.c index e83d13d73d..75468aad33 100644 --- a/nuttx/sched/pthread_attrsetinheritsched.c +++ b/nuttx/sched/pthread_attrsetinheritsched.c @@ -92,7 +92,7 @@ int pthread_attr_setinheritsched(pthread_attr_t *attr, { int ret; - dbg("%s: inheritsched=%d\n", __FUNCTION__, inheritsched); + dbg("inheritsched=%d\n", inheritsched); if (!attr || (inheritsched != PTHREAD_INHERIT_SCHED && @@ -106,7 +106,7 @@ int pthread_attr_setinheritsched(pthread_attr_t *attr, ret = OK; } - dbg("%s: Returning %d\n", __FUNCTION__, ret); + dbg("Returning %d\n", ret); return ret; } diff --git a/nuttx/sched/pthread_attrsetschedparam.c b/nuttx/sched/pthread_attrsetschedparam.c index 4a0d983483..77dfa1ccc0 100644 --- a/nuttx/sched/pthread_attrsetschedparam.c +++ b/nuttx/sched/pthread_attrsetschedparam.c @@ -89,7 +89,7 @@ int pthread_attr_setschedparam(pthread_attr_t *attr, { int ret; - dbg("%s: attr=0x%p param=0x%p\n", __FUNCTION__, attr, param); + dbg("attr=0x%p param=0x%p\n", attr, param); if (!attr || !param) { @@ -100,7 +100,7 @@ int pthread_attr_setschedparam(pthread_attr_t *attr, attr->priority = (short)param->sched_priority; ret = OK; } - dbg("%s: Returning %d\n", __FUNCTION__, ret); + dbg("Returning %d\n", ret); return ret; } diff --git a/nuttx/sched/pthread_attrsetschedpolicy.c b/nuttx/sched/pthread_attrsetschedpolicy.c index d750cf6fd4..2ba20db517 100644 --- a/nuttx/sched/pthread_attrsetschedpolicy.c +++ b/nuttx/sched/pthread_attrsetschedpolicy.c @@ -89,7 +89,7 @@ int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy) { int ret; - dbg("%s: attr=0x%p policy=%d\n", __FUNCTION__, attr, policy); + dbg("attr=0x%p policy=%d\n", attr, policy); #if CONFIG_RR_INTERVAL > 0 if (!attr || (policy != SCHED_FIFO && policy != SCHED_RR)) @@ -105,6 +105,6 @@ int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy) ret = OK; } - dbg("%s: Returning %d\n", __FUNCTION__, ret); + dbg("Returning %d\n", ret); return ret; } diff --git a/nuttx/sched/pthread_attrsetstacksize.c b/nuttx/sched/pthread_attrsetstacksize.c index b33b75e635..c62093f234 100644 --- a/nuttx/sched/pthread_attrsetstacksize.c +++ b/nuttx/sched/pthread_attrsetstacksize.c @@ -88,8 +88,7 @@ int pthread_attr_setstacksize(pthread_attr_t *attr, long stacksize) { int ret; - dbg("%s: attr=0x%p stacksize=%ld\n", - __FUNCTION__, attr, stacksize); + dbg("attr=0x%p stacksize=%ld\n", attr, stacksize); if (!attr || stacksize < PTHREAD_STACK_MIN) { @@ -101,7 +100,7 @@ int pthread_attr_setstacksize(pthread_attr_t *attr, long stacksize) ret = OK; } - dbg("%s: Returning %d\n", __FUNCTION__, ret); + dbg("Returning %d\n", ret); return ret; } diff --git a/nuttx/sched/pthread_cancel.c b/nuttx/sched/pthread_cancel.c index d34c29ae3d..8b8c36c991 100644 --- a/nuttx/sched/pthread_cancel.c +++ b/nuttx/sched/pthread_cancel.c @@ -77,7 +77,7 @@ int pthread_cancel(pthread_t thread) /* First, make sure that the handle references a valid thread */ - if (!thread.pid) + if (!thread) { /* pid == 0 is the IDLE task. Callers cannot cancel the * IDLE task. @@ -86,7 +86,7 @@ int pthread_cancel(pthread_t thread) return ESRCH; } - tcb = sched_gettcb(thread.pid); + tcb = sched_gettcb((pid_t)thread); if (!tcb) { /* The pid does not correspond to any known thread */ @@ -132,11 +132,11 @@ int pthread_cancel(pthread_t thread) /* Complete pending join operations */ - (void)pthread_completejoin(thread.pid, PTHREAD_CANCELED); + (void)pthread_completejoin((pid_t)thread, PTHREAD_CANCELED); /* Then let pthread_delete do the real work */ - task_delete(thread.pid); + task_delete((pid_t)thread); return OK; } diff --git a/nuttx/sched/pthread_completejoin.c b/nuttx/sched/pthread_completejoin.c index a5e7651e01..8e57ada8ba 100644 --- a/nuttx/sched/pthread_completejoin.c +++ b/nuttx/sched/pthread_completejoin.c @@ -79,7 +79,7 @@ static void pthread_destroyjoininfo(join_t *pjoin) int ntasks_waiting; int status; - dbg("%s: pjoin=0x%p\n", __FUNCTION__, pjoin); + dbg("pjoin=0x%p\n", pjoin); /* Are any tasks waiting for our exit value? */ @@ -150,7 +150,7 @@ int pthread_completejoin(pid_t pid, void *exit_value) join_t *pjoin; boolean detached = FALSE; - dbg("%s: process_id=%d exit_value=%p\n", __FUNCTION__, pid, exit_value); + dbg("process_id=%d exit_value=%p\n", pid, exit_value); /* First, find thread's structure in the private data set. */ @@ -170,7 +170,7 @@ int pthread_completejoin(pid_t pid, void *exit_value) detached = pjoin->detached; if (detached) { - dbg("%s: Detaching\n", __FUNCTION__); + dbg("Detaching\n"); /* If so, then remove the thread's structure from the private * data set. After this point, no other thread can perform a join diff --git a/nuttx/sched/pthread_condattrdestroy.c b/nuttx/sched/pthread_condattrdestroy.c index a12c3f57c0..8cc524ae5e 100644 --- a/nuttx/sched/pthread_condattrdestroy.c +++ b/nuttx/sched/pthread_condattrdestroy.c @@ -67,14 +67,14 @@ int pthread_condattr_destroy(pthread_condattr_t *attr) { int ret = OK; - dbg("%s: attr=0x%p\n", __FUNCTION__, attr); + dbg("attr=0x%p\n", attr); if (!attr) { ret = EINVAL; } - dbg("%s: Returning %d\n", __FUNCTION__, ret); + dbg("Returning %d\n", ret); return ret; } diff --git a/nuttx/sched/pthread_condattrinit.c b/nuttx/sched/pthread_condattrinit.c index 739b703ff0..0d341dbc8f 100644 --- a/nuttx/sched/pthread_condattrinit.c +++ b/nuttx/sched/pthread_condattrinit.c @@ -67,7 +67,7 @@ int pthread_condattr_init(pthread_condattr_t *attr) { int ret = OK; - dbg("%s: attr=0x%p\n", __FUNCTION__, attr); + dbg("attr=0x%p\n", attr); if (!attr) { @@ -78,7 +78,7 @@ int pthread_condattr_init(pthread_condattr_t *attr) *attr = 0; } - dbg("%s: Returning %d\n", __FUNCTION__, ret); + dbg("Returning %d\n", ret); return ret; } diff --git a/nuttx/sched/pthread_condbroadcast.c b/nuttx/sched/pthread_condbroadcast.c index 322a4d288b..1fd1292485 100644 --- a/nuttx/sched/pthread_condbroadcast.c +++ b/nuttx/sched/pthread_condbroadcast.c @@ -89,7 +89,7 @@ int pthread_cond_broadcast(pthread_cond_t *cond) int ret = OK; int sval; - dbg("%s: cond=0x%p\n", __FUNCTION__, cond); + dbg("cond=0x%p\n", cond); if (!cond) { @@ -135,7 +135,7 @@ int pthread_cond_broadcast(pthread_cond_t *cond) sched_unlock(); } - dbg("%s: Returning %d\n", __FUNCTION__, ret); + dbg("Returning %d\n", ret); return ret; } diff --git a/nuttx/sched/pthread_conddestroy.c b/nuttx/sched/pthread_conddestroy.c index 5272008570..5c95577a96 100644 --- a/nuttx/sched/pthread_conddestroy.c +++ b/nuttx/sched/pthread_conddestroy.c @@ -67,7 +67,7 @@ int pthread_cond_destroy(pthread_cond_t *cond) { int ret = OK; - dbg("%s: cond=0x%p\n", __FUNCTION__, cond); + dbg("cond=0x%p\n", cond); if (!cond) { @@ -81,7 +81,7 @@ int pthread_cond_destroy(pthread_cond_t *cond) ret = EINVAL; } - dbg("%s: Returning %d\n", __FUNCTION__, ret); + dbg("Returning %d\n", ret); return ret; } diff --git a/nuttx/sched/pthread_condinit.c b/nuttx/sched/pthread_condinit.c index 9dac4692fe..90ee127827 100644 --- a/nuttx/sched/pthread_condinit.c +++ b/nuttx/sched/pthread_condinit.c @@ -67,7 +67,7 @@ int pthread_cond_init(pthread_cond_t *cond, pthread_condattr_t *attr) { int ret = OK; - dbg("%s: cond=0x%p attr=0x%p\n", __FUNCTION__, cond, attr); + dbg("cond=0x%p attr=0x%p\n", cond, attr); if (!cond) { @@ -83,7 +83,7 @@ int pthread_cond_init(pthread_cond_t *cond, pthread_condattr_t *attr) ret = EINVAL; } - dbg("%s: Returning %d\n", __FUNCTION__, ret); + dbg("Returning %d\n", ret); return ret; } diff --git a/nuttx/sched/pthread_condsignal.c b/nuttx/sched/pthread_condsignal.c index f9ee3781d2..90698ce2aa 100644 --- a/nuttx/sched/pthread_condsignal.c +++ b/nuttx/sched/pthread_condsignal.c @@ -88,7 +88,7 @@ int pthread_cond_signal(pthread_cond_t *cond) int ret = OK; int sval; - dbg("%s: cond=0x%p\n", __FUNCTION__, cond); + dbg("cond=0x%p\n", cond); if (!cond) { @@ -110,16 +110,16 @@ int pthread_cond_signal(pthread_cond_t *cond) else { - dbg("%s: sval=%d\n", __FUNCTION__, sval); + dbg("sval=%d\n", sval); if (sval < 0) { - dbg("%s: Signalling...\n", __FUNCTION__); + dbg("Signalling...\n"); ret = pthread_givesemaphore((sem_t*)&cond->sem); } } } - dbg("%s: Returning %d\n", __FUNCTION__, ret); + dbg("Returning %d\n", ret); return ret; } diff --git a/nuttx/sched/pthread_condtimedwait.c b/nuttx/sched/pthread_condtimedwait.c index f651226998..59d92921e8 100644 --- a/nuttx/sched/pthread_condtimedwait.c +++ b/nuttx/sched/pthread_condtimedwait.c @@ -116,8 +116,7 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, int int_state; int status; - dbg("%s: cond=0x%p mutex=0x%p abstime=0x%p\n", - __FUNCTION__, cond, mutex, abstime); + dbg("cond=0x%p mutex=0x%p abstime=0x%p\n", cond, mutex, abstime); /* Make sure that non-NULL references were provided. */ @@ -153,7 +152,7 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, } else { - dbg("%s: Give up mutex...\n", __FUNCTION__); + dbg("Give up mutex...\n"); /* We must disable pre-emption and interrupts here so that * the time stays valid until the wait begins. This adds @@ -263,7 +262,7 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, if (*get_errno_ptr() == EINTR) { - dbg("%s: Timedout!\n", __FUNCTION__); + dbg("Timedout!\n"); ret = ETIMEDOUT; } else @@ -275,7 +274,7 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, /* Reacquire the mutex (retaining the ret). */ - dbg("%s: Re-locking...\n", __FUNCTION__); + dbg("Re-locking...\n"); status = pthread_takesemaphore((sem_t*)&mutex->sem); if (!status) { @@ -300,7 +299,7 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, } } - dbg("%s: Returning %d\n", __FUNCTION__, ret); + dbg("Returning %d\n", ret); return ret; } diff --git a/nuttx/sched/pthread_condwait.c b/nuttx/sched/pthread_condwait.c index 555d3d06ff..cbfacf2a32 100644 --- a/nuttx/sched/pthread_condwait.c +++ b/nuttx/sched/pthread_condwait.c @@ -90,7 +90,7 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) { int ret; - dbg("%s: cond=0x%p mutex=0x%p\n", __FUNCTION__, cond, mutex); + dbg("cond=0x%p mutex=0x%p\n", cond, mutex); /* Make sure that non-NULL references were provided. */ @@ -110,7 +110,7 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) { /* Give up the mutex */ - dbg("%s: Give up mutex / take cond\n", __FUNCTION__); + dbg("Give up mutex / take cond\n"); sched_lock(); mutex->pid = 0; @@ -123,7 +123,7 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) /* Reacquire the mutex */ - dbg("%s: Reacquire mutex...\n", __FUNCTION__); + dbg("Reacquire mutex...\n"); ret |= pthread_takesemaphore((sem_t*)&mutex->sem); if (!ret) { @@ -131,7 +131,7 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) } } - dbg("%s: Returning %d\n", __FUNCTION__, ret); + dbg("Returning %d\n", ret); return ret; } diff --git a/nuttx/sched/pthread_create.c b/nuttx/sched/pthread_create.c index c8ec604d1a..5d9104c754 100644 --- a/nuttx/sched/pthread_create.c +++ b/nuttx/sched/pthread_create.c @@ -297,7 +297,7 @@ int pthread_create(pthread_t *thread, pthread_attr_t *attr, */ pid = (int)ptcb->pid; - pjoin->thread.pid = pid; + pjoin->thread = (pthread_t)pid; /* Initialize the semaphores in the join structure to zero. */ @@ -322,7 +322,7 @@ int pthread_create(pthread_t *thread, pthread_attr_t *attr, /* Return the thread information to the caller */ - if (thread) thread->pid = pid; + if (thread) *thread = (pthread_t)pid; if (!pjoin->started) status = ERROR; sched_unlock(); diff --git a/nuttx/sched/pthread_detach.c b/nuttx/sched/pthread_detach.c index 967ed237f9..4306b28e44 100644 --- a/nuttx/sched/pthread_detach.c +++ b/nuttx/sched/pthread_detach.c @@ -90,15 +90,15 @@ int pthread_detach(pthread_t thread) join_t *pjoin; int ret; - dbg("%s: Thread=%d\n", __FUNCTION__, thread.pid); + dbg("Thread=%d\n", thread); /* Find the entry associated with this pthread. */ (void)pthread_takesemaphore(&g_join_semaphore); - pjoin = pthread_findjoininfo(thread.pid); + pjoin = pthread_findjoininfo((pid_t)thread); if (!pjoin) { - dbg("%s: Could not find thread entry\n", __FUNCTION__); + dbg("Could not find thread entry\n"); ret = EINVAL; } else @@ -109,7 +109,7 @@ int pthread_detach(pthread_t thread) { /* YES.. just remove the thread entry. */ - (void)pthread_removejoininfo(thread.pid); + (void)pthread_removejoininfo((pid_t)thread); sched_free(pjoin); pjoin = NULL; } @@ -129,6 +129,6 @@ int pthread_detach(pthread_t thread) } (void)pthread_givesemaphore(&g_join_semaphore); - dbg("%s: Returning %d\n", __FUNCTION__, ret); + dbg("Returning %d\n", ret); return ret; } diff --git a/nuttx/sched/pthread_exit.c b/nuttx/sched/pthread_exit.c index 5330ee3f07..e6ed040d49 100644 --- a/nuttx/sched/pthread_exit.c +++ b/nuttx/sched/pthread_exit.c @@ -91,7 +91,7 @@ void pthread_exit(void *exit_value) int error_code = (int)exit_value; int status; - dbg("%s: exit_value=%p\n", __FUNCTION__, exit_value); + dbg("exit_value=%p\n", exit_value); /* Complete pending join operations */ diff --git a/nuttx/sched/pthread_findjoininfo.c b/nuttx/sched/pthread_findjoininfo.c index 48871cf80c..1d33c50e00 100644 --- a/nuttx/sched/pthread_findjoininfo.c +++ b/nuttx/sched/pthread_findjoininfo.c @@ -81,14 +81,14 @@ * ************************************************************/ -join_t *pthread_findjoininfo(int pid) +join_t *pthread_findjoininfo(pid_t pid) { join_t *pjoin; /* Find the entry with the matching pid */ for (pjoin = g_pthread_head; - (pjoin && pjoin->thread.pid != pid); + (pjoin && (pid_t)pjoin->thread != pid); pjoin = pjoin->next); /* and return it */ diff --git a/nuttx/sched/pthread_getschedparam.c b/nuttx/sched/pthread_getschedparam.c index 0a30fba8f6..0e410ef9ed 100644 --- a/nuttx/sched/pthread_getschedparam.c +++ b/nuttx/sched/pthread_getschedparam.c @@ -91,8 +91,7 @@ int pthread_getschedparam(pthread_t thread, int *policy, { int ret; - dbg("%s: thread ID=%d policy=0x%p param=0x%p\n", - __FUNCTION__, thread.pid, policy, param); + dbg("Thread ID=%d policy=0x%p param=0x%p\n", thread, policy, param); if (!policy || !param) { @@ -102,7 +101,7 @@ int pthread_getschedparam(pthread_t thread, int *policy, { /* Get the schedparams of the thread. */ - ret = sched_getparam(thread.pid, param); + ret = sched_getparam((pid_t)thread, param); if (ret != OK) { ret = EINVAL; @@ -110,14 +109,14 @@ int pthread_getschedparam(pthread_t thread, int *policy, /* Return the policy. */ - *policy = sched_getscheduler(thread.pid); + *policy = sched_getscheduler((pid_t)thread); if (*policy == ERROR) { ret = *get_errno_ptr(); } } - dbg("%s: Returning %d\n", __FUNCTION__, ret); + dbg("Returning %d\n", ret); return ret; } diff --git a/nuttx/sched/pthread_internal.h b/nuttx/sched/pthread_internal.h index d0b1cdeb9e..f23bafe5cb 100644 --- a/nuttx/sched/pthread_internal.h +++ b/nuttx/sched/pthread_internal.h @@ -115,9 +115,9 @@ extern "C" { EXTERN void weak_function pthread_initialize(void); EXTERN int pthread_completejoin(pid_t pid, void *exit_value); -EXTERN join_t *pthread_findjoininfo(int pid); +EXTERN join_t *pthread_findjoininfo(pid_t pid); EXTERN int pthread_givesemaphore(sem_t *sem); -EXTERN join_t *pthread_removejoininfo(int pid); +EXTERN join_t *pthread_removejoininfo(pid_t pid); EXTERN int pthread_takesemaphore(sem_t *sem); #undef EXTERN diff --git a/nuttx/sched/pthread_join.c b/nuttx/sched/pthread_join.c index 4e956777c9..28c8bf1c9d 100644 --- a/nuttx/sched/pthread_join.c +++ b/nuttx/sched/pthread_join.c @@ -98,13 +98,13 @@ int pthread_join(pthread_t thread, pthread_addr_t *pexit_value) join_t *pjoin; int ret; - dbg("%s: thread=%d\n", __FUNCTION__, thread.pid); + dbg("thread=%d\n", thread); /* First make sure that this is not an attempt to join to * ourself. */ - if (thread.pid == getpid()) + if ((pid_t)thread == getpid()) { return EDEADLK; } @@ -124,14 +124,14 @@ int pthread_join(pthread_t thread, pthread_addr_t *pexit_value) * was detached and has exitted. */ - pjoin = pthread_findjoininfo(thread.pid); + pjoin = pthread_findjoininfo((pid_t)thread); if (!pjoin) { /* Determine what kind of error to return */ - _TCB *tcb = sched_gettcb(thread.pid); + _TCB *tcb = sched_gettcb((pthread_t)thread); - dbg("%s: Could not find thread data\n", __FUNCTION__); + dbg("Could not find thread data\n"); /* Case (1) or (3) -- we can't tell which. Assume (3) */ @@ -153,26 +153,26 @@ int pthread_join(pthread_t thread, pthread_addr_t *pexit_value) } else if (pjoin->terminated) { - dbg("%s: Thread has terminated\n", __FUNCTION__); + dbg("Thread has terminated\n"); /* Get the thread exit value from the terminated thread. */ if (pexit_value) { - dbg("%s: exit_value=0x%p\n", __FUNCTION__, pjoin->exit_value); + dbg("exit_value=0x%p\n", pjoin->exit_value); *pexit_value = pjoin->exit_value; } /* Then remove and deallocate the thread entry. */ - (void)pthread_removejoininfo(thread.pid); + (void)pthread_removejoininfo((pid_t)thread); (void)pthread_givesemaphore(&g_join_semaphore); sched_free(pjoin); ret = OK; } else { - dbg("%s: Thread is still running\n", __FUNCTION__); + dbg("Thread is still running\n"); /* Relinquish the data set semaphore, making certain that * no task has the opportunity to run between the time @@ -192,7 +192,7 @@ int pthread_join(pthread_t thread, pthread_addr_t *pexit_value) if (pexit_value) { *pexit_value = pjoin->exit_value; - dbg("%s: exit_value=0x%p\n", __FUNCTION__, pjoin->exit_value); + dbg("exit_value=0x%p\n", pjoin->exit_value); } /* Post the thread's join semaphore so that exitting thread @@ -208,6 +208,6 @@ int pthread_join(pthread_t thread, pthread_addr_t *pexit_value) ret = OK; } - dbg("%s: Returning %d\n", __FUNCTION__, ret); + dbg("Returning %d\n", ret); return ret; } diff --git a/nuttx/sched/pthread_mutexattrdestroy.c b/nuttx/sched/pthread_mutexattrdestroy.c index 8e3abdb47b..a61b60c876 100644 --- a/nuttx/sched/pthread_mutexattrdestroy.c +++ b/nuttx/sched/pthread_mutexattrdestroy.c @@ -88,7 +88,7 @@ int pthread_mutexattr_destroy(pthread_mutexattr_t *attr) { int ret = OK; - dbg("%s: attr=0x%p\n", __FUNCTION__, attr); + dbg("attr=0x%p\n", attr); if (!attr) { @@ -99,6 +99,6 @@ int pthread_mutexattr_destroy(pthread_mutexattr_t *attr) attr->pshared = 0; } - dbg("%s: Returning %d\n", __FUNCTION__, ret); + dbg("Returning %d\n", ret); return ret; } diff --git a/nuttx/sched/pthread_mutexattrgetpshared.c b/nuttx/sched/pthread_mutexattrgetpshared.c index 1d54b90127..82198dfddb 100644 --- a/nuttx/sched/pthread_mutexattrgetpshared.c +++ b/nuttx/sched/pthread_mutexattrgetpshared.c @@ -88,7 +88,7 @@ int pthread_mutexattr_getpshared(pthread_mutexattr_t *attr, int *pshared) { int ret = OK; - dbg("%s: attr=0x%p pshared=0x%p\n", __FUNCTION__, attr, pshared); + dbg("attr=0x%p pshared=0x%p\n", attr, pshared); if (!attr || !pshared) { @@ -99,6 +99,6 @@ int pthread_mutexattr_getpshared(pthread_mutexattr_t *attr, int *pshared) *pshared = attr->pshared; } - dbg("%s: Returning %d\n", __FUNCTION__, ret); + dbg("Returning %d\n", ret); return ret; } diff --git a/nuttx/sched/pthread_mutexattrinit.c b/nuttx/sched/pthread_mutexattrinit.c index 920ccf0ee4..6bddd19f44 100644 --- a/nuttx/sched/pthread_mutexattrinit.c +++ b/nuttx/sched/pthread_mutexattrinit.c @@ -87,7 +87,7 @@ int pthread_mutexattr_init(pthread_mutexattr_t *attr) { int ret = OK; - dbg("%s: attr=0x%p\n", __FUNCTION__, attr); + dbg("attr=0x%p\n", attr); if (!attr) { @@ -98,6 +98,6 @@ int pthread_mutexattr_init(pthread_mutexattr_t *attr) attr->pshared = 0; } - dbg("%s: Returning %d\n", __FUNCTION__, ret); + dbg("Returning %d\n", ret); return ret; } diff --git a/nuttx/sched/pthread_mutexattrsetpshared.c b/nuttx/sched/pthread_mutexattrsetpshared.c index a9ddd0c3c9..f25ed4639b 100644 --- a/nuttx/sched/pthread_mutexattrsetpshared.c +++ b/nuttx/sched/pthread_mutexattrsetpshared.c @@ -88,7 +88,7 @@ int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int pshared) { int ret = OK; - dbg("%s: attr=0x%p pshared=%d\n", __FUNCTION__, attr, pshared); + dbg("attr=0x%p pshared=%d\n", attr, pshared); if (!attr || (pshared != 0 && pshared != 1)) { @@ -99,6 +99,6 @@ int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int pshared) attr->pshared = pshared; } - dbg("%s: Returning %d\n", __FUNCTION__, ret); + dbg("Returning %d\n", ret); return ret; } diff --git a/nuttx/sched/pthread_mutexdestroy.c b/nuttx/sched/pthread_mutexdestroy.c index bf82d4f436..14b5727c05 100644 --- a/nuttx/sched/pthread_mutexdestroy.c +++ b/nuttx/sched/pthread_mutexdestroy.c @@ -90,7 +90,7 @@ int pthread_mutex_destroy(pthread_mutex_t *mutex) int ret = OK; int status; - dbg("%s: mutex=0x%p\n", __FUNCTION__, mutex); + dbg("mutex=0x%p\n", mutex); if (!mutex) { @@ -123,6 +123,6 @@ int pthread_mutex_destroy(pthread_mutex_t *mutex) sched_unlock(); } - dbg("%s: Returning %d\n", __FUNCTION__, ret); + dbg("Returning %d\n", ret); return ret; } diff --git a/nuttx/sched/pthread_mutexinit.c b/nuttx/sched/pthread_mutexinit.c index faa06f227d..a91a0339d4 100644 --- a/nuttx/sched/pthread_mutexinit.c +++ b/nuttx/sched/pthread_mutexinit.c @@ -89,7 +89,7 @@ int pthread_mutex_init(pthread_mutex_t *mutex, pthread_mutexattr_t *attr) int pshared = 0; int status; - dbg("%s: mutex=0x%p attr=0x%p\n", __FUNCTION__, mutex, attr); + dbg("mutex=0x%p attr=0x%p\n", mutex, attr); if (!mutex) { @@ -117,6 +117,6 @@ int pthread_mutex_init(pthread_mutex_t *mutex, pthread_mutexattr_t *attr) } } - dbg("%s: Returning %d\n", __FUNCTION__, ret); + dbg("Returning %d\n", ret); return ret; } diff --git a/nuttx/sched/pthread_mutexlock.c b/nuttx/sched/pthread_mutexlock.c index 43e7c83562..64a6632190 100644 --- a/nuttx/sched/pthread_mutexlock.c +++ b/nuttx/sched/pthread_mutexlock.c @@ -90,7 +90,7 @@ int pthread_mutex_lock(pthread_mutex_t *mutex) int mypid = (int)getpid(); int ret = OK; - dbg("%s: mutex=0x%p\n", __FUNCTION__, mutex); + dbg("mutex=0x%p\n", mutex); if (!mutex) { @@ -108,7 +108,7 @@ int pthread_mutex_lock(pthread_mutex_t *mutex) if (mutex->pid == mypid) { - dbg("%s: Returning EDEADLK\n", __FUNCTION__); + dbg("Returning EDEADLK\n"); ret = EDEADLK; } else @@ -129,7 +129,7 @@ int pthread_mutex_lock(pthread_mutex_t *mutex) sched_unlock(); } - dbg("%s: Returning %d\n", __FUNCTION__, ret); + dbg("Returning %d\n", ret); return ret; } diff --git a/nuttx/sched/pthread_mutextrylock.c b/nuttx/sched/pthread_mutextrylock.c index 010c85f805..6474579a10 100644 --- a/nuttx/sched/pthread_mutextrylock.c +++ b/nuttx/sched/pthread_mutextrylock.c @@ -90,7 +90,7 @@ int pthread_mutex_trylock(pthread_mutex_t *mutex) { int ret = OK; - dbg("%s: mutex=0x%p\n", __FUNCTION__, mutex); + dbg("mutex=0x%p\n", mutex); if (!mutex) { @@ -129,7 +129,7 @@ int pthread_mutex_trylock(pthread_mutex_t *mutex) sched_unlock(); } - dbg("%s: Returning %d\n", __FUNCTION__, ret); + dbg("Returning %d\n", ret); return ret; } diff --git a/nuttx/sched/pthread_mutexunlock.c b/nuttx/sched/pthread_mutexunlock.c index 133dc1a942..2bc63eb264 100644 --- a/nuttx/sched/pthread_mutexunlock.c +++ b/nuttx/sched/pthread_mutexunlock.c @@ -89,7 +89,7 @@ int pthread_mutex_unlock(pthread_mutex_t *mutex) { int ret = OK; - dbg("%s: mutex=0x%p\n", __FUNCTION__, mutex); + dbg("mutex=0x%p\n", mutex); if (!mutex) { @@ -107,7 +107,7 @@ int pthread_mutex_unlock(pthread_mutex_t *mutex) if (mutex->pid != (int)getpid()) { - dbg("%s: Holder=%d Returning EPERM\n", __FUNCTION__, mutex->pid); + dbg("Holder=%d returning EPERM\n", mutex->pid); ret = EPERM; } else @@ -120,7 +120,7 @@ int pthread_mutex_unlock(pthread_mutex_t *mutex) sched_unlock(); } - dbg("%s: Returning %d\n", __FUNCTION__, ret); + dbg("Returning %d\n", ret); return ret; } diff --git a/nuttx/sched/pthread_removejoininfo.c b/nuttx/sched/pthread_removejoininfo.c index ecdc6d99e1..33fb243918 100644 --- a/nuttx/sched/pthread_removejoininfo.c +++ b/nuttx/sched/pthread_removejoininfo.c @@ -81,7 +81,7 @@ * ************************************************************/ -join_t *pthread_removejoininfo(int pid) +join_t *pthread_removejoininfo(pid_t pid) { join_t *prev; join_t *join; @@ -89,7 +89,7 @@ join_t *pthread_removejoininfo(int pid) /* Find the entry with the matching pid */ for (prev = NULL, join = g_pthread_head; - (join && join->thread.pid != pid); + (join && (pid_t)join->thread != pid); prev = join, join = join->next); /* Remove it from the data set. */ diff --git a/nuttx/sched/pthread_self.c b/nuttx/sched/pthread_self.c deleted file mode 100644 index 55ceddbddd..0000000000 --- a/nuttx/sched/pthread_self.c +++ /dev/null @@ -1,91 +0,0 @@ -/************************************************************ - * pthread_self.c - * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt <spudmonkey@racsa.co.cr> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ************************************************************/ - -/************************************************************ - * Included Files - ************************************************************/ - -#include <sys/types.h> -#include <unistd.h> -#include <pthread.h> -#include "pthread_internal.h" - -/************************************************************ - * Definitions - ************************************************************/ - -/************************************************************ - * Private Type Declarations - ************************************************************/ - -/************************************************************ - * Global Variables - ************************************************************/ - -/************************************************************ - * Private Variables - ************************************************************/ - -/************************************************************ - * Private Functions - ************************************************************/ - -/************************************************************ - * Public Functions - ************************************************************/ - -/************************************************************ - * Function: pthread_self - * - * Description: - * A thread may obtain a copy of its own thread handle. - * - * Parameters: - * None - * - * Return Value: - * A copy of this threads handle - * - * Assumptions: - * - ************************************************************/ - -pthread_t pthread_self(void) -{ - pthread_t thread; - thread.pid = (int)getpid(); - return thread; -} - diff --git a/nuttx/sched/pthread_setschedparam.c b/nuttx/sched/pthread_setschedparam.c index 5d0f913c25..bb0435aa03 100644 --- a/nuttx/sched/pthread_setschedparam.c +++ b/nuttx/sched/pthread_setschedparam.c @@ -89,15 +89,9 @@ int pthread_setschedparam(pthread_t thread, int policy, const struct sched_param *param) { - int ret; - - dbg("%s: thread ID=%d policy=%d param=0x%p\n", - __FUNCTION__, thread.pid, policy, param); + dbg("thread ID=%d policy=%d param=0x%p\n", thread, policy, param); /* Let sched_setscheduler do all of the work */ - ret = sched_setscheduler(thread.pid, policy, param); - - dbg("%s: Returning %d\n", __FUNCTION__, ret); - return ret; + return sched_setscheduler((pid_t)thread, policy, param); } diff --git a/nuttx/sched/sched_getscheduler.c b/nuttx/sched/sched_getscheduler.c index 9406d9774c..ae97391854 100644 --- a/nuttx/sched/sched_getscheduler.c +++ b/nuttx/sched/sched_getscheduler.c @@ -103,7 +103,7 @@ int sched_getscheduler(pid_t pid) /* Verify that the pid corresponds to a real task */ - if (pid = 0) + if (!pid) { tcb = (_TCB*)g_readytorun.head; } diff --git a/nuttx/sched/sem_internal.h b/nuttx/sched/sem_internal.h index dd15ae6df7..460b358fc6 100644 --- a/nuttx/sched/sem_internal.h +++ b/nuttx/sched/sem_internal.h @@ -87,7 +87,7 @@ extern "C" { #endif EXTERN void weak_function sem_initialize(void); -EXTERN void weak_function sem_waitirq(_TCB *wtcb); +EXTERN void sem_waitirq(_TCB *wtcb); EXTERN nsem_t *sem_findnamed(const char *name); #undef EXTERN diff --git a/nuttx/sched/task_create.c b/nuttx/sched/task_create.c index dd7da112e4..c1cf117725 100644 --- a/nuttx/sched/task_create.c +++ b/nuttx/sched/task_create.c @@ -226,8 +226,6 @@ STATUS _task_init(_TCB *tcb, char *name, int priority, { STATUS ret; - vdbg("%s: Entry\n", __FUNCTION__); - /* Assign a unique task ID to the task. */ ret = task_assignpid(tcb); @@ -382,8 +380,6 @@ STATUS task_activate(_TCB *tcb) uint32 flags; #endif - vdbg("%s: Entry\n", __FUNCTION__); - #ifdef CONFIG_SCHED_INSTRUMENTATION flags = irqsave(); @@ -449,8 +445,6 @@ int task_create(char *name, int priority, STATUS status; pid_t pid; - vdbg("%s: Entry\n", __FUNCTION__); - /* Allocate a TCB for the new task. */ tcb = (_TCB*)kzmalloc(sizeof(_TCB)); diff --git a/nuttx/sched/wd_internal.h b/nuttx/sched/wd_internal.h index 9198387cca..212c686192 100644 --- a/nuttx/sched/wd_internal.h +++ b/nuttx/sched/wd_internal.h @@ -70,7 +70,6 @@ struct wdog_s }; typedef struct wdog_s wdog_t; -typedef struct wdog_s *WDOG_ID; /************************************************************ * Public Variables |