From 0eb35940a400ca2c36a585d30696eac47c6d687a Mon Sep 17 00:00:00 2001 From: bernard Date: Sat, 19 Jul 2014 06:52:35 +0800 Subject: [POSIX] fix mq_open and sem_open argument issue. --- components/pthreads/mqueue.c | 3 +++ components/pthreads/semaphore.c | 2 ++ 2 files changed, 5 insertions(+) (limited to 'components/pthreads') diff --git a/components/pthreads/mqueue.c b/components/pthreads/mqueue.c index c1303ae6b1..7b669dc367 100644 --- a/components/pthreads/mqueue.c +++ b/components/pthreads/mqueue.c @@ -119,6 +119,7 @@ mqd_t mq_open(const char *name, int oflag, ...) { mqd_t mqdes; va_list arg; + mode_t mode; struct mq_attr *attr = RT_NULL; /* lock posix mqueue list */ @@ -128,6 +129,8 @@ mqd_t mq_open(const char *name, int oflag, ...) if (oflag & O_CREAT) { va_start(arg, oflag); + mode = (mode_t)va_arg(arg, unsigned int); + mode = mode; attr = (struct mq_attr *)va_arg(arg, struct mq_attr *); va_end(arg); diff --git a/components/pthreads/semaphore.c b/components/pthreads/semaphore.c index 726246c95f..ae69e0d1bc 100644 --- a/components/pthreads/semaphore.c +++ b/components/pthreads/semaphore.c @@ -224,6 +224,7 @@ sem_t *sem_open(const char *name, int oflag, ...) { sem_t* sem; va_list arg; + mode_t mode; unsigned int value; sem = RT_NULL; @@ -233,6 +234,7 @@ sem_t *sem_open(const char *name, int oflag, ...) if (oflag & O_CREAT) { va_start(arg, oflag); + mode = (mode_t) va_arg( arg, unsigned int); mode = mode; value = va_arg( arg, unsigned int); va_end(arg); -- cgit v1.3.1 From 94883a92fbc43b41e4888beb27fc2c3e2a95d4f1 Mon Sep 17 00:00:00 2001 From: bernard Date: Thu, 31 Jul 2014 08:34:36 +0800 Subject: [pthreads] Fix pthread_cond_init issue. #261 --- components/pthreads/pthread_cond.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'components/pthreads') diff --git a/components/pthreads/pthread_cond.c b/components/pthreads/pthread_cond.c index e5342dd775..25628fc2b3 100644 --- a/components/pthreads/pthread_cond.c +++ b/components/pthreads/pthread_cond.c @@ -98,7 +98,11 @@ int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr) rt_snprintf(cond_name, sizeof(cond_name), "cond%02d", cond_num++); - cond->attr = *attr; + if (attr == RT_NULL) /* use default value */ + cond->attr = PTHREAD_PROCESS_PRIVATE; + else + cond->attr = *attr; + result = rt_sem_init(&cond->sem, cond_name, 0, RT_IPC_FLAG_FIFO); if (result != RT_EOK) return EINVAL; -- cgit v1.3.1