June 29th, 2005


userinfo senji
2005/06/29 10:37:00 - Error
I am consistently (but irregularly) irritated when I get errors or warnings to stderr that don't identify the process that they come from. I'd like some general sort of solution to this that I can implement and ignore.

My best thought so far is to use LD_PRELOAD to wrap fprintf such that outputs to stderr get [pid] prepended, but I suspect that this is insufficiently general; plus it is ick.

Any suggestions, anyone?
Current Mood: [mood icon] irritated
Entry Tags: geeky, hacks, programming, question, todo, ui, unix

< | 9 glosses | comment | > )

userinfo cartesiandaemon
[userpic]
2005/06/29 10:26:07
Suggestion: "geeky" is too general, perhaps a "computers" or "programming" or even "stdstreams" tag is merited in addition :)

Suggestion: Do we have any better way to standardise tags that copying what our friends do?

Sorry, though, no *relevent* suggestions.
reply | thread )
userinfo senji
[userpic]
2005/06/29 10:45:24
"geeky" is only my third most referenced tag (so far), but I think I agree.

This one is more "ui" than "programming", although I guess it's both...

Is that better?

I'm considering turning "apply tags" permission on for friends, what do you think?
reply | parent | thread )
userinfo cartesiandaemon
[userpic]
2005/06/29 11:03:31
LOL :) Sorry, I wasn't entirely serious, it was just a thought. For me 'geeky' would include like computer stuff and also random meta meta witterings, so I thought it might help.

I'm considering turning "apply tags" permission on for friends, what do you think?

I think that's a good idea in principle, except that most people probably wouldn't do it, and a few people would get carried away. Are you ok with people adding joke tags as long as they're non-confusing? Perhaps have a stated policy in userinfo on which tags you'd like to see people apply? Or have a "Woot" tag, where each concurring person adds another 'o'...?
reply | parent | thread )
userinfo senji
[userpic]
2005/06/29 11:05:30
I wasn't planning on letting people create new tags in the process (AIUI it's possible to restrict them to existing tags only).
reply | parent | thread )
userinfo cartesiandaemon
[userpic]
2005/06/29 11:09:15
OK, that makes sense. But some sort of recommendation from you would probably be helpful.
reply | parent | thread )
userinfo simont
[userpic]
2005/06/29 10:47:58
This idea is only half-baked as yet and I haven't done any of the backup research, but I wonder if there's anything we can set up by using a Unix domain socket as stderr and using recvmsg().

sendmsg() is more general than send(), not only because it allows the data sent to be gathered from various different parts of the sending process's memory, but also because it permits the attaching of ancillary strange information to the message being sent. (This, in particular, is how you pass file descriptors between unrelated processes across a Unix socket.)

So if, at the start of your shell session, you established a Unix domain socketpair, put the reading half in a process which looped on readmsg() and output the data to whatever the original stderr was, and in the other process you put the sending half in fd 2 and then exec()ed your real shell, then any process doing sendmsg() rather than write() on fd 2 would be able to pass strange ancillary information to the readmsg()ing process.

That by itself isn't terribly useful, but if we also did a small kernel hack which allowed you to (say) set a magic option on the socket which had the effect that ordinary write()s became equivalent to sendmsg() with the sending pid in the ancillary data, then the readmsg()ing process would be able to pull that out and annotate what got sent to your terminal.

It's still not very pretty, but it's more general than LD_PRELOAD...
reply | thread )
userinfo simont
[userpic]
2005/06/29 10:49:37
Ahem. For "readmsg" read "recvmsg" throughout.
reply | parent | thread )
userinfo senji
[userpic]
2005/06/29 11:25:24
Bleh, but yes I can see how that could work.

I see a problem though in that you have to deal with stderr in a non-blocking way, so it may be hard to tell where the beginning of a message is.
reply | parent | thread )
userinfo fanf
[userpic]
2005/06/29 18:07:38
Assume that newlines are message delimiters.
reply | parent | thread )

< | 9 glosses | comment | > )

Error - Squaring the circle...

> log in
> recent entries
> fiends
> archive
> toothywiki page
> profile
> new entry
> recent comments


> go to top