linux-um archives
 help / color / mirror / Atom feed
* [uml-devel] Errno handling bug
@ 2003-10-03 18:48 BlaisorBlade
       [not found] ` <200310051736.09761.blaisorblade_spam@yahoo.it>
  0 siblings, 1 reply; 2+ messages in thread
From: BlaisorBlade @ 2003-10-03 18:48 UTC (permalink / raw)
  To: user-mode-linux-devel

[-- Attachment #1: Type: text/plain, Size: 1455 bytes --]

I posted this patch some time ago, but it was hidden inside an unrelated 
thread. It applies to .22-[345]um
**Description**
On the i386 arch(and I think others, too) the translation from 
return value(of calls like open(), fork()...) to errno setting is done in 
include/asm-i386/unistd.h. Instead, 
UML doesn't do it. I'm posting a patch to correct this in 
include/asm-um/unistd.h for mainline, but I think that parts of the rest of 
Uml will have to be changed, probably, to conform to the new(and correct) 
semantic.
**Why it IS needed**
Code inside the kernel relies on this behaviour. It's a things archs must do. 
So, it will have to end up in, at some point.
**Tested**
Yes, but not everything is clear. Stability is ok, but some error messages I 
get are strange:
modprobe: modprobe: Can't locate module char-major-10-135
request_module[char-major-10-135]: waitpid(26,...) failed, errno 0
Which however seems to be either fine or not related directly to this: waitpid 
returns 0 when no child is found, and maybe this happens here. However this 
is not clear to me.

If you agree that this patch will have to go in, I'll complete it with 
complete checking for errno. But I think I'll need a working version of 
-4um(I'm going to test -5um), since I think that version has added/changed 
also much uses of errno.
-- 
cat <<EOSIGN
Paolo Giarrusso, aka Blaisorblade
Linux Kernel 2.4.21/2.6.0-test on an i686; Linux registered user n. 292729
EOSIGN

[-- Attachment #2: errno.patch --]
[-- Type: text/x-diff, Size: 414 bytes --]

--- linuxUm/include/asm-um/unistd.h.notfixed	2003-09-17 13:30:42.000000000 +0200
+++ linuxUm/include/asm-um/unistd.h	2003-09-17 19:15:58.000000000 +0200
@@ -33,7 +33,11 @@
 	set_fs(KERNEL_DS);			\
 	ret = sys(args);			\
 	set_fs(fs);				\
-	return ret;
+	if (ret < 0) {				\
+	  errno = -ret;				\
+	  return -1;				\
+	}					\
+	return 0;
 
 static inline long open(const char *pathname, int flags, int mode) 
 {

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-11-10  1:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-03 18:48 [uml-devel] Errno handling bug BlaisorBlade
     [not found] ` <200310051736.09761.blaisorblade_spam@yahoo.it>
2003-11-10  1:23   ` Jeff Dike

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox