Port on AIX 32bit : unsigned int len; and __ulong32_t socklen_t
Robbie Harwood
rharwood at redhat.com
Wed Aug 30 12:38:53 EDT 2017
"REIX, Tony" <tony.reix at atos.net> writes:
> Hi,
>
> On AIX, in:
> src/appl/simple/client/sim_client.c
> src/appl/simple/server/sim_server.c
>
> the following definition works in 64bit but not in 32bit:
> unsigned int len;
> if (getsockname(sock, (struct sockaddr *)&c_sock, &len) < 0) {
>
> This is due to:
> /opt/freeware/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/include-fixed/sys/socket.h :
> int getsockname(int, struct sockaddr *__restrict__, socklen_t *__restrict__);
> typedef __ulong32_t socklen_t;
> and:
> /usr/include/inttypes.h
> #ifdef __64BIT__
> typedef unsigned int __ulong32_t;
> #else
> typedef unsigned long __ulong32_t;
> #endif /* __64BIT__ */
>
>
> I do not know what happens on Linux/x86_64 in 32bit.
> I'm looking at Linux/x86_64 now, using krb5-1.15.1-8.fc26.spec.
> However I think that it builds by default in 64bit.
krb5-1.15.1 builds fine on both 32 and 64-bit Linux. POSIX[1] states:
<sys/socket.h> makes available a type, socklen_t, which is an
unsigned opaque integral type of length of at least 32 bits. To
forestall portability problems, it is recommended that applications
should not use values larger than 2^32 - 1.
> Moreover:
> - /root/rpmbuild/BUILD/gcc-7.1.0/fixincludes/tests/base/sys/socket.h
> does not contain any definition for getsockname()
I would expect that to be at /usr/include/sys/socket.h on Fedora, and
it's declared as:
/* Put the local address of FD into *ADDR and its length in *LEN. */
extern int getsockname (int __fd, __SOCKADDR_ARG __addr,
socklen_t *__restrict __len) __THROW;
(It comes out of the glibc-headers package.)
> So: if krb5 on Linux is always built in 64bit, and never in 32bit, the issue does not appear.
> However, maybe that, even in 32bit, the issue does not appear. Unless
> some # if __WORDSIZE == 64 is required ?
krb5 has abstraction around getsockname's third type. The #define to
look for is GETSOCKNAME_ARG3_TYPE; there are some rules in aclocal.m4
for determining it.
Thanks,
--Robbie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
Url : http://mailman.mit.edu/pipermail/krbdev/attachments/20170830/533319cc/attachment.bin
More information about the krbdev
mailing list