aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
Diffstat (limited to 'erts')
-rw-r--r--erts/configure.in71
-rw-r--r--erts/doc/src/alt_dist.xml22
-rw-r--r--erts/doc/src/crash_dump.xml8
-rw-r--r--erts/doc/src/driver.xml142
-rw-r--r--erts/doc/src/driver_entry.xml8
-rw-r--r--erts/doc/src/erlang.xml24
-rw-r--r--erts/doc/src/erlsrv.xml22
-rw-r--r--erts/doc/src/escript.xml20
-rw-r--r--erts/doc/src/inet_cfg.xml13
-rw-r--r--erts/doc/src/match_spec.xml40
-rw-r--r--erts/doc/src/notes.xml20
-rw-r--r--erts/doc/src/tty.xml8
-rw-r--r--erts/doc/src/zlib.xml24
-rw-r--r--erts/emulator/beam/erl_bif_info.c92
-rw-r--r--erts/emulator/beam/erl_db.c23
-rw-r--r--erts/emulator/beam/erl_db_hash.c16
-rw-r--r--erts/emulator/beam/erl_lock_count.c68
-rw-r--r--erts/emulator/beam/erl_lock_count.h25
-rw-r--r--erts/emulator/beam/erl_process.c10
-rw-r--r--erts/emulator/beam/io.c12
-rw-r--r--erts/etc/unix/Install.src2
21 files changed, 387 insertions, 283 deletions
diff --git a/erts/configure.in b/erts/configure.in
index a3b6fe319f..5fa1245b13 100644
--- a/erts/configure.in
+++ b/erts/configure.in
@@ -226,6 +226,19 @@ AC_ARG_ENABLE(m64-build,
esac
],enable_m64_build=no)
+AC_ARG_ENABLE(m32-build,
+[ --enable-m32-build build 32bit binaries using the -m32 flag to (g)cc],
+[ case "$enableval" in
+ no) enable_m32_build=no ;;
+ *)
+ if test X${enable_darwin_64bit} = Xyes -o X${enable_m64_build} = Xyes;
+ then
+ AC_MSG_ERROR([(--enable-darwin-64bit or --enable-m64-build) and --enable-m32-build are mutually exclusive]) ;
+ fi ;
+ enable_m32_build=yes ;;
+ esac
+],enable_m32_build=no)
+
AC_ARG_ENABLE(fixalloc,
[ --disable-fixalloc disable the use of fix_alloc])
if test x${enable_fixalloc} = xno ; then
@@ -335,6 +348,17 @@ else
esac
;;
*)
+ if test X${enable_m32_build} = Xyes;
+ then
+ enable_hipe=no;
+ case $CFLAGS in
+ *-m32*)
+ ;;
+ *)
+ CFLAGS="-m32 $CFLAGS"
+ ;;
+ esac ;
+ fi
;;
esac
fi
@@ -432,6 +456,35 @@ CFLAGS="$CFLAGS $extra_flags"
DEBUG_CFLAGS="-g $CPPFLAGS $extra_flags"
DEBUG_FLAGS=-g
+dnl
+dnl Adjust DEBUG_CFLAGS to match CFLAGS in terms of -m
+dnl
+
+case $CFLAGS in
+ *-m64*)
+ case $DEBUG_CFLAGS in
+ *-m64*)
+ ;;
+ *)
+ DEBUG_CFLAGS="-m64 $DEBUG_CFLAGS"
+ ;;
+ esac
+ ;;
+ *-m32*)
+ case $DEBUG_CFLAGS in
+ *-m32*)
+ ;;
+ *)
+ DEBUG_CFLAGS="-m32 $DEBUG_CFLAGS"
+ ;;
+ esac
+ ;;
+ *)
+ ;;
+esac
+
+
+
CFLAG_RUNTIME_LIBRARY_PATH="-Wl,-R"
case $host_os in
darwin*)
@@ -664,6 +717,16 @@ case $ARCH-$OPSYS in
LDFLAGS="-m64 $LDFLAGS"
;;
esac
+ fi;
+ if test X${enable_m32_build} = Xyes; then
+ AC_MSG_NOTICE([Adjusting LDFLAGS to use -m32]) ;
+ case $LDFLAGS in
+ *-m32*)
+ ;;
+ *)
+ LDFLAGS="-m32 $LDFLAGS"
+ ;;
+ esac ;
fi
;;
esac
@@ -1378,7 +1441,7 @@ AC_CHECK_HEADER(sys/devpoll.h, have_kernel_poll=/dev/poll)
dnl Check for kernel SCTP support
AC_SUBST(LIBSCTP)
-if test "x$enable_sctp" == "xyes" ; then
+if test "x$enable_sctp" = "xyes" ; then
AC_CHECK_HEADER(netinet/sctp.h,
[LIBSCTP=libsctp.so.1
AC_DEFINE(HAVE_SCTP_H, [1],
@@ -3220,6 +3283,9 @@ case $host_os in
DED_LDFLAGS="-shared -Wl,-Bsymbolic"
if test X${enable_m64_build} = Xyes; then
DED_LDFLAGS="-m64 $DED_LDFLAGS"
+ fi;
+ if test X${enable_m32_build} = Xyes; then
+ DED_LDFLAGS="-m32 $DED_LDFLAGS"
fi
;;
freebsd*)
@@ -3228,6 +3294,9 @@ case $host_os in
DED_LDFLAGS="-shared"
if test X${enable_m64_build} = Xyes; then
DED_LDFLAGS="-m64 $DED_LDFLAGS"
+ fi;
+ if test X${enable_m32_build} = Xyes; then
+ DED_LDFLAGS="-m32 $DED_LDFLAGS"
fi
;;
osf*)
diff --git a/erts/doc/src/alt_dist.xml b/erts/doc/src/alt_dist.xml
index 9a68b3cf40..a929aec97f 100644
--- a/erts/doc/src/alt_dist.xml
+++ b/erts/doc/src/alt_dist.xml
@@ -4,7 +4,7 @@
<chapter>
<header>
<copyright>
- <year>2000</year><year>2009</year>
+ <year>2000</year><year>2010</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -13,12 +13,12 @@
compliance with the License. You should have received a copy of the
Erlang Public License along with this software. If not, it can be
retrieved online at http://www.erlang.org/.
-
+
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.
-
+
</legalnotice>
<title>How to implement an alternative carrier for the Erlang distribution</title>
@@ -939,7 +939,7 @@
connection that is not functioning.</item>
<item>'R': Get creation number of listen socket, which is used to
dig out the number stored in the lock file to differentiate
- between invocations of Erlang nodes with the same name.\011 </item>
+ between invocations of Erlang nodes with the same name.</item>
</list>
<p>The control interface gets a buffer to return its value in,
but is free to allocate it's own buffer is the provided one is
@@ -949,11 +949,11 @@
( 2) char* buf, int count, char** res, int res_size)
( 3) {
( 4) /* Local macro to ensure large enough buffer. */
-( 5) #define ENSURE(N) \\
-( 6) do { \\
-( 7) if (res_size < N) { \\
-( 8) *res = ALLOC(N); \\
-( 9) } \\
+( 5) #define ENSURE(N) \
+( 6) do { \
+( 7) if (res_size < N) { \
+( 8) *res = ALLOC(N); \
+( 9) } \
(10) } while(0)
(11) UdsData *ud = (UdsData *) handle;
@@ -1075,7 +1075,7 @@ Eshell V5.0 (abort with ^G)
(bing@hador)2></pre>
<p>...</p>
<pre>
-$ <input>erl -pa $ERL_TOP/lib/kernel/examples/uds_dist/ebin -proto_dist uds \\ </input>
+$ <input>erl -pa $ERL_TOP/lib/kernel/examples/uds_dist/ebin -proto_dist uds \ </input>
<input> -no_epmd -sname bong</input>
Erlang (BEAM) emulator version 5.0
@@ -1084,7 +1084,7 @@ Eshell V5.0 (abort with ^G)
<p>One can utilize the ERL_FLAGS environment variable to store the
complicated parameters in:</p>
<pre>
-$ <input>ERL_FLAGS=-pa $ERL_TOP/lib/kernel/examples/uds_dist/ebin \\ </input>
+$ <input>ERL_FLAGS=-pa $ERL_TOP/lib/kernel/examples/uds_dist/ebin \ </input>
<input> -proto_dist uds -no_epmd</input>
$ <input>export ERL_FLAGS</input>
$ <input>erl -sname bang</input>
diff --git a/erts/doc/src/crash_dump.xml b/erts/doc/src/crash_dump.xml
index 5182929358..b3c4671c3d 100644
--- a/erts/doc/src/crash_dump.xml
+++ b/erts/doc/src/crash_dump.xml
@@ -4,7 +4,7 @@
<chapter>
<header>
<copyright>
- <year>1999</year><year>2009</year>
+ <year>1999</year><year>2010</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -13,12 +13,12 @@
compliance with the License. You should have received a copy of the
Erlang Public License along with this software. If not, it can be
retrieved online at http://www.erlang.org/.
-
+
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.
-
+
</legalnotice>
<title>How to interpret the Erlang crash dumps</title>
@@ -96,7 +96,7 @@
allocators see
<seealso marker="erts_alloc">erts_alloc(3)</seealso>.</item>
<item>"<em>&lt;A&gt;</em>: Cannot reallocate <em>&lt;N&gt;</em>
- bytes of memory\011(of type "<em>&lt;T&gt;</em>")." - Same as
+ bytes of memory (of type "<em>&lt;T&gt;</em>")." - Same as
above with the exception that memory was being reallocated
instead of being allocated when the system ran out of memory.</item>
<item>"Unexpected op code <em>N</em>" - Error in compiled
diff --git a/erts/doc/src/driver.xml b/erts/doc/src/driver.xml
index c396ee0b90..12c79aee90 100644
--- a/erts/doc/src/driver.xml
+++ b/erts/doc/src/driver.xml
@@ -4,7 +4,7 @@
<chapter>
<header>
<copyright>
- <year>2001</year><year>2009</year>
+ <year>2001</year><year>2010</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -13,12 +13,12 @@
compliance with the License. You should have received a copy of the
Erlang Public License along with this software. If not, it can be
retrieved online at http://www.erlang.org/.
-
+
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.
-
+
</legalnotice>
<title>How to implement a driver</title>
@@ -510,11 +510,11 @@ static int do_select(const char* s, our_data_t* data)
PGconn* conn = data->conn;
/* if there's an error return it now */
if (PQsendQuery(conn, s) == 0) {
-\011ei_x_buff x;
-\011ei_x_new_with_version(&x);
-\011encode_error(&x, conn);
-\011driver_output(data->port, x.buff, x.index);
-\011ei_x_free(&x);
+ ei_x_buff x;
+ ei_x_new_with_version(&x);
+ encode_error(&x, conn);
+ driver_output(data->port, x.buff, x.index);
+ ei_x_free(&x);
}
/* else wait for ready_output to get results */
return 0;
@@ -532,31 +532,31 @@ static void ready_io(ErlDrvData drv_data, ErlDrvEvent event)
ei_x_buff x;
ei_x_new_with_version(&x);
if (data->connecting) {
-\011ConnStatusType status;
-\011PQconnectPoll(conn);
-\011status = PQstatus(conn);
-\011if (status == CONNECTION_OK)
-\011 encode_ok(&x);
-\011else if (status == CONNECTION_BAD)
-\011 encode_error(&x, conn);
+ ConnStatusType status;
+ PQconnectPoll(conn);
+ status = PQstatus(conn);
+ if (status == CONNECTION_OK)
+ encode_ok(&x);
+ else if (status == CONNECTION_BAD)
+ encode_error(&x, conn);
} else {
-\011PQconsumeInput(conn);
-\011if (PQisBusy(conn))
-\011 return;
-\011res = PQgetResult(conn);
-\011encode_result(&x, res, conn);
-\011PQclear(res);
-\011for (;;) {
-\011 res = PQgetResult(conn);
-\011 if (res == NULL)
-\011\011break;
-\011 PQclear(res);
-\011}
+ PQconsumeInput(conn);
+ if (PQisBusy(conn))
+ return;
+ res = PQgetResult(conn);
+ encode_result(&x, res, conn);
+ PQclear(res);
+ for (;;) {
+ res = PQgetResult(conn);
+ if (res == NULL)
+ break;
+ PQclear(res);
+ }
}
if (x.index > 1) {
-\011driver_output(data->port, x.buff, x.index);
-\011if (data->connecting)
-\011 driver_select(data->port, (ErlDrvEvent)data->socket, DO_WRITE, 0);
+ driver_output(data->port, x.buff, x.index);
+ if (data->connecting)
+ driver_select(data->port, (ErlDrvEvent)data->socket, DO_WRITE, 0);
}
ei_x_free(&x);
}
@@ -592,17 +592,17 @@ static void ready_io(ErlDrvData drv_data, ErlDrvEvent event)
connect(ConnectStr) ->
case erl_ddll:load_driver(".", "pg_async") of
-\011ok -> ok;
-\011{error, already_loaded} -> ok;
-\011_ -> exit({error, could_not_load_driver})
+ ok -> ok;
+ {error, already_loaded} -> ok;
+ _ -> exit({error, could_not_load_driver})
end,
Port = open_port({spawn, ?MODULE}, [binary]),
port_control(Port, ?DRV_CONNECT, ConnectStr),
case return_port_data(Port) of
-\011ok ->
-\011 {ok, Port};
-\011Error ->
-\011 Error
+ ok ->
+ {ok, Port};
+ Error ->
+ Error
end.
disconnect(Port) ->
@@ -617,8 +617,8 @@ select(Port, Query) ->
return_port_data(Port) ->
receive
-\011{Port, {data, Data}} ->
-\011 binary_to_term(Data)
+ {Port, {data, Data}} ->
+ binary_to_term(Data)
end.
]]></code>
<p>The Erlang code is slightly different, this is because we
@@ -662,22 +662,22 @@ return_port_data(Port) ->
call-back <c><![CDATA[ready_async]]></c>.</p>
<code type="none"><![CDATA[
static ErlDrvEntry next_perm_driver_entry = {
- NULL,\011\011\011/* init */
+ NULL, /* init */
start,
- NULL, \011\011\011/* stop */
- output,\011\011\011
- NULL,\011\011\011/* ready_input */
- NULL,\011\011\011/* ready_output */
- "next_perm", /* the name of the driver */
- NULL,\011\011\011/* finish */
- NULL,\011\011\011/* handle */
- NULL,\011\011\011/* control */
- NULL,\011\011\011/* timeout */
- NULL,\011\011\011/* outputv */
+ NULL, /* stop */
+ output,
+ NULL, /* ready_input */
+ NULL, /* ready_output */
+ "next_perm", /* the name of the driver */
+ NULL, /* finish */
+ NULL, /* handle */
+ NULL, /* control */
+ NULL, /* timeout */
+ NULL, /* outputv */
ready_async,
- NULL,\011\011\011/* flush */
- NULL,\011\011\011/* call */
- NULL\011\011\011/* event */
+ NULL, /* flush */
+ NULL, /* call */
+ NULL /* event */
};
]]></code>
<p>The <c><![CDATA[output]]></c> function allocates the work-area of the
@@ -699,7 +699,7 @@ struct our_async_data {
};
our_async_data::our_async_data(ErlDrvPort p, int command,
-\011\011\011 const char* buf, int len)
+ const char* buf, int len)
: prev(command == 2),
data((int*)buf, (int*)buf + len / sizeof(int))
{
@@ -722,9 +722,9 @@ static void do_perm(void* async_data)
{
our_async_data* d = reinterpret_cast<our_async_data*>(async_data);
if (d->prev)
-\011prev_permutation(d->data.begin(), d->data.end());
+ prev_permutation(d->data.begin(), d->data.end());
else
-\011next_permutation(d->data.begin(), d->data.end());
+ next_permutation(d->data.begin(), d->data.end());
}
]]></code>
<p>In the <c><![CDATA[ready_async]]></c> function, the output is sent back to the
@@ -742,9 +742,9 @@ static void ready_async(ErlDrvData drv_data, ErlDrvThreadData async_data)
int n = d->data.size(), result_n = n*2 + 3;
ErlDrvTermData* result = new ErlDrvTermData[result_n], * rp = result;
for (vector<int>::iterator i = d->data.begin();
-\011 i != d->data.end(); ++i) {
-\011*rp++ = ERL_DRV_INT;
-\011*rp++ = *i;
+ i != d->data.end(); ++i) {
+ *rp++ = ERL_DRV_INT;
+ *rp++ = *i;
}
*rp++ = ERL_DRV_NIL;
*rp++ = ERL_DRV_LIST;
@@ -767,16 +767,16 @@ static void ready_async(ErlDrvData drv_data, ErlDrvThreadData async_data)
load() ->
case whereis(next_perm) of
-\011undefined ->
-\011 case erl_ddll:load_driver(".", "next_perm") of
-\011\011ok -> ok;
-\011\011{error, already_loaded} -> ok;
-\011\011E -> exit(E)
-\011 end,
-\011 Port = open_port({spawn, "next_perm"}, []),
-\011 register(next_perm, Port);
-\011_ ->
-\011 ok
+ undefined ->
+ case erl_ddll:load_driver(".", "next_perm") of
+ ok -> ok;
+ {error, already_loaded} -> ok;
+ E -> exit(E)
+ end,
+ Port = open_port({spawn, "next_perm"}, []),
+ register(next_perm, Port);
+ _ ->
+ ok
end.
list_to_integer_binaries(L) ->
@@ -793,8 +793,8 @@ next_perm(L, Nxt) ->
B = list_to_integer_binaries(L),
port_control(next_perm, Nxt, B),
receive
-\011Result ->
-\011 Result
+ Result ->
+ Result
end.
all_perm(L) ->
diff --git a/erts/doc/src/driver_entry.xml b/erts/doc/src/driver_entry.xml
index 6b7d2acf24..e71b48bd92 100644
--- a/erts/doc/src/driver_entry.xml
+++ b/erts/doc/src/driver_entry.xml
@@ -4,7 +4,7 @@
<cref>
<header>
<copyright>
- <year>2001</year><year>2009</year>
+ <year>2001</year><year>2010</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -13,12 +13,12 @@
compliance with the License. You should have received a copy of the
Erlang Public License along with this software. If not, it can be
retrieved online at http://www.erlang.org/.
-
+
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.
-
+
</legalnotice>
<title>driver_entry</title>
@@ -188,7 +188,7 @@ typedef struct erl_drv_entry {
<p>This is called when the port is closed, with
<c>port_close/1</c> or <c>Port ! {self(), close}</c>. Note
that terminating the port owner process also closes the
- p\011 port.</p>
+ port.</p>
</item>
<tag><marker id="output"/>void (*output)(ErlDrvData drv_data, char *buf, int len)</tag>
<item>
diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml
index 207aabca35..8e2c02e0ce 100644
--- a/erts/doc/src/erlang.xml
+++ b/erts/doc/src/erlang.xml
@@ -774,10 +774,10 @@ false</pre>
erlang:demonitor(MonitorRef),
receive
-\011{_, MonitorRef, _, _, _} ->
-\011 true
+ {_, MonitorRef, _, _, _} ->
+ true
after 0 ->
-\011 true
+ true
end</code>
</item>
<tag><c>info</c></tag>
@@ -2325,13 +2325,13 @@ os_prompt%</pre>
other. Values beginning with an uppercase letter is not part
of the result.</p>
<code type="none">
-\011total = processes + system
-\011processes = processes_used + ProcessesNotUsed
-\011system = atom + binary + code + ets + OtherSystem
-\011atom = atom_used + AtomNotUsed
+ total = processes + system
+ processes = processes_used + ProcessesNotUsed
+ system = atom + binary + code + ets + OtherSystem
+ atom = atom_used + AtomNotUsed
-\011RealTotal = processes + RealSystem
-\011RealSystem = system + MissedSystem</code>
+ RealTotal = processes + RealSystem
+ RealSystem = system + MissedSystem</code>
<p>More tuples in the returned list may be added in the future.</p>
<note>
<p>The <c>total</c> value is supposed to be the total amount
@@ -6965,10 +6965,10 @@ true</pre>
unlink(Id),
receive
-\011{'EXIT', Id, _} ->
-\011 true
+ {'EXIT', Id, _} ->
+ true
after 0 ->
-\011 true
+ true
end</code>
<note>
<p>Prior to OTP release R11B (erts version 5.5) <c>unlink/1</c>
diff --git a/erts/doc/src/erlsrv.xml b/erts/doc/src/erlsrv.xml
index 93db56fc7c..0dfad2a112 100644
--- a/erts/doc/src/erlsrv.xml
+++ b/erts/doc/src/erlsrv.xml
@@ -4,7 +4,7 @@
<comref>
<header>
<copyright>
- <year>1998</year><year>2009</year>
+ <year>1998</year><year>2010</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -13,12 +13,12 @@
compliance with the License. You should have received a copy of the
Erlang Public License along with this software. If not, it can be
retrieved online at http://www.erlang.org/.
-
+
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.
-
+
</legalnotice>
<title>erlsrv</title>
@@ -251,7 +251,7 @@
necessarily the same as the interactive users. The service
runs as the local administrator. All arguments should be given
together in one string, use double quotes (") to give an
- argument string containing spaces and use quoted quotes (\\")
+ argument string containing spaces and use quoted quotes (\")
to give an quote within the argument string if
necessary.</item>
<tag>-i[nternalservicename] [&lt;internal name&gt;]</tag>
@@ -356,7 +356,7 @@ The environment of an Erlang machine started
*/
BOOL WINAPI service_aware_handler(DWORD ctrl){
if(ctrl == CTRL_LOGOFF_EVENT)
-\011return TRUE;
+ return TRUE;
return FALSE;
}
@@ -368,10 +368,10 @@ void initialize_handler(void){
*/
if(GetEnvironmentVariable("ERLSRV_SERVICE_NAME",buffer,
(DWORD) 2)){
-\011/*
-\011** Actually set the control handler
-\011*/
-\011SetConsoleCtrlHandler(&service_aware_handler, TRUE);
+ /*
+ ** Actually set the control handler
+ */
+ SetConsoleCtrlHandler(&service_aware_handler, TRUE);
}
} ]]></code>
</section>
@@ -388,8 +388,8 @@ void initialize_handler(void){
the runtime system should not need to overwrite existing (and probably
used) executables.</p>
<p>To easily manipulate the Erlang services, put
- the <c><![CDATA[<erlang_root>\\erts-<version>\\bin]]></c> directory in
- the path instead of <c><![CDATA[<erlang_root>\\bin]]></c>. The erlsrv program
+ the <c><![CDATA[<erlang_root>\erts-<version>\bin]]></c> directory in
+ the path instead of <c><![CDATA[<erlang_root>\bin]]></c>. The erlsrv program
can be found from inside Erlang by using the
<c><![CDATA[os:find_executable/1]]></c> Erlang function.</p>
<p>For release handling to work, use <c><![CDATA[start_erl]]></c> as the Erlang
diff --git a/erts/doc/src/escript.xml b/erts/doc/src/escript.xml
index 8df179b3e2..a89449df23 100644
--- a/erts/doc/src/escript.xml
+++ b/erts/doc/src/escript.xml
@@ -4,7 +4,7 @@
<comref>
<header>
<copyright>
- <year>2007</year><year>2009</year>
+ <year>2007</year><year>2010</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -13,12 +13,12 @@
compliance with the License. You should have received a copy of the
Erlang Public License along with this software. If not, it can be
retrieved online at http://www.erlang.org/.
-
+
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.
-
+
</legalnotice>
<title>escript</title>
@@ -50,20 +50,18 @@ $ <input>cat factorial</input>
%%! -smp enable -sname factorial -mnesia debug verbose
main([String]) ->
try
-\011N = list_to_integer(String),
-\011F = fac(N),
-\011io:format("factorial ~w = ~w\
-", [N,F])
+ N = list_to_integer(String),
+ F = fac(N),
+ io:format("factorial ~w = ~w\n", [N,F])
catch
-\011_:_ ->
-\011 usage()
+ _:_ ->
+ usage()
end;
main(_) ->
usage().
usage() ->
- io:format("usage: factorial integer\
-"),
+ io:format("usage: factorial integer\n"),
halt(1).
fac(0) -> 1;
diff --git a/erts/doc/src/inet_cfg.xml b/erts/doc/src/inet_cfg.xml
index 18cf65759a..2a033c037c 100644
--- a/erts/doc/src/inet_cfg.xml
+++ b/erts/doc/src/inet_cfg.xml
@@ -4,7 +4,7 @@
<chapter>
<header>
<copyright>
- <year>2004</year><year>2009</year>
+ <year>2004</year><year>2010</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -13,12 +13,12 @@
compliance with the License. You should have received a copy of the
Erlang Public License along with this software. If not, it can be
retrieved online at http://www.erlang.org/.
-
+
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.
-
+
</legalnotice>
<title>Inet configuration</title>
@@ -230,6 +230,13 @@
(use the Erlang DNS client
<seealso marker="kernel:inet_res">inet_res</seealso>
for nameserver queries).</p>
+ <p>The lookup method <c><![CDATA[string]]></c> tries to
+ parse the hostname as a IPv4 or IPv6 string and return
+ the resulting IP address. It is automatically tried
+ first when <c><![CDATA[native]]></c> is <em>not</em>
+ in the <c><![CDATA[Methods]]></c> list. To skip it in this case
+ the pseudo lookup method <c><![CDATA[nostring]]></c> can be
+ inserted anywhere in the <c><![CDATA[Methods]]></c> list.</p>
<p></p>
</item>
<tag><em><c><![CDATA[{cache_size, Size}.]]></c></em></tag>
diff --git a/erts/doc/src/match_spec.xml b/erts/doc/src/match_spec.xml
index 26480473d2..b9f955e4db 100644
--- a/erts/doc/src/match_spec.xml
+++ b/erts/doc/src/match_spec.xml
@@ -4,7 +4,7 @@
<chapter>
<header>
<copyright>
- <year>1999</year><year>2009</year>
+ <year>1999</year><year>2010</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -13,12 +13,12 @@
compliance with the License. You should have received a copy of the
Erlang Public License along with this software. If not, it can be
retrieved online at http://www.erlang.org/.
-
+
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.
-
+
</legalnotice>
<title>Match specifications in Erlang</title>
@@ -360,52 +360,52 @@
</p>
<table>
<row>
- <cell align="left" valign="middle">Expression\011\011</cell>
- <cell align="left" valign="middle">Variable bindings\011\011</cell>
- <cell align="left" valign="middle">Result\011</cell>
+ <cell align="left" valign="middle">Expression </cell>
+ <cell align="left" valign="middle">Variable bindings </cell>
+ <cell align="left" valign="middle">Result </cell>
</row>
<row>
- <cell align="left" valign="middle">{{'$1','$2'}}\011\011</cell>
+ <cell align="left" valign="middle">{{'$1','$2'}} </cell>
<cell align="left" valign="middle">'$1' = a, '$2' = b</cell>
<cell align="left" valign="middle">{a,b}</cell>
</row>
<row>
- <cell align="left" valign="middle">{const, {'$1', '$2'}}\011</cell>
+ <cell align="left" valign="middle">{const, {'$1', '$2'}} </cell>
<cell align="left" valign="middle">doesn't matter</cell>
<cell align="left" valign="middle">{'$1', '$2'}</cell>
</row>
<row>
- <cell align="left" valign="middle">a\011\011\011</cell>
- <cell align="left" valign="middle">doesn't matter\011\011\011</cell>
+ <cell align="left" valign="middle">a </cell>
+ <cell align="left" valign="middle">doesn't matter </cell>
<cell align="left" valign="middle">a</cell>
</row>
<row>
- <cell align="left" valign="middle">'$1'\011\011\011</cell>
- <cell align="left" valign="middle">'$1' = []\011\011\011</cell>
+ <cell align="left" valign="middle">'$1' </cell>
+ <cell align="left" valign="middle">'$1' = [] </cell>
<cell align="left" valign="middle">[]</cell>
</row>
<row>
- <cell align="left" valign="middle">['$1']\011\011\011</cell>
- <cell align="left" valign="middle">'$1' = []\011\011\011</cell>
+ <cell align="left" valign="middle">['$1'] </cell>
+ <cell align="left" valign="middle">'$1' = [] </cell>
<cell align="left" valign="middle">[[]]</cell>
</row>
<row>
- <cell align="left" valign="middle">[{{a}}]\011\011\011</cell>
+ <cell align="left" valign="middle">[{{a}}] </cell>
<cell align="left" valign="middle">doesn't matter</cell>
<cell align="left" valign="middle">[{a}]</cell>
</row>
<row>
- <cell align="left" valign="middle">42\011\011\011</cell>
+ <cell align="left" valign="middle">42 </cell>
<cell align="left" valign="middle">doesn't matter</cell>
<cell align="left" valign="middle">42</cell>
</row>
<row>
- <cell align="left" valign="middle">"hello"\011\011\011</cell>
+ <cell align="left" valign="middle">"hello" </cell>
<cell align="left" valign="middle">doesn't matter</cell>
<cell align="left" valign="middle">"hello"</cell>
</row>
<row>
- <cell align="left" valign="middle">$1\011\011\011</cell>
+ <cell align="left" valign="middle">$1 </cell>
<cell align="left" valign="middle">doesn't matter</cell>
<cell align="left" valign="middle">49 (the ASCII value for the character '1')</cell>
</row>
@@ -507,8 +507,8 @@
a list which in turn begins with the second argument times
two (i. e. [{[4,x],y},2] or [{[8], y, z},4])</p>
<code type="none"><![CDATA[
-[{['$1', '$2'],\011[{'=:=', {'*', 2, '$2'}, {hd, {element, 1, '$1'}}}],
- []}]\011
+[{['$1', '$2'],[{'=:=', {'*', 2, '$2'}, {hd, {element, 1, '$1'}}}],
+ []}]
]]></code>
<p>Match three arguments. When all three are equal and are
numbers, append the process dump to the trace message, else
diff --git a/erts/doc/src/notes.xml b/erts/doc/src/notes.xml
index 5fe414841e..70f2d95103 100644
--- a/erts/doc/src/notes.xml
+++ b/erts/doc/src/notes.xml
@@ -4371,16 +4371,16 @@
following code might hang:</p>
<code type="none"><![CDATA[
Mon = erlang:monitor(process, Pid),
-\011 %% ...
-\011 exit(Pid, bang),
+ %% ...
+ exit(Pid, bang),
erlang:demonitor(Mon),
-\011 receive
-\011 {'DOWN', Mon , process, Pid, _} -> ok
-\011 %% We were previously guaranteed to get a down message
-\011 %% (since we exited the process ourself), so we could
-\011 %% in this case leave out:
-\011 %% after 0 -> ok
-\011 end,
+ receive
+ {'DOWN', Mon , process, Pid, _} -> ok
+ %% We were previously guaranteed to get a down message
+ %% (since we exited the process ourself), so we could
+ %% in this case leave out:
+ %% after 0 -> ok
+ end,
]]></code>
<p>*** POTENTIAL INCOMPATIBILITY ***</p>
<p>Own Id: OTP-5772</p>
@@ -5342,7 +5342,7 @@
<list type="bulleted">
<item>
<p>If Erlang/OTP was installed in a short directory name,
- such as <c><![CDATA[C:\\Program\\erl5.4.2]]></c>, the emulator would not
+ such as <c><![CDATA[C:\Program\erl5.4.2]]></c>, the emulator would not
start.</p>
<p>Own Id: OTP-5254</p>
</item>
diff --git a/erts/doc/src/tty.xml b/erts/doc/src/tty.xml
index 23694e5965..7d662a2849 100644
--- a/erts/doc/src/tty.xml
+++ b/erts/doc/src/tty.xml
@@ -4,7 +4,7 @@
<chapter>
<header>
<copyright>
- <year>1996</year><year>2009</year>
+ <year>1996</year><year>2010</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -13,12 +13,12 @@
compliance with the License. You should have received a copy of the
Erlang Public License along with this software. If not, it can be
retrieved online at http://www.erlang.org/.
-
+
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.
-
+
</legalnotice>
<title>tty - A command line interface</title>
@@ -47,7 +47,7 @@
<section>
<title>Normal Mode</title>
<p>In normal mode keystrokes from the user are collected and interpreted by <c><![CDATA[tty]]></c>. Most of the <em>emacs</em> line editing commands are supported. The following is a complete list of the supported line editing commands.<br></br></p>
- <p><em>Note:</em>\011The notation <c><![CDATA[C-a]]></c> means pressing the control key and the letter <c><![CDATA[a]]></c> simultaneously. <c><![CDATA[M-f]]></c> means pressing the <c><![CDATA[ESC]]></c> key followed by the letter <c><![CDATA[f]]></c>.
+ <p><em>Note:</em> The notation <c><![CDATA[C-a]]></c> means pressing the control key and the letter <c><![CDATA[a]]></c> simultaneously. <c><![CDATA[M-f]]></c> means pressing the <c><![CDATA[ESC]]></c> key followed by the letter <c><![CDATA[f]]></c>.
</p>
<table>
<row>
diff --git a/erts/doc/src/zlib.xml b/erts/doc/src/zlib.xml
index 9f39ac657a..b1e768bce9 100644
--- a/erts/doc/src/zlib.xml
+++ b/erts/doc/src/zlib.xml
@@ -4,7 +4,7 @@
<erlref>
<header>
<copyright>
- <year>2005</year><year>2009</year>
+ <year>2005</year><year>2010</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -13,12 +13,12 @@
compliance with the License. You should have received a copy of the
Erlang Public License along with this software. If not, it can be
retrieved online at http://www.erlang.org/.
-
+
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.
-
+
</legalnotice>
<title>zlib</title>
@@ -372,11 +372,11 @@ list_to_binary([B1,B2])</pre>
<pre>
unpack(Z, Compressed, Dict) ->
case catch zlib:inflate(Z, Compressed) of
-\011 {'EXIT',{{need_dictionary,DictID},_}} ->
- \011 zlib:inflateSetDictionary(Z, Dict),
-\011 Uncompressed = zlib:inflate(Z, []);
-\011 Uncompressed ->
-\011 Uncompressed
+ {'EXIT',{{need_dictionary,DictID},_}} ->
+ zlib:inflateSetDictionary(Z, Dict),
+ Uncompressed = zlib:inflate(Z, []);
+ Uncompressed ->
+ Uncompressed
end.</pre>
</desc>
</func>
@@ -466,8 +466,8 @@ unpack(Z, Compressed, Dict) ->
the required initial value for the crc.</p>
<pre>
Crc = lists:foldl(fun(Bin,Crc0) ->
-\011 zlib:crc32(Z, Crc0, Bin),
-\011 end, zlib:crc32(Z,&lt;&lt; &gt;&gt;), Bins)</pre>
+ zlib:crc32(Z, Crc0, Bin),
+ end, zlib:crc32(Z,&lt;&lt; &gt;&gt;), Bins)</pre>
</desc>
</func>
<func>
@@ -517,8 +517,8 @@ Crc = lists:foldl(fun(Bin,Crc0) ->
the required initial value for the checksum.</p>
<pre>
Crc = lists:foldl(fun(Bin,Crc0) ->
-\011 zlib:adler32(Z, Crc0, Bin),
-\011 end, zlib:adler32(Z,&lt;&lt; &gt;&gt;), Bins)</pre>
+ zlib:adler32(Z, Crc0, Bin),
+ end, zlib:adler32(Z,&lt;&lt; &gt;&gt;), Bins)</pre>
</desc>
</func>
<func>
diff --git a/erts/emulator/beam/erl_bif_info.c b/erts/emulator/beam/erl_bif_info.c
index 5ff1f794df..a34d400ed8 100644
--- a/erts/emulator/beam/erl_bif_info.c
+++ b/erts/emulator/beam/erl_bif_info.c
@@ -3704,12 +3704,11 @@ static Eterm lcnt_build_lock_term(Eterm **hpp, Uint *szp, erts_lcnt_lock_t *lock
ASSERT(ltype);
type = am_atom_put(ltype, strlen(ltype));
-
name = am_atom_put(lock->name, strlen(lock->name));
if (lock->flag & ERTS_LCNT_LT_ALLOC) {
/* use allocator types names as id's for allocator locks */
- ltype = ERTS_ALC_A2AD(signed_val(lock->id));
+ ltype = (char *) ERTS_ALC_A2AD(signed_val(lock->id));
id = am_atom_put(ltype, strlen(ltype));
} else if (lock->flag & ERTS_LCNT_LT_PROCLOCK) {
/* use registered names as id's for process locks if available */
@@ -3778,17 +3777,28 @@ BIF_RETTYPE erts_debug_lock_counters_1(BIF_ALIST_1)
{
#ifdef ERTS_ENABLE_LOCK_COUNT
Eterm res = NIL;
- erts_smp_proc_unlock(BIF_P, ERTS_PROC_LOCK_MAIN);
- erts_smp_block_system(0);
+#endif
+
+
+ if (BIF_ARG_1 == am_enabled) {
+#ifdef ERTS_ENABLE_LOCK_COUNT
+ BIF_RET(am_true);
+#else
+ BIF_RET(am_false);
+#endif
+ }
+#ifdef ERTS_ENABLE_LOCK_COUNT
- if (BIF_ARG_1 == am_info) {
+ else if (BIF_ARG_1 == am_info) {
erts_lcnt_data_t *data;
Uint hsize = 0;
Uint *szp;
Eterm* hp;
- erts_lcnt_set_rt_opt(ERTS_LCNT_OPT_SUSPEND);
+ erts_smp_proc_unlock(BIF_P, ERTS_PROC_LOCK_MAIN);
+ erts_smp_block_system(0);
+ erts_lcnt_set_rt_opt(ERTS_LCNT_OPT_SUSPEND);
data = erts_lcnt_get_data();
/* calculate size */
@@ -3803,29 +3813,65 @@ BIF_RETTYPE erts_debug_lock_counters_1(BIF_ALIST_1)
res = lcnt_build_result_term(&hp, NULL, data, res);
erts_lcnt_clear_rt_opt(ERTS_LCNT_OPT_SUSPEND);
+
+ erts_smp_release_system();
+ erts_smp_proc_lock(BIF_P, ERTS_PROC_LOCK_MAIN);
- goto done;
+ BIF_RET(res);
} else if (BIF_ARG_1 == am_clear) {
+ erts_smp_proc_unlock(BIF_P, ERTS_PROC_LOCK_MAIN);
+ erts_smp_block_system(0);
+
erts_lcnt_clear_counters();
- res = am_ok;
- goto done;
+
+ erts_smp_release_system();
+ erts_smp_proc_lock(BIF_P, ERTS_PROC_LOCK_MAIN);
+
+ BIF_RET(am_ok);
} else if (is_tuple(BIF_ARG_1)) {
- Uint prev = 0;
Eterm* tp = tuple_val(BIF_ARG_1);
+
switch (arityval(tp[0])) {
case 2:
- if (ERTS_IS_ATOM_STR("process_locks", tp[1])) {
+ if (ERTS_IS_ATOM_STR("copy_save", tp[1])) {
+ erts_smp_proc_unlock(BIF_P, ERTS_PROC_LOCK_MAIN);
+ erts_smp_block_system(0);
if (tp[2] == am_true) {
- prev = erts_lcnt_set_rt_opt(ERTS_LCNT_OPT_PROCLOCK);
- if (prev) res = am_true;
- else res = am_false;
- goto done;
+
+ res = erts_lcnt_set_rt_opt(ERTS_LCNT_OPT_COPYSAVE) ? am_true : am_false;
+
} else if (tp[2] == am_false) {
- prev = erts_lcnt_clear_rt_opt(ERTS_LCNT_OPT_PROCLOCK);
- if (prev) res = am_true;
- else res = am_false;
- goto done;
+
+ res = erts_lcnt_clear_rt_opt(ERTS_LCNT_OPT_COPYSAVE) ? am_true : am_false;
+
+ } else {
+ erts_smp_release_system();
+ erts_smp_proc_lock(BIF_P, ERTS_PROC_LOCK_MAIN);
+ BIF_ERROR(BIF_P, BADARG);
}
+ erts_smp_release_system();
+ erts_smp_proc_lock(BIF_P, ERTS_PROC_LOCK_MAIN);
+ BIF_RET(res);
+
+ } else if (ERTS_IS_ATOM_STR("process_locks", tp[1])) {
+ erts_smp_proc_unlock(BIF_P, ERTS_PROC_LOCK_MAIN);
+ erts_smp_block_system(0);
+ if (tp[2] == am_true) {
+
+ res = erts_lcnt_set_rt_opt(ERTS_LCNT_OPT_PROCLOCK) ? am_true : am_false;
+
+ } else if (tp[2] == am_false) {
+
+ res = erts_lcnt_set_rt_opt(ERTS_LCNT_OPT_PROCLOCK) ? am_true : am_false;
+
+ } else {
+ erts_smp_release_system();
+ erts_smp_proc_lock(BIF_P, ERTS_PROC_LOCK_MAIN);
+ BIF_ERROR(BIF_P, BADARG);
+ }
+ erts_smp_release_system();
+ erts_smp_proc_lock(BIF_P, ERTS_PROC_LOCK_MAIN);
+ BIF_RET(res);
}
break;
@@ -3834,16 +3880,8 @@ BIF_RETTYPE erts_debug_lock_counters_1(BIF_ALIST_1)
}
}
- erts_smp_release_system();
- erts_smp_proc_lock(BIF_P, ERTS_PROC_LOCK_MAIN);
#endif
BIF_ERROR(BIF_P, BADARG);
-#ifdef ERTS_ENABLE_LOCK_COUNT
-done:
- erts_smp_release_system();
- erts_smp_proc_lock(BIF_P, ERTS_PROC_LOCK_MAIN);
- BIF_RET(res);
-#endif
}
void
diff --git a/erts/emulator/beam/erl_db.c b/erts/emulator/beam/erl_db.c
index b02150008f..15b1c6bb56 100644
--- a/erts/emulator/beam/erl_db.c
+++ b/erts/emulator/beam/erl_db.c
@@ -1,19 +1,19 @@
/*
* %CopyrightBegin%
- *
- * Copyright Ericsson AB 1996-2009. All Rights Reserved.
- *
+ *
+ * Copyright Ericsson AB 1996-2010. All Rights Reserved.
+ *
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
* compliance with the License. You should have received a copy of the
* Erlang Public License along with this software. If not, it can be
* retrieved online at http://www.erlang.org/.
- *
+ *
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
- *
+ *
* %CopyrightEnd%
*/
@@ -261,13 +261,8 @@ static ERTS_INLINE void db_init_lock(DbTable* tb, char *rwname, char* fixname)
erts_refc_init(&tb->common.ref, 1);
erts_refc_init(&tb->common.fixref, 0);
#ifdef ERTS_SMP
-# ifdef ERTS_ENABLE_LOCK_COUNT
erts_smp_rwmtx_init_x(&tb->common.rwlock, rwname, tb->common.the_name);
erts_smp_mtx_init_x(&tb->common.fixlock, fixname, tb->common.the_name);
-# else
- erts_smp_rwmtx_init(&tb->common.rwlock, rwname);
- erts_smp_mtx_init(&tb->common.fixlock, fixname);
-# endif
tb->common.is_thread_safe = !(tb->common.status & DB_FINE_LOCKED);
#endif
}
@@ -2597,19 +2592,11 @@ void init_db(void)
#ifdef ERTS_SMP
for (i=0; i<META_MAIN_TAB_LOCK_CNT; i++) {
-#ifdef ERTS_ENABLE_LOCK_COUNT
erts_smp_spinlock_init_x(&meta_main_tab_locks[i].lck, "meta_main_tab_slot", make_small(i));
-#else
- erts_smp_spinlock_init(&meta_main_tab_locks[i].lck, "meta_main_tab_slot");
-#endif
}
erts_smp_spinlock_init(&meta_main_tab_main_lock, "meta_main_tab_main");
for (i=0; i<META_NAME_TAB_LOCK_CNT; i++) {
-#ifdef ERTS_ENABLE_LOCK_COUNT
erts_smp_rwmtx_init_x(&meta_name_tab_rwlocks[i].lck, "meta_name_tab", make_small(i));
-#else
- erts_smp_rwmtx_init(&meta_name_tab_rwlocks[i].lck, "meta_name_tab");
-#endif
}
#endif
diff --git a/erts/emulator/beam/erl_db_hash.c b/erts/emulator/beam/erl_db_hash.c
index dea45053df..4141f9766b 100644
--- a/erts/emulator/beam/erl_db_hash.c
+++ b/erts/emulator/beam/erl_db_hash.c
@@ -1,19 +1,19 @@
/*
* %CopyrightBegin%
- *
- * Copyright Ericsson AB 1998-2009. All Rights Reserved.
- *
+ *
+ * Copyright Ericsson AB 1998-2010. All Rights Reserved.
+ *
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
* compliance with the License. You should have received a copy of the
* Erlang Public License along with this software. If not, it can be
* retrieved online at http://www.erlang.org/.
- *
+ *
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
- *
+ *
* %CopyrightEnd%
*/
@@ -628,11 +628,7 @@ int db_create_hash(Process *p, DbTable *tbl)
(DbTable *) tb,
sizeof(DbTableHashFineLocks));
for (i=0; i<DB_HASH_LOCK_CNT; ++i) {
- #ifdef ERTS_ENABLE_LOCK_COUNT
- erts_rwmtx_init_x(&tb->locks->lck_vec[i].lck, "db_hash_slot", tb->common.the_name);
- #else
- erts_rwmtx_init(&tb->locks->lck_vec[i].lck, "db_hash_slot");
- #endif
+ erts_rwmtx_init_x(&tb->locks->lck_vec[i].lck, "db_hash_slot", make_small(i));
}
/* This important property is needed to guarantee that the buckets
* involved in a grow/shrink operation it protected by the same lock:
diff --git a/erts/emulator/beam/erl_lock_count.c b/erts/emulator/beam/erl_lock_count.c
index 6211983f4b..0d7e1335c1 100644
--- a/erts/emulator/beam/erl_lock_count.c
+++ b/erts/emulator/beam/erl_lock_count.c
@@ -1,19 +1,19 @@
/*
* %CopyrightBegin%
- *
- * Copyright Ericsson AB 2008-2009. All Rights Reserved.
- *
+ *
+ * Copyright Ericsson AB 2008-2010. All Rights Reserved.
+ *
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
* compliance with the License. You should have received a copy of the
* Erlang Public License along with this software. If not, it can be
* retrieved online at http://www.erlang.org/.
- *
+ *
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
- *
+ *
* %CopyrightEnd%
*/
@@ -162,7 +162,6 @@ static void print_lock_x(erts_lcnt_lock_t *lock, Uint16 flag, char *action, char
long int colls, tries, w_state, r_state;
erts_lcnt_lock_stats_t *stats = NULL;
- float rate;
char *type;
int i;
@@ -170,8 +169,6 @@ static void print_lock_x(erts_lcnt_lock_t *lock, Uint16 flag, char *action, char
ethr_atomic_read(&lock->r_state, &r_state);
ethr_atomic_read(&lock->w_state, &w_state);
- if (tries > 0) rate = (float)(colls/(float)tries)*100;
- else rate = 0.0f;
if (lock->flag & flag) {
erts_printf("%20s [%30s] [r/w state %4ld/%4ld] id %T %s\r\n",
@@ -181,26 +178,13 @@ static void print_lock_x(erts_lcnt_lock_t *lock, Uint16 flag, char *action, char
w_state,
lock->id,
extra);
-
- for(i = 0; i < lock->n_stats; i++) {
- stats = &(lock->stats[i]);
- ethr_atomic_read(&stats->tries, &tries);
- ethr_atomic_read(&stats->colls, &colls);
- fprintf(stderr, "%69s:%5d [tries %9ld] [colls %9ld] [timer_n %8ld] [timer %4ld s %6ld us]\r\n",
- stats->file,
- stats->line,
- tries,
- colls,
- stats->timer_n,
- stats->timer.s,
- (unsigned long)stats->timer.ns/1000);
- }
- fprintf(stderr, "\r\n");
}
}
static void print_lock(erts_lcnt_lock_t *lock, char *action) {
- print_lock_x(lock, ERTS_LCNT_LT_ALL, action, "");
+ if (strcmp(lock->name, "proc_main") == 0) {
+ print_lock_x(lock, ERTS_LCNT_LT_ALL, action, "");
+ }
}
#endif
@@ -230,8 +214,8 @@ static void lcnt_update_stats(erts_lcnt_lock_stats_t *stats, int lock_in_conflic
ethr_atomic_inc(&stats->tries);
- /* beware of trylock */
- if (lock_in_conflict) ethr_atomic_inc(&stats->colls);
+ if (lock_in_conflict)
+ ethr_atomic_inc(&stats->colls);
if (time_wait) {
lcnt_time_add(&(stats->timer), time_wait);
@@ -366,6 +350,7 @@ void erts_lcnt_init_lock_x(erts_lcnt_lock_t *lock, char *name, Uint16 flag, Eter
for (i = 0; i < ERTS_LCNT_MAX_LOCK_LOCATIONS; i++) {
lcnt_clear_stats(&lock->stats[i]);
}
+
erts_lcnt_list_insert(erts_lcnt_data->current_locks, lock);
lcnt_unlock();
@@ -373,18 +358,20 @@ void erts_lcnt_init_lock_x(erts_lcnt_lock_t *lock, char *name, Uint16 flag, Eter
void erts_lcnt_destroy_lock(erts_lcnt_lock_t *lock) {
erts_lcnt_lock_t *deleted_lock;
-
- /* copy structure and insert the copy */
- deleted_lock = (erts_lcnt_lock_t*)malloc(sizeof(erts_lcnt_lock_t));
lcnt_lock();
- memcpy(deleted_lock, lock, sizeof(erts_lcnt_lock_t));
- deleted_lock->next = NULL;
- deleted_lock->prev = NULL;
+ if (erts_lcnt_rt_options & ERTS_LCNT_OPT_COPYSAVE) {
+ /* copy structure and insert the copy */
- erts_lcnt_list_insert(erts_lcnt_data->deleted_locks, deleted_lock);
+ deleted_lock = (erts_lcnt_lock_t*)malloc(sizeof(erts_lcnt_lock_t));
+ memcpy(deleted_lock, lock, sizeof(erts_lcnt_lock_t));
+ deleted_lock->next = NULL;
+ deleted_lock->prev = NULL;
+
+ erts_lcnt_list_insert(erts_lcnt_data->deleted_locks, deleted_lock);
+ }
/* delete original */
erts_lcnt_list_delete(erts_lcnt_data->current_locks, lock);
@@ -416,9 +403,10 @@ void erts_lcnt_lock_opt(erts_lcnt_lock_t *lock, Uint16 option) {
/* we cannot acquire w_lock if either w or r are taken */
/* we cannot acquire r_lock if w_lock is taken */
- if ((w_state > 0) || (r_state > 0)){
+ if ((w_state > 0) || (r_state > 0)) {
eltd->lock_in_conflict = 1;
- if (eltd->timer_set == 0) lcnt_time(&eltd->timer);
+ if (eltd->timer_set == 0)
+ lcnt_time(&eltd->timer);
eltd->timer_set++;
} else {
eltd->lock_in_conflict = 0;
@@ -445,7 +433,8 @@ void erts_lcnt_lock(erts_lcnt_lock_t *lock) {
* 'atomicly'. All other locks will block the thread if w_state > 0
* i.e. locked.
*/
- if (eltd->timer_set == 0) lcnt_time(&eltd->timer);
+ if (eltd->timer_set == 0)
+ lcnt_time(&eltd->timer);
eltd->timer_set++;
} else {
@@ -494,24 +483,23 @@ void erts_lcnt_lock_post_x(erts_lcnt_lock_t *lock, char *file, unsigned int line
eltd = lcnt_get_thread_data();
ASSERT(eltd);
-
+
/* if lock was in conflict, time it */
stats = lcnt_get_lock_stats(lock, file, line);
if (eltd->timer_set) {
lcnt_time(&timer);
-
- eltd->timer_set--;
lcnt_time_diff(&time_wait, &timer, &(eltd->timer));
lcnt_update_stats(stats, eltd->lock_in_conflict, &time_wait);
+ eltd->timer_set--;
ASSERT(eltd->timer_set >= 0);
} else {
lcnt_update_stats(stats, eltd->lock_in_conflict, NULL);
}
-
+
}
/* unlock */
diff --git a/erts/emulator/beam/erl_lock_count.h b/erts/emulator/beam/erl_lock_count.h
index 8564c36203..e3044c371f 100644
--- a/erts/emulator/beam/erl_lock_count.h
+++ b/erts/emulator/beam/erl_lock_count.h
@@ -1,19 +1,19 @@
/*
* %CopyrightBegin%
- *
- * Copyright Ericsson AB 2008-2009. All Rights Reserved.
- *
+ *
+ * Copyright Ericsson AB 2008-2010. All Rights Reserved.
+ *
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
* compliance with the License. You should have received a copy of the
* Erlang Public License along with this software. If not, it can be
* retrieved online at http://www.erlang.org/.
- *
+ *
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
- *
+ *
* %CopyrightEnd%
*/
@@ -39,6 +39,20 @@
* Each instance of a lock is the unique lock, i.e. set and id in that set.
* For each lock there is a set of statistics with where and what impact
* the lock aqusition had.
+ *
+ * Runtime options
+ * - suspend, used when internal lock-counting can't be applied. For instance
+ * when allocating a term for the outside and halloc needs to be used.
+ * Default: off.
+ * - location, reserved and not used.
+ * - proclock, disable proclock counting. Used when performance might be an
+ * issue. Accessible from erts_debug:lock_counters({process_locks, bool()}).
+ * Default: off.
+ * - copysave, enable saving of destroyed locks (and thereby its statistics).
+ * If memory constraints is an issue this need to be disabled.
+ * Accessible from erts_debug:lock_counters({copy_save, bool()}).
+ * Default: off.
+ *
*/
#include "sys.h"
@@ -74,6 +88,7 @@
#define ERTS_LCNT_OPT_SUSPEND (((Uint16) 1) << 0)
#define ERTS_LCNT_OPT_LOCATION (((Uint16) 1) << 1)
#define ERTS_LCNT_OPT_PROCLOCK (((Uint16) 1) << 2)
+#define ERTS_LCNT_OPT_COPYSAVE (((Uint16) 1) << 3)
typedef struct {
unsigned long s;
diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c
index 2789691c55..996806fc75 100644
--- a/erts/emulator/beam/erl_process.c
+++ b/erts/emulator/beam/erl_process.c
@@ -2095,7 +2095,11 @@ erts_init_scheduling(int mrq, int no_schedulers, int no_schedulers_online)
rq->ix = ix;
erts_smp_atomic_init(&rq->info_flags, ERTS_RUNQ_IFLG_NONEMPTY);
- erts_smp_mtx_init(&rq->mtx, "run_queue");
+ /* make sure that the "extra" id correponds to the schedulers
+ * id if the esdp->no <-> ix+1 mapping change.
+ */
+
+ erts_smp_mtx_init_x(&rq->mtx, "run_queue", make_small(ix + 1));
erts_smp_cnd_init(&rq->cnd);
erts_smp_atomic_init(&rq->spin_waiter, 0);
@@ -6282,7 +6286,9 @@ Process *schedule(Process *p, int calls)
erts_check_my_tracer_proc(p);
#endif
- if ((FLAGS(p) & F_FORCE_GC) || (MSO(p).overhead > BIN_VHEAP_SZ(p))) {
+ if (!ERTS_PROC_IS_EXITING(p)
+ && ((FLAGS(p) & F_FORCE_GC)
+ || (MSO(p).overhead > BIN_VHEAP_SZ(p)))) {
reds -= erts_garbage_collect(p, 0, p->arg_reg, p->arity);
if (reds < 0) {
reds = 1;
diff --git a/erts/emulator/beam/io.c b/erts/emulator/beam/io.c
index 61985271e6..c5de180cb2 100644
--- a/erts/emulator/beam/io.c
+++ b/erts/emulator/beam/io.c
@@ -1,19 +1,19 @@
/*
* %CopyrightBegin%
- *
- * Copyright Ericsson AB 1996-2009. All Rights Reserved.
- *
+ *
+ * Copyright Ericsson AB 1996-2010. All Rights Reserved.
+ *
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
* compliance with the License. You should have received a copy of the
* Erlang Public License along with this software. If not, it can be
* retrieved online at http://www.erlang.org/.
- *
+ *
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
- *
+ *
* %CopyrightEnd%
*/
@@ -1227,7 +1227,7 @@ void init_io(void)
erts_smp_atomic_init(&erts_port[i].refc, 0);
erts_port[i].lock = NULL;
erts_port[i].xports = NULL;
- erts_smp_spinlock_init(&erts_port[i].state_lck, "port_state");
+ erts_smp_spinlock_init_x(&erts_port[i].state_lck, "port_state", make_small(i));
#endif
erts_port[i].tracer_proc = NIL;
erts_port[i].trace_flags = 0;
diff --git a/erts/etc/unix/Install.src b/erts/etc/unix/Install.src
index 22357b057f..83f9690782 100644
--- a/erts/etc/unix/Install.src
+++ b/erts/etc/unix/Install.src
@@ -149,4 +149,4 @@ then
./misc/format_man_pages $ERL_ROOT
fi
-
+exit 0