GithubHelp home page GithubHelp logo

cgull / wsl-forkpty-shim Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 1.0 19 KB

solib forkpty() shim for Windows Subsystem for Linux beta

License: GNU General Public License v3.0

C 94.29% Makefile 5.71%

wsl-forkpty-shim's Introduction

Stale and deprecated

Windows Subsystem for Linux has working ptys in the Anniversary update, and long before in the fast ring releases. You don't need this any more.

##forkpty shlib hack##

This is a hack to get ptys somewhat working on Windows 10 fast-ring builds with Bash on Windows / Windows Subsystem for Linux installed. It's mostly intended for programs that use forkpty().

The WSL pty subsystem, as of build 14332, is too incomplete to use with glibc's forkpty(). The blocker I found is that statvfs("/dev/pts/") fails, but I'm sure there are others.

However, the ptys are not completely unusable. This is a simpler implementation that dodges some pty bugs, so that script and (with some hacks) Mosh's mosh-server (and optional termemu example program) can run. It implements forkpty()/openpty()/login_tty(), the core BSD API to ptys. It also implements posix_openpt() and glibc's getpt(). There are still problems:

  • TIOC{G,S}WINSZ fail on a pty master or slave.
  • I've been unable to make the slave a controlling tty yet via open() or ioctl(..., TIOCSCTTY, ...).
  • Device permissions are broken, requiring running as root.
  • openpty() works but callers may themselves trip on unimplemented termios features if they don't use login_tty()
  • There are several different ways to access ptys: the BSD forkpty() calls, the POSIX API, glibc's API, open() + ioctl(), and more. This only implements a subset.

So...if you use this you get terminal sessions with no controlling pty, no job control, no keyboard interrupts, broken window resize, and some other termios brokenness I haven't investigated yet. As of Build 14332, I think ptys don't even have a real termio implementation, only a stub implementation that copies bytes back and forth and adds CR on output. But it's just barely usable enough to start further work on pty-using programs in WSL.

to use:

make
sudo sh -c 'LD_PRELOAD=./forkpty.so /usr/bin/script /tmp/barf'

wsl-forkpty-shim's People

Contributors

cgull avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

longjohncoder

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.