udev-watch.c revision 3d3a0a709a38805259fe07240c3ca47a120dd5d6
/*
* Copyright (C) 2004-2008 Kay Sievers <kay.sievers@vrfy.org>
* Copyright (C) 2009 Canonical Ltd.
* Copyright (C) 2009 Scott James Remnant <scott@netsplit.com>
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <dirent.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#ifdef HAVE_INOTIFY
#endif
#include "udev.h"
int inotify_fd = -1;
/* inotify descriptor, will be shared with rules directory;
* set to cloexec since we need our children to be able to add
* watches for us
*/
{
inotify_fd = inotify_init();
if (inotify_fd >= 0) {
int flags;
if (flags < 0)
flags = FD_CLOEXEC;
else
flags |= FD_CLOEXEC;
else
}
/* move any old watches directory out of the way, and then restore
* the watches
*/
{
if (inotify_fd < 0)
return;
return;
}
char path[UTIL_PATH_SIZE];
char buf[UTIL_PATH_SIZE];
struct udev_device *dev;
continue;
if (len <= 0) {
continue;
}
continue;
}
}
}
}
{
char filename[UTIL_PATH_SIZE];
int wd;
if (inotify_fd < 0)
return;
if (wd < 0) {
}
}
{
int wd;
char filename[UTIL_PATH_SIZE];
if (inotify_fd < 0)
return;
if (wd < 0)
return;
}
{
char filename[UTIL_PATH_SIZE];
char buf[UTIL_PATH_SIZE];
if (inotify_fd < 0 || wd < 0)
return NULL;
if (len > 0) {
}
return NULL;
}