16.11.2014 Views

Kern el

Kern el

Kern el

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

OSE<br />

<strong>Kern</strong><strong>el</strong><br />

<strong>Kern</strong><strong>el</strong><br />

Reference Manual<br />

Enea OSE Systems AB


Copyright<br />

Copyright (C) 1998 by Enea OSE Systems AB. All rights reserved. No part of this publication may<br />

be reproduced, transmitted, stored in a retrieval system, or translated into any language or computer<br />

language, in any form or by any means, <strong>el</strong>ectronic, mechanical, optical, chemical or otherwise,<br />

without the prior written permission of Enea OSE Systems AB. The software described in this<br />

document is furnished under a licence agreement or a non-disclosure agreement. The software may<br />

be used or copied only in accordance with terms of agreement.<br />

Disclaimer<br />

Enea OSE Systems AB makes no representations or warranties with respect to the contents hereof<br />

and specifically disclaims any implied warranties of merchantability or fitness for any particular<br />

purpose. Further, Enea OSE Systems AB reserves the right to revise this publication and to make<br />

changes from time to time in the contents hereof without obligation to Enea OSE Systems AB to<br />

notify any person of such revision or changes.<br />

Trademarks<br />

OSE is a registered trademark of Enea OSE Systems AB.<br />

<strong>Kern</strong><strong>el</strong><br />

Document No: 420e/OSE93-1 R1.0.4<br />

OSE / <strong>Kern</strong><strong>el</strong>


Table Of Contents<br />

<strong>Kern</strong><strong>el</strong><br />

1 Introduction<br />

1.1 Purpose of this manual 1 : 1<br />

1.2 Who Should Read this Manual 1 : 1<br />

1.3 About this Manual 1 : 1<br />

2 System Call Summary<br />

2.1 System Calls in Alphabetical Order 2 : 1<br />

2.2 System Calls in Functional Groups 2 : 5<br />

2.3 System Calls in Implementation Lev<strong>el</strong> Groups 2 : 10<br />

3 System Calls<br />

addressee 3 : 1<br />

alloc 3 : 3<br />

assign_linkhandler 3 : 5<br />

attach 3 : 7<br />

attach_block 3 : 9<br />

attach_segment 3 : 10<br />

clear_bp 3 : 11<br />

create_block 3 : 13<br />

create_error_handler 3 : 15<br />

create_pool 3 : 17<br />

create_process 3 : 19<br />

create_sem 3 : 23<br />

current_process 3 : 25<br />

d<strong>el</strong>ay 3 : 26<br />

detach 3 : 27<br />

error 3 : 28<br />

error2 3 : 29<br />

flush 3 : 30<br />

free_buf 3 : 31<br />

get_bid 3 : 32<br />

get_bid_list 3 : 33<br />

get_cpu 3 : 35<br />

get_env 3 : 36<br />

get_env_list 3 : 37<br />

get_envp 3 : 39<br />

get_fsem 3 : 40<br />

get_mem 3 : 41<br />

get_pcb 3 : 43<br />

get_pid_list 3 : 47<br />

get_pool_list 3 : 49<br />

get_poolcb 3 : 50<br />

get_pri 3 : 53<br />

get_ptype 3 : 54<br />

get_segid 3 : 56<br />

get_sem 3 : 57<br />

get_sig_info 3 : 58<br />

get_sig_poolid 3 : 61<br />

get_signal 3 : 62<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - toc : 1


<strong>Kern</strong><strong>el</strong><br />

get_stk_poolid 3 : 64<br />

get_systime 3 : 65<br />

get_ticks 3 : 66<br />

get_uid 3 : 67<br />

hunt 3 : 68<br />

hunt_from 3 : 71<br />

intercept 3 : 73<br />

kill_proc 3 : 75<br />

kill_sem 3 : 77<br />

mem_move 3 : 78<br />

power_fail 3 : 79<br />

receive 3 : 81<br />

receive_from 3 : 83<br />

receive_w_tmo 3 : 85<br />

restore 3 : 87<br />

resume 3 : 89<br />

s<strong>el</strong>ect_segment 3 : 91<br />

send 3 : 92<br />

sender 3 : 94<br />

send_w_s 3 : 95<br />

set_bp 3 : 96<br />

set_env 3 : 99<br />

set_envp 3 : 100<br />

set_fsem 3 : 101<br />

set_mem 3 : 102<br />

set_pcb 3 : 103<br />

set_pri 3 : 104<br />

set_pri_for 3 : 105<br />

set_redirection 3 : 106<br />

set_segment 3 : 108<br />

set_segment_mode 3 : 109<br />

set_sigsize 3 : 110<br />

set_suid 3 : 111<br />

sigsize 3 : 112<br />

signal_fsem 3 : 113<br />

signal_sem 3 : 114<br />

start 3 : 115<br />

start_OSE 3 : 117<br />

stop 3 : 118<br />

system_tick 3 : 119<br />

tick 3 : 120<br />

wait_fsem 3 : 121<br />

wait_sem 3 : 122<br />

wake_up 3 : 123<br />

NIL 3 : 125<br />

OS68 3 : 126<br />

OS_ATTACH_SIG 3 : 127<br />

OS_DEBUG 3 : 128<br />

OSE 3 : 129<br />

OSE_LEVEL_x 3 : 130<br />

OSE_I 3 : 131<br />

OS_PROCESS 3 : 132<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - toc : 2


<strong>Kern</strong><strong>el</strong><br />

OSSIM 3 : 133<br />

SYSTEM_TICK 3 : 135<br />

4 User Interface<br />

4.1 Header Files 4 : 1<br />

4.2 Data Types 4 : 3<br />

5 Remote System Calls<br />

5.1 Signal Definitions 5 : 1<br />

5.2 Parameter Structures 5 : 4<br />

rem_clear_bp 5 : 4<br />

rem_create_error_handler 5 : 4<br />

rem_flush 5 : 4<br />

rem_get_cpu 5 : 5<br />

rem_get_env 5 : 5<br />

rem_get_env_list 5 : 5<br />

rem_get_fsem 5 : 6<br />

rem_get_mem 5 : 6<br />

rem_get_pcb 5 : 6<br />

rem_get_pid_list 5 : 7<br />

rem_get_pri 5 : 7<br />

rem_get_signal 5 : 8<br />

rem_get_uid 5 : 8<br />

rem_hunt 5 : 9<br />

rem_intercept 5 : 9<br />

rem_resume 5 : 9<br />

rem_set_bp 5 : 10<br />

rem_set_env 5 : 10<br />

rem_set_fsem 5 : 10<br />

rem_set_mem 5 : 11<br />

rem_set_pcb 5 : 11<br />

rem_signal_fsem 5 : 11<br />

rem_start 5 : 12<br />

rem_stop 5 : 12<br />

5.3 Example of a Link Handler 5 : 13<br />

6 Error Messages<br />

6.1 <strong>Kern</strong><strong>el</strong> Error Message Reference 6 : 1<br />

6.1.1 Target-specific error codes 6 : 10<br />

6.2 Caller Information Reference 6 : 12<br />

6.3 Interface Library Errors 6 : 14<br />

6.4 <strong>Kern</strong><strong>el</strong> Error Summary 6 : 15<br />

6.4.1 Target-specific error summary 6 : 17<br />

7 Glossary<br />

Appendix A ASCII Character Set<br />

Appendix B Portability Considerations<br />

Index<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - toc : 3


1 Introduction<br />

1.1 Purpose of this manual<br />

This volume of the OSE Real Time <strong>Kern</strong><strong>el</strong> Reference Manual contains a system call summary, a<br />

detailed description of every system call, specification of data types and an error message guide.<br />

The purpose of this manual is to provide all the necessary information for using the OSE system<br />

calls. The operating system is described in full in the User’s Guide.<br />

1.2 Who Should Read this Manual<br />

This manual is primarily intended for application dev<strong>el</strong>opers.<br />

It is recommended that the Real Time <strong>Kern</strong><strong>el</strong> User’s Guide be studied before reading this Reference<br />

Manual.<br />

<strong>Kern</strong><strong>el</strong><br />

1.3 About this Manual<br />

This manual provides a guide to all available system calls. It includes a system call summary with<br />

the system calls presented according to three different principles: alphabetical order, functional<br />

groups and availability at the various implementation lev<strong>el</strong>s.<br />

It also includes a section giving a detailed explanation of every system call, with examples, and a<br />

section discussing possible errors together with a description of all error messages.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 1 : 1<br />

Introduction


2 System Call Summary<br />

This chapter contains the OSE system call interface, i.e. all the available system calls (except for<br />

remote system calls), manifest constants and macros. A brief explanation is given of every call.<br />

<strong>Kern</strong><strong>el</strong><br />

2.1 System Calls in Alphabetical Order<br />

addressee<br />

alloc<br />

assign_linkhandler<br />

attach<br />

attach_block<br />

attach_segment<br />

clear_bp<br />

create_block<br />

create_error_handler<br />

create_pool<br />

create_process<br />

create_sem<br />

current_process<br />

d<strong>el</strong>ay<br />

detach<br />

error<br />

error2<br />

flush<br />

free_buf<br />

get_bid<br />

get_bid_list<br />

get_cpu<br />

get_env<br />

Finds the addressee of a signal.<br />

Allocates a buffer of requested size.<br />

Assigns a process as link handler to the system.<br />

Stores a signal buffer owned by the caller in the control block of<br />

the specified process or block.<br />

A call from OSE to t<strong>el</strong>l the MMU software that a new block has<br />

been created.<br />

A call from the MMU to t<strong>el</strong>l OSE that the specified block resides<br />

in the indicated memory segment.<br />

Removes a previously set breakpoint.<br />

Creates a block and returns the block ID.<br />

Creates an error handler for the specified process or block.<br />

The MMU creates a new pool and attaches it to the specified block.<br />

Creates a process as a part of the specified block and returns the<br />

process ID.<br />

Creates and initializes a semaphore.<br />

Returns the process-ID of the calling process.<br />

Puts a process to sleep for a specified number of milliseconds.<br />

Removes a signal that has previously been attached to a process or<br />

block by the caller.<br />

Reports an error to the OSE kern<strong>el</strong> or to the error handler if such<br />

exists.<br />

Reports an error to the OSE kern<strong>el</strong> or to the error handler if such<br />

exists, with an extra user defined parameter.<br />

Removes all signals sent by any of a set of processes specified from<br />

the signal queue of a process.<br />

Returns a signal buffer to the pool associated with the block.<br />

Returns the block ID that the specified process is a part of.<br />

Lists all the blocks that are available to the specified user number.<br />

Returns an identification string of the operating system where the<br />

specified process is executing.<br />

Reads the contents of the named environment variable.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 2 : 1<br />

System Call Summary


<strong>Kern</strong><strong>el</strong><br />

get_env_list<br />

get_envp<br />

get_fsem<br />

get_mem<br />

get_pcb<br />

get_pid_list<br />

get_pool_list<br />

get_poolcb<br />

get_pri<br />

get_ptype<br />

get_segid<br />

get_sem<br />

get_sig_info<br />

get_sig_poolid<br />

get_signal<br />

get_stk_poolid<br />

get_systime<br />

get_ticks<br />

get_uid<br />

hunt<br />

hunt_from<br />

intercept<br />

kill_proc<br />

kill_sem<br />

mem_move<br />

NIL<br />

OS_ATTACH_SIG<br />

Lists the environment variables available in the specified block or<br />

process.<br />

Reads a 32 bit pointer from a named environment variable for the<br />

specified process or block.<br />

Reads the current value of a fast semaphore.<br />

Reads data from the address space of the specified process or<br />

block.<br />

Returns the status of a specified process or block.<br />

Lists all the processes that are part of a specified block.<br />

Lists all pools that are available to the specified user number.<br />

Interrogates the status of the specified pool.<br />

Returns the priority of a process.<br />

Returns the type of the specified process.<br />

Finds the segment that the specified block or process is part of.<br />

Reads the current value of a semaphore.<br />

Extract detailed information about a signal buffer.<br />

Returns the ID of the signal pool associated with a specified block<br />

or process.<br />

Returns a copy of the signal located in the queue at the specified<br />

process.<br />

Returns the ID of the stack pool associated with a specified block<br />

or process.<br />

Returns the number of ticks since system start and the number of<br />

microseconds since the last tick.<br />

Returns the number of ticks since system start.<br />

Returns the user number of the specified process or block.<br />

Searches for a process by name and returns the process ID.<br />

Hunts for a process with the access rights evaluated for the process<br />

specified in the from parameter.<br />

Stops a process or trips a previously set breakpoint.<br />

Kills a process or a block.<br />

Returns a semaphore to the OS memory pool.<br />

A call from OSE requiring a block of memory to be copied from<br />

one memory segment to another by the MMU.<br />

A manifest constant defined by the OSE kern<strong>el</strong>.<br />

A manifest constant defining the signal number of the default<br />

signal created by the attach system call.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 2 : 2<br />

System Call Summary


<strong>Kern</strong><strong>el</strong><br />

OS_DEBUG<br />

OS_PROCESS<br />

OSE<br />

OSE_I<br />

OSE_LEVEL_x<br />

OSSIM<br />

OS68<br />

power_fail<br />

receive<br />

receive_from<br />

receive_w_tmo<br />

restore<br />

resume<br />

s<strong>el</strong>ect_segment<br />

send<br />

sender<br />

send_w_s<br />

set_bp<br />

set_env<br />

set_envp<br />

set_fsem<br />

set_mem<br />

set_pcb<br />

set_pri<br />

set_redirection<br />

set_segment<br />

A manifest constant that the user can define to enable reporting of<br />

file and line information and CPU registers to the debugger.<br />

A macro which should be used to define the entry point of a<br />

process. Use OSENTRYPOINT when forward-declaring an<br />

entrypoint.<br />

A manifest constant defined by ose.h.<br />

A manifest constant defined by ose_i.h.<br />

Manifest constants defined by the OSE kern<strong>el</strong> indicating the<br />

functional lev<strong>el</strong> of the kern<strong>el</strong>.<br />

A manifest constant which should be defined by the user when<br />

compiling a process for use in the OSE simulator.<br />

A manifest constant defined by the OSE kern<strong>el</strong> indicating which<br />

operating system is currently in use.<br />

Shuts down the system and enables the system for a subsequent<br />

restart.<br />

Receives s<strong>el</strong>ected signal(s).<br />

Like receive but it only accepts signals from a specified process.<br />

Receives s<strong>el</strong>ected signal(s) with a s<strong>el</strong>ectable time-out.<br />

Makes the caller owner of a signal and clears the redirection<br />

information.<br />

Re-enables an intercepted process or all intercepted processes in a<br />

block.<br />

A call from OSE requiring the MMU to s<strong>el</strong>ect the address space in<br />

which the process about to be swapped in will run.<br />

Sends a signal to a destination process.<br />

Returns the ID of the process which last sent a specified signal.<br />

Sends a signal with a stated sender.<br />

Sets a breakpoint in a process or block.<br />

Creates or updates an environment string for the specified process<br />

or block.<br />

Stores a 32 bit pointer in a named environment variable.<br />

Initializes a fast semaphore with the specified value.<br />

Writes data to the address space of a specified process or block.<br />

Sets the CPU registers of the specified process.<br />

Sets a new priority lev<strong>el</strong> for the calling process.<br />

Replace the redirection table of a process.<br />

The effective segment number for the calling process is set by the<br />

MMU.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 2 : 3<br />

System Call Summary


<strong>Kern</strong><strong>el</strong><br />

set_segment_mode<br />

set_sigsize<br />

set_suid<br />

signal_fsem<br />

signal_sem<br />

sigsize<br />

start<br />

start_OSE<br />

stop<br />

system_tick<br />

SYSTEM_TICK<br />

tick<br />

wait_fsem<br />

wait_sem<br />

wake_up<br />

A call from OSE t<strong>el</strong>ling the MMU what type of processes reside<br />

in the specified segment.<br />

Attempts to change the size of a signal buffer without actually<br />

reallocate and copy it.<br />

Temporarily assigns superuser privileges to the calling process.<br />

Increments a fast semaphore value.<br />

Increments the value of the specified semaphore.<br />

Returns requested size of a signal buffer.<br />

Starts a newly created or previously stopped block or process.<br />

Creates and initializes the OSE kern<strong>el</strong>.<br />

Stops a single process or all processes in a block.<br />

Returns the system tick length in microseconds.<br />

A manifest constant assigned the value 1000L for compatibility<br />

with older OSE kern<strong>el</strong>s.<br />

Increments the system timer.<br />

Waits for a fast semaphore to become non-negative.<br />

Waits for the specified semaphore to become non-negative.<br />

Informs an interrupt process of how it was invoked.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 2 : 4<br />

System Call Summary


2.2 System Calls in Functional Groups<br />

This section contains all the system calls grouped according to functionality. The memory manager<br />

interface is of interest only if you write a program loader or a memory protection hardware interface.<br />

Basic System Calls<br />

alloc<br />

d<strong>el</strong>ay<br />

error<br />

free_buf<br />

receive<br />

receive_w_tmo<br />

send<br />

sender<br />

Allocates a buffer of requested size.<br />

Puts a process to sleep for a specified number of milliseconds.<br />

Reports an error to the OSE kern<strong>el</strong> or to the error handler if such<br />

exists.<br />

Returns a signal buffer to the pool associated with the block.<br />

Receives s<strong>el</strong>ected signal(s).<br />

Receives s<strong>el</strong>ected signal(s) with s<strong>el</strong>ectable time-out.<br />

Sends a signal to a destination process.<br />

Returns the ID of the process which last sent a specified signal.<br />

<strong>Kern</strong><strong>el</strong><br />

Advanced System Calls<br />

addressee<br />

create_error_handler<br />

current_process<br />

error2<br />

get_cpu<br />

get_ptype<br />

get_ticks<br />

get_uid<br />

power_fail<br />

receive_from<br />

restore<br />

send_w_s<br />

set_sigsize<br />

sigsize<br />

start<br />

start_OSE<br />

stop<br />

Finds the addressee of a signal.<br />

Creates an error handler for the specified process or block.<br />

Returns the process-ID of the calling process.<br />

Reports an error to the OSE kern<strong>el</strong> or to the error handler if such<br />

exists, with an extra user defined parameter.<br />

Returns an identification string of the operating system where the<br />

specified process is executing.<br />

Returns the type of the specified process.<br />

Returns the number of ticks since system start.<br />

Returns the user number of the specified process or block.<br />

Shuts down the system and enables the system for a subsequent<br />

restart.<br />

Like receive but it only accepts signals from a specified process.<br />

Makes the caller the owner of a signal and clears the signals<br />

redirection information.<br />

Sends a signal with a stated sender.<br />

Attempts to change the size of a signal buffer without actually<br />

reallocate and copy it.<br />

Returns requested size of a signal buffer.<br />

Starts a newly created or previously stopped block or process.<br />

Creates and initializes the OSE kern<strong>el</strong>.<br />

Stops a single process or all processes in a block.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 2 : 5<br />

System Call Summary


system_tick<br />

tick<br />

wake_up<br />

Returns the system tick length in microseconds.<br />

Increments the system timer.<br />

Informs an interrupt process of how it was invoked.<br />

<strong>Kern</strong><strong>el</strong><br />

System Calls for Dynamic Processes<br />

attach<br />

create_block<br />

create_process<br />

detach<br />

flush<br />

get_bid<br />

get_pri<br />

hunt<br />

kill_proc<br />

set_pri<br />

set_redirection<br />

Network R<strong>el</strong>ated Calls<br />

assign_linkhandler<br />

hunt_from<br />

Stores a signal buffer owned by the caller in the control block of<br />

the specified process or block.<br />

Creates a block and returns the block ID.<br />

Creates a process as a part of the specified block and returns the<br />

process ID.<br />

Removes a signal that has previously been attached to a process or<br />

block by the caller.<br />

Removes all signals sent by any of a set of processes specified,<br />

from the signal queue of a process.<br />

Returns the block ID that the specified process is a part of.<br />

Returns the priority of a process.<br />

Searches for a process by name and returns the process ID.<br />

Kills a process or a block.<br />

Sets a new priority lev<strong>el</strong> for the calling process.<br />

Replace the redirection table of a process.<br />

Assigns a process as a link handler to the system.<br />

Hunts for a process with the access rights evaluated for the process<br />

specified in the from parameter.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 2 : 6<br />

System Call Summary


Semaphore Calls<br />

create_sem<br />

get_sem<br />

kill_sem<br />

signal_sem<br />

wait_sem<br />

Fast Semaphore Calls<br />

get_fsem<br />

set_fsem<br />

signal_fsem<br />

wait_fsem<br />

Creates and initializes a semaphore.<br />

Reads the current value of a semaphore.<br />

Returns a semaphore to the OS memory pool.<br />

Increments the value of the specified semaphore.<br />

Waits for the specified semaphore to become non-negative.<br />

Reads the current value of a fast semaphore.<br />

Initializes a fast semaphore with the specified value.<br />

Increments a fast semaphore value.<br />

Waits for a fast semaphore to become non-negative.<br />

<strong>Kern</strong><strong>el</strong><br />

Environment Variable Calls<br />

get_env<br />

get_env_list<br />

get_envp<br />

set_env<br />

set_envp<br />

System Interrogation Calls<br />

get_bid_list<br />

get_mem<br />

get_pcb<br />

get_pid_list<br />

get_pool_list<br />

get_poolcb<br />

get_sig_info<br />

get_sig_poolid<br />

get_signal<br />

get_stk_poolid<br />

Reads the contents of the named environment variable.<br />

Lists the environment variables available in the specified block or<br />

process.<br />

Reads a 32 bit pointer from a named environment variable for the<br />

specified process or block.<br />

Creates or updates an environment string for the specified process<br />

or block.<br />

Stores a 32 bit pointer in a named environment variable.<br />

Lists all the blocks that are available to the specified user number.<br />

Reads data from the address space of the specified process or<br />

block.<br />

Returns the status of a specified process or block.<br />

Lists all the processes that are part of a specified block.<br />

Lists all pools that are available to the specified user number.<br />

Interrogates the status of the specified pool.<br />

Extract detailed information about a signal buffer.<br />

Returns the ID of the signal pool associated with a specified block<br />

or process.<br />

Returns a copy of the signal located in the queue at the specified<br />

process.<br />

Returns the ID of the stack pool associated with a specified block<br />

or process.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 2 : 7<br />

System Call Summary


get_systime<br />

set_mem<br />

set_pcb<br />

Breakpoint Calls<br />

clear_bp<br />

intercept<br />

resume<br />

set_bp<br />

Returns the number of ticks since system start and the number of<br />

microseconds since the last tick.<br />

Writes data to the address space of a specified process or block.<br />

Sets the CPU registers of the specified process.<br />

Removes a previously set breakpoint.<br />

Stops a process or trips a previously set breakpoint.<br />

Re-enables an intercepted process or all intercepted processes in a<br />

block.<br />

Sets a breakpoint in a process or block.<br />

<strong>Kern</strong><strong>el</strong><br />

System Calls for Memory Management<br />

attach_block<br />

attach_segment<br />

create_pool<br />

get_segid<br />

mem_move<br />

s<strong>el</strong>ect_segment<br />

set_segment<br />

set_segment_mode<br />

set_suid<br />

A call from OSE to t<strong>el</strong>l the MMU software that a new block has<br />

been created.<br />

A call from the MMU to t<strong>el</strong>l OSE that the specified block resides<br />

in the indicated memory segment.<br />

The MMU creates a new pool and attaches it to the specified block.<br />

Finds the segment that the specified block or process is part of.<br />

A call from OSE requiring a block of memory to be copied from<br />

one memory segment to another, by the MMU.<br />

A call from OSE requiring the MMU to s<strong>el</strong>ect the address space in<br />

which the process about to be swapped in will run.<br />

The effective segment number for the calling process is set by the<br />

MMU.<br />

A call from OSE t<strong>el</strong>ling the MMU what type of processes reside<br />

in the specified segment.<br />

Temporarily assigns superuser privileges to the calling process.<br />

Macros and Constants<br />

NIL<br />

OS_ATTACH_SIG<br />

OS_DEBUG<br />

OS_PROCESS<br />

OSE<br />

A manifest constant defined by the OSE kern<strong>el</strong>.<br />

A manifest constant defining the signal number of the default<br />

signal.<br />

A manifest constant that the user can define to enable reporting of<br />

file and line information and CPU registers to the debugger.<br />

A macro which should be used to define the entry point of a<br />

process. Use OSENTRYPOINT when forward-declaring an<br />

entrypoint.<br />

A manifest constant defined by ose.h.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 2 : 8<br />

System Call Summary


OSE_I<br />

OSE_LEVEL_x<br />

OSSIM<br />

OS68<br />

SYSTEM_TICK<br />

A manifest constant defined by ose_i.h.<br />

Manifest constants defined by the OSE kern<strong>el</strong> indicating the<br />

functional lev<strong>el</strong> of the kern<strong>el</strong>.<br />

A manifest constant which should be defined by the user when<br />

compiling a process for use in the OSE simulator.<br />

A manifest constant defined by the OSE kern<strong>el</strong> indicating which<br />

operating system is currently in use.<br />

A manifest constant assigned the value 1000L for compatibility<br />

with older OSE kern<strong>el</strong>s.<br />

<strong>Kern</strong><strong>el</strong><br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 2 : 9<br />

System Call Summary


2.3 System Calls in Implementation Lev<strong>el</strong> Groups<br />

This section groups the system calls according to implementation lev<strong>el</strong>s. Types, manifest constants<br />

and macros are not shown here.<br />

Lev<strong>el</strong> A is the portable set which means the smallest set of system calls available in an OSE kern<strong>el</strong>.<br />

Using these system calls ensures the highest degree of portability.<br />

Lev<strong>el</strong> A defines all constants and macros and all types required by system calls on that lev<strong>el</strong>.<br />

Lev<strong>el</strong> B defines the remaining types.<br />

Lev<strong>el</strong> A System Calls<br />

alloc<br />

current_process<br />

d<strong>el</strong>ay<br />

error<br />

free_buf<br />

get_ticks<br />

receive<br />

receive_w_tmo<br />

restore<br />

send<br />

sender<br />

sigsize<br />

<strong>Kern</strong><strong>el</strong><br />

Lev<strong>el</strong> B System Calls<br />

Lev<strong>el</strong> B contains all lev<strong>el</strong> A system calls, with the following additions:<br />

addressee<br />

get_pcb<br />

assign_linkhandler<br />

get_ptype<br />

attach<br />

get_sem<br />

1 create_block get_systime<br />

create_error_handler<br />

get_uid<br />

2 create_process hunt<br />

create_sem<br />

hunt_from<br />

detach<br />

kill_proc<br />

flush<br />

kill_sem<br />

get_bid<br />

power_fail<br />

get_cpu<br />

receive_from<br />

get_env<br />

send_w_s<br />

get_env_list<br />

set_env<br />

get_fsem<br />

set_fsem<br />

signal_fsem<br />

system_tick<br />

signal_sem<br />

tick<br />

1. Remote systems call servers are not supported and only user number zero may<br />

be s<strong>el</strong>ected.<br />

2. Only phantom processes may be created and only user number zero may be<br />

s<strong>el</strong>ected<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 2 : 10<br />

System Call Summary


start<br />

start_OSE<br />

stop<br />

wait_fsem<br />

wait_sem<br />

wake_up<br />

Lev<strong>el</strong> C System Calls<br />

Lev<strong>el</strong> C contains all lev<strong>el</strong> B system calls, with the following additions:<br />

attach_block<br />

get_pri<br />

attach_segment<br />

get_signal<br />

clear_bp<br />

intercept<br />

1 create_block resume<br />

create_pool<br />

s<strong>el</strong>ect_segment<br />

1 create_process set_bp<br />

get_bid_list<br />

get_mem<br />

get_pid_list<br />

set_mem<br />

set_pri<br />

set_suid<br />

<strong>Kern</strong><strong>el</strong><br />

Lev<strong>el</strong> D System Calls<br />

Lev<strong>el</strong> D contains all lev<strong>el</strong> C system calls, with the following additions:<br />

2 create_block s<strong>el</strong>ect_segment<br />

2 create_process set_segment<br />

mem_move<br />

set_segment_mode<br />

set_segment<br />

set_segment_mode<br />

1. Only user number zero may be s<strong>el</strong>ected.<br />

2. These systems are fully implemented at this lev<strong>el</strong>.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 2 : 11<br />

System Call Summary


3 System Calls<br />

addressee<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

Description<br />

PROCESS addressee (union SIGNAL **sig);<br />

Examines a signal buffer to find out to which process the buffer was originally<br />

sent by the sender.<br />

Include files #include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

Parameters sig A pointer to a pointer to a signal buffer.<br />

Return value<br />

Restrictions<br />

See also<br />

The process ID of the caller is returned in case the signal was sent without<br />

redirections. If sig has been redirected, addressee returns the process ID that was<br />

stated in the send or send_w_s call that caused the buffer redirection.<br />

Returns owner's ID if the signal was never sent.<br />

None.<br />

restore, sender, send, send_w_s<br />

Implementation Not implemented at lev<strong>el</strong> A. Full performance from lev<strong>el</strong> B.<br />

lev<strong>el</strong><br />

Example<br />

#include "ose.h"<br />

static const SIGSELECT any_sig[] = {0};<br />

union SIGNAL<br />

{<br />

SIGSELECT sig_no;<br />

};<br />

OS_PROCESS(my_process)<br />

{<br />

union SIGNAL *sig;<br />

PROCESS addr;<br />

for(;;)<br />

{<br />

sig = receive((SIGSELECT *) any_sig);<br />

addr = addressee(&sig);<br />

if(addr == current_process ())<br />

{<br />

/* The signal was sent directly to this process */<br />

}<br />

<strong>el</strong>se<br />

{<br />

/* Signal was sent to the process with process ID "addr"<br />

* but was redirected to this process through the use of<br />

* a redirection table<br />

*/<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 1<br />

System Calls


}<br />

}<br />

<strong>Kern</strong><strong>el</strong><br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 2<br />

addressee


alloc<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

Description<br />

union SIGNAL *alloc (OSBUFSIZE size,<br />

SIGSELECT signo);<br />

Allocates a signal buffer of the specified size from the pool available to the caller's<br />

block. The specified signo (signal number) is entered in the first location in the<br />

new buffer.<br />

Another signal number may later be assigned to the buffer by simply storing a<br />

new number in the first location.<br />

The maximum buffer size available is dictated by sizeof(OSBUFSIZE). This<br />

means that if sizeof(OSBUFSIZE) returns 2 then the maximum available buffer<br />

size is:<br />

65536 (2 (sizeof(OSBUFSIZE) * 8) )<br />

This rule may sometimes fail since the maximum buffer size may have been set<br />

to a smaller value when the pool was created. The minimum buffer size is one<br />

byte.<br />

Include files #include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

Parameters size The requested size of the buffer.<br />

signo<br />

The signal number, will be placed in the allocated buffer.<br />

Return value Returns a pointer to the new buffer.<br />

Restrictions<br />

See also<br />

The new buffer is owned by the calling process. A new owner can be entered only<br />

by using one of the system calls that operates on the buffer. It is basically illegal<br />

to pass control of a buffer to another process in any other way since buffers may<br />

then be lost in case of premature process termination.<br />

If you really need to pass buffers around in a disorderly manner, the restore<br />

system call can be used to force registration of a new owner of a buffer.<br />

It is an error to allocate a buffer larger than the largest buffer size available in the<br />

pool. Use the get_pcb system call to gain information about the largest possible<br />

buffer size for a process.<br />

free_buf, restore, sender, addressee, sigsize, create_pool, set_sigsize<br />

Implementation Full performance at all implementation lev<strong>el</strong>s.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

#define THIRD 3 /* These declarations */<br />

struct Third /* are preferably made */<br />

{ /* in a .sig-file which*/<br />

SIGSELECT sig_no; /* should be included. */<br />

};<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 3<br />

alloc


union SIGNAL<br />

{<br />

SIGSELECT sig_no;<br />

struct Third third;<br />

};<br />

OS_PROCESS(my_process)<br />

{<br />

union SIGNAL *sig;<br />

extern PROCESS proc_;<br />

/* Process ID for the static<br />

* process named "proc".<br />

*/<br />

for(;;)<br />

{<br />

sig = alloc(sizeof(struct third),THIRD);<br />

send(&sig,proc_);<br />

d<strong>el</strong>ay(100);<br />

}<br />

}<br />

<strong>Kern</strong><strong>el</strong><br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 4<br />

alloc


assign_linkhandler<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax OSBOOLEAN assign_linkhandler (char *linkname,<br />

PROCESS handler);<br />

Description A link handler is registered with OSE.<br />

This link handler receives remote system calls for all hunt calls specifying the<br />

indicated linkname as the first part of the hunt path, unless a process with a name<br />

matching the hunt path already exists.<br />

For a path name to match a link handler it is sufficient that the characters before<br />

the first "/"-character match the pathname of the link handler.<br />

For instance:<br />

The hunt path "h<strong>el</strong>ios/robin/peter" matches the link handler named "h<strong>el</strong>ios" as<br />

w<strong>el</strong>l as the Linkhandler named "h<strong>el</strong>ios/robin".<br />

The hunt path "h<strong>el</strong>ios/" also matches the "h<strong>el</strong>ios" link handler.<br />

The hunt path "/robin" matches the link handler named "". (This may look<br />

strange, but it is in fact possible to have a link handler with the name "").<br />

Hunt calls already pending within the OSE kern<strong>el</strong>, matching the new link handler<br />

name, are honoured by the new link handler.<br />

Include files #include "ose.h"<br />

Parameters linkname The path to the link handler.<br />

handler<br />

The process ID of the link handler.<br />

Return value Returns a non-zero value if another link handler with the specified name is<br />

already present in the caller's user number space.<br />

Restrictions There can be only one link handler for each linkname in each user number space.<br />

A link handler with user number zero (superuser) serves all user numbers, and<br />

therefore disallows any other Linkhandler with that name.<br />

There is no way to deregister a link handler. It must be killed when its services<br />

are no longer required.<br />

There is a deadlock problem that occurs when a link handler or remote call server<br />

issues a system call that results in a remote system call towards the same link<br />

handler. This problem is most easily avoided if link handlers are so designed that<br />

they never use any system calls from which remote system calls can result. If this<br />

is not possible, then such operations should be deferred to other processes r<strong>el</strong>ated<br />

to the link handler.<br />

The assign_linkhandler call is not available to interrupt processes.<br />

See also hunt, hunt_from<br />

Implementation Not implemented at lev<strong>el</strong> A. Full performance from lev<strong>el</strong> B.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 5<br />

assign_linkhandler


OS_PROCESS(my_process)<br />

{<br />

char *linkh = "linkhandler";<br />

PROCESS linkhand_;<br />

OSBOOLEAN check;<br />

PROCESS proc_id_;<br />

check = assign_linkhandler(linkh,linkhand_);<br />

if (check)<br />

{<br />

/* If a non-zero value is returned in check, a<br />

* link handler with that name already exists.<br />

*/<br />

}<br />

for(;;)<br />

{<br />

check = hunt("linkhandler/proc", NULL, &proc_id_,NULL);<br />

if(check)<br />

{<br />

/* Code */<br />

}<br />

}<br />

}<br />

<strong>Kern</strong><strong>el</strong><br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 6<br />

assign_linkhandler


attach<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

OSATTREF attach (union SIGNAL **sig, PROCESS pid);<br />

Description This call is used in defensive programming to detect and resolve unexpected<br />

situations that occur when processes die during signal transactions.<br />

Attach stores a signal buffer owned by the caller in the control block of the<br />

specified process or block.<br />

If the sig parameter is set to NULL, the kern<strong>el</strong> automatically allocates a signal<br />

with signal number OS_ATTACH_SIG.<br />

This buffer is sent back to the caller by the kern<strong>el</strong> if the attached process or block<br />

is killed. The buffer will be sent back imediat<strong>el</strong>y to the caller if the process or<br />

block is already dead when issuing the attach.<br />

The buffer is freed by the kern<strong>el</strong> when the calling process issues a detach call for<br />

the previously attached process or block, using the reference ID obtained from<br />

attach. This works even if the attached process has been killed and the attached<br />

buffer waits in the caller's signal queue.<br />

The normal buffer examination calls like sender and addressee work on the<br />

returned buffer. Sender is set to the process ID of the killed process.<br />

OSE ensures that, when a process dies, attached signals are the last signals sent<br />

from the killed process. This means that it is safe for a supervising process to<br />

clear signal queues when a previously attached signal is received.<br />

The attach system call can also be used by memory manager software to supervise<br />

a memory segment. A segment ID obtained from either the attach_segment<br />

system call or the get_segid system call can be attached too. This enables a<br />

memory manager to be conveniently notified when a killed memory segment can<br />

be reclaimed.<br />

Include files #include "ose.h"<br />

Parameters sig A pointer to a pointer to a signal buffer.<br />

pid<br />

The ID of the specified block, process or segment to attach.<br />

Return value Returns a reference ID that may be used in a subsequent call to detach.<br />

Restrictions The order in which attached signals are returned when a process dies is<br />

unspecified. Also, a user can not assume that attached signals are returned<br />

immediat<strong>el</strong>y when a process dies. There is a d<strong>el</strong>ay caused by the fact that process<br />

housekeeping is performed by system daemons as a lower priority job.<br />

The attach call is not available to interrupt processes.<br />

See also detach, kill_proc, OS_ATTACH_SIG, attach_segment, get_segid<br />

Implementation Not implemented at lev<strong>el</strong> A. Full performance from lev<strong>el</strong> B.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 7<br />

attach


#define FORTH 4 /* These declarations */<br />

struct Forth /* are preferably made */<br />

{ /* in a .sig-file which */<br />

SIGSELECT sig_no; /* is included. */<br />

};<br />

union SIGNAL<br />

{<br />

SIGSELECT sig_no;<br />

struct Forth forth;<br />

};<br />

static const SIGSELECT any_sig[] = {0};<br />

OS_PROCESS(my_process)<br />

{<br />

union SIGNAL *sig;<br />

OSATTREF attref;<br />

extern PROCESS proc_;<br />

<strong>Kern</strong><strong>el</strong><br />

for(;;)<br />

{<br />

/* Code */<br />

sig = alloc(sizeof(struct forth), FORTH);<br />

attref = attach(&sig,proc_);<br />

sig = receive((SIGSELECT *) any_sig);<br />

if (sender(&sig) == proc_)<br />

{<br />

/* Code, The process has been killed */<br />

}<br />

<strong>el</strong>se<br />

{<br />

/* Code */<br />

}<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 8<br />

attach


attach_block<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

void attach_block (PROCESS bid, OSSEGMENT segnum);<br />

Description This is a call from the memory manager block (MMU) to the kern<strong>el</strong> and is<br />

therefore normally not a user system call.<br />

The kern<strong>el</strong> t<strong>el</strong>ls the MMU software that a new block has been created and that it<br />

inherits the specified memory segment from its creator.<br />

The MMU may note that there is a new block in the segment. This allows the<br />

MMU software to map user created blocks to segments. The attach_block<br />

function may use system calls as if it was called from a prioritized superuser<br />

process. It is called in the context of the process that requires the operation, so<br />

attach_block can be simultaneously executed by several processes, and the calling<br />

process may be killed at any time.<br />

Any alloc calls issued by the attach_block function refer to the system pool,<br />

regardless of the pool attached to the calling process.<br />

The user ID of the calling process is temporarily set to zero for the duration of<br />

the attach_block call. This allows the function to communicate with system<br />

processes normally invisible to the calling process.<br />

Include files #include "ose_mmu.h"<br />

Parameters bid The block ID of the new block.<br />

segnum<br />

The segment the block will inherit.<br />

Return value None.<br />

Restrictions None.<br />

Implementation Not implemented at lev<strong>el</strong>s A and B. Full performance from<br />

lev<strong>el</strong>s lev<strong>el</strong> C.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 9<br />

attach_block


attach_segment<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax PROCESS attach_segment (PROCESS bid,<br />

OSSEGMENT segnum);<br />

Description This is a call from the memory manager block (MMU) to the kern<strong>el</strong> and is<br />

therefore normally not a user system call.<br />

The MMU t<strong>el</strong>ls the kern<strong>el</strong> that the specified block resides in the indicated memory<br />

segment.<br />

The kern<strong>el</strong> will s<strong>el</strong>ect that segment at each subsequent swap in of any process in<br />

the block.<br />

If attach_segment is not used for a block, then the kern<strong>el</strong> assumes that the block<br />

resides in the same memory segment as its creator.<br />

A unique segment number should normally be assigned in each attach_segment<br />

call. This causes the kern<strong>el</strong> to maintain intersegment memory protection and issue<br />

a s<strong>el</strong>ect_segment call for each process switch between the segments.<br />

It is possible to specify the same segment number in several attach_segment calls.<br />

The kern<strong>el</strong> then creates a new segment descriptor and segment ID for each call,<br />

but it is assumed that the blocks reside in a shared address space. This mode of<br />

operation is useful when it is desired to disable memory protection between the<br />

involved blocks.<br />

Include files #include "ose.h"<br />

Parameters bid The block ID of the specified block.<br />

segnum<br />

The segment the specified block resides in.<br />

Return value Returns a segment ID which is recognized by the attach and kill_proc system<br />

calls. Other system calls will treat this ID as "illegal".<br />

Attaching to this segment ID means that the caller is notified when the segment<br />

dies and the memory occupied by it can be reclaimed/reused.<br />

Killing the segment ID means that all processes in the segment are killed.<br />

Restrictions The attach_segment call is available only to superuser processes since segment<br />

numbers must be properly coordinated with the attach_block, mem_move,<br />

s<strong>el</strong>ect_segment, and set_segment functions, it is assumed that segments are<br />

manipulated only by a single memory manager package.<br />

attach_segment must be called before the first process in the block is created, if<br />

called at all.<br />

Segment number zero is the supervisor space. This segment number must not be<br />

redefined by the memory manager. Other segment numbers are fre<strong>el</strong>y allocated<br />

by the memory manager.<br />

The attach_segment call is not available to interrupt processes.<br />

See also s<strong>el</strong>ect_segment, set_segment_mode, mem_move, attach, kill_proc, get_segid<br />

Implementation Not implemented at lev<strong>el</strong>s A and B. Full performance from<br />

lev<strong>el</strong>s lev<strong>el</strong> C.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 10<br />

attach_segment


clear_bp<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

OSBOOLEAN clear_bp (PROCESS pid, OSADDRESS addr);<br />

Description This is a call from a debugger process to the kern<strong>el</strong> and is therefore normally not<br />

a user system call. It clears a breakpoint previously set by the caller at the<br />

specified address in the specified process or block.<br />

The trap signal that was specified in the set_bp call is returned to the caller (using<br />

a send call just as if the breakpoint had been reached).<br />

This call is used to clear previously set breakpoints without causing the target<br />

block to enter intercept status. It is also used to remove breakpoints that are no<br />

longer needed after another breakpoint has been reached.<br />

It is important to remember to clear breakpoints that are no longer in use.<br />

When the target process is killed, all breakpoints set are automatically cleared as<br />

if clear_bp had been called, but the signal buffers are freed by the kern<strong>el</strong> instead<br />

of being sent to the owner.<br />

When the debugger process (the caller of set_bp) is killed, any breakpoints set are<br />

cleared in the same way.<br />

Include files #include "ose.h"<br />

Parameters pid The ID of the specified process or block.<br />

addr<br />

The adress where the breakpoint is to be cleared.<br />

Return value Returns non-zero if no breakpoint was set at the specified address, or if the<br />

breakpoint was already reached, or if the process died before reaching the<br />

breakpoint.<br />

Restrictions The breakpoint cleared must have been set by the calling process. It is illegal to<br />

clear a breakpoint set by another process.<br />

The clear_bp call is not available to interrupt processes.<br />

See also set_bp, intercept, resume, get_pcb<br />

Implementation Not implemented at lev<strong>el</strong>s A and B. Full performance from<br />

lev<strong>el</strong>s lev<strong>el</strong> C.<br />

Example<br />

#include "ose.h"<br />

#define TRAP_SIG 1 /* These declarations */<br />

struct Trap_sig /* are preferably made */<br />

{ /* in a .sig-file which */<br />

SIGSELECT sig_no; /* is included. */<br />

};<br />

union SIGNAL<br />

{<br />

SIGSELECT sig_no;<br />

struct Trap_sig trap_sig;<br />

};<br />

static const SIGSELECT trap_s<strong>el</strong>[] = {1, TRAP_SIG};<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 11<br />

clear_bp


extern void function(void);<br />

extern PROCESS proc_;<br />

OS_PROCESS(my_process)<br />

{<br />

union SIGNAL *trapsignal;<br />

for(;;)<br />

{<br />

trapsignal=alloc(sizeof (struct trap_sig), TRAP_SIG);<br />

set_bp(proc_, (OSADDRESS) function, (OSADDRESS) 2,<br />

&trapsignal)<br />

/* Code */<br />

trapsignal = receive_w_tmo(100, (SIGSELECT *) trap_s<strong>el</strong>);<br />

if(!trapsignal)<br />

{<br />

/* Breakpoint not reached */<br />

clear_bp(proc_, (OSADRESS) function);<br />

}<br />

/* Code */<br />

}<br />

}<br />

<strong>Kern</strong><strong>el</strong><br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 12<br />

clear_bp


create_block<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

PROCESS create_block (char *name,<br />

OSUSER user,<br />

OSBOOLEAN use_remote_calls,<br />

PROCESS remote_call_server,<br />

OSBOOLEAN supervisor_mode);<br />

Description Creates a block descriptor owned by the specified user number.<br />

The memory segment is inherited from the caller, i.e. all processes in the new<br />

block will execute in the same memory space as the creator unless another<br />

memory segment is attached to the block by a memory manager prior to the first<br />

process being created. This may be desired when a new, separat<strong>el</strong>y linked<br />

software unit is being loaded into memory for execution.<br />

New block descriptors are given "stopped" status so an environment can be<br />

initialized before operation begins. This means that the first set of processes in a<br />

new block are "stopped" until started by issuing a start call for the block or for<br />

each process in the block.<br />

Until the last start call is issued, the block is owned by its creator, i.e. if the creator<br />

is killed before this, the child block is killed too. This mechanism ensures that<br />

partially created blocks are never left abandoned in the system.<br />

A block descriptor is removed from the system when either the block is explicitly<br />

killed, or the last process executing in the block is killed.<br />

The name parameter is a string containing the name by which the block will be<br />

known to the system and to the debugger.<br />

The user parameter is the user number under which the created block will execute.<br />

A value of NULL means the creator's user number, which is the value typically<br />

used.<br />

use_remote_calls is set to any non-zero value to indicate that a remote call server<br />

is specified in the remote_call_server parameter.<br />

remote_call_server, if present, is the ID of the process that will execute remote<br />

system calls issued towards processes in the block. This parameter is mainly used<br />

for phantom processes that should be managed by some link handler. This<br />

parameter is ignored if use_remote_calls is set to zero.<br />

supervisor_mode is set to any non-zero value if the processes in the block should<br />

be created in supervisor mode. Such processes must reside in kern<strong>el</strong> address space<br />

and can only be created by a superuser process (user 0) executing in supervisor<br />

mode.<br />

Include files #include "ose.h"<br />

Parameters name A pointer to the name of the block.<br />

user<br />

The user number under which the block will execute.<br />

use_remote_calls Specifies whether a remote call server is used or not.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 13<br />

create_block


Return value<br />

Restrictions<br />

See also<br />

remote_call_server The process ID of the remote call server if used.<br />

supervisor_mode The specified mode, non-zero means supervisor mode.<br />

Returns the block ID for the new block.<br />

Superuser blocks can only be created by a superuser process.<br />

Supervisor mode blocks can only be created by a superuser process (user number<br />

0) executing in supervisor mode its<strong>el</strong>f.<br />

The create_block call is not available to interrupt processes.<br />

create_process, get_bid, get_bid_list, kill_proc, start<br />

Implementation Not implemented at lev<strong>el</strong> A. Remote system call servers are<br />

lev<strong>el</strong>s<br />

not allowed and only user number zero is supported at lev<strong>el</strong><br />

B. Allows only user number zero at lev<strong>el</strong> C. Full performance<br />

at lev<strong>el</strong> D.<br />

Example<br />

#include "ose.h"<br />

OSENTRYPOINT new_process;<br />

<strong>Kern</strong><strong>el</strong><br />

OS_PROCESS(my_process)<br />

{<br />

PROCESS block_;<br />

PROCESS proc_;<br />

for(;;)<br />

{<br />

/* Code */<br />

block_ = create_block("block",<br />

(OSUSER) 0,<br />

(OSBOOLEAN) 0,<br />

(PROCESS) 0,<br />

(OSBOOLEAN) 0);<br />

proc_=create_process(OS_PRI_PROC,<br />

"proc_",<br />

new_process,<br />

200,<br />

16,<br />

(OSTIME) 0,<br />

block_,<br />

(struct OS_redir_entry *) NULL,<br />

(OSVECTOR) 0,<br />

(OSUSER) 0);<br />

start(block_);<br />

/* Code */<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 14<br />

create_block


create_error_handler<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax OSERRH *create_error_handler(PROCESS pid,<br />

OSERRH *entrypoint,<br />

OSADDRES stack_size);<br />

Description An error handler is created for the specified process or block and stack space is<br />

reserved for the handler in each process affected (also in those affected but not<br />

yet created).<br />

Any previously defined handler on that error lev<strong>el</strong> is replaced, and the old error<br />

handlers entrypoint is returned to the caller.<br />

If error handler stack space reserved by a previously defined error handler is larger<br />

than required, the stack space size is not altered.<br />

The entrypoint is a location within the address space of the specified block.<br />

Set entrypoint to NULL to remove a previously created error handler.<br />

An error handler behaves as a subroutine called from the process in context. The<br />

only difference is that the error handler has its own separate stack.<br />

Error handlers may use the same set of system calls as the process running when<br />

the error handler was invoked.<br />

The error handler is passed parameters containing error information and a flag set<br />

to a non-zero value if the call was made from user code and not from the kern<strong>el</strong>.<br />

The handler should return a flag set to a non-zero value if the error was managed.<br />

An error handler declaration looks like this:<br />

OSBOOLEAN err_handler(OSBOOLEAN user_called,<br />

OSERRCODE ecode,<br />

OSERRCODE extra);<br />

There are three lev<strong>el</strong>s of error handlers: The process error handler is called first<br />

if it is present. If it returns a flag saying that it could not manage the error, then<br />

the error is propagated to the next lev<strong>el</strong>. Otherwise the kern<strong>el</strong> returns to user code.<br />

(Errors considered fatal by the kern<strong>el</strong> are always propagated to the next lev<strong>el</strong>)<br />

The block error handler is called if there is no process error handler or if the<br />

process error handler returns an zero. The block error handler may then be able<br />

to resolve the situation in exactly the same manner as on the previous lev<strong>el</strong>.<br />

The kern<strong>el</strong> error handler is part of the kern<strong>el</strong> and is specified when the kern<strong>el</strong> is<br />

generated. This handler is called if no other error handler is present or if a<br />

reported error is fatal or if previous lev<strong>el</strong>s can not resolve the situation.<br />

Include files #include "ose.h"<br />

Parameters pid The ID of the specified process.<br />

entrypoint The address of the error handler.<br />

stack_size Specifies the stack size to be used.<br />

Return value Returns the entrypoint of any previously defined error handler, or NULL if no<br />

previous error handler was defined.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 15<br />

create_error_handler


Restrictions<br />

See also<br />

Error handlers used by several processes must be re-entrant, i.e they must use only<br />

stack variables.<br />

An error handler must return when it is finished. In particular, it must not use the<br />

longjmp directive defined in the C language.<br />

It is recommended that error handlers are created only for processes or blocks that<br />

are clos<strong>el</strong>y r<strong>el</strong>ated to the caller. It is illegal to create an error handler for a block<br />

or process in another memory segment.<br />

Error codes provided by the OSE kern<strong>el</strong> as w<strong>el</strong>l as all symbols defined in<br />

ose_err.h are implementation dependent.<br />

The create_error_handler call is not available to interrupt processes.<br />

error, ose_err.h<br />

Implementation Not implemented at lev<strong>el</strong> A. Full performance from lev<strong>el</strong> B.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

<strong>Kern</strong><strong>el</strong><br />

OSBOOLEAN pr_err_hand(OSBOOLEAN user_called,<br />

OSERRCODE ecode,<br />

OSERRCODE extra);<br />

OSBOOLEAN bl_err_hand(OSBOOLEAN user_called,<br />

OSERRCODE ecode,<br />

OSERRCODE extra);<br />

PROCESS proc_;<br />

PROCESS block_;<br />

OS_PROCESS(my_process)<br />

{<br />

OSERRH errhand, old_pr_errhand, old_block_errhand;<br />

/* Creating a process error handler. (The entrypoint<br />

* to an error handler is returned in errhand if one<br />

* is previously defined otherwise NULL is returned,<br />

* there is no need to test the value).<br />

*/<br />

old_pr_errhand = create_error_handler(proc_,(OSERRH *)<br />

pr_err_hand,200);<br />

/* Creating a block error handler. (The entrypoint to<br />

* an error handler is returned in errhand if one is<br />

* previously defined otherwise NULL is returned,<br />

* there is no need to test the value).<br />

*/<br />

old_block_errhand = create_error_handler(block_,(OSERRH *)<br />

bl_err_hand,200);<br />

for(;;)<br />

{<br />

/* Code */<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 16<br />

create_error_handler


create_pool<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax void create_pool (PROCESS bid,<br />

OSADDRESS base,<br />

OSADDRESS size,<br />

OSADDRESS sigsize_tab[],<br />

OSADDRESS stacksize_tab[]);<br />

Description This is a call from the memory manager block (MMU) to the kern<strong>el</strong> and is<br />

therefore normally not a user system call.<br />

The MMU creates a new pool and attaches it to the specified block and all its<br />

children.<br />

Pool space skould be allocated by the memory manager and is made known to the<br />

kern<strong>el</strong> by issuing this call. The pool is entir<strong>el</strong>y managed by the kern<strong>el</strong> until all<br />

blocks using the pool are dead. At that point, pool space may be reclaimed by the<br />

MMU without further notice to the kern<strong>el</strong>.<br />

The first pool created is the system pool. The system pool is shared by all<br />

supervisor processes and those user processes that reside in kern<strong>el</strong> address space.<br />

Other pools are local pools to be used only by the specified block and its children.<br />

(It is possible to have local pools in kern<strong>el</strong> space too, which may be a useful<br />

feature when separat<strong>el</strong>y linked blocks are utilized in a system with no memory<br />

protection hardware.)<br />

In systems with simple memory protection hardware (fence registers) it may be<br />

useful to have local pools assigned only for stacks. In this way you will get a<br />

system with improved security without affecting performance.<br />

Bid is the (newly created) block to which the new pool should be attached.<br />

Base is the lowest address in the pool.<br />

Size is number of bytes reserved for the pool.<br />

Sigsize_tab[] is a sorted array of signal buffer sizes.<br />

The first location contains the number of entries in the array, excluding the count<br />

its<strong>el</strong>f (max 8). If count = 0 then signals are allocated from the pool inherited from<br />

the creator or the pool already created for signals.<br />

Stacksize_tab[] is a sorted array of stack buffer sizes. The first location counts<br />

the number of entries (max 8). If count = 0 then stacks are allocated from the pool<br />

inherited from the creator or the pool already created for stacks.<br />

Include files #include "ose.h"<br />

Parameters bid The ID of the specified block.<br />

base<br />

The lowest address in the pool.<br />

size<br />

The number of bytes reserved for the pool.<br />

sigsize_tab[] An array of all the available buffer sizes in the pool.<br />

stacksize_tab[] An array of all the available stack buffer sizes in the pool.<br />

Return value None.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 17<br />

create_pool


Restrictions Create_pool must be called before the first process in the block is created, if<br />

called at all.<br />

Create_pool is normally called after any call to attach_segment if that system call<br />

is required. Otherwise the pool will appear in the original memory segment,<br />

which is probably not what the caller intended. On the other hand, keeping signal<br />

pools in a common segment disables signal copying while maintaining code<br />

protection, which may sometimes be a useful and more efficient mode of<br />

operation.<br />

The get_pid_list and get_bid_list system call requires that:<br />

(max buffer size) > (max number of processes * sizeof(PROCESS)).<br />

It is also wise to set the largest buffer size to a large value, like 65535, which is<br />

the largest portable OSE buffersize.<br />

The create_pool call is not available to interrupt processes.<br />

See also alloc, free_buf<br />

Implementation Not implemented at lev<strong>el</strong>s A and B. Full performance from<br />

lev<strong>el</strong>s lev<strong>el</strong> C.<br />

<strong>Kern</strong><strong>el</strong><br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 18<br />

create_pool


create_process<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax PROCESS create_process (<br />

enum PROCESS_TYPE proc_type,<br />

char<br />

*name,<br />

OSENTRYPOINT<br />

*entrypoint,<br />

OSADDRESS stack_size,<br />

OSPRIORITY priority,<br />

OSTIME timeslice,<br />

PROCESS<br />

block,<br />

struct OS_redir_entry *redir_table,<br />

OSVECTOR<br />

vector,<br />

OSUSER<br />

user);<br />

Description Creates a process as part of the specified block.<br />

Prioritized, background and timer-interrupt processes must be subsequently<br />

started with the start system call, or the entire block can be started if only new<br />

processes are contained in it.<br />

proc_type is the type of the process. Legal values are:<br />

OS_PRI_PROC: for a prioritized process.<br />

OS_BG_PROC: for a background process.<br />

OS_INT_PROC: for an interrupt process.<br />

OS_TI_PROC: for a timer-interrupt process.<br />

OS_PHANTOM: for a phantom or dummy process.<br />

Name is a zero-terminated ASCII string that represents the process name. This<br />

string may in some implementations be copied by the kern<strong>el</strong> and stored in kern<strong>el</strong><br />

memory. The name is used as a tag by other processes when searching for a<br />

process with the hunt call. The name may contain all printable characters.<br />

The slash (/) has special significance because it is recognized by the kern<strong>el</strong> as a<br />

path separator. It separates components in the name, which usually represents a<br />

network routing path. A link handler may however choose to use the pathname in<br />

any way desired. The create_process call does not manipulate the name string, it<br />

is just stored away, path and all.<br />

Entrypoint is where the process should begin execution. Portable programs<br />

should define the entrypoint with the OS_PROCESS macro.<br />

Stack_size is the number of bytes that should be allocated for the stack. Stacks<br />

are allocated according to a complex set of rules. Supervisor type interrupt and<br />

timer-interrupt processes share a common interrupt stack in kern<strong>el</strong> space. The size<br />

of this stack is automatically adjusted to maximum requirements. Prioritized and<br />

background processes allocate the user stack from the pool of the block they<br />

b<strong>el</strong>ong to, the supervisor stack is allocated from the system pool.<br />

Priority is the priority of the process. Legal values are 0-31. 0 is the highest<br />

priority. The priority is interpreted in different ways for the various process types.<br />

For interrupt processes it means hardware priority. The logical interrupt priority<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 19<br />

create_process


<strong>Kern</strong><strong>el</strong><br />

(0-31) maps to actual hardware priority in an implementation specific way. For<br />

timer-interrupt processes, it means in which order after the actual timer event the<br />

process is scheduled for execution. For prioritized processes, it means how<br />

important the process should be. For background and phantom processes it is not<br />

used. (You must however set the parameter to a legal value 0-31 for this as w<strong>el</strong>l)<br />

Timer process priority is an implementation option since this feature is some what<br />

difficult to implement efficiently.<br />

Timeslice is used only for timer-interrupt processes and background processes<br />

(some implementations allow a timeslice or pre-emption timeout also for<br />

prioritized processes - set it to zero if not used). For timer-interrupt processes the<br />

timeslice represents the number of milliseconds between each activation of the<br />

process. For background processes it represents the number of milliseconds the<br />

process is allowed to run before the next background process is scheduled. The<br />

stipulated time is rounded upwards to an integral number of system tick periods<br />

by the kern<strong>el</strong>. A timeslice of NULL means the default timeslice defined by the<br />

implementation. Any attempt to create a prioritized or background process with a<br />

timeslice longer than the default value causes the process to be created with the<br />

default timeslice.<br />

Block is the ID of the block that contains the new process. The block ID indicates<br />

among other things in which memory segment the process executes and which<br />

default user number the process has. Set block ID to zero for the new process to<br />

become part of the caller's block.<br />

Redir_table, if present, is a pointer to a redirection table that describes how<br />

signals sent to the created process should be redirected. It is set to zero if not<br />

present. If present, this structure contains an array of signal/process pairs. When<br />

a signal is sent to the created process, the redirection table is searched and if<br />

present in the table, the signal is redirected to the process that should receive the<br />

signal.<br />

The redirection table consists of an array of structures of type "struct<br />

OS_redir_entry", which is defined as:<br />

struct OS_redir_entry<br />

{<br />

SIGSELECT sig;<br />

PROCESS pid;<br />

};<br />

The first structure in the redirection table contains a count of the number of<br />

entries in the table including the first entry, and a process ID to which signals not<br />

specified in the redirection table should be sent. The count is always at least 1,<br />

and the default process ID may be set to zero to specify the created process.<br />

The kern<strong>el</strong> may or may not copy this table to kern<strong>el</strong> memory, so the user must<br />

assume that the table can not be subsequently altered.<br />

Vector is valid for interrupt processes only. It is the hardware vector number<br />

attached to the new process. A vector number of -1 causes the kern<strong>el</strong> to skip<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 20<br />

create_process


<strong>Kern</strong><strong>el</strong><br />

hardware vector generation. Such a process can only be invoked by sending a<br />

signal to it or signalling its fast semaphore. Use the wake_up() system call to gain<br />

knowledge about how the interrupt process was invoked.<br />

User is the user ID of the new process, or zero if the process should inherit the<br />

default user ID of the block in which it is contained.<br />

Include files #include "ose.h"<br />

Parameters proc_type Specifies the type of the process.<br />

name<br />

A pointer to the name of the process.<br />

entrypoint The address of where the process will start execution<br />

stack_size Specifies the size of the stack.<br />

priority<br />

The priority lev<strong>el</strong> for the process.<br />

timeslice Number of milliseconds.<br />

block<br />

The name of the block the process will be part of.<br />

redir_table A pointer to the redirection table if present.<br />

vector<br />

The hardware vector number (only for interrupt processes).<br />

user<br />

Specifies the user ID of the process.<br />

Return value. Returns the process ID for the new process.<br />

Restrictions The redirection table must be built in run-time since process identities are<br />

unknown at compile time.<br />

Supervisor mode processes (part of a supervisor mode block) can only be created<br />

by a superuser process (user number 0), executing in supervisor mode its<strong>el</strong>f.<br />

Only superuser processes may create processes with user numbers other than the<br />

caller's own usernumber.<br />

The create_process call is not available to interrupt processes.<br />

Some implementations can not create timer-interrupt processes with a timeslice<br />

value larger than 256 times the length of a tick. I.e. 256 * (system_tick() / 1000).<br />

See also current_process, create_block, kill_proc, OS_PROCESS, set_redirection, start<br />

Implementation Not implemented at lev<strong>el</strong> A. Only phantom processes and<br />

lev<strong>el</strong>s<br />

user number zero are allowed at lev<strong>el</strong> B. Only user number<br />

zero is allowed at lev<strong>el</strong> C. Full performance at lev<strong>el</strong> D.<br />

Example<br />

#include "ose.h"<br />

extern OSENTRYPOINT new_process;<br />

OS_PROCESS(my_process)<br />

{<br />

PROCESS proc_;<br />

for(;;)<br />

{<br />

/* Code */<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 21<br />

create_process


}<br />

}<br />

proc_ = create_process(OS_PRI_PROC,<br />

"proc",<br />

new_process,<br />

200,<br />

16,<br />

(OSTIME) 0,<br />

(PROCESS) 0,<br />

(struct OS_redir_entry *) NULL,<br />

(OSVECTOR) 0,<br />

(OSUSER) 0);<br />

start(proc_);<br />

/* Code */<br />

<strong>Kern</strong><strong>el</strong><br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 22<br />

create_process


create_sem<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

SEMAPHORE *create_sem (OSSEMVAL initial_val);<br />

Description Creates a dynamic semaphore structure and initializes it to the value specified in<br />

initial_val. The initial value must be zero or a positive value. Typical values are<br />

0 and 1.<br />

The semaphore is dynamically allocated from the current pool. It may be returned<br />

to the pool when it is no longer in use by calling kill_sem. Semaphores are<br />

implicitly killed when all blocks in the memory segment of the creator terminates,<br />

i.e when the memory segment is reclaimed.<br />

Semaphores may also be statically defined by simply declaring a static semaphore<br />

structure in the program and initializing it. Such semaphores can not be killed.<br />

They are removed from the system when the blocks using a semaphore have<br />

terminated and the memory manager software reclaims the memory segment.<br />

Semaphore structures contain three fi<strong>el</strong>ds. The first must be initialized to the<br />

initial (positive) value of the semaphore. The second and third fi<strong>el</strong>ds must be<br />

initialized to zero, and are required for internal use by the kern<strong>el</strong>.<br />

The three fi<strong>el</strong>ds of a semaphore structure are named "value", "f" and "b"<br />

respectiv<strong>el</strong>y. The value fi<strong>el</strong>d is of type OSSEMVAL. The types of the other fi<strong>el</strong>ds<br />

are implementation-specific.<br />

Include files #include "ose.h"<br />

Parameters initial_val The initial value of the created semaphore.<br />

Return value A pointer to the created semaphore structure.<br />

Restrictions A semaphore can only be shared by processes within the same memory segment<br />

since the semaphore dies when the memory segment is reclaimed. If it is known<br />

that the segment is never killed, then a semaphore can be shared among all<br />

processes with access to the address space of the segment. It is the user's<br />

responsibility to ensure that the semaphore is not killed while it is still in use, and<br />

that a process is not killed while operating on a semaphore that is expected to live.<br />

Serious problems may otherwise arise.<br />

The create_sem call is not available to interrupt processes.<br />

See also wait_sem, signal_sem, get_sem, kill_sem<br />

Implementation Not implemented at lev<strong>el</strong> A. Full performance from lev<strong>el</strong> B.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

OS_PROCESS(my_process)<br />

{<br />

SEMAPHORE *sem;<br />

for(;;)<br />

{<br />

/* Code */<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 23<br />

create_sem


}<br />

}<br />

sem = create_sem(1);<br />

/* Code */<br />

<strong>Kern</strong><strong>el</strong><br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 24<br />

create_sem


current_process<br />

Syntax<br />

Description<br />

Include files<br />

PROCESS current_process (void);<br />

Determines which process is currently running.<br />

#include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

Parameters None.<br />

Return value Returns the process ID of the calling process.<br />

Restrictions None.<br />

Implementation Full performance at all implementation lev<strong>el</strong>s.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

OS_PROCESS(my_process)<br />

{<br />

PROCESS proc_;<br />

<strong>Kern</strong><strong>el</strong><br />

for(;;)<br />

{<br />

/* Code */<br />

proc_ = current_process();<br />

/* Code */<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 25<br />

current_process


d<strong>el</strong>ay<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

void d<strong>el</strong>ay (OSTIME timeout);<br />

Description Suspends the calling process for the number of milliseconds specified in the<br />

timeout parameter.<br />

The specified timeout period is converted to a number of actual system ticks<br />

according to the following rules:<br />

A value of zero returns immediat<strong>el</strong>y.<br />

A value equal to or smaller than one system tick period returns at the next system<br />

timer event, i.e. after anything between 0 and 1 system tick.<br />

A value higher than one system tick period is rounded upwards to the closest<br />

number of system ticks. The actual d<strong>el</strong>ay will vary between the calculated number<br />

of ticks and this value less one tick period.<br />

The result is that the actual d<strong>el</strong>ay may be up to one system tick period shorter<br />

than specified.<br />

Include files #include "ose.h"<br />

Parameters timeout Specifies the number of milliseconds to suspend the process.<br />

Return value None.<br />

Restrictions The d<strong>el</strong>ay call is not available to interrupt processes.<br />

See also receive_w_tmo<br />

Implementation Full performance at all implementation lev<strong>el</strong>s.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

OS_PROCESS(my_process)<br />

{<br />

for(;;)<br />

{<br />

turn_on_lamp();/* fictive function */<br />

d<strong>el</strong>ay(10);<br />

turn_off_lamp();/* fictive function */<br />

d<strong>el</strong>ay(10);<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 26<br />

d<strong>el</strong>ay


detach<br />

Syntax<br />

void detach (OSATTREF *ref);<br />

Description Removes a signal previously attached by the caller.<br />

The ref parameter contains a pointer to the reference ID which was returned by<br />

the previous call to attach.<br />

Include files #include "ose.h"<br />

Parameters ref A pointer to the reference ID of the previously attached<br />

signal.<br />

Return value None.<br />

Restrictions It is illegal to detach a signal already received and freed by the caller.<br />

It is illegal for a process to use a ref parameter obtained by another process, i.e<br />

corresponding attach and detach calls must be made by the same process.<br />

The detach call is not available to interrupt processes.<br />

See also attach, OS_ATTACH_SIG<br />

Implementation Not implemented at lev<strong>el</strong> A. Full performance from lev<strong>el</strong> B.<br />

lev<strong>el</strong>s<br />

Example<br />

<strong>Kern</strong><strong>el</strong><br />

#include "ose.h"<br />

union SIGNAL<br />

{<br />

SIGSELECT sig_no;<br />

};<br />

static const SIGSELECT attach_sig[2] = {1, OS_ATTACH_SIG};<br />

extern PROCESS proc_;<br />

OS_PROCESS(my_process)<br />

{<br />

union SIGNAL *sig;<br />

OSATTREF attref;<br />

for(;;)<br />

{<br />

attref = attach(NULL, proc_);<br />

/* Code */<br />

sig = receive_w_tmo(0, (SIGSELECT *)attach_sig);<br />

if(sender(&sig) != proc_)<br />

{<br />

detach(&attref);/* Process not dead */<br />

}<br />

free_buf(&sig);<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 27<br />

detach


error<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

void error (OSERRCODE ecode);<br />

Description Reports an error to the kern<strong>el</strong> or to the error handler possibly attached to the<br />

current process or block.<br />

The ecode parameter contains a user-defined numerical error code. This code is<br />

passed to the error handler for evaluation.<br />

It is suggested that error codes are grouped into ranges for classification of the<br />

error. For instance, an error code with the most significant bit set to zero can be<br />

interpreted as a warning while other error codes can be considered fatal for the<br />

calling process.<br />

Include files #include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

Parameters ecode The error number to be passed to the error handler.<br />

Return value The error call may or may not return, depending on how the error handler policy<br />

is implemented by the user.<br />

Restrictions None.<br />

Implementation Full performance at all implementation lev<strong>el</strong>s.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

OS_PROCESS(my_process)<br />

{<br />

for(;;)<br />

{<br />

/* Code */<br />

error(6);<br />

/* Code */<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 28<br />

error


error2<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

void error2 (OSERRCODE ecode, OSERRCODE extra);<br />

Description Reports an error to the kern<strong>el</strong> or to the error handler possibly attached to the<br />

current process or block.<br />

The ecode parameter contains a user-defined numerical error code. This code is<br />

passed to the error handler for evaluation.<br />

It is suggested that error codes are grouped into ranges for classification of the<br />

error. For instance, an error code with the most significant bit set to zero can be<br />

interpreted as a warning while other error codes can be considered fatal for the<br />

calling process.<br />

The extra parameter is there so you can pass extra information to the error<br />

handler. It might be a pointer to some info that you would like to have available<br />

when<br />

handling the error in the error handler.<br />

Include files #include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

Parameters ecode The error number to be passed to the error handler.<br />

extra<br />

This parameter will be passed to the error handler, and show<br />

up as the extra parameter in the error handler.<br />

Return value The error call may or may not return, depending on how the error handler policy<br />

is implemented by the user.<br />

Restrictions None.<br />

Implementation All OSE implementations might not have this system call.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

OS_PROCESS(my_process)<br />

{<br />

for(;;)<br />

{<br />

const char *error_str = "This is no good";<br />

/* Code */<br />

error2(6, (OSERRCODE)error_str);<br />

/* Code */<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 29<br />

error2


flush<br />

Syntax<br />

void flush (PROCESS *ps<strong>el</strong>, PROCESS pid);<br />

Description The flush call throws away all signals sent by any of a set of processes specified<br />

in ps<strong>el</strong>, from the signal queue of the process specified in pid.<br />

The ps<strong>el</strong> parameter is an array of process ID's. The first location contains the<br />

number of valid entries in the rest of the array.<br />

The flush call may be useful for instance when a process is unexpectedly killed,<br />

and other processes involved need to clear any pending transactions towards the<br />

killed process.<br />

Include files #include "ose.h"<br />

Parameters ps<strong>el</strong> A pointer to an array of processes to flush signals from.<br />

pid<br />

The process ID of the receiving process.<br />

Return value None.<br />

Restrictions The ps<strong>el</strong> array must be built in run-time since process identities are unknown at<br />

compile time.<br />

The first location in ps<strong>el</strong> contains the number of entries in the rest of the array.<br />

Since the PROCESS type may not be compatible to an integer, the count should<br />

be cast to the PROCESS type when building ps<strong>el</strong>.<br />

<strong>Kern</strong><strong>el</strong><br />

Ex: ps<strong>el</strong>[0] = (PROCESS) 1;<br />

It is illegal to flush the queue of an interrupt or timer-interrupt process.<br />

The flush call is not available to interrupt processes.<br />

Implementation This system call should be regarded as obsolete, and is only implemented for<br />

lev<strong>el</strong>s<br />

backwards compatibility reasons.<br />

Example<br />

#include "ose.h"<br />

extern PROCESS proc1_;<br />

extern PROCESS proc2_;<br />

OS_PROCESS(my_process)<br />

{<br />

PROCESS flush_array[2];<br />

flush_array[0] = (PROCESS) 1;<br />

flush_array[1] = proc1_;<br />

}<br />

}<br />

for (;;)<br />

{<br />

/* Code */<br />

flush(flush_array, proc2_); /* Throws away all */<br />

/* signals sent */<br />

/* from proc1 to proc2*/<br />

/* Code */<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 30<br />

flush


free_buf<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

Description<br />

void free_buf (union SIGNAL **sig);<br />

Returns a signal buffer that is no longer needed to the pool associated with the<br />

caller's block. NIL is entered into the caller's signal pointer to avoid accidental<br />

reuse of the buffer.<br />

Include files #include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

Parameters sig A pointer to a pointer to the signal buffer to free.<br />

Return value None.<br />

Restrictions<br />

See also<br />

It is an error to free a buffer owned by another process. Such buffers must be freed<br />

by the owner, or ownership must be changed by calling restore before calling<br />

free_buf.<br />

Some old OSE implementations will not permit freeing redirected buffers (e.g.<br />

signals sent to other processors). Portable code should therefore call restore before<br />

freeing such buffers. New OSE implementations do not have this restriction.<br />

Note that many OSE calls return buffers that are allocated by the kern<strong>el</strong>. These<br />

buffers are typed as required by the various calls and must be cast to (union<br />

SIGNAL **) when freed.<br />

alloc, restore<br />

Implementation Full performance at all implementation lev<strong>el</strong>s.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

static const SIGSELECT any_sig[] = {0};<br />

union SIGNAL<br />

{<br />

SIGSELECT sig_no;<br />

}<br />

OS_PROCESS(my_process)<br />

{<br />

union SIGNAL *sig;<br />

for(;;)<br />

{<br />

/* Code */<br />

sig = receive((SIGSELECT *) any_sig);<br />

/* Code */<br />

free_buf(&sig);<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 31<br />

free_buf


get_bid<br />

Syntax<br />

Description<br />

Include files<br />

PROCESS get_bid (PROCESS pid);<br />

Finds the block that the specified process is part of.<br />

#include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

Parameters pid The process ID.<br />

Return value Returns the block ID.<br />

If pid is a block ID or the ID of a dead process, then the value specified in pid is<br />

returned from the get_bid call. Use get_ptype to test on these cases if you need to.<br />

Restrictions Superuser blocks can only be created by a superuser process.Supervisor mode<br />

blocks can only be created by a superuser process (user number 0) executing in<br />

supervisor mode its<strong>el</strong>f. The create_block call is not available to interrupt<br />

processes.<br />

See also create_block, get_bid_list<br />

Implementation Not implemented at lev<strong>el</strong> A. Full performance from lev<strong>el</strong> B.<br />

lev<strong>el</strong>s<br />

Example<br />

<strong>Kern</strong><strong>el</strong><br />

#include "ose.h"<br />

OSENTRYPOINT new_process;<br />

extern PROCESS proc_;<br />

OS_PROCESS(my_process)<br />

{<br />

PROCESS bid;<br />

PROCESS process_;<br />

for(;;)<br />

{<br />

/* Code */<br />

bid = get_bid(proc_);<br />

/* Add new_process to the blocks to which*/<br />

/* proc_ b<strong>el</strong>ongs */<br />

process_ = create_process(OS_PRI_PROC,<br />

"process",<br />

new_process,<br />

200,<br />

16,<br />

(OSTIME) 0,<br />

bid,<br />

(struct OS_redir_entry *) NULL,<br />

(OSVECTOR) 0,<br />

(OSUSER) 0);<br />

start(process_);<br />

/* Code */<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 32<br />

get_bid


get_bid_list<br />

Syntax<br />

struct OS_pid_list *get_bid_list (OSUSER user);<br />

Description Lists all blocks that are available to the specified user number.<br />

Blocks that are owned by some other user are included if they contain at least one<br />

process available to the specified user.<br />

If user 0 is specified, this indicates the caller's user number.<br />

If user 0 is specified and the caller is a superuser, then all blocks in the system<br />

are listed.<br />

Include files #include "ose.h"<br />

Parameters user Specifies the user number.<br />

Return value Returns NULL if there are no blocks available to the specified user.<br />

Otherwise get_bid_list allocates and returns a signal buffer with a structure<br />

containing the list of block ID's.<br />

The buffer must be freed by the caller when information has been extracted. The<br />

structure is:<br />

<strong>Kern</strong><strong>el</strong><br />

Restrictions<br />

See also<br />

struct OS_pid_list<br />

{<br />

OSBUFSIZE count;<br />

PROCESS list[];<br />

};<br />

where count is the number of blocks and list is a variable size array containing<br />

the block identities.<br />

Only a superuser process may examine another user space.<br />

The get_bid_list call is not available to interrupt processes.<br />

get_bid, get_pcb, get_pid_list<br />

Implementation Not implemented at lev<strong>el</strong>s A and B. Full performance from<br />

lev<strong>el</strong>s lev<strong>el</strong> C.<br />

Example<br />

#include "ose.h"<br />

OS_PROCESS(my_process)<br />

{<br />

struct OS_pid_list *bidlist;<br />

OSBUFSIZE count;<br />

PROCESS block1_;<br />

OSBOOLEAN exist;<br />

int i;<br />

for(;;)<br />

{<br />

/* Code */<br />

bidlist = get_bid_list(0);<br />

count = bidlist->count;<br />

exist = 0;<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 33<br />

get_bid_list


}<br />

}<br />

for(i = 0; i < count; i++)<br />

{<br />

if(bidlist->list[i] == block1_)<br />

{<br />

exist = 1;<br />

break;<br />

}<br />

}<br />

if(exist)<br />

{<br />

/* Code, The block exists */<br />

}<br />

<strong>el</strong>se<br />

{<br />

block1_ = create_block("block1",<br />

(OSUSER) 0,<br />

(OSBOOLEAN) 0,<br />

(PROCESS) 0,<br />

(OSBOOLEAN) 0);<br />

/* Code */<br />

}<br />

<strong>Kern</strong><strong>el</strong><br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 34<br />

get_bid_list


get_cpu<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

char *get_cpu (PROCESS pid);<br />

Description Returns a string describing the operating system on which the specified process<br />

is executing.<br />

In many cases, this information is also used indirectly to find out the CPU type.<br />

The string is contained in a buffer obtained from the caller's pool. This buffer<br />

must be returned to the pool with the free_buf call when the string has been<br />

extracted.<br />

Include files #include "ose.h"<br />

Parameters pid The process ID of the specified process.<br />

Return value The returned null-terminated string has the following general format:<br />

"//"<br />

The "/" character is a general fi<strong>el</strong>d separator.<br />

Only the first two fi<strong>el</strong>ds have specified contents.<br />

Ex: "OSE/68360 R1.2.0"<br />

Restrictions The get_cpu call is not available to interrupt processes.<br />

Implementation Not implemented at lev<strong>el</strong> A. Full performance from lev<strong>el</strong> B.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

union SIGNAL<br />

{<br />

SIGSELECT sig_no;<br />

};<br />

OS_PROCESS(my_process)<br />

{<br />

char *cpu1;<br />

char *cpu2;<br />

extern PROCESS proc_;<br />

for(;;)<br />

{<br />

/* Code */<br />

cpu1 = (char*) get_cpu(current_process());<br />

cpu2 = (char*) get_cpu(proc_);<br />

if(strcmp(cpu1, cpu2) == 0)<br />

{<br />

/* Code, The processes run in exactly the same<br />

* operating systems (need not be in the same<br />

* cpu)<br />

*/<br />

}<br />

free_buf( (union SIGNAL **) &cpu1);<br />

free_buf( (union SIGNAL **) &cpu2);<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 35<br />

get_cpu


get_env<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

char *get_env (PROCESS pid, char *name);<br />

Description Reads the contents of the named environment variable for the specified process<br />

or block.<br />

Variables set with the set_envp() call can be read with the get_env() call, but the<br />

string returned is not easily interpreted<br />

Include files #include "ose.h"<br />

Parameters pid The ID of the specified process.<br />

name<br />

A pointer to the environment variable name.<br />

Return value Returns a buffer obtained from the caller’s pool containing the value of the<br />

specified environment variable. The value is always a null-terminated string.<br />

This buffer must be freed with free_buf by the caller when information has been<br />

extracted.<br />

Returns NULL if the specified environment variable was not found.<br />

Restrictions Strings that are too long to be passed in a signal buffer are truncated.<br />

The get_env call is not available to interrupt processes.<br />

See also get_env_list, get_envp, set_env, set_envp<br />

Implementation Not implemented at lev<strong>el</strong> A. Full performance from lev<strong>el</strong> B.<br />

lev<strong>el</strong>s<br />

Example<br />

#include <br />

#include "ose.h"<br />

void print_term(void)<br />

{<br />

char *env = get_env(current_process(), "TERM");<br />

if(envbuf != NULL)<br />

{<br />

printf("TERM=%s\n", env);<br />

free_buf( (union SIGNAL **) &envbuf);<br />

}<br />

} /* print_term */<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 36<br />

get_env


get_env_list<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

char *get_env_list (PROCESS pid,<br />

char *first_name);<br />

Description Lists the environment variables available in the specified process or block.<br />

If first_name is NULL then the returned list starts at the first variable found.<br />

If first_name is a valid name, then the returned list starts at the first variable name<br />

found after first_name. (In this way a long list can be managed.)<br />

Include files #include "ose.h"<br />

Parameters pid The ID of the specified process.<br />

first_name A pointer to an environment variablename.<br />

Return value Returns a buffer obtained from the caller’s pool containing the names of the<br />

environment variables available in the specified process or block.<br />

Names are separated by a single space and the entire string is null-terminated.<br />

Names that are too long for a single buffer are discarded from the return list.<br />

(Truncated names are never returned).<br />

The buffer must be freed by the caller when information has been extracted.<br />

Returns an empty string "" if the process or block has terminated or if no variables<br />

were found.<br />

Restrictions There is only one way to know if the environment contains more strings than the<br />

ones returned. A second get_env_list call must always be issued, specifying the<br />

last name in the previous list as first_name.<br />

The get_env_list call is not available to interrupt processes.<br />

See also set_env<br />

Implementation Not implemented at lev<strong>el</strong> A.Full performance from lev<strong>el</strong> B.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

extern PROCESS proc_;<br />

OS_PROCESS(my_process)<br />

{<br />

char *envbuf;<br />

OSBOOLEAN exist;<br />

char *last;<br />

for(;;)<br />

{<br />

/* Code */<br />

envbuf = get_env_list(proc_, NULL);<br />

exist = 0;<br />

while(*envbuf && exist == 0)<br />

{<br />

if(strstr(envbuf, "port"))<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 37<br />

get_env_list


}<br />

}<br />

{<br />

exist = 1;<br />

}<br />

<strong>el</strong>se<br />

{<br />

/* Find the last name in the buffer */<br />

last = strrchr(envbuf,' ');<br />

if (last)<br />

envbuf = get_env_list(proc_, last);<br />

<strong>el</strong>se<br />

envbuf = "";<br />

}<br />

}<br />

if(exist)<br />

{<br />

/* Code, The variable exists */<br />

}<br />

<strong>el</strong>se<br />

{<br />

/* Code */<br />

}<br />

<strong>Kern</strong><strong>el</strong><br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 38<br />

get_env_list


get_envp<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax OSADDRESS get_envp (PROCESS pid, char *name);<br />

Description Reads a 32 bit pointer from a named environment variable for the specified<br />

process or block.<br />

This call assumes that the value was set with the set_envp call, which means that<br />

it was stored in a special format. Variables set with the set_env call can be read<br />

with the get_envp call only if the value consists of exactly 8 characters.<br />

Include files #include "ose.h"<br />

Parameters pid The ID of the specified block or process. Setting the pid<br />

parameter to zero is equivalent to using the pid of the current<br />

process.<br />

name<br />

A pointer to the environment variable name.<br />

Return value Returns the 32 bit pointer value of the environment variable.<br />

Returns zero if the specified environment variable was not found.<br />

Restrictions The get_envp call is not available to interrupt processes.<br />

See also get_env, get_env_list, set_env, set_envp<br />

Implementation All OSE implementations might not have this system call.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

OS_PROCESS(my_process)<br />

{<br />

int prod_data = 0xCAFE;<br />

OSADDRESS pa;<br />

for(;;)<br />

{<br />

set_envp(0, "pd", (OSADDRESS)&proc_data);<br />

pa = get_envp(0, "pd");<br />

if (pa != 0)<br />

printf("pa = %d\n", *(int *)pa);<br />

/* Code */<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 39<br />

get_envp


get_fsem<br />

Syntax<br />

Description<br />

Include files<br />

OSFSEMVAL get_fsem (PROCESS pid);<br />

Interrogates the fast semaphore of the specified process.<br />

#include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

Parameters pid The ID of the specified process.<br />

Return value Returns the current value of the fast semaphore.<br />

Restrictions Get_fsem may also be called from interrupt and timer-interrupt processes, but it<br />

is an error to cause a remote system call while doing so, i.e. an interrupt or timerinterrupt<br />

process may not access a fast semaphore in another CPU.<br />

Examining the fast semaphore of an interrupt or timer-interrupt process, or a<br />

process without a fast semaphore, yi<strong>el</strong>ds garbage.<br />

See also signal_fsem, wait_fsem, set_fsem<br />

Implementation Not implemented at lev<strong>el</strong> A. Full performance from lev<strong>el</strong> B.<br />

lev<strong>el</strong>s<br />

Example<br />

<strong>Kern</strong><strong>el</strong><br />

#include "ose.h"<br />

OS_PROCESS(my_process)<br />

{<br />

OSFSEMVAL fsemvalue;<br />

for(;;)<br />

{<br />

/* Code */<br />

fsemvalue = get_fsem(current_process());<br />

/*Code */<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 40<br />

get_fsem


get_mem<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax OSBOOLEAN get_mem (PROCESS pid,<br />

OSADDRESS from,<br />

void *to,<br />

OSADDRESS size);<br />

Description Reads a specified number of bytes from the address space of the specified process<br />

or block.<br />

This call is mainly used by debuggers to examine a program being debugged.<br />

Include files #include "ose.h"<br />

Parameters pid The ID of the specified block or process.<br />

from<br />

The memory address to read from.<br />

to<br />

A pointer to the destination buffer.<br />

size<br />

The number of bytes to read.<br />

Return value Returns a non-zero value if an error occurred. Either the specified process/block<br />

could not be found, or the requested size could not be transferred.<br />

Restrictions The caller must be aware of the problems that occur when a program on another<br />

CPU type is examined. In particular if that CPU has another word length.<br />

The get_mem call is not available to interrupt processes.<br />

See also set_mem<br />

Implementation Not implemented at lev<strong>el</strong>s A and B. Full performance from<br />

lev<strong>el</strong>s lev<strong>el</strong> C.<br />

Example<br />

#include "ose.h"<br />

#define MEM 33 /* These declarations */<br />

struct Mem /* are preferably made */<br />

{ /* in a .sig-file which */<br />

SIGSELECT sig_no; /* is included. */<br />

OSADDRESS address;<br />

};<br />

union SIGNAL<br />

{<br />

SIGSELECT sig_no;<br />

struct Mem mem;<br />

};<br />

OS_PROCESS(my_process)<br />

{<br />

char to_array[10];<br />

OSADDRESS array;<br />

OSBOOLEAN success;<br />

union SIGNAL *sig;<br />

static const SIGSELECT mem_sig[] = {1, MEM};<br />

for(;;)<br />

{<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 41<br />

get_mem


}<br />

}<br />

/* Code */<br />

sig = receive((SIGSELECT *) mem_sig);<br />

array = sig->mem.address;<br />

success = get_mem(sender(&sig),<br />

array,<br />

to_array,<br />

sizeof(to_array));<br />

if(success)<br />

{<br />

/* Code, The memory move was successful */<br />

}<br />

<strong>el</strong>se<br />

{<br />

/* Code, Not a successful memory move */<br />

}<br />

/* Code */<br />

<strong>Kern</strong><strong>el</strong><br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 42<br />

get_mem


get_pcb<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

Description<br />

struct OS_pcb *get_pcb (PROCESS pid);<br />

Interrogates the status of the specified process or block. This information is<br />

returned to the caller.<br />

The get_pcb call is mainly used by debuggers, but the process name, for instance,<br />

may also be of interest in some applications.<br />

Terminated processes may be examined, although no information of interest<br />

except process type is available.<br />

The process type fi<strong>el</strong>d must always be tested to validate other information.<br />

Note that it is legal to pass an invalid process ID to this system call. This is<br />

allowed only for the get_pcb and get_ptype calls. The returned “type” fi<strong>el</strong>d of the<br />

struct will then be set to OS_ILLEGAL.<br />

Include files #include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

Parameters pid The ID of the specified block or process.<br />

Return value<br />

Returns a buffer obtained from the caller’s pool containing the OS_pcb structure.<br />

This buffer must be freed with free_buf when it is no longer needed.<br />

If the get_pcb call was not successful, a NULL pointer is returned.<br />

The OS_pcb structure has the following layout: (For blocks, only fi<strong>el</strong>ds marked<br />

by '#' are valid.)<br />

struct OS_pcb<br />

{<br />

# OSADDRESS type; /* Should be cast to */<br />

/* enum PROCESS_TYPE */<br />

OSADDRESS status; /* Should be cast to */<br />

/* enum PROCESS_STATUS */<br />

OSADDRESS priority; /* Should be cast to OSPRIORITY */<br />

# OSUSER user;<br />

OSFSEMVAL fsemvalue;<br />

OSADDRESS sigqueue;<br />

# OSADDRESS attach_list;<br />

OSADDRESS stack_top;<br />

OSADDRESS stack_limit;<br />

# PROCESS remote_server;<br />

OSADDRESS sig_cnt_in_q;<br />

OSADDRESS sig_cnt_owned;<br />

# OSADDRESS max_sigsize;<br />

# OSADDRESS sigs<strong>el</strong>_size;<br />

OSADDRESS line;<br />

OSADDRESS file;<br />

# OSADDRESS name;<br />

OSADDRESS cpuregs;<br />

OSADDRESS wanted;<br />

# char strings[1];<br />

};<br />

where:<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 43<br />

get_pcb


<strong>Kern</strong><strong>el</strong><br />

Type contains the process type. Legal values are<br />

OS_BLOCK: A block was specified.<br />

OS_PRI_PROC: A prioritized process.<br />

OS_BG_PROC: A background process.<br />

OS_INT_PROC: An interrupt process.<br />

OS_TI_PROC: A timer-interrupt process.<br />

OS_PHANTOM: A phantom process.<br />

OS_ZOOMBIE: A killed process or block.<br />

OS_ILLEGAL: An invalid process ID was specified.<br />

Status contains process status. This is a bit fi<strong>el</strong>d with zero, one, two or three bits<br />

set. If no bits are set, the process is ready or running. Otherwise the process is<br />

suspended for one or more reasons. The OS_STOPPED and OS_INTERCEPTED<br />

bits can be independently set. Other bits are mutually exclusive.<br />

Legal bit masks are:<br />

OS_RECEIVE: Waiting for one of the receive<br />

calls.<br />

OS_DELAY:<br />

Waiting for a d<strong>el</strong>ay call.<br />

OS_SEMAPHORE: Waiting at a semaphore.<br />

OS_FSEMAPHORE: Waiting at a fast semaphore.<br />

OS_REMOTE: Waiting for a remote system<br />

call.<br />

OS_STOPPED: The process was stopped.<br />

OS_INTERCEPTED: A breakpoint was reached.<br />

Priority is the priority of the process. Legal values are 0 - 31.<br />

User is the user number of the process.<br />

Fsemvalue is the current value of the fast semaphore attached to the process. The<br />

value is negative if the process is waiting at the semaphore or if the process does<br />

not have a fast semaphore. Use the status fi<strong>el</strong>d to determine which is the case.<br />

Sigqueue is the address of the first signal in the signal queue. The signal queue<br />

can be examined by subsequent get_signal calls.<br />

Sigqueue = 0 if no signal is presently in the queue.<br />

Attach_list is the address of the first signal in the queue of attached signals. The<br />

attach queue can be examined by subsequent get_signal calls. Attach_list = 0 if<br />

no signal is attached to the process.<br />

Stack_top is the highest address on the stack. (The byte at the specified address<br />

is part of the stack.)<br />

Stack_limit is the lowest address on the stack. (The byte at the specified address<br />

is part of the stack.) The stack_top and stack_limit fi<strong>el</strong>ds are equal if the kern<strong>el</strong><br />

can not provide stack information.<br />

Remote_server is the ID of the process that manages remote system calls directed<br />

towards the examined process.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 44<br />

get_pcb


<strong>Kern</strong><strong>el</strong><br />

Remote_server is the process ID of the examined process its<strong>el</strong>f if no remote call<br />

server is present.<br />

Sig_cnt_in_q is the number of signals currently in the signal queue of the<br />

process. The address of the first signal is found in the sigqueue fi<strong>el</strong>d. Please note<br />

that the sig_cnt_in_q fi<strong>el</strong>d should only be used for statistics, not when traversing<br />

the signal queue its<strong>el</strong>f.<br />

Sig_cnt_owned is the number of signals currently owned by the process. This<br />

includes signals allocated by the process and signals attached by the process, but<br />

not signals in the signal queue or signals handed to the hunt system call.<br />

Max_sigsize indicates number of bytes in the largest signal that the specified<br />

process or block is able to allocate. This is also the largest signal that can be<br />

successfully sent to a process in the block. (Other signals are lost.)<br />

Sigs<strong>el</strong>_size contains sizeof(SIGSELECT) for the specified process or block.<br />

Line is an integer containing the source code line from which the current system<br />

call was issued. Line is 0 if no line and file information is available. Line and file<br />

information is available if the specified process was compiled with the constant<br />

OS_DEBUG defined.(I.e. a -DOS_DEBUG flag was set when compiling).<br />

File is a string (in the strings array) showing the file name from which the current<br />

system call was issued. This fi<strong>el</strong>d is invalid if line is 0.<br />

Line and file information is available if the specified process was compiled with<br />

the constant OS_DEBUG defined.<br />

Name is a string (in the strings array) showing the name of the process or block.<br />

Cpuregs is a string (in the strings array) showing all known CPU register values.<br />

The names of these are CPU dependent.<br />

A sample string might look like "PC=00001D34 SP=000089AB D1=0000A89".<br />

Registers are separated by a space. All values are in upper case hex format.<br />

Registers that can not be determined at a certain point are excluded from the list.<br />

There may be a pseudoregister named "RA". It contains the return address to user<br />

code while a system call is in progress. Information on CPU register values is<br />

available if the specified process was complied with the constant OS_DEBUG<br />

defined.<br />

Wanted is a copy (in the strings arrary) of the currently active sigs<strong>el</strong>ect array<br />

passed to receive by the examined process. The array was converted to a byte<br />

order suitable for the caller. The size of each entry must be calculated by the caller<br />

using the sigs<strong>el</strong>_size fi<strong>el</strong>d described above. The wanted fi<strong>el</strong>d is invalid if process<br />

status does not indicate OS_RECEIVE.<br />

If the sigs<strong>el</strong> array is unresolvable large it will be truncated.<br />

Strings is a variable size array containing the string pool. The string pool is used<br />

to store strings for file, process or block name and cpu registers. It also holds the<br />

wanted array. The values of those fi<strong>el</strong>ds are not pointers, but indexes into the<br />

string pool.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 45<br />

get_pcb


Restrictions<br />

See also<br />

There must be a buffer available in the pool that is large enough to hold the<br />

returned structure. Otherwise the get_pcb call will fail.<br />

Get_pcb may be called also from interrupt and timer-interrupt processes, but it is<br />

an error to cause a remote system call while doing so, i.e. an interrupt or timerinterrupt<br />

process may not examine a process in another CPU, and the kern<strong>el</strong><br />

ignores any attempt to do so. Calling get_pcb from interrupt processes is allowed<br />

mainly to aid error handlers in obtaining the name of the current process. In the<br />

softkern<strong>el</strong> the return value for cpuregs will be an empty string.<br />

get_signal, get_mem, get_ptype, set_pcb<br />

Implementation Not implemented at lev<strong>el</strong> A.<br />

lev<strong>el</strong>s Full performance from lev<strong>el</strong> B.<br />

Implementations must support the "type", "status" and "name" fi<strong>el</strong>ds. Other fi<strong>el</strong>ds<br />

are optionally implemented, but must contain harmless dummy values.<br />

Example<br />

#include "ose.h"<br />

union SIGNAL<br />

{<br />

SIGSELECT sig_no;<br />

};<br />

<strong>Kern</strong><strong>el</strong><br />

OS_PROCESS(my_process)<br />

{<br />

struct OS_pcb *pcbbuf;<br />

static const char *name = "my_process";<br />

for(;;)<br />

{<br />

/* Code */<br />

pcbbuf = get_pcb(current_process());<br />

if(pcbbuf)<br />

{<br />

switch((enum PROCESS_TYPE)pcbbuf->type)<br />

{<br />

case OS_PRI_PROC:<br />

if(strcmp(&pcbbuf->strings[pcbbuf->name], name))<br />

{<br />

/* Code */<br />

}<br />

break;<br />

default:<br />

/* Code */<br />

break;<br />

}<br />

free_buf( (union SIGNAL **) &pcbbuf);<br />

}<br />

<strong>el</strong>se<br />

{<br />

/* Code, Not a successful call */<br />

}<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 46<br />

get_pcb


get_pid_list<br />

Syntax<br />

struct OS_pid_list *get_pid_list (PROCESS bid);<br />

Description Lists all processes that are part of the specified block and are available to the<br />

calling process.<br />

It is permitted to examine a block ID in another user space. Only processes<br />

available to the caller are listed.<br />

Include files #include "ose.h"<br />

Parameters bid The ID of the specified block.<br />

Return value Returns NULL if the block has no processes available to the caller.<br />

Otherwise get_pid_list allocates and returns a signal buffer with a structure<br />

containing process ID's available to the caller in the block.<br />

The buffer must be freed by the caller when information has been extracted. The<br />

structure is:<br />

struct OS_pid_list<br />

{<br />

OSBUFSIZE count;<br />

PROCESS list[];<br />

};<br />

<strong>Kern</strong><strong>el</strong><br />

Restrictions<br />

See also<br />

where count is number of processes and list is a variable size array containing the<br />

process identities.<br />

If the block contains processes that are not available to the caller, for instance<br />

processes running under other user numbers, these processes are not shown.<br />

If the block contains more processes than can be presented in the largest signal<br />

buffer, then the list is truncated at that size.<br />

The get_pid_list is not available to interrupt processes.<br />

get_pcb, get_bid_list<br />

Implementation Not implemented at lev<strong>el</strong>s A and B. Full performance from<br />

lev<strong>el</strong>s lev<strong>el</strong> C.<br />

Example<br />

#include "ose.h"<br />

#define START 10 /* These declarations */<br />

struct Start /* are preferably made */<br />

{ /* in a .sig-file which */<br />

SIGSELECT sig_no; /* is included. */<br />

};<br />

union SIGNAL<br />

{<br />

SIGSELECT sig_no;<br />

struct Start start;<br />

};<br />

extern PROCESS some_block_;<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 47<br />

get_pid_list


OS_PROCESS(my_process)<br />

{<br />

struct OS_pid_list *pidlist;<br />

OSBUFSIZE count;<br />

union SIGNAL *sig;<br />

int i;<br />

for(;;)<br />

{<br />

/* Code */<br />

pidlist = get_pid_list(some_block_);<br />

if(pidlist)<br />

{<br />

count = pidlist->count;<br />

<strong>Kern</strong><strong>el</strong><br />

}<br />

}<br />

for(i = 0 ; i < count ; i++)<br />

{<br />

/* Send the start signal to all<br />

* processes in the block<br />

*/<br />

sig = alloc(sizeof(struct start), START);<br />

send(&sig, pidlist->list[i]);<br />

}<br />

free_buf( (union SIGNAL **) &pidlist);<br />

/* Code */<br />

}<br />

<strong>el</strong>se<br />

{<br />

/* Code, no processes available to the caller<br />

* in specified block<br />

*/<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 48<br />

get_pid_list


get_pool_list<br />

Syntax<br />

struct OS_pid_list *get_pool_list (OSUSER user);<br />

Description Lists all pools that are available to the specified user number.<br />

If user 0 is specified, this indicates the caller's user number.<br />

If user 0 is specified and the caller is a superuser, then all pools in the system are<br />

listed.<br />

Include files #include "ose.h"<br />

Parameters user Specifies the user number.<br />

Return value Returns a signal buffer with a structure containing the list of pool IDs.<br />

The buffer must be freed by the caller when information has been extracted. The<br />

structure is:<br />

struct OS_pid_list<br />

{<br />

OSBUFSIZE count;<br />

PROCESS list[];<br />

};<br />

<strong>Kern</strong><strong>el</strong><br />

Restrictions<br />

See also<br />

where count is the number of pools and list is a variable size array containing the<br />

pool identities.<br />

Only a superuser process may examine another user space.<br />

The get_pool_list call is not available to interrupt processes.<br />

get_poolcb, get_sig_info, get_sig_poolid, get_stk_poolid<br />

Implementation All OSE implementations might not have this system call.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

void list_pools(void)<br />

{<br />

struct OS_pid_list *list = get_pool_list(0);<br />

if (list != NULL)<br />

{<br />

OSBUFSIZE count = list->count;<br />

int i;<br />

}<br />

}<br />

printf("Pools: ");<br />

for(i = 0 ; i < count ; i++)<br />

{<br />

printf("%#lx ", list->list[i])<br />

}<br />

printf("\n");<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 49<br />

get_pool_list


get_poolcb<br />

Syntax<br />

struct OS_poolcb *get_poolcb (PROCESS pool_id);<br />

Description Interrogates the status of the specified pool. This information is returned to the<br />

caller in a buffer.<br />

Note that it is legal to pass an invalid pool ID to this system call.<br />

Include files #include "ose.h"<br />

Parameters pool_id The ID of the specified pool.<br />

Return value Returns a buffer obtained from the caller’s pool containing an OS_poolcb<br />

structure with information about a specified pool. The buffer must be returned to<br />

the system with free_buf when the information is no longer needed.<br />

If the get_poolcb call was not successful, a NULL pointer is returned.<br />

The OS_poolcb structure has the following layout:<br />

<strong>Kern</strong><strong>el</strong><br />

struct OS_poolcb<br />

{<br />

OSADDRESS tot_size;<br />

OSADDRESS free_size;<br />

OSADDRESS fragment_info;<br />

OSADDRESS stk_conf_entries;<br />

OSADDRESS sig_conf_entries;<br />

OSADDRESS stk_conf_sizes;<br />

OSADDRESS sig_conf_sizes;<br />

OSADDRESS stk_alloc_sizes;<br />

OSADDRESS sig_alloc_sizes;<br />

OSADDRESS values[1];<br />

};<br />

where:<br />

Tot_size contains the total memory size (in bytes) of all pool fragments.<br />

Free_size contains the number of bytes never used in the pool.<br />

Fragment_info is an index into the values array where detailed information about<br />

all the pool fragments can be found. The layout of this information is as follows:<br />

The number of fragments in the pool can be found at:<br />

values[fragment_info + 0]<br />

The base address of fragment 0 can be found at:<br />

values[fragment_info + 1]<br />

The size of fragment 0 can be found at:<br />

values[fragment_info + 2]<br />

The number of bytes used for stacks in fragment 0 can be found at:<br />

values[fragment_info + 3]<br />

The number of bytes used for signals in fragment 0 can be found at:<br />

values[fragment_info + 4]<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 50<br />

get_poolcb


<strong>Kern</strong><strong>el</strong><br />

If there are more than one pool fragment the detailed information about pool<br />

fragment 1 starts at "values[fragment_info + 5]", which contains the base address<br />

of fragment 1. "values[fragment_info + 6]" contains the size of fragment 1 and so<br />

on.<br />

Stk_conf_entries is the number of configured stack sizes for this pool.<br />

Sig_conf_entries is the number of configured signal buffer sizes for this pool.<br />

Stk_conf_sizes is an index into the values array where to find an array (of size<br />

stk_conf_entries) with information about how the stack sizes has been configured<br />

for this pool. This fi<strong>el</strong>d is only valid if the value of the stk_conf_entries fi<strong>el</strong>d is<br />

greater than zero. The smallest configured stack size can be found at<br />

"values[stk_conf_sizes]" and largest configured stack size can be found at<br />

"values[stk_conf_sizes + stk_conf_entries - 1]".<br />

Sig_conf_sizes is an index into the values array where to find an array (of size<br />

sig_conf_entries) with information about how the signal buffer sizes has been<br />

configured for this pool. This fi<strong>el</strong>d is only valid if the value of the<br />

sig_conf_entries fi<strong>el</strong>d is greater than zero. The smallest configured signal buffer<br />

size can be found at"values[sig_conf_sizes]" and the largest configured signal<br />

buffer size can be found at "values[sig_conf_sizes + sig_conf_entries - 1]".<br />

Stk_alloc_sizes is an index into the values array where to find an array (of size<br />

stk_conf_entries) with information about how many stacks (of a certain<br />

configured size) are currently in use in the pool. This fi<strong>el</strong>d is only valid if the<br />

value of the stk_conf_entries fi<strong>el</strong>d is greater than zero. The number of currently<br />

used stacks of the smallest configured stack size in the pool can be found at<br />

"values[stk_alloc_sizes]" and "values[stk_alloc_sizes + stk_conf_entries - 1]"<br />

contains the number of currently used stacks of the largest configured stack size<br />

in the pool.<br />

Sig_alloc_sizes is an index into the values array where to find an array (of size<br />

sig_conf_entries) with information about how many signal buffers (of a certain<br />

configured size) are currently allocated in the pool. This fi<strong>el</strong>d is only valid if the<br />

value of the sig_conf_entries fi<strong>el</strong>d is greater than zero. The number of currently<br />

allocated signal buffers of the smallest configured signal buffer size in the pool<br />

can be found at "values[sig_alloc_sizes]" and "values[sig_alloc_sizes +<br />

sig_conf_entries - 1]" contains the number of currently allocated signal buffers of<br />

the largest configured signal buffer size in the pool.<br />

Values is a variable size array containing most of the requested pool information.<br />

Restrictions There must be a buffer available in the callers pool that is large enough to hold<br />

the returned structure. Otherwise the get_poolcb call will fail.<br />

The get_poolcb call is not available to interrupt processes.<br />

See also get_pool_list, get_sig_info, get_sig_poolid, get_stk_poolid<br />

Implementation All OSE implementations might not have this system call.<br />

lev<strong>el</strong>s<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 51<br />

get_poolcb


Example<br />

#include "ose.h"<br />

void list_pool_info(PROCESS pool_id)<br />

{<br />

struct OS_poolcb *pool = get_poolcb(pool_id);<br />

OSADDRESS<br />

*value;<br />

OSADDRESS<br />

loop;<br />

if (pool == NULL)<br />

<strong>Kern</strong><strong>el</strong><br />

printf("Error: %#lx is not a valid pool identifier.\n", pool_id);<br />

return;<br />

}<br />

printf("Pool id.....: %#lx\n", pool_id);<br />

printf("Total size..: %lu\n", pool -> tot_size);<br />

printf("Never used..: %lu\n", pool -> free_size);<br />

printf("Stack sizes.: %lu\n", pool -> stk_conf_entries);<br />

if (pool -> stk_conf_entries)<br />

{<br />

value = &pool -> values[pool -> stk_conf_sizes];<br />

loop = pool -> stk_conf_entries;<br />

printf( " Conf.: ");<br />

while (loop--)<br />

printf( "%7lu", *value++);<br />

printf( "\n Alloc: ");<br />

value = &pool -> values[pool -> stk_alloc_sizes];<br />

loop = pool -> stk_conf_entries;<br />

while (loop--)<br />

printf( "%7lu", *value++);<br />

printf("\n");<br />

}<br />

printf("Signal sizes: %lu\n", pool -> sig_conf_entries);<br />

if (pool -> sig_conf_entries)<br />

{<br />

value = &pool -> values[pool -> sig_conf_sizes];<br />

loop = pool -> sig_conf_entries;<br />

printf( " Conf.: ");<br />

while (loop--)<br />

printf( "%7lu", *value++);<br />

printf( "\n Alloc: ");<br />

value = &pool -> values[pool -> sig_alloc_sizes];<br />

loop = pool -> sig_conf_entries;<br />

while (loop--)<br />

printf( "%7lu", *value++);<br />

printf("\n");<br />

}<br />

loop = pool -> values[pool -> fragment_info];<br />

value = &pool -> values[pool -> fragment_info + 1];<br />

printf("Fragments: %lu\n", loop);<br />

printf(" %10s %10s %10s %10s %10s\n",<br />

"Fragment", "BaseAddr", "Size", "StkUsed", "SigUsed");<br />

do<br />

{<br />

printf(" %10lu %#010lx %10lu %10lu %10lu\n",<br />

loop, value[0], value[1], value[2], value[3]);<br />

value += 4;<br />

} while (--loop);<br />

free_buf((union SIGNAL **)&pool);<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 52<br />

get_poolcb


get_pri<br />

Syntax<br />

OSPRIORITY get_pri (PROCESS pid);<br />

Description Examines the current priority of the specified process.<br />

Include files #include "ose.h"<br />

Parameters pid The ID of the specified process.<br />

Return value Returns the priority.<br />

Restrictions Works only for prioritized processes. The get_pri call is not available to interrupt<br />

processes. Returns 0 for background processes<br />

See also set_pri<br />

Implementation Not implemented at lev<strong>el</strong>s A and B. Full performance from<br />

lev<strong>el</strong>s lev<strong>el</strong> C.<br />

Example<br />

#include "ose.h"<br />

OS_PROCESS(my_process)<br />

{<br />

OSPRIORITY prio;<br />

<strong>Kern</strong><strong>el</strong><br />

}<br />

}<br />

for(;;)<br />

{<br />

prio = get_pri(current_process());<br />

if(prio != 31)<br />

{<br />

set_pri(++prio);<br />

}<br />

<strong>el</strong>se<br />

{<br />

set_pri(0);<br />

}<br />

d<strong>el</strong>ay(100);<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 53<br />

get_pri


get_ptype<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

Description<br />

enum PROCESS_TYPE get_ptype(PROCESS pid);<br />

Interrogates the type of the specified process or block.<br />

This call is intended for use in code that is shared by several processes of different<br />

types. For instance, it can be used in common code that needs to react in different<br />

ways to calls from interrupt processes and other types.<br />

The get_ptype call is special in that it can not be caught by a remote call server.<br />

This means that you can always find out the true process type with get_ptype.<br />

This is not true for the get_pcb call, and thus you may get different results from<br />

the two calls for the same process.<br />

Note that it is legal to pass an invalid process ID to this system call. This is<br />

allowed only for the get_pcb and get_ptype calls.<br />

Include files #include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

Parameters pid The ID of the specified block or process.<br />

Return value Returns the process type.<br />

Legal values are:<br />

OS_BLOCK:<br />

A block was specified.<br />

OS_PRI_PROC: A prioritized process.<br />

OS_BG_PROC: A background process.<br />

OS_INT_PROC: An interrupt process.<br />

OS_TI_PROC: A timer-interrupt process.<br />

OS_PHANTOM: A phantom or dummy process.<br />

OS_ZOOMBIE: A killed process or block.<br />

OS_ILLEGAL: An invalid process ID was specified.<br />

Restrictions None.<br />

See also get_pcb<br />

Implementation Not implemented at lev<strong>el</strong> A. Full performance from lev<strong>el</strong> B.<br />

lev<strong>el</strong>s<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 54<br />

get_ptype


Example<br />

#include "ose.h"<br />

OS_PROCESS(my_process)<br />

{<br />

enum PROCESS_TYPE ptype;<br />

for(;;)<br />

{<br />

/* Code */<br />

ptype = get_ptype(current_process());<br />

if(ptype == OS_BG_PROC)<br />

{<br />

/* Code, specific to a background process */<br />

}<br />

<strong>el</strong>se<br />

{<br />

/* Code */<br />

}<br />

}<br />

}<br />

<strong>Kern</strong><strong>el</strong><br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 55<br />

get_ptype


get_segid<br />

Syntax<br />

PROCESS get_segid (PROCESS pid);<br />

Description Finds the segment that the specified block or process is part of.<br />

Include files #include "ose.h"<br />

Parameters pid The ID of the specified block or process.<br />

Return value Returns the segment ID.<br />

If pid is the ID of a dead block or process, then the value specified in pid is<br />

returned from the get_segid call.<br />

Restrictions The get_segid call is not available to interrupt processes.<br />

See also attach, attach_segment<br />

Implementation All OSE implementations might not have this system call.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

extern PROCESS proc_;<br />

<strong>Kern</strong><strong>el</strong><br />

OS_PROCESS(my_process)<br />

{<br />

static const SIGSELECT att_sig[] = { 1, OS_ATTACH_SIG };<br />

union SIGNAL *sig;<br />

PROCESS sid;<br />

sid = get_segid(proc_);<br />

(void)attach(NULL, sid);<br />

for(;;)<br />

{<br />

sig = receive((SIGSELECT *) att_sig);<br />

if (sender(&sig) == sid)<br />

{<br />

printf("The segment containing proc_ has died!\n");<br />

}<br />

free_buf(&sig);<br />

stop(current_process());<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 56<br />

get_segid


get_sem<br />

Syntax<br />

Description<br />

Include files<br />

OSSEMVAL get_sem (SEMAPHORE *sem);<br />

Reads the current value of a semaphore.<br />

#include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

Parameters sem A pointer to the specified semaphore.<br />

Return value Returns the current semaphore value.<br />

Restrictions None.<br />

See also wait_sem, signal_sem, create_sem, kill_sem<br />

Implementation Not implemented at lev<strong>el</strong> A. Full performance from lev<strong>el</strong> B.<br />

lev<strong>el</strong>s<br />

Example<br />

<strong>Kern</strong><strong>el</strong><br />

#include "ose.h"<br />

extern SEMAPHORE *sem;<br />

OS_PROCESS(my_process)<br />

{<br />

OSSEMVAL semvalue;<br />

for(;;)<br />

{<br />

/* Code */<br />

semvalue = get_sem(sem);<br />

if(semvalue == 5)<br />

{<br />

/* Code */<br />

}<br />

<strong>el</strong>se<br />

{<br />

/* Code */<br />

}<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 57<br />

get_sem


get_sig_info<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

Description<br />

OSBOOLEAN get_sig_info (struct OS_sig_info *sig_info,<br />

PROCESS pool_id,<br />

PROCESS pid,<br />

OSADDRESS sig);<br />

Extract detailed information about a signal buffer and searches for the next buffer<br />

owned by a specified process in a specified pool.<br />

The sig_info parameter should contain a pointer to a result buffer. It is updated<br />

with information about the signal buffer pointed out by the sig parameter. Set<br />

sig_info to NULL if you don't want that information.<br />

The pool_id and pid parameters are used to specify how to search for the next<br />

buffer. The pool_id parameter specifies which pool to search. A value of zero<br />

allows the search to continue in any pool. The pid parameter, if non zero, specifies<br />

that only buffers owned by that process should be searched for. A value of zero<br />

allows any owner including buffers owned by the system.<br />

As a special case, the pool_id parameter may be set to a block id to specify the<br />

signal pool associated with that block.<br />

The sig parameter contains the address of the signal buffer to check. Set it to zero<br />

to request a search for the first signal in the first pool that matches the pool_id<br />

and pid parameters. Then use the value of the "next" fi<strong>el</strong>d in the sig_info structure<br />

for subsequent calls until the next fi<strong>el</strong>d becomes zero. This way you can traverse<br />

all signals in a pool.<br />

Include files #include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

Parameters sig_info A pointer to a result buffer.<br />

pool_id<br />

The ID of the pool in which to search.<br />

pid<br />

Search only for signals owned by the process with this ID.<br />

sig<br />

A pointer to signal to examine.<br />

Return value Returns a status code with either of these values:<br />

0. Unimplemented system call. No result is obtained.<br />

1. The sig parameter points to a valid signal buffer.<br />

2. The sig parameter points to a signal buffer which seems to be ok, apart from<br />

the fact that it lacks a valid endmark.<br />

3. The sig parameter points to a signal buffer with a broken (somehow faulty)<br />

signal administration block.<br />

4. The sig parameter is a wild pointer (not pointing at any signal buffer) inside<br />

a pool.<br />

5. The sig parameter is a wild pointer not inside any pool.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 58<br />

get_sig_info


If you are unauthorised to look at the specified signal buffer (you don't have the<br />

right user number) the result will be the same as calling get_sig_info with a wild<br />

signal pointer value in the sig parameter (i.e. 4).<br />

If the sig_info parameter is not NULL it should contain a pointer to a OS_sig_info<br />

structure which will be updated with information about the signal buffer pointed<br />

out by the sig parameter. The structure is:<br />

struct OS_sig_info<br />

{<br />

SIGSELECT sig_no;<br />

PROCESS owner;<br />

PROCESS sender_pid;<br />

PROCESS addressee_pid;<br />

OSBUFSIZE sig_size;<br />

OSBUFSIZE size_in_pool;<br />

OSADDRESS next;<br />

};<br />

<strong>Kern</strong><strong>el</strong><br />

where:<br />

Sig_no is set to the signal number.<br />

Owner is set to process ID of the owner of the signal. If this value is zero this<br />

means that the signal is owned by the system. Signals who has been returned to<br />

the system by a call to free_buf or is located in the signal queue of a process are<br />

owned by the system and yi<strong>el</strong>ds zero in this fi<strong>el</strong>d.<br />

Sender_pid is set to the process ID of the sender of the signal. If the signal was<br />

never sent it will be set to the same value as the owner fi<strong>el</strong>d.<br />

Addressee_pid is set to the process ID of the addressee of the signal, but only if<br />

the signal has been redirected, otherwise it will be set to the same value as the<br />

owner fi<strong>el</strong>d.<br />

Sig_size is set to to the size value used when the signal was allocated.<br />

Size_in_pool is set to the number of bytes the signal occupies in the user pool. If<br />

memory mod<strong>el</strong> 1 is used an additional signal administration block is allocated in<br />

the system pool, the size of this signal administration block is typically 32 bytes.<br />

Next is set to the address of the next signal buffer owned by the specified process<br />

in the specified pool. If the pid parameter to get_sig_info was set to zero it will<br />

be set to the next signal buffer owned by anyone.<br />

Restrictions Fi<strong>el</strong>ds r<strong>el</strong>ated to the sig parameter can be trusted only if the get_sig_info call<br />

returns 1 or 2. The next fi<strong>el</strong>d can be trusted only if the get_sig_info call returns<br />

1 or 2, or if the sig parameter was set to zero, in which case get_sig_info returns<br />

5. It is unwise to call get_sig_info for a process that is not stopped or intercepted,<br />

since signal pointers age rapidly.<br />

See also get_pool_list, get_poolcb, get_sig_poolid, get_stk_poolid<br />

Implementation All OSE implementations might not have this system call.<br />

lev<strong>el</strong>s<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 59<br />

get_sig_info


Example<br />

#include "ose.h"<br />

void list_my_sigs(void)<br />

{<br />

struct OS_sig_info sig_info;<br />

PROCESS curr = current_process();<br />

PROCESS sig_pool = get_sig_poolid(curr);<br />

OSBOOLEAN status = get_sig_info(&sig_info,sig_pool,curr,0);<br />

if (status == 5 && sig_info.next)<br />

{<br />

do<br />

{<br />

OSADDRESS sigptr = sig_info.next;<br />

<strong>Kern</strong><strong>el</strong><br />

}<br />

}<br />

status = get_sig_info(&sig_info, sig_pool, curr, sig_info.next);<br />

printf("sigptr........: %#lx \n", sigptr);<br />

switch (status)<br />

{<br />

case 1:<br />

break;<br />

case 2:<br />

printf("No valid endmark found\n");<br />

break;<br />

case 3:<br />

printf("The signal's administration block is faulty\n");<br />

return; /* Not safe to continue */<br />

case 4:<br />

printf("The signal's address is wild (inside a pool)\n");<br />

return; /* Not safe to continue */<br />

case 5:<br />

printf("The signal's address is wild (not inside any pool)\n");<br />

return; /* Not safe to continue */<br />

default:<br />

return;<br />

}<br />

printf(" sig_no.......: %#lx\n", sig_info.sig_no);<br />

printf(" owner........: %#lx\n", sig_info.owner);<br />

printf(" sender_pid...: %#lx\n", sig_info.sender_pid);<br />

printf(" addressee_pid: %#lx\n", sig_info.addressee_pid);<br />

printf(" sig_size.....: %#lx\n", sig_info.sig_size);<br />

printf(" size_in_pool.: %#lx\n", sig_info.size_in_pool);<br />

} while (sig_info.next);<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 60<br />

get_sig_info


get_sig_poolid<br />

Syntax<br />

PROCESS get_sig_poolid (PROCESS bid);<br />

Description Returns the ID of the signal pool associated with a specified block or process.<br />

Include files #include "ose.h"<br />

Parameters bid The ID of the specified block or process.<br />

Return value The ID of the signal pool associated with a specified block or process.<br />

If bid is the ID of a dead block or process, then the value specified in bid is<br />

returned from the get_sig_poolid call.<br />

Restrictions None.<br />

See also get_pool_list, get_poolcb, get_sig_info, get_stk_poolid<br />

Implementation All OSE implementations might not have this system call.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

void show_my_sig_poolid(void)<br />

{<br />

PROCESS poolid = get_sig_poolid(current_process());<br />

<strong>Kern</strong><strong>el</strong><br />

printf("My signal pool ID: %#lx", poolid);<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 61<br />

get_sig_poolid


get_signal<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax OSBOOLEAN get_signal (PROCESS pid,<br />

OSADDRESS mailptr,<br />

union SIGNAL **sig_copy,<br />

OSADDRESS *nextsig);<br />

Description This is a debugger call.<br />

Returns in sig_copy a copy of the signal located in the signal queue or attach list<br />

for the specified process or block. (Only processes have signal queues.)<br />

The signal copy is returned in a signal buffer obtained by get_signal. This buffer<br />

can be examined with the sender, sigsize and addressee system calls. The buffer<br />

must be freed with free_buf by the caller when information has been extracted.<br />

mailptr is a signal queue pointer obtained from get_pcb or from a previous<br />

get_signal call. (You can not evaluate these pointers with get_mem since signal<br />

buffers are not always stored in the address space of the addressee process.)<br />

The signal structure its<strong>el</strong>f is not altered in any way, just copied byte by byte. It is<br />

important to understand this since sizeof(SIGSELECT) as w<strong>el</strong>l as other signal<br />

data may vary between systems. Thus the caller must realize that if the examined<br />

process runs on another processor, signal data must be interpreted according to<br />

the conventions used in that processor.<br />

A pointer to the next signal in the list is returned in nextsig. A zero value is placed<br />

in nextsig if there are no more signals in the list. Nextsig may be used as input to<br />

another get_sig call.<br />

Include files #include "ose.h"<br />

Parameters pid The ID of the specified block or process.<br />

mailptr<br />

A pointer to the signal queue.<br />

sig_copy A pointer to a pointer to the signal buffer in which the signal<br />

is returned.<br />

nextsig<br />

A pointer to the next signal in the queue.<br />

Return value Returns a non-zero value if the call failed.<br />

This occurs for instance if the signal queue of the specified process has been<br />

altered by an intermediate call to receive, flush, kill_proc or any other system call<br />

that alters the contents of the r<strong>el</strong>evant buffer lists. When this happens, the list must<br />

be re-examined from the top, i.e a new list head must be obtained from get_pcb.<br />

Restrictions It is unwise to call get_signal (as w<strong>el</strong>l as get_pcb) for a process that is not stopped<br />

or intercepted, since signal pointers age rapidly.<br />

The get_signal call is not available to interrupt processes.<br />

See also get_pcb<br />

Implementation Not implemented at lev<strong>el</strong>s A and B. Full performance from<br />

lev<strong>el</strong>s lev<strong>el</strong> C.<br />

Example<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 62<br />

get_signal


#include "ose.h"<br />

extern PROCESS proc_;<br />

extern PROCESS proc2_;<br />

union SIGNAL<br />

{<br />

SIGSELECT sig_no;<br />

};<br />

OS_PROCESS(my_process)<br />

{<br />

struct OS_pcb *pcbbuf;<br />

OSADDRESS sigptr;<br />

union SIGNAL *sig;<br />

OSADDRESS next;<br />

OSBOOLEAN nosuccess;<br />

for(;;)<br />

{<br />

/* Code */<br />

stop(proc_);<br />

pcbbuf = get_pcb(proc_);<br />

sigptr = pcbbuf->sigqueue;<br />

nosuccess = get_signal(proc_, sigptr, &sig,&next);<br />

<strong>Kern</strong><strong>el</strong><br />

}<br />

}<br />

while(nosuccess)<br />

{<br />

/* If a non-zero value was returned the call was<br />

* unsuccessful both the get_pcb and get_signal<br />

* calls must be repeated<br />

*/<br />

pcbbuf = get_pcb(proc_);<br />

sigptr = pcbbuf->sigqueue;<br />

nosuccess = get_signal(proc_, sigptr, &sig,&next);<br />

}<br />

do<br />

{<br />

if(sender(&sig) == proc2_)<br />

{<br />

/* Code */<br />

}<br />

free_buf(&sig);<br />

get_signal(proc_, next, &sig, &next);<br />

} while(next != NULL);<br />

free_buf((union SIGNAL **)&pcbbuf);<br />

start(proc_);<br />

/* Code */<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 63<br />

get_signal


get_stk_poolid<br />

Syntax<br />

PROCESS get_stk_poolid (PROCESS bid);<br />

Description Returns the ID of the stack pool associated with a specified block or process.<br />

Include files #include "ose.h"<br />

Parameters bid The ID of the specified block or process.<br />

Return value The ID of the stack pool associated with a specified block or process.<br />

If bid is the ID of a dead block or process, then the value specified in bid is<br />

returned from the get_stk_poolid call.<br />

Restrictions None.<br />

See also get_pool_list, get_poolcb, get_sig_info, get_sig_poolid<br />

Implementation All OSE implementations might not have this system call.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

void show_my_stk_poolid(void)<br />

{<br />

PROCESS poolid = get_stk_poolid(current_process());<br />

<strong>Kern</strong><strong>el</strong><br />

printf("My stack pool ID: %#lx", poolid);<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 64<br />

get_stk_poolid


get_systime<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

Description<br />

OSTICK get_systime (OSTICK *microsecs);<br />

This call is mainly used by debuggers. Shows the number of system ticks since<br />

system start and the number of microseconds since the last tick.<br />

The system ticks counter is reset to zero each time the kern<strong>el</strong> is restarted.<br />

The system ticks counter is incremented each time the system clock is advanced<br />

i.e when the tick system call is issued and wraps after a fairly long period of time.<br />

If microsecs == NULL, then the number of microseconds is not returned.<br />

Include files #include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

Parameters microsecs A pointer to the returned number of microseconds.<br />

Return value<br />

Restrictions<br />

See also<br />

Returns the number of system ticks since system start. Returns the number of<br />

microseconds since the last tick in the microsecs parameter. No two subsequent<br />

calls to get_systime will ever return the same microsecond value, even if no<br />

hardware counter is available.<br />

Few systems can actually provide an accurate timing reference at the microsecond<br />

lev<strong>el</strong>. The actual resolution of the microseconds counter must therefore be<br />

determined for each target hardware.<br />

get_ticks<br />

Implementation Not implemented at lev<strong>el</strong> A. Full performance from lev<strong>el</strong> B.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

OS_PROCESS(my_process)<br />

{<br />

OSTICK systick;<br />

OSTICK micro;<br />

for(;;)<br />

{<br />

/* Code */<br />

systick = get_systime(&micro);<br />

/* Code */<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 65<br />

get_systime


get_ticks<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

Description<br />

Include files<br />

Parameters<br />

Return value<br />

Restrictions<br />

See also<br />

OSTICK get_ticks (void);<br />

Shows the number of system ticks since system start. The system ticks counter is<br />

set to zero when time the kern<strong>el</strong> is started.<br />

The counter is incremented each time the system clock is advanced (i.e. when the<br />

tick system call is issued).<br />

The counter wraps after a fairly long period of time.<br />

The get_ticks system call may be defined as get_systime(NULL).<br />

#include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

None.<br />

Returns system time in ticks.<br />

None.<br />

tick, get_systime<br />

Implementation Full performance at all implementation lev<strong>el</strong>s.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

OS_PROCESS(my_process)<br />

{<br />

OSTICK tick;<br />

for(;;)<br />

{<br />

/* Code */<br />

tick = get_ticks();<br />

/* Code */<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 66<br />

get_ticks


get_uid<br />

Syntax<br />

OSUSER get_uid (PROCESS pid);<br />

Description Finds the user number under which the specified process or block is executing.<br />

Include files #include "ose.h"<br />

Parameters pid The ID of the specified block or process.<br />

Return value Returns the user ID of the examined process. Returns the user ID of the caller if<br />

the examined process has terminated.<br />

Restrictions The get_uid call is not available to interrupt processes.<br />

See also create_block, create_process<br />

Implementation Not implemented at lev<strong>el</strong> A. Full performance at lev<strong>el</strong> B.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

PROCESS block_;<br />

OS_PROCESS(my_process)<br />

{<br />

OSUSER id;<br />

<strong>Kern</strong><strong>el</strong><br />

for(;;)<br />

{<br />

/* Code */<br />

id = get_uid(current_process());<br />

block_ = create_block("block",<br />

id,<br />

(OSBOOLEAN) 0,<br />

(PROCESS) 0,<br />

(OSBOOLEAN) 0);<br />

/* Code */<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 67<br />

get_uid


hunt<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax OSBOOLEAN hunt (char *name,<br />

OSUSER<br />

user,<br />

PROCESS<br />

*name_,<br />

union SIGNAL **hunt_sig);<br />

Description Searches for a process by name and updates the name_ parameter with the<br />

process ID of the named process.<br />

The name_ parameter may be set to NULL if no return value variable is provided.<br />

This may be convenient when a hunt_sig is present.<br />

Only processes with the specified user number are searched for. A user parameter<br />

set to zero specifies the caller's user number, not the superuser.<br />

Processes are searched for in the following order:<br />

1. Processes within the caller's block.<br />

2. Processes that are "block processes" in other blocks.<br />

3. Processes in other blocks.<br />

4. The r<strong>el</strong>evant link handler is asked for the process ID.<br />

If the process is found immediat<strong>el</strong>y, the ID of the found process is returned in the<br />

name_ variable.<br />

An optional hunt signal may be specified. This signal is stored within the kern<strong>el</strong><br />

until the process appears on the network or the caller terminates. Hunt_sig may<br />

be set to NULL to indicate that no hunt signal is provided.<br />

When the process is found or created, the hunt signal is returned to the caller, and<br />

the process ID of the found process can be extracted with the sender call.<br />

The hunt signal is immediat<strong>el</strong>y returned if the process was immediat<strong>el</strong>y found, i.e<br />

if a hunt signal is specified, it should always be received, either immediat<strong>el</strong>y or<br />

later on.<br />

If the process was not found in the current CPU, and the process name contains<br />

a path that matches a link handler, then the hunt request is passed on to that link<br />

handler as a remote system call. Remote system calls are described in the Remote<br />

System Calls chapter.<br />

The link handler has several options at this point:<br />

1. It may return a value indicating that the process was not found. The hunt<br />

signal is then stored within the kern<strong>el</strong> until the link handler or someone <strong>el</strong>se<br />

creates a process with a matching name. At that point the hunt signal is sent<br />

to the caller. An invalid process ID is propagated to the caller in the name_<br />

variable. (If someone <strong>el</strong>se created a process with the required name during the<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 68<br />

hunt


<strong>Kern</strong><strong>el</strong><br />

remote call, that process ID is returned to the caller when the kern<strong>el</strong><br />

recognizes a link handler failure.)<br />

2. It may create a new process or use an existing process with the desired name<br />

and return that process ID. The kern<strong>el</strong> returns the hunt signal to the caller.<br />

The returned process ID is propagated to the caller in the name_ variable.<br />

3. It may create a new process or use an existing process with another name and<br />

return that process ID, indicating to the caller that the obtained process ID is<br />

a "private" ID. The process ID is propagated to the caller in the name_<br />

variable. The hunt signal is also immediat<strong>el</strong>y returned to the caller, regardless<br />

of the fact that no matching name was ever found. This scheme allows the<br />

link handler to create new instances of a service process for each hunt that is<br />

issued, using the path name mer<strong>el</strong>y as a request for some service.<br />

The kern<strong>el</strong> frees the pending hunt signal if the calling process dies.<br />

Include files #include "ose.h"<br />

Parameters name A pointer to the specified process name.<br />

user<br />

The user number.<br />

name_<br />

The ID of the found process.<br />

hunt_sig A pointer to the hunt signal buffer if specified.<br />

Return value The name_ parameter, if present, is updated with the found process ID. The ID<br />

is guaranteed to be invalid if the process was not immediat<strong>el</strong>y found.<br />

The call returns zero if the process could not be found immediat<strong>el</strong>y. If a hunt<br />

signal was given by the caller, it is stored in the kern<strong>el</strong> until a matching process<br />

appears at a later time.<br />

Returns a non-zero value if the process was found immediat<strong>el</strong>y. Any hunt signal<br />

provided is returned to the caller.<br />

The returned value is further subdivided to indicate the scope of the found<br />

process. This is important only to link handlers when propagating hunt requests.<br />

If the hunt call returns 1, then the found process is "public", meaning that access<br />

to it is not restricted to any particular process.<br />

If the hunt call returns 2, then the found process is "private", meaning that access<br />

is restricted to the client process that hunted for it. This restriction is not enforced<br />

by the kern<strong>el</strong>, but a link handler is assumed to d<strong>el</strong>ete the private process when the<br />

client terminates.<br />

Restrictions The kern<strong>el</strong> may reallocate the space occupied by the hunt signal. Thus, the pointer<br />

to the hunt signal is not valid following the call to hunt.<br />

The hunt call is not available to interrupt processes.<br />

See also attach, detach, assign_linkhandler<br />

Implementation Not implemented at lev<strong>el</strong> A. Full performance from lev<strong>el</strong> B.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 69<br />

hunt


#define SIXTH 6 /* These declarations */<br />

struct Sixth /* are preferably made */<br />

{ /* in a .sig-file which */<br />

SIGSELECT sig_no; /* is included. */<br />

};<br />

static const SIGSELECT any_sig[] = {0};<br />

extern PROCESS huntproc_;<br />

union SIGNAL<br />

{<br />

SIGSELECT sig_no;<br />

struct Sixth sixth;<br />

};<br />

OS_PROCESS(my_process)<br />

{<br />

OSBOOLEAN check;<br />

union SIGNAL *huntsignal;<br />

<strong>Kern</strong><strong>el</strong><br />

for(;;)<br />

{<br />

/* Code */<br />

huntsignal = alloc(sizeof(struct sixth), SIXTH);<br />

check = hunt("proc", 0, &huntproc_, &huntsignal);<br />

if(check)<br />

{<br />

huntsignal = receive((SIGSELECT *) any_sig);<br />

free_buf(&huntsignal);<br />

}<br />

/* Code */<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 70<br />

hunt


hunt_from<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax OSBOOLEAN hunt_from (char *name,<br />

OSUSER<br />

user,<br />

PROCESS<br />

*name_,<br />

union SIGNAL **hunt_sig,<br />

PROCESS<br />

from);<br />

Description This is a system call intended mainly for link handlers and other network<br />

software. You should not require this call unless you are writing such software.<br />

Hunt_from does what hunt does, except that access rights are evaluated for the<br />

process specified in the from parameter (usually a phantom process created by the<br />

caller).<br />

This makes a true difference only if hunt causes a remote system call to some<br />

other link handler, and that link handler uses the hunt remote call to register new<br />

clients.<br />

In this case the other link handler should register the from parameter as a client.<br />

Response to the remote call must be sent to the caller<br />

(= sender(rem_call_sig)) as always.<br />

A user parameter set to zero implies the user number of the process in the from<br />

parameter.<br />

The optional hunt signal is eventually returned to the caller, not to the process<br />

specified in the from fi<strong>el</strong>d.<br />

The kern<strong>el</strong> frees the pending hunt signal if the calling process dies or if the<br />

process specified in the from fi<strong>el</strong>d dies.<br />

Include files #include "ose.h"<br />

Parameters name A pointer to the specified process name.<br />

user<br />

The user number.<br />

name_<br />

The ID of the found process.<br />

hunt_sig A pointer to the hunt signal buffer if specified.<br />

from<br />

The ID of the process specified as hunter.<br />

Return value See the hunt system call.<br />

Restriction See the hunt system call.<br />

See also hunt, attach, detach, assign_linkhandler<br />

Implementation Not implemented at lev<strong>el</strong> A. Full performance from lev<strong>el</strong> B.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

#define FIRST 1 /* These declarations */<br />

struct First /* are preferably made */<br />

{ /* in a .sig-file which */<br />

SIGSELECT sig_no; /* is included. */<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 71<br />

hunt_from


};<br />

union SIGNAL<br />

{<br />

SIGSELECT sig_no;<br />

struct Firsth first;<br />

};<br />

static SIGSELECT sig_s<strong>el</strong>[] = {0};<br />

extern PROCESS proc_;<br />

OSENTRYPOINT phant;<br />

OS_PROCESS(my_linkhandler)<br />

{<br />

union SIGNAL *sig;<br />

PROCESS phantom_;<br />

union SIGNAL *huntsig;<br />

struct OS_redir_entry redir_table[1];<br />

redir_table[0].sig = (SIGSELECT) 1;<br />

redir_table[0].pid = current_process();<br />

<strong>Kern</strong><strong>el</strong><br />

for(;;)<br />

{<br />

sig = receive((SIGSELECT *) sig_s<strong>el</strong>);<br />

switch(sig->remote_call.call_type)<br />

{<br />

case REM_HUNT:<br />

sig->sig_no=REMOTE_RESPONSE;<br />

sig->remote_response.results.remr_hunt.found=1;<br />

phantom_ = create_process(OS_PHANTOM,<br />

"proc",<br />

phant,<br />

0,<br />

0,<br />

(OSTIME) 0,<br />

(PROCESS) 0,<br />

&redir_table,<br />

(OSVECTOR) 0,<br />

(OSUSER) 0);<br />

sig->remote_response.results.remr_hunt.pid = phantom_;<br />

send(&sig, sender(&sig));<br />

huntsig = alloc(sizeof(struct first), FIRST);<br />

hunt_from("linkhandler2",<br />

0,<br />

&proc_,<br />

&huntsig,<br />

current_process());<br />

break;<br />

}<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 72<br />

hunt_from


intercept<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

Description<br />

void intercept (PROCESS pid);<br />

This system call is mainly used by debuggers. The intercept call stops a process<br />

as if a breakpoint was reached.<br />

Status for the specified process or for all processes in the specified block is<br />

changed to intercepted. This means that processes are permanently swapped out<br />

until allowed to continue with the resume call.<br />

If any breakpoints with a zero attribute are set in the processes, then these<br />

breakpoint signals are returned to their respective owners. Breakpoints set with<br />

non-zero attributes are not affected.<br />

There are no intercept counters in the system. Intercepting a process that is<br />

already intercepted performs no operation.<br />

Include files #include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

Parameters pid The ID of the specified block or process.<br />

Return value None.<br />

Restrictions<br />

See also<br />

Only prioritized, background and timer-interrupt processes can be intercepted.<br />

The intercept and resume calls have no effect on process types that can not be<br />

intercepted.<br />

Intercept may also be called from interrupt and timer-interrupt processes, but it is<br />

an error to cause a remote system call while doing so, i.e. an interrupt or timerinterrupt<br />

process may not intercept a process in another CPU, and the kern<strong>el</strong><br />

ignores any attempt to do so.<br />

resume, set_bp, clear_bp, get_pcb, alloc<br />

Implementation Not implemented at lev<strong>el</strong>s A and B. Full performance from lev<strong>el</strong>slev<strong>el</strong> C.<br />

Example<br />

#include "ose.h"<br />

#define FIRST 1 /* These declarations */<br />

struct First /* are preferably made */<br />

{ /* in a .sig-file which */<br />

SIGSELECT sig_no; /* is included. */<br />

};<br />

static const SIGSELECT any_sig[] = {1,FIRST};<br />

extern PROCESS proc_;<br />

union SIGNAL<br />

{<br />

SIGSELECT sig_no;<br />

struct First first;<br />

};<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 73<br />

intercept


OS_PROCESS(my_process)<br />

{<br />

union SIGNAL *trapsignal;<br />

for(;;)<br />

{<br />

trapsignal = alloc(sizeof(struct first), FIRST);<br />

set_bp(proc_, (OSADDRESS) function, (OSADDRESS) 0,<br />

&trapsignal);<br />

intercept(proc_);<br />

trapsignal = receive_w_tmo(0, (SIGSELECT *) any_sig);<br />

if(trapsignal)<br />

{<br />

free_buf(&trapsignal);<br />

}<br />

/* Code */<br />

resume(proc_);<br />

}<br />

}<br />

<strong>Kern</strong><strong>el</strong><br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 74<br />

intercept


kill_proc<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

void kill_proc (PROCESS pid);<br />

Description Kill a process or a block or segment.<br />

If a block is specified, then all processes known to the caller in that block are<br />

killed. If there are no processes left, the block descriptor is then d<strong>el</strong>eted too.<br />

(If the caller can see only some processes, then only those are killed. This is<br />

sufficient for the block to disappear for the caller.)<br />

If a single process is specified, then that process only is killed, unless it is the last<br />

process in a block, in which case the block is d<strong>el</strong>eted too, as described above.<br />

In any case, all signals attached to killed processes and blocks and segments are<br />

eventually returned to their respective owners.<br />

If a killed process owns other blocks, signal buffers, semaphores, hunt signals etc,<br />

these are returned to the system. If a killed process was a link handler, then that<br />

information is d<strong>el</strong>eted from the kern<strong>el</strong> lists.<br />

If a killed process was a remote system call server to some other blocks, then all<br />

those blocks are killed too.<br />

The kill_proc system call can also be used by memory manager software, MMS<br />

to kill a memory segment. A segment ID obtained from either the attach_segment<br />

system call or the get_segid system call can be passed to kill_proc, which causes<br />

d<strong>el</strong>etion of all processes and blocks in the memory segment.<br />

Include files #include "ose.h"<br />

Parameters pid The ID of the specified block, process or segment.<br />

Return value None.<br />

Restrictions Killing a static process is allowed by the kern<strong>el</strong> only when the process is part of<br />

a separat<strong>el</strong>y linked software unit (program), otherwise it is an illegal operation.<br />

Killing a static process causes the software unit (program) to terminate in most<br />

implementations. This behaviour is achieved by interactions between the OSE<br />

interface library and user-provided memory management and program loader<br />

software. Other rules may apply as desired for each system.<br />

When the kill_proc system call is executed, the kern<strong>el</strong> removes the affected<br />

process(es) and blocks from system tables and invokes the lower priority system<br />

daemon to return attached signals and clean up at a later time. Kill_proc returns<br />

to the caller before this work begins. This has some important implications:<br />

1. A significant amount of time may <strong>el</strong>apse before attached signals are returned.<br />

2. Excessive process creation and destruction may exhaust system resources.<br />

3. When a remote call server is killed, served blocks disappear at a later time.<br />

The kill_proc call is not available to interrupt processes.<br />

See also create_block, create_process, attach_segment, attach<br />

Implementation Not implemented at lev<strong>el</strong> A. Full performance from lev<strong>el</strong> B.<br />

lev<strong>el</strong>s<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 75<br />

kill_proc


Example<br />

#include "ose.h"<br />

OSENTRYPOINT new_process;<br />

OS_PROCESS(my_process)<br />

{<br />

PROCESS proc_;<br />

for(;;)<br />

{<br />

proc_ = create_process(OS_PRI_PROC,<br />

"process",<br />

new_process,<br />

200,<br />

16,<br />

(OSTIME) 0,<br />

(PROCESS) 0,<br />

(struct OS_redir_entry *) NULL,<br />

(OSVECTOR) 0,<br />

(OSUSER) 0);<br />

/* Code */<br />

kill_proc(proc_);<br />

}<br />

}<br />

<strong>Kern</strong><strong>el</strong><br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 76<br />

kill_proc


kill_sem<br />

Syntax<br />

void kill_sem (SEMAPHORE *sem);<br />

Description Return a semaphore created by create_sem to the pool.<br />

Include files #include "ose.h"<br />

Parameters sem A pointer to the semaphore.<br />

Return value None.<br />

Restrictions Make sure no process is using the semaphore when it is killed.<br />

Never kill a statically declared semaphore structure by calling kill_sem. (A<br />

statically declared semaphore is initialised at declaration).<br />

The kill_sem call is not available to interrupt processes.<br />

See also create_sem, signal_sem, wait_sem, get_sem<br />

Implementation Not implemented at lev<strong>el</strong> A. Full performance from lev<strong>el</strong> B.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

<strong>Kern</strong><strong>el</strong><br />

OS_PROCESS(my_process)<br />

{<br />

SEMAPHORE *sem;<br />

for(;;)<br />

{<br />

/* Code */<br />

sem = create_sem(1);<br />

/* Code */<br />

kill_sem(sem);<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 77<br />

kill_sem


mem_move<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax OSBOOLEAN mem_move (OSSEGMENT src_segment,<br />

OSADDRESS src_begin,<br />

OSADDRESS size,<br />

OSSEGMENT dest_segment,<br />

OSADDRESS dest_begin);<br />

Description This is a call from the kern<strong>el</strong> to the memory manager block. It is thus not a user<br />

system call.<br />

The kern<strong>el</strong> requires a block of memory to be copied from one memory segment<br />

to another. The MMU software performs this operation.<br />

The mem_move function may use system calls as if it was called from a<br />

prioritized superuser process. It is called in the context of the process that requires<br />

the operation, so mem_move can be simultaneously executed by several<br />

processes, and the calling process may be killed at any time.<br />

Any alloc calls issued by the mem_move function refer to the system pool,<br />

regardless of the pool attached to the calling process.<br />

The user ID of the calling process is temporarily set to zero for the duration of<br />

the mem_move call. This allows the mem_move function to communicate with<br />

system processes normally invisible to the calling process.<br />

The mem_move function should use set_segment calls to temporarily s<strong>el</strong>ect<br />

segments while copying. When copying is complete, the home segment is<br />

res<strong>el</strong>ected with a final set_segment call. Note that each set_segment call issued<br />

may indicate that the segment has been killed, in which case copying must be<br />

aborted.<br />

Include files #include "ose_mmu.h"<br />

Parameters src_segment<br />

src_begin<br />

size<br />

dest_segment<br />

dest_begin<br />

Return value Returns a non-zero value if an error occurred. Either the specified process/block<br />

could not be found, or the requested size could not be transferred.<br />

Restrictions The mem_move function its<strong>el</strong>f must reside in supervisor space (segment zero).<br />

See also set_segment, s<strong>el</strong>ect_segment, set_segment_mode, attach_segment<br />

Implementation Not implemented at lev<strong>el</strong>s A, B and C. Full performance at<br />

lev<strong>el</strong>s lev<strong>el</strong> D.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 78<br />

mem_move


power_fail<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

Description<br />

Include files<br />

Parameters<br />

Return value<br />

Restrictions<br />

void power_fail (void);<br />

Shuts down the system in a manner which enables immediate continuation at a<br />

subsequent restart. When power reappears, the calling process (and all others)<br />

appears to be continuing where it left off at the time of the power_fail system call.<br />

The call to power_fail causes the current process to be swapped out, and a userwritten<br />

power fail handler is called to save memory contents and i/o status. When<br />

this is complete, the handler should shut down the CPU.<br />

If power_fail is called from an interrupt process, then the system shutdown<br />

procedure is deferred until execution returns to a non-interrupt lev<strong>el</strong>.<br />

When the system restarts, the kern<strong>el</strong> calls a power on handler which determines<br />

if memory and i/o can be restored. If this is the case, the kern<strong>el</strong> immediat<strong>el</strong>y<br />

swaps in the process that called power_fail, unless an interrupt process called<br />

power_fail, in which case the kern<strong>el</strong> swaps in the process that was swapped out<br />

when the interrupt process was called. Otherwise an ordinary cold start is<br />

performed.<br />

#include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

None.<br />

None.<br />

This system call may only be used by a superuser process (user number 0). Use<br />

of the power_fail system call requires careful system planning since many<br />

hardware problems must be correctly addressed. In particular, it must be possible<br />

to reinitialize all i/o devices to the exact state that was present at the shutdown.<br />

Hints:<br />

• A good memory backup power system is required, including protection against<br />

spurious memory cycles during periods of unstable power.<br />

• A r<strong>el</strong>iable power fail interrupt is needed. This interrupt should not be an NMI<br />

since non-maskable interrupts can not communicate with the kern<strong>el</strong>.<br />

• A watchdog timer is needed since memory backup designs may be somewhat<br />

unr<strong>el</strong>iable.<br />

• It is a good idea to have hardware support for determining if a cold start is<br />

required.<br />

• Software should be planned in a way that promotes saving the i/o state. Doing<br />

this correctly is an art.<br />

Implementation Not implemented at lev<strong>el</strong> A. Full performance from lev<strong>el</strong> B.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 79<br />

power_fail


OS_PROCESS(my_process)<br />

{<br />

for(;;)<br />

{<br />

/* Code */<br />

power_fail();<br />

/* Code, This is where the system starts again at<br />

* power up if a warm start<br />

*/<br />

}<br />

}<br />

<strong>Kern</strong><strong>el</strong><br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 80<br />

power_fail


eceive<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

Description<br />

union SIGNAL *receive (SIGSELECT *sigs<strong>el</strong>);<br />

Receives a signal from the caller's signal queue. If an appropriate signal is not<br />

immediat<strong>el</strong>y available, the caller pends until an appropriate signal is sent to the<br />

caller by some other process.<br />

Sigs<strong>el</strong> points to an array containing a list of signal numbers to be received.<br />

Receive returns to the caller when a signal matching any of the specified signal<br />

numbers is found.<br />

The first position in sigs<strong>el</strong> contains the number of entries in the list that follows.<br />

If the number of entries is zero, any signal number is accepted.<br />

When called from an interrupt or timer-interrupt process, receive always returns<br />

immediat<strong>el</strong>y. If no requested signal was immediat<strong>el</strong>y available in the signal queue,<br />

NIL is returned. This works in a manner similar to receive_w_tmo with a 0<br />

timeout. (Note that receive_w_tmo is not available to interrupt and timer-interrupt<br />

processes.)<br />

A "negative receive specification" feature is supported. This means that if the first<br />

location of the sigs<strong>el</strong> array contains a negative count, then any signal except those<br />

that match the sigs<strong>el</strong> array is received. This feature effectiv<strong>el</strong>y inverts the<br />

semantics of the receive, receive_w_tmo and receive_from calls, providing a<br />

means of holding back certain signals.<br />

The SIGSELECT type is an unsigned type, so using a negative receive<br />

specification requires the count in the sigs<strong>el</strong> array to be initialized with a proper<br />

cast expression.<br />

Include files #include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

Parameters sigs<strong>el</strong> Pointer to an array of the signal numbers to receive.<br />

Return value<br />

Restrictions<br />

See also<br />

Returns a pointer to the received signal buffer. This buffer is owned by the caller<br />

from that moment.<br />

None.<br />

send, send_w_s, receive_w_tmo, receive_from, alloc, free_buf, sender, sigsize,<br />

addressee<br />

Implementation Full performance at all implementation lev<strong>el</strong>s.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

#define THIRD 3 /* These declarations */<br />

struct Third /* are preferably made */<br />

{ /* in a .sig-file which*/<br />

SIGSELECT sig_no; /* is included. */<br />

};<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 81<br />

receive


#define FIFTH 5 /* These declarations */<br />

struct Fifth /* are preferably made */<br />

{ /* in a .sig-file which*/<br />

SIGSELECT sig_no; /* is included. */<br />

};<br />

union SIGNAL /* A union SIGNAL declaration */<br />

{ /* must include a signal */<br />

/* number and the signal */<br />

SIGSELECT sig_no; /* structures of the signals */<br />

struct Third third; /* that will be used. It must */<br />

struct Fifth fifth; /* be present in every */<br />

/* application using signals */<br />

};<br />

static const SIGSELECT any_sig[] = {0};<br />

OS_PROCESS(my_process)<br />

{<br />

union SIGNAL *sig;<br />

<strong>Kern</strong><strong>el</strong><br />

for(;;)<br />

{<br />

sig = receive((SIGSELECT *) any_sig);<br />

switch(sig->sig_no)<br />

{<br />

case THIRD:<br />

/* Code */<br />

break;<br />

case FIFTH:<br />

/* Code */<br />

break;<br />

default:<br />

/* Code */<br />

}<br />

free_buf(&sig);<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 82<br />

receive


eceive_from<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax union SIGNAL *receive_from (OSTIME timeout,<br />

SIGSELECT *s<strong>el</strong>,<br />

PROCESS from);<br />

Description Works like receive_w_tmo, but signals are only accepted from a specific process.<br />

This call is used, for instance, in interface libraries which hide signal transactions<br />

towards a server process from a user. In this case it must be possible to define<br />

signals to the server without conflicts with user signal numbers.<br />

The receive_from call should be used with some caution since extensive use can<br />

easily cause a messy system design and lead to debugging problems.<br />

Include files #include "ose.h"<br />

Parameters timeout The number of milliseconds to wait.<br />

s<strong>el</strong><br />

Pointer to an array of the signal numbers to receive.<br />

from<br />

The ID of the process to receive from.<br />

Return value Returns a pointer to the received signal buffer or the NIL pointer if no signal<br />

arrived within the specified timeout.<br />

Restrictions There is no way to issue receive_from without a timeout. If no timeout is required,<br />

a loop can be used without causing much overhead.<br />

For example:<br />

See also<br />

while(NIL == (sig = receive_from((OSTIME)-1, ...)));<br />

The receive_from call is not available to interrupt processes.<br />

alloc, free_buf, addressee, send, send_w_s, receive, receive_w_tmo<br />

Implementation Not implemented at lev<strong>el</strong> A. Full performance from lev<strong>el</strong> B.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

#define FIRST 1 /* These declarations */<br />

struct First /* are preferably made */<br />

{ /* in a .sig-file which */<br />

SIGSELECT sig_no; /* is included. */<br />

};<br />

#define THIRD 3 /* These declarations */<br />

struct Third /* are preferably made */<br />

{ /* in a .sig-file which */<br />

SIGSELECT sig_no; /* is included. */<br />

};<br />

union SIGNAL<br />

{<br />

SIGSELECT sig_no;<br />

struct First first;<br />

struct Third third;<br />

};<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 83<br />

receive_from


static const SIGSELECT any_sig[] = {0};<br />

static const SIGSELECT sig_one[] = {1, FIRST};<br />

extern PROCESS sending_proc_;<br />

extern PROCESS sending_proc2_;<br />

OS_PROCESS(my_process)<br />

{<br />

union SIGNAL *sig;<br />

<strong>Kern</strong><strong>el</strong><br />

for(;;)<br />

{<br />

sig = receive_from(10,<br />

(SIGSELECT *) any_sig,<br />

sending_proc_);<br />

if(sig != NIL)<br />

{<br />

if(sig->sig_no == THIRD)<br />

{<br />

free_buf(&sig);<br />

sig = receive_from(55,<br />

(SIGSELECT *) sig_one,<br />

sending_proc2_);<br />

if(sig != NIL)<br />

{<br />

/* Code */<br />

free_buf(&sig);<br />

}<br />

}<br />

<strong>el</strong>se<br />

{<br />

/* Code */<br />

free_buf(&sig);<br />

}<br />

<strong>el</strong>se<br />

{<br />

/* Code */<br />

}<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 84<br />

receive_from


eceive_w_tmo<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax union SIGNAL *receive_w_tmo (OSTIME timeout,<br />

SIGSELECT *s<strong>el</strong>);<br />

Description Short for receive with timeout. Works like receive, except that the caller is<br />

suspended no longer than the number of milliseconds specified in the timeout<br />

parameter.<br />

If the requested signal has not arrived by then, the NIL pointer is returned.<br />

The specified timeout period is converted to a number of actual system ticks<br />

according to the following rules:<br />

A value of zero returns immediat<strong>el</strong>y.<br />

A value equal to or smaller than one system tick period returns at the next system<br />

timer event, i.e. after anything between 0 and 1 system tick.<br />

A value higher than one system tick period is rounded upwards to the closest<br />

number of system ticks. The actual d<strong>el</strong>ay may varies between the calculated<br />

number of ticks and this value less 1 tick period.<br />

The result is that the actual d<strong>el</strong>ay may be up to one system tick period shorter<br />

than specified.<br />

Include files #include "ose.h"<br />

Parameters timeout The number of milliseconds to wait.<br />

s<strong>el</strong><br />

A pointer to an array of the signal numbers to receive.<br />

Return value Returns a pointer to the received signal buffer or the NIL pointer if no signal<br />

arrived within the specified timeout.<br />

Restrictions The receive_w_tmo call is not available to interrupt processes.<br />

See also alloc, addressee, free_buf, send, sender, send_w_s, receive, receive_from<br />

Implementation Full performance at all implementation lev<strong>el</strong>s.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

static const SIGSELECT any_sig[] = {0};<br />

union SIGNAL<br />

{<br />

SIGSELECT sig_no;<br />

};<br />

OS_PROCESS(my_process)<br />

{<br />

union SIGNAL *sig;<br />

for(;;)<br />

{<br />

/* Wait for any signal in 10 ms time */<br />

sig = receive_w_tmo((OSTIME) 10, any_sig);<br />

/* Check if a signal was received. If no signal was<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 85<br />

receive_w_tmo


}<br />

}<br />

* received in 10 ms time the receive_w_tmo() sys<br />

* call will return NIL.<br />

*/<br />

if (sig != NIL)<br />

{<br />

/* Code */<br />

free_buf(&sig);<br />

}<br />

<strong>el</strong>se<br />

{<br />

/* Code */<br />

}<br />

<strong>Kern</strong><strong>el</strong><br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 86<br />

receive_w_tmo


estore<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

Description<br />

void restore (union SIGNAL *sig);<br />

Registers the caller as the current owner of a signal buffer and clears buffer<br />

redirection information from it. Use this call if:<br />

1. A redirected buffer is to be reused without reallocation or<br />

2. A buffer has been illegally transferred from one process to another.<br />

The restore call should only be needed on rare occasions.<br />

Include files #include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

Parameters sig A pointer to the specified signal buffer.<br />

Return value None.<br />

Restrictions<br />

See also<br />

Caution! This call has an unusual parameter syntax. In systems with multiple<br />

address space, it is an error to restore a buffer that is not in the callers address<br />

space. Some old OSE implementations do not allow a redirected buffer to be freed<br />

without restoring it. New implementations should avoid this problem.<br />

If a killed process is part of a design which passes buffers around without proper<br />

ownership control, then the following problem may arise: the killed process owns<br />

a buffer which is currently in use by some other process. Once the owner is killed,<br />

the buffer is returned to the pool without the knowledge of the process which uses<br />

the buffer. If that process chooses to send or free the buffer, the system may crash.<br />

Summary: If you use kill_proc extensiv<strong>el</strong>y, never transfer buffers between<br />

processes without using one of the send system calls.<br />

alloc, free_buf, send<br />

Implementation Full performance at all implementation lev<strong>el</strong>s.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

static const SIGSELECT any_sig[] = {0};<br />

union SIGNAL<br />

{<br />

SIGSELECT sig_no;<br />

};<br />

OS_PROCESS(my_linkhandler)<br />

{<br />

union SIGNAL *sig;<br />

for(;;)<br />

{<br />

/* Code */<br />

sig = receive((SIGSELECT *) any_sig);<br />

if(addressee(&sig) != current_process())<br />

{<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 87<br />

restore


}<br />

}<br />

restore(sig);<br />

/* Code */<br />

}<br />

free_buf(&sig);<br />

<strong>Kern</strong><strong>el</strong><br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 88<br />

restore


esume<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

Description<br />

void resume (PROCESS pid);<br />

This system call is mainly used by debuggers.<br />

The resume call starts processes previously stopped with the intercept call or by<br />

a breakpoint.<br />

Intercept status for the specified process or for all processes in the specified block<br />

is removed. This means that the process(es) are allowed to continue operation as<br />

implied by the state present before they were intercepted.<br />

If any breakpoints with a zero attribute are set in the processes, then these<br />

breakpoint signals are returned to their respective owners. Breakpoints set with<br />

non-zero attributes are not affected.<br />

There are no intercept counters in the system. Resuming a process that is not<br />

intercepted performs no operation.<br />

Include files #include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

Parameters pid The ID of the specified process.<br />

Return value None.<br />

Restrictions<br />

See also<br />

Only prioritized, background and timer-interrupt processes can be intercepted.<br />

The intercept and resume calls have no effect on process types that can not be<br />

intercepted.<br />

Resume may also be called from interrupt and timer-interrupt processes, but it is<br />

an error to cause a remote system call while doing so, i.e. an interrupt or timerinterrupt<br />

process may not resume a process in another CPU, and the kern<strong>el</strong><br />

ignores any attempt to do so.<br />

intercept, set_bp, clear_bp, get_pcb<br />

Implementation Not implemented at lev<strong>el</strong>s A and B. Full performance from<br />

lev<strong>el</strong>s. lev<strong>el</strong> C.<br />

Example<br />

#include "ose.h"<br />

#define FIFTH 5 /* These declarations */<br />

struct Fifth /* are preferably made */<br />

{ /* in a .sig-file which */<br />

SIGSELECT sig_no; /* is included. */<br />

};<br />

union SIGNAL<br />

{<br />

SIGSELECT sig_no;<br />

struct Fifth fifth;<br />

};<br />

static const SIGSELECT any_sig[] = {0};<br />

extern PROCESS proc_;<br />

void function(void);<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 89<br />

resume


OS_PROCESS(my_process)<br />

{<br />

union SIGNAL *trapsignal;<br />

for(;;)<br />

{<br />

trapsignal = alloc(sizeof(struct fifth), FIFTH);<br />

set_bp(proc_, (OSADDRESS) function,0,&trapsignal);<br />

trapsignal = receive((SIGSELECT *) any_sig);<br />

switch(trapsignal->sig_no)<br />

{<br />

case FIFTH:<br />

resume(proc_);<br />

/* Code */<br />

break;<br />

default:<br />

/* Code */<br />

}<br />

}<br />

}<br />

<strong>Kern</strong><strong>el</strong><br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 90<br />

resume


s<strong>el</strong>ect_segment<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

Description<br />

Include files<br />

Parameters<br />

Return value<br />

Restrictions<br />

void s<strong>el</strong>ect_segment (OSSEGMENT segnum);<br />

This is a call from the kern<strong>el</strong> to the memory manager block and is therefore not<br />

a user system call.<br />

The s<strong>el</strong>ect_segment function is called by the OSE dispatcher when it swaps in a<br />

user mode process and requires the MMU to s<strong>el</strong>ect the address space where the<br />

process is located.<br />

The s<strong>el</strong>ect_segment function may also be called in response to a set_segment<br />

system call issued from memory management software.<br />

#include "ose_mmu.h"<br />

segnum<br />

None.<br />

The s<strong>el</strong>ect_segment function is called both in the context of a process and by the<br />

dispatcher in a state when no process is in context. This means that the<br />

s<strong>el</strong>ect_segment function may be called concurrently by several processes, and that<br />

the calling process can be killed at any time unless interrupts are disabled.<br />

Some implementations disable interrupts during dispatcher calls to<br />

s<strong>el</strong>ect_segment, so interrupt status must be preserved by the s<strong>el</strong>ect_segment<br />

function.<br />

It is important that the code is efficient since s<strong>el</strong>ect_segment is called for every<br />

process switch. No system calls may be used by s<strong>el</strong>ect_segment.<br />

Implementation Not implemented at lev<strong>el</strong>s A and B. Full performance from<br />

lev<strong>el</strong>s lev<strong>el</strong> C.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 91<br />

s<strong>el</strong>ect_segment


send<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

Description<br />

void send (union SIGNAL **sig, PROCESS to);<br />

Sends a signal buffer to a specified addressee process and enters NIL into the<br />

caller's signal pointer to avoid accidental reuse of the buffer.<br />

The calling process is no longer the owner of the signal.<br />

Signals are redirected if the addressee process has a redirection table that matches<br />

the sent signal.<br />

(The signal is not redirected if the redirection table chain is infinite or indicates<br />

that the signal should be sent to the caller.)<br />

If the addressee process has terminated, the signal is quietly killed. The caller will<br />

never know.<br />

Include files #include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

Parameters sig A pointer to the signal buffer.<br />

to<br />

The ID of the process the signal will be sent to.<br />

Return value None.<br />

Restrictions<br />

See also<br />

A sender process can only reach the addressee if at least one of the following<br />

conditions is true.<br />

1. The sender is a superuser process, i.e it has user number 0.<br />

2. The sender and addressee processes have the same user number.<br />

3. The sender and addressee processes are part of the same block.<br />

These rules are re-evaluated for each hop in the redirection chain, i.e. the final<br />

addressee may not be known to the calling process. (The calling process is the<br />

"sender" for the first hop. For subsequent hops, the process with the redirection<br />

table is considered "sender" when the rules are re-evaluated.)<br />

Interrupt processes and timer-interrupt processes may exchange signals (in both<br />

directions) only with processes that are part of the same block.<br />

Interrupt processes and timer-interrupt processes may not exchange signals with<br />

other interrupt or timer-interrupt processes. Some OSE implementations may<br />

r<strong>el</strong>ax this restriction if the hardware architecture allows this.<br />

send_w_s, receive, receive_w_tmo, receive_from<br />

Implementation Full performance at all implementation lev<strong>el</strong>s.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

#define FORTH 4 /* These declarations */<br />

struct forth /* are preferably made */<br />

{ /* in a .sig-file which */<br />

SIGSELECT sig_no; /* is included. */<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 92<br />

send


char<br />

};<br />

data;<br />

extern PROCESS proc_;<br />

union SIGNAL<br />

{<br />

SIGSELECT sig_no;<br />

struct Forth forth;<br />

};<br />

OS_PROCESS(my_process)<br />

{<br />

union SIGNAL *sig;<br />

for(;;)<br />

{<br />

sig = alloc(sizeof(struct forth), FORTH);<br />

sig->forth.data =’x’;<br />

send(&sig,proc_);<br />

/* Code */<br />

}<br />

}<br />

<strong>Kern</strong><strong>el</strong><br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 93<br />

send


sender<br />

Syntax<br />

Description<br />

Include files<br />

PROCESS sender (union SIGNAL **sig);<br />

Finds the process which last sent a specified signal buffer.<br />

#include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

Parameters sig A pointer to the signal buffer.<br />

Return value Returns the process ID of the sender or the owner's ID if the signal was never sent.<br />

The sender is not affected by signal redirection, i.e the sender is always the<br />

process which called send or the process ID that was specified in send_w_s.<br />

Restrictions None.<br />

See also addressee, restore, send, send_w_s<br />

Implementation Full performance at all implementation lev<strong>el</strong>s.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

static const SIGSELECT any_sig[] = {0};<br />

<strong>Kern</strong><strong>el</strong><br />

union SIGNAL<br />

{<br />

SIGSELECT sig_no;<br />

};<br />

OS_PROCESS(my_process)<br />

{<br />

union SIGNAL *sig;<br />

for(;;)<br />

{<br />

sig = receive((SIGSELECT *) any_sig);<br />

/* Code */<br />

send(&sig, sender(&sig));<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 94<br />

sender


send_w_s<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax void send_w_s (union SIGNAL **sig,<br />

PROCESS<br />

from,<br />

PROCESS<br />

to);<br />

Description Short for send with sender. Works like send, except that the signal buffer is tagged<br />

with the specified process ID in place of the caller's.<br />

If the addressee process or the specified sender process has terminated, the signal<br />

is quietly killed. The caller will never know.<br />

Include files #include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

Parameters sig A pointer to the signal buffer.<br />

from<br />

The ID of the process specified as sender.<br />

to<br />

The ID of the process the signal will be sent to.<br />

Return value None.<br />

Restrictions See send<br />

See also send, receive, receive_w_tmo, receive_from<br />

Implementation Not implemented at lev<strong>el</strong> A. Full performance from lev<strong>el</strong> B.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

#define FIFTH 5 /* These declarations */<br />

struct fifth /* are preferably made */<br />

{ /* in a .sig-file which */<br />

SIGSELECT sig_no; /* is included. */<br />

};<br />

extern PROCESS proc1_;<br />

extern PROCESS proc2_;<br />

union SIGNAL<br />

{<br />

SIGSELECT sig_no;<br />

};<br />

OS_PROCESS(my_process)<br />

{<br />

union SIGNAL *sig;<br />

for(;;)<br />

{<br />

sig = alloc(sizeof(struct fifth), FIFTH);<br />

/* send a signal to proc2 specifying proc1 as sender */<br />

send_w_s(&sig, proc1_, proc2_);<br />

/* Code */<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 95<br />

send_w_s


set_bp<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax OSBOOLEAN set_bp (PROCESS pid,<br />

OSADDRESS<br />

address,<br />

OSADDRESS<br />

attribute,<br />

union SIGNAL **trapsig);<br />

Description This is a debugger system call.<br />

Set_bp sets a breakpoint in a block or in a process.<br />

Setting a breakpoint in a block means that any process in the block can trip the<br />

breakpoint and all processes will be intercepted when the breakpoint is reached.<br />

Setting a breakpoint in a process means that only the specified process can trip<br />

the breakpoint and only that process will be intercepted.<br />

A breakpoint is removed when it is reached, i.e. the breakpoint must be set again<br />

with another set_bp call if it is still needed.<br />

When a breakpoint is reached, the specified trap signal is sent back to the caller.<br />

The caller must then free that signal. (The signal may have been copied to a new<br />

signal buffer by the kern<strong>el</strong>.)<br />

If a process or block is killed, breakpoints set in the process/block are cleared.<br />

Trap signals are freed by the kern<strong>el</strong>.<br />

The breakpoint attribute contains CPU-dependent breakpoint modifier bits. These<br />

are set in combinations to specify various CPU cycles and the like. Bits not used<br />

should be cleared.<br />

Only a few attribute bits/values are w<strong>el</strong>l defined:<br />

1. All bits = 0, which identifies a software testpoint. No hardware breakpoint is<br />

actually set and the breakpoint can thus not be reached. The trap signal is<br />

returned to the owner whenever intercept status changes in either direction for<br />

the specified process or for any process in the specified block. The trap signal<br />

is returned regardless of which event caused the status change. The get_pcb<br />

call can be used to obtain further information. The address fi<strong>el</strong>d is in this case<br />

used only as a breakpoint ID which serves a purpose in a subsequent clear_bp<br />

call. The address is otherwise not used by the kern<strong>el</strong>.<br />

2. Bit 0 s<strong>el</strong>ects a pre or post breakpoint. Bit 0=0 means that the process that<br />

causes the break will stop at the set address. Bit 0=1 means that the process<br />

will stop one machine instruction beyond the set address. This bit may not be<br />

valid unless bit 1=1.<br />

3. Bit 1 s<strong>el</strong>ects simple execution breakpoints. Bit 1=1 means that a break will<br />

occur when the process executes an instruction at the specified address. Bit<br />

1=0 means that the bit is ignored and other bits determine the breakpoint type.<br />

Other bits depend on the implementation.<br />

Include files #include "ose.h"<br />

Parameters pid The ID of the block or process for which the breakpoint is<br />

set.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 96<br />

set_bp


<strong>Kern</strong><strong>el</strong><br />

Return value<br />

Restrictions<br />

See also<br />

address<br />

attribute<br />

trapsig<br />

The address where the breakpoint is to be set.<br />

CPU-dependent modifier bits.<br />

A pointer to the signal buffer returned.<br />

Returns a non-zero value if the breakpoint could not be set.<br />

This occurs when either too many breakpoints were set or several breakpoints<br />

were set at the same address or the attribute contains a value that is not supported.<br />

In case of error, the trap signal is immediat<strong>el</strong>y freed by the kern<strong>el</strong>.<br />

Only one breakpoint may be set at each address within a memory segment. This<br />

is because the address is also used as the breakpoint ID. Implementations may<br />

find various ways to r<strong>el</strong>ax this restriction, but conflicts that can not be handled<br />

are reported to the caller.<br />

Breakpoints may not be set in an interrupt or timer-interrupt process.<br />

The kern<strong>el</strong> may reallocate the space occupied by the trap signal. Thus, the pointer<br />

to the trap signal is not valid following the call to set_bp.<br />

The set_bp call is not available to interrupt processes.<br />

clear_bp, intercept, resume, get_pcb<br />

Implementation Not implemented at lev<strong>el</strong>s A and B. Full performance from<br />

lev<strong>el</strong>s<br />

lev<strong>el</strong> C. Several aspects of hardware breakpoints are<br />

implementation-specific. They depend on what is possible in<br />

the specific processor architecture and target hardware. Only<br />

attribute = zero must always be supported.<br />

Example<br />

#include "ose.h"<br />

#define SIXTH 6 /* These declarations */<br />

struct Sixth /* are preferably made */<br />

{ /* in a .sig-file which */<br />

SIGSELECT sig_no; /* is included. */<br />

};<br />

static const SIGSELECT six[] = {1, SIXTH};<br />

extern PROCESS proc_;<br />

void function(void);<br />

union SIGNAL<br />

{<br />

SIGSELECT sig_no;<br />

struct Sixth sixth;<br />

};<br />

OS_PROCESS(my_process)<br />

{<br />

union SIGNAL *trapsignal;<br />

for(;;)<br />

{<br />

trapsignal = alloc(sizeof(struct sixth), SIXTH);<br />

set_bp(proc_,<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 97<br />

set_bp


}<br />

}<br />

(OSADDRESS) function,<br />

(OSADDRESS) 2,<br />

&trapsignal);<br />

trapsignal = receive((SIGSELECT *)six);<br />

/* Code */<br />

free_buf(&trapsignal);<br />

<strong>Kern</strong><strong>el</strong><br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 98<br />

set_bp


set_env<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax OSBOOLEAN set_env ( PROCESS pid,<br />

char *name,<br />

char *value);<br />

Description Create, update or d<strong>el</strong>ete an environment string for the specified process or block.<br />

The environment variable specified by name is set to the value specified in the<br />

value parameter. A value set to NULL removes the variable<br />

Include files #include "ose.h"<br />

Parameters pid The ID of the specified block or process.<br />

name<br />

A pointer to the enviroment variable name.<br />

value<br />

A pointer to the value.<br />

Return value Returns a non-zero value if out of environment space for the specified process or<br />

block.<br />

Restrictions If the specified name or value is longer than the maximum size of a signal buffer,<br />

then the environment variable is not set.<br />

The set_env call is not available to interrupt processes.<br />

See also get_env_list, get_env, get_envp, set_envp<br />

Implementation Not implemented at lev<strong>el</strong> A. Full performance from lev<strong>el</strong> B.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

extern PROCESS proc_;<br />

OS_PROCESS(my_process)<br />

{<br />

for(;;)<br />

{<br />

set_env(current_process(), "appvar", "xyz21");<br />

set_env(proc_, "number", "2000");<br />

/* Code */<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 99<br />

set_env


set_envp<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax OSBOOLEAN set_envp ( PROCESS pid,<br />

char *name,<br />

OSADDRESS value);<br />

Description This system call stores a 32 bit pointer in a named environment variable. The<br />

value is stored in a special (mangled) format so that it can be efficiently read with<br />

the get_envp call.<br />

Variables set with the set_envp call can be read with the get_env call, but the<br />

string returned is not easily interpreted.<br />

Include files #include "ose.h"<br />

Parameters pid The ID of the specified block or process. Setting the pid<br />

parameter to zero is equivalent to using the pid of the current<br />

process.<br />

name<br />

A pointer to the enviroment variable name.<br />

value<br />

A pointer to the value.<br />

Return value Returns a non zero value if the call was successful. Returns zero if the kern<strong>el</strong> does<br />

not support the call or if the call failed due to an ignored error report.<br />

Restrictions Setting a variable to zero is less useful as that value can not be properly read.<br />

If the specified name is longer than the maximum size of a signal buffer, then the<br />

environment variable is not set.<br />

The set_envp call is not available to interrupt processes.<br />

See also get_env, get_env_list, get_envp, set_env<br />

Implementation All OSE implementations might not have this system call.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

OS_PROCESS(my_process)<br />

{<br />

int prod_data = 0xCAFE;<br />

OSADDRESS pa;<br />

for(;;)<br />

{<br />

set_envp(0, "pd", (OSADDRESS)&proc_data);<br />

pa = get_envp(0, "pd");<br />

if (pa != 0)<br />

printf("pa = %d\n", *(int *)pa);<br />

/* Code */<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 100<br />

set_envp


set_fsem<br />

Syntax<br />

void set_fsem (OSFSEMVAL value, PROCESS pid);<br />

Description Initializes a fast semaphore for subsequent use.<br />

Include files #include "ose.h"<br />

Parameters value The initial value.<br />

pid<br />

The ID of the process for which to set the fast semaphore.<br />

Return value None.<br />

Restrictions The fast semaphore may not be accessed in any way before it is initialized.<br />

It is illegal to set a fast semaphore to a negative value.<br />

Some OSE implementations behave badly if a fast semaphore is reinitialized<br />

while the owner is waiting for it. Portable code should avoid reinitializing fast<br />

semaphores.<br />

The set_fsem call is not available to interrupt processes.<br />

See also signal_fsem, wait_fsem, get_fsem<br />

Implementation Not implemented at lev<strong>el</strong> A. Full performance from lev<strong>el</strong> B.<br />

lev<strong>el</strong>s<br />

Example<br />

<strong>Kern</strong><strong>el</strong><br />

#include "ose.h"<br />

extern PROCESS proc_;<br />

OS_PROCESS(my_process)<br />

{<br />

for(;;)<br />

{<br />

set_fsem((OSSEMVAL) 1, proc_);<br />

/* Code */<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 101<br />

set_fsem


set_mem<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax OSBOOLEAN set_mem (PROCESS pid,<br />

void *from,<br />

OSADDRESS to,<br />

OSADDRESS size);<br />

Description This call is mainly used by memory managers, program loaders and debuggers to<br />

load and modify a program.<br />

Writes a specified number of bytes from the address space of the caller to the<br />

address space of the specified process or block.<br />

Include files #include "ose.h"<br />

Parameters pid The ID of the specified block or process.<br />

from<br />

A pointer to the address to read from.<br />

to<br />

The address to write to.<br />

size<br />

The number of bytes to read.<br />

Return value Returns a non-zero value if an error occurred. Either the specified process/block<br />

could not be found, or the requested size could not be transferred.<br />

Restrictions The caller must be aware of the problems that occur when a program on another<br />

CPU type is loaded or examined, in particular if that CPU has another word<br />

length. Link handler conventions should be dev<strong>el</strong>oped to resolve this.<br />

The set_mem call is not available to interrupt processes.<br />

See also get_mem<br />

Implementation Not implemented at lev<strong>el</strong>s A and B. Full performance from<br />

lev<strong>el</strong>s lev<strong>el</strong> C.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 102<br />

set_mem


set_pcb<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

OSBOOLEAN set_pcb (PROCESS pid, char *cpuregs);<br />

Description Sets the CPU registers of the specified process if the process is in a state where<br />

this is possible. The set_pcb call is mainly used by debuggers.<br />

Cpuregs contains a string describing the registers to be set. The string format<br />

corresponds to the format used in the cpuregs string in the get_pcb call, except<br />

registers may be in any order and not all registers need to be present.<br />

Include files #include "ose.h"<br />

Parameters pid The ID of the specified process.<br />

cpuregs<br />

A pointer to a string describing the registers.<br />

Return value Returns zero if the call was successful.<br />

Returns a non-zero value if the call failed because the process is not in a state<br />

where the CPU registers can be set, or the string was in a format not recognized.<br />

Restrictions Works only for prioritized and background processes.<br />

Implementations are often sensitive to the format of the cpuregs string. For<br />

example, in an assignment of a CPU register, the number of digits of the register<br />

value may be crucial for the success of the assignment: "PC=0" may not succeed<br />

whilst "PC=00000000" would. Take care not to violate the rules provided by each<br />

implementation.<br />

The set_pcb call is not available to interrupt processes.<br />

See also get_pcb<br />

Implementation Not implemented at lev<strong>el</strong>s A and B. Full performance from<br />

lev<strong>el</strong>s<br />

lev<strong>el</strong> C. The set_pcb call is useful only in kern<strong>el</strong>s that provide<br />

CPU registers per process.<br />

Example<br />

#include "ose.h"<br />

extern PROCESS proc_;<br />

OS_PROCESS(my_process)<br />

{<br />

for(;;)<br />

{<br />

/* Code */<br />

if(set_pcb(proc_, "A0 = 000037F5"))<br />

{<br />

error(17);/* Set_pcb call was not successful */<br />

}<br />

/* Code */<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 103<br />

set_pcb


set_pri<br />

Syntax<br />

OSPRIORITY set_pri (OSPRIORITY newpri);<br />

Description Sets a new priority lev<strong>el</strong> for the calling process.<br />

The calling process is moved to the tail of the ready list on the new priority, which<br />

means that the process is swapped out until all other processes with that priority<br />

have had an opportunity to execute.<br />

The newpri parameter may be any priority lev<strong>el</strong> allowed in the create_process<br />

system call.<br />

Include files #include "ose.h"<br />

Parameters newpri The priority lev<strong>el</strong> to set.<br />

Return value Returns the resulting priority. This is the old priority if the call failed.<br />

Restrictions Works only for prioritized processes. Some implementations place restrictions on<br />

how priority lev<strong>el</strong>s may be used.<br />

See also create_process, get_pri, set_pri_for<br />

Implementation Not implemented at lev<strong>el</strong>s A and B. Full performance from<br />

lev<strong>el</strong>s lev<strong>el</strong> C.<br />

Example<br />

<strong>Kern</strong><strong>el</strong><br />

#include "ose.h"<br />

OS_PROCESS(my_process)<br />

{<br />

OSPRIORITY org_prio;<br />

OSPRIORITY prio;<br />

for(;;)<br />

{<br />

org_prio = get_pri(current_process());<br />

prio = set_pri(31);<br />

if(prio == org_prio && org_prio == 31)<br />

{<br />

/* Code, priority could not be set */<br />

}<br />

<strong>el</strong>se<br />

{<br />

/* Code */<br />

/* Reset the original priority */<br />

prio = set_pri(org_prio);<br />

}<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 104<br />

set_pri


set_pri_for<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

OSPRIORITY set_pri_for (PROCESS pid, OSPRIORITY newpri);<br />

Description Sets a new priority lev<strong>el</strong> for the specified process.<br />

The specified process is moved to the tail of the ready list on the new priority,<br />

which means that the process is swapped out until all other processes with that<br />

priority have had an opportunity to execute.<br />

The newpri parameter may be any priority lev<strong>el</strong> allowed in the create_process<br />

system call.<br />

Include files #include "ose.h"<br />

Parameters pid The ID of the specified process.<br />

newpri<br />

The priority lev<strong>el</strong> to set.<br />

Return value Returns the resulting priority. This is the old priority if the call failed.<br />

Restrictions Works only for prioritized or background processes. The target process specified<br />

with the pid parameter must be a prioritized process. Some implementations place<br />

restrictions on how priority lev<strong>el</strong>s may be used.<br />

See also create_process, get_pri, set_pri<br />

Implementation Not implemented at lev<strong>el</strong>s A and B. Full performance from<br />

lev<strong>el</strong>s lev<strong>el</strong> C.<br />

Example<br />

#include "ose.h"<br />

OS_PROCESS(my_process)<br />

{<br />

OSPRIORITY org_prio;<br />

OSPRIORITY prio;<br />

for(;;)<br />

{<br />

org_prio = get_pri(current_process());<br />

prio = set_pri_for(current_process(), 31);<br />

if(prio == org_prio)<br />

{<br />

/* Code, priority could not be set */<br />

}<br />

<strong>el</strong>se<br />

{<br />

/* Code */<br />

/* Reset the original priority */<br />

prio = set_pri(org_prio);<br />

}<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 105<br />

set_pri_for


set_redirection<br />

Syntax<br />

Description<br />

void set_redirection (PROCESS pid, struct OS_redir_entry *redir);<br />

Replace the redirection table of a process.<br />

The redir parameter is a pointer to a redirection table that describes how signals<br />

sent to the process pointed out by the pid parameter should be redirected. The<br />

redirection table contains an array of signal/process pairs. When a signal is sent<br />

to the process, the redirection table is searched and if present in the table, the<br />

signal is redirected to the process that should receive the signal.<br />

The redirection table consists of an array of structures of type "struct<br />

OS_redir_entry", which is defined as:<br />

struct OS_redir_entry<br />

{<br />

SIGSELECT sig;<br />

PROCESS pid;<br />

};<br />

<strong>Kern</strong><strong>el</strong><br />

The first structure in the redirection table contains a count of the number of<br />

entries in the table including the first entry, and a process ID to which signals not<br />

specified in the redirection table should be sent. The count is always at least 1,<br />

and the default process ID may be set to zero to specify the process to wich the<br />

redirection table is attached.<br />

The kern<strong>el</strong> may or may not copy this table to kern<strong>el</strong> memory, so the user must<br />

assume that the table can not be subsequently altered.<br />

Include files #include "ose.h"<br />

Parameters pid The ID of the specified process.<br />

redir_table A pointer to the redirection table.<br />

Return value None.<br />

Restrictions The redirection table must be built in run-time since process identities are<br />

unknown at compile time.<br />

The set_redirection call is not available to interrupt processes.<br />

See also create_process<br />

Implementation All OSE implementations might not have this system call.<br />

lev<strong>el</strong>s<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 106<br />

set_redirection


Example<br />

#include "ose.h"<br />

#define REDIRECTED_SIG 0xCAFE<br />

extern PROCESS proc_;<br />

void redir_to_proc(void)<br />

{<br />

OS_redir_entry redir_tbl[2];<br />

/* Set number of entries in the redir table */<br />

redir_tbl[0].sig = 2;<br />

/* Set default addressee for signals not found in the redir table.<br />

* If we set this to zero we mean that the default addressee will<br />

* be set to the process pointed out by the pid parameter when<br />

* calling set_redirection().<br />

*/<br />

redir_tbl[0].pid = 0;<br />

/* State that if REDIRECTED_SIG is sent it should be directed<br />

* to new_proc_ instead.<br />

*/<br />

redir_tbl[1].sig = REDIRECTED_SIG;<br />

redir_tbl[1].pid = proc_;<br />

<strong>Kern</strong><strong>el</strong><br />

/* Set the redirection table for the current process */<br />

set_redirection(current_process(), redir_tbl);<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 107<br />

set_redirection


set_segment<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax OSBOOLEAN set_segment (OSBOOLEAN go_home,<br />

OSSEGMENT segnum);<br />

Description This is a call from the memory manager block (MMU) to the kern<strong>el</strong> and is<br />

therefore not a user system call.<br />

This call sets the effective segment number for the calling process.<br />

This ID is provided by the kern<strong>el</strong> in subsequent s<strong>el</strong>ect_segment calls to the MMU,<br />

and a s<strong>el</strong>ect_segment call is immediat<strong>el</strong>y issued from within the set_segment call.<br />

The real segment ID, once set with attach_segment, is not affected. The real<br />

segment ID is always the "home" segment of the process.<br />

The segment s<strong>el</strong>ected is locked to the calling process so that the segment can not<br />

disappear until another segment is set, or the process is killed.<br />

The home segment is res<strong>el</strong>ected by setting the go_home flag to a non-zero value,<br />

in which case the segnum parameter is ignored.<br />

The intention is that the set_segment call should be used from within mem_move<br />

to temporarily s<strong>el</strong>ect segments while performing intersegment copying. When<br />

copying is complete, the home segment is res<strong>el</strong>ected by calling set_segment with<br />

the go_home flag set.<br />

Include files #include "ose.h"<br />

Parameters go_home<br />

segnum<br />

Return value Set_segment returns non-zero if the segment does not exist, which occurs if the<br />

segment died before it could be locked by set_segment.<br />

Restrictions The set_segment function can only be called by a process executing in supervisor<br />

space. The set_segment call is not available to interrupt processes.<br />

See also mem_move, s<strong>el</strong>ect_segment, attach_segment<br />

Implementation Not implemented at lev<strong>el</strong>s A, B and C. Full performance at<br />

lev<strong>el</strong>s lev<strong>el</strong> D.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 108<br />

set_segment


set_segment_mode<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax OSBOOLEAN set_segment_mode (OSSEGMENT segnum,<br />

OSBOOLEAN contains_int);<br />

Description This is a call from the kern<strong>el</strong> to the memory manager block and is therefore not<br />

a user system call.<br />

If contains_int is non-zero:<br />

The kern<strong>el</strong> t<strong>el</strong>ls the MMU that the specified segment contains at least one<br />

interrupt process, timer-interrupt process or a prioritized process with a priority<br />

high enough to disallow paging/swapping.This means that the MMU must make<br />

the entire memory segment resident. (Page faults are fatal if they occur in an<br />

interrupt or timer-interrupt process.) The call must not return until memory has<br />

been made resident.<br />

If contains_int is zero:<br />

The kern<strong>el</strong> t<strong>el</strong>ls the MMU that all interrupt and timer-interrupt processes in the<br />

memory segment have been killed, and paging/swapping may be re-enabled. This<br />

is the initial state assumed by the MMU software.<br />

The set_segment_mode function may use system calls as if it was called from a<br />

prioritized superuser process. It is called in the context of a system daemon, so<br />

the set_segment function can be simultaneously executed by several processes, but<br />

the calling process can not be killed.<br />

Any alloc calls issued by the attach_block function refer to the system pool, and<br />

the caller is a superuser process.<br />

Include files #include "ose_mmu.h"<br />

Parameters segnum<br />

contains_int<br />

Return value Zero if ok, nonzero if out of ram.<br />

Restrictions None.<br />

See also attach_block, attach_segment, mem_move<br />

Implementation Not implemented at lev<strong>el</strong>s A, B and C. Full performance<br />

lev<strong>el</strong>s from lev<strong>el</strong> D.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 109<br />

set_segment_mode


set_sigsize<br />

Syntax<br />

Description<br />

OSBOOLEAN set_sigsize (union SIGNAL **sig, OSBUFSIZE newsize);<br />

This system call attempts to change the size of a signal buffer without actually<br />

reallocate and copy it. This can only be done if the requested size is smaller than<br />

the actual size of the buffer.<br />

Include files #include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

Parameters sig A pointer to a pointer to a signal buffer.<br />

newsize<br />

The requested new size of the buffer.<br />

Return value<br />

Restrictions<br />

See also<br />

Returns a non zero value if the operation was successful. Returns zero if the<br />

operation failed.<br />

None.<br />

alloc, sigsize<br />

Implementation All OSE implementations might not have this system call.<br />

lev<strong>el</strong>s<br />

Example<br />

<strong>Kern</strong><strong>el</strong><br />

#include "ose.h"<br />

static const SIGSELECT any_sig[] = {0};<br />

union SIGNAL<br />

{<br />

SIGSELECT sig_no;<br />

};<br />

OS_PROCESS(my_process)<br />

{<br />

union SIGNAL *sig;<br />

union SIGNAL *sig2;<br />

OSBUFSIZE size;<br />

for(;;)<br />

{<br />

sig = receive((SIGSELECT *) any_sig);<br />

if (set_sigsize(&sig, sigsize(&sig) + 4))<br />

{<br />

/* Successfully enlarged the signal */<br />

}<br />

<strong>el</strong>se<br />

{<br />

/* Could not enlarge the signal */<br />

}<br />

/* Code */<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 110<br />

set_sigsize


set_suid<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

Description<br />

Include files<br />

Parameters<br />

Return value<br />

Restrictions<br />

void set_suid (OSBOOLEAN make_super);<br />

This is a call used to implement non-OSE system calls, and is therefore not a user<br />

system call.<br />

The set_suid system call temporarily assigns superuser (user 0) privileges to the<br />

calling process. This allows the caller to communicate with processes normally<br />

invisible to the calling process.<br />

The calling process is also temporarily attached to the system pool, i.e. any alloc<br />

calls issued while in a superuser region refers to the system pool, regardless of<br />

the pool normally attached to the calling process.<br />

The kern<strong>el</strong> maintains a record of how many times a process has acquired<br />

superuser rights with a non-zero set_suid parameter. A process r<strong>el</strong>inquishes<br />

superuser rights only when the same number of set_suid calls with a zero<br />

parameter have been issued.<br />

The intention is to allow users to provide a lev<strong>el</strong> of application specific operating<br />

system services that appear as system calls. Any user or supervisor mode process<br />

may trap to one of these services. The service uses the set_suid call with a nonzero<br />

parameter to acquire superuser rights, communicates with system processes,<br />

and then uses the set_suid call with a zero parameter to restore non-superuser<br />

rights before returning to the caller.<br />

#include "ose.h"<br />

make_super<br />

None.<br />

The set_suid function can only be called by a process executing in supervisor<br />

mode. There is, however, no restriction on the user number of the process. A nonsuperuser<br />

process may thus access the set_suid while executing in supervisor<br />

mode.<br />

The set_suid call is not available to interrupt processes.<br />

Implementation Not implemented at lev<strong>el</strong>s A, and B. Full performance at<br />

lev<strong>el</strong>s lev<strong>el</strong> C and D.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 111<br />

set_suid


sigsize<br />

Syntax<br />

Description<br />

OSBUFSIZE sigsize (union SIGNAL **sig);<br />

Examines a signal buffer and reports the size that was requested when the buffer<br />

was allocated.<br />

Include files #include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

Parameters sig A pointer to a pointer to a signal buffer.<br />

Return value Returns the number of bytes requested when the buffer was allocated.<br />

Restrictions None.<br />

See also alloc, set_sigsize<br />

Implementation Full performance at all implementation lev<strong>el</strong>s.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

static const SIGSELECT any_sig[] = {0};<br />

<strong>Kern</strong><strong>el</strong><br />

union SIGNAL<br />

{<br />

SIGSELECT sig_no;<br />

};<br />

OS_PROCESS(my_process)<br />

{<br />

union SIGNAL *sig;<br />

union SIGNAL *sig2;<br />

OSBUFSIZE size;<br />

for(;;)<br />

{<br />

sig = receive((SIGSELECT *) any_sig);<br />

size = sigsize(&sig);<br />

sig2 = alloc(size,sig->sig_no);<br />

/* Code */<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 112<br />

sigsize


signal_fsem<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

Description<br />

void signal_fsem (PROCESS pid);<br />

Increments the value of the fast semaphore associated with the specified process.<br />

If the result is zero, the specified process is made ready if it had done a wait_fsem.<br />

If the process is an interrupt process, a wake_up invocation of the process is<br />

scheduled.<br />

Include files #include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

Parameters pid The ID of the process for which the fast semaphore is<br />

signalled.<br />

Return value None.<br />

Restrictions<br />

See also<br />

It is illegal to cause a fast semaphore to wrap from high positive numbers to a<br />

negative value for all processes but interrupt processes (these are allowed to wrap<br />

since the fast semaphore is only used to issue a wake_up call).<br />

Signal_fsem may be called also from interrupt and timer-interrupt processes, but<br />

it is an error to cause a remote system call while doing so, i.e. an interrupt or<br />

timer-interrupt process may not access a fast semaphore in another CPU.<br />

set_fsem, wait_fsem, get_fsem<br />

Implementation Not implemented at lev<strong>el</strong> A. Full performance from lev<strong>el</strong> B.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

extern PROCESS proc_;<br />

OS_PROCESS(my_process)<br />

{<br />

for(;;)<br />

{<br />

/* Code */<br />

signal_fsem(proc_);<br />

/* Code */<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 113<br />

signal_fsem


signal_sem<br />

Syntax<br />

Description<br />

void signal_sem (SEMAPHORE *sem);<br />

Increments the value of the specified semaphore and r<strong>el</strong>eases the first process<br />

waiting at the semaphore.<br />

Include files #include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

Parameters sem A pointer to the semaphore to be signalled.<br />

Return value None.<br />

Restrictions<br />

See also<br />

It is illegal to cause a semaphore to wrap from high positive numbers to a negative<br />

value.<br />

wait_sem, get_sem, create_sem, kill_sem<br />

Implementation Not implemented at lev<strong>el</strong> A. Full performance from lev<strong>el</strong> B.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

extern SEMAPHORE *sem;<br />

<strong>Kern</strong><strong>el</strong><br />

OS_PROCESS(my_process)<br />

{<br />

for(;;)<br />

{<br />

/* Code */<br />

signal_sem(sem);<br />

/* Code */<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 114<br />

signal_sem


start<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

Description<br />

void start (PROCESS pid);<br />

Starts a previously stopped or newly created block or process.<br />

The kern<strong>el</strong> keeps a record of how many times each process has been stopped. A<br />

process is allowed to execute again only when the same number of start calls have<br />

been issued.<br />

Each new process must be started to enable execution.<br />

Starting a block is equivalent to issuing a start call to each of the processes<br />

contained in the block. It is important that no process is started individually before<br />

the block is started, since starting a process twice is illegal.<br />

Starting a timer-interrupt process means that it from now on will be scheduled to<br />

run at its specified time interval.<br />

Include files #include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

Parameters pid The ID of the block or process to start.<br />

Return value None.<br />

Restrictions<br />

See also<br />

Only prioritized, background and timer-interrupt processes can be stopped. The<br />

start and stop calls have no effect on process types that can not be stopped.<br />

Starting a process that is not stopped is illegal. (It is illegal to start a process more<br />

times than it was stopped.)<br />

This implies that it is always illegal to start the current process or the current<br />

block.<br />

Start may be called also from interrupt and timer-interrupt processes, but it is an<br />

error to cause a remote system call while doing so, i.e. an interrupt or timerinterrupt<br />

process may not start a process in another CPU, and the kern<strong>el</strong> ignores<br />

any attempt to do so.<br />

stop, create_process<br />

Implementation Not implemented at lev<strong>el</strong> A. Full performance from lev<strong>el</strong> B.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

OSENTRYPOINT new_process;<br />

OS_PROCESS(my_process)<br />

{<br />

PROCESS proc1_;<br />

PROCESS proc2_;<br />

PROCESS block_;<br />

for(;;)<br />

{<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 115<br />

start


<strong>Kern</strong><strong>el</strong><br />

}<br />

}<br />

proc1_ = create_process(OS_PRI_PROC,<br />

"proc1",<br />

new_process,<br />

200,<br />

16,<br />

(OSTIME) 0,<br />

(PROCESS) 0,<br />

(struct OS_redir_entry *) NULL,<br />

(OSVECTOR) 0,<br />

(OSUSER) 0);<br />

start(proc1_);<br />

block_ = create_block("block",<br />

(OSUSER) 0,<br />

(OSBOOLEAN) 0,<br />

(PROCESS) 0,<br />

(OSBOOLEAN) 0);<br />

proc2_ = create_process(OS_PRI_PROC,<br />

"proc2",<br />

new_process,<br />

200,<br />

16,<br />

(OSTIME) 0,<br />

block_,<br />

(struct OS_redir_entry *) NULL,<br />

(OSVECTOR) 0,<br />

(OSUSER) 0);<br />

start(block_);<br />

/* Code */<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 116<br />

start


start_OSE<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

Description<br />

Include files<br />

Parameters<br />

Return value<br />

Restrictions<br />

void start_OSE (void);<br />

This function works in two ways.<br />

start_OSE is called during system start to create the kern<strong>el</strong> and initialize kern<strong>el</strong><br />

structures.<br />

This function does not return to the caller since the kern<strong>el</strong> replaces the caller's<br />

program.<br />

start_OSE is also called by the main process for each separat<strong>el</strong>y linked OSE unit<br />

to create the static blocks and processes contained in that unit.<br />

The main process does not return. It waits in the interface library for any static<br />

process to die, and then kills all blocks in the unit. This behaviour r<strong>el</strong>ies on the<br />

convention that program loaders keep track of the main process, and kill the<br />

memory segment when the main process dies. Other conventions are possible and<br />

may appear in certain systems.<br />

It might be possible to restert the system by calling start_OSE in a running<br />

system.<br />

#include "ose.h"<br />

None.<br />

None.<br />

<strong>Kern</strong><strong>el</strong>s that do not support user initiated system start need not provide the<br />

start_OSE call.<br />

The start_OSE call is not available to interrupt processes.<br />

Implementation Not implemented at lev<strong>el</strong> A. Full performance from lev<strong>el</strong> B.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

int main()<br />

{<br />

/* Code, initialisation etc. */<br />

start_OSE();<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 117<br />

start_OSE


stop<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

Description<br />

void stop (PROCESS pid);<br />

Suspends the execution of a single process or all processes in a block.<br />

It is legal to stop a process any (reasonable) number of times.<br />

The kern<strong>el</strong> keeps a record of how many times each process has been stopped. A<br />

process is allowed to execute again only when the same number of start calls have<br />

been issued.<br />

Stopping a block is equivalent to issuing a stop call to each of the processes<br />

contained in the block.<br />

Stopping a timer-interrupt process means that it will no longer be scheduled to<br />

run at its specified time interval.<br />

Include files #include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

Parameters pid The ID of the block or process to stop.<br />

Return value None.<br />

Restrictions<br />

See also<br />

Only prioritized, background and timer-interrupt processes can be stopped. The<br />

start and stop calls have no effect on process types that can not be stopped.<br />

Stop may be called also from interrupt and timer-interrupt processes, but it is an<br />

error to cause a remote system call while doing so, i.e. an interrupt or timerinterrupt<br />

process may not stop a process in another CPU, and the kern<strong>el</strong> ignores<br />

any attempt to do so.<br />

Note that a timer-interrupt process will continue to execute until its end, even after<br />

issuing a stop(current_process()), but it will no longer be scheduled to run at its<br />

specified time interval.<br />

start<br />

Implementation Not implemented at lev<strong>el</strong> A. Full performance from lev<strong>el</strong> B.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

extern PROCESS proc_;<br />

OS_PROCESS(my_process)<br />

{<br />

for(;;)<br />

{<br />

stop(proc_);<br />

/* Code */<br />

start(proc_);<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 118<br />

stop


system_tick<br />

Syntax<br />

Description<br />

Include files<br />

Parameters<br />

Return value<br />

Restrictions<br />

See also<br />

OSTIME system_tick (void);<br />

Returns the system tick length in microseconds.<br />

#include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

None.<br />

Returns the number of microseconds per system tick.<br />

This call r<strong>el</strong>ies on the tick system call being issued at intervals corresponding to<br />

the system tick length configured into the kern<strong>el</strong>. This can not be ensured by the<br />

kern<strong>el</strong> its<strong>el</strong>f.<br />

SYSTEM_TICK, tick<br />

Implementation Not implemented at lev<strong>el</strong> A. Full performance from lev<strong>el</strong> B.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

<strong>Kern</strong><strong>el</strong><br />

OS_PROCESS(my_process)<br />

{<br />

unsigned int tick;<br />

for(;;)<br />

{<br />

/* Code */<br />

tick = system_tick();<br />

/* Code */<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 119<br />

system_tick


tick<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

Description<br />

Include files<br />

Parameters<br />

Return value<br />

Restrictions<br />

void tick (void);<br />

This call advances the system clock.<br />

The system tick counter is advanced, timer-interrupt processes are invoked,<br />

process timeslices and timeouts requested by calls to d<strong>el</strong>ay, receive_w_tmo et al.<br />

are managed.<br />

Timer-interrupt processes are run at the priority of the calling interrupt process,<br />

or at a priority immediat<strong>el</strong>y b<strong>el</strong>ow interrupt processes if tick was called from a<br />

prioritized process.<br />

#include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

None.<br />

None.<br />

Tick should be called periodically at intervals that match the value returned by<br />

system_tick ().<br />

Tick may not be called from a timer-interrupt process.<br />

Tick may only be called from a superuser process executing in supervisor space.<br />

The tick system call is not re-entrant. Only one process in the system may call<br />

tick.<br />

It may be required to the state the type of the calling process and hardware<br />

priority in the kern<strong>el</strong> configuration file.Wakeup calls may otherwise be hard to<br />

implement.<br />

<strong>Kern</strong><strong>el</strong>s with built in timer management need not provide the tick system call.<br />

Implementation Not implemented at lev<strong>el</strong> A, but the kern<strong>el</strong> is still required lev<strong>el</strong>sto manage the<br />

system timer in some fashion. Full<br />

performance from lev<strong>el</strong> B.<br />

Example<br />

#include "ose.h"<br />

OS_PROCESS(ticker)<br />

{<br />

if(wake_up()) /* This is an interrupt process */<br />

{ /* used as a timer. */<br />

tick(); /* Its only function is to run the */<br />

} /* system clock. */<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 120<br />

tick


wait_fsem<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

void wait_fsem (OSFSEMVAL count);<br />

Description Waits at the fast semaphore associated with the caller.<br />

The semaphore value is decreased by the specified amount. If the result is<br />

negative, the caller is suspended until some other process has issued enough<br />

signal_fsem calls for the value to become non-negative.<br />

Include files #include "ose.h"<br />

Parameters count The number to decrease the fast semaphore with.<br />

Return value None.<br />

Restrictions The wait_fsem call is not available to interrupt processes, but fast semaphores<br />

may still be used in a limited fashion to wake up interrupt processes from<br />

prioritized processes.<br />

This may be used for instance to start a sequence that is mainly interrupt driven,<br />

such as transmitting a string of characters to some serial port.<br />

See also signal_fsem, get_fsem, set_fsem<br />

Implementation Not implemented at lev<strong>el</strong> A. Full performance from lev<strong>el</strong> B.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

OS_PROCESS(my_process)<br />

{<br />

for(;;)<br />

{<br />

/* Code */<br />

wait_fsem((OSFSEMVAL) 1);<br />

/* Code */<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 121<br />

wait_fsem


wait_sem<br />

Syntax<br />

void wait_sem (SEMAPHORE *sem);<br />

Description The caller waits at the specified semaphore structure.<br />

The semaphore value is decremented. If the result is negative, the caller is<br />

suspended and queued at the end of the semaphore queue.<br />

Each time some other process signals the semaphore, the value is incremented and<br />

the first process queued at the semaphore is r<strong>el</strong>eased.<br />

Include files #include "ose.h"<br />

Parameters sem A pointer to the semaphore.<br />

Return value None.<br />

Restrictions The wait_sem call is not available to interrupt processes.<br />

See also signal_sem, get_sem, create_sem, kill_sem<br />

Implementation Not implemented at lev<strong>el</strong> A. Full performance from lev<strong>el</strong> B.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

SEMAPHORE *sem;<br />

<strong>Kern</strong><strong>el</strong><br />

OS_PROCESS(my_process)<br />

{<br />

for(;;)<br />

{<br />

/* Code */<br />

wait_sem(sem);<br />

/* Code */<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 122<br />

wait_sem


wake_up<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

Description<br />

Include files<br />

Parameters<br />

Return value<br />

int wake_up (void);<br />

An interrupt process can be invoked in two ways; either by a hardware interrupt<br />

or by a software event. In both cases the interrupt process is invoked with<br />

interrupts disabled up to and including the hardware priority assigned to the<br />

interrupt process.<br />

The wake_up system call informs the interrupt process of the way in which it was<br />

invoked. This is useful because receive calls are fairly expensive and can often not<br />

be afforded at each hardware interrupt.<br />

Software events that cause interrupt processes to be invoked are signal<br />

transmissions to an interrupt process and signal_fsem calls specifying an interrupt<br />

process.<br />

Hardware interrupts are d<strong>el</strong>ayed until the wake_up call has completed.<br />

#include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

None.<br />

Returns 0 (zero) if the interrupt process was invoked by a hardware interrupt.<br />

Returns 1 (one) if the interrupt process was invoked by a signal sent to it. The<br />

signal is ready to be fetched with a receive call.<br />

Returns 2 if the interrupt process was invoked in response to a signal_fsem call<br />

issued by some other process. (The value of the fast semaphore is not important<br />

and can not be read with the get_fsem system call.)<br />

If called by a process of a type other than an interrupt process, the wake_up<br />

function returns 1 (one).<br />

Restrictions Some processors can not accept a simulated interrupt call.<br />

On these processors it may not be possible to implement the wake_up feature, or<br />

there may be some restrictions. A common problem is that nested interrupts must<br />

be disabled while a wake_up call is in progress.<br />

Implementation Not implemented at lev<strong>el</strong> A. Full performance from lev<strong>el</strong> B.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

union SIGNAL<br />

{<br />

SIGSELECT sig_no;<br />

};<br />

OS_PROCESS(my_interrupt_process)<br />

{<br />

static const SIGSELECT all[] = {0};<br />

union SIGNAL *sig;<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 123<br />

wake_up


switch(wake_up())<br />

{<br />

case 0:<br />

/* hardware interrupt invoked the interrupt<br />

* process<br />

*/<br />

break;<br />

case 1:<br />

/* A signal sent to this process caused the wake_up */<br />

sig = receive((SIGSELECT *)all);<br />

free_buf(&sig);<br />

break;<br />

case 2:<br />

/* signal_fsem() on this process caused the wake_up */<br />

break;<br />

default:<br />

/* this is an error */<br />

}<br />

}<br />

<strong>Kern</strong><strong>el</strong><br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 124<br />

wake_up


NIL<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

Description<br />

Include files<br />

Return value<br />

Restrictions<br />

#define NIL<br />

NIL is a manifest constant defined by the kern<strong>el</strong>. It is defined in ose.h and in<br />

ose_i.h.<br />

NIL is the value returned from receive, receive_w_tmo and receive_from when no<br />

signal buffer could be received.<br />

NIL is stored in the caller's signal pointer by the send, send_w_s and free_buf<br />

system calls.<br />

NIL is not equivalent to NULL, and should be used only to test on received<br />

buffers.<br />

#include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

None.<br />

NIL is specified such that it is never confused with a legal signal pointer.<br />

Furthermore, it is an advantage if NIL points to a valid scratchpad area. This<br />

enables the kern<strong>el</strong> to correctly report several user errors that would otherwise lead<br />

to bus error or memory parity error.<br />

Implementation Full performance at all implementation lev<strong>el</strong>s.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

static const SIGSELECT any_sig[] = {0};<br />

union SIGNAL<br />

{<br />

SIGSELECT sig_no;<br />

};<br />

OS_PROCESS(my_process)<br />

{<br />

union SIGNAL *sig;<br />

for(;;)<br />

{<br />

sig = receive_w_tmo(1000, (SIGSELECT *)any_sig);<br />

if(sig != NIL)<br />

{<br />

/* Code */<br />

free_buf(&sig);<br />

}<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 125<br />

NIL


OS68<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

Description<br />

Include files<br />

Return value<br />

Restrictions<br />

See also<br />

#define OS68<br />

A CPU dependent manifest constant of similar layout is defined by the header<br />

files ose.h and ose_i.h.<br />

The value of this constant is unimportant. It is intended for use in an #ifdef or<br />

#ifndef statement.<br />

It may be used by an application or an OSE system simulator to determine which<br />

operating system is currently in use.<br />

softOSE means a that the OSE system is a soft kern<strong>el</strong>.<br />

OSPP means OSE for any PowerPC CPU.<br />

OS68 means OSE for any Motorola 68k CPU,<br />

OS88 means OSE for the Motorola 88000 CPU,<br />

OS11 means OSE for the Motorola 68HC11 CPU, etc.<br />

#include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

None.<br />

None.<br />

OSE_I, OSE<br />

Implementation Full performance at all implementation lev<strong>el</strong>s.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

OSPROCESS(my_process)<br />

{<br />

for(;;)<br />

{<br />

#ifdef OS68<br />

/* Code */<br />

#<strong>el</strong>se<br />

/* Code */<br />

#endif<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 126<br />

OS68


OS_ATTACH_SIG<br />

Syntax #define OS_ATTACH_SIG 252<br />

Description<br />

Include files<br />

Return value<br />

Restrictions<br />

See also<br />

A manifest constant defining the signal number of the default signal created by<br />

the attach system call when invoked with a signal pointer set to NULL.<br />

It is defined in the header files ose.h and ose_i.h.<br />

It may be used by an application to determine if such a signal was received.<br />

The value of this constant is always 252.<br />

#include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

None.<br />

None.<br />

attach, detach<br />

Implementation Full performance at all implementation lev<strong>el</strong>s.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

<strong>Kern</strong><strong>el</strong><br />

static const SIGSELECT any_sig[] = {0};<br />

union SIGNAL<br />

{<br />

SIGSELECT sig_no;<br />

};<br />

OS_PROCESS(my_process)<br />

{<br />

union SIGNAL *sig;<br />

for(;;)<br />

{<br />

sig = receive((SIGSELECT *) any_sig);<br />

switch(sig->sig_no)<br />

{<br />

case OSATTACH_SIG:<br />

/* Code */<br />

break;<br />

default:<br />

/* Code */<br />

}<br />

free_buf(&sig);<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 127<br />

OS_ATTACH_SIG


OS_DEBUG<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

Description<br />

Include files<br />

Return value<br />

Restrictions<br />

See also<br />

#define OS_DEBUG<br />

This manifest constant may be defined by the user to enable reporting of file and<br />

line information and CPU registers to the debugger.<br />

The value of this constant is unimportant. It is intended for use in an #ifdef or<br />

#ifndef statement.<br />

The constant affects the header files ose.h, ose_i.h.<br />

OS_DEBUG is typically defined on the compiler command line to enable file and<br />

line information and CPU registers in a specific module.<br />

#include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

None.<br />

OS_DEBUG must be defined before any OSE header is included.<br />

File and line information, as w<strong>el</strong>l as CPU register information, is optional to the<br />

OSE implementation. This means that some implementations lack all or parts of<br />

this information.<br />

get_pcb<br />

Implementation Full performance at all implementation lev<strong>el</strong>s.<br />

lev<strong>el</strong>s<br />

Example<br />

The typical way to define the constant is as a compiler directive, for instance in a make file as<br />

follows:<br />

CFLAGS= -c -g -Wall -ansi -pedantic -DOS_DEBUG -I.<br />

It may also be declared in a define statement:<br />

#define OS_DEBUG<br />

#include "ose.h"<br />

OSPROCESS(my_process)<br />

{<br />

for(;;)<br />

{<br />

#ifdef OS_DEBUG<br />

/* Code */<br />

#<strong>el</strong>se<br />

/* Code */<br />

#endif<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 128<br />

OS_DEBUG


OSE<br />

Syntax<br />

Description<br />

Include files<br />

Return value<br />

Restrictions<br />

See also<br />

#define OSE<br />

This manifest constant is defined by ose.h.<br />

The value of this constant is unimportant. It is intended for use in an #ifdef or<br />

#ifndef statement.<br />

It may be used by an application or an OSE system simulator to find out which<br />

OSE header file is being used.<br />

#include "ose.h"<br />

None.<br />

The OSE manifest constant is not available to interrupt processes.<br />

OSE_I, OS68<br />

Implementation Full performance at all implementation lev<strong>el</strong>s.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

<strong>Kern</strong><strong>el</strong><br />

OS_PROCESS(my_process)<br />

{<br />

#ifdef OSE<br />

for(;;)<br />

{<br />

/* Code, "I am a prioritized process" */<br />

}<br />

#<strong>el</strong>se<br />

if(wake_up())<br />

{<br />

/* Code, "I am an interrupt process" */<br />

}<br />

#endif<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 129<br />

OSE


OSE_LEVEL_x<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

#define OSE_LEVEL_B<br />

#define OSE_LEVEL_C<br />

#define OSE_LEVEL_D<br />

Description These manifest constants are defined in ose.h and ose_i.h.<br />

They may be used by an application or an OSE system simulator to find out the<br />

functional lev<strong>el</strong> of the kern<strong>el</strong> used.<br />

Each constant represents a fully supported OSE implementation lev<strong>el</strong>.<br />

OSE_LEVEL_B is defined if at least lev<strong>el</strong> B is supported.<br />

OSE_LEVEL_C is defined if at least lev<strong>el</strong> C is supported.<br />

OSE_LEVEL_D is defined if lev<strong>el</strong> D is supported.<br />

The values of the constants are unimportant. They are intended for use in #ifdef<br />

or #ifndef statements.<br />

All constants b<strong>el</strong>ow the actual implementation lev<strong>el</strong> are defined. For instance, a<br />

lev<strong>el</strong> C implementation defines both OSE_LEVEL_B and OSE_LEVEL_C, but<br />

not OSE_LEVEL_D.<br />

Include files #include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

Return value None.<br />

Restrictions None.<br />

Implementation Full performance at all implementation lev<strong>el</strong>s.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

OS_PROCESS(my_process)<br />

{<br />

for(;;)<br />

{<br />

#ifdef OSE_LEVEL_B<br />

/* Code */<br />

#endif<br />

#ifdef OSE_LEVEL_C<br />

/* Code */<br />

#endif<br />

#ifdef OSE_LEVEL_D<br />

/* Code */<br />

#endif<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 130<br />

OSE_LEVEL_x


OSE_I<br />

Syntax<br />

Description<br />

Include files<br />

Return value<br />

Restrictions<br />

See also<br />

#define OSE_I<br />

Same as OSE, but defined in ose_i.h.<br />

#include "ose_i.h"<br />

None.<br />

The OSE_I manifest constant is only available to interrupt processes.<br />

OSE, OS68<br />

Implementation Full performance at all implementation lev<strong>el</strong>s.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose_i.h"<br />

<strong>Kern</strong><strong>el</strong><br />

OS_PROCESS(my_process)<br />

{<br />

for(;;)<br />

{<br />

#ifdef OSE_I<br />

if(wake_up())<br />

{<br />

/* Code, "I am an interrupt process" */<br />

}<br />

#<strong>el</strong>se<br />

for(;;)<br />

{<br />

/* Code, "I am a prioritized process" */<br />

}<br />

#endif<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 131<br />

OSE_I


OS_PROCESS<br />

Syntax<br />

#define OS_PROCESS (name)<br />

Description This macro should be used to define the entrypoint of a process.<br />

It is defined in ose.h and ose_i.h.<br />

Various OSE implementations use this macro in different ways.<br />

It is wise to assume that OS_PROCESS is differently defined in ose.h and ose_i.h,<br />

even if this is not normally the case.<br />

Include files #include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

Return value None.<br />

Restrictions None.<br />

Implementation Full performance at all implementation lev<strong>el</strong>s.<br />

lev<strong>el</strong>s<br />

Example<br />

#include "ose.h"<br />

<strong>Kern</strong><strong>el</strong><br />

OS_PROCESS(my_process)<br />

{<br />

for(;;)<br />

{<br />

/* Code */<br />

}<br />

}<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 132<br />

OS_PROCESS


OSSIM<br />

<strong>Kern</strong><strong>el</strong><br />

Syntax<br />

#define OSSIM<br />

Description The user should define this manifest constant when compiling a process for use<br />

in the OSE system simulator.<br />

The value of this constant is unimportant. It is intended for use in an #ifdef or<br />

#ifndef statement.<br />

The header files ose.h and ose_i.h test on this constant and replace thems<strong>el</strong>ves<br />

with ossim.h if OSSIM is defined. ossim.h is part of the OSE simulator.<br />

The header file ose_mmu.h test on this constant and replaces its<strong>el</strong>f with<br />

sim_mmu.h if OSSIM is defined. The file sim_mmu.h is part of the OSE<br />

simulator.<br />

The constants OSE, OSE_I and OS68 are defined before the test on OSSIM, so<br />

these constants can be interrogated by ossim.h.<br />

It may sometimes be desirable to test on OSSIM in user programs too. For<br />

instance one may wish to remove target dependent code that can not cooperate<br />

with the OSE simulator.<br />

Include files #include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

Return value None.<br />

Restrictions OSSIM must be defined before any OSE header is included.<br />

Implementation Full performance at all implementation lev<strong>el</strong>s.<br />

lev<strong>el</strong>s<br />

Example<br />

The most common way to use OSSIM is as a flag in a make file as in example 1.<br />

It can then be used in the application code as in example 2.<br />

Example 1<br />

CFLAGS= -c -g -Wall -ansi -pedantic -DOSSIM -I./<br />

#generalized rules<br />

.c.o:<br />

gcc $(CFLAGS) -o $@ $<<br />

# the makefile continues<br />

Example 2<br />

#include "ose.h"<br />

OS_PROCESS(my_process)<br />

{<br />

for(;;)<br />

{<br />

/* Code */<br />

#ifdef OSSIM<br />

/* Code */<br />

#<strong>el</strong>se<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 133<br />

OSSIM


#endif<br />

}<br />

}<br />

/* Code that is target dependent and can not run<br />

* in the simulator.<br />

*/<br />

/* Code */<br />

<strong>Kern</strong><strong>el</strong><br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 134<br />

OSSIM


SYSTEM_TICK<br />

Syntax<br />

#define SYSTEM_TICK (1000L)<br />

Description This manifest constant is always 1000L.<br />

It is present only for compatibility with old OSE kern<strong>el</strong>s (it should not be used<br />

when writing applications for OSE), where the d<strong>el</strong>ay and receive_w_tmo calls<br />

specify timeout in number of system ticks instead of in number of milliseconds.<br />

An old way of saying "d<strong>el</strong>ay 50 milliseconds" is:<br />

d<strong>el</strong>ay((OSTIME) ((50 * 1000L) / SYSTEM_TICK));<br />

<strong>Kern</strong><strong>el</strong><br />

This design also works with new OSE versions since the SYSTEM_TICK<br />

constant balances the expression.<br />

(It is, of course, more efficient to calculate the expression in advance and save the<br />

result for repeated use.)<br />

Include files #include "ose.h"<br />

or<br />

#include "ose_i.h"<br />

Return value None.<br />

Restrictions None.<br />

See also system_tick, d<strong>el</strong>ay, receive_w_tmo<br />

Implementation Full performance at all implementation lev<strong>el</strong>s.<br />

lev<strong>el</strong>s<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 3 : 135<br />

SYSTEM_TICK


4 User Interface<br />

4.1 Header Files<br />

The user interface to OSE is defined in a number of C header files, which should be included in an<br />

OSE application.<br />

These files are not affected by OSE kern<strong>el</strong> and interface library reconfiguration, even if the headers<br />

are sometimes produced by a configuration program.<br />

Header behaviour may be affected by manifest constants defined at compile time. In particular, the<br />

OS_DEBUG constant affects debugger support, and the OSSIM constant indicates that code should<br />

be produced for an OSE simulator session.<br />

Headers conform to ANSI recommendations, i.e. they use ANSI prototypes and may be included<br />

any number of times in any order.<br />

Internal OSE symbols begin with the string "zz" or "ZZ". Such symbols along with the names of all<br />

system calls, types, tags of enumerated types, macros and manifest constants are reserved by OSE.<br />

Many types begin with the letters "OS" or "ose_", so it is wise to avoid such symbols when writing<br />

an application.<br />

<strong>Kern</strong><strong>el</strong><br />

The following standard headers define the OSE interface:<br />

ose.h<br />

System calls for prioritized processes and background processes. This header is used in most<br />

applications.<br />

ose_i.h<br />

System calls for interrupt processes and timer-interrupt processes. This header is used in most<br />

applications.<br />

ose_rem.h<br />

Remote call format for link handlers. This is actually a signal definition file. This header requires<br />

ose.h and will not work with ose_i.h. This header is used only in link handlers and remote call<br />

servers.<br />

ose_mmu.h<br />

Prototypes for functions that must be provided by user-written memory management software. This<br />

header file defines the functions attach_block, s<strong>el</strong>ect_segment, set_segment_mode and mem_move.<br />

See also the detailed system call description for these calls. Using the ose_mmu header requires<br />

ose.h to be included as w<strong>el</strong>l. It will not work with ose_i.h. This header is used only in memory<br />

management software and the header is therefore present only in lev<strong>el</strong> C and D implementations.<br />

ose_err.h<br />

Error code definitions for error handlers. This header is used only in error handlers and defines<br />

symbolically the error codes provided by the OSE kern<strong>el</strong> when the kern<strong>el</strong> detects an error.<br />

When using these files the "union SIGNAL" type must be defined. This must be done after the<br />

header files have been included and the union must consist of all signals used in the particular file.<br />

For a more detailed description refer to the section on OSE Data Types.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 4 : 1<br />

User Interface


ose.h, ose_i.h and ose_mmu.h test on the manifest constant OSSIM. This constant causes the<br />

headers ose.h and ose_i.h to replace thems<strong>el</strong>ves with ossim.h, and ose_mmu.h to replace its<strong>el</strong>f with<br />

sim_mmu.h.<br />

Many OSE system calls are in fact implemented as macros. This means that when writing an<br />

application it is important to be aware of this since it results in limitations on how system calls can<br />

be used.<br />

<strong>Kern</strong><strong>el</strong><br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 4 : 2<br />

User Interface


4.2 Data Types<br />

The header files described in the Header files section contain several type definitions. These types<br />

are introduced to allow reasonable portability between various OSE implementations.<br />

The following types are the most important:<br />

• union SIGNAL<br />

• SIGSELECT<br />

• PROCESS.<br />

All types except unions, structures and the SEMAPHORE type, which is a typedef for the semaphore<br />

structure, are simple types. This means that in an application variables of these types can be<br />

compared saf<strong>el</strong>y against each other for numerical equality.<br />

The types OSSEMVAL and OSFSEMVAL are signed. Other types are unsigned.<br />

When writing an application it is necessary to declare the “union SIGNAL” type and this must be<br />

done after including the ose.h header file. All signals that are used in a file must be part of the union<br />

signal declaration in that particular file. This is done in the following way:<br />

#include "ose.h"<br />

#include "signals.sig"<br />

<strong>Kern</strong><strong>el</strong><br />

union SIGNAL<br />

{<br />

SIGSELECT<br />

struct First<br />

struct Testsignal<br />

};<br />

sig_no;<br />

first;<br />

testsignal;<br />

The sig_no variable must always be part of the union. Signal structures may also be included if they<br />

are used, preferably declared in a header file which is included. The signal structure must contain<br />

the signal number but it may also contain other variables. A declaration of a signal structure can<br />

look like this:<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 4 : 3<br />

User Interface


#define FIRST 1<br />

struct First<br />

{<br />

SIGSELECT sig_no;<br />

/* Here, other data can be declared if desirable<br />

* for instance: char data;<br />

*/<br />

};<br />

<strong>Kern</strong><strong>el</strong><br />

The following is a list of types with usage information:<br />

Type<br />

Usage<br />

union SIGNAL<br />

A signal structure<br />

SIGSELECT<br />

A signal number<br />

PROCESS<br />

A process ID<br />

OSBUFSIZE<br />

The number of bytes in a signal<br />

OSPRIORITY<br />

A process priority<br />

OSUSER<br />

A user number<br />

OSFSEMVAL<br />

A fast semaphore value<br />

OSSEMVAL<br />

A semaphore value<br />

OSSERCODE<br />

Information passed to error()<br />

OSADDRESS<br />

A memory address<br />

OSENTRYPOINT<br />

A process entrypoint<br />

OSTIME<br />

Used by d<strong>el</strong>ay() and similar<br />

OSTICK<br />

Returned from get_ticks()<br />

OSVECTOR<br />

An interrupt vector number<br />

SEMAPHORE<br />

A semaphore structure<br />

OSBOOLEAN<br />

A binary flag<br />

OSSEGMENT<br />

A segment ID used by MMU<br />

OSATTREF<br />

An attach reference ID<br />

OSERRH<br />

An error handler entrypoint<br />

enum PROCESS_TYPE The type of a process<br />

enum PROCESS_STATUS The status of a process<br />

struct semaphore<br />

A semaphore fi<strong>el</strong>d<br />

struct OS_redir_entry A redirection table fi<strong>el</strong>d<br />

struct OS_pid_list<br />

A process ID list<br />

struct OS_pcb<br />

Misc<strong>el</strong>laneous process information<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 4 : 4<br />

User Interface


5 Remote System Calls<br />

There are a number of system calls that may operate on blocks and processes in other CPUs. If a<br />

process issues one of these calls to a process not present in the same CPU, the OSE kern<strong>el</strong> translates<br />

the system call into a remote system call. Remote system calls are signal transactions which are<br />

executed by the OSE kern<strong>el</strong>. The OSE kern<strong>el</strong> sends a remote_call signal to the remote call server<br />

attached to the specified process (usually a phantom process). This remote call server is often a link<br />

handler.<br />

<strong>Kern</strong><strong>el</strong><br />

5.1 Signal Definitions<br />

The OSE kern<strong>el</strong> defines three signals for remote calls; remote_call, remote_response and<br />

remote_canc<strong>el</strong>.<br />

Each system call consists of a remote_call signal in the forward direction, and either a<br />

remote_response or a remote_canc<strong>el</strong> signal in the return direction. In the remote_response signal the<br />

response is returned from the remote call server to OSE.<br />

A remote_canc<strong>el</strong> signal may be returned if the remote call server cannot execute the remote system<br />

call. In that case OSE aborts the system call and produces a reasonable dummy result. Valid reasons<br />

for this are if the contact with the remote system is lost or if the requested system call is not<br />

recognized by the remote call server.<br />

These signals and associated unions and manifest constants are defined in the header file ose_rem.h.<br />

The signal numbers for these three signals are reserved and should not be used for any other purpose<br />

by a link handler.<br />

The call_type fi<strong>el</strong>d in the remote_call and remote_response signals indicates which system call is<br />

being executed. It is also used to s<strong>el</strong>ect members of the remote_calls and remote_responses unions<br />

respectiv<strong>el</strong>y.<br />

When these signals are propagated to a foreign system on the network, they should be transformed<br />

to a set of packets specified at byte lev<strong>el</strong> to support transmission between systems with different byte<br />

order and type conventions. OSE ensures that signal buffers received by a link handler can be used<br />

without reallocation to return responses for the same system call. This is true for all system calls<br />

except those with variable size responses.<br />

The three signal structures are listed b<strong>el</strong>ow:<br />

#define REMOTE_CALL (255)<br />

struct remote_call<br />

{<br />

SIGSELECT sig_no;<br />

OSCALLTYPE call_type;<br />

union remote_calls params;<br />

};<br />

#define REMOTE_RESPONSE (254)<br />

struct remote_response<br />

{<br />

SIGSELECT sig_no;<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 5 : 1<br />

Remote System Calls


OSCALLTYPE call_type;<br />

union remote_responses results;<br />

};<br />

#define REMOTE_CANCEL (253)<br />

struct remote_canc<strong>el</strong><br />

{<br />

SIGSELECT sig_no;<br />

};<br />

The remote_calls and remote _responses unions are listed b<strong>el</strong>ow:<br />

<strong>Kern</strong><strong>el</strong><br />

union remote_calls<br />

{<br />

struct rem_clear_bp rem_clear_bp;<br />

struct rem_create_error_handler rem_create_error_handler;<br />

struct rem_flush rem_flush;<br />

struct rem_get_cpu rem_get_cpu;<br />

struct rem_get_env rem_get_env;<br />

struct rem_get_env_list rem_get_env_list;<br />

struct rem_get_fsem rem_get_fsem;<br />

struct rem_get_mem rem_get_mem;<br />

struct rem_get_pcb rem_get_pcb;<br />

struct rem_get_pid_list rem_get_pid_list;<br />

struct rem_get_pri rem_get_pri;<br />

struct rem_get_signal rem_get_signal;<br />

struct rem_get_uid rem_get_uid;<br />

struct rem_hunt rem_hunt;<br />

struct rem_intercept rem_intercept;<br />

struct rem_resume rem_resume;<br />

struct rem_set_bp rem_set_bp;<br />

struct rem_set_env rem_set_env;<br />

struct rem_set_fsem rem_set_fsem;<br />

struct rem_set_mem rem_set_mem;<br />

struct rem_set_pcb rem_set_pcb;<br />

struct rem_signal_fsem rem_signal_fsem;<br />

struct rem_start rem_start;<br />

struct rem_stop rem_stop;<br />

};<br />

union remote_responses<br />

{<br />

struct remr_clear_bp remr_clear_bp;<br />

struct remr_create_error_handler remr_create_error_handler;<br />

struct remr_get_cpu remr_get_cpu;<br />

struct remr_get_env remr_get_env;<br />

struct remr_get_env_list remr_get_env_list;<br />

struct remr_get_fsem remr_get_fsem;<br />

struct remr_get_mem remr_get_mem;<br />

struct remr_get_pcb remr_get_pcb;<br />

struct remr_get_pid_list remr_get_pid_list;<br />

struct remr_get_pri remr_get_pri;<br />

struct remr_get_signal remr_get_signal;<br />

struct remr_get_uid remr_get_uid;<br />

struct remr_hunt remr_hunt;<br />

struct remr_set_bp remr_set_bp;<br />

struct remr_set_env remr_set_env;<br />

struct remr_set_mem remr_set_mem;<br />

struct remr_set_pcb remr_set_pcb;<br />

};<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 5 : 2<br />

Remote System Calls


The call_type fi<strong>el</strong>d contains one of the following values<br />

#define REM_CLEAR_BP 1<br />

#define REM_CREATE_ERROR_HANDLER 2<br />

#define REM_FLUSH 3<br />

#define REM_GET_CPU 4<br />

#define REM_GET_ENV 5<br />

#define REM_GET_ENV_LIST 6<br />

#define REM_GET_FSEM 7<br />

#define REM_GET_MEM 8<br />

#define REM_GET_PCB 9<br />

#define REM_GET_PID_LIST 10<br />

#define REM_GET_PRI 11<br />

#define REM_GET_SIGNAL 12<br />

#define REM_GET_UID 13<br />

#define REM_HUNT 14<br />

#define REM_INTERCEPT 15<br />

#define REM_RESUME 16<br />

#define REM_SET_BP 17<br />

#define REM_SET_ENV 18<br />

#define REM_SET_FSEM 19<br />

#define REM_SET_MEM 20<br />

#define REM_SIGNAL_FSEM 21<br />

#define REM_START 22<br />

#define REM_STOP 23<br />

#define REM_SET_PCB 24<br />

<strong>Kern</strong><strong>el</strong><br />

#define REMR_CLEAR_BP 1<br />

#define REMR_CREATE_ERROR_HANDLER 2<br />

#define REMR_FLUSH 3<br />

#define REMR_GET_CPU 4<br />

#define REMR_GET_ENV 5<br />

#define REMR_GET_ENV_LIST 6<br />

#define REMR_GET_FSEM 7<br />

#define REMR_GET_MEM 8<br />

#define REMR_GET_PCB 9<br />

#define REMR_GET_PID_LIST 10<br />

#define REMR_GET_PRI 11<br />

#define REMR_GET_SIGNAL 12<br />

#define REMR_GET_UID 13<br />

#define REMR_HUNT 14<br />

#define REMR_INTERCEPT 15<br />

#define REMR_RESUME 16<br />

#define REMR_SET_BP 17<br />

#define REMR_SET_ENV 18<br />

#define REMR_SET_FSEM 19<br />

#define REMR_SET_MEM 20<br />

#define REMR_SIGNAL_FSEM 21<br />

#define REMR_START 22<br />

#define REMR_STOP 23<br />

#define REMR_SET_PCB 24<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 5 : 3<br />

Remote System Calls


5.2 Parameter Structures<br />

This section defines the members of the remote_calls and remote_responses unions.<br />

Remote call servers must be able to handle all of these and produce reasonable responses.<br />

Some remote call responses consist only of a signal number and a call_type parameter. There is no<br />

response structure defined for these calls.<br />

rem_clear_bp<br />

Include files<br />

remote_calls member<br />

remote_responses member<br />

#include "ose_rem.h"<br />

struct rem_clear_bp<br />

{<br />

PROCESS pid;<br />

OSADDRESS addr;<br />

};<br />

struct remr_clear_bp<br />

{<br />

OSBOOLEAN failed;<br />

};<br />

<strong>Kern</strong><strong>el</strong><br />

rem_create_error_handler<br />

Include files<br />

remote_calls member<br />

remote_responses member<br />

#include "ose_rem.h"<br />

struct rem_create_error_handler<br />

{<br />

PROCESS pid;<br />

OSADDRESS entrypoint;<br />

OSADDRESS stacksize;<br />

};<br />

struct remr_create_error_handler<br />

{<br />

OSADDRESS entrypoint;<br />

};<br />

rem_flush<br />

Include files<br />

remote_calls member<br />

remote_responses member<br />

#include "ose_rem.h"<br />

struct rem_flush<br />

{<br />

PROCESS pid;<br />

PROCESS ps<strong>el</strong>[1]; /* Variable size */<br />

};<br />

None.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 5 : 4<br />

rem_clear_bp


em_get_cpu<br />

Include files<br />

remote_calls member<br />

remote_responses member<br />

#include "ose_rem.h"<br />

struct rem_get_cpu<br />

{<br />

PROCESS pid;<br />

};<br />

struct remr_get_cpu<br />

{<br />

char name[1]; /* Variable size */<br />

};<br />

rem_get_env<br />

<strong>Kern</strong><strong>el</strong><br />

Include files<br />

remote_calls member<br />

remote_responses member<br />

rem_get_env_list<br />

Include files<br />

remote_calls member<br />

remote_responses member<br />

#include "ose_rem.h"<br />

struct rem_get_env<br />

{<br />

PROCESS pid;<br />

char name[1]; /* Variable size */<br />

};<br />

struct remr_get_env<br />

{<br />

char value[1]; /* Variable size */<br />

};<br />

#include "ose_rem.h"<br />

struct rem_get_env_list<br />

{<br />

PROCESS pid;<br />

char first_name[1]; /* Variable size */<br />

};<br />

struct remr_get_env_list<br />

{<br />

char name[1]; /* Variable size */<br />

};<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 5 : 5<br />

rem_get_cpu


em_get_fsem<br />

Include files<br />

remote_calls member<br />

remote_responses member<br />

#include "ose_rem.h"<br />

struct rem_get_fsem<br />

{<br />

PROCESS pid;<br />

};<br />

struct remr_get_fsem<br />

{<br />

OSFSEMVAL value;<br />

};<br />

rem_get_mem<br />

<strong>Kern</strong><strong>el</strong><br />

Include files<br />

remote_calls member<br />

remote_responses member<br />

rem_get_pcb<br />

#include "ose_rem.h"<br />

struct rem_get_mem<br />

{<br />

PROCESS pid;<br />

OSADDRESS from;<br />

void * to;<br />

OSADDRESS size;<br />

};<br />

struct remr_get_mem<br />

{<br />

OSBOOLEAN failed;<br />

};<br />

Include files<br />

remote_calls member<br />

remote_responses member<br />

#include "ose_rem.h"<br />

struct rem_get_pcb<br />

{<br />

PROCESS pid;<br />

};<br />

struct remr_get_pcb<br />

{<br />

struct OS_pcb pcb; /* Variable size */<br />

};<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 5 : 6<br />

rem_get_fsem


em_get_pid_list<br />

Include files<br />

remote_calls member<br />

remote_responses member<br />

#include "ose_rem.h"<br />

struct rem_get_pid_list<br />

{<br />

PROCESS bid;<br />

};<br />

struct remr_get_pid_list<br />

{<br />

OSBUFSIZE count;<br />

PROCESS pidlist[1]; /* Variable size */<br />

};<br />

rem_get_pri<br />

<strong>Kern</strong><strong>el</strong><br />

Include files<br />

remote_calls member<br />

remote_responses member<br />

#include "ose_rem.h"<br />

struct rem_get_pri<br />

{<br />

PROCESS pid;<br />

};<br />

struct remr_get_pri<br />

{<br />

OSPRIORITY pri;<br />

};<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 5 : 7<br />

rem_get_pid_list


em_get_signal<br />

Include files<br />

remote_calls member<br />

remote_responses member<br />

{<br />

};<br />

#include "ose_rem.h"<br />

struct rem_get_signal<br />

{<br />

PROCESS pid;<br />

OSADDRESS mailptr;<br />

};<br />

struct remr_get_signal<br />

OSADDRESS nextsig;<br />

OSBUFSIZE sigsize;<br />

/* Zero if call<br />

* failed<br />

*/<br />

PROCESS sender;<br />

PROCESS addressee;<br />

unsigned char contents[1];<br />

/* Variablesize */<br />

<strong>Kern</strong><strong>el</strong><br />

rem_get_uid<br />

Include files<br />

remote_calls member<br />

remote_responses member<br />

#include "ose_rem.h"<br />

struct rem_get_uid<br />

{<br />

PROCESS pid;<br />

};<br />

struct remr_get_uid<br />

{<br />

OSUSER uid;<br />

};<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 5 : 8<br />

rem_get_signal


em_hunt<br />

Include files<br />

#include "ose_rem.h"<br />

remote_calls member<br />

struct rem_hunt<br />

{<br />

OSUSER user;<br />

PROCESS from;<br />

OSBOOLEAN persistent;<br />

/* Set if a hunt<br />

* signal is<br />

* present.<br />

*/<br />

char name[1]; /* Variablesize */<br />

};<br />

remote_responses member<br />

struct remr_hunt<br />

{<br />

PROCESS pid;<br />

OSBOOLEAN found;<br />

<strong>Kern</strong><strong>el</strong><br />

rem_intercept<br />

Include files<br />

};<br />

/* 0=no,<br />

* 1=found,<br />

* 2=found<br />

* unnamed<br />

*/<br />

#include "ose_rem.h"<br />

remote_calls member<br />

struct rem_intercept<br />

{<br />

PROCESS pid;<br />

};<br />

remote_responses member<br />

None.<br />

rem_resume<br />

Include files<br />

#include "ose_rem.h"<br />

remote_calls member<br />

struct rem_resume<br />

{<br />

PROCESS pid;<br />

};<br />

remote_responses member<br />

None.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 5 : 9<br />

rem_hunt


em_set_bp<br />

Include files<br />

remote_calls member<br />

remote_responses member<br />

#include "ose_rem.h"<br />

struct rem_set_bp<br />

{<br />

PROCESS pid;<br />

OSADDRESS address;<br />

OSADDRESS attribute;<br />

OSBUFSIZE sigsize;<br />

unsigned char trapsig_contents[1];<br />

/* Variablesize */<br />

};<br />

struct remr_set_bp<br />

{<br />

OSBOOLEAN failed;<br />

};<br />

rem_set_env<br />

<strong>Kern</strong><strong>el</strong><br />

Include files<br />

remote_calls member<br />

remote_responses member<br />

#include "ose_rem.h"<br />

struct rem_set_env<br />

{<br />

PROCESS pid;<br />

OSBUFSIZE name;<br />

/* Index into strings.*/<br />

OSBUFSIZE value;<br />

/* Index into strings.*/<br />

char strings[1];<br />

/* Variable size */<br />

};<br />

struct remr_set_env<br />

{<br />

OSBOOLEAN failed;<br />

};<br />

rem_set_fsem<br />

Include files<br />

remote_calls member<br />

remote_responses member<br />

#include "ose_rem.h"<br />

struct rem_set_fsem<br />

{<br />

PROCESS pid;<br />

OSFSEMVAL value;<br />

};<br />

None.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 5 : 10<br />

rem_set_bp


em_set_mem<br />

Include files<br />

remote_calls member<br />

remote_responses member<br />

#include "ose_rem.h"<br />

struct rem_set_mem<br />

{<br />

PROCESS pid;<br />

void *from;<br />

OSADDRESS to;<br />

OSADDRESS size;<br />

};<br />

struct remr_set_mem<br />

{<br />

OSBOOLEAN failed;<br />

};<br />

rem_set_pcb<br />

<strong>Kern</strong><strong>el</strong><br />

Include files<br />

remote_calls member<br />

remote_responses member<br />

rem_signal_fsem<br />

#include "ose_rem.h"<br />

struct rem_set_pcb<br />

{<br />

PROCESS pid;<br />

char cpuregs[1]; /* Variable size */<br />

};<br />

struct remr_set_pcb<br />

{<br />

OSBOOLEAN failed;<br />

};<br />

Include files<br />

remote_calls member<br />

remote_responses member<br />

#include "ose_rem.h"<br />

struct rem_signal_fsem<br />

{<br />

PROCESS pid;<br />

};<br />

None.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 5 : 11<br />

rem_set_mem


em_start<br />

Include files<br />

remote_calls member<br />

remote_responses member<br />

#include "ose_rem.h"<br />

struct rem_start<br />

{<br />

PROCESS pid;<br />

};<br />

None.<br />

rem_stop<br />

Include files<br />

remote_calls member<br />

remote_responses member<br />

#include "ose_rem.h"<br />

struct rem_stop<br />

{<br />

PROCESS pid;<br />

};<br />

None.<br />

<strong>Kern</strong><strong>el</strong><br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 5 : 12<br />

rem_start


5.3 Example of a Link Handler<br />

The following is a simple example of how to use the remote calls when writing a link handler. This<br />

link handler manages only remote hunt signals; other remote call types are handled in a similar<br />

manner.<br />

#include "ose.h"<br />

#include "ose_rem.h"<br />

OS_PROCESS(my_linkhandler)<br />

{<br />

/* Defines the signals in the ose_rem.h file that<br />

* are being used.<br />

*/<br />

union SIGNAL<br />

{<br />

struct remote_call remote_call;<br />

struct remote_response remote_response;<br />

remote_canc<strong>el</strong> remote_canc<strong>el</strong>;<br />

};<br />

union SIGNAL *signal;<br />

static const SIGSELECT any_sig[]={0};<br />

struct OS_redir_table redir_table[1];<br />

PROCESS phantom_;<br />

/* Redirects all signals to the current process. */<br />

<strong>Kern</strong><strong>el</strong><br />

redir_table[0].sig = (SIGSELECT) 1;<br />

redir_table[0].pid = current_process();<br />

for(;;)<br />

{<br />

signal = receive((SIGSELECT *)any_sig);<br />

if (signal->sig_no == REMOTE_CALL)<br />

{<br />

switch(signal->remote_call.call_type)<br />

{<br />

case REM_HUNT:<br />

/* Create a phantom process with the name<br />

* stated in the hunt call.<br />

*/<br />

phantom_ = create_process(OS_PHANTOM,<br />

signal->remote_call.params.<br />

rem_hunt.name,<br />

(OSENTRYPOINT *) 0,<br />

(OSADDRESS) 0,<br />

(OSPRIORITY) 0,<br />

(OSTIME) 0,<br />

(PROCESS) 0,<br />

&redir_table,<br />

(OSVECTOR) 0,<br />

(OSUSER) 0);<br />

/* Define the response signal<br />

* and its parameters<br />

*/<br />

signal->sig_no = REMOTE_RESPONSE;<br />

signal->remote_response.results.remr_hunt.found= 1;<br />

signal->remote_response.results.remr_hunt.pid = phantom_;<br />

break;<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 5 : 13<br />

rem_stop


}<br />

}<br />

default:<br />

/* No hunt signal received, cannot manage<br />

* the request.<br />

*/<br />

signal->sig_no = REMOTE_CANCEL;<br />

}<br />

send (&signal, sender(&signal));<br />

/* Send the signal*/<br />

/* to the caller. */<br />

}<br />

<strong>el</strong>se<br />

{<br />

/* The signal received is a signal sent to a process<br />

* in another CPU. Code is needed here to send the signal<br />

* over the communication link to a link handler in the<br />

* other CPU.<br />

*/<br />

}<br />

<strong>Kern</strong><strong>el</strong><br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 5 : 14<br />

rem_stop


6 Error Messages<br />

<strong>Kern</strong><strong>el</strong><br />

6.1 <strong>Kern</strong><strong>el</strong> Error Message Reference<br />

The following is a list of all constants, in hexadecimal representation, used by the kern<strong>el</strong> to indicate<br />

which error caused a call to the error handler.<br />

Error Code Symbolic name<br />

0x01<br />

OSE_ESTACK_TOO_LARGE<br />

Too large stack buffer requested. There is no stack of this size or larger in the pool<br />

attached to process that called create_process. The extra parameter contains the<br />

size requested.<br />

0x02<br />

OSE_ENO_USER_STACKSPACE<br />

Out of space in a user stack pool. An error handler may extend the pool with the<br />

extend_pool() system call. The extra parameter contains a pool identifier that can<br />

be passed to the extend_pool() system call. The extra parameter serves no other<br />

purpose. This error code can be ignored only if the pool was extended. Ignoring<br />

the error causes the current allocation to be retried.<br />

Note that the error handler is called in a state where the dispatcher is locked. The<br />

error handler is therefore not allowed to perform any operations or system calls<br />

that would cause a process switch to be attempted. As a special case, it is however<br />

possible to use the kill_proc(), signal_fsem() and signal_sem() calls because these<br />

calls were designed to work in this situation.<br />

Further, if the pool serves interrupt or timer processes, the error handler is<br />

assumed to disable interrupts before calling extend_pool() and restoring the<br />

previous interrupt status upon return.<br />

0x03<br />

OSE_ETOO_MANY_PROCESSES<br />

Too many processes were created. The system tables allows only a certain number<br />

of processes. This number was exceeded. As the process table is used to store any<br />

object that is represented by a PROCESS id, this error may also be reported when<br />

creating new blocks, pools or segments.<br />

Ignoring this error causes the system call to return as if it was never called.<br />

0x11<br />

OSE_EBUFFER_TOO_LARGE<br />

Too large signal buffer requested.It is impossible to allocate a buffer larger than<br />

the largest size available in the pool.The extra parameter contains the size<br />

requested. Ignoring this error causes the kern<strong>el</strong> to allocate the largest buffer<br />

available in the pool.This error is fatal if it occurs when the kern<strong>el</strong> tries to allocate<br />

system pool space as a side effect of system calls like create_block(),<br />

create_process() etc.<br />

0x12<br />

OSE_ENO_KERN_SPACE<br />

Out of space in the kern<strong>el</strong> pool. An error handler may extend the pool with the<br />

extend_pool() system call. The extra parameter contains a pool identifier that can<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 6 : 1<br />

Error Messages


<strong>Kern</strong><strong>el</strong><br />

0x1d<br />

0x1e<br />

0x1f<br />

0x20<br />

0x21<br />

be passed to the extend_pool() system call. The extra parameter serves no other<br />

purpose. This error code can be ignored only if the pool was extended. Ignoring<br />

the error causes the current allocation to be retried. Note that the error handler is<br />

called in a state where the dispatcher is locked. The error handler is therefore not<br />

allowed to perform any operations or system calls that would cause a process<br />

switch to be attempted. As a special case, it is however possible to use the<br />

signal_fsem() and signal_sem() calls because these calls were designed to work<br />

in this situation. Further, if the pool serves interrupt or timer processes, the error<br />

handler is assumed to disable interrupts before calling extend_pool() and restoring<br />

the previous interrupt status upon return.<br />

OSE_EKILLED_STATIC_SEMAPHORE<br />

An attempt to kill a static semaphore was made.Only semaphores created with the<br />

create_sem system call can be killed.<br />

OSE_EKILLED_SEMAPHORE_IN_USE<br />

An attempt to kill a semaphore that is still in use was made. A semaphore can not<br />

be killed when there are processes waiting at it.<br />

OSE_EILLEGAL_SEMAPHORE<br />

An illegal semaphore pointer was presented to the kern<strong>el</strong>. This error also occurs<br />

when a semaphore that is not available to the calling process is killed. A<br />

semaphore in another memory segment is unavailable in some memory<br />

configurations. Ignoring this error causes the system call to return as if it was<br />

never called.<br />

OSE_ENO_USER_SIGSPACE<br />

Out of space in a user signal pool. An error handler may extend the pool with the<br />

extend_pool() system call. The extra parameter contains a pool identifier that can<br />

be passed to the extend_pool() system call. The extra parameter serves no other<br />

purpose. This error code can be ignored only if the pool was extended. Ignoring<br />

the error causes the current allocation to be retried.<br />

Note that the error handler is called in a state where the dispatcher is locked. The<br />

error handler is therefore not allowed to perform any operations or system calls<br />

that would cause a process switch to be attempted. As a special case, it is however<br />

possible to use the kill_proc(), signal_fsem() and signal_sem() calls because these<br />

calls were designed to work in this situation.<br />

Further, if the pool serves interrupt or timer processes, the error handler is<br />

assumed to disable interrupts before calling extend_pool() and restoring the<br />

previous interrupt status upon return.<br />

OSE_EPOOL_EXTENSION_FAILED<br />

Pool extension failed. An error handler repeatedly claims that an out of space<br />

error was handled, but the kern<strong>el</strong> can not find the extended space. It is possible<br />

that the error handler never used the extend_pool() system call.<br />

The extra parameter contains a the initial error code. I.e one of:<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 6 : 2<br />

Error Messages


<strong>Kern</strong><strong>el</strong><br />

0x22<br />

0x23<br />

0x24<br />

0x25<br />

0x26<br />

0x27<br />

0x28<br />

• OSE_ENO_KERN_SPACE<br />

• OSE_ENO_USER_SIGSPACE<br />

• OSE_ENO_USER_STACKSPACE.<br />

This error is fatal when it occurs in an interrupt process. If it is not, the error<br />

handler is expected to kill the current process. For errors in the kern<strong>el</strong> pool, the<br />

recover procedure may not be straight forward so it is recommended that the<br />

system is shut down or restarted by the system error handler.<br />

OSE_EBLOCK_HAS_PROCESSES<br />

The create_pool system call was used on a block that contains processes.<br />

OSE_EUNREASONABLE_SIZES<br />

The create_pool system call was exposed to an illegal signal size table or stack<br />

size table. This error code is used in any of the following illegal cases:<br />

1. The count fi<strong>el</strong>d in the first location is unreasonable.<br />

Valid counts are 0-8, but both tables can not have a count of zero.<br />

2. The supplied memory fragment does not fit in the address space.<br />

3. The size table is not properly sorted on size.<br />

4. All sizes in a table are zero.<br />

Ignoring this error causes the system call to return as if it was never called.<br />

OSE_ETOO_MANY_ATTACHED<br />

Too many signals were attached. The system tables allows only a certain number<br />

of attached signals. This number was exceeded.<br />

OSE_EVECTOR_IN_USE<br />

Vector already in use. An interrupt process was created for a vector that is already<br />

allocated to another interrupt process. The extra parameter contains the vector.<br />

Ignoring this error causes the interrupt process to be removed from the system as<br />

if it was never created.<br />

OSE_EILLEGAL_SYSTEMCALL<br />

Illegal system call from an interrupt process. The current interrupt or timer<br />

process has been using a system call that is only allowed for non interrupt<br />

processes.<br />

OSE_EINTERSEGMENT_SEND<br />

Illegal intersegment send to an interrupt or timer process. Signals can be sent to<br />

interrupt or timer processes only if the pool associated with the target process is<br />

in the same memory segment as the pool associated with the sending process.<br />

This restriction is present because an interrupt process can not handle the page<br />

fault that might occur when a reference to the senders memory segment is made<br />

at the time of the receive call in the interrupt process.<br />

OSE_EBAD_INTLEVEL<br />

Illegal wakeup priority for an interrupt process. The current interrupt process was<br />

invoked with a hardware priority that does not match the priority stated when the<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 6 : 3<br />

Error Messages


<strong>Kern</strong><strong>el</strong><br />

0x29<br />

0x2a<br />

0x2b<br />

0x2c<br />

0x2d<br />

0x2e<br />

interrupt process was created. The priority parameter in the create_process call<br />

must match the actual hardware priority at which the interrupt occurs.<br />

The extra parameter to the error handler contains the actual priority<br />

encountered.Ignoring this error causes the process priority to be updated.<br />

OSE_ERECURSIVE_ERROR<br />

An error was encountered while an error handler was executing. The situation was<br />

detected in an error system call made by the current process. The extra parameter<br />

to the error handler contains the error code supplied in the error system call. This<br />

error must be handled in a system error handler by killing the current process/<br />

program. The error can not be ignored, and attempting to ignore it will only cause<br />

the error to be reported again with the fatal flag set.<br />

OSE_ERECURSIVE_SYSERROR<br />

An error was encountered while an error handler was executing.The situation was<br />

detected when an error detected by OSE was about to be reported. The extra<br />

parameter to the error handler contains the error code that was about to be<br />

reported by OSE when the recursive error call was detected. This error must be<br />

handled in a system error handler by killing the current process/program. The<br />

error can not be ignored, and attempting to ignore it will only cause the error to<br />

be reported again with the fatal flag set.<br />

OSE_EILLEGAL_SEM_VALUE<br />

An semaphore with a negative initial value was found or created. This is an illegal<br />

situation since a negative semaphore value implies that one or more processes are<br />

waiting at the semaphore. The extra parameter contains the illegal initial value.<br />

Ignoring this error causes the semaphore to be created with an initial value set to<br />

zero.<br />

OSE_EINTERSEGMENT_SEMAPHORE_REF<br />

A semaphore in use was implicitly killed, but processes are still waiting at it. This<br />

error occurs when processes erroneously use a semaphore located in another<br />

memory segment. This is illegal, but in a system without memory protection it<br />

works up to the point when the memory segment containing the semaphore is<br />

reclaimed. This occurs when all processes in that segment have been killed. This<br />

error must be handled in a system error handler by killing the offending process.<br />

The id of this process is passed to the error handler in the extra parameter.<br />

OSE_EDETACHED_TWICE<br />

An attempt to detach from an already detached process was made.Only one detach<br />

call may be issued for each attach call made.This error may also occur if detach<br />

is called with a bad parameter.The kern<strong>el</strong> can not understand the difference in all<br />

cases. Ignoring this error causes detach() to perform no operation.<br />

OSE_EDETACHED_TOO_LATE<br />

An attempt was made to detach from a process long after the death of that<br />

process.This error implies that the attached process has been killed, and the caller<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 6 : 4<br />

Error Messages


<strong>Kern</strong><strong>el</strong><br />

0x2f<br />

0x30<br />

0x31<br />

0x32<br />

0x47<br />

0x48<br />

0x49<br />

0x4a<br />

failed to notice this for a period long enough for the kern<strong>el</strong> to discard all attach<br />

information for that process. The error can sometimes occur as a result of a too<br />

small number of attach entries defined in the kern<strong>el</strong> configuration. If you<br />

encounter this error for no apparent reason, then try increasing the attach limit in<br />

the configuration file. This error may also occur if detach is called with a bad<br />

parameter. The kern<strong>el</strong> can not understand the difference in all cases. Ignoring this<br />

error causes the same effect as if detach() was never called, i.e the caller must be<br />

prepared to receive a subsequent attached signal from the killed process.<br />

OSE_EDETACH_AFTER_RECEIVE<br />

An attempt was made to detach from a process when the attached signal has<br />

already been received.<br />

OSE_EBAD_PROCESS_TYPE<br />

An attempt was made to create a process of an invalid type.<br />

OSE_EUSED_NIL_POINTER<br />

The caller tried to operate on the NIL pointer. The buffer has probably been sent<br />

or freed already. The extra parameter contains the address of the signal pointer<br />

that points to NIL. Ignoring this error causes the illegal system call to be ignored.<br />

OSE_EILLEGAL_PROCESS_ID<br />

An illegal block or process id was presented to the kern<strong>el</strong>.This code may also<br />

indicate a bad process id in a redirection table.The extra parameter contains the<br />

offending id.Ignoring this error causes the system call to treat the id as the id of<br />

a killed process.<br />

OSE_EILLEGAL_FLUSH_SENDER<br />

An invalid process id was encountered in the flush system call.The invalid id was<br />

found in the array specifying from which processes signals should be<br />

discarded.This error may also indicate that the first entry of the array contains an<br />

invalid array size.<br />

OSE_EKILLED_STATIC_PROCESS<br />

A static process was killed. Killing a static process is illegal in a system linked<br />

to an OSE realtime kern<strong>el</strong>.The error was reported by the system daemon, which<br />

detected the death of the main process in osemain.c. It is unknown at this time<br />

which process was originally killed, since all static processes are now dead.<br />

OSE_EILLEGAL_REDIRCOUNT<br />

An invalid redirection table was presented to the kern<strong>el</strong>. The count of number of<br />

entries was zero. It must always be at least one, since the first table entry<br />

containing the count and the default process id is included in the counter. Ignoring<br />

this error causes the illegal system call to be ignored.<br />

OSE_ECORRUPTED_KERNEL<br />

<strong>Kern</strong><strong>el</strong> data was damaged. The kern<strong>el</strong> tables were found to be inconsistent.<strong>Kern</strong><strong>el</strong><br />

data may have been damaged by a crashed process.The extra parameter contains<br />

an undocumented subcode.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 6 : 5<br />

Error Messages


<strong>Kern</strong><strong>el</strong><br />

0x52<br />

0x53<br />

0x54<br />

0x55<br />

0x56<br />

0x57<br />

0x58<br />

OSE_ESPURIOUS_INTERRUPT<br />

An interrupt occurred from an unused interrupt vector. There may be several<br />

reasons for this. Possible reasons might be that hardware capable of generating<br />

interrupt was erroneously initialized, or the system was restarted without issuing<br />

a proper hardware reset, or an interrupt process might have been killed without<br />

disabling the corresponding hardware.The extra parameter to the error handler<br />

contains the priority on which the interrupt was encountered.<br />

OSE_EATTACHED_TO_CALLER<br />

An attempt was made to attach to the current process.<br />

It is illegal to issue an attach call with the id of the calling process as a parameter.<br />

OSE_EINTERSEGMENT_COPY_FAILED<br />

The current receive(from/w_tmo) system call failed because the pool attached to<br />

the calling process does not support the size of the signal received. Planning pools<br />

with regard to the largest available buffer size is an important issue in systems<br />

where intersegment memory protection is utilized. It is nearly always advisable to<br />

have all pools support a largest signal size of 64k bytes. The extra parameter to<br />

the error handler contains the size of the signal buffer found in the receive queue.<br />

Ignoring this error causes the received signal to be lost.<br />

OSE_EINTSTACK_TOO_LARGE<br />

Too large interrupt stack buffer requested.There is no interrupt stack of sufficient<br />

size in the system pool.The extra parameter contains the accummulated size. This<br />

error does not necessarily mean that a real problem is present since the interrupt<br />

stack size accumulates worst stack case requirements on each interrupt priority<br />

over the system life.<br />

If the system is designed such that interrupt processes are frequently created and<br />

killed on various interrupt priorities, then a situation may arise where the kern<strong>el</strong><br />

thinks that the interrupt stack needs to be larger than actually required by interrupt<br />

processes currently in operation. Ignoring this error causes the interrupt stack to<br />

be silently truncated to the largest size available.<br />

OSE_EKILLED_SYSTEM_DAEMON<br />

An attempt was made to kill a system daemon. Killing a member of the OSE<br />

block such as “ose_sysd” or “idle” is not allowed.The extra parameter to the error<br />

handler contains the process id of the system daemon. Ignoring this error causes<br />

the kill_proc call to return without killing the system daemon.<br />

OSE_ECANNOT_RESTORE<br />

Restore was attempted on a signal buffer that has already been freed or is<br />

otherwise not owned by any process. Such buffers can not be restored. This error<br />

may also occur for a wild signal pointer. The extra parameter contains the address<br />

of the signal buffer.<br />

OSE_EFRAGMENT_TOO_SMALL<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 6 : 6<br />

Error Messages


<strong>Kern</strong><strong>el</strong><br />

0x59<br />

0x5a<br />

0x5b<br />

0x5c<br />

0x5d<br />

0x5e<br />

An attempt was made to install an unreasonably small pool or pool fragment.<br />

Pool fragments smaller than 1024 bytes are rendered us<strong>el</strong>ess. This is an arbitrary<br />

limit, s<strong>el</strong>ected because it is b<strong>el</strong>ieved that fragments this small are always us<strong>el</strong>ess.<br />

As a general guid<strong>el</strong>ine, fragments should be at least several times the size of the<br />

largest buffer or stack size. The extra parameter to the error handler contains the<br />

size of the supplied pool fragment. Ignoring this error causes the system call to<br />

return without creating the pool or installing the pool extension. I.e. as if the call<br />

was never made.<br />

OSE_ECONCURRENT_TICK_CALL<br />

Tick was called concurrently by several processes. Tick is a non reentrant system<br />

call. Only one process at a time may use it, or the system will crash. This is a<br />

fatal error.<br />

OSE_EILLEGAL_USER_CALL<br />

A superuser system call was used by a non superuser process. Some system calls<br />

are reserved for use by processes with a user number of zero (the superuser<br />

number). Using these calls in other processes is illegal. Ignoring this error causes<br />

the illegal system call to be ignored.<br />

OSE_EALLREADY_STARTED<br />

An attempt was made to start a process that is not stopped. The start() system<br />

call was invoked with either a process or a block id. For a block id, the block was<br />

found to contain at least one process that was not stopped. The extra parameter<br />

contains the id that was passed to the start() call. Ignoring the error causes the<br />

start() system call to continue, starting only stopped processes.<br />

OSE_ELINKHANDLER_DEADLOCK<br />

A linkhandler deadlock was detected. This error was probably caused by a<br />

linkhandler process issuing a hunt() system call or another system call that can<br />

cause a remote system call request. Doing this is a design rule violation. It is<br />

however possible that the error was instead caused during debugging or if the<br />

linkhandler was stopped or intercepted for more than 10 seconds. The extra<br />

parameter contains the process id of the linkhandler that did not respond.<br />

Ignoring this error causes the kern<strong>el</strong> to continue waiting for a response.<br />

OSE_EILLEGAL_ENVNAME<br />

An illegal environment variable name was detected. A set_env() or get_env() call<br />

was issued with a name parameter set to NULL. This was probably caused by a<br />

problem r<strong>el</strong>ated to uninitialized variables. Ignoring this error causes the illegal<br />

system call to be ignored.<br />

OSE_EILLEGAL_POOL<br />

An illegal pool id was presented to the kern<strong>el</strong>. The extend_pool() call was issued<br />

with a pool_id parameter that refers to an object that is not a pool. This was<br />

probably caused by a problem r<strong>el</strong>ated to uninitialized variables. Ignoring this<br />

error causes the illegal system call to be ignored.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 6 : 7<br />

Error Messages


<strong>Kern</strong><strong>el</strong><br />

0x5f<br />

0x70<br />

0x71<br />

0x72<br />

0x73<br />

0x74<br />

0x75<br />

OSE_ENOT_SIG_OWNER<br />

The calling process is not the owner of the specified signal buffer. This error may<br />

sometimes also occur for a wild signal pointer. The extra parameter contains the<br />

address of the signal buffer. Ignoring this error causes the illegal system call to<br />

be ignored.<br />

OSE_EWILD_SIG_POINTER<br />

An invalid signal pointer was presented to the kern<strong>el</strong>. The operating system was<br />

unable to identify the memory pointed to as a signal buffer. The extra parameter<br />

contains the offending pointer, that is the address that should have contained a<br />

signal number. Ignoring this error causes the illegal system call to be ignored.<br />

OSE_EBAD_PARAMETER<br />

An invalid parameter was used in a system call. The operating system checks<br />

many of the system call parameters for unreasonable values. This error code<br />

means that one of the parameters to the indicated system call contained an illegal<br />

value. The extra parameter contains the value of the offending parameter.<br />

Ignoring this error causes the illegal system call to be ignored.<br />

OSE_EFRAGMENT_IN_USE<br />

An attempt was made to create a pool with a memory area that is already used in<br />

another pool. This error commonly occurs when a block is killed and recreated.<br />

The old pool is probably still in use because it contains signals that are currently<br />

owned by a process that is still alive. Pools don’t die until the last signal in the<br />

pool has been freed. This error can also be reported if pool space is by mistake<br />

allocated on the stack of the caller. The extra parameter contains the base of the<br />

offending pool space. Ignoring this error causes the illegal system call to be<br />

ignored.<br />

OSE_EILLEGAL_SUPER_MODE<br />

An illegal attempt was made to create a supervisor mode block. Supervisor mode<br />

blocks can only be created by a superuser process executing in supervisor mode.<br />

The extra parameter contains a pointer to the name of the new block. Ignoring<br />

this error causes the block to be created anyway, but the mode is set to user mode.<br />

OSE_ESPURIOUS_SYSTEM_SIGNAL<br />

An unrecognized signal was received by one of the system daemon processes.<br />

The extra parameter contains the process id of the sender of the unknown signal.<br />

Ignoring this error causes the signal to be silently freed.<br />

OSE_EFRAGMENT_TOO_LARGE<br />

An attempt was made to install an unreasonably large pool or pool fragment. The<br />

size of the pool fragment presented to the kern<strong>el</strong> is too large for the fragment to<br />

fit in the address space. This error indicates either that the size is unreasonably<br />

large, or that the base of the memory fragment is too close to the end of the<br />

address space. The extra parameter to the error handler contains the size of the<br />

supplied pool fragment. Ignoring this error causes the system call to return<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 6 : 8<br />

Error Messages


<strong>Kern</strong><strong>el</strong><br />

0x76<br />

0x77<br />

0x78<br />

0x79<br />

0x7a<br />

0xa5<br />

0xa6<br />

without creating the pool or installing the pool extension. I.e. as if the call was<br />

never made.<br />

OSE_ESTOP_OVERFLOW<br />

An attempt was made to stop a process an unreasonable number of times. This<br />

error occurs when the stop-counter wrapps from 4 Giga times to zero. The extra<br />

parameter to the error handler contains the id of the process stopped. Ignoring<br />

this error causes the system call to return without executing the stop operation.<br />

I.e. as if the call was never made.<br />

OSE_ESEM_OVERFLOW<br />

An attempt was made to signal a semaphore or a fast semaphore beyond the<br />

maximum value. Semaphores can only be signaled a limitied number of times<br />

before a wait operation is performed. This error occurs when the semaphore value<br />

wrapps from 2 Giga times to -2 Giga times. The extra parameter to the error<br />

handler contains the address of the semaphore or the process id to which the fast<br />

semaphore b<strong>el</strong>ongs. Ignoring this error causes the system call to return without<br />

executing the semaphore operation. I.e. as if the call was never made.<br />

OSE_EBAD_HUNT_PRI<br />

This is the result of a bad kern<strong>el</strong> configuration. The huntd priority is too low. The<br />

ose_huntd process must have a priority higher than the ose_sysd process. Ignoring<br />

this error causes the priorities to be automatically adjusted.<br />

OSE_EILLEGAL_PRISYSTEMCALL<br />

An illegal system call was made from interrupt or background process. The<br />

current background, interrupt or timer process has been using a system call that<br />

is only allowed for prioritized processes.<br />

OSE_EILLEGAL_CONFIGURATION<br />

This is the result of an illegal kern<strong>el</strong> configuration. One or more entries in the<br />

kern<strong>el</strong> configuration file has an illegal value. The extra parameter to the error<br />

handler contains this value. Ignoring this error will cause the kern<strong>el</strong> to adjust the<br />

value to the closest legal value.<br />

OSE_ENO_BUFFER_END_MARK<br />

A valid end mark could not be found in the signal buffer presented to the kern<strong>el</strong>.<br />

The calling process seems to have been writing more data than the size of the<br />

buffer allows. The extra parameter contains the address of the signal buffer. This<br />

error must be handled in a system error handler by killing the current process/<br />

program. The error can not be ignored, and attempting to ignore it will only cause<br />

the error to be reported again with the fatal flag set.<br />

OSE_ECORRUPTED_POOL<br />

A damaged signal buffer was presented to the kern<strong>el</strong>. Analysis indicates that the<br />

problem was caused by some other buffer in which a process has been writing<br />

more data than the size of the buffer allows.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 6 : 9<br />

Error Messages


The extra parameter contains a pointer to a structure with four 32 bit entries and<br />

the following layout:<br />

• extra[0]<br />

The process id of the other process that may have caused the problem. The fi<strong>el</strong>d<br />

may contain the id of any process including the current. The fi<strong>el</strong>d is zero if the<br />

id could not be obtained.<br />

• extra[1]<br />

A pointer to the name of the other process. The fi<strong>el</strong>d is zero if the name could<br />

not be obtained.<br />

• extra[2]<br />

A pointer to the signal buffer that was damaged by the indicated process. This<br />

is probably the buffer which was originally damaged.<br />

• extra[3]<br />

A pointer to the damaged signal buffer that was presented to the kern<strong>el</strong> by the<br />

calling process. This is probably only a secondary error indication caused by<br />

the extra[2] buffer.<br />

<strong>Kern</strong><strong>el</strong><br />

6.1.1 Target-specific error codes<br />

These error codes are only valid for realtime kern<strong>el</strong>s not softkern<strong>el</strong>s.<br />

0x101<br />

OSE_EUSER_STACK_OVERFLOW<br />

Stack overwrite in user stack. The extra parameter contains address of stack end.<br />

0x102<br />

OSE_ESUPERV_STACK_OVERFLOW<br />

Stack overwrite in supervisor stack. The extra parameter contains address of stack<br />

end.<br />

0x103<br />

OSE_EINTERRUPT_STACK_OVERFLOW<br />

Stack overwrite in interrupt stack. The extra parameter contains address of stack<br />

end.<br />

0x104<br />

OSE_EUNKNOWN_BREAKPOINT<br />

An unknown breakpoint was encountered.<br />

0x105<br />

OSE_EUNKNOWN_INTERRUPT<br />

An unknown interrupt was encountered. The extra parameter contains vector<br />

number.<br />

0x107<br />

OSE_EPROCESS_ENDED<br />

A prioritised or background process ended. This error should be treated as a<br />

warning. The extra parameter contains the process id.<br />

0x108<br />

OSE_ESTART_STACK_OVERFLOW<br />

Stack overwrite in kern<strong>el</strong> startup stack. A handler has used too much stack space.<br />

The extra parameter contains address of stack end.<br />

0x110<br />

OSE_EUNDEFINED_SYSCALL_CODE<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 6 : 10<br />

Error Messages


0x111<br />

0x112<br />

An undefined function code has been used for a system call. The extra parameter<br />

the contains function code.<br />

OSE_EUNEXPECTED_EXCEPTION<br />

An unexpected exception occured. The exception offset is supplied in the subcode<br />

fi<strong>el</strong>d. The extra parameter contains the pc register (the Program counter).<br />

OSE_EPRIORITY_ERROR<br />

An interrupt has occurred with equal or less priority than the currently running<br />

interrupt process. The reason for this is probably that interrupts have not been<br />

masked properly in the interrupt controller. The interrupt controller must not allow<br />

an interrupt process to be interrupted by an interrupt process with equal or lower<br />

priority. The extra parameter contains the illegal priority. This error is only valid<br />

on PowerPC targets.<br />

<strong>Kern</strong><strong>el</strong><br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 6 : 11<br />

Error Messages


<strong>Kern</strong><strong>el</strong><br />

6.2 Caller Information Reference<br />

The following is a list of all constants used to determine which system call was in progress when<br />

an error was encountered.<br />

Caller No<br />

Symbolic routine name<br />

0x010000<br />

OSE_ADDRESSEE<br />

0x020000<br />

OSE_ALLOC<br />

0x030000<br />

OSE_ASSIGN_LINKHANDLER<br />

0x040000<br />

OSE_ATTACH<br />

0x050000<br />

OSE_ATTACH_SEGMENT<br />

0x060000<br />

OSE_CLEAR_BP<br />

0x070000<br />

OSE_CREATE_BLOCK<br />

0x080000<br />

OSE_CREATE_ERROR_HANDLER<br />

0x090000<br />

OSE_CREATE_POOL<br />

0x0a0000<br />

OSE_CREATE_PROCESS<br />

0x0b0000<br />

OSE_CREATE_SEM<br />

0x0c0000<br />

OSE_CURRENT_PROCESS<br />

0x0d0000<br />

OSE_DELAY<br />

0x0e0000<br />

OSE_DETACH<br />

0x0f0000<br />

OSE_ERROR<br />

0x100000<br />

OSE_FLUSH<br />

0x110000<br />

OSE_FREE_BUF<br />

0x120000<br />

OSE_GET_BID<br />

0x130000<br />

OSE_GET_BID_LIST<br />

0x140000<br />

OSE_GET_CPU<br />

0x150000<br />

OSE_GET_ENV<br />

0x160000<br />

OSE_GET_ENV_LIST<br />

0x170000<br />

OSE_GET_FSEM<br />

0x180000<br />

OSE_GET_MEM<br />

0x190000<br />

OSE_GET_PCB<br />

0x1a0000<br />

OSE_GET_PID_LIST<br />

0x1b0000<br />

OSE_GET_PRI<br />

0x1c0000<br />

OSE_GET_PTYPE<br />

0x1d0000<br />

OSE_GET_SEM<br />

0x1e0000<br />

OSE_GET_SIGNAL<br />

0x1f0000<br />

OSE_GET_SYSTIME<br />

0x200000<br />

OSE_GET_TICKS<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 6 : 12<br />

Error Messages


<strong>Kern</strong><strong>el</strong><br />

Caller No<br />

0x210000<br />

0x220000<br />

0x230000<br />

0x240000<br />

0x250000<br />

0x260000<br />

0x270000<br />

0x280000<br />

0x290000<br />

0x2a0000<br />

0x2b0000<br />

0x2c0000<br />

0x2d0000<br />

0x2e0000<br />

0x2f0000<br />

0x300000<br />

0x310000<br />

0x320000<br />

0x330000<br />

0x340000<br />

0x350000<br />

0x360000<br />

0x370000<br />

0x380000<br />

0x390000<br />

0x3a0000<br />

0x3b0000<br />

0x3c0000<br />

0x3d0000<br />

0x3e0000<br />

0x3f0000<br />

0x400000<br />

0x410000<br />

0x420000<br />

0x440000<br />

Symbolic routine name<br />

OSE_GET_UID<br />

OSE_HUNT<br />

OSE_HUNT_FROM<br />

OSE_INTERCEPT<br />

OSE_KILL_PROC<br />

OSE_KILL_SEM<br />

OSE_POWER_FAIL<br />

OSE_RECEIVE<br />

OSE_RECEIVE_FROM<br />

OSE_RECEIVE_W_TMO<br />

OSE_RESTORE<br />

OSE_RESUME<br />

OSE_SEND<br />

OSE_SENDER<br />

OSE_SEND_W_S<br />

OSE_SET_BP<br />

OSE_SET_ENV<br />

OSE_SET_FSEM<br />

OSE_SET_MEM<br />

OSE_SET_PCB<br />

OSE_SET_PRI<br />

OSE_SET_SEGMENT<br />

OSE_SIGSIZE<br />

OSE_SIGNAL_FSEM<br />

OSE_SIGNAL_SEM<br />

OSE_START<br />

OSE_START_OSE<br />

OSE_STOP<br />

OSE_SYSTEM_TICK<br />

OSE_TICK<br />

OSE_WAIT_FSEM<br />

OSE_WAIT_SEM<br />

OSE_WAKE_UP<br />

OSE_EXTEND_POOL<br />

OSE_SET_PRI_FOR<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 6 : 13<br />

Error Messages


6.3 Interface Library Errors<br />

This is a summary of error codes, in hexadecimal representation, used by the interface library, which<br />

is described in the OSE Real Time <strong>Kern</strong><strong>el</strong> User’s Guide.<br />

Error Code<br />

Description<br />

0x9520<br />

0x9521<br />

0x9522<br />

0x9523<br />

The system can not be created due to a circular dependency<br />

between blocks, remote call server processes, redirection tables and<br />

processes.<br />

An external process could not be found within the specified<br />

timeout.<br />

No static processes were found. There must be at least one.<br />

An unexpected value appear in a statically initialized test variable.<br />

This is a check that initialization of static C variables works.<br />

<strong>Kern</strong><strong>el</strong><br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 6 : 14<br />

Error Messages


<strong>Kern</strong><strong>el</strong><br />

6.4 <strong>Kern</strong><strong>el</strong> Error Summary<br />

This is a summary of the error code list in the previous chapter.<br />

Error Code Description<br />

0x01<br />

Too large stack buffer requested.<br />

0x02<br />

Out of space in user stack pool.<br />

0x03<br />

Too many processes were created.<br />

0x11<br />

Too large signal buffer requested.<br />

0x12<br />

Out of space in kern<strong>el</strong> pool.<br />

0x1d<br />

An attempt to kill a static semaphore was made.<br />

0x1e<br />

An attempt to kill a semaphore that is still in use was made.<br />

0x1f<br />

An illegal semaphore pointer was presented to the kern<strong>el</strong>.<br />

0x20<br />

Out of space in user signal pool.<br />

0x21<br />

Pool extension failed.<br />

0x22<br />

The create_pool system call was used on a block that contains processes.<br />

0x23<br />

The create_pool system call was presented a signal size table or a stack size table<br />

that contains an unreasonable number in the first location.<br />

0x24<br />

Too many signals were attached.<br />

0x25<br />

Vector already in use.<br />

0x26<br />

Illegal system call from an interrupt process.<br />

0x27<br />

Illegal intersegment send to an interrupt or timer-interrupt process.<br />

0x28<br />

Illegal wakeup priority for an interrupt process.<br />

0x29<br />

An error was encountered while an error handler was executing.<br />

0x2a<br />

An error was encountered while an error handler was executing.<br />

0x2b<br />

A semaphore with a negative initial value was found or created.<br />

0x2c<br />

A semaphore in use was implicitly killed, but processes are still waiting at it.<br />

0x2d<br />

An attempt to detach from an already detached process was made.<br />

0x2e<br />

An attempt was made to detach from a process long after the death of that<br />

process.<br />

0x2f<br />

An attempt was made to detach from a process when the attached signal has<br />

already been received.<br />

0x30<br />

An attempt was made to create a process of an invalid type.<br />

0x31<br />

The caller tried to operate on the NIL pointer.<br />

0x32<br />

An illegal block or process ID was presented to the kern<strong>el</strong>.<br />

0x47<br />

An invalid process ID was encountered in the flush system call.<br />

0x48<br />

A static process was killed. Killing a static process is illegal.<br />

0x49<br />

An invallid redirection table was presented to the kern<strong>el</strong>.<br />

0x4a<br />

<strong>Kern</strong><strong>el</strong> data was damaged.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 6 : 15<br />

Error Messages


<strong>Kern</strong><strong>el</strong><br />

0x52<br />

0x53<br />

0x54<br />

0x55<br />

0x56<br />

0x57<br />

0x58<br />

0x59<br />

0x5b<br />

0x5c<br />

0x5d<br />

0x5e<br />

0x5f<br />

0x70<br />

0x71<br />

0x72<br />

0x73<br />

0x74<br />

0x75<br />

0x76<br />

0x77<br />

0x78<br />

0x79<br />

0x7a<br />

0xa5<br />

0xa6<br />

An interrupt occured from an unused interrupt vector.<br />

An attempt was made to attach to the current process, this is illegal.<br />

The current receive (or similar) system call failed because the pool attached to the<br />

current process does not support the size of the signal received.<br />

A too large interrupt stack was requested.<br />

An attempt was made to kill a system daemon, this is illegal.<br />

Restore was attempted on a signal buffer that has already been freed or is<br />

otherwise not owned by any process.<br />

An attempt was made to install an unreasonably small pool fragment.<br />

The tick system call was called concurrently by several processes.<br />

An attempt was made to start a process that is not stopped.<br />

A linkhandler deadlock was detected.<br />

An illegal environment variable name was detected.<br />

An illegal pool id was presented to the kern<strong>el</strong>.<br />

The calling process is not the owner of the specified signal buffer.<br />

An invalid signal pointer was presented to the kern<strong>el</strong>.<br />

An invalid parameter was used in a system call.<br />

An attempt was made to create a pool with a memory area that is already used in<br />

another pool.<br />

An illegal attempt was made to create a supervisor mode block.<br />

An unrecognized signal was received by one of the system daemon processes.<br />

An attempt was made to install an unreasonably large pool or pool fragment.<br />

An attempt was made to stop a process an unreasonable number of times.<br />

An attempt was made to signal a semaphore or a fast semaphore beyond the<br />

maximum value.<br />

The huntd priority is too low. The ose_huntd process must have a priority higher<br />

than the ose_sysd process.<br />

An illegal system call was made from interrupt or background process.<br />

One or more entries in the kern<strong>el</strong> configuration file has an illegal value.<br />

A valid end mark could not be found in the signal buffer presented to the kern<strong>el</strong>.<br />

A damaged signal buffer was presented to the kern<strong>el</strong>.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 6 : 16<br />

Error Messages


6.4.1 Target-specific error summary<br />

0x101<br />

A user stack overflow was encountered.<br />

0x102<br />

A supervisor stack overflow was encountered.<br />

0x103<br />

An interrupt stack overflow was encountered.<br />

0x104<br />

An unknown breakpoint was encountered.<br />

0x105<br />

An unknown interrupt was encountered.<br />

0x107<br />

A prioritized or background process ended.<br />

0x108<br />

Startup stack overflow.<br />

0x110<br />

An undefined function code has been used for a system call.<br />

0x111<br />

An unexpected exception occurred.<br />

0x112<br />

An interrupt has occurred with equal or less priority than the currently running<br />

interrupt process.<br />

<strong>Kern</strong><strong>el</strong><br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 6 : 17<br />

Error Messages


7 Glossary<br />

<strong>Kern</strong><strong>el</strong><br />

ANSI<br />

ASCII<br />

attach<br />

block<br />

buffer<br />

configuration<br />

debugging<br />

default<br />

dispatch<br />

dispatcher<br />

dynamic process<br />

environment variable<br />

error checks<br />

event<br />

fast semaphore<br />

fault tolerant system<br />

American National Standards Institute.<br />

American National Standard Code for Information Interchange.<br />

In OSE, a system call that attaches a signal to a process. Attached<br />

signals are returned to their owners when the process with the<br />

attached signals is killed.<br />

OSE processes can be grouped together into blocks. Several<br />

commands allow blocks to be operated upon as single units. The<br />

block is an exc<strong>el</strong>lent means of grouping logically connected<br />

processes into bigger and fewer functional units.<br />

A section of memory. It is reserved using the alloc system call. A<br />

buffer always has an owner.<br />

The operating system may contain different parts of code and<br />

parameters and behave differently depending on the configuration.<br />

Locating and removing errors from a system.<br />

An attribute, value or option that is used when no alternative is<br />

specified.<br />

To swap out a running process and swap in another ready process.<br />

A part of the kern<strong>el</strong> which performs a dispatch.<br />

A process that can be created and killed during run-time.<br />

Using OSE environment variables it is possible for a process to<br />

distribute information to other processes. Environment variables<br />

should be used sparingly and only for infrequently updated<br />

information.<br />

An ability to turn on or turn off certain error checking in OSE. This<br />

capability allows the OSE user to get maximum speed when error<br />

checking is no longer needed.<br />

1. Something which happens in the system. For example, the<br />

operator may have pressed a button or a resource becomes<br />

available. Events are often connected to interrupts or polled.<br />

2. For the DDS, event has a special meaning; an event is when a<br />

user defined condition is fulfilled.<br />

The fastest way in OSE to obtain process synchronisation. A fast<br />

semaphore does not give the possibility to transfer information<br />

between processes. A process cannot have more than one fast<br />

semaphore.<br />

A single or multi CPU system capable of recovering from different<br />

kinds of errors or malfunctions.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 7 : 1<br />

Glossary


<strong>Kern</strong><strong>el</strong><br />

handlers<br />

hunt<br />

intercepted<br />

interface<br />

interrupt<br />

interrupt process<br />

kern<strong>el</strong><br />

lev<strong>el</strong> A<br />

lev<strong>el</strong> B<br />

lev<strong>el</strong> C<br />

lev<strong>el</strong> D<br />

link handler<br />

logical chann<strong>el</strong><br />

MMU<br />

multi CPU systems<br />

NIL<br />

NULL<br />

phantom process<br />

pool<br />

In OSE, a handler is a piece of code which is automatically<br />

executed when a system event has occurred. Examples of handlers<br />

are swap in handler, swap out handler and send handler.<br />

Availability of handlers is strongly implementation dependent.<br />

An OSE system mechanism, mainly used for multi-CPU<br />

communication, to get the process identity of a named process.<br />

A state an OSE process enters when a breakpoint is reached.<br />

The boundary between processes. Together, all possible contacts<br />

between two processes defines their interface. In OSE, the process<br />

interface consists of the signals exchanged between the processes.<br />

An event which, through hardware or software, causes the CPU to<br />

transfer control from the currently running process to an interrupt<br />

process.<br />

An OSE interrupt process is called when a hardware or software<br />

interrupt occurs. Two types of interrupt processes exist in OSE;<br />

interrupt processes and timer-interrupt processes.<br />

The central part of an operating system which handles things like<br />

dispatching, resource allocation and inter process communication.<br />

The simplest of the OSE implementation lev<strong>el</strong>s. Also known as the<br />

portable set.<br />

The OSE implementation lev<strong>el</strong>s which contains all necessary parts<br />

to build a distributed real time system.<br />

Complete kern<strong>el</strong> configuration except for memory management,<br />

local pools, user numbers and complete breakpoint functionality.<br />

The complete kern<strong>el</strong> configuration.<br />

Handles signal exchange between remote processes in an OSE<br />

system.<br />

A link between remote processes that is managed by a link handler.<br />

A memory management unit (MMU) is hardware capable of<br />

protecting memory areas from illegal access.<br />

A system with more than one CPU and with some connection<br />

between the CPUs.<br />

A constant defined by OSE. Used as a return value in receive,<br />

receive_w_tmo and receive_from system calls when no signal<br />

buffer could be received.<br />

A pointer guaranteed not to point to a data object.<br />

An empty process with an optional redirection table.<br />

A contiguous area of memory from which signal buffers, stacks<br />

and kern<strong>el</strong> areas are allocated. There may be more than one pool<br />

in OSE.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 7 : 2<br />

Glossary


<strong>Kern</strong><strong>el</strong><br />

pre-emption<br />

priority<br />

process<br />

process identity<br />

process state<br />

process types<br />

real-time operating system<br />

redirection table<br />

re-entrant<br />

remote system calls<br />

scheduling<br />

segments<br />

semaphore<br />

signal<br />

signal redirection<br />

software event<br />

static process<br />

Interrupting an activity in progress immediat<strong>el</strong>y without letting it<br />

finish, and starting some other activity.<br />

Each process in an OSE system has a priority. The meaning of the<br />

priority differs between process types but always defines the order<br />

in which different activities will be carried out.<br />

Processes are the building blocks in OSE. Each process is a<br />

sequential program component that has its own flow-of-control, its<br />

own stack and CPU registers.<br />

In OSE a number identifying a process. It is necessary to know the<br />

process identity before you can send a signal to the process.<br />

A process running under OSE is always in one of three states;<br />

running, ready or waiting.<br />

Each OSE process is of one of the following process types;<br />

interrupt process, timer-interrupt process, prioritized process,<br />

background process or phantom process.<br />

Programs which have to react to external events within a limited<br />

time are called real-time programs. An operating system designed<br />

to handle such programs is a real-time operating system.<br />

A table defining signal routes to receivers other than the original.<br />

Processes may be equipped with redirection tables.<br />

Code is re-entrant if more than one process at a time may execute<br />

it. This requires that the code does not use fixed variable locations;<br />

it must use registers or stack, i.e. only r<strong>el</strong>ative addressing is<br />

allowed. The OSE system calls are re-entrant but many C-libraries<br />

are not.<br />

System calls which operate on processes or blocks in other CPUs.<br />

The way the operating system s<strong>el</strong>ects which process to run at a<br />

given instant.<br />

Pools may be grouped together into segments.<br />

In OSE, a way to obtain a fast process synchronisation mechanism<br />

when no data needs to be transferred between processes.<br />

The most common way in OSE to transfer information between<br />

processes. A signal is a buffer allocated from the kern<strong>el</strong> and usually<br />

contains data.<br />

In OSE it is possible to change the addressee of a signal. This is<br />

called signal redirection. Signal redirection is maintained through<br />

a redirection table.<br />

A way to wake up an interrupt process directly from another<br />

process by sending a signal to it.<br />

Processes which are created by the kern<strong>el</strong> at system start. Static<br />

processes may never be killed.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 7 : 3<br />

Glossary


superuser<br />

supervisor<br />

swap<br />

system calls<br />

system processes<br />

system tick<br />

user number<br />

In OSE, a process with user number 0. The superuser has access to<br />

all other processes.<br />

A CPU dependent execution mode. In OSE a process running in<br />

supervisor mode does not necessarily have to be a superuser.<br />

Refers to exchanging control from one process to another.<br />

The interface between application processes and the kern<strong>el</strong>.<br />

Usually a function call in the C programming language.<br />

Internal processes in an OSE implementation.<br />

In OSE, system tick is a counter which is incremented by a call to<br />

the system function tick. Timer-interrupt processes, d<strong>el</strong>ays and<br />

timeouts are dependent on the system tick to work. The system tick<br />

should be generated from a system hardware timer.<br />

To protect functionally separated software from each other, OSE<br />

equips processes with user numbers. With one exception, only<br />

processes having the same user number may communicate with<br />

each other. The superuser can communicate with all processes.<br />

<strong>Kern</strong><strong>el</strong><br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - 7 : 4<br />

Glossary


Appendix A ASCII Character Set<br />

ASCII control characters<br />

Dec Hex Dec Hex<br />

<strong>Kern</strong><strong>el</strong><br />

0 0 NUL Null 16 10 DLE Data linkescape<br />

1 1 SOH Start of heading 17 11 DC1 Device control 1<br />

2 2 STX Start of text 18 12 DC2 Device control 2<br />

3 3 ETX End of text 19 13 DC3 Device control 3<br />

4 4 EOT End of transmission<br />

20 14 DC4 Device control 4<br />

5 5 ENQ Enquiry 21 15 NAK Negative Acknowledge<br />

6 6 ACK Acknowledge 22 16 SYN Synchronous<br />

idle<br />

7 7 BEL B<strong>el</strong>l 23 17 ETB End of transmission<br />

block<br />

8 8 BS Backspace 24 18 CAN Canc<strong>el</strong><br />

9 9 HT Horizontal tab 25 19 EM End of medium<br />

10 A LF Line feed 26 1A SUB Substitute<br />

11 B VT Vertical tab 27 1B ESC Escape<br />

12 C FF Form feed 28 1C FS File separator<br />

13 D CR Carriage return 29 1D GS Group separator<br />

14 E SO Shift out 30 1E RS Record separator<br />

15 F SI Shift in 31 1F US Unit separator<br />

ASCII normal characters<br />

Dec Hex Dec Hex Dec Hex<br />

32 20 Space 64 40 @ 96 60 ’<br />

33 21 ! 65 41 A 97 61 a<br />

34 22 " 66 42 B 98 62 b<br />

35 23 # 67 43 C 99 63 c<br />

36 24 $ 68 44 D 100 64 d<br />

37 25 % 69 45 E 101 65 e<br />

38 26 & 70 46 F 102 66 f<br />

39 27 ' 71 47 G 103 67 g<br />

40 28 ( 72 48 H 104 68 h<br />

41 29 ) 73 49 I 105 69 i<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - Appendix A : 1<br />

ASCII Character Set


<strong>Kern</strong><strong>el</strong><br />

Dec Hex Dec Hex Dec Hex<br />

42 2A * 74 4A J 106 6A j<br />

43 2B + 75 4B K 107 6B k<br />

44 2C , 76 4C L 108 6C l<br />

45 2D - 77 4D M 109 6D m<br />

46 2E . 78 4E N 110 6E n<br />

47 2F / 79 4F O 111 6F o<br />

48 30 0 80 50 P 112 70 p<br />

49 31 1 81 51 Q 113 71 q<br />

50 32 2 82 52 R 114 72 r<br />

51 33 3 83 53 S 115 73 s<br />

52 34 4 84 54 T 116 74 t<br />

53 35 5 85 55 U 117 75 u<br />

54 36 6 86 56 V 118 76 v<br />

55 37 7 87 57 W 119 77 w<br />

56 38 8 88 58 X 120 78 x<br />

57 39 9 89 59 Y 121 79 y<br />

58 3A : 90 5A Z 122 7A z<br />

59 3B ; 91 5B [ 123 7B {<br />

60 3C < 92 5C \ 124 7C |<br />

61 3D = 93 5D ] 125 7D }<br />

62 3E > 94 5E ^ 126 7E ~<br />

63 3F ? 95 5F _ 127 7F D<strong>el</strong>ete<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - Appendix A : 2<br />

ASCII Character Set


Appendix B Portability Considerations<br />

One fundamental idea when designing OSE D<strong>el</strong>ta was to gather the operating systems for the<br />

different CPUs together to make it more general.<br />

The major part of OSE D<strong>el</strong>ta is written in C: only the CPU specific parts and very time-critical parts<br />

are written in assembler. This results in an easy way to port OSE D<strong>el</strong>ta to any target CPU. The older<br />

OSE kern<strong>el</strong>s are all written in assembler and are very CPU specific. This can lead to problems when<br />

porting an application written for an older OSE kern<strong>el</strong> to OSE D<strong>el</strong>ta.<br />

Variable sizes<br />

The biggest problem is if the application is dependent on the size of variables, the OSE types have<br />

other sizes in OSE D<strong>el</strong>ta than in older OSE kern<strong>el</strong>s. The most obvious examples are the PROCESS<br />

and SIGSELECT types. Fortunat<strong>el</strong>y, applications written in C are usually not dependent on variable<br />

sizes.<br />

<strong>Kern</strong><strong>el</strong><br />

Link<br />

Handler<br />

Debugger<br />

Interface<br />

Handlers<br />

Create_proc<br />

system call<br />

OSE D<strong>el</strong>ta<br />

The link handler mechanism<br />

is complet<strong>el</strong>y new in OSE<br />

D<strong>el</strong>ta.<br />

In OSE D<strong>el</strong>ta the debugger<br />

interface is the same for all<br />

CPUs.<br />

Because of CPU dependency<br />

all the handlers are new in<br />

OSE D<strong>el</strong>ta.<br />

The create_proc system call<br />

in the OSE Classic kern<strong>el</strong> is<br />

not part of OSE D<strong>el</strong>ta concept.<br />

It is however still implemented<br />

for backwards<br />

compatibility so it is possible<br />

to run an application using<br />

the create_proc system<br />

call.<br />

The create_proc system call<br />

should not be used when<br />

writing new OSE D<strong>el</strong>ta applications.<br />

Older OSE kern<strong>el</strong><br />

This means that link handlers<br />

for older OSE kern<strong>el</strong>s have to<br />

be able to run in an OSE D<strong>el</strong>ta<br />

system.<br />

In older OSE kern<strong>el</strong>s the<br />

debugger interface is CPU<br />

dependent, all kern<strong>el</strong>s have different<br />

debugger interfaces.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - Appendix B : 1<br />

Portability Considerations


<strong>Kern</strong><strong>el</strong><br />

Background<br />

Processes<br />

Wake_up<br />

system call<br />

A prioritized process does<br />

not have a time slice in OSE<br />

D<strong>el</strong>ta. Instead there is a separate<br />

process type called<br />

background process which<br />

always run in strict time<br />

sharing mode on a priority<br />

lev<strong>el</strong> b<strong>el</strong>ow other processes.<br />

The background process<br />

lev<strong>el</strong> that exists in the OSE<br />

Classic kern<strong>el</strong> is not present<br />

in OSE D<strong>el</strong>ta.<br />

Another difference concerning<br />

background processes is<br />

that when a background<br />

process is swapped out before<br />

the time slice has expired<br />

the time slice is not<br />

restarted when it is swapped<br />

in again as in OSE Classic<br />

kern<strong>el</strong>s. The background<br />

process starts executing at<br />

the place in the time slice<br />

where it was swapped out.<br />

The wake_up feature differs<br />

between older OSE kern<strong>el</strong>s<br />

and OSE D<strong>el</strong>ta.<br />

In OSE D<strong>el</strong>ta an interruptprocess<br />

can be invoked with<br />

the wake_up feature by<br />

sending a signal to it. The<br />

wake_up call informs the<br />

process what caused the interrupt.<br />

If not used and a<br />

signal is sent to an interruptprocess,<br />

the process will<br />

start executing anyway.<br />

The background process concept<br />

is not present in the OSE<br />

Classic kern<strong>el</strong>. Instead there is<br />

a background process lev<strong>el</strong>.<br />

In older OSE kern<strong>el</strong>s the<br />

wake_up feature is either aconfiguration<br />

option or not present<br />

at all.<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - Appendix B : 2<br />

Portability Considerations


<strong>Kern</strong><strong>el</strong><br />

Index<br />

A<br />

addressee 3 : 1<br />

addressee process 3 : 92<br />

alloc definition 3 : 3<br />

assign_linkhandler definition 3 : 5<br />

attach definition 3 : 7<br />

attach_block definition 3 : 9<br />

attach_segment 3 : 10<br />

B<br />

background process 3 : 19, 3 : 20, 3 : 54<br />

block descriptor 3 : 13, 3 : 75<br />

block error handler 3 : 15<br />

block ID 3 : 20, 3 : 32, 3 : 56<br />

block name 3 : 13<br />

block owner 3 : 13<br />

block start 3 : 115<br />

block status 3 : 13, 3 : 43<br />

block type 3 : 54<br />

blocks<br />

attaching 3 : 9<br />

attaching a pool to 3 : 17<br />

block ID 3 : 20, 3 : 32, 3 : 56<br />

creating 3 : 13<br />

descriptor 3 : 13, 3 : 75<br />

killing 3 : 96<br />

name 3 : 13<br />

owner 3 : 13<br />

starting 3 : 115<br />

status 3 : 13, 3 : 43<br />

stoping 3 : 118<br />

breakpoint 3 : 73, 3 : 96<br />

breakpoints<br />

clearing 3 : 11<br />

setting 3 : 96<br />

byte order 5 : 1<br />

C<br />

caller information reference 6 : 12<br />

clear_bp 3 : 11<br />

CPU registers 3 : 103<br />

CPU type 3 : 35<br />

create_block 3 : 13<br />

create_error_handler 3 : 15<br />

create_pool 3 : 17<br />

create_process 3 : 19<br />

create_sem 3 : 23<br />

current owner 3 : 87<br />

current_process 3 : 25<br />

D<br />

data types 4 : 3<br />

dead process<br />

breakpoint in 3 : 11, 3 : 96<br />

detection of 3 : 7<br />

flushing queue of 3 : 30<br />

ID of 3 : 32<br />

sending signals to 3 : 92, 3 : 95<br />

debugger system calls<br />

clear_bp 3 : 11<br />

get_mem 3 : 41<br />

get_pcb 3 : 43<br />

get_poolcb 3 : 50<br />

get_sig_info 3 : 58<br />

get_signal 3 : 62<br />

get_systime 3 : 65<br />

intercept 3 : 73<br />

resume 3 : 89<br />

set_mem 3 : 102<br />

set_pcb 3 : 103<br />

d<strong>el</strong>ay 3 : 26<br />

detach 3 : 27<br />

dummy process 3 : 19<br />

dynamic semaphore 3 : 23<br />

E<br />

environment variable 2 : 2, 2 : 7, 3 : 36, 3 : 37, 3<br />

: 39, 3 : 99, 3 : 100<br />

environment variables<br />

reading 3 : 36, 3 : 37, 3 : 39<br />

setting 3 : 99, 3 : 100<br />

error 3 : 28, 6 : 12<br />

error codes 3 : 28, 3 : 29, 6 : 1<br />

error handler 6 : 1<br />

system call in progress 6 : 12<br />

error code 3 : 28, 3 : 29<br />

error handler 4 : 1, 6 : 1<br />

block error handler 3 : 15, 3 : 28, 3 : 29<br />

create_error_handler 3 : 15<br />

entrypoint 3 : 14, 3 : 15<br />

kern<strong>el</strong> error handler 3 : 15<br />

lev<strong>el</strong> of 3 : 15<br />

process error handler 3 : 15<br />

error handler entrypoint 3 : 15<br />

error lev<strong>el</strong> 3 : 15<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - index : 1<br />

Index


<strong>Kern</strong><strong>el</strong><br />

error messages 6 : 1, 6 : 14, 6 : 15<br />

error report 3 : 28, 3 : 29<br />

error2 3 : 29<br />

F<br />

fast semaphore 3 : 40, 3 : 101, 3 : 113, 3 : 121<br />

fast semaphores<br />

setting 3 : 101<br />

signalling 3 : 113<br />

value of 3 : 40, 3 : 44<br />

waiting for 3 : 122<br />

flush 3 : 30<br />

free_buf 3 : 31<br />

G<br />

get_bid 3 : 32<br />

get_bid_list 3 : 33<br />

get_cpu 3 : 35<br />

get_env 3 : 36<br />

get_env_list 3 : 37<br />

get_envp 3 : 39<br />

get_fsem 3 : 40<br />

get_mem 3 : 41<br />

get_pcb 3 : 43<br />

get_pid_list 3 : 47<br />

get_pool_list 3 : 49<br />

get_poolcb 3 : 50<br />

get_pri 3 : 53<br />

get_ptype 3 : 54<br />

get_segid 3 : 56<br />

get_sem 3 : 57<br />

get_sig_info 3 : 58<br />

get_sig_poolid 3 : 61<br />

get_signal 3 : 62<br />

get_stk_poolid 3 : 64<br />

get_systime 3 : 65<br />

get_ticks 3 : 66<br />

get_uid 3 : 67<br />

H<br />

hardware interrupt 3 : 20, 3 : 123<br />

hardware priority 3 : 123<br />

hardware vector 3 : 21<br />

header files 4 : 1, 4 : 3<br />

hunt 3 : 68<br />

hunt_from 3 : 71<br />

I<br />

implementation lev<strong>el</strong> 2 : 1, 3 : 130<br />

intercept 3 : 73<br />

intercept status 3 : 89<br />

interrupt process 3 : 19<br />

interrupt process priority 3 : 19<br />

K<br />

kern<strong>el</strong> error handler 3 : 15<br />

kill_proc 3 : 75<br />

kill_sem 3 : 77<br />

L<br />

link handlers<br />

assign_linkhandler definition 3 : 5<br />

byte order 5 : 1<br />

example of 5 : 13<br />

header file 4 : 1<br />

hunt request 3 : 68–3 : 69<br />

linkname 3 : 5<br />

signal structure 5 : 1<br />

linkname 3 : 5<br />

local pools 3 : 17<br />

M<br />

manifest constants 4 : 1<br />

mem_move 3 : 78<br />

memory management<br />

attach_block 3 : 9<br />

attach_segment 3 : 10<br />

creating a pool 3 : 17<br />

include files for 4 : 1<br />

killing segments 3 : 75<br />

moving memory 3 : 78<br />

supervising segments 3 : 7<br />

writing memory 3 : 102<br />

memory manager 3 : 102<br />

memory manager block 3 : 78, 3 : 91, 3 : 108<br />

MMU 3 : 78, 3 : 91, 3 : 108, 3 : 109<br />

N<br />

negative receive specification 3 : 81<br />

NIL 3 : 125<br />

O<br />

OS_ATTACH_SIG 3 : 127<br />

OS_DEBUG 3 : 128<br />

OS_PROCESS 3 : 132<br />

OS68 3 : 126<br />

OSE 3 : 129<br />

OSE_I 3 : 131<br />

OSE_LEVEL_x 3 : 130<br />

OSSIM 3 : 133<br />

owner 3 : 3<br />

P<br />

phantom process 3 : 19<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - index : 2<br />

Index


<strong>Kern</strong><strong>el</strong><br />

pool<br />

create pool 3 : 17<br />

local pool 3 : 17<br />

returning memory 3 : 31<br />

system pool 3 : 17<br />

power fail handler 3 : 79<br />

power_fail 3 : 79<br />

prioritized process 3 : 19<br />

priority 3 : 19, 3 : 53, 3 : 104, 3 : 105<br />

process entrypoint 3 : 19, 3 : 132<br />

process error handler 3 : 15<br />

process name 3 : 19<br />

process start 3 : 89, 3 : 115<br />

process status 3 : 43<br />

process stop 3 : 118<br />

process type 3 : 54<br />

processes<br />

background 3 : 19, 3 : 20, 3 : 73, 3 : 89, 3 :<br />

103, 3 : 115, 3 : 118<br />

control block 3 : 43, 3 : 102<br />

creating 3 : 19<br />

current 3 : 25<br />

dummy 3 : 19<br />

entrypoint 3 : 19<br />

hunting 3 : 68<br />

identity 3 : 43, 3 : 47<br />

intercepting 3 : 73<br />

interrupt 3 : 19, 3 : 73, 3 : 123<br />

interrupt vector 3 : 20<br />

killing 3 : 75<br />

name 3 : 19, 3 : 45, 3 : 68<br />

phantom 3 : 19, 3 : 44<br />

prioritized 3 : 19, 3 : 89, 3 : 103, 3 : 104, 3 :<br />

105, 3 : 115, 3 : 118<br />

priority 3 : 19, 3 : 44, 3 : 53, 3 : 104, 3 : 105<br />

redirection table 3 : 20, 3 : 106<br />

resuming 3 : 89<br />

stack 3 : 19, 3 : 21, 3 : 44<br />

starting 3 : 115<br />

status 3 : 43, 3 : 73, 3 : 89, 4 : 4<br />

stoping 3 : 118<br />

superuser 3 : 13<br />

suspending 3 : 26<br />

timer interrupt 3 : 19, 3 : 20, 3 : 73, 3 : 89, 3<br />

: 115, 3 : 118<br />

timeslice 3 : 20<br />

type 3 : 19<br />

waking up 3 : 123<br />

programloader 3 : 102<br />

R<br />

receive_from 3 : 83<br />

receive_w_tmo 3 : 85<br />

recieve 3 : 81<br />

recieve timeout 3 : 85<br />

redirection table 3 : 92<br />

remote call server<br />

header files for 4 : 1<br />

killing 3 : 75<br />

parameter structure 5 : 4<br />

signal definition 5 : 1<br />

remote systems calls<br />

parameters of 5 : 4<br />

remote responses 5 : 3<br />

remote_call_server 3 : 13<br />

use_remote_calls 3 : 13<br />

remote_call_server 3 : 13<br />

restore 3 : 87<br />

resume 3 : 89<br />

S<br />

segment descriptor 3 : 10<br />

segment ID 3 : 10<br />

segment number 3 : 10<br />

segments<br />

attaching 3 : 10<br />

descriptor 3 : 10<br />

ID 3 : 10<br />

killing 3 : 75<br />

numbers 3 : 10, 3 : 108<br />

s<strong>el</strong>ect_segment 3 : 91<br />

semaphores within 3 : 23<br />

setting 3 : 108<br />

setting mode 3 : 109<br />

supervising 3 : 7<br />

supervisor space 3 : 10<br />

semaphore 3 : 114, 3 : 122<br />

semaphore value 3 : 57<br />

semaphores<br />

create_sem 3 : 23<br />

dynamic 3 : 23<br />

killing 3 : 23, 3 : 77<br />

signalling 3 : 114<br />

static 3 : 23<br />

value of 3 : 57<br />

waiting for 3 : 122<br />

send 3 : 92<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - index : 3<br />

Index


<strong>Kern</strong><strong>el</strong><br />

send_w_s 3 : 95<br />

sender 3 : 94<br />

set_bp 3 : 96<br />

set_env 3 : 99<br />

set_envp 3 : 100<br />

set_fsem 3 : 101<br />

set_mem 3 : 102<br />

set_pcb 3 : 103<br />

set_pri 3 : 104<br />

set_pri_for 3 : 105<br />

set_redirection 3 : 106<br />

set_segment 3 : 108<br />

set_segment_mode 3 : 109<br />

set_sigsize 3 : 110<br />

set_suid 3 : 111<br />

signal buffer 3 : 3, 3 : 110, 3 : 112<br />

signal number 3 : 3, 3 : 81<br />

signal owner 3 : 92<br />

signal queue 3 : 62, 3 : 81<br />

signal structs 4 : 3<br />

signal_fsem 3 : 113<br />

signal_sem 3 : 114<br />

signals<br />

allocating 3 : 3<br />

attaching 3 : 7, 3 : 127<br />

detaching 3 : 27<br />

freeing 3 : 31<br />

owner 3 : 3, 3 : 31<br />

receiving 3 : 81, 3 : 83<br />

redirecting 3 : 92<br />

remote signals 5 : 1<br />

restoring 3 : 87<br />

sending 3 : 92, 3 : 95<br />

signal addressee 3 : 1<br />

signal number 3 : 7, 5 : 1<br />

signal s<strong>el</strong>ection 3 : 81, 3 : 83, 3 : 85<br />

signal sender 3 : 94<br />

signal structures 4 : 3<br />

size 3 : 110, 3 : 112<br />

union signal 4 : 3<br />

sigsize 3 : 112<br />

software event 3 : 123<br />

start 3 : 115<br />

start_OSE 3 : 117<br />

static semaphore 3 : 23<br />

stop 3 : 118<br />

superuser 3 : 111<br />

superuser processes 3 : 10<br />

superuser system calls<br />

attach_block 3 : 9<br />

attach_segment 3 : 10<br />

mem_move 3 : 78<br />

power_fail 3 : 79<br />

set_mem 3 : 102<br />

set_segment 3 : 108<br />

set_segment_mode 3 : 109<br />

set_suid 3 : 111<br />

tick 3 : 120<br />

supervise a memory segment 3 : 7<br />

supervisor space 3 : 10<br />

system<br />

shut down 3 : 79<br />

starting 3 : 117<br />

system calls<br />

addressee 3 : 1<br />

alloc 3 : 3<br />

assign_linkhandler 3 : 5<br />

attach 3 : 7<br />

attach_block 3 : 9<br />

attach_segment 3 : 10<br />

clear_bp 3 : 11<br />

create_block 3 : 13<br />

create_error_handler 3 : 15<br />

create_pool 3 : 17<br />

create_process 3 : 19<br />

create_sem 3 : 23<br />

current_process 3 : 25<br />

d<strong>el</strong>ay 3 : 26<br />

detach 3 : 27<br />

error 3 : 28<br />

error2 3 : 29<br />

flush 3 : 30<br />

free_buf 3 : 31<br />

get_bid 3 : 32<br />

get_bid_list 3 : 33<br />

get_cpu 3 : 35<br />

get_env 3 : 36<br />

get_env_list 3 : 37<br />

get_envp 3 : 39<br />

get_fsem 3 : 40<br />

get_mem 3 : 41<br />

get_pcb 3 : 43<br />

get_pid_list 3 : 47<br />

get_pool_list 3 : 49<br />

get_poolcb 3 : 50<br />

get_pri 3 : 53<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - index : 4<br />

Index


<strong>Kern</strong><strong>el</strong><br />

get_ptype 3 : 54<br />

get_segid 3 : 56<br />

get_sem 3 : 57<br />

get_sig_info 3 : 58<br />

get_sig_poolid 3 : 61<br />

get_signal 3 : 62<br />

get_stk_poolid 3 : 64<br />

get_systime 3 : 65<br />

get_ticks 3 : 66<br />

get_uid 3 : 67<br />

hunt 3 : 68<br />

hunt_from 3 : 71<br />

intercept 3 : 73<br />

kill_proc 3 : 75<br />

kill_sem 3 : 77<br />

mem_move 3 : 78<br />

NIL 3 : 125<br />

OS_ATTACH_SIG 3 : 127<br />

OS_DEBUG 3 : 128<br />

OS_PROCESS 3 : 132<br />

OS68 3 : 126<br />

OSE 3 : 129<br />

OSE_I 3 : 131<br />

OSE_LEVEL_x 3 : 130<br />

OSSIM 3 : 133<br />

power_fail 3 : 79<br />

receive 3 : 81<br />

receive_from 3 : 83<br />

receive_w_tmo 3 : 85<br />

restore 3 : 87<br />

resume 3 : 89<br />

s<strong>el</strong>ecting 3 : 91<br />

send 3 : 92<br />

send_w_s 3 : 95<br />

sender 3 : 94<br />

set_bp 3 : 96<br />

set_env 3 : 99<br />

set_envp 3 : 100<br />

set_fsem 3 : 101<br />

set_mem 3 : 102<br />

set_pcb 3 : 103<br />

set_pri 3 : 104<br />

set_pri_for 3 : 105<br />

set_redirection 3 : 106<br />

set_segment 3 : 108<br />

set_segment_mode 3 : 109<br />

set_sigsize 3 : 110<br />

set_suid 3 : 111<br />

signal_fsem 3 : 113<br />

signal_sem 3 : 114<br />

sigsize 3 : 112<br />

start 3 : 115<br />

start_OSE 3 : 117<br />

stop 3 : 118<br />

SYSTEM_TICK 3 : 135<br />

system_tick 3 : 119, 3 : 135<br />

tick 3 : 120<br />

wait_fsem 3 : 121<br />

wait_sem 3 : 122<br />

wake_up 3 : 123<br />

system clock<br />

running 3 : 120<br />

system pool 3 : 17<br />

system restart 3 : 79<br />

system start 3 : 117<br />

system tick<br />

length of 3 : 119<br />

system tick counter 3 : 65, 3 : 66, 3 : 135<br />

SYSTEM_TICK 3 : 135<br />

system_tick 3 : 119<br />

T<br />

tick 3 : 120<br />

timer-interrupt process 3 : 19<br />

timeslice 3 : 20<br />

type definitions 4 : 3<br />

U<br />

union signal 4 : 3<br />

use_remote_calls 3 : 13<br />

user number 3 : 67<br />

W<br />

wait_fsem 3 : 121<br />

wait_sem 3 : 122<br />

wake_up 3 : 123<br />

Reference Manual / R1.0.4 OSE / <strong>Kern</strong><strong>el</strong> - index : 5<br />

Index

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!