+instance_stdio(struct ustream *s, int prio, struct service_instance *in)
+{
+ char *newline, *str, *arg0, ident[32];
+ int len;
+
+ arg0 = basename(blobmsg_data(blobmsg_data(in->command)));
+ snprintf(ident, sizeof(ident), "%s[%d]", arg0, in->proc.pid);
+ ulog_open(ULOG_SYSLOG, LOG_DAEMON, ident);
+
+ do {
+ str = ustream_get_read_buf(s, NULL);
+ if (!str)
+ break;
+
+ newline = strchr(str, '\n');
+ if (!newline)
+ break;
+
+ *newline = 0;
+ ulog(prio, "%s\n", str);
+
+ len = newline + 1 - str;
+ ustream_consume(s, len);
+ } while (1);
+
+ ulog_open(ULOG_SYSLOG, LOG_DAEMON, "procd");
+}
+
+static void
+instance_stdout(struct ustream *s, int bytes)
+{
+ instance_stdio(s, LOG_INFO,
+ container_of(s, struct service_instance, _stdout.stream));
+}
+
+static void
+instance_stderr(struct ustream *s, int bytes)
+{
+ instance_stdio(s, LOG_ERR,
+ container_of(s, struct service_instance, _stderr.stream));
+}
+
+static void