Files
xen/extras/mini-os/include/sched.h
T
Ian Campbell 1a4af67d32 mini-os: use BSD sys/queue.h instead of Linux list.h
The latter is GPL which makes the whole of mini-os GPL rather than BSD
as intended. In tree users are all GPL or GPL-compatible but we should
fix this so that mini-os is BSD. Do so by using the same BSD
sys/queue.h as we use in libxl.

Tested with the builtin mini-os test app and qemu stubdomain, both of which
appear to still function as expected.

Move tools/libxl/external and the associated sed script to
tools/include/xen-external to allow more sensible access from mini-os.

Also add s/NULL/0/ in the sed script due to NULL not always being
defined in stubdom code when mini-os/wait.h is included.

As well as the obvious ABI changes there are a few API updates
associated with the change:

  - struct rw_semaphore.wait_list is unused
  - remove_waiter needs to take the wait_queue_head

The latter requires a qemu update, so there is also a QEMU_TAG
update in this changeset.

I sprinkled some extra-emacs local variables around the files I edited
which didn't have them.

I think this should be backported to the stable branches since
external users of mini-os may have been mislead into thinking they
could safely link mini-os against GPL-incompatible code.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
2012-01-31 16:06:14 +00:00

60 lines
1.5 KiB
C

#ifndef __SCHED_H__
#define __SCHED_H__
#include <mini-os/list.h>
#include <mini-os/time.h>
#include <mini-os/arch_sched.h>
#ifdef HAVE_LIBC
#include <sys/reent.h>
#endif
struct thread
{
char *name;
char *stack;
#if !defined(__ia64__)
/* keep in that order */
unsigned long sp; /* Stack pointer */
unsigned long ip; /* Instruction pointer */
#else /* !defined(__ia64__) */
thread_regs_t regs;
#endif /* !defined(__ia64__) */
MINIOS_TAILQ_ENTRY(struct thread) thread_list;
uint32_t flags;
s_time_t wakeup_time;
#ifdef HAVE_LIBC
struct _reent reent;
#endif
};
extern struct thread *idle_thread;
void idle_thread_fn(void *unused);
#define RUNNABLE_FLAG 0x00000001
#define is_runnable(_thread) (_thread->flags & RUNNABLE_FLAG)
#define set_runnable(_thread) (_thread->flags |= RUNNABLE_FLAG)
#define clear_runnable(_thread) (_thread->flags &= ~RUNNABLE_FLAG)
#define switch_threads(prev, next) arch_switch_threads(prev, next)
/* Architecture specific setup of thread creation. */
struct thread* arch_create_thread(char *name, void (*function)(void *),
void *data);
void init_sched(void);
void run_idle_thread(void);
struct thread* create_thread(char *name, void (*function)(void *), void *data);
void exit_thread(void) __attribute__((noreturn));
void schedule(void);
#ifdef __INSIDE_MINIOS__
#define current get_current()
#endif
void wake(struct thread *thread);
void block(struct thread *thread);
void msleep(uint32_t millisecs);
#endif /* __SCHED_H__ */