Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Jul 2018 19:11:23 +0000
From:      bugzilla-noreply@freebsd.org
To:        gnome@FreeBSD.org
Subject:   [Bug 214338] [PATCH] devel/glib20: new kqueue() backend for file monitoring
Message-ID:  <bug-214338-6497-XeF8QXRAUW@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-214338-6497@https.bugs.freebsd.org/bugzilla/>
References:  <bug-214338-6497@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D214338

--- Comment #59 from lightside <lightside@gmx.com> ---
(In reply to comment #56)
> Fixed MSTOSBT macro for files/kqueue_fnm.c.
The MSTOSBT macro used in kq_fnm_create function in files/kqueue_fnm.c file=
 as:
kfnm->rate_lim_time_init =3D MSTOSBT(kfnm->s.rate_limit_time_init);

where KQUEUE_MON_RATE_LIMIT_TIME_INIT defined as:
#ifndef KQUEUE_MON_RATE_LIMIT_TIME_INIT
#       define KQUEUE_MON_RATE_LIMIT_TIME_INIT          1000
#endif

and used for "kfms.rate_limit_time_init =3D KQUEUE_MON_RATE_LIMIT_TIME_INIT=
;" in
g_kqueue_file_monitor_is_supported function in files/gkqueuefilemonitor.c f=
ile
before kq_fnm_create function invocation.

If change "<" to  "<=3D" in "for (int64_t i =3D 0; i < 1000; ++i) {" for te=
stcase
in comment #56, then possible to get result for 1000 value:
% cc --version | head -1
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
% cc -O2 -o test test.c
% ./test && echo ok || echo not ok
<..>
998: funct =3D 4286377361, macro =3D -8589935, false
999: funct =3D 4290672328, macro =3D -4294968, false
1000: funct =3D 4294967295, macro =3D -1, false
not ok
% cc -O2 -DFIXED=3D1 -o test test.c
% ./test && echo ok || echo not ok
<..>
998: funct =3D 4286377361, macro =3D 4286377361, true
999: funct =3D 4290672328, macro =3D 4290672328, true
1000: funct =3D 4294967295, macro =3D 4294967295, true
ok
% clang60 --version | head -1
clang version 6.0.1 (tags/RELEASE_601/final)
% clang60 -O2 -o test test.c
% ./test && echo ok || echo not ok
<..>
998: funct =3D 4286377361, macro =3D 4286377361, true
999: funct =3D 4290672328, macro =3D 4290672328, true
1000: funct =3D 4294967295, macro =3D 4294967295, true
ok
% clang60 -O2 -DFIXED=3D1 -o test test.c
% ./test && echo ok || echo not ok
<..>
998: funct =3D 4286377361, macro =3D 4286377361, true
999: funct =3D 4290672328, macro =3D 4290672328, true
1000: funct =3D 4294967295, macro =3D 4294967295, true
ok

In other words, if kfnm->s.rate_limit_time_init was assigned to 1000 value,
then kfnm->rate_lim_time_init maybe assigned to -1 instead of 4294967295, if
compiled without fix for MSTOSBT macro (attachment #195598) with using Clang
3.4.1 base compiler on FreeBSD 10.4 amd64.

Sorry about long explanations.

--=20
You are receiving this mail because:
You are on the CC list for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-214338-6497-XeF8QXRAUW>