X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Fl2fwd-keepalive%2Fshm.c;h=fbf5bd795583bc47ceb20db6a1f9b2fc97f29e34;hb=7236d2bfe0acc48330e3c2a3dfac4ada9a792cd8;hp=66fc433bb7d539b4794bf7833efe15028ce71d2d;hpb=7b2a704c4e84dcc11ffa381293d2c3d686a999b8;p=dpdk.git diff --git a/examples/l2fwd-keepalive/shm.c b/examples/l2fwd-keepalive/shm.c index 66fc433bb7..fbf5bd7955 100644 --- a/examples/l2fwd-keepalive/shm.c +++ b/examples/l2fwd-keepalive/shm.c @@ -80,6 +80,8 @@ struct rte_keepalive_shm *rte_keepalive_shm_create(void) RTE_LOG(INFO, EAL, "Failed to setup SHM semaphore (%s)\n", strerror(errno)); + munmap(ka_shm, + sizeof(struct rte_keepalive_shm)); return NULL; } @@ -127,3 +129,13 @@ void rte_keepalive_relayed_state(struct rte_keepalive_shm *shm, strerror(errno)); } } + +void rte_keepalive_shm_cleanup(struct rte_keepalive_shm *ka_shm) +{ + if (shm_unlink(RTE_KEEPALIVE_SHM_NAME) == -1 && errno != ENOENT) + printf("Warning: Error unlinking %s (%s)\n", + RTE_KEEPALIVE_SHM_NAME, strerror(errno)); + + if (ka_shm && munmap(ka_shm, sizeof(struct rte_keepalive_shm)) != 0) + printf("Warning: munmap() failed\n"); +}