Module: xenomai-3 Branch: master Commit: e0e2775ad33537d2646af4d5e36c1333fe57d9a8 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=e0e2775ad33537d2646af4d5e36c1333fe57d9a8
Author: Philippe Gerum <r...@xenomai.org> Date: Tue Mar 17 17:58:56 2015 +0100 cobalt/posix: cleanup reclaiming of process-local objects --- kernel/cobalt/posix/cond.c | 38 +++++++++++------------------- kernel/cobalt/posix/cond.h | 11 ++++----- kernel/cobalt/posix/event.c | 33 ++++++++++---------------- kernel/cobalt/posix/event.h | 11 ++++----- kernel/cobalt/posix/init.c | 43 +++++++++------------------------ kernel/cobalt/posix/internal.h | 8 +++---- kernel/cobalt/posix/monitor.c | 32 +++++++++---------------- kernel/cobalt/posix/monitor.h | 11 ++++----- kernel/cobalt/posix/mqueue.c | 28 +--------------------- kernel/cobalt/posix/mqueue.h | 4 ---- kernel/cobalt/posix/mutex.c | 46 ++++++++++++++---------------------- kernel/cobalt/posix/mutex.h | 10 ++++---- kernel/cobalt/posix/nsem.c | 50 ++++++++++++++++++++------------------- kernel/cobalt/posix/process.c | 51 ++++++++++++++++------------------------ kernel/cobalt/posix/process.h | 8 +++---- kernel/cobalt/posix/sched.c | 30 +++++++---------------- kernel/cobalt/posix/sched.h | 11 ++++----- kernel/cobalt/posix/sem.c | 47 +++++++++++++++--------------------- kernel/cobalt/posix/sem.h | 10 +++----- kernel/cobalt/posix/signal.c | 7 +----- kernel/cobalt/posix/signal.h | 4 +--- kernel/cobalt/posix/timer.c | 2 +- kernel/cobalt/posix/timer.h | 5 +--- 23 files changed, 174 insertions(+), 326 deletions(-) diff --git a/kernel/cobalt/posix/cond.c b/kernel/cobalt/posix/cond.c index cdd0720..549a871 100644 --- a/kernel/cobalt/posix/cond.c +++ b/kernel/cobalt/posix/cond.c @@ -24,7 +24,7 @@ #include <trace/events/cobalt-posix.h> static inline void -cond_destroy_internal(xnhandle_t handle, struct cobalt_kqueues *q) +cond_destroy_internal(xnhandle_t handle) { struct cobalt_cond *cond; spl_t s; @@ -38,9 +38,8 @@ cond_destroy_internal(xnhandle_t handle, struct cobalt_kqueues *q) xnregistry_remove(handle); list_del(&cond->link); /* - * synchbase wait queue may not be empty only when this - * function is called from cobalt_cond_pkg_cleanup, in which - * case we don't have to reschedule. + * At this point, synchbase wait queue is empty, so we don't + * have to reschedule. */ xnsynch_destroy(&cond->synchbase); cobalt_mark_deleted(cond); @@ -76,7 +75,7 @@ pthread_cond_init(struct cobalt_cond_shadow *cnd, const struct cobalt_condattr * xnlock_get_irqsave(&nklock, s); - condq = &cobalt_kqueues(attr->pshared)->condq; + condq = &cobalt_current_resources(attr->pshared)->condq; /* * We allow reinitializing a shared condvar. Rationale: since @@ -96,7 +95,7 @@ pthread_cond_init(struct cobalt_cond_shadow *cnd, const struct cobalt_condattr * goto fail_register; } xnlock_put_irqrestore(&nklock, s); - cond_destroy_internal(cnd->handle, cobalt_kqueues(1)); + cond_destroy_internal(cnd->handle); xnlock_get_irqsave(&nklock, s); do_init: ret = xnregistry_enter_anon(cond, &cond->handle); @@ -109,7 +108,7 @@ do_init: xnsynch_init(&cond->synchbase, synch_flags, NULL); cond->attr = *attr; cond->mutex = NULL; - cond->owningq = cobalt_kqueues(attr->pshared); + cond->scope = cobalt_current_resources(attr->pshared); list_add_tail(&cond->link, condq); cnd->handle = cond->handle; @@ -147,7 +146,7 @@ static inline int pthread_cond_destroy(struct cobalt_cond_shadow *cnd) return -EINVAL; } - if (cond->owningq != cobalt_kqueues(cond->attr.pshared)) { + if (cond->scope != cobalt_current_resources(cond->attr.pshared)) { xnlock_put_irqrestore(&nklock, s); return -EPERM; } @@ -161,7 +160,7 @@ static inline int pthread_cond_destroy(struct cobalt_cond_shadow *cnd) pshared = cond->attr.pshared; xnlock_put_irqrestore(&nklock, s); - cond_destroy_internal(cnd->handle, cobalt_kqueues(pshared)); + cond_destroy_internal(cnd->handle); return 0; } @@ -184,7 +183,7 @@ static inline int cobalt_cond_timedwait_prologue(struct xnthread *cur, } #if XENO_DEBUG(USER) - if (cond->owningq != cobalt_kqueues(cond->attr.pshared)) { + if (cond->scope != cobalt_current_resources(cond->attr.pshared)) { err = -EPERM; goto unlock_and_return; } @@ -453,31 +452,22 @@ int cobalt_cond_deferred_signals(struct cobalt_cond *cond) return need_resched; } -void cobalt_condq_cleanup(struct cobalt_kqueues *q) +void cobalt_cond_reclaim(struct cobalt_process *process) { + struct cobalt_resources *p = &process->resources; struct cobalt_cond *cond, *tmp; spl_t s; xnlock_get_irqsave(&nklock, s); - if (list_empty(&q->condq)) + if (list_empty(&p->condq)) goto out; - list_for_each_entry_safe(cond, tmp, &q->condq, link) { + list_for_each_entry_safe(cond, tmp, &p->condq, link) { xnlock_put_irqrestore(&nklock, s); - cond_destroy_internal(cond->handle, q); + cond_destroy_internal(cond->handle); xnlock_get_irqsave(&nklock, s); } out: xnlock_put_irqrestore(&nklock, s); } - -void cobalt_cond_pkg_init(void) -{ - INIT_LIST_HEAD(&cobalt_global_kqueues.condq); -} - -void cobalt_cond_pkg_cleanup(void) -{ - cobalt_condq_cleanup(&cobalt_global_kqueues); -} diff --git a/kernel/cobalt/posix/cond.h b/kernel/cobalt/posix/cond.h index 7bd8138..07372cc 100644 --- a/kernel/cobalt/posix/cond.h +++ b/kernel/cobalt/posix/cond.h @@ -26,8 +26,9 @@ #include <cobalt/uapi/cond.h> #include <xenomai/posix/syscall.h> -struct cobalt_kqueues; +struct cobalt_resources; struct cobalt_mutex; +struct cobalt_process; struct cobalt_cond { unsigned int magic; @@ -38,7 +39,7 @@ struct cobalt_cond { struct cobalt_cond_state *state; struct cobalt_condattr attr; struct cobalt_mutex *mutex; - struct cobalt_kqueues *owningq; + struct cobalt_resources *scope; xnhandle_t handle; }; @@ -68,10 +69,6 @@ COBALT_SYSCALL_DECL(cond_wait_epilogue, int cobalt_cond_deferred_signals(struct cobalt_cond *cond); -void cobalt_condq_cleanup(struct cobalt_kqueues *q); - -void cobalt_cond_pkg_init(void); - -void cobalt_cond_pkg_cleanup(void); +void cobalt_cond_reclaim(struct cobalt_process *process); #endif /* !_COBALT_POSIX_COND_H */ diff --git a/kernel/cobalt/posix/event.c b/kernel/cobalt/posix/event.c index f9a4cc2..475b5cd 100644 --- a/kernel/cobalt/posix/event.c +++ b/kernel/cobalt/posix/event.c @@ -52,9 +52,9 @@ COBALT_SYSCALL(event_init, current, { struct cobalt_event_shadow shadow; struct cobalt_event_state *state; + struct cobalt_resources *rs; int pshared, synflags, ret; struct cobalt_event *event; - struct cobalt_kqueues *kq; struct cobalt_umm *umm; unsigned long stateoff; spl_t s; @@ -84,11 +84,11 @@ COBALT_SYSCALL(event_init, current, event->flags = flags; synflags = (flags & COBALT_EVENT_PRIO) ? XNSYNCH_PRIO : XNSYNCH_FIFO; xnsynch_init(&event->synch, synflags, NULL); - kq = cobalt_kqueues(pshared); - event->owningq = kq; + rs = cobalt_current_resources(pshared); + event->scope = rs; xnlock_get_irqsave(&nklock, s); - list_add_tail(&event->link, &kq->eventq); + list_add_tail(&event->link, &rs->eventq); xnlock_put_irqrestore(&nklock, s); event->magic = COBALT_EVENT_MAGIC; @@ -260,7 +260,6 @@ out: } static void event_destroy(struct cobalt_event *event, - struct cobalt_kqueues *q, spl_t s) /* atomic-entry */ { struct cobalt_umm *umm; @@ -299,7 +298,7 @@ COBALT_SYSCALL(event_destroy, current, goto out; } - event_destroy(event, event->owningq, s); + event_destroy(event, s); xnsched_run(); out: @@ -394,27 +393,19 @@ COBALT_SYSCALL(event_inquire, current, return ret ?: nrwait; } -void cobalt_eventq_cleanup(struct cobalt_kqueues *q) +void cobalt_event_reclaim(struct cobalt_process *process) { + struct cobalt_resources *p = &process->resources; struct cobalt_event *event, *tmp; spl_t s; xnlock_get_irqsave(&nklock, s); - if (!list_empty(&q->eventq)) { - list_for_each_entry_safe(event, tmp, &q->eventq, link) - event_destroy(event, q, s); - } + if (list_empty(&p->eventq)) + goto out; + list_for_each_entry_safe(event, tmp, &p->eventq, link) + event_destroy(event, s); +out: xnlock_put_irqrestore(&nklock, s); } - -void cobalt_event_pkg_init(void) -{ - INIT_LIST_HEAD(&cobalt_global_kqueues.eventq); -} - -void cobalt_event_pkg_cleanup(void) -{ - cobalt_eventq_cleanup(&cobalt_global_kqueues); -} diff --git a/kernel/cobalt/posix/event.h b/kernel/cobalt/posix/event.h index f22130a..1461a3e 100644 --- a/kernel/cobalt/posix/event.h +++ b/kernel/cobalt/posix/event.h @@ -23,14 +23,15 @@ #include <cobalt/uapi/event.h> #include <xenomai/posix/syscall.h> -struct cobalt_kqueues; +struct cobalt_resources; +struct cobalt_process; struct cobalt_event { unsigned int magic; unsigned int value; struct xnsynch synch; struct cobalt_event_state *state; - struct cobalt_kqueues *owningq; + struct cobalt_resources *scope; struct list_head link; int flags; xnhandle_t handle; @@ -65,10 +66,6 @@ COBALT_SYSCALL_DECL(event_inquire, pid_t __user *u_waitlist, size_t waitsz)); -void cobalt_eventq_cleanup(struct cobalt_kqueues *q); - -void cobalt_event_pkg_init(void); - -void cobalt_event_pkg_cleanup(void); +void cobalt_event_reclaim(struct cobalt_process *process); #endif /* !_COBALT_POSIX_EVENT_H */ diff --git a/kernel/cobalt/posix/init.c b/kernel/cobalt/posix/init.c index e955a3f..bc446d8 100644 --- a/kernel/cobalt/posix/init.c +++ b/kernel/cobalt/posix/init.c @@ -32,39 +32,18 @@ LIST_HEAD(cobalt_thread_list); -struct cobalt_kqueues cobalt_global_kqueues; - -void cobalt_cleanup(void) -{ - cobalt_process_cleanup(); - cobalt_monitor_pkg_cleanup(); - cobalt_event_pkg_cleanup(); - cobalt_signal_pkg_cleanup(); - cobalt_mq_pkg_cleanup(); - cobalt_sem_pkg_cleanup(); - cobalt_cond_pkg_cleanup(); - cobalt_mutex_pkg_cleanup(); - cobalt_sched_pkg_cleanup(); -} - -int __init cobalt_init(void) +struct cobalt_resources cobalt_global_resources = { + .condq = LIST_HEAD_INIT(cobalt_global_resources.condq), + .mutexq = LIST_HEAD_INIT(cobalt_global_resources.mutexq), + .semq = LIST_HEAD_INIT(cobalt_global_resources.semq), + .monitorq = LIST_HEAD_INIT(cobalt_global_resources.monitorq), + .eventq = LIST_HEAD_INIT(cobalt_global_resources.eventq), + .schedq = LIST_HEAD_INIT(cobalt_global_resources.schedq), +}; + +__init int cobalt_init(void) { - int ret; - cobalt_time_slice = CONFIG_XENO_OPT_RR_QUANTUM * 1000; - ret = cobalt_process_init(); - if (ret) - return ret; - - cobalt_sched_pkg_init(); - cobalt_mutex_pkg_init(); - cobalt_sem_pkg_init(); - cobalt_cond_pkg_init(); - cobalt_signal_pkg_init(); - cobalt_mq_pkg_init(); - cobalt_event_pkg_init(); - cobalt_monitor_pkg_init(); - - return 0; + return cobalt_process_init(); } diff --git a/kernel/cobalt/posix/internal.h b/kernel/cobalt/posix/internal.h index f61c8ad..dd20972 100644 --- a/kernel/cobalt/posix/internal.h +++ b/kernel/cobalt/posix/internal.h @@ -47,14 +47,14 @@ #define cobalt_mark_deleted(t) ((t)->magic = ~(t)->magic) -static inline struct cobalt_kqueues *cobalt_kqueues(int pshared) +static inline struct cobalt_resources *cobalt_current_resources(int pshared) { struct cobalt_process *process; if (pshared || (process = cobalt_current_process()) == NULL) - return &cobalt_global_kqueues; + return &cobalt_global_resources; - return &process->kqueues; + return &process->resources; } static inline xnhandle_t cobalt_get_handle_from_user(xnhandle_t *u_h) @@ -65,6 +65,4 @@ static inline xnhandle_t cobalt_get_handle_from_user(xnhandle_t *u_h) int cobalt_init(void); -void cobalt_cleanup(void); - #endif /* !_COBALT_POSIX_INTERNAL_H */ diff --git a/kernel/cobalt/posix/monitor.c b/kernel/cobalt/posix/monitor.c index 380a75f..4e19af4 100644 --- a/kernel/cobalt/posix/monitor.c +++ b/kernel/cobalt/posix/monitor.c @@ -54,8 +54,8 @@ COBALT_SYSCALL(monitor_init, current, { struct cobalt_monitor_shadow shadow; struct cobalt_monitor_state *state; + struct cobalt_resources *rs; struct cobalt_monitor *mon; - struct cobalt_kqueues *kq; int pshared, tmode, ret; struct cobalt_umm *umm; unsigned long stateoff; @@ -90,11 +90,11 @@ COBALT_SYSCALL(monitor_init, current, mon->flags = flags; mon->tmode = tmode; INIT_LIST_HEAD(&mon->waiters); - kq = cobalt_kqueues(pshared); - mon->owningq = kq; + rs = cobalt_current_resources(pshared); + mon->scope = rs; xnlock_get_irqsave(&nklock, s); - list_add_tail(&mon->link, &kq->monitorq); + list_add_tail(&mon->link, &rs->monitorq); xnlock_put_irqrestore(&nklock, s); mon->magic = COBALT_MONITOR_MAGIC; @@ -376,8 +376,7 @@ COBALT_SYSCALL(monitor_exit, primary, return ret; } -static void monitor_destroy(struct cobalt_monitor *mon, - struct cobalt_kqueues *q) +static void monitor_destroy(struct cobalt_monitor *mon) { struct cobalt_umm *umm; int pshared; @@ -437,7 +436,7 @@ COBALT_SYSCALL(monitor_destroy, primary, xnlock_put_irqrestore(&nklock, s); - monitor_destroy(mon, mon->owningq); + monitor_destroy(mon); xnsched_run(); @@ -448,32 +447,23 @@ COBALT_SYSCALL(monitor_destroy, primary, return ret; } -void cobalt_monitorq_cleanup(struct cobalt_kqueues *q) +void cobalt_monitor_reclaim(struct cobalt_process *process) { + struct cobalt_resources *p = &process->resources; struct cobalt_monitor *mon, *tmp; spl_t s; xnlock_get_irqsave(&nklock, s); - if (list_empty(&q->monitorq)) + if (list_empty(&p->monitorq)) goto out; - list_for_each_entry_safe(mon, tmp, &q->monitorq, link) { + list_for_each_entry_safe(mon, tmp, &p->monitorq, link) { mon->magic = 0; xnlock_put_irqrestore(&nklock, s); - monitor_destroy(mon, q); + monitor_destroy(mon); xnlock_get_irqsave(&nklock, s); } out: xnlock_put_irqrestore(&nklock, s); } - -void cobalt_monitor_pkg_init(void) -{ - INIT_LIST_HEAD(&cobalt_global_kqueues.monitorq); -} - -void cobalt_monitor_pkg_cleanup(void) -{ - cobalt_monitorq_cleanup(&cobalt_global_kqueues); -} diff --git a/kernel/cobalt/posix/monitor.h b/kernel/cobalt/posix/monitor.h index fc77084..80cafbb 100644 --- a/kernel/cobalt/posix/monitor.h +++ b/kernel/cobalt/posix/monitor.h @@ -23,14 +23,15 @@ #include <cobalt/uapi/monitor.h> #include <xenomai/posix/syscall.h> -struct cobalt_kqueues; +struct cobalt_resources; +struct cobalt_process; struct cobalt_monitor { unsigned int magic; struct xnsynch gate; struct xnsynch drain; struct cobalt_monitor_state *state; - struct cobalt_kqueues *owningq; + struct cobalt_resources *scope; struct list_head link; struct list_head waiters; int flags; @@ -64,10 +65,6 @@ COBALT_SYSCALL_DECL(monitor_wait, COBALT_SYSCALL_DECL(monitor_destroy, (struct cobalt_monitor_shadow __user *u_monsh)); -void cobalt_monitorq_cleanup(struct cobalt_kqueues *q); - -void cobalt_monitor_pkg_init(void); - -void cobalt_monitor_pkg_cleanup(void); +void cobalt_monitor_reclaim(struct cobalt_process *process); #endif /* !_COBALT_POSIX_MONITOR_H */ diff --git a/kernel/cobalt/posix/mqueue.c b/kernel/cobalt/posix/mqueue.c index 8d5758a..5ffa5f9 100644 --- a/kernel/cobalt/posix/mqueue.c +++ b/kernel/cobalt/posix/mqueue.c @@ -83,7 +83,7 @@ static struct mq_attr default_attr = { .mq_msgsize = 8192, }; -static struct list_head cobalt_mqq; +static LIST_HEAD(cobalt_mqq); static inline struct cobalt_msg *mq_msg_alloc(struct cobalt_mq *mq) { @@ -1004,29 +1004,3 @@ COBALT_SYSCALL(mq_timedreceive, primary, return ret ?: cobalt_copy_to_user(u_len, &len, sizeof(*u_len)); } - -int cobalt_mq_pkg_init(void) -{ - INIT_LIST_HEAD(&cobalt_mqq); - - return 0; -} - -void cobalt_mq_pkg_cleanup(void) -{ - struct cobalt_mq *mq, *tmp; - spl_t s; - - xnlock_get_irqsave(&nklock, s); - - if (list_empty(&cobalt_mqq)) - goto out; - - list_for_each_entry_safe(mq, tmp, &cobalt_mqq, link) { - xnlock_put_irqrestore(&nklock, s); - mq_destroy(mq); - xnlock_get_irqsave(&nklock, s); - } -out: - xnlock_put_irqrestore(&nklock, s); -} diff --git a/kernel/cobalt/posix/mqueue.h b/kernel/cobalt/posix/mqueue.h index 2af5660..acae2a4 100644 --- a/kernel/cobalt/posix/mqueue.h +++ b/kernel/cobalt/posix/mqueue.h @@ -71,8 +71,4 @@ COBALT_SYSCALL_DECL(mq_timedreceive, COBALT_SYSCALL_DECL(mq_notify, (mqd_t fd, const struct sigevent *__user evp)); -int cobalt_mq_pkg_init(void); - -void cobalt_mq_pkg_cleanup(void); - #endif /* !_COBALT_POSIX_MQUEUE_H */ diff --git a/kernel/cobalt/posix/mutex.c b/kernel/cobalt/posix/mutex.c index 1bd4c07..78fba35 100644 --- a/kernel/cobalt/posix/mutex.c +++ b/kernel/cobalt/posix/mutex.c @@ -28,12 +28,12 @@ static int cobalt_mutex_init_inner(struct cobalt_mutex_shadow *shadow, const struct cobalt_mutexattr *attr) { int synch_flags = XNSYNCH_PRIO | XNSYNCH_OWNER; + struct cobalt_resources *rs; struct cobalt_ppd *sys_ppd; - struct cobalt_kqueues *kq; spl_t s; int err; - kq = cobalt_kqueues(attr->pshared); + rs = cobalt_current_resources(attr->pshared); sys_ppd = cobalt_ppd_get(attr->pshared); err = xnregistry_enter_anon(mutex, &shadow->handle); if (err < 0) @@ -54,18 +54,18 @@ static int cobalt_mutex_init_inner(struct cobalt_mutex_shadow *shadow, state->flags = (attr->type == PTHREAD_MUTEX_ERRORCHECK ? COBALT_MUTEX_ERRORCHECK : 0); mutex->attr = *attr; - mutex->owningq = kq; + mutex->scope = rs; INIT_LIST_HEAD(&mutex->conds); xnlock_get_irqsave(&nklock, s); - list_add_tail(&mutex->link, &kq->mutexq); + list_add_tail(&mutex->link, &rs->mutexq); xnlock_put_irqrestore(&nklock, s); return 0; } static void -cobalt_mutex_destroy_inner(xnhandle_t handle, struct cobalt_kqueues *q) +cobalt_mutex_destroy_inner(xnhandle_t handle) { struct cobalt_mutex *mutex; spl_t s; @@ -74,16 +74,15 @@ cobalt_mutex_destroy_inner(xnhandle_t handle, struct cobalt_kqueues *q) mutex = xnregistry_lookup(handle, NULL); if (!cobalt_obj_active(mutex, COBALT_MUTEX_MAGIC, typeof(*mutex))) { xnlock_put_irqrestore(&nklock, s); - printk(XENO_WARNING "mutex_destroy: invalid mutex %x\n", - mutex ? mutex->magic : ~0); + printk(XENO_WARNING "%s: invalid mutex %x\n", + __func__, mutex ? mutex->magic : ~0); return; } xnregistry_remove(handle); list_del(&mutex->link); /* - * synchbase wait queue may not be empty only when this - * function is called from cobalt_mutex_pkg_cleanup, hence the - * absence of xnsched_run(). + * At this point, synchbase wait queue must be empty, so we + * don't need to reschedule. */ xnsynch_destroy(&mutex->synchbase); cobalt_mark_deleted(mutex); @@ -130,7 +129,7 @@ int cobalt_mutex_release(struct xnthread *cur, return -EINVAL; #if XENO_DEBUG(USER) - if (mutex->owningq != cobalt_kqueues(mutex->attr.pshared)) + if (mutex->scope != cobalt_current_resources(mutex->attr.pshared)) return -EPERM; #endif state = container_of(mutex->synchbase.fastlock, struct cobalt_mutex_state, owner); @@ -176,7 +175,7 @@ redo: goto out; } #if XENO_DEBUG(USER) - if (mutex->owningq != cobalt_kqueues(mutex->attr.pshared)) { + if (mutex->scope != cobalt_current_resources(mutex->attr.pshared)) { ret = -EPERM; goto out; } @@ -303,7 +302,7 @@ COBALT_SYSCALL(mutex_destroy, current, err = -EINVAL; goto err_unlock; } - if (cobalt_kqueues(mutex->attr.pshared) != mutex->owningq) { + if (cobalt_current_resources(mutex->attr.pshared) != mutex->scope) { err = -EPERM; goto err_unlock; } @@ -323,7 +322,7 @@ COBALT_SYSCALL(mutex_destroy, current, cobalt_mark_deleted(&mx); xnlock_put_irqrestore(&nklock, s); - cobalt_mutex_destroy_inner(mx.handle, mutex->owningq); + cobalt_mutex_destroy_inner(mx.handle); return cobalt_copy_to_user(u_mx, &mx, sizeof(*u_mx)); } @@ -417,31 +416,22 @@ COBALT_SYSCALL(mutex_unlock, nonrestartable, return err; } -void cobalt_mutexq_cleanup(struct cobalt_kqueues *q) +void cobalt_mutex_reclaim(struct cobalt_process *process) { + struct cobalt_resources *p = &process->resources; struct cobalt_mutex *mutex, *tmp; spl_t s; xnlock_get_irqsave(&nklock, s); - if (list_empty(&q->mutexq)) + if (list_empty(&p->mutexq)) goto out; - list_for_each_entry_safe(mutex, tmp, &q->mutexq, link) { + list_for_each_entry_safe(mutex, tmp, &p->mutexq, link) { xnlock_put_irqrestore(&nklock, s); - cobalt_mutex_destroy_inner(mutex->handle, q); + cobalt_mutex_destroy_inner(mutex->handle); xnlock_get_irqsave(&nklock, s); } out: xnlock_put_irqrestore(&nklock, s); } - -void cobalt_mutex_pkg_init(void) -{ - INIT_LIST_HEAD(&cobalt_global_kqueues.mutexq); -} - -void cobalt_mutex_pkg_cleanup(void) -{ - cobalt_mutexq_cleanup(&cobalt_global_kqueues); -} diff --git a/kernel/cobalt/posix/mutex.h b/kernel/cobalt/posix/mutex.h index 343ad82..df1a537 100644 --- a/kernel/cobalt/posix/mutex.h +++ b/kernel/cobalt/posix/mutex.h @@ -23,6 +23,8 @@ #include <cobalt/uapi/mutex.h> #include <xenomai/posix/syscall.h> +struct cobalt_process; + struct cobalt_mutex { unsigned int magic; struct xnsynch synchbase; @@ -30,7 +32,7 @@ struct cobalt_mutex { struct list_head link; struct list_head conds; struct cobalt_mutexattr attr; - struct cobalt_kqueues *owningq; + struct cobalt_resources *scope; xnhandle_t handle; }; @@ -69,10 +71,6 @@ COBALT_SYSCALL_DECL(mutex_unlock, int cobalt_mutex_release(struct xnthread *cur, struct cobalt_mutex *mutex); -void cobalt_mutexq_cleanup(struct cobalt_kqueues *q); - -void cobalt_mutex_pkg_init(void); - -void cobalt_mutex_pkg_cleanup(void); +void cobalt_mutex_reclaim(struct cobalt_process *process); #endif /* !_COBALT_POSIX_MUTEX_H */ diff --git a/kernel/cobalt/posix/nsem.c b/kernel/cobalt/posix/nsem.c index 43d66db..4ed2e80 100644 --- a/kernel/cobalt/posix/nsem.c +++ b/kernel/cobalt/posix/nsem.c @@ -36,11 +36,12 @@ struct named_sem { struct filename *filename; }; -static struct named_sem *sem_search(struct cobalt_process *cc, xnhandle_t handle) +static struct named_sem * +sem_search(struct cobalt_process *process, xnhandle_t handle) { struct xnid *i; - i = xnid_fetch(&cc->usems, handle); + i = xnid_fetch(&process->usems, handle); if (i == NULL) return NULL; @@ -48,8 +49,10 @@ static struct named_sem *sem_search(struct cobalt_process *cc, xnhandle_t handle } static struct cobalt_sem_shadow __user * -sem_open(struct cobalt_process *cc, struct cobalt_sem_shadow __user *ushadow, - struct filename *filename, int oflags, mode_t mode, unsigned int value) +sem_open(struct cobalt_process *process, + struct cobalt_sem_shadow __user *ushadow, + struct filename *filename, int oflags, mode_t mode, + unsigned int value) { const char *name = filename->name; struct cobalt_sem_shadow shadow; @@ -71,7 +74,7 @@ sem_open(struct cobalt_process *cc, struct cobalt_sem_shadow __user *ushadow, return ERR_PTR(-EEXIST); xnlock_get_irqsave(&named_sem_lock, s); - u = sem_search(cc, handle); + u = sem_search(process, handle); if (u) { ++u->refs; xnlock_put_irqrestore(&named_sem_lock, s); @@ -131,7 +134,7 @@ sem_open(struct cobalt_process *cc, struct cobalt_sem_shadow __user *ushadow, u->filename = filename; xnlock_get_irqsave(&named_sem_lock, s); - v = sem_search(cc, handle); + v = sem_search(process, handle); if (v) { ++v->refs; xnlock_put_irqrestore(&named_sem_lock, s); @@ -143,7 +146,7 @@ sem_open(struct cobalt_process *cc, struct cobalt_sem_shadow __user *ushadow, xnfree(u); u = v; } else { - xnid_enter(&cc->usems, &u->id, handle); + xnid_enter(&process->usems, &u->id, handle); xnlock_put_irqrestore(&named_sem_lock, s); } @@ -152,14 +155,14 @@ sem_open(struct cobalt_process *cc, struct cobalt_sem_shadow __user *ushadow, return u->usem; } -static int sem_close(struct cobalt_process *cc, xnhandle_t handle) +static int sem_close(struct cobalt_process *process, xnhandle_t handle) { struct named_sem *u; spl_t s; int err; xnlock_get_irqsave(&named_sem_lock, s); - u = sem_search(cc, handle); + u = sem_search(process, handle); if (u == NULL) { err = -ENOENT; goto err_unlock; @@ -170,7 +173,7 @@ static int sem_close(struct cobalt_process *cc, xnhandle_t handle) goto err_unlock; } - xnid_remove(&cc->usems, &u->id); + xnid_remove(&process->usems, &u->id); xnlock_put_irqrestore(&named_sem_lock, s); __cobalt_sem_destroy(handle); @@ -195,18 +198,18 @@ __cobalt_sem_open(struct cobalt_sem_shadow __user *usm, const char __user *u_name, int oflags, mode_t mode, unsigned int value) { + struct cobalt_process *process; struct filename *filename; - struct cobalt_process *cc; - cc = cobalt_current_process(); - if (cc == NULL) + process = cobalt_current_process(); + if (process == NULL) return ERR_PTR(-EPERM); filename = getname(u_name); if (IS_ERR(filename)) return ERR_CAST(filename); - usm = sem_open(cc, usm, filename, oflags, mode, value); + usm = sem_open(process, usm, filename, oflags, mode, value); if (IS_ERR(usm)) { trace_cobalt_psem_open_failed(filename->name, oflags, mode, value, PTR_ERR(usm)); @@ -236,17 +239,17 @@ COBALT_SYSCALL(sem_open, lostage, COBALT_SYSCALL(sem_close, lostage, (struct cobalt_sem_shadow __user *usm)) { - struct cobalt_process *cc; + struct cobalt_process *process; xnhandle_t handle; - cc = cobalt_current_process(); - if (cc == NULL) + process = cobalt_current_process(); + if (process == NULL) return -EPERM; handle = cobalt_get_handle_from_user(&usm->handle); trace_cobalt_psem_close(handle); - return sem_close(cc, handle); + return sem_close(process, handle); } static inline int sem_unlink(const char *name) @@ -283,18 +286,17 @@ COBALT_SYSCALL(sem_unlink, lostage, return ret; } -static void cleanup_named_sems(void *cookie, struct xnid *i) +static void reclaim_named_sem(void *arg, struct xnid *i) { - struct cobalt_process *cc; + struct cobalt_process *process = arg; struct named_sem *u; - cc = cookie; u = container_of(i, struct named_sem, id); u->refs = 1; - sem_close(cc, xnid_key(i)); + sem_close(process, xnid_key(i)); } -void cobalt_sem_usems_cleanup(struct cobalt_process *cc) +void cobalt_nsem_reclaim(struct cobalt_process *process) { - xntree_cleanup(&cc->usems, cc, cleanup_named_sems); + xntree_cleanup(&process->usems, process, reclaim_named_sem); } diff --git a/kernel/cobalt/posix/process.c b/kernel/cobalt/posix/process.c index 1ae494f..06ff84f 100644 --- a/kernel/cobalt/posix/process.c +++ b/kernel/cobalt/posix/process.c @@ -1320,12 +1320,12 @@ static void *cobalt_process_attach(void) return ERR_PTR(ret); } - INIT_LIST_HEAD(&process->kqueues.condq); - INIT_LIST_HEAD(&process->kqueues.mutexq); - INIT_LIST_HEAD(&process->kqueues.semq); - INIT_LIST_HEAD(&process->kqueues.monitorq); - INIT_LIST_HEAD(&process->kqueues.eventq); - INIT_LIST_HEAD(&process->kqueues.schedq); + INIT_LIST_HEAD(&process->resources.condq); + INIT_LIST_HEAD(&process->resources.mutexq); + INIT_LIST_HEAD(&process->resources.semq); + INIT_LIST_HEAD(&process->resources.monitorq); + INIT_LIST_HEAD(&process->resources.eventq); + INIT_LIST_HEAD(&process->resources.schedq); INIT_LIST_HEAD(&process->sigwaiters); xntree_init(&process->usems); bitmap_fill(process->timers_map, CONFIG_XENO_OPT_NRTIMERS); @@ -1355,14 +1355,14 @@ static void cobalt_process_detach(void *arg) { struct cobalt_process *process = arg; - cobalt_sem_usems_cleanup(process); - cobalt_timers_cleanup(process); - cobalt_monitorq_cleanup(&process->kqueues); - cobalt_semq_cleanup(&process->kqueues); - cobalt_mutexq_cleanup(&process->kqueues); - cobalt_condq_cleanup(&process->kqueues); - cobalt_eventq_cleanup(&process->kqueues); - cobalt_sched_cleanup(&process->kqueues); + cobalt_nsem_reclaim(process); + cobalt_timer_reclaim(process); + cobalt_cond_reclaim(process); + cobalt_mutex_reclaim(process); + cobalt_sem_reclaim(process); + cobalt_monitor_reclaim(process); + cobalt_event_reclaim(process); + cobalt_sched_reclaim(process); detach_process(process); /* * The cobalt_process descriptor release may be deferred until @@ -1408,11 +1408,17 @@ int cobalt_process_init(void) if (ret) goto fail_register; + ret = cobalt_signal_init(); + if (ret) + goto fail_siginit; + init_hostrt(); ipipe_set_hooks(ipipe_root_domain, IPIPE_SYSCALL|IPIPE_KEVENT); ipipe_set_hooks(&xnsched_realtime_domain, IPIPE_SYSCALL|IPIPE_TRAP); return 0; +fail_siginit: + cobalt_unregister_personality(0); fail_register: cobalt_memdev_cleanup(); fail_memdev: @@ -1426,23 +1432,6 @@ fail_debug: return ret; } -void cobalt_process_cleanup(void) -{ - cobalt_unregister_personality(cobalt_personality.xid); - cobalt_memdev_cleanup(); - xnsynch_destroy(&yield_sync); - ipipe_set_hooks(&xnsched_realtime_domain, 0); - ipipe_set_hooks(ipipe_root_domain, 0); - - xnarch_cleanup_mayday(); - xndebug_cleanup(); - - if (process_hash) { - kfree(process_hash); - process_hash = NULL; - } -} - struct xnthread_personality cobalt_personality = { .name = "cobalt", .magic = 0, diff --git a/kernel/cobalt/posix/process.h b/kernel/cobalt/posix/process.h index 7c9ab2f..5891559 100644 --- a/kernel/cobalt/posix/process.h +++ b/kernel/cobalt/posix/process.h @@ -34,7 +34,7 @@ struct mm_struct; struct xnthread_personality; struct cobalt_timer; -struct cobalt_kqueues { +struct cobalt_resources { struct list_head condq; struct list_head mutexq; struct list_head semq; @@ -48,9 +48,9 @@ struct cobalt_process { struct hlist_node hlink; struct cobalt_ppd sys_ppd; unsigned long permap; - struct cobalt_kqueues kqueues; struct rb_root usems; struct list_head sigwaiters; + struct cobalt_resources resources; DECLARE_BITMAP(timers_map, CONFIG_XENO_OPT_NRTIMERS); struct cobalt_timer *timers[CONFIG_XENO_OPT_NRTIMERS]; void *priv[NR_PERSONALITIES]; @@ -58,7 +58,7 @@ struct cobalt_process { extern struct list_head cobalt_thread_list; -extern struct cobalt_kqueues cobalt_global_kqueues; +extern struct cobalt_resources cobalt_global_resources; int cobalt_register_personality(struct xnthread_personality *personality); @@ -82,8 +82,6 @@ int cobalt_yield(xnticks_t min, xnticks_t max); int cobalt_process_init(void); -void cobalt_process_cleanup(void); - static inline struct cobalt_process *cobalt_current_process(void) { return ipipe_current_threadinfo()->process; diff --git a/kernel/cobalt/posix/sched.c b/kernel/cobalt/posix/sched.c index 94a9b74..0e7d405 100644 --- a/kernel/cobalt/posix/sched.c +++ b/kernel/cobalt/posix/sched.c @@ -395,7 +395,7 @@ int set_quota_config(int cpu, union sched_config *config, size_t len) return -ENOMEM; tg = &group->quota; group->pshared = p->add.pshared != 0; - group->kq = cobalt_kqueues(group->pshared); + group->scope = cobalt_current_resources(group->pshared); xnlock_get_irqsave(&nklock, s); sched = xnsched_struct(cpu); ret = xnsched_quota_create_group(tg, sched, "a_sum); @@ -404,7 +404,7 @@ int set_quota_config(int cpu, union sched_config *config, size_t len) xnfree(group); return ret; } - list_add(&group->next, &group->kq->schedq); + list_add(&group->next, &group->scope->schedq); xnlock_put_irqrestore(&nklock, s); break; case sched_quota_remove: @@ -415,7 +415,7 @@ int set_quota_config(int cpu, union sched_config *config, size_t len) if (tg == NULL) goto bad_tgid; group = container_of(tg, struct cobalt_sched_group, quota); - if (group->kq != cobalt_kqueues(group->pshared)) + if (group->scope != cobalt_current_resources(group->pshared)) goto bad_tgid; ret = xnsched_quota_destroy_group(tg, p->op == sched_quota_force_remove, @@ -435,7 +435,7 @@ int set_quota_config(int cpu, union sched_config *config, size_t len) if (tg == NULL) goto bad_tgid; group = container_of(tg, struct cobalt_sched_group, quota); - if (group->kq != cobalt_kqueues(group->pshared)) + if (group->scope != cobalt_current_resources(group->pshared)) goto bad_tgid; xnsched_quota_set_limit(tg, p->set.quota, p->set.quota_peak, "a_sum); @@ -485,7 +485,7 @@ ssize_t get_quota_config(int cpu, void __user *u_config, size_t len, goto bad_tgid; group = container_of(tg, struct cobalt_sched_group, quota); - if (group->kq != cobalt_kqueues(group->pshared)) + if (group->scope != cobalt_current_resources(group->pshared)) goto bad_tgid; config->quota.info.tgid = tg->tgid; @@ -711,8 +711,9 @@ COBALT_SYSCALL(sched_weightprio, current, return __cobalt_sched_weightprio(policy, ¶m_ex); } -void cobalt_sched_cleanup(struct cobalt_kqueues *q) +void cobalt_sched_reclaim(struct cobalt_process *process) { + struct cobalt_resources *p = &process->resources; struct cobalt_sched_group *group; #ifdef CONFIG_XENO_OPT_SCHED_QUOTA int quota_sum; @@ -721,11 +722,8 @@ void cobalt_sched_cleanup(struct cobalt_kqueues *q) xnlock_get_irqsave(&nklock, s); - for (;;) { - if (list_empty(&q->schedq)) - break; - - group = list_get_entry(&q->schedq, struct cobalt_sched_group, next); + while (!list_empty(&p->schedq)) { + group = list_get_entry(&p->schedq, struct cobalt_sched_group, next); #ifdef CONFIG_XENO_OPT_SCHED_QUOTA xnsched_quota_destroy_group(&group->quota, 1, "a_sum); #endif @@ -736,13 +734,3 @@ void cobalt_sched_cleanup(struct cobalt_kqueues *q) xnlock_put_irqrestore(&nklock, s); } - -void cobalt_sched_pkg_init(void) -{ - INIT_LIST_HEAD(&cobalt_global_kqueues.schedq); -} - -void cobalt_sched_pkg_cleanup(void) -{ - cobalt_sched_cleanup(&cobalt_global_kqueues); -} diff --git a/kernel/cobalt/posix/sched.h b/kernel/cobalt/posix/sched.h index 40d7d56..ae7b618 100644 --- a/kernel/cobalt/posix/sched.h +++ b/kernel/cobalt/posix/sched.h @@ -22,13 +22,14 @@ #include <cobalt/kernel/sched.h> #include <xenomai/posix/syscall.h> -struct cobalt_kqueues; +struct cobalt_resources; +struct cobalt_process; struct cobalt_sched_group { #ifdef CONFIG_XENO_OPT_SCHED_QUOTA struct xnsched_quota_group quota; #endif - struct cobalt_kqueues *kq; + struct cobalt_resources *scope; int pshared; struct list_head next; }; @@ -81,10 +82,6 @@ COBALT_SYSCALL_DECL(sched_getconfig_np, union sched_config __user *u_config, size_t len)); -void cobalt_sched_cleanup(struct cobalt_kqueues *q); - -void cobalt_sched_pkg_init(void); - -void cobalt_sched_pkg_cleanup(void); +void cobalt_sched_reclaim(struct cobalt_process *process); #endif /* !_COBALT_POSIX_SCHED_H */ diff --git a/kernel/cobalt/posix/sem.c b/kernel/cobalt/posix/sem.c index fc89c24..3f18a4c 100644 --- a/kernel/cobalt/posix/sem.c +++ b/kernel/cobalt/posix/sem.c @@ -24,10 +24,10 @@ #include "sem.h" #include <trace/events/cobalt-posix.h> -static inline struct cobalt_kqueues *sem_kqueue(struct cobalt_sem *sem) +static inline struct cobalt_resources *sem_kqueue(struct cobalt_sem *sem) { int pshared = !!(sem->flags & SEM_PSHARED); - return cobalt_kqueues(pshared); + return cobalt_current_resources(pshared); } int __cobalt_sem_destroy(xnhandle_t handle) @@ -73,7 +73,7 @@ __cobalt_sem_init(const char *name, struct cobalt_sem_shadow *sm, { struct cobalt_sem_state *state; struct cobalt_sem *sem, *osem; - struct cobalt_kqueues *kq; + struct cobalt_resources *rs; struct cobalt_ppd *sys_ppd; int ret, sflags; spl_t s; @@ -98,8 +98,8 @@ __cobalt_sem_init(const char *name, struct cobalt_sem_shadow *sm, xnlock_get_irqsave(&nklock, s); - kq = cobalt_kqueues(!!(flags & SEM_PSHARED)); - if (list_empty(&kq->semq)) + rs = cobalt_current_resources(!!(flags & SEM_PSHARED)); + if (list_empty(&rs->semq)) goto do_init; if (sm->magic != COBALT_SEM_MAGIC && @@ -136,7 +136,7 @@ __cobalt_sem_init(const char *name, struct cobalt_sem_shadow *sm, goto err_lock_put; sem->magic = COBALT_SEM_MAGIC; - list_add_tail(&sem->link, &kq->semq); + list_add_tail(&sem->link, &rs->semq); sflags = flags & SEM_FIFO ? 0 : XNSYNCH_PRIO; xnsynch_init(&sem->synchbase, sflags, NULL); @@ -144,7 +144,7 @@ __cobalt_sem_init(const char *name, struct cobalt_sem_shadow *sm, atomic_set(&state->value, value); state->flags = flags; sem->flags = flags; - sem->owningq = kq; + sem->scope = rs; sem->refs = name ? 2 : 1; sm->magic = name ? COBALT_NAMED_SEM_MAGIC : COBALT_SEM_MAGIC; @@ -187,7 +187,7 @@ static int sem_destroy(struct cobalt_sem_shadow *sm) goto error; } - if (sem_kqueue(sem) != sem->owningq) { + if (sem_kqueue(sem) != sem->scope) { ret = -EPERM; goto error; } @@ -219,7 +219,7 @@ static inline int sem_trywait_inner(struct cobalt_sem *sem) return -EINVAL; #if XENO_DEBUG(USER) - if (sem->owningq != sem_kqueue(sem)) + if (sem->scope != sem_kqueue(sem)) return -EPERM; #endif @@ -241,7 +241,8 @@ static int sem_trywait(xnhandle_t handle) return err; } -static int sem_post_inner(struct cobalt_sem *sem, struct cobalt_kqueues *ownq, int bcast) +static int sem_post_inner(struct cobalt_sem *sem, + struct cobalt_resources *ownq, int bcast) { if (sem == NULL || sem->magic != COBALT_SEM_MAGIC) return -EINVAL; @@ -290,7 +291,7 @@ static int sem_wait(xnhandle_t handle) if (info & XNRMID) { ret = -EINVAL; } else if (info & XNBREAK) { - sem_post_inner(sem, sem->owningq, 0); + sem_post_inner(sem, sem->scope, 0); ret = -EINTR; } out: @@ -376,7 +377,7 @@ static int sem_post(xnhandle_t handle) xnlock_get_irqsave(&nklock, s); sm = xnregistry_lookup(handle, NULL); - ret = sem_post_inner(sm, sm->owningq, 0); + ret = sem_post_inner(sm, sm->scope, 0); xnlock_put_irqrestore(&nklock, s); return ret; @@ -396,7 +397,7 @@ static int sem_getvalue(xnhandle_t handle, int *value) return -EINVAL; } - if (sem->owningq != sem_kqueue(sem)) { + if (sem->scope != sem_kqueue(sem)) { xnlock_put_irqrestore(&nklock, s); return -EPERM; } @@ -519,7 +520,7 @@ COBALT_SYSCALL(sem_broadcast_np, current, xnlock_get_irqsave(&nklock, s); sm = xnregistry_lookup(handle, NULL); - err = sem_post_inner(sm, sm->owningq, 1); + err = sem_post_inner(sm, sm->scope, 1); xnlock_put_irqrestore(&nklock, s); return err; @@ -608,17 +609,18 @@ COBALT_SYSCALL(sem_inquire, current, return ret ?: nrwait; } -void cobalt_semq_cleanup(struct cobalt_kqueues *q) +void cobalt_sem_reclaim(struct cobalt_process *process) { + struct cobalt_resources *p = &process->resources; struct cobalt_sem *sem, *tmp; spl_t s; xnlock_get_irqsave(&nklock, s); - if (list_empty(&q->semq)) + if (list_empty(&p->semq)) goto out; - list_for_each_entry_safe(sem, tmp, &q->semq, link) { + list_for_each_entry_safe(sem, tmp, &p->semq, link) { xnlock_put_irqrestore(&nklock, s); if (sem->flags & SEM_NAMED) __cobalt_sem_unlink(sem->handle); @@ -628,14 +630,3 @@ void cobalt_semq_cleanup(struct cobalt_kqueues *q) out: xnlock_put_irqrestore(&nklock, s); } - - -void cobalt_sem_pkg_init(void) -{ - INIT_LIST_HEAD(&cobalt_global_kqueues.semq); -} - -void cobalt_sem_pkg_cleanup(void) -{ - cobalt_semq_cleanup(&cobalt_global_kqueues); -} diff --git a/kernel/cobalt/posix/sem.h b/kernel/cobalt/posix/sem.h index 1cc6b58..56a4da4 100644 --- a/kernel/cobalt/posix/sem.h +++ b/kernel/cobalt/posix/sem.h @@ -33,7 +33,7 @@ struct cobalt_sem { struct list_head link; struct cobalt_sem_state *state; int flags; - struct cobalt_kqueues *owningq; + struct cobalt_resources *scope; xnhandle_t handle; unsigned int refs; }; @@ -72,7 +72,7 @@ int __cobalt_sem_destroy(xnhandle_t handle); void __cobalt_sem_unlink(xnhandle_t handle); -void cobalt_sem_usems_cleanup(struct cobalt_process *cc); +void cobalt_nsem_reclaim(struct cobalt_process *process); struct cobalt_sem * __cobalt_sem_init(const char *name, struct cobalt_sem_shadow *sem, @@ -121,10 +121,6 @@ COBALT_SYSCALL_DECL(sem_inquire, pid_t __user *u_waitlist, size_t waitsz)); -void cobalt_semq_cleanup(struct cobalt_kqueues *q); - -void cobalt_sem_pkg_init(void); - -void cobalt_sem_pkg_cleanup(void); +void cobalt_sem_reclaim(struct cobalt_process *process); #endif /* !_COBALT_POSIX_SEM_H */ diff --git a/kernel/cobalt/posix/signal.c b/kernel/cobalt/posix/signal.c index 86b7b00..d6cda8e 100644 --- a/kernel/cobalt/posix/signal.c +++ b/kernel/cobalt/posix/signal.c @@ -589,7 +589,7 @@ COBALT_SYSCALL(sigqueue, conforming, return ret ?: __cobalt_sigqueue(pid, sig, &val); } -int cobalt_signal_pkg_init(void) +__init int cobalt_signal_init(void) { struct cobalt_sigpending *sigp; @@ -603,8 +603,3 @@ int cobalt_signal_pkg_init(void) return 0; } - -void cobalt_signal_pkg_cleanup(void) -{ - free_pages_exact(sigpending_mem, __SIGPOOL_SIZE); -} diff --git a/kernel/cobalt/posix/signal.h b/kernel/cobalt/posix/signal.h index 63354d5..993c48b 100644 --- a/kernel/cobalt/posix/signal.h +++ b/kernel/cobalt/posix/signal.h @@ -112,8 +112,6 @@ COBALT_SYSCALL_DECL(kill, (pid_t pid, int sig)); COBALT_SYSCALL_DECL(sigqueue, (pid_t pid, int sig, const union sigval __user *u_value)); -int cobalt_signal_pkg_init(void); - -void cobalt_signal_pkg_cleanup(void); +int cobalt_signal_init(void); #endif /* !_COBALT_POSIX_SIGNAL_H */ diff --git a/kernel/cobalt/posix/timer.c b/kernel/cobalt/posix/timer.c index 925219d..0adc112 100644 --- a/kernel/cobalt/posix/timer.c +++ b/kernel/cobalt/posix/timer.c @@ -568,7 +568,7 @@ int cobalt_timer_deliver(timer_t timerid) /* nklocked, IRQs off. */ return timer->overruns; } -void cobalt_timers_cleanup(struct cobalt_process *p) +void cobalt_timer_reclaim(struct cobalt_process *p) { struct cobalt_timer *timer; unsigned id; diff --git a/kernel/cobalt/posix/timer.h b/kernel/cobalt/posix/timer.h index 630faec..f0b41f0 100644 --- a/kernel/cobalt/posix/timer.h +++ b/kernel/cobalt/posix/timer.h @@ -25,9 +25,6 @@ #include <xenomai/posix/signal.h> #include <xenomai/posix/syscall.h> -struct cobalt_thread; -struct cobalt_kqueues; - struct cobalt_timer { struct xntimer timerbase; timer_t id; @@ -40,7 +37,7 @@ struct cobalt_timer { int cobalt_timer_deliver(timer_t timerid); -void cobalt_timers_cleanup(struct cobalt_process *p); +void cobalt_timer_reclaim(struct cobalt_process *p); static inline timer_t cobalt_timer_id(const struct cobalt_timer *timer) { _______________________________________________ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git