Module: xenomai-2.5
Branch: master
Commit: 5c5d6bee6c57f7bb8336036c35fe6825ba38a339
URL:    
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=5c5d6bee6c57f7bb8336036c35fe6825ba38a339

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Tue Mar  2 01:03:58 2010 +0100

libxenomai: make xnsysinfo static, its contents depend on the skin

---

 src/skins/common/timeconv.c |   10 +++++++---
 src/skins/posix/clock.c     |   16 +++++++++++++++-
 src/skins/posix/init.c      |    5 +++++
 3 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/src/skins/common/timeconv.c b/src/skins/common/timeconv.c
index 87a0ba2..931c5eb 100644
--- a/src/skins/common/timeconv.c
+++ b/src/skins/common/timeconv.c
@@ -25,21 +25,25 @@
 #include <asm/xenomai/syscall.h>
 #include <asm-generic/xenomai/bits/timeconv.h>
 
-xnsysinfo_t sysinfo;
+static unsigned long long xeno_cpufreq;
 
 static void xeno_init_timeconv_inner(void)
 {
-       xnarch_init_timeconv(sysinfo.cpufreq);
+       xnarch_init_timeconv(xeno_cpufreq);
 }
 
 void xeno_init_timeconv(int muxid)
 {
        static pthread_once_t init_timeconv_once = PTHREAD_ONCE_INIT;
-       int err = XENOMAI_SYSCALL2(__xn_sys_info, muxid, &sysinfo);
+       xnsysinfo_t sysinfo;
+       int err;
+
+       err = XENOMAI_SYSCALL2(__xn_sys_info, muxid, &sysinfo);
        if (err) {
                fprintf(stderr, "Xenomai: sys_info failed: %s\n",
                        strerror(-err));
                exit(EXIT_FAILURE);
        }
+       xeno_cpufreq = sysinfo.cpufreq;
        pthread_once(&init_timeconv_once, &xeno_init_timeconv_inner);
 }
diff --git a/src/skins/posix/clock.c b/src/skins/posix/clock.c
index 7b2e42d..e27a2ec 100644
--- a/src/skins/posix/clock.c
+++ b/src/skins/posix/clock.c
@@ -28,6 +28,20 @@
 
 extern int __pse51_muxid;
 
+#ifdef XNARCH_HAVE_NONPRIV_TSC
+static xnsysinfo_t __pse51_sysinfo;
+
+void pse51_clock_init(int muxid)
+{
+       int err = -XENOMAI_SYSCALL2(__xn_sys_info, muxid, &__pse51_sysinfo);
+       if (err) {
+               fprintf(stderr, "Xenomai Posix skin init: "
+                       "sys_info: %s\n", strerror(err));
+               exit(EXIT_FAILURE);
+       }
+}
+#endif /* XNARCH_HAVE_NONPRIV_TSC */
+
 int __wrap_clock_getres(clockid_t clock_id, struct timespec *tp)
 {
        int err = -XENOMAI_SKINCALL2(__pse51_muxid,
@@ -46,7 +60,7 @@ int __wrap_clock_gettime(clockid_t clock_id, struct timespec 
*tp)
 {
        int err;
 #ifdef XNARCH_HAVE_NONPRIV_TSC
-       if (clock_id == CLOCK_MONOTONIC && sysinfo.tickval == 1) {
+       if (clock_id == CLOCK_MONOTONIC && __pse51_sysinfo.tickval == 1) {
                unsigned long long ns;
                unsigned long rem;
 
diff --git a/src/skins/posix/init.c b/src/skins/posix/init.c
index 8ed878b..20ae526 100644
--- a/src/skins/posix/init.c
+++ b/src/skins/posix/init.c
@@ -41,6 +41,7 @@ int __rtdm_fd_start = INT_MAX;
 static int fork_handler_registered;
 
 int __wrap_pthread_setschedparam(pthread_t, int, const struct sched_param *);
+void pse51_clock_init(int);
 
 static __attribute__ ((constructor))
 void __init_posix_interface(void)
@@ -53,6 +54,10 @@ void __init_posix_interface(void)
 
        muxid = xeno_bind_skin(PSE51_SKIN_MAGIC, "POSIX", "xeno_posix", NULL);
 
+#ifdef XNARCH_HAVE_NONPRIV_TSC
+       pse51_clock_init(muxid);
+#endif /* XNARCH_HAVE_NONPRIV_TSC */
+
        __pse51_muxid = __xn_mux_shifted_id(muxid);
 
        muxid = XENOMAI_SYSBIND(RTDM_SKIN_MAGIC,


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

Reply via email to