+/*
+ * Copyright (C) 2009 Pierre-Marc Fournier
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
#define _GNU_SOURCE
#include <sys/types.h>
struct buffer_info {
char *name;
pid_t pid;
+ struct ustcomm_connection conn;
int shmid;
void *mem;
buf->name = bufname;
buf->pid = pid;
+ /* connect to app */
+ result = ustcomm_connect_app(buf->pid, &buf->conn);
+ if(result) {
+ ERR("unable to connect to process");
+ return -1;
+ }
+
/* get shmid */
asprintf(&send_msg, "get_shmid %s", buf->name);
- send_message(pid, send_msg, &received_msg);
+ ustcomm_send_request(&buf->conn, send_msg, &received_msg);
free(send_msg);
DBG("got buffer name %s", buf->name);
/* get n_subbufs */
asprintf(&send_msg, "get_n_subbufs %s", buf->name);
- send_message(pid, send_msg, &received_msg);
+ ustcomm_send_request(&buf->conn, send_msg, &received_msg);
free(send_msg);
result = sscanf(received_msg, "%d", &buf->n_subbufs);
/* get subbuf size */
asprintf(&send_msg, "get_subbuf_size %s", buf->name);
- send_message(pid, send_msg, &received_msg);
+ ustcomm_send_request(&buf->conn, send_msg, &received_msg);
free(send_msg);
result = sscanf(received_msg, "%d", &buf->subbuf_size);