tags:

views:

67

answers:

2

I was inspecting the code of a linux application and i saw the #include in one of the code files. I tried looking it up on opengroup.org but i couldn't find it there, this is what the sys directory looks like: http://www.opengroup.org/onlinepubs/000095399/basedefs/sys/ . I guess it's not standard header file, but i checked it in my /usr/include/sys and it was there.

What does it do and what it is used for ? If you can provide me with some manual for it, i would be grateful. Thanks.

A: 

Used in conjunction with ptrace(2) (see PTRACE_PEEKUSER): http://linux.die.net/man/2/ptrace

quietdragon
+2  A: 

The comment at the top of the header pretty much says it all:

#ifndef _SYS_USER_H
#define _SYS_USER_H     1

/* The whole purpose of this file is for GDB and GDB only.  Don't read
   too much into it.  Don't use it for anything other than GDB unless
   you know what you are doing.  */

GNU specific extensions are usually pretty easy to identify (e.g. _GNU_SOURCE). However, debugging and instrumentation has to work even if those extensions aren't turned on. For instance, people want to use GDB on code that does not #define _GNU_SOURCE.

In that case, stuff that is not defined in ISO C (and not required by POSIX) is usually clearly labeled as such.

You'll also find all kinds of strange looking symbols in programs that include the Valgrind headers.

Tim Post