nxt_cgo_lib.c (1323:6dfc9895e25e) nxt_cgo_lib.c (1543:42f27153db91)
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);
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_ctx_t *, nxt_unit_port_id_t *port_id);
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,
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,
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)

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

103
104
105static int
106nxt_cgo_add_port(nxt_unit_ctx_t *ctx, nxt_unit_port_t *port)
107{
108 nxt_go_add_port(port->id.pid, port->id.id,
109 port->in_fd, port->out_fd);
110
18static ssize_t nxt_cgo_port_send(nxt_unit_ctx_t *, nxt_unit_port_id_t *port_id,
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,
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)

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

103
104
105static int
106nxt_cgo_add_port(nxt_unit_ctx_t *ctx, nxt_unit_port_t *port)
107{
108 nxt_go_add_port(port->id.pid, port->id.id,
109 port->in_fd, port->out_fd);
110
111 return nxt_unit_add_port(ctx, port);
111 port->in_fd = -1;
112 port->out_fd = -1;
113
114 return NXT_UNIT_OK;
112}
113
114
115static void
115}
116
117
118static void
116nxt_cgo_remove_port(nxt_unit_ctx_t *ctx, nxt_unit_port_id_t *port_id)
119nxt_cgo_remove_port(nxt_unit_t *unit, nxt_unit_port_t *port)
117{
120{
118 nxt_go_remove_port(port_id->pid, port_id->id);
119
120 nxt_unit_remove_port(ctx, port_id);
121 nxt_go_remove_port(port->id.pid, port->id.id);
121}
122
123
124static ssize_t
125nxt_cgo_port_send(nxt_unit_ctx_t *ctx, nxt_unit_port_id_t *port_id,
126 const void *buf, size_t buf_size, const void *oob, size_t oob_size)
127{
128 return nxt_go_port_send(port_id->pid, port_id->id,

--- 81 unchanged lines hidden ---
122}
123
124
125static ssize_t
126nxt_cgo_port_send(nxt_unit_ctx_t *ctx, nxt_unit_port_id_t *port_id,
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,

--- 81 unchanged lines hidden ---