Re: ioctl: No space left on device



Nat Friedman wrote:
> Hmm.  The error message sure could be clearer.

Pick a better one from `man errno` ? :)

Actually, something like the attached might be useful.

Daniel

Index: inotify-glue.c
===================================================================
RCS file: /cvs/gnome/beagle/glue/inotify-glue.c,v
retrieving revision 1.19
diff -u -B -p -r1.19 inotify-glue.c
--- inotify-glue.c	23 Mar 2005 20:21:49 -0000	1.19
+++ inotify-glue.c	22 Jun 2005 21:48:42 -0000
@@ -97,8 +96,19 @@ inotify_glue_watch (int fd, const char *
 	iwr.mask = mask;
 
 	wd = ioctl (fd, INOTIFY_WATCH, &iwr);
-	if (wd < 0)
+	if (wd < 0) {
+		switch (errno) {
+		case ENOSPC:
+			fprintf(stderr, "Maximum watch limit hit. Try adjusting /sys/class/misc/inotify/max_user_watches\n");
+			break;
+		case EFAULT:
+			fprintf(stderr, "This usually indicates an inotify version incompatibility.\n");
+			break;
+		default:
+			break;
+		}
 		perror ("ioctl");
+	}
 
 	if (close (file_fd))
 		perror ("close");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]