/* ****************************************************************************** * ///////////// /////////////// * * ///////////////////// /////////////////////// * * /////////////////////////// //////////////////////////// * * /////////////////////////////// /////////////////////////////// * * ////////////// ///////////// ///////////// /////////// * * /////////// ////////// ///////// ////////// * * ///////// //////// ////////// ////////// * * /////// //////// //////////// * * ////// /////// ///////////// * * ///// //////// //////////////////////// * * ///// //////// ///////////////////////// * * ///// //////// //////////////////////////// * * ///// //////// /////////////////////////// * * ///// //############# /////////////// * * ////// ///############# ///////////// * * /////// ////####/ ////////// * * ///////// //////############/////// ///////// * * ////////// ////////############//////// ////////// * * ///////////// ////////////#### ///////////// /////////// * * //////////////////////////// #############////////////////////////////// * * ////////////////////////// #############//////////////////////////// * * /////////////////// ///////////////////////// * * ///////////// ///////////////// * * * * * * MULTITASKING REALTIME OPERATING SYSTEM. * * * * COPYRIGHT (C), 1991-2001, ENEA DATA AB. * * * *** *** ****************************************************************************** * @(#) File: ose.h Id: 06/1946370276339265 * * @(#) Revision: 3.24 Revision date: 02/09/25 * * * This file contains declarations to be included in prioritized or * background processes written in C. * * OSSIM should be defined when running the OSE simulator which is not part * of the standard OSE package. * * History of changes * * Date Name Vers Change * ------ ---- ---- ------------------------------- * * 930401 Bengt Eliasson 3.0 Initial OSExc release. * 930806 Bengt Eliasson 3.1 Moved system calls from ose_mmu.h * 931008 Bengt Eliasson 3.2 Assign_linkhandler() retuns OSBOOLEAN. * 931022 Bengt Eliasson 3.3 Altered the order of fields in the * OS_pcb struct to avoid alignment * problems. Added user parameter to * create_process(). Removed the set_uid() * call. * 931214 Bengt Eliasson 3.4 Added the set_segment() call and * modified the return type of the * attach_segment() call. * Added the OSE_LEVEL_x constants. * 940210 Bengt Eliasson 3.5 Added the set_pcb() call. * 940220 Bengt Eliasson 3.6 Replaced bad NIL declaration. * Added conditional C++ support. * 940821 Bengt Eliasson 3.7 Added the set_suid declaration. * Modified the OS_pcb struct according * to generic spec changes. * 940901 Bengt Eliasson 3.8 Added support for the obsolete * create_proc() system call present * in the old os68 Classic kernel. * Added prototypes for the implementation * specific system calls extend_pool(), error2(), * and set_redirection(). * 950901 Bengt Eliasson 3.9 The zz-prototypes for debugger calls are * available also without the OS_DEBUG flag. * Added prototypes for the implementation * specific system calls set_pri_for(), * set_abstime(), get_abstime(), get_segid(), * create_event() and signal_event(). * 951115 Bengt Eliasson 3.10 Fixed a C++ syntax error. * Added the ZZFILE_AT_HEAD constant. It is * intended only for internal ose use, and * it is defined in implementations that * places the file and line parameters of * system calls at the beginning of the * parameter list instead of at the end. * User code should not attempt to use it. * Added the implementation dependent * system calls exit_error_handler() and * receive_with(). * 960329 Bengt Eliasson 3.11 Removed bad parameters in zzpower_fail(). * 960925 Bengt Eliasson 3.12 Added the implementation dependent * system calls alloc_nil() and get_sysconf(). * Changed the type of system_tick() to OSTIME. * 961101 Bengt Eliasson 3.13 Removed a compiler warning in ZZOS_MAIN. * Added the @-PRIVATE-CALLS-@ tag. * 970718 Bengt Eliasson 3.14 Added the implementation dependent * system call receive_sport(). * 970920 Bengt Eliasson 3.15 Added the implementation dependent * system calls set_sigsize(), * get_sig_info(), get_pool_list(), * get_poolcb(), get_stk_poolid(), * get_sig_poolid(), get_envp() and set_envp(). * 990127 Fredrik Bredberg 3.16 Added zz-prototypes for system * calls signal_fsem(), signal_sem(), * wait_fsem(), wait_sem(), error2(), * receive_with(), get_sysconf(), * addressee(), sender(), sigsize(), * set_pri_for() and hunt_from(). * 000525 Fredrik Bredberg 3.17 A major rewrite in order to support * C++. Credits to Claes Lillieskold * and Gunnar Eklund for research and * moral support. * 010116 Fredrik Bredberg 3.18 The definition of the system type * is now imported from "osarch.h". * 010410 Fredrik Bredberg 3.19 Added const to some prototypes. * Moved some prototypes from the * private calls section. Declared * "union SIGNAL;" for both C and C++. * 011010 Fredrik Bredberg 3.20 Added the implementation dependent * system call cond_halt(). * 011101 Gunnar Eklund 3.21 Added the implementation dependent * timeout signal handling system calls. * Renamed cond_halt() to * set_halt_condition(). * 020221 Gunnar Eklund 3.22 Let error() and error2() provide * file and line information also when * OS_DEBUG is not defined. * 020313 Gunnar Eklund 3.23 With C++, inline error() and error2() * only when OS_DEBUG defined. * 020925 Fredrik Bredberg 3.24 Fixed a C++ incompatibility problem. */ #ifndef ZZOSE_H #define ZZOSE_H /* ** This symbol designates a prioritized or background process. */ #define OSE /* ** This include file defines a preprocessor symbol that states the ** current processor type. I.e. it will define either OS68, OSARM, ** OSMIPS, OSPP, softOSE or a similar symbol in future systems. ** ** It may also define a symbol called ZZFILE_AT_HEAD to state that the ** first (hidden) parameters to the debug versions of the system calls ** should be __FILE__ and __LINE__. If ZZFILE_AT_HEAD is not defined, ** file and line info will be passed as the last parameters. Of the ** above listed system types, OS68 and softOSE are the only ones that ** define this symbol. */ #ifndef __KERNEL__ #include "osarch.h" #endif /* ****************************************************************************** ** Simulator versions of OS types and functions. ****************************************************************************** */ #ifdef OSSIM #include "ossim.h" #else /* OSSIM */ /* ****************************************************************************** ** Target versions of OS types and functions. ****************************************************************************** */ /* * RTAI/LINUX target * Include hal.h and redefined some typedef that already exist */ #ifdef __KERNEL__ #include #include #define SEMAPHORE SEM #endif /* ** These symbols indicate the supported OSE implementation levels. */ #define OSE_LEVEL_B #define OSE_LEVEL_C /* ** C++ needs to know that this is C code. */ #ifdef __cplusplus extern "C" { #endif /* ** Basic types. */ typedef unsigned char OSPRIORITY; typedef unsigned char OSBOOLEAN; typedef unsigned short OSVECTOR; typedef unsigned long PROCESS; typedef unsigned long SIGSELECT; typedef unsigned long OSBUFSIZE; typedef unsigned long OSUSER; typedef unsigned long OSERRCODE; typedef unsigned long OSADDRESS; typedef unsigned long OSTIME; typedef unsigned long OSTICK; typedef unsigned long OSATTREF; typedef unsigned long OSSEGMENT; typedef signed long OSFSEMVAL; typedef signed long OSSEMVAL; typedef void (OSENTRYPOINT)(void); typedef OSADDRESS (OSERRH)(OSBOOLEAN, OSERRCODE, OSERRCODE); /* ** Derived types and misc constants. */ #ifdef __cplusplus #define OS_PROCESS(name) extern "C" void name(void) #else #define OS_PROCESS(name) void name(void) #endif #define ZZOS_MAIN(name) \ void name(void)\ {\ void zzname ## name(void);\ void zzinit_OSE(void);\ zzinit_OSE();zzname ## name();\ }\ void zzname ## name(void) #define NIL ((union SIGNAL *) 0) #define SYSTEM_TICK 1000L union SIGNAL; /* Forward declaration. */ #define OS_ATTACH_SIG (252) /* !-SIGNO(SIGSELECT)-! */ enum PROCESS_TYPE { OS_PRI_PROC = 0, OS_BG_PROC = 64, KTHRD_INT_PROC = 100, OS_INT_PROC = 128, OS_TI_PROC = 256, OS_PHANTOM = 512, OS_BLOCK = 1024, OS_ZOOMBIE = 2048, OS_ILLEGAL = 4096 }; enum PROCESS_STATUS { OS_RECEIVE = 1, OS_DELAY = 2, OS_SEMAPHORE = 4, OS_FSEMAPHORE = 8, OS_REMOTE = 16, OS_STOPPED = 32, OS_INTERCEPTED = 64 }; struct OS_redir_entry { SIGSELECT sig; PROCESS pid; }; #ifndef __KERNEL__ struct semaphore { OSSEMVAL value; void *f; void *b; }; typedef struct semaphore SEMAPHORE; #endif struct OS_pid_list { OSBUFSIZE count; PROCESS list[1]; /* Variable size */ }; struct OS_pcb { OSADDRESS type; /* enum PROCESS_TYPE */ OSADDRESS status; /* enum PROCESS_STATUS */ OSADDRESS priority; /* OSPRIORITY */ OSUSER user; OSFSEMVAL fsemvalue; OSADDRESS sigqueue; OSADDRESS attach_list; OSADDRESS stack_top; OSADDRESS stack_limit; PROCESS remote_server; OSADDRESS sig_cnt_in_q; OSADDRESS sig_cnt_owned; OSADDRESS max_sigsize; OSADDRESS sigsel_size; OSADDRESS line; OSADDRESS file; OSADDRESS name; OSADDRESS cpuregs; OSADDRESS wanted; char strings[1]; }; struct OS_sig_info { SIGSELECT sig_no; PROCESS owner; PROCESS sender_pid; PROCESS addressee_pid; OSBUFSIZE sig_size; OSBUFSIZE size_in_pool; OSADDRESS next; }; struct OS_poolcb { OSADDRESS tot_size; OSADDRESS free_size; OSADDRESS fragment_info; OSADDRESS stk_conf_entries; /* [0-8] -> 0 == Not a stack pool */ OSADDRESS sig_conf_entries; /* [0-8] -> 0 == Not a signal pool */ OSADDRESS stk_conf_sizes; OSADDRESS sig_conf_sizes; OSADDRESS stk_alloc_sizes; OSADDRESS sig_alloc_sizes; OSADDRESS values[1]; }; /* ** Prototypes. */ union SIGNAL * alloc(OSBUFSIZE size, SIGSELECT signo); OSBOOLEAN assign_linkhandler(const char *pathname, PROCESS handler); PROCESS attach_segment(PROCESS pid, OSSEGMENT segid); OSBOOLEAN clear_bp(PROCESS id, OSADDRESS addr); OSERRH * create_error_handler(PROCESS id, OSERRH *entrypoint, OSADDRESS stack_size); void create_pool(PROCESS bid, OSADDRESS base, OSADDRESS size, const OSADDRESS sigsize_tab[], const OSADDRESS stacksize_tab[]); /*#ifndef __KERNEL__*/ SEMAPHORE * create_sem(OSSEMVAL initial_val); /*#endif*/ PROCESS current_process(void); void flush(PROCESS *psel, PROCESS pid); PROCESS get_bid(PROCESS pid); struct OS_pid_list * get_bid_list(OSUSER user); #ifndef __KERNEL__ char * get_cpu(PROCESS pid); #endif char * get_env(PROCESS id, const char *name); char * get_env_list(PROCESS id, const char *first_name); OSADDRESS get_envp(PROCESS id, const char *name); OSFSEMVAL get_fsem(PROCESS pid); OSBOOLEAN get_mem(PROCESS id, OSADDRESS from, void *to, OSADDRESS size); struct OS_pcb * get_pcb(PROCESS id); struct OS_pid_list * get_pid_list(PROCESS bid); struct OS_pid_list * get_pool_list(OSUSER user); struct OS_poolcb * get_poolcb(PROCESS pool_id); OSPRIORITY get_pri(PROCESS pid); enum PROCESS_TYPE get_ptype(PROCESS pid); PROCESS get_segid(PROCESS pid); /*#ifndef __KERNEL__*/ OSSEMVAL get_sem(SEMAPHORE *sem); /*#endif*/ OSBOOLEAN get_sig_info(struct OS_sig_info *sig_info, PROCESS pool_id, PROCESS pid, OSADDRESS sig); PROCESS get_sig_poolid(PROCESS bid); OSBOOLEAN get_signal(PROCESS id, OSADDRESS mailptr, union SIGNAL **sig_copy, OSADDRESS *nextsig); PROCESS get_stk_poolid(PROCESS bid); OSTICK get_systime(OSTICK *microsecs); OSTICK get_ticks(void); #ifndef __KERNEL__ OSUSER get_uid(PROCESS id); #endif void intercept(PROCESS id); /*#ifndef __KERNEL__*/ void kill_sem(SEMAPHORE *sem); /*#endif*/ void restore(union SIGNAL *sig); void resume(PROCESS id); OSBOOLEAN set_bp(PROCESS id, OSADDRESS address, OSADDRESS attribute, union SIGNAL **trapsig); OSBOOLEAN set_env(PROCESS id, const char *name, const char *value); OSBOOLEAN set_envp(PROCESS id, const char *name, OSADDRESS value); void set_fsem(OSFSEMVAL value, PROCESS pid); OSBOOLEAN set_mem(PROCESS id, void *from, OSADDRESS to, OSADDRESS size); OSBOOLEAN set_pcb(PROCESS pid, const char *cpuregs); void set_redirection(PROCESS pid, struct OS_redir_entry *redir); OSBOOLEAN set_segment(OSBOOLEAN go_home, OSSEGMENT segid); OSBOOLEAN set_sigsize(union SIGNAL **sig, OSBUFSIZE newsize); void set_suid(OSBOOLEAN make_super); void start_OSE(void); OSTIME system_tick(void); #ifndef __KERNEL__ void tick(void); int wake_up(void); #endif #ifdef softOSE void zzzsend(union SIGNAL **sig, PROCESS to); #endif /* ** The "look and feel" of the following system calls will remain as below ** even though they are not declared here in case OS_DEBUG is defined. */ #if !(defined(__cplusplus) && defined(OS_DEBUG)) PROCESS addressee(union SIGNAL **sig); OSATTREF attach(union SIGNAL **sig, PROCESS id); PROCESS create_block(const char *name, OSUSER user, OSBOOLEAN use_remote_calls, PROCESS remote_call_server, OSBOOLEAN supervisor_mode); PROCESS create_process(enum PROCESS_TYPE proc_type, const char *name, OSENTRYPOINT *entrypoint, OSADDRESS stack_size, OSPRIORITY priority, OSTIME timeslice, PROCESS block, struct OS_redir_entry *router_table, OSVECTOR vector, OSUSER user); void delay(OSTIME timeout); void detach(OSATTREF *sigref); void error(OSERRCODE ecode); void error2(OSERRCODE ecode, OSERRCODE extra); void free_buf(union SIGNAL **sig); OSADDRESS get_sysconf(OSADDRESS f, OSADDRESS p, OSADDRESS q, OSADDRESS r); OSBOOLEAN hunt(const char *name, OSUSER user, PROCESS *name_, union SIGNAL **hunt_sig); OSBOOLEAN hunt_from(const char *name, OSUSER user, PROCESS *name_, union SIGNAL **hunt_sig, PROCESS from); #ifndef __KERNEL__ void kill_proc(PROCESS id); #else void ose_kill_proc(PROCESS id); #endif void power_fail(void); union SIGNAL * receive(const SIGSELECT *sigsel); union SIGNAL * receive_from(OSTIME timeout, const SIGSELECT *sel, PROCESS from); union SIGNAL * receive_sport(OSTIME timeout, const SIGSELECT *sel, PROCESS *sport_list); union SIGNAL * receive_w_tmo(OSTIME timeout, const SIGSELECT *sel); union SIGNAL * receive_with(OSTIME timeout, const SIGSELECT *sel, PROCESS from); #ifndef softOSE void send(union SIGNAL **sig, PROCESS to); #endif PROCESS sender(union SIGNAL **sig); void send_w_s(union SIGNAL **sig, PROCESS from, PROCESS to); OSPRIORITY set_pri(OSPRIORITY newpri); OSPRIORITY set_pri_for(PROCESS pid, OSPRIORITY newpri); OSBUFSIZE sigsize(union SIGNAL **sig); void signal_fsem(PROCESS pid); /*#ifndef __KERNEL__*/ void signal_sem(SEMAPHORE *sem); /*#endif*/ void start(PROCESS id); void stop(PROCESS id); void wait_fsem(OSFSEMVAL count); /*#ifndef __KERNEL__*/ void wait_sem(SEMAPHORE *sem); /*#endif*/ #endif /* !(defined(__cplusplus) && defined(OS_DEBUG)) */ /* ** Debug system calls. */ #ifdef ZZFILE_AT_HEAD #define ZZPRE_PROTO const char *file, long line, #define ZZPOST_PROTO #define ZZPRE_ARGS __FILE__,__LINE__, #define ZZPRE_CPP_ARGS(n) #n "@ose.h", __LINE__, #define ZZPOST_ARGS #define ZZPOST_CPP_ARGS(n) #else #define ZZPRE_PROTO #define ZZPOST_PROTO ,const char *file, long line #define ZZPRE_ARGS #define ZZPRE_CPP_ARGS(n) #define ZZPOST_ARGS ,__FILE__,__LINE__ #define ZZPOST_CPP_ARGS(n) , #n "@ose.h", __LINE__ #endif #define ZZMIDDLE_PROTO const char *file, long line #define ZZMIDDLE_ARGS __FILE__,__LINE__ #define ZZMIDDLE_CPP_ARGS(n) #n "@ose.h", __LINE__ PROCESS zzaddressee(ZZPRE_PROTO union SIGNAL **sig ZZPOST_PROTO); OSATTREF zzattach(ZZPRE_PROTO union SIGNAL **sig, PROCESS id ZZPOST_PROTO); PROCESS zzcreate_block(ZZPRE_PROTO const char *name, OSUSER user, OSBOOLEAN use_remote_calls, PROCESS remote_call_server, OSBOOLEAN supervisor_mode ZZPOST_PROTO); PROCESS zzcreate_process(ZZPRE_PROTO enum PROCESS_TYPE proc_type, const char *name, OSENTRYPOINT *entrypoint, OSADDRESS stack_size, OSPRIORITY priority, OSTIME timeslice, PROCESS block, struct OS_redir_entry *router_table, OSVECTOR vector, OSUSER user ZZPOST_PROTO); void zzdelay(ZZPRE_PROTO OSTIME timeout ZZPOST_PROTO); void zzdetach(ZZPRE_PROTO OSATTREF *sigref ZZPOST_PROTO); void zzerror(ZZPRE_PROTO OSERRCODE ecode ZZPOST_PROTO); void zzerror2(ZZPRE_PROTO OSERRCODE ecode, OSERRCODE extra ZZPOST_PROTO); void zzfree_buf(ZZPRE_PROTO union SIGNAL **sig ZZPOST_PROTO); OSADDRESS zzget_sysconf(ZZPRE_PROTO OSADDRESS f, OSADDRESS p, OSADDRESS q, OSADDRESS r ZZPOST_PROTO); OSBOOLEAN zzhunt(ZZPRE_PROTO const char *name, OSUSER user, PROCESS *name_, union SIGNAL **hunt_sig ZZPOST_PROTO); OSBOOLEAN zzhunt_from(ZZPRE_PROTO const char *name, OSUSER user, PROCESS *name_, union SIGNAL **hunt_sig, PROCESS from ZZPOST_PROTO); void zzkill_proc(ZZPRE_PROTO PROCESS id ZZPOST_PROTO); void zzpower_fail(ZZMIDDLE_PROTO); union SIGNAL * zzreceive(ZZPRE_PROTO const SIGSELECT *sigsel ZZPOST_PROTO); union SIGNAL * zzreceive_from(ZZPRE_PROTO OSTIME timeout, const SIGSELECT *sel, PROCESS from ZZPOST_PROTO); union SIGNAL * zzreceive_w_tmo(ZZPRE_PROTO OSTIME timeout, const SIGSELECT *sel ZZPOST_PROTO); union SIGNAL * zzreceive_with(ZZPRE_PROTO OSTIME timeout, const SIGSELECT *sel, PROCESS from ZZPOST_PROTO); void zzsend(ZZPRE_PROTO union SIGNAL **sig, PROCESS to ZZPOST_PROTO); PROCESS zzsender(ZZPRE_PROTO union SIGNAL **sig ZZPOST_PROTO); void zzsend_w_s(ZZPRE_PROTO union SIGNAL **sig, PROCESS from, PROCESS to ZZPOST_PROTO); OSPRIORITY zzset_pri(ZZPRE_PROTO OSPRIORITY newpri ZZPOST_PROTO); OSPRIORITY zzset_pri_for(ZZPRE_PROTO PROCESS pid, OSPRIORITY newpri ZZPOST_PROTO); OSBUFSIZE zzsigsize(ZZPRE_PROTO union SIGNAL **sig ZZPOST_PROTO); void zzsignal_fsem(ZZPRE_PROTO PROCESS pid ZZPOST_PROTO); /*#ifndef __KERNEL__*/ void zzsignal_sem(ZZPRE_PROTO SEMAPHORE *sem ZZPOST_PROTO); /*#endif*/ void zzstart(ZZPRE_PROTO PROCESS id ZZPOST_PROTO); void zzstop(ZZPRE_PROTO PROCESS id ZZPOST_PROTO); void zzwait_fsem(ZZPRE_PROTO OSFSEMVAL count ZZPOST_PROTO); /*#ifndef __KERNEL__*/ void zzwait_sem(ZZPRE_PROTO SEMAPHORE *sem ZZPOST_PROTO); /*#endif*/ #ifdef __cplusplus } /* end of extern "C" */ #ifdef OS_DEBUG static inline PROCESS addressee(union SIGNAL **sig) { return zzaddressee(ZZPRE_CPP_ARGS(addressee) sig ZZPOST_CPP_ARGS(addressee)); } static inline OSATTREF attach(union SIGNAL **sig, PROCESS id) { return zzattach(ZZPRE_CPP_ARGS(attach) sig, id ZZPOST_CPP_ARGS(attach)); } static inline PROCESS create_block(const char *name, OSUSER user, OSBOOLEAN use_remote_calls, PROCESS remote_call_server, OSBOOLEAN supervisor_mode) { return zzcreate_block(ZZPRE_CPP_ARGS(create_block) name, user, use_remote_calls, remote_call_server, supervisor_mode ZZPOST_CPP_ARGS(create_block)); } static inline PROCESS create_process(enum PROCESS_TYPE proc_type,const char *name, OSENTRYPOINT *entrypoint, OSADDRESS stack_size, OSPRIORITY priority, OSTIME timeslice, PROCESS block, struct OS_redir_entry *router_table, OSVECTOR vector, OSUSER user) { return zzcreate_process(ZZPRE_CPP_ARGS(create_process) proc_type, name, entrypoint, stack_size, priority, timeslice, block, router_table, vector, user ZZPOST_CPP_ARGS(create_process)); } static inline void delay(OSTIME timeout) { zzdelay(ZZPRE_CPP_ARGS(delay) timeout ZZPOST_CPP_ARGS(delay)); } static inline void detach(OSATTREF *sigref) { zzdetach(ZZPRE_CPP_ARGS(detach) sigref ZZPOST_CPP_ARGS(detach)); } static inline void error(OSERRCODE ecode) { zzerror(ZZPRE_CPP_ARGS(error) ecode ZZPOST_CPP_ARGS(error)); } static inline void error2(OSERRCODE ecode, OSERRCODE extra) { zzerror2(ZZPRE_CPP_ARGS(error2) ecode, extra ZZPOST_CPP_ARGS(error2)); } static inline void free_buf(union SIGNAL **sig) { zzfree_buf(ZZPRE_CPP_ARGS(free_buf) sig ZZPOST_CPP_ARGS(free_buf)); } static inline OSADDRESS get_sysconf(OSADDRESS f, OSADDRESS p, OSADDRESS q, OSADDRESS r) { return zzget_sysconf(ZZPRE_CPP_ARGS(get_sysconf) f, p, q, r ZZPOST_CPP_ARGS(get_sysconf)); } static inline OSBOOLEAN hunt(const char *name, OSUSER user, PROCESS *name_, union SIGNAL **hunt_sig) { return zzhunt(ZZPRE_CPP_ARGS(hunt) name, user, name_, hunt_sig ZZPOST_CPP_ARGS(hunt)); } static inline OSBOOLEAN hunt_from(const char *name, OSUSER user, PROCESS *name_, union SIGNAL **hunt_sig, PROCESS from) { return zzhunt_from(ZZPRE_CPP_ARGS(hunt_from) name, user, name_, hunt_sig, from ZZPOST_CPP_ARGS(hunt_from)); } static inline void kill_proc(PROCESS id) { zzkill_proc(ZZPRE_CPP_ARGS(kill_proc) id ZZPOST_CPP_ARGS(kill_proc)); } static inline void power_fail(void) { zzpower_fail(ZZMIDDLE_CPP_ARGS(power_fail)); } static inline union SIGNAL * receive(const SIGSELECT *sigsel) { return zzreceive(ZZPRE_CPP_ARGS(receive) sigsel ZZPOST_CPP_ARGS(receive)); } static inline union SIGNAL * receive_from(OSTIME timeout, const SIGSELECT *sel, PROCESS from) { return zzreceive_from(ZZPRE_CPP_ARGS(receive_from) timeout, sel, from ZZPOST_CPP_ARGS(receive_from)); } static inline union SIGNAL * receive_w_tmo(OSTIME timeout, const SIGSELECT *sel) { return zzreceive_w_tmo(ZZPRE_CPP_ARGS(receive_w_tmo) timeout, sel ZZPOST_CPP_ARGS(receive_w_tmo)); } static inline union SIGNAL * receive_with(OSTIME timeout, const SIGSELECT *sel, PROCESS from) { return zzreceive_with(ZZPRE_CPP_ARGS(receive_with) timeout, sel, from ZZPOST_CPP_ARGS(receive_with)); } static inline void send(union SIGNAL **sig, PROCESS to) { zzsend(ZZPRE_CPP_ARGS(send) sig, to ZZPOST_CPP_ARGS(send)); } static inline PROCESS sender(union SIGNAL **sig) { return zzsender(ZZPRE_CPP_ARGS(sender) sig ZZPOST_CPP_ARGS(sender)); } static inline void send_w_s(union SIGNAL **sig, PROCESS from, PROCESS to) { zzsend_w_s(ZZPRE_CPP_ARGS(send_w_s) sig, from, to ZZPOST_CPP_ARGS(send_w_s)); } static inline OSPRIORITY set_pri(OSPRIORITY newpri) { return zzset_pri(ZZPRE_CPP_ARGS(set_pri) newpri ZZPOST_CPP_ARGS(set_pri)); } static inline OSPRIORITY set_pri_for(PROCESS pid, OSPRIORITY newpri) { return zzset_pri_for(ZZPRE_CPP_ARGS(set_pri_for) pid, newpri ZZPOST_CPP_ARGS(set_pri_for)); } static inline OSBUFSIZE sigsize(union SIGNAL **sig) { return zzsigsize(ZZPRE_CPP_ARGS(sigsize) sig ZZPOST_CPP_ARGS(sigsize)); } static inline void signal_fsem(PROCESS pid) { zzsignal_fsem(ZZPRE_CPP_ARGS(signal_fsem) pid ZZPOST_CPP_ARGS(signal_fsem)); } #ifndef __KERNEL__ static inline void signal_sem(SEMAPHORE *sem) { zzsignal_sem(ZZPRE_CPP_ARGS(signal_sem) sem ZZPOST_CPP_ARGS(signal_sem)); } #endif static inline void start(PROCESS id) { zzstart(ZZPRE_CPP_ARGS(start) id ZZPOST_CPP_ARGS(start)); } static inline void stop(PROCESS id) { zzstop(ZZPRE_CPP_ARGS(stop) id ZZPOST_CPP_ARGS(stop)); } static inline void wait_fsem(OSFSEMVAL count) { zzwait_fsem(ZZPRE_CPP_ARGS(wait_fsem) count ZZPOST_CPP_ARGS(wait_fsem)); } #ifndef __KERNEL__ static inline void wait_sem(SEMAPHORE *sem) { zzwait_sem(ZZPRE_CPP_ARGS(wait_sem) sem ZZPOST_CPP_ARGS(wait_sem)); } #endif #endif /* OS_DEBUG */ extern "C" { /* end of C++ */ #else /* __cplusplus */ #if !defined(ZZNO_FILE_LINE_INFO_IN_ERROR) #define error(ecode) zzerror(ZZPRE_ARGS ecode ZZPOST_ARGS) #define error2(ecode,extra) zzerror2(ZZPRE_ARGS ecode,extra ZZPOST_ARGS) #endif #ifdef OS_DEBUG #define addressee(sig) zzaddressee(ZZPRE_ARGS sig ZZPOST_ARGS) #define attach(sig,id) zzattach(ZZPRE_ARGS sig,id ZZPOST_ARGS) #define create_block(name,user,use_remote_calls,remote_call_server,\ supervisor_mode) \ zzcreate_block(ZZPRE_ARGS name,user,\ use_remote_calls,remote_call_server,\ supervisor_mode ZZPOST_ARGS) #define create_process(proc_type,name,entrypoint,stack_size,priority,\ timeslice,block,router_table,vector,user) \ zzcreate_process(ZZPRE_ARGS proc_type,name,entrypoint,\ stack_size,priority,timeslice,block,router_table,\ vector,user ZZPOST_ARGS) #define delay(timeout) zzdelay(ZZPRE_ARGS timeout ZZPOST_ARGS) #define detach(id) zzdetach(ZZPRE_ARGS id ZZPOST_ARGS) #define free_buf(sig) zzfree_buf(ZZPRE_ARGS sig ZZPOST_ARGS) #define get_sysconf(f,p,q,r)\ zzget_sysconf(ZZPRE_ARGS f,p,q,r ZZPOST_ARGS) #define hunt(name,user,name_,hunt_sig)\ zzhunt(ZZPRE_ARGS name,user,name_,hunt_sig ZZPOST_ARGS) #define hunt_from(name,user,name_,hunt_sig,from)\ zzhunt_from(ZZPRE_ARGS name,user,name_,hunt_sig,from ZZPOST_ARGS) #define kill_proc(id) zzkill_proc(ZZPRE_ARGS id ZZPOST_ARGS) #define power_fail() zzpower_fail(ZZMIDDLE_ARGS) #define receive(sigsel) zzreceive(ZZPRE_ARGS sigsel ZZPOST_ARGS) #define receive_from(timeout,sel,from)\ zzreceive_from(ZZPRE_ARGS timeout,sel,from ZZPOST_ARGS) #define receive_w_tmo(timeout,sel)\ zzreceive_w_tmo(ZZPRE_ARGS timeout,sel ZZPOST_ARGS) #define receive_with(timeout,sel,from)\ zzreceive_with(ZZPRE_ARGS timeout,sel,from ZZPOST_ARGS) #define send(sig,to) zzsend(ZZPRE_ARGS sig,to ZZPOST_ARGS) #define sender(sig) zzsender(ZZPRE_ARGS sig ZZPOST_ARGS) #define send_w_s(sig,from,to) zzsend_w_s(ZZPRE_ARGS sig,from,to ZZPOST_ARGS) #define set_pri(newpri) zzset_pri(ZZPRE_ARGS newpri ZZPOST_ARGS) #define set_pri_for(pid,newpri) zzset_pri_for(ZZPRE_ARGS pid,newpri \ ZZPOST_ARGS) #define sigsize(sig) zzsigsize(ZZPRE_ARGS sig ZZPOST_ARGS) #define signal_fsem(id) zzsignal_fsem(ZZPRE_ARGS id ZZPOST_ARGS) #define signal_sem(sem) zzsignal_sem(ZZPRE_ARGS sem ZZPOST_ARGS) #define start(id) zzstart(ZZPRE_ARGS id ZZPOST_ARGS) #define stop(id) zzstop(ZZPRE_ARGS id ZZPOST_ARGS) #define wait_fsem(count) zzwait_fsem(ZZPRE_ARGS count ZZPOST_ARGS) #define wait_sem(sem) zzwait_sem(ZZPRE_ARGS sem ZZPOST_ARGS) #endif /* OS_DEBUG */ #endif /* __cplusplus */ #if defined(softOSE) && !defined(OS_DEBUG) #ifdef __cplusplus } /* end of extern "C" */ static inline void send(union SIGNAL **sig, PROCESS to) { zzzsend(sig, to); } extern "C" { /* end of C++ */ #else #define send(sig, to) zzzsend(sig, to) #endif /* __cplusplus */ #endif /* defined(softOSE) && !defined(OS_DEBUG) */ /* ** The system calls below are considered "implementation specific". ** This means that they are subject to a lower degree of portability than ** other system calls as they are present only in some OSE Delta implementations. ** New system calls that have not yet been incorporated in the generic OSE delta ** specification are also treated as "implementation specific" until it has been ** decided that they should be globally adopted. */ /*@-PRIVATE-CALLS-@*/ void extend_pool(OSERRCODE pool_id, OSADDRESS base, OSADDRESS size); void set_abstime(OSTICK abs_time, OSTICK ticks, OSTICK microsecs); void get_abstime(OSTICK *abs_time, OSTICK *ticks, OSTICK *microsecs); OSADDRESS create_event(OSADDRESS *trig, const char *class_name, const char *format); void signal_event(OSADDRESS *trig, OSADDRESS handle, ...); /* Max 5 extra fields. */ void exit_error_handler(void); union SIGNAL *alloc_nil(OSBUFSIZE size, SIGSELECT signo); #define ZZGET_SYSCONF OSTIME set_halt_condition(OSTIME threshold_time); typedef OSADDRESS OSTMOREF; OSTMOREF request_tmo_sig(OSTIME timeout, union SIGNAL **tmosig); OSTMOREF request_tmo(OSTIME timeout, SIGSELECT tmosigno); union SIGNAL *cancel_tmo_sig(OSTMOREF *tmoref); void cancel_tmo(OSTMOREF *tmoref); void restart_tmo(OSTMOREF *tmoref, OSTIME timeout); /* ** These definitions are needed to support the obsolete create_proc() system call ** that is inherited from the OS68 Classic kernel. It is officially supported only ** in the 68k family of OSE delta. ** Please use the new create_process() system call in new designs whenever possible. */ #define SUPERVISOR 0x2000 #define USER 0 #define OSDEFAULT 0 #define OSDEBUG 0 #define OSNOSIGDB 1 #define OSNOPDB 2 #define OSNODEBUG 3 typedef unsigned long int OSSTACKSIZE; typedef unsigned long int OSPROCTYPE; typedef unsigned long int OSOPTION; PROCESS create_proc(OSENTRYPOINT *entrypoint, const char *name, OSPRIORITY priority, OSSTACKSIZE stacksz, OSPROCTYPE type, OSTIME timeslice, OSOPTION opt1, OSOPTION opt2); #ifdef __cplusplus } #endif #endif /* OSSIM */ #endif /* ZZOSE_H */