summaryrefslogtreecommitdiff
path: root/glib/glib-init.h
Commit message (Collapse)AuthorAgeFilesLines
* glib: Add SPDX license headers automaticallyPhilip Withnall2022-05-181-0/+2
| | | | | | | | | | | | | | Add SPDX license (but not copyright) headers to all files which follow a certain pattern in their existing non-machine-readable header comment. This commit was entirely generated using the command: ``` git ls-files glib/*.[ch] | xargs perl -0777 -pi -e 's/\n \*\n \* This library is free software; you can redistribute it and\/or\n \* modify it under the terms of the GNU Lesser General Public/\n \*\n \* SPDX-License-Identifier: LGPL-2.1-or-later\n \*\n \* This library is free software; you can redistribute it and\/or\n \* modify it under the terms of the GNU Lesser General Public/igs' ``` Signed-off-by: Philip Withnall <pwithnall@endlessos.org> Helps: #1415
* glib/win32: introduce private g_win32_handle_is_socket()Marc-André Lureau2022-05-121-0/+1
| | | | | | Used in following commits, including in some GIO experiments. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* glib/win32: introduce private g_win32_reopen_noninherited()Marc-André Lureau2022-05-121-0/+2
| | | | | | | | | | | Used in following commits, including in some GIO experiments, so make it a private API. For now, this implementation is similar to the glib/gspawn-win32.c one, with mroe error checking and better on error behaviour. A following patch will also fix the case of duplicating sockets. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* Fix process spawning with static build on WindowsLoic Le Page2022-01-271-0/+2
| | | | | | | | | | | | On Windows, process spawning needs an external helper exe which is found relatively to the glib DLL file. If glib has been built statically this file doesn't exist anymore and reference path is not the DLL path anymore but the current executable path. This patch searches for the helper exe taking as starting point the current executable path, relative 'bin', 'lib', 'glib' and 'gio' folders and then gets one level up until the root path. If this search doesn't give result then the helper exe is searched using the PATH variable.
* gwin32.c: Split out call to RtlGetVersion()Chun-wei Fan2021-11-191-0/+1
| | | | | | | | | | | | | | | Unfortunately, we may well be likely to need to call RtlGetVersion() via GetModuleHandle() + GetProcAddress(), so split out the call to RtlGetVersion() into a private function of its own, so that we can reuse the same code in other parts of GLib, so that we can: * Determine better in a more fine-tuned way to determine whether we are on Windows 10/11 and/or Server 2016/2019/2022, since we need to rely on the build number. * Just call RtlGetVersion() once, when needed, as that is all that is needed. We could re-use the same function once to compare what we got when we called RtlGetVersion() and do what is necessary there.
* gerror: Add support for extended errorsKrzesimir Nowak2021-01-061-0/+1
| | | | | | This commit adds a G_DEFINE_EXTENDED_ERROR macro and g_error_domain_register() functions to register extended error domains.
* W32: Add a simple exception handlerРуслан Ижбулатов2019-03-061-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Install a Vectored Exception Handler[0]. Its sole purpose is to catch some exceptions (access violations, stack overflows, illegal instructions and debug breaks - by default, but it can be made to catch any exception for which a code is known) and run a debugger in response. This allows W32 glib applications to be run without a debugger, but at the same time allows a debugger to be attached in case something happens. The debugger is run with a new console, unless an environment variable is set to allow it to inherit the console of the crashing process. The short list of handleable exceptions is there to ensure that this handler won't run a debugger to "handle" utility exceptions, such as the one that is used to communicate thread names to a debugger. The handler is installed to be called last, and shouldn't interfere with any user-installed handlers. There's nothing fancy about the way it runs a debugger (it doesn't even support unicode in paths), and it deliberately avoids using glib code. The handler will also print a bit of information about the exception that it caught, and even more information for well-known exceptions, such as access violation. The whole scheme is similar to AeDebug[1] and, in fact, the signal-event gdb command was originally implemented for this very purpose. [0]: https://docs.microsoft.com/en-us/windows/desktop/debug/vectored-exception-handling [1]: https://docs.microsoft.com/en-us/windows/desktop/debug/configuring-automatic-debugging
* W32: add std stream redirection envvar optionsРуслан Ижбулатов2018-06-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds two W32-only environmental variable checks: * G_WIN32_ALLOC_CONSOLE, if set to 1, will force glib to create a new console if the process has no console by itself. This option is for GUI apps that are launched from GUI processes, in which case there's no console anywhere near them. * G_WIN32_ATTACH_CONSOLE, if set to a comma-separated list of standard stream names (stdint, stdout, stderr), will reopen a given std stream and tie it to the console (using existing console or parent console). This works either with the other option (to create a console), or if the app is launched from a console process (often the case for developers). The redirection is done with freopen(), dup() and dup2(). If everything goes well, C file descriptors 0, 1 or 2 will be bound to stdin, stdout and stderr respectively (only for streams listed in the envrionmental variable), and so will be stdio streams by the same names. With these it's possible to see the output of g_log*() functions when running GTK4 applications, which are linked as GUI applications, and thus do not get a console by default. https://bugzilla.gnome.org/show_bug.cgi?id=790857 Fixes issue #1304
* glib/: LGPLv2+ -> LGPLv2.1+Sébastien Wilmet2017-05-241-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All glib/*.{c,h} files have been processed, as well as gtester-report. 12 of those files are not licensed under LGPL: gbsearcharray.h gconstructor.h glibintl.h gmirroringtable.h gscripttable.h gtranslit-data.h gunibreak.h gunichartables.h gunicomp.h gunidecomp.h valgrind.h win_iconv.c Some of them are generated files, some are licensed under a BSD-style license and win_iconv.c is in the public domain. Sub-directories inside glib/: deprecated/: processed in a previous commit glib-mirroring-tab/: already LGPLv2.1+ gnulib/: not modified, the code is copied from gnulib libcharset/: a copy pcre/: a copy tests/: processed in a previous commit https://bugzilla.gnome.org/show_bug.cgi?id=776504
* Add g_system_thread_set_name() implementation for W32 threadsРуслан Ижбулатов2016-04-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This works by using semi-documented[1] exception to tell the debugger that a thread needs to have its name changed. If this exception is not caught and handled by something, it will crash the process, so we need to set up our own handler in case there's no debugger attached or the debugger can't handle this type of exception. Since SEH is not supported by gcc on i686 (at the moment), we need to use VEH instead. For completeness the MSVC-oriented code still uses SEH, although there is no reason why it shouldn't work with the VEH variant used by MinGW. VEH handler has to be set up somewhere (g_thread_win32_init () works nicely) and removed once it's not needed (g_thread_win32_process_detach () is added expressly for that purpose). Note that g_thread_win32_process_detach() is only called when glib is unloaded by FreeLibrary(), not when glib-using process is terminating. This exception is known to work with WinDbg, and adding support for it into GDB proved to be feasible (GDB patch will be sent upstream, eventually). [1] https://msdn.microsoft.com/en-us/library/xcb2z8hs%28v=vs.71%29.aspx https://bugzilla.gnome.org/show_bug.cgi?id=747478
* Export glib_init via GLIB_PRIVATE_CALLMatthias Clasen2015-10-071-0/+1
| | | | | | | | This will be used in the next commit to call glib_init from the gobject constructor, to ensure proper constructor ordering with non-GNU libc. https://bugzilla.gnome.org/show_bug.cgi?id=756139
* Move quark initialization to a constructorMatthias Clasen2015-09-121-0/+2
| | | | | This removes a branch from the very frequently called quark functions.
* Updated FSF's addressDaniel Mustieles2014-01-311-3/+1
|
* glib-init: fix redundant-decls of g_mem_gc_friendlyDjalal Harouni2013-10-201-1/+0
| | | | | | | | | | | | | | | | | Currently g_mem_gc_friendly is declared in both gmem.h and glib-init.h files, we will have reports on each unit that include these two files. This patch removes the redundant declaration from glib-init.h Since g_mem_gc_friendly is related to gmem.h and was first declared in this header which also exports it via glib.h, then declare it in gmem.h Other files already include gmem.h: garray.c and gslice.c, no need to change anything. Signed-off-by: Djalal Harouni <tixxdz@opendz.org> https://bugzilla.gnome.org/show_bug.cgi?id=710345
* Remove most use of G_GNUC_INTERNALColin Walters2013-01-181-6/+6
| | | | | | | Now that we use an explicit list of symbols to export, the G_GNUC_INTERNAL is redundant. https://bugzilla.gnome.org/show_bug.cgi?id=688681
* win32: Add a monotonic timerAlexander Larsson2011-11-161-0/+1
|
* win32: stop leaking GPrivate dataRyan Lortie2011-10-041-0/+1
| | | | | | | | | | Instead of running the GPrivate destructors from our thread proxy code, run it from the DllMain handler for the DLL_THREAD_DETACH case. This should ensure that thread-local data is free at the exit of all threads -- not just the ones we created for ourselves. https://bugzilla.gnome.org/show_bug.cgi?id=660745
* Deprecate g_thread_init()Ryan Lortie2011-10-041-0/+38
Move the last few things that needed thread-safe initialisation to a global ctor. https://bugzilla.gnome.org/show_bug.cgi?id=660744