Module: xenomai-forge
Branch: next
Commit: a4a6ff9a9c9614d3e8ac860386fa3b168c649af0
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=a4a6ff9a9c9614d3e8ac860386fa3b168c649af0

Author: Philippe Gerum <r...@xenomai.org>
Date:   Mon Jun 16 18:39:44 2014 +0200

cobalt/posix: drop pthread_make_periodic_np/wait_period_np services

We have no more in-tree users of these calls.

With the introduction of services to support real-time signals, those
two non-portable calls have become redundant. Instead, Cobalt-based
applications should create a periodic timer using the timer_create()
call, and wait for release points via sigwaitinfo(), checking for
overruns by looking at the siginfo.si_overrun field.

Alternatively, applications may include a timer source in a
synchronous multiplexing operation, by passing a file descriptor
returned by the timerfd() service to a select() call.

---

 include/cobalt/pthread.h           |    7 ----
 include/cobalt/uapi/syscall.h      |    3 +-
 kernel/cobalt/posix/syscall.c      |    2 -
 kernel/cobalt/posix/thread.c       |   75 ------------------------------------
 kernel/cobalt/posix/thread.h       |    7 ----
 kernel/cobalt/trace/cobalt-posix.h |   46 ----------------------
 lib/cobalt/thread.c                |   48 -----------------------
 7 files changed, 1 insertion(+), 187 deletions(-)

diff --git a/include/cobalt/pthread.h b/include/cobalt/pthread.h
index 247371f..8393bf6 100644
--- a/include/cobalt/pthread.h
+++ b/include/cobalt/pthread.h
@@ -96,13 +96,6 @@ COBALT_DECL(int, pthread_kill(pthread_t ptid, int sig));
 
 COBALT_DECL(int, pthread_join(pthread_t ptid, void **retval));
 
-int pthread_make_periodic_np(pthread_t thread,
-                            clockid_t clk_id,
-                            const struct timespec *__restrict__ starttp,
-                            const struct timespec *__restrict__ periodtp);
-
-int pthread_wait_np(unsigned long *overruns_r);
-
 int pthread_set_mode_np(int clrmask, int setmask,
                        int *mask_r);
 
diff --git a/include/cobalt/uapi/syscall.h b/include/cobalt/uapi/syscall.h
index 858d0b0..e0b7ca0 100644
--- a/include/cobalt/uapi/syscall.h
+++ b/include/cobalt/uapi/syscall.h
@@ -26,8 +26,7 @@
 /* 1 unimplemented */
 #define sc_cobalt_sched_weightprio      2
 #define sc_cobalt_sched_yield           3
-#define sc_cobalt_thread_make_periodic  4
-#define sc_cobalt_thread_wait           5
+/* 4-5 unimplemented */
 #define sc_cobalt_thread_set_mode       6
 #define sc_cobalt_thread_set_name       7
 #define sc_cobalt_sem_init              8
diff --git a/kernel/cobalt/posix/syscall.c b/kernel/cobalt/posix/syscall.c
index 7321b67..2d60769 100644
--- a/kernel/cobalt/posix/syscall.c
+++ b/kernel/cobalt/posix/syscall.c
@@ -92,8 +92,6 @@ static struct xnsyscall cobalt_syscalls[] = {
        SKINCALL_DEF(sc_cobalt_thread_getschedparam_ex, 
cobalt_thread_getschedparam_ex, current),
        SKINCALL_DEF(sc_cobalt_sched_weightprio, cobalt_sched_weighted_prio, 
current),
        SKINCALL_DEF(sc_cobalt_sched_yield, cobalt_sched_yield, primary),
-       SKINCALL_DEF(sc_cobalt_thread_make_periodic, 
cobalt_thread_make_periodic_np, conforming),
-       SKINCALL_DEF(sc_cobalt_thread_wait, cobalt_thread_wait_np, primary),
        SKINCALL_DEF(sc_cobalt_thread_set_mode, cobalt_thread_set_mode_np, 
primary),
        SKINCALL_DEF(sc_cobalt_thread_set_name, cobalt_thread_set_name_np, 
current),
        SKINCALL_DEF(sc_cobalt_thread_kill, cobalt_thread_kill, conforming),
diff --git a/kernel/cobalt/posix/thread.c b/kernel/cobalt/posix/thread.c
index 5ed64ec..895cbda 100644
--- a/kernel/cobalt/posix/thread.c
+++ b/kernel/cobalt/posix/thread.c
@@ -417,41 +417,6 @@ static inline int pthread_create(struct cobalt_thread 
**thread_p,
        return 0;
 }
 
-static inline int pthread_make_periodic_np(struct cobalt_thread *thread,
-                                          clockid_t clock_id,
-                                          struct timespec *starttp,
-                                          struct timespec *periodtp)
-{
-
-       xnticks_t start, period;
-       int ret;
-       spl_t s;
-
-       if (clock_id != CLOCK_MONOTONIC &&
-           clock_id != CLOCK_MONOTONIC_RAW &&
-           clock_id != CLOCK_REALTIME)
-               return -EINVAL;
-
-       xnlock_get_irqsave(&nklock, s);
-
-       if (!cobalt_obj_active(thread, COBALT_THREAD_MAGIC,
-                              struct cobalt_thread)) {
-               ret = -ESRCH;
-               goto unlock_and_exit;
-       }
-
-       start = ts2ns(starttp);
-       period = ts2ns(periodtp);
-       ret = xnthread_set_periodic(&thread->threadbase, start,
-                                   clock_flag(TIMER_ABSTIME, clock_id),
-                                   period);
-      unlock_and_exit:
-
-       xnlock_put_irqrestore(&nklock, s);
-
-       return ret;
-}
-
 static inline int pthread_set_mode_np(int clrmask, int setmask, int *mode_r)
 {
        const int valid_flags = XNLOCK|XNTRAPSW|XNTRAPLB;
@@ -639,46 +604,6 @@ fail:
        return ERR_PTR(ret);
 }
 
-int cobalt_thread_make_periodic_np(unsigned long pth,
-                                  clockid_t clk_id,
-                                  struct timespec __user *u_startt,
-                                  struct timespec __user *u_periodt)
-{
-       struct timespec startt, periodt;
-       struct cobalt_local_hkey hkey;
-       struct cobalt_thread *thread;
-
-       hkey.u_pth = pth;
-       hkey.mm = current->mm;
-       thread = thread_lookup(&hkey);
-
-       if (__xn_safe_copy_from_user(&startt, u_startt, sizeof(startt)))
-               return -EFAULT;
-
-       if (__xn_safe_copy_from_user(&periodt, u_periodt, sizeof(periodt)))
-               return -EFAULT;
-
-       trace_cobalt_pthread_make_periodic(pth, clk_id, &startt, &periodt);
-
-       return pthread_make_periodic_np(thread, clk_id, &startt, &periodt);
-}
-
-int cobalt_thread_wait_np(unsigned long __user *u_overruns)
-{
-       unsigned long overruns = 0;
-       int ret;
-
-       trace_cobalt_pthread_wait_entry(0);
-
-       ret = xnthread_wait_period(&overruns);
-       if (u_overruns && (ret == 0 || ret == -ETIMEDOUT))
-               __xn_put_user(overruns, u_overruns);
-
-       trace_cobalt_pthread_wait_exit(ret, overruns);
-
-       return ret;
-}
-
 int cobalt_thread_set_mode_np(int clrmask, int setmask, int __user *u_mode_r)
 {
        int ret, old;
diff --git a/kernel/cobalt/posix/thread.h b/kernel/cobalt/posix/thread.h
index 5b1a45d..90c4b0b 100644
--- a/kernel/cobalt/posix/thread.h
+++ b/kernel/cobalt/posix/thread.h
@@ -138,13 +138,6 @@ cobalt_thread_shadow(struct task_struct *p,
                     struct cobalt_local_hkey *lhkey,
                     unsigned long __user *u_window_offset);
 
-int cobalt_thread_make_periodic_np(unsigned long tid,
-                                  clockid_t clk_id,
-                                  struct timespec __user *u_startt,
-                                  struct timespec __user *u_periodt);
-
-int cobalt_thread_wait_np(unsigned long __user *u_overruns);
-
 int cobalt_thread_set_mode_np(int clrmask, int setmask, int __user *u_mode_r);
 
 int cobalt_thread_set_name_np(unsigned long tid, const char __user *u_name);
diff --git a/kernel/cobalt/trace/cobalt-posix.h 
b/kernel/cobalt/trace/cobalt-posix.h
index dfb680f..b3a5654 100644
--- a/kernel/cobalt/trace/cobalt-posix.h
+++ b/kernel/cobalt/trace/cobalt-posix.h
@@ -129,52 +129,6 @@ DEFINE_EVENT(cobalt_posix_schedparam, 
cobalt_pthread_getschedparam,
        TP_ARGS(pth, policy, param_ex)
 );
 
-TRACE_EVENT(cobalt_pthread_make_periodic,
-       TP_PROTO(unsigned long pth, clockid_t clk_id,
-                struct timespec *start, struct timespec *period),
-       TP_ARGS(pth, clk_id, start, period),
-
-       TP_STRUCT__entry(
-               __field(unsigned long, pth)
-               __field(clockid_t, clk_id)
-               __timespec_fields(start)
-               __timespec_fields(period)
-       ),
-
-       TP_fast_assign(
-               __entry->pth = pth;
-               __entry->clk_id = clk_id;
-               __assign_timespec(start, start);
-               __assign_timespec(period, period);
-       ),
-
-       TP_printk("pth=%p clock_id=%d start=(%ld.%09ld) period=(%ld.%09ld)",
-                 (void *)__entry->pth, __entry->clk_id,
-                 __timespec_args(start),
-                 __timespec_args(period)
-       )
-);
-
-DEFINE_EVENT(cobalt_void, cobalt_pthread_wait_entry,
-       TP_PROTO(int dummy),
-       TP_ARGS(dummy)
-);
-
-TRACE_EVENT(cobalt_pthread_wait_exit,
-       TP_PROTO(int status, unsigned long overruns),
-       TP_ARGS(status, overruns),
-       TP_STRUCT__entry(
-               __field(int, status)
-               __field(unsigned long, overruns)
-       ),
-       TP_fast_assign(
-               __entry->status = status;
-               __entry->overruns = overruns;
-       ),
-       TP_printk("status=%d overruns=%lu",
-                 __entry->status, __entry->overruns)
-);
-
 #define cobalt_print_thread_mode(__mode)                       \
        __print_flags(__mode, "|",                              \
                      {PTHREAD_WARNSW, "warnsw"},               \
diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c
index 0fbb433..0d43ab5 100644
--- a/lib/cobalt/thread.c
+++ b/lib/cobalt/thread.c
@@ -552,54 +552,6 @@ COBALT_IMPL(int, pthread_create, (pthread_t *ptid_r,
 }
 
 /**
- * Make a thread periodic.
- *
- * This service make the Cobalt interface @a thread periodic.
- *
- * This service is a non-portable extension of the POSIX interface.
- *
- * @param thread thread identifier.
- *
- * @param clk_id clock identifier, either CLOCK_REALTIME,
- * CLOCK_MONOTONIC or CLOCK_MONOTONIC_RAW.
- *
- * @param starttp start time, expressed as an absolute value of the
- * clock @a clock_id. The affected thread will be delayed until this
- * point is reached.
- *
- * @param periodtp period, expressed as a time interval.
- *
- * @return 0 on success;
- * @return an error number if:
- * - ESRCH, @a thread is invalid;
- * - ETIMEDOUT, the start time has already passed.
- * - EINVAL, the specified clock is unsupported;
- */
-int pthread_make_periodic_np(pthread_t thread,
-                            clockid_t clk_id,
-                            const struct timespec *__restrict__ starttp,
-                            const struct timespec *__restrict__ periodtp)
-{
-       return -XENOMAI_SKINCALL4(__cobalt_muxid,
-                                 sc_cobalt_thread_make_periodic,
-                                 thread, clk_id, starttp, periodtp);
-}
-
-int pthread_wait_np(unsigned long *overruns_r)
-{
-       int ret, oldtype;
-
-       pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype);
-
-       ret = -XENOMAI_SKINCALL1(__cobalt_muxid,
-                                sc_cobalt_thread_wait, overruns_r);
-
-       pthread_setcanceltype(oldtype, NULL);
-
-       return ret;
-}
-
-/**
  * Set the mode of the current thread.
  *
  * This service sets the mode of the calling thread. @a clrmask and @a setmask


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to