nxt_cgo_lib.c (1543:42f27153db91) nxt_cgo_lib.c (1544:05af370e63b7)
1
2/*
3 * Copyright (C) Max Romanov
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include "_cgo_export.h"
8
9#include <nxt_unit.h>
10#include <nxt_unit_request.h>
11
12
13static void nxt_cgo_request_handler(nxt_unit_request_info_t *req);
14static nxt_cgo_str_t *nxt_cgo_str_init(nxt_cgo_str_t *dst,
15 nxt_unit_sptr_t *sptr, uint32_t length);
16static int nxt_cgo_add_port(nxt_unit_ctx_t *, nxt_unit_port_t *port);
17static void nxt_cgo_remove_port(nxt_unit_t *, nxt_unit_port_t *port);
1
2/*
3 * Copyright (C) Max Romanov
4 * Copyright (C) NGINX, Inc.
5 */
6
7#include "_cgo_export.h"
8
9#include <nxt_unit.h>
10#include <nxt_unit_request.h>
11
12
13static void nxt_cgo_request_handler(nxt_unit_request_info_t *req);
14static nxt_cgo_str_t *nxt_cgo_str_init(nxt_cgo_str_t *dst,
15 nxt_unit_sptr_t *sptr, uint32_t length);
16static int nxt_cgo_add_port(nxt_unit_ctx_t *, nxt_unit_port_t *port);
17static void nxt_cgo_remove_port(nxt_unit_t *, nxt_unit_port_t *port);
18static ssize_t nxt_cgo_port_send(nxt_unit_ctx_t *, nxt_unit_port_id_t *port_id,
18static ssize_t nxt_cgo_port_send(nxt_unit_ctx_t *, nxt_unit_port_t *port,
19 const void *buf, size_t buf_size, const void *oob, size_t oob_size);
19 const void *buf, size_t buf_size, const void *oob, size_t oob_size);
20static ssize_t nxt_cgo_port_recv(nxt_unit_ctx_t *, nxt_unit_port_id_t *port_id,
20static ssize_t nxt_cgo_port_recv(nxt_unit_ctx_t *, nxt_unit_port_t *port,
21 void *buf, size_t buf_size, void *oob, size_t oob_size);
22static void nxt_cgo_shm_ack_handler(nxt_unit_ctx_t *ctx);
23
24int
25nxt_cgo_run(uintptr_t handler)
26{
27 int rc;
28 nxt_unit_ctx_t *ctx;

--- 89 unchanged lines hidden (view full) ---

118static void
119nxt_cgo_remove_port(nxt_unit_t *unit, nxt_unit_port_t *port)
120{
121 nxt_go_remove_port(port->id.pid, port->id.id);
122}
123
124
125static ssize_t
21 void *buf, size_t buf_size, void *oob, size_t oob_size);
22static void nxt_cgo_shm_ack_handler(nxt_unit_ctx_t *ctx);
23
24int
25nxt_cgo_run(uintptr_t handler)
26{
27 int rc;
28 nxt_unit_ctx_t *ctx;

--- 89 unchanged lines hidden (view full) ---

118static void
119nxt_cgo_remove_port(nxt_unit_t *unit, nxt_unit_port_t *port)
120{
121 nxt_go_remove_port(port->id.pid, port->id.id);
122}
123
124
125static ssize_t
126nxt_cgo_port_send(nxt_unit_ctx_t *ctx, nxt_unit_port_id_t *port_id,
126nxt_cgo_port_send(nxt_unit_ctx_t *ctx, nxt_unit_port_t *port,
127 const void *buf, size_t buf_size, const void *oob, size_t oob_size)
128{
127 const void *buf, size_t buf_size, const void *oob, size_t oob_size)
128{
129 return nxt_go_port_send(port_id->pid, port_id->id,
129 return nxt_go_port_send(port->id.pid, port->id.id,
130 (void *) buf, buf_size, (void *) oob, oob_size);
131}
132
133
134static ssize_t
130 (void *) buf, buf_size, (void *) oob, oob_size);
131}
132
133
134static ssize_t
135nxt_cgo_port_recv(nxt_unit_ctx_t *ctx, nxt_unit_port_id_t *port_id,
135nxt_cgo_port_recv(nxt_unit_ctx_t *ctx, nxt_unit_port_t *port,
136 void *buf, size_t buf_size, void *oob, size_t oob_size)
137{
136 void *buf, size_t buf_size, void *oob, size_t oob_size)
137{
138 return nxt_go_port_recv(port_id->pid, port_id->id,
138 return nxt_go_port_recv(port->id.pid, port->id.id,
139 buf, buf_size, oob, oob_size);
140}
141
142
143static void
144nxt_cgo_shm_ack_handler(nxt_unit_ctx_t *ctx)
145{
146 return nxt_go_shm_ack_handler();

--- 64 unchanged lines hidden ---
139 buf, buf_size, oob, oob_size);
140}
141
142
143static void
144nxt_cgo_shm_ack_handler(nxt_unit_ctx_t *ctx)
145{
146 return nxt_go_shm_ack_handler();

--- 64 unchanged lines hidden ---