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

Function lock

dpdk/lib/eal/linux/eal_memalloc.c:213–232  ·  view source on GitHub ↗

returns 1 on successful lock, 0 on unsuccessful lock, -1 on error */

Source from the content-addressed store, hash-verified

211
212/* returns 1 on successful lock, 0 on unsuccessful lock, -1 on error */
213static int lock(int fd, int type)
214{
215 int ret;
216
217 /* flock may be interrupted */
218 do {
219 ret = flock(fd, type | LOCK_NB);
220 } while (ret && errno == EINTR);
221
222 if (ret && errno == EWOULDBLOCK) {
223 /* couldn't lock */
224 return 0;
225 } else if (ret) {
226 RTE_LOG(ERR, EAL, "%s(): error calling flock(): %s\n",
227 __func__, strerror(errno));
228 return -1;
229 }
230 /* lock was successful */
231 return 1;
232}
233
234static int
235get_seg_memfd(struct hugepage_info *hi __rte_unused,

Callers 3

get_seg_fdFunction · 0.70
alloc_segFunction · 0.70
free_segFunction · 0.70

Calls 1

flockClass · 0.70

Tested by

no test coverage detected