* libc
@ 1997-07-22 13:14 Ryan Benigno
0 siblings, 0 replies; 5+ messages in thread
From: Ryan Benigno @ 1997-07-22 13:14 UTC (permalink / raw)
I am running RedHat-4.2 an an Alpha box. The problem is with libc.
Whenever I compile something with socket code I get warnings about
incompatable pointer types in accept() and a few other important calls.
The reason is on an Alpha longs are 64 bit while on x86's they're only
32. The network functions in question use size_t rather then int as
they should. This is a bad thing because size_t != sizeof(int) on an
Alpha like they are on a x86 but rather sizeof(long). This causes some
network programs to be really broken. I guess what I'm asking is if
anyone knows of a non-broken libc or patches to fix libc on an Alpha.
Any info would be appreciated.
Thanks,
Ryan
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: libc
@ 1997-07-22 3:45 Greg Lindahl
1997-07-22 12:40 ` libc Michael Alan Dorman
0 siblings, 1 reply; 5+ messages in thread
From: Greg Lindahl @ 1997-07-22 3:45 UTC (permalink / raw)
> > This causes some
> > network programs to be really broken.
>
> Not really. If you avoid shoddy programming practices and include proper
> headers, instead of second-guessing them, they work like advertised.
The interface to accept() has a (int *) in the manpage which is a
(size_t *) in the include file.
Other OSes, not to mention Redhat 4.1/Intel, have int *. There is no
easy way to write compatible code for both cases.
This is a real issue. I'd bet that it was done on purpose as there
are many things in the bsd interfaces which ought to be size_t's.
But we need a graceful plan for migrating and some explanation, so
I can explain to my boss why my code breaks on this new OS revision
but it's not my fault.
-- g
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: libc
1997-07-22 3:45 libc Greg Lindahl
@ 1997-07-22 12:40 ` Michael Alan Dorman
0 siblings, 0 replies; 5+ messages in thread
From: Michael Alan Dorman @ 1997-07-22 12:40 UTC (permalink / raw)
On Jul 21, Greg Lindahl wrote
> Other OSes, not to mention Redhat 4.1/Intel, have int *. There is no
> easy way to write compatible code for both cases.
Sure there is.
#ifdef __GLIBC__
# define sock_size_t size_t
#else /* __GLIBC__ */
# define sock_size_t int
#endif /* __GLIBC__ */
sock_size_t len;
accept ( ..., &len );
This is exactly what the perl people have done---you should look at
the code in 5.004, as it also knows about the proper defines for the
new spec that specifies this.
Mike.
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <33D4B218.7137@home.com>]
* Re: libc
[not found] <33D4B218.7137@home.com>
@ 1997-07-22 3:41 ` Michal Jaegermann
1997-07-22 5:52 ` libc Richard Henderson
0 siblings, 1 reply; 5+ messages in thread
From: Michal Jaegermann @ 1997-07-22 3:41 UTC (permalink / raw)
>
> I am running RedHat-4.2 an an Alpha box. The problem is with libc.
> Whenever I compile something with socket code I get warnings about
> incompatable pointer types in accept() and a few other important calls.
Never, NEVER, provide your own declarations for functions declared
in system headers.
> The network functions in question use size_t rather then int as
> they should.
Headers, i.e. <sys/socket.h> say:
extern int __connect __P ((int __fd,
__CONST_SOCKADDR_ARG __addr, size_t __len));
extern int connect __P ((int __fd,
__CONST_SOCKADDR_ARG __addr, size_t __len));
while indeed manpage says that the third argument is int. But
system headers have a precedence. This is what libraries really expect.
The same goes for other socket functions.
> This causes some
> network programs to be really broken.
Not really. If you avoid shoddy programming practices and include proper
headers, instead of second-guessing them, they work like advertised.
I strongly suspect that size_t above is a POSIX requirement although
I do not know that for sure. Anybody can confirm/refute?
Manpages indeed should be fixed to agree with what is in headers.
Michal
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: libc
1997-07-22 3:41 ` libc Michal Jaegermann
@ 1997-07-22 5:52 ` Richard Henderson
0 siblings, 0 replies; 5+ messages in thread
From: Richard Henderson @ 1997-07-22 5:52 UTC (permalink / raw)
> Headers, i.e. <sys/socket.h> say:
>
> extern int connect __P ((int __fd,
> __CONST_SOCKADDR_ARG __addr, size_t __len));
[...]
> I strongly suspect that size_t above is a POSIX requirement although
> I do not know that for sure. Anybody can confirm/refute?
Confirmed. POSIX requires size_t while tradition said int.
The portable solution is to add a new test to autoconf and a
type define to accompany. This is going to be even more of a
problem for sparc64, what with it being big-endian...
r~
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~1997-07-22 13:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-07-22 13:14 libc Ryan Benigno
-- strict thread matches above, loose matches on Subject: below --
1997-07-22 3:45 libc Greg Lindahl
1997-07-22 12:40 ` libc Michael Alan Dorman
[not found] <33D4B218.7137@home.com>
1997-07-22 3:41 ` libc Michal Jaegermann
1997-07-22 5:52 ` libc Richard Henderson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox