Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/abeluck/black-arts
Black Arts of POSIX
https://github.com/abeluck/black-arts
Last synced: about 9 hours ago
JSON representation
Black Arts of POSIX
- Host: GitHub
- URL: https://github.com/abeluck/black-arts
- Owner: abeluck
- Created: 2013-01-28T21:09:32.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2013-01-29T18:16:27.000Z (almost 12 years ago)
- Last Synced: 2024-11-15T20:27:34.301Z (2 months ago)
- Language: C
- Size: 117 KB
- Stars: 1
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Black Magic
## Spell 0x0: STDIN Sleight of Hand
Passing an application's STDIN fd to another process through an abstract unix
domain socket, that the other process can subsequently read from.## Incantations
Linux:
$ make
$ ./server < ../wizard
(open another terminal)
$ ./clientAndroid (after setting up your NDK environment):
$ make clean # if you did previous
$ make -f Makefile.android
$ adb push server /data/local/tmp/
$ adb push client /data/local/tmp/
$ adb push wizard /sdcard/
$ adb shell "/data/local/tmp/server < /sdcard/wizard"
(open another terminal)
$ adb shell /data/local/tmp/client## Spell 0x1: Switcharoo
invoker.py invokes server and communicates to it via STDIN and STDOUT, but
server doesn't have a flippin clue, so server opens a unix domain socket and
waits connections from someone who does. client knows what's up, so server passes its
STDIN and STDOUT fds to client, then exits.invoker is now communicating with client.
## Incantations
Linux:
$ make
$ python invoker.py < ../wizard
(open another terminal)
$ ./client# The Masters
The crucial `[send,recv]_fd()` functions are from Thomas at
http://www.thomasstover.com/uds.html