Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:26
erlang
3101-erts-esock-Update-socket-preloaded-add-sen...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 3101-erts-esock-Update-socket-preloaded-add-sendv-functio.patch of Package erlang
From 7693240567111bea6295f28fdbb2ce498e68eae5 Mon Sep 17 00:00:00 2001 From: Micael Karlberg <bmk@erlang.org> Date: Thu, 7 Mar 2024 14:07:49 +0100 Subject: [PATCH 01/11] [erts|esock] Update (socket) preloaded - add sendv function OTP-18845 --- erts/preloaded/ebin/prim_socket.beam | Bin 15064 -> 15452 bytes erts/preloaded/src/prim_socket.erl | 48 +++++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/erts/preloaded/src/prim_socket.erl b/erts/preloaded/src/prim_socket.erl index be698564f1..9652621416 100644 --- a/erts/preloaded/src/prim_socket.erl +++ b/erts/preloaded/src/prim_socket.erl @@ -36,7 +36,7 @@ connect/1, connect/3, listen/2, accept/2, - send/4, sendto/4, sendto/5, sendmsg/4, sendmsg/5, + send/4, sendto/4, sendto/5, sendmsg/4, sendmsg/5, sendv/3, sendfile/4, sendfile/5, sendfile_deferred_close/1, recv/4, recvfrom/4, recvmsg/5, close/1, finalize_close/1, @@ -52,7 +52,8 @@ -nifs([nif_info/0, nif_info/1, nif_supports/0, nif_supports/1, nif_command/1, nif_open/2, nif_open/4, nif_bind/2, nif_connect/1, nif_connect/3, - nif_listen/2, nif_accept/2, nif_send/4, nif_sendto/5, nif_sendmsg/5, + nif_listen/2, nif_accept/2, + nif_send/4, nif_sendto/5, nif_sendmsg/5, nif_sendv/3, nif_sendfile/5, nif_sendfile/4, nif_sendfile/1, nif_recv/4, nif_recvfrom/4, nif_recvmsg/5, nif_close/1, nif_shutdown/2, nif_setopt/5, nif_getopt/3, nif_getopt/4, nif_sockname/1, @@ -697,6 +698,48 @@ invalid_iov([H|IOV], N) -> invalid_iov(_, N) -> {improper_list, N}. + +sendv(SockRef, IOV, SendRef) -> + sendv_result( + SockRef, IOV, SendRef, false, + nif_sendv(SockRef, IOV, SendRef)). + +sendv_result(SockRef, IOV, SendRef, HasWritten, Result) -> + case Result of + ok -> + ok; + + {ok, Written} -> + RestIOV = rest_iov(Written, IOV), + {ok, RestIOV}; + + {iov, Written} -> + RestIOV = rest_iov(Written, IOV), + sendv_result( + SockRef, RestIOV, SendRef, true, + nif_sendv(SockRef, RestIOV, SendRef)); + + select -> + if + HasWritten -> + %% Cont is not used for sendv + {select, IOV, undefined}; + true -> + select + end; + {select, Written} -> + RestIOV = rest_iov(Written, IOV), + %% Cont is not used for sendv + {select, RestIOV, undefined}; + + completion = C -> + C; + + {error, _Reason} = Result -> + Result + end. + + sendfile(SockRef, Offset, Count, SendRef) -> nif_sendfile(SockRef, SendRef, Offset, Count). @@ -1186,6 +1229,7 @@ nif_accept(_SockRef, _Ref) -> erlang:nif_error(notsup). nif_send(_SockRef, _Bin, _Flags, _SendRef) -> erlang:nif_error(notsup). nif_sendto(_SockRef, _Bin, _Dest, _Flags, _SendRef) -> erlang:nif_error(notsup). nif_sendmsg(_SockRef, _Msg, _Flags, _SendRef, _IOV) -> erlang:nif_error(notsup). +nif_sendv(_SockRef, _IOVec, _SendRef) -> erlang:nif_error(notsup). nif_sendfile(_SockRef, _SendRef, _Offset, _Count, _InFileRef) -> erlang:nif_error(notsup). -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor