diff options
author | wollman <wollman@FreeBSD.org> | 1997-02-18 20:43:07 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 1997-02-18 20:43:07 +0000 |
commit | 348a992441e4cfa6fff7a76bd128868ccc008872 (patch) | |
tree | 42867fb3be45df5695638f4334b3466cd51c6e75 /sys | |
parent | a7fe8a4f0755bc16cc827cc40c168fbaf65f9dee (diff) | |
download | FreeBSD-src-348a992441e4cfa6fff7a76bd128868ccc008872.zip FreeBSD-src-348a992441e4cfa6fff7a76bd128868ccc008872.tar.gz |
uipc_mbuf.c: do a better job of counting how often we have to wait
for memory, or are denied a cluster.
uipc_socket2.c: define some generic ``operation-not-supported'' entry points
for pr_usrreqs.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/uipc_mbuf.c | 22 | ||||
-rw-r--r-- | sys/kern/uipc_sockbuf.c | 35 | ||||
-rw-r--r-- | sys/kern/uipc_socket2.c | 35 |
3 files changed, 86 insertions, 6 deletions
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index d2cb6c0..b816740 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)uipc_mbuf.c 8.2 (Berkeley) 1/4/94 - * $FreeBSD$ + * $Id$ */ #include <sys/param.h> @@ -118,7 +118,12 @@ m_mballoc(nmb, nowait) return (0); nbytes = round_page(nmb * MSIZE); - p = (caddr_t)kmem_malloc(mb_map, nbytes, nowait ? M_NOWAIT : M_WAITOK); + p = (caddr_t)kmem_malloc(mb_map, nbytes, M_NOWAIT); + if (p == 0 && !nowait) { + mbstat.m_wait++; + p = (caddr_t)kmem_malloc(mb_map, nbytes, M_WAITOK); + } + /* * Either the map is now full, or this is nowait and there * are no pages left. @@ -137,9 +142,9 @@ m_mballoc(nmb, nowait) } #if MCLBYTES > PAGE_SIZE -int i_want_my_mcl; +static int i_want_my_mcl; -void +static void kproc_mclalloc(void) { int status; @@ -184,13 +189,16 @@ m_clalloc(ncl, nowait) * to get any more (nothing is ever freed back to the * map). */ - if (mb_map_full) + if (mb_map_full) { + mbstat.m_drops++; return (0); + } #if MCLBYTES > PAGE_SIZE if (nowait) { i_want_my_mcl += ncl; wakeup(&i_want_my_mcl); + mbstat.m_wait++; p = 0; } else { p = contigmalloc1(MCLBYTES * ncl, M_DEVBUF, M_WAITOK, 0ul, @@ -206,8 +214,10 @@ m_clalloc(ncl, nowait) * Either the map is now full, or this is nowait and there * are no pages left. */ - if (p == NULL) + if (p == NULL) { + mbstat.m_drops++; return (0); + } for (i = 0; i < ncl; i++) { ((union mcluster *)p)->mcl_next = mclfree; diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c index 463b4bb..2d753dd7 100644 --- a/sys/kern/uipc_sockbuf.c +++ b/sys/kern/uipc_sockbuf.c @@ -971,7 +971,42 @@ struct pr_usrreqs pru_oldstyle = { * supported by a protocol. Fill in as needed. */ int +pru_accept_notsupp(struct socket *so, struct mbuf *nam) +{ + return EOPNOTSUPP; +} + +int pru_connect2_notsupp(struct socket *so1, struct socket *so2) { return EOPNOTSUPP; } + +int +pru_listen_notsupp(struct socket *so) +{ + return EOPNOTSUPP; +} + +int +pru_rcvd_notsupp(struct socket *so, int flags) +{ + return EOPNOTSUPP; +} + +int +pru_rcvoob_notsupp(struct socket *so, struct mbuf *m, int flags) +{ + return EOPNOTSUPP; +} + +/* + * This isn't really a ``null'' operation, but it's the default one + * and doesn't do anything destructive. + */ +int +pru_sense_null(struct socket *so, struct stat *sb) +{ + sb->st_blksize = so->so_snd.sb_hiwat; + return 0; +} diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c index 463b4bb..2d753dd7 100644 --- a/sys/kern/uipc_socket2.c +++ b/sys/kern/uipc_socket2.c @@ -971,7 +971,42 @@ struct pr_usrreqs pru_oldstyle = { * supported by a protocol. Fill in as needed. */ int +pru_accept_notsupp(struct socket *so, struct mbuf *nam) +{ + return EOPNOTSUPP; +} + +int pru_connect2_notsupp(struct socket *so1, struct socket *so2) { return EOPNOTSUPP; } + +int +pru_listen_notsupp(struct socket *so) +{ + return EOPNOTSUPP; +} + +int +pru_rcvd_notsupp(struct socket *so, int flags) +{ + return EOPNOTSUPP; +} + +int +pru_rcvoob_notsupp(struct socket *so, struct mbuf *m, int flags) +{ + return EOPNOTSUPP; +} + +/* + * This isn't really a ``null'' operation, but it's the default one + * and doesn't do anything destructive. + */ +int +pru_sense_null(struct socket *so, struct stat *sb) +{ + sb->st_blksize = so->so_snd.sb_hiwat; + return 0; +} |