Moved the files vm_types.h, syscalls.h, and vfs_types.h to the private
kernel header directory - they are by no means public includes. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2349 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,119 +0,0 @@
|
||||
/*
|
||||
** Copyright 2001, Travis Geiselbrecht. All rights reserved.
|
||||
** Distributed under the terms of the NewOS License.
|
||||
*/
|
||||
#ifndef _LIBSYS_SYSCALLS_H
|
||||
#define _LIBSYS_SYSCALLS_H
|
||||
|
||||
/* this file shouldn't be in the public folder! */
|
||||
|
||||
#include <ktypes.h>
|
||||
#include <defines.h>
|
||||
#include <resource.h>
|
||||
#include <vfs_types.h>
|
||||
#include <vm_types.h>
|
||||
#include <thread_types.h>
|
||||
#include <OS.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int sys_null();
|
||||
|
||||
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);
|
||||
|
||||
/* sem functions */
|
||||
sem_id sys_create_sem(int count, const char *name);
|
||||
int sys_delete_sem(sem_id id);
|
||||
int sys_acquire_sem(sem_id id);
|
||||
int sys_acquire_sem_etc(sem_id id, uint32 count, uint32 flags, bigtime_t timeout);
|
||||
int sys_release_sem(sem_id id);
|
||||
int sys_release_sem_etc(sem_id id, uint32 count, uint32 flags);
|
||||
int sys_sem_get_count(sem_id id, int32* thread_count);
|
||||
int sys_get_sem_info(sem_id, struct sem_info *, size_t);
|
||||
int sys_get_next_sem_info(team_id, uint32 *, struct sem_info *, size_t);
|
||||
int sys_set_sem_owner(sem_id id, team_id proc);
|
||||
|
||||
void sys_exit(int retcode);
|
||||
team_id sys_create_team(const char *path, const char *name, char **args, int argc, char **envp, int envc, int priority);
|
||||
|
||||
thread_id sys_spawn_thread(int32 (*func)(void*), const char *, int32, void *);
|
||||
thread_id sys_get_current_thread_id(void);
|
||||
int sys_suspend_thread(thread_id tid);
|
||||
int sys_resume_thread(thread_id tid);
|
||||
int sys_kill_thread(thread_id tid);
|
||||
void sys_exit_thread(status_t return_value);
|
||||
|
||||
status_t sys_wait_on_thread(thread_id tid, status_t *retcode);
|
||||
int sys_kill_team(team_id tid);
|
||||
|
||||
team_id sys_get_current_team_id();
|
||||
int sys_wait_on_team(team_id tid, int *retcode);
|
||||
|
||||
status_t sys_get_thread_info(thread_id id, thread_info *info);
|
||||
status_t sys_get_next_thread_info(team_id team, int32 *cookie, thread_info *info);
|
||||
status_t sys_get_team_info(team_id id, team_info *info);
|
||||
status_t sys_get_next_team_info(int32 *cookie, team_info *info);
|
||||
|
||||
int sys_send_signal(pid_t tid, uint sig);
|
||||
int sys_sigaction(int sig, const struct sigaction *act, struct sigaction *oact);
|
||||
bigtime_t sys_set_alarm(bigtime_t time, uint32 mode);
|
||||
|
||||
region_id sys_vm_create_anonymous_region(const char *name, void **address, int addr_type,
|
||||
addr size, int wiring, int lock);
|
||||
region_id sys_vm_clone_region(const char *name, void **address, int addr_type,
|
||||
region_id source_region, int mapping, int lock);
|
||||
region_id sys_vm_map_file(const char *name, void **address, int addr_type,
|
||||
addr size, int lock, int mapping, const char *path, off_t offset);
|
||||
int sys_vm_delete_region(region_id id);
|
||||
int sys_vm_get_region_info(region_id id, vm_region_info *info);
|
||||
|
||||
/* kernel port functions */
|
||||
port_id sys_port_create(int32 queue_length, const char *name);
|
||||
int sys_port_close(port_id id);
|
||||
int sys_port_delete(port_id id);
|
||||
port_id sys_port_find(const char *port_name);
|
||||
int sys_port_get_info(port_id id, struct port_info *info);
|
||||
int sys_port_get_next_port_info(team_id team, uint32 *cookie, struct port_info *info);
|
||||
ssize_t sys_port_buffer_size(port_id port);
|
||||
ssize_t sys_port_buffer_size_etc(port_id port, uint32 flags, bigtime_t timeout);
|
||||
int32 sys_port_count(port_id port);
|
||||
ssize_t sys_port_read(port_id port, int32 *msg_code, void *msg_buffer, size_t buffer_size);
|
||||
ssize_t sys_port_read_etc(port_id port, int32 *msg_code, void *msg_buffer, size_t buffer_size, uint32 flags, bigtime_t timeout);
|
||||
int sys_port_set_owner(port_id port, team_id team);
|
||||
int sys_port_write(port_id port, int32 msg_code, const void *msg_buffer, size_t buffer_size);
|
||||
int sys_port_write_etc(port_id port, int32 msg_code, const void *msg_buffer, size_t buffer_size, uint32 flags, bigtime_t timeout);
|
||||
|
||||
/* atomic_* ops (needed for cpus that dont support them directly) */
|
||||
int sys_atomic_add(int *val, int incr);
|
||||
int sys_atomic_and(int *val, int incr);
|
||||
int sys_atomic_or(int *val, int incr);
|
||||
int sys_atomic_set(int *val, int set_to);
|
||||
int sys_test_and_set(int *val, int set_to, int test_val);
|
||||
|
||||
int sys_sysctl(int *, uint, void *, size_t *, void *, size_t);
|
||||
int sys_socket(int, int, int);
|
||||
|
||||
int sys_setenv(const char *, const char *, int);
|
||||
int sys_getenv(const char *, char **);
|
||||
|
||||
/* region prototypes */
|
||||
area_id sys_find_region_by_name(const char *);
|
||||
|
||||
/* This is a real BSD'ism :) Basically it returns the size of the
|
||||
* descriptor table for the current process as an integer.
|
||||
*/
|
||||
int sys_getdtablesize(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#ifndef VFS_TYPES_H
|
||||
#define VFS_TYPES_H
|
||||
|
||||
#include <sys/uio.h>
|
||||
|
||||
typedef struct iovecs {
|
||||
size_t num;
|
||||
size_t total_len;
|
||||
iovec vec[0];
|
||||
} iovecs;
|
||||
|
||||
#endif /* VFS_TYPES_H */
|
||||
|
||||
@@ -1,185 +0,0 @@
|
||||
#ifndef _PUBLIC_KERNEL_VM_TYPES_H
|
||||
#define _PUBLIC_KERNEL_VM_TYPES_H
|
||||
|
||||
// ToDo: this file shouldn't be in the public folder
|
||||
|
||||
#include <kernel.h>
|
||||
#include <stage2.h>
|
||||
#include <defines.h>
|
||||
#include <vfs.h>
|
||||
#include <arch/vm_translation_map.h>
|
||||
|
||||
// vm page
|
||||
typedef struct vm_page {
|
||||
struct vm_page *queue_prev;
|
||||
struct vm_page *queue_next;
|
||||
|
||||
struct vm_page *hash_next;
|
||||
|
||||
addr ppn; // physical page number
|
||||
off_t offset;
|
||||
|
||||
struct vm_cache_ref *cache_ref;
|
||||
|
||||
struct vm_page *cache_prev;
|
||||
struct vm_page *cache_next;
|
||||
|
||||
int32 ref_count;
|
||||
|
||||
unsigned int type : 2;
|
||||
unsigned int state : 3;
|
||||
} vm_page;
|
||||
|
||||
enum {
|
||||
PAGE_TYPE_PHYSICAL = 0,
|
||||
PAGE_TYPE_DUMMY,
|
||||
PAGE_TYPE_GUARD
|
||||
};
|
||||
|
||||
enum {
|
||||
PAGE_STATE_ACTIVE = 0,
|
||||
PAGE_STATE_INACTIVE,
|
||||
PAGE_STATE_BUSY,
|
||||
PAGE_STATE_MODIFIED,
|
||||
PAGE_STATE_FREE,
|
||||
PAGE_STATE_CLEAR,
|
||||
PAGE_STATE_WIRED,
|
||||
PAGE_STATE_UNUSED
|
||||
};
|
||||
|
||||
// vm_cache_ref
|
||||
typedef struct vm_cache_ref {
|
||||
struct vm_cache *cache;
|
||||
mutex lock;
|
||||
|
||||
struct vm_region *region_list;
|
||||
|
||||
int32 ref_count;
|
||||
} vm_cache_ref;
|
||||
|
||||
// vm_cache
|
||||
typedef struct vm_cache {
|
||||
vm_page *page_list;
|
||||
vm_cache_ref *ref;
|
||||
struct vm_cache *source;
|
||||
struct vm_store *store;
|
||||
off_t virtual_size;
|
||||
unsigned int temporary : 1;
|
||||
unsigned int scan_skip : 1;
|
||||
} vm_cache;
|
||||
|
||||
// info about a region that external entities may want to know
|
||||
// used in vm_get_region_info()
|
||||
typedef struct vm_region_info {
|
||||
region_id id;
|
||||
addr base;
|
||||
addr size;
|
||||
int lock;
|
||||
int wiring;
|
||||
char name[SYS_MAX_OS_NAME_LEN];
|
||||
} vm_region_info;
|
||||
|
||||
// vm region
|
||||
typedef struct vm_region {
|
||||
char *name;
|
||||
region_id id;
|
||||
addr base;
|
||||
addr size;
|
||||
int lock;
|
||||
int wiring;
|
||||
int32 ref_count;
|
||||
|
||||
struct vm_cache_ref *cache_ref;
|
||||
off_t cache_offset;
|
||||
|
||||
struct vm_address_space *aspace;
|
||||
struct vm_region *aspace_next;
|
||||
struct vm_virtual_map *map;
|
||||
struct vm_region *cache_next;
|
||||
struct vm_region *cache_prev;
|
||||
struct vm_region *hash_next;
|
||||
} vm_region;
|
||||
|
||||
// virtual map (1 per address space)
|
||||
typedef struct vm_virtual_map {
|
||||
vm_region *region_list;
|
||||
vm_region *region_hint;
|
||||
int change_count;
|
||||
sem_id sem;
|
||||
struct vm_address_space *aspace;
|
||||
addr base;
|
||||
addr size;
|
||||
} vm_virtual_map;
|
||||
|
||||
enum {
|
||||
VM_ASPACE_STATE_NORMAL = 0,
|
||||
VM_ASPACE_STATE_DELETION
|
||||
};
|
||||
|
||||
// address space
|
||||
typedef struct vm_address_space {
|
||||
vm_virtual_map virtual_map;
|
||||
vm_translation_map translation_map;
|
||||
char *name;
|
||||
aspace_id id;
|
||||
int32 ref_count;
|
||||
int32 fault_count;
|
||||
int state;
|
||||
addr scan_va;
|
||||
addr working_set_size;
|
||||
addr max_working_set;
|
||||
addr min_working_set;
|
||||
bigtime_t last_working_set_adjust;
|
||||
struct vm_address_space *hash_next;
|
||||
} vm_address_space;
|
||||
|
||||
// vm_store
|
||||
typedef struct vm_store {
|
||||
struct vm_store_ops *ops;
|
||||
struct vm_cache *cache;
|
||||
void *data;
|
||||
off_t committed_size;
|
||||
} vm_store;
|
||||
|
||||
// vm_store_ops
|
||||
typedef struct vm_store_ops {
|
||||
void (*destroy)(struct vm_store *backing_store);
|
||||
off_t (*commit)(struct vm_store *backing_store, off_t size);
|
||||
int (*has_page)(struct vm_store *backing_store, off_t offset);
|
||||
ssize_t (*read)(struct vm_store *backing_store, off_t offset, iovecs *vecs);
|
||||
ssize_t (*write)(struct vm_store *backing_store, off_t offset, iovecs *vecs);
|
||||
int (*fault)(struct vm_store *backing_store, struct vm_address_space *aspace, off_t offset);
|
||||
void (*acquire_ref)(struct vm_store *backing_store);
|
||||
void (*release_ref)(struct vm_store *backing_store);
|
||||
} vm_store_ops;
|
||||
|
||||
// args for the create_area funcs
|
||||
enum {
|
||||
REGION_ADDR_ANY_ADDRESS = 0,
|
||||
REGION_ADDR_EXACT_ADDRESS
|
||||
};
|
||||
|
||||
enum {
|
||||
REGION_NO_PRIVATE_MAP = 0,
|
||||
REGION_PRIVATE_MAP
|
||||
};
|
||||
|
||||
enum {
|
||||
REGION_WIRING_LAZY = 0,
|
||||
REGION_WIRING_WIRED,
|
||||
REGION_WIRING_WIRED_ALREADY,
|
||||
REGION_WIRING_WIRED_CONTIG
|
||||
};
|
||||
|
||||
enum {
|
||||
PHYSICAL_PAGE_NO_WAIT = 0,
|
||||
PHYSICAL_PAGE_CAN_WAIT,
|
||||
};
|
||||
|
||||
#define LOCK_RO 0x0
|
||||
#define LOCK_RW 0x1
|
||||
#define LOCK_KERNEL 0x2
|
||||
#define LOCK_MASK 0x3
|
||||
|
||||
#endif /* _PUBLIC_KERNEL_VM_TYPES_H */
|
||||
|
||||
Reference in New Issue
Block a user