RTEMS shell and telnetd

Chris Johns chrisj at rtems.org
Wed Jun 4 01:14:04 UTC 2014


On 2/06/2014 5:13 pm, Sebastian Huber wrote:
> On 2014-05-29 01:32, Chris Johns wrote:
>> On 29/05/2014 1:13 am, Sebastian Huber wrote:
>>> Hello Peter,
>>>
>>> On 2014-05-28 17:04, Peter Dufault wrote:
>>>> I'm figuring out how we're supposed to hook telnetd and RTEMS shell
>>>> together in the git head and I don't understand the intent.  I used to
>>>> do it like this:
>>>>
>>>> static void sh_wrap(char *unused_dev, void *arg)
>>>> {
>>>>      rtems_shell_env_t my_env = rtems_global_shell_env;
>>>>      my_env.forever = false;
>>>>      (void)rtems_shell_main_loop( &my_env );
>>>> }
>>>>
>>>> rtems_telnetd_config_table rtems_telnetd_config = {
>>>>      sh_wrap,                /* Command */
>>>>      NULL,                   /* Argument */
>>>>      0,                      /* Priority */
>>>>      20 * RTEMS_MINIMUM_STACK_SIZE, /* task stack size */
>>>>      0,                      /* Login check */
>>>>      0                       /* Keep stdio of the caller  */
>>>> };
>>>>
>>>> and later call:
>>>>
>>>>      rtems_telnetd_initialize();
>>>>
>>>> "rtems_global_shell_env" is no longer global.
>>>> "rtems_shell_init_env()" which would initialize a rtems_shell_env_t is
>>>> not global.  "rtems_shell_get_current_env()" won't work outside of a
>>>> shell context.  Passing 0 to rtems_shell_main_loop(0) will get the
>>>> default settings for the shell env, so forever will be set true and I
>>>> won't be able to exit the session.
>>>>
>>>> Am I missing something or is the intention I set up a "my_env"
>>>> myself?  rtems_shell_env_t is still global.
>>>
>>> since so many user stumble over this problem I think we should bring
>>> this global rtems_global_shell_env back as a read-only variable simply
>>> to initialize rtems_shell_env_t variables.
>>>
>>
>> What is wrong with:
>>
>>    rtems_shell_env_t shell_env = *rtems_shell_get_current_env();
>>
>> ?
>
> I don't like this global, but it turned that this missing
> rtems_global_shell_env is currently the number one support question of
> users updating to the latest RTEMS version.  At least now it is const.
>

That maybe the case but I do not see this as a reason to keep a poor 
interface any longer than we need. I suggest we strengthen the API and 
remove this variable and get things cleaned up.

I posted a patch on the devel list and no one has comments so can I 
assume it is ok to push ?

Chris



More information about the users mailing list