profile
viewpoint
Santiago Gimeno santigimeno IonIDE Telematics S.L. Madrid, Spain https://linkedin.com/in/santiago-gimeno-30002b2 Lead developer @ https://ionide.es/

node-schedule/node-schedule 7011

A cron-like and not-cron-like job scheduler for Node.

bnoordhuis/node-unix-dgram 60

unix datagram support for node.js

santigimeno/node-ioctl 25

node ioctl wrapper

santigimeno/node-ewmh 10

Implementation of the Extended Window Manager Hints (EWMH)

santigimeno/CCID 1

CCID driver

santigimeno/addon-sdk 0

The Add-on SDK repository.

santigimeno/browser-launcher 0

detect and launch browser versions, headlessly or otherwise

santigimeno/build 0

Better build and test infra for Node.

santigimeno/chokidar 0

A neat wrapper around node.js fs.watch / fs.watchFile.

issue commentlibuv/libuv

unix,fs: returning error on partial writes

uv_fs_write shouldn't return until the content is fully written, or there's a repeatable error

Sorry, I'm not sure I follow. That's the behaviour I'm observing with ENOSPC.

santigimeno

comment created time in 14 hours

issue commentlibuv/libuv

unix,fs: returning error on partial writes

If you look at the referenced example, calling uv_fs_write() with a size larger than the underlying disk space, results in 2 consecutive write() syscalls. A successful with with the partial write and a second one returning the ENOSPC error. If this ENOSPC error could be somehow returned, the consumer could avoid having to call uv_fs_write() again to retrieve the specific error. Does it make sense?

santigimeno

comment created time in 17 hours

issue commentnodejs/node

fs.createWriteSteam doesn't report ENOSPC on a single write

Generally, node streams as an abstraction expose error states by emitting an error event. It could be helpful if an incomplete fs write was exposed as a regular stream error like an ENOSPC would.

The problem with this approach, is that there can be partial writes for other reasons. For example, reaching the RLIMIT_FSIZE resource limit would result in an EFBIG error.

Anyway, I'm opening https://github.com/libuv/libuv/issues/2699 to see if this scenario can be improved.

noffle

comment created time in 18 hours

issue openedlibuv/libuv

unix,fs: returning error on partial writes

At the moment, uv_fs_write() returns success (as it should) when partial writes happen, but it'd be nice being able to also propagate the possible error returned by the write() syscall in some scenarios such as with ENOSPC so we can avoid an extra write() by the library consumer. Also, not breaking the ABI would be a plus. Wdyt?

Refs: https://github.com/nodejs/node/issues/31908

created time in 18 hours

issue commentnodejs/node

fs.createWriteSteam doesn't report ENOSPC on a single write

Yeah, as long as some data is successfully written, no error is going to be returned. You can check the bytesWritten property of the stream to check for this case.

noffle

comment created time in 4 days

pull request commentlibuv/libuv

build: remove support for gyp

Yes, the windows-cmake is ok. I'd like to have, at least, the macos fixed first, being a Tier1 platform.

bnoordhuis

comment created time in 7 days

pull request commentlibuv/libuv

build: remove support for gyp

Maybe @richardlau can shed some light ^^

bnoordhuis

comment created time in 7 days

pull request commentlibuv/libuv

build: remove support for gyp

Also, macos looks red, though autotools could be used. So it seems the bots need to have cmake installed and the jenkins build scripts updated accordingly. I can try to look into the needed changes in ansible to add cmake, but I don't know where the jenkins build scripts are located in the nodejs/build repo.

bnoordhuis

comment created time in 7 days

startedmpenick/uvtls

started time in 7 days

startedcrquan/coremem

started time in 7 days

pull request commentlibuv/libuv

fix: Do not stop the poll watcher twice

Refs: https://github.com/libuv/libuv/issues/1172#issuecomment-267951458

bwoebi

comment created time in 8 days

issue commentlibuv/help

unix: uv_stream_t question

Understood. Thanks for the answers.

santigimeno

comment created time in 8 days

issue closedlibuv/help

unix: uv_stream_t question

Looking at this part of the code:

https://github.com/libuv/libuv/blob/7b28d36056d947e74e2c3347ee9bb04a1f5388c6/src/unix/stream.c#L1177-L1183

I was wondering in what scenario was necessary calling to uv__io_start(.....,POLLIN) while the UV_HANDLE_READING flag was alredy set.

closed time in 8 days

santigimeno

issue commentlibuv/help

unix: uv_stream_t question

Kind of. I was wondering if POLLERR is received, would the following read() call always return error? and only if that's the case make that short read. But I guess that's not the case as POLLIN and POLLERR can both be received, right?

santigimeno

comment created time in 9 days

issue commentlibuv/help

unix: uv_stream_t question

Got it!

One final kind-of related question: let's say a POLLERR event is received on a handle set for reading. Would the error be reported on the first call to read()? If that's the case, could it be possible to make some optimization in uv__read() to avoid buffer allocation calls?

Thanks again!

santigimeno

comment created time in 9 days

issue commentlibuv/help

unix: uv_stream_t question

I get it, but I'm failing to see how in that case the UV_HANDLE_READING flag would be set :man_shrugging: . Thanks!

santigimeno

comment created time in 10 days

issue openedlibuv/help

unix: uv_stream_t question

Looking at this part of the code:

https://github.com/libuv/libuv/blob/7b28d36056d947e74e2c3347ee9bb04a1f5388c6/src/unix/stream.c#L1177-L1183

I was wondering in what scenario was necessary calling to uv__io_start(.....,POLLIN) while the UV_HANDLE_READING flag was alredy set.

created time in 11 days

Pull request review commentnodejs/node

src: create a getter for kernel version

 static void GetOSType(const FunctionCallbackInfo<Value>& args) {     return args.GetReturnValue().SetUndefined();   } -  args.GetReturnValue().Set(-      String::NewFromUtf8(env->isolate(), info.sysname, NewStringType::kNormal)-          .ToLocalChecked());+  Local<Value> version_str = String::NewFromUtf8(env->isolate(),+                              info.version,+                              v8::NewStringType::kNormal).ToLocalChecked();++  Local<Value> release_str = String::NewFromUtf8(env->isolate(),+                              info.release,+                              v8::NewStringType::kNormal).ToLocalChecked();++  Local<Value> sysname_str = String::NewFromUtf8(env->isolate(),+                              info.sysname,+                              v8::NewStringType::kNormal).ToLocalChecked();++  Local<Object> obj = Object::New(env->isolate());+  obj->Set(context,+           String::NewFromUtf8(env->isolate(),+                               "type",+                               NewStringType::kNormal).ToLocalChecked(),+                               sysname_str)+           .FromJust();+  obj->Set(context,+           String::NewFromUtf8(env->isolate(),+                               "version",+                               NewStringType::kNormal).ToLocalChecked(),+                               version_str)+           .FromJust();+  obj->Set(context,+           String::NewFromUtf8(env->isolate(),+                               "release",+                               NewStringType::kNormal).ToLocalChecked(),+                               release_str)+           .FromJust();

E.g. the following would current crash the process:

Are these kind of crashes something to be avoided? It can be reproduced with some other properties:

node -e 'Object.defineProperty(Object.prototype, "name", { set() { throw new Error(); } });require("dns").resolveSrv("_jabber._tcp.google.com", () => {});'
juanarbol

comment created time in 13 days

Pull request review commentnodejs/node

crypto: optimize sign.update() and verify.update()

 bool Hash::HashUpdate(const char* data, int len) {   void Hash::HashUpdate(const FunctionCallbackInfo<Value>& args) {-  Environment* env = Environment::GetCurrent(args);--  Hash* hash;-  ASSIGN_OR_RETURN_UNWRAP(&hash, args.Holder());--  // Only copy the data if we have to, because it's a string-  bool r = true;-  if (args[0]->IsString()) {-    StringBytes::InlineDecoder decoder;-    enum encoding enc = ParseEncoding(env->isolate(), args[1], UTF8);--    if (decoder.Decode(env, args[0].As<String>(), enc).IsNothing()) {-      args.GetReturnValue().Set(false);-      return;-    }-    r = hash->HashUpdate(decoder.out(), decoder.size());-  } else if (args[0]->IsArrayBufferView()) {-    ArrayBufferViewContents<char> buf(args[0].As<ArrayBufferView>());-    r = hash->HashUpdate(buf.data(), buf.length());-  }--  args.GetReturnValue().Set(r);+  Decode<Hash>(args, [](Hash* hash, const FunctionCallbackInfo<Value>& args,+                        const char* data, size_t size) {+    bool r = hash->HashUpdate(data, size);+    args.GetReturnValue().Set(r);+  });

Thanks for clarifying. I'm fine either way.

bnoordhuis

comment created time in 13 days

Pull request review commentnodejs/node

crypto: optimize sign.update() and verify.update()

 bool Hash::HashUpdate(const char* data, int len) {   void Hash::HashUpdate(const FunctionCallbackInfo<Value>& args) {-  Environment* env = Environment::GetCurrent(args);--  Hash* hash;-  ASSIGN_OR_RETURN_UNWRAP(&hash, args.Holder());--  // Only copy the data if we have to, because it's a string-  bool r = true;-  if (args[0]->IsString()) {-    StringBytes::InlineDecoder decoder;-    enum encoding enc = ParseEncoding(env->isolate(), args[1], UTF8);--    if (decoder.Decode(env, args[0].As<String>(), enc).IsNothing()) {-      args.GetReturnValue().Set(false);-      return;-    }-    r = hash->HashUpdate(decoder.out(), decoder.size());-  } else if (args[0]->IsArrayBufferView()) {-    ArrayBufferViewContents<char> buf(args[0].As<ArrayBufferView>());-    r = hash->HashUpdate(buf.data(), buf.length());-  }--  args.GetReturnValue().Set(r);+  Decode<Hash>(args, [](Hash* hash, const FunctionCallbackInfo<Value>& args,+                        const char* data, size_t size) {+    bool r = hash->HashUpdate(data, size);+    args.GetReturnValue().Set(r);+  });

Not sure I'm understanding this correctly but, shouldn't this function return false in case the Decode() callback is never called?

bnoordhuis

comment created time in 13 days

Pull request review commentlibuv/libuv

build: remove support for gyp

 Prerequisites:   [Git for Windows][] includes Git Bash   and tools which can be included in the global `PATH`. -To build, launch a git shell (e.g. Cmd or PowerShell), run `vcbuild.bat`-(to build with VS2017 you need to explicitly add a `vs2017` argument),-which will checkout the GYP code into `build/gyp`, generate `uv.sln`-as well as the necesery related project files, and start building.--```console-> vcbuild-```--Or:--```console-> vcbuild vs2017-```--To run the tests:--```console-> vcbuild test-```--To see all the options that could passed to `vcbuild`:--```console-> vcbuild help-vcbuild.bat [debug/release] [test/bench] [clean] [noprojgen] [nobuild] [vs2017] [x86/x64] [static/shared]-Examples:-  vcbuild.bat              : builds debug build-  vcbuild.bat test         : builds debug build and runs tests-  vcbuild.bat release bench: builds release build and runs benchmarks-```-+</details> -### Unix--For Debug builds (recommended) run:+To build with autotools:  ```bash-$ ./gyp_uv.py -f make-$ make -C out+$ sh autogen.sh+$ ./configure+$ make+$ make check+$ make install ``` -For Release builds run:+To build with [CMake][]:  ```bash-$ ./gyp_uv.py -f make-$ BUILDTYPE=Release make -C out-```--Run `./gyp_uv.py -f make -Dtarget_arch=x32` to build [x32][] binaries.--### OS X+$ cmake -B build -DBUILD_TESTING=ON   # generate project with test+$ cmake --build build -j 8            # build (8 parallel jobs)

This is the first time I'm trying to build the project with cmake but following the instructions is not working for me. It returns this error:

$ cmake -B build -DBUILD_TESTING=ON
CMake Error: The source directory "/home/sgimeno/software/libuv/build" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.

The current cmake build instructions seem to work correctly though.

bnoordhuis

comment created time in 15 days

Pull request review commentlibuv/libuv

test: add UV_TIMEOUT_MULTIPLIER environment var

 $ make -C out $ ./out/Debug/run-tests ``` +Some tests are timing sensitive. Relaxing test timeouts may be necessary+on slow or overloaded machines:++```bash+$ env UV_TIMEOUT_MULTIPLIER=2 ./out/Debug/run-tests  # 10s instead of 5s

One tiny suggestion: what about naming it UV_TEST_TIMEOUT_MULTIPLIER so it's clear it's only for testing purposes? I'm fine either way though.

bnoordhuis

comment created time in 17 days

pull request commentlibuv/libuv

Add recvmmsg and sendmmsg support

It should be merged shortly. Being not a trivial change we usually wait a little for other collaborators to chime in.

oerdnj

comment created time in 18 days

pull request commentlibuv/libuv

unix: make uv_tcp_keepalive predictable

Landed in https://github.com/libuv/libuv/commit/21aff3b4c430e73da8364ddfcec87746689988b4. Thanks!

Tarnyko

comment created time in 19 days

PR closed libuv/libuv

unix: make uv_tcp_keepalive predictable

Current UNIX systems define various defaults for TCP_KEEPINTVL and TCP_KEEPCNT, which makes the time between TCP_KEEPIDLE delay is reached and timeout effectively occurs unpredictable (Linux: /proc/sys /net/ipv4/tcp_keepalive_intvl;tcp_keepalive_probes).

Do the following: set TCP_KEEPINTVL to 1 second (same as Win32 default) and TCP_KEEPCNT to 10 times (same as Win32 hardcoded value).

+15 -2

4 comments

2 changed files

Tarnyko

pr closed time in 19 days

push eventlibuv/libuv

Manuel BACHMANN

commit sha 21aff3b4c430e73da8364ddfcec87746689988b4

unix: make uv_tcp_keepalive predictable Current UNIX systems define various defaults for TCP_KEEPINTVL and TCP_KEEPCNT, which makes the time between TCP_KEEPIDLE delay is reached and timeout effectively occurs unpredictable (Linux: /proc/sys /net/ipv4/tcp_keepalive_intvl;tcp_keepalive_probes). Do the following: set TCP_KEEPINTVL to 1 second (same as Win32 default) and TCP_KEEPCNT to 10 times (same as Win32 hardcoded value). Fixes: https://github.com/libuv/libuv/issues/2664 PR-URL: https://github.com/libuv/libuv/pull/2669 Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

view details

push time in 19 days

PR closed libuv/libuv

Strip icc profile from 2 jpg files

The embedded color profiles are proprietary data. Considering that embedding a color profile in a image is not necessary when color accuracy is not important, it's better to strip them.

This was done with:

convert -strip docs/src/static/diagrams.key/Data/st0-311.jpg docs/src/static/diagrams.key/Data/st0-311.jpg
convert -strip docs/src/static/diagrams.key/Data/st1-475.jpg docs/src/static/diagrams.key/Data/st1-475.jpg

convert command comes from ImageMagick project.

Fix: #2670

+0 -0

2 comments

2 changed files

dod38fr

pr closed time in 19 days

pull request commentlibuv/libuv

Strip icc profile from 2 jpg files

Landed in https://github.com/libuv/libuv/commit/fb5a35ee915921a8baf26e02c12ab05853f1b9af. Thanks!

dod38fr

comment created time in 19 days

push eventlibuv/libuv

Dominique Dumont

commit sha fb5a35ee915921a8baf26e02c12ab05853f1b9af

doc: strip ICC profile from 2 jpg files The embedded color profiles are proprietary data. Considering that embedding a color profile in a image is not necessary when color accuracy is not important, it's better to strip them. This was done with: convert -strip docs/src/static/diagrams.key/Data/st0-311.jpg \ docs/src/static/diagrams.key/Data/st0-311.jpg convert -strip docs/src/static/diagrams.key/Data/st1-475.jpg \ docs/src/static/diagrams.key/Data/st1-475.jpg convert command comes from ImageMagick project. Fixes: https://github.com/libuv/libuv/issues/2670 PR-URL: https://github.com/libuv/libuv/pull/2672 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

view details

push time in 19 days

issue closedlibuv/libuv

2 jpg images contain propriatry ICC profiles

  • Version: 1.34.2
  • Platform: all

Hello

While reviewing copyright information to package new version for Debian, I've noticed that 2 files contain proprietary ICC profile information:

$ for i in $(find . -name *.jpg); do echo $i; exiftool $i | grep Profile; done
./docs/src/static/diagrams.key/preview-web.jpg
./docs/src/static/diagrams.key/Data/st0-311.jpg
Profile CMM Type                : Linotronic
Profile Version                 : 2.1.0
Profile Class                   : Display Device Profile
Profile Connection Space        : XYZ
Profile Date Time               : 1998:02:09 06:49:00
Profile File Signature          : acsp
Profile Creator                 : Hewlett-Packard
Profile ID                      : 0
Profile Copyright               : Copyright (c) 1998 Hewlett-Packard Company
Profile Description             : sRGB IEC61966-2.1
./docs/src/static/diagrams.key/Data/st1-475.jpg
Profile CMM Type                : Linotronic
Profile Version                 : 2.1.0
Profile Class                   : Display Device Profile
Profile Connection Space        : XYZ
Profile Date Time               : 1998:02:09 06:49:00
Profile File Signature          : acsp
Profile Creator                 : Hewlett-Packard
Profile ID                      : 0
Profile Copyright               : Copyright (c) 1998 Hewlett-Packard Company
Profile Description             : sRGB IEC61966-2.1
./docs/src/static/diagrams.key/preview.jpg
./docs/src/static/diagrams.key/preview-micro.jpg

According to this, embedding a color profile in a image is not necessary when color accuracy is not important.

I'd suggest to strip the profile from these image with convert -strip from imagemagick:

convert -strip docs/src/static/diagrams.key/Data/st0-311.jpg docs/src/static/diagrams.key/Data/st0-311.jpg
convert -strip docs/src/static/diagrams.key/Data/st1-475.jpg docs/src/static/diagrams.key/Data/st1-475.jpg

This would get libuv1 rid of some proprietary data.

All the best

closed time in 19 days

dod38fr

pull request commentlibuv/libuv

unix: make uv_tcp_keepalive predictable

CI: https://ci.nodejs.org/view/libuv/job/libuv-test-commit/1753/

Tarnyko

comment created time in 19 days

issue closedlibuv/libuv

Building libuv in nixpkgs on darwin fails during tests

More details in: https://github.com/NixOS/nixpkgs/issues/79331

  • Version: 1.34.1, 1.34.2 and master (https://github.com/libuv/libuv/commit/24d73d065ff3ae43f63db87901dcea64cc504527).
  • Platform:
uname -a
Darwin bassbox 18.7.0 Darwin Kernel Version 18.7.0: Sat Oct 12 00:02:19 PDT 2019; root:xnu-4903.278.12~1/RELEASE_X86_64 x86_64 i386 MacBookPro15,1 Darwin

closed time in 19 days

basvandijk

issue commentlibuv/libuv

Building libuv in nixpkgs on darwin fails during tests

I guess this can be closed now. @basvandijk feel free to re-open if that's not the case

basvandijk

comment created time in 19 days

issue commentlibuv/libuv

Building libuv in nixpkgs on darwin fails during tests

@basvandijk I've noticed that commit was already published in 1.34.2. Was that version already failing for you?

basvandijk

comment created time in 20 days

issue commentlibuv/libuv

Building libuv in nixpkgs on darwin fails during tests

If you run it with current master it should have that fix in.

I meant current v1.x

basvandijk

comment created time in 20 days

issue commentlibuv/libuv

Building libuv in nixpkgs on darwin fails during tests

Do you folks also notice this much flakiness when running the test suite in your CI?

Not really, it's mostly green.

not ok 42 - fs_event_error_reporting
# timeout
# Output from process `fs_event_error_reporting`: (no output)

This one has been fixed recently. If you run it with current master it should have that fix in.

not ok 111 - hrtime
# timeout
# Output from process `hrtime`: (no output)

This one has been flaky in the past and if IIRC it's very much time dependent so on certain conditions it might fail.

basvandijk

comment created time in 20 days

issue commentlibuv/libuv

Building libuv in nixpkgs on darwin fails during tests

I'm not sure why it mentioned that only 1 test failed because I see multiple "not ok"s.

Yeah, that's quirk of the test suite. Whether 1 or multiple tests fail it always returns that.

Isn't it possible for you to give those permissions permanently to the run-tests executable to avoid these issues?

basvandijk

comment created time in 20 days

issue commentlibuv/libuv

Building libuv in nixpkgs on darwin fails during tests

not ok 279 - udp_multicast_join

timeout

Output from process udp_multicast_join: (no output)

This one is usually a firewall issue.

basvandijk

comment created time in 20 days

issue commentlibuv/libuv

Building libuv in nixpkgs on darwin fails during tests

Not sure what happened, it might be a permissions issue with TEST_PIPENAME path.

However, I don't see its output when building the package:

Yes, this is expected. The output is only printed if the test fails.

basvandijk

comment created time in 20 days

issue commentlibuv/libuv

Building libuv in nixpkgs on darwin fails during tests

Adding the output of the error:

not ok 294 - udp_send_unix
# exit code 6
# Output from process `udp_send_unix`:
# Assertion failed in test/test-udp-open.c on line 325: 0 == bind(fd, (const struct sockaddr*)&addr, sizeof addr)

@basvandijk can you modify the test to print the return value of the bind() call?

basvandijk

comment created time in 20 days

startedcjihrig/versionly

started time in 21 days

Pull request review commentlibuv/libuv

Add recvmmsg and sendmmsg support

+/* Copyright libuv project contributors. All rights reserved.+ *+ * Permission is hereby granted, free of charge, to any person obtaining a copy+ * of this software and associated documentation files (the "Software"), to+ * deal in the Software without restriction, including without limitation the+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or+ * sell copies of the Software, and to permit persons to whom the Software is+ * furnished to do so, subject to the following conditions:+ *+ * The above copyright notice and this permission notice shall be included in+ * all copies or substantial portions of the Software.+ *+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS+ * IN THE SOFTWARE.+ */++#include "uv.h"+#include "task.h"++#include <stdlib.h>+#include <stdio.h>++/* Run the benchmark for this many ms */+#define TIME 5000++typedef struct {+  int pongs;+  int state;+  uv_udp_t udp;+  struct sockaddr_in server_addr;+} pinger_t;++typedef struct buf_s {+  uv_buf_t uv_buf_t;+  struct buf_s* next;+} buf_t;++static char PING[] = "PING\n";++static uv_loop_t* loop;++static int completed_pingers = 0;+static unsigned long completed_pings = 0;+static int64_t start_time;+++static void buf_alloc(uv_handle_t* tcp, size_t size, uv_buf_t* buf) {+  static char slab[64 * 1024];+  buf->base = slab;+  buf->len = sizeof(slab);+}+++static void buf_free(const uv_buf_t* buf) {+}+++static void pinger_close_cb(uv_handle_t* handle) {+  pinger_t* pinger;++  pinger = (pinger_t*)handle->data;+#if DEBUG+  fprintf(stderr, "ping_pongs: %d roundtrips/s\n", pinger->pongs / (TIME / 1000));+#endif++  completed_pings += pinger->pongs;+  completed_pingers++;+  free(pinger);+}++static void pinger_write_ping(pinger_t* pinger) {+  uv_buf_t buf;+  int r;++  buf = uv_buf_init(PING, sizeof(PING) - 1);+  r = uv_udp_try_send(&pinger->udp, &buf, 1,+		      (const struct sockaddr*) &pinger->server_addr);+  if (r < 0) {+    FATAL("uv_udp_send failed");+  }+}++static void pinger_read_cb(uv_udp_t* udp,+                           ssize_t nread,+                           const uv_buf_t* buf,+                           const struct sockaddr* addr,+                           unsigned flags) {+  ssize_t i;+  pinger_t* pinger;+  pinger = (pinger_t*)udp->data;++  /* Now we count the pings */+  for (i = 0; i < nread; i++) {+    ASSERT(buf->base[i] == PING[pinger->state]);+    pinger->state = (pinger->state + 1) % (sizeof(PING) - 1);+    if (pinger->state == 0) {+      pinger->pongs++;+      if (uv_now(loop) - start_time > TIME) {+        uv_close((uv_handle_t*)udp, pinger_close_cb);+        break;+      } else {+        pinger_write_ping(pinger);+      }

Style: this else might be removed

oerdnj

comment created time in 21 days

Pull request review commentlibuv/libuv

Add recvmmsg and sendmmsg support

+/* Copyright libuv project contributors. All rights reserved.+ *+ * Permission is hereby granted, free of charge, to any person obtaining a copy+ * of this software and associated documentation files (the "Software"), to+ * deal in the Software without restriction, including without limitation the+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or+ * sell copies of the Software, and to permit persons to whom the Software is+ * furnished to do so, subject to the following conditions:+ *+ * The above copyright notice and this permission notice shall be included in+ * all copies or substantial portions of the Software.+ *+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS+ * IN THE SOFTWARE.+ */++#include "uv.h"+#include "task.h"++#include <stdlib.h>+#include <stdio.h>++/* Run the benchmark for this many ms */+#define TIME 5000++typedef struct {+  int pongs;+  int state;+  uv_udp_t udp;+  struct sockaddr_in server_addr;+} pinger_t;++typedef struct buf_s {+  uv_buf_t uv_buf_t;+  struct buf_s* next;+} buf_t;++static char PING[] = "PING\n";++static uv_loop_t* loop;++static buf_t* buf_freelist = NULL;+static int completed_pingers = 0;+static unsigned long completed_pings = 0;+static int64_t start_time;+++static void buf_alloc(uv_handle_t* tcp, size_t size, uv_buf_t* buf) {+  buf_t* ab;++  ab = buf_freelist;+  if (ab != NULL)+    buf_freelist = ab->next;+  else {+    ab = malloc(size + sizeof(*ab));+    ab->uv_buf_t.len = size;+    ab->uv_buf_t.base = (char*) (ab + 1);+  }++  *buf = ab->uv_buf_t;+}+++static void buf_free(const uv_buf_t* buf) {+  buf_t* ab = (buf_t*) buf->base - 1;+  ab->next = buf_freelist;+  buf_freelist = ab;+}+++static void pinger_close_cb(uv_handle_t* handle) {+  pinger_t* pinger;++  pinger = (pinger_t*)handle->data;+#if DEBUG+  fprintf(stderr, "ping_pongs: %d roundtrips/s\n", pinger->pongs / (TIME / 1000));+#endif++  completed_pings += pinger->pongs;+  completed_pingers++;+  free(pinger);+}++static void pinger_write_ping(pinger_t* pinger) {+  uv_buf_t buf;+  int r;++  buf = uv_buf_init(PING, sizeof(PING) - 1);+  r = uv_udp_try_send(&pinger->udp, &buf, 1,+		      (const struct sockaddr*) &pinger->server_addr);+  if (r < 0) {+    FATAL("uv_udp_send failed");+  }++}++static void pinger_read_cb(uv_udp_t* udp,+                           ssize_t nread,+                           const uv_buf_t* buf,+                           const struct sockaddr* addr,+                           unsigned flags) {+  ssize_t i;+  pinger_t* pinger;+  pinger = (pinger_t*)udp->data;++  /* Now we count the pings */+  for (i = 0; i < nread; i++) {+    ASSERT(buf->base[i] == PING[pinger->state]);+    pinger->state = (pinger->state + 1) % (sizeof(PING) - 1);+    if (pinger->state == 0) {+      pinger->pongs++;+      if (uv_now(loop) - start_time > TIME) {+        uv_close((uv_handle_t*)udp, pinger_close_cb);+        break;+      } else {+        pinger_write_ping(pinger);+      }+    }+  }++  buf_free(buf);+}++static void udp_pinger_new(void) {+  pinger_t* pinger = malloc(sizeof(*pinger));+  int r;++  ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &pinger->server_addr));+  pinger->state = 0;+  pinger->pongs = 0;++  /* Try to do NUM_PINGS ping-pongs (connection-less). */+  r = uv_udp_init(loop, &pinger->udp);+  ASSERT(r == 0);++  pinger->udp.data = pinger;++  /* Start pinging */+  if (0 != uv_udp_recv_start(&pinger->udp, buf_alloc, pinger_read_cb)) {+    FATAL("uv_udp_read_start failed");+  }+  pinger_write_ping(pinger);+}++static int ping_udp(unsigned pingers) {+  loop = uv_default_loop();+  start_time = uv_now(loop);++  unsigned i;+  for (i = 0; i < pingers; ++i) {+    udp_pinger_new();+  }+  uv_run(loop, UV_RUN_DEFAULT);+  ASSERT(completed_pingers >= 1);++  fprintf(stderr, "ping_pongs: %d pingers, ~ %lu roundtrips/s\n",+	  completed_pingers, completed_pings / (TIME/1000));

Style nit: align arguments

oerdnj

comment created time in 21 days

Pull request review commentlibuv/libuv

Add recvmmsg and sendmmsg support

 int uv__getsockpeername(const uv_handle_t* handle,                         struct sockaddr* name,                         int* namelen); +#if defined(__linux__)            ||                                      \+    defined(__FreeBSD__)          ||                                      \+    defined(__FreeBSD_kernel__)+#define HAVE_MMSG 1+struct uv__mmsghdr {+  struct msghdr msg_hdr;+  unsigned int msg_len;+};

I'm getting a compilation error on linux as uv__mmsghdr is already defined in https://github.com/libuv/libuv/blob/v1.x/src/unix/linux-syscalls.h#L64-L67

oerdnj

comment created time in 21 days

Pull request review commentlibuv/libuv

Add recvmmsg and sendmmsg support

+/* Copyright libuv project contributors. All rights reserved.

This benchmark should be added to test/test.gyp file and the benchmarks to benchmark-list.h.

oerdnj

comment created time in 21 days

Pull request review commentlibuv/libuv

Add recvmmsg and sendmmsg support

 static void uv__udp_recvmsg(uv_udp_t* handle) {       && handle->recv_cb != NULL); } +static void uv__udp_sendmmsg(uv_udp_t* handle) {+  uv_udp_send_t* req;+  struct uv__mmsghdr h[MMSG_MAXWIDTH];+  QUEUE* q;+  ssize_t npkts;+  int i;++  if (QUEUE_EMPTY(&handle->write_queue)) {+    return;+  }++write_queue_drain:+  for (i = 0, q = QUEUE_HEAD(&handle->write_queue);+       i < MMSG_MAXWIDTH && q != &handle->write_queue;+       ++i, q = QUEUE_HEAD(q)) {+    assert(q != NULL);+    req = QUEUE_DATA(q, uv_udp_send_t, queue);+    assert(req != NULL);++    memset(&h[i], 0, sizeof(h[i]));+    h[i].msg_hdr.msg_name = &req->addr;+    h[i].msg_hdr.msg_namelen = (req->addr.ss_family == AF_INET6 ?+      sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in));+    h[i].msg_hdr.msg_iov = (struct iovec*) req->bufs;+    h[i].msg_hdr.msg_iovlen = req->nbufs;+  }++  do {+    npkts = uv__sendmmsg(handle->io_watcher.fd, h, i, 0);+  } while (npkts == -1 && errno == EINTR);++  if (npkts < 1) {+    if (errno == EAGAIN || errno == EWOULDBLOCK || errno == ENOBUFS)+      return;+    else {

Style: maybe remove the else statement as we're returning in the if section

oerdnj

comment created time in 4 months

Pull request review commentlibuv/libuv

Add recvmmsg and sendmmsg support

 static void on_server_close(uv_handle_t* handle) {   ASSERT(handle == server); } +static uv_udp_send_t* send_alloc(void) {+  uv_udp_send_t* req = send_freelist;+  if (req != NULL)+    send_freelist = req->data;+  else {+    req = malloc(sizeof(*req));+  }

Style nit: remove braces

oerdnj

comment created time in 21 days

Pull request review commentlibuv/libuv

Add recvmmsg and sendmmsg support

 static void uv__udp_recvmsg(uv_udp_t* handle) {    do {     buf = uv_buf_init(NULL, 0);-    handle->alloc_cb((uv_handle_t*) handle, 64 * 1024, &buf);+    handle->alloc_cb((uv_handle_t*) handle, UV__UDP_DGRAM_MAXSIZE, &buf);     if (buf.base == NULL || buf.len == 0) {       handle->recv_cb(handle, UV_ENOBUFS, &buf, NULL, 0);       return;     }     assert(buf.base != NULL); +#if HAVE_MMSG+    uv_once(&once, uv__udp_mmsg_init);+    if (uv__recvmmsg_avail) {+      /* Returned space for more than 1 datagram, use it to receive+       * multiple datagrams. */+      if (buf.len >= 2 * UV__UDP_DGRAM_MAXSIZE) {+        nread = uv__udp_recvmmsg(handle, &buf);+        if (nread > 0) {+          count -= nread;+        }+        continue;+      }+    }+#endif

I think it might be a good idea to document when recvmmsg is preferred over recvmsg, and add it to the commit message as well.

oerdnj

comment created time in 21 days

Pull request review commentlibuv/libuv

Add recvmmsg and sendmmsg support

 static int uv__udp_maybe_deferred_bind(uv_udp_t* handle,                                        int domain,                                        unsigned int flags); +#if HAVE_MMSG++#define UV__MMSG_MAXWIDTH 20++static int uv__udp_recvmmsg(uv_udp_t* handle, uv_buf_t* buf);+static void uv__udp_sendmmsg(uv_udp_t* handle);++static int uv__recvmmsg_avail = 0;+static int uv__sendmmsg_avail = 0;+static uv_once_t once = UV_ONCE_INIT;++static void uv__udp_mmsg_init(void) {+  int ret;+  int s;+  s = uv__socket(AF_INET, SOCK_DGRAM, 0);+  if (s < 0) {+    return;+  }

style: these braces can be removed

oerdnj

comment created time in 21 days

Pull request review commentlibuv/libuv

Add recvmmsg and sendmmsg support

+/* Copyright libuv project contributors. All rights reserved.+ *+ * Permission is hereby granted, free of charge, to any person obtaining a copy+ * of this software and associated documentation files (the "Software"), to+ * deal in the Software without restriction, including without limitation the+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or+ * sell copies of the Software, and to permit persons to whom the Software is+ * furnished to do so, subject to the following conditions:+ *+ * The above copyright notice and this permission notice shall be included in+ * all copies or substantial portions of the Software.+ *+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS+ * IN THE SOFTWARE.+ */++#include "uv.h"+#include "task.h"++#include <stdlib.h>+#include <stdio.h>++/* Run the benchmark for this many ms */+#define TIME 5000++typedef struct {+  int pongs;+  int state;+  uv_udp_t udp;+  struct sockaddr_in server_addr;+} pinger_t;++typedef struct buf_s {+  uv_buf_t uv_buf_t;+  struct buf_s* next;+} buf_t;++static char PING[] = "PING\n";++static uv_loop_t* loop;++static int completed_pingers = 0;+static unsigned long completed_pings = 0;+static int64_t start_time;+++static void buf_alloc(uv_handle_t* tcp, size_t size, uv_buf_t* buf) {+  static char slab[64 * 1024];+  buf->base = slab;+  buf->len = sizeof(slab);+}+++static void buf_free(const uv_buf_t* buf) {+}+++static void pinger_close_cb(uv_handle_t* handle) {+  pinger_t* pinger;++  pinger = (pinger_t*)handle->data;+#if DEBUG+  fprintf(stderr, "ping_pongs: %d roundtrips/s\n", pinger->pongs / (TIME / 1000));+#endif++  completed_pings += pinger->pongs;+  completed_pingers++;+  free(pinger);+}++static void pinger_write_ping(pinger_t* pinger) {+  uv_buf_t buf;+  int r;++  buf = uv_buf_init(PING, sizeof(PING) - 1);+  r = uv_udp_try_send(&pinger->udp, &buf, 1,+		      (const struct sockaddr*) &pinger->server_addr);+  if (r < 0) {+    FATAL("uv_udp_send failed");+  }

Style nit: remove braces

oerdnj

comment created time in 21 days

Pull request review commentlibuv/libuv

Add recvmmsg and sendmmsg support

 static void uv__udp_run_completed(uv_udp_t* handle); static void uv__udp_io(uv_loop_t* loop, uv__io_t* w, unsigned int revents); static void uv__udp_recvmsg(uv_udp_t* handle);+static void uv__udp_recvmmsg(uv_udp_t* handle, uv_buf_t* buf); static void uv__udp_sendmsg(uv_udp_t* handle);+static void uv__udp_sendmmsg(uv_udp_t* handle); static int uv__udp_maybe_deferred_bind(uv_udp_t* handle,                                        int domain,                                        unsigned int flags); +static int uv__recvmmsg_avail = 0;+static int uv__sendmmsg_avail = 0;

No need to initialize static variables to zero

oerdnj

comment created time in 4 months

Pull request review commentlibuv/libuv

Add recvmmsg and sendmmsg support

 static void uv__udp_recvmsg(uv_udp_t* handle) {       && handle->recv_cb != NULL); } +static void uv__udp_sendmmsg(uv_udp_t* handle) {+  uv_udp_send_t* req;+  struct uv__mmsghdr h[MMSG_MAXWIDTH];+  QUEUE* q;+  ssize_t npkts;+  int i;++  if (QUEUE_EMPTY(&handle->write_queue)) {+    return;+  }

Style nit: remove brackets

oerdnj

comment created time in 4 months

Pull request review commentlibuv/libuv

Add recvmmsg and sendmmsg support

 static void uv__udp_recvmsg(uv_udp_t* handle) {    do {     buf = uv_buf_init(NULL, 0);-    handle->alloc_cb((uv_handle_t*) handle, 64 * 1024, &buf);+    handle->alloc_cb((uv_handle_t*) handle, UV__UDP_DGRAM_MAXSIZE, &buf);     if (buf.base == NULL || buf.len == 0) {       handle->recv_cb(handle, UV_ENOBUFS, &buf, NULL, 0);       return;     }     assert(buf.base != NULL); +#if HAVE_MMSG+    uv_once(&once, uv__udp_mmsg_init);+    if (uv__recvmmsg_avail) {+      /* Returned space for more than 1 datagram, use it to receive+       * multiple datagrams. */+      if (buf.len >= 2 * UV__UDP_DGRAM_MAXSIZE) {+        nread = uv__udp_recvmmsg(handle, &buf);+        if (nread > 0) {+          count -= nread;+        }

Style nit: remove braces

oerdnj

comment created time in 21 days

Pull request review commentlibuv/libuv

Add recvmmsg and sendmmsg support

+/* Copyright libuv project contributors. All rights reserved.+ *+ * Permission is hereby granted, free of charge, to any person obtaining a copy+ * of this software and associated documentation files (the "Software"), to+ * deal in the Software without restriction, including without limitation the+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or+ * sell copies of the Software, and to permit persons to whom the Software is+ * furnished to do so, subject to the following conditions:+ *+ * The above copyright notice and this permission notice shall be included in+ * all copies or substantial portions of the Software.+ *+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS+ * IN THE SOFTWARE.+ */++#include "uv.h"+#include "task.h"++#include <stdlib.h>+#include <stdio.h>++/* Run the benchmark for this many ms */+#define TIME 5000++typedef struct {+  int pongs;+  int state;+  uv_udp_t udp;+  struct sockaddr_in server_addr;+} pinger_t;++typedef struct buf_s {+  uv_buf_t uv_buf_t;+  struct buf_s* next;+} buf_t;++static char PING[] = "PING\n";++static uv_loop_t* loop;++static int completed_pingers = 0;+static unsigned long completed_pings = 0;

No need to initialize these as they're static.

oerdnj

comment created time in 21 days

Pull request review commentlibuv/libuv

Add recvmmsg and sendmmsg support

 static void uv__udp_io(uv_loop_t* loop, uv__io_t* w, unsigned int revents) {   } } +#if HAVE_MMSG+static int uv__udp_recvmmsg(uv_udp_t* handle, uv_buf_t* buf) {+  struct sockaddr_in6 peers[UV__MMSG_MAXWIDTH];+  struct iovec iov[UV__MMSG_MAXWIDTH];+  struct uv__mmsghdr msgs[UV__MMSG_MAXWIDTH];+  ssize_t nread;+  uv_buf_t chunk_buf;+  int chunks;+  int flags;+  int k;++  /* prepare structures for recvmmsg */+  chunks = buf->len / UV__UDP_DGRAM_MAXSIZE;+  if (chunks > UV__MMSG_MAXWIDTH)+    chunks = UV__MMSG_MAXWIDTH;+  for (k = 0; k < chunks; ++k) {+    iov[k].iov_base = buf->base + k * UV__UDP_DGRAM_MAXSIZE;+    iov[k].iov_len = UV__UDP_DGRAM_MAXSIZE;+    msgs[k].msg_hdr.msg_iov = iov + k;+    msgs[k].msg_hdr.msg_iovlen = 1;+    msgs[k].msg_hdr.msg_name = peers + k;+    msgs[k].msg_hdr.msg_namelen = sizeof(peers[0]);+  }++  do {+    nread = uv__recvmmsg(handle->io_watcher.fd, msgs, chunks, 0, NULL);+  } while (nread == -1 && errno == EINTR);++  if (nread < 1) {+    if (nread == 0 || errno == EAGAIN || errno == EWOULDBLOCK)+      handle->recv_cb(handle, 0, buf, NULL, 0);+    else+      handle->recv_cb(handle, UV__ERR(errno), buf, NULL, 0);+  }+  else {+    /* count to zero, so the buffer base comes last */

style: } else {

oerdnj

comment created time in 21 days

Pull request review commentlibuv/libuv

Add recvmmsg and sendmmsg support

+/* Copyright libuv project contributors. All rights reserved.+ *+ * Permission is hereby granted, free of charge, to any person obtaining a copy+ * of this software and associated documentation files (the "Software"), to+ * deal in the Software without restriction, including without limitation the+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or+ * sell copies of the Software, and to permit persons to whom the Software is+ * furnished to do so, subject to the following conditions:+ *+ * The above copyright notice and this permission notice shall be included in+ * all copies or substantial portions of the Software.+ *+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS+ * IN THE SOFTWARE.+ */++#include "uv.h"+#include "task.h"++#include <stdlib.h>+#include <stdio.h>++/* Run the benchmark for this many ms */+#define TIME 5000++typedef struct {+  int pongs;+  int state;+  uv_udp_t udp;+  struct sockaddr_in server_addr;+} pinger_t;++typedef struct buf_s {+  uv_buf_t uv_buf_t;+  struct buf_s* next;+} buf_t;++static char PING[] = "PING\n";++static uv_loop_t* loop;++static int completed_pingers = 0;+static unsigned long completed_pings = 0;+static int64_t start_time;+++static void buf_alloc(uv_handle_t* tcp, size_t size, uv_buf_t* buf) {+  static char slab[64 * 1024];+  buf->base = slab;+  buf->len = sizeof(slab);+}+++static void buf_free(const uv_buf_t* buf) {+}+++static void pinger_close_cb(uv_handle_t* handle) {+  pinger_t* pinger;++  pinger = (pinger_t*)handle->data;+#if DEBUG+  fprintf(stderr, "ping_pongs: %d roundtrips/s\n", pinger->pongs / (TIME / 1000));+#endif++  completed_pings += pinger->pongs;+  completed_pingers++;+  free(pinger);+}++static void pinger_write_ping(pinger_t* pinger) {+  uv_buf_t buf;+  int r;++  buf = uv_buf_init(PING, sizeof(PING) - 1);+  r = uv_udp_try_send(&pinger->udp, &buf, 1,+		      (const struct sockaddr*) &pinger->server_addr);

Style: align arguments

oerdnj

comment created time in 21 days

Pull request review commentlibuv/libuv

Add recvmmsg and sendmmsg support

 static void uv__udp_recvmsg(uv_udp_t* handle) {       && handle->recv_cb != NULL); } +static void uv__udp_sendmmsg(uv_udp_t* handle) {+  uv_udp_send_t* req;+  struct uv__mmsghdr h[MMSG_MAXWIDTH];+  QUEUE* q;+  ssize_t npkts;+  int i;++  if (QUEUE_EMPTY(&handle->write_queue)) {+    return;+  }++write_queue_drain:+  for (i = 0, q = QUEUE_HEAD(&handle->write_queue);+       i < MMSG_MAXWIDTH && q != &handle->write_queue;+       ++i, q = QUEUE_HEAD(q)) {+    assert(q != NULL);+    req = QUEUE_DATA(q, uv_udp_send_t, queue);+    assert(req != NULL);++    memset(&h[i], 0, sizeof(h[i]));+    h[i].msg_hdr.msg_name = &req->addr;+    h[i].msg_hdr.msg_namelen = (req->addr.ss_family == AF_INET6 ?+      sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in));+    h[i].msg_hdr.msg_iov = (struct iovec*) req->bufs;+    h[i].msg_hdr.msg_iovlen = req->nbufs;+  }++  do {+    npkts = uv__sendmmsg(handle->io_watcher.fd, h, i, 0);+  } while (npkts == -1 && errno == EINTR);

Style nit: remove brackets

oerdnj

comment created time in 4 months

Pull request review commentlibuv/libuv

Add recvmmsg and sendmmsg support

 static void uv__udp_recvmsg(uv_udp_t* handle) {        handle->recv_cb(handle, nread, &buf, (const struct sockaddr*) &peer, flags);     }+    count--;   }   /* recv_cb callback may decide to pause or close the handle */   while (nread != -1-      && count-- > 0+      && count > 0       && handle->io_watcher.fd != -1       && handle->recv_cb != NULL); } +#if HAVE_MMSG+static void uv__udp_sendmmsg(uv_udp_t* handle) {+  uv_udp_send_t* req;+  struct uv__mmsghdr h[UV__MMSG_MAXWIDTH];+  QUEUE* q;+  ssize_t npkts;+  int pkts, i;++  if (QUEUE_EMPTY(&handle->write_queue)) {+    return;+  }++write_queue_drain:+  for (pkts = 0, q = QUEUE_HEAD(&handle->write_queue);+       pkts < UV__MMSG_MAXWIDTH && q != &handle->write_queue;+       ++pkts, q = QUEUE_HEAD(q)) {+    assert(q != NULL);+    req = QUEUE_DATA(q, uv_udp_send_t, queue);+    assert(req != NULL);++    memset(&h[pkts], 0, sizeof(h[pkts]));+    if (req->addr.ss_family == AF_UNSPEC) {+      h[pkts].msg_hdr.msg_name = NULL;+      h[pkts].msg_hdr.msg_namelen = 0;+    } else {+      h[pkts].msg_hdr.msg_name = &req->addr;+      if (req->addr.ss_family == AF_INET6)+        h[pkts].msg_hdr.msg_namelen = sizeof(struct sockaddr_in6);+      else if (req->addr.ss_family == AF_INET)+        h[pkts].msg_hdr.msg_namelen = sizeof(struct sockaddr_in);+      else if (req->addr.ss_family == AF_UNIX)+        h[pkts].msg_hdr.msg_namelen = sizeof(struct sockaddr_un);+      else {+        assert(0 && "unsupported address family");+        abort();+      }+    }+    h[pkts].msg_hdr.msg_iov = (struct iovec*) req->bufs;+    h[pkts].msg_hdr.msg_iovlen = req->nbufs;+  }++  do {+    npkts = uv__sendmmsg(handle->io_watcher.fd, h, pkts, 0);+  } while (npkts == -1 && errno == EINTR);++  if (npkts < 1) {+    if (errno == EAGAIN || errno == EWOULDBLOCK || errno == ENOBUFS)+      return;+    else {+      for (i = 0, q = QUEUE_HEAD(&handle->write_queue);+	   i < pkts && q != &handle->write_queue;+	   ++i, q = QUEUE_HEAD(q)) {

style: align the for params

oerdnj

comment created time in 21 days

Pull request review commentlibuv/libuv

Add recvmmsg and sendmmsg support

 static void uv__udp_recvmsg(uv_udp_t* handle) {        handle->recv_cb(handle, nread, &buf, (const struct sockaddr*) &peer, flags);     }+    count--;   }   /* recv_cb callback may decide to pause or close the handle */   while (nread != -1-      && count-- > 0+      && count > 0       && handle->io_watcher.fd != -1       && handle->recv_cb != NULL); } +#if HAVE_MMSG+static void uv__udp_sendmmsg(uv_udp_t* handle) {+  uv_udp_send_t* req;+  struct uv__mmsghdr h[UV__MMSG_MAXWIDTH];+  QUEUE* q;+  ssize_t npkts;+  int pkts, i;++  if (QUEUE_EMPTY(&handle->write_queue)) {+    return;+  }++write_queue_drain:+  for (pkts = 0, q = QUEUE_HEAD(&handle->write_queue);+       pkts < UV__MMSG_MAXWIDTH && q != &handle->write_queue;+       ++pkts, q = QUEUE_HEAD(q)) {+    assert(q != NULL);+    req = QUEUE_DATA(q, uv_udp_send_t, queue);+    assert(req != NULL);++    memset(&h[pkts], 0, sizeof(h[pkts]));+    if (req->addr.ss_family == AF_UNSPEC) {+      h[pkts].msg_hdr.msg_name = NULL;+      h[pkts].msg_hdr.msg_namelen = 0;+    } else {+      h[pkts].msg_hdr.msg_name = &req->addr;+      if (req->addr.ss_family == AF_INET6)+        h[pkts].msg_hdr.msg_namelen = sizeof(struct sockaddr_in6);+      else if (req->addr.ss_family == AF_INET)+        h[pkts].msg_hdr.msg_namelen = sizeof(struct sockaddr_in);+      else if (req->addr.ss_family == AF_UNIX)+        h[pkts].msg_hdr.msg_namelen = sizeof(struct sockaddr_un);+      else {+        assert(0 && "unsupported address family");+        abort();+      }+    }+    h[pkts].msg_hdr.msg_iov = (struct iovec*) req->bufs;+    h[pkts].msg_hdr.msg_iovlen = req->nbufs;+  }++  do {+    npkts = uv__sendmmsg(handle->io_watcher.fd, h, pkts, 0);+  } while (npkts == -1 && errno == EINTR);++  if (npkts < 1) {+    if (errno == EAGAIN || errno == EWOULDBLOCK || errno == ENOBUFS)+      return;+    else {+      for (i = 0, q = QUEUE_HEAD(&handle->write_queue);+	   i < pkts && q != &handle->write_queue;+	   ++i, q = QUEUE_HEAD(q)) {+        assert(q != NULL);+        req = QUEUE_DATA(q, uv_udp_send_t, queue);+        assert(req != NULL);++        req->status = UV__ERR(errno);+        QUEUE_REMOVE(&req->queue);+        QUEUE_INSERT_TAIL(&handle->write_completed_queue, &req->queue);+      }+    }+    uv__io_feed(handle->loop, &handle->io_watcher);+    return;+  }+  else {+    for (i = 0, q = QUEUE_HEAD(&handle->write_queue);+	 i < pkts && q != &handle->write_queue;+	 ++i, q = QUEUE_HEAD(&handle->write_queue)) {+      assert(q != NULL);+      req = QUEUE_DATA(q, uv_udp_send_t, queue);+      assert(req != NULL);++      req->status = req->bufs[0].len;++      /* Sending a datagram is an atomic operation: either all data+       * is written or nothing is (and EMSGSIZE is raised). That is+       * why we don't handle partial writes. Just pop the request+       * off the write queue and onto the completed queue, done.+       */+      QUEUE_REMOVE(&req->queue);+      QUEUE_INSERT_TAIL(&handle->write_completed_queue, &req->queue);+    }+    /* couldn't batch everything, continue sending (jump to avoid stack growth) */+    if (!QUEUE_EMPTY(&handle->write_queue))+      goto write_queue_drain;+  }

Style: the else statement might be removed as well

oerdnj

comment created time in 21 days

fork santigimeno/v8

The official mirror of the V8 Git repository

https://chromium.googlesource.com/v8/v8.git

fork in a month

PR closed libuv/libuv

fs,macos: fix fs_event_watch_dir_recursive flakiness

This test sometimes times out because not all the expected events are received: the create and delete events may coalesce. To avoid it, make sure not to start deleting the files until all the create events are received.

Also, take into account in the test that a create event of the subdir directory can be detected even though we start watching for the events after its creation.

CI: https://ci.nodejs.org/view/libuv/job/libuv-test-commit/1725/

+9 -1

1 comment

1 changed file

santigimeno

pr closed time in a month

pull request commentlibuv/libuv

fs,macos: fix fs_event_watch_dir_recursive flakiness

Landed in https://github.com/libuv/libuv/commit/1ff84206613e17e4d2242b96e3b6be7288840043.

santigimeno

comment created time in a month

push eventlibuv/libuv

Santiago Gimeno

commit sha 1ff84206613e17e4d2242b96e3b6be7288840043

test: fix fs_event_watch_dir_recursive flakiness This test sometimes times out on `macos` because not all the expected events are received: the create and delete events may coalesce. To avoid it, make sure not to start deleting the files until all the create events are received. Also, take into account in the test that a create event of the `subdir` directory can be detected even though we start watching for the events after its creation. PR-URL: https://github.com/libuv/libuv/pull/2648 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jameson Nash <vtjnash@gmail.com> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

view details

push time in a month

Pull request review commentlibuv/libuv

adds check so we only queue one copy of the async wakeup request

+/* Copyright libuv project contributors. All rights reserved.+ *+ * Permission is hereby granted, free of charge, to any person obtaining a copy+ * of this software and associated documentation files (the "Software"), to+ * deal in the Software without restriction, including without limitation the+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or+ * sell copies of the Software, and to permit persons to whom the Software is+ * furnished to do so, subject to the following conditions:+ *+ * The above copyright notice and this permission notice shall be included in+ * all copies or substantial portions of the Software.+ *+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS+ * IN THE SOFTWARE.+ */++#include "uv.h"+#include "task.h"+#include <stdio.h>+#include <stdlib.h>++static uv_pipe_t pipe_dummy;+static uv_connect_t connect_req;+static uv_prepare_t prepare;++static int async_cb_called;+static int close_cb_called;+++void close_cb(uv_handle_t* handle) {+  close_cb_called++;+}+++void connect_cb(uv_connect_t *req, int status) {+  ASSERT(status == UV_ENOENT);+  uv_close((uv_handle_t*) req->handle, close_cb);+}+++void async_cb(uv_async_t* handle) {+  async_cb_called++;+  uv_close((uv_handle_t*) handle, close_cb);+}+++void prepare_cb(uv_prepare_t* handle) {+  uv_pipe_connect(&connect_req, &pipe_dummy, "nonexistent_file_path", connect_cb);+  uv_close((uv_handle_t*) handle, close_cb);+}+++TEST_IMPL(async_multi) {+  uv_loop_t *loop;+  uv_async_t async1, async2;++  loop = uv_default_loop();++  ASSERT(0 == uv_async_init(loop, &async1, async_cb));+  ASSERT(0 == uv_async_init(loop, &async2, async_cb));++  /* Create a pending notification */+  ASSERT(0 == uv_pipe_init(loop, &pipe_dummy, 0));+  ASSERT(0 == uv_prepare_init(uv_default_loop(), &prepare));

nit: use loop directly

ssfrr

comment created time in a month

Pull request review commentlibuv/libuv

adds check so we only queue one copy of the async wakeup request

+/* Copyright libuv project contributors. All rights reserved.+ *+ * Permission is hereby granted, free of charge, to any person obtaining a copy+ * of this software and associated documentation files (the "Software"), to+ * deal in the Software without restriction, including without limitation the+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or+ * sell copies of the Software, and to permit persons to whom the Software is+ * furnished to do so, subject to the following conditions:+ *+ * The above copyright notice and this permission notice shall be included in+ * all copies or substantial portions of the Software.+ *+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS+ * IN THE SOFTWARE.+ */++#include "uv.h"+#include "task.h"+#include <stdio.h>+#include <stdlib.h>++static uv_pipe_t pipe_dummy;+static uv_connect_t connect_req;+static uv_prepare_t prepare;++static int async_cb_called;+static int close_cb_called;+++void close_cb(uv_handle_t* handle) {+  close_cb_called++;+}+++void connect_cb(uv_connect_t *req, int status) {+  ASSERT(status == UV_ENOENT);+  uv_close((uv_handle_t*) req->handle, close_cb);+}+++void async_cb(uv_async_t* handle) {+  async_cb_called++;+  uv_close((uv_handle_t*) handle, close_cb);+}+++void prepare_cb(uv_prepare_t* handle) {+  uv_pipe_connect(&connect_req, &pipe_dummy, "nonexistent_file_path", connect_cb);+  uv_close((uv_handle_t*) handle, close_cb);+}+++TEST_IMPL(async_multi) {+  uv_loop_t *loop;+  uv_async_t async1, async2;

Shouldn't these be global?

ssfrr

comment created time in a month

Pull request review commentlibuv/libuv

adds check so we only queue one copy of the async wakeup request

+/* Copyright libuv project contributors. All rights reserved.+ *+ * Permission is hereby granted, free of charge, to any person obtaining a copy+ * of this software and associated documentation files (the "Software"), to+ * deal in the Software without restriction, including without limitation the+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or+ * sell copies of the Software, and to permit persons to whom the Software is+ * furnished to do so, subject to the following conditions:+ *+ * The above copyright notice and this permission notice shall be included in+ * all copies or substantial portions of the Software.+ *+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS+ * IN THE SOFTWARE.+ */++#include "uv.h"+#include "task.h"+#include <stdio.h>+#include <stdlib.h>++static uv_pipe_t pipe_dummy;+static uv_connect_t connect_req;+static uv_prepare_t prepare;++static int async_cb_called;+static int close_cb_called;+++void close_cb(uv_handle_t* handle) {+  close_cb_called++;+}+++void connect_cb(uv_connect_t *req, int status) {+  ASSERT(status == UV_ENOENT);+  uv_close((uv_handle_t*) req->handle, close_cb);+}+++void async_cb(uv_async_t* handle) {+  async_cb_called++;+  uv_close((uv_handle_t*) handle, close_cb);+}+++void prepare_cb(uv_prepare_t* handle) {+  uv_pipe_connect(&connect_req, &pipe_dummy, "nonexistent_file_path", connect_cb);+  uv_close((uv_handle_t*) handle, close_cb);+}+++TEST_IMPL(async_multi) {+  uv_loop_t *loop;

style: star to lean left

ssfrr

comment created time in a month

issue commentnodejs/help

Why Node uses syscalls instead libuv's abstractions

Indeed, they're using libuv functions. Take a look at FSReqBase implementation which inherits from ReqWrap.

juanarbol

comment created time in a month

PR closed libuv/libuv

ibmi: ensure that pipe backlog is not zero

On IBMi PASE, listen(pipe_fd, backlog=0) leads to "Connection refused" error.

This patch fixes below 2 failed test cases on IBMi PASE --

not ok 170 - pipe_getsockname
# exit code 393350
# Output from process `pipe_getsockname`:
# Assertion failed in ../test/test-pipe-getsockname.c on line 149: r == 0

not ok 182 - pipe_server_close
# exit code 393350
# Output from process `pipe_server_close`:
# Assertion failed in ../test/test-pipe-server-close.c on line 46: status == 0
+2 -1

1 comment

1 changed file

dmabupt

pr closed time in a month

pull request commentlibuv/libuv

ibmi: ensure that pipe backlog is not zero

Landed in https://github.com/libuv/libuv/commit/1b045d464d5703b97d7fbd5b434454fc60b96915. Thanks!

dmabupt

comment created time in a month

push eventlibuv/libuv

Xu Meng

commit sha 1b045d464d5703b97d7fbd5b434454fc60b96915

ibmi: ensure that pipe backlog is not zero On IBMi PASE, listen(pipe_fd, backlog=0) leads to "Connection refused" error PR-URL: https://github.com/libuv/libuv/pull/2641 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>

view details

push time in a month

pull request commentlibuv/libuv

ibmi: skip unsupported fs test cases

Landed in https://github.com/libuv/libuv/commit/ed1dc8537ebcf78d9f26d8c0b40f330be5939ab4. Thanks!

dmabupt

comment created time in a month

push eventlibuv/libuv

Xu Meng

commit sha ed1dc8537ebcf78d9f26d8c0b40f330be5939ab4

ibmi: skip unsupported fs test cases On IBMi PASE, we need to skip some file permission tests for `root`. And the file stat of symbolic links are different as well. PR-URL: https://github.com/libuv/libuv/pull/2628 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>

view details

push time in a month

push eventsantigimeno/libuv

erw7

commit sha 7ed1eced3145c9eb17f831c2d66cdaa3d440d904

win: fix duplicate tty vt100 fn key Refs: https://github.com/libuv/libuv/pull/2114 Refs: https://github.com/nodejs/node/issues/25875 Refs: https://github.com/nodejs/node/issues/26013 Fixes: https://github.com/libuv/libuv/issues/2168 PR-URL: https://github.com/libuv/libuv/pull/2160 Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>

view details

Ben Noordhuis

commit sha 1ce6393a5780538ad8601cae00c5bd079b9415a9

unix: don't attempt to invalidate invalid fd Add a missing check in uv__io_close() where it called uv__platform_invalidate_fd() without checking that the watcher actually has a valid file descriptor assigned. Fixes: https://github.com/libuv/libuv/issues/2181 PR-URL: https://github.com/libuv/libuv/pull/2182 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>

view details

cjihrig

commit sha 8669d8d3e93cddb62611b267ef62a3ddb5ba3ca0

2019.02.11, Version 1.26.0 (Stable) Changes since version 1.25.0: * doc: fix uv_get_free_memory doc (Stephen Belanger) * unix: fix epoll cpu 100% issue (yeyuanfeng) * openbsd,tcp: special handling of EINVAL on connect (ptlomholt) * win: simplify registry closing in uv_cpu_info() (cjihrig) * src,include: define UV_MAXHOSTNAMESIZE (cjihrig) * win: return product name in uv_os_uname() version (cjihrig) * thread: allow specifying stack size for new thread (Anna Henningsen) * win: fix duplicate tty vt100 fn key (erw7) * unix: don't attempt to invalidate invalid fd (Ben Noordhuis)

view details

cjihrig

commit sha 0c3ce4b316ca1a6aacc75b315d1434f2b554e92e

Add SHA to ChangeLog

view details

cjihrig

commit sha 598a49b942852285d7d9cdb7db0433e52b5b485a

Now working on version 1.26.1 Fixes: https://github.com/libuv/libuv/issues/2180

view details

Vladimír Čunát

commit sha 4fc5a0ee61168565bd94864c9cd68379bb5454f3

doc: describe unix signal handling better - SIGTERM seems OK to handle - I tested that on Linux, read POSIX, etc. I can't see why it should be different from SIGUSR1, for example, except that the default handler is different. - Also raise(15) is caught by the handler for me, and I can't see why it wouldn't. The main source of knowledge for this is POSIX. http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_04_03_03 PR-URL: https://github.com/libuv/libuv/pull/1987 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>

view details

Ben Noordhuis

commit sha 19d8eb0c92fda8931b14d2daac71a0644ebe4695

linux: use statx() to obtain file birth time Kernels > 4.11 support the statx() system call that lets one retrieve the birth time of a file. Teach libuv about it. Fixes: https://github.com/libuv/libuv/issues/2152 PR-URL: https://github.com/libuv/libuv/pull/2184 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

view details

Santiago Gimeno

commit sha 98db18479a618106ec76130e298cf8870d2ba8aa

src: fill sockaddr_in6.sin6_len when it's defined As some calls in some platforms require. PR-URL: https://github.com/libuv/libuv/pull/2189 Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>

view details

Ben Noordhuis

commit sha cdee607d482ad8b9f665541d3f092dd11f72e508

test: relax uv_hrtime() test assumptions Expecting `uv_sleep(45)` to wake up within 80 ms is not a reasonable assumption: the operating system may not reschedule the process within that time frame when the system is overloaded. The test fails intermittently on our own CI and packagers have reported similar failures. Fixes: https://github.com/libuv/libuv/issues/2117 PR-URL: https://github.com/libuv/libuv/pull/2186 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>

view details

Thomas Karl Pietrowski

commit sha bcef1c16fb5a36b499b46d6b0a22d625fefdaeed

build: make cmake install LICENSE only once The license file is installed twice. Once where it should be installed and the second time into the pkg-config directory. Among other files from other projects it might be confusing why there is a license file among with other files. Additionally, that is normally not the right location for license files. Guess, that is only a copy/pasting mistake. PR-URL: https://github.com/libuv/libuv/pull/2204 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>

view details

Ben Noordhuis

commit sha 09ba4778d8a8d36b652c714c2cc6557b7e945ee2

bsd: plug uv_fs_event_start() error path fd leak Close the watched file's file descriptor when initialization fails due to out-of-memory conditions. PR-URL: https://github.com/libuv/libuv/pull/2197 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

view details

cjihrig

commit sha 45a49688c86bd2afd0fe9e2e85b86ac31ee1e02e

unix: fix __FreeBSD_kernel__ typo Fixes: https://github.com/libuv/libuv/issues/2212 PR-URL: https://github.com/libuv/libuv/pull/2214 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

view details

Ben Noordhuis

commit sha 7262dd049018b57a2a12b7fbcef8def0b083db20

doc: add note about uv_run() not being reentrant PR-URL: https://github.com/libuv/libuv/pull/2208 Refs: https://github.com/libuv/help/issues/81 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

view details

Anna Henningsen

commit sha bdb5838eac6c159939455285955e3bf7d860ffd6

unix, win: make fs-poll close wait for resource cleanup Wait until all fs requests spawned by an `uv_fs_poll_t` have finished and all timers created by it have fully been closed before calling the close callback. Fixes: https://github.com/libuv/libuv/issues/1869 PR-URL: https://github.com/libuv/libuv/pull/1875 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>

view details

Ryan Liptak

commit sha 419975e54ef07bdfefecddeebff9e3837b815337

doc: fix typo in uv_thread_options_t definition PR-URL: https://github.com/libuv/libuv/pull/2195 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

view details

evgley

commit sha af31d01492b2714a56a9b86943e8aeb9711ee019

win: skip winsock initialization in safe mode uv_winsock_init calls abort() if socket operation failed, which means all libuv-based applications are not able to start in safe mode without network. PR-URL: https://github.com/libuv/libuv/pull/2205 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

view details

Santiago Gimeno

commit sha d16897c493387e48a5403098395352851a51c4d9

unix: refactor getsockname/getpeername methods PR-URL: https://github.com/libuv/libuv/pull/1872 Backport-PR-URL: https://github.com/libuv/libuv/pull/2217 Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>

view details

Santiago Gimeno

commit sha 03061d54f0730e1565aedecf11b361053e5897a9

win,udp: allow to use uv_udp_open on bound sockets PR-URL: https://github.com/libuv/libuv/pull/1872 Backport-PR-URL: https://github.com/libuv/libuv/pull/2217 Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>

view details

Santiago Gimeno

commit sha 90415a3394f51056e037a8a4d5a6ada6a710fd42

udp: add support for UDP connected sockets Add two new methods: `uv_udp_connect()` to connect / disconnect an UDP handle. `uv_udp_getpeername()` to get the remote peer address of a connected UDP handle. Modify `uv_udp_send()` and `uv_udp_try_send()` to accept a `NULL` `addr` to send messages over an "UDP connection". Refs: https://github.com/libuv/leps/pull/10 PR-URL: https://github.com/libuv/libuv/pull/1872 Backport-PR-URL: https://github.com/libuv/libuv/pull/2217 Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>

view details

Poul Thomas Lomholt

commit sha c4a77f5bc74621e16a355615d9deddbcaa848ec3

build: fix uv_test shared uv Windows cmake build This commit fixes a linker error when building tests via cmake on Windows by adding the proper USING_UV_SHARED=1 define when linking to the shared libuv. Fixes: https://github.com/libuv/libuv/issues/2188 PR-URL: https://github.com/libuv/libuv/pull/2187 Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>

view details

push time in a month

push eventlibuv/libuv

Xu Meng

commit sha aa53113ba8c125a86ec18d77149b92ff12e9d4c7

ibmi: skip unsupported fs test cases On IBMi PASE, we need to skip some file permission tests for `root`. And the file stat of symbolic links are different as well. Fixes: https://github.com/libuv/libuv/issues/2628 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>

view details

push time in a month

PR closed libuv/libuv

ibmi: skip unsupported fs test cases

On IBMi PASE, we need to skip some file permission tests for root. And the file stat of symbolic links are different as well.

+14 -0

1 comment

2 changed files

dmabupt

pr closed time in a month

pull request commentlibuv/libuv

ibmi: skip unsupported fs test cases

CI: https://ci.nodejs.org/job/libuv-test-commit/1726/. It looks good.

dmabupt

comment created time in a month

PR closed libuv/libuv

Make code can be compiled for iOS on macOS with Xcode

See #2638

+1 -1

1 comment

1 changed file

ssrlive

pr closed time in a month

pull request commentlibuv/libuv

Make code can be compiled for iOS on macOS with Xcode

Landed in https://github.com/libuv/libuv/commit/2475296c4ee50f9b144f5781ae7a8e182d1f002a. Thanks!

ssrlive

comment created time in a month

push eventlibuv/libuv

ssrlive

commit sha 2475296c4ee50f9b144f5781ae7a8e182d1f002a

build: make code compilable for iOS on Xcode Fixes: https://github.com/libuv/libuv/issues/2638 PR-URL: https://github.com/libuv/libuv/pull/2639 Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>

view details

push time in a month

issue closedlibuv/libuv

Unable to compile for iOS on macOS with Xcode

Can not compile it because of the following lines.

https://github.com/libuv/libuv/blob/7a914e7f3d3d53ccbde50d0933cbaf576720c24e/src/unix/core.c#L536-L542

Since there NO close$NOCANCEL$UNIX2003 function in iOS SDK, can we changed the first line to #if defined(__LP64__) || defined(TARGET_OS_IPHONE)? likes:

#if defined(__LP64__) || defined(TARGET_OS_IPHONE)
  extern int close$NOCANCEL(int);
  return close$NOCANCEL(fd);
#else
  extern int close$NOCANCEL$UNIX2003(int);
  return close$NOCANCEL$UNIX2003(fd);
#endif

closed time in a month

ssrlive

PR closed libuv/libuv

src: android build fix

ip_mreq_source struct are not defined in Android NDK <= 16, regardless of the API level.

Fix proposal for #2633

+2 -2

1 comment

1 changed file

devnexen

pr closed time in a month

pull request commentlibuv/libuv

src: android build fix

Landed in https://github.com/libuv/libuv/commit/8270add421c602454a1ccafc8d6947cd4536c754. Thanks!

devnexen

comment created time in a month

push eventlibuv/libuv

David Carlier

commit sha 8270add421c602454a1ccafc8d6947cd4536c754

src: android build fix ip_mreq_source struct are not defined in Android NDK <= 16, regardless of the API level. Fixes: https://github.com/libuv/libuv/issues/2633 PR-URL: https://github.com/libuv/libuv/pull/2637 Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>

view details

push time in a month

issue closedlibuv/libuv

Unable to compile for Android on linux

<!-- If you want to report a bug, you are in the right place!

If you need help or have a question, go here: https://github.com/libuv/help/issues/new

If you are reporting a libuv test failure, please ensure that you are not running the test as root.

Please include code that demonstrates the bug and keep it short and simple. -->

  • Version: 1.x
  • Platform: Linux Ubu 5.0.0-37-generic #40~18.04.1-Ubuntu SMP Thu Nov 14 12:06:39 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

When following your build instructions:

jzer0@Ubu:/media/jzer0/Dev/git/libuv$ source ./android-configure-arm64 /media/jzer0/Dev/development/android-ndk-r15c gyp 23
HOST_OS=linux
HOST_EXE=
HOST_ARCH=x86_64
HOST_TAG=linux-x86_64
HOST_NUM_CPUS=1
BUILD_NUM_CPUS=2
Toolchain installed to /media/jzer0/Dev/git/libuv/android-toolchain-arm64.
['-Dtarget_arch=arm64', '-DOS=android', '-f', 'make-android', '-I', 'common.gypi', 'test/test.gyp', '--depth=.', '-Goutput_dir=/media/jzer0/Dev/git/libuv/out', '--generator-output', '/media/jzer0/Dev/git/libuv/out', '-Dhost_arch=x64', '-Duv_library=static_library']


jzer0@Ubu:/media/jzer0/Dev/git/libuv$ make -C out
make: Entering directory `/media/jzer0/Dev/git/libuv/out'
  CC(target) /media/jzer0/Dev/git/libuv/out/Debug/obj.target/libuv/src/unix/udp.o
../src/unix/udp.c: In function 'uv__udp_set_source_membership4':
../src/unix/udp.c:673:68: error: request for member 's_addr' in something not a structure or union
     err = uv_inet_pton(AF_INET, interface_addr, &mreq.imr_interface.s_addr);
                                                                    ^
../src/unix/udp.c:677:23: error: request for member 's_addr' in something not a structure or union
     mreq.imr_interface.s_addr = htonl(INADDR_ANY);
                       ^
../src/unix/udp.c:680:21: error: request for member 's_addr' in something not a structure or union
   mreq.imr_multiaddr.s_addr = multicast_addr->sin_addr.s_addr;
                     ^
../src/unix/udp.c:681:22: error: request for member 's_addr' in something not a structure or union
   mreq.imr_sourceaddr.s_addr = source_addr->sin_addr.s_addr;
                      ^
make: *** [/media/jzer0/Dev/git/libuv/out/Debug/obj.target/libuv/src/unix/udp.o] Error 1
make: Leaving directory `/media/jzer0/Dev/git/libuv/out'

closed time in a month

jzer0

PR opened libuv/libuv

fs,macos: fix fs_event_watch_dir_recursive flakiness

This test sometimes times out because not all the expected events are received: the create and delete events may coalesce. To avoid it, make sure not to start deleting the files until all the create events are received.

Also, take into account in the test that a create event of the subdir directory can be detected even though we start watching for the events after its creation.

CI: https://ci.nodejs.org/view/libuv/job/libuv-test-commit/1725/

+9 -1

0 comment

1 changed file

pr created time in a month

push eventsantigimeno/libuv

Santiago Gimeno

commit sha 9d5e04c8cd42c0c0dd71eae5d09338201ce83aa6

fs,macos: fix fs_event_watch_dir_recursive flakiness This test sometimes times out because not all the expected events are received: the create and delete events may coalesce. To avoid it, make sure not to start deleting the files until all the create events are received. Also, take into account in the test that a create event of the `subdir` directory can be detected even though we start watching for the events after its creation.

view details

push time in a month

push eventsantigimeno/libuv

Santiago Gimeno

commit sha f1fdfaaf697ed4eba58858d07584e0d8ee21ae77

fs,macos: fix fs_event_watch_dir_recursive flakiness This test sometimes times out because not all the expected events are received: the create and delete events may coalesce. To avoid it, make sure not to start deleting the files until all the create events are received. Also, take into account in the test that a create event of the `subdir` directory can be detected even though we start watching for the events after its creation.

view details

push time in a month

create barnchsantigimeno/libuv

branch : investigate_fs_recursive

created branch time in a month

issue commentlibuv/libuv

Unable to compile for Android on linux

@ping996 can you check if https://github.com/libuv/libuv/pull/2637 fixes the issue?

jzer0

comment created time in a month

issue commentlibuv/libuv

not ok 345 - udp_multicast_join (on MacOS)

Can the test be improved somehow?

The tests in their current form are pretty simple. As Ben said, most of the reports ended up being firewall or routing issues.

Anyway, what version of MacOS are the tests run? Can you add some logs around this line to see if it's failing to receive the first datagram or the second?

It is MacOS build on regular CI

Yes, and those test pass: https://ci.nodejs.org/view/libuv/job/libuv-test-commit-osx/

frol

comment created time in a month

pull request commentsantigimeno/node-pcsclite

Update cflags include to use pkg-config if include directory is different then default /usr/include

@rkalkani sorry this PR fell through the cracks. Let me take a look at it and if it's fine I'll merge it.

rkalkani

comment created time in 2 months

issue closednode-schedule/node-schedule

Is there any rule dayOfMonth exactly like dayOfWeek?

Actually I want to repeat a job on specific days of every month like on 10th, 17th, 24th of every moth.

closed time in 2 months

Hamza-Khurshid

issue commentnode-schedule/node-schedule

Is there any rule dayOfMonth exactly like dayOfWeek?

@Hamza-Khurshid only if you use the cron syntax (see README)

Hamza-Khurshid

comment created time in 2 months

pull request commentnodejs/node

util: add util.sleep()

Isn't the need of a busy loop for some of the tests an indication of a valid use case? Someone could use if for the same purpose such as testing how an app would behave when performing a CPU intensive task.

cjihrig

comment created time in 3 months

IssuesEvent

pull request commentlibuv/libuv

unix,win: introduced uv_udp_send_ex and uv_udp_try_send_ex

CI: https://ci.nodejs.org/view/libuv/job/libuv-test-commit/1646/

k13-engineering

comment created time in 3 months

Pull request review commentlibuv/libuv

unix,win: introduced uv_udp_send_ex and uv_udp_try_send_ex

 TEST_IMPL(udp_send_and_recv) {                   cl_send_cb);   ASSERT(r == 0); +  /* client sends "ping", expects "pong" */+  buf = uv_buf_init("PING", 4);++  r = uv_udp_send_ex(&req_ex,+                  &client,+                  &buf,+                  1,+                  (const struct sockaddr*) &addr,+                  sizeof(struct sockaddr_in),+                  cl_send_cb);

Style: fix argument alignment

k13-engineering

comment created time in 3 months

Pull request review commentlibuv/libuv

unix,win: introduced uv_udp_send_ex and uv_udp_try_send_ex

 static void sv_send_cb(uv_udp_send_t* req, int status) {   ASSERT(status == 0);   CHECK_HANDLE(req->handle); -  uv_close((uv_handle_t*) req->handle, close_cb);+  if (sv_send_cb_called > 0) {+    uv_close((uv_handle_t*) req->handle, close_cb);+  }

Style: remove braces

k13-engineering

comment created time in 3 months

Pull request review commentlibuv/libuv

unix: switch uv_sleep() to nanosleep()

 int uv_gettimeofday(uv_timeval64_t* tv) { }  void uv_sleep(unsigned int msec) {-  unsigned int sec;-  unsigned int usec;--  sec = msec / 1000;-  usec = (msec % 1000) * 1000;-  if (sec > 0)-    sleep(sec);-  if (usec > 0)-    usleep(usec);+  struct timespec timeout;++  timeout.tv_sec = msec / 1000;+  timeout.tv_nsec = (msec % 1000) * 1000 * 1000;+  nanosleep(&timeout, NULL);

Does it make sense handling EINTR errors?

bnoordhuis

comment created time in 3 months

PullRequestEvent
more