D-Bus 1.13.18

dbus-watch.c
1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2 /* dbus-watch.c DBusWatch implementation
3 *
4 * Copyright (C) 2002, 2003 Red Hat Inc.
5 *
6 * Licensed under the Academic Free License version 2.1
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 *
22 */
23
24 #include <config.h>
25 #include "dbus-internals.h"
26 #include "dbus-watch.h"
27 #include "dbus-list.h"
28
40 struct DBusWatch
41 {
42 int refcount;
43 DBusPollable fd;
44 unsigned int flags;
46 DBusWatchHandler handler;
47 void *handler_data;
48 DBusFreeFunction free_handler_data_function;
50 void *data;
51 DBusFreeFunction free_data_function;
52 unsigned int enabled : 1;
53 unsigned int oom_last_time : 1;
54 };
55
56 dbus_bool_t
57 _dbus_watch_get_enabled (DBusWatch *watch)
58 {
59 return watch->enabled;
60 }
61
62 dbus_bool_t
63 _dbus_watch_get_oom_last_time (DBusWatch *watch)
64 {
65 return watch->oom_last_time;
66 }
67
68 void
69 _dbus_watch_set_oom_last_time (DBusWatch *watch,
70 dbus_bool_t oom)
71 {
72 watch->oom_last_time = oom;
73 }
74
87 DBusWatch*
88 _dbus_watch_new (DBusPollable fd,
89 unsigned int flags,
90 dbus_bool_t enabled,
91 DBusWatchHandler handler,
92 void *data,
93 DBusFreeFunction free_data_function)
94 {
95 DBusWatch *watch;
96
97 #define VALID_WATCH_FLAGS (DBUS_WATCH_WRITABLE | DBUS_WATCH_READABLE)
98
99 _dbus_assert ((flags & VALID_WATCH_FLAGS) == flags);
100
101 watch = dbus_new0 (DBusWatch, 1);
102 if (watch == NULL)
103 return NULL;
104
105 watch->refcount = 1;
106 watch->fd = fd;
107 watch->flags = flags;
108 watch->enabled = enabled;
109
110 watch->handler = handler;
111 watch->handler_data = data;
112 watch->free_handler_data_function = free_data_function;
113
114 return watch;
115 }
116
123 DBusWatch *
124 _dbus_watch_ref (DBusWatch *watch)
125 {
126 watch->refcount += 1;
127
128 return watch;
129 }
130
137 void
138 _dbus_watch_unref (DBusWatch *watch)
139 {
140 _dbus_assert (watch != NULL);
141 _dbus_assert (watch->refcount > 0);
142
143 watch->refcount -= 1;
144 if (watch->refcount == 0)
145 {
146 if (_dbus_pollable_is_valid (watch->fd))
147 _dbus_warn ("this watch should have been invalidated");
148
149 dbus_watch_set_data (watch, NULL, NULL); /* call free_data_function */
150
151 if (watch->free_handler_data_function)
152 (* watch->free_handler_data_function) (watch->handler_data);
153
154 dbus_free (watch);
155 }
156 }
157
168 void
169 _dbus_watch_invalidate (DBusWatch *watch)
170 {
171 _dbus_pollable_invalidate (&watch->fd);
172 watch->flags = 0;
173 }
174
184 void
185 _dbus_watch_sanitize_condition (DBusWatch *watch,
186 unsigned int *condition)
187 {
188 if (!(watch->flags & DBUS_WATCH_READABLE))
189 *condition &= ~DBUS_WATCH_READABLE;
190 if (!(watch->flags & DBUS_WATCH_WRITABLE))
191 *condition &= ~DBUS_WATCH_WRITABLE;
192 }
193
194
214 struct DBusWatchList
215 {
216 DBusList *watches;
218 DBusAddWatchFunction add_watch_function;
219 DBusRemoveWatchFunction remove_watch_function;
220 DBusWatchToggledFunction watch_toggled_function;
221 void *watch_data;
222 DBusFreeFunction watch_free_data_function;
223 };
224
231 DBusWatchList*
232 _dbus_watch_list_new (void)
233 {
234 DBusWatchList *watch_list;
235
236 watch_list = dbus_new0 (DBusWatchList, 1);
237 if (watch_list == NULL)
238 return NULL;
239
240 return watch_list;
241 }
242
248 void
249 _dbus_watch_list_free (DBusWatchList *watch_list)
250 {
251 /* free watch_data and removes watches as a side effect */
252 _dbus_watch_list_set_functions (watch_list,
253 NULL, NULL, NULL, NULL, NULL);
254
255 _dbus_list_clear_full (&watch_list->watches,
256 (DBusFreeFunction) _dbus_watch_unref);
257
258 dbus_free (watch_list);
259 }
260
261 #ifdef DBUS_ENABLE_VERBOSE_MODE
262 static const char*
263 watch_flags_to_string (int flags)
264 {
265 const char *watch_type;
266
267 if ((flags & DBUS_WATCH_READABLE) &&
268 (flags & DBUS_WATCH_WRITABLE))
269 watch_type = "readwrite";
270 else if (flags & DBUS_WATCH_READABLE)
271 watch_type = "read";
272 else if (flags & DBUS_WATCH_WRITABLE)
273 watch_type = "write";
274 else
275 watch_type = "not read or write";
276 return watch_type;
277 }
278 #endif /* DBUS_ENABLE_VERBOSE_MODE */
279
294 dbus_bool_t
295 _dbus_watch_list_set_functions (DBusWatchList *watch_list,
296 DBusAddWatchFunction add_function,
297 DBusRemoveWatchFunction remove_function,
298 DBusWatchToggledFunction toggled_function,
299 void *data,
300 DBusFreeFunction free_data_function)
301 {
302 /* Add watches with the new watch function, failing on OOM */
303 if (add_function != NULL)
304 {
305 DBusList *link;
306
307 link = _dbus_list_get_first_link (&watch_list->watches);
308 while (link != NULL)
309 {
310 DBusList *next = _dbus_list_get_next_link (&watch_list->watches,
311 link);
312 #ifdef DBUS_ENABLE_VERBOSE_MODE
313 DBusWatch *watch = link->data;
314
315 _dbus_verbose ("Adding a %s watch on fd %" DBUS_POLLABLE_FORMAT " using newly-set add watch function\n",
316 watch_flags_to_string (dbus_watch_get_flags (link->data)),
317 _dbus_pollable_printable (watch->fd));
318 #endif
319
320 if (!(* add_function) (link->data, data))
321 {
322 /* remove it all again and return FALSE */
323 DBusList *link2;
324
325 link2 = _dbus_list_get_first_link (&watch_list->watches);
326 while (link2 != link)
327 {
328 DBusList *next2 = _dbus_list_get_next_link (&watch_list->watches,
329 link2);
330 #ifdef DBUS_ENABLE_VERBOSE_MODE
331 DBusWatch *watch2 = link2->data;
332
333 _dbus_verbose ("Removing watch on fd %" DBUS_POLLABLE_FORMAT " using newly-set remove function because initial add failed\n",
334 _dbus_pollable_printable (watch2->fd));
335 #endif
336
337 (* remove_function) (link2->data, data);
338
339 link2 = next2;
340 }
341
342 return FALSE;
343 }
344
345 link = next;
346 }
347 }
348
349 /* Remove all current watches from previous watch handlers */
350
351 if (watch_list->remove_watch_function != NULL)
352 {
353 _dbus_verbose ("Removing all pre-existing watches\n");
354
355 _dbus_list_foreach (&watch_list->watches,
356 (DBusForeachFunction) watch_list->remove_watch_function,
357 watch_list->watch_data);
358 }
359
360 if (watch_list->watch_free_data_function != NULL)
361 (* watch_list->watch_free_data_function) (watch_list->watch_data);
362
363 watch_list->add_watch_function = add_function;
364 watch_list->remove_watch_function = remove_function;
365 watch_list->watch_toggled_function = toggled_function;
366 watch_list->watch_data = data;
367 watch_list->watch_free_data_function = free_data_function;
368
369 return TRUE;
370 }
371
380 dbus_bool_t
381 _dbus_watch_list_add_watch (DBusWatchList *watch_list,
382 DBusWatch *watch)
383 {
384 if (!_dbus_list_append (&watch_list->watches, watch))
385 return FALSE;
386
387 _dbus_watch_ref (watch);
388
389 if (watch_list->add_watch_function != NULL)
390 {
391 _dbus_verbose ("Adding watch on fd %" DBUS_POLLABLE_FORMAT "\n",
392 _dbus_pollable_printable (watch->fd));
393
394 if (!(* watch_list->add_watch_function) (watch,
395 watch_list->watch_data))
396 {
397 _dbus_list_remove_last (&watch_list->watches, watch);
398 _dbus_watch_unref (watch);
399 return FALSE;
400 }
401 }
402
403 return TRUE;
404 }
405
413 void
414 _dbus_watch_list_remove_watch (DBusWatchList *watch_list,
415 DBusWatch *watch)
416 {
417 if (!_dbus_list_remove (&watch_list->watches, watch))
418 _dbus_assert_not_reached ("Nonexistent watch was removed");
419
420 if (watch_list->remove_watch_function != NULL)
421 {
422 _dbus_verbose ("Removing watch on fd %" DBUS_POLLABLE_FORMAT "\n",
423 _dbus_pollable_printable (watch->fd));
424
425 (* watch_list->remove_watch_function) (watch,
426 watch_list->watch_data);
427 }
428
429 _dbus_watch_unref (watch);
430 }
431
440 void
441 _dbus_watch_list_toggle_watch (DBusWatchList *watch_list,
442 DBusWatch *watch,
443 dbus_bool_t enabled)
444 {
445 enabled = !!enabled;
446
447 if (enabled == watch->enabled)
448 return;
449
450 watch->enabled = enabled;
451
452 if (watch_list->watch_toggled_function != NULL)
453 {
454 _dbus_verbose ("Toggling watch %p on fd %" DBUS_POLLABLE_FORMAT " to %d\n",
455 watch,
456 _dbus_pollable_printable (watch->fd),
457 watch->enabled);
458
459 (* watch_list->watch_toggled_function) (watch,
460 watch_list->watch_data);
461 }
462 }
463
471 void
472 _dbus_watch_list_toggle_all_watches (DBusWatchList *watch_list,
473 dbus_bool_t enabled)
474 {
475 DBusList *link;
476
477 for (link = _dbus_list_get_first_link (&watch_list->watches);
478 link != NULL;
479 link = _dbus_list_get_next_link (&watch_list->watches, link))
480 {
481 _dbus_watch_list_toggle_watch (watch_list, link->data, enabled);
482 }
483 }
484
497 void
498 _dbus_watch_set_handler (DBusWatch *watch,
499 DBusWatchHandler handler,
500 void *data,
501 DBusFreeFunction free_data_function)
502 {
503 if (watch->free_handler_data_function)
504 (* watch->free_handler_data_function) (watch->handler_data);
505
506 watch->handler = handler;
507 watch->handler_data = data;
508 watch->free_handler_data_function = free_data_function;
509 }
510
542 int
543 dbus_watch_get_fd (DBusWatch *watch)
544 {
545 _dbus_return_val_if_fail (watch != NULL, -1);
546
547 return dbus_watch_get_unix_fd(watch);
548 }
549
563 int
564 dbus_watch_get_unix_fd (DBusWatch *watch)
565 {
566 _dbus_return_val_if_fail (watch != NULL, -1);
567
568 /* FIXME remove #ifdef and do this on a lower level
569 * (watch should have set_socket and set_unix_fd and track
570 * which it has, and the transport should provide the
571 * appropriate watch type)
572 */
573 #ifdef DBUS_UNIX
574 return watch->fd;
575 #else
576 return dbus_watch_get_socket( watch );
577 #endif
578 }
579
592 int
593 dbus_watch_get_socket (DBusWatch *watch)
594 {
595 _dbus_return_val_if_fail (watch != NULL, -1);
596
597 #ifdef DBUS_UNIX
598 return watch->fd;
599 #else
600 return _dbus_socket_get_int (watch->fd);
601 #endif
602 }
603
604 DBusSocket
605 _dbus_watch_get_socket (DBusWatch *watch)
606 {
607 DBusSocket s;
608
609 _dbus_assert (watch != NULL);
610
611 #ifdef DBUS_UNIX
612 s.fd = watch->fd;
613 #else
614 s = watch->fd;
615 #endif
616
617 return s;
618 }
619
620 DBusPollable
621 _dbus_watch_get_pollable (DBusWatch *watch)
622 {
623 _dbus_assert (watch != NULL);
624
625 return watch->fd;
626 }
627
641 unsigned int
642 dbus_watch_get_flags (DBusWatch *watch)
643 {
644 _dbus_return_val_if_fail (watch != NULL, 0);
645 _dbus_assert ((watch->flags & VALID_WATCH_FLAGS) == watch->flags);
646
647 return watch->flags;
648 }
649
657 void*
658 dbus_watch_get_data (DBusWatch *watch)
659 {
660 _dbus_return_val_if_fail (watch != NULL, NULL);
661
662 return watch->data;
663 }
664
676 void
677 dbus_watch_set_data (DBusWatch *watch,
678 void *data,
679 DBusFreeFunction free_data_function)
680 {
681 _dbus_return_if_fail (watch != NULL);
682
683 _dbus_verbose ("Setting watch fd %" DBUS_POLLABLE_FORMAT " data to data = %p function = %p from data = %p function = %p\n",
684 _dbus_pollable_printable (watch->fd),
685 data, free_data_function, watch->data, watch->free_data_function);
686
687 if (watch->free_data_function != NULL)
688 (* watch->free_data_function) (watch->data);
689
690 watch->data = data;
691 watch->free_data_function = free_data_function;
692 }
693
701 dbus_bool_t
702 dbus_watch_get_enabled (DBusWatch *watch)
703 {
704 _dbus_return_val_if_fail (watch != NULL, FALSE);
705
706 return watch->enabled;
707 }
708
709
732 dbus_bool_t
733 dbus_watch_handle (DBusWatch *watch,
734 unsigned int flags)
735 {
736 _dbus_return_val_if_fail (watch != NULL, FALSE);
737
738 #ifndef DBUS_DISABLE_CHECKS
739 if (!_dbus_pollable_is_valid (watch->fd) || watch->flags == 0)
740 {
741 _dbus_warn_check_failed ("Watch is invalid, it should have been removed");
742 return TRUE;
743 }
744 #endif
745
746 _dbus_return_val_if_fail (_dbus_pollable_is_valid (watch->fd) /* fails if watch was removed */, TRUE);
747
748 _dbus_watch_sanitize_condition (watch, &flags);
749
750 if (flags == 0)
751 {
752 _dbus_verbose ("After sanitization, watch flags on fd %" DBUS_POLLABLE_FORMAT " were 0\n",
753 _dbus_pollable_printable (watch->fd));
754 return TRUE;
755 }
756 else
757 return (* watch->handler) (watch, flags,
758 watch->handler_data);
759 }
760
761
_dbus_watch_list_add_watch
dbus_bool_t _dbus_watch_list_add_watch(DBusWatchList *watch_list, DBusWatch *watch)
Adds a new watch to the watch list, invoking the application DBusAddWatchFunction if appropriate.
Definition: dbus-watch.c:381
_dbus_watch_list_new
DBusWatchList * _dbus_watch_list_new(void)
Creates a new watch list.
Definition: dbus-watch.c:232
DBusWatch::handler
DBusWatchHandler handler
Watch handler.
Definition: dbus-watch.c:46
_dbus_list_remove
dbus_bool_t _dbus_list_remove(DBusList **list, void *data)
Removes a value from the list.
Definition: dbus-list.c:416
DBusWatch::handler_data
void * handler_data
Watch handler data.
Definition: dbus-watch.c:47
_dbus_watch_list_remove_watch
void _dbus_watch_list_remove_watch(DBusWatchList *watch_list, DBusWatch *watch)
Removes a watch from the watch list, invoking the application's DBusRemoveWatchFunction if appropriat...
Definition: dbus-watch.c:414
DBusWatch::free_data_function
DBusFreeFunction free_data_function
Free the application data.
Definition: dbus-watch.c:51
dbus_watch_get_enabled
DBUS_EXPORT dbus_bool_t dbus_watch_get_enabled(DBusWatch *watch)
Returns whether a watch is enabled or not.
Definition: dbus-watch.c:702
DBusFreeFunction
void(* DBusFreeFunction)(void *memory)
Definition: dbus-memory.h:63
_dbus_watch_sanitize_condition
void _dbus_watch_sanitize_condition(DBusWatch *watch, unsigned int *condition)
Sanitizes the given condition so that it only contains flags that the DBusWatch requested.
Definition: dbus-watch.c:185
DBusWatch
Implementation of DBusWatch.
Definition: dbus-watch.c:41
DBusWatchList::watch_free_data_function
DBusFreeFunction watch_free_data_function
Free function for watch callback data.
Definition: dbus-watch.c:222
DBusWatch::flags
unsigned int flags
Conditions to watch.
Definition: dbus-watch.c:44
TRUE
#define TRUE
_dbus_list_append
dbus_bool_t _dbus_list_append(DBusList **list, void *data)
Appends a value to the list.
Definition: dbus-list.c:271
DBUS_WATCH_READABLE
@ DBUS_WATCH_READABLE
As in POLLIN.
Definition: dbus-connection.h:61
DBusWatchList::watches
DBusList * watches
Watch objects.
Definition: dbus-watch.c:216
DBusWatch::refcount
int refcount
Reference count.
Definition: dbus-watch.c:42
dbus_watch_set_data
DBUS_EXPORT void dbus_watch_set_data(DBusWatch *watch, void *data, DBusFreeFunction free_data_function)
Sets data which can be retrieved with dbus_watch_get_data().
Definition: dbus-watch.c:677
DBusWatchHandler
dbus_bool_t(* DBusWatchHandler)(DBusWatch *watch, unsigned int flags, void *data)
function to run when the watch is handled
Definition: dbus-watch.h:43
_dbus_list_clear_full
void _dbus_list_clear_full(DBusList **list, DBusFreeFunction function)
Free every link and every element in the list.
Definition: dbus-list.c:568
DBusAddWatchFunction
dbus_bool_t(* DBusAddWatchFunction)(DBusWatch *watch, void *data)
Called when libdbus needs a new watch to be monitored by the main loop.
Definition: dbus-connection.h:92
_dbus_watch_unref
void _dbus_watch_unref(DBusWatch *watch)
Decrements the reference count of a DBusWatch object and finalizes the object if the count reaches ze...
Definition: dbus-watch.c:138
dbus_free
void dbus_free(void *memory)
Frees a block of memory previously allocated by dbus_malloc() or dbus_malloc0().
Definition: dbus-memory.c:704
DBusWatchList::remove_watch_function
DBusRemoveWatchFunction remove_watch_function
Callback for removing a watch.
Definition: dbus-watch.c:219
_dbus_list_get_next_link
#define _dbus_list_get_next_link(list, link)
Definition: dbus-list.h:119
DBusWatch::data
void * data
Application data.
Definition: dbus-watch.c:50
dbus_watch_get_socket
DBUS_EXPORT int dbus_watch_get_socket(DBusWatch *watch)
Returns a socket to be watched, on UNIX this will return -1 if our transport is not socket-based so d...
Definition: dbus-watch.c:593
DBusSocket
Socket interface.
Definition: dbus-sysdeps.h:181
_dbus_list_remove_last
dbus_bool_t _dbus_list_remove_last(DBusList **list, void *data)
Removes a value from the list.
Definition: dbus-list.c:447
FALSE
#define FALSE
dbus_watch_get_unix_fd
DBUS_EXPORT int dbus_watch_get_unix_fd(DBusWatch *watch)
Returns a UNIX file descriptor to be watched, which may be a pipe, socket, or other type of descripto...
Definition: dbus-watch.c:564
DBusList::data
void * data
Data stored at this element.
Definition: dbus-list.h:38
_dbus_assert_not_reached
#define _dbus_assert_not_reached(explanation)
Definition: dbus-internals.h:164
DBusWatch::free_handler_data_function
DBusFreeFunction free_handler_data_function
Free the watch handler data.
Definition: dbus-watch.c:48
DBusWatchList
DBusWatchList implementation details.
Definition: dbus-watch.c:215
_dbus_list_foreach
void _dbus_list_foreach(DBusList **list, DBusForeachFunction function, void *data)
Calls the given function for each element in the list.
Definition: dbus-list.c:787
DBusWatchList::watch_toggled_function
DBusWatchToggledFunction watch_toggled_function
Callback on toggling enablement.
Definition: dbus-watch.c:220
DBusWatch::enabled
unsigned int enabled
Whether it's enabled.
Definition: dbus-watch.c:52
_dbus_watch_set_handler
void _dbus_watch_set_handler(DBusWatch *watch, DBusWatchHandler handler, void *data, DBusFreeFunction free_data_function)
Sets the handler for the watch.
Definition: dbus-watch.c:498
DBusWatchToggledFunction
void(* DBusWatchToggledFunction)(DBusWatch *watch, void *data)
Called when dbus_watch_get_enabled() may return a different value than it did before.
Definition: dbus-connection.h:98
_dbus_assert
#define _dbus_assert(condition)
Definition: dbus-internals.h:153
dbus_watch_get_fd
DBUS_EXPORT DBUS_DEPRECATED int dbus_watch_get_fd(DBusWatch *watch)
Deprecated former name of dbus_watch_get_unix_fd().
Definition: dbus-watch.c:543
_dbus_warn
void _dbus_warn(const char *format,...)
Prints a warning message to stderr.
Definition: dbus-internals.c:238
dbus_watch_get_data
DBUS_EXPORT void * dbus_watch_get_data(DBusWatch *watch)
Gets data previously set with dbus_watch_set_data() or NULL if none.
Definition: dbus-watch.c:658
_dbus_watch_list_free
void _dbus_watch_list_free(DBusWatchList *watch_list)
Frees a DBusWatchList.
Definition: dbus-watch.c:249
_dbus_watch_invalidate
void _dbus_watch_invalidate(DBusWatch *watch)
Clears the file descriptor from a now-invalid watch object so that no one tries to use it.
Definition: dbus-watch.c:169
dbus_watch_get_flags
DBUS_EXPORT unsigned int dbus_watch_get_flags(DBusWatch *watch)
Gets flags from DBusWatchFlags indicating what conditions should be monitored on the file descriptor.
Definition: dbus-watch.c:642
_dbus_watch_list_toggle_watch
void _dbus_watch_list_toggle_watch(DBusWatchList *watch_list, DBusWatch *watch, dbus_bool_t enabled)
Sets a watch to the given enabled state, invoking the application's DBusWatchToggledFunction if appro...
Definition: dbus-watch.c:441
_dbus_watch_list_set_functions
dbus_bool_t _dbus_watch_list_set_functions(DBusWatchList *watch_list, DBusAddWatchFunction add_function, DBusRemoveWatchFunction remove_function, DBusWatchToggledFunction toggled_function, void *data, DBusFreeFunction free_data_function)
Sets the watch functions.
Definition: dbus-watch.c:295
DBusList
Definition: dbus-list.h:35
dbus_watch_handle
DBUS_EXPORT dbus_bool_t dbus_watch_handle(DBusWatch *watch, unsigned int flags)
Called to notify the D-Bus library when a previously-added watch is ready for reading or writing,...
Definition: dbus-watch.c:733
DBusForeachFunction
void(* DBusForeachFunction)(void *element, void *data)
Definition: dbus-internals.h:322
_dbus_watch_list_toggle_all_watches
void _dbus_watch_list_toggle_all_watches(DBusWatchList *watch_list, dbus_bool_t enabled)
Sets all watches to the given enabled state, invoking the application's DBusWatchToggledFunction if a...
Definition: dbus-watch.c:472
DBusWatchList::add_watch_function
DBusAddWatchFunction add_watch_function
Callback for adding a watch.
Definition: dbus-watch.c:218
DBusWatch::oom_last_time
unsigned int oom_last_time
Whether it was OOM last time.
Definition: dbus-watch.c:53
DBusWatch::fd
DBusPollable fd
File descriptor.
Definition: dbus-watch.c:43
DBusRemoveWatchFunction
void(* DBusRemoveWatchFunction)(DBusWatch *watch, void *data)
Called when libdbus no longer needs a watch to be monitored by the main loop.
Definition: dbus-connection.h:104
_dbus_watch_ref
DBusWatch * _dbus_watch_ref(DBusWatch *watch)
Increments the reference count of a DBusWatch object.
Definition: dbus-watch.c:124
DBusWatchList::watch_data
void * watch_data
Data for watch callbacks.
Definition: dbus-watch.c:221
dbus_new0
#define dbus_new0(type, count)
Definition: dbus-memory.h:58
_dbus_watch_new
DBusWatch * _dbus_watch_new(DBusPollable fd, unsigned int flags, dbus_bool_t enabled, DBusWatchHandler handler, void *data, DBusFreeFunction free_data_function)
Creates a new DBusWatch.
Definition: dbus-watch.c:88
DBUS_WATCH_WRITABLE
@ DBUS_WATCH_WRITABLE
As in POLLOUT.
Definition: dbus-connection.h:62
_dbus_list_get_first_link
DBusList * _dbus_list_get_first_link(DBusList **list)
Gets the first link in the list.
Definition: dbus-list.c:595
_dbus_warn_check_failed
void _dbus_warn_check_failed(const char *format,...)
Prints a "critical" warning to stderr when an assertion fails; differs from _dbus_warn primarily in t...
Definition: dbus-internals.c:270
dbus_bool_t
dbus_uint32_t dbus_bool_t
Definition: dbus-types.h:35
NULL
#define NULL