Samsung / libtuv

Asynchronous I/O for IoT.js and embedded system
Apache License 2.0
128 stars 76 forks source link

TTY support #85

Open niklauslee opened 7 years ago

niklauslee commented 7 years ago

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.

glistening commented 7 years ago

@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.

niklauslee commented 7 years ago

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?

LaszloLango commented 7 years ago

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