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

Function NgNameNode

tools/libnetgraph/sock.c:192–213  ·  view source on GitHub ↗

* Assign a globally unique name to a node * Returns -1 if error and sets errno. */

Source from the content-addressed store, hash-verified

190 * Returns -1 if error and sets errno.
191 */
192int
193NgNameNode(int cs, const char *path, const char *fmt, ...)
194{
195 struct ngm_name ngn;
196 va_list args;
197
198 /* Build message arg */
199 va_start(args, fmt);
200 vsnprintf(ngn.name, sizeof(ngn.name), fmt, args);
201 va_end(args);
202
203 /* Send message */
204 if (NgSendMsg(cs, path,
205 NGM_GENERIC_COOKIE, NGM_NAME, &ngn, sizeof(ngn)) < 0) {
206 if (_gNgDebugLevel >= 1)
207 NGLOGX("%s: failed", __func__);
208 return (-1);
209 }
210
211 /* Done */
212 return (0);
213}
214
215/*
216 * Read a packet from a data socket

Callers

nothing calls this directly

Calls 2

vsnprintfFunction · 0.85
NgSendMsgFunction · 0.85

Tested by

no test coverage detected