diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2008-10-27 18:51:52 +0000 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2008-10-27 18:51:52 +0000 |
commit | 7a0db9514bfd797ebc59ae79cb167c43048f1b95 (patch) | |
tree | 78d617f0525a15dc78929cb3b72ce4d50426a925 /extras/mini-os/include | |
parent | 9fe166283800326486fb8ce9c1966727905d2092 (diff) | |
download | xen-7a0db9514bfd797ebc59ae79cb167c43048f1b95.tar.gz xen-7a0db9514bfd797ebc59ae79cb167c43048f1b95.tar.bz2 xen-7a0db9514bfd797ebc59ae79cb167c43048f1b95.zip |
minios: do not expose #define current to applications
Currently the minios headers do this:
#define current get_current()
Obviously when porting general code to this environment, this can
cause problems !
The attached patch arranges for this only to be done if
#define __MINIOS__
is declared, which is set up by the makefile in extras/mini-os.
Suppressing the namespace pollution is necessary to get recent
upstream qemu's to compile, since they (quite properly) use `current'
as an ordinary identifier.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'extras/mini-os/include')
-rw-r--r-- | extras/mini-os/include/sched.h | 3 | ||||
-rw-r--r-- | extras/mini-os/include/wait.h | 10 |
2 files changed, 7 insertions, 6 deletions
diff --git a/extras/mini-os/include/sched.h b/extras/mini-os/include/sched.h index 3359439b55..62dc4a93c6 100644 --- a/extras/mini-os/include/sched.h +++ b/extras/mini-os/include/sched.h @@ -48,8 +48,9 @@ struct thread* create_thread(char *name, void (*function)(void *), void *data); void exit_thread(void) __attribute__((noreturn)); void schedule(void); +#ifdef __MINIOS__ #define current get_current() - +#endif void wake(struct thread *thread); void block(struct thread *thread); diff --git a/extras/mini-os/include/wait.h b/extras/mini-os/include/wait.h index 14e98ba755..10b9f29b07 100644 --- a/extras/mini-os/include/wait.h +++ b/extras/mini-os/include/wait.h @@ -7,7 +7,7 @@ #define DEFINE_WAIT(name) \ struct wait_queue name = { \ - .thread = current, \ + .thread = get_current(), \ .thread_list = MINIOS_LIST_HEAD_INIT((name).thread_list), \ } @@ -53,7 +53,7 @@ static inline void wake_up(struct wait_queue_head *head) unsigned long flags; \ local_irq_save(flags); \ add_wait_queue(&wq, &w); \ - block(current); \ + block(get_current()); \ local_irq_restore(flags); \ } while (0) @@ -74,8 +74,8 @@ static inline void wake_up(struct wait_queue_head *head) /* protect the list */ \ local_irq_save(flags); \ add_wait_queue(&wq, &__wait); \ - current->wakeup_time = deadline; \ - clear_runnable(current); \ + get_current()->wakeup_time = deadline; \ + clear_runnable(get_current()); \ local_irq_restore(flags); \ if((condition) || (deadline && NOW() >= deadline)) \ break; \ @@ -83,7 +83,7 @@ static inline void wake_up(struct wait_queue_head *head) } \ local_irq_save(flags); \ /* need to wake up */ \ - wake(current); \ + wake(get_current()); \ remove_wait_queue(&__wait); \ local_irq_restore(flags); \ } while(0) |