Evan Martin (evan) wrote in evan_tech,
Evan Martin

two potential hacks, both ugly, one glorious

(1) To get the list of arguments a command understands (for use with, for example, tab completion in a shell), why not make an LD_PRELOAD library that wraps getopt (and maybe libpopt, or whatever people use these days).
(Yes, really the applications ought to all be able to emit argument information in the same format, but I'm not holding my breath for that one.)

(2) For my networking class, I'm supposed to write the glue between students' code (basically implementing TCP in addition to lower-level stuff) and their to-be-assigned application code. The plan is (and was when I was in the class) to run the two pieces in different processes, where the application uses an API just like the Unix sockets API, so the students get a taste for what socket programming is like both from the application and the implementation's perspective. Another nice benefit of this is that they can test their application code on top of real sockets, so it's easier to debug their application without wondering if the bug is in their TCP code.

It occurred to me that since these processes will communicate over a socket themselves, I could just as well let them write apps in C as I could in Ruby. But, going a step farther, wouldn't it be a rad hack if I could LD_PRELOAD my way underneath socket calls so they could run unmodified binaries (web browsers!) on top of their own network implementation? Unfortunately, the transfer protocol they implement only does one-way connections... I'm still thinking about that.

  • socks5 proxying flash via ssh

    Suppose you're in Germany and want to watch some Flash-based videos that are IP-limited to the US for whatever reason. At first you'd think you could…

  • your vcs sucks

    I've been hacking on some Haskell stuff lately that's all managed in darcs and it's reminded me of an observation I made over two years ago now (see…

  • ghc llvm

    I read this thesis on an LLVM backend for GHC, primarily because I was curious to learn more about GHC internals. The thesis serves well as an…

  • Post a new comment


    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.