Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 612 Vote(s) - 3.58 Average
  • 1
  • 2
  • 3
  • 4
  • 5
#include statements that include a slash (header files made up of two parts)

#1
Sometimes I see header files of the form.

#include <sys/sysinfo.h> // I found this on my system under /usr/include/sys/sysinfo.h. Is that all the "sys/" means?

What is this called and why are these header files different from most others like

#include <stdio.h>

Maybe a group of related header files been grouped under the label of 'sys', but if I try something like "man pci" (there's a pci.h header in /usr/include/sys/ there is no entry.
Reply

#2
They're still headers, but they're not directly in the default search paths. This is often done for headers from third-party libraries, to keep them separate from the stock libc headers.
Reply

#3
It is a convenient way of providing some 'namespace structure' to header files. In the Unix world, the main division is between headers like `<stdio.h>` which are often fairly general and primarily for use by user programs and not primarily for use by the operating system kernel. By contrast, the headers like `<sys/sysinfo.h>` or `<sys/types.h>` were intended for use when compiling the kernel - they were more system-y.

Nowadays, it provides a way to separate your project's headers from another project's headers. For example, `<openssl/ssl.h>` identifies the header as belonging to the OpenSSL code base.

I don't know that there is a particular name for this style of specifying headers.

Note that if the OpenSSL headers are stored in the directory `/usr/local/include/openssl`, then you specify `-I /usr/local/include` on the compiler command line. What actually happens is that the header is looked for by prefixing the name in the angle brackets by one of a number of standard directories, of which the default one is `/usr/include` on Unix. Therefore, `<stdio.h>` is found in `/usr/include/stdio.h` and `<sys/sysinfo.h>` is found in `/usr/include/sys/sysinfo.h`, etc.
Reply

#4
It has to do with how your preprocessor works. If your preprocessor looks in `/usr/include/` then you need `sys/sysinfo.h`. If your preprocessor looks in `/usr/include/sys/` then you only need `sysinfo.h`

Try playing around with gcc with the `-I` and `-l` options

edit: those should be capital i and lowercase L
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through