+ char path[UNIX_PATH_MAX];
+
+ result = snprintf(path, UNIX_PATH_MAX, "%s/%d", SOCK_DIR, pid);
+ if(result >= UNIX_PATH_MAX) {
+ fprintf(stderr, "string overflow allocating socket name");
+ return -1;
+ }
+
+ send_message_path(path, msg, reply, pid);
+
+ return 0;
+}
+
+/* Called by an app to ask the consumer daemon to connect to it. */
+
+int ustcomm_request_consumer(pid_t pid, const char *channel)
+{
+ char path[UNIX_PATH_MAX];
+ int result;
+ char *msg;
+
+ result = snprintf(path, UNIX_PATH_MAX, "%s/ustd", SOCK_DIR);
+ if(result >= UNIX_PATH_MAX) {
+ fprintf(stderr, "string overflow allocating socket name");
+ return -1;
+ }
+
+ asprintf(&msg, "collect %d %s", pid, channel);
+
+ send_message_path(path, msg, NULL, -1);
+ free(msg);
+
+ return 0;
+}
+
+static int recv_message_fd(int fd, char **msg, struct ustcomm_source *src)
+{
+ int result;
+ size_t initial_addrlen,addrlen;