+ DBG("Handling create session message");
+ memset(&lur, 0, sizeof(lur));
+ lur.cmd_type = LTTNG_CREATE_SESSION;
+
+ /* ... */
+ ret = 0;
+
+ if (!ret)
+ lur.ret_code = LTTCOMM_OK;
+ else
+ lur.ret_code = LTTCOMM_SESSION_FAIL;
+ lur.u.session.handle = 42;
+ len = lttcomm_send_unix_sock(sock, &lur, sizeof(lur));
+ switch (len) {
+ case sizeof(lur):
+ printf("message successfully sent\n");
+ break;
+ case -1:
+ if (errno == ECONNRESET) {
+ printf("remote end closed connection\n");
+ return 0;
+ }
+ return -1;
+ default:
+ printf("incorrect message size: %zd\n", len);
+ return -1;
+ }