MCPcopy Create free account
hub / github.com/F-Stack/f-stack / nvlist_send

Function nvlist_send

freebsd/contrib/libnv/nvlist.c:1255–1295  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1253
1254#ifndef _KERNEL
1255int
1256nvlist_send(int sock, const nvlist_t *nvl)
1257{
1258 size_t datasize, nfds;
1259 int *fds;
1260 void *data;
1261 int64_t fdidx;
1262 int ret;
1263
1264 if (nvlist_error(nvl) != 0) {
1265 ERRNO_SET(nvlist_error(nvl));
1266 return (-1);
1267 }
1268
1269 fds = nvlist_descriptors(nvl, &nfds);
1270 if (fds == NULL)
1271 return (-1);
1272
1273 ret = -1;
1274 fdidx = 0;
1275
1276 data = nvlist_xpack(nvl, &fdidx, &datasize);
1277 if (data == NULL)
1278 goto out;
1279
1280 if (buf_send(sock, data, datasize) == -1)
1281 goto out;
1282
1283 if (nfds > 0) {
1284 if (fd_send(sock, fds, nfds) == -1)
1285 goto out;
1286 }
1287
1288 ret = 0;
1289out:
1290 ERRNO_SAVE();
1291 nv_free(fds);
1292 nv_free(data);
1293 ERRNO_RESTORE();
1294 return (ret);
1295}
1296
1297nvlist_t *
1298nvlist_recv(int sock, int flags)

Callers 1

nvlist_xferFunction · 0.85

Calls 3

nvlist_errorFunction · 0.85
nvlist_descriptorsFunction · 0.85
nvlist_xpackFunction · 0.70

Tested by

no test coverage detected