A fix is available
APAR status
Closed as program error.
Error description
The test case behaves differently when _GNU_SOURCE is defined. Specifically, the bind() routine fails when _GNU_SOURCE is defined and works fine when the macro is not defined. The problem is it only happens with XL C and not with GCC. According to the GNU documentation defining _GNU_SOURCE makes program use the GNU C library extensions or some other non-standard functionality. TESTCASE: /* t.c */ #include <stdio.h> #include <sys/socket.h> #include <fcntl.h> #include <netinet/in.h> #include <errno.h> int main() { int s; const int so_reuseaddr = 1; unsigned int nAddr = 0; unsigned short nPort = 9999; struct sockaddr_in addr; s = socket(PF_INET, SOCK_STREAM, 0); setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (const char *)&so_reuseaddr, sizeof(so_reuseaddr)); fcntl(s, F_SETFD, 1); memset(&addr, 0, sizeof(addr)); addr.sin_addr.s_addr = htonl((unsigned int)nAddr); addr.sin_family = AF_INET; addr.sin_port = htons((unsigned short)nPort); if (bind(s, (struct sockaddr *)&addr, sizeof(addr))) { perror("INVALID_SOCKET"); } else { printf("BIND: SUCC\n"); } } $ xlc t.c -D_GNU_SOURCE && a.out INVALID_SOCKET: Cannot assign requested address $ gcc t.c -D_GNU_SOURCE && a.out BIND: SUCC
Local fix
N/A
Problem summary
A problem has been identified whereas with the calling convention used for the second parameter of the bind function.
Problem conclusion
The calling convention has been corrected to fix the problem.
Temporary fix
Comments
APAR Information
APAR number
LI71696
Reported component name
XL C/C++ RHEL4
Reported component ID
5724K7720
Reported release
701
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2006-10-25
Closed date
2006-10-25
Last modified date
2006-10-25
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
Fix information
Fixed component name
XL C/C++ RHEL4
Fixed component ID
5724K7720
Applicable component levels
R701 PSN LI71216
UP06/09/13
[{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SSJT9L","label":"XL C\/C++"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"7.0.1","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]
Document Information
Modified date:
16 October 2021