Skip to content

getdtablesize() returns wrong value in qemu user mode on Linux/alpha

Host environment

  • Operating system: Ubuntu 20.04
  • OS/kernel version: Linux 5.11.0-27-generic x86_64
  • Architecture: x86_64
  • QEMU flavor: qemu-alpha
  • QEMU version: 6.1.0
  • QEMU command line:
    qemu-alpha ./a.out

Emulated/Virtualized environment

  • Operating system: Linux
  • OS/kernel version: --
  • Architecture: alpha

Description of problem

The getdtablesize() function returns a value that is too large. Namely, getdtablesize() - 1 ought to be a valid file descriptor, but is not.

Steps to reproduce

foo.c

# apt install g++-10-alpha-linux-gnu
$ alpha-linux-gnu-gcc-10 -Wall -static foo.c

a.out

  1. Transfer the a.out file to a Linux/alpha machine; execute it there. The return code is 0.
$ QEMU_LD_PREFIX=/usr/alpha-linux-gnu ~/inst-qemu/6.1.0/bin/qemu-alpha ./a.out ; echo $?

Expected: 0 Actual: 1

Additional information

Edited by Bruno Haible
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information