4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-18 12:29:32 +08:00

* net.cc (cygwin_sendto): Define appropriate parameters using

socklen_t type according to SUSv3.
	(cygwin_recvfrom): Ditto.
	(cygwin_setsockopt): Ditto.
	(cygwin_getsockopt): Ditto.
	(cygwin_connect): Ditto.
	(cygwin_accept): Ditto.
	(cygwin_bind): Ditto.
	(cygwin_getsockname): Ditto.
	(cygwin_getpeername): Ditto.
	(cygwin_recv): Ditto.
	(cygwin_send): Ditto.
	* include/cygwin/socket.h (socklen_t): Typedef and define.
	* include/sys/socket.h: Declare socket functions using socklen_t type.
This commit is contained in:
Corinna Vinschen 2006-07-03 11:31:56 +00:00
parent 37b43cde0c
commit 78db7dff2c
4 changed files with 50 additions and 27 deletions

View File

@ -1,3 +1,20 @@
2006-07-03 Corinna Vinschen <corinna@vinschen.de>
* net.cc (cygwin_sendto): Define appropriate parameters using
socklen_t type according to SUSv3.
(cygwin_recvfrom): Ditto.
(cygwin_setsockopt): Ditto.
(cygwin_getsockopt): Ditto.
(cygwin_connect): Ditto.
(cygwin_accept): Ditto.
(cygwin_bind): Ditto.
(cygwin_getsockname): Ditto.
(cygwin_getpeername): Ditto.
(cygwin_recv): Ditto.
(cygwin_send): Ditto.
* include/cygwin/socket.h (socklen_t): Typedef and define.
* include/sys/socket.h: Declare socket functions using socklen_t type.
2006-07-02 Christopher Faylor <cgf@timesys.com> 2006-07-02 Christopher Faylor <cgf@timesys.com>
* include/cygwin/version.h: Bump DLL minor version number to 21. * include/cygwin/version.h: Bump DLL minor version number to 21.

View File

@ -17,8 +17,11 @@ extern "C" {
#include <stdint.h> #include <stdint.h>
/* Not unsigned for backward compatibility. Keep #define for backward
compatibility. */
#ifndef socklen_t #ifndef socklen_t
#define socklen_t int /* Not unsigned for backward compat. */ typedef int socklen_t;
#define socklen_t socklen_t
#endif #endif
typedef uint16_t sa_family_t; typedef uint16_t sa_family_t;

View File

@ -26,22 +26,24 @@ extern "C"
#define SHUT_RDWR 2 /* == Win32 SD_BOTH */ #define SHUT_RDWR 2 /* == Win32 SD_BOTH */
#ifndef __INSIDE_CYGWIN_NET__ #ifndef __INSIDE_CYGWIN_NET__
int accept (int, struct sockaddr *__peer, int *); int accept (int, struct sockaddr *__peer, socklen_t *);
int bind (int, const struct sockaddr *__my_addr, int __addrlen); int bind (int, const struct sockaddr *__my_addr, socklen_t __addrlen);
int connect (int, const struct sockaddr *, int); int connect (int, const struct sockaddr *, socklen_t);
int getpeername (int, struct sockaddr *__peer, int *); int getpeername (int, struct sockaddr *__peer, socklen_t *);
int getsockname (int, struct sockaddr *__addr, int *); int getsockname (int, struct sockaddr *__addr, socklen_t *);
int listen (int, int __n); int listen (int, int __n);
int recv (int, void *__buff, int __len, int __flags); int recv (int, void *__buff, size_t __len, int __flags);
int recvfrom (int, void *__buff, int __len, int __flags, int recvfrom (int, void *__buff, size_t __len, int __flags,
struct sockaddr *__from, int *__fromlen); struct sockaddr *__from, socklen_t *__fromlen);
int recvmsg(int s, struct msghdr *msg, int flags); int recvmsg(int s, struct msghdr *msg, int flags);
int send (int, const void *__buff, int __len, int __flags); int send (int, const void *__buff, size_t __len, int __flags);
int sendmsg(int s, const struct msghdr *msg, int flags); int sendmsg(int s, const struct msghdr *msg, int flags);
int sendto (int, const void *, int __len, int __flags, int sendto (int, const void *, size_t __len, int __flags,
const struct sockaddr *__to, int __tolen); const struct sockaddr *__to, socklen_t __tolen);
int setsockopt (int __s, int __level, int __optname, const void *optval, int __optlen); int setsockopt (int __s, int __level, int __optname, const void *optval,
int getsockopt (int __s, int __level, int __optname, void *__optval, int *__optlen); socklen_t __optlen);
int getsockopt (int __s, int __level, int __optname, void *__optval,
socklen_t *__optlen);
int shutdown (int, int); int shutdown (int, int);
int socket (int __family, int __type, int __protocol); int socket (int __family, int __type, int __protocol);
int socketpair (int __domain, int __type, int __protocol, int *__socket_vec); int socketpair (int __domain, int __type, int __protocol, int *__socket_vec);

View File

@ -623,8 +623,8 @@ done:
/* exported as sendto: standards? */ /* exported as sendto: standards? */
extern "C" int extern "C" int
cygwin_sendto (int fd, const void *buf, int len, int flags, cygwin_sendto (int fd, const void *buf, size_t len, int flags,
const struct sockaddr *to, int tolen) const struct sockaddr *to, socklen_t tolen)
{ {
int res; int res;
sig_dispatch_pending (); sig_dispatch_pending ();
@ -645,8 +645,8 @@ cygwin_sendto (int fd, const void *buf, int len, int flags,
/* exported as recvfrom: standards? */ /* exported as recvfrom: standards? */
extern "C" int extern "C" int
cygwin_recvfrom (int fd, void *buf, int len, int flags, cygwin_recvfrom (int fd, void *buf, size_t len, int flags,
struct sockaddr *from, int *fromlen) struct sockaddr *from, socklen_t *fromlen)
{ {
int res; int res;
sig_dispatch_pending (); sig_dispatch_pending ();
@ -689,7 +689,7 @@ convert_ws1_ip_optname (int optname)
/* exported as setsockopt: standards? */ /* exported as setsockopt: standards? */
extern "C" int extern "C" int
cygwin_setsockopt (int fd, int level, int optname, const void *optval, cygwin_setsockopt (int fd, int level, int optname, const void *optval,
int optlen) socklen_t optlen)
{ {
int res; int res;
fhandler_socket *fh = get (fd); fhandler_socket *fh = get (fd);
@ -753,7 +753,8 @@ cygwin_setsockopt (int fd, int level, int optname, const void *optval,
/* exported as getsockopt: standards? */ /* exported as getsockopt: standards? */
extern "C" int extern "C" int
cygwin_getsockopt (int fd, int level, int optname, void *optval, int *optlen) cygwin_getsockopt (int fd, int level, int optname, void *optval,
socklen_t *optlen)
{ {
int res; int res;
fhandler_socket *fh = get (fd); fhandler_socket *fh = get (fd);
@ -803,7 +804,7 @@ getpeereid (int fd, __uid32_t *euid, __gid32_t *egid)
/* exported as connect: standards? */ /* exported as connect: standards? */
extern "C" int extern "C" int
cygwin_connect (int fd, const struct sockaddr *name, int namelen) cygwin_connect (int fd, const struct sockaddr *name, socklen_t namelen)
{ {
int res; int res;
sig_dispatch_pending (); sig_dispatch_pending ();
@ -986,7 +987,7 @@ cygwin_gethostbyaddr (const char *addr, int len, int type)
/* exported as accept: standards? */ /* exported as accept: standards? */
extern "C" int extern "C" int
cygwin_accept (int fd, struct sockaddr *peer, int *len) cygwin_accept (int fd, struct sockaddr *peer, socklen_t *len)
{ {
int res; int res;
sig_dispatch_pending (); sig_dispatch_pending ();
@ -1017,7 +1018,7 @@ cygwin_accept (int fd, struct sockaddr *peer, int *len)
/* exported as bind: standards? */ /* exported as bind: standards? */
extern "C" int extern "C" int
cygwin_bind (int fd, const struct sockaddr *my_addr, int addrlen) cygwin_bind (int fd, const struct sockaddr *my_addr, socklen_t addrlen)
{ {
int res; int res;
sig_dispatch_pending (); sig_dispatch_pending ();
@ -1035,7 +1036,7 @@ cygwin_bind (int fd, const struct sockaddr *my_addr, int addrlen)
/* exported as getsockname: standards? */ /* exported as getsockname: standards? */
extern "C" int extern "C" int
cygwin_getsockname (int fd, struct sockaddr *addr, int *namelen) cygwin_getsockname (int fd, struct sockaddr *addr, socklen_t *namelen)
{ {
int res; int res;
sig_dispatch_pending (); sig_dispatch_pending ();
@ -1137,7 +1138,7 @@ cygwin_herror (const char *s)
/* exported as getpeername: standards? */ /* exported as getpeername: standards? */
extern "C" int extern "C" int
cygwin_getpeername (int fd, struct sockaddr *name, int *len) cygwin_getpeername (int fd, struct sockaddr *name, socklen_t *len)
{ {
int res; int res;
sig_dispatch_pending (); sig_dispatch_pending ();
@ -1156,14 +1157,14 @@ cygwin_getpeername (int fd, struct sockaddr *name, int *len)
/* exported as recv: standards? */ /* exported as recv: standards? */
extern "C" int extern "C" int
cygwin_recv (int fd, void *buf, int len, int flags) cygwin_recv (int fd, void *buf, size_t len, int flags)
{ {
return cygwin_recvfrom (fd, buf, len, flags, NULL, NULL); return cygwin_recvfrom (fd, buf, len, flags, NULL, NULL);
} }
/* exported as send: standards? */ /* exported as send: standards? */
extern "C" int extern "C" int
cygwin_send (int fd, const void *buf, int len, int flags) cygwin_send (int fd, const void *buf, size_t len, int flags)
{ {
return cygwin_sendto (fd, buf, len, flags, NULL, 0); return cygwin_sendto (fd, buf, len, flags, NULL, 0);
} }