diff mbox

getifaddrs() and CONFIG_PAGE_SIZE_16KB=y

Message ID CAHjYbdFghCRPB3we_+_wwXcSa+WbhwGEcP=LLJgHZ480VO+hzQ@mail.gmail.com
State Accepted
Commit cf0234de47b019ac24e2d361d6386fdfad48f119
Headers show

Commit Message

nenhard March 29, 2015, 6:08 p.m. UTC
Thanks, here is a workaround.
Can someone do a proper patch?


2015-03-29 19:40 GMT+02:00 Rich Felker <dalias@libc.org>:

> On Sun, Mar 29, 2015 at 02:03:47PM +0200, Nenad Kljajić wrote:
> > When I compiled MIPS32 kernel with option CONFIG_PAGE_SIZE_16KB=y
> >  getifaddrs() fails with 'Device or resource busy'.
>
> Netlink sockets require a page-sized buffer for the response. uClibc
> probably has a hard-coded 4k or 8k result buffer rather than using the
> current page size...
>
> Rich
>

Comments

Rich Felker March 29, 2015, 7:02 p.m. UTC | #1
On Sun, Mar 29, 2015 at 08:08:57PM +0200, nenhard wrote:
> Thanks, here is a workaround.
> Can someone do a proper patch?
> 
> diff -rup a/libc/inet/ifaddrs.c b/libc/inet/ifaddrs.c
> --- a/libc/inet/ifaddrs.c 2012-05-15 09:20:09.000000000 +0200
> +++ b/libc/inet/ifaddrs.c 2015-03-29 15:07:11.528316570 +0200
> @@ -119,7 +119,7 @@ __netlink_request (struct netlink_handle
>  {
>    struct netlink_res *nlm_next;
>    struct netlink_res **new_nlm_list;
> -  static volatile size_t buf_size = 4096;
> +  static volatile size_t buf_size = 16384;

I would get the value from PAGE_SIZE (if defined) or
sysconf(_SC_PAGE_SIZE) or whatever internal method uClibc has for
accessing this rather than hard-coding the larger size, which may be
problematic for extremely small systems that don't need it.

Rich
diff mbox

Patch

diff -rup a/libc/inet/ifaddrs.c b/libc/inet/ifaddrs.c
--- a/libc/inet/ifaddrs.c 2012-05-15 09:20:09.000000000 +0200
+++ b/libc/inet/ifaddrs.c 2015-03-29 15:07:11.528316570 +0200
@@ -119,7 +119,7 @@  __netlink_request (struct netlink_handle
 {
   struct netlink_res *nlm_next;
   struct netlink_res **new_nlm_list;
-  static volatile size_t buf_size = 4096;
+  static volatile size_t buf_size = 16384;
   char *buf;
   struct sockaddr_nl nladdr;
   struct nlmsghdr *nlmh;