Code Monkey home page Code Monkey logo

libuv-dox's Introduction

libuv-dox

become a patron

Documenting types and methods of libuv, mostly by reading uv.h.

Organization

The information found in uv.h has been organized into three categories:

Examples were added to show how the API is used.

types

The inheritance relationship is documented via :, i.e. uv_tcp_t : uv_stream_t denotes that uv_tcp_t derives from uv_stream_t and thus has all the stream type fields.

Macros of extra/private fields have been resolved as much as was sensible and the original location and name is documented, i.e. the private fields for uv_fs_t found inside include/uv-unix.h are included.

Note: uv-unix.h was always preferred over uv-win.h when resolving fields from macros.

callbacks

Although they are techniqually types as well they are documented in a separately in order to speed up lookup.

methods

The methods are categorized and ordered to mirror the categorization and order of the types that they use.

version

The libuv version at that is the source of this documentation is: v0.11.17.

License

MIT

libuv-dox's People

Contributors

robbie-cao avatar thlorenz avatar timoxley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libuv-dox's Issues

'uv_fs_read' and 'uv_fs_write' file method signatures

I was going through the learnuv project and looking at uv_fs_read. The method signature here differs from the actual method signature in uv.h

libuv-dox

int uv_fs_read(uv_loop_t* loop,
               uv_fs_t* req,
               uv_file file,
               void* buf,
               size_t length,
               int64_t offset,
               uv_fs_cb cb);

uv.h

int uv_fs_read(uv_loop_t* loop,
               uv_fs_t* req,
               uv_file file,
               const uv_buf_t bufs[],
               unsigned int nbufs,
               int64_t offset,
               uv_fs_cb cb);

The same goes for uv_fs_write. I'm new to libuv, so am I missing something?

Undefined Reference Errors

Hello there,
I am trying to compile libuv examples, and i get undefined reference errors in all of them. In particular in 05-tcp-echo-server i get the following output:

find . -name ".gc" -exec rm {} ;
rm -rf find . -name "*.dSYM" -print
rm -f main main.o
cc -g -O2 -Wall -I/home/pgirao/Projects/Libraries/libuv-dox/examples/05-tcp-echo-server/../libuv/include/ /home/pgirao/Projects/Libraries/libuv-dox/examples/05-tcp-echo-server/../libuv/out/Debug/libuv.a main.c -o main
main.c: In function ‘read_cb’:
main.c:47:8: warning: unused variable ‘readp’ [-Wunused-variable]
/tmp/ccEhPGtr.o: In function read_cb': /home/pgirao/Projects/Libraries/libuv-dox/examples/05-tcp-echo-server/main.c:66: undefined reference touv_buf_init'
/home/pgirao/Projects/Libraries/libuv-dox/examples/05-tcp-echo-server/main.c:55: undefined reference to uv_close' /tmp/ccEhPGtr.o: In functionwrite_cb':
/home/pgirao/Projects/Libraries/libuv-dox/examples/05-tcp-echo-server/main.c:78: undefined reference to uv_strerror' /home/pgirao/Projects/Libraries/libuv-dox/examples/05-tcp-echo-server/main.c:78: undefined reference touv_err_name'
/tmp/ccEhPGtr.o: In function alloc_cb': /home/pgirao/Projects/Libraries/libuv-dox/examples/05-tcp-echo-server/main.c:41: undefined reference touv_buf_init'
/tmp/ccEhPGtr.o: In function connection_cb': /home/pgirao/Projects/Libraries/libuv-dox/examples/05-tcp-echo-server/main.c:29: undefined reference touv_tcp_init'
/home/pgirao/Projects/Libraries/libuv-dox/examples/05-tcp-echo-server/main.c:31: undefined reference to uv_accept' /home/pgirao/Projects/Libraries/libuv-dox/examples/05-tcp-echo-server/main.c:26: undefined reference touv_strerror'
/home/pgirao/Projects/Libraries/libuv-dox/examples/05-tcp-echo-server/main.c:26: undefined reference to uv_err_name' /tmp/ccEhPGtr.o: In functionread_cb':
/home/pgirao/Projects/Libraries/libuv-dox/examples/05-tcp-echo-server/main.c:67: undefined reference to uv_write' /tmp/ccEhPGtr.o: In functionconnection_cb':
/home/pgirao/Projects/Libraries/libuv-dox/examples/05-tcp-echo-server/main.c:36: undefined reference to uv_read_start' /home/pgirao/Projects/Libraries/libuv-dox/examples/05-tcp-echo-server/main.c:34: undefined reference touv_close'
/tmp/ccEhPGtr.o: In function main': /home/pgirao/Projects/Libraries/libuv-dox/examples/05-tcp-echo-server/main.c:89: undefined reference touv_default_loop'
/home/pgirao/Projects/Libraries/libuv-dox/examples/05-tcp-echo-server/main.c:92: undefined reference to uv_tcp_init' /home/pgirao/Projects/Libraries/libuv-dox/examples/05-tcp-echo-server/main.c:95: undefined reference touv_ip4_addr'
/home/pgirao/Projects/Libraries/libuv-dox/examples/05-tcp-echo-server/main.c:97: undefined reference to uv_tcp_bind' /home/pgirao/Projects/Libraries/libuv-dox/examples/05-tcp-echo-server/main.c:99: undefined reference touv_listen'
/home/pgirao/Projects/Libraries/libuv-dox/examples/05-tcp-echo-server/main.c:104: undefined reference to uv_run' /home/pgirao/Projects/Libraries/libuv-dox/examples/05-tcp-echo-server/main.c:100: undefined reference touv_strerror'
/home/pgirao/Projects/Libraries/libuv-dox/examples/05-tcp-echo-server/main.c:100: undefined reference to `uv_err_name'
collect2: ld returned 1 exit status
make: *** [main] Error 1

I followed the instructions in the README.md.

Can someone help me?

Thank you!

Possible use-after-free in TCP echo server

I'm not entirely sure if this is correct so please bear with me.

On line 64, a write request is queued and sent, passing in a pointer to the buffer received from the read callback. However, on line 68, the same buffer can be freed if the callback is invoked with nread = 0.

This means that if a write request is queued, and while the write is pending on the libuv event loop, the read callback is invoked again with nread = 0, then the buffer which you are trying to write will be freed. This may result in a use-after-free, or at least a double free (since the same buffer later gets freed in the write callback).

Am I correct with my analysis?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.