Re: pgsql: Remove check for accept() argument types
От | Tom Lane |
---|---|
Тема | Re: pgsql: Remove check for accept() argument types |
Дата | |
Msg-id | 1731092.1636739453@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: pgsql: Remove check for accept() argument types (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-committers |
I wrote: > Peter Eisentraut <peter.eisentraut@enterprisedb.com> writes: >> What does the man page say the correct type >> would be? size_t? > The machine's not booted up right now :-(. But I'm pretty sure we > shouldn't consider using size_t here, as it's not real clear that that > couldn't be 64 bits on any affected platforms. Your previous research > said that the desired type is 32 bits on all such platforms, so I think > that "int" is correct; we need only debate signedness. Hmm ... now that I'm in my office, I checked this and HPUX 10.20's accept(2) man page saith SYNOPSIS #include <sys/socket.h> AF_CCITT only #include <x25/x25addrstr.h> int accept(int s, void *addr, int *addrlen); _XOPEN_SOURCE_EXTENDED only int accept(int s, struct sockaddr *addr, size_t *addrlen); gaur is using -D_XOPEN_SOURCE_EXTENDED and hence building against the latter definition. (I found out quite a long time ago that without _XOPEN_SOURCE_EXTENDED, this platform has a LOT of discrepancies from SUS v2.) Further down, there's FUTURE DIRECTION The default behavior in this release is still the classic HP-UX BSD Sockets, however it will be changed to X/Open Sockets in some future release. At that time, any HP-UX BSD Sockets behavior which is incompatible with X/Open Sockets may be obsoleted. HP customers are advised to migrate their applications to conform to X/Open specification (see xopen_networking(7)). So what it looks like to me is (1) Original BSD Sockets defined the argument as "int *addrlen". (I confirmed this by looking in an ancient copy of Stevens' Unix Network Programming.) (2) X/Open thought it'd be better to use size_t. (3) POSIX decided to resolve the conflict by inventing socklen_t. However, SUS v2 says specifically that socklen_t "is an unsigned opaque integral type of length of at least 32 bits". The "unsigned" part was removed in later POSIX editions, which surprises me --- they don't usually change the standard in the direction of less definiteness. On the whole, I still think "unsigned int" is our best compromise. But maybe we should use size_t and cite X/Open as authority. regards, tom lane
В списке pgsql-committers по дате отправления: