Housekeeping changes and small bug-fixes:
Added new syscall for set_thread_priority(). Replaced the userland syscall snooze_until() with snooze_etc() (the latter has to be exported to userland and realize snooze() and snooze_until()). Cleaned the sources - scheduler functions now have the scheduler_ prefix. Moved signal related stuff into ksignal.h (out of thread.h). Replaced public kernel API with direct exports (i.e. resume_thread() instead of thread_resume_thread()). Removed the thread_create_XXX_thread*() calls, and replaced them with a BeOS compatible set. Made some fields of struct thread a bit prettier. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2569 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
dc7fb22c07
commit
a9731b41c1
19
headers/private/kernel/ksignal.h
Normal file
19
headers/private/kernel/ksignal.h
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
#ifndef _KERNEL_SIGNAL_H
|
||||
#define _KERNEL_SIGNAL_H
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#define BLOCKABLE_SIGS (~((1L << (SIGKILL - 1)) | (1L << (SIGSTOP - 1))))
|
||||
|
||||
extern int handle_signals(struct thread *t, int state);
|
||||
|
||||
|
||||
extern int user_send_signal(pid_t tid, uint sig);
|
||||
extern int user_sigaction(int sig, const struct sigaction *act, struct sigaction *oact);
|
||||
extern bigtime_t user_set_alarm(bigtime_t time, uint32 mode);
|
||||
|
||||
#endif /* _KERNEL_SIGNAL_H */
|
@ -26,7 +26,7 @@ enum {
|
||||
SYSCALL_READ_PATH_STAT,
|
||||
SYSCALL_WRITE_PATH_STAT,
|
||||
SYSCALL_SYSTEM_TIME,
|
||||
SYSCALL_SNOOZE_UNTIL,
|
||||
SYSCALL_SNOOZE_ETC,
|
||||
SYSCALL_SEM_CREATE,
|
||||
SYSCALL_SEM_DELETE,
|
||||
SYSCALL_SEM_ACQUIRE, /* 20 */
|
||||
@ -130,6 +130,7 @@ enum {
|
||||
SYSCALL_START_WATCHING,
|
||||
SYSCALL_STOP_WATCHING,
|
||||
SYSCALL_STOP_NOTIFYING, /* 120 */
|
||||
SYSCALL_SET_THREAD_PRIORITY,
|
||||
};
|
||||
|
||||
int syscall_dispatcher(unsigned long call_num, void *arg_buffer, uint64 *call_ret);
|
||||
|
@ -25,7 +25,7 @@ int sys_getrlimit(int resource, struct rlimit * rlp);
|
||||
int sys_setrlimit(int resource, const struct rlimit * rlp);
|
||||
|
||||
bigtime_t sys_system_time();
|
||||
status_t sys_snooze_until(bigtime_t time, int timebase);
|
||||
status_t sys_snooze_etc(bigtime_t time, int timebase, int32 flags);
|
||||
|
||||
/* sem functions */
|
||||
sem_id sys_create_sem(int count, const char *name);
|
||||
|
@ -9,29 +9,26 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <OS.h>
|
||||
#include <thread_types.h>
|
||||
#include <arch/thread.h>
|
||||
#include <signal.h>
|
||||
|
||||
void resched(void);
|
||||
|
||||
void scheduler_reschedule(void);
|
||||
void start_scheduler(void);
|
||||
|
||||
#define BLOCKABLE_SIGS (~((1L << (SIGKILL - 1)) | (1L << (SIGSTOP - 1))))
|
||||
|
||||
int handle_signals(struct thread *t, int state);
|
||||
|
||||
void thread_enqueue(struct thread *t, struct thread_queue *q);
|
||||
struct thread *thread_lookat_queue(struct thread_queue *q);
|
||||
struct thread *thread_dequeue(struct thread_queue *q);
|
||||
struct thread *thread_dequeue_id(struct thread_queue *q, thread_id thr_id);
|
||||
void thread_enqueue_run_q(struct thread *t);
|
||||
|
||||
void scheduler_enqueue_in_run_queue(struct thread *thread);
|
||||
void scheduler_remove_from_run_queue(struct thread *thread);
|
||||
|
||||
void thread_atkernel_entry(void);
|
||||
// called when the thread enters the kernel on behalf of the thread
|
||||
void thread_atkernel_exit(void);
|
||||
|
||||
int thread_suspend_thread(thread_id id);
|
||||
int thread_resume_thread(thread_id id);
|
||||
status_t thread_set_priority(thread_id id, int32 priority);
|
||||
int thread_init(kernel_args *ka);
|
||||
int thread_init_percpu(int cpu_num);
|
||||
void thread_exit(void);
|
||||
@ -51,17 +48,13 @@ thread_get_current_thread_id(void)
|
||||
return t ? t->id : 0;
|
||||
}
|
||||
|
||||
int thread_wait_on_thread(thread_id id, int *retcode);
|
||||
|
||||
thread_id thread_create_user_thread(char *name, team_id tid, addr entry, void *args);
|
||||
thread_id thread_create_kernel_thread(const char *name, int (*func)(void *args), void *args);
|
||||
thread_id thread_create_kernel_thread_etc(const char *name, int (*func)(void *), void *args, struct team *p);
|
||||
thread_id spawn_kernel_thread_etc(thread_func, const char *name, int32 priority, void *args, team_id team);
|
||||
|
||||
int team_init(kernel_args *ka);
|
||||
struct team *team_get_kernel_team(void);
|
||||
team_id team_create_team(const char *path, const char *name, char **args, int argc, char **envp, int envc, int priority);
|
||||
int team_kill_team(team_id);
|
||||
int team_wait_on_team(team_id id, int *retcode);
|
||||
status_t wait_for_team(team_id id, status_t *returnCode);
|
||||
void team_remove_team_from_hash(struct team *team);
|
||||
team_id team_get_kernel_team_id(void);
|
||||
team_id team_get_current_team_id(void);
|
||||
@ -71,13 +64,20 @@ struct team *team_get_team_struct(team_id id);
|
||||
struct team *team_get_team_struct_locked(team_id id);
|
||||
|
||||
// used in syscalls.c
|
||||
int user_thread_wait_on_thread(thread_id id, int *uretcode);
|
||||
int user_thread_wait_for_thread(thread_id id, int *uretcode);
|
||||
team_id user_team_create_team(const char *path, const char *name, char **args, int argc, char **envp, int envc, int priority);
|
||||
int user_team_wait_on_team(team_id id, int *uretcode);
|
||||
int user_team_wait_for_team(team_id id, int *uretcode);
|
||||
|
||||
thread_id user_thread_create_user_thread(addr, team_id, const char*,
|
||||
int, void *);
|
||||
status_t user_set_thread_priority(thread_id thread, int32 newPriority);
|
||||
status_t user_suspend_thread(thread_id thread);
|
||||
status_t user_resume_thread(thread_id thread);
|
||||
thread_id user_spawn_thread(thread_func func, const char *name, int32 priority, void *arg);
|
||||
status_t user_wait_for_thread(thread_id id, status_t *returnCode);
|
||||
status_t user_wait_for_team(team_id id, status_t *returnCode);
|
||||
status_t user_snooze_etc(bigtime_t timeout, int timebase, uint32 flags);
|
||||
void user_exit_thread(status_t return_value);
|
||||
|
||||
bool user_has_data(thread_id thread);
|
||||
status_t user_send_data(thread_id thread, int32 code, const void *buffer, size_t buffer_size);
|
||||
status_t user_receive_data(thread_id *sender, void *buffer, size_t buffer_size);
|
||||
|
||||
@ -89,11 +89,10 @@ status_t user_get_next_team_info(int32 *cookie, team_info *info);
|
||||
int user_getrlimit(int resource, struct rlimit * rlp);
|
||||
int user_setrlimit(int resource, const struct rlimit * rlp);
|
||||
|
||||
// ToDo: please move the "env" setter/getter out of the kernel!
|
||||
int user_setenv(const char *name, const char *value, int overwrite);
|
||||
int user_getenv(const char *name, char **value);
|
||||
|
||||
int user_sigaction(int sig, const struct sigaction *act, struct sigaction *oact);
|
||||
|
||||
#if 1
|
||||
// XXX remove later
|
||||
int thread_test(void);
|
||||
|
@ -73,7 +73,7 @@ struct team {
|
||||
struct thread {
|
||||
struct thread *all_next;
|
||||
struct thread *team_next;
|
||||
struct thread *q_next;
|
||||
struct thread *queue_next; /* i.e. run queue, release queue, etc. */
|
||||
timer alarm;
|
||||
thread_id id;
|
||||
char name[SYS_MAX_OS_NAME_LEN];
|
||||
@ -108,7 +108,7 @@ struct thread {
|
||||
int32 page_faults_allowed;
|
||||
/* this field may only stay in debug builds in the future*/
|
||||
|
||||
addr entry;
|
||||
thread_func entry;
|
||||
void *args;
|
||||
struct team *team;
|
||||
status_t return_code;
|
||||
|
Loading…
Reference in New Issue
Block a user