# Dealing with external libraries that don't restore old signal handlers

**URL:** https://discourse.julialang.org/t/dealing-with-external-libraries-that-dont-restore-old-signal-handlers/84343
**Category:** Internals & Design
**Created:** [July 17, 2022, 2:27am UTC](https://discourse.julialang.org/t/dealing-with-external-libraries-that-dont-restore-old-signal-handlers/84343 "2022-07-17T02:27:19Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)
#### Post date: [July 17, 2022, 2:54am UTC](https://discourse.julialang.org/t/dealing-with-external-libraries-that-dont-restore-old-signal-handlers/84343/2 "2022-07-17T02:54:16Z")

</div>

By running some C code we can compute the `sizeof(struct sigaction)` and currently that is 152 bytes on Linux.

I suspect that we can obtain this directly by parsing the C header signals.h or more specifically bits/sigaction.h.

Nonetheless, the above approach will probably work. One might want to leave a buffer in case `sigaction` has additional fields that are just zero valued.

> [@How do I obtain \`sizeof(struct sigaction)\`? Clang.jl?](https://discourse.julialang.org/t/how-do-i-obtain-sizeof-struct-sigaction-clang-jl/84344):
>
> I would like to figure out the value printed by this C program in Julia. #include \<signal.h\> #include \<stdio.h\> int main() { printf("%ld", sizeof(struct sigaction)); return 0; } On my system, this prints 152 bytes. My /usr/include/x86\_64-linux-gnu/bits/sigaction.h has this definition: [https://sourceware.org/git/?p=glibc.git;a=blob;f=bits/sigaction.h;h=cef879f40aae8e14b2e998daeded26ebe5cfad9d;hb=HEAD#l32](https://sourceware.org/git/?p=glibc.git;a=blob;f=bits/sigaction.h;h=cef879f40aae8e14b2e998daeded26ebe5cfad9d;hb=HEAD#l32) Other than building the C code above, is there a way to obtain the size …

---

_[View the full topic](https://discourse.julialang.org/t/dealing-with-external-libraries-that-dont-restore-old-signal-handlers/84343)._
