How are standard library headers set on Linux?

I have an annoying problem with the siginfo.h library. I need a version of this library that contains a siginfo_t structure with a field for processing SIGSYS signals.

For isntance, the version of the structure I need can be found here: http://code.woboq.org/userspace/glibc/sysdeps/unix/sysv/linux/x86/bits/siginfo.h.html

The version that is automatically included using #include is the version in /usr/include/bits/siginfo.h that skips this field. However, there is another version of the same library in asm-generic that provides the fields I need. The kernel contains two files named siginfo.h, but they do not contain the siginfo_t structure. I thought this problem could be solved by updating glibc, but the latest version of glibc (2.17) again has a completely different version, and not what I need.

Now I'm a little confused, how are the standard library headers actually set? Should I activate compilation options to create this structure?

+4
source share
2 answers

What is available in the union {} _sifields element of the union {} _sifields element depends on which kernel you are using.

Kernel 3.6.4 definitely defines:

  /* SIGSYS */ struct { void __user *_call_addr; /* calling user insn */ int _syscall; /* triggering system call number */ unsigned int _arch; /* AUDIT_ARCH_* of syscall */ } _sigsys; 

Kernel 2.6.32 does not.

I do not know when it was introduced exactly.

0
source

The header file is executed as the following order in gcc: 1) the path identified by the -I option; 2) The path to env vars, C_INCLUDE_PATH, CPLUS_INCLUDE_PATH, OBJC_INCLUDE_PATH; 3) The system path, for example, "/ usr / include", etc. Thus, you can use the -I option to change the search path of the header file. And you may need to use the -L option to change the library path.

-1
source

Source: https://habr.com/ru/post/1486472/


All Articles