[Xenomai-git] Jan Kiszka : nucleus: Restore u_mode after failed hardening

2011-07-28 Thread GIT version control
Module: xenomai-jki
Branch: for-upstream
Commit: 4de7606ff498370b9359b58fd82a794f2fdc2c46
URL:
http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=4de7606ff498370b9359b58fd82a794f2fdc2c46

Author: Jan Kiszka jan.kis...@siemens.com
Date:   Mon Jul 18 18:57:12 2011 +0200

nucleus: Restore u_mode after failed hardening

When we abort xnshadow_harden due to a pending signal, restore u_mode in
case XNRELAX was already cleared. This will deliver the right state to
user space while it runs the signal handler.

Signed-off-by: Jan Kiszka jan.kis...@siemens.com

---

 ksrc/nucleus/shadow.c |   13 ++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/ksrc/nucleus/shadow.c b/ksrc/nucleus/shadow.c
index fe7e504..fc0af8e 100644
--- a/ksrc/nucleus/shadow.c
+++ b/ksrc/nucleus/shadow.c
@@ -940,7 +940,7 @@ int xnshadow_harden(void)
struct task_struct *this_task = current;
struct xnthread *thread;
struct xnsched *sched;
-   int cpu;
+   int cpu, err;
 
 redo:
thread = xnshadow_thread(this_task);
@@ -951,8 +951,10 @@ redo:
sched = xnpod_sched_slot(cpu);
 
/* Grab the request token. */
-   if (down_interruptible(sched-gksync))
-   return -ERESTARTSYS;
+   if (down_interruptible(sched-gksync)) {
+   err = -ERESTARTSYS;
+   goto failed;
+   }
 
if (thread-u_mode)
*(thread-u_mode) = thread-state  ~XNRELAX;
@@ -1065,6 +1067,11 @@ redo:
xnsched_resched_after_unlocked_switch();
 
return 0;
+
+  failed:
+   if (thread-u_mode)
+   *(thread-u_mode) = thread-state;
+   return err;
 }
 EXPORT_SYMBOL_GPL(xnshadow_harden);
 


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


[Xenomai-git] Jan Kiszka : nucleus: Fix race between gatekeeper and premature task resumption

2011-07-28 Thread GIT version control
Module: xenomai-jki
Branch: for-upstream
Commit: 470c31356e3d5c8a58815c828b19087f7427
URL:
http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=470c31356e3d5c8a58815c828b19087f7427

Author: Jan Kiszka jan.kis...@siemens.com
Date:   Fri Jul  8 18:19:09 2011 +0200

nucleus: Fix race between gatekeeper and premature task resumption

A task that is about to be hardened may receive a signal. In that case
the schedule() that the task invoke will set its state to TASK_RUNNING
again and may than decide to move it to a different CPU as also the
gatekeeper is runnable at that point. Now we start a race between the
task continuing to run in Linux context or terminate (on SIGKILL etc.)
and the gatekeeper still holding a reference to this object and
potentially seeing the task state as TASK_INTERRUPTIBLE again (if it
waits long enough).

Avoid this race by waiting for the gatekeeper to drop the obsolete
migration request before returning from xnshadow_harden. Based on
suggestion by Gilles.

Signed-off-by: Jan Kiszka jan.kis...@siemens.com

---

 ksrc/nucleus/shadow.c |   21 +++--
 1 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/ksrc/nucleus/shadow.c b/ksrc/nucleus/shadow.c
index eea9151..76f326a 100644
--- a/ksrc/nucleus/shadow.c
+++ b/ksrc/nucleus/shadow.c
@@ -995,12 +995,11 @@ redo:
xnthread_clear_info(thread, XNATOMIC);
 
/*
-* Rare case: we might have been awaken by a signal before the
-* gatekeeper sent us to primary mode. Since
-* TASK_UNINTERRUPTIBLE is unavailable to us without wrecking
-* the runqueue's count of uniniterruptible tasks, we just
-* notice the issue and gracefully fail; the caller will have
-* to process this signal anyway.
+* Rare case: we might have received a signal before entering
+* schedule() and returned early from it. Since TASK_UNINTERRUPTIBLE
+* is unavailable to us without wrecking the runqueue's count of
+* uniniterruptible tasks, we just notice the issue and gracefully
+* fail; the caller will have to process this signal anyway.
 */
if (rthal_current_domain == rthal_root_domain) {
if (XENO_DEBUG(NUCLEUS)  (!signal_pending(this_task)
@@ -1008,6 +1007,16 @@ redo:
xnpod_fatal
(xnshadow_harden() failed for thread %s[%d],
 thread-name, xnthread_user_pid(thread));
+
+   /*
+* Synchronize with the chosen gatekeeper so that it no longer
+* holds any reference to this thread and does not develop the
+* idea to resume it for the Xenomai domain if, later on, we
+* may happen to reenter TASK_INTERRUPTIBLE state.
+*/
+   down(sched-gksync);
+   up(sched-gksync);
+
return -ERESTARTSYS;
}
 


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


[Xenomai-git] Jan Kiszka : posix: Do not prevent double-inclusion of original stdio.h

2011-07-28 Thread GIT version control
Module: xenomai-jki
Branch: for-upstream
Commit: 650b45c10e1752ce50612f703be97b3486fcd381
URL:
http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=650b45c10e1752ce50612f703be97b3486fcd381

Author: Jan Kiszka jan.kis...@siemens.com
Date:   Wed Jul 20 12:00:14 2011 +0200

posix: Do not prevent double-inclusion of original stdio.h

iostream, eg., pulls in stdio.h for internal purposes. This pull will
only define a subset of what an explicit stdio.h inclusion provides. But
as we block a second inclusion so far, this full definition set cannot
be pulled later on. So move #include_next out of the double-inclusion
check.

Signed-off-by: Jan Kiszka jan.kis...@siemens.com

---

 include/posix/stdio.h |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/posix/stdio.h b/include/posix/stdio.h
index adf3a90..775742b 100644
--- a/include/posix/stdio.h
+++ b/include/posix/stdio.h
@@ -1,12 +1,12 @@
+#ifndef __KERNEL__
+
+#include_next stdio.h
+
 #ifndef STDIO_H
 #define STDIO_H
 
-#ifndef __KERNEL__
-
 #include stdarg.h
 
-#include_next stdio.h
-
 #ifdef __cplusplus
 extern C {
 #endif /* __cplusplus */
@@ -23,6 +23,6 @@ int __real_printf(const char *fmt, ...);
 }
 #endif /* __cplusplus */
 
-#endif /* !__KERNEL__ */
-
 #endif /* STDIO_H */
+
+#endif /* !__KERNEL__ */


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


[Xenomai-git] Jan Kiszka : posix: Add missing stdarg.h to stdio.h wrapper

2011-07-28 Thread GIT version control
Module: xenomai-jki
Branch: for-upstream
Commit: 55d70cea1a4647aa90e4bc907b15a9464fe606e1
URL:
http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=55d70cea1a4647aa90e4bc907b15a9464fe606e1

Author: Jan Kiszka jan.kis...@siemens.com
Date:   Wed Jul 20 11:22:08 2011 +0200

posix: Add missing stdarg.h to stdio.h wrapper

Required for va_list. glibc's stdio.h uses opaque types, thus does not
pull in stdarg.h.

Signed-off-by: Jan Kiszka jan.kis...@siemens.com

---

 include/posix/stdio.h |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/posix/stdio.h b/include/posix/stdio.h
index 15cda57..adf3a90 100644
--- a/include/posix/stdio.h
+++ b/include/posix/stdio.h
@@ -3,6 +3,8 @@
 
 #ifndef __KERNEL__
 
+#include stdarg.h
+
 #include_next stdio.h
 
 #ifdef __cplusplus


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


[Xenomai-git] Jan Kiszka : nucleus: Simplify request token acquisition in xnshadow_harden

2011-07-28 Thread GIT version control
Module: xenomai-jki
Branch: for-upstream
Commit: cb8a5b8b3e08882c6505d3b1f9d483930c48db4f
URL:
http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=cb8a5b8b3e08882c6505d3b1f9d483930c48db4f

Author: Jan Kiszka jan.kis...@siemens.com
Date:   Thu Jul 28 17:28:49 2011 +0200

nucleus: Simplify request token acquisition in xnshadow_harden

down_interruptible checks for pending signals, no need to do this in
advance.

Signed-off-by: Jan Kiszka jan.kis...@siemens.com

---

 ksrc/nucleus/shadow.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ksrc/nucleus/shadow.c b/ksrc/nucleus/shadow.c
index 76f326a..fe1dac9 100644
--- a/ksrc/nucleus/shadow.c
+++ b/ksrc/nucleus/shadow.c
@@ -950,8 +950,8 @@ redo:
cpu = task_cpu(this_task);
sched = xnpod_sched_slot(cpu);
 
-   if (signal_pending(this_task) || down_interruptible(sched-gksync))
-   /* Grab the request token. */
+   /* Grab the request token. */
+   if (down_interruptible(sched-gksync))
return -ERESTARTSYS;
 
if (thread-u_mode)


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


[Xenomai-git] Jan Kiszka : nucleus: Fix racy Linux task state manipulation

2011-07-28 Thread GIT version control
Module: xenomai-jki
Branch: for-upstream
Commit: 7b37dfdaa2dd48bec0886113badb7e5195856277
URL:
http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=7b37dfdaa2dd48bec0886113badb7e5195856277

Author: Jan Kiszka jan.kis...@siemens.com
Date:   Mon Jul 18 14:07:00 2011 +0200

nucleus: Fix racy Linux task state manipulation

xnshadow_relax can race with do_sigwake_event on a different CPU /wrt
manipulating the Linux task state. Fix this by taking nklock before
calling clear_task_nowakeup.

Signed-off-by: Jan Kiszka jan.kis...@siemens.com

---

 ksrc/nucleus/shadow.c |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/ksrc/nucleus/shadow.c b/ksrc/nucleus/shadow.c
index fc0af8e..a228c91 100644
--- a/ksrc/nucleus/shadow.c
+++ b/ksrc/nucleus/shadow.c
@@ -1137,8 +1137,15 @@ void xnshadow_relax(int notify, int reason)
splmax();
rpi_push(thread-sched, thread);
schedule_linux_call(LO_WAKEUP_REQ, current, 0);
+
+   /*
+* Task nklock to synchronize the Linux task state manipulation with
+* do_sigwake_event. nklock will be released by xnpod_suspend_thread.
+*/
+   xnlock_get(nklock);
clear_task_nowakeup(current);
xnpod_suspend_thread(thread, XNRELAX, XN_INFINITE, XN_RELATIVE, NULL);
+
splnone();
if (XENO_DEBUG(NUCLEUS)  rthal_current_domain != rthal_root_domain)
xnpod_fatal(xnshadow_relax() failed for thread %s[%d],


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


[Xenomai-git] Jan Kiszka : nucleus: Process signals ignored during task migration

2011-07-28 Thread GIT version control
Module: xenomai-jki
Branch: for-upstream
Commit: feac8c921112fe85282d485a38bcb57219cd4896
URL:
http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=feac8c921112fe85282d485a38bcb57219cd4896

Author: Jan Kiszka jan.kis...@siemens.com
Date:   Mon Jul 18 22:38:57 2011 +0200

nucleus: Process signals ignored during task migration

We failed to process signals arriving after suspending the Linux task
and before migrating it to the Xenomai domain in the gatekeeper thread.
Fix this by checking for pending signals at the end of xnshadow_harden.

This may resolve rare lockups of gdb when stopping applications on SMP
systems.

Signed-off-by: Jan Kiszka jan.kis...@siemens.com

---

 ksrc/nucleus/shadow.c |   13 +
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/ksrc/nucleus/shadow.c b/ksrc/nucleus/shadow.c
index fe1dac9..fe7e504 100644
--- a/ksrc/nucleus/shadow.c
+++ b/ksrc/nucleus/shadow.c
@@ -1049,6 +1049,19 @@ redo:
trace_mark(xn_nucleus, shadow_hardened, thread %p thread_name %s,
   thread, xnthread_name(thread));
 
+   /*
+* Recheck pending signals once again. As we block task wakeups during
+* the migration and do_sigwake_event ignores signals until XNRELAX is
+* left, any signal between entering TASK_ATOMICSWITCH and starting
+* the migration in the gatekeeker thread is just silently queued up
+* to here.
+*/
+   if (signal_pending(this_task)) {
+   xnshadow_relax(!xnthread_test_state(thread, XNDEBUG),
+  SIGDEBUG_MIGRATE_SIGNAL);
+   return -ERESTARTSYS;
+   }
+
xnsched_resched_after_unlocked_switch();
 
return 0;


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


[Xenomai-git] Jan Kiszka : rt_print: Provide rt_puts

2011-07-28 Thread GIT version control
Module: xenomai-jki
Branch: for-upstream
Commit: 9616925a791fc0a93422fa96a6c247d2c9467945
URL:
http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=9616925a791fc0a93422fa96a6c247d2c9467945

Author: Jan Kiszka jan.kis...@siemens.com
Date:   Thu Jul 21 13:43:31 2011 +0200

rt_print: Provide rt_puts

This requires to add an additional, format-free mode to print_to_buffer.
In this mode, print_to_buffer follows puts semantics regarding return
value and appending a newline character to the string.

rt_puts will be useful for wrapping puts under POSIX.

Signed-off-by: Jan Kiszka jan.kis...@siemens.com

---

 include/rtdk.h  |1 +
 src/skins/common/rt_print.c |   58 +--
 2 files changed, 40 insertions(+), 19 deletions(-)

diff --git a/include/rtdk.h b/include/rtdk.h
index 905d35a..a0d63c8 100644
--- a/include/rtdk.h
+++ b/include/rtdk.h
@@ -52,6 +52,7 @@ int rt_vfprintf(FILE *stream, const char *format, va_list 
args);
 int rt_vprintf(const char *format, va_list args);
 int rt_fprintf(FILE *stream, const char *format, ...);
 int rt_printf(const char *format, ...);
+int rt_puts(const char *s);
 void rt_syslog(int priority, const char *format, ...);
 void rt_vsyslog(int priority, const char *format, va_list args);
 
diff --git a/src/skins/common/rt_print.c b/src/skins/common/rt_print.c
index fda197f..186de48 100644
--- a/src/skins/common/rt_print.c
+++ b/src/skins/common/rt_print.c
@@ -46,6 +46,9 @@
 
 #define RT_PRINT_SYSLOG_STREAM NULL
 
+#define RT_PRINT_MODE_FORMAT   0
+#define RT_PRINT_MODE_PUTS 1
+
 struct entry_head {
FILE *dest;
uint32_t seq_no;
@@ -92,14 +95,14 @@ static void print_buffers(void);
 
 /* *** rt_print API *** */
 
-static int print_to_buffer(FILE *stream, int priority, const char *format,
-  va_list args)
+static int print_to_buffer(FILE *stream, int priority, unsigned int mode,
+  const char *format, va_list args)
 {
struct print_buffer *buffer = pthread_getspecific(buffer_key);
off_t write_pos, read_pos;
struct entry_head *head;
-   int len;
-   int res;
+   int len, str_len;
+   int res = 0;
 
if (!buffer) {
res = 0;
@@ -122,7 +125,7 @@ static int print_to_buffer(FILE *stream, int priority, 
const char *format,
 
/* Is our write limit the end of the ring buffer? */
if (write_pos = read_pos) {
-   /* Keep a savety margin to the end for at least an empty entry 
*/
+   /* Keep a safety margin to the end for at least an empty entry 
*/
len = buffer-size - write_pos - sizeof(struct entry_head);
 
/* Special case: We were stuck at the end of the ring buffer
@@ -152,17 +155,27 @@ static int print_to_buffer(FILE *stream, int priority, 
const char *format,
 
head = buffer-ring + write_pos;
 
-   res = vsnprintf(head-text, len, format, args);
+   if (mode == RT_PRINT_MODE_FORMAT) {
+   res = vsnprintf(head-text, len, format, args);
 
-   if (res  len) {
-   /* Text was written completely, res contains its length */
-   len = res;
-   } else {
-   /* Text was truncated, remove closing \0 that entry_head
-  already includes */
-   len--;
-   res = len;
-   }
+   if (res  len) {
+   /* Text was written completely, res contains its
+  length */
+   len = res;
+   } else {
+   /* Text was truncated, remove closing \0 that
+  entry_head already includes */
+   len--;
+   res = len;
+   }
+   } else if (len = 2) {
+   str_len = strlen(format);
+   len = (str_len  len - 2) ? str_len : len - 2;
+   strncpy(head-text, format, len);
+   head-text[len++] = '\n';
+   head-text[len] = 0;
+   } else
+   len = 0;
 
/* If we were able to write some text, finalise the entry */
if (len  0) {
@@ -196,7 +209,7 @@ static int print_to_buffer(FILE *stream, int priority, 
const char *format,
 
 int rt_vfprintf(FILE *stream, const char *format, va_list args)
 {
-   return print_to_buffer(stream, 0, format, args);
+   return print_to_buffer(stream, 0, RT_PRINT_MODE_FORMAT, format, args);
 }
 
 int rt_vprintf(const char *format, va_list args)
@@ -228,18 +241,25 @@ int rt_printf(const char *format, ...)
return n;
 }
 
+int rt_puts(const char *s)
+{
+   return print_to_buffer(stdout, 0, RT_PRINT_MODE_PUTS, s, NULL);
+}
+
 void rt_syslog(int priority, const char *format, ...)
 {
va_list args;
 
va_start(args, format);
-   print_to_buffer(RT_PRINT_SYSLOG_STREAM, priority, format, args);
+   

[Xenomai-git] Jan Kiszka : rt_print: Remove unneeded constructor/destructor indirection

2011-07-28 Thread GIT version control
Module: xenomai-jki
Branch: for-upstream
Commit: 04e8ff64251620f01473af203f0e89fc5f4fa3f9
URL:
http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=04e8ff64251620f01473af203f0e89fc5f4fa3f9

Author: Jan Kiszka jan.kis...@siemens.com
Date:   Wed Jul 20 14:46:53 2011 +0200

rt_print: Remove unneeded constructor/destructor indirection

Signed-off-by: Jan Kiszka jan.kis...@siemens.com

---

 src/skins/common/rt_print.c |   14 ++
 1 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/src/skins/common/rt_print.c b/src/skins/common/rt_print.c
index 356347c..fda197f 100644
--- a/src/skins/common/rt_print.c
+++ b/src/skins/common/rt_print.c
@@ -586,7 +586,7 @@ static void forked_child_init(void)
spawn_printer_thread();
 }
 
-static void __rt_print_init(void)
+static __attribute__ ((constructor)) void __rt_print_init(void)
 {
const char *value_str;
unsigned long long period;
@@ -686,7 +686,7 @@ static void __rt_print_init(void)
pthread_atfork(NULL, NULL, forked_child_init);
 }
 
-static void __rt_print_exit(void)
+static __attribute__ ((destructor)) void __rt_print_exit(void)
 {
if (buffers) {
/* Flush the buffers. Do not call print_buffers here
@@ -695,13 +695,3 @@ static void __rt_print_exit(void)
nanosleep(print_period, NULL);
}
 }
-
-static __attribute__ ((constructor)) void __init_rtdk(void)
-{
-   __rt_print_init();
-}
-
-static __attribute__ ((destructor)) void __exit_rtdk(void)
-{
-   __rt_print_exit();
-}


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


[Xenomai-git] Jan Kiszka : posix: Wrap puts

2011-07-28 Thread GIT version control
Module: xenomai-jki
Branch: for-upstream
Commit: c30280ba95a4cb41b091d6b8272663fcc2c4dd43
URL:
http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=c30280ba95a4cb41b091d6b8272663fcc2c4dd43

Author: Jan Kiszka jan.kis...@siemens.com
Date:   Thu Jul 21 12:44:47 2011 +0200

posix: Wrap puts

The compiler uses puts for printing format-free strings. Wrap this
service to avoid user surprises.

Signed-off-by: Jan Kiszka jan.kis...@siemens.com

---

 include/posix/stdio.h  |2 ++
 src/skins/posix/posix.wrappers |1 +
 src/skins/posix/printf.c   |   11 +++
 src/skins/posix/wrappers.c |6 ++
 4 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/include/posix/stdio.h b/include/posix/stdio.h
index 775742b..e4ad01c 100644
--- a/include/posix/stdio.h
+++ b/include/posix/stdio.h
@@ -19,6 +19,8 @@ int __real_fprintf(FILE *stream, const char *fmt, ...);
 
 int __real_printf(const char *fmt, ...);
 
+int __real_puts(const char *s);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
diff --git a/src/skins/posix/posix.wrappers b/src/skins/posix/posix.wrappers
index 636e6d8..2aa3d33 100644
--- a/src/skins/posix/posix.wrappers
+++ b/src/skins/posix/posix.wrappers
@@ -93,6 +93,7 @@
 --wrap vprintf
 --wrap fprintf
 --wrap printf
+--wrap puts
 --wrap syslog
 --wrap vsyslog
 --wrap malloc
diff --git a/src/skins/posix/printf.c b/src/skins/posix/printf.c
index 5343808..d838b8a 100644
--- a/src/skins/posix/printf.c
+++ b/src/skins/posix/printf.c
@@ -44,6 +44,17 @@ int __wrap_printf(const char *fmt, ...)
return rc;
 }
 
+int __wrap_puts(const char *s)
+{
+   if (unlikely(xeno_get_current() != XN_NO_HANDLE 
+!(xeno_get_current_mode()  XNRELAX)))
+   return rt_puts(s);
+   else {
+   rt_print_flush_buffers();
+   return puts(s);
+   }
+}
+
 void __wrap_vsyslog(int priority, const char *fmt, va_list ap)
 {
if (unlikely(xeno_get_current() != XN_NO_HANDLE 
diff --git a/src/skins/posix/wrappers.c b/src/skins/posix/wrappers.c
index dedf238..8b7a872 100644
--- a/src/skins/posix/wrappers.c
+++ b/src/skins/posix/wrappers.c
@@ -352,6 +352,12 @@ int __real_printf(const char *fmt, ...)
 }
 
 __attribute__ ((weak))
+int __real_puts(const char *s)
+{
+   return puts(s);
+}
+
+__attribute__ ((weak))
 void __real_syslog(int priority, const char *fmt, ...)
 {
va_list args;


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


[Xenomai-git] Jan Kiszka : rtdk: Remove dead code fragments

2011-07-28 Thread GIT version control
Module: xenomai-jki
Branch: for-upstream
Commit: 1709315d922bd9f8ca4556ce094637a1df754360
URL:
http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=1709315d922bd9f8ca4556ce094637a1df754360

Author: Jan Kiszka jan.kis...@siemens.com
Date:   Wed Jul 20 14:45:11 2011 +0200

rtdk: Remove dead code fragments

Forgotten by 00c9c8d0b9.

Signed-off-by: Jan Kiszka jan.kis...@siemens.com

---

 src/rtdk/assert_context.c |   97 ---
 src/rtdk/rt_print.c   |  687 -
 2 files changed, 0 insertions(+), 784 deletions(-)

diff --git a/src/rtdk/assert_context.c b/src/rtdk/assert_context.c
deleted file mode 100644
index ba9c074..000
--- a/src/rtdk/assert_context.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2008, 2009 Jan Kiszka jan.kis...@siemens.com.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
-
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
- */
-
-#include signal.h
-#include stdlib.h
-
-#include internal.h
-
-#include nucleus/thread.h
-#include asm-generic/syscall.h
-#include asm-generic/bits/current.h
-
-static void assert_nrt_inner(void)
-{
-   xnthread_info_t info;
-   int err;
-
-   fprintf(stderr, assert_nrt_inner !\n);
-
-   err = XENOMAI_SYSCALL1(__xn_sys_current_info, info);
-
-   if (err) {
-   fprintf(stderr, __xn_sys_current_info failed: %s\n,
-   strerror(-err));
-   return;
-   }
-
-   if (info.state  XNTRAPSW)
-   pthread_kill(pthread_self(), SIGXCPU);
-}
-
-void assert_nrt(void)
-{
-   fprintf(stderr, current: %lu, relax: %d\n,
-   xeno_get_current(), xeno_get_current_mode()  XNRELAX);
-   if (unlikely(xeno_get_current() != XN_NO_HANDLE 
-!(xeno_get_current_mode()  XNRELAX)))
-   assert_nrt_inner();
-}
-
-/*
- * Note: Works without syscalls but may not catch all errors when used inside
- * TSD destructors (as registered via pthread_key_create) when TLS support
- * (__thread) is disabled.
- */
-void assert_nrt_fast(void)
-{
-   if (unlikely(xeno_get_current_fast() != XN_NO_HANDLE 
-!(xeno_get_current_mode()  XNRELAX)))
-   assert_nrt_inner();
-}
-
-/* Memory allocation services */
-void *__wrap_malloc(size_t size)
-{
-   void *block;
-   assert_nrt();
-   fprintf(stderr, malloc(%lu)\n, (unsigned long)size);
-   return __real_malloc(size);
-}
-
-void __wrap_free(void *ptr)
-{
-   assert_nrt();
-   fprintf(stderr, free\n);
-   __real_free(ptr);
-}
-
-/* vsyscall-based services */
-__attribute__ ((weak))
-int __wrap_gettimeofday(struct timeval *tv, struct timezone *tz)
-{
-   assert_nrt();
-   return __real_gettimeofday(tv, tz);
-}
-
-__attribute__ ((weak))
-int __wrap_clock_gettime(clockid_t clk_id, struct timespec *tp)
-{
-   assert_nrt();
-   return __real_clock_gettime(clk_id, tp);
-}
diff --git a/src/rtdk/rt_print.c b/src/rtdk/rt_print.c
deleted file mode 100644
index 999f0a3..000
--- a/src/rtdk/rt_print.c
+++ /dev/null
@@ -1,687 +0,0 @@
-/*
- * Copyright (C) 2007 Jan Kiszka jan.kis...@web.de.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
-
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
- */
-
-#include errno.h
-#include inttypes.h
-#include limits.h
-#include pthread.h
-#include stdarg.h
-#include stdio.h
-#include stdlib.h
-#include string.h
-#include unistd.h
-#include syslog.h
-
-#include rtdk.h
-#include nucleus/types.h /* For BITS_PER_LONG */
-#include asm/xenomai/system.h
-#include asm/xenomai/atomic.h/* For atomic_cmpxchg */
-#include asm-generic/stack.h
-
-#define RT_PRINT_BUFFER_ENVRT_PRINT_BUFFER