libtuv icon indicating copy to clipboard operation
libtuv copied to clipboard

TTY support

Open niklauslee opened this issue 8 years ago • 3 comments

Hello,

I'm developing JavaScript REPL with Jerryscript and libtuv on NuttX platform. However, It seems that TTY functions are not ported in libtuv.

I've tried to include the tty.c source file when building, but it fails to link to symbols: ttyname_r, cfmakeraw, and uv__dup2_cloexec. (ttyname_r and cfmakeraw are not found in any source files in NuttX)

Do you have any plans to support TTY?

Thanks.

niklauslee avatar Aug 19 '17 05:08 niklauslee

@niklauslee We currently don't have plan to use tty.c in iotjs for now. So we commented out tty.c in option_unix_common.cmake.

glistening avatar Aug 21 '17 02:08 glistening

Ok. I'll try to port myself.

One more question. I noticed that buffer size is allocated 64K in NuttX when reading from TTY and I found the related code in stream.c as follow:

#if defined(__NUTTX__) || defined(__TIZENRT__)
    stream->alloc_cb((uv_handle_t*)stream, 64 * 1024, &buf);
#else
    stream->alloc_cb((uv_handle_t*)stream, 2 * 1024, &buf);
#endif

It try to alloc 64K for NuttX and 2K for other platforms. I think that it's reversed. Or, do you have any other intensions for this?

niklauslee avatar Aug 21 '17 03:08 niklauslee

@niklauslee yes, it looks like those lines should be swapped.

LaszloLango avatar Aug 21 '17 07:08 LaszloLango