Subject: lmin in sbspace
To: None <>
From: Scott Barron <>
List: tech-net
Date: 08/06/2001 13:00:35
Content-Type: multipart/mixed; boundary="bpVaumkpfGNUagdU"
Content-Disposition: inline

Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


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.


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 @@
  * 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))
 /* do we have to send all at once on a socket? */
 #define	sosendallatonce(so) \
 	((so)->so_proto->pr_flags & PR_ATOMIC)


Content-Type: application/pgp-signature
Content-Disposition: inline

Version: GnuPG v1.0.6 (NetBSD)
Comment: For info see