Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Jun 2017 12:43:48 +0000
From:      John <jwd@FreeBSD.org>
To:        Jeremie Le Hen <jlh@freebsd.org>
Cc:        Slawa Olhovchenkov <slw@zxy.spb.ru>, freebsd-arch@freebsd.org
Subject:   Re: rtools were deemed almost unused 15 years ago...
Message-ID:  <20170626124348.GA11618@FreeBSD.org>
In-Reply-To: <CAGSa5y1o300nthcsRd1pGzy04SjMrmRWtRrp4DP_NrpqF2rr=g@mail.gmail.com>
References:  <CAGSa5y3kVajpSSJUT9Vt0-dTwtaXMwNWvv_ELH14z68osM0UYA@mail.gmail.com> <CAGSa5y1=1zN0ywKQ--HTi%2BDY18M5o%2BGR0fv6CyaaF9WX-z9BZg@mail.gmail.com> <20170625130923.GD18123@zxy.spb.ru> <CAGSa5y1o300nthcsRd1pGzy04SjMrmRWtRrp4DP_NrpqF2rr=g@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--VbJkn9YxBvnuCH5J
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

----- Jeremie Le Hen's Original Message -----
> On Sun, Jun 25, 2017 at 3:09 PM, Slawa Olhovchenkov <slw@zxy.spb.ru> wrot=
e:
> > On Sat, Jun 24, 2017 at 10:29:22PM +0200, Jeremie Le Hen wrote:
> >
> >> So the first step was to create a port with FreeBSD rcmds, here we
> >> are!  But I need some eyes to vet it:
> >> https://reviews.freebsd.org/D11345
> >
> > 1. Create port
> > 2. Port unmantained
> > 3. Port broken
> > 4. Port removed.
> > 5. Lack of functionality.
>=20
> Feel free to step in to help with the maintenance :-).

Let's commit this little snippet which is a major win for HA heads
with 10 of thousands of file descriptors open...

Index: libexec/rshd/rshd.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- libexec/rshd/rshd.c (revision 316672)
+++ libexec/rshd/rshd.c (working copy)
@@ -191,7 +191,7 @@
        struct passwd *pwd;
        u_short port;
        fd_set ready, readfrom;
-       int cc, fd, nfd, pv[2], pid, s;
+       int cc, nfd, pv[2], pid, s;
        int one =3D 1;
        const char *cp, *errorstr;
        char sig, buf[BUFSIZ];
@@ -496,8 +496,7 @@
 #ifdef USE_BLACKLIST
        blacklist(0, STDIN_FILENO, "success");
 #endif
-       for (fd =3D getdtablesize(); fd > 2; fd--)
-               (void) close(fd);
+       closefrom(3);
        if (setsid() =3D=3D -1)
                syslog(LOG_ERR, "setsid() failed: %m");
        if (setlogin(pwd->pw_name) < 0)

Cheers,
John

> --=20
> Jeremie Le Hen
> jlh@FreeBSD.org
> _______________________________________________
> freebsd-arch@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-arch
> To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"

--VbJkn9YxBvnuCH5J
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQF8BAEBCgBmBQJZUQGEXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQwNDBGOTgxNzM0NzQ3OEFBNDYyODNGQzVC
NjI0OTlBMTQyNEY3RjgxAAoJELYkmaFCT3+BYkEIAIBroqvSXOfP2s98/1+ZkCJg
wgE7KxXP4FuPIahYB+gVUT/icY8PVD9yYHU5K28cf6+l8Jx2jeVBXMMPbhMtzk6R
own4/na4RzJ5cxAHMpKzleO4UcaKWo0DWOcetB3CMts3Fy2YqGxc92qcHbTyoEeH
DRLI7OYtg0h3spOAQJGBhZ7YcVvay+FIZDIlxx3qXESFCAiyhw4I9ZgrRN6WpHzP
qZClJVmSfw3EuREd6o9pFyVyE5XnYUX1ddA1wIViEifh0GxG8RIkGHNI9YNWKdpx
D2nd3jtDjdVpGaA/Un+u6ZHWb0pjVRyk3WKWzXCIcr0PqaEdPyE/XNdUT0Ic8iU=
=XAH3
-----END PGP SIGNATURE-----

--VbJkn9YxBvnuCH5J--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170626124348.GA11618>