doc: remove outdated list of supported OS
[dpdk.git] / examples / l2fwd-keepalive / shm.c
index 66fc433..fbf5bd7 100644 (file)
@@ -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");
+}