evan_tech

Previous Entry Share Next Entry
(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.