qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas K. Hüttel" <dilfridge@gentoo.org>
To: qemu-devel@nongnu.org, libc-alpha@sourceware.org
Subject: riscv32 wait() problem, qemu or glibc?
Date: Mon, 14 Sep 2020 11:14:16 +0300	[thread overview]
Message-ID: <9435182.tdPhlSkOF2@farino> (raw)

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

Hi, 

first of all, sorry for crossposting, but I'm dealing with many moving and 
experimental parts here... 

Situation: riscv32 (ilp32) qemu-user [1] chroot, Linux [2], glibc [3], gcc [4]

The following small program outputs "child exited with status 40", which is 
rather unexpected (it should be 42). Any idea what is going on?

(This is a simplified version of code in a configure test. The test has other 
potential issues [5], but in any case it cant produce useful results on 
riscv32 right now.)

TIA, 
Andreas

====================================
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/wait.h>

main(c, v)
     int c;
     char **v;
{
  pid_t pid, p;
  int s, i, n;

  s = 0;
  pid = fork();
  if (pid == 0)
    exit (42);

  /* wait for the process */
  p = wait(&s);
  if (p != pid)
    exit (255);

  if (WIFEXITED(s))
  {
     int r=WEXITSTATUS(s);
     printf("child exited with status %i\n",r);
  }
}
====================================


[1] qemu built from git master, Sep 12, 2020 16:30:37 EEST
[2] host kernel is 5.8.8
[3] glibc-2.32 with the rv32 patch series backported from master
[4] (Gentoo 10.2.0-r1 p2)
[5] https://lists.gnu.org/archive/html/bug-bash/2020-09/msg00033.html

-- 
Andreas K. Hüttel
dilfridge@gentoo.org
Gentoo Linux developer 
(council, qa, toolchain, base-system, perl, libreoffice)

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 963 bytes --]

             reply	other threads:[~2020-09-14  8:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-14  8:14 Andreas K. Hüttel [this message]
2020-09-15 18:57 ` riscv32 wait() problem, qemu or glibc? Andreas K. Hüttel
2020-09-16 15:18 ` Alistair Francis
2020-09-16 21:09   ` Andreas K. Hüttel
2020-09-16 21:05     ` Alistair Francis
2020-09-17 10:16       ` Andreas K. Hüttel
2020-09-17 14:02         ` Alistair Francis

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=9435182.tdPhlSkOF2@farino \
    --to=dilfridge@gentoo.org \
    --cc=libc-alpha@sourceware.org \
    --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).