Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Sep 2023 18:58:58 +0000
From:      cglogic <cglogic@protonmail.com>
To:        dev-commits-src-main@FreeBSD.org
Subject:   Re: git: fb5daae920ba - main - timerfd: Namespace pollution  adjustments
Message-ID:  <kumtnEYa8yfnNceFxNMc9iJ15yTgc487_d_UTK7LjnhlTB0xjgCW3q-j_y-82gIiY7Krvhr8k7Gbmp_V2Niqi8sh4XMld9FSF7-EA5fMa4g=@protonmail.com>
In-Reply-To: <202309052226.385MQF5F075354@gitrepo.freebsd.org>
References:  <202309052226.385MQF5F075354@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Is it planned to MFC this and related timerfd commits to stable/14?
It should help build some ports.

------- Original Message -------
On Wednesday, September 6th, 2023 at 1:26 AM, Warner Losh <imp@FreeBSD.org>=
 wrote:


> The branch main has been updated by imp:
>=20
> URL: https://cgit.FreeBSD.org/src/commit/?id=3Dfb5daae920bae84e3eec8175bf=
9e46304c3b2ae6
>=20
> commit fb5daae920bae84e3eec8175bf9e46304c3b2ae6
> Author: Jake Freeland jfree@FreeBSD.org
>=20
> AuthorDate: 2023-09-05 22:11:50 +0000
> Commit: Warner Losh imp@FreeBSD.org
>=20
> CommitDate: 2023-09-05 22:25:01 +0000
>=20
> timerfd: Namespace pollution adjustments
>=20
> Do not pollute userspace with <sys/proc.h>, instead declare struct thread
>=20
> when _KERNEL is defined.
>=20
> Include <sys/time.h> instead of <sys/timespec.h>. This causes intentional
>=20
> namespace pollution that mimics Linux. g/musl libcs include <time.h> in
>=20
> their <sys/timerfd.h>, exposing clock gettime, settime functions and
>=20
> CLOCK_ macro constants. Ports like Chromium expect this namespace
> pollution and fail without it.
>=20
> MFC After: 3 days
> Reviewed by: imp, markj
> Differential Revision: https://reviews.freebsd.org/D41641
> ---
> sys/sys/timerfd.h | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>=20
> diff --git a/sys/sys/timerfd.h b/sys/sys/timerfd.h
> index 8cb9939ba60f..cace3b71498c 100644
> --- a/sys/sys/timerfd.h
> +++ b/sys/sys/timerfd.h
> @@ -30,8 +30,12 @@
>=20
> #include <sys/types.h>
>=20
> #include <sys/fcntl.h>
>=20
> -#include <sys/proc.h>
>=20
> -#include <sys/timespec.h>
>=20
> +/*
> + * We only need <sys/timespec.h>, but glibc pollutes the namespace
>=20
> + * with <time.h>. This pollution is expected by most programs, so
>=20
> + * reproduce it by including <sys/time.h> here.
>=20
> + */
> +#include <sys/time.h>
>=20
>=20
> typedef uint64_t timerfd_t;
>=20
> @@ -54,6 +58,8 @@ __END_DECLS
>=20
> #else /* _KERNEL */
>=20
> +struct thread;
> +
> int kern_timerfd_create(struct thread *td, int clockid, int flags);
> int kern_timerfd_gettime(struct thread *td, int fd,
> struct itimerspec *curr_value);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?kumtnEYa8yfnNceFxNMc9iJ15yTgc487_d_UTK7LjnhlTB0xjgCW3q-j_y-82gIiY7Krvhr8k7Gbmp_V2Niqi8sh4XMld9FSF7-EA5fMa4g=>