-/* $OpenBSD: uipc_socket2.c,v 1.90 2018/02/10 06:00:06 claudio Exp $ */
+/* $OpenBSD: uipc_socket2.c,v 1.91 2018/02/18 19:11:27 kettenis Exp $ */
/* $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $ */
/*
if (cc == 0 || cc > sb_max)
return (1);
sb->sb_hiwat = cc;
- sb->sb_mbmax = max(3 * MAXMCLBYTES, cc * 8);
+ sb->sb_mbmax = max(3 * MAXMCLBYTES,
+ min(cc * 2, sb_max + (sb_max / MCLBYTES) * MSIZE));
if (sb->sb_lowat > sb->sb_hiwat)
sb->sb_lowat = sb->sb_hiwat;
return (0);