X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flibudev%2Flibudev-monitor.c;h=b02ea8808cf949a41de9caca803dba7e7b859f01;hb=e68893075083a7461b1572233d23fdb23541d630;hp=96506fe580c73a8d74a2fafd844a9c2950456d1d;hpb=20bbd54f603994a3cc211d2795de16550882ed8d;p=elogind.git diff --git a/src/libudev/libudev-monitor.c b/src/libudev/libudev-monitor.c index 96506fe58..b02ea8808 100644 --- a/src/libudev/libudev-monitor.c +++ b/src/libudev/libudev-monitor.c @@ -1,13 +1,21 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008-2010 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ +/*** + This file is part of systemd. + + Copyright 2008-2012 Kay Sievers + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see . +***/ #include #include @@ -400,6 +408,7 @@ _public_ struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor * the bound socket will be closed, and the resources of the monitor * will be released. * + * Returns: the passed udev monitor if it has still an active reference, or #NULL otherwise. **/ _public_ struct udev_monitor *udev_monitor_unref(struct udev_monitor *udev_monitor) { @@ -493,6 +502,11 @@ tag: * * Only socket connections with uid=0 are accepted. * + * The monitor socket is by default set to NONBLOCK. A variant of poll() on + * the file descriptor returned by udev_monitor_get_fd() should to be used to + * wake up when new devices arrive, or alternatively the file descriptor + * switched into blocking mode. + * * The initial refcount is 1, and needs to be decremented to * release the resources of the udev device. * @@ -577,7 +591,7 @@ retry: nlh->magic, htonl(UDEV_MONITOR_MAGIC)); return NULL; } - if (nlh->properties_off+32 > buflen) + if (nlh->properties_off+32 > (size_t)buflen) return NULL; bufpos = nlh->properties_off; } else {