Mathieu Dube wrote:
> when accept return -1 perror gives me "No buffer space available"
> What do you think that means??
Better ask a real net guru :-)
Or look at the sources.
in /usr/src/linux/net/ipv4/af_inet.c
int inet_create() {
...
sk = sk_alloc(PF_INET, GFP_KERNEL, 1);
if (sk == NULL)
goto do_oom;
...
do_oom:
return -ENOBUFS;
in /usr/src/linux/net/core/sock.c
/*
* All socket objects are allocated here. This is for future
* usage.
*/
struct sock *sk_alloc(int family, int priority, int zero_it)
{
struct sock *sk = kmem_cache_alloc(sk_cachep, priority);
if(sk) {
if (zero_it)
memset(sk, 0, sizeof(struct sock));
sk->family = family;
}
return sk;
}
void __init sk_init(void)
{
sk_cachep = kmem_cache_create("sock", sizeof(struct sock), 0,
SLAB_HWCACHE_ALIGN, 0, 0);
}
Poking around a little in mm/slab.c, I see that the name passed to
kmem_cache_create is used in generating the /proc/slabinfo report, so
cat /proc/slabinfo | grep sock
shows you some info. On my system, it prints two numbers, from
len += sprintf(buf+len, "%-17s %6lu %6lu\n", cachep->c_name, active_objs, num_objs);
which tells you how many sockets are allocated. Dunno how useful that is.
Like I said, you'll have to ask a real guru :-)
- Dan