summaryrefslogtreecommitdiffhomepage
path: root/go
diff options
context:
space:
mode:
authorTiago Natel de Moura <t.nateldemoura@f5.com>2021-11-09 15:48:44 +0300
committerTiago Natel de Moura <t.nateldemoura@f5.com>2021-11-09 15:48:44 +0300
commitff6a7053f500414dc74568a4e49adbac7f0cf634 (patch)
treecda31505e9746138fb864a6b2902b89107e04bc7 /go
parente878f6d54376ea676b96b56f41708f01cfc4d8b4 (diff)
downloadunit-ff6a7053f500414dc74568a4e49adbac7f0cf634.tar.gz
unit-ff6a7053f500414dc74568a4e49adbac7f0cf634.tar.bz2
Introduced SCM_CREDENTIALS / SCM_CREDS in the socket control msgs.
Diffstat (limited to '')
-rw-r--r--go/nxt_cgo_lib.c8
-rw-r--r--go/port.go7
2 files changed, 9 insertions, 6 deletions
diff --git a/go/nxt_cgo_lib.c b/go/nxt_cgo_lib.c
index 3e766b1e..ca9fc3ab 100644
--- a/go/nxt_cgo_lib.c
+++ b/go/nxt_cgo_lib.c
@@ -10,10 +10,10 @@
#include <nxt_unit_request.h>
-static ssize_t nxt_cgo_port_send(nxt_unit_ctx_t *, nxt_unit_port_t *port,
+static ssize_t nxt_cgo_port_send(nxt_unit_ctx_t *ctx, nxt_unit_port_t *port,
const void *buf, size_t buf_size, const void *oob, size_t oob_size);
-static ssize_t nxt_cgo_port_recv(nxt_unit_ctx_t *, nxt_unit_port_t *port,
- void *buf, size_t buf_size, void *oob, size_t oob_size);
+static ssize_t nxt_cgo_port_recv(nxt_unit_ctx_t *ctx, nxt_unit_port_t *port,
+ void *buf, size_t buf_size, void *oob, size_t *oob_size);
int
nxt_cgo_run(uintptr_t handler)
@@ -58,7 +58,7 @@ nxt_cgo_port_send(nxt_unit_ctx_t *ctx, nxt_unit_port_t *port,
static ssize_t
nxt_cgo_port_recv(nxt_unit_ctx_t *ctx, nxt_unit_port_t *port,
- void *buf, size_t buf_size, void *oob, size_t oob_size)
+ void *buf, size_t buf_size, void *oob, size_t *oob_size)
{
return nxt_go_port_recv(port->id.pid, port->id.id,
buf, buf_size, oob, oob_size);
diff --git a/go/port.go b/go/port.go
index 8fa94cb4..6635e87c 100644
--- a/go/port.go
+++ b/go/port.go
@@ -169,7 +169,7 @@ func nxt_go_port_send(pid C.int, id C.int, buf unsafe.Pointer, buf_size C.int,
//export nxt_go_port_recv
func nxt_go_port_recv(pid C.int, id C.int, buf unsafe.Pointer, buf_size C.int,
- oob unsafe.Pointer, oob_size C.int) C.ssize_t {
+ oob unsafe.Pointer, oob_size *C.size_t) C.ssize_t {
key := port_key{
pid: int(pid),
@@ -184,7 +184,7 @@ func nxt_go_port_recv(pid C.int, id C.int, buf unsafe.Pointer, buf_size C.int,
}
n, oobn, _, _, err := p.rcv.ReadMsgUnix(GoBytes(buf, buf_size),
- GoBytes(oob, oob_size))
+ GoBytes(oob, C.int(*oob_size)))
if err != nil {
if nerr, ok := err.(*net.OpError); ok {
@@ -196,6 +196,9 @@ func nxt_go_port_recv(pid C.int, id C.int, buf unsafe.Pointer, buf_size C.int,
nxt_go_warn("read result %d (%d), %s", n, oobn, err)
n = -1
+
+ } else {
+ *oob_size = C.size_t(oobn)
}
return C.ssize_t(n)