Commit Graph

74 Commits

Author SHA1 Message Date
Philip Withnall
723ac89b0c tests: Add a GFileMonitor test for G_FILE_MONITOR_WATCH_HARD_LINKS
Add a test for monitoring an existing local file, with the
WATCH_HARD_LINKS flag specified. This would previously cause a crash;
now it doesn’t.

This test contains a FIXME where I suspect we should be getting some
additional file change notifications from changes made through the hard
link; this requires further follow up and probably further fixes to our
inotify backend.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=755721
2018-04-18 15:13:02 +01:00
Philip Withnall
40be86bb0e gio: Port GThreadedResolver to use res_nquery() to fix thread-safety
res_query() uses global state in the form of the struct __res_state
which contains the contents of resolv.conf (and other things). On Linux,
this state seems to be thread-local, so there is no problem. On OS X,
however, it is not, and hence multiple res_query() calls from parallel
threads will compete and return bogus results.

The fix for this is to use res_nquery(), introduced in BIND 8.2, which
takes an explicit state argument. This allows us to manually store the
state thread-locally. If res_nquery() isn’t available, we fall back to
res_query(). It should be available on OS X though. As a data point,
it’s available on Fedora 27.

There’s a slight complication in the fact that OS X requires the state
to be freed using res_ndestroy() rather than res_nclose(). Linux uses
res_nclose().

(See, for example, the NetBSD man page:
https://www.unix.com/man-page/netbsd/3/res_ninit/. The Linux one is
incomplete and not so useful:
http://man7.org/linux/man-pages/man3/resolver.3.html.)

The new code will call res_ninit() once per res_nquery() task. This is
not optimal, but no worse than before — since res_query() was being
called in a worker thread, on Linux, it would implicitly initialise the
thread-local struct __res_state when it was called. We’ve essentially
just made that explicit. In practical terms, this means a
stat("/etc/resolv.conf") call per res_nquery() task.

In future, we could improve this by using an explicit thread pool with
some manually-created worker threads, each of which initialises a struct
__res_state on spawning, and only updates it on receiving
the #GResolver::reload signal.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=792050
2018-02-02 18:05:27 +01:00
Chun-wei Fan
9831516835 config.h.win32.in: Fix previous commit
We should still let people building via the MSVC projects decide whether
they use the bundled PCRE sources for building GLib.  Accidentally
changed it in the previous commit.
2017-09-15 11:48:58 +08:00
Chun-wei Fan
751a757766 build: Update config.h.win32.in
Update config.h.win32.in to match closely to what Meson will produce for
the various Visual Studio versions (2008~2017), as it seems that Meson
produces a better config.h for our MSVC builds of GLib.

One of the major changes in this is that all Visual Studio builds
(either through Meson, which is already so, or via the existing
projects) is that the built binaries will require Windows 7 or later,
so that we let people know early on in a cycle that MSVC builds of
2.55.0 and later will definitely need Windows 7 or later.
2017-09-15 11:37:40 +08:00
Chun-wei Fan
ad49479265 Visual Studio builds: Visual Studio 2013 and later has va_copy()
Update config.h.win32.in and glib/glibconfig.h.win32.in to indicate so.
2017-06-14 11:48:27 +08:00
Chun-wei Fan
9198f19d97 config.h.win32.in: Always define HAVE_LONG_LONG
Visual Studio actually supports long long types, but HAVE_LONG_LONG is
undefined for Visual Studio builds, likely due to issues in previous
gnulib code for printf functionality, that was bundled with GLib.

Since gnulib has much better support with Visual Studio nowadays (which we
updated the related code to last October), and HAVE_LONG_LONG being undefined
actually causes issues in Visual Studio builds, which was demonstrated with
the type-test test program in tests/, we should always define HAVE_LONG_LONG
in config.h.win32.in.

Thanks to Paolo Borelli for the heads up on the issue.
2016-06-07 15:51:31 +08:00
Chun-wei Fan
80dcec234c config.h.win32.in: Clean up a bit
Remove the HAVE_*INLINE items from here as well, since 'inline' is
unconditionally defined in gmacros.h.
2015-12-02 21:04:43 +08:00
Philip Withnall
f62cbfc022 gsocket: Add g_socket_receive_messages()
Add support for receiving multiple messages with a single system call,
using recvmmsg() if available. Otherwise, fall back to looping over
g_socket_receive_message().

This adds new API, g_socket_receive_messages(), and corresponding unit
tests.

https://bugzilla.gnome.org/show_bug.cgi?id=751924
2015-10-01 14:10:10 +01:00
Chun-wei Fan
53d487e31b config.h.win32.in: Clean Up and Update
Merge the parts that has things to do with stdint.h and inttypes.h with
the !_MSC_VER portions, and add initial support for Visual Studio 2015,
which added support for C99 snprintf() and vsnprintf().

Not too sure about the !_MSC_VER for C99 snprintf() and vsnprintf(), but
since this file is mainly for Visual Studio builds, anyways...
2015-07-21 11:26:29 +08:00
Chun-wei Fan
1632d5716e Win32: Update Pre-configured Config Headers
Update config.h.win32.in and glibconfig.h.win32.in so that they will be
in-line with the ones that are produced with configure.ac, for use on
Windows builds.

Thanks to Philip Withnall for pointing out the changes needed to update
glibconfig.h.win32.in in bug 727829.
2015-01-07 09:59:47 +08:00
Chun-wei Fan
e3db9632e7 config.h.win32.in: Define _WIN32_WINNT Conditionally
This is done so that _WIN32_WINNT may be overridden in the project files,
if needed, so that one can access the Vista+ (or so) Windows APIs easier
by using "preprocessor defines" (or so) in the Visual C++ project files.
2014-05-23 10:14:50 +08:00
Chun-wei Fan
f4ae0cbf9a Update config.h.win32.in for Newer Windows
Make use of if_indextoname() and if_nametoindex() when building against
Window Vista/Server 2008 or later, as these are provided by the system.

This is not turned on by default as we still want to support XP and
Server 2003-turn this on by changing _WIN32_WINNT to 0x600 or later prior
to compiling GLib.

https://bugzilla.gnome.org/show_bug.cgi?id=730352
2014-05-19 14:49:39 +08:00
Chun-wei Fan
62206576c3 Update config.h.win32.in
Make the entries of config.h.win32.in match those that are being checked
in config.h.in.
2014-03-12 17:26:45 +08:00
Ryan Lortie
3f41e49285 Use POSIX-specified <poll.h> over <sys/poll.h>
POSIX specifies that <poll.h> is the correct header to include for
poll(), so let's do that instead.

https://bugzilla.gnome.org/show_bug.cgi?id=141251
2013-12-22 11:33:07 -05:00
Dan Winship
158dde0507 Replace #ifdef HAVE_UNISTD_H checks with #ifdef G_OS_UNIX
In Windows development environments that have it, <unistd.h> is mostly
just a wrapper around several other native headers (in particular,
<io.h>, which contains read(), close(), etc, and <process.h>, which
contains getpid()). But given that some Windows dev environments don't
have <unistd.h>, everything that uses those functions on Windows
already needed to include the correct Windows header as well, and so
there is never any point to including <unistd.h> on Windows.

Also, remove some <unistd.h> includes (and a few others) that were
unnecessary even on unix.

https://bugzilla.gnome.org/show_bug.cgi?id=710519
2013-11-20 09:25:39 -05:00
Dan Winship
3981cddbf8 Require POSIX.1 (1990) compliance on unix
Assume unix platforms support the original POSIX.1 standard.
Specifically, assume that if G_OS_UNIX, then we have chown(),
getcwd(), getgrgid(), getpwuid(), link(), <grp.h>, <pwd.h>,
<sys/types.h>, <sys/uio.h>, <sys/wait.h>, and <unistd.h>.

Additionally, since all versions of Windows that we care about also
have <sys/types.h>, we can remove HAVE_SYS_TYPES_H checks everywhere.

Also remove one include of <sys/times.h>, and the corresponding
configure check, since the include is not currently needed (and may
always have just been a typo for <sys/time.h>).

https://bugzilla.gnome.org/show_bug.cgi?id=710519
2013-11-20 09:17:42 -05:00
Dan Winship
6e4a7fca43 Require C90 compliance
Assume all supported platforms implement C90, and therefore they
(correctly) implement atexit(), memmove(), setlocale(), strerror(),
and vprintf(), and have <float.h> and <limits.h>.

(Also remove the configure check testing that "do ... while (0)" works
correctly; the non-do/while-based version of G_STMT_START and
G_STMT_END was removed years ago, but the check remained. Also, remove
some checks that configure.ac claimed were needed for libcharset, but
aren't actually used.)

Note that removing the g_memmove() function is not an ABI break even
on systems where g_memmove() was previously not a macro, because it
was never marked GLIB_AVAILABLE_IN_ALL or listed in glib.symbols, so
it would have been glib-internal since 2004.

https://bugzilla.gnome.org/show_bug.cgi?id=710519
2013-11-20 09:16:16 -05:00
Chun-wei Fan
e05abaed04 Update config.h.win32.in
Make entries more in sync with the items checked with autotools, and
provide a MinGW declaration for _GLIB_EXTERN, taken from configure.ac.
2013-08-21 11:04:37 +08:00
Chun-wei Fan
1e945933d4 config.h.win32.in: Drop unneeded item
...We no longer have the iconv cache code around.
2013-08-16 10:35:19 +08:00
Chun-wei Fan
2ab9e54477 Update config.h.win32.in
Make its entries match the items that are being checked by the autotools
builds in config.h.in.
2013-08-16 10:29:41 +08:00
Chun-wei Fan
80985d1c05 Update config.h.win32(.in)
Make the entries of config.h.win32(.in) consistent with the entries
that are generated from the autotools build (config.h.in).
2013-05-27 12:50:37 +08:00
Chun-wei Fan
872d3634a7 Update config.h.win32.in
Add entry for __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4, to better reflect the
entries of items in config.h.in.  We are not currently defining this here
as the pre-configured config.h.win32.in is primarily meant for Visual
Studio builds of GLib-the MinGW/GCC/Clang builds of GLib will normally
use the autotools builds, which should give the correct config.h entries
upon running ./configure.
2013-03-01 16:12:36 +08:00
Chun-wei Fan
4ba56f3653 Bug 688681: Stop using .def files in Visual Studio builds
Since we are now starting to use __declspec (dllexport) to export the
public functions during the build of the GLib DLLs (i.e. to generate the
.lib files), we don't want to generate the .def files from the .symbols
files as we did before for a long time.

This removes from the projects the custom build steps to generate the
various .def files

This will also update the pre-configured config.h(.win32.in) to define
_GLIB_EXTERN appropriately as __declspec (dllexport), as well as making its
entries reflect config.h.in more closely.
2013-01-15 15:23:05 +08:00
Chun-wei Fan
39150f90e5 Update config.h.win32.in
Make its entries correspond to the entries in config.h.in, and use
_strnicmp for strncasecmp on Visual C++.
2012-11-19 12:38:28 +08:00
Chun-wei Fan
3d45854a58 Update config.h.win32(.in) and glibconfig.h.win32(.in)
-Make config.h.win32(.in) have entries that more resembles the generated
 config.h.in
-Move the ALIGNOF_* #define's from glibconfig.h.win32(.in) to
 config.h.win32(.in), where they were supposed to be.
2012-09-26 17:47:52 +08:00
Chun-wei Fan
190891042d Update config.h.win32(.in)
Make it more like the one that is generated by autotools.

It is true that Visual C++ has sig_atomic_t, at least for Visual C++ 2008
and later, but this is currently only used for UNIX builds of GLib, as a
point of note here.
2012-03-19 16:02:37 +08:00
Chun-wei Fan
05663607ea Update config.h.win32(.in)
Remove the config for ENABLE_REGEX, as GRegex is now included in all builds.
2012-03-08 15:34:39 +08:00
Chun-wei Fan
71c3ba28a8 config.h.win32.in: Add note on if_nametoindex
This explains the current disabling of HAVE_IF_NAMETOINDEX as we are
still supporting Windows XP.  This is expected to change when the patch
for XP support for if_nametoindex in accepted into master.
2012-02-08 20:41:13 +08:00
Chun-wei Fan
95a2c885d7 config.h.win32.in: Updates
Make this more like the config.h.in template
2012-02-08 19:52:55 +08:00
Chun-wei Fan
a2e1541cda config.h.win32.in: Cleanups
-Make the contents of the preconfigured config.h.win32(.in) more like the
 contents of config.h.in
-Correct the sizing of void* on x64 platforms (which should be 8, unlike
 4 on x86-32 platforms)
2011-12-30 15:27:31 +08:00
Chun-wei Fan
eb17516a67 config.h.win32(.in): Update for strcasecmp
Visual C++ uses _stricmp, which is identical to strcasecmp on gcc.
2011-10-06 15:03:30 +08:00
Matthias Clasen
e6c76d9fd4 Clean up atomic cruft
Nothing is using these defines anymore, and the messages
are misleading. Based on a patch by Kean Johnston.

https://bugzilla.gnome.org/show_bug.cgi?id=660013
2011-09-29 23:20:09 -04:00
Chun-wei Fan
09a322c8e4 Update config.h.win32.in
Make the pre-configured config.h(.win32.in) for Windows more like the
config.h that would be produced during ./configure on Windows systems.
2011-08-23 00:09:03 +08:00
Chun-wei Fan
77a10feafa Bug 652827: Update config.h.win32.in
Add check macro for HAVE_WIN32_BUILTINS_FOR_ATOMIC_OPERATIONS, as it is
now required for MSVC builds of glib/gatomic.c GLib 2.29.15+.

It is true that the MinGW cross-compiler on Linux systems will have
HAVE_GCC_BUILTINS_FOR_ATOMIC_OPERATIONS and
HAVE_WIN32_BUILTINS_FOR_ATOMIC_OPERATIONS defined during the completion
of ./configure, but since this file is primarily meant for people
compiling -on- Windows (and that the "native" Windows MinGW would neither
./configure to define HAVE_GCC_BUILTINS_FOR_ATOMIC_OPERATIONS and
HAVE_WIN32_BUILTINS_FOR_ATOMIC_OPERATIONS), this file will be updated as
it is for now at least until the situation for "native" Windows MinGW
change. (please see Bug 652827 regarding this paragraph)
2011-08-11 15:30:48 +08:00
Chun-wei Fan
0e4507a296 Update config.h.win32(.in)
Make file contents more like the config.h(.in) contents
2011-06-22 15:22:55 +08:00
Chun-wei Fan
1d1f44ca64 Update config.h.win32.in
-Make contents more like the current config.h(.in)
-vsnprintf is included in VS 2008+
2011-06-07 10:32:47 +08:00
Chun-wei Fan
b2ebf0526d Update config.h.win32.in for VS 2010
VS2010 ships with stdint.h by default, so update config.h.win32.in
to reflect that
2011-03-10 12:40:57 +08:00
Ryan Lortie
3a8ab85d96 rename configure.in to configure.ac 2010-07-13 11:59:16 -04:00
Tor Lillqvist
3e3779b7d0 Make config.h.win32.in match what configure produces
No semantic changes.
2010-05-19 10:47:02 +03:00
Tor Lillqvist
365fd70f26 Make config.h.win32 match what the configure script produces 2010-03-22 15:33:38 +02:00
Tor Lillqvist
a0bcd63304 Don't check for headers we include unconditionally
Don't bother checking for winsock2.h and mswsock.h in the configure
script as we include these unconditionally when building for Windows
anyway.
2009-12-14 03:16:55 +02:00
Tor Lillqvist
8dc200db04 Check for <wspiapi.h> and use it if present
Should help bug #603527 if glib is built in an environment that has
<wspiapi.h>.
2009-12-14 03:09:46 +02:00
Hans Breuer
75ef018248 Updated msvc build files 2009-05-30 15:29:23 +02:00
Tor Lillqvist
b006f4832f Update to match what the configure script produces. Just for uniformity,
2008-09-15  Tor Lillqvist  <tml@novell.com>

	* config.h.win32.in: Update to match what the configure script
	produces. Just for uniformity, only commented out parts affected.


svn path=/trunk/; revision=7489
2008-09-15 15:14:00 +00:00
Tor Lillqvist
194493f3f8 Should not define HAVE_DIRENT_H when compiling with MSVC, as the only file
2008-08-27  Tor Lillqvist  <tml@novell.com>

	* config.h.win32.in: Should not define HAVE_DIRENT_H when
	compiling with MSVC, as the only file which checks HAVE_DIRENT_H
	is gdir.c, and that includes the dirent.h and wdirent.c from
	build/win32/dirent explicitly anyway when being compiled with
	MSVC.


svn path=/trunk/; revision=7403
2008-08-27 12:48:57 +00:00
Tor Lillqvist
e3127daf4e Update to match the configure-produced one.
2008-05-16  Tor Lillqvist  <tml@novell.com>

	* config.h.win32.in: Update to match the configure-produced one.


svn path=/trunk/; revision=6892
2008-05-16 16:42:52 +00:00
Tor Lillqvist
3deb5aceda Update to match what configure produces.
2007-11-28  Tor Lillqvist  <tml@novell.com>

	* config.h.win32.in: Update to match what configure produces.


svn path=/trunk/; revision=5976
2007-11-28 16:01:16 +00:00
Tor Lillqvist
851c7067aa Update to match what configure produces.
2007-03-15  Tor Lillqvist  <tml@novell.com>

	* config.h.win32.in: Update to match what configure produces.


svn path=/trunk/; revision=5409
2007-03-15 14:41:24 +00:00
Tor Lillqvist
98a5ddc4c8 config.h.win32.in glib/galloca.h glib/gbacktrace.h glib/gwin32.c
2007-01-17  Tor Lillqvist  <tml@novell.com>

	* config.h.win32.in
	* glib/galloca.h
	* glib/gbacktrace.h
	* glib/gwin32.c
	* glibconfig.h.win32.in
	* README.win32: More minor tweaks for Digital Mars
	compiler. (#346808, Serhat Sevki Dincer)


svn path=/trunk/; revision=5294
2007-01-18 19:05:21 +00:00
Tor Lillqvist
93627e1925 Update to match what configure produces. Add the G_ATOMIC_*. Define
2004-08-04  Tor Lillqvist  <tml@iki.fi>

	* config.h.win32.in: Update to match what configure produces. Add
	the G_ATOMIC_*. Define G_ATOMIC_I486 when compiling with gcc. Move
	HAVE_INT64_AND_I64 to where the configure script puts it. Add
	HAVE_INTTYPES_H_WITH_UINTMAX. Define intmax_t as __int64 for MSVC.
2004-08-04 23:12:53 +00:00