1 /* __LICENSE_HEADER_BEGIN__ */
4 * Copyright (C) 2012 Emmanuel Roullit <emmanuel.roullit@gmail.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
22 /* __LICENSE_HEADER_END__ */
29 #include <dabba/ipc.h>
31 int dabba_ipc_msg(struct dabba_ipc_msg
*msg
)
39 qid
= dabba_get_ipc_queue_id(0660);
42 perror("Cannot get IPC id");
46 snd
= msgsnd(qid
, msg
, sizeof(msg
->msg_body
), 0);
49 perror("Error while sending IPC msg");
55 rcv
= msgrcv(qid
, msg
, sizeof(msg
->msg_body
), 0, 0);
58 perror("Error while receiving IPC msg");
62 if (msg
->msg_body
.error
!= 0) {
63 printf("The daemon reported: %s\n",
64 strerror(msg
->msg_body
.error
));
65 return msg
->msg_body
.error
;