From 24524dbd7867a27ba0550dbfd2c3fafed5ae0ca5 Mon Sep 17 00:00:00 2001 From: Sverker Eriksson Date: Wed, 6 Oct 2010 10:53:49 +0200 Subject: Documentation update to ETS and drivers State more clearly that ETS functions will throw badarg if calling process lacks access right. And that driver stop callback should free memory allocted by start. --- erts/doc/src/driver.xml | 7 +++++-- erts/doc/src/driver_entry.xml | 6 ++++-- lib/stdlib/doc/src/ets.xml | 22 ++++++++++++++-------- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/erts/doc/src/driver.xml b/erts/doc/src/driver.xml index 006a6160de..db455312ec 100644 --- a/erts/doc/src/driver.xml +++ b/erts/doc/src/driver.xml @@ -196,11 +196,14 @@ static ErlDrvData start(ErlDrvPort port, char *command)

We call disconnect to log out from the database. (This should have been done from Erlang, but just in case.)

We use the binary format only to return data to the emulator; diff --git a/erts/doc/src/driver_entry.xml b/erts/doc/src/driver_entry.xml index e71b48bd92..dd949d4048 100644 --- a/erts/doc/src/driver_entry.xml +++ b/erts/doc/src/driver_entry.xml @@ -172,7 +172,7 @@ typedef struct erl_drv_entry { added to the driver list.) The driver should return 0, or if the driver can't initialize, -1.

- int (*start)(ErlDrvPort port, char* command) + ErlDrvData (*start)(ErlDrvPort port, char* command)

This is called when the driver is instantiated, when open_port/2 is called. The driver should return a @@ -188,7 +188,9 @@ typedef struct erl_drv_entry {

This is called when the port is closed, with port_close/1 or Port ! {self(), close}. Note that terminating the port owner process also closes the - port.

+ port. If drv_data is a pointer to memory allocated in + start, then stop is the place to deallocate that + memory.

void (*output)(ErlDrvData drv_data, char *buf, int len) diff --git a/lib/stdlib/doc/src/ets.xml b/lib/stdlib/doc/src/ets.xml index dd4a289c61..702e1b928e 100644 --- a/lib/stdlib/doc/src/ets.xml +++ b/lib/stdlib/doc/src/ets.xml @@ -56,8 +56,8 @@ Even if there are no references to a table from any process, it will not automatically be destroyed unless the owner process terminates. It can be destroyed explicitly by using - delete/1.

-

Since R13B01, table ownership can be transferred at process termination + delete/1. The default owner is the process that created the + table. Table ownership can be transferred at process termination by using the heir option or explicitly by calling give_away/3.

Some implementation details:

@@ -82,11 +82,15 @@ float() that extends to the same value, hence the key 1 and the key 1.0 are regarded as equal in an ordered_set table.

-

In general, the functions below will exit with reason - badarg if any argument is of the wrong format, or if the - table identifier is invalid.

- +
+ Failure +

In general, the functions below will exit with reason + badarg if any argument is of the wrong format, if the + table identifier is invalid or if the operation is denied due to + table access rights (protected + or private).

+
Concurrency

This module provides some limited support for concurrent access. @@ -947,7 +951,7 @@ ets:select(Table,MatchSpec), Name = atom() Options = [Option] -  Option = Type | Access | named_table | {keypos,Pos} | {heir,pid(),HeirData} | {heir,none} | {write_concurrency,bool()} +  Option = Type | Access | named_table | {keypos,Pos} | {heir,pid(),HeirData} | {heir,none} | {write_concurrency,bool()} | {read_concurrency,bool()}   Type = set | ordered_set | bag | duplicate_bag   Access = public | protected | private   Pos = int() @@ -963,7 +967,7 @@ ets:select(Table,MatchSpec), table is named or not. If one or more options are left out, the default values are used. This means that not specifying any options ([]) is the same as specifying - [set,protected,{keypos,1},{heir,none},{write_concurrency,false}].

+ [set,protected,{keypos,1},{heir,none},{write_concurrency,false},{read_concurrency,false}].

set @@ -1002,12 +1006,14 @@ ets:select(Table,MatchSpec), Any process may read or write to the table.

+

protected The owner process can read and write to the table. Other processes can only read the table. This is the default setting for the access rights.

+

private Only the owner process can read or write to the table.

-- cgit v1.2.3