Subject: lmin in sbspace
To: None <tech-net@netbsd.org>
From: Scott Barron <sb125499@oak.cats.ohiou.edu>
List: tech-net
Date: 08/06/2001 13:00:35
--GBuTPvBEOL0MYPgd
Content-Type: multipart/mixed; boundary="bpVaumkpfGNUagdU"
Content-Disposition: inline
--bpVaumkpfGNUagdU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hello,
Going through some things today I noticed a comment above the sbspace macro
in socketvar.h stating it should use lmin instead of imin but lmin doesn't
exist. I saw the lmin.c code in libkern and wondered if there was still a
reason to not use lmin or if nobody had gotten around to it. If it is the
latter I've attached a patch to socketvar.h to change it to use lmin.
Thanks,
-Scott
--bpVaumkpfGNUagdU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="socketvar.h.patch"
Content-Transfer-Encoding: quoted-printable
--- socketvar.h.orig Mon Aug 6 12:53:06 2001
+++ socketvar.h Mon Aug 6 12:55:17 2001
@@ -158,14 +158,11 @@
=20
/*
* How much space is there in a socket buffer (so->so_snd or so->so_rcv)?
- * This is problematical if the fields are unsigned, as the space might
- * still be negative (cc > hiwat or mbcnt > mbmax). Should detect
- * overflow and return 0. Should use "lmin" but it doesn't exist now.
*/
-#define sbspace(sb) \
- ((long) imin((int)((sb)->sb_hiwat - (sb)->sb_cc), \
- (int)((sb)->sb_mbmax - (sb)->sb_mbcnt)))
-
+#define sbspace(sb) \
+ (lmin((sb)->sb_hiwat - (sb)->sb_cc, \
+ (sb)->sb_mbmax - (sb)->sb_mbcnt))
+=20
/* do we have to send all at once on a socket? */
#define sosendallatonce(so) \
((so)->so_proto->pr_flags & PR_ATOMIC)
--bpVaumkpfGNUagdU--
--GBuTPvBEOL0MYPgd
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (NetBSD)
Comment: For info see http://www.gnupg.org
iD8DBQE7bttCvqYRQQGcpIQRAg5iAJ4ocFNzb9I2UTGhb6/yvwx7bgJbeQCfd0EL
fjMQv9fj/blPp1Ik26+bLEA=
=QI6R
-----END PGP SIGNATURE-----
--GBuTPvBEOL0MYPgd--