Skip to content

ttyname: Inappropriate ioctl for device #11582

Open
@dseomn

Description

@dseomn

Description

If I call ttyname(0) in C, it gives an Inappropriate ioctl for device error.

Steps to reproduce

If I compile this code to a.out:

#include <stdio.h>
#include <unistd.h>

int main() {
  char *name = ttyname(0);
  if (!name) {
    perror("ttyname");
    return 1;
  }
  printf("ttyname = %s\n", name);
  return 0;
}

With runsc, it fails:

$ podman run --rm -ti -v $PWD/a.out:/a.out:ro --runtime=runsc --runtime-flag=ignore-cgroups --runtime-flag=network=none debian:testing /a.out
ttyname: Inappropriate ioctl for device

With runc, it works:

$ podman run --rm -ti -v $PWD/a.out:/a.out:ro --runtime=runc debian:testing /a.out
ttyname = /dev/pts/0

Note that in both cases, I gave it the -t flag.

runsc version

runsc version 0.0~20240729.0
spec: 1.2.0

docker version (if using docker)

$ podman version
Client:       Podman Engine
Version:      5.4.0
API Version:  5.4.0
Go Version:   go1.24.0
Built:        Sun Feb 16 08:51:11 2025
OS/Arch:      linux/amd64

uname

Linux solaria 6.12.12-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.12-1 (2025-02-02) x86_64 GNU/Linux

kubectl (if using Kubernetes)

repo state (if built from source)

No response

runsc debug logs (if available)

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions