OSE Kernel Reference Manual Kernel - cnblogs.com · Reference Manual / R1.0.4 OSE / Kernel - 2 : 2...
Transcript of OSE Kernel Reference Manual Kernel - cnblogs.com · Reference Manual / R1.0.4 OSE / Kernel - 2 : 2...
Ker
nel
OSEKernel
Reference Manual
Enea OSE Systems AB
Ker
nel
may mputer e,
is re may
hereof ar make B to
Document No: 420e/OSE93-1 R1.0.4
CopyrightCopyright (C) 1998 by Enea OSE Systems AB. All rights reserved. No part of this publicationbe reproduced, transmitted, stored in a retrieval system, or translated into any language or colanguage, in any form or by any means, electronic, mechanical, optical, chemical or otherwiswithout the prior written permission of Enea OSE Systems AB. The software described in thdocument is furnished under a licence agreement or a non-disclosure agreement. The softwabe used or copied only in accordance with terms of agreement.
DisclaimerEnea OSE Systems AB makes no representations or warranties with respect to the contentsand specifically disclaims any implied warranties of merchantability or fitness for any particulpurpose. Further, Enea OSE Systems AB reserves the right to revise this publication and to changes from time to time in the contents hereof without obligation to Enea OSE Systems Anotify any person of such revision or changes.
Trademarks OSE is a registered trademark of Enea OSE Systems AB.
OSE / Kernel
Reference Ma
Ker
nel
1
1510
Table Of Contents 1 Introduction1.1 Purpose of this manual 1 : 11.2 Who Should Read this Manual 1 : 1.3 About this Manual 1 : 1
2 System Call Summary2.1 System Calls in Alphabetical Order 2 : 2.2 System Calls in Functional Groups 2 : 2.3 System Calls in Implementation Level Groups 2 :
3 System Callsaddressee 3 : 1alloc 3 : 3assign_linkhandler 3 : 5attach 3 : 7attach_block 3 : 9attach_segment 3 : 10clear_bp 3 : 11create_block 3 : 13create_error_handler 3 : 15create_pool 3 : 17create_process 3 : 19create_sem 3 : 23current_process 3 : 25delay 3 : 26detach 3 : 27error 3 : 28error2 3 : 29flush 3 : 30free_buf 3 : 31get_bid 3 : 32get_bid_list 3 : 33get_cpu 3 : 35get_env 3 : 36get_env_list 3 : 37get_envp 3 : 39get_fsem 3 : 40get_mem 3 : 41get_pcb 3 : 43get_pid_list 3 : 47get_pool_list 3 : 49get_poolcb 3 : 50get_pri 3 : 53get_ptype 3 : 54get_segid 3 : 56get_sem 3 : 57get_sig_info 3 : 58get_sig_poolid 3 : 61get_signal 3 : 62
nual / R1.0.4 OSE / Kernel - toc : 1
Reference Ma
Ker
nel
get_stk_poolid 3 : 64get_systime 3 : 65get_ticks 3 : 66get_uid 3 : 67hunt 3 : 68hunt_from 3 : 71intercept 3 : 73kill_proc 3 : 75kill_sem 3 : 77mem_move 3 : 78power_fail 3 : 79receive 3 : 81receive_from 3 : 83receive_w_tmo 3 : 85restore 3 : 87resume 3 : 89select_segment 3 : 91send 3 : 92sender 3 : 94send_w_s 3 : 95set_bp 3 : 96set_env 3 : 99set_envp 3 : 100set_fsem 3 : 101set_mem 3 : 102set_pcb 3 : 103set_pri 3 : 104set_pri_for 3 : 105set_redirection 3 : 106set_segment 3 : 108set_segment_mode 3 : 109set_sigsize 3 : 110set_suid 3 : 111sigsize 3 : 112signal_fsem 3 : 113signal_sem 3 : 114start 3 : 115start_OSE 3 : 117stop 3 : 118system_tick 3 : 119tick 3 : 120wait_fsem 3 : 121wait_sem 3 : 122wake_up 3 : 123NIL 3 : 125OS68 3 : 126OS_ATTACH_SIG 3 : 127OS_DEBUG 3 : 128OSE 3 : 129OSE_LEVEL_x 3 : 130OSE_I 3 : 131OS_PROCESS 3 : 132
nual / R1.0.4 OSE / Kernel - toc : 2
Reference Ma
Ker
nel
10
7
OSSIM 3 : 133SYSTEM_TICK 3 : 135
4 User Interface4.1 Header Files 4 : 14.2 Data Types 4 : 3
5 Remote System Calls5.1 Signal Definitions 5 : 15.2 Parameter Structures 5 : 4
rem_clear_bp 5 : 4rem_create_error_handler 5 : 4rem_flush 5 : 4rem_get_cpu 5 : 5rem_get_env 5 : 5rem_get_env_list 5 : 5rem_get_fsem 5 : 6rem_get_mem 5 : 6rem_get_pcb 5 : 6rem_get_pid_list 5 : 7rem_get_pri 5 : 7rem_get_signal 5 : 8rem_get_uid 5 : 8rem_hunt 5 : 9rem_intercept 5 : 9rem_resume 5 : 9rem_set_bp 5 : 10rem_set_env 5 : 10rem_set_fsem 5 : 10rem_set_mem 5 : 11rem_set_pcb 5 : 11rem_signal_fsem 5 : 11rem_start 5 : 12rem_stop 5 : 12
5.3 Example of a Link Handler 5 : 13
6 Error Messages6.1 Kernel Error Message Reference 6 :
6.1.1 Target-specific error codes 6 : 16.2 Caller Information Reference 6 : 126.3 Interface Library Errors 6 : 146.4 Kernel Error Summary 6 : 15
6.4.1 Target-specific error summary 6 : 1
7 GlossaryAppendix A ASCII Character SetAppendix B Portability ConsiderationsIndex
nual / R1.0.4 OSE / Kernel - toc : 3
Reference Manual / R1.0.4 OSE / Kernel - 1 : 1Introduction
Ker
nel
1 Introduction
1.1 Purpose of this manualThis volume of the OSE Real Time Kernel Reference Manual contains a system call summary, a detailed description of every system call, specification of data types and an error message guide.
The purpose of this manual is to provide all the necessary information for using the OSE system calls. The operating system is described in full in the User’s Guide.
1.2 Who Should Read this ManualThis manual is primarily intended for application developers.
It is recommended that the Real Time Kernel User’s Guide be studied before reading this Reference Manual.
1.3 About this ManualThis manual provides a guide to all available system calls. It includes a system call summary with the system calls presented according to three different principles: alphabetical order, functional groups and availability at the various implementation levels.
It also includes a section giving a detailed explanation of every system call, with examples, and a section discussing possible errors together with a description of all error messages.
Reference MaSystem Call S
Ker
nel
pt for all.
of
s
s
ock.
the
.
ss or
ch
ch
from
ber.
the
2 System Call SummaryThis chapter contains the OSE system call interface, i.e. all the available system calls (exceremote system calls), manifest constants and macros. A brief explanation is given of every c
2.1 System Calls in Alphabetical Orderaddressee Finds the addressee of a signal.
alloc Allocates a buffer of requested size.
assign_linkhandler Assigns a process as link handler to the system.
attach Stores a signal buffer owned by the caller in the control block the specified process or block.
attach_block A call from OSE to tell the MMU software that a new block habeen created.
attach_segment A call from the MMU to tell OSE that the specified block residein the indicated memory segment.
clear_bp Removes a previously set breakpoint.
create_block Creates a block and returns the block ID.
create_error_handler Creates an error handler for the specified process or block.
create_pool The MMU creates a new pool and attaches it to the specified bl
create_process Creates a process as a part of the specified block and returnsprocess ID.
create_sem Creates and initializes a semaphore.
current_process Returns the process-ID of the calling process.
delay Puts a process to sleep for a specified number of milliseconds
detach Removes a signal that has previously been attached to a proceblock by the caller.
error Reports an error to the OSE kernel or to the error handler if suexists.
error2 Reports an error to the OSE kernel or to the error handler if suexists, with an extra user defined parameter.
flush Removes all signals sent by any of a set of processes specified the signal queue of a process.
free_buf Returns a signal buffer to the pool associated with the block.
get_bid Returns the block ID that the specified process is a part of.
get_bid_list Lists all the blocks that are available to the specified user num
get_cpu Returns an identification string of the operating system where specified process is executing.
get_env Reads the contents of the named environment variable.
nual / R1.0.4 OSE / Kernel - 2 : 1ummary
Reference MaSystem Call S
Ker
nel
or
the
r
f.
ck
fied
ck
r of
cess
get_env_list Lists the environment variables available in the specified block process.
get_envp Reads a 32 bit pointer from a named environment variable for specified process or block.
get_fsem Reads the current value of a fast semaphore.
get_mem Reads data from the address space of the specified process oblock.
get_pcb Returns the status of a specified process or block.
get_pid_list Lists all the processes that are part of a specified block.
get_pool_list Lists all pools that are available to the specified user number.
get_poolcb Interrogates the status of the specified pool.
get_pri Returns the priority of a process.
get_ptype Returns the type of the specified process.
get_segid Finds the segment that the specified block or process is part o
get_sem Reads the current value of a semaphore.
get_sig_info Extract detailed information about a signal buffer.
get_sig_poolid Returns the ID of the signal pool associated with a specified bloor process.
get_signal Returns a copy of the signal located in the queue at the speciprocess.
get_stk_poolid Returns the ID of the stack pool associated with a specified bloor process.
get_systime Returns the number of ticks since system start and the numbemicroseconds since the last tick.
get_ticks Returns the number of ticks since system start.
get_uid Returns the user number of the specified process or block.
hunt Searches for a process by name and returns the process ID.
hunt_from Hunts for a process with the access rights evaluated for the prospecified in the from parameter.
intercept Stops a process or trips a previously set breakpoint.
kill_proc Kills a process or a block.
kill_sem Returns a semaphore to the OS memory pool.
mem_move A call from OSE requiring a block of memory to be copied fromone memory segment to another by the MMU.
NIL A manifest constant defined by the OSE kernel.
OS_ATTACH_SIG A manifest constant defining the signal number of the default signal created by the attach system call.
nual / R1.0.4 OSE / Kernel - 2 : 2ummary
Reference MaSystem Call S
Ker
nel
of
h
ent
s.
in a
in
l.
ess
ck.
the
OS_DEBUG A manifest constant that the user can define to enable reportingfile and line information and CPU registers to the debugger.
OS_PROCESS A macro which should be used to define the entry point of a process. Use OSENTRYPOINT when forward-declaring an entrypoint.
OSE A manifest constant defined by ose.h.
OSE_I A manifest constant defined by ose_i.h.
OSE_LEVEL_x Manifest constants defined by the OSE kernel indicating the functional level of the kernel.
OSSIM A manifest constant which should be defined by the user whencompiling a process for use in the OSE simulator.
OS68 A manifest constant defined by the OSE kernel indicating whicoperating system is currently in use.
power_fail Shuts down the system and enables the system for a subsequrestart.
receive Receives selected signal(s).
receive_from Like receive but it only accepts signals from a specified proces
receive_w_tmo Receives selected signal(s) with a selectable time-out.
restore Makes the caller owner of a signal and clears the redirection information.
resume Re-enables an intercepted process or all intercepted processesblock.
select_segment A call from OSE requiring the MMU to select the address spacewhich the process about to be swapped in will run.
send Sends a signal to a destination process.
sender Returns the ID of the process which last sent a specified signa
send_w_s Sends a signal with a stated sender.
set_bp Sets a breakpoint in a process or block.
set_env Creates or updates an environment string for the specified procor block.
set_envp Stores a 32 bit pointer in a named environment variable.
set_fsem Initializes a fast semaphore with the specified value.
set_mem Writes data to the address space of a specified process or blo
set_pcb Sets the CPU registers of the specified process.
set_pri Sets a new priority level for the calling process.
set_redirection Replace the redirection table of a process.
set_segment The effective segment number for the calling process is set by MMU.
nual / R1.0.4 OSE / Kernel - 2 : 3ummary
Reference MaSystem Call S
Ker
nel
e
.
set_segment_mode A call from OSE telling the MMU what type of processes residin the specified segment.
set_sigsize Attempts to change the size of a signal buffer without actually reallocate and copy it.
set_suid Temporarily assigns superuser privileges to the calling process
signal_fsem Increments a fast semaphore value.
signal_sem Increments the value of the specified semaphore.
sigsize Returns requested size of a signal buffer.
start Starts a newly created or previously stopped block or process.
start_OSE Creates and initializes the OSE kernel.
stop Stops a single process or all processes in a block.
system_tick Returns the system tick length in microseconds.
SYSTEM_TICK A manifest constant assigned the value 1000L for compatibilitywith older OSE kernels.
tick Increments the system timer.
wait_fsem Waits for a fast semaphore to become non-negative.
wait_sem Waits for the specified semaphore to become non-negative.
wake_up Informs an interrupt process of how it was invoked.
nual / R1.0.4 OSE / Kernel - 2 : 4ummary
Reference MaSystem Call S
Ker
nel
nager rface.
.
ch
l.
ch
the
ent
s.
2.2 System Calls in Functional GroupsThis section contains all the system calls grouped according to functionality. The memory mainterface is of interest only if you write a program loader or a memory protection hardware inte
Basic System Callsalloc Allocates a buffer of requested size.
delay Puts a process to sleep for a specified number of milliseconds
error Reports an error to the OSE kernel or to the error handler if suexists.
free_buf Returns a signal buffer to the pool associated with the block.
receive Receives selected signal(s).
receive_w_tmo Receives selected signal(s) with selectable time-out.
send Sends a signal to a destination process.
sender Returns the ID of the process which last sent a specified signa
Advanced System Callsaddressee Finds the addressee of a signal.
create_error_handler Creates an error handler for the specified process or block.
current_process Returns the process-ID of the calling process.
error2 Reports an error to the OSE kernel or to the error handler if suexists, with an extra user defined parameter.
get_cpu Returns an identification string of the operating system where specified process is executing.
get_ptype Returns the type of the specified process.
get_ticks Returns the number of ticks since system start.
get_uid Returns the user number of the specified process or block.
power_fail Shuts down the system and enables the system for a subsequrestart.
receive_from Like receive but it only accepts signals from a specified proces
restore Makes the caller the owner of a signal and clears the signals redirection information.
send_w_s Sends a signal with a stated sender.
set_sigsize Attempts to change the size of a signal buffer without actually reallocate and copy it.
sigsize Returns requested size of a signal buffer.
start Starts a newly created or previously stopped block or process.
start_OSE Creates and initializes the OSE kernel.
stop Stops a single process or all processes in a block.
nual / R1.0.4 OSE / Kernel - 2 : 5ummary
Reference MaSystem Call S
Ker
nel
of
the
ss or
d,
cess
system_tick Returns the system tick length in microseconds.
tick Increments the system timer.
wake_up Informs an interrupt process of how it was invoked.
System Calls for Dynamic Processesattach Stores a signal buffer owned by the caller in the control block
the specified process or block.
create_block Creates a block and returns the block ID.
create_process Creates a process as a part of the specified block and returnsprocess ID.
detach Removes a signal that has previously been attached to a proceblock by the caller.
flush Removes all signals sent by any of a set of processes specifiefrom the signal queue of a process.
get_bid Returns the block ID that the specified process is a part of.
get_pri Returns the priority of a process.
hunt Searches for a process by name and returns the process ID.
kill_proc Kills a process or a block.
set_pri Sets a new priority level for the calling process.
set_redirection Replace the redirection table of a process.
Network Related Callsassign_linkhandler Assigns a process as a link handler to the system.
hunt_from Hunts for a process with the access rights evaluated for the prospecified in the from parameter.
nual / R1.0.4 OSE / Kernel - 2 : 6ummary
Reference MaSystem Call S
Ker
nel
or
the
ess
ber.
r
ck
fied
ck
Semaphore Callscreate_sem Creates and initializes a semaphore.
get_sem Reads the current value of a semaphore.
kill_sem Returns a semaphore to the OS memory pool.
signal_sem Increments the value of the specified semaphore.
wait_sem Waits for the specified semaphore to become non-negative.
Fast Semaphore Callsget_fsem Reads the current value of a fast semaphore.
set_fsem Initializes a fast semaphore with the specified value.
signal_fsem Increments a fast semaphore value.
wait_fsem Waits for a fast semaphore to become non-negative.
Environment Variable Callsget_env Reads the contents of the named environment variable.
get_env_list Lists the environment variables available in the specified block process.
get_envp Reads a 32 bit pointer from a named environment variable for specified process or block.
set_env Creates or updates an environment string for the specified procor block.
set_envp Stores a 32 bit pointer in a named environment variable.
System Interrogation Callsget_bid_list Lists all the blocks that are available to the specified user num
get_mem Reads data from the address space of the specified process oblock.
get_pcb Returns the status of a specified process or block.
get_pid_list Lists all the processes that are part of a specified block.
get_pool_list Lists all pools that are available to the specified user number.
get_poolcb Interrogates the status of the specified pool.
get_sig_info Extract detailed information about a signal buffer.
get_sig_poolid Returns the ID of the signal pool associated with a specified bloor process.
get_signal Returns a copy of the signal located in the queue at the speciprocess.
get_stk_poolid Returns the ID of the stack pool associated with a specified bloor process.
nual / R1.0.4 OSE / Kernel - 2 : 7ummary
Reference MaSystem Call S
Ker
nel
r of
ck.
in a
s
s
ock.
f.
in
the
e
.
of
get_systime Returns the number of ticks since system start and the numbemicroseconds since the last tick.
set_mem Writes data to the address space of a specified process or blo
set_pcb Sets the CPU registers of the specified process.
Breakpoint Callsclear_bp Removes a previously set breakpoint.
intercept Stops a process or trips a previously set breakpoint.
resume Re-enables an intercepted process or all intercepted processesblock.
set_bp Sets a breakpoint in a process or block.
System Calls for Memory Managementattach_block A call from OSE to tell the MMU software that a new block ha
been created.
attach_segment A call from the MMU to tell OSE that the specified block residein the indicated memory segment.
create_pool The MMU creates a new pool and attaches it to the specified bl
get_segid Finds the segment that the specified block or process is part o
mem_move A call from OSE requiring a block of memory to be copied fromone memory segment to another, by the MMU.
select_segment A call from OSE requiring the MMU to select the address spacewhich the process about to be swapped in will run.
set_segment The effective segment number for the calling process is set by MMU.
set_segment_mode A call from OSE telling the MMU what type of processes residin the specified segment.
set_suid Temporarily assigns superuser privileges to the calling process
Macros and ConstantsNIL A manifest constant defined by the OSE kernel.
OS_ATTACH_SIG A manifest constant defining the signal number of the default signal.
OS_DEBUG A manifest constant that the user can define to enable reportingfile and line information and CPU registers to the debugger.
OS_PROCESS A macro which should be used to define the entry point of a process. Use OSENTRYPOINT when forward-declaring an entrypoint.
OSE A manifest constant defined by ose.h.
nual / R1.0.4 OSE / Kernel - 2 : 8ummary
Reference MaSystem Call S
Ker
nel
h
OSE_I A manifest constant defined by ose_i.h.
OSE_LEVEL_x Manifest constants defined by the OSE kernel indicating the functional level of the kernel.
OSSIM A manifest constant which should be defined by the user whencompiling a process for use in the OSE simulator.
OS68 A manifest constant defined by the OSE kernel indicating whicoperating system is currently in use.
SYSTEM_TICK A manifest constant assigned the value 1000L for compatibilitywith older OSE kernels.
nual / R1.0.4 OSE / Kernel - 2 : 9ummary
Reference MaSystem Call S
Ker
nel
stants
kernel.
l.
2.3 System Calls in Implementation Level GroupsThis section groups the system calls according to implementation levels. Types, manifest conand macros are not shown here.
Level A is the portable set which means the smallest set of system calls available in an OSE Using these system calls ensures the highest degree of portability.
Level A defines all constants and macros and all types required by system calls on that leve
Level B defines the remaining types.
Level A System Callsalloc receive
current_process receive_w_tmo
delay restore
error send
free_buf sender
get_ticks sigsize
Level B System CallsLevel B contains all level A system calls, with the following additions:
addressee get_pcb
assign_linkhandler get_ptype
attach get_sem1create_block get_systime
create_error_handler get_uid2create_process hunt
create_sem hunt_from
detach kill_proc
flush kill_sem
get_bid power_fail
get_cpu receive_from
get_env send_w_s
get_env_list set_env
get_fsem set_fsem
signal_fsem system_tick
signal_sem tick
1. Remote systems call servers are not supported and only user number zero may be selected.
2. Only phantom processes may be created and only user number zero may be selected
nual / R1.0.4 OSE / Kernel - 2 : 10ummary
Reference MaSystem Call S
Ker
nel
start wait_fsem
start_OSE wait_sem
stop wake_up
Level C System CallsLevel C contains all level B system calls, with the following additions:
attach_block get_pri
attach_segment get_signal
clear_bp intercept1create_block resume
create_pool select_segment1create_process set_bp
get_bid_list set_mem
get_mem set_pri
get_pid_list set_suid
Level D System CallsLevel D contains all level C system calls, with the following additions:2create_block select_segment2create_process set_segment
mem_move set_segment_mode
set_segment
set_segment_mode
1. Only user number zero may be selected.2. These systems are fully implemented at this level.
nual / R1.0.4 OSE / Kernel - 2 : 11ummary
Reference MaSystem Calls
Ker
nel
lly
t was
3 System Callsaddressee
Syntax PROCESS addressee (union SIGNAL **sig);
Description Examines a signal buffer to find out to which process the buffer was originasent by the sender.
Include files #include "ose.h"or#include "ose_i.h"
Parameters sig A pointer to a pointer to a signal buffer.
Return value The process ID of the caller is returned in case the signal was sent withoutredirections. If sig has been redirected, addressee returns the process ID thastated in the send or send_w_s call that caused the buffer redirection.
Returns owner's ID if the signal was never sent.
Restrictions None.
See also restore, sender, send, send_w_s
Implementation Not implemented at level A. Full performance from level B.level
Example
#include "ose.h"
static const SIGSELECT any_sig[] = {0};
union SIGNAL{
SIGSELECT sig_no;};
OS_PROCESS(my_process){
union SIGNAL *sig;PROCESS addr;
for(;;){
sig = receive((SIGSELECT *) any_sig);addr = addressee(&sig);if(addr == current_process ()){
/* The signal was sent directly to this process */}else{
/* Signal was sent to the process with process ID "addr" * but was redirected to this process through the use of * a redirection table */
}
nual / R1.0.4 OSE / Kernel - 3 : 1
Reference Maaddressee
Ker
nel
}}
nual / R1.0.4 OSE / Kernel - 3 : 2
Reference Maalloc
Ker
nel
ler's the
a
ffer
set ne
only egal may
the sible
alloc
Syntax union SIGNAL * alloc (OSBUFSIZE size,
SIGSELECT signo);
Description Allocates a signal buffer of the specified size from the pool available to the calblock. The specified signo (signal number) is entered in the first location in new buffer.
Another signal number may later be assigned to the buffer by simply storingnew number in the first location.
The maximum buffer size available is dictated by sizeof(OSBUFSIZE). This means that if sizeof(OSBUFSIZE) returns 2 then the maximum available busize is:
65536 (2 (sizeof(OSBUFSIZE) * 8))
This rule may sometimes fail since the maximum buffer size may have beento a smaller value when the pool was created. The minimum buffer size is obyte.
Include files #include "ose.h"or#include "ose_i.h"
Parameters size The requested size of the buffer.
signo The signal number, will be placed in the allocated buffer.
Return value Returns a pointer to the new buffer.
Restrictions The new buffer is owned by the calling process. A new owner can be enteredby using one of the system calls that operates on the buffer. It is basically illto pass control of a buffer to another process in any other way since buffers then be lost in case of premature process termination.
If you really need to pass buffers around in a disorderly manner, the restoresystem call can be used to force registration of a new owner of a buffer.
It is an error to allocate a buffer larger than the largest buffer size available inpool. Use the get_pcb system call to gain information about the largest posbuffer size for a process.
See also free_buf, restore, sender, addressee, sigsize, create_pool, set_sigsize
Implementation Full performance at all implementation levels.levels
Example
#include "ose.h"
#define THIRD 3 /* These declarations */struct Third /* are preferably made */{ /* in a .sig-file which*/
SIGSELECT sig_no; /* should be included. */};
nual / R1.0.4 OSE / Kernel - 3 : 3
Reference Maalloc
Ker
nel
union SIGNAL{
SIGSELECT sig_no;struct Third third;
};
OS_PROCESS(my_process){
union SIGNAL *sig;extern PROCESS proc_; /* Process ID for the static
* process named "proc". */
for(;;){
sig = alloc(sizeof(struct third),THIRD);send(&sig,proc_);delay(100);
}}
nual / R1.0.4 OSE / Kernel - 3 : 4
Reference Maassign_linkhan
Ker
nel
e ame
fore
" as
.
dler
pace. and
ces
erver link that f this elated
assign_linkhandler
Syntax OSBOOLEAN assign_linkhandler (char *linkname,
PROCESS handler);
Description A link handler is registered with OSE.
This link handler receives remote system calls for all hunt calls specifying thindicated linkname as the first part of the hunt path, unless a process with a nmatching the hunt path already exists.
For a path name to match a link handler it is sufficient that the characters bethe first "/"-character match the pathname of the link handler.
For instance:
The hunt path "helios/robin/peter" matches the link handler named "helioswell as the Linkhandler named "helios/robin".
The hunt path "helios/" also matches the "helios" link handler.
The hunt path "/robin" matches the link handler named "". (This may lookstrange, but it is in fact possible to have a link handler with the name "")
Hunt calls already pending within the OSE kernel, matching the new link hanname, are honoured by the new link handler.
Include files #include "ose.h"
Parameters linkname The path to the link handler.
handler The process ID of the link handler.
Return value Returns a non-zero value if another link handler with the specified name is already present in the caller's user number space.
Restrictions There can be only one link handler for each linkname in each user number sA link handler with user number zero (superuser) serves all user numbers, therefore disallows any other Linkhandler with that name.
There is no way to deregister a link handler. It must be killed when its serviare no longer required.
There is a deadlock problem that occurs when a link handler or remote call sissues a system call that results in a remote system call towards the same handler. This problem is most easily avoided if link handlers are so designedthey never use any system calls from which remote system calls can result. Iis not possible, then such operations should be deferred to other processes rto the link handler.
The assign_linkhandler call is not available to interrupt processes.
See also hunt, hunt_from
Implementation Not implemented at level A. Full performance from level B.levels
Example
#include "ose.h"
nual / R1.0.4 OSE / Kernel - 3 : 5dler
Reference Maassign_linkhan
Ker
nel
OS_PROCESS(my_process){
char *linkh = "linkhandler";PROCESS linkhand_;OSBOOLEAN check;PROCESS proc_id_;
check = assign_linkhandler(linkh,linkhand_);
if (check){
/* If a non-zero value is returned in check, a * link handler with that name already exists. */
}
for(;;){
check = hunt("linkhandler/proc", NULL, &proc_id_,NULL);if(check){
/* Code */}
}}
nual / R1.0.4 OSE / Kernel - 3 : 6dler
Reference Maattach
Ker
nel
d
al
lock r
ll for om ched
ls sent to
ervise a can
ch.
ocess
attach
Syntax OSATTREF attach (union SIGNAL **sig, PROCESS pid);
Description This call is used in defensive programming to detect and resolve unexpectesituations that occur when processes die during signal transactions.
Attach stores a signal buffer owned by the caller in the control block of the specified process or block.
If the sig parameter is set to NULL, the kernel automatically allocates a signwith signal number OS_ATTACH_SIG.
This buffer is sent back to the caller by the kernel if the attached process or bis killed. The buffer will be sent back imediately to the caller if the process oblock is already dead when issuing the attach.
The buffer is freed by the kernel when the calling process issues a detach cathe previously attached process or block, using the reference ID obtained frattach. This works even if the attached process has been killed and the attabuffer waits in the caller's signal queue.
The normal buffer examination calls like sender and addressee work on thereturned buffer. Sender is set to the process ID of the killed process.
OSE ensures that, when a process dies, attached signals are the last signafrom the killed process. This means that it is safe for a supervising processclear signal queues when a previously attached signal is received.
The attach system call can also be used by memory manager software to supa memory segment. A segment ID obtained from either the attach_segmentsystem call or the get_segid system call can be attached too. This enables memory manager to be conveniently notified when a killed memory segmentbe reclaimed.
Include files #include "ose.h"
Parameters sig A pointer to a pointer to a signal buffer.
pid The ID of the specified block, process or segment to atta
Return value Returns a reference ID that may be used in a subsequent call to detach.
Restrictions The order in which attached signals are returned when a process dies is unspecified. Also, a user can not assume that attached signals are returnedimmediately when a process dies. There is a delay caused by the fact that prhousekeeping is performed by system daemons as a lower priority job.
The attach call is not available to interrupt processes.
See also detach, kill_proc, OS_ATTACH_SIG, attach_segment, get_segid
Implementation Not implemented at level A. Full performance from level B.levels
Example
#include "ose.h"
nual / R1.0.4 OSE / Kernel - 3 : 7
Reference Maattach
Ker
nel
#define FORTH 4 /* These declarations */struct Forth /* are preferably made */{ /* in a .sig-file which */
SIGSELECT sig_no; /* is included. */};
union SIGNAL{
SIGSELECT sig_no;struct Forth forth;
};
static const SIGSELECT any_sig[] = {0};
OS_PROCESS(my_process){
union SIGNAL *sig;OSATTREF attref;extern PROCESS proc_;
for(;;){
/* Code */sig = alloc(sizeof(struct forth), FORTH);attref = attach(&sig,proc_);sig = receive((SIGSELECT *) any_sig);if (sender(&sig) == proc_){
/* Code, The process has been killed */}else{
/* Code */}
}}
nual / R1.0.4 OSE / Kernel - 3 : 8
Reference Maattach_block
Ker
nel
at it
e
r , so alling
of
attach_block
Syntax void attach_block (PROCESS bid, OSSEGMENT segnum);
Description This is a call from the memory manager block (MMU) to the kernel and is therefore normally not a user system call.
The kernel tells the MMU software that a new block has been created and thinherits the specified memory segment from its creator.
The MMU may note that there is a new block in the segment. This allows thMMU software to map user created blocks to segments. The attach_block function may use system calls as if it was called from a prioritized superuseprocess. It is called in the context of the process that requires the operationattach_block can be simultaneously executed by several processes, and the cprocess may be killed at any time.
Any alloc calls issued by the attach_block function refer to the system pool,regardless of the pool attached to the calling process.
The user ID of the calling process is temporarily set to zero for the durationthe attach_block call. This allows the function to communicate with system processes normally invisible to the calling process.
Include files #include "ose_mmu.h"
Parameters bid The block ID of the new block.
segnum The segment the block will inherit.
Return value None.
Restrictions None.
Implementation Not implemented at levels A and B. Full performance from levels level C.
nual / R1.0.4 OSE / Kernel - 3 : 9
Reference Maattach_segme
Ker
nel
ory
ss in
block
ment issue
calls. call, de of the
m
ent
ment
re
, if
ot be ated
attach_segment
Syntax PROCESS attach_segment (PROCESS bid,
OSSEGMENT segnum);
Description This is a call from the memory manager block (MMU) to the kernel and is therefore normally not a user system call.
The MMU tells the kernel that the specified block resides in the indicated memsegment.
The kernel will select that segment at each subsequent swap in of any procethe block.
If attach_segment is not used for a block, then the kernel assumes that the resides in the same memory segment as its creator.
A unique segment number should normally be assigned in each attach_segcall. This causes the kernel to maintain intersegment memory protection and a select_segment call for each process switch between the segments.
It is possible to specify the same segment number in several attach_segmentThe kernel then creates a new segment descriptor and segment ID for eachbut it is assumed that the blocks reside in a shared address space. This mooperation is useful when it is desired to disable memory protection betweeninvolved blocks.
Include files #include "ose.h"
Parameters bid The block ID of the specified block.
segnum The segment the specified block resides in.
Return value Returns a segment ID which is recognized by the attach and kill_proc systecalls. Other system calls will treat this ID as "illegal".
Attaching to this segment ID means that the caller is notified when the segmdies and the memory occupied by it can be reclaimed/reused.
Killing the segment ID means that all processes in the segment are killed.
Restrictions The attach_segment call is available only to superuser processes since segnumbers must be properly coordinated with the attach_block, mem_move, select_segment, and set_segment functions, it is assumed that segments amanipulated only by a single memory manager package.
attach_segment must be called before the first process in the block is createdcalled at all.
Segment number zero is the supervisor space. This segment number must nredefined by the memory manager. Other segment numbers are freely allocby the memory manager.
The attach_segment call is not available to interrupt processes.
See also select_segment, set_segment_mode, mem_move, attach, kill_proc, get_segid
Implementation Not implemented at levels A and B. Full performance from levels level C.
nual / R1.0.4 OSE / Kernel - 3 : 10nt
Reference Maclear_bp
Ker
nel
not
sing
et e no
d as tead
t are
al to
clear_bp
Syntax OSBOOLEAN clear_bp (PROCESS pid, OSADDRESS addr);
Description This is a call from a debugger process to the kernel and is therefore normallya user system call. It clears a breakpoint previously set by the caller at the specified address in the specified process or block.
The trap signal that was specified in the set_bp call is returned to the caller (ua send call just as if the breakpoint had been reached).
This call is used to clear previously set breakpoints without causing the targblock to enter intercept status. It is also used to remove breakpoints that arlonger needed after another breakpoint has been reached.
It is important to remember to clear breakpoints that are no longer in use.
When the target process is killed, all breakpoints set are automatically cleareif clear_bp had been called, but the signal buffers are freed by the kernel insof being sent to the owner.
When the debugger process (the caller of set_bp) is killed, any breakpoints secleared in the same way.
Include files #include "ose.h"
Parameters pid The ID of the specified process or block.
addr The adress where the breakpoint is to be cleared.
Return value Returns non-zero if no breakpoint was set at the specified address, or if thebreakpoint was already reached, or if the process died before reaching the breakpoint.
Restrictions The breakpoint cleared must have been set by the calling process. It is illegclear a breakpoint set by another process.
The clear_bp call is not available to interrupt processes.
See also set_bp, intercept, resume, get_pcb
Implementation Not implemented at levels A and B. Full performance from levels level C.
Example
#include "ose.h"
#define TRAP_SIG 1 /* These declarations */struct Trap_sig /* are preferably made */{ /* in a .sig-file which */
SIGSELECT sig_no; /* is included. */};
union SIGNAL{
SIGSELECT sig_no;struct Trap_sig trap_sig;
};
static const SIGSELECT trap_sel[] = {1, TRAP_SIG};
nual / R1.0.4 OSE / Kernel - 3 : 11
Reference Maclear_bp
Ker
nel
extern void function(void);extern PROCESS proc_;
OS_PROCESS(my_process){
union SIGNAL *trapsignal;
for(;;){
trapsignal=alloc(sizeof (struct trap_sig), TRAP_SIG);set_bp(proc_, (OSADDRESS) function, (OSADDRESS) 2,
&trapsignal)/* Code */trapsignal = receive_w_tmo(100, (SIGSELECT *) trap_sel);if(!trapsignal){
/* Breakpoint not reached */clear_bp(proc_, (OSADRESS) function);
}/* Code */
}}
nual / R1.0.4 OSE / Kernel - 3 : 12
Reference Macreate_block
Ker
nel
ew first
in a for
ator at
itly
l be
cute. lly
erver
ote used
hould space
rvisor
create_block
Syntax PROCESS create_block (char *name,
OSUSER user,
OSBOOLEAN use_remote_calls,
PROCESS remote_call_server,
OSBOOLEAN supervisor_mode);
Description Creates a block descriptor owned by the specified user number.
The memory segment is inherited from the caller, i.e. all processes in the nblock will execute in the same memory space as the creator unless anothermemory segment is attached to the block by a memory manager prior to theprocess being created. This may be desired when a new, separately linked software unit is being loaded into memory for execution.
New block descriptors are given "stopped" status so an environment can beinitialized before operation begins. This means that the first set of processesnew block are "stopped" until started by issuing a start call for the block or each process in the block.
Until the last start call is issued, the block is owned by its creator, i.e. if the creis killed before this, the child block is killed too. This mechanism ensures thpartially created blocks are never left abandoned in the system.
A block descriptor is removed from the system when either the block is explickilled, or the last process executing in the block is killed.
The name parameter is a string containing the name by which the block wilknown to the system and to the debugger.
The user parameter is the user number under which the created block will exeA value of NULL means the creator's user number, which is the value typicaused.
use_remote_calls is set to any non-zero value to indicate that a remote call sis specified in the remote_call_server parameter.
remote_call_server, if present, is the ID of the process that will execute remsystem calls issued towards processes in the block. This parameter is mainlyfor phantom processes that should be managed by some link handler. This parameter is ignored if use_remote_calls is set to zero.
supervisor_mode is set to any non-zero value if the processes in the block sbe created in supervisor mode. Such processes must reside in kernel addressand can only be created by a superuser process (user 0) executing in supemode.
Include files #include "ose.h"
Parameters name A pointer to the name of the block.
user The user number under which the block will execute.
use_remote_calls Specifies whether a remote call server is used or not.
nual / R1.0.4 OSE / Kernel - 3 : 13
Reference Macreate_block
Ker
nel
umber
remote_call_serverThe process ID of the remote call server if used.
supervisor_mode The specified mode, non-zero means supervisor mode.
Return value Returns the block ID for the new block.
Restrictions Superuser blocks can only be created by a superuser process.
Supervisor mode blocks can only be created by a superuser process (user n0) executing in supervisor mode itself.
The create_block call is not available to interrupt processes.
See also create_process, get_bid, get_bid_list, kill_proc, start
Implementation Not implemented at level A. Remote system call servers are levels not allowed and only user number zero is supported at level
B. Allows only user number zero at level C. Full performanceat level D.
Example
#include "ose.h"
OSENTRYPOINT new_process;
OS_PROCESS(my_process){
PROCESS block_;PROCESS proc_;
for(;;){
/* Code */block_ = create_block("block",
(OSUSER) 0, (OSBOOLEAN) 0, (PROCESS) 0, (OSBOOLEAN) 0);
proc_=create_process(OS_PRI_PROC, "proc_",
new_process, 200,
16, (OSTIME) 0, block_, (struct OS_redir_entry *) NULL, (OSVECTOR) 0, (OSUSER) 0);
start(block_);/* Code */
}}
nual / R1.0.4 OSE / Kernel - 3 : 14
Reference Macreate_error_h
Ker
nel
ce is t not
rror
arger
. The
when
g set rnel. aged.
first hen code. el)
e able l.
el is
create_error_handler
Syntax OSERRH *create_error_handler (PROCESS pid,
OSERRH *entrypoint,
OSADDRES stack_size);
Description An error handler is created for the specified process or block and stack spareserved for the handler in each process affected (also in those affected buyet created).
Any previously defined handler on that error level is replaced, and the old ehandlers entrypoint is returned to the caller.
If error handler stack space reserved by a previously defined error handler is lthan required, the stack space size is not altered.
The entrypoint is a location within the address space of the specified block.
Set entrypoint to NULL to remove a previously created error handler.
An error handler behaves as a subroutine called from the process in contextonly difference is that the error handler has its own separate stack.
Error handlers may use the same set of system calls as the process runningthe error handler was invoked.
The error handler is passed parameters containing error information and a flato a non-zero value if the call was made from user code and not from the keThe handler should return a flag set to a non-zero value if the error was man
An error handler declaration looks like this:
OSBOOLEAN err_handler(OSBOOLEAN user_called,OSERRCODE ecode,OSERRCODE extra);
There are three levels of error handlers: The process error handler is calledif it is present. If it returns a flag saying that it could not manage the error, tthe error is propagated to the next level. Otherwise the kernel returns to user (Errors considered fatal by the kernel are always propagated to the next lev
The block error handler is called if there is no process error handler or if thprocess error handler returns an zero. The block error handler may then beto resolve the situation in exactly the same manner as on the previous leve
The kernel error handler is part of the kernel and is specified when the kerngenerated. This handler is called if no other error handler is present or if a reported error is fatal or if previous levels can not resolve the situation.
Include files #include "ose.h"
Parameters pid The ID of the specified process.
entrypoint The address of the error handler.
stack_size Specifies the stack size to be used.
Return value Returns the entrypoint of any previously defined error handler, or NULL if noprevious error handler was defined.
nual / R1.0.4 OSE / Kernel - 3 : 15andler
Reference Macreate_error_h
Ker
nel
e only
the
s that lock
Restrictions Error handlers used by several processes must be re-entrant, i.e they must usstack variables.
An error handler must return when it is finished. In particular, it must not uselongjmp directive defined in the C language.
It is recommended that error handlers are created only for processes or blockare closely related to the caller. It is illegal to create an error handler for a bor process in another memory segment.
Error codes provided by the OSE kernel as well as all symbols defined in ose_err.h are implementation dependent.
The create_error_handler call is not available to interrupt processes.
See also error, ose_err.h
Implementation Not implemented at level A. Full performance from level B.levels
Example
#include "ose.h"
OSBOOLEAN pr_err_hand(OSBOOLEAN user_called, OSERRCODE ecode, OSERRCODE extra);
OSBOOLEAN bl_err_hand(OSBOOLEAN user_called, OSERRCODE ecode,
OSERRCODE extra);PROCESS proc_;PROCESS block_;
OS_PROCESS(my_process){
OSERRH errhand, old_pr_errhand, old_block_errhand;
/* Creating a process error handler. (The entrypoint * to an error handler is returned in errhand if one * is previously defined otherwise NULL is returned, * there is no need to test the value). */old_pr_errhand = create_error_handler(proc_,(OSERRH *)
pr_err_hand,200);
/* Creating a block error handler. (The entrypoint to * an error handler is returned in errhand if one is * previously defined otherwise NULL is returned, * there is no need to test the value). */old_block_errhand = create_error_handler(block_,(OSERRH *)
bl_err_hand,200);for(;;){
/* Code */}
}
nual / R1.0.4 OSE / Kernel - 3 : 16andler
Reference Macreate_pool
Ker
nel
its
to the ll
y the
space.
ren. l
ory
be a
unt om
ts pool
l.
create_pool
Syntax void create_pool (PROCESS bid,
OSADDRESS base,
OSADDRESS size,
OSADDRESS sigsize_tab[],
OSADDRESS stacksize_tab[]);
Description This is a call from the memory manager block (MMU) to the kernel and is therefore normally not a user system call.
The MMU creates a new pool and attaches it to the specified block and all children.
Pool space skould be allocated by the memory manager and is made known kernel by issuing this call. The pool is entirely managed by the kernel until ablocks using the pool are dead. At that point, pool space may be reclaimed bMMU without further notice to the kernel.
The first pool created is the system pool. The system pool is shared by all supervisor processes and those user processes that reside in kernel address
Other pools are local pools to be used only by the specified block and its child(It is possible to have local pools in kernel space too, which may be a usefufeature when separately linked blocks are utilized in a system with no memprotection hardware.)
In systems with simple memory protection hardware (fence registers) it mayuseful to have local pools assigned only for stacks. In this way you will get system with improved security without affecting performance.
Bid is the (newly created) block to which the new pool should be attached.
Base is the lowest address in the pool.
Size is number of bytes reserved for the pool.
Sigsize_tab[] is a sorted array of signal buffer sizes.
The first location contains the number of entries in the array, excluding the coitself (max 8). If count = 0 then signals are allocated from the pool inherited frthe creator or the pool already created for signals.
Stacksize_tab[] is a sorted array of stack buffer sizes. The first location counthe number of entries (max 8). If count = 0 then stacks are allocated from theinherited from the creator or the pool already created for stacks.
Include files #include "ose.h"
Parameters bid The ID of the specified block.
base The lowest address in the pool.
size The number of bytes reserved for the pool.
sigsize_tab[] An array of all the available buffer sizes in the pool.
stacksize_tab[] An array of all the available stack buffer sizes in the poo
Return value None.
nual / R1.0.4 OSE / Kernel - 3 : 17
Reference Macreate_pool
Ker
nel
if
call gnal
h is
Restrictions Create_pool must be called before the first process in the block is created, called at all.
Create_pool is normally called after any call to attach_segment if that systemis required. Otherwise the pool will appear in the original memory segment,which is probably not what the caller intended. On the other hand, keeping sipools in a common segment disables signal copying while maintaining codeprotection, which may sometimes be a useful and more efficient mode of operation.
The get_pid_list and get_bid_list system call requires that:(max buffer size) > (max number of processes * sizeof(PROCESS)).
It is also wise to set the largest buffer size to a large value, like 65535, whicthe largest portable OSE buffersize.
The create_pool call is not available to interrupt processes.
See also alloc, free_buf
Implementation Not implemented at levels A and B. Full performance from levels level C.
nual / R1.0.4 OSE / Kernel - 3 : 18
Reference Macreate_proces
Ker
nel
ew
his rnel
r a
l as a nts a e in
ing, it
cks and e size and y
t es. rity
create_process
Syntax PROCESS create_process (
enum PROCESS_TYPE proc_type,
char *name,
OSENTRYPOINT *entrypoint,
OSADDRESS stack_size,
OSPRIORITY priority,
OSTIME timeslice,
PROCESS block,
struct OS_redir_entry *redir_table,
OSVECTOR vector,
OSUSER user);
Description Creates a process as part of the specified block.
Prioritized, background and timer-interrupt processes must be subsequentlystarted with the start system call, or the entire block can be started if only nprocesses are contained in it.
proc_type is the type of the process. Legal values are:
OS_PRI_PROC: for a prioritized process.OS_BG_PROC: for a background process.OS_INT_PROC: for an interrupt process.OS_TI_PROC: for a timer-interrupt process.OS_PHANTOM: for a phantom or dummy process.
Name is a zero-terminated ASCII string that represents the process name. Tstring may in some implementations be copied by the kernel and stored in kememory. The name is used as a tag by other processes when searching foprocess with the hunt call. The name may contain all printable characters.
The slash (/) has special significance because it is recognized by the kernepath separator. It separates components in the name, which usually represenetwork routing path. A link handler may however choose to use the pathnamany way desired. The create_process call does not manipulate the name stris just stored away, path and all.
Entrypoint is where the process should begin execution. Portable programsshould define the entrypoint with the OS_PROCESS macro.
Stack_size is the number of bytes that should be allocated for the stack. Staare allocated according to a complex set of rules. Supervisor type interrupt timer-interrupt processes share a common interrupt stack in kernel space. Thof this stack is automatically adjusted to maximum requirements. Prioritized background processes allocate the user stack from the pool of the block thebelong to, the supervisor stack is allocated from the system pool.
Priority is the priority of the process. Legal values are 0-31. 0 is the highespriority. The priority is interpreted in different ways for the various process typFor interrupt processes it means hardware priority. The logical interrupt prio
nual / R1.0.4 OSE / Kernel - 3 : 19s
Reference Macreate_proces
Ker
nel
or t the is not well)
hat
es
s the the s the The iods e
ith a h the
tes hich ss to
not
hen if e the
not t 1, s.
ust
ip
(0-31) maps to actual hardware priority in an implementation specific way. Ftimer-interrupt processes, it means in which order after the actual timer evenprocess is scheduled for execution. For prioritized processes, it means howimportant the process should be. For background and phantom processes it used. (You must however set the parameter to a legal value 0-31 for this as
Timer process priority is an implementation option since this feature is some wdifficult to implement efficiently.
Timeslice is used only for timer-interrupt processes and background process(some implementations allow a timeslice or pre-emption timeout also for prioritized processes - set it to zero if not used). For timer-interrupt processetimeslice represents the number of milliseconds between each activation of process. For background processes it represents the number of millisecondprocess is allowed to run before the next background process is scheduled.stipulated time is rounded upwards to an integral number of system tick perby the kernel. A timeslice of NULL means the default timeslice defined by thimplementation. Any attempt to create a prioritized or background process wtimeslice longer than the default value causes the process to be created witdefault timeslice.
Block is the ID of the block that contains the new process. The block ID indicaamong other things in which memory segment the process executes and wdefault user number the process has. Set block ID to zero for the new procebecome part of the caller's block.
Redir_table, if present, is a pointer to a redirection table that describes howsignals sent to the created process should be redirected. It is set to zero if present. If present, this structure contains an array of signal/process pairs. Wa signal is sent to the created process, the redirection table is searched andpresent in the table, the signal is redirected to the process that should receivsignal.
The redirection table consists of an array of structures of type "struct OS_redir_entry", which is defined as:
struct OS_redir_entry{
SIGSELECT sig;PROCESS pid;
};
The first structure in the redirection table contains a count of the number ofentries in the table including the first entry, and a process ID to which signalsspecified in the redirection table should be sent. The count is always at leasand the default process ID may be set to zero to specify the created proces
The kernel may or may not copy this table to kernel memory, so the user massume that the table can not be subsequently altered.
Vector is valid for interrupt processes only. It is the hardware vector numberattached to the new process. A vector number of -1 causes the kernel to sk
nual / R1.0.4 OSE / Kernel - 3 : 20s
Reference Macreate_proces
Ker
nel
g a gain
the
s).
eated lf.
an the
lice 00).
hardware vector generation. Such a process can only be invoked by sendinsignal to it or signalling its fast semaphore. Use the wake_up() system call to knowledge about how the interrupt process was invoked.
User is the user ID of the new process, or zero if the process should inheritdefault user ID of the block in which it is contained.
Include files #include "ose.h"
Parameters proc_type Specifies the type of the process.
name A pointer to the name of the process.
entrypoint The address of where the process will start execution
stack_size Specifies the size of the stack.
priority The priority level for the process.
timeslice Number of milliseconds.
block The name of the block the process will be part of.
redir_table A pointer to the redirection table if present.
vector The hardware vector number (only for interrupt processe
user Specifies the user ID of the process.
Return value. Returns the process ID for the new process.
Restrictions The redirection table must be built in run-time since process identities are unknown at compile time.
Supervisor mode processes (part of a supervisor mode block) can only be crby a superuser process (user number 0), executing in supervisor mode itse
Only superuser processes may create processes with user numbers other thcaller's own usernumber.
The create_process call is not available to interrupt processes.
Some implementations can not create timer-interrupt processes with a timesvalue larger than 256 times the length of a tick. I.e. 256 * (system_tick() / 10
See also current_process, create_block, kill_proc, OS_PROCESS, set_redirection, start
Implementation Not implemented at level A. Only phantom processes and levels user number zero are allowed at level B. Only user number
zero is allowed at level C. Full performance at level D.
Example
#include "ose.h"
extern OSENTRYPOINT new_process;
OS_PROCESS(my_process){
PROCESS proc_;
for(;;){
/* Code */
nual / R1.0.4 OSE / Kernel - 3 : 21s
Reference Macreate_proces
Ker
nel
proc_ = create_process(OS_PRI_PROC,"proc",
new_process, 200,
16, (OSTIME) 0,
(PROCESS) 0, (struct OS_redir_entry *) NULL, (OSVECTOR) 0,
(OSUSER) 0);start(proc_);/* Code */
}}
nual / R1.0.4 OSE / Kernel - 3 : 22s
Reference Macreate_sem
Ker
nel
ed in are
rned
es,
hore d.
ve nt.
e e
lds
gment own ll and live.
create_sem
Syntax SEMAPHORE *create_sem (OSSEMVAL initial_val);
Description Creates a dynamic semaphore structure and initializes it to the value specifiinitial_val. The initial value must be zero or a positive value. Typical values 0 and 1.
The semaphore is dynamically allocated from the current pool. It may be retuto the pool when it is no longer in use by calling kill_sem. Semaphores are implicitly killed when all blocks in the memory segment of the creator terminati.e when the memory segment is reclaimed.
Semaphores may also be statically defined by simply declaring a static semapstructure in the program and initializing it. Such semaphores can not be killeThey are removed from the system when the blocks using a semaphore haterminated and the memory manager software reclaims the memory segme
Semaphore structures contain three fields. The first must be initialized to thinitial (positive) value of the semaphore. The second and third fields must binitialized to zero, and are required for internal use by the kernel.
The three fields of a semaphore structure are named "value", "f" and "b" respectively. The value field is of type OSSEMVAL. The types of the other fieare implementation-specific.
Include files #include "ose.h"
Parameters initial_val The initial value of the created semaphore.
Return value A pointer to the created semaphore structure.
Restrictions A semaphore can only be shared by processes within the same memory sesince the semaphore dies when the memory segment is reclaimed. If it is knthat the segment is never killed, then a semaphore can be shared among aprocesses with access to the address space of the segment. It is the user'sresponsibility to ensure that the semaphore is not killed while it is still in use, that a process is not killed while operating on a semaphore that is expected toSerious problems may otherwise arise.
The create_sem call is not available to interrupt processes.
See also wait_sem, signal_sem, get_sem, kill_sem
Implementation Not implemented at level A. Full performance from level B.levels
Example
#include "ose.h"
OS_PROCESS(my_process){
SEMAPHORE *sem;
for(;;){
/* Code */
nual / R1.0.4 OSE / Kernel - 3 : 23
Reference Macreate_sem
Ker
nel
sem = create_sem(1);/* Code */
}}
nual / R1.0.4 OSE / Kernel - 3 : 24
Reference Macurrent_proces
Ker
nel
current_process
Syntax PROCESS current_process (void);
Description Determines which process is currently running.
Include files #include "ose.h"or#include "ose_i.h"
Parameters None.
Return value Returns the process ID of the calling process.
Restrictions None.
Implementation Full performance at all implementation levels.levels
Example
#include "ose.h"
OS_PROCESS(my_process){
PROCESS proc_;
for(;;){
/* Code */proc_ = current_process();/* Code */
}}
nual / R1.0.4 OSE / Kernel - 3 : 25s
Reference Madelay
Ker
nel
s
stem
st ber
rter
ess.
delay
Syntax void delay (OSTIME timeout);
Description Suspends the calling process for the number of milliseconds specified in thetimeout parameter.
The specified timeout period is converted to a number of actual system tickaccording to the following rules:
A value of zero returns immediately.
A value equal to or smaller than one system tick period returns at the next sytimer event, i.e. after anything between 0 and 1 system tick.
A value higher than one system tick period is rounded upwards to the closenumber of system ticks. The actual delay will vary between the calculated numof ticks and this value less one tick period.
The result is that the actual delay may be up to one system tick period shothan specified.
Include files #include "ose.h"
Parameters timeout Specifies the number of milliseconds to suspend the proc
Return value None.
Restrictions The delay call is not available to interrupt processes.
See also receive_w_tmo
Implementation Full performance at all implementation levels.levels
Example
#include "ose.h"
OS_PROCESS(my_process){
for(;;){
turn_on_lamp();/* fictive function */delay(10);turn_off_lamp();/* fictive function */delay(10);
}}
nual / R1.0.4 OSE / Kernel - 3 : 26
Reference Madetach
Ker
nel
d by
s, i.e
detach
Syntax void detach (OSATTREF *ref);
Description Removes a signal previously attached by the caller.
The ref parameter contains a pointer to the reference ID which was returnethe previous call to attach.
Include files #include "ose.h"
Parameters ref A pointer to the reference ID of the previously attached signal.
Return value None.
Restrictions It is illegal to detach a signal already received and freed by the caller.
It is illegal for a process to use a ref parameter obtained by another procescorresponding attach and detach calls must be made by the same process.
The detach call is not available to interrupt processes.
See also attach, OS_ATTACH_SIG
Implementation Not implemented at level A. Full performance from level B.levels
Example
#include "ose.h"
union SIGNAL{
SIGSELECT sig_no;};
static const SIGSELECT attach_sig[2] = {1, OS_ATTACH_SIG};
extern PROCESS proc_;
OS_PROCESS(my_process){
union SIGNAL *sig;OSATTREF attref;
for(;;){
attref = attach(NULL, proc_);/* Code */sig = receive_w_tmo(0, (SIGSELECT *)attach_sig);if(sender(&sig) != proc_){
detach(&attref); /* Process not dead */}free_buf(&sig);
}}
nual / R1.0.4 OSE / Kernel - 3 : 27
Reference Maerror
Ker
nel
e
de is
the n be the
licy
error
Syntax void error (OSERRCODE ecode);
Description Reports an error to the kernel or to the error handler possibly attached to thcurrent process or block.
The ecode parameter contains a user-defined numerical error code. This copassed to the error handler for evaluation.
It is suggested that error codes are grouped into ranges for classification oferror. For instance, an error code with the most significant bit set to zero cainterpreted as a warning while other error codes can be considered fatal forcalling process.
Include files #include "ose.h"or#include "ose_i.h"
Parameters ecode The error number to be passed to the error handler.
Return value The error call may or may not return, depending on how the error handler pois implemented by the user.
Restrictions None.
Implementation Full performance at all implementation levels.levels
Example
#include "ose.h"
OS_PROCESS(my_process){
for(;;){
/* Code */error(6);/* Code */
}}
nual / R1.0.4 OSE / Kernel - 3 : 28
Reference Maerror2
Ker
nel
e
de is
the n be the
ble
ow
licy
error2
Syntax void error2 (OSERRCODE ecode, OSERRCODE extra);
Description Reports an error to the kernel or to the error handler possibly attached to thcurrent process or block.
The ecode parameter contains a user-defined numerical error code. This copassed to the error handler for evaluation.
It is suggested that error codes are grouped into ranges for classification oferror. For instance, an error code with the most significant bit set to zero cainterpreted as a warning while other error codes can be considered fatal forcalling process.
The extra parameter is there so you can pass extra information to the errorhandler. It might be a pointer to some info that you would like to have availawhen
handling the error in the error handler.
Include files #include "ose.h"or#include "ose_i.h"
Parameters ecode The error number to be passed to the error handler.
extra This parameter will be passed to the error handler, and shup as the extra parameter in the error handler.
Return value The error call may or may not return, depending on how the error handler pois implemented by the user.
Restrictions None.
Implementation All OSE implementations might not have this system call.levels
Example
#include "ose.h"
OS_PROCESS(my_process){
for(;;){
const char *error_str = "This is no good";/* Code */error2(6, (OSERRCODE)error_str);/* Code */
}}
nual / R1.0.4 OSE / Kernel - 3 : 29
Reference Maflush
Ker
nel
ified
e
lled, s the
n at
ray. ould
for
flush
Syntax void flush (PROCESS *psel, PROCESS pid);
Description The flush call throws away all signals sent by any of a set of processes specin psel, from the signal queue of the process specified in pid.
The psel parameter is an array of process ID's. The first location contains thnumber of valid entries in the rest of the array.
The flush call may be useful for instance when a process is unexpectedly kiand other processes involved need to clear any pending transactions towardkilled process.
Include files #include "ose.h"
Parameters psel A pointer to an array of processes to flush signals from.
pid The process ID of the receiving process.
Return value None.
Restrictions The psel array must be built in run-time since process identities are unknowcompile time.
The first location in psel contains the number of entries in the rest of the arSince the PROCESS type may not be compatible to an integer, the count shbe cast to the PROCESS type when building psel.
Ex: psel[0] = (PROCESS) 1;
It is illegal to flush the queue of an interrupt or timer-interrupt process.
The flush call is not available to interrupt processes.
Implementation This system call should be regarded as obsolete, and is only implemented levels backwards compatibility reasons.
Example
#include "ose.h"
extern PROCESS proc1_;extern PROCESS proc2_;
OS_PROCESS(my_process){
PROCESS flush_array[2];flush_array[0] = (PROCESS) 1;flush_array[1] = proc1_;
for (;;){
/* Code */flush(flush_array, proc2_); /* Throws away all */
/* signals sent */ /* from proc1 to proc2*/
/* Code */
}}
nual / R1.0.4 OSE / Kernel - 3 : 30
Reference Mafree_buf
Ker
nel
the tal
freed g
g. before
ese n
free_buf
Syntax void free_buf (union SIGNAL **sig);
Description Returns a signal buffer that is no longer needed to the pool associated withcaller's block. NIL is entered into the caller's signal pointer to avoid accidenreuse of the buffer.
Include files #include "ose.h"or#include "ose_i.h"
Parameters sig A pointer to a pointer to the signal buffer to free.
Return value None.
Restrictions It is an error to free a buffer owned by another process. Such buffers must be by the owner, or ownership must be changed by calling restore before callinfree_buf.
Some old OSE implementations will not permit freeing redirected buffers (e.signals sent to other processors). Portable code should therefore call restore freeing such buffers. New OSE implementations do not have this restriction.
Note that many OSE calls return buffers that are allocated by the kernel. Thbuffers are typed as required by the various calls and must be cast to (unioSIGNAL **) when freed.
See also alloc, restore
Implementation Full performance at all implementation levels.levels
Example
#include "ose.h"
static const SIGSELECT any_sig[] = {0};
union SIGNAL{
SIGSELECT sig_no;}
OS_PROCESS(my_process){
union SIGNAL *sig;
for(;;){
/* Code */sig = receive((SIGSELECT *) any_sig);/* Code */free_buf(&sig);
}}
nual / R1.0.4 OSE / Kernel - 3 : 31
Reference Maget_bid
Ker
nel
d is ed to.
ode ing in
get_bid
Syntax PROCESS get_bid (PROCESS pid);
Description Finds the block that the specified process is part of.
Include files #include "ose.h"or#include "ose_i.h"
Parameters pid The process ID.
Return value Returns the block ID.
If pid is a block ID or the ID of a dead process, then the value specified in pireturned from the get_bid call. Use get_ptype to test on these cases if you ne
Restrictions Superuser blocks can only be created by a superuser process.Supervisor mblocks can only be created by a superuser process (user number 0) executsupervisor mode itself. The create_block call is not available to interrupt processes.
See also create_block, get_bid_list
Implementation Not implemented at level A. Full performance from level B.levels
Example
#include "ose.h"
OSENTRYPOINT new_process;extern PROCESS proc_;
OS_PROCESS(my_process){
PROCESS bid;PROCESS process_;
for(;;){
/* Code */bid = get_bid(proc_);/* Add new_process to the blocks to which*/ /* proc_ belongs */process_ = create_process(OS_PRI_PROC,
"process", new_process, 200, 16, (OSTIME) 0, bid , (struct OS_redir_entry *) NULL, (OSVECTOR) 0, (OSUSER) 0);
start(process_);/* Code */
}}
nual / R1.0.4 OSE / Kernel - 3 : 32
Reference Maget_bid_list
Ker
nel
t one
tem
The
ing
get_bid_list
Syntax struct OS_pid_list * get_bid_list (OSUSER user);
Description Lists all blocks that are available to the specified user number.
Blocks that are owned by some other user are included if they contain at leasprocess available to the specified user.
If user 0 is specified, this indicates the caller's user number.
If user 0 is specified and the caller is a superuser, then all blocks in the sysare listed.
Include files #include "ose.h"
Parameters user Specifies the user number.
Return value Returns NULL if there are no blocks available to the specified user.
Otherwise get_bid_list allocates and returns a signal buffer with a structure containing the list of block ID's.
The buffer must be freed by the caller when information has been extracted.structure is:
struct OS_pid_list{
OSBUFSIZE count;PROCESS list[];
};
where count is the number of blocks and list is a variable size array containthe block identities.
Restrictions Only a superuser process may examine another user space.
The get_bid_list call is not available to interrupt processes.
See also get_bid, get_pcb, get_pid_list
Implementation Not implemented at levels A and B. Full performance from levels level C.
Example
#include "ose.h"
OS_PROCESS(my_process){
struct OS_pid_list *bidlist;OSBUFSIZE count;PROCESS block1_;OSBOOLEAN exist;int i;
for(;;){
/* Code */bidlist = get_bid_list(0);count = bidlist->count;exist = 0;
nual / R1.0.4 OSE / Kernel - 3 : 33
Reference Maget_bid_list
Ker
nel
for(i = 0; i < count; i++){
if(bidlist->list[i] == block1_){
exist = 1;break;
}}if(exist){
/* Code, The block exists */}else{
block1_ = create_block("block1", (OSUSER) 0, (OSBOOLEAN) 0, (PROCESS) 0, (OSBOOLEAN) 0);
/* Code */}
}}
nual / R1.0.4 OSE / Kernel - 3 : 34
Reference Maget_cpu
Ker
nel
cess
pe.
r
get_cpu
Syntax char * get_cpu (PROCESS pid);
Description Returns a string describing the operating system on which the specified prois executing.
In many cases, this information is also used indirectly to find out the CPU ty
The string is contained in a buffer obtained from the caller's pool. This buffemust be returned to the pool with the free_buf call when the string has beenextracted.
Include files #include "ose.h"
Parameters pid The process ID of the specified process.
Return value The returned null-terminated string has the following general format:
"<OSE_product>/<revision>/<other_info>"
The "/" character is a general field separator.
Only the first two fields have specified contents.
Ex: "OSE/68360 R1.2.0"
Restrictions The get_cpu call is not available to interrupt processes.
Implementation Not implemented at level A. Full performance from level B.levels
Example
#include "ose.h"
union SIGNAL{
SIGSELECT sig_no;};
OS_PROCESS(my_process){
char *cpu1;char *cpu2;extern PROCESS proc_;
for(;;){
/* Code */cpu1 = (char*) get_cpu(current_process());cpu2 = (char*) get_cpu(proc_);if(strcmp(cpu1, cpu2) == 0){
/* Code, The processes run in exactly the same * operating systems (need not be in the same * cpu) */
}free_buf( (union SIGNAL **) &cpu1);free_buf( (union SIGNAL **) &cpu2);
}}
nual / R1.0.4 OSE / Kernel - 3 : 35
Reference Maget_env
Ker
nel
cess
t the
een
get_env
Syntax char * get_env (PROCESS pid, char *name);
Description Reads the contents of the named environment variable for the specified proor block.
Variables set with the set_envp() call can be read with the get_env() call, bustring returned is not easily interpreted
Include files #include "ose.h"
Parameters pid The ID of the specified process.
name A pointer to the environment variable name.
Return value Returns a buffer obtained from the caller’s pool containing the value of the specified environment variable. The value is always a null-terminated string.
This buffer must be freed with free_buf by the caller when information has bextracted.
Returns NULL if the specified environment variable was not found.
Restrictions Strings that are too long to be passed in a signal buffer are truncated.
The get_env call is not available to interrupt processes.
See also get_env_list, get_envp, set_env, set_envp
Implementation Not implemented at level A. Full performance from level B.levels
Example
#include <stdio.h>#include "ose.h"
void print_term(void){
char *env = get_env(current_process(), "TERM");
if(envbuf != NULL){
printf("TERM=%s\n", env);free_buf( (union SIGNAL **) &envbuf);
}} /* print_term */
nual / R1.0.4 OSE / Kernel - 3 : 36
Reference Maget_env_list
Ker
nel
ame
ted.
t.
.
bles
the the
get_env_list
Syntax char * get_env_list (PROCESS pid,
char *first_name);
Description Lists the environment variables available in the specified process or block.
If first_name is NULL then the returned list starts at the first variable found.
If first_name is a valid name, then the returned list starts at the first variable nfound after first_name. (In this way a long list can be managed.)
Include files #include "ose.h"
Parameters pid The ID of the specified process.
first_name A pointer to an environment variablename.
Return value Returns a buffer obtained from the caller’s pool containing the names of theenvironment variables available in the specified process or block.
Names are separated by a single space and the entire string is null-termina
Names that are too long for a single buffer are discarded from the return lis(Truncated names are never returned).
The buffer must be freed by the caller when information has been extracted
Returns an empty string "" if the process or block has terminated or if no variawere found.
Restrictions There is only one way to know if the environment contains more strings thanones returned. A second get_env_list call must always be issued, specifyinglast name in the previous list as first_name.
The get_env_list call is not available to interrupt processes.
See also set_env
Implementation Not implemented at level A.Full performance from level B. levels
Example
#include "ose.h"
extern PROCESS proc_;
OS_PROCESS(my_process){
char *envbuf;OSBOOLEAN exist;char *last;
for(;;){
/* Code */envbuf = get_env_list(proc_, NULL);exist = 0;
while(*envbuf && exist == 0){
if(strstr(envbuf, "port"))
nual / R1.0.4 OSE / Kernel - 3 : 37
Reference Maget_env_list
Ker
nel
{exist = 1;
}else{
/* Find the last name in the buffer */last = strrchr(envbuf,' ');if (last)
envbuf = get_env_list(proc_, last);else
envbuf = "";}
}if(exist){
/* Code, The variable exists */}else{
/* Code */}
}}
nual / R1.0.4 OSE / Kernel - 3 : 38
Reference Maget_envp
Ker
nel
s that read
ent
get_envp
Syntax OSADDRESS get_envp (PROCESS pid, char *name);
Description Reads a 32 bit pointer from a named environment variable for the specifiedprocess or block.
This call assumes that the value was set with the set_envp call, which meanit was stored in a special format. Variables set with the set_env call can be with the get_envp call only if the value consists of exactly 8 characters.
Include files #include "ose.h"
Parameters pid The ID of the specified block or process. Setting the pid parameter to zero is equivalent to using the pid of the currprocess.
name A pointer to the environment variable name.
Return value Returns the 32 bit pointer value of the environment variable.
Returns zero if the specified environment variable was not found.
Restrictions The get_envp call is not available to interrupt processes.
See also get_env, get_env_list, set_env, set_envp
Implementation All OSE implementations might not have this system call.levels
Example
#include "ose.h"
OS_PROCESS(my_process){
int prod_data = 0xCAFE;OSADDRESS pa;
for(;;){
set_envp(0, "pd", (OSADDRESS)&proc_data);pa = get_envp(0, "pd");if (pa != 0)
printf("pa = %d\n", *(int *)pa);/* Code */
}}
nual / R1.0.4 OSE / Kernel - 3 : 39
Reference Maget_fsem
Ker
nel
ut it imer-
a
get_fsem
Syntax OSFSEMVAL get_fsem (PROCESS pid);
Description Interrogates the fast semaphore of the specified process.
Include files #include "ose.h"or#include "ose_i.h"
Parameters pid The ID of the specified process.
Return value Returns the current value of the fast semaphore.
Restrictions Get_fsem may also be called from interrupt and timer-interrupt processes, bis an error to cause a remote system call while doing so, i.e. an interrupt or tinterrupt process may not access a fast semaphore in another CPU.
Examining the fast semaphore of an interrupt or timer-interrupt process, or process without a fast semaphore, yields garbage.
See also signal_fsem, wait_fsem, set_fsem
Implementation Not implemented at level A. Full performance from level B.levels
Example
#include "ose.h"
OS_PROCESS(my_process){
OSFSEMVAL fsemvalue;
for(;;){
/* Code */fsemvalue = get_fsem(current_process());/*Code */
}}
nual / R1.0.4 OSE / Kernel - 3 : 40
Reference Maget_mem
Ker
nel
rocess
d.
lock
other
get_mem
Syntax OSBOOLEAN get_mem (PROCESS pid,
OSADDRESS from,
void *to,
OSADDRESS size);
Description Reads a specified number of bytes from the address space of the specified por block.
This call is mainly used by debuggers to examine a program being debugge
Include files #include "ose.h"
Parameters pid The ID of the specified block or process.
from The memory address to read from.
to A pointer to the destination buffer.
size The number of bytes to read.
Return value Returns a non-zero value if an error occurred. Either the specified process/bcould not be found, or the requested size could not be transferred.
Restrictions The caller must be aware of the problems that occur when a program on anCPU type is examined. In particular if that CPU has another word length.
The get_mem call is not available to interrupt processes.
See also set_mem
Implementation Not implemented at levels A and B. Full performance from levels level C.
Example
#include "ose.h"
#define MEM 33 /* These declarations */struct Mem /* are preferably made */{ /* in a .sig-file which */
SIGSELECT sig_no; /* is included. */OSADDRESS address;
};
union SIGNAL{
SIGSELECT sig_no;struct Mem mem;
};
OS_PROCESS(my_process){
char to_array[10];OSADDRESS array;OSBOOLEAN success;union SIGNAL *sig;static const SIGSELECT mem_sig[] = {1, MEM};
for(;;){
nual / R1.0.4 OSE / Kernel - 3 : 41
Reference Maget_mem
Ker
nel
/* Code */sig = receive((SIGSELECT *) mem_sig);array = sig->mem.address;success = get_mem(sender(&sig),
array, to_array,
sizeof(to_array));if(success){
/* Code, The memory move was successful */}else{
/* Code, Not a successful memory move */}/* Code */
}}
nual / R1.0.4 OSE / Kernel - 3 : 42
Reference Maget_pcb
Ker
nel
ance,
t
the
ure.
ed
get_pcb
Syntax struct OS_pcb * get_pcb (PROCESS pid);
Description Interrogates the status of the specified process or block. This information isreturned to the caller.
The get_pcb call is mainly used by debuggers, but the process name, for instmay also be of interest in some applications.
Terminated processes may be examined, although no information of interesexcept process type is available.
The process type field must always be tested to validate other information.
Note that it is legal to pass an invalid process ID to this system call. This isallowed only for the get_pcb and get_ptype calls. The returned “type” field of struct will then be set to OS_ILLEGAL.
Include files #include "ose.h"or#include "ose_i.h"
Parameters pid The ID of the specified block or process.
Return value Returns a buffer obtained from the caller’s pool containing the OS_pcb structThis buffer must be freed with free_buf when it is no longer needed.
If the get_pcb call was not successful, a NULL pointer is returned.
The OS_pcb structure has the following layout: (For blocks, only fields markby '#' are valid.)
struct OS_pcb{
# OSADDRESS type; /* Should be cast to *//* enum PROCESS_TYPE */
OSADDRESS status; /* Should be cast to */ /* enum PROCESS_STATUS */
OSADDRESS priority; /* Should be cast to 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];
};
where:
nual / R1.0.4 OSE / Kernel - 3 : 43
Reference Maget_pcb
Ker
nel
bits s is TED
. The does ase.
eue
The 0 if
ress
ress rnel
cted
Type contains the process type. Legal values are
OS_BLOCK: A block was specified.OS_PRI_PROC: A prioritized process.OS_BG_PROC: A background process.OS_INT_PROC: An interrupt process.OS_TI_PROC: A timer-interrupt process.OS_PHANTOM: A phantom process.OS_ZOOMBIE: A killed process or block.OS_ILLEGAL: An invalid process ID was specified.
Status contains process status. This is a bit field with zero, one, two or three set. If no bits are set, the process is ready or running. Otherwise the processuspended for one or more reasons. The OS_STOPPED and OS_INTERCEPbits can be independently set. Other bits are mutually exclusive.
Legal bit masks are:
OS_RECEIVE: Waiting for one of the receive calls.
OS_DELAY: Waiting for a delay call.OS_SEMAPHORE: Waiting at a semaphore.OS_FSEMAPHORE: Waiting at a fast semaphore.OS_REMOTE: Waiting for a remote system
call.OS_STOPPED: The process was stopped.OS_INTERCEPTED: A breakpoint was reached.
Priority is the priority of the process. Legal values are 0 - 31.
User is the user number of the process.
Fsemvalue is the current value of the fast semaphore attached to the processvalue is negative if the process is waiting at the semaphore or if the processnot have a fast semaphore. Use the status field to determine which is the c
Sigqueue is the address of the first signal in the signal queue. The signal qucan be examined by subsequent get_signal calls. Sigqueue = 0 if no signal is presently in the queue.
Attach_list is the address of the first signal in the queue of attached signals. attach queue can be examined by subsequent get_signal calls. Attach_list =no signal is attached to the process.
Stack_top is the highest address on the stack. (The byte at the specified addis part of the stack.)
Stack_limit is the lowest address on the stack. (The byte at the specified addis part of the stack.) The stack_top and stack_limit fields are equal if the kecan not provide stack information.
Remote_server is the ID of the process that manages remote system calls diretowards the examined process.
nual / R1.0.4 OSE / Kernel - 3 : 44
Reference Maget_pcb
Ker
nel
call
note sing
is s, but
be
tem file ant
ent
ith
lock.
es.
".t.
e list. user
is G
y yte aller ess
sed s the e
Remote_server is the process ID of the examined process itself if no remoteserver is present.
Sig_cnt_in_q is the number of signals currently in the signal queue of the process. The address of the first signal is found in the sigqueue field. Pleasethat the sig_cnt_in_q field should only be used for statistics, not when traverthe signal queue itself.
Sig_cnt_owned is the number of signals currently owned by the process. Thincludes signals allocated by the process and signals attached by the procesnot signals in the signal queue or signals handed to the hunt system call.
Max_sigsize indicates number of bytes in the largest signal that the specifiedprocess or block is able to allocate. This is also the largest signal that can successfully sent to a process in the block. (Other signals are lost.)
Sigsel_size contains sizeof(SIGSELECT) for the specified process or block.
Line is an integer containing the source code line from which the current syscall was issued. Line is 0 if no line and file information is available. Line and information is available if the specified process was compiled with the constOS_DEBUG defined.(I.e. a -DOS_DEBUG flag was set when compiling).
File is a string (in the strings array) showing the file name from which the currsystem call was issued. This field is invalid if line is 0. Line and file information is available if the specified process was compiled wthe constant OS_DEBUG defined.
Name is a string (in the strings array) showing the name of the process or b
Cpuregs is a string (in the strings array) showing all known CPU register valuThe names of these are CPU dependent. A sample string might look like "PC=00001D34 SP=000089AB D1=0000A89Registers are separated by a space. All values are in upper case hex formaRegisters that can not be determined at a certain point are excluded from thThere may be a pseudoregister named "RA". It contains the return address tocode while a system call is in progress. Information on CPU register valuesavailable if the specified process was complied with the constant OS_DEBUdefined.
Wanted is a copy (in the strings arrary) of the currently active sigselect arrapassed to receive by the examined process. The array was converted to a border suitable for the caller. The size of each entry must be calculated by the cusing the sigsel_size field described above. The wanted field is invalid if procstatus does not indicate OS_RECEIVE.If the sigsel array is unresolvable large it will be truncated.
Strings is a variable size array containing the string pool. The string pool is uto store strings for file, process or block name and cpu registers. It also holdwanted array. The values of those fields are not pointers, but indexes into thstring pool.
nual / R1.0.4 OSE / Kernel - 3 : 45
Reference Maget_pcb
Ker
nel
it is mer-el wed the
lds
Restrictions There must be a buffer available in the pool that is large enough to hold thereturned structure. Otherwise the get_pcb call will fail.
Get_pcb may be called also from interrupt and timer-interrupt processes, butan error to cause a remote system call while doing so, i.e. an interrupt or tiinterrupt process may not examine a process in another CPU, and the kernignores any attempt to do so. Calling get_pcb from interrupt processes is allomainly to aid error handlers in obtaining the name of the current process. Insoftkernel the return value for cpuregs will be an empty string.
See also get_signal, get_mem, get_ptype, set_pcb
Implementation Not implemented at level A. levels Full performance from level B.
Implementations must support the "type", "status" and "name" fields. Other fieare optionally implemented, but must contain harmless dummy values.
Example
#include "ose.h"
union SIGNAL{
SIGSELECT sig_no;};
OS_PROCESS(my_process){
struct OS_pcb *pcbbuf;static const char *name = "my_process";
for(;;){
/* Code */pcbbuf = get_pcb(current_process());if(pcbbuf){
switch((enum PROCESS_TYPE)pcbbuf->type){
case OS_PRI_PROC:if(strcmp(&pcbbuf->strings[pcbbuf->name], name)){
/* Code */}break;
default:/* Code */break;
}free_buf( (union SIGNAL **) &pcbbuf);
}else{
/* Code, Not a successful call */}
}}
nual / R1.0.4 OSE / Kernel - 3 : 46
Reference Maget_pid_list
Ker
nel
he
The
g the
ce n.
ignal
get_pid_list
Syntax struct OS_pid_list * get_pid_list (PROCESS bid);
Description Lists all processes that are part of the specified block and are available to tcalling process.
It is permitted to examine a block ID in another user space. Only processesavailable to the caller are listed.
Include files #include "ose.h"
Parameters bid The ID of the specified block.
Return value Returns NULL if the block has no processes available to the caller.
Otherwise get_pid_list allocates and returns a signal buffer with a structure containing process ID's available to the caller in the block.
The buffer must be freed by the caller when information has been extracted.structure is:
struct OS_pid_list{
OSBUFSIZE count;PROCESS list[];
};
where count is number of processes and list is a variable size array containinprocess identities.
Restrictions If the block contains processes that are not available to the caller, for instanprocesses running under other user numbers, these processes are not show
If the block contains more processes than can be presented in the largest sbuffer, then the list is truncated at that size.
The get_pid_list is not available to interrupt processes.
See also get_pcb, get_bid_list
Implementation Not implemented at levels A and B. Full performance from levels level C.
Example
#include "ose.h"
#define START 10 /* These declarations */struct Start /* are preferably made */{ /* in a .sig-file which */
SIGSELECT sig_no; /* is included. */};
union SIGNAL{
SIGSELECT sig_no;struct Start start;
};
extern PROCESS some_block_;
nual / R1.0.4 OSE / Kernel - 3 : 47
Reference Maget_pid_list
Ker
nel
OS_PROCESS(my_process){
struct OS_pid_list *pidlist;OSBUFSIZE count;union SIGNAL *sig;int i;
for(;;){
/* Code */pidlist = get_pid_list(some_block_);if(pidlist){
count = pidlist->count;
for(i = 0 ; i < count ; i++){
/* Send the start signal to all * processes in the block */sig = alloc(sizeof(struct start), START);send(&sig, pidlist->list[i]);
}free_buf( (union SIGNAL **) &pidlist);/* Code */
}else{
/* Code, no processes available to the caller * in specified block */
}}
}
nual / R1.0.4 OSE / Kernel - 3 : 48
Reference Maget_pool_list
Ker
nel
are
The
the
get_pool_list
Syntax struct OS_pid_list * get_pool_list (OSUSER user);
Description Lists all pools that are available to the specified user number.
If user 0 is specified, this indicates the caller's user number.
If user 0 is specified and the caller is a superuser, then all pools in the systemlisted.
Include files #include "ose.h"
Parameters user Specifies the user number.
Return value Returns a signal buffer with a structure containing the list of pool IDs.
The buffer must be freed by the caller when information has been extracted.structure is:
struct OS_pid_list{
OSBUFSIZE count;PROCESS list[];
};
where count is the number of pools and list is a variable size array containingpool identities.
Restrictions Only a superuser process may examine another user space.
The get_pool_list call is not available to interrupt processes.
See also get_poolcb, get_sig_info, get_sig_poolid, get_stk_poolid
Implementation All OSE implementations might not have this system call.levels
Example
#include "ose.h"
void list_pools(void){
struct OS_pid_list *list = get_pool_list(0);
if (list != NULL){
OSBUFSIZE count = list->count;int i;
printf("Pools: ");for(i = 0 ; i < count ; i++){
printf("%#lx ", list->list[i])}printf("\n");
}}
nual / R1.0.4 OSE / Kernel - 3 : 49
Reference Maget_poolcb
Ker
nel
the
d to
out ws:
get_poolcb
Syntax struct OS_poolcb * get_poolcb (PROCESS pool_id);
Description Interrogates the status of the specified pool. This information is returned to caller in a buffer.
Note that it is legal to pass an invalid pool ID to this system call.
Include files #include "ose.h"
Parameters pool_id The ID of the specified pool.
Return value Returns a buffer obtained from the caller’s pool containing an OS_poolcb structure with information about a specified pool. The buffer must be returnethe system with free_buf when the information is no longer needed.
If the get_poolcb call was not successful, a NULL pointer is returned.
The OS_poolcb structure has the following layout:
struct OS_poolcb {
OSADDRESS tot_size;OSADDRESS free_size;OSADDRESS fragment_info;OSADDRESS stk_conf_entries;OSADDRESS sig_conf_entries;OSADDRESS stk_conf_sizes;OSADDRESS sig_conf_sizes;OSADDRESS stk_alloc_sizes;OSADDRESS sig_alloc_sizes;OSADDRESS values[1];
};
where:
Tot_size contains the total memory size (in bytes) of all pool fragments.
Free_size contains the number of bytes never used in the pool.
Fragment_info is an index into the values array where detailed information aball the pool fragments can be found. The layout of this information is as follo
The number of fragments in the pool can be found at:
values[fragment_info + 0]
The base address of fragment 0 can be found at:
values[fragment_info + 1]
The size of fragment 0 can be found at:
values[fragment_info + 2]
The number of bytes used for stacks in fragment 0 can be found at:
values[fragment_info + 3]
The number of bytes used for signals in fragment 0 can be found at:
values[fragment_info + 4]
nual / R1.0.4 OSE / Kernel - 3 : 50
Reference Maget_poolcb
Ker
nel
l ress so
.
ze ured is
e n
ffer al
ze
ntly t
" size
ze in he ntly ool
s of
tion.
old
If there are more than one pool fragment the detailed information about poofragment 1 starts at "values[fragment_info + 5]", which contains the base addof fragment 1. "values[fragment_info + 6]" contains the size of fragment 1 andon.
Stk_conf_entries is the number of configured stack sizes for this pool.
Sig_conf_entries is the number of configured signal buffer sizes for this pool
Stk_conf_sizes is an index into the values array where to find an array (of sistk_conf_entries) with information about how the stack sizes has been configfor this pool. This field is only valid if the value of the stk_conf_entries field greater than zero. The smallest configured stack size can be found at"values[stk_conf_sizes]" and largest configured stack size can be found at "values[stk_conf_sizes + stk_conf_entries - 1]".
Sig_conf_sizes is an index into the values array where to find an array (of sizsig_conf_entries) with information about how the signal buffer sizes has beeconfigured for this pool. This field is only valid if the value of the sig_conf_entries field is greater than zero. The smallest configured signal busize can be found at"values[sig_conf_sizes]" and the largest configured signbuffer size can be found at "values[sig_conf_sizes + sig_conf_entries - 1]".
Stk_alloc_sizes is an index into the values array where to find an array (of sistk_conf_entries) with information about how many stacks (of a certain configured size) are currently in use in the pool. This field is only valid if thevalue of the stk_conf_entries field is greater than zero. The number of curreused stacks of the smallest configured stack size in the pool can be found a"values[stk_alloc_sizes]" and "values[stk_alloc_sizes + stk_conf_entries - 1]contains the number of currently used stacks of the largest configured stackin the pool.
Sig_alloc_sizes is an index into the values array where to find an array (of sisig_conf_entries) with information about how many signal buffers (of a certaconfigured size) are currently allocated in the pool. This field is only valid if tvalue of the sig_conf_entries field is greater than zero. The number of curreallocated signal buffers of the smallest configured signal buffer size in the pcan be found at "values[sig_alloc_sizes]" and "values[sig_alloc_sizes + sig_conf_entries - 1]" contains the number of currently allocated signal bufferthe largest configured signal buffer size in the pool.
Values is a variable size array containing most of the requested pool informa
Restrictions There must be a buffer available in the callers pool that is large enough to hthe returned structure. Otherwise the get_poolcb call will fail.
The get_poolcb call is not available to interrupt processes.
See also get_pool_list, get_sig_info, get_sig_poolid, get_stk_poolid
Implementation All OSE implementations might not have this system call.levels
nual / R1.0.4 OSE / Kernel - 3 : 51
Reference Maget_poolcb
Ker
nel
Example
#include "ose.h"
void list_pool_info(PROCESS pool_id){
struct OS_poolcb *pool = get_poolcb(pool_id);OSADDRESS *value;OSADDRESS loop;
if (pool == NULL)
printf("Error: %#lx is not a valid pool identifier.\n", pool_id);return;
}printf("Pool id.....: %#lx\n", pool_id);printf("Total size..: %lu\n", pool -> tot_size);printf("Never used..: %lu\n", pool -> free_size);printf("Stack sizes.: %lu\n", pool -> stk_conf_entries);if (pool -> stk_conf_entries){
value = &pool -> values[pool -> stk_conf_sizes];loop = pool -> stk_conf_entries;printf( " Conf.: ");while (loop--)
printf( "%7lu", *value++);printf( "\n Alloc: ");value = &pool -> values[pool -> stk_alloc_sizes];loop = pool -> stk_conf_entries;while (loop--)
printf( "%7lu", *value++);printf("\n");
}printf("Signal sizes: %lu\n", pool -> sig_conf_entries);if (pool -> sig_conf_entries){
value = &pool -> values[pool -> sig_conf_sizes];loop = pool -> sig_conf_entries;printf( " Conf.: ");while (loop--)
printf( "%7lu", *value++);printf( "\n Alloc: ");value = &pool -> values[pool -> sig_alloc_sizes];loop = pool -> sig_conf_entries;while (loop--)
printf( "%7lu", *value++);printf("\n");
}loop = pool -> values[pool -> fragment_info];value = &pool -> values[pool -> fragment_info + 1];printf("Fragments: %lu\n", loop);printf(" %10s %10s %10s %10s %10s\n",
"Fragment", "BaseAddr", "Size", "StkUsed", "SigUsed");do{
printf(" %10lu %#010lx %10lu %10lu %10lu\n",loop, value[0], value[1], value[2], value[3]);
value += 4;} while (--loop);free_buf((union SIGNAL **)&pool);
}
nual / R1.0.4 OSE / Kernel - 3 : 52
Reference Maget_pri
Ker
nel
upt
get_pri
Syntax OSPRIORITY get_pri (PROCESS pid);
Description Examines the current priority of the specified process.
Include files #include "ose.h"
Parameters pid The ID of the specified process.
Return value Returns the priority.
Restrictions Works only for prioritized processes. The get_pri call is not available to interrprocesses. Returns 0 for background processes
See also set_pri
Implementation Not implemented at levels A and B. Full performance from levels level C.
Example
#include "ose.h"
OS_PROCESS(my_process){
OSPRIORITY prio;
for(;;){
prio = get_pri(current_process());if(prio != 31){
set_pri(++prio);}else{
set_pri(0);}
delay(100);}
}
nual / R1.0.4 OSE / Kernel - 3 : 53
Reference Maget_ptype
Ker
nel
erent ferent
rver. pe. rom
get_ptype
Syntax enum PROCESS_TYPE get_ptype (PROCESS pid);
Description Interrogates the type of the specified process or block.
This call is intended for use in code that is shared by several processes of difftypes. For instance, it can be used in common code that needs to react in difways to calls from interrupt processes and other types.
The get_ptype call is special in that it can not be caught by a remote call seThis means that you can always find out the true process type with get_ptyThis is not true for the get_pcb call, and thus you may get different results fthe two calls for the same process.
Note that it is legal to pass an invalid process ID to this system call. This isallowed only for the get_pcb and get_ptype calls.
Include files #include "ose.h"or#include "ose_i.h"
Parameters pid The ID of the specified block or process.
Return value Returns the process type.
Legal values are:
OS_BLOCK: A block was specified.OS_PRI_PROC: A prioritized process.OS_BG_PROC: A background process.OS_INT_PROC: An interrupt process.OS_TI_PROC: A timer-interrupt process.OS_PHANTOM: A phantom or dummy process.OS_ZOOMBIE: A killed process or block.OS_ILLEGAL: An invalid process ID was specified.
Restrictions None.
See also get_pcb
Implementation Not implemented at level A. Full performance from level B. levels
nual / R1.0.4 OSE / Kernel - 3 : 54
Reference Maget_ptype
Ker
nel
Example
#include "ose.h"
OS_PROCESS(my_process){
enum PROCESS_TYPE ptype;
for(;;){
/* Code */ptype = get_ptype(current_process());if(ptype == OS_BG_PROC){
/* Code, specific to a background process */}else{
/* Code */}
}}
nual / R1.0.4 OSE / Kernel - 3 : 55
Reference Maget_segid
Ker
nel
get_segid
Syntax PROCESS get_segid (PROCESS pid);
Description Finds the segment that the specified block or process is part of.
Include files #include "ose.h"
Parameters pid The ID of the specified block or process.
Return value Returns the segment ID.
If pid is the ID of a dead block or process, then the value specified in pid isreturned from the get_segid call.
Restrictions The get_segid call is not available to interrupt processes.
See also attach, attach_segment
Implementation All OSE implementations might not have this system call.levels
Example
#include "ose.h"
extern PROCESS proc_;
OS_PROCESS(my_process){
static const SIGSELECT att_sig[] = { 1, OS_ATTACH_SIG };union SIGNAL *sig;PROCESS sid;
sid = get_segid(proc_);(void)attach(NULL, sid);
for(;;){
sig = receive((SIGSELECT *) att_sig);if (sender(&sig) == sid){
printf("The segment containing proc_ has died!\n");}free_buf(&sig);stop(current_process());
}}
nual / R1.0.4 OSE / Kernel - 3 : 56
Reference Maget_sem
Ker
nel
get_sem
Syntax OSSEMVAL get_sem (SEMAPHORE *sem);
Description Reads the current value of a semaphore.
Include files #include "ose.h"or#include "ose_i.h"
Parameters sem A pointer to the specified semaphore.
Return value Returns the current semaphore value.
Restrictions None.
See also wait_sem, signal_sem, create_sem, kill_sem
Implementation Not implemented at level A. Full performance from level B.levels
Example
#include "ose.h"extern SEMAPHORE *sem;OS_PROCESS(my_process){
OSSEMVAL semvalue;for(;;){
/* Code */semvalue = get_sem(sem);if(semvalue == 5){
/* Code */}else{
/* Code */}
}}
nual / R1.0.4 OSE / Kernel - 3 : 57
Reference Maget_sig_info
Ker
nel
uffer
ted t
ext o cifies zero
y the
zero l_id ture erse
.
from
lty)
ide
get_sig_info
Syntax OSBOOLEAN get_sig_info (struct OS_sig_info *sig_info,PROCESS pool_id,PROCESS pid,OSADDRESS sig);
Description Extract detailed information about a signal buffer and searches for the next bowned by a specified process in a specified pool.
The sig_info parameter should contain a pointer to a result buffer. It is updawith information about the signal buffer pointed out by the sig parameter. Sesig_info to NULL if you don't want that information.
The pool_id and pid parameters are used to specify how to search for the nbuffer. The pool_id parameter specifies which pool to search. A value of zerallows the search to continue in any pool. The pid parameter, if non zero, spethat only buffers owned by that process should be searched for. A value of allows any owner including buffers owned by the system.
As a special case, the pool_id parameter may be set to a block id to specifsignal pool associated with that block.
The sig parameter contains the address of the signal buffer to check. Set it toto request a search for the first signal in the first pool that matches the pooand pid parameters. Then use the value of the "next" field in the sig_info strucfor subsequent calls until the next field becomes zero. This way you can travall signals in a pool.
Include files #include "ose.h"or#include "ose_i.h"
Parameters sig_info A pointer to a result buffer.
pool_id The ID of the pool in which to search.
pid Search only for signals owned by the process with this ID
sig A pointer to signal to examine.
Return value Returns a status code with either of these values:
0. Unimplemented system call. No result is obtained.
1. The sig parameter points to a valid signal buffer.
2. The sig parameter points to a signal buffer which seems to be ok, apart the fact that it lacks a valid endmark.
3. The sig parameter points to a signal buffer with a broken (somehow fausignal administration block.
4. The sig parameter is a wild pointer (not pointing at any signal buffer) insa pool.
5. The sig parameter is a wild pointer not inside any pool.
nual / R1.0.4 OSE / Kernel - 3 : 58
Reference Maget_sig_info
Ker
nel
the ild
nfo ed
is ed to s are
was
ly if the
l. If d in tes.
cess will
ll rns
turns ted,
If you are unauthorised to look at the specified signal buffer (you don't haveright user number) the result will be the same as calling get_sig_info with a wsignal pointer value in the sig parameter (i.e. 4).
If the sig_info parameter is not NULL it should contain a pointer to a OS_sig_istructure which will be updated with information about the signal buffer pointout by the sig parameter. The structure is:
struct OS_sig_info{
SIGSELECT sig_no;PROCESS owner;PROCESS sender_pid;PROCESS addressee_pid;OSBUFSIZE sig_size;OSBUFSIZE size_in_pool;OSADDRESS next;
};
where:
Sig_no is set to the signal number.
Owner is set to process ID of the owner of the signal. If this value is zero thmeans that the signal is owned by the system. Signals who has been returnthe system by a call to free_buf or is located in the signal queue of a procesowned by the system and yields zero in this field.
Sender_pid is set to the process ID of the sender of the signal. If the signal never sent it will be set to the same value as the owner field.
Addressee_pid is set to the process ID of the addressee of the signal, but onthe signal has been redirected, otherwise it will be set to the same value asowner field.
Sig_size is set to to the size value used when the signal was allocated.
Size_in_pool is set to the number of bytes the signal occupies in the user poomemory model 1 is used an additional signal administration block is allocatethe system pool, the size of this signal administration block is typically 32 by
Next is set to the address of the next signal buffer owned by the specified proin the specified pool. If the pid parameter to get_sig_info was set to zero it be set to the next signal buffer owned by anyone.
Restrictions Fields related to the sig parameter can be trusted only if the get_sig_info careturns 1 or 2. The next field can be trusted only if the get_sig_info call retu1 or 2, or if the sig parameter was set to zero, in which case get_sig_info re5. It is unwise to call get_sig_info for a process that is not stopped or intercepsince signal pointers age rapidly.
See also get_pool_list, get_poolcb, get_sig_poolid, get_stk_poolid
Implementation All OSE implementations might not have this system call.levels
nual / R1.0.4 OSE / Kernel - 3 : 59
Reference Maget_sig_info
Ker
nel
Example
#include "ose.h"
void list_my_sigs(void){
struct OS_sig_info sig_info;PROCESS curr = current_process();PROCESS sig_pool = get_sig_poolid(curr);OSBOOLEAN status = get_sig_info(&sig_info,sig_pool,curr,0);
if (status == 5 && sig_info.next){
do{
OSADDRESS sigptr = sig_info.next;
status = get_sig_info(&sig_info, sig_pool, curr, sig_info.next); printf("sigptr........: %#lx \n", sigptr); switch (status) { case 1: break; case 2: printf("No valid endmark found\n"); break; case 3: printf("The signal's administration block is faulty\n"); return; /* Not safe to continue */ case 4: printf("The signal's address is wild (inside a pool)\n"); return; /* Not safe to continue */ case 5: printf("The signal's address is wild (not inside any pool)\n"); return; /* Not safe to continue */ default: return; } printf(" sig_no.......: %#lx\n", sig_info.sig_no); printf(" owner........: %#lx\n", sig_info.owner); printf(" sender_pid...: %#lx\n", sig_info.sender_pid); printf(" addressee_pid: %#lx\n", sig_info.addressee_pid); printf(" sig_size.....: %#lx\n", sig_info.sig_size); printf(" size_in_pool.: %#lx\n", sig_info.size_in_pool);
} while (sig_info.next);}
}
nual / R1.0.4 OSE / Kernel - 3 : 60
Reference Maget_sig_poolid
Ker
nel
ss.
get_sig_poolid
Syntax PROCESS get_sig_poolid (PROCESS bid);
Description Returns the ID of the signal pool associated with a specified block or proce
Include files #include "ose.h"
Parameters bid The ID of the specified block or process.
Return value The ID of the signal pool associated with a specified block or process.
If bid is the ID of a dead block or process, then the value specified in bid isreturned from the get_sig_poolid call.
Restrictions None.
See also get_pool_list, get_poolcb, get_sig_info, get_stk_poolid
Implementation All OSE implementations might not have this system call.levels
Example
#include "ose.h"
void show_my_sig_poolid(void){
PROCESS poolid = get_sig_poolid(current_process());
printf("My signal pool ID: %#lx", poolid);}
nual / R1.0.4 OSE / Kernel - 3 : 61
Reference Maget_signal
Ker
nel
h list
ffer buffer
ted.
gnal s.)
It is al ined
ng to
ced ut to
al
en call must _pcb.
pped
get_signal
Syntax OSBOOLEAN get_signal (PROCESS pid,
OSADDRESS mailptr,
union SIGNAL **sig_copy,
OSADDRESS *nextsig);
Description This is a debugger call.
Returns in sig_copy a copy of the signal located in the signal queue or attacfor the specified process or block. (Only processes have signal queues.)
The signal copy is returned in a signal buffer obtained by get_signal. This bucan be examined with the sender, sigsize and addressee system calls. The must be freed with free_buf by the caller when information has been extrac
mailptr is a signal queue pointer obtained from get_pcb or from a previous get_signal call. (You can not evaluate these pointers with get_mem since sibuffers are not always stored in the address space of the addressee proces
The signal structure itself is not altered in any way, just copied byte by byte. important to understand this since sizeof(SIGSELECT) as well as other signdata may vary between systems. Thus the caller must realize that if the examprocess runs on another processor, signal data must be interpreted accordithe conventions used in that processor.
A pointer to the next signal in the list is returned in nextsig. A zero value is plain nextsig if there are no more signals in the list. Nextsig may be used as inpanother get_sig call.
Include files #include "ose.h"
Parameters pid The ID of the specified block or process.
mailptr A pointer to the signal queue.
sig_copy A pointer to a pointer to the signal buffer in which the signis returned.
nextsig A pointer to the next signal in the queue.
Return value Returns a non-zero value if the call failed.
This occurs for instance if the signal queue of the specified process has bealtered by an intermediate call to receive, flush, kill_proc or any other systemthat alters the contents of the relevant buffer lists. When this happens, the list be re-examined from the top, i.e a new list head must be obtained from get
Restrictions It is unwise to call get_signal (as well as get_pcb) for a process that is not stoor intercepted, since signal pointers age rapidly.
The get_signal call is not available to interrupt processes.
See also get_pcb
Implementation Not implemented at levels A and B. Full performance from levels level C.
Example
nual / R1.0.4 OSE / Kernel - 3 : 62
Reference Maget_signal
Ker
nel
#include "ose.h"
extern PROCESS proc_;extern PROCESS proc2_;
union SIGNAL{
SIGSELECT sig_no;};
OS_PROCESS(my_process){
struct OS_pcb *pcbbuf;OSADDRESS sigptr;union SIGNAL *sig;OSADDRESS next;OSBOOLEAN nosuccess;
for(;;){
/* Code */stop(proc_);pcbbuf = get_pcb(proc_);sigptr = pcbbuf->sigqueue;nosuccess = get_signal(proc_, sigptr, &sig,&next);
while(nosuccess){
/* If a non-zero value was returned the call was * unsuccessful both the get_pcb and get_signal * calls must be repeated */pcbbuf = get_pcb(proc_);sigptr = pcbbuf->sigqueue;nosuccess = get_signal(proc_, sigptr, &sig,&next);
}
do{
if(sender(&sig) == proc2_){
/* Code */}free_buf(&sig);get_signal(proc_, next, &sig, &next);
} while(next != NULL);free_buf((union SIGNAL **)&pcbbuf);start(proc_);/* Code */
}}
nual / R1.0.4 OSE / Kernel - 3 : 63
Reference Maget_stk_poolid
Ker
nel
s.
get_stk_poolid
Syntax PROCESS get_stk_poolid (PROCESS bid);
Description Returns the ID of the stack pool associated with a specified block or proces
Include files #include "ose.h"
Parameters bid The ID of the specified block or process.
Return value The ID of the stack pool associated with a specified block or process.
If bid is the ID of a dead block or process, then the value specified in bid isreturned from the get_stk_poolid call.
Restrictions None.
See also get_pool_list, get_poolcb, get_sig_info, get_sig_poolid
Implementation All OSE implementations might not have this system call.levels
Example
#include "ose.h"
void show_my_stk_poolid(void){
PROCESS poolid = get_stk_poolid(current_process());
printf("My stack pool ID: %#lx", poolid);}
nual / R1.0.4 OSE / Kernel - 3 : 64
Reference Maget_systime
Ker
nel
ince
nced ime.
of uent
cond
get_systime
Syntax OSTICK get_systime (OSTICK *microsecs);
Description This call is mainly used by debuggers. Shows the number of system ticks ssystem start and the number of microseconds since the last tick.
The system ticks counter is reset to zero each time the kernel is restarted.
The system ticks counter is incremented each time the system clock is advai.e when the tick system call is issued and wraps after a fairly long period of t
If microsecs == NULL, then the number of microseconds is not returned.
Include files #include "ose.h"or#include "ose_i.h"
Parameters microsecs A pointer to the returned number of microseconds.
Return value Returns the number of system ticks since system start. Returns the numbermicroseconds since the last tick in the microsecs parameter. No two subseqcalls to get_systime will ever return the same microsecond value, even if nohardware counter is available.
Restrictions Few systems can actually provide an accurate timing reference at the microselevel. The actual resolution of the microseconds counter must therefore be determined for each target hardware.
See also get_ticks
Implementation Not implemented at level A. Full performance from level B. levels
Example
#include "ose.h"
OS_PROCESS(my_process){
OSTICK systick;OSTICK micro;for(;;){
/* Code */systick = get_systime(µ);/* Code */
}}
nual / R1.0.4 OSE / Kernel - 3 : 65
Reference Maget_ticks
Ker
nel
ter is
n the
get_ticks
Syntax OSTICK get_ticks (void);
Description Shows the number of system ticks since system start. The system ticks counset to zero when time the kernel is started.
The counter is incremented each time the system clock is advanced (i.e. whetick system call is issued).
The counter wraps after a fairly long period of time.
The get_ticks system call may be defined as get_systime(NULL).
Include files #include "ose.h"or#include "ose_i.h"
Parameters None.
Return value Returns system time in ticks.
Restrictions None.
See also tick, get_systime
Implementation Full performance at all implementation levels.levels
Example
#include "ose.h"
OS_PROCESS(my_process){
OSTICK tick;for(;;){
/* Code */tick = get_ticks();/* Code */
}}
nual / R1.0.4 OSE / Kernel - 3 : 66
Reference Maget_uid
Ker
nel
ting.
ller if
get_uid
Syntax OSUSER get_uid (PROCESS pid);
Description Finds the user number under which the specified process or block is execu
Include files #include "ose.h"
Parameters pid The ID of the specified block or process.
Return value Returns the user ID of the examined process. Returns the user ID of the cathe examined process has terminated.
Restrictions The get_uid call is not available to interrupt processes.
See also create_block, create_process
Implementation Not implemented at level A. Full performance at level B.levels
Example
#include "ose.h"
PROCESS block_;OS_PROCESS(my_process){
OSUSER id;
for(;;){
/* Code */id = get_uid(current_process());block_ = create_block("block",
id , (OSBOOLEAN) 0, (PROCESS) 0, (OSBOOLEAN) 0);
/* Code */}
}
nual / R1.0.4 OSE / Kernel - 3 : 67
Reference Mahunt
Ker
nel
e
ded.
meter
the
nel may
r, and
, i.e or
tains t link
emote
t lse
sent e_ g the
hunt
Syntax OSBOOLEAN hunt (char *name,
OSUSER user,
PROCESS *name_,
union SIGNAL **hunt_sig);
Description Searches for a process by name and updates the name_ parameter with thprocess ID of the named process.
The name_ parameter may be set to NULL if no return value variable is proviThis may be convenient when a hunt_sig is present.
Only processes with the specified user number are searched for. A user paraset to zero specifies the caller's user number, not the superuser.
Processes are searched for in the following order:
1. Processes within the caller's block.
2. Processes that are "block processes" in other blocks.
3. Processes in other blocks.
4. The relevant link handler is asked for the process ID.
If the process is found immediately, the ID of the found process is returned inname_ variable.
An optional hunt signal may be specified. This signal is stored within the keruntil the process appears on the network or the caller terminates. Hunt_sig be set to NULL to indicate that no hunt signal is provided.
When the process is found or created, the hunt signal is returned to the callethe process ID of the found process can be extracted with the sender call.
The hunt signal is immediately returned if the process was immediately foundif a hunt signal is specified, it should always be received, either immediatelylater on.
If the process was not found in the current CPU, and the process name cona path that matches a link handler, then the hunt request is passed on to thahandler as a remote system call. Remote system calls are described in the RSystem Calls chapter.
The link handler has several options at this point:
1. It may return a value indicating that the process was not found. The hunsignal is then stored within the kernel until the link handler or someone ecreates a process with a matching name. At that point the hunt signal isto the caller. An invalid process ID is propagated to the caller in the namvariable. (If someone else created a process with the required name durin
nual / R1.0.4 OSE / Kernel - 3 : 68
Reference Mahunt
Ker
nel
name er. le.
e and D is
less he at is
e ID
t ess
gnal
sts.
cess
cess rced n the
ointer
remote call, that process ID is returned to the caller when the kernel recognizes a link handler failure.)
2. It may create a new process or use an existing process with the desired and return that process ID. The kernel returns the hunt signal to the callThe returned process ID is propagated to the caller in the name_ variab
3. It may create a new process or use an existing process with another namreturn that process ID, indicating to the caller that the obtained process Ia "private" ID. The process ID is propagated to the caller in the name_ variable. The hunt signal is also immediately returned to the caller, regardof the fact that no matching name was ever found. This scheme allows tlink handler to create new instances of a service process for each hunt thissued, using the path name merely as a request for some service.
The kernel frees the pending hunt signal if the calling process dies.
Include files #include "ose.h"
Parameters name A pointer to the specified process name.
user The user number.
name_ The ID of the found process.
hunt_sig A pointer to the hunt signal buffer if specified.
Return value The name_ parameter, if present, is updated with the found process ID. This guaranteed to be invalid if the process was not immediately found.
The call returns zero if the process could not be found immediately. If a hunsignal was given by the caller, it is stored in the kernel until a matching procappears at a later time.
Returns a non-zero value if the process was found immediately. Any hunt siprovided is returned to the caller.
The returned value is further subdivided to indicate the scope of the found process. This is important only to link handlers when propagating hunt reque
If the hunt call returns 1, then the found process is "public", meaning that acto it is not restricted to any particular process. If the hunt call returns 2, then the found process is "private", meaning that acis restricted to the client process that hunted for it. This restriction is not enfoby the kernel, but a link handler is assumed to delete the private process wheclient terminates.
Restrictions The kernel may reallocate the space occupied by the hunt signal. Thus, the pto the hunt signal is not valid following the call to hunt.
The hunt call is not available to interrupt processes.
See also attach, detach, assign_linkhandler
Implementation Not implemented at level A. Full performance from level B.levels
Example
#include "ose.h"
nual / R1.0.4 OSE / Kernel - 3 : 69
Reference Mahunt
Ker
nel
#define SIXTH 6 /* These declarations */struct Sixth /* are preferably made */{ /* in a .sig-file which */
SIGSELECT sig_no; /* is included. */};
static const SIGSELECT any_sig[] = {0};extern PROCESS huntproc_;
union SIGNAL{
SIGSELECT sig_no;struct Sixth sixth;
};
OS_PROCESS(my_process){
OSBOOLEAN check;union SIGNAL *huntsignal;
for(;;){
/* Code */huntsignal = alloc(sizeof(struct sixth), SIXTH);check = hunt("proc", 0, &huntproc_, &huntsignal);if(check){
huntsignal = receive((SIGSELECT *) any_sig);free_buf(&huntsignal);
}/* Code */
}}
nual / R1.0.4 OSE / Kernel - 3 : 70
Reference Mahunt_from
Ker
nel
re.
r the by the
me new
lient.
from
ss
hunt_from
Syntax OSBOOLEAN hunt_from (char *name,
OSUSER user,
PROCESS *name_,
union SIGNAL **hunt_sig,
PROCESS from);
Description This is a system call intended mainly for link handlers and other network software. You should not require this call unless you are writing such softwa
Hunt_from does what hunt does, except that access rights are evaluated foprocess specified in the from parameter (usually a phantom process created caller).
This makes a true difference only if hunt causes a remote system call to soother link handler, and that link handler uses the hunt remote call to register clients.
In this case the other link handler should register the from parameter as a cResponse to the remote call must be sent to the caller (= sender(rem_call_sig)) as always.
A user parameter set to zero implies the user number of the process in theparameter.
The optional hunt signal is eventually returned to the caller, not to the procespecified in the from field.
The kernel frees the pending hunt signal if the calling process dies or if theprocess specified in the from field dies.
Include files #include "ose.h"
Parameters name A pointer to the specified process name.
user The user number.
name_ The ID of the found process.
hunt_sig A pointer to the hunt signal buffer if specified.
from The ID of the process specified as hunter.
Return value See the hunt system call.
Restriction See the hunt system call.
See also hunt, attach, detach, assign_linkhandler
Implementation Not implemented at level A. Full performance from level B.levels
Example
#include "ose.h"
#define FIRST 1 /* These declarations */struct First /* are preferably made */{ /* in a .sig-file which */
SIGSELECT sig_no; /* is included. */
nual / R1.0.4 OSE / Kernel - 3 : 71
Reference Mahunt_from
Ker
nel
};
union SIGNAL{
SIGSELECT sig_no;struct Firsth first;
};
static SIGSELECT sig_sel[] = {0};extern PROCESS proc_;OSENTRYPOINT phant;
OS_PROCESS(my_linkhandler){
union SIGNAL *sig;PROCESS phantom_;union SIGNAL *huntsig;struct OS_redir_entry redir_table[1];redir_table[0].sig = (SIGSELECT) 1;redir_table[0].pid = current_process();
for(;;){
sig = receive((SIGSELECT *) sig_sel);switch(sig->remote_call.call_type){
case REM_HUNT:sig->sig_no=REMOTE_RESPONSE;sig->remote_response.results.remr_hunt.found=1;phantom_ = create_process(OS_PHANTOM,
"proc", phant, 0, 0,
(OSTIME) 0,(PROCESS) 0,&redir_table,(OSVECTOR) 0,(OSUSER) 0);
sig->remote_response.results.remr_hunt.pid = phantom_;send(&sig, sender(&sig));huntsig = alloc(sizeof(struct first), FIRST);hunt_from("linkhandler2",
0,&proc_,&huntsig,current_process());
break;}
}}
nual / R1.0.4 OSE / Kernel - 3 : 72
Reference Maintercept
Ker
nel
cess
ed out
ith
d. t be
it is mer-el
intercept
Syntax void intercept (PROCESS pid);
Description This system call is mainly used by debuggers. The intercept call stops a proas if a breakpoint was reached.
Status for the specified process or for all processes in the specified block ischanged to intercepted. This means that processes are permanently swappuntil allowed to continue with the resume call.
If any breakpoints with a zero attribute are set in the processes, then thesebreakpoint signals are returned to their respective owners. Breakpoints set wnon-zero attributes are not affected.
There are no intercept counters in the system. Intercepting a process that isalready intercepted performs no operation.
Include files #include "ose.h"or#include "ose_i.h"
Parameters pid The ID of the specified block or process.
Return value None.
Restrictions Only prioritized, background and timer-interrupt processes can be intercepteThe intercept and resume calls have no effect on process types that can nointercepted.
Intercept may also be called from interrupt and timer-interrupt processes, butan error to cause a remote system call while doing so, i.e. an interrupt or tiinterrupt process may not intercept a process in another CPU, and the kernignores any attempt to do so.
See also resume, set_bp, clear_bp, get_pcb, alloc
Implementation Not implemented at levels A and B. Full performance from levelslevel C.
Example
#include "ose.h"
#define FIRST 1 /* These declarations */struct First /* are preferably made */{ /* in a .sig-file which */
SIGSELECT sig_no; /* is included. */};
static const SIGSELECT any_sig[] = {1,FIRST};extern PROCESS proc_;
union SIGNAL{
SIGSELECT sig_no;struct First first;
};
nual / R1.0.4 OSE / Kernel - 3 : 73
Reference Maintercept
Ker
nel
OS_PROCESS(my_process){
union SIGNAL *trapsignal;
for(;;){
trapsignal = alloc(sizeof(struct first), FIRST);set_bp(proc_, (OSADDRESS) function, (OSADDRESS) 0,
&trapsignal);intercept(proc_);trapsignal = receive_w_tmo(0, (SIGSELECT *) any_sig);if(trapsignal){
free_buf(&trapsignal);}/* Code */resume(proc_);
}}
nual / R1.0.4 OSE / Kernel - 3 : 74
Reference Makill_proc
Ker
nel
re .
is
last ve.
ts are
s etc, that
n all
MS ent uses
rt of on. ost E r
stem turns
rned.
ces.
me.
kill_proc
Syntax void kill_proc (PROCESS pid);
Description Kill a process or a block or segment.
If a block is specified, then all processes known to the caller in that block akilled. If there are no processes left, the block descriptor is then deleted too
(If the caller can see only some processes, then only those are killed. Thissufficient for the block to disappear for the caller.)
If a single process is specified, then that process only is killed, unless it is theprocess in a block, in which case the block is deleted too, as described abo
In any case, all signals attached to killed processes and blocks and segmeneventually returned to their respective owners.
If a killed process owns other blocks, signal buffers, semaphores, hunt signalthese are returned to the system. If a killed process was a link handler, theninformation is deleted from the kernel lists.
If a killed process was a remote system call server to some other blocks, thethose blocks are killed too.
The kill_proc system call can also be used by memory manager software, Mto kill a memory segment. A segment ID obtained from either the attach_segmsystem call or the get_segid system call can be passed to kill_proc, which cadeletion of all processes and blocks in the memory segment.
Include files #include "ose.h"
Parameters pid The ID of the specified block, process or segment.
Return value None.
Restrictions Killing a static process is allowed by the kernel only when the process is paa separately linked software unit (program), otherwise it is an illegal operatiKilling a static process causes the software unit (program) to terminate in mimplementations. This behaviour is achieved by interactions between the OSinterface library and user-provided memory management and program loadesoftware. Other rules may apply as desired for each system.
When the kill_proc system call is executed, the kernel removes the affectedprocess(es) and blocks from system tables and invokes the lower priority sydaemon to return attached signals and clean up at a later time. Kill_proc reto the caller before this work begins. This has some important implications:
1. A significant amount of time may elapse before attached signals are retu
2. Excessive process creation and destruction may exhaust system resour
3. When a remote call server is killed, served blocks disappear at a later ti
The kill_proc call is not available to interrupt processes.
See also create_block, create_process, attach_segment, attach
Implementation Not implemented at level A. Full performance from level B.levels
nual / R1.0.4 OSE / Kernel - 3 : 75
Reference Makill_proc
Ker
nel
Example
#include "ose.h"
OSENTRYPOINT new_process;OS_PROCESS(my_process){
PROCESS proc_;
for(;;){
proc_ = create_process(OS_PRI_PROC, "process", new_process, 200, 16, (OSTIME) 0, (PROCESS) 0, (struct OS_redir_entry *) NULL, (OSVECTOR) 0, (OSUSER) 0);
/* Code */kill_proc(proc_);
}}
nual / R1.0.4 OSE / Kernel - 3 : 76
Reference Makill_sem
Ker
nel
kill_sem
Syntax void kill_sem (SEMAPHORE *sem);
Description Return a semaphore created by create_sem to the pool.
Include files #include "ose.h"
Parameters sem A pointer to the semaphore.
Return value None.
Restrictions Make sure no process is using the semaphore when it is killed.
Never kill a statically declared semaphore structure by calling kill_sem. (A statically declared semaphore is initialised at declaration).
The kill_sem call is not available to interrupt processes.
See also create_sem, signal_sem, wait_sem, get_sem
Implementation Not implemented at level A. Full performance from level B.levels
Example
#include "ose.h"
OS_PROCESS(my_process){
SEMAPHORE *sem;
for(;;){
/* Code */sem = create_sem(1);/* Code */kill_sem(sem);
}}
nual / R1.0.4 OSE / Kernel - 3 : 77
Reference Mamem_move
Ker
nel
user
ent
uires
of ith
t
sued be
lock
ro).
mem_move
Syntax OSBOOLEAN mem_move (OSSEGMENT src_segment,
OSADDRESS src_begin,
OSADDRESS size,
OSSEGMENT dest_segment,
OSADDRESS dest_begin);
Description This is a call from the kernel to the memory manager block. It is thus not a system call.
The kernel requires a block of memory to be copied from one memory segmto another. The MMU software performs this operation.
The mem_move function may use system calls as if it was called from a prioritized superuser process. It is called in the context of the process that reqthe operation, so mem_move can be simultaneously executed by several processes, and the calling process may be killed at any time.
Any alloc calls issued by the mem_move function refer to the system pool, regardless of the pool attached to the calling process.
The user ID of the calling process is temporarily set to zero for the durationthe mem_move call. This allows the mem_move function to communicate wsystem processes normally invisible to the calling process.
The mem_move function should use set_segment calls to temporarily selecsegments while copying. When copying is complete, the home segment is reselected with a final set_segment call. Note that each set_segment call ismay indicate that the segment has been killed, in which case copying must aborted.
Include files #include "ose_mmu.h"
Parameters src_segment
src_begin
size
dest_segment
dest_begin
Return value Returns a non-zero value if an error occurred. Either the specified process/bcould not be found, or the requested size could not be transferred.
Restrictions The mem_move function itself must reside in supervisor space (segment ze
See also set_segment, select_segment, set_segment_mode, attach_segment
Implementation Not implemented at levels A, B and C. Full performance at levels level D.
nual / R1.0.4 OSE / Kernel - 3 : 78
Reference Mapower_fail
Ker
nel
at a ers) call.
user-hen
ines y led d out
. Use
sible wn.
inst
MI
what
is
oing
power_fail
Syntax void power_fail (void);
Description Shuts down the system in a manner which enables immediate continuation subsequent restart. When power reappears, the calling process (and all othappears to be continuing where it left off at the time of the power_fail system
The call to power_fail causes the current process to be swapped out, and awritten power fail handler is called to save memory contents and i/o status. Wthis is complete, the handler should shut down the CPU.
If power_fail is called from an interrupt process, then the system shutdown procedure is deferred until execution returns to a non-interrupt level.
When the system restarts, the kernel calls a power on handler which determif memory and i/o can be restored. If this is the case, the kernel immediatelswaps in the process that called power_fail, unless an interrupt process calpower_fail, in which case the kernel swaps in the process that was swappewhen the interrupt process was called. Otherwise an ordinary cold start is performed.
Include files #include "ose.h"or#include "ose_i.h"
Parameters None.
Return value None.
Restrictions This system call may only be used by a superuser process (user number 0)of the power_fail system call requires careful system planning since many hardware problems must be correctly addressed. In particular, it must be posto reinitialize all i/o devices to the exact state that was present at the shutdoHints:
• A good memory backup power system is required, including protection agaspurious memory cycles during periods of unstable power.
• A reliable power fail interrupt is needed. This interrupt should not be an Nsince non-maskable interrupts can not communicate with the kernel.
• A watchdog timer is needed since memory backup designs may be someunreliable.
• It is a good idea to have hardware support for determining if a cold start required.
• Software should be planned in a way that promotes saving the i/o state. Dthis correctly is an art.
Implementation Not implemented at level A. Full performance from level B.levels
Example
#include "ose.h"
nual / R1.0.4 OSE / Kernel - 3 : 79
Reference Mapower_fail
Ker
nel
OS_PROCESS(my_process){
for(;;){
/* Code */power_fail();/* Code, This is where the system starts again at * power up if a warm start */
}}
nual / R1.0.4 OSE / Kernel - 3 : 80
Reference Mareceive
Ker
nel
not the
gnal
ws.
rns eue,
upt
first those
per
aller
receive
Syntax union SIGNAL * receive (SIGSELECT *sigsel);
Description Receives a signal from the caller's signal queue. If an appropriate signal is immediately available, the caller pends until an appropriate signal is sent tocaller by some other process.
Sigsel points to an array containing a list of signal numbers to be received. Receive returns to the caller when a signal matching any of the specified sinumbers is found.
The first position in sigsel contains the number of entries in the list that follo
If the number of entries is zero, any signal number is accepted.
When called from an interrupt or timer-interrupt process, receive always retuimmediately. If no requested signal was immediately available in the signal quNIL is returned. This works in a manner similar to receive_w_tmo with a 0 timeout. (Note that receive_w_tmo is not available to interrupt and timer-interrprocesses.)
A "negative receive specification" feature is supported. This means that if the location of the sigsel array contains a negative count, then any signal except that match the sigsel array is received. This feature effectively inverts the semantics of the receive, receive_w_tmo and receive_from calls, providing ameans of holding back certain signals.
The SIGSELECT type is an unsigned type, so using a negative receive specification requires the count in the sigsel array to be initialized with a procast expression.
Include files #include "ose.h"or#include "ose_i.h"
Parameters sigsel Pointer to an array of the signal numbers to receive.
Return value Returns a pointer to the received signal buffer. This buffer is owned by the cfrom that moment.
Restrictions None.
See also send, send_w_s, receive_w_tmo, receive_from, alloc, free_buf, sender, sigsize, addressee
Implementation Full performance at all implementation levels.levels
Example
#include "ose.h"
#define THIRD 3 /* These declarations */struct Third /* are preferably made */{ /* in a .sig-file which*/
SIGSELECT sig_no; /* is included. */};
nual / R1.0.4 OSE / Kernel - 3 : 81
Reference Mareceive
Ker
nel
#define FIFTH 5 /* These declarations */struct Fifth /* are preferably made */{ /* in a .sig-file which*/
SIGSELECT sig_no; /* is included. */};
union SIGNAL /* A union SIGNAL declaration */{ /* must include a signal */
/* number and the signal */SIGSELECT sig_no; /* structures of the signals */ struct Third third; /* that will be used. It must */ struct Fifth fifth; /* be present in every */
/* application using signals */};
static const SIGSELECT any_sig[] = {0};
OS_PROCESS(my_process){
union SIGNAL *sig;
for(;;){
sig = receive((SIGSELECT *) any_sig);switch(sig->sig_no){
case THIRD:/* Code */break;
case FIFTH:/* Code */break;
default:/* Code */
}free_buf(&sig);
}}
nual / R1.0.4 OSE / Kernel - 3 : 82
Reference Mareceive_from
Ker
nel
ess.
ions fine
can
l
red,
receive_from
Syntax union SIGNAL * receive_from (OSTIME timeout,
SIGSELECT *sel,
PROCESS from);
Description Works like receive_w_tmo, but signals are only accepted from a specific proc
This call is used, for instance, in interface libraries which hide signal transacttowards a server process from a user. In this case it must be possible to designals to the server without conflicts with user signal numbers.
The receive_from call should be used with some caution since extensive useeasily cause a messy system design and lead to debugging problems.
Include files #include "ose.h"
Parameters timeout The number of milliseconds to wait.
sel Pointer to an array of the signal numbers to receive.
from The ID of the process to receive from.
Return value Returns a pointer to the received signal buffer or the NIL pointer if no signaarrived within the specified timeout.
Restrictions There is no way to issue receive_from without a timeout. If no timeout is requia loop can be used without causing much overhead.
For example:
while(NIL == (sig = receive_from((OSTIME)-1, ...)));
The receive_from call is not available to interrupt processes.
See also alloc, free_buf, addressee, send, send_w_s, receive, receive_w_tmo
Implementation Not implemented at level A. Full performance from level B.levels
Example
#include "ose.h"
#define FIRST 1 /* These declarations */struct First /* are preferably made */{ /* in a .sig-file which */
SIGSELECT sig_no; /* is included. */};
#define THIRD 3 /* These declarations */struct Third /* are preferably made */{ /* in a .sig-file which */
SIGSELECT sig_no; /* is included. */};
union SIGNAL{
SIGSELECT sig_no;struct First first;struct Third third;
};
nual / R1.0.4 OSE / Kernel - 3 : 83
Reference Mareceive_from
Ker
nel
static const SIGSELECT any_sig[] = {0};static const SIGSELECT sig_one[] = {1, FIRST};extern PROCESS sending_proc_;extern PROCESS sending_proc2_;
OS_PROCESS(my_process){
union SIGNAL *sig;
for(;;){
sig = receive_from(10, (SIGSELECT *) any_sig, sending_proc_);
if(sig != NIL){
if(sig->sig_no == THIRD){
free_buf(&sig);sig = receive_from(55,
(SIGSELECT *) sig_one, sending_proc2_);
if(sig != NIL){
/* Code */free_buf(&sig);
}}else{
/* Code */free_buf(&sig);
}else{
/* Code */}
}}
nual / R1.0.4 OSE / Kernel - 3 : 84
Reference Mareceive_w_tmo
Ker
nel
ut
s
stem
st d
rter
l
receive_w_tmo
Syntax union SIGNAL * receive_w_tmo (OSTIME timeout,
SIGSELECT *sel);
Description Short for receive with timeout. Works like receive, except that the caller is suspended no longer than the number of milliseconds specified in the timeoparameter.
If the requested signal has not arrived by then, the NIL pointer is returned.
The specified timeout period is converted to a number of actual system tickaccording to the following rules:
A value of zero returns immediately.
A value equal to or smaller than one system tick period returns at the next sytimer event, i.e. after anything between 0 and 1 system tick.
A value higher than one system tick period is rounded upwards to the closenumber of system ticks. The actual delay may varies between the calculatenumber of ticks and this value less 1 tick period.
The result is that the actual delay may be up to one system tick period shothan specified.
Include files #include "ose.h"
Parameters timeout The number of milliseconds to wait.
sel A pointer to an array of the signal numbers to receive.
Return value Returns a pointer to the received signal buffer or the NIL pointer if no signaarrived within the specified timeout.
Restrictions The receive_w_tmo call is not available to interrupt processes.
See also alloc, addressee, free_buf, send, sender, send_w_s, receive, receive_from
Implementation Full performance at all implementation levels.levels
Example
#include "ose.h"
static const SIGSELECT any_sig[] = {0};
union SIGNAL{
SIGSELECT sig_no;};
OS_PROCESS(my_process){
union SIGNAL *sig;
for(;;){
/* Wait for any signal in 10 ms time */ sig = receive_w_tmo((OSTIME) 10, any_sig);/* Check if a signal was received. If no signal was
nual / R1.0.4 OSE / Kernel - 3 : 85
Reference Mareceive_w_tmo
Ker
nel
* received in 10 ms time the receive_w_tmo() sys * call will return NIL. */if (sig != NIL){
/* Code */free_buf(&sig);
}else{
/* Code */}
}}
nual / R1.0.4 OSE / Kernel - 3 : 86
Reference Marestore
Ker
nel
e ress freed
oper ns
illed, uses crash.
restore
Syntax void restore (union SIGNAL *sig);
Description Registers the caller as the current owner of a signal buffer and clears bufferredirection information from it. Use this call if:
1. A redirected buffer is to be reused without reallocation or
2. A buffer has been illegally transferred from one process to another.
The restore call should only be needed on rare occasions.
Include files #include "ose.h"or#include "ose_i.h"
Parameters sig A pointer to the specified signal buffer.
Return value None.
Restrictions Caution! This call has an unusual parameter syntax. In systems with multipladdress space, it is an error to restore a buffer that is not in the callers addspace. Some old OSE implementations do not allow a redirected buffer to be without restoring it. New implementations should avoid this problem.
If a killed process is part of a design which passes buffers around without prownership control, then the following problem may arise: the killed process owa buffer which is currently in use by some other process. Once the owner is kthe buffer is returned to the pool without the knowledge of the process which the buffer. If that process chooses to send or free the buffer, the system may Summary: If you use kill_proc extensively, never transfer buffers between processes without using one of the send system calls.
See also alloc, free_buf, send
Implementation Full performance at all implementation levels.levels
Example
#include "ose.h"
static const SIGSELECT any_sig[] = {0};
union SIGNAL{
SIGSELECT sig_no;};
OS_PROCESS(my_linkhandler){
union SIGNAL *sig;
for(;;){
/* Code */sig = receive((SIGSELECT *) any_sig);if(addressee(&sig) != current_process()){
nual / R1.0.4 OSE / Kernel - 3 : 87
Reference Marestore
Ker
nel
restore(sig);/* Code */
}free_buf(&sig);
}}
nual / R1.0.4 OSE / Kernel - 3 : 88
Reference Maresume
Ker
nel
r by
block on as
ith
not
d. t be
t it is mer-l
resume
Syntax void resume (PROCESS pid);
Description This system call is mainly used by debuggers.
The resume call starts processes previously stopped with the intercept call oa breakpoint.
Intercept status for the specified process or for all processes in the specified is removed. This means that the process(es) are allowed to continue operatiimplied by the state present before they were intercepted.
If any breakpoints with a zero attribute are set in the processes, then thesebreakpoint signals are returned to their respective owners. Breakpoints set wnon-zero attributes are not affected.
There are no intercept counters in the system. Resuming a process that is intercepted performs no operation.
Include files #include "ose.h"or#include "ose_i.h"
Parameters pid The ID of the specified process.
Return value None.
Restrictions Only prioritized, background and timer-interrupt processes can be intercepteThe intercept and resume calls have no effect on process types that can nointercepted.
Resume may also be called from interrupt and timer-interrupt processes, buan error to cause a remote system call while doing so, i.e. an interrupt or tiinterrupt process may not resume a process in another CPU, and the kerneignores any attempt to do so.
See also intercept, set_bp, clear_bp, get_pcb
Implementation Not implemented at levels A and B. Full performance from levels. level C.
Example
#include "ose.h"
#define FIFTH 5 /* These declarations */struct Fifth /* are preferably made */{ /* in a .sig-file which */
SIGSELECT sig_no; /* is included. */};
union SIGNAL{
SIGSELECT sig_no;struct Fifth fifth;
};static const SIGSELECT any_sig[] = {0};extern PROCESS proc_;void function(void);
nual / R1.0.4 OSE / Kernel - 3 : 89
Reference Maresume
Ker
nel
OS_PROCESS(my_process){
union SIGNAL *trapsignal;
for(;;){
trapsignal = alloc(sizeof(struct fifth), FIFTH);set_bp(proc_, (OSADDRESS) function,0,&trapsignal);trapsignal = receive((SIGSELECT *) any_sig);switch(trapsignal->sig_no){
case FIFTH:resume(proc_);/* Code */break;
default:/* Code */
}}
}
nual / R1.0.4 OSE / Kernel - 3 : 90
Reference Maselect_segmen
Ker
nel
not
in a re the
ent
y the
d that
nt
ery
select_segment
Syntax void select_segment (OSSEGMENT segnum);
Description This is a call from the kernel to the memory manager block and is thereforea user system call.
The select_segment function is called by the OSE dispatcher when it swapsuser mode process and requires the MMU to select the address space wheprocess is located.
The select_segment function may also be called in response to a set_segmsystem call issued from memory management software.
Include files #include "ose_mmu.h"
Parameters segnum
Return value None.
Restrictions The select_segment function is called both in the context of a process and bdispatcher in a state when no process is in context. This means that the select_segment function may be called concurrently by several processes, anthe calling process can be killed at any time unless interrupts are disabled.
Some implementations disable interrupts during dispatcher calls to select_segment, so interrupt status must be preserved by the select_segmefunction.
It is important that the code is efficient since select_segment is called for evprocess switch. No system calls may be used by select_segment.
Implementation Not implemented at levels A and B. Full performance from levels level C.
nual / R1.0.4 OSE / Kernel - 3 : 91t
Reference Masend
Ker
nel
the
atches
tes
r will
ing
inal the tion
both
with y
send
Syntax void send (union SIGNAL **sig, PROCESS to);
Description Sends a signal buffer to a specified addressee process and enters NIL into caller's signal pointer to avoid accidental reuse of the buffer.
The calling process is no longer the owner of the signal.
Signals are redirected if the addressee process has a redirection table that mthe sent signal.
(The signal is not redirected if the redirection table chain is infinite or indicathat the signal should be sent to the caller.)
If the addressee process has terminated, the signal is quietly killed. The callenever know.
Include files #include "ose.h"or#include "ose_i.h"
Parameters sig A pointer to the signal buffer.
to The ID of the process the signal will be sent to.
Return value None.
Restrictions A sender process can only reach the addressee if at least one of the followconditions is true.
1. The sender is a superuser process, i.e it has user number 0.
2. The sender and addressee processes have the same user number.
3. The sender and addressee processes are part of the same block.
These rules are re-evaluated for each hop in the redirection chain, i.e. the faddressee may not be known to the calling process. (The calling process is"sender" for the first hop. For subsequent hops, the process with the redirectable is considered "sender" when the rules are re-evaluated.)
Interrupt processes and timer-interrupt processes may exchange signals (indirections) only with processes that are part of the same block.
Interrupt processes and timer-interrupt processes may not exchange signalsother interrupt or timer-interrupt processes. Some OSE implementations marelax this restriction if the hardware architecture allows this.
See also send_w_s, receive, receive_w_tmo, receive_from
Implementation Full performance at all implementation levels.levels
Example
#include "ose.h"
#define FORTH 4 /* These declarations */struct forth /* are preferably made */{ /* in a .sig-file which */
SIGSELECT sig_no; /* is included. */
nual / R1.0.4 OSE / Kernel - 3 : 92
Reference Masend
Ker
nel
char data;};
extern PROCESS proc_;
union SIGNAL{
SIGSELECT sig_no;struct Forth forth;
};
OS_PROCESS(my_process){
union SIGNAL *sig;
for(;;){
sig = alloc(sizeof(struct forth), FORTH);sig->forth.data =’x’;send(&sig,proc_);/* Code */
}}
nual / R1.0.4 OSE / Kernel - 3 : 93
Reference Masender
Ker
nel
r sent.
s.
sender
Syntax PROCESS sender (union SIGNAL **sig);
Description Finds the process which last sent a specified signal buffer.
Include files #include "ose.h"or#include "ose_i.h"
Parameters sig A pointer to the signal buffer.
Return value Returns the process ID of the sender or the owner's ID if the signal was neve
The sender is not affected by signal redirection, i.e the sender is always theprocess which called send or the process ID that was specified in send_w_
Restrictions None.
See also addressee, restore, send, send_w_s
Implementation Full performance at all implementation levels.levels
Example
#include "ose.h"
static const SIGSELECT any_sig[] = {0};
union SIGNAL{
SIGSELECT sig_no;};
OS_PROCESS(my_process){
union SIGNAL *sig;
for(;;){
sig = receive((SIGSELECT *) any_sig);/* Code */send(&sig, sender(&sig));
}}
nual / R1.0.4 OSE / Kernel - 3 : 94
Reference Masend_w_s
Ker
nel
gged
signal
send_w_s
Syntax void send_w_s (union SIGNAL **sig,
PROCESS from,
PROCESS to);
Description Short for send with sender. Works like send, except that the signal buffer is tawith the specified process ID in place of the caller's.
If the addressee process or the specified sender process has terminated, theis quietly killed. The caller will never know.
Include files #include "ose.h"or#include "ose_i.h"
Parameters sig A pointer to the signal buffer.
from The ID of the process specified as sender.
to The ID of the process the signal will be sent to.
Return value None.
Restrictions See send
See also send, receive, receive_w_tmo, receive_from
Implementation Not implemented at level A. Full performance from level B.levels
Example
#include "ose.h"
#define FIFTH 5 /* These declarations */struct fifth /* are preferably made */{ /* in a .sig-file which */
SIGSELECT sig_no; /* is included. */};
extern PROCESS proc1_;extern PROCESS proc2_;
union SIGNAL{
SIGSELECT sig_no;};
OS_PROCESS(my_process){
union SIGNAL *sig;
for(;;){
sig = alloc(sizeof(struct fifth), FIFTH);/* send a signal to proc2 specifying proc1 as sender */send_w_s(&sig, proc1_, proc2_);/* Code */
}}
nual / R1.0.4 OSE / Kernel - 3 : 95
Reference Maset_bp
Ker
nel
the hed.
trip
gain
aller. new
ed.
ese sed
t is l is n for ignal t_pcb ase
ar_bp
at ocess t be
ill . Bit type.
s
set_bp
Syntax OSBOOLEAN set_bp (PROCESS pid,
OSADDRESS address,
OSADDRESS attribute,
union SIGNAL **trapsig);
Description This is a debugger system call.
Set_bp sets a breakpoint in a block or in a process.
Setting a breakpoint in a block means that any process in the block can tripbreakpoint and all processes will be intercepted when the breakpoint is reac
Setting a breakpoint in a process means that only the specified process canthe breakpoint and only that process will be intercepted.
A breakpoint is removed when it is reached, i.e. the breakpoint must be set awith another set_bp call if it is still needed.
When a breakpoint is reached, the specified trap signal is sent back to the cThe caller must then free that signal. (The signal may have been copied to asignal buffer by the kernel.)
If a process or block is killed, breakpoints set in the process/block are clearTrap signals are freed by the kernel.
The breakpoint attribute contains CPU-dependent breakpoint modifier bits. Thare set in combinations to specify various CPU cycles and the like. Bits not ushould be cleared.
Only a few attribute bits/values are well defined:
1. All bits = 0, which identifies a software testpoint. No hardware breakpoinactually set and the breakpoint can thus not be reached. The trap signareturned to the owner whenever intercept status changes in either directiothe specified process or for any process in the specified block. The trap sis returned regardless of which event caused the status change. The gecall can be used to obtain further information. The address field is in this cused only as a breakpoint ID which serves a purpose in a subsequent clecall. The address is otherwise not used by the kernel.
2. Bit 0 selects a pre or post breakpoint. Bit 0=0 means that the process thcauses the break will stop at the set address. Bit 0=1 means that the prwill stop one machine instruction beyond the set address. This bit may novalid unless bit 1=1.
3. Bit 1 selects simple execution breakpoints. Bit 1=1 means that a break woccur when the process executes an instruction at the specified address1=0 means that the bit is ignored and other bits determine the breakpoint
Other bits depend on the implementation.
Include files #include "ose.h"
Parameters pid The ID of the block or process for which the breakpoint iset.
nual / R1.0.4 OSE / Kernel - 3 : 96
Reference Maset_bp
Ker
nel
nts ported.
This may ed
ointer
address The address where the breakpoint is to be set.
attribute CPU-dependent modifier bits.
trapsig A pointer to the signal buffer returned.
Return value Returns a non-zero value if the breakpoint could not be set.
This occurs when either too many breakpoints were set or several breakpoiwere set at the same address or the attribute contains a value that is not sup
In case of error, the trap signal is immediately freed by the kernel.
Restrictions Only one breakpoint may be set at each address within a memory segment.is because the address is also used as the breakpoint ID. Implementations find various ways to relax this restriction, but conflicts that can not be handlare reported to the caller.
Breakpoints may not be set in an interrupt or timer-interrupt process.
The kernel may reallocate the space occupied by the trap signal. Thus, the pto the trap signal is not valid following the call to set_bp.
The set_bp call is not available to interrupt processes.
See also clear_bp, intercept, resume, get_pcb
Implementation Not implemented at levels A and B. Full performance from levels level C. Several aspects of hardware breakpoints are
implementation-specific. They depend on what is possible in the specific processor architecture and target hardware. Only attribute = zero must always be supported.
Example
#include "ose.h"
#define SIXTH 6 /* These declarations */struct Sixth /* are preferably made */{ /* in a .sig-file which */
SIGSELECT sig_no; /* is included. */};
static const SIGSELECT six[] = {1, SIXTH};extern PROCESS proc_;void function(void);
union SIGNAL{
SIGSELECT sig_no;struct Sixth sixth;
};
OS_PROCESS(my_process){
union SIGNAL *trapsignal;
for(;;){
trapsignal = alloc(sizeof(struct sixth), SIXTH);set_bp(proc_,
nual / R1.0.4 OSE / Kernel - 3 : 97
Reference Maset_bp
Ker
nel
(OSADDRESS) function, (OSADDRESS) 2, &trapsignal);
trapsignal = receive((SIGSELECT *)six);/* Code */free_buf(&trapsignal);
}}
nual / R1.0.4 OSE / Kernel - 3 : 98
Reference Maset_env
Ker
nel
lock.
the
ss or
ffer,
set_env
Syntax OSBOOLEAN set_env ( PROCESS pid,
char *name,
char *value);
Description Create, update or delete an environment string for the specified process or b
The environment variable specified by name is set to the value specified in value parameter. A value set to NULL removes the variable
Include files #include "ose.h"
Parameters pid The ID of the specified block or process.
name A pointer to the enviroment variable name.
value A pointer to the value.
Return value Returns a non-zero value if out of environment space for the specified proceblock.
Restrictions If the specified name or value is longer than the maximum size of a signal buthen the environment variable is not set.
The set_env call is not available to interrupt processes.
See also get_env_list, get_env, get_envp, set_envp
Implementation Not implemented at level A. Full performance from level B.levels
Example
#include "ose.h"
extern PROCESS proc_;
OS_PROCESS(my_process){
for(;;){
set_env(current_process(), "appvar", "xyz21");set_env(proc_, "number", "2000");/* Code */
}}
nual / R1.0.4 OSE / Kernel - 3 : 99
Reference Maset_envp
Ker
nel
e with
e
ent
does
ad.
the
set_envp
Syntax OSBOOLEAN set_envp ( PROCESS pid,
char *name,
OSADDRESS value);
Description This system call stores a 32 bit pointer in a named environment variable. Thvalue is stored in a special (mangled) format so that it can be efficiently read the get_envp call.
Variables set with the set_envp call can be read with the get_env call, but thstring returned is not easily interpreted.
Include files #include "ose.h"
Parameters pid The ID of the specified block or process. Setting the pid parameter to zero is equivalent to using the pid of the currprocess.
name A pointer to the enviroment variable name.
value A pointer to the value.
Return value Returns a non zero value if the call was successful. Returns zero if the kernelnot support the call or if the call failed due to an ignored error report.
Restrictions Setting a variable to zero is less useful as that value can not be properly re
If the specified name is longer than the maximum size of a signal buffer, thenenvironment variable is not set.
The set_envp call is not available to interrupt processes.
See also get_env, get_env_list, get_envp, set_env
Implementation All OSE implementations might not have this system call.levels
Example
#include "ose.h"
OS_PROCESS(my_process){
int prod_data = 0xCAFE;OSADDRESS pa;
for(;;){
set_envp(0, "pd", (OSADDRESS)&proc_data);pa = get_envp(0, "pd");if (pa != 0)
printf("pa = %d\n", *(int *)pa);/* Code */
}}
nual / R1.0.4 OSE / Kernel - 3 : 100
Reference Maset_fsem
Ker
nel
e.
d t
set_fsem
Syntax void set_fsem (OSFSEMVAL value, PROCESS pid);
Description Initializes a fast semaphore for subsequent use.
Include files #include "ose.h"
Parameters value The initial value.
pid The ID of the process for which to set the fast semaphor
Return value None.
Restrictions The fast semaphore may not be accessed in any way before it is initialized.
It is illegal to set a fast semaphore to a negative value.
Some OSE implementations behave badly if a fast semaphore is reinitializewhile the owner is waiting for it. Portable code should avoid reinitializing fassemaphores.
The set_fsem call is not available to interrupt processes.
See also signal_fsem, wait_fsem, get_fsem
Implementation Not implemented at level A. Full performance from level B.levels
Example
#include "ose.h"
extern PROCESS proc_;
OS_PROCESS(my_process){
for(;;){
set_fsem((OSSEMVAL) 1, proc_);/* Code */
}}
nual / R1.0.4 OSE / Kernel - 3 : 101
Reference Maset_mem
Ker
nel
rs to
the
lock
other
set_mem
Syntax OSBOOLEAN set_mem (PROCESS pid,
void *from,
OSADDRESS to,
OSADDRESS size);
Description This call is mainly used by memory managers, program loaders and debuggeload and modify a program.
Writes a specified number of bytes from the address space of the caller to address space of the specified process or block.
Include files #include "ose.h"
Parameters pid The ID of the specified block or process.
from A pointer to the address to read from.
to The address to write to.
size The number of bytes to read.
Return value Returns a non-zero value if an error occurred. Either the specified process/bcould not be found, or the requested size could not be transferred.
Restrictions The caller must be aware of the problems that occur when a program on anCPU type is loaded or examined, in particular if that CPU has another wordlength. Link handler conventions should be developed to resolve this.
The set_mem call is not available to interrupt processes.
See also get_mem
Implementation Not implemented at levels A and B. Full performance from levels level C.
nual / R1.0.4 OSE / Kernel - 3 : 102
Reference Maset_pcb
Ker
nel
here
at cept
tate nized.
ister ceed ach
set_pcb
Syntax OSBOOLEAN set_pcb (PROCESS pid, char *cpuregs);
Description Sets the CPU registers of the specified process if the process is in a state wthis is possible. The set_pcb call is mainly used by debuggers.
Cpuregs contains a string describing the registers to be set. The string formcorresponds to the format used in the cpuregs string in the get_pcb call, exregisters may be in any order and not all registers need to be present.
Include files #include "ose.h"
Parameters pid The ID of the specified process.
cpuregs A pointer to a string describing the registers.
Return value Returns zero if the call was successful.
Returns a non-zero value if the call failed because the process is not in a swhere the CPU registers can be set, or the string was in a format not recog
Restrictions Works only for prioritized and background processes.
Implementations are often sensitive to the format of the cpuregs string. For example, in an assignment of a CPU register, the number of digits of the regvalue may be crucial for the success of the assignment: "PC=0" may not sucwhilst "PC=00000000" would. Take care not to violate the rules provided by eimplementation.
The set_pcb call is not available to interrupt processes.
See also get_pcb
Implementation Not implemented at levels A and B. Full performance from levels level C. The set_pcb call is useful only in kernels that provide
CPU registers per process.
Example
#include "ose.h"
extern PROCESS proc_;
OS_PROCESS(my_process){
for(;;){
/* Code */if( set_pcb(proc_, "A0 = 000037F5") ){
error(17);/* Set_pcb call was not successful */}/* Code */
}}
nual / R1.0.4 OSE / Kernel - 3 : 103
Reference Maset_pri
Ker
nel
ich iority
ss
s on
set_pri
Syntax OSPRIORITY set_pri (OSPRIORITY newpri);
Description Sets a new priority level for the calling process.
The calling process is moved to the tail of the ready list on the new priority, whmeans that the process is swapped out until all other processes with that prhave had an opportunity to execute.
The newpri parameter may be any priority level allowed in the create_procesystem call.
Include files #include "ose.h"
Parameters newpri The priority level to set.
Return value Returns the resulting priority. This is the old priority if the call failed.
Restrictions Works only for prioritized processes. Some implementations place restrictionhow priority levels may be used.
See also create_process, get_pri, set_pri_for
Implementation Not implemented at levels A and B. Full performance from levels level C.
Example
#include "ose.h"
OS_PROCESS(my_process){
OSPRIORITY org_prio;OSPRIORITY prio;
for(;;){
org_prio = get_pri(current_process());prio = set_pri(31);if(prio == org_prio && org_prio == 31){
/* Code, priority could not be set */}else {
/* Code *//* Reset the original priority */prio = set_pri(org_prio);
}}
}
nual / R1.0.4 OSE / Kernel - 3 : 104
Reference Maset_pri_for
Ker
nel
ty, that
ss
ified place
set_pri_for
Syntax OSPRIORITY set_pri_for (PROCESS pid, OSPRIORITY newpri);
Description Sets a new priority level for the specified process.
The specified process is moved to the tail of the ready list on the new prioriwhich means that the process is swapped out until all other processes withpriority have had an opportunity to execute.
The newpri parameter may be any priority level allowed in the create_procesystem call.
Include files #include "ose.h"
Parameters pid The ID of the specified process.
newpri The priority level to set.
Return value Returns the resulting priority. This is the old priority if the call failed.
Restrictions Works only for prioritized or background processes. The target process specwith the pid parameter must be a prioritized process. Some implementations restrictions on how priority levels may be used.
See also create_process, get_pri, set_pri
Implementation Not implemented at levels A and B. Full performance from levels level C.
Example
#include "ose.h"
OS_PROCESS(my_process){
OSPRIORITY org_prio;OSPRIORITY prio;
for(;;){
org_prio = get_pri(current_process());prio = set_pri_for(current_process(), 31);if(prio == org_prio){
/* Code, priority could not be set */}else {
/* Code *//* Reset the original priority */prio = set_pri(org_prio);
}}
}
nual / R1.0.4 OSE / Kernel - 3 : 105
Reference Maset_redirection
Ker
nel
nals The sent the
not t 1,
h the
ust
set_redirection
Syntax void set_redirection (PROCESS pid, struct OS_redir_entry *redir);
Description Replace the redirection table of a process.
The redir parameter is a pointer to a redirection table that describes how sigsent to the process pointed out by the pid parameter should be redirected. redirection table contains an array of signal/process pairs. When a signal isto the process, the redirection table is searched and if present in the table, signal is redirected to the process that should receive the signal.
The redirection table consists of an array of structures of type "struct OS_redir_entry", which is defined as:
struct OS_redir_entry{
SIGSELECT sig;PROCESS pid;
};
The first structure in the redirection table contains a count of the number ofentries in the table including the first entry, and a process ID to which signalsspecified in the redirection table should be sent. The count is always at leasand the default process ID may be set to zero to specify the process to wicredirection table is attached.
The kernel may or may not copy this table to kernel memory, so the user massume that the table can not be subsequently altered.
Include files #include "ose.h"
Parameters pid The ID of the specified process.
redir_table A pointer to the redirection table.
Return value None.
Restrictions The redirection table must be built in run-time since process identities are unknown at compile time.
The set_redirection call is not available to interrupt processes.
See also create_process
Implementation All OSE implementations might not have this system call.levels
nual / R1.0.4 OSE / Kernel - 3 : 106
Reference Maset_redirection
Ker
nel
Example
#include "ose.h"
#define REDIRECTED_SIG 0xCAFE
extern PROCESS proc_;
void redir_to_proc(void){
OS_redir_entry redir_tbl[2];
/* Set number of entries in the redir table */redir_tbl[0].sig = 2;
/* Set default addressee for signals not found in the redir table. * If we set this to zero we mean that the default addressee will * be set to the process pointed out by the pid parameter when * calling set_redirection(). */redir_tbl[0].pid = 0;
/* State that if REDIRECTED_SIG is sent it should be directed * to new_proc_ instead. */redir_tbl[1].sig = REDIRECTED_SIG;redir_tbl[1].pid = proc_;
/* Set the redirection table for the current process */set_redirection(current_process(), redir_tbl);
}
nual / R1.0.4 OSE / Kernel - 3 : 107
Reference Maset_segment
Ker
nel
MU, call.
al
an not
value,
ove n t with
if the
rvisor
set_segment
Syntax OSBOOLEAN set_segment (OSBOOLEAN go_home,
OSSEGMENT segnum);
Description This is a call from the memory manager block (MMU) to the kernel and is therefore not a user system call.
This call sets the effective segment number for the calling process.This ID is provided by the kernel in subsequent select_segment calls to the Mand a select_segment call is immediately issued from within the set_segment
The real segment ID, once set with attach_segment, is not affected. The resegment ID is always the "home" segment of the process.
The segment selected is locked to the calling process so that the segment cdisappear until another segment is set, or the process is killed.
The home segment is reselected by setting the go_home flag to a non-zero in which case the segnum parameter is ignored.
The intention is that the set_segment call should be used from within mem_mto temporarily select segments while performing intersegment copying. Whecopying is complete, the home segment is reselected by calling set_segmenthe go_home flag set.
Include files #include "ose.h"
Parameters go_home
segnum
Return value Set_segment returns non-zero if the segment does not exist, which occurs segment died before it could be locked by set_segment.
Restrictions The set_segment function can only be called by a process executing in supespace. The set_segment call is not available to interrupt processes.
See also mem_move, select_segment, attach_segment
Implementation Not implemented at levels A, B and C. Full performance at levels level D.
nual / R1.0.4 OSE / Kernel - 3 : 108
Reference Maset_segment_
Ker
nel
not
rity ake n as
he . This
om a , so es, but
and
set_segment_mode
Syntax OSBOOLEAN set_segment_mode (OSSEGMENT segnum,
OSBOOLEAN contains_int);
Description This is a call from the kernel to the memory manager block and is thereforea user system call.
If contains_int is non-zero:
The kernel tells the MMU that the specified segment contains at least one interrupt process, timer-interrupt process or a prioritized process with a priohigh enough to disallow paging/swapping.This means that the MMU must mthe entire memory segment resident. (Page faults are fatal if they occur in ainterrupt or timer-interrupt process.) The call must not return until memory hbeen made resident.
If contains_int is zero:
The kernel tells the MMU that all interrupt and timer-interrupt processes in tmemory segment have been killed, and paging/swapping may be re-enabledis the initial state assumed by the MMU software.
The set_segment_mode function may use system calls as if it was called frprioritized superuser process. It is called in the context of a system daemonthe set_segment function can be simultaneously executed by several processthe calling process can not be killed.
Any alloc calls issued by the attach_block function refer to the system pool, the caller is a superuser process.
Include files #include "ose_mmu.h"
Parameters segnum
contains_int
Return value Zero if ok, nonzero if out of ram.
Restrictions None.
See also attach_block, attach_segment, mem_move
Implementation Not implemented at levels A, B and C. Full performance levels from level D.
nual / R1.0.4 OSE / Kernel - 3 : 109mode
Reference Maset_sigsize
Ker
nel
lly than
e
set_sigsize
Syntax OSBOOLEAN set_sigsize (union SIGNAL **sig, OSBUFSIZE newsize);
Description This system call attempts to change the size of a signal buffer without actuareallocate and copy it. This can only be done if the requested size is smallerthe actual size of the buffer.
Include files #include "ose.h"or#include "ose_i.h"
Parameters sig A pointer to a pointer to a signal buffer.
newsize The requested new size of the buffer.
Return value Returns a non zero value if the operation was successful. Returns zero if thoperation failed.
Restrictions None.
See also alloc, sigsize
Implementation All OSE implementations might not have this system call.levels
Example
#include "ose.h"
static const SIGSELECT any_sig[] = {0};
union SIGNAL{
SIGSELECT sig_no;};
OS_PROCESS(my_process){
union SIGNAL *sig;union SIGNAL *sig2;OSBUFSIZE size;
for(;;){
sig = receive((SIGSELECT *) any_sig);if (set_sigsize(&sig, sigsize(&sig) + 4)){
/* Successfully enlarged the signal */}else{
/* Could not enlarge the signal */}/* Code */
}}
nual / R1.0.4 OSE / Kernel - 3 : 110
Reference Maset_suid
Ker
nel
user
o the ally
alloc s of
ting rocess non-sses, ser
or non-sor
set_suid
Syntax void set_suid (OSBOOLEAN make_super);
Description This is a call used to implement non-OSE system calls, and is therefore not asystem call.
The set_suid system call temporarily assigns superuser (user 0) privileges tcalling process. This allows the caller to communicate with processes norminvisible to the calling process.
The calling process is also temporarily attached to the system pool, i.e. any calls issued while in a superuser region refers to the system pool, regardlesthe pool normally attached to the calling process.
The kernel maintains a record of how many times a process has acquired superuser rights with a non-zero set_suid parameter. A process relinquishessuperuser rights only when the same number of set_suid calls with a zero parameter have been issued.
The intention is to allow users to provide a level of application specific operasystem services that appear as system calls. Any user or supervisor mode pmay trap to one of these services. The service uses the set_suid call with azero parameter to acquire superuser rights, communicates with system proceand then uses the set_suid call with a zero parameter to restore non-superurights before returning to the caller.
Include files #include "ose.h"
Parameters make_super
Return value None.
Restrictions The set_suid function can only be called by a process executing in supervismode. There is, however, no restriction on the user number of the process. Asuperuser process may thus access the set_suid while executing in supervimode.
The set_suid call is not available to interrupt processes.
Implementation Not implemented at levels A, and B. Full performance at levels level C and D.
nual / R1.0.4 OSE / Kernel - 3 : 111
Reference Masigsize
Ker
nel
buffer
sigsize
Syntax OSBUFSIZE sigsize (union SIGNAL **sig);
Description Examines a signal buffer and reports the size that was requested when the was allocated.
Include files #include "ose.h"or#include "ose_i.h"
Parameters sig A pointer to a pointer to a signal buffer.
Return value Returns the number of bytes requested when the buffer was allocated.
Restrictions None.
See also alloc, set_sigsize
Implementation Full performance at all implementation levels.levels
Example
#include "ose.h"
static const SIGSELECT any_sig[] = {0};
union SIGNAL{
SIGSELECT sig_no;};
OS_PROCESS(my_process){
union SIGNAL *sig;union SIGNAL *sig2;OSBUFSIZE size;
for(;;){
sig = receive((SIGSELECT *) any_sig);size = sigsize(&sig);sig2 = alloc(size,sig->sig_no);/* Code */
}}
nual / R1.0.4 OSE / Kernel - 3 : 112
Reference Masignal_fsem
Ker
nel
cess.
sem.
is
a wrap
, but or
signal_fsem
Syntax void signal_fsem (PROCESS pid);
Description Increments the value of the fast semaphore associated with the specified pro
If the result is zero, the specified process is made ready if it had done a wait_f
If the process is an interrupt process, a wake_up invocation of the process scheduled.
Include files #include "ose.h"or#include "ose_i.h"
Parameters pid The ID of the process for which the fast semaphore is signalled.
Return value None.
Restrictions It is illegal to cause a fast semaphore to wrap from high positive numbers tonegative value for all processes but interrupt processes (these are allowed tosince the fast semaphore is only used to issue a wake_up call).
Signal_fsem may be called also from interrupt and timer-interrupt processesit is an error to cause a remote system call while doing so, i.e. an interrupt timer-interrupt process may not access a fast semaphore in another CPU.
See also set_fsem, wait_fsem, get_fsem
Implementation Not implemented at level A. Full performance from level B.levels
Example
#include "ose.h"
extern PROCESS proc_;
OS_PROCESS(my_process){
for(;;){
/* Code */signal_fsem(proc_);/* Code */
}}
nual / R1.0.4 OSE / Kernel - 3 : 113
Reference Masignal_sem
Ker
nel
ess
ative
signal_sem
Syntax void signal_sem (SEMAPHORE *sem);
Description Increments the value of the specified semaphore and releases the first procwaiting at the semaphore.
Include files #include "ose.h"or#include "ose_i.h"
Parameters sem A pointer to the semaphore to be signalled.
Return value None.
Restrictions It is illegal to cause a semaphore to wrap from high positive numbers to a negvalue.
See also wait_sem, get_sem, create_sem, kill_sem
Implementation Not implemented at level A. Full performance from level B.levels
Example
#include "ose.h"
extern SEMAPHORE *sem;
OS_PROCESS(my_process){
for(;;){
/* Code */signal_sem(sem);/* Code */
}}
nual / R1.0.4 OSE / Kernel - 3 : 114
Reference Mastart
Ker
nel
ed. A have
fore
d to
The .
more
t
s an -nores
start
Syntax void start (PROCESS pid);
Description Starts a previously stopped or newly created block or process.
The kernel keeps a record of how many times each process has been stoppprocess is allowed to execute again only when the same number of start callsbeen issued.
Each new process must be started to enable execution.
Starting a block is equivalent to issuing a start call to each of the processescontained in the block. It is important that no process is started individually bethe block is started, since starting a process twice is illegal.
Starting a timer-interrupt process means that it from now on will be schedulerun at its specified time interval.
Include files #include "ose.h"or#include "ose_i.h"
Parameters pid The ID of the block or process to start.
Return value None.
Restrictions Only prioritized, background and timer-interrupt processes can be stopped. start and stop calls have no effect on process types that can not be stopped
Starting a process that is not stopped is illegal. (It is illegal to start a process times than it was stopped.)
This implies that it is always illegal to start the current process or the currenblock.
Start may be called also from interrupt and timer-interrupt processes, but it ierror to cause a remote system call while doing so, i.e. an interrupt or timerinterrupt process may not start a process in another CPU, and the kernel igany attempt to do so.
See also stop, create_process
Implementation Not implemented at level A. Full performance from level B. levels
Example
#include "ose.h"
OSENTRYPOINT new_process;
OS_PROCESS(my_process){
PROCESS proc1_;PROCESS proc2_;PROCESS block_;
for(;;){
nual / R1.0.4 OSE / Kernel - 3 : 115
Reference Mastart
Ker
nel
proc1_ = create_process(OS_PRI_PROC, "proc1",
new_process, 200,
16, (OSTIME) 0,
(PROCESS) 0, (struct OS_redir_entry *) NULL, (OSVECTOR) 0,
(OSUSER) 0);start(proc1_);block_ = create_block("block",
(OSUSER) 0, (OSBOOLEAN) 0, (PROCESS) 0, (OSBOOLEAN) 0);
proc2_ = create_process(OS_PRI_PROC, "proc2",
new_process, 200, 16, (OSTIME) 0, block_, (struct OS_redir_entry *) NULL, (OSVECTOR) 0, (OSUSER) 0);
start(block_);/* Code */
}}
nual / R1.0.4 OSE / Kernel - 3 : 116
Reference Mastart_OSE
Ker
nel
rnel
r's
unit
tic the
le and
start_OSE
Syntax void start_OSE (void);
Description This function works in two ways.
start_OSE is called during system start to create the kernel and initialize kestructures.
This function does not return to the caller since the kernel replaces the calleprogram.
start_OSE is also called by the main process for each separately linked OSEto create the static blocks and processes contained in that unit.
The main process does not return. It waits in the interface library for any staprocess to die, and then kills all blocks in the unit. This behaviour relies on convention that program loaders keep track of the main process, and kill thememory segment when the main process dies. Other conventions are possibmay appear in certain systems.
It might be possible to restert the system by calling start_OSE in a running system.
Include files #include "ose.h"
Parameters None.
Return value None.
Restrictions Kernels that do not support user initiated system start need not provide the start_OSE call.
The start_OSE call is not available to interrupt processes.
Implementation Not implemented at level A. Full performance from level B.levels
Example
#include "ose.h"
int main(){
/* Code, initialisation etc. */start_OSE();
}
nual / R1.0.4 OSE / Kernel - 3 : 117
Reference Mastop
Ker
nel
ed. A have
s
to
The .
s an -nores
fter t its
stop
Syntax void stop (PROCESS pid);
Description Suspends the execution of a single process or all processes in a block.
It is legal to stop a process any (reasonable) number of times.
The kernel keeps a record of how many times each process has been stoppprocess is allowed to execute again only when the same number of start callsbeen issued.
Stopping a block is equivalent to issuing a stop call to each of the processecontained in the block.
Stopping a timer-interrupt process means that it will no longer be scheduledrun at its specified time interval.
Include files #include "ose.h"or#include "ose_i.h"
Parameters pid The ID of the block or process to stop.
Return value None.
Restrictions Only prioritized, background and timer-interrupt processes can be stopped. start and stop calls have no effect on process types that can not be stopped
Stop may be called also from interrupt and timer-interrupt processes, but it ierror to cause a remote system call while doing so, i.e. an interrupt or timerinterrupt process may not stop a process in another CPU, and the kernel igany attempt to do so.
Note that a timer-interrupt process will continue to execute until its end, even aissuing a stop(current_process()), but it will no longer be scheduled to run aspecified time interval.
See also start
Implementation Not implemented at level A. Full performance from level B.levels
Example
#include "ose.h"
extern PROCESS proc_;
OS_PROCESS(my_process){
for(;;){
stop(proc_);/* Code */start(proc_);
}}
nual / R1.0.4 OSE / Kernel - 3 : 118
Reference Masystem_tick
Ker
nel
g to the
system_tick
Syntax OSTIME system_tick (void);
Description Returns the system tick length in microseconds.
Include files #include "ose.h"or#include "ose_i.h"
Parameters None.
Return value Returns the number of microseconds per system tick.
Restrictions This call relies on the tick system call being issued at intervals correspondinthe system tick length configured into the kernel. This can not be ensured bykernel itself.
See also SYSTEM_TICK, tick
Implementation Not implemented at level A. Full performance from level B.levels
Example
#include "ose.h"
OS_PROCESS(my_process){
unsigned int tick;
for(;;){
/* Code */tick = system_tick();/* Code */
}}
nual / R1.0.4 OSE / Kernel - 3 : 119
Reference Matick
Ker
nel
et al.
ss, a
by
ace.
call
o
ll.
tick
Syntax void tick (void);
Description This call advances the system clock.
The system tick counter is advanced, timer-interrupt processes are invoked,process timeslices and timeouts requested by calls to delay, receive_w_tmo are managed.
Timer-interrupt processes are run at the priority of the calling interrupt proceor at a priority immediately below interrupt processes if tick was called fromprioritized process.
Include files #include "ose.h"or#include "ose_i.h"
Parameters None.
Return value None.
Restrictions Tick should be called periodically at intervals that match the value returned system_tick ().
Tick may not be called from a timer-interrupt process.
Tick may only be called from a superuser process executing in supervisor sp
The tick system call is not re-entrant. Only one process in the system may tick.
It may be required to the state the type of the calling process and hardwarepriority in the kernel configuration file.Wakeup calls may otherwise be hard timplement.
Kernels with built in timer management need not provide the tick system ca
Implementation Not implemented at level A, but the kernel is still required levelsto manage the system timer in some fashion. Full
performance from level B.
Example
#include "ose.h"
OS_PROCESS(ticker){
if(wake_up()) /* This is an interrupt process */{ /* used as a timer. */
tick(); /* Its only function is to run the */} /* system clock. */
}
nual / R1.0.4 OSE / Kernel - 3 : 120
Reference Mawait_fsem
Ker
nel
gh
res
iven,
wait_fsem
Syntax void wait_fsem (OSFSEMVAL count);
Description Waits at the fast semaphore associated with the caller.
The semaphore value is decreased by the specified amount. If the result is negative, the caller is suspended until some other process has issued enousignal_fsem calls for the value to become non-negative.
Include files #include "ose.h"
Parameters count The number to decrease the fast semaphore with.
Return value None.
Restrictions The wait_fsem call is not available to interrupt processes, but fast semaphomay still be used in a limited fashion to wake up interrupt processes from prioritized processes.
This may be used for instance to start a sequence that is mainly interrupt drsuch as transmitting a string of characters to some serial port.
See also signal_fsem, get_fsem, set_fsem
Implementation Not implemented at level A. Full performance from level B.levels
Example
#include "ose.h"
OS_PROCESS(my_process){
for(;;){
/* Code */wait_fsem((OSFSEMVAL) 1);/* Code */
}}
nual / R1.0.4 OSE / Kernel - 3 : 121
Reference Mawait_sem
Ker
nel
ed and
wait_sem
Syntax void wait_sem (SEMAPHORE *sem);
Description The caller waits at the specified semaphore structure.
The semaphore value is decremented. If the result is negative, the caller is suspended and queued at the end of the semaphore queue.
Each time some other process signals the semaphore, the value is incrementthe first process queued at the semaphore is released.
Include files #include "ose.h"
Parameters sem A pointer to the semaphore.
Return value None.
Restrictions The wait_sem call is not available to interrupt processes.
See also signal_sem, get_sem, create_sem, kill_sem
Implementation Not implemented at level A. Full performance from level B.levels
Example
#include "ose.h"
SEMAPHORE *sem;
OS_PROCESS(my_process){
for(;;){
/* Code */wait_sem(sem);/* Code */
}}
nual / R1.0.4 OSE / Kernel - 3 : 122
Reference Mawake_up
Ker
nel
rupt
was n not
rrupt
t.
he
call rtant
p
re, or must
wake_up
Syntax int wake_up (void);
Description An interrupt process can be invoked in two ways; either by a hardware interor by a software event. In both cases the interrupt process is invoked with interrupts disabled up to and including the hardware priority assigned to theinterrupt process.
The wake_up system call informs the interrupt process of the way in which it invoked. This is useful because receive calls are fairly expensive and can oftebe afforded at each hardware interrupt.
Software events that cause interrupt processes to be invoked are signal transmissions to an interrupt process and signal_fsem calls specifying an inteprocess.
Hardware interrupts are delayed until the wake_up call has completed.
Include files #include "ose.h"or#include "ose_i.h"
Parameters None.
Return value Returns 0 (zero) if the interrupt process was invoked by a hardware interrup
Returns 1 (one) if the interrupt process was invoked by a signal sent to it. Tsignal is ready to be fetched with a receive call.
Returns 2 if the interrupt process was invoked in response to a signal_fsemissued by some other process. (The value of the fast semaphore is not impoand can not be read with the get_fsem system call.)
If called by a process of a type other than an interrupt process, the wake_ufunction returns 1 (one).
Restrictions Some processors can not accept a simulated interrupt call.
On these processors it may not be possible to implement the wake_up featuthere may be some restrictions. A common problem is that nested interrupts be disabled while a wake_up call is in progress.
Implementation Not implemented at level A. Full performance from level B.levels
Example
#include "ose.h"
union SIGNAL{
SIGSELECT sig_no;};
OS_PROCESS(my_interrupt_process){
static const SIGSELECT all[] = {0};union SIGNAL *sig;
nual / R1.0.4 OSE / Kernel - 3 : 123
Reference Mawake_up
Ker
nel
switch( wake_up() ){
case 0:/* hardware interrupt invoked the interrupt
* process*/
break;case 1:
/* A signal sent to this process caused the wake_up */sig = receive((SIGSELECT *)all);free_buf(&sig);break;
case 2:/* signal_fsem() on this process caused the wake_up */break;
default:/* this is an error */
}}
nual / R1.0.4 OSE / Kernel - 3 : 124
Reference MaNIL
Ker
nel
n
no
buf
s lead
NIL
Syntax #define NIL
Description NIL is a manifest constant defined by the kernel. It is defined in ose.h and iose_i.h.
NIL is the value returned from receive, receive_w_tmo and receive_from whensignal buffer could be received.
NIL is stored in the caller's signal pointer by the send, send_w_s and free_system calls.
NIL is not equivalent to NULL, and should be used only to test on received buffers.
Include files #include "ose.h"or#include "ose_i.h"
Return value None.
Restrictions NIL is specified such that it is never confused with a legal signal pointer.
Furthermore, it is an advantage if NIL points to a valid scratchpad area. Thienables the kernel to correctly report several user errors that would otherwiseto bus error or memory parity error.
Implementation Full performance at all implementation levels.levels
Example
#include "ose.h"
static const SIGSELECT any_sig[] = {0};
union SIGNAL{
SIGSELECT sig_no;};
OS_PROCESS(my_process){
union SIGNAL *sig;
for(;;){
sig = receive_w_tmo(1000, (SIGSELECT *)any_sig);if(sig != NIL){
/* Code */free_buf(&sig);
}}
}
nual / R1.0.4 OSE / Kernel - 3 : 125
Reference MaOS68
Ker
nel
er
or
hich
OS68
Syntax #define OS68
Description A CPU dependent manifest constant of similar layout is defined by the headfiles ose.h and ose_i.h.
The value of this constant is unimportant. It is intended for use in an #ifdef #ifndef statement.
It may be used by an application or an OSE system simulator to determine woperating system is currently in use.
softOSE means a that the OSE system is a soft kernel.OSPP means OSE for any PowerPC CPU.OS68 means OSE for any Motorola 68k CPU,OS88 means OSE for the Motorola 88000 CPU,OS11 means OSE for the Motorola 68HC11 CPU, etc.
Include files #include "ose.h"or#include "ose_i.h"
Return value None.
Restrictions None.
See also OSE_I, OSE
Implementation Full performance at all implementation levels.levels
Example
#include "ose.h"
OSPROCESS(my_process){
for(;;){
#ifdef OS68/* Code */
#else/* Code */
#endif}
}
nual / R1.0.4 OSE / Kernel - 3 : 126
Reference MaOS_ATTACH_
Ker
nel
by
.
OS_ATTACH_SIG
Syntax #define OS_ATTACH_SIG 252
Description A manifest constant defining the signal number of the default signal createdthe attach system call when invoked with a signal pointer set to NULL.
It is defined in the header files ose.h and ose_i.h.
It may be used by an application to determine if such a signal was received
The value of this constant is always 252.
Include files #include "ose.h"or#include "ose_i.h"
Return value None.
Restrictions None.
See also attach, detach
Implementation Full performance at all implementation levels.levels
Example
#include "ose.h"
static const SIGSELECT any_sig[] = {0};
union SIGNAL{
SIGSELECT sig_no;};
OS_PROCESS(my_process){
union SIGNAL *sig;
for(;;){
sig = receive((SIGSELECT *) any_sig);switch(sig->sig_no){
case OSATTACH_SIG:/* Code */break;
default:/* Code */
}free_buf(&sig);
}}
nual / R1.0.4 OSE / Kernel - 3 : 127SIG
Reference MaOS_DEBUG
Ker
nel
and
or
nd
the ts of
s
OS_DEBUG
Syntax #define OS_DEBUG
Description This manifest constant may be defined by the user to enable reporting of fileline information and CPU registers to the debugger.
The value of this constant is unimportant. It is intended for use in an #ifdef #ifndef statement.
The constant affects the header files ose.h, ose_i.h.
OS_DEBUG is typically defined on the compiler command line to enable file aline information and CPU registers in a specific module.
Include files #include "ose.h"or#include "ose_i.h"
Return value None.
Restrictions OS_DEBUG must be defined before any OSE header is included.
File and line information, as well as CPU register information, is optional to OSE implementation. This means that some implementations lack all or parthis information.
See also get_pcb
Implementation Full performance at all implementation levels.levels
Example
The typical way to define the constant is as a compiler directive, for instance in a make file afollows:
CFLAGS= -c -g -Wall -ansi -pedantic -DOS_DEBUG -I.
It may also be declared in a define statement:
#define OS_DEBUG#include "ose.h"
OSPROCESS(my_process){
for(;;){
#ifdef OS_DEBUG/* Code */
#else/* Code */
#endif}
}
nual / R1.0.4 OSE / Kernel - 3 : 128
Reference MaOSE
Ker
nel
or
ich
OSE
Syntax #define OSE
Description This manifest constant is defined by ose.h.
The value of this constant is unimportant. It is intended for use in an #ifdef #ifndef statement.
It may be used by an application or an OSE system simulator to find out whOSE header file is being used.
Include files #include "ose.h"
Return value None.
Restrictions The OSE manifest constant is not available to interrupt processes.
See also OSE_I, OS68
Implementation Full performance at all implementation levels.levels
Example
#include "ose.h"
OS_PROCESS(my_process){#ifdef OSE
for(;;){
/* Code, "I am a prioritized process" */}
#elseif(wake_up()){
/* Code, "I am an interrupt process" */}
#endif}
nual / R1.0.4 OSE / Kernel - 3 : 129
Reference MaOSE_LEVEL_
Ker
nel
t the
ifdef
e, a ut
OSE_LEVEL_x
Syntax #define OSE_LEVEL_B
#define OSE_LEVEL_C
#define OSE_LEVEL_D
Description These manifest constants are defined in ose.h and ose_i.h.
They may be used by an application or an OSE system simulator to find oufunctional level of the kernel used.
Each constant represents a fully supported OSE implementation level.
OSE_LEVEL_B is defined if at least level B is supported.OSE_LEVEL_C is defined if at least level C is supported.OSE_LEVEL_D is defined if level D is supported.The values of the constants are unimportant. They are intended for use in #or #ifndef statements.
All constants below the actual implementation level are defined. For instanclevel C implementation defines both OSE_LEVEL_B and OSE_LEVEL_C, bnot OSE_LEVEL_D.
Include files #include "ose.h"or#include "ose_i.h"
Return value None.
Restrictions None.
Implementation Full performance at all implementation levels.levels
Example
#include "ose.h"
OS_PROCESS(my_process){
for(;;){
#ifdef OSE_LEVEL_B/* Code */
#endif#ifdef OSE_LEVEL_C
/* Code */#endif#ifdef OSE_LEVEL_D
/* Code */#endif
}}
nual / R1.0.4 OSE / Kernel - 3 : 130x
Reference MaOSE_I
Ker
nel
OSE_I
Syntax #define OSE_I
Description Same as OSE, but defined in ose_i.h.
Include files #include "ose_i.h"
Return value None.
Restrictions The OSE_I manifest constant is only available to interrupt processes.
See also OSE, OS68
Implementation Full performance at all implementation levels.levels
Example
#include "ose_i.h"
OS_PROCESS(my_process){
for(;;){
#ifdef OSE_Iif(wake_up()){
/* Code, "I am an interrupt process" */}
#elsefor(;;){
/* Code, "I am a prioritized process" */}
#endif}
nual / R1.0.4 OSE / Kernel - 3 : 131
Reference MaOS_PROCESS
Ker
nel
_i.h,
OS_PROCESS
Syntax #define OS_PROCESS (name)
Description This macro should be used to define the entrypoint of a process.
It is defined in ose.h and ose_i.h.
Various OSE implementations use this macro in different ways.
It is wise to assume that OS_PROCESS is differently defined in ose.h and oseeven if this is not normally the case.
Include files #include "ose.h"or#include "ose_i.h"
Return value None.
Restrictions None.
Implementation Full performance at all implementation levels.levels
Example
#include "ose.h"
OS_PROCESS(my_process){
for(;;){
/* Code */}
}
nual / R1.0.4 OSE / Kernel - 3 : 132
Reference MaOSSIM
Ker
nel
use
or
lves
, so
erate
OSSIM
Syntax #define OSSIM
Description The user should define this manifest constant when compiling a process forin the OSE system simulator.
The value of this constant is unimportant. It is intended for use in an #ifdef #ifndef statement.
The header files ose.h and ose_i.h test on this constant and replace themsewith ossim.h if OSSIM is defined. ossim.h is part of the OSE simulator.
The header file ose_mmu.h test on this constant and replaces itself with sim_mmu.h if OSSIM is defined. The file sim_mmu.h is part of the OSE simulator.
The constants OSE, OSE_I and OS68 are defined before the test on OSSIMthese constants can be interrogated by ossim.h.
It may sometimes be desirable to test on OSSIM in user programs too. Forinstance one may wish to remove target dependent code that can not coopwith the OSE simulator.
Include files #include "ose.h"or#include "ose_i.h"
Return value None.
Restrictions OSSIM must be defined before any OSE header is included.
Implementation Full performance at all implementation levels.levels
Example
The most common way to use OSSIM is as a flag in a make file as in example 1.
It can then be used in the application code as in example 2.
Example 1
CFLAGS= -c -g -Wall -ansi -pedantic -DOSSIM -I./#generalized rules.c.o:
gcc $(CFLAGS) -o $@ $<# the makefile continues
Example 2
#include "ose.h"
OS_PROCESS(my_process){
for(;;){
/* Code */#ifdef OSSIM
/* Code */#else
nual / R1.0.4 OSE / Kernel - 3 : 133
Reference MaOSSIM
Ker
nel
/* Code that is target dependent and can not run * in the simulator.
*/#endif
/* Code */}
}
nual / R1.0.4 OSE / Kernel - 3 : 134
Reference MaSYSTEM_TIC
Ker
nel
d lls ds.
e the
SYSTEM_TICK
Syntax #define SYSTEM_TICK (1000L)
Description This manifest constant is always 1000L.
It is present only for compatibility with old OSE kernels (it should not be usewhen writing applications for OSE), where the delay and receive_w_tmo caspecify timeout in number of system ticks instead of in number of millisecon
An old way of saying "delay 50 milliseconds" is:
delay((OSTIME) ((50 * 1000L) / SYSTEM_TICK));
This design also works with new OSE versions since the SYSTEM_TICK constant balances the expression.
(It is, of course, more efficient to calculate the expression in advance and savresult for repeated use.)
Include files #include "ose.h"or#include "ose_i.h"
Return value None.
Restrictions None.
See also system_tick, delay, receive_w_tmo
Implementation Full performance at all implementation levels.levels
nual / R1.0.4 OSE / Kernel - 3 : 135K
Reference MaUser Interface
Ker
nel
in an
aders
ar, the should
luded
f all by OSE. riting
st
ost
ires all
This _move. uires ry tions.
es
the ar file.
4 User Interface
4.1 Header FilesThe user interface to OSE is defined in a number of C header files, which should be includedOSE application.
These files are not affected by OSE kernel and interface library reconfiguration, even if the heare sometimes produced by a configuration program.
Header behaviour may be affected by manifest constants defined at compile time. In particulOS_DEBUG constant affects debugger support, and the OSSIM constant indicates that code be produced for an OSE simulator session.
Headers conform to ANSI recommendations, i.e. they use ANSI prototypes and may be incany number of times in any order.
Internal OSE symbols begin with the string "zz" or "ZZ". Such symbols along with the names osystem calls, types, tags of enumerated types, macros and manifest constants are reserved Many types begin with the letters "OS" or "ose_", so it is wise to avoid such symbols when wan application.
The following standard headers define the OSE interface:
ose.h
System calls for prioritized processes and background processes. This header is used in moapplications.
ose_i.h
System calls for interrupt processes and timer-interrupt processes. This header is used in mapplications.
ose_rem.h
Remote call format for link handlers. This is actually a signal definition file. This header requose.h and will not work with ose_i.h. This header is used only in link handlers and remote cservers.
ose_mmu.h
Prototypes for functions that must be provided by user-written memory management software.header file defines the functions attach_block, select_segment, set_segment_mode and memSee also the detailed system call description for these calls. Using the ose_mmu header reqose.h to be included as well. It will not work with ose_i.h. This header is used only in memomanagement software and the header is therefore present only in level C and D implementa
ose_err.h
Error code definitions for error handlers. This header is used only in error handlers and definsymbolically the error codes provided by the OSE kernel when the kernel detects an error.
When using these files the "union SIGNAL" type must be defined. This must be done afterheader files have been included and the union must consist of all signals used in the particulFor a more detailed description refer to the section on OSE Data Types.
nual / R1.0.4 OSE / Kernel - 4 : 1
Reference MaUser Interface
Ker
nel
elf with
n can
ose.h, ose_i.h and ose_mmu.h test on the manifest constant OSSIM. This constant causes theheaders ose.h and ose_i.h to replace themselves with ossim.h, and ose_mmu.h to replace itssim_mmu.h.
Many OSE system calls are in fact implemented as macros. This means that when writing aapplication it is important to be aware of this since it results in limitations on how system callsbe used.
nual / R1.0.4 OSE / Kernel - 4 : 2
Reference MaUser Interface
Ker
nel
types
phore e
t be union
if they ntain
can
4.2 Data TypesThe header files described in the Header files section contain several type definitions. Theseare introduced to allow reasonable portability between various OSE implementations.
The following types are the most important:• union SIGNAL
• SIGSELECT
• PROCESS.
All types except unions, structures and the SEMAPHORE type, which is a typedef for the semastructure, are simple types. This means that in an application variables of these types can bcompared safely against each other for numerical equality.
The types OSSEMVAL and OSFSEMVAL are signed. Other types are unsigned.
When writing an application it is necessary to declare the “union SIGNAL” type and this musdone after including the ose.h header file. All signals that are used in a file must be part of thesignal declaration in that particular file. This is done in the following way:
#include "ose.h"#include "signals.sig"
union SIGNAL{
SIGSELECT sig_no;struct First first;struct Testsignal testsignal;
};
The sig_no variable must always be part of the union. Signal structures may also be included are used, preferably declared in a header file which is included. The signal structure must cothe signal number but it may also contain other variables. A declaration of a signal structurelook like this:
nual / R1.0.4 OSE / Kernel - 4 : 3
Reference MaUser Interface
Ker
nel
#define FIRST 1struct First{
SIGSELECT sig_no;/* Here, other data can be declared if desirable * for instance: char data;
*/};
The following is a list of types with usage information:Type Usage
union SIGNAL A signal structure
SIGSELECT A signal number
PROCESS A process ID
OSBUFSIZE The number of bytes in a signal
OSPRIORITY A process priority
OSUSER A user number
OSFSEMVAL A fast semaphore value
OSSEMVAL A semaphore value
OSSERCODE Information passed to error()
OSADDRESS A memory address
OSENTRYPOINT A process entrypoint
OSTIME Used by delay() and similar
OSTICK Returned from get_ticks()
OSVECTOR An interrupt vector number
SEMAPHORE A semaphore structure
OSBOOLEAN A binary flag
OSSEGMENT A segment ID used by MMU
OSATTREF An attach reference ID
OSERRH An error handler entrypoint
enum PROCESS_TYPE The type of a process
enum PROCESS_STATUS The status of a process
struct semaphore A semaphore field
struct OS_redir_entry A redirection table field
struct OS_pid_list A process ID list
struct OS_pcb Miscellaneous process information
nual / R1.0.4 OSE / Kernel - 4 : 4
Reference MaRemote Syste
Ker
nel
s. If a ranslates are
server n a link
gnal the
system reasons t
_rem.h.
purpose
all is unions
formed nt byte e used calls
5 Remote System CallsThere are a number of system calls that may operate on blocks and processes in other CPUprocess issues one of these calls to a process not present in the same CPU, the OSE kernel tthe system call into a remote system call. Remote system calls are signal transactions whichexecuted by the OSE kernel. The OSE kernel sends a remote_call signal to the remote call attached to the specified process (usually a phantom process). This remote call server is oftehandler.
5.1 Signal DefinitionsThe OSE kernel defines three signals for remote calls; remote_call, remote_response and remote_cancel.
Each system call consists of a remote_call signal in the forward direction, and either a remote_response or a remote_cancel signal in the return direction. In the remote_response siresponse is returned from the remote call server to OSE.
A remote_cancel signal may be returned if the remote call server cannot execute the remote call. In that case OSE aborts the system call and produces a reasonable dummy result. Valid for this are if the contact with the remote system is lost or if the requested system call is norecognized by the remote call server.
These signals and associated unions and manifest constants are defined in the header file ose
The signal numbers for these three signals are reserved and should not be used for any other by a link handler.
The call_type field in the remote_call and remote_response signals indicates which system cbeing executed. It is also used to select members of the remote_calls and remote_responsesrespectively.
When these signals are propagated to a foreign system on the network, they should be transto a set of packets specified at byte level to support transmission between systems with differeorder and type conventions. OSE ensures that signal buffers received by a link handler can bwithout reallocation to return responses for the same system call. This is true for all system except those with variable size responses.
The three signal structures are listed below:
#define REMOTE_CALL (255)struct remote_call{
SIGSELECT sig_no;OSCALLTYPE call_type;union remote_calls params;
};
#define REMOTE_RESPONSE (254)struct remote_response{
SIGSELECT sig_no;
nual / R1.0.4 OSE / Kernel - 5 : 1m Calls
Reference MaRemote Syste
Ker
nel
OSCALLTYPE call_type;union remote_responses results;
};
#define REMOTE_CANCEL (253)struct remote_cancel{
SIGSELECT sig_no;};
The remote_calls and remote _responses unions are listed below:
union remote_calls{
struct rem_clear_bp rem_clear_bp;struct rem_create_error_handler rem_create_error_handler;struct rem_flush rem_flush;struct rem_get_cpu rem_get_cpu;struct rem_get_env rem_get_env;struct rem_get_env_list rem_get_env_list;struct rem_get_fsem rem_get_fsem;struct rem_get_mem rem_get_mem;struct rem_get_pcb rem_get_pcb;struct rem_get_pid_list rem_get_pid_list;struct rem_get_pri rem_get_pri;struct rem_get_signal rem_get_signal;struct rem_get_uid rem_get_uid;struct rem_hunt rem_hunt;struct rem_intercept rem_intercept;struct rem_resume rem_resume;struct rem_set_bp rem_set_bp;struct rem_set_env rem_set_env;struct rem_set_fsem rem_set_fsem;struct rem_set_mem rem_set_mem;struct rem_set_pcb rem_set_pcb;struct rem_signal_fsem rem_signal_fsem;struct rem_start rem_start;struct rem_stop rem_stop;
};
union remote_responses{
struct remr_clear_bp remr_clear_bp;struct remr_create_error_handler remr_create_error_handler;struct remr_get_cpu remr_get_cpu;struct remr_get_env remr_get_env;struct remr_get_env_list remr_get_env_list;struct remr_get_fsem remr_get_fsem;struct remr_get_mem remr_get_mem;struct remr_get_pcb remr_get_pcb;struct remr_get_pid_list remr_get_pid_list;struct remr_get_pri remr_get_pri;struct remr_get_signal remr_get_signal;struct remr_get_uid remr_get_uid;struct remr_hunt remr_hunt;struct remr_set_bp remr_set_bp;struct remr_set_env remr_set_env;struct remr_set_mem remr_set_mem;struct remr_set_pcb remr_set_pcb;
};
nual / R1.0.4 OSE / Kernel - 5 : 2m Calls
Reference MaRemote Syste
Ker
nel
The call_type field contains one of the following values
#define REM_CLEAR_BP 1#define REM_CREATE_ERROR_HANDLER 2#define REM_FLUSH 3#define REM_GET_CPU 4#define REM_GET_ENV 5#define REM_GET_ENV_LIST 6#define REM_GET_FSEM 7#define REM_GET_MEM 8#define REM_GET_PCB 9#define REM_GET_PID_LIST 10#define REM_GET_PRI 11#define REM_GET_SIGNAL 12#define REM_GET_UID 13#define REM_HUNT 14#define REM_INTERCEPT 15#define REM_RESUME 16#define REM_SET_BP 17#define REM_SET_ENV 18#define REM_SET_FSEM 19#define REM_SET_MEM 20#define REM_SIGNAL_FSEM 21#define REM_START 22#define REM_STOP 23#define REM_SET_PCB 24
#define REMR_CLEAR_BP 1#define REMR_CREATE_ERROR_HANDLER 2#define REMR_FLUSH 3#define REMR_GET_CPU 4#define REMR_GET_ENV 5#define REMR_GET_ENV_LIST 6#define REMR_GET_FSEM 7#define REMR_GET_MEM 8#define REMR_GET_PCB 9#define REMR_GET_PID_LIST 10#define REMR_GET_PRI 11#define REMR_GET_SIGNAL 12#define REMR_GET_UID 13#define REMR_HUNT 14#define REMR_INTERCEPT 15#define REMR_RESUME 16#define REMR_SET_BP 17#define REMR_SET_ENV 18#define REMR_SET_FSEM 19#define REMR_SET_MEM 20#define REMR_SIGNAL_FSEM 21#define REMR_START 22#define REMR_STOP 23#define REMR_SET_PCB 24
nual / R1.0.4 OSE / Kernel - 5 : 3m Calls
Reference Marem_clear_bp
Ker
nel
re is no
5.2 Parameter StructuresThis section defines the members of the remote_calls and remote_responses unions.
Remote call servers must be able to handle all of these and produce reasonable responses.
Some remote call responses consist only of a signal number and a call_type parameter. Theresponse structure defined for these calls.
rem_clear_bp
Include files #include "ose_rem.h"
remote_calls member struct rem_clear_bp{
PROCESS pid;OSADDRESS addr;
};
remote_responses member struct remr_clear_bp{
OSBOOLEAN failed;};
rem_create_error_handler
Include files #include "ose_rem.h"
remote_calls member struct rem_create_error_handler{
PROCESS pid;OSADDRESS entrypoint;OSADDRESS stacksize;
};
remote_responses member struct remr_create_error_handler{
OSADDRESS entrypoint;};
rem_flush
Include files #include "ose_rem.h"
remote_calls member struct rem_flush{
PROCESS pid;PROCESS psel[1]; /* Variable size */
};
remote_responses member None.
nual / R1.0.4 OSE / Kernel - 5 : 4
Reference Marem_get_cpu
Ker
nel
rem_get_cpu
Include files #include "ose_rem.h"
remote_calls member struct rem_get_cpu{
PROCESS pid;};
remote_responses member struct remr_get_cpu{
char name[1]; /* Variable size */};
rem_get_env
Include files #include "ose_rem.h"
remote_calls member struct rem_get_env{
PROCESS pid;char name[1]; /* Variable size */
};
remote_responses member struct remr_get_env{
char value[1]; /* Variable size */};
rem_get_env_list
Include files #include "ose_rem.h"
remote_calls member struct rem_get_env_list{
PROCESS pid;char first_name[1]; /* Variable size */
};
remote_responses member struct remr_get_env_list{
char name[1]; /* Variable size */};
nual / R1.0.4 OSE / Kernel - 5 : 5
Reference Marem_get_fsem
Ker
nel
rem_get_fsem
Include files #include "ose_rem.h"
remote_calls member struct rem_get_fsem{
PROCESS pid;};
remote_responses member struct remr_get_fsem{
OSFSEMVAL value;};
rem_get_mem
Include files #include "ose_rem.h"
remote_calls member struct rem_get_mem{
PROCESS pid;OSADDRESS from;void * to;OSADDRESS size;
};
remote_responses member struct remr_get_mem{
OSBOOLEAN failed;};
rem_get_pcb
Include files #include "ose_rem.h"
remote_calls member struct rem_get_pcb{
PROCESS pid;};
remote_responses member struct remr_get_pcb{
struct OS_pcb pcb; /* Variable size */};
nual / R1.0.4 OSE / Kernel - 5 : 6
Reference Marem_get_pid_l
Ker
nel
rem_get_pid_list
Include files #include "ose_rem.h"
remote_calls member struct rem_get_pid_list{
PROCESS bid; };
remote_responses member struct remr_get_pid_list{
OSBUFSIZE count;PROCESS pidlist[1]; /* Variable size */
};
rem_get_pri
Include files #include "ose_rem.h"
remote_calls member struct rem_get_pri{
PROCESS pid;};
remote_responses member struct remr_get_pri{
OSPRIORITY pri;};
nual / R1.0.4 OSE / Kernel - 5 : 7ist
Reference Marem_get_signa
Ker
nel
rem_get_signal
Include files #include "ose_rem.h"
remote_calls member struct rem_get_signal{
PROCESS pid;OSADDRESS mailptr;
};
remote_responses member struct remr_get_signal
{OSADDRESS nextsig;OSBUFSIZE sigsize;
/* Zero if call * failed*/
PROCESS sender;PROCESS addressee;unsigned char contents[1];
/* Variablesize */ };
rem_get_uid
Include files #include "ose_rem.h"
remote_calls member struct rem_get_uid{
PROCESS pid;};
remote_responses member struct remr_get_uid{
OSUSER uid;};
nual / R1.0.4 OSE / Kernel - 5 : 8l
Reference Marem_hunt
Ker
nel
rem_hunt
Include files #include "ose_rem.h"
remote_calls member struct rem_hunt{
OSUSER user;PROCESS from;OSBOOLEAN persistent;
/* Set if a hunt * signal is * present.*/
char name[1]; /* Variablesize */};
remote_responses member struct remr_hunt{
PROCESS pid;OSBOOLEAN found;
/* 0=no,* 1=found,* 2=found* unnamed*/
};
rem_intercept
Include files #include "ose_rem.h"
remote_calls member struct rem_intercept{
PROCESS pid;};
remote_responses member None.
rem_resume
Include files #include "ose_rem.h"
remote_calls member struct rem_resume{
PROCESS pid;};
remote_responses member None.
nual / R1.0.4 OSE / Kernel - 5 : 9
Reference Marem_set_bp
Ker
nel
rem_set_bp
Include files #include "ose_rem.h"
remote_calls member struct rem_set_bp{
PROCESS pid;OSADDRESS address;OSADDRESS attribute;OSBUFSIZE sigsize;unsigned char trapsig_contents[1];
/* Variablesize */};
remote_responses member struct remr_set_bp{
OSBOOLEAN failed;};
rem_set_env
Include files #include "ose_rem.h"
remote_calls member struct rem_set_env{
PROCESS pid;OSBUFSIZE name;
/* Index into strings.*/OSBUFSIZE value;
/* Index into strings.*/char strings[1];
/* Variable size */};
remote_responses member struct remr_set_env{
OSBOOLEAN failed;};
rem_set_fsem
Include files #include "ose_rem.h"
remote_calls member struct rem_set_fsem{
PROCESS pid;OSFSEMVAL value;
};
remote_responses member None.
nual / R1.0.4 OSE / Kernel - 5 : 10
Reference Marem_set_mem
Ker
nel
rem_set_mem
Include files #include "ose_rem.h"
remote_calls member struct rem_set_mem{
PROCESS pid;void *from;OSADDRESS to;OSADDRESS size;
};
remote_responses member struct remr_set_mem{
OSBOOLEAN failed;};
rem_set_pcb
Include files #include "ose_rem.h"
remote_calls member struct rem_set_pcb{
PROCESS pid;char cpuregs[1]; /* Variable size */
};
remote_responses member struct remr_set_pcb{
OSBOOLEAN failed;};
rem_signal_fsem
Include files #include "ose_rem.h"
remote_calls member struct rem_signal_fsem{
PROCESS pid;};
remote_responses member None.
nual / R1.0.4 OSE / Kernel - 5 : 11
Reference Marem_start
Ker
nel
rem_start
Include files #include "ose_rem.h"
remote_calls member struct rem_start{
PROCESS pid;};
remote_responses member None.
rem_stop
Include files #include "ose_rem.h"
remote_calls member struct rem_stop{
PROCESS pid;};
remote_responses member None.
nual / R1.0.4 OSE / Kernel - 5 : 12
Reference Marem_stop
Ker
nel
This ilar
5.3 Example of a Link HandlerThe following is a simple example of how to use the remote calls when writing a link handler. link handler manages only remote hunt signals; other remote call types are handled in a simmanner.
#include "ose.h"#include "ose_rem.h"
OS_PROCESS(my_linkhandler){
/* Defines the signals in the ose_rem.h file that * are being used. */union SIGNAL{
struct remote_call remote_call; struct remote_response remote_response; remote_cancel remote_cancel;
};
union SIGNAL *signal;static const SIGSELECT any_sig[]={0};struct OS_redir_table redir_table[1];PROCESS phantom_;
/* Redirects all signals to the current process. */
redir_table[0].sig = (SIGSELECT) 1; redir_table[0].pid = current_process();
for(;;){
signal = receive((SIGSELECT *)any_sig);if (signal->sig_no == REMOTE_CALL){
switch(signal->remote_call.call_type){
case REM_HUNT:/* Create a phantom process with the name
* stated in the hunt call. */
phantom_ = create_process(OS_PHANTOM, signal->remote_call.params.
rem_hunt.name, (OSENTRYPOINT *) 0, (OSADDRESS) 0, (OSPRIORITY) 0, (OSTIME) 0,
(PROCESS) 0,&redir_table,(OSVECTOR) 0,(OSUSER) 0);
/* Define the response signal * and its parameters */
signal->sig_no = REMOTE_RESPONSE;signal->remote_response.results.remr_hunt.found= 1;signal->remote_response.results.remr_hunt.pid = phantom_;break;
nual / R1.0.4 OSE / Kernel - 5 : 13
Reference Marem_stop
Ker
nel
default:/* No hunt signal received, cannot manage * the request. */signal->sig_no = REMOTE_CANCEL;
}send (&signal, sender(&signal)); /* Send the signal*/
/* to the caller. */}else{
/* The signal received is a signal sent to a process * in another CPU. Code is needed here to send the signal
* over the communication link to a link handler in the * other CPU.
*/}
}}
nual / R1.0.4 OSE / Kernel - 5 : 14
Reference MaError Message
Ker
nel
icate
pool
the t can other ring
. The alls wever these
mber re any when
han
r ate
the t can
6 Error Messages
6.1 Kernel Error Message ReferenceThe following is a list of all constants, in hexadecimal representation, used by the kernel to indwhich error caused a call to the error handler.
Error Code Symbolic name
0x01 OSE_ESTACK_TOO_LARGE
Too large stack buffer requested. There is no stack of this size or larger in theattached to process that called create_process. The extra parameter contains thesize requested.
0x02 OSE_ENO_USER_STACKSPACE
Out of space in a user stack pool. An error handler may extend the pool withextend_pool() system call. The extra parameter contains a pool identifier thabe passed to the extend_pool() system call. The extra parameter serves nopurpose. This error code can be ignored only if the pool was extended. Ignothe error causes the current allocation to be retried.
Note that the error handler is called in a state where the dispatcher is lockederror handler is therefore not allowed to perform any operations or system cthat would cause a process switch to be attempted. As a special case, it is hopossible to use the kill_proc(), signal_fsem() and signal_sem() calls because calls were designed to work in this situation.
Further, if the pool serves interrupt or timer processes, the error handler is assumed to disable interrupts before calling extend_pool() and restoring theprevious interrupt status upon return.
0x03 OSE_ETOO_MANY_PROCESSES
Too many processes were created. The system tables allows only a certain nuof processes. This number was exceeded. As the process table is used to stoobject that is represented by a PROCESS id, this error may also be reported creating new blocks, pools or segments.
Ignoring this error causes the system call to return as if it was never called.
0x11 OSE_EBUFFER_TOO_LARGE
Too large signal buffer requested.It is impossible to allocate a buffer larger tthe largest size available in the pool.The extra parameter contains the size requested. Ignoring this error causes the kernel to allocate the largest buffeavailable in the pool.This error is fatal if it occurs when the kernel tries to allocsystem pool space as a side effect of system calls like create_block(), create_process() etc.
0x12 OSE_ENO_KERN_SPACE
Out of space in the kernel pool. An error handler may extend the pool with extend_pool() system call. The extra parameter contains a pool identifier tha
nual / R1.0.4 OSE / Kernel - 6 : 1s
Reference MaError Message
Ker
nel
other ring ler is e not ss work rror
oring
h the
n not
curs
s
the t can other ring
. The alls wever these
ce sible
be passed to the extend_pool() system call. The extra parameter serves nopurpose. This error code can be ignored only if the pool was extended. Ignothe error causes the current allocation to be retried. Note that the error handcalled in a state where the dispatcher is locked. The error handler is thereforallowed to perform any operations or system calls that would cause a proceswitch to be attempted. As a special case, it is however possible to use thesignal_fsem() and signal_sem() calls because these calls were designed to in this situation. Further, if the pool serves interrupt or timer processes, the ehandler is assumed to disable interrupts before calling extend_pool() and restthe previous interrupt status upon return.
0x1d OSE_EKILLED_STATIC_SEMAPHORE
An attempt to kill a static semaphore was made.Only semaphores created witcreate_sem system call can be killed.
0x1e OSE_EKILLED_SEMAPHORE_IN_USE
An attempt to kill a semaphore that is still in use was made. A semaphore cabe killed when there are processes waiting at it.
0x1f OSE_EILLEGAL_SEMAPHORE
An illegal semaphore pointer was presented to the kernel. This error also ocwhen a semaphore that is not available to the calling process is killed. A semaphore in another memory segment is unavailable in some memory configurations. Ignoring this error causes the system call to return as if it wanever called.
0x20 OSE_ENO_USER_SIGSPACE
Out of space in a user signal pool. An error handler may extend the pool withextend_pool() system call. The extra parameter contains a pool identifier thabe passed to the extend_pool() system call. The extra parameter serves nopurpose. This error code can be ignored only if the pool was extended. Ignothe error causes the current allocation to be retried.
Note that the error handler is called in a state where the dispatcher is lockederror handler is therefore not allowed to perform any operations or system cthat would cause a process switch to be attempted. As a special case, it is hopossible to use the kill_proc(), signal_fsem() and signal_sem() calls because calls were designed to work in this situation.
Further, if the pool serves interrupt or timer processes, the error handler is assumed to disable interrupts before calling extend_pool() and restoring theprevious interrupt status upon return.
0x21 OSE_EPOOL_EXTENSION_FAILED
Pool extension failed. An error handler repeatedly claims that an out of spaerror was handled, but the kernel can not find the extended space. It is posthat the error handler never used the extend_pool() system call.
The extra parameter contains a the initial error code. I.e one of:
nual / R1.0.4 OSE / Kernel - 6 : 2s
Reference MaError Message
Ker
nel
r the e
tack
mber
eady tor. m as
nt to ss is ess.
page made
was the
• OSE_ENO_KERN_SPACE
• OSE_ENO_USER_SIGSPACE
• OSE_ENO_USER_STACKSPACE.
This error is fatal when it occurs in an interrupt process. If it is not, the errohandler is expected to kill the current process. For errors in the kernel pool,recover procedure may not be straight forward so it is recommended that thsystem is shut down or restarted by the system error handler.
0x22 OSE_EBLOCK_HAS_PROCESSES
The create_pool system call was used on a block that contains processes.
0x23 OSE_EUNREASONABLE_SIZES
The create_pool system call was exposed to an illegal signal size table or ssize table. This error code is used in any of the following illegal cases:
1. The count field in the first location is unreasonable.Valid counts are 0-8, but both tables can not have a count of zero.
2. The supplied memory fragment does not fit in the address space.
3. The size table is not properly sorted on size.
4. All sizes in a table are zero.
Ignoring this error causes the system call to return as if it was never called.
0x24 OSE_ETOO_MANY_ATTACHED
Too many signals were attached. The system tables allows only a certain nuof attached signals. This number was exceeded.
0x25 OSE_EVECTOR_IN_USE
Vector already in use. An interrupt process was created for a vector that is alrallocated to another interrupt process. The extra parameter contains the vecIgnoring this error causes the interrupt process to be removed from the systeif it was never created.
0x26 OSE_EILLEGAL_SYSTEMCALL
Illegal system call from an interrupt process. The current interrupt or timer process has been using a system call that is only allowed for non interrupt processes.
0x27 OSE_EINTERSEGMENT_SEND
Illegal intersegment send to an interrupt or timer process. Signals can be seinterrupt or timer processes only if the pool associated with the target procein the same memory segment as the pool associated with the sending proc
This restriction is present because an interrupt process can not handle the fault that might occur when a reference to the senders memory segment is at the time of the receive call in the interrupt process.
0x28 OSE_EBAD_INTLEVEL
Illegal wakeup priority for an interrupt process. The current interrupt process invoked with a hardware priority that does not match the priority stated when
nual / R1.0.4 OSE / Kernel - 6 : 3s
Reference MaError Message
Ker
nel
call
was meter This ss/use
was tra t be e r to
egal es are lue. et to
his er
it is This ess.
etach tach in all
caller
interrupt process was created. The priority parameter in the create_processmust match the actual hardware priority at which the interrupt occurs.
The extra parameter to the error handler contains the actual priority encountered.Ignoring this error causes the process priority to be updated.
0x29 OSE_ERECURSIVE_ERROR
An error was encountered while an error handler was executing. The situationdetected in an error system call made by the current process. The extra parato the error handler contains the error code supplied in the error system call.error must be handled in a system error handler by killing the current proceprogram. The error can not be ignored, and attempting to ignore it will only cathe error to be reported again with the fatal flag set.
0x2a OSE_ERECURSIVE_SYSERROR
An error was encountered while an error handler was executing.The situationdetected when an error detected by OSE was about to be reported. The exparameter to the error handler contains the error code that was about to bereported by OSE when the recursive error call was detected. This error mushandled in a system error handler by killing the current process/program. Therror can not be ignored, and attempting to ignore it will only cause the errobe reported again with the fatal flag set.
0x2b OSE_EILLEGAL_SEM_VALUE
An semaphore with a negative initial value was found or created. This is an illsituation since a negative semaphore value implies that one or more processwaiting at the semaphore. The extra parameter contains the illegal initial vaIgnoring this error causes the semaphore to be created with an initial value szero.
0x2c OSE_EINTERSEGMENT_SEMAPHORE_REF
A semaphore in use was implicitly killed, but processes are still waiting at it. Terror occurs when processes erroneously use a semaphore located in anothmemory segment. This is illegal, but in a system without memory protectionworks up to the point when the memory segment containing the semaphorereclaimed. This occurs when all processes in that segment have been killed.error must be handled in a system error handler by killing the offending procThe id of this process is passed to the error handler in the extra parameter.
0x2d OSE_EDETACHED_TWICE
An attempt to detach from an already detached process was made.Only one dcall may be issued for each attach call made.This error may also occur if deis called with a bad parameter.The kernel can not understand the difference cases. Ignoring this error causes detach() to perform no operation.
0x2e OSE_EDETACHED_TOO_LATE
An attempt was made to detach from a process long after the death of thatprocess.This error implies that the attached process has been killed, and the
nual / R1.0.4 OSE / Kernel - 6 : 4s
Reference MaError Message
Ker
nel
ach too
it in d g this ust be
as
sent inter red.
so s the d of
was
s an
ed hich ime .
r of
ring
ernel ontains
failed to notice this for a period long enough for the kernel to discard all attinformation for that process. The error can sometimes occur as a result of asmall number of attach entries defined in the kernel configuration. If you encounter this error for no apparent reason, then try increasing the attach limthe configuration file. This error may also occur if detach is called with a baparameter. The kernel can not understand the difference in all cases. Ignorinerror causes the same effect as if detach() was never called, i.e the caller mprepared to receive a subsequent attached signal from the killed process.
0x2f OSE_EDETACH_AFTER_RECEIVE
An attempt was made to detach from a process when the attached signal halready been received.
0x30 OSE_EBAD_PROCESS_TYPE
An attempt was made to create a process of an invalid type.
0x31 OSE_EUSED_NIL_POINTER
The caller tried to operate on the NIL pointer. The buffer has probably been or freed already. The extra parameter contains the address of the signal pothat points to NIL. Ignoring this error causes the illegal system call to be igno
0x32 OSE_EILLEGAL_PROCESS_ID
An illegal block or process id was presented to the kernel.This code may alindicate a bad process id in a redirection table.The extra parameter containoffending id.Ignoring this error causes the system call to treat the id as the ia killed process.
0x47 OSE_EILLEGAL_FLUSH_SENDER
An invalid process id was encountered in the flush system call.The invalid id found in the array specifying from which processes signals should be discarded.This error may also indicate that the first entry of the array containinvalid array size.
0x48 OSE_EKILLED_STATIC_PROCESS
A static process was killed. Killing a static process is illegal in a system linkto an OSE realtime kernel.The error was reported by the system daemon, wdetected the death of the main process in osemain.c. It is unknown at this twhich process was originally killed, since all static processes are now dead
0x49 OSE_EILLEGAL_REDIRCOUNT
An invalid redirection table was presented to the kernel. The count of numbeentries was zero. It must always be at least one, since the first table entry containing the count and the default process id is included in the counter. Ignothis error causes the illegal system call to be ignored.
0x4a OSE_ECORRUPTED_KERNEL
Kernel data was damaged. The kernel tables were found to be inconsistent.Kdata may have been damaged by a crashed process.The extra parameter can undocumented subcode.
nual / R1.0.4 OSE / Kernel - 6 : 5s
Reference MaError Message
Ker
nel
l ating uing out ler
eter.
d to pools ms e to er to eue.
ient . This rrupt
ority
d and rnel rrupt ck to
E rror
auses
error dress
0x52 OSE_ESPURIOUS_INTERRUPT
An interrupt occurred from an unused interrupt vector. There may be severareasons for this. Possible reasons might be that hardware capable of generinterrupt was erroneously initialized, or the system was restarted without issa proper hardware reset, or an interrupt process might have been killed withdisabling the corresponding hardware.The extra parameter to the error handcontains the priority on which the interrupt was encountered.
0x53 OSE_EATTACHED_TO_CALLER
An attempt was made to attach to the current process.
It is illegal to issue an attach call with the id of the calling process as a param
0x54 OSE_EINTERSEGMENT_COPY_FAILED
The current receive(from/w_tmo) system call failed because the pool attachethe calling process does not support the size of the signal received. Planning with regard to the largest available buffer size is an important issue in systewhere intersegment memory protection is utilized. It is nearly always advisablhave all pools support a largest signal size of 64k bytes. The extra parametthe error handler contains the size of the signal buffer found in the receive quIgnoring this error causes the received signal to be lost.
0x55 OSE_EINTSTACK_TOO_LARGE
Too large interrupt stack buffer requested.There is no interrupt stack of sufficsize in the system pool.The extra parameter contains the accummulated sizeerror does not necessarily mean that a real problem is present since the intestack size accumulates worst stack case requirements on each interrupt priover the system life.
If the system is designed such that interrupt processes are frequently createkilled on various interrupt priorities, then a situation may arise where the kethinks that the interrupt stack needs to be larger than actually required by inteprocesses currently in operation. Ignoring this error causes the interrupt stabe silently truncated to the largest size available.
0x56 OSE_EKILLED_SYSTEM_DAEMON
An attempt was made to kill a system daemon. Killing a member of the OSblock such as “ose_sysd” or “idle” is not allowed.The extra parameter to the ehandler contains the process id of the system daemon. Ignoring this error cthe kill_proc call to return without killing the system daemon.
0x57 OSE_ECANNOT_RESTORE
Restore was attempted on a signal buffer that has already been freed or is otherwise not owned by any process. Such buffers can not be restored. Thismay also occur for a wild signal pointer. The extra parameter contains the adof the signal buffer.
0x58 OSE_EFRAGMENT_TOO_SMALL
nual / R1.0.4 OSE / Kernel - 6 : 6s
Reference MaError Message
Ker
nel
t. itrary less. f the s the ll to
call
stem is a
m calls er uses
stem was meter the
can is he a
call by a gal
ued s is
An attempt was made to install an unreasonably small pool or pool fragmenPool fragments smaller than 1024 bytes are rendered useless. This is an arblimit, selected because it is believed that fragments this small are always useAs a general guideline, fragments should be at least several times the size olargest buffer or stack size. The extra parameter to the error handler containsize of the supplied pool fragment. Ignoring this error causes the system careturn without creating the pool or installing the pool extension. I.e. as if the was never made.
0x59 OSE_ECONCURRENT_TICK_CALL
Tick was called concurrently by several processes. Tick is a non reentrant sycall. Only one process at a time may use it, or the system will crash. This fatal error.
0x5a OSE_EILLEGAL_USER_CALL
A superuser system call was used by a non superuser process. Some systeare reserved for use by processes with a user number of zero (the superusnumber). Using these calls in other processes is illegal. Ignoring this error cathe illegal system call to be ignored.
0x5b OSE_EALLREADY_STARTED
An attempt was made to start a process that is not stopped. The start() sycall was invoked with either a process or a block id. For a block id, the block found to contain at least one process that was not stopped. The extra paracontains the id that was passed to the start() call. Ignoring the error causesstart() system call to continue, starting only stopped processes.
0x5c OSE_ELINKHANDLER_DEADLOCK
A linkhandler deadlock was detected. This error was probably caused by alinkhandler process issuing a hunt() system call or another system call that cause a remote system call request. Doing this is a design rule violation. Ithowever possible that the error was instead caused during debugging or if tlinkhandler was stopped or intercepted for more than 10 seconds. The extrparameter contains the process id of the linkhandler that did not respond. Ignoring this error causes the kernel to continue waiting for a response.
0x5d OSE_EILLEGAL_ENVNAME
An illegal environment variable name was detected. A set_env() or get_env()was issued with a name parameter set to NULL. This was probably causedproblem related to uninitialized variables. Ignoring this error causes the illesystem call to be ignored.
0x5e OSE_EILLEGAL_POOL
An illegal pool id was presented to the kernel. The extend_pool() call was isswith a pool_id parameter that refers to an object that is not a pool. This waprobably caused by a problem related to uninitialized variables. Ignoring therror causes the illegal system call to be ignored.
nual / R1.0.4 OSE / Kernel - 6 : 7s
Reference MaError Message
Ker
nel
may the ll to
was eter d a ed.
cks e
illegal
ed in ted. ntly
the stake of the e
ode ode.
ring mode.
ses. gnal.
The nt to ably e of the
0x5f OSE_ENOT_SIG_OWNER
The calling process is not the owner of the specified signal buffer. This error sometimes also occur for a wild signal pointer. The extra parameter containsaddress of the signal buffer. Ignoring this error causes the illegal system cabe ignored.
0x70 OSE_EWILD_SIG_POINTER
An invalid signal pointer was presented to the kernel. The operating systemunable to identify the memory pointed to as a signal buffer. The extra paramcontains the offending pointer, that is the address that should have containesignal number. Ignoring this error causes the illegal system call to be ignor
0x71 OSE_EBAD_PARAMETER
An invalid parameter was used in a system call. The operating system chemany of the system call parameters for unreasonable values. This error codmeans that one of the parameters to the indicated system call contained an value. The extra parameter contains the value of the offending parameter. Ignoring this error causes the illegal system call to be ignored.
0x72 OSE_EFRAGMENT_IN_USE
An attempt was made to create a pool with a memory area that is already usanother pool. This error commonly occurs when a block is killed and recreaThe old pool is probably still in use because it contains signals that are curreowned by a process that is still alive. Pools don’t die until the last signal in pool has been freed. This error can also be reported if pool space is by miallocated on the stack of the caller. The extra parameter contains the base offending pool space. Ignoring this error causes the illegal system call to bignored.
0x73 OSE_EILLEGAL_SUPER_MODE
An illegal attempt was made to create a supervisor mode block. Supervisor mblocks can only be created by a superuser process executing in supervisor mThe extra parameter contains a pointer to the name of the new block. Ignothis error causes the block to be created anyway, but the mode is set to user
0x74 OSE_ESPURIOUS_SYSTEM_SIGNAL
An unrecognized signal was received by one of the system daemon procesThe extra parameter contains the process id of the sender of the unknown siIgnoring this error causes the signal to be silently freed.
0x75 OSE_EFRAGMENT_TOO_LARGE
An attempt was made to install an unreasonably large pool or pool fragment. size of the pool fragment presented to the kernel is too large for the fragmefit in the address space. This error indicates either that the size is unreasonlarge, or that the base of the memory fragment is too close to the end of thaddress space. The extra parameter to the error handler contains the size supplied pool fragment. Ignoring this error causes the system call to return
nual / R1.0.4 OSE / Kernel - 6 : 8s
Reference MaError Message
Ker
nel
as
This extra ring ion.
he es value or e fast thout
he noring
l that
e r the
el. the This ss/use
t the ting
without creating the pool or installing the pool extension. I.e. as if the call wnever made.
0x76 OSE_ESTOP_OVERFLOW
An attempt was made to stop a process an unreasonable number of times.error occurs when the stop-counter wrapps from 4 Giga times to zero. The parameter to the error handler contains the id of the process stopped. Ignothis error causes the system call to return without executing the stop operatI.e. as if the call was never made.
0x77 OSE_ESEM_OVERFLOW
An attempt was made to signal a semaphore or a fast semaphore beyond tmaximum value. Semaphores can only be signaled a limitied number of timbefore a wait operation is performed. This error occurs when the semaphore wrapps from 2 Giga times to -2 Giga times. The extra parameter to the errhandler contains the address of the semaphore or the process id to which thsemaphore belongs. Ignoring this error causes the system call to return wiexecuting the semaphore operation. I.e. as if the call was never made.
0x78 OSE_EBAD_HUNT_PRI
This is the result of a bad kernel configuration. The huntd priority is too low. Tose_huntd process must have a priority higher than the ose_sysd process. Igthis error causes the priorities to be automatically adjusted.
0x79 OSE_EILLEGAL_PRISYSTEMCALL
An illegal system call was made from interrupt or background process. The current background, interrupt or timer process has been using a system calis only allowed for prioritized processes.
0x7a OSE_EILLEGAL_CONFIGURATION
This is the result of an illegal kernel configuration. One or more entries in thkernel configuration file has an illegal value. The extra parameter to the errohandler contains this value. Ignoring this error will cause the kernel to adjustvalue to the closest legal value.
0xa5 OSE_ENO_BUFFER_END_MARK
A valid end mark could not be found in the signal buffer presented to the kernThe calling process seems to have been writing more data than the size of buffer allows. The extra parameter contains the address of the signal buffer. error must be handled in a system error handler by killing the current proceprogram. The error can not be ignored, and attempting to ignore it will only cathe error to be reported again with the fatal flag set.
0xa6 OSE_ECORRUPTED_POOL
A damaged signal buffer was presented to the kernel. Analysis indicates thaproblem was caused by some other buffer in which a process has been wrimore data than the size of the buffer allows.
nual / R1.0.4 OSE / Kernel - 6 : 9s
Reference MaError Message
Ker
nel
and
field the
ould
This
the by
k end.
stack
stack
r
a
pace.
The extra parameter contains a pointer to a structure with four 32 bit entriesthe following layout:
• extra[0]The process id of the other process that may have caused the problem. Themay contain the id of any process including the current. The field is zero ifid could not be obtained.
• extra[1]A pointer to the name of the other process. The field is zero if the name cnot be obtained.
• extra[2]A pointer to the signal buffer that was damaged by the indicated process. is probably the buffer which was originally damaged.
• extra[3]A pointer to the damaged signal buffer that was presented to the kernel bycalling process. This is probably only a secondary error indication causedthe extra[2] buffer.
6.1.1 Target-specific error codesThese error codes are only valid for realtime kernels not softkernels.
0x101 OSE_EUSER_STACK_OVERFLOW
Stack overwrite in user stack. The extra parameter contains address of stac
0x102 OSE_ESUPERV_STACK_OVERFLOW
Stack overwrite in supervisor stack. The extra parameter contains address ofend.
0x103 OSE_EINTERRUPT_STACK_OVERFLOW
Stack overwrite in interrupt stack. The extra parameter contains address of end.
0x104 OSE_EUNKNOWN_BREAKPOINT
An unknown breakpoint was encountered.
0x105 OSE_EUNKNOWN_INTERRUPT
An unknown interrupt was encountered. The extra parameter contains vectonumber.
0x107 OSE_EPROCESS_ENDED
A prioritised or background process ended. This error should be treated as warning. The extra parameter contains the process id.
0x108 OSE_ESTART_STACK_OVERFLOW
Stack overwrite in kernel startup stack. A handler has used too much stack sThe extra parameter contains address of stack end.
0x110 OSE_EUNDEFINED_SYSCALL_CODE
nual / R1.0.4 OSE / Kernel - 6 : 10s
Reference MaError Message
Ker
nel
eter
code
ng en low wer lid
An undefined function code has been used for a system call. The extra paramthe contains function code.
0x111 OSE_EUNEXPECTED_EXCEPTION
An unexpected exception occured. The exception offset is supplied in the subfield. The extra parameter contains the pc register (the Program counter).
0x112 OSE_EPRIORITY_ERROR
An interrupt has occurred with equal or less priority than the currently runniinterrupt process. The reason for this is probably that interrupts have not bemasked properly in the interrupt controller. The interrupt controller must not alan interrupt process to be interrupted by an interrupt process with equal or lopriority. The extra parameter contains the illegal priority. This error is only vaon PowerPC targets.
nual / R1.0.4 OSE / Kernel - 6 : 11s
Reference MaError Message
Ker
nel
hen
6.2 Caller Information ReferenceThe following is a list of all constants used to determine which system call was in progress wan error was encountered.
Caller No Symbolic routine name
0x010000 OSE_ADDRESSEE
0x020000 OSE_ALLOC
0x030000 OSE_ASSIGN_LINKHANDLER
0x040000 OSE_ATTACH
0x050000 OSE_ATTACH_SEGMENT
0x060000 OSE_CLEAR_BP
0x070000 OSE_CREATE_BLOCK
0x080000 OSE_CREATE_ERROR_HANDLER
0x090000 OSE_CREATE_POOL
0x0a0000 OSE_CREATE_PROCESS
0x0b0000 OSE_CREATE_SEM
0x0c0000 OSE_CURRENT_PROCESS
0x0d0000 OSE_DELAY
0x0e0000 OSE_DETACH
0x0f0000 OSE_ERROR
0x100000 OSE_FLUSH
0x110000 OSE_FREE_BUF
0x120000 OSE_GET_BID
0x130000 OSE_GET_BID_LIST
0x140000 OSE_GET_CPU
0x150000 OSE_GET_ENV
0x160000 OSE_GET_ENV_LIST
0x170000 OSE_GET_FSEM
0x180000 OSE_GET_MEM
0x190000 OSE_GET_PCB
0x1a0000 OSE_GET_PID_LIST
0x1b0000 OSE_GET_PRI
0x1c0000 OSE_GET_PTYPE
0x1d0000 OSE_GET_SEM
0x1e0000 OSE_GET_SIGNAL
0x1f0000 OSE_GET_SYSTIME
0x200000 OSE_GET_TICKS
nual / R1.0.4 OSE / Kernel - 6 : 12s
Reference MaError Message
Ker
nel
Caller No Symbolic routine name
0x210000 OSE_GET_UID
0x220000 OSE_HUNT
0x230000 OSE_HUNT_FROM
0x240000 OSE_INTERCEPT
0x250000 OSE_KILL_PROC
0x260000 OSE_KILL_SEM
0x270000 OSE_POWER_FAIL
0x280000 OSE_RECEIVE
0x290000 OSE_RECEIVE_FROM
0x2a0000 OSE_RECEIVE_W_TMO
0x2b0000 OSE_RESTORE
0x2c0000 OSE_RESUME
0x2d0000 OSE_SEND
0x2e0000 OSE_SENDER
0x2f0000 OSE_SEND_W_S
0x300000 OSE_SET_BP
0x310000 OSE_SET_ENV
0x320000 OSE_SET_FSEM
0x330000 OSE_SET_MEM
0x340000 OSE_SET_PCB
0x350000 OSE_SET_PRI
0x360000 OSE_SET_SEGMENT
0x370000 OSE_SIGSIZE
0x380000 OSE_SIGNAL_FSEM
0x390000 OSE_SIGNAL_SEM
0x3a0000 OSE_START
0x3b0000 OSE_START_OSE
0x3c0000 OSE_STOP
0x3d0000 OSE_SYSTEM_TICK
0x3e0000 OSE_TICK
0x3f0000 OSE_WAIT_FSEM
0x400000 OSE_WAIT_SEM
0x410000 OSE_WAKE_UP
0x420000 OSE_EXTEND_POOL
0x440000 OSE_SET_PRI_FOR
nual / R1.0.4 OSE / Kernel - 6 : 13s
Reference MaError Message
Ker
nel
which
and
le.
6.3 Interface Library ErrorsThis is a summary of error codes, in hexadecimal representation, used by the interface library,is described in the OSE Real Time Kernel User’s Guide.
Error Code Description
0x9520 The system can not be created due to a circular dependency between blocks, remote call server processes, redirection tablesprocesses.
0x9521 An external process could not be found within the specified timeout.
0x9522 No static processes were found. There must be at least one.
0x9523 An unexpected value appear in a statically initialized test variabThis is a check that initialization of static C variables works.
nual / R1.0.4 OSE / Kernel - 6 : 14s
Reference MaError Message
Ker
nel
table
.
as
6.4 Kernel Error SummaryThis is a summary of the error code list in the previous chapter.
Error Code Description
0x01 Too large stack buffer requested.
0x02 Out of space in user stack pool.
0x03 Too many processes were created.
0x11 Too large signal buffer requested.
0x12 Out of space in kernel pool.
0x1d An attempt to kill a static semaphore was made.
0x1e An attempt to kill a semaphore that is still in use was made.
0x1f An illegal semaphore pointer was presented to the kernel.
0x20 Out of space in user signal pool.
0x21 Pool extension failed.
0x22 The create_pool system call was used on a block that contains processes.
0x23 The create_pool system call was presented a signal size table or a stack sizethat contains an unreasonable number in the first location.
0x24 Too many signals were attached.
0x25 Vector already in use.
0x26 Illegal system call from an interrupt process.
0x27 Illegal intersegment send to an interrupt or timer-interrupt process.
0x28 Illegal wakeup priority for an interrupt process.
0x29 An error was encountered while an error handler was executing.
0x2a An error was encountered while an error handler was executing.
0x2b A semaphore with a negative initial value was found or created.
0x2c A semaphore in use was implicitly killed, but processes are still waiting at it
0x2d An attempt to detach from an already detached process was made.
0x2e An attempt was made to detach from a process long after the death of thatprocess.
0x2f An attempt was made to detach from a process when the attached signal halready been received.
0x30 An attempt was made to create a process of an invalid type.
0x31 The caller tried to operate on the NIL pointer.
0x32 An illegal block or process ID was presented to the kernel.
0x47 An invalid process ID was encountered in the flush system call.
0x48 A static process was killed. Killing a static process is illegal.
0x49 An invallid redirection table was presented to the kernel.
0x4a Kernel data was damaged.
nual / R1.0.4 OSE / Kernel - 6 : 15s
Reference MaError Message
Ker
nel
o the
ed in
ses.
t.
he
her
nel.
0x52 An interrupt occured from an unused interrupt vector.
0x53 An attempt was made to attach to the current process, this is illegal.
0x54 The current receive (or similar) system call failed because the pool attached tcurrent process does not support the size of the signal received.
0x55 A too large interrupt stack was requested.
0x56 An attempt was made to kill a system daemon, this is illegal.
0x57 Restore was attempted on a signal buffer that has already been freed or is otherwise not owned by any process.
0x58 An attempt was made to install an unreasonably small pool fragment.
0x59 The tick system call was called concurrently by several processes.
0x5b An attempt was made to start a process that is not stopped.
0x5c A linkhandler deadlock was detected.
0x5d An illegal environment variable name was detected.
0x5e An illegal pool id was presented to the kernel.
0x5f The calling process is not the owner of the specified signal buffer.
0x70 An invalid signal pointer was presented to the kernel.
0x71 An invalid parameter was used in a system call.
0x72 An attempt was made to create a pool with a memory area that is already usanother pool.
0x73 An illegal attempt was made to create a supervisor mode block.
0x74 An unrecognized signal was received by one of the system daemon proces
0x75 An attempt was made to install an unreasonably large pool or pool fragmen
0x76 An attempt was made to stop a process an unreasonable number of times.
0x77 An attempt was made to signal a semaphore or a fast semaphore beyond tmaximum value.
0x78 The huntd priority is too low. The ose_huntd process must have a priority higthan the ose_sysd process.
0x79 An illegal system call was made from interrupt or background process.
0x7a One or more entries in the kernel configuration file has an illegal value.
0xa5 A valid end mark could not be found in the signal buffer presented to the ker
0xa6 A damaged signal buffer was presented to the kernel.
nual / R1.0.4 OSE / Kernel - 6 : 16s
Reference MaError Message
Ker
nel
ng
6.4.1 Target-specific error summary0x101 A user stack overflow was encountered.
0x102 A supervisor stack overflow was encountered.
0x103 An interrupt stack overflow was encountered.
0x104 An unknown breakpoint was encountered.
0x105 An unknown interrupt was encountered.
0x107 A prioritized or background process ended.
0x108 Startup stack overflow.
0x110 An undefined function code has been used for a system call.
0x111 An unexpected exception occurred.
0x112 An interrupt has occurred with equal or less priority than the currently runniinterrupt process.
nual / R1.0.4 OSE / Kernel - 6 : 17s
Reference MaGlossary
Ker
nel
hed
he
A
tion.
cess.
o s
is ror
n a
ast t
nt
7 GlossaryANSI American National Standards Institute.
ASCII American National Standard Code for Information Interchange.
attach In OSE, a system call that attaches a signal to a process. Attacsignals are returned to their owners when the process with theattached signals is killed.
block OSE processes can be grouped together into blocks. Several commands allow blocks to be operated upon as single units. Tblock is an excellent means of grouping logically connected processes into bigger and fewer functional units.
buffer A section of memory. It is reserved using the alloc system call.buffer always has an owner.
configuration The operating system may contain different parts of code and parameters and behave differently depending on the configura
debugging Locating and removing errors from a system.
default An attribute, value or option that is used when no alternative isspecified.
dispatch To swap out a running process and swap in another ready pro
dispatcher A part of the kernel which performs a dispatch.
dynamic process A process that can be created and killed during run-time.
environment variable Using OSE environment variables it is possible for a process tdistribute information to other processes. Environment variableshould be used sparingly and only for infrequently updated information.
error checks An ability to turn on or turn off certain error checking in OSE. Thcapability allows the OSE user to get maximum speed when erchecking is no longer needed.
event 1. Something which happens in the system. For example, the operator may have pressed a button or a resource becomes available. Events are often connected to interrupts or polled.2. For the DDS, event has a special meaning; an event is wheuser defined condition is fulfilled.
fast semaphore The fastest way in OSE to obtain process synchronisation. A fsemaphore does not give the possibility to transfer informationbetween processes. A process cannot have more than one fassemaphore.
fault tolerant system A single or multi CPU system capable of recovering from differekinds of errors or malfunctions.
nual / R1.0.4 OSE / Kernel - 7 : 1
Reference MaGlossary
Ker
nel
dlers
.
cts cess sses.
to pt
re ;
ike ion.
the
rts
t, y.
E
dler.
pool
handlers In OSE, a handler is a piece of code which is automatically executed when a system event has occurred. Examples of hanare swap in handler, swap out handler and send handler. Availability of handlers is strongly implementation dependent.
hunt An OSE system mechanism, mainly used for multi-CPU communication, to get the process identity of a named process
intercepted A state an OSE process enters when a breakpoint is reached.
interface The boundary between processes. Together, all possible contabetween two processes defines their interface. In OSE, the prointerface consists of the signals exchanged between the proce
interrupt An event which, through hardware or software, causes the CPUtransfer control from the currently running process to an interruprocess.
interrupt process An OSE interrupt process is called when a hardware or softwainterrupt occurs. Two types of interrupt processes exist in OSEinterrupt processes and timer-interrupt processes.
kernel The central part of an operating system which handles things ldispatching, resource allocation and inter process communicat
level A The simplest of the OSE implementation levels. Also known as portable set.
level B The OSE implementation levels which contains all necessary pato build a distributed real time system.
level C Complete kernel configuration except for memory managemenlocal pools, user numbers and complete breakpoint functionalit
level D The complete kernel configuration.
link handler Handles signal exchange between remote processes in an OSsystem.
logical channel A link between remote processes that is managed by a link han
MMU A memory management unit (MMU) is hardware capable of protecting memory areas from illegal access.
multi CPU systems A system with more than one CPU and with some connection between the CPUs.
NIL A constant defined by OSE. Used as a return value in receive,receive_w_tmo and receive_from system calls when no signal buffer could be received.
NULL A pointer guaranteed not to point to a data object.
phantom process An empty process with an optional redirection table.
pool A contiguous area of memory from which signal buffers, stacksand kernel areas are allocated. There may be more than one in OSE.
nual / R1.0.4 OSE / Kernel - 7 : 2
Reference MaGlossary
Ker
nel
t
the der
its
the
;
d ed
al.
cute ns;
ies
PUs.
a
ism
ally
is gh
tic
pre-emption Interrupting an activity in progress immediately without letting ifinish, and starting some other activity.
priority Each process in an OSE system has a priority. The meaning ofpriority differs between process types but always defines the orin which different activities will be carried out.
process Processes are the building blocks in OSE. Each process is a sequential program component that has its own flow-of-control, own stack and CPU registers.
process identity In OSE a number identifying a process. It is necessary to know process identity before you can send a signal to the process.
process state A process running under OSE is always in one of three statesrunning, ready or waiting.
process types Each OSE process is of one of the following process types; interrupt process, timer-interrupt process, prioritized process, background process or phantom process.
real-time operating system Programs which have to react to external events within a limitetime are called real-time programs. An operating system designto handle such programs is a real-time operating system.
redirection table A table defining signal routes to receivers other than the originProcesses may be equipped with redirection tables.
re-entrant Code is re-entrant if more than one process at a time may exeit. This requires that the code does not use fixed variable locatioit must use registers or stack, i.e. only relative addressing is allowed. The OSE system calls are re-entrant but many C-librarare not.
remote system calls System calls which operate on processes or blocks in other C
scheduling The way the operating system selects which process to run atgiven instant.
segments Pools may be grouped together into segments.
semaphore In OSE, a way to obtain a fast process synchronisation mechanwhen no data needs to be transferred between processes.
signal The most common way in OSE to transfer information betweenprocesses. A signal is a buffer allocated from the kernel and usucontains data.
signal redirection In OSE it is possible to change the addressee of a signal. Thiscalled signal redirection. Signal redirection is maintained throua redirection table.
software event A way to wake up an interrupt process directly from another process by sending a signal to it.
static process Processes which are created by the kernel at system start. Staprocesses may never be killed.
nual / R1.0.4 OSE / Kernel - 7 : 3
Reference MaGlossary
Ker
nel
ss to
in
to tick
E ith s.
superuser In OSE, a process with user number 0. The superuser has acceall other processes.
supervisor A CPU dependent execution mode. In OSE a process runningsupervisor mode does not necessarily have to be a superuser.
swap Refers to exchanging control from one process to another.
system calls The interface between application processes and the kernel. Usually a function call in the C programming language.
system processes Internal processes in an OSE implementation.
system tick In OSE, system tick is a counter which is incremented by a callthe system function tick. Timer-interrupt processes, delays andtimeouts are dependent on the system tick to work. The system should be generated from a system hardware timer.
user number To protect functionally separated software from each other, OSequips processes with user numbers. With one exception, onlyprocesses having the same user number may communicate weach other. The superuser can communicate with all processe
nual / R1.0.4 OSE / Kernel - 7 : 4
Reference MaASCII Charact
Ker
nel
Appendix A ASCII Character Set
ASCII control characters
ASCII normal characters
Dec Hex Dec Hex
0 0 NUL Null 16 10 DLE Data linkescape
1 1 SOH Start of heading 17 11 DC1 Device control 1
2 2 STX Start of text 18 12 DC2 Device control 2
3 3 ETX End of text 19 13 DC3 Device control 3
4 4 EOT End of transmis-sion
20 14 DC4 Device control 4
5 5 ENQ Enquiry 21 15 NAK Negative Ac-knowledge
6 6 ACK Acknowledge 22 16 SYN Synchronous idle
7 7 BEL Bell 23 17 ETB End of transmis-sion block
8 8 BS Backspace 24 18 CAN Cancel
9 9 HT Horizontal tab 25 19 EM End of medium
10 A LF Line feed 26 1A SUB Substitute
11 B VT Vertical tab 27 1B ESC Escape
12 C FF Form feed 28 1C FS File separator
13 D CR Carriage return 29 1D GS Group separator
14 E SO Shift out 30 1E RS Record separa-tor
15 F SI Shift in 31 1F US Unit separator
Dec Hex Dec Hex Dec Hex
32 20 Space 64 40 @ 96 60 ’
33 21 ! 65 41 A 97 61 a
34 22 " 66 42 B 98 62 b
35 23 # 67 43 C 99 63 c
36 24 $ 68 44 D 100 64 d
37 25 % 69 45 E 101 65 e
38 26 & 70 46 F 102 66 f
39 27 ' 71 47 G 103 67 g
40 28 ( 72 48 H 104 68 h
41 29 ) 73 49 I 105 69 i
nual / R1.0.4 OSE / Kernel - Appendix A : 1er Set
Reference MaASCII Charact
Ker
nel
42 2A * 74 4A J 106 6A j
43 2B + 75 4B K 107 6B k
44 2C , 76 4C L 108 6C l
45 2D - 77 4D M 109 6D m
46 2E . 78 4E N 110 6E n
47 2F / 79 4F O 111 6F o
48 30 0 80 50 P 112 70 p
49 31 1 81 51 Q 113 71 q
50 32 2 82 52 R 114 72 r
51 33 3 83 53 S 115 73 s
52 34 4 84 54 T 116 74 t
53 35 5 85 55 U 117 75 u
54 36 6 86 56 V 118 76 v
55 37 7 87 57 W 119 77 w
56 38 8 88 58 X 120 78 x
57 39 9 89 59 Y 121 79 y
58 3A : 90 5A Z 122 7A z
59 3B ; 91 5B [ 123 7B {
60 3C < 92 5C \ 124 7C |
61 3D = 93 5D ] 125 7D }
62 3E > 94 5E ^ 126 7E ~
63 3F ? 95 5F _ 127 7F Delete
Dec Hex Dec Hex Dec Hex
nual / R1.0.4 OSE / Kernel - Appendix A : 2er Set
Reference MaPortability Con
Ker
nel
he
arts older when
s have CESS
riable
Appendix B Portability ConsiderationsOne fundamental idea when designing OSE Delta was to gather the operating systems for tdifferent CPUs together to make it more general. The major part of OSE Delta is written in C: only the CPU specific parts and very time-critical pare written in assembler. This results in an easy way to port OSE Delta to any target CPU. TheOSE kernels are all written in assembler and are very CPU specific. This can lead to problemsporting an application written for an older OSE kernel to OSE Delta.
Variable sizesThe biggest problem is if the application is dependent on the size of variables, the OSE typeother sizes in OSE Delta than in older OSE kernels. The most obvious examples are the PROand SIGSELECT types. Fortunately, applications written in C are usually not dependent on vasizes.
OSE Delta Older OSE kernelLink Handler
The link handler mechanismis completely new in OSE Delta.
This means that link handlersfor older OSE kernels have to be able to run in an OSE Delta system.
DebuggerInterface
In OSE Delta the debugger interface is the same for all CPUs.
In older OSE kernels the debugger interface is CPUdependent, all kernels have dif-ferent debugger interfaces.
Handlers Because of CPU dependen-cy all the handlers are new in OSE Delta.
Create_procsystem call
The create_proc system call in the OSE Classic kernel is not part of OSE Delta con-cept. It is however still im-plemented for backwards compatibility so it is possi-ble to run an application us-ing the create_proc system call.The create_proc system call should not be used when writing new OSE Delta ap-plications.
nual / R1.0.4 OSE / Kernel - Appendix B : 1siderations
Reference MaPortability Con
Ker
nel
Background Processes
A prioritized process does not have a time slice in OSE Delta. Instead there is a sep-arate process type called background process which always run in strict time sharing mode on a priority level below other processes. The background process level that exists in the OSE Classic kernel is not present in OSE Delta. Another difference concern-ing background processes is that when a background process is swapped out be-fore the time slice has ex-pired the time slice is not restarted when it is swapped in again as in OSE Classic kernels. The background process starts executing at the place in the time slice where it was swapped out.
The background process con-cept is not present in the OSE Classic kernel. Instead there is a background process level.
Wake_upsystem call
The wake_up feature differs between older OSE kernels and OSE Delta.In OSE Delta an interrupt-process can be invoked with the wake_up feature by sending a signal to it. The wake_up call informs the process what caused the in-terrupt. If not used and a signal is sent to an interrupt-process, the process will start executing anyway.
In older OSE kernels the wake_up feature is either acon-figuration option or not present at all.
nual / R1.0.4 OSE / Kernel - Appendix B : 2siderations
Reference MaIndex
Ker
nel
IndexA
addressee 3 : 1addressee process 3 : 92alloc definition 3 : 3assign_linkhandler definition 3 : 5attach definition 3 : 7attach_block definition 3 : 9attach_segment 3 : 10
Bbackground process 3 : 19, 3 : 20, 3 : 54block descriptor 3 : 13, 3 : 75block error handler 3 : 15block ID 3 : 20, 3 : 32, 3 : 56block name 3 : 13block owner 3 : 13block start 3 : 115block status 3 : 13, 3 : 43block type 3 : 54blocks
attaching 3 : 9attaching a pool to 3 : 17block ID 3 : 20, 3 : 32, 3 : 56creating 3 : 13descriptor 3 : 13, 3 : 75killing 3 : 96name 3 : 13owner 3 : 13starting 3 : 115status 3 : 13, 3 : 43stoping 3 : 118
breakpoint 3 : 73, 3 : 96breakpoints
clearing 3 : 11setting 3 : 96
byte order 5 : 1C
caller information reference 6 : 12clear_bp 3 : 11CPU registers 3 : 103CPU type 3 : 35create_block 3 : 13create_error_handler 3 : 15create_pool 3 : 17create_process 3 : 19
nual / R1.0.4
create_sem 3 : 23current owner 3 : 87current_process 3 : 25
Ddata types 4 : 3dead process
breakpoint in 3 : 11, 3 : 96detection of 3 : 7flushing queue of 3 : 30ID of 3 : 32sending signals to 3 : 92, 3 : 95
debugger system callsclear_bp 3 : 11get_mem 3 : 41get_pcb 3 : 43get_poolcb 3 : 50get_sig_info 3 : 58get_signal 3 : 62get_systime 3 : 65intercept 3 : 73resume 3 : 89set_mem 3 : 102set_pcb 3 : 103
delay 3 : 26detach 3 : 27dummy process 3 : 19dynamic semaphore 3 : 23
Eenvironment variable 2 : 2, 2 : 7, 3 : 36, 3 : 37, 3
: 39, 3 : 99, 3 : 100environment variables
reading 3 : 36, 3 : 37, 3 : 39setting 3 : 99, 3 : 100
error 3 : 28, 6 : 12error codes 3 : 28, 3 : 29, 6 : 1error handler 6 : 1system call in progress 6 : 12
error code 3 : 28, 3 : 29error handler 4 : 1, 6 : 1
block error handler 3 : 15, 3 : 28, 3 : 29create_error_handler 3 : 15entrypoint 3 : 14, 3 : 15kernel error handler 3 : 15level of 3 : 15process error handler 3 : 15
error handler entrypoint 3 : 15error level 3 : 15
OSE / Kernel - index : 1
Reference MaIndex
Ker
nel
error messages 6 : 1, 6 : 14, 6 : 15error report 3 : 28, 3 : 29error2 3 : 29
Ffast semaphore 3 : 40, 3 : 101, 3 : 113, 3 : 121fast semaphores
setting 3 : 101signalling 3 : 113value of 3 : 40, 3 : 44waiting for 3 : 122
flush 3 : 30free_buf 3 : 31
Gget_bid 3 : 32get_bid_list 3 : 33get_cpu 3 : 35get_env 3 : 36get_env_list 3 : 37get_envp 3 : 39get_fsem 3 : 40get_mem 3 : 41get_pcb 3 : 43get_pid_list 3 : 47get_pool_list 3 : 49get_poolcb 3 : 50get_pri 3 : 53get_ptype 3 : 54get_segid 3 : 56get_sem 3 : 57get_sig_info 3 : 58get_sig_poolid 3 : 61get_signal 3 : 62get_stk_poolid 3 : 64get_systime 3 : 65get_ticks 3 : 66get_uid 3 : 67
Hhardware interrupt 3 : 20, 3 : 123hardware priority 3 : 123hardware vector 3 : 21header files 4 : 1, 4 : 3hunt 3 : 68hunt_from 3 : 71
Iimplementation level 2 : 1, 3 : 130intercept 3 : 73intercept status 3 : 89
nual / R1.0.4
interrupt process 3 : 19interrupt process priority 3 : 19
Kkernel error handler 3 : 15kill_proc 3 : 75kill_sem 3 : 77
Llink handlers
assign_linkhandler definition 3 : 5byte order 5 : 1example of 5 : 13header file 4 : 1hunt request 3 : 68–3 : 69linkname 3 : 5signal structure 5 : 1
linkname 3 : 5local pools 3 : 17
Mmanifest constants 4 : 1mem_move 3 : 78memory management
attach_block 3 : 9attach_segment 3 : 10creating a pool 3 : 17include files for 4 : 1killing segments 3 : 75moving memory 3 : 78supervising segments 3 : 7writing memory 3 : 102
memory manager 3 : 102memory manager block 3 : 78, 3 : 91, 3 : 108MMU 3 : 78, 3 : 91, 3 : 108, 3 : 109
Nnegative receive specification 3 : 81NIL 3 : 125
OOS_ATTACH_SIG 3 : 127OS_DEBUG 3 : 128OS_PROCESS 3 : 132OS68 3 : 126OSE 3 : 129OSE_I 3 : 131OSE_LEVEL_x 3 : 130OSSIM 3 : 133owner 3 : 3
Pphantom process 3 : 19
OSE / Kernel - index : 2
Reference MaIndex
Ker
nel
poolcreate pool 3 : 17local pool 3 : 17returning memory 3 : 31system pool 3 : 17
power fail handler 3 : 79power_fail 3 : 79prioritized process 3 : 19priority 3 : 19, 3 : 53, 3 : 104, 3 : 105process entrypoint 3 : 19, 3 : 132process error handler 3 : 15process name 3 : 19process start 3 : 89, 3 : 115process status 3 : 43process stop 3 : 118process type 3 : 54processes
background 3 : 19, 3 : 20, 3 : 73, 3 : 89, 3 : 103, 3 : 115, 3 : 118
control block 3 : 43, 3 : 102creating 3 : 19current 3 : 25dummy 3 : 19entrypoint 3 : 19hunting 3 : 68identity 3 : 43, 3 : 47intercepting 3 : 73interrupt 3 : 19, 3 : 73, 3 : 123interrupt vector 3 : 20killing 3 : 75name 3 : 19, 3 : 45, 3 : 68phantom 3 : 19, 3 : 44prioritized 3 : 19, 3 : 89, 3 : 103, 3 : 104, 3 :
105, 3 : 115, 3 : 118priority 3 : 19, 3 : 44, 3 : 53, 3 : 104, 3 : 105redirection table 3 : 20, 3 : 106resuming 3 : 89stack 3 : 19, 3 : 21, 3 : 44starting 3 : 115status 3 : 43, 3 : 73, 3 : 89, 4 : 4stoping 3 : 118superuser 3 : 13suspending 3 : 26timer interrupt 3 : 19, 3 : 20, 3 : 73, 3 : 89, 3
: 115, 3 : 118timeslice 3 : 20type 3 : 19waking up 3 : 123
nual / R1.0.4
programloader 3 : 102R
receive_from 3 : 83receive_w_tmo 3 : 85recieve 3 : 81recieve timeout 3 : 85redirection table 3 : 92remote call server
header files for 4 : 1killing 3 : 75parameter structure 5 : 4signal definition 5 : 1
remote systems callsparameters of 5 : 4remote responses 5 : 3remote_call_server 3 : 13use_remote_calls 3 : 13
remote_call_server 3 : 13restore 3 : 87resume 3 : 89
Ssegment descriptor 3 : 10segment ID 3 : 10segment number 3 : 10segments
attaching 3 : 10descriptor 3 : 10ID 3 : 10killing 3 : 75numbers 3 : 10, 3 : 108select_segment 3 : 91semaphores within 3 : 23setting 3 : 108setting mode 3 : 109supervising 3 : 7supervisor space 3 : 10
semaphore 3 : 114, 3 : 122semaphore value 3 : 57semaphores
create_sem 3 : 23dynamic 3 : 23killing 3 : 23, 3 : 77signalling 3 : 114static 3 : 23value of 3 : 57waiting for 3 : 122
send 3 : 92
OSE / Kernel - index : 3
Reference MaIndex
Ker
nel
send_w_s 3 : 95sender 3 : 94set_bp 3 : 96set_env 3 : 99set_envp 3 : 100set_fsem 3 : 101set_mem 3 : 102set_pcb 3 : 103set_pri 3 : 104set_pri_for 3 : 105set_redirection 3 : 106set_segment 3 : 108set_segment_mode 3 : 109set_sigsize 3 : 110set_suid 3 : 111signal buffer 3 : 3, 3 : 110, 3 : 112signal number 3 : 3, 3 : 81signal owner 3 : 92signal queue 3 : 62, 3 : 81signal structs 4 : 3signal_fsem 3 : 113signal_sem 3 : 114signals
allocating 3 : 3attaching 3 : 7, 3 : 127detaching 3 : 27freeing 3 : 31owner 3 : 3, 3 : 31receiving 3 : 81, 3 : 83redirecting 3 : 92remote signals 5 : 1restoring 3 : 87sending 3 : 92, 3 : 95signal addressee 3 : 1signal number 3 : 7, 5 : 1signal selection 3 : 81, 3 : 83, 3 : 85signal sender 3 : 94signal structures 4 : 3size 3 : 110, 3 : 112union signal 4 : 3
sigsize 3 : 112software event 3 : 123start 3 : 115start_OSE 3 : 117static semaphore 3 : 23stop 3 : 118superuser 3 : 111superuser processes 3 : 10
nual / R1.0.4
superuser system callsattach_block 3 : 9attach_segment 3 : 10mem_move 3 : 78power_fail 3 : 79set_mem 3 : 102set_segment 3 : 108set_segment_mode 3 : 109set_suid 3 : 111tick 3 : 120
supervise a memory segment 3 : 7supervisor space 3 : 10system
shut down 3 : 79starting 3 : 117
system callsaddressee 3 : 1alloc 3 : 3assign_linkhandler 3 : 5attach 3 : 7attach_block 3 : 9attach_segment 3 : 10clear_bp 3 : 11create_block 3 : 13create_error_handler 3 : 15create_pool 3 : 17create_process 3 : 19create_sem 3 : 23current_process 3 : 25delay 3 : 26detach 3 : 27error 3 : 28error2 3 : 29flush 3 : 30free_buf 3 : 31get_bid 3 : 32get_bid_list 3 : 33get_cpu 3 : 35get_env 3 : 36get_env_list 3 : 37get_envp 3 : 39get_fsem 3 : 40get_mem 3 : 41get_pcb 3 : 43get_pid_list 3 : 47get_pool_list 3 : 49get_poolcb 3 : 50get_pri 3 : 53
OSE / Kernel - index : 4
Reference MaIndex
Ker
nel
get_ptype 3 : 54get_segid 3 : 56get_sem 3 : 57get_sig_info 3 : 58get_sig_poolid 3 : 61get_signal 3 : 62get_stk_poolid 3 : 64get_systime 3 : 65get_ticks 3 : 66get_uid 3 : 67hunt 3 : 68hunt_from 3 : 71intercept 3 : 73kill_proc 3 : 75kill_sem 3 : 77mem_move 3 : 78NIL 3 : 125OS_ATTACH_SIG 3 : 127OS_DEBUG 3 : 128OS_PROCESS 3 : 132OS68 3 : 126OSE 3 : 129OSE_I 3 : 131OSE_LEVEL_x 3 : 130OSSIM 3 : 133power_fail 3 : 79receive 3 : 81receive_from 3 : 83receive_w_tmo 3 : 85restore 3 : 87resume 3 : 89selecting 3 : 91send 3 : 92send_w_s 3 : 95sender 3 : 94set_bp 3 : 96set_env 3 : 99set_envp 3 : 100set_fsem 3 : 101set_mem 3 : 102set_pcb 3 : 103set_pri 3 : 104set_pri_for 3 : 105set_redirection 3 : 106set_segment 3 : 108set_segment_mode 3 : 109set_sigsize 3 : 110set_suid 3 : 111
nual / R1.0.4
signal_fsem 3 : 113signal_sem 3 : 114sigsize 3 : 112start 3 : 115start_OSE 3 : 117stop 3 : 118SYSTEM_TICK 3 : 135system_tick 3 : 119, 3 : 135tick 3 : 120wait_fsem 3 : 121wait_sem 3 : 122wake_up 3 : 123
system clockrunning 3 : 120
system pool 3 : 17system restart 3 : 79system start 3 : 117system tick
length of 3 : 119system tick counter 3 : 65, 3 : 66, 3 : 135
SYSTEM_TICK 3 : 135system_tick 3 : 119
Ttick 3 : 120timer-interrupt process 3 : 19timeslice 3 : 20type definitions 4 : 3
Uunion signal 4 : 3use_remote_calls 3 : 13user number 3 : 67
Wwait_fsem 3 : 121wait_sem 3 : 122wake_up 3 : 123
OSE / Kernel - index : 5