linux-um archives
 help / color / mirror / Atom feed
From: BlaisorBlade <blaisorblade_spam@yahoo.it>
To: user-mode-linux-devel@lists.sourceforge.net
Subject: [uml-devel] Errno handling bug
Date: Fri, 3 Oct 2003 20:48:27 +0200	[thread overview]
Message-ID: <200310032048.27028.blaisorblade_spam@yahoo.it> (raw)

[-- 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) 
 {

             reply	other threads:[~2003-10-03 18:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-03 18:48 BlaisorBlade [this message]
     [not found] ` <200310051736.09761.blaisorblade_spam@yahoo.it>
2003-11-10  1:23   ` [uml-devel] Errno handling bug Jeff Dike

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200310032048.27028.blaisorblade_spam@yahoo.it \
    --to=blaisorblade_spam@yahoo.it \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox