[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [PATCH 2/2] lib/vfscore: Add both the block and echo support



Neither CONFIG_UK_STDIN_BLOCKING, nor CONFIG_UK_STDIN_ECHO is not
present in any configurations. And I don't think they should. Isn't the
code under these ifdefs implements a bit more correct behavior of the
read function? Even though it would not build if I manually enable these
config.

I said "more correct" because this implementation reads only 1
character from stdin. I think it is more reasonable to mimic the
whatever normal read does (read until EOF or \n met).

That is a step in the right direction I think, but a little bit more
needed to be done.

"Vlad-Andrei BĂDOIU (78692)" <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
writes:

> The block behaviour is needed by the python shell. Currently
> uk_cink return 0 if no character is being inputted and python
> uses fgets on stdin which causes the console to close
> immediately. The echo behaviour is needed for feedback on the
> typed input. Both features are guarded by defines (CONFIG_UK_
> STDIN_BLOCKING and CONFIG_UK_STDIN_ECHO).
>
> Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
> ---
>  lib/vfscore/stdio.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/lib/vfscore/stdio.c b/lib/vfscore/stdio.c
> index 6acbb32..ec61e3a 100644
> --- a/lib/vfscore/stdio.c
> +++ b/lib/vfscore/stdio.c
> @@ -44,6 +44,14 @@ static ssize_t stdin_read(struct vfscore_file 
> *vfscore_file __unused,
>  
>       read_count = ukplat_cink(buf, count);
>  
> +#ifdef CONFIG_UK_STDIN_BLOCKING
> +     while (read_count <= 0)
> +             read_count = ukplat_cink(buf, count);
> +#endif
> +
> +#ifdef CONFIG_UK_STDIN_ECHO
> +     stdout_write(vfscore_file, buf, read_count, 0);
> +#endif
>       return read_count;
>  }
>  
> -- 
> 2.19.1
>

-- 
Yuri Volchkov
Software Specialist

NEC Europe Ltd
Kurfürsten-Anlage 36
D-69115 Heidelberg

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.