コード例 #1
0
static void
remove_server_watch (DBusWatch  *watch,
                     void       *data)
{
  ServerData *context = data;
  
  _dbus_loop_remove_watch (context->loop, watch);
}
コード例 #2
0
static void
remove_watch (DBusWatch *watch,
	      void      *data)
{
  CData *cd = data;
  
  _dbus_loop_remove_watch (cd->loop, watch);
}
コード例 #3
0
ファイル: bus.c プロジェクト: kobolabs/dbus
static void
remove_server_watch (DBusWatch  *watch,
                     void       *data)
{
  DBusServer *server = data;
  BusContext *context;

  context = server_get_context (server);

  _dbus_loop_remove_watch (context->loop, watch);
}
コード例 #4
0
ファイル: main.c プロジェクト: AByzhynar/sdl_core
static void
close_reload_pipe (DBusWatch **watch)
{
    _dbus_loop_remove_watch (bus_context_get_loop (context), *watch);
    _dbus_watch_invalidate (*watch);
    _dbus_watch_unref (*watch);
    *watch = NULL;

    _dbus_close_socket (reload_pipe[RELOAD_READ_END], NULL);
    reload_pipe[RELOAD_READ_END] = -1;

    _dbus_close_socket (reload_pipe[RELOAD_WRITE_END], NULL);
    reload_pipe[RELOAD_WRITE_END] = -1;
}
コード例 #5
0
ファイル: dir-watch-kqueue.c プロジェクト: darrengarvey/dbus
static void _shutdown_kqueue (void *data)
{
  int i;

  if (kq < 0)
    return;

  for (i = 0; i < MAX_DIRS_TO_WATCH; i++)
    {
      if (fds[i] >= 0)
        {
          close (fds[i]);
          fds[i] = -1;
        }
      if (dirs[i] != NULL)
        {
          /* dbus_free() is necessary to pass memleak check */
          dbus_free (dirs[i]);
          dirs[i] = NULL;
        }
    }

  if (loop)
    {
      _dbus_loop_remove_watch (loop, watch);
      _dbus_loop_unref (loop);
      loop = NULL;
    }

  if (watch)
    {
      _dbus_watch_invalidate (watch);
      _dbus_watch_unref (watch);
      watch = NULL;
    }

    close (kq);
    kq = -1;
}
コード例 #6
0
ファイル: dir-watch-kqueue.c プロジェクト: darrengarvey/dbus
static dbus_bool_t
_handle_kqueue_watch (DBusWatch *watch, unsigned int flags, void *data)
{
  struct kevent ev;
  struct timespec nullts = { 0, 0 };
  int res;
  pid_t pid;

  res = kevent (kq, NULL, 0, &ev, 1, &nullts);

  /* Sleep for half a second to avoid a race when files are install(1)'d
   * to system.d. */
  usleep(500000);

  if (res > 0)
    {
      pid = getpid ();
      _dbus_verbose ("Sending SIGHUP signal on reception of a kevent\n");
      (void) kill (pid, SIGHUP);
    }
  else if (res < 0 && errno == EBADF)
    {
      kq = -1;
      if (watch != NULL)
        {
          _dbus_loop_remove_watch (loop, watch);
          _dbus_watch_invalidate (watch);
          _dbus_watch_unref (watch);
          watch = NULL;
        }
      pid = getpid ();
      _dbus_verbose ("Sending SIGHUP signal since kqueue has been closed\n");
      (void) kill (pid, SIGHUP);
    }

  return TRUE;
}
コード例 #7
0
ファイル: dir-watch-kqueue.c プロジェクト: darrengarvey/dbus
static int
_init_kqueue (BusContext *context)
{
  if (kq < 0)
    {

      kq = kqueue ();
      if (kq < 0)
        {
          _dbus_warn ("Cannot create kqueue; error '%s'\n", _dbus_strerror (errno));
          goto out;
        }

      loop = bus_context_get_loop (context);
      _dbus_loop_ref (loop);

      watch = _dbus_watch_new (kq, DBUS_WATCH_READABLE, TRUE,
                               _handle_kqueue_watch, NULL, NULL);

      if (watch == NULL)
        {
          _dbus_warn ("Unable to create kqueue watch\n");
          goto out1;
        }

      if (!_dbus_loop_add_watch (loop, watch))
        {
          _dbus_warn ("Unable to add reload watch to main loop");
          goto out2;
        }

      if (!_dbus_register_shutdown_func (_shutdown_kqueue, NULL))
        {
          _dbus_warn ("Unable to register shutdown function");
          goto out3;
        }
    }

  return 1;

out3:
  _dbus_loop_remove_watch (loop, watch);

out2:
  if (watch)
    {
      _dbus_watch_invalidate (watch);
      _dbus_watch_unref (watch);
      watch = NULL;
    }

out1:
  if (kq >= 0)
    {
      close (kq);
      kq = -1;
    }
  if (loop)
    {
      _dbus_loop_unref (loop);
      loop = NULL;
    }

out:
  return 0;
}
コード例 #8
0
ファイル: test.c プロジェクト: 13824125580/hello-world
static void
remove_client_watch (DBusWatch      *watch,
                     void           *data)
{
  _dbus_loop_remove_watch (client_loop, watch);
}