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

Function netisr_load_kvm_string

tools/netstat/netisr.c:114–126  ·  view source on GitHub ↗

* Load a nul-terminated string from KVM up to 'limit', guarantee that the * string in local memory is nul-terminated. */

Source from the content-addressed store, hash-verified

112 * string in local memory is nul-terminated.
113 */
114static void
115netisr_load_kvm_string(uintptr_t addr, char *dest, u_int limit)
116{
117 u_int i;
118
119 for (i = 0; i < limit; i++) {
120 if (kread(addr + i, &dest[i], sizeof(dest[i])) != 0)
121 xo_errx(-1, "%s: kread()", __func__);
122 if (dest[i] == '\0')
123 break;
124 }
125 dest[limit - 1] = '\0';
126}
127#endif
128
129static const char *

Callers 1

netisr_load_kvm_protoFunction · 0.85

Calls 2

xo_errxFunction · 0.85
kreadFunction · 0.70

Tested by

no test coverage detected