Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* Re: Trouble with sockets while compiling Tcl 8.0
@ 1998-02-12  9:36 Stefan Traby
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Traby @ 1998-02-12  9:36 UTC (permalink / raw)


Hi Michal !

> > extern int accept __P ((int __fd, __SOCKADDR_ARG __addr,size_t *__addr_len));
                                                             ^^^^
> Not that I have here a copy of a POSIX standard here to check, but I
> believe that this is what it requires.  Other functions as well.

;-}
The man pages are BSD like !

UNIX Network Programming (Stevens) says about BSD Sockets:
int accept(int sockfd, struct sockaddr *peer, int *addrlen);
 
But for all GNU software check first the info and then the man pages.

glibc-info:
 - Function: int accept (int SOCKET, struct sockaddr *ADDR, socklen_t
          *LENGTH-PTR)

And look deep into the info file. (An _exact_ text on your problem...)

---------
   Throughout the following description at various places
variables/parameters to denote sizes are required.  And here the trouble
starts.  In the first implementations the type of these variables was
simply `int'.  This type was on almost all machines of this time 32
bits wide and so a de-factor standard required 32 bit variables.  This
is important since references to variables of this type are passed to
the kernel.

   But now the POSIX people came and unified the interface with their
words "all size values are of type `size_t'".  But on 64 bit machines
`size_t' is 64 bits wide and so variable references are not anymore
possible.

   A solution provides the Unix98 specification which finally
introduces a type `socklen_t'.  This type is used in all of the cases in
previously changed to use `size_t'.  The only requirement of this type
is that it is an unsigned type of at least 32 bits.  Therefore,
implementations which require references to 32 bit variables be passed
can be as happy as implementations which right from the start of 64 bit
values.
--------

-- 
  ciao - 
    Stefan

Stefan Traby                            phone:  +43-3133-6107-2
Mitterlasznitzstr. 13                     fax:  +43-3133-6107-9
8302 Nestelbach                        mailto://stefan@sime.com
Austria

-- 
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] 3+ messages in thread
[parent not found: <199802120049.TAA07622@ulexite.nist.gov>]
* Trouble with sockets while compiling Tcl 8.0
@ 1998-02-12  0:49 Michael J. Donahue
  0 siblings, 0 replies; 3+ messages in thread
From: Michael J. Donahue @ 1998-02-12  0:49 UTC (permalink / raw)


I'm trying to build Tcl 8.0p2 on my linux/axp/RedHat 4.1 box, and
running into some trouble with some of the socket code.  To be
specific, my /usr/include/sys/socket.h file gives:

extern int accept __P ((int __fd, __SOCKADDR_ARG __addr,size_t *__addr_len));
extern int getpeername __P ((int __fd, __SOCKADDR_ARG __addr,size_t *__len));
extern int getsockname __P ((int __fd, __SOCKADDR_ARG __addr,size_t *__len));
extern int getsockopt __P ((int __fd, int __level, int __optname,
                            __ptr_t __optval, size_t *__optlen));

However, the man pages and the Tcl code say the last arg in each case
should be (int *) instead of (size_t *).

This is a problem, because size_t is apparently getting set in

   /usr/lib/gcc-lib/alpha-linux/2.7.2.1/include/stddef.h

as (long unsigned int), which is 8 bytes wide rather than the 4 bytes
for an (int).  Incidentally, my <linux/stddef.h> file gives

   #ifndef _SIZE_T
   #define _SIZE_T
   typedef unsigned int size_t;
   #endif

So, should the "len" arg in the above calls be (int *) or (size_t *)?
Is size_t suppose to be unsigned int or unsigned long?  And is any of
this different in latter releases of RH?

TIA,

-mike

-- 
Michael J. Donahue
National Institute of Standards and Technology
Mathematical & Computational Sciences Division
Bldg 820, Rm 365
Gaithersburg, MD 20899
email: michael.donahue@nist.gov
voice: (301) 975-5424
  fax: (301) 990-4127
  web: http://math.nist.gov/mcsd/Staff/MDonahue/

-- 
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] 3+ messages in thread

end of thread, other threads:[~1998-02-12  9:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-02-12  9:36 Trouble with sockets while compiling Tcl 8.0 Stefan Traby
     [not found] <199802120049.TAA07622@ulexite.nist.gov>
1998-02-12  5:30 ` Michal Jaegermann
  -- strict thread matches above, loose matches on Subject: below --
1998-02-12  0:49 Michael J. Donahue

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox