When I have searched for the header unistd.h, in The Open Group, I found that it contains the standard symbolic constants & types and for sys/types.h it said for data types.
The division of the POSIX and C header in fine grained files probably comes from the old days when compilation might take a long time, and adding unnecesary header files made the time longer.
If you only need the OS types, say for the prototypes of your functions, then just #include
. However if you need the function definitions, then you #include
or any of the other system headers, as needed.
Naturally there are types that are in both headers, as you cannot declare some functions without their necessary types.
But these different declarations of the same type are guaranteed to be the same, so there is no problem if you include both.