MCPcopy Create free account
hub / github.com/ElementsProject/lightning / run_child

Function run_child

ccan/ccan/ptr_valid/ptr_valid.c:178–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178static void run_child(int infd, int outfd)
179{
180 volatile char *p;
181
182 /* This is how we expect to exit. */
183 while (read(infd, &p, sizeof(p)) == sizeof(p)) {
184 size_t i, size;
185 bool is_write;
186 char ret = 0;
187
188 /* This is weird. */
189 if (read(infd, &size, sizeof(size)) != sizeof(size))
190 _exit(1);
191 if (read(infd, &is_write, sizeof(is_write)) != sizeof(is_write))
192 _exit(2);
193
194 for (i = 0; i < size; i++) {
195 ret = p[i];
196 if (is_write)
197 p[i] = ret;
198 }
199
200 /* If we're still here, the answer is "yes". */
201 if (write(outfd, &ret, 1) != 1)
202 _exit(3);
203 }
204 _exit(0);
205}
206
207static bool create_child(struct ptr_valid_batch *batch)
208{

Callers 1

create_childFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected