| Summary: | Inability to compile programs defining _POSIX_SOURCE | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | arun <arun> | ||||
| Component: | bin | Assignee: | freebsd-bugs (Nobody) <bugs> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Only Me | ||||||
| Priority: | Normal | ||||||
| Version: | 5.0-CURRENT | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
Responsible Changed From-To: gnats-admin->freebsd-bugs misfiled If `_POSIX_SOURCE' is defined the system has to make visible the same namespace as permitted and required by IEEE Std 1003.1-1990, nothing more, nothing less. Your patch would make `u_char' .. `uint' visible to programs even if `_POSIX_SOURCE' were defined, which would cause portable programs to break. If you need to use <sys/socket.h>, then by definition your code falls outside of the gambit defined by the POSIX standard, so you should not be defining `_POSIX_SOURCE'. Incidentally, the `_POSIX_SOURCE' feature test macro is deprecated; `_POSIX_C_SOURCE' is recommended and can be given a numeric value corresponding to revision of the POSIX standard desired. Regards, Koshy <jkoshy@freebsd.org> State Changed From-To: open->closed Seems to be a misunderstanding on how defining `_POSIX_SOURCE' is required to change the behaviour of the C compilation system. On Wed, 21 Nov 2001 jkoshy@FreeBSD.ORG wrote: > If you need to use <sys/socket.h>, then by definition your code > falls outside of the gambit defined by the POSIX standard, so you > should not be defining `_POSIX_SOURCE'. Correct for the 1990 standard. > Incidentally, the `_POSIX_SOURCE' feature test macro is deprecated; > `_POSIX_C_SOURCE' is recommended and can be given a numeric value > corresponding to revision of the POSIX standard desired. POSIX.1-200x-draft7 has <sys/socket.h>, and for strict conformance, _POSIX_C_SOURCE has to be defined as 200xxxL before including any header. So the PR mostly applies to POSIX.1-200x. Bruce |
When a POSIX compliant program uses <sys/socket.h>, it gets compilation errors. The justification for this I've heard in the past is that POSIX doesn't include sockets. However, precluding all POSIX compliant programs from using sockets is not a good idea, in my opinion. Fix: Apply the patch below. $ diff -u /usr/include/sys/types.h- /usr/include/sys/types.h How-To-Repeat: Compile this program: #include <sys/types.h> #include <sys/socket.h> main() {} with -D_POSIX_SOURCE