Commit Graph

18 Commits

Author SHA1 Message Date
Santiago Gimeno
309d603382
test: fix -Wformat warning
Substitute the `z` length modifier with `l` to avoid warnings, as the
`z` modifier is defined in the C99 standard.

PR-URL: https://github.com/libuv/libuv/pull/1220
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2017-02-08 12:47:50 +01:00
Ben Noordhuis
538782fbda test: make threadpool saturation reliable
Use a deterministic approach for saturating the threadpool instead of
depending on a timeout.  Should help reduce the flakiness of the CI.

PR-URL: https://github.com/libuv/libuv/pull/1014
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-10-14 02:06:55 +02:00
Ben Noordhuis
39baaa58b7 test: make threadpool_cancel_single deterministic
Saturate the thread pool before trying to post-and-cancel the work
request.  Before this commit we simply posted requests in a loop,
in the (sometimes idle) hope that one would get queued up instead
of being dispatched right away.

PR-URL: https://github.com/libuv/libuv/pull/1014
Refs: https://github.com/libuv/libuv/pull/1010
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-10-14 02:02:47 +02:00
Yuval Brik
e76b8838e5 fs: add uv_fs_realpath()
Equivalent to realpath(3), returns the full resolved absolute path of a
file or directory.

PR-URL: https://github.com/libuv/libuv/pull/531
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-12-05 11:32:58 +01:00
Karl Skomski
939ea06f45 unix,win: return EINVAL on nullptr args in uv_fs_{read,write}
PR-URL: https://github.com/libuv/libuv/pull/470
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-08-11 13:35:54 +02:00
Saúl Ibarra Corretgé
03e53f1cf7 fs: rename uv_fs_readdir to uv_fs_scandir
Closes #1431
2014-09-25 10:09:58 +02:00
Saúl Ibarra Corretgé
d4c1228d15 include: const-ify arguments to uv_getnameinfo_cb 2014-06-26 22:46:39 +02:00
Saúl Ibarra Corretgé
133b9d1cc1 unix: allow uv_getnameinfo to be cancelled 2014-06-18 02:00:07 +02:00
Rasmus Pedersen
cd6e74dd80 test: fix compilation warnings with VC++
C6011 and C4244
2014-04-17 17:31:11 +02:00
Saúl Ibarra Corretgé
db2a9072bc unix, windows: removed unused status parameter
async, timer, prepare, idle and check handles don't need the status
parameter.
2014-03-17 21:42:36 +01:00
Rasmus Pedersen
fd35e7a0bd test: fix VC++ warning C4244 2014-02-20 11:32:07 +01:00
Ben Noordhuis
3ee4d3f183 unix, windows: return error codes directly
This commit changes the libuv API to return error codes directly rather
than storing them in a loop-global field.

A code snippet like this one:

    if (uv_foo(loop) < 0) {
      uv_err_t err = uv_last_error(loop);
      fprintf(stderr, "%s\n", uv_strerror(err));
    }

Should be rewritten like this:

    int err = uv_foo(loop);
    if (err < 0)
      fprintf(stderr, "%s\n", uv_strerror(err));

The rationale for this change is that it should make creating bindings
for other languages a lot easier: dealing with struct return values is
painful with most FFIs and often downright buggy.
2013-07-07 09:51:00 +02:00
Ben Noordhuis
76d831e4c8 unix: getaddrinfo_cb status arg should be 0 or -1
The documentation in uv.h states that the status argument to the
uv_getaddrinfo() callback is either 0 or -1 but uv-unix actually
passed it the addrinfo error code. Rectify that and add a regression
test.

Fixes #754.
2013-03-26 22:30:46 +01:00
Ben Noordhuis
e7f384f853 test: make threadpool tests valgrind-compliant
Delete the event loop after the test to stop valgrind from complaining
about memory leaks.
2013-01-16 23:59:58 +01:00
Ben Noordhuis
4ba03ddd56 unix, windows: rename uv_run2 to uv_run
This changes the prototype of uv_run() from:

  int uv_run(uv_loop_t* loop);

To:

  int uv_run(uv_loop_t* loop, uv_run_mode mode);

Where `mode` is UV_RUN_DEFAULT, UV_RUN_ONCE or UV_RUN_NOWAIT.

Fixes #683.
2013-01-16 23:35:29 +01:00
Ben Noordhuis
92a19a19dd unix: ensure done_cb gets called after uv_cancel()
Wake up the event loop with uv_async_send() when a request is cancelled.
Ensures the done_cb is run on the next tick of the event loop.

Not sending a wakeup signal results in the done_cb not getting called until
another request completes, which may be a long time coming when it's the only
request in the queue or when other requests are executing long-running jobs.

Fixes #669.
2012-12-28 18:09:39 +01:00
Ben Noordhuis
92fb84b751 unix: rework uv_cancel() api
Bert Belder informs me the current approach where a request is immediately
cancelled, is impossible to implement on Windows.

Rework the API to always invoke the "done" callback with an UV_ECANCELED error
code.
2012-12-13 13:46:38 +01:00
Ben Noordhuis
52c8a8617d unix: add uv_cancel() 2012-12-09 15:12:42 +01:00