help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] Question: Capturing command output (on-screen keyword co


From: Chet Ramey
Subject: Re: [Help-bash] Question: Capturing command output (on-screen keyword colorizer/prettifier).
Date: Fri, 7 Oct 2016 10:29:39 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.4.0

On 10/6/16 2:49 PM, Matthew Giassa wrote:
> Is it possible to hook the bash builtin malloc? I'm not explicitly
> calling calloc/malloc, so I wonder if it's something else that could be
> triggering this behavior, such as pthread_create. If that's the case, I
> guess I'll need to drop threads and instead issue an additional
> fork/exec call.

That's probably too difficult, since the bash malloc is statically linked
into the bash binary, and LD_PRELOAD can't see it.  It can shadow
functions bash gets from a dynamically-linked libc, but not something
static in the binary.

> Also, I had considered creating a pseudo terminal to intercept the data
> in place of the pipe approach I'm utilizing, but I believe BASh
> installed a SIGCHLD signal handler, so using grantpt would be error
> prone. Is this assumption correct?

Why would a SIGCHLD handler interfere with grantpt? Or are you worried
about signals interrupting your library's system calls?

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]