Skip to contentSkip to conversation

uml: fix compilation for missing headers

PATCH In review [email protected] 3 participants 3 messages Jan 13, 2005 – Jan 14, 2005 User-mode Linux (UML)

lore
Share & tools
lore
#0 lore raw

PATCH 2/11 uml: fix compilation for missing headers

Readd some needed headers inclusion deleted in
http://linux.bkbits.net:8080/linux-2.5/cset@41e49628dGbOWX-bT9yZII4f19GT6A

If you think it cannot make sense to include both <sys/ptrace.h> and <linux/ptrace.h> (as userspace process, i.e. host includes), go complaining with glibc, or follow the linux-abi includes idea.

However, the compilation failure is possibly glibc-version (or better glibc includes version) related - what I now is that the failure happens on my system with a glibc 2.3.4 (from Gentoo).

Also, remove some syscalls from the syscall table, since some syscalls were added which are only inside -mm currently, and this prevents currently compilation.

---

 linux-2.6.11-paolo/arch/um/kernel/process.c        |    4 ++++
 linux-2.6.11-paolo/arch/um/kernel/sys_call_table.c |   13 +++++++++++++
 2 files changed, 17 insertions(+)
arch/um/kernel/process.c renamed from arch/um/kernel/process.c~uml-fix-compilation-for-missing-headers +4 -0
diff -puN arch/um/kernel/process.c~uml-fix-compilation-for-missing-headers arch/um/kernel/process.c
@@ -13,6 +13,10 @@
 #include <setjmp.h>
 #include <sys/time.h>
 #include <sys/ptrace.h>
+
+/*Userspace header, must be after sys/ptrace.h, and both must be included. */
+#include <linux/ptrace.h>
+
 #include <sys/wait.h>
 #include <sys/mman.h>
 #include <asm/unistd.h>
arch/um/kernel/sys_call_table.c renamed from arch/um/kernel/sys_call_table.c~uml-fix-compilation-for-missing-headers +13 -0
diff -puN arch/um/kernel/sys_call_table.c~uml-fix-compilation-for-missing-headers arch/um/kernel/sys_call_table.c
@@ -20,7 +20,11 @@
 #define NFSSERVCTL sys_ni_syscall
 #endif
 
+#if 0
 #define LAST_GENERIC_SYSCALL __NR_vperfctr_read
+#else
+#define LAST_GENERIC_SYSCALL __NR_keyctl
+#endif
 
 #if LAST_GENERIC_SYSCALL > LAST_ARCH_SYSCALL
 #define LAST_SYSCALL LAST_GENERIC_SYSCALL
@@ -54,11 +58,14 @@ extern syscall_handler_t sys_get_mempoli
 extern syscall_handler_t sys_set_mempolicy;
 extern syscall_handler_t sys_sys_kexec_load;
 extern syscall_handler_t sys_sys_setaltroot;
+
+#if 0
 extern syscall_handler_t sys_vperfctr_open;
 extern syscall_handler_t sys_vperfctr_control;
 extern syscall_handler_t sys_vperfctr_unlink;
 extern syscall_handler_t sys_vperfctr_iresume;
 extern syscall_handler_t sys_vperfctr_read;
+#endif
 
 syscall_handler_t *sys_call_table[] = {
 	[ __NR_restart_syscall ] = (syscall_handler_t *) sys_restart_syscall,
@@ -273,7 +280,10 @@ syscall_handler_t *sys_call_table[] = {
 	[ __NR_mq_timedreceive ] = (syscall_handler_t *) sys_mq_timedreceive,
 	[ __NR_mq_notify ] = (syscall_handler_t *) sys_mq_notify,
 	[ __NR_mq_getsetattr ] = (syscall_handler_t *) sys_mq_getsetattr,
+#if 0
 	[ __NR_sys_kexec_load ] = (syscall_handler_t *) sys_kexec_load,
+#endif
+	[ __NR_sys_kexec_load ] = (syscall_handler_t *) sys_ni_syscall,
 	[ __NR_waitid ] = (syscall_handler_t *) sys_waitid,
 #if 0
 	[ __NR_sys_setaltroot ] = (syscall_handler_t *) sys_sys_setaltroot,
@@ -281,11 +291,14 @@ syscall_handler_t *sys_call_table[] = {
 	[ __NR_add_key ] = (syscall_handler_t *) sys_add_key,
 	[ __NR_request_key ] = (syscall_handler_t *) sys_request_key,
 	[ __NR_keyctl ] = (syscall_handler_t *) sys_keyctl,
+	/* These syscalls are still in -mm only*/
+#if 0
 	[ __NR_vperfctr_open ] = (syscall_handler_t *) sys_vperfctr_open,
 	[ __NR_vperfctr_control ] = (syscall_handler_t *) sys_vperfctr_control,
 	[ __NR_vperfctr_unlink ] = (syscall_handler_t *) sys_vperfctr_unlink,
 	[ __NR_vperfctr_iresume ] = (syscall_handler_t *) sys_vperfctr_iresume,
 	[ __NR_vperfctr_read ] = (syscall_handler_t *) sys_vperfctr_read,
+#endif
 
 	ARCH_SYSCALLS
 	[ LAST_SYSCALL + 1 ... NR_syscalls ] = 

_

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#1 lore raw

Sorry, I reposted the same patch inside the bunch of ones, hope it's not a problem. However, I've seen some more problems which I didn't fix in the patch:

Quoted 24 lines
arch/um/kernel/sys_call_table.c renamed from arch/um/kernel/sys_call_table.c~uml-fix-compilation-for-missing-headers +7 -0
+#if 0
 #define LAST_GENERIC_SYSCALL __NR_vperfctr_read
+#else
+#define LAST_GENERIC_SYSCALL __NR_keyctl
+#endif
 
 #if LAST_GENERIC_SYSCALL > LAST_ARCH_SYSCALL
 #define LAST_SYSCALL LAST_GENERIC_SYSCALL
@@ -54,11 +58,14 @@ extern syscall_handler_t sys_get_mempoli
 extern syscall_handler_t sys_set_mempolicy;
 extern syscall_handler_t sys_sys_kexec_load;
 extern syscall_handler_t sys_sys_setaltroot;
+
+#if 0
 extern syscall_handler_t sys_vperfctr_open;
 extern syscall_handler_t sys_vperfctr_control;
 extern syscall_handler_t sys_vperfctr_unlink;
 extern syscall_handler_t sys_vperfctr_iresume;
 extern syscall_handler_t sys_vperfctr_read;
+#endif
 
 syscall_handler_t *sys_call_table[] = {
  [ __NR_restart_syscall ] = (syscall_handler_t *) sys_restart_syscall,

arch/um/kernel/sys_call_table.c syscall_handler_t *sys_call_table[] = { · line 289

Quoted 10 lines
arch/um/kernel/sys_call_table.c renamed from arch/um/kernel/sys_call_table.c~uml-fix-compilation-for-missing-headers +3 -0
@@ -273,7 +280,10 @@ syscall_handler_t *sys_call_table[] = {
  [ __NR_mq_timedreceive ] = (syscall_handler_t *) sys_mq_timedreceive,
  [ __NR_mq_notify ] = (syscall_handler_t *) sys_mq_notify,
  [ __NR_mq_getsetattr ] = (syscall_handler_t *) sys_mq_getsetattr,
+#if 0
  [ __NR_sys_kexec_load ] = (syscall_handler_t *) sys_kexec_load,
+#endif
+ [ __NR_sys_kexec_load ] = (syscall_handler_t *) sys_ni_syscall,
  [ __NR_waitid ] = (syscall_handler_t *) sys_waitid,
 #if 0
  [ __NR_sys_setaltroot ] = (syscall_handler_t *) sys_sys_setaltroot,

This is left alone, but this way, the "285" syscall is not set at all, while it should be sys_ni_syscall like for what I commented out (apart the ones at the end).

Quoted 15 lines
arch/um/kernel/sys_call_table.c renamed from arch/um/kernel/sys_call_table.c~uml-fix-compilation-for-missing-headers +3 -0
@@ -281,11 +291,14 @@ syscall_handler_t *sys_call_table[] = {
  [ __NR_add_key ] = (syscall_handler_t *) sys_add_key,
  [ __NR_request_key ] = (syscall_handler_t *) sys_request_key,
  [ __NR_keyctl ] = (syscall_handler_t *) sys_keyctl,
+ /* These syscalls are still in -mm only*/
+#if 0
  [ __NR_vperfctr_open ] = (syscall_handler_t *) sys_vperfctr_open,
  [ __NR_vperfctr_control ] = (syscall_handler_t *) sys_vperfctr_control,
  [ __NR_vperfctr_unlink ] = (syscall_handler_t *) sys_vperfctr_unlink,
  [ __NR_vperfctr_iresume ] = (syscall_handler_t *) sys_vperfctr_iresume,
  [ __NR_vperfctr_read ] = (syscall_handler_t *) sys_vperfctr_read,
+#endif
 
  ARCH_SYSCALLS
  [ LAST_SYSCALL + 1 ... NR_syscalls ] =
Quoted 1 line

_

While looking at the unistd.h code, I discovered another bug (for i386) - I'm posting it here to avoid forgetting it:

/*
* user-visible error numbers are in the range -1 - -128: see
* <asm-i386/errno.h>
*/

But in include/asm-generic/errno.h, there is a problem:

#define EKEYREVOKED     128     /* Key has been revoked */
#define EKEYREJECTED    129     /* Key was rejected by service */

I.e. the range has changed...
I think that the max errno value should become a macro defined in errno.h.

Signature · 13 lines
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729
http://www.user-mode-linux.org/~blaisorblade


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#2 lore raw
In reply to [email protected]
Quoted 11 lines · [email protected] said:

If you think it cannot make sense to include both <sys/ptrace.h> and <linux/ptrace.h> (as userspace process, i.e. host includes), go complaining with glibc, or follow the linux-abi includes idea.

However, the compilation failure is possibly glibc-version (or better glibc includes version) related - what I now is that the failure happens on my system with a glibc 2.3.4 (from Gentoo).

Also, remove some syscalls from the syscall table, since some syscalls were added which are only inside -mm currently, and this prevents currently compilation.

Hold off on this one. I have different fixes for this in my tree.

The system ptrace headers (asm/ptrace.h, sys/ptrace.h, linux/ptrace.h) have varying effects, depending on distro and architecture. So, I decided to put sysdep/ptrace_user.h in charge of supplying the system ptrace information to the rest of UML. This has some ripple effects which I am in the process of sorting out.

On the system calls, I have them indef-ed depending on whether one of the __NR_vperf symbols are defined. This will go away when the entry points are in both -mm and -linus.

Jeff

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel