vpp-api: Add context to VPPStatsIOError.
* Provide context information and return meaningful information.
VPPStatsIOError: Stat segment client connection returned: -2 Stat client socket open but couldn't connect.
Change-Id: I14ea35c58452a2cb7598a7efd136f0c7e1f5743a
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
diff --git a/src/vpp-api/client/stat_client.c b/src/vpp-api/client/stat_client.c
index bb7f240..2cf53d5 100644
--- a/src/vpp-api/client/stat_client.c
+++ b/src/vpp-api/client/stat_client.c
@@ -124,14 +124,14 @@
0)
{
close (sock);
- return -1;
+ return -2;
}
if ((mfd = recv_fd (sock)) < 0)
{
close (sock);
fprintf (stderr, "Receiving file descriptor failed\n");
- return -1;
+ return -3;
}
close (sock);
@@ -142,13 +142,13 @@
if (fstat (mfd, &st) == -1)
{
perror ("mmap fstat failed");
- return -1;
+ return -4;
}
if ((memaddr =
mmap (NULL, st.st_size, PROT_READ, MAP_SHARED, mfd, 0)) == MAP_FAILED)
{
perror ("mmap map failed");
- return -1;
+ return -5;
}
sm->memory_size = st.st_size;