| Author |
Message |
< Erlang patches mailing list ~ gen_server:format_status/2 only works with registered proces |
| vances at motivity.ca |
Posted: Thu Mar 20, 2003 11:05 pm |
|
|
|
Guest
|
OK, I found the problem. The following patch to lists.erl does it:
*** lists.erl.dist Thu Mar 20 17:56:16 2003
--- lists.erl Thu Mar 20 17:58:26 2003
***************
*** 280,285 ****
--- 280,286 ----
thing_to_list(X) when integer(X) -> integer_to_list(X);
thing_to_list(X) when float(X) -> float_to_list(X);
thing_to_list(X) when atom(X) -> atom_to_list(X);
+ thing_to_list(X) when pid(X) -> pid_to_list(X);
thing_to_list(X) when list(X) -> X. %Assumed to be a string
%% flatten(List)
-Vance
Vance Shipley
Motivity Telecom Inc.
+1 519 240 3684
vances_at_motivity.ca
On Thu, Mar 20, 2003 at 04:36:04PM -0500, Vance Shipley wrote:
}
} Now the problem is that, at least in R9B-[0|1], this only works if the
} process is registered! In the following example I am peeking at a
} couple gen_server processes the system runs. I am referring to each
} by PID but the process which is not registerd fails.
...
} Error in process <0.25.0> with exit value: {function_clause,[{lists,thing_to_list,[<0.23.0>]},{lists,flatmap,2},{gen_server,format_status,2},{erl_eval,expr,3},{erl_eval,exprs,4},{shell,eval_loop,2}]}
}
Post generated using Mail2Forum (http://m2f.sourceforge.net) |
|
|
| Back to top |
|
| raimo.niskanen at uab.eri |
Posted: Mon Mar 24, 2003 12:52 pm |
|
|
|
Guest
|
Vance Shipley wrote:
> OK, I found the problem. The following patch to lists.erl does it:
>
> *** lists.erl.dist Thu Mar 20 17:56:16 2003
> --- lists.erl Thu Mar 20 17:58:26 2003
> ***************
> *** 280,285 ****
> --- 280,286 ----
> thing_to_list(X) when integer(X) -> integer_to_list(X);
> thing_to_list(X) when float(X) -> float_to_list(X);
> thing_to_list(X) when atom(X) -> atom_to_list(X);
> + thing_to_list(X) when pid(X) -> pid_to_list(X);
> thing_to_list(X) when list(X) -> X. %Assumed to be a string
>
> %% flatten(List)
>
I am sorry, I do not think that is the correct(tm) solution. It seems
that lists:thing_to_list/1 handles items that look the same in a
parseable Erlang source file as when printed. Some types that are
missing are: pid(), port(), reference(), all not parseable from their
string representation.
So I think it is gen_server:format_status/2 that is faulty, trying to
call lists:concat/1 with a pid(). See the diff following.
/ Raimo Niskanen, Erlang/OTP
Note that the following diff might not patch as it is since it is not
from the R9B-1 version of the file.
***************
*** 670,676 ****
%%-----------------------------------------------------------------
format_status(Opt, StatusData) ->
[PDict, SysState, Parent, Debug, [Name, State, Mod, _Time]] =
StatusData,
! Header = lists:concat(["Status for generic server ", Name]),
Log = sys:get_debug(log, Debug, []),
Specfic =
case erlang:function_exported(Mod, format_status, 2) of
--- 670,681 ----
%%-----------------------------------------------------------------
format_status(Opt, StatusData) ->
[PDict, SysState, Parent, Debug, [Name, State, Mod, _Time]] =
StatusData,
! NameTag = if pid(Name) ->
! pid_to_list(Name);
! atom(Name) ->
! Name
! end,
! Header = lists:concat(["Status for generic server ", NameTag]),
Log = sys:get_debug(log, Debug, []),
Specfic =
case erlang:function_exported(Mod, format_status, 2) of
>
>
> -Vance
>
> Vance Shipley
> Motivity Telecom Inc.
> +1 519 240 3684
> vances_at_motivity.ca
>
> On Thu, Mar 20, 2003 at 04:36:04PM -0500, Vance Shipley wrote:
> }
> } Now the problem is that, at least in R9B-[0|1], this only works if the
> } process is registered! In the following example I am peeking at a
> } couple gen_server processes the system runs. I am referring to each
> } by PID but the process which is not registerd fails.
> ...
> } Error in process <0.25.0> with exit value: {function_clause,[{lists,thing_to_list,[<0.23.0>]},{lists,flatmap,2},{gen_server,format_status,2},{erl_eval,expr,3},{erl_eval,exprs,4},{shell,eval_loop,2}]}
> }
Post generated using Mail2Forum (http://m2f.sourceforge.net) |
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|