1
0
mirror of https://gitlab.gnome.org/GNOME/glib.git synced 2026-10-24 00:49:00 +03:00
Commit Graph

33147 Commits

Author SHA1 Message Date
Emmanuele Bassi
399b0271dd Force the visibility of the gtype_id global
Since we cannot use GOBJECT_VAR, and we don't have a way to add
caller-specific annotations, we default to making the gtype_id global
visible by default everywhere.
2026-08-08 11:07:54 +01:00
Emmanuele Bassi
af1a2b5bc5 fixup! Use C11 standard atomics for g_type_once() 2026-08-08 10:56:14 +01:00
Emmanuele Bassi
0fe0333546 fixup! Add g_super() macro 2026-08-08 10:52:08 +01:00
Emmanuele Bassi
0f310a417f fixup! Register a global variable for object types 2026-08-08 10:51:38 +01:00
Emmanuele Bassi
726a963517 Add g_class() macro
A macro to replace per-type GET_CLASS macros/inlines.
2026-08-08 10:50:08 +01:00
Emmanuele Bassi
d90d632459 Add g_super() macro
A replacement for the shouty and verbose:

    PARENT_CLASS (instance_parent_class)

pattern that improves readability.
2026-08-07 16:04:51 +01:00
Emmanuele Bassi
54d217d4cc Add macro availability annotations
For g_gtype(), g_is_a(), and g_as(), so that the compiler will warning
if they are used outside of the allowed versions.
2026-08-06 17:50:03 +01:00
Emmanuele Bassi
3dd6a48317 Mark atomic GType operators as "protected"
Do not document them, like we do for other symbols that are public just
because macros require them to be.
2026-08-06 17:49:09 +01:00
Emmanuele Bassi
127f250bff fixup! Use C11 standard atomics for g_type_once() 2026-07-19 15:02:48 +02:00
Emmanuele Bassi
88d125b048 fixup! Use C11 standard atomics for g_type_once() 2026-07-19 14:53:12 +02:00
Emmanuele Bassi
32f0c13a7a Add compatibility GType getter for GObject
Both GObject and GInitiallyUnowned should work with the new g_is_a(),
g_as(), and g_gtype() operators.
2026-07-19 14:49:26 +02:00
Emmanuele Bassi
6e05bbdd49 Use C11 standard atomics for g_type_once()
Fall back to other atomic access if C11 atomics are not available.
2026-07-19 14:49:26 +02:00
Emmanuele Bassi
4e85e6d20e gbinding: Use the newly added API for type operations 2026-07-19 14:43:00 +02:00
Emmanuele Bassi
3071e772ac Move GObject autocleanups to gobject.h
This way we can define GObject types using G_DECLARE_* macros inside
libgobject itself.
2026-07-19 14:43:00 +02:00
Emmanuele Bassi
053b9eabb4 Register a global variable for object types
Instead of forcing the call to the get_type() function to get a GType,
we can introduce a global variable when using G_DECLARE_* and G_DEFINE_*
macros, and wrap its access with a generated static inline.

The variable is set under a once-time lock when calling the get_type()
function, and it is read atomically. If the global variable is unset, we
call the get_type() function, which will set the variable for
subsequent calls.
2026-07-19 14:43:00 +02:00
Philip Withnall
f91e4a3365 Merge branch 'solaris-iptosmessage-skip' into 'main'
gio/tests: Skip iptosmessage on Solaris

Closes #3994

See merge request GNOME/glib!5250
2026-07-15 08:40:48 +00:00
Martin Rehak
a0c1fc4e7a gio/tests: Skip iptosmessage on Solaris 2026-07-15 09:01:33 +02:00
Philip Withnall
06dd223a3a Merge branch 'gcc16-fixes' into 'main'
tests: Minor compiler warning fixes for GCC16

See merge request GNOME/glib!5248
2026-07-14 14:38:48 +00:00
Philip Withnall
b9550be9c4 Merge branch 'stream-close-docs' into 'main'
giostream: Clarify is_closed() method docs for streams

See merge request GNOME/glib!5230
2026-07-14 12:15:20 +00:00
Philip Withnall
19cc82488e tests: Move a feature test macro definition
Feature test macros always need to be defined before any headers are
included. This triggers a redefinition warning with GCC 16 and the new
gnu11 C level.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2026-07-14 12:43:32 +01:00
Philip Withnall
f90d3683d7 tests: Fix some const warnings
GCC 16 is a little better than before at detecting accidentally dropped
`const` modifiers.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2026-07-14 12:42:00 +01:00
Philip Withnall
977d6e8607 2.89.2
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2.89.2
2026-07-14 12:18:36 +01:00
Philip Withnall
71aadcdbf2 Merge branch 'joantolo/fix-unown-name' into 'main'
gdbusnameowning: Downgrade ReleaseName warning on closed connection to debug

See merge request GNOME/glib!5247
2026-07-14 10:58:30 +00:00
Joan Torres Lopez
23dbc305bd gdbusnameowning: Downgrade ReleaseName warning on closed connection to debug
g_bus_unown_name() calls ReleaseName synchronously after checking that
the connection is still open. However, the connection can close on the
worker thread between the check and the call, which commonly happens
during session shutdown when the bus daemon exits while clients are
still running cleanup code.

When this race occurs, the ReleaseName call fails with G_IO_ERROR_CLOSED
and produces a spurious warning in the journal. Downgrade to g_debug
since the name release is best-effort — the bus daemon is gone, so the
name is already unowned.
2026-07-13 21:46:02 +02:00
Philip Withnall
eadc02e907 giostream: Clarify is_closed() method docs for streams
The behaviour has to be this way, if users think for a minute about how
pipes/sockets/FDs work (one end does not get a notification that the
other end has closed them without doing a read/write).

However, that’s not at all hinted at by the documentation, so let’s add
something to clarify that for people who are in a hurry.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2026-07-13 16:21:28 +01:00
Philip Withnall
34c38ee7ab Merge branch 'update-translation-ro-from-main-90cdc810-7d03-11f1-901d-0a580a800019' into 'main'
Update Romanian translation

See merge request GNOME/glib!5244
2026-07-13 10:16:03 +00:00
Philip Withnall
02de4bcd17 Merge branch 'update-translation-sl-from-main-a281169a-7e0f-11f1-9736-0a580a8304c0' into 'main'
Update Slovenian translation

See merge request GNOME/glib!5245
2026-07-13 10:15:57 +00:00
Martin
3fc8c06033 Update Slovenian translation
Co-authored-by: Martin <miles@filmsi.net>
2026-07-12 16:35:16 +00:00
Antonio Marin
eeb3e71750 Update Romanian translation
Co-authored-by: Antonio Marin <gnmer.6qxyg@slmail.me>
2026-07-11 08:36:17 +00:00
Philip Withnall
b3a124f501 Merge branch '3985-gdbus-auth-limiting' into 'main'
gdbusauth: Limit length of lines read from client

Closes #3985

See merge request GNOME/glib!5240
2026-07-10 14:53:01 +00:00
Philip Withnall
ea386571f9 Merge branch 'alexk/gpoll' into 'main'
gpoll: Correctly zero-out heap-allocated fd_sets on macOS

See merge request GNOME/glib!5238
2026-07-10 14:51:23 +00:00
Alex Kirszenberg
2c9b6d7b35 gpoll: Correctly zero-out heap-allocated fd_sets on macOS 2026-07-10 14:51:23 +00:00
Philip Withnall
8729ab2477 Merge branch 'glib2_tests' into 'main'
gio/tests: skip unsupported IP TOS tests on AIX

See merge request GNOME/glib!5236
2026-07-09 11:15:11 +00:00
Philip Withnall
a01a1fd091 Merge branch 'gdbus-serialization-no-autofree' into 'main'
gdbus-serialization.c: Avoid g_autofree

See merge request GNOME/glib!5237
2026-07-09 10:41:22 +00:00
Chun-wei Fan
54e2b75692 gdbus-serialization.c: Avoid g_autofree
Sadly, this code may still be built with Visual Studio, so avoid
g_autofree here.
2026-07-09 10:41:21 +00:00
Philip Withnall
444949c141 Merge branch 'fix-typelib-test-msvc' into 'main'
tests: Fix gi-inspect-typelib.py on Visual Studio

See merge request GNOME/glib!5235
2026-07-09 10:31:29 +00:00
Chun-wei Fan
216aaafe84 tests: Fix gi-inspect-typelib.py on Visual Studio
...and Visual Studio-style builds. These builds do not build DLLs with a
'lib' prefix, and therefore the test would fail as a 'lib' prefix is
expected.

Check in the script whether we are running in a MSVC-style environment,
by checking the envvars that the various vcvars*.bat's, which is used
to setup a Visual Studio command prompt, set.
2026-07-09 18:07:13 +08:00
Philip Withnall
1a7fc34d68 Merge branch 'nm-systemd/netlink-optimize2' into 'main'
gnetworkmonitornetlink: Performance improvements by following iproute2 behavior

See merge request GNOME/glib!5232
2026-07-08 18:24:42 +00:00
Parth Patel
146c7e24cc gio/tests: skip unsupported IP TOS tests on AIX
AIX does not support IP_RECVTOS and IPV6_RECVTCLASS.
Skip the corresponding tests to avoid failures on AIX.
2026-07-08 11:46:34 -05:00
Philip Withnall
c4c8353bb5 Merge branch 'fix-3719' into 'main'
win32: Fix walking UNC path when searching for helper executable

Closes #3719

See merge request GNOME/glib!5231
2026-07-08 15:36:38 +00:00
Philip Withnall
ccfef2efac Merge branch 'glib2_issue3500_2' into 'main'
gmain: fix poll.h include order on AIX

See merge request GNOME/glib!5234
2026-07-08 15:09:22 +00:00
Parth Patel
00c849914f gmain: fix poll.h include order on AIX
On AIX, poll.h must be included before other GLib headers to
avoid build failures.

The fix was required because of this commit: 42283ffb
After the above commit, "glib.h" started being included before <poll.h>.

This was also discussed in !4355 (merged). The root cause was the include order in gmain.c:
gmain.c -> glib-unix.h -> glib.h -> giochannel.h -> gmain.h -> gpoll.h
However, <poll.h> was being included only after glib-unix.h in gmain.c, which caused the issue.

To resolve this, we moved the #include <poll.h> directive to the beginning of the file.

This implements the fix discussed in:
https://gitlab.gnome.org/GNOME/glib/-/work_items/3500
2026-07-08 04:17:32 -05:00
Sorah Fukumori
e3e2b8089a gnetworkmonitornetlink: Exclude the route cache from the table dump
The construction dump sent a bare `rtgenmsg` `RTM_GETROUTE`, which the
kernel answers through the non-strict path with route-cache exceptions
included (cloned PMTU and redirect routes). On a host with large route
tables those clones are numerous and churn constantly, which has two
costs: the dump walks far more entries, and every clone change bumps the
IPv6 FIB generation, so the kernel restarts the IPv6 dump from the root
over and over (`fib6_dump_table()`) and one dump request balloons into
dozens of re-walks. On a full-table BGP router this made the dump ~30x
larger than the table and tens of seconds long, against ~3s for `ip route
show table all`.

Enable `NETLINK_GET_STRICT_CHK` and send an `rtmsg`: under strict checking
the kernel reads `rtm_flags` and, with `RTM_F_CLONED` unset, leaves the
cache exceptions out of the dump (`dump_exceptions = false`), returning FIB
routes only. This is how iproute2 issues route dumps. The option is
feature-detected and its failure is non-fatal, falling back to the heavier
dump.

The setsockopt level `SOL_NETLINK` is defined in the kernel's
`<linux/socket.h>`, not the uapi `<linux/netlink.h>` that provides
`NETLINK_GET_STRICT_CHK`, so an older libc can expose the option constant
without the level. Define it as a fallback, matching iproute2
(`lib/libnetlink.c`).

Signed-off-by: Sorah Fukumori <her@sorah.jp>
2026-07-07 03:09:13 +09:00
Sorah Fukumori
929df99116 gnetworkmonitornetlink: Enlarge netlink socket receive buffers
The route-monitor socket used the default receive buffer (net.core.rmem_default,
typically ~208 KiB). On a host with a large or busy routing table the
initial dump and the stream of unsolicited route changes can overrun it,
which surfaces as ENOBUFS and forces a full re-dump to resync.

Request a 1 MiB receive buffer on the netlink sockets, as iproute2 does
unconditionally in `rtnl_open_byproto()`. The kernel clamps the request to
net.core.rmem_max, so this is best-effort for an unprivileged process, but
it matches the headroom every other rtnetlink client runs with.

Signed-off-by: Sorah Fukumori <her@sorah.jp>
2026-07-07 03:04:48 +09:00
Sorah Fukumori
dcc9f099d4 gnetworkmonitornetlink: Read netlink dumps into a fixed-size buffer
The route-monitor socket sized each read to the exact length of the next
datagram, learned with an MSG_PEEK probe, and allocated that much. The
kernel grows route-dump datagrams only up to the largest buffer the socket
has ever been read with (`nlk->max_recvmsg_len`, see
`net/netlink/af_netlink.c`), so reading exact-sized buffers keeps that
ceiling at one page and forces a full-table dump to arrive in ~4 KiB
datagrams, an order of magnitude more datagrams and syscalls than `ip
route` (which reads into a fixed 32 KiB buffer).

Read into a single buffer sized at `NETLINK_MESSAGE_MAX_SIZE` instead. The
kernel then packs the dump into its 32 KiB datagram ceiling, and the
MSG_PEEK round-trip per datagram is gone. `MSG_TRUNC` guards the
theoretical oversized datagram, which the generous bound makes impossible
for route messages in practice.

Signed-off-by: Sorah Fukumori <her@sorah.jp>
2026-07-07 03:04:33 +09:00
Philip Withnall
fef3619b70 Merge branch 'ebassi/c11-toolchain-req' into 'main'
Update toolchain requirement to C11

See merge request GNOME/glib!3574
2026-07-06 16:11:14 +00:00
Emmanuele Bassi
9c7202a393 Revert "build: Add -Wno-typedef-redefinition to CFLAGS"
This reverts commit 5b0ae99e9a.

We now require a C11 toolchain, which explicitly supports typedef
redefinition.
2026-07-06 16:33:04 +01:00
Emmanuele Bassi
eaec725d99 docs: Update toolchain requirement to C11
We have recommended C11 support since commit 5697c11f (September 2023).
It is time to upgrade the recommendation to a requirement.
2026-07-06 16:28:34 +01:00
Emmanuele Bassi
d6a9be139d build: Update the default C standard
Request C11 support (with GNU extensions, if available).
2026-07-06 16:26:41 +01:00
Philip Withnall
45d653d7f8 Merge branch 'nm-systemd/netlink-optimize' into 'main'
GNetworkMonitor: Stop pulling route table on sd-networkd hosts

See merge request GNOME/glib!5222
2026-07-06 15:24:15 +00:00