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

218
Vistas
Where is glibc's code for setjmp?

I was interested in what exactly setjmp does at least in x86_64 linux, so I searched through glibc's source code, but I cannot really find where the register saving is done. Could you explain what is going on here?

setjmp.h

extern int _setjmp (struct __jmp_buf_tag __env[1]) __THROWNL;
#define setjmp(env)     _setjmp (env)

bsd-_setjmp.c

int
_setjmp (jmp_buf env)
{
  return __sigsetjmp (env, 0);
}

libc_hidden_def (_setjmp)

setjmp.c

int
__libc_sigsetjmp (jmp_buf env, int savemask)
{
  __sigjmp_save (env, savemask);
  __set_errno (ENOSYS);
  return 0;
}

weak_alias (__libc_sigsetjmp, __sigsetjmp)
stub_warning (__sigsetjmp)

sigjmp.c

int
__sigjmp_save (sigjmp_buf env, int savemask)
{
  env[0].__mask_was_saved = (savemask &&
                             __sigprocmask (SIG_BLOCK, (sigset_t *) NULL,
                                            &env[0].__saved_mask) == 0);
  return 0;
}
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

setjmp is a macro which calls _setjmp. For the x86_64 architecture, it's defined in ../sysdeps/x86_64/bsd-_setjmp.S. _setjmp will then call __sigsetjmp, defined in ../sysdeps/x86_64/setjmp.S; this function is strictly platform dependent and needs to be implemented in assembly.

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