libuv/libuv — pull request #19 by zhaozg (2014-11-29 08:26:13+00:00)
Title: add uv_device_t as stream on windows and Linux to handle device I/O

After long conversion on https://github.com/joyent/libuv/pull/1580, I need make a RP here.

Libuv is a good i/o framework, and easy to extent, I hope persist on libuv to do my work.

When I want to do r/w device on windows, I try filesystem api, it works for device handle, but not fit my needs. I need a real stream, I try wrap handle as pipe, and fail to work. When I study TTY and TCP, I realize that it not hard to implication a device type stream, because just file operation with overlapped, even simpler than other stream types.

There are only two type related api.

```c
UV_EXTERN int uv_device_init(uv_loop_t* handle,
uv_device_t* device,
const char* path,
int flags);
UV_EXTERN int uv_device_ioctl(uv_device_t* device, int cmd, uv_ioargs_t* args);
```

uv_device_init will init and create a uv_deive_t, path should be '/dev/??' on linux or "\\.\Global\???" on windows. flags should be O_RDONLY,O_WRONLY or O_RDWR.

uv_device_ioctl will set or get device paramater, arg is relative with OS platform, return >=0 for success, detail please see header file.

because not test widely, so maybe have bugs, please attention.

Happy for do something for libUV.