Skip to contentSkip to conversation

epoll handling in the alpha port

PATCH Mike Frysinger 3 participants 5 messages Feb 1, 2007 – Feb 2, 2007

lore
Share & tools
lore
#0 lore raw

the alpha linux port differs from all others when it comes to the epoll functions in that it uses '__NR_sys_epoll_XXX' instead of '__NR_epoll_XXX' in the asm/unistd.h header ... the trouble with this is that glibc maps the function name directly to an __NR_ define, so when it maps
like 'epoll_create', it expects '__NR_epoll_create' (which it gets with all other architectures)

is there some obvious thing i'm missing here ? or is the attached patch OK ?

---

include/asm-alpha/unistd.h +3 -3
@@ -342,9 +342,9 @@
 #define __NR_io_cancel			402
 #define __NR_exit_group			405
 #define __NR_lookup_dcookie		406
-#define __NR_sys_epoll_create		407
-#define __NR_sys_epoll_ctl		408
-#define __NR_sys_epoll_wait		409
+#define __NR_epoll_create		407
+#define __NR_epoll_ctl		408
+#define __NR_epoll_wait		409
 #define __NR_remap_file_pages		410
 #define __NR_set_tid_address		411
 #define __NR_restart_syscall		412
#1 lore raw
Quoted 16 lines · On Thu, 1 Feb 2007 15:20:45 -0500 Mike Frysinger <[email protected]> wrote:

the alpha linux port differs from all others when it comes to the epoll functions in that it uses '__NR_sys_epoll_XXX' instead of '__NR_epoll_XXX' in the asm/unistd.h header ... the trouble with this is that glibc maps the function name directly to an __NR_ define, so when it maps
like 'epoll_create', it expects '__NR_epoll_create' (which it gets with all other architectures)

is there some obvious thing i'm missing here ? or is the attached patch OK ?

---

include/asm-alpha/unistd.h +0 -0
@@ -342,9 +342,9 @@
 #define __NR_io_cancel			402
 #define __NR_exit_group			405

include/asm-alpha/unistd.h line 350

Quoted 10 lines
include/asm-alpha/unistd.h +3 -3
 #define __NR_lookup_dcookie		406
-#define __NR_sys_epoll_create		407
-#define __NR_sys_epoll_ctl		408
-#define __NR_sys_epoll_wait		409
+#define __NR_epoll_create		407
+#define __NR_epoll_ctl		408
+#define __NR_epoll_wait		409
 #define __NR_remap_file_pages		410
 #define __NR_set_tid_address		411
 #define __NR_restart_syscall		412

It might be to late to fix this - we risk breaking userspace which worked around it.

It would be safer to add the correct definitions while leaving the old ones in place.

#2 lore raw
Quoted 2 lines · Andrew Morton

It might be to late to fix this - we risk breaking userspace which worked around it.

we'd be breaking userspace API, but not ABI ... and the largest consumers out there (glibc/uclibc) have not been accounting for this, so we wouldnt be breaking them

that's how we noticed the issue in Gentoo ... all the epoll calls are automatically declared -ENOSYS stubs in glibc's libc.so

is there some other large consumer i'm not thinking of ?

Quoted 2 lines

It would be safer to add the correct definitions while leaving the old ones in place.

in the end, either works for me ... i can see linux's pretty hard 'dont break userspace' policy coming into play here
-mike

#3 lore raw
Quoted 4 lines · Mike Frysinger
Quoted 2 lines · Andrew Morton

It might be to late to fix this - we risk breaking userspace which worked around it.

Quoted 8 lines

we'd be breaking userspace API, but not ABI ... and the largest consumers out there (glibc/uclibc) have not been accounting for this, so we wouldnt be breaking them

that's how we noticed the issue in Gentoo ... all the epoll calls are automatically declared -ENOSYS stubs in glibc's libc.so

is there some other large consumer i'm not thinking of ?

Not necessarily some large consumers, but epoll() is quite older than its kernel inclusion, so there certainly are some apps still using the syscall without going through libc.

Quoted 5 lines
Quoted 2 lines

It would be safer to add the correct definitions while leaving the old ones in place.

in the end, either works for me ... i can see linux's pretty hard 'dont break userspace' policy coming into play here

I think it would be reasonable to use the NR_epoll* names first, and to declare NR_sys_epoll* aliases which will point to NR_epoll*. You would then add a comment with the date of the change, stating that you keep them just in case there are some old apps. Then, someone coming on the comment in 3 or 4 years could reasonably suggest removing those aliases.

Willy

#4 lore raw
Quoted 5 lines · Willy Tarreau

I think it would be reasonable to use the NR_epoll* names first, and to declare NR_sys_epoll* aliases which will point to NR_epoll*. You would then add a comment with the date of the change, stating that you keep them just in case there are some old apps. Then, someone coming on the comment in 3 or 4 years could reasonably suggest removing those aliases.

fair enough, sounds like a plan man ... patch attached to do that

---

include/asm-alpha/unistd.h +8 -3
index 84313d1..e58a427 100644
@@ -342,9 +342,14 @@
 #define __NR_io_cancel			402
 #define __NR_exit_group			405
 #define __NR_lookup_dcookie		406
-#define __NR_sys_epoll_create		407
-#define __NR_sys_epoll_ctl		408
-#define __NR_sys_epoll_wait		409
+#define __NR_epoll_create		407
+#define __NR_epoll_ctl			408
+#define __NR_epoll_wait			409
+/* Feb 2007: These three sys_epoll defines shouldn't be here but culling
+ * them would break userspace apps ... we'll kill them off in 2010 :) */
+#define __NR_sys_epoll_create		__NR_epoll_create
+#define __NR_sys_epoll_ctl		__NR_epoll_ctl
+#define __NR_sys_epoll_wait		__NR_epoll_wait
 #define __NR_remap_file_pages		410
 #define __NR_set_tid_address		411
 #define __NR_restart_syscall		412