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

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Sun Dec 11 20:03:08 2011 +0100

cobalt: remove errno

---

 include/asm-generic/syscall.h   |    4 ----
 include/cobalt/nucleus/thread.h |    4 ----
 kernel/cobalt/clock.c           |    2 +-
 kernel/cobalt/nucleus/shadow.c  |    6 +-----
 kernel/cobalt/nucleus/thread.c  |   20 --------------------
 kernel/cobalt/thread.h          |   10 ----------
 6 files changed, 2 insertions(+), 44 deletions(-)

diff --git a/include/asm-generic/syscall.h b/include/asm-generic/syscall.h
index 97894ae..6391b33 100644
--- a/include/asm-generic/syscall.h
+++ b/include/asm-generic/syscall.h
@@ -138,12 +138,8 @@ struct xnsysent {
 
 extern int nkthrptd;
 
-extern int nkerrptd;
-
 #define xnshadow_thrptd(t) ((t)->ptd[nkthrptd])
 #define xnshadow_thread(t) ((xnthread_t *)xnshadow_thrptd(t))
-/* The errno field must be addressable for plain Linux tasks too. */
-#define xnshadow_errno(t)  (*(int *)&((t)->ptd[nkerrptd]))
 
 #define access_rok(addr, size) access_ok(VERIFY_READ, (addr), (size))
 #define access_wok(addr, size) access_ok(VERIFY_WRITE, (addr), (size))
diff --git a/include/cobalt/nucleus/thread.h b/include/cobalt/nucleus/thread.h
index b8c4511..c55bbd7 100644
--- a/include/cobalt/nucleus/thread.h
+++ b/include/cobalt/nucleus/thread.h
@@ -271,8 +271,6 @@ typedef struct xnthread {
 
        struct xnselector *selector;    /* For select. */
 
-       int errcode;                    /* Local errno */
-
        xnasr_t asr;                    /* Asynchronous service routine */
 
        xnflags_t asrmode;              /* Thread's mode for ASR */
@@ -437,8 +435,6 @@ void xnthread_cleanup_tcb(struct xnthread *thread);
 
 char *xnthread_format_status(xnflags_t status, char *buf, int size);
 
-int *xnthread_get_errno_location(struct xnthread *thread);
-
 xnticks_t xnthread_get_timeout(struct xnthread *thread, xnticks_t tsc_ns);
 
 xnticks_t xnthread_get_period(struct xnthread *thread);
diff --git a/kernel/cobalt/clock.c b/kernel/cobalt/clock.c
index 5d31e5d..95f783d 100644
--- a/kernel/cobalt/clock.c
+++ b/kernel/cobalt/clock.c
@@ -175,7 +175,7 @@ int cobalt_clock_gettime(clockid_t clock_id, struct 
timespec __user *u_ts)
        if (err == 0 && __xn_safe_copy_to_user(u_ts, &ts, sizeof(*u_ts)))
                return -EFAULT;
 
-       return err ? -thread_get_errno() : 0;
+       return err;
 }
 
 int cobalt_clock_settime(clockid_t clock_id, const struct timespec __user 
*u_ts)
diff --git a/kernel/cobalt/nucleus/shadow.c b/kernel/cobalt/nucleus/shadow.c
index 15430f1..7f06fe3 100644
--- a/kernel/cobalt/nucleus/shadow.c
+++ b/kernel/cobalt/nucleus/shadow.c
@@ -66,8 +66,6 @@ MODULE_PARM_DESC(xenomai_gid, "GID of the group with access 
to Xenomai services"
 
 int nkthrptd;
 EXPORT_SYMBOL_GPL(nkthrptd);
-int nkerrptd;
-EXPORT_SYMBOL_GPL(nkerrptd);
 int nkmmptd;
 EXPORT_SYMBOL_GPL(nkmmptd);
 
@@ -2589,10 +2587,9 @@ int xnshadow_mount(void)
 
        sema_init(&completion_mutex, 1);
        nkthrptd = rthal_alloc_ptdkey();
-       nkerrptd = rthal_alloc_ptdkey();
        nkmmptd = rthal_alloc_ptdkey();
 
-       if (nkthrptd < 0 || nkerrptd < 0 || nkmmptd < 0) {
+       if (nkthrptd < 0 || nkmmptd < 0) {
                printk(KERN_ERR "Xenomai: cannot allocate PTD slots\n");
                return -ENOMEM;
        }
@@ -2691,7 +2688,6 @@ void xnshadow_cleanup(void)
        }
 
        rthal_apc_free(lostage_apc);
-       rthal_free_ptdkey(nkerrptd);
        rthal_free_ptdkey(nkthrptd);
 
        mayday_cleanup_page();
diff --git a/kernel/cobalt/nucleus/thread.c b/kernel/cobalt/nucleus/thread.c
index f9e139f..b5132de 100644
--- a/kernel/cobalt/nucleus/thread.c
+++ b/kernel/cobalt/nucleus/thread.c
@@ -137,7 +137,6 @@ int xnthread_init(struct xnthread *thread,
        thread->wwake = NULL;
        thread->wcontext = NULL;
        thread->hrescnt = 0;
-       thread->errcode = 0;
        thread->registry.handle = XN_NO_HANDLE;
        thread->registry.waitkey = NULL;
        memset(&thread->stat, 0, sizeof(thread->stat));
@@ -253,25 +252,6 @@ char *xnthread_format_status(xnflags_t status, char *buf, 
int size)
        return buf;
 }
 
-int *xnthread_get_errno_location(xnthread_t *thread)
-{
-       static int fallback_errno;
-
-       if (unlikely(!xnpod_active_p()))
-               return &fallback_errno;
-
-#ifndef __XENO_SIM__
-       if (xnthread_test_state(thread, XNSHADOW))
-               return &thread->errcode;
-
-       if (xnthread_test_state(thread, XNROOT))
-               return &xnshadow_errno(current);
-#endif /* !__XENO_SIM__ */
-
-       return &thread->errcode;
-}
-EXPORT_SYMBOL_GPL(xnthread_get_errno_location);
-
 xnticks_t xnthread_get_timeout(xnthread_t *thread, xnticks_t tsc_ns)
 {
        xnticks_t timeout;
diff --git a/kernel/cobalt/thread.h b/kernel/cobalt/thread.h
index b7752b2..162cd42 100644
--- a/kernel/cobalt/thread.h
+++ b/kernel/cobalt/thread.h
@@ -82,16 +82,6 @@ struct cobalt_thread {
 
 #define cobalt_current_thread() thread2pthread(xnpod_current_thread())
 
-static inline void thread_set_errno(int err)
-{
-       *xnthread_get_errno_location(xnpod_current_thread()) = err;
-}
-
-static inline int thread_get_errno(void)
-{
-       return *xnthread_get_errno_location(xnpod_current_thread());
-}
-
 #define thread_name(thread) ((thread)->attr.name)
 
 pthread_t cobalt_thread_find(const struct cobalt_hkey *hkey);


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to