Bug 3877 - accept4 included unconditionally
Summary: accept4 included unconditionally
Status: NEW
Alias: None
Product: uClibc
Classification: Unclassified
Component: Networking (show other bugs)
Version: 0.9.32
Hardware: PC Linux
: P5 minor
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-17 13:27 UTC by Michael Deutschmann
Modified: 2012-03-29 04:34 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments
Patch to omit accept4() on kernels that don't support it. (939 bytes, patch)
2011-06-17 13:27 UTC, Michael Deutschmann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Deutschmann 2011-06-17 13:27:45 UTC
Created attachment 3415 [details]
Patch to omit accept4() on kernels that don't support it.

The accept4() call is built even on a kernel that does not support it.

I've attached a patch to make uClibc obey the __ASSUME_ACCEPT4 macro already present in kernel-features.h.
Comment 1 Bernhard Reutner-Fischer 2012-03-28 08:34:43 UTC
I think it should rather be
-#elif defined(__NR_socketcall)
+#elif defined(__NR_socketcall) && defined __ASSUME_ACCEPT4
Comment 2 Mike Frysinger 2012-03-28 17:42:27 UTC
Comment on attachment 3415 [details]
Patch to omit accept4() on kernels that don't support it.

this patch is wrong.  __ASSUME_ACCEPT4 means "i can assume accept4 exists".  if it is undefined, it does not mean "you may not use accept4".
Comment 3 Mike Frysinger 2012-03-28 17:44:40 UTC
if you have __NR_accept4 defined, then it means your kernel headers say your target supports it.  uClibc currently binds itself to the version of the kernel headers you built it against, so if you want to run on kernel version x.y.z, you better use kernel headers that are x.y.z or *older*.
Comment 4 Michael Deutschmann 2012-03-29 04:34:51 UTC
Whoops.  I meant to add my "#ifdef __ASSUME_ACCEPT4" above the "#ifdef __NR_accept4", not below.  It was pretty much a fluke that the patch worked for me (compiled OK and with no accept4 visible to nm).

Your way works too, though.  I've altered my patch to just add the #include and change the #elif line as you recommend, and the resulting code is byte for byte identical.