From: "Laurent Desnogues" <laurent.desnogues@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATH] gdbstub: fix gdbserver_fork
Date: Tue, 6 Jan 2009 19:02:31 +0100 [thread overview]
Message-ID: <761ea48b0901061002j1e7076bie3fafecca42da782@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 280 bytes --]
Hello,
as reported by Martin Mohring fork doesn't work with NPTL.
A fix is attached that makes the also attached test run
(tested with ARM CodeSourcery 2008q3 on an x86_64
Fedora Core with kernel 2.6.23).
Laurent
Signed-off-by: Laurent Desnogues <laurent.desnogues@gmail.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: fork.patch --]
[-- Type: text/x-patch; name=fork.patch, Size: 352 bytes --]
Index: gdbstub.c
===================================================================
--- gdbstub.c (revision 6146)
+++ gdbstub.c (working copy)
@@ -2225,7 +2225,7 @@
void gdbserver_fork(CPUState *env)
{
GDBState *s = gdbserver_state;
- if (s->fd < 0)
+ if (gdbserver_fd < 0 || s->fd < 0)
return;
close(s->fd);
s->fd = -1;
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: testfork.c --]
[-- Type: text/x-csrc; name=testfork.c, Size: 505 bytes --]
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <wait.h>
static void test_fork(void)
{
pid_t id;
id = fork();
if (id == 0) {
printf("child\n");
exit(0);
} else if (id == -1) {
perror("Fork fail");
exit(-1);
} else {
int status;
waitpid(id, &status, 0);
printf("Parent: done %d\n", status);
exit(0);
}
}
int main(int argc, char **argv)
{
test_fork();
return 0;
}
reply other threads:[~2009-01-06 18:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=761ea48b0901061002j1e7076bie3fafecca42da782@mail.gmail.com \
--to=laurent.desnogues@gmail.com \
--cc=qemu-devel@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).