On Fri, Sep 27, 2013 at 12:00:40PM -0400, Kenneth R Westerback wrote:
> I'm not sure what the 'rule' is regarding ENOMEM and ENOBUFS, but
> ENOMEN seems more appropriate to me.

man 2 errno

     12 ENOMEM Cannot allocate memory. The new process image required more
             memory than was allowed by the hardware or by system-imposed
             memory management constraints.  A lack of swap space is normally
             temporary; however, a lack of core is not.  Soft limits may be
             increased to their corresponding hard limits.

     55 ENOBUFS No buffer space available. An operation on a socket or pipe
             was not performed because the system lacked sufficient buffer
             space or because a queue was full.

According to this, ENOMEM looks very much like memory allocation
failure for the user space.  In my case we ran out of network device
memory, so I think ENOBUFS is more appropriate.

The kernel code is not very consistent there.  Developers are tempted
to use ENOMEM when malloc(9) fails, but the man page says something
different.

bluhm

Reply via email to