blob: ce6babc889a66b8a72dbe91f76abec0f924d0701 [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 Drakef6863c11999-03-02 16:37:17 +00004 Amoeba system support}
Fred Drakeb91e9341998-07-23 17:59:49 +00005
Fred Drakef6863c11999-03-02 16:37:17 +00006\declaremodule{builtin}{amoeba}
7 \platform{Amoeba}
Fred Drakec7dd3e11999-01-07 15:45:55 +00008\modulesynopsis{Functions for the Amoeba operating system.}
Fred Drakeb91e9341998-07-23 17:59:49 +00009
Fred Drake12918af1998-02-18 15:10:24 +000010
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000011This module provides some object types and operations useful for
12Amoeba applications. It is only available on systems that support
13Amoeba operations. RPC errors and other Amoeba errors are reported as
14the exception \code{amoeba.error = 'amoeba.error'}.
15
Fred Drakef6863c11999-03-02 16:37:17 +000016The module \module{amoeba} defines the following items:
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000017
Fred Drakecce10901998-03-17 06:33:25 +000018\begin{funcdesc}{name_append}{path, cap}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000019Stores a capability in the Amoeba directory tree.
20Arguments are the pathname (a string) and the capability (a capability
21object as returned by
Fred Drakef6863c11999-03-02 16:37:17 +000022\function{name_lookup()}).
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000023\end{funcdesc}
24
25\begin{funcdesc}{name_delete}{path}
26Deletes a capability from the Amoeba directory tree.
27Argument is the pathname.
28\end{funcdesc}
29
30\begin{funcdesc}{name_lookup}{path}
31Looks up a capability.
32Argument is the pathname.
33Returns a
34\dfn{capability}
35object, to which various interesting operations apply, described below.
36\end{funcdesc}
37
Fred Drakecce10901998-03-17 06:33:25 +000038\begin{funcdesc}{name_replace}{path, cap}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000039Replaces a capability in the Amoeba directory tree.
40Arguments are the pathname and the new capability.
41(This differs from
Fred Drakef6863c11999-03-02 16:37:17 +000042\function{name_append()}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000043in the behavior when the pathname already exists:
Fred Drakef6863c11999-03-02 16:37:17 +000044\function{name_append()}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000045finds this an error while
Fred Drakef6863c11999-03-02 16:37:17 +000046\function{name_replace()}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000047allows it, as its name suggests.)
48\end{funcdesc}
49
50\begin{datadesc}{capv}
51A table representing the capability environment at the time the
52interpreter was started.
53(Alas, modifying this table does not affect the capability environment
54of the interpreter.)
55For example,
56\code{amoeba.capv['ROOT']}
57is the capability of your root directory, similar to
58\code{getcap("ROOT")}
59in C.
60\end{datadesc}
61
62\begin{excdesc}{error}
63The exception raised when an Amoeba function returns an error.
64The value accompanying this exception is a pair containing the numeric
65error code and the corresponding string, as returned by the C function
Fred Drakef6863c11999-03-02 16:37:17 +000066\cfunction{err_why()}.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000067\end{excdesc}
68
69\begin{funcdesc}{timeout}{msecs}
70Sets the transaction timeout, in milliseconds.
71Returns the previous timeout.
72Initially, the timeout is set to 2 seconds by the Python interpreter.
73\end{funcdesc}
74
75\subsection{Capability Operations}
76
Guido van Rossum470be141995-03-17 16:07:09 +000077Capabilities are written in a convenient \ASCII{} format, also used by the
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000078Amoeba utilities
Fred Drakeb6ce6421998-01-19 02:51:02 +000079\emph{c2a}(U)
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000080and
Fred Drakeb6ce6421998-01-19 02:51:02 +000081\emph{a2c}(U).
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000082For example:
83
Fred Drake19479911998-02-13 06:58:54 +000084\begin{verbatim}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000085>>> amoeba.name_lookup('/profile/cap')
86aa:1c:95:52:6a:fa/14(ff)/8e:ba:5b:8:11:1a
87>>>
Fred Drake19479911998-02-13 06:58:54 +000088\end{verbatim}
Guido van Rossume47da0a1997-07-17 16:34:52 +000089%
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000090The following methods are defined for capability objects.
91
Guido van Rossumd8faa362007-04-27 19:54:29 +000092\begin{methoddesc}[capability]{dir_list}{}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000093Returns a list of the names of the entries in an Amoeba directory.
Guido van Rossumd8faa362007-04-27 19:54:29 +000094\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000095
Guido van Rossumd8faa362007-04-27 19:54:29 +000096\begin{methoddesc}[capability]{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.
Guido van Rossumd8faa362007-04-27 19:54:29 +0000103\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000104
Guido van Rossumd8faa362007-04-27 19:54:29 +0000105\begin{methoddesc}[capability]{b_size}{}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000106Returns the size of a bullet file.
Guido van Rossumd8faa362007-04-27 19:54:29 +0000107\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000108
Guido van Rossumd8faa362007-04-27 19:54:29 +0000109\begin{methoddesc}[capability]{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.)
Guido van Rossumd8faa362007-04-27 19:54:29 +0000118\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000119
Guido van Rossumd8faa362007-04-27 19:54:29 +0000120\begin{methoddesc}[capability]{std_info}{}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000121Returns the standard info string of the object.
Guido van Rossumd8faa362007-04-27 19:54:29 +0000122\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000123
Guido van Rossumd8faa362007-04-27 19:54:29 +0000124\begin{methoddesc}[capability]{tod_gettime}{}
Fred Drakec37b65e2001-11-28 07:26:15 +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.
Guido van Rossumd8faa362007-04-27 19:54:29 +0000127\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000128
Guido van Rossumd8faa362007-04-27 19:54:29 +0000129\begin{methoddesc}[capability]{tod_settime}{t}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000130Sets the time kept by a time server.
Guido van Rossumd8faa362007-04-27 19:54:29 +0000131\end{methoddesc}