aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrik Nyblom <[email protected]>2012-04-18 11:31:27 +0200
committerPatrik Nyblom <[email protected]>2012-04-18 11:31:27 +0200
commit00668f8cbae565d482e9ad72a63f846cef8e8071 (patch)
tree408683cfdc04303c0e9ddeb9340a4d02b6da9254
parentf21ff0941a68ef8bc1097537f4bb503a522a8bf3 (diff)
downloadotp-00668f8cbae565d482e9ad72a63f846cef8e8071.tar.gz
otp-00668f8cbae565d482e9ad72a63f846cef8e8071.tar.bz2
otp-00668f8cbae565d482e9ad72a63f846cef8e8071.zip
Revert "Extend erlang:port_info/1,2 to show the OS pid of a spawned process"
This reverts commit d4667d383964c1550e0a91d64b674e84f6d07e3b. This commit was included by mistake, the correct patch will be merged from maint.
-rw-r--r--erts/doc/src/erlang.xml4
-rw-r--r--erts/emulator/beam/atom.names1
-rw-r--r--erts/emulator/beam/erl_bif_info.c16
-rw-r--r--erts/emulator/beam/global.h1
-rw-r--r--erts/emulator/beam/io.c1
-rw-r--r--erts/emulator/sys/unix/sys.c2
-rw-r--r--erts/emulator/test/port_bif_SUITE.erl28
-rw-r--r--lib/dialyzer/test/small_SUITE_data/results/port_info_test3
-rw-r--r--lib/dialyzer/test/small_SUITE_data/src/port_info_test.erl6
-rw-r--r--lib/hipe/cerl/erl_bif_types.erl3
10 files changed, 5 insertions, 60 deletions
diff --git a/erts/doc/src/erlang.xml b/erts/doc/src/erlang.xml
index 9c8c033e29..63e2e63b0b 100644
--- a/erts/doc/src/erlang.xml
+++ b/erts/doc/src/erlang.xml
@@ -3119,10 +3119,6 @@ os_prompt% </pre>
<p><c><anno>Bytes</anno></c> is the total number of bytes written to
the port.</p>
</item>
- <tag><c>{os_pid, Integer}</c></tag>
- <item>
- <p><c>Integer</c> is the OS pid of the spawned process (Unix systems only).</p>
- </item>
</taglist>
<p>Failure: <c>badarg</c> if <c><anno>Port</anno></c> is not a local port.</p>
</desc>
diff --git a/erts/emulator/beam/atom.names b/erts/emulator/beam/atom.names
index 78c566ed38..02735d4b68 100644
--- a/erts/emulator/beam/atom.names
+++ b/erts/emulator/beam/atom.names
@@ -391,7 +391,6 @@ atom opt
atom or
atom ordered_set
atom orelse
-atom os_pid
atom os_type
atom os_version
atom ose_bg_proc
diff --git a/erts/emulator/beam/erl_bif_info.c b/erts/emulator/beam/erl_bif_info.c
index 4dcfe997d4..060a52d220 100644
--- a/erts/emulator/beam/erl_bif_info.c
+++ b/erts/emulator/beam/erl_bif_info.c
@@ -2765,8 +2765,7 @@ port_info_1(BIF_ALIST_1)
am_id,
am_connected,
am_input,
- am_output,
- am_os_pid
+ am_output
};
Eterm items[ASIZE(keys)];
Eterm result = NIL;
@@ -2823,7 +2822,6 @@ port_info_1(BIF_ALIST_1)
** name String
** input Number of bytes input from port program
** output Number of bytes output to the port program
-** os_pid The child's process ID
*/
BIF_RETTYPE port_info_2(BIF_ALIST_2)
@@ -2924,18 +2922,6 @@ static BIF_RETTYPE port_info(Process* p, Eterm portid, Eterm item)
hp = HAlloc(p, hsz);
res = erts_bld_uint(&hp, NULL, n);
}
- else if (item == am_os_pid) {
- if (prt->os_pid >= 0) {
- Uint hsz = 3;
- Uint n = prt->os_pid;
- (void) erts_bld_uint(NULL, &hsz, n);
- hp = HAlloc(p, hsz);
- res = erts_bld_uint(&hp, NULL, n);
- } else {
- hp = HAlloc(p, 3);
- res = am_undefined;
- }
- }
else if (item == am_registered_name) {
RegProc *reg;
reg = prt->reg;
diff --git a/erts/emulator/beam/global.h b/erts/emulator/beam/global.h
index 732cc7d45d..84267dd140 100644
--- a/erts/emulator/beam/global.h
+++ b/erts/emulator/beam/global.h
@@ -174,7 +174,6 @@ struct port {
char *name; /* String used in the open */
erts_driver_t* drv_ptr;
UWord drv_data;
- pid_t os_pid; /* Child process ID */
ErtsProcList *suspended; /* List of suspended processes. */
LineBuf *linebuf; /* Buffer to hold data not ready for
process to get (line oriented I/O)*/
diff --git a/erts/emulator/beam/io.c b/erts/emulator/beam/io.c
index a685f41c4d..53a25f5136 100644
--- a/erts/emulator/beam/io.c
+++ b/erts/emulator/beam/io.c
@@ -440,7 +440,6 @@ setup_port(Port* prt, Eterm pid, erts_driver_t *driver,
sys_strcpy(new_name, name);
erts_smp_runq_lock(runq);
erts_smp_port_state_lock(prt);
- prt->os_pid = -1;
prt->status = ERTS_PORT_SFLG_CONNECTED | xstatus;
prt->snapshot = erts_smp_atomic32_read_nob(&erts_ports_snapshot);
old_name = prt->name;
diff --git a/erts/emulator/sys/unix/sys.c b/erts/emulator/sys/unix/sys.c
index bf69f3bf90..f94e0f2296 100644
--- a/erts/emulator/sys/unix/sys.c
+++ b/erts/emulator/sys/unix/sys.c
@@ -1163,8 +1163,6 @@ static int set_driver_data(int port_num,
report_exit_list = report_exit;
}
- erts_port[port_num].os_pid = pid;
-
if (read_write & DO_READ) {
driver_data[ifd].packet_bytes = packet_bytes;
driver_data[ifd].port_num = port_num;
diff --git a/erts/emulator/test/port_bif_SUITE.erl b/erts/emulator/test/port_bif_SUITE.erl
index f4ba502be5..d9c82aba0e 100644
--- a/erts/emulator/test/port_bif_SUITE.erl
+++ b/erts/emulator/test/port_bif_SUITE.erl
@@ -24,7 +24,6 @@
init_per_group/2,end_per_group/2, command/1,
command_e_1/1, command_e_2/1, command_e_3/1, command_e_4/1,
port_info1/1, port_info2/1,
- port_info_os_pid/1,
connect/1, control/1, echo_to_busy/1]).
-export([do_command_e_1/1, do_command_e_2/1, do_command_e_4/1]).
@@ -42,7 +41,7 @@ all() ->
groups() ->
[{command_e, [],
[command_e_1, command_e_2, command_e_3, command_e_4]},
- {port_info, [], [port_info1, port_info2, port_info_os_pid]}].
+ {port_info, [], [port_info1, port_info2]}].
init_per_suite(Config) ->
Config.
@@ -197,7 +196,6 @@ port_info1(Config) when is_list(Config) ->
?line {value,{connected,_}}=lists:keysearch(connected, 1, A),
?line {value,{input,0}}=lists:keysearch(input, 1, A),
?line {value,{output,0}}=lists:keysearch(output, 1, A),
- ?line {value,{os_pid,undefined}}=lists:keysearch(os_pid, 1, A), % linked-in driver doesn't have a OS pid
?line true=erlang:port_close(P),
ok.
@@ -217,7 +215,6 @@ port_info2(Config) when is_list(Config) ->
?line {connected, Me} = erlang:port_info(P, connected),
?line {input, 0}=erlang:port_info(P, input),
?line {output,0}=erlang:port_info(P, output),
- ?line {os_pid, undefined}=erlang:port_info(P, os_pid), % linked-in driver doesn't have a OS pid
?line erlang:port_control(P, $i, "abc"),
?line receive
@@ -232,29 +229,6 @@ port_info2(Config) when is_list(Config) ->
?line true = erlang:port_close(P),
ok.
-%% Tests the port_info/1,2 os_pid option BIF
-port_info_os_pid(Config) when is_list(Config) ->
- case os:type() of
- {unix,_} ->
- do_port_info_os_pid();
- _ ->
- {skip,"Only on Unix."}
- end.
-
-do_port_info_os_pid() ->
- ?line P = open_port({spawn, "echo $$"}, [eof]),
- ?line A = erlang:port_info(P),
- ?line {os_pid, InfoOSPid} = erlang:port_info(P, os_pid),
- ?line EchoPidStr = receive
- {P, {data, EchoPidStr0}} -> EchoPidStr0
- after 10000 -> ?line test_server:fail(timeout)
- end,
- ?line {ok, [EchoPid], []} = io_lib:fread("~u\n", EchoPidStr),
- ?line {value,{os_pid, InfoOSPid}}=lists:keysearch(os_pid, 1, A),
- ?line EchoPid = InfoOSPid,
- ?line true = erlang:port_close(P),
- ok.
-
output_test(_, _, Input, Output) when Output > 16#1fffffff ->
io:format("~p bytes received\n", [Input]);
output_test(P, Bin, Input0, Output0) ->
diff --git a/lib/dialyzer/test/small_SUITE_data/results/port_info_test b/lib/dialyzer/test/small_SUITE_data/results/port_info_test
index 8a4ce0fc66..9ee863f9eb 100644
--- a/lib/dialyzer/test/small_SUITE_data/results/port_info_test
+++ b/lib/dialyzer/test/small_SUITE_data/results/port_info_test
@@ -3,5 +3,4 @@ port_info_test.erl:10: The pattern {'connected', 42} can never match the type 'u
port_info_test.erl:14: The pattern {'registered_name', "42"} can never match the type 'undefined' | {'registered_name',atom()}
port_info_test.erl:19: The pattern {'output', 42} can never match the type 'undefined' | {'connected',pid()}
port_info_test.erl:24: Guard test 'links' =:= Atom::'connected' can never succeed
-port_info_test.erl:28: The pattern {'gazonk', _} can never match the type 'undefined' | {'connected' | 'id' | 'input' | 'links' | 'name' | 'os_pid' | 'output' | 'registered_name',atom() | pid() | [pid() | char()] | integer()}
-port_info_test.erl:32: The pattern {'os_pid', "42"} can never match the type 'undefined' | {'os_pid',integer()}
+port_info_test.erl:28: The pattern {'gazonk', _} can never match the type 'undefined' | {'connected' | 'id' | 'input' | 'links' | 'name' | 'output' | 'registered_name',atom() | pid() | [pid() | char()] | integer()}
diff --git a/lib/dialyzer/test/small_SUITE_data/src/port_info_test.erl b/lib/dialyzer/test/small_SUITE_data/src/port_info_test.erl
index 07f22256c9..2ee9a3a6e2 100644
--- a/lib/dialyzer/test/small_SUITE_data/src/port_info_test.erl
+++ b/lib/dialyzer/test/small_SUITE_data/src/port_info_test.erl
@@ -3,7 +3,7 @@
%% and the quality of the warnings that Dialyzer spits out
%%
-module(port_info_test).
--export([t1/1, t2/1, t3/1, t4/1, t5/2, t6/1, buggy/1]).
+-export([t1/1, t2/1, t3/1, t4/1, t5/2, buggy/1]).
%% The following errors are correctly caught, but the messages are a bit weird
t1(X) when is_port(X) ->
@@ -28,10 +28,6 @@ t5(X, Atom) when is_port(X) ->
{gazonk, _} = erlang:port_info(X, Atom);
t5(_, _) -> ok.
-t6(X) when is_port(X) ->
- {os_pid, "42"} = erlang:port_info(X, os_pid);
-t6(_) -> ok.
-
%% The type system is not strong enough to catch the following errors
buggy(X) when is_atom(X) ->
{links, X} = erlang:port_info(foo, X).
diff --git a/lib/hipe/cerl/erl_bif_types.erl b/lib/hipe/cerl/erl_bif_types.erl
index a65b46494e..5c5ffe86e5 100644
--- a/lib/hipe/cerl/erl_bif_types.erl
+++ b/lib/hipe/cerl/erl_bif_types.erl
@@ -781,7 +781,6 @@ type(erlang, port_info, 2, Xs) ->
['input'] -> t_tuple([Item, t_integer()]);
['links'] -> t_tuple([Item, t_list(t_pid())]);
['name'] -> t_tuple([Item, t_string()]);
- ['os_pid'] -> t_tuple([Item, t_integer()]);
['output'] -> t_tuple([Item, t_integer()]);
['registered_name'] -> t_tuple([Item, t_atom()]);
List when is_list(List) ->
@@ -2287,7 +2286,7 @@ arg_types(erlang, port_info, 1) ->
arg_types(erlang, port_info, 2) ->
[t_sup(t_port(), t_atom()),
t_atoms(['registered_name', 'id', 'connected',
- 'links', 'name', 'input', 'output', 'os_pid'])];
+ 'links', 'name', 'input', 'output'])];
%% Guard bif, needs to be here.
arg_types(erlang, round, 1) ->
[t_number()];