blob: 3d8fd1498e9d5c591425deb0deab9d5657bc6dc0 [file] [log] [blame]
Guido van Rossumecde7811995-03-28 13:35:14 +00001\chapter{Amoeba Specific Services}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +00002
Fred Drake295da241998-08-10 19:42:37 +00003\section{\module{amoeba} ---
Fred Drakec7dd3e11999-01-07 15:45:55 +00004 Amoeba system support.}
Fred Drakeb91e9341998-07-23 17:59:49 +00005\declaremodule{builtin}{amoeba}
6
Fred Drakec7dd3e11999-01-07 15:45:55 +00007\modulesynopsis{Functions for the Amoeba operating system.}
Fred Drakeb91e9341998-07-23 17:59:49 +00008
Fred Drake12918af1998-02-18 15:10:24 +00009
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000010This module provides some object types and operations useful for
11Amoeba applications. It is only available on systems that support
12Amoeba operations. RPC errors and other Amoeba errors are reported as
13the exception \code{amoeba.error = 'amoeba.error'}.
14
15The module \code{amoeba} defines the following items:
16
Fred Drakecce10901998-03-17 06:33:25 +000017\begin{funcdesc}{name_append}{path, cap}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000018Stores a capability in the Amoeba directory tree.
19Arguments are the pathname (a string) and the capability (a capability
20object as returned by
21\code{name_lookup()}).
22\end{funcdesc}
23
24\begin{funcdesc}{name_delete}{path}
25Deletes a capability from the Amoeba directory tree.
26Argument is the pathname.
27\end{funcdesc}
28
29\begin{funcdesc}{name_lookup}{path}
30Looks up a capability.
31Argument is the pathname.
32Returns a
33\dfn{capability}
34object, to which various interesting operations apply, described below.
35\end{funcdesc}
36
Fred Drakecce10901998-03-17 06:33:25 +000037\begin{funcdesc}{name_replace}{path, cap}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000038Replaces a capability in the Amoeba directory tree.
39Arguments are the pathname and the new capability.
40(This differs from
41\code{name_append()}
42in the behavior when the pathname already exists:
43\code{name_append()}
44finds this an error while
45\code{name_replace()}
46allows it, as its name suggests.)
47\end{funcdesc}
48
49\begin{datadesc}{capv}
50A table representing the capability environment at the time the
51interpreter was started.
52(Alas, modifying this table does not affect the capability environment
53of the interpreter.)
54For example,
55\code{amoeba.capv['ROOT']}
56is the capability of your root directory, similar to
57\code{getcap("ROOT")}
58in C.
59\end{datadesc}
60
61\begin{excdesc}{error}
62The exception raised when an Amoeba function returns an error.
63The value accompanying this exception is a pair containing the numeric
64error code and the corresponding string, as returned by the C function
65\code{err_why()}.
66\end{excdesc}
67
68\begin{funcdesc}{timeout}{msecs}
69Sets the transaction timeout, in milliseconds.
70Returns the previous timeout.
71Initially, the timeout is set to 2 seconds by the Python interpreter.
72\end{funcdesc}
73
74\subsection{Capability Operations}
75
Guido van Rossum470be141995-03-17 16:07:09 +000076Capabilities are written in a convenient \ASCII{} format, also used by the
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000077Amoeba utilities
Fred Drakeb6ce6421998-01-19 02:51:02 +000078\emph{c2a}(U)
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000079and
Fred Drakeb6ce6421998-01-19 02:51:02 +000080\emph{a2c}(U).
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000081For example:
82
Fred Drake19479911998-02-13 06:58:54 +000083\begin{verbatim}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000084>>> amoeba.name_lookup('/profile/cap')
85aa:1c:95:52:6a:fa/14(ff)/8e:ba:5b:8:11:1a
86>>>
Fred Drake19479911998-02-13 06:58:54 +000087\end{verbatim}
Guido van Rossume47da0a1997-07-17 16:34:52 +000088%
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000089The following methods are defined for capability objects.
90
Fred Drake19479911998-02-13 06:58:54 +000091\setindexsubitem{(capability method)}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000092\begin{funcdesc}{dir_list}{}
93Returns a list of the names of the entries in an Amoeba directory.
94\end{funcdesc}
95
Fred Drakecce10901998-03-17 06:33:25 +000096\begin{funcdesc}{b_read}{offset, maxsize}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000097Reads (at most)
98\var{maxsize}
99bytes from a bullet file at offset
100\var{offset.}
101The data is returned as a string.
102EOF is reported as an empty string.
103\end{funcdesc}
104
105\begin{funcdesc}{b_size}{}
106Returns the size of a bullet file.
107\end{funcdesc}
108
109\begin{funcdesc}{dir_append}{}
Fred Drakec7dd3e11999-01-07 15:45:55 +0000110\funcline{dir_delete}{}
111\funcline{dir_lookup}{}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000112\funcline{dir_replace}{}
113Like the corresponding
114\samp{name_}*
115functions, but with a path relative to the capability.
116(For paths beginning with a slash the capability is ignored, since this
117is the defined semantics for Amoeba.)
118\end{funcdesc}
119
120\begin{funcdesc}{std_info}{}
121Returns the standard info string of the object.
122\end{funcdesc}
123
124\begin{funcdesc}{tod_gettime}{}
Fred Drake65b32f71998-02-09 20:27:12 +0000125Returns the time (in seconds since the Epoch, in UCT, as for \POSIX{}) from
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000126a time server.
127\end{funcdesc}
128
129\begin{funcdesc}{tod_settime}{t}
130Sets the time kept by a time server.
131\end{funcdesc}