Skip to content

POSIX Emulation #5169

@fniephaus

Description

@fniephaus

TL;DR

Introduce a dedicated, internal Truffle language for implementing POSIX-level file and networking support in guest languages.

Problem description

Languages (e.g., Python, Ruby, ...) usually don't have very good OS abstractions, they tend to model their APIs after POSIX and expose rather low-level aspects of POSIX. Emulating all those APIs with Truffle filesystem and other Truffle APIs that actually do abstract OS properly is tedious and partially impossible. Thus, any POSIX layer in languages may need to expose access to the underlying native libraries for maximum compatibility, and also implement alternatives to those APIs on top of the Truffle APIs to allow sandboxing and virtualization via the Truffle features (FileSystem, permissions, limits, ...).

Goals

  • A Truffle API that would offer POSIX functionality
  • An emulated backend for that Truffle API: implemented on top of existing Truffle abstractions (TruffleFile, FileSystem, ...) and thus keeping the Truffle sandbox intact
  • A native backend for that Truffle API: this calls native POSIX functions directly using NFI ("NFI POSIX") for maximum compatibility

Non-Goals

  • Complete emulation of all POSIX functionality in the emulated backend
  • Isolation of the native backend when different contexts are active in the same OS process

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions