2 * Mock version of dbus-launch, for gdbus-unix-addresses test
4 * Copyright © 2015 Collabora Ltd.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General
17 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
23 #error This is a Unix-specific test helper
28 #include <sys/types.h>
31 #define ME "GDBus mock version of dbus-launch"
34 write_all (const void *ptr,
41 ssize_t done = write (STDOUT_FILENO, p, len);
45 g_error ("%s: write: EOF", ME);
52 g_error ("%s: write: %s", ME, g_strerror (errno));
56 if (len < (size_t) done)
57 g_error ("%s: wrote too many bytes?", ME);
70 long window_id = 0x42424242;
71 const char *addr = "hello:this=address-is-from-the,mock=dbus-launch";
73 write_all (addr, strlen (addr) + 1);
74 write_all (&pid, sizeof (pid));
75 write_all (&window_id, sizeof (window_id));