Commit Graph

42 Commits

Author SHA1 Message Date
Ryan Lortie
700677de51 inotify: stop using constructor()
and start using the new start() vcall on the local monitor classes.

I only port inotify because I am uncomfortable making changes to the
other monitor backends without having a way of testing them.

https://bugzilla.gnome.org/show_bug.cgi?id=704887
2013-10-03 10:37:30 -04:00
Matthias Clasen
3bdd8a2c88 Use GLIB_PRIVATE_CALL macro
I accidentally pushed the fix for bug 704873 before
applying this cleanup.
2013-07-28 18:44:41 -04:00
Ryan Lortie
abbb225738 inotify: don't assume mainloop is running
GFileMonitor takes great care to sample the thread-default main context
at the time that it is created in order that events can be dispatched to
the correct thread when they come in.

The inotify GFileMonitor implementation uses a global file descriptor
shared between all watches.  It has to poll this file descriptor from
somewhere so it arbitrarily picks the default main context.

The problem with that is that the user might not be running it.

Let's use the GLib worker thread for this instead.  It's guaranteed to
be running if you need it, and this is exactly the sort of problem it
was meant to solve.

https://bugzilla.gnome.org/show_bug.cgi?id=704873
2013-07-28 17:19:38 -04:00
Matthias Clasen
e546eb016a Remove some unused inotify code 2013-06-02 20:01:56 -04:00
Ryan Lortie
f9eb9eed10 Rework the build system for a new tests approach
Perform a substantial cleanup of the build system with respect to
building and installing testcases.

First, Makefile.decl has been renamed glib.mk and substantially
expanded.  We intend to add more stuff here in the future, like canned
rules for mkenums, marshallers, resources, etc.

By default, tests are no longer compiled as part of 'make'.  They will
be built when 'make check' is run.  The old behaviour can be obtained
with --enable-always-build-tests.

--disable-modular-tests is gone (because tests are no longer built by
default).  There is no longer any way to cause 'make check' to be a
no-op, but that's not very useful anyway.

A new glibtests.m4 file is introduced.  Along with glib.mk, this
provides for consistent handling of --enable-installed-tests and
--enable-always-build-tests (mentioned above).

Port our various test-installing Makefiles to the new framework.

This patch substantially improves the situation in the toplevel tests/
directory.  Things are now somewhat under control there.  There were
some tests being built that weren't even being run and we run those now.
The long-running GObject performance tests in this directory have been
removed from 'make check' because they take too long.

As an experiment, 'make check' now runs the testcases on win32 builds,
by default.  We can't run them under gtester (since it uses a pipe to
communicate with the subprocess) so just toss them in TESTS.  Most of
them are passing on win32.

Things are not quite done here, but this patch is already a substantial
improvement.  More to come.
2013-05-31 23:12:15 -04:00
Cosimo Cecchi
40f8e15c1b inotify: fix a memleak
https://bugzilla.gnome.org/show_bug.cgi?id=692201
2013-01-21 09:51:09 -05:00
Ryan Lortie
52a81a7d86 Remove a few more G_GNUC_INTERNAL users 2013-01-18 13:28:43 -05:00
Ryan Lortie
346aa683de Fix visibility for glib/ and gio/ submodules
We have various sub directories in glib/ and gio/ (eg: inotify, gnulib,
pcre, xdgmime, etc.) that build convenience libraries that are then
included into libglib and libgio.  The files in these directories need
to be built with the same visibility policy as the files in the first
level directories, so add CFLAGS for them all.

This wasn't a problem when the visibility flags were set directly in
CFLAGS but then we had to deal with some modules that we built that we
explicitly wanted to export symbols from.

For now, we can keep things the way they are because it's less hacky and
although it's a theoretical hazard to forget these CFLAGS, we rarely add
new subdirectories to the build.
2013-01-18 13:23:40 -05:00
Dan Winship
69ad5010e3 inotify: fix compile 2012-12-19 09:10:12 -05:00
Ryan Lortie
707bc4a40f gio + inotify support for hard links
Add a new GFileMonitorFlag: G_FILE_MONITOR_WATCH_HARD_LINKS.  When set,
changes made to the file via another hard link will be detected.

Implement the new flag for the inotify backend.

https://bugzilla.gnome.org/show_bug.cgi?id=532815
2012-12-19 08:19:18 -05:00
Matthias Clasen
6a50dc511b Drop GVFS_INOTIFY_DIAG debug feature
Just not a good idea to have this in production code.
2012-09-11 20:24:30 -04:00
Cosimo Alfarano
fd1e9938b3 Send CHANGES_DONE_HINT on file moves if no IN_CLOSE_WRITE is emitted
This patch makes GFileMonitor to emit EVENT_CHANGES_DONE_HINT when
EVENT_CREATED is emitted but the file is not opened for writing.

On file moves across different mounted volumes, inotify will always emit
IN_CREATE and IN_CLOSE_WRITE (plus other events).
This translates into GIO's _EVENT_CREATED and _EVENT_CHANGES_DONE_HINT.

On file moves across the same mounted volumes, inotify will emit
IN_MOVED_FROM/IN_MOVED_TO which will be translated into
_EVENT_DELETED/_EVENT_CREATED GIO's side. No _EVENT_CHANGES_DONE_HINT is
emited afterwards.
Under such circumstances a file indexer does not know when actually the
file is ready to be indexed, either waiting too much or triggering the
indexing twice. On small devices it's not advisable.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=640077
Bug-NB: NB#219982
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Tomas Bzatek <tbzatek@redhat.com>
2011-12-05 18:27:34 +00:00
Matthias Clasen
c003468296 Correct a comment 2010-08-13 17:23:44 -04:00
Ryan Lortie
b3b7ea8e22 Replace -I with $(glib_INCLUDES) and friends
Stop using ad hoc -I in all of our Makefile.am.  Use the new variables
instead.
2010-08-06 13:10:34 -04:00
Ryan Lortie
ba0208b3a8 Clean up improper #includes
We have a lot of broken #including going on around the tree.  This has
gone unnoticed due to our sloppy use of -I.
2010-08-06 13:05:18 -04:00
Benjamin Otte
284ea16b9d inotify: Constify function argument
gcc complained...
2010-07-22 21:56:20 +02:00
Colin Walters
d2fe46b476 Annotate all custom GIO GSource using g_source_set_name
Naming the sources allows easier debugging with e.g. SystemTap
probes.

https://bugzilla.gnome.org/show_bug.cgi?id=620536
2010-07-10 20:09:34 -04:00
Matthias Clasen
551461b23a Fix some leaks in the inotify code
Also avoid creating some unused objects. Patch by Carlos Garnacho,
bug 613057
2010-07-09 08:33:27 -04:00
Ryan Lortie
5b946e0504 gio/: fully remove gioalias hacks 2010-07-07 19:53:22 -04:00
Juan A. Suarez Romero
992e07c8b2 Fix warnings
Do explicit casts to avoid warnings.
2010-06-09 10:32:12 +02:00
Matthias Clasen
e608b1f067 Don't spew a g_warning if inotify setup fails
We use is_supported when we are trying to find a local file monitor
implementation that works, and having the g_warning in there trips
the test suite.
2010-06-03 11:42:59 -04:00
Christian Kellner
48f74cab39 Move event support in the inotify backend
This adds support for G_FILE_MONITOR_SEND_MOVED events when requested by
the user to the inotify backend. Last part to fix bug #547890.
Based heavily on a patch by Martyn Russel <martyn@lanedo.com>.
2010-02-18 15:50:26 +01:00
Mures Andone
96f41b6283 Fixed bug 91 (GIO monitoring not working due to bad assert)
https://bugzilla.gnome.org/show_bug.cgi?id=593856
2009-11-26 15:40:01 +01:00
Josselin Mouette
cc4970cf94 Fall back to inotify_init if inotify_init1 does not work
This fixes monitoring failing to work when glib is built on a 2.6.27+
kernel but run on an older one.

http://bugs.debian.org/544354
https://bugzilla.gnome.org/show_bug.cgi?id=593775
2009-09-23 18:39:45 +02:00
Matthias Clasen
8a3a3d797e Use inotify_init1 when available
To avoid leaking the inotify fd. Fixes bug 585478.
2009-06-14 22:29:17 -04:00
Alexander Larsson
e1afc6e79b Remove gtk-doc warnings
Some code was using gtk-doc comment blocks for non-gtk-doc contents, just
turn it into ordinary comments.
2009-05-18 13:07:39 +02:00
Matthias Clasen
6a0f0c2bfb Bug 561807 – inotify_sub.c :: dup_dirname() fails to remove trailing '/'
2008-11-28  Matthias Clasen  <mclasen@redhat.com>

        Bug 561807 – inotify_sub.c :: dup_dirname() fails to remove trailing
        '/'

        * inotify/inotify-sub.c (dup_dirname): Actually strip the trailing
        '/' away. Spotted by Dan Williams.

`

svn path=/trunk/; revision=7682
2008-11-28 05:09:21 +00:00
Cody Russell
3d93bf6968 Moved all relevant typedefs into these files.
2008-07-01  Cody Russell  <bratsche@gnome.org>

        * gio/gioenums.h:
        * gio/giotypes.h:
	Moved all relevant typedefs into these	files.

        * gio/*.[ch]:
	Updated wrt added files.

        Split types into separate file	for easier maintainership. (#538564)


svn path=/trunk/; revision=7127
2008-07-01 06:32:35 +00:00
Johan Dahlin
761424465a Include "config.h" instead of <config.h> Command used: find -name
2008-06-21  Johan Dahlin  <jdahlin@async.com.br>

    * *.[ch]: Include "config.h" instead of <config.h>
    Command used:
    find -name \*.[ch]|xargs perl -p -i -e 's/^#include <config.h>/#include "config.h"/g'
    Rubberstamped by Mitch


svn path=/trunk/; revision=7092
2008-06-22 15:10:51 +00:00
Alexander Larsson
ab7e80d366 Define IN_ONLYDIR if not in header (#515346)
2008-02-13  Alexander Larsson  <alexl@redhat.com>

	* inotify/inotify-path.c:
	Define IN_ONLYDIR if not in header (#515346)



svn path=/trunk/; revision=6510
2008-02-13 13:33:57 +00:00
Alexander Larsson
bff9ecedbb Add registration hooks for extension points. Register the gio extension
2008-01-28  Alexander Larsson  <alexl@redhat.com>

        * giomodule.[ch]:
        * gio.symbols:
	Add registration hooks for extension points.
	Register the gio extension points.
	
        * fam/gfamdirectorymonitor.c:
        * fam/gfamfilemonitor.c:
        * glocaldirectorymonitor.[ch]:
        * glocalfilemonitor.[ch]:
        * gnativevolumemonitor.h:
        * gunionvolumemonitor.c:
        * gunixvolumemonitor.c:
        * gvfs.[ch]:
        * gvolumemonitor.h:
        * inotify/ginotifydirectorymonitor.c:
        * inotify/ginotifyfilemonitor.c:
	Use the extension points registration instead
	of g_type_children().


svn path=/trunk/; revision=6399
2008-01-28 19:43:10 +00:00
Alexander Larsson
d8473705b0 Removed. Removed. Removed the included copies of the inotify headers. We
2008-01-21  Alexander Larsson  <alexl@redhat.com>

        * inotify/Makefile.am:
        * inotify/inotify-helper.c:
        * inotify/inotify-kernel.c:
        * inotify/inotify-path.c:
        * inotify/local_inotify.h: Removed.
        * inotify/local_inotify_syscalls.h: Removed.
	Removed the included copies of the inotify
	headers. We now only use the <sys/inotify.h>
	header which exists on modern systems.
	This fixes problems on ARM and SH5 (#510448)
	but is also generally much cleaner and future
	safe. For instance, if other OSes add support
	for inotify it should "just work".



svn path=/trunk/; revision=6338
2008-01-21 10:35:44 +00:00
Matthias Clasen
a043325ec1 Coding style fixes
svn path=/trunk/; revision=6337
2008-01-21 05:12:16 +00:00
Alexander Larsson
e23140cbb4 Build test subdir after . Remove gdirectorymonitor.[ch]
2008-01-07  Alexander Larsson  <alexl@redhat.com>

        * Makefile.am:
	Build test subdir after .
	Remove gdirectorymonitor.[ch]
	
        * gdirectorymonitor.[ch]:
        * gfilemonitor.c:
        * gfile.[ch]:
        * gio.h:
	Remove GDirectoryMonitor and make
	GFileMonitor the baseclass for both file and
	directory monitors. Lift the more generic
	rate limiting code from GDirectoryMonitor
	into GFileMonitor.
	
        * fam/fam-helper.c:
        * fam/gfamdirectorymonitor.[ch]:
        * inotify/ginotifydirectorymonitor.[ch]:
        * inotify/inotify-helper.c:
        * glocaldirectorymonitor.[ch]:
        * glocalfile.c:
        * gvolumemonitor.c:
	Update for the removed GDirectoryMonitor.
	
        * gmemoryoutputstream.c:
	Remove ununsed variable


svn path=/trunk/; revision=6262
2008-01-07 13:42:08 +00:00
Matthias Clasen
a2cea97a8d Fix build with --disable-visibility
svn path=/trunk/; revision=6219
2007-12-31 02:30:33 +00:00
Yevgen Muntyan
ee5aacbc61 Fixed build when srcdir != builddir, made mkenums and friends use
2007-12-14  Yevgen Muntyan  <muntyan@tamu.edu>

	* gio/Makefile.am:
	* gio/inotify/Makefile.am: Fixed build when srcdir != builddir,
	made mkenums and friends use temporary files to avoid leaving
	empty generated files on failure (#503470).


svn path=/trunk/; revision=6126
2007-12-14 14:28:35 +00:00
Alexander Larsson
ced2927726 Only allow including <gio/gio.h> from apps
2007-12-14  Alexander Larsson  <alexl@redhat.com>

        * Makefile.am:
        * fam/Makefile.am:
        * gappinfo.h:
        * gasyncresult.h:
        * gbufferedinputstream.h:
        * gbufferedoutputstream.h:
        * gcancellable.h:
        * gcontenttype.h:
        * gdatainputstream.h:
        * gdataoutputstream.h:
        * gdesktopappinfo.h:
        * gdirectorymonitor.h:
        * gdrive.h:
        * gfile.h:
        * gfileattribute.h:
        * gfileenumerator.h:
        * gfileicon.h:
        * gfileinfo.h:
        * gfileinputstream.h:
        * gfilemonitor.h:
        * gfilenamecompleter.h:
        * gfileoutputstream.h:
        * gfilterinputstream.h:
        * gfilteroutputstream.h:
        * gicon.h:
        * ginputstream.h:
        * gio.h:
        * gioerror.h:
        * giomodule.h:
        * gioscheduler.h:
        * gloadableicon.h:
        * gmemoryinputstream.h:
        * gmemoryoutputstream.h:
        * gmount.h:
        * gmountoperation.h:
        * goutputstream.h:
        * gseekable.h:
        * gsimpleasyncresult.h:
        * gthemedicon.h:
        * gunixinputstream.h:
        * gunixmounts.h:
        * gunixoutputstream.h:
        * gvfs.h:
        * gvolume.h:
        * gvolumemonitor.h:
        * inotify/Makefile.am:
	Only allow including <gio/gio.h> from apps


svn path=/trunk/; revision=6117
2007-12-14 10:35:24 +00:00
Matthias Clasen
7c0e098f4e Don't export the inotify lock
svn path=/trunk/; revision=5992
2007-11-29 03:39:01 +00:00
Alexander Larsson
d9594f5709 Removed unnecessary file
2007-11-28  Alexander Larsson  <alexl@redhat.com>

        * Makefile.am:
        * gdriveprivate.h:
	Removed unnecessary file
	
        * gdesktopappinfo.[ch]:
        * gdummyfile.[ch]:
        * gfile.c:
        * glocaldirectorymonitor.[ch]:
        * glocalfile.[ch]:
        * glocalfileenumerator.[ch]:
        * glocalfileinputstream.[ch]:
        * glocalfilemonitor.[ch]:
        * glocalfileoutputstream.[ch]:
        * glocalvfs.[ch]:
        * gnativevolumemonitor.c:
        * gpollfilemonitor.[ch]:
        * gunionvolumemonitor.[ch]:
        * gunixdrive.[ch]:
        * gunixvolume.[ch]:
        * gunixvolumemonitor.[ch]:
        * gvfs.c:
        * gvolumeprivate.h:
        * inotify/ginotifydirectorymonitor.[ch]:
        * inotify/ginotifyfilemonitor.[ch]:
        * inotify/inotify-helper.c:
	Append _ to all internal functions
	
        * gio.symbols:
	Add missing symbols
	Export symbols needed for modules


svn path=/trunk/; revision=5977
2007-11-28 16:01:59 +00:00
Alexander Larsson
7f3280230b Added. Added. Added. Added.
2007-11-28  Alexander Larsson  <alexl@redhat.com>

        * Makefile.am:
        * abicheck.sh: Added.
        * makegioalias.pl: Added.
        * pltcheck.sh: Added.
        * gio.symbols: Added.
	* *.c:
        * inotify/*.c
	Initial work on adding symbol handling.

	* gvfs.h:
	Correct ifdef guard name

        * fam/Makefile.am:
        * inotify/Makefile.am:
        * xdgmime/Makefile.am:
	Include toplevel Makefile.decl


svn path=/trunk/; revision=5972
2007-11-28 12:39:07 +00:00
Alexander Larsson
2490a699be Allow configuration of gio-module-dir
2007-11-27  Alexander Larsson  <alexl@redhat.com>

        * configure.in:
	Allow configuration of gio-module-dir
	
        * gio-2.0.pc.in:
	Export giomodules location as giomodule variable

2007-11-27  Alexander Larsson  <alexl@redhat.com>

        * Makefile.am:
        * fam/Makefile.am:
        * inotify/Makefile.am:
	Use the user-specified giomoduledir


svn path=/trunk/; revision=5951
2007-11-27 12:39:14 +00:00
Alexander Larsson
3781343738 gio/ docs/reference/gio Merged gio-standalone into glib.
2007-11-26  Alexander Larsson  <alexl@redhat.com>

        * Makefile.am:
        * configure.in:
        * gio-2.0-uninstalled.pc.in:
        * gio-2.0.pc.in: 
        * gio-unix-2.0-uninstalled.pc.in:
        * gio-unix-2.0.pc.in:
	* gio/
	* docs/reference/gio
	Merged gio-standalone into glib.
	
        * glib/glibintl.h:
        * glib/gutils.c:
	Export glib_gettext so that gio can use it
	Add P_ (using same domain for now)
	Add I_ as g_intern_static_string


svn path=/trunk/; revision=5941
2007-11-26 16:13:05 +00:00