mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-05 02:36:19 +01:00
libtool installs/uninstalls the import library, no need to do it
2005-06-26 Tor Lillqvist <tml@novell.com> * glib/Makefile.am: libtool installs/uninstalls the import library, no need to do it ourselves. Do still install/uninstall the .def file, though. * glib/gmappedfile.c: Add Win32 implementation. (g_mapped_file_free): Don't mention writable shared mappings in the doc comment. Free the GMappedFile struct. * tests/mapping-test.c (main): No kill() or SIGUSR1 on Win32, use a flag file instead to stop the child. Use g_usleep() instead of sleep().
This commit is contained in:
parent
d8926119d1
commit
ef48ce636b
14
ChangeLog
14
ChangeLog
@ -1,3 +1,17 @@
|
|||||||
|
2005-06-26 Tor Lillqvist <tml@novell.com>
|
||||||
|
|
||||||
|
* glib/Makefile.am: libtool installs/uninstalls the import
|
||||||
|
library, no need to do it ourselves. Do still install/uninstall
|
||||||
|
the .def file, though.
|
||||||
|
|
||||||
|
* glib/gmappedfile.c: Add Win32 implementation.
|
||||||
|
(g_mapped_file_free): Don't mention writable shared mappings in
|
||||||
|
the doc comment. Free the GMappedFile struct.
|
||||||
|
|
||||||
|
* tests/mapping-test.c (main): No kill() or SIGUSR1 on Win32, use
|
||||||
|
a flag file instead to stop the child. Use g_usleep() instead of
|
||||||
|
sleep().
|
||||||
|
|
||||||
2005-06-24 Matthias Clasen <mclasen@redhat.com>
|
2005-06-24 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
Add an mmap() wrapper called GMappedFile. (#148218,
|
Add an mmap() wrapper called GMappedFile. (#148218,
|
||||||
|
@ -1,3 +1,17 @@
|
|||||||
|
2005-06-26 Tor Lillqvist <tml@novell.com>
|
||||||
|
|
||||||
|
* glib/Makefile.am: libtool installs/uninstalls the import
|
||||||
|
library, no need to do it ourselves. Do still install/uninstall
|
||||||
|
the .def file, though.
|
||||||
|
|
||||||
|
* glib/gmappedfile.c: Add Win32 implementation.
|
||||||
|
(g_mapped_file_free): Don't mention writable shared mappings in
|
||||||
|
the doc comment. Free the GMappedFile struct.
|
||||||
|
|
||||||
|
* tests/mapping-test.c (main): No kill() or SIGUSR1 on Win32, use
|
||||||
|
a flag file instead to stop the child. Use g_usleep() instead of
|
||||||
|
sleep().
|
||||||
|
|
||||||
2005-06-24 Matthias Clasen <mclasen@redhat.com>
|
2005-06-24 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
Add an mmap() wrapper called GMappedFile. (#148218,
|
Add an mmap() wrapper called GMappedFile. (#148218,
|
||||||
|
@ -1,3 +1,17 @@
|
|||||||
|
2005-06-26 Tor Lillqvist <tml@novell.com>
|
||||||
|
|
||||||
|
* glib/Makefile.am: libtool installs/uninstalls the import
|
||||||
|
library, no need to do it ourselves. Do still install/uninstall
|
||||||
|
the .def file, though.
|
||||||
|
|
||||||
|
* glib/gmappedfile.c: Add Win32 implementation.
|
||||||
|
(g_mapped_file_free): Don't mention writable shared mappings in
|
||||||
|
the doc comment. Free the GMappedFile struct.
|
||||||
|
|
||||||
|
* tests/mapping-test.c (main): No kill() or SIGUSR1 on Win32, use
|
||||||
|
a flag file instead to stop the child. Use g_usleep() instead of
|
||||||
|
sleep().
|
||||||
|
|
||||||
2005-06-24 Matthias Clasen <mclasen@redhat.com>
|
2005-06-24 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
Add an mmap() wrapper called GMappedFile. (#148218,
|
Add an mmap() wrapper called GMappedFile. (#148218,
|
||||||
|
@ -1,3 +1,17 @@
|
|||||||
|
2005-06-26 Tor Lillqvist <tml@novell.com>
|
||||||
|
|
||||||
|
* glib/Makefile.am: libtool installs/uninstalls the import
|
||||||
|
library, no need to do it ourselves. Do still install/uninstall
|
||||||
|
the .def file, though.
|
||||||
|
|
||||||
|
* glib/gmappedfile.c: Add Win32 implementation.
|
||||||
|
(g_mapped_file_free): Don't mention writable shared mappings in
|
||||||
|
the doc comment. Free the GMappedFile struct.
|
||||||
|
|
||||||
|
* tests/mapping-test.c (main): No kill() or SIGUSR1 on Win32, use
|
||||||
|
a flag file instead to stop the child. Use g_usleep() instead of
|
||||||
|
sleep().
|
||||||
|
|
||||||
2005-06-24 Matthias Clasen <mclasen@redhat.com>
|
2005-06-24 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
Add an mmap() wrapper called GMappedFile. (#148218,
|
Add an mmap() wrapper called GMappedFile. (#148218,
|
||||||
|
@ -186,14 +186,14 @@ glibsubinclude_HEADERS = \
|
|||||||
gwin32.h \
|
gwin32.h \
|
||||||
gprintf.h
|
gprintf.h
|
||||||
|
|
||||||
install-data-local: install-ms-lib install-libtool-import-lib
|
install-data-local: install-ms-lib install-def-file
|
||||||
@if test -f $(glibincludedir)/glist.h ; then \
|
@if test -f $(glibincludedir)/glist.h ; then \
|
||||||
echo "*** Old headers found in $(glibincludedir). You should remove the" ; \
|
echo "*** Old headers found in $(glibincludedir). You should remove the" ; \
|
||||||
echo "*** contents of this directory and type 'make install' again." ; \
|
echo "*** contents of this directory and type 'make install' again." ; \
|
||||||
false ; \
|
false ; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
uninstall-local: uninstall-ms-lib uninstall-libtool-import-lib
|
uninstall-local: uninstall-ms-lib uninstall-def-file
|
||||||
|
|
||||||
if PLATFORM_WIN32
|
if PLATFORM_WIN32
|
||||||
no_undefined = -no-undefined
|
no_undefined = -no-undefined
|
||||||
@ -203,15 +203,14 @@ if OS_WIN32
|
|||||||
# This requires a very new libtool
|
# This requires a very new libtool
|
||||||
export_symbols = -export-symbols glib.def
|
export_symbols = -export-symbols glib.def
|
||||||
|
|
||||||
install-libtool-import-lib:
|
install-def-file:
|
||||||
$(INSTALL) .libs/libglib-2.0.dll.a $(DESTDIR)$(libdir)
|
|
||||||
$(INSTALL) glib.def $(DESTDIR)$(libdir)/glib-2.0.def
|
$(INSTALL) glib.def $(DESTDIR)$(libdir)/glib-2.0.def
|
||||||
|
|
||||||
uninstall-libtool-import-lib:
|
uninstall-def-file:
|
||||||
-rm $(DESTDIR)$(libdir)/libglib-2.0.dll.a $(DESTDIR)$(libdir)/glib-2.0.def
|
-rm $(DESTDIR)$(libdir)/glib-2.0.def
|
||||||
else
|
else
|
||||||
install-libtool-import-lib:
|
install-def-file:
|
||||||
uninstall-libtool-import-lib:
|
uninstall-def-file:
|
||||||
|
|
||||||
export_symbols = $(LIBTOOL_EXPORT_OPTIONS)
|
export_symbols = $(LIBTOOL_EXPORT_OPTIONS)
|
||||||
endif
|
endif
|
||||||
|
@ -32,6 +32,11 @@
|
|||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "glibconfig.h"
|
||||||
|
|
||||||
|
#ifdef G_OS_WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "gconvert.h"
|
#include "gconvert.h"
|
||||||
#include "gerror.h"
|
#include "gerror.h"
|
||||||
@ -46,6 +51,10 @@
|
|||||||
|
|
||||||
#include "galias.h"
|
#include "galias.h"
|
||||||
|
|
||||||
|
#ifndef _O_BINARY
|
||||||
|
#define _O_BINARY 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef MAP_FAILED
|
#ifndef MAP_FAILED
|
||||||
#define MAP_FAILED ((void *) -1)
|
#define MAP_FAILED ((void *) -1)
|
||||||
#endif
|
#endif
|
||||||
@ -54,6 +63,9 @@ struct _GMappedFile
|
|||||||
{
|
{
|
||||||
gsize length;
|
gsize length;
|
||||||
gchar *contents;
|
gchar *contents;
|
||||||
|
#ifdef G_OS_WIN32
|
||||||
|
HANDLE mapping;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -91,7 +103,7 @@ g_mapped_file_new (const gchar *filename,
|
|||||||
g_return_val_if_fail (filename != NULL, NULL);
|
g_return_val_if_fail (filename != NULL, NULL);
|
||||||
g_return_val_if_fail (!error || *error == NULL, NULL);
|
g_return_val_if_fail (!error || *error == NULL, NULL);
|
||||||
|
|
||||||
fd = g_open (filename, writable ? O_RDWR : O_RDONLY);
|
fd = g_open (filename, (writable ? O_RDWR : O_RDONLY) | _O_BINARY, 0);
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
{
|
{
|
||||||
int save_errno = errno;
|
int save_errno = errno;
|
||||||
@ -132,6 +144,27 @@ g_mapped_file_new (const gchar *filename,
|
|||||||
writable ? PROT_READ|PROT_WRITE : PROT_READ,
|
writable ? PROT_READ|PROT_WRITE : PROT_READ,
|
||||||
MAP_PRIVATE, fd, 0);
|
MAP_PRIVATE, fd, 0);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef G_OS_WIN32
|
||||||
|
file->length = st.st_size;
|
||||||
|
file->mapping = CreateFileMapping ((HANDLE) _get_osfhandle (fd), NULL,
|
||||||
|
writable ? PAGE_WRITECOPY : PAGE_READONLY,
|
||||||
|
0, 0,
|
||||||
|
NULL);
|
||||||
|
if (file->mapping != NULL)
|
||||||
|
{
|
||||||
|
file->contents = MapViewOfFile (file->mapping,
|
||||||
|
writable ? FILE_MAP_COPY : FILE_MAP_READ,
|
||||||
|
0, 0,
|
||||||
|
0);
|
||||||
|
if (file->contents == NULL)
|
||||||
|
{
|
||||||
|
file->contents = MAP_FAILED;
|
||||||
|
CloseHandle (file->mapping);
|
||||||
|
file->mapping = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
if (file->contents == MAP_FAILED)
|
if (file->contents == MAP_FAILED)
|
||||||
{
|
{
|
||||||
@ -203,9 +236,6 @@ g_mapped_file_get_contents (GMappedFile *file)
|
|||||||
*
|
*
|
||||||
* Unmaps the buffer of @file and frees it.
|
* Unmaps the buffer of @file and frees it.
|
||||||
*
|
*
|
||||||
* For writable, shared mappings, the contents
|
|
||||||
* will be written back to the file at this point.
|
|
||||||
*
|
|
||||||
* Since: 2.8
|
* Since: 2.8
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
@ -216,6 +246,12 @@ g_mapped_file_free (GMappedFile *file)
|
|||||||
#ifdef HAVE_MMAP
|
#ifdef HAVE_MMAP
|
||||||
munmap (file->contents, file->length);
|
munmap (file->contents, file->length);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef G_OS_WIN32
|
||||||
|
UnmapViewOfFile (file->contents);
|
||||||
|
CloseHandle (file->mapping);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
g_free (file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,22 +24,31 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
#include "glib.h"
|
#include "glib.h"
|
||||||
|
#include "gstdio.h"
|
||||||
|
|
||||||
static gchar *dir, *filename, *displayname, *childname;
|
static gchar *dir, *filename, *displayname, *childname;
|
||||||
|
|
||||||
static gboolean stop = FALSE;
|
static gboolean stop = FALSE;
|
||||||
|
|
||||||
|
#ifndef G_OS_WIN32
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_usr1 (int signum)
|
handle_usr1 (int signum)
|
||||||
{
|
{
|
||||||
stop = TRUE;
|
stop = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
check_stop (gpointer data)
|
check_stop (gpointer data)
|
||||||
{
|
{
|
||||||
GMainLoop *loop = data;
|
GMainLoop *loop = data;
|
||||||
|
|
||||||
|
#ifdef G_OS_WIN32
|
||||||
|
stop = g_file_test ("STOP", G_FILE_TEST_EXISTS);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (stop)
|
if (stop)
|
||||||
g_main_loop_quit (loop);
|
g_main_loop_quit (loop);
|
||||||
|
|
||||||
@ -93,7 +102,9 @@ child_main (int argc, char *argv[])
|
|||||||
|
|
||||||
loop = g_main_loop_new (NULL, FALSE);
|
loop = g_main_loop_new (NULL, FALSE);
|
||||||
|
|
||||||
|
#ifndef G_OS_WIN32
|
||||||
signal (SIGUSR1, handle_usr1);
|
signal (SIGUSR1, handle_usr1);
|
||||||
|
#endif
|
||||||
g_idle_add (check_stop, loop);
|
g_idle_add (check_stop, loop);
|
||||||
g_main_loop_run (loop);
|
g_main_loop_run (loop);
|
||||||
|
|
||||||
@ -160,6 +171,11 @@ test_child_private (gchar *argv0)
|
|||||||
gchar *child_argv[3];
|
gchar *child_argv[3];
|
||||||
GPid child_pid;
|
GPid child_pid;
|
||||||
|
|
||||||
|
#ifdef G_OS_WIN32
|
||||||
|
g_remove ("STOP");
|
||||||
|
g_assert (!g_file_test ("STOP", G_FILE_TEST_EXISTS));
|
||||||
|
#endif
|
||||||
|
|
||||||
write_or_die (filename, "ABC", -1);
|
write_or_die (filename, "ABC", -1);
|
||||||
map = map_or_die (filename, TRUE);
|
map = map_or_die (filename, TRUE);
|
||||||
|
|
||||||
@ -175,7 +191,7 @@ test_child_private (gchar *argv0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* give the child some time to set up its mapping */
|
/* give the child some time to set up its mapping */
|
||||||
sleep (2);
|
g_usleep (2000000);
|
||||||
|
|
||||||
buffer = (gchar *)g_mapped_file_get_contents (map);
|
buffer = (gchar *)g_mapped_file_get_contents (map);
|
||||||
buffer[0] = '1';
|
buffer[0] = '1';
|
||||||
@ -183,10 +199,14 @@ test_child_private (gchar *argv0)
|
|||||||
buffer[2] = '3';
|
buffer[2] = '3';
|
||||||
g_mapped_file_free (map);
|
g_mapped_file_free (map);
|
||||||
|
|
||||||
|
#ifndef G_OS_WIN32
|
||||||
kill (child_pid, SIGUSR1);
|
kill (child_pid, SIGUSR1);
|
||||||
|
#else
|
||||||
|
g_file_set_contents ("STOP", "Hey there\n", -1, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* give the child some time to write the file */
|
/* give the child some time to write the file */
|
||||||
sleep (2);
|
g_usleep (2000000);
|
||||||
|
|
||||||
if (!g_file_get_contents (childname, &buffer, &len, &error))
|
if (!g_file_get_contents (childname, &buffer, &len, &error))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user