View | Details | Raw Unified
Collapse All | Expand All

(-) beagle-0.0.8.1.old/glue/inotify-glue.c (-6 / +9 lines)
 Lines 85-104    Link Here 
inotify_glue_watch (int fd, const char *filename, __u32 mask)
inotify_glue_watch (int fd, const char *filename, __u32 mask)
{
{
	struct inotify_watch_request iwr;
	struct inotify_watch_request iwr;
	__s32 wd;
	int file_fd, wd;
	iwr.mask = mask;
	file_fd = open (filename, O_RDONLY);
	iwr.name = strdup (filename);
	if (file_fd < 0) {
	if (!iwr.name) {
		perror ("open");
		perror ("strdup");
		return -1;
		return -1;
	}
	}
	iwr.fd = file_fd;
	iwr.mask = mask;
	wd = ioctl (fd, INOTIFY_WATCH, &iwr);
	wd = ioctl (fd, INOTIFY_WATCH, &iwr);
	if (wd < 0)
	if (wd < 0)
		perror ("ioctl");
		perror ("ioctl");
	free (iwr.name);
	if (close (file_fd))
		perror ("close");
	return wd;
	return wd;
}
}
(-) beagle-0.0.8.1.old/glue/inotify.h (-1 / +1 lines)
 Lines 30-36    Link Here 
 * Pass to the inotify device via the INOTIFY_WATCH ioctl
 * Pass to the inotify device via the INOTIFY_WATCH ioctl
 */
 */
struct inotify_watch_request {
struct inotify_watch_request {
	char		*name;		/* filename name */
	int		fd		/* fd of filename to watch */
	__u32		mask;		/* event mask */
	__u32		mask;		/* event mask */
};
};