Just how can i recognize which unistd.h documents is filled?

I have numerous unistd.h documents in my Ubuntu Linux. I've one on /usr/include/asm/unistd.h. This documents has this instructions:

# ifdef __i386__
#  include "unistd_32.h"
# else
#  include "unistd_64.h"
# endif

Because folder, I can locate those documents (unistd_32.h and also unistd_64.h).

Yet in /usr/src/linux-headers-2.6.31-22/include/asm-generic/ there's an additional unistd.h that begins with this instructions:

#if !defined(_ASM_GENERIC_UNISTD_H) || defined(__SYSCALL)
#define _ASM_GENERIC_UNISTD_H

So, the inquiry is: Just how can I recognize which one is filled? Exists any kind of means to examine it in runtime with Java?

0
2019-05-04 10:54:32
Source Share
Answers: 1

The specific regulations adhered to by the gcc compiler for locating include documents are clarified at : http://gcc.gnu.org/onlinedocs/cpp/Search-Path.html

A fast command - line method to figure out where an include documents originates from is the adhering to : 1

echo '#include <unistd.h>' | gcc -E -x c - > unistd.preprocessed

Then, if you consider the unistd.preprocessed documents, you will certainly see lines like :

# 1 "/usr/include/unistd.h" <some numbers>

These inform you that the adhering to block of lines (till the next # number ... line) originate from documents /usr/include/unistd.h.

So, if you need to know the complete checklist of documents consisted of, you can grep for the # number lines :

echo '#include <unistd.h>' | gcc -E -x c - | egrep '# [0-9]+ ' | awk '{print $3;}' | sort -u*emphasized text*

On my Ubuntu 10.04/ gcc 4.4.3 system, this generates :

$ echo '#include <unistd.h>' | gcc -E -x c - | egrep '# [0-9]+ ' | awk '{print $3;}' | sort -u
"<built-in>"
"<command-line>"
"<stdin>"
"/usr/include/bits/confname.h"
"/usr/include/bits/posix_opt.h"
"/usr/include/bits/predefs.h"
"/usr/include/bits/types.h"
"/usr/include/bits/typesizes.h"
"/usr/include/bits/wordsize.h"
"/usr/include/features.h"
"/usr/include/getopt.h"
"/usr/include/gnu/stubs-64.h"
"/usr/include/gnu/stubs.h"
"/usr/include/sys/cdefs.h"
"/usr/include/unistd.h"
"/usr/lib/gcc/x86_64-linux-gnu/4.4.3/include/stddef.h"

1 Note : The search course for include documents is changed by the -I command - line alternative ; so, you need to add any kind of -I path debates to the gcc conjuration. Additionally, if you are assembling a C+npls resource, you need to replace -x c with -x c++.

0
2019-05-08 21:25:53
Source