Just in case anyone else is doing some hacking on bionic / busybox,
that had nothing to do with the problem.

The real problem was that the bionic libc defines stdin, stdout, and
stderr as so.

#define stdin (&__sF[0])
#define stdout (&__sF[1])
#define stderr (&__sF[2])

whereas in most libc's they're defined as _real_, global variables
that can be manipulated, e.g.

FILE *stdin = &__sF[0], *stdout = &__sF[1], *stderr = &__sF[2];

The problem arises in shells, where the stdin & stdout manipulators
are often redirected. In C this involves something (sort of) like the
following:

FILE *stdin_backup = stdin;
stdin = fopen("some path", "r");
...

besides an attempt at an rvalue assignment, which the compiler will
error out from, if someone were to overwrite one of the #define'd
values (which might occur in bionic), there's no way to get that
stream back.

My solution was to just add the _real_ variables to bionic. It should
also be possible to define the global stdin, stdout, and stderr
variables in busybox, initialized to the correct addresses too, but I
haven't tested whether it results in a functional shell.

C



On Thu, Jan 19, 2012 at 4:55 PM, Christopher Friedt
<[email protected]> wrote:
> Doh - nevermind. I was just inspecting my strace log a bit more
> carefully, and this is what I found.
>
> ioctl(1, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or
> TCGETS, 0xbef88ca0) = -1 EINVAL (Invalid argument)
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to