10.0;itest (IOS test), revision 1.0, 88/04/22
ios_test - test ios_$ calls
usage: ios_test [-init]
DESCRIPTION
ios_test is a program for testing type managers that manage input and
output to objects. ios_test allows you to open a stream to any type of
object and then use selected IOS calls on the open stream. With
ios_test, you can open streams to existing or new objects. For more
information on using ios_test to test type managers, see Using the
Open System Toolkit to Extend the Streams Facility.
OPTIONS
-init
Call the ios_$initialize routine (within a type manager) at start-up
time.
COMMANDS SUMMARY
ios_test prompts for commands. Any valid, unambiguous prefix of one of
the following commands will suffice. Each command calls the IOS
call with a similar name. For example, the close command calls
ios_$close.
Syntax Function
change_path_name stream-id pathname
Changes the pathname of an object.
close stream-id Closes a stream.
create create-mode [open-options] pathname typename
Creates an object and opens a stream to it.
delete stream-id Deletes an object and closes the associated
stream.
dup stream-id stream-id Creates a copy of a specified stream ID.
equal stream-id-1 stream-id-2
Determines whether two stream IDs refer to the
same object.
export stream-id Simulates stream passing via a pgm_$invoke
system call. This command tests a type manager's
export and import procedures.
force_write stream-id Forcibly writes an object and the directory
containing the object to stable storage.
get [put-get-option] stream-id count
Copies data from a stream into a buffer.
inq_byte_pos [pos-opt] stream-id
Returns the byte position of the stream marker.
If you omit a position option, the default is
the current position of the stream marker.
inq_conn_flags stream-id
Displays the current "on" (true) connection
flags for a connection.
inq_cur_rec_len stream-id
Returns the length of the record at the current
stream marker.
inq_file_attr stream-id Returns object usage attributes.
inq_flags stream-id Returns the attribute set of an object's type
manager.
inq_full_key [pos-opt] stream-id
Returns a full seek key. If you omit a position
option, the default is the current position of
the stream marker.
inq_obj_flags stream-id Displays the current "on" (true) object flags
for an object.
inq_path_name [name-type] stream-id
Returns the pathname of the object to which a
stream is open. If you omit a name-type, the
default is -root.
inq_rec_pos [pos-opt] stream-id
Returns the record position of the stream
marker. If you omit a position option, the
default is the current position of the stream
marker.
inq_rec_rem stream-id Returns the number of bytes remaining in the
current record.
inq_rec_type stream-id Returns the record type of an object.
inq_short_key [pos-opt] stream-id
Returns a short seek key. If you omit a position
option, the default is the current position of
the stream marker.
inq_type_uid stream-id Returns the type UID of an object.
locate stream-id count Reads data from a stream, returning a pointer to
the data (rather than copying the data to a
buffer).
open [open-options] pathname
Opens a stream to an existing object.
put [put-get-options] [-nl] stream-id string
Writes data into an object. The -nl option
inserts a newline character at the end of the
string, the default writes only the data.
readdir stream-id maxcnt bufsize
Reads up to maxcnt dir entries or so long as
there is space in bufsize (or EOF is reached).
replicate stream-id stream-id
Creates a copy of a specified stream ID.
rewinddir stream-id Rewinds dir stream-id to beginning-of-file
(BOF).
seek [-relative [-minus]] [-record] stream-id count
Performs an absolute or relative seek using byte
or record positioning. If you omit the -relative
option, the default is an absolute seek. If you
omit the -minus option, the default is to seek
forward, towards the end of the file. If you
omit the -record option, the default is to seek
by bytes.
seekdir stream-id key Positions to key within dir stream-id (key must
be returned by telldir)
seek_full stream-id recadr byteadr
Performs a seek using a full (8-byte) seek key.
seek_short stream-id key Performs a seek using a short 4-byte seek key.
seek_to_bof stream-id Positions the stream marker to the beginning of
an object.
seek_to_eof stream-id Positions the stream marker to the end of an
object.
set_conn_flag stream-id connection-flag [t | f]
Sets a connection flag to be on (true) or off
(false). "connection-flag" can be one of:
"tty", "ipc", "vt", "write", "append",
"unregulated", or "read_intend_writ".
set_obj_flag stream-id object-flag [t | f]
Sets an object flag to be on (true) or off
(false). "object-flag" can be one of: "delete",
"spare", "ascii", "ftncc", or "cond".
set_rec_type stream-id rec-type rec-len
Sets an object's record type and length. "rec-
type" can be one of: "v1", "f2", "undef",
"exf2", or "f1". "rec-len" is the integer
record length.
switch stream-id stream-id
Switches a stream from one stream ID to another
stream ID.
telldir stream-id Returns a key that refers to current position in
dir stream-id
truncate stream-id Deletes the contents of an object following the
current stream marker.
Use one of the following to specify create-mode. These options
correspond to the ios_$create_mode_t data type.
-no_pre_exist Returns an error if object already exists.
-preserve Saves contents of object, if it exists, opens
object, and positions stream marker at BOF.
-recreate Deletes existing object and creates new one of
the same name.
-truncate Opens object, then truncates the contents.
-make_backup Creates a backup (.bak) file when closed.
-loc_name_only Creates a temporary unnamed object, uses
pathname to specify location of object, and
locates it on the same volume.
Use one of the following to specify name-type. These options correspond
to the ios_$name_type_t data type.
-leaf Specifies leaf name regardless of object's name.
-ndir Specifies leaf name if object's name is a name
in current naming directory; otherwise,
specifies full pathname.
-node Specifies name relative to the root directory if
object is a name in boot volume; otherwise,
specifies full pathname.
-node_data Specifies leaf name if object's name is a name
in current node_data directory; otherwise,
specifies full pathname.
-root Specifies full pathname, for example,
//node/sid/file.
-wdir Specifies leaf name if object's name is a name
in current working directory; otherwise,
specifies full pathname.
Use one or more of the following to specify open-options. These options
correspond to the ios_$open_options_t data type.
-no_d[elay] ios_$open does not wait for the open to complete
before returning.
-w[rite] Permits writing data to a new object.
-unreg[ulated] Permits concurrent writing (unregulated read and
write access) to the object.
-position_to_eof Positions stream marker at EOF at open.
-inq[uire_only] Opens object for attribute inquiries only.
Use one of the following to specify pos-opt. These options correspond to
the ios_$pos_opt_t data type.
-bof Returns key for EOF marker.
-eof Returns key for BOF marker.
Use one or more of the following to specify put-get-options. These
options correspond to the ios_$put_get_opts_t data type.
-cond Gets or puts data conditionally. If the data is
not available, returns with a status indicating
that condition.
-pre[view] Determines if a put/get would succeed, but does
not actually perform data transfer.
-part[ial_record] Puts the data, but does not terminate the
record.
-no_rec_[bndry] Ignore record (line) boundaries.
DEBUGGING MANAGERS
Under normal conditions, user-written managers are dynamically loaded
into the opener's address space. While you can use ios_test to test such
managers, the manager code itself can not be debugged using debug at the
present time.
To debug managers using ios_test, you must follow the convention that
your manager contains no "main program" (PROGRAM in Pascal, "main" in C).
Instead, the initialization for your manager (the part that calls
trait_$mgr_dcl, etc.) should be placed in a procedure named
"ios_$initialize". To debug your manager module using ios_test, bind all
the pieces of your manager together with /com/ios_test. Then use debug
on the result of the bind and give the -init option. For example
$ bind -b my_itest <<!
my_mgr.bin
my_mgr_uid.bin
/sys/traits/io_traits
/com/itest
!
$ debug -src my_itest -init