Re: [PATCHv2] w using logind instead of utmp
"Craig Small" <[email protected]> ("csmall") Sun, 25 Jun 2023 10:23:48 +1000
| Newsgroups | gmane.linux.procps.devel |
|---|---|
| Message-ID | <CALy8Cw6hc-eM85BAzB33EH6uMmm46g6svqUADNfQrHd1yHWh2Q@mail.gmail.com> |
--00000000000013330c05fee940ec
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Hi Thorsten,
Not sure if this was introduced in the latest patch but there's a problem
I've found now.
Line 199 conditionally has the session added to the print_from function,
but subsequent calls to print_from are not conditional.
So without systemd line 590 is calling with 4 arguments, but the definition
at line 199 only has 3.
src/w.c: In function =E2=80=98showinfo=E2=80=99:
src/w.c:590:34: warning: passing argument 2 of =E2=80=98print_from=E2=80=99=
makes integer
from pointer without a cast [-Wint-conversion]
590 | print_from(NULL, u, ip_addresses, fromlen);
| ^
| |
| utmp_t * {aka struct utmpx *}
src/w.c:211:66: note: expected =E2=80=98int=E2=80=99 but argument is of typ=
e =E2=80=98utmp_t *=E2=80=99
{aka =E2=80=98struct utmpx *=E2=80=99}
211 | const utmp_t *restrict const u, const int
ip_addresses, const int fromlen) {
|
~~~~~~~~~~^~~~~~~~~~~~
src/w.c:590:17: error: too many arguments to function =E2=80=98print_from=
=E2=80=99
590 | print_from(NULL, u, ip_addresses, fromlen);
| ^~~~~~~~~~
src/w.c:207:13: note: declared here
207 | static void print_from(
| ^~~~~~~~~~
src/w.c:616:30: warning: passing argument 2 of =E2=80=98print_from=E2=80=99=
makes integer
from pointer without a cast [-Wint-conversion]
616 | print_from(NULL, u, ip_addresses, fromlen);
| ^
| |
| utmp_t * {aka struct utmpx *}
src/w.c:211:66: note: expected =E2=80=98int=E2=80=99 but argument is of typ=
e =E2=80=98utmp_t *=E2=80=99
{aka =E2=80=98struct utmpx *=E2=80=99}
211 | const utmp_t *restrict const u, const int
ip_addresses, const int fromlen) {
|
~~~~~~~~~~^~~~~~~~~~~~
src/w.c:616:13: error: too many arguments to function =E2=80=98print_from=
=E2=80=99
616 | print_from(NULL, u, ip_addresses, fromlen);
| ^~~~~~~~~~
On Fri, 23 Jun 2023 at 19:58, Thorsten Kukuk <[email protected]>
wrote:
>
> Hi,
>
> even if I wrote some days ago I have no updated patch for w, now I have
> one. I found one bug and one optimization during daily usage.
>
> Attached is a new patch, maily using "sd_session_get_start_time()"
> instead of "sd_uid_get_login_time()" and don't get the session PID for
> every PID comparisation again, it will not change, so fetch it only
> once.
>
> Thorsten
>
> --
> Thorsten Kukuk, Distinguished Engineer, Senior Architect, Future
> Technologies
> SUSE Software Solutions Germany GmbH, Frankenstra=C3=9Fe 146, 90461 Nuern=
berg,
> Germany
> Managing Director: Ivo Totev, Andrew Myers, Andrew McDonald, Martje
> Boudien Moerman
> (HRB 36809, AG N=C3=BCrnberg)
>
--00000000000013330c05fee940ec
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>Hi Thorsten,</div><div>=C2=A0 Not sure if this was in=
troduced in the latest patch but there's a problem I've found now.<=
/div><div><br></div><div>Line 199 conditionally has the session added to th=
e print_from function, but subsequent calls to print_from are not condition=
al.</div><div>So without systemd line 590 is calling with 4 arguments, but =
the definition at line 199 only has 3.<br></div><div><br></div><div>src/w.c=
: In function =E2=80=98showinfo=E2=80=99:<br>src/w.c:590:34: warning: passi=
ng argument 2 of =E2=80=98print_from=E2=80=99 makes integer from pointer wi=
thout a cast [-Wint-conversion]<br>=C2=A0 590 | =C2=A0 =C2=A0 =C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 print_from(NULL, u, ip_addresses, fromlen);<br=
>=C2=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0^<br>=
=C2=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|<br>=C2=
=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0utmp_t * {ak=
a struct utmpx *}<br>src/w.c:211:66: note: expected =E2=80=98int=E2=80=99 b=
ut argument is of type =E2=80=98utmp_t *=E2=80=99 {aka =E2=80=98struct utmp=
x *=E2=80=99}<br>=C2=A0 211 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0const utmp_t *restrict const u, const=
int ip_addresses, const int fromlen) {<br>=C2=A0 =C2=A0 =C2=A0 | =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0~~~~~~~~~~^~~~~~~~~~~~<br>src/w.c:=
590:17: error: too many arguments to function =E2=80=98print_from=E2=80=99<=
br>=C2=A0 590 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pri=
nt_from(NULL, u, ip_addresses, fromlen);<br>=C2=A0 =C2=A0 =C2=A0 | =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ^~~~~~~~~~<br>src/w.c:207:=
13: note: declared here<br>=C2=A0 207 | static void print_from(<br>=C2=A0 =
=C2=A0 =C2=A0 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ^~~~~~~~~~<br>src=
/w.c:616:30: warning: passing argument 2 of =E2=80=98print_from=E2=80=99 ma=
kes integer from pointer without a cast [-Wint-conversion]<br>=C2=A0 616 | =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 print_from(NULL, u, ip_addresses,=
fromlen);<br>=C2=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0^<br>=C2=
=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|<br>=C2=A0 =C2=A0 =C2=A0 =
| =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0utmp_t * {aka struct utmpx *}<br>src/w.c:211=
:66: note: expected =E2=80=98int=E2=80=99 but argument is of type =E2=80=98=
utmp_t *=E2=80=99 {aka =E2=80=98struct utmpx *=E2=80=99}<br>=C2=A0 211 | =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0const utmp_t *restrict const u, const int ip_addresses, const int=
fromlen) {<br>=C2=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0~~~~~~~~~~^~~~~~~~~~~~<br>src/w.c:616:13: error: too many argu=
ments to function =E2=80=98print_from=E2=80=99<br>=C2=A0 616 | =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 print_from(NULL, u, ip_addresses, fromlen);=
<br>=C2=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ^~~~~~=
~~~~<br></div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=
=3D"gmail_attr">On Fri, 23 Jun 2023 at 19:58, Thorsten Kukuk <<a href=3D=
"mailto:[email protected]">[email protected]</a>> wr=
ote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px=
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Hi,<br>
<br>
even if I wrote some days ago I have no updated patch for w, now I have<br>
one. I found one bug and one optimization during daily usage.<br>
<br>
Attached is a new patch, maily using "sd_session_get_start_time()"=
;<br>
instead of "sd_uid_get_login_time()" and don't get the sessio=
n PID for<br>
every PID comparisation again, it will not change, so fetch it only<br>
once.<br>
<br>
=C2=A0 Thorsten<br>
<br>
-- <br>
Thorsten Kukuk, Distinguished Engineer, Senior Architect, Future Technologi=
es<br>
SUSE Software Solutions Germany GmbH, Frankenstra=C3=9Fe 146, 90461 Nuernbe=
rg, Germany<br>
Managing Director: Ivo Totev, Andrew Myers, Andrew McDonald, Martje Boudien=
Moerman<br>
(HRB 36809, AG N=C3=BCrnberg)<br>
</blockquote></div>
--00000000000013330c05fee940ec--