summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schlemmer <azarah@gentoo.org>2004-08-22 22:43:17 +0000
committerMartin Schlemmer <azarah@gentoo.org>2004-08-22 22:43:17 +0000
commite59c4fc66de1985af3359be71ffc41614bc9f62f (patch)
tree8743bb87b28973cc3869079421a83ef7f8061661 /app-admin/gamin/files
parentStable on sparc. (Manifest recommit) (diff)
downloadgentoo-2-e59c4fc66de1985af3359be71ffc41614bc9f62f.tar.gz
gentoo-2-e59c4fc66de1985af3359be71ffc41614bc9f62f.tar.bz2
gentoo-2-e59c4fc66de1985af3359be71ffc41614bc9f62f.zip
Add runtime-backend-select.patch to select between inotify/dnotify/poll at run
time. Add inotify header, and fixup build to use a local copy.
Diffstat (limited to 'app-admin/gamin/files')
-rw-r--r--app-admin/gamin/files/digest-gamin-0.0.6-r11
-rw-r--r--app-admin/gamin/files/gamin-0.0.6-inotify_h-include.patch11
-rw-r--r--app-admin/gamin/files/gamin-0.0.6-runtime-backend-select.patch121
-rw-r--r--app-admin/gamin/files/inotify-0.8.1.h74
4 files changed, 207 insertions, 0 deletions
diff --git a/app-admin/gamin/files/digest-gamin-0.0.6-r1 b/app-admin/gamin/files/digest-gamin-0.0.6-r1
new file mode 100644
index 000000000000..8254b2729611
--- /dev/null
+++ b/app-admin/gamin/files/digest-gamin-0.0.6-r1
@@ -0,0 +1 @@
+MD5 8f8841ed896cd11a96ad2089ab7326b8 gamin-0.0.6.tar.gz 385972
diff --git a/app-admin/gamin/files/gamin-0.0.6-inotify_h-include.patch b/app-admin/gamin/files/gamin-0.0.6-inotify_h-include.patch
new file mode 100644
index 000000000000..bf65b20bac9a
--- /dev/null
+++ b/app-admin/gamin/files/gamin-0.0.6-inotify_h-include.patch
@@ -0,0 +1,11 @@
+--- gamin-0.0.6/server/gam_inotify.c 2004-08-23 00:16:20.821374728 +0200
++++ gamin-0.0.6.az/server/gam_inotify.c 2004-08-23 00:16:31.835700296 +0200
+@@ -27,7 +27,7 @@
+ #include <unistd.h>
+ #include <stdio.h>
+ #include <glib.h>
+-#include "/usr/src/linux/include/linux/inotify.h"
++#include "inotify.h"
+ #include "gam_error.h"
+ #include "gam_inotify.h"
+ #include "gam_tree.h"
diff --git a/app-admin/gamin/files/gamin-0.0.6-runtime-backend-select.patch b/app-admin/gamin/files/gamin-0.0.6-runtime-backend-select.patch
new file mode 100644
index 000000000000..3dd51c219512
--- /dev/null
+++ b/app-admin/gamin/files/gamin-0.0.6-runtime-backend-select.patch
@@ -0,0 +1,121 @@
+diff -urN gamin-0.0.6/server/gam_server.c gamin-0.0.6.az/server/gam_server.c
+--- gamin-0.0.6/server/gam_server.c 2004-08-19 12:54:45.000000000 +0200
++++ gamin-0.0.6.az/server/gam_server.c 2004-08-23 00:22:48.136493880 +0200
+@@ -41,6 +41,7 @@
+ #endif
+
+ static const char *session;
++static int gam_backend;
+
+ /**
+ * gam_shutdown:
+@@ -63,13 +64,36 @@
+ gboolean
+ gam_init_subscriptions(void)
+ {
++ gboolean ret;
++
++ gam_backend = 0;
++
+ #ifdef USE_INOTIFY
+- return (gam_inotify_init());
+-#elif linux
+- return (gam_dnotify_init());
+-#else
+- return (gam_poll_init());
++ if ((!gam_backend) && (ret = gam_inotify_init())) {
++ gam_backend = BACKEND_INOTIFY;
++ gam_debug(DEBUG_INFO, "Using INotify as backend\n");
++ return ret;
++ }
+ #endif
++#ifdef linux
++ if ((!gam_backend) && (ret = gam_dnotify_init())) {
++ gam_backend = BACKEND_DNOTIFY;
++ gam_debug(DEBUG_INFO, "Using DNotify as backend\n");
++ return ret;
++ }
++#endif
++ if (!gam_backend) {
++ ret = gam_poll_init();
++ if (ret) {
++ gam_backend = BACKEND_POLL;
++ gam_debug(DEBUG_INFO, "Using Poll as backend\n");
++ }
++ return ret;
++ }
++
++ gam_debug(DEBUG_INFO, "Cannot initialize any backend\n");
++
++ return FALSE;
+ }
+
+ /**
+@@ -113,13 +137,21 @@
+ return (gam_poll_add_subscription(sub));
+ }
+ ***/
++ switch (gam_backend) {
+ #ifdef USE_INOTIFY
+- return (gam_inotify_add_subscription(sub));
+-#elif linux
+- return (gam_dnotify_add_subscription(sub));
+-#else
+- return (gam_poll_add_subscription(sub));
++ case BACKEND_INOTIFY:
++ return (gam_inotify_add_subscription(sub));
++ break;
+ #endif
++#ifdef linux
++ case BACKEND_DNOTIFY:
++ return (gam_dnotify_add_subscription(sub));
++ break;
++#endif
++ case BACKEND_POLL:
++ return (gam_poll_add_subscription(sub));
++ break;
++ }
+ }
+
+ /**
+@@ -132,13 +164,21 @@
+ gboolean
+ gam_remove_subscription(GamSubscription * sub)
+ {
++ switch (gam_backend) {
+ #ifdef USE_INOTIFY
+- return (gam_inotify_remove_subscription(sub));
+-#elif linux
+- return (gam_dnotify_remove_subscription(sub));
+-#else
+- return (gam_poll_remove_subscription(sub));
++ case BACKEND_INOTIFY:
++ return (gam_inotify_remove_subscription(sub));
++ break;
++#endif
++#ifdef linux
++ case BACKEND_DNOTIFY:
++ return (gam_dnotify_remove_subscription(sub));
++ break;
+ #endif
++ case BACKEND_POLL:
++ return (gam_poll_remove_subscription(sub));
++ break;
++ }
+ }
+
+ /**
+diff -urN gamin-0.0.6/server/gam_server.h gamin-0.0.6.az/server/gam_server.h
+--- gamin-0.0.6/server/gam_server.h 2004-08-19 12:51:57.000000000 +0200
++++ gamin-0.0.6.az/server/gam_server.h 2004-08-23 00:20:01.420838512 +0200
+@@ -9,6 +9,10 @@
+ extern "C" {
+ #endif
+
++#define BACKEND_INOTIFY 1
++#define BACKEND_DNOTIFY 2
++#define BACKEND_POLL 3
++
+ gboolean gam_init_subscriptions (void);
+ gboolean gam_add_subscription (GamSubscription *sub);
+ gboolean gam_remove_subscription (GamSubscription *sub);
diff --git a/app-admin/gamin/files/inotify-0.8.1.h b/app-admin/gamin/files/inotify-0.8.1.h
new file mode 100644
index 000000000000..a6f9e86d7abf
--- /dev/null
+++ b/app-admin/gamin/files/inotify-0.8.1.h
@@ -0,0 +1,74 @@
+/*
+ * Inode based directory notification for Linux
+ *
+ * Copyright (C) 2004 John McCutchan
+ *
+ * Signed-off-by: John McCutchan ttb@tentacle.dhs.org
+ */
+
+#ifndef _LINUX_INOTIFY_H
+#define _LINUX_INOTIFY_H
+
+struct inode;
+struct dentry;
+struct super_block;
+
+struct inotify_event {
+ int wd;
+ int mask;
+ char filename[256];
+ /* When you are watching a directory you will get the filenames
+ * for events like IN_CREATE, IN_DELETE, IN_OPEN, IN_CLOSE, etc..
+ */
+};
+/* When reading from the device you must provide a buffer
+ * that is a multiple of the sizeof(inotify_event)
+ */
+
+#define IN_ACCESS 0x00000001 /* File was accessed */
+#define IN_MODIFY 0x00000002 /* File was modified */
+#define IN_CREATE 0x00000004 /* File was created */
+#define IN_DELETE 0x00000008 /* File was deleted */
+#define IN_RENAME 0x00000010 /* File was renamed */
+#define IN_ATTRIB 0x00000020 /* File changed attributes */
+#define IN_MOVE 0x00000040 /* File was moved */
+#define IN_UNMOUNT 0x00000080 /* Device file was on, was unmounted */
+#define IN_CLOSE 0x00000100 /* File was closed */
+#define IN_OPEN 0x00000200 /* File was opened */
+#define IN_IGNORED 0x00000400 /* File was ignored */
+#define IN_ALL_EVENTS 0xffffffff /* All the events */
+
+/* ioctl */
+
+/* Fill this and pass it to INOTIFY_WATCH ioctl */
+struct inotify_watch_request {
+ char *dirname; // directory name
+ unsigned long mask; // event mask
+};
+
+#define INOTIFY_IOCTL_MAGIC 'Q'
+#define INOTIFY_IOCTL_MAXNR 4
+
+#define INOTIFY_WATCH _IOR(INOTIFY_IOCTL_MAGIC, 1, struct inotify_watch_request)
+#define INOTIFY_IGNORE _IOR(INOTIFY_IOCTL_MAGIC, 2, int)
+#define INOTIFY_STATS _IOR(INOTIFY_IOCTL_MAGIC, 3, int)
+#define INOTIFY_SETDEBUG _IOR(INOTIFY_IOCTL_MAGIC, 4, int)
+
+#define INOTIFY_DEBUG_NONE 0x00000000
+#define INOTIFY_DEBUG_ALLOC 0x00000001
+#define INOTIFY_DEBUG_EVENTS 0x00000002
+#define INOTIFY_DEBUG_INODE 0x00000004
+#define INOTIFY_DEBUG_ERRORS 0x00000008
+#define INOTIFY_DEBUG_FILEN 0x00000010
+#define INOTIFY_DEBUG_ALL 0xffffffff
+
+/* Kernel API */
+/* Adds events to all watchers on inode that are interested in mask */
+void inotify_inode_queue_event (struct inode *inode, unsigned long mask, const char *filename);
+/* Same as above but uses dentry's inode */
+void inotify_dentry_parent_queue_event (struct dentry *dentry, unsigned long mask, const char *filename);
+/* This will remove all watchers from all inodes on the superblock */
+void inotify_super_block_umount (struct super_block *sb);
+
+#endif
+