Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade libuv to 1.46.0 #154

Merged
merged 6 commits into from
Dec 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
build :
dune build -p luv

.PHONY : watch
watch :
dune build -p luv -w

.PHONY : test
test :
dune runtest --no-buffer --force
Expand Down
19 changes: 18 additions & 1 deletion src/c/luv_c_function_descriptions.ml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,19 @@ struct
(ptr Types.Loop.t @-> Types.Loop.Run_mode.t @-> returning bool)
end

(* See https://github.com/ocsigen/lwt/issues/230. *)
(* bind is potentially a blocking call, because the filesystem may block the
calling process indefinitely when creating a file for Unix domain socket or
similar. *)
module Pipe =
struct
let bind =
foreign "uv_pipe_bind"
(ptr Types.Pipe.t @-> string @-> returning error_code)

let bind2 =
foreign "uv_pipe_bind2"
(ptr Types.Pipe.t @-> string @-> size_t @-> int @->
returning error_code)
end

(* Synchronous (callback = NULL) calls to these functions are blocking, so we
Expand Down Expand Up @@ -1002,6 +1009,16 @@ struct
Stream.Connect_request.trampoline @->
returning void)

let connect2 =
foreign "uv_pipe_connect2"
(ptr Types.Stream.Connect_request.t @->
ptr t @->
ocaml_string @->
size_t @->
int @->
Stream.Connect_request.trampoline @->
returning void)

let getsockname =
foreign "uv_pipe_getsockname"
(ptr t @-> ocaml_bytes @-> ptr size_t @-> returning error_code)
Expand Down
3 changes: 3 additions & 0 deletions src/c/luv_c_type_descriptions.ml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ struct
let esrch = constant "UV_ESRCH" int
let etimedout = constant "UV_ETIMEDOUT" int
let etxtbsy = constant "UV_ETXTBSY" int
let eunatch = constant "UV_EUNATCH" int
let exdev = constant "UV_EXDEV" int
let unknown = constant "UV_UNKNOWN" int
let eof = constant "UV_EOF" int
Expand Down Expand Up @@ -564,6 +565,8 @@ struct

let t : ([ `Pipe ] Stream.t) typ = typedef (structure "`Pipe") "uv_pipe_t"
let () = seal t

let no_truncate = constant "UV_PIPE_NO_TRUNCATE" int
end

module TTY =
Expand Down
21 changes: 21 additions & 0 deletions src/c/shims.h
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,8 @@
return ENOSYS;
}

#define UV_ENODATA 0x6242424

static int uv_metrics_info(uv_loop_t *loop, void *metrics)
{
return ENOSYS;
Expand Down Expand Up @@ -725,3 +727,22 @@
return ENOSYS;
}
#endif

#if UV_VERSION_MAJOR == 1 && UV_VERSION_MINOR < 46
#define UV_PIPE_NO_TRUNCATE 0

static int uv_pipe_bind2(
uv_pipe_t *pipe, const char *name, size_t namelen, unsigned int flags)
{
return ENOSYS;
}

static int uv_pipe_connect2(
uv_connect_t *request, uv_pipe_t *pipe, const char *name,
size_t namelen, unsigned int flags, uv_connect_cb callback)
{
return ENOSYS;
}

#define UV_EUNATCH 0x7242424
#endif
7 changes: 4 additions & 3 deletions src/c/vendor/configure/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -1270,6 +1270,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
Expand Down Expand Up @@ -1500,7 +1501,7 @@ all: all-am
.SUFFIXES: .c .lo .o .obj
am--refresh: Makefile
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
Expand All @@ -1526,9 +1527,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck

$(top_srcdir)/configure: $(am__configure_deps)
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(am__cd) $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
$(am__aclocal_m4_deps):
libuv.pc: $(top_builddir)/config.status $(srcdir)/libuv.pc.in
Expand Down
2 changes: 1 addition & 1 deletion src/c/vendor/configure/commit-hash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
96e05543f53b19d9642b4b0dd73b86ad3cea313e
f0bb7e40f0508bedf6fad33769b3f87bb8aedfa6
55 changes: 45 additions & 10 deletions src/c/vendor/configure/configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.71 for libuv 1.45.0.
# Generated by GNU Autoconf 2.71 for libuv 1.46.0.
#
# Report bugs to <https://github.com/libuv/libuv/issues>.
#
Expand Down Expand Up @@ -618,8 +618,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='libuv'
PACKAGE_TARNAME='libuv'
PACKAGE_VERSION='1.45.0'
PACKAGE_STRING='libuv 1.45.0'
PACKAGE_VERSION='1.46.0'
PACKAGE_STRING='libuv 1.46.0'
PACKAGE_BUGREPORT='https://github.com/libuv/libuv/issues'
PACKAGE_URL=''

Expand Down Expand Up @@ -743,6 +743,9 @@ build_os
build_vendor
build_cpu
build
MAINT
MAINTAINER_MODE_FALSE
MAINTAINER_MODE_TRUE
AM_BACKSLASH
AM_DEFAULT_VERBOSITY
AM_DEFAULT_V
Expand Down Expand Up @@ -817,6 +820,7 @@ ac_subst_files=''
ac_user_opts='
enable_option_checking
enable_silent_rules
enable_maintainer_mode
enable_shared
enable_static
enable_dependency_tracking
Expand Down Expand Up @@ -1386,7 +1390,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures libuv 1.45.0 to adapt to many kinds of systems.
\`configure' configures libuv 1.46.0 to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

Expand Down Expand Up @@ -1457,7 +1461,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of libuv 1.45.0:";;
short | recursive ) echo "Configuration of libuv 1.46.0:";;
esac
cat <<\_ACEOF

Expand All @@ -1467,6 +1471,9 @@ Optional Features:
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-silent-rules less verbose build output (undo: "make V=1")
--disable-silent-rules verbose build output (undo: "make V=0")
--disable-maintainer-mode
disable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
--enable-shared[=PKGS] build shared libraries [default=yes]
--enable-static[=PKGS] build static libraries [default=yes]
--enable-dependency-tracking
Expand Down Expand Up @@ -1569,7 +1576,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
libuv configure 1.45.0
libuv configure 1.46.0
generated by GNU Autoconf 2.71

Copyright (C) 2021 Free Software Foundation, Inc.
Expand Down Expand Up @@ -1825,7 +1832,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by libuv $as_me 1.45.0, which was
It was created by libuv $as_me 1.46.0, which was
generated by GNU Autoconf 2.71. Invocation command line was

$ $0$ac_configure_args_raw
Expand Down Expand Up @@ -3162,7 +3169,7 @@ fi

# Define the identity of the package.
PACKAGE='libuv'
VERSION='1.45.0'
VERSION='1.46.0'


printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
Expand Down Expand Up @@ -3266,6 +3273,30 @@ END
fi


{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
printf %s "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
# Check whether --enable-maintainer-mode was given.
if test ${enable_maintainer_mode+y}
then :
enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
else $as_nop
USE_MAINTAINER_MODE=yes
fi

{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5
printf "%s\n" "$USE_MAINTAINER_MODE" >&6; }
if test $USE_MAINTAINER_MODE = yes; then
MAINTAINER_MODE_TRUE=
MAINTAINER_MODE_FALSE='#'
else
MAINTAINER_MODE_TRUE='#'
MAINTAINER_MODE_FALSE=
fi

MAINT=$MAINTAINER_MODE_TRUE

# pass --disable-maintainer-mode if autotools may be unavailable


# Make sure we can run config.sub.
$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 ||
Expand Down Expand Up @@ -15247,6 +15278,10 @@ else
am__EXEEXT_FALSE=
fi

if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
as_fn_error $? "conditional \"AMDEP\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
Expand Down Expand Up @@ -15706,7 +15741,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by libuv $as_me 1.45.0, which was
This file was extended by libuv $as_me 1.46.0, which was
generated by GNU Autoconf 2.71. Invocation command line was

CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -15769,7 +15804,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
libuv config.status 1.45.0
libuv config.status 1.46.0
configured by $0, generated by GNU Autoconf 2.71,
with options \\"\$ac_cs_config\\"

Expand Down
2 changes: 1 addition & 1 deletion src/c/vendor/libuv
Submodule libuv updated 65 files
+1 −0 .readthedocs.yaml
+6 −0 AUTHORS
+60 −1 ChangeLog
+2 −1 LINKS.md
+2 −1 configure.ac
+3 −0 docs/src/errors.rst
+49 −5 docs/src/pipe.rst
+25 −4 include/uv.h
+3 −3 include/uv/darwin.h
+6 −0 include/uv/errno.h
+1 −1 include/uv/linux.h
+1 −1 include/uv/threadpool.h
+25 −23 include/uv/unix.h
+1 −1 include/uv/version.h
+2 −2 include/uv/win.h
+68 −86 src/queue.h
+36 −36 src/threadpool.c
+7 −7 src/unix/aix.c
+26 −26 src/unix/async.c
+36 −31 src/unix/core.c
+29 −35 src/unix/fs.c
+42 −42 src/unix/fsevents.c
+11 −0 src/unix/internal.h
+9 −9 src/unix/kqueue.c
+217 −42 src/unix/linux.c
+10 −10 src/unix/loop-watcher.c
+14 −14 src/unix/loop.c
+12 −12 src/unix/os390-syscalls.c
+1 −1 src/unix/os390-syscalls.h
+7 −7 src/unix/os390.c
+82 −14 src/unix/pipe.c
+7 −7 src/unix/posix-poll.c
+25 −25 src/unix/process.c
+4 −4 src/unix/signal.c
+28 −28 src/unix/stream.c
+9 −9 src/unix/sunos.c
+2 −2 src/unix/tcp.c
+1 −1 src/unix/tty.c
+38 −38 src/unix/udp.c
+14 −14 src/uv-common.c
+2 −1 src/uv-common.h
+5 −6 src/win/core.c
+209 −104 src/win/fs.c
+1 −1 src/win/handle-inl.h
+2 −12 src/win/internal.h
+82 −20 src/win/pipe.c
+2 −2 src/win/tcp.c
+0 −20 src/win/tty.c
+2 −2 src/win/udp.c
+2 −0 test/benchmark-list.h
+42 −0 test/benchmark-loop-count.c
+10 −0 test/runner-unix.c
+36 −0 test/test-fork.c
+53 −0 test/test-fs.c
+2 −0 test/test-get-passwd.c
+10 −0 test/test-list.h
+11 −0 test/test-loop-stop.c
+24 −0 test/test-pipe-bind-error.c
+11 −1 test/test-pipe-close-stdout-read-stdin.c
+46 −45 test/test-pipe-getsockname.c
+3 −2 test/test-queue-foreach-delete.c
+1 −1 test/test-spawn.c
+0 −4 test/test-thread.c
+38 −0 test/test-threadpool-cancel.c
+12 −0 test/test-timer.c
2 changes: 2 additions & 0 deletions src/error.ml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ type t = [
| `ESRCH
| `ETIMEDOUT
| `ETXTBSY
| `EUNATCH
| `EXDEV
| `UNKNOWN
| `EOF
Expand Down Expand Up @@ -162,6 +163,7 @@ let to_c = let open C.Types.Error in function
| `ESRCH -> esrch
| `ETIMEDOUT -> etimedout
| `ETXTBSY -> etxtbsy
| `EUNATCH -> eunatch
| `EXDEV -> exdev
| `UNKNOWN -> unknown
| `EOF -> eof
Expand Down
1 change: 1 addition & 0 deletions src/error.mli
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ type t = [
| `ESRCH
| `ETIMEDOUT
| `ETXTBSY
| `EUNATCH
| `EXDEV
| `UNKNOWN
| `EOF
Expand Down
2 changes: 2 additions & 0 deletions src/feature/detect_features.ml
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ let () =
needs 25 "os_uname" "See {!Luv.System_info.uname}.";
needs 21 "overlapped_pipe" "See {!Luv.Process.to_parent_pipe}.";
needs 41 "pipe" "See {!Luv.Pipe.pipe}";
needs 46 "pipe_bind2" "See {!Luv.Pipe.bind}.";
needs 46 "pipe_connect2" "See {!Luv.Pipe.connect}.";
needs 16 "pipe_chmod" "See {!Luv.Pipe.chmod}.";
needs 14 "prioritized" "See [`PRIORITIZED] in {!Luv.Poll.Event.t}.";
needs 24 "process_windows_hide_console" "See {!Luv.Process.spawn}.";
Expand Down
44 changes: 36 additions & 8 deletions src/pipe.ml
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,49 @@ let open_ pipe file =
C.Functions.Pipe.open_ pipe (File.to_int file)
|> Error.to_result ()

let bind pipe name =
C.Blocking.Pipe.bind pipe name
let bind ?(no_truncate = false) pipe name =
let use_bind2 =
match name.[0] with
| '\x00' -> true
| _ | exception Invalid_argument _ -> no_truncate
in
begin if use_bind2 then
let length = String.length name |> Unsigned.Size_t.of_int in
let no_truncate = if no_truncate then C.Types.Pipe.no_truncate else 0 in
C.Blocking.Pipe.bind2 pipe name length no_truncate
else
C.Blocking.Pipe.bind pipe name
end
|> Error.to_result ()

let connect pipe name_or_path callback =
let connect ?(no_truncate = false) pipe name_or_path callback =
let request = Stream.Connect_request.make () in
let callback result =
Error.catch_exceptions callback (Error.to_result () result)
in
Request.set_callback request callback;
C.Functions.Pipe.connect
request
pipe
(Ctypes.ocaml_string_start name_or_path)
Stream.Connect_request.trampoline
let use_connect2 =
match name_or_path.[0] with
| '\x00' -> true
| _ | exception Invalid_argument _ -> no_truncate
in
let c_name_or_path = Ctypes.ocaml_string_start name_or_path in
if use_connect2 then
let length = String.length name_or_path |> Unsigned.Size_t.of_int in
let no_truncate = if no_truncate then C.Types.Pipe.no_truncate else 0 in
C.Functions.Pipe.connect2
request
pipe
c_name_or_path
length
no_truncate
Stream.Connect_request.trampoline
else
C.Functions.Pipe.connect
request
pipe
c_name_or_path
Stream.Connect_request.trampoline

let rec generic_getname ?(buffer_size = 128) c_function pipe =
let length_cell =
Expand Down
Loading
Loading