Add close unix socket function to libcomm API
[lttng-tools.git] / liblttsessiondcomm / liblttsessiondcomm.c
index 0e9c290fed0ca96453a8cbee96f00efd0e8c5203..8413f6b08eb6c0aa863e5bf2028eae0281419421 100644 (file)
@@ -226,3 +226,21 @@ ssize_t lttcomm_send_unix_sock(int sock, void *buf, size_t len)
 
        return ret;
 }
+
+/*
+ *  lttcomm_close_unix_sock
+ *
+ *  Shutdown cleanly a unix socket.
+ */
+int lttcomm_close_unix_sock(int sock)
+{
+       int ret;
+
+       /* Shutdown receptions and transmissions */
+       ret = shutdown(sock, SHUT_RDWR);
+       if (ret < 0) {
+               perror("shutdown");
+       }
+
+       return ret;
+}
This page took 0.022616 seconds and 4 git commands to generate.