Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

258
Vistas
Create a linux Shell with malloc_hook() defined

I want to create a linux shell with overridden malloc() i.e. malloc_hook(). My terminal should take an .exe file as input and run the program as a thread. Whenever there's a malloc() call in the program, terminal's malloc_hook() should be called eventually. How can I achieve this goal. I have gone through a tutorial to write my own Linux terminal link : https://abhijangda.wordpress.com/2013/04/14/creating-a-simple-linux-terminal-in-c/ but that wasn't just enough.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Using malloc_hook does not have much to do with the Linux terminal. You can look at the man page for malloc_hook to try and understand how it works. but it seems to have been deprecated in recent versions of the glibc:

http://man7.org/linux/man-pages/man3/malloc_hook.3.html

You can also read the manual page for mallopt for other ways to tweak the allocation system:

http://man7.org/linux/man-pages/man3/mallopt.3.html

If the program is yours, use malloc_hook as documented above.

If you cannot recompile the program, you may achieve your goal by making a library that replaces all of the malloc family of functions and dynamically link the program with this library before the C library, using LD_PRELOAD as documented here:

http://man7.org/linux/man-pages/man8/ld.so.8.html

And as discussed in this question: What is the LD_PRELOAD trick?

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda