aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2013-04-08 10:03:11 +0000
committerCorinna Vinschen <corinna@vinschen.de>2013-04-08 10:03:11 +0000
commitcb8b6dcf683ee2ba14d7a123d1afa10b97ed7c85 (patch)
tree802d630f9b84dd0912d462d5c1438f7ba425adca
parent975df426a476b1266ffe4e37069b9e1fe7e0078f (diff)
downloadnewlib-cb8b6dcf683ee2ba14d7a123d1afa10b97ed7c85.zip
newlib-cb8b6dcf683ee2ba14d7a123d1afa10b97ed7c85.tar.gz
newlib-cb8b6dcf683ee2ba14d7a123d1afa10b97ed7c85.tar.bz2
* fhandler_socket.cc (fhandler_socket::get_proc_fd_name): Use %lu as
format specifier to match HANDLE size. * net.cc (cygwin_sendto): Fix return type to be ssize_t. Change syscall_printf return type format specifier to %lR. (cygwin_recvfrom): Ditto. (cygwin_recv): Ditto. (cygwin_send): Ditto. (cygwin_recvmsg): Ditto. (cygwin_sendmsg): Ditto. * smallprint.cc (__small_vsprintf): Handle `l' for %R, too. (__small_vswprintf): Ditto. * syscalls.cc (read): Change syscall_printf return type format specifier to %lR. (readv): Ditto. (pread): Ditto. (write): Ditto. (writev): Ditto. (pwrite): Ditto. (lseek64): Enhance comment.
-rw-r--r--winsup/cygwin/ChangeLog.64bit22
-rw-r--r--winsup/cygwin/fhandler_socket.cc2
-rw-r--r--winsup/cygwin/net.cc24
-rw-r--r--winsup/cygwin/smallprint.cc21
-rw-r--r--winsup/cygwin/syscalls.cc16
5 files changed, 59 insertions, 26 deletions
diff --git a/winsup/cygwin/ChangeLog.64bit b/winsup/cygwin/ChangeLog.64bit
index f147831..59b2f3e 100644
--- a/winsup/cygwin/ChangeLog.64bit
+++ b/winsup/cygwin/ChangeLog.64bit
@@ -1,4 +1,26 @@
2013-04-08 Corinna Vinschen <corinna@vinschen.de>
+
+ * fhandler_socket.cc (fhandler_socket::get_proc_fd_name): Use %lu as
+ format specifier to match HANDLE size.
+ * net.cc (cygwin_sendto): Fix return type to be ssize_t. Change
+ syscall_printf return type format specifier to %lR.
+ (cygwin_recvfrom): Ditto.
+ (cygwin_recv): Ditto.
+ (cygwin_send): Ditto.
+ (cygwin_recvmsg): Ditto.
+ (cygwin_sendmsg): Ditto.
+ * smallprint.cc (__small_vsprintf): Handle `l' for %R, too.
+ (__small_vswprintf): Ditto.
+ * syscalls.cc (read): Change syscall_printf return type format specifier
+ to %lR.
+ (readv): Ditto.
+ (pread): Ditto.
+ (write): Ditto.
+ (writev): Ditto.
+ (pwrite): Ditto.
+ (lseek64): Enhance comment.
+
+2013-04-08 Corinna Vinschen <corinna@vinschen.de>
* pipe.cc (fhandler_pipe::open): Fix format specifier and type when
reading handle value.
diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc
index 44e36db..dd79ac1 100644
--- a/winsup/cygwin/fhandler_socket.cc
+++ b/winsup/cygwin/fhandler_socket.cc
@@ -219,7 +219,7 @@ fhandler_socket::~fhandler_socket ()
char *
fhandler_socket::get_proc_fd_name (char *buf)
{
- __small_sprintf (buf, "socket:[%d]", get_socket ());
+ __small_sprintf (buf, "socket:[%lu]", get_socket ());
return buf;
}
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc
index 0144295..fa747ac 100644
--- a/winsup/cygwin/net.cc
+++ b/winsup/cygwin/net.cc
@@ -704,7 +704,7 @@ done:
}
/* exported as sendto: standards? */
-extern "C" int
+extern "C" ssize_t
cygwin_sendto (int fd, const void *buf, size_t len, int flags,
const struct sockaddr *to, socklen_t tolen)
{
@@ -720,13 +720,13 @@ cygwin_sendto (int fd, const void *buf, size_t len, int flags,
else
res = fh->sendto (buf, len, flags, to, tolen);
- syscall_printf ("%R = sendto(%d, %p, %ld, %y, %p, %d)",
+ syscall_printf ("%lR = sendto(%d, %p, %ld, %y, %p, %d)",
res, fd, buf, len, flags, to, tolen);
return res;
}
/* exported as recvfrom: standards? */
-extern "C" int
+extern "C" ssize_t
cygwin_recvfrom (int fd, void *buf, size_t len, int flags,
struct sockaddr *from, socklen_t *fromlen)
{
@@ -746,7 +746,7 @@ cygwin_recvfrom (int fd, void *buf, size_t len, int flags,
to deliver valid error conditions and peer address. */
res = fh->recvfrom (buf, len, flags, from, fromlen);
- syscall_printf ("%R = recvfrom(%d, %p, %ld, %y, %p, %p)",
+ syscall_printf ("%lR = recvfrom(%d, %p, %ld, %y, %p, %p)",
res, fd, buf, len, flags, from, fromlen);
return res;
}
@@ -1493,7 +1493,7 @@ cygwin_getpeername (int fd, struct sockaddr *name, socklen_t *len)
}
/* exported as recv: standards? */
-extern "C" int
+extern "C" ssize_t
cygwin_recv (int fd, void *buf, size_t len, int flags)
{
int res;
@@ -1512,12 +1512,12 @@ cygwin_recv (int fd, void *buf, size_t len, int flags)
to deliver valid error conditions. */
res = fh->recvfrom (buf, len, flags, NULL, NULL);
- syscall_printf ("%R = recv(%d, %p, %ld, %y)", res, fd, buf, len, flags);
+ syscall_printf ("%lR = recv(%d, %p, %ld, %y)", res, fd, buf, len, flags);
return res;
}
/* exported as send: standards? */
-extern "C" int
+extern "C" ssize_t
cygwin_send (int fd, const void *buf, size_t len, int flags)
{
int res;
@@ -1532,7 +1532,7 @@ cygwin_send (int fd, const void *buf, size_t len, int flags)
else
res = fh->sendto (buf, len, flags, NULL, 0);
- syscall_printf ("%R = send(%d, %p, %ld, %y)", res, fd, buf, len, flags);
+ syscall_printf ("%lR = send(%d, %p, %ld, %y)", res, fd, buf, len, flags);
return res;
}
@@ -2611,7 +2611,7 @@ endhostent (void)
}
/* exported as recvmsg: standards? */
-extern "C" int
+extern "C" ssize_t
cygwin_recvmsg (int fd, struct msghdr *msg, int flags)
{
int res;
@@ -2634,12 +2634,12 @@ cygwin_recvmsg (int fd, struct msghdr *msg, int flags)
res = fh->recvmsg (msg, flags);
}
- syscall_printf ("%R = recvmsg(%d, %p, %y)", res, fd, msg, flags);
+ syscall_printf ("%lR = recvmsg(%d, %p, %y)", res, fd, msg, flags);
return res;
}
/* exported as sendmsg: standards? */
-extern "C" int
+extern "C" ssize_t
cygwin_sendmsg (int fd, const struct msghdr *msg, int flags)
{
int res;
@@ -2658,7 +2658,7 @@ cygwin_sendmsg (int fd, const struct msghdr *msg, int flags)
res = fh->sendmsg (msg, flags);
}
- syscall_printf ("%R = sendmsg(%d, %p, %y)", res, fd, msg, flags);
+ syscall_printf ("%lR = sendmsg(%d, %p, %y)", res, fd, msg, flags);
return res;
}
diff --git a/winsup/cygwin/smallprint.cc b/winsup/cygwin/smallprint.cc
index e6f1972..75291e7 100644
--- a/winsup/cygwin/smallprint.cc
+++ b/winsup/cygwin/smallprint.cc
@@ -1,7 +1,7 @@
/* smallprint.cc: small print routines for WIN32
Copyright 1996, 1998, 2000, 2001, 2002, 2003, 2005, 2006,
- 2007, 2008, 2009, 2012
+ 2007, 2008, 2009, 2012, 2013
Red Hat, Inc.
This file is part of Cygwin.
@@ -108,6 +108,7 @@ __rn (char *dst, int base, int dosign, long long val, int len, int pad, unsigned
p address
P process name
R return value, 4 byte.
+ lR return value, 4 byte on 32 bit, 8 byte on 64 bit.
s char *
ls char * w/ non-ASCII tweaking
S PUNICODE_STRING
@@ -137,7 +138,7 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap)
DWORD err = GetLastError ();
- int32_t Rval = 0;
+ intptr_t Rval = 0;
while (*fmt)
{
int i, n = 0x7fff;
@@ -206,7 +207,12 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap)
break;
case 'R':
{
- Rval = va_arg (ap, int32_t);
+#ifdef __x86_64__
+ if (l_opt)
+ Rval = va_arg (ap, int64_t);
+ else
+#endif
+ Rval = va_arg (ap, int32_t);
dst = __rn (dst, 10, addsign, Rval, len, pad, LMASK);
}
break;
@@ -474,7 +480,7 @@ __small_vswprintf (PWCHAR dst, const WCHAR *fmt, va_list ap)
DWORD err = GetLastError ();
- int32_t Rval = 0;
+ intptr_t Rval = 0;
while (*fmt)
{
unsigned int n = 0x7fff;
@@ -525,7 +531,12 @@ __small_vswprintf (PWCHAR dst, const WCHAR *fmt, va_list ap)
break;
case 'R':
{
- Rval = va_arg (ap, int32_t);
+#ifdef __x86_64__
+ if (l_opt)
+ Rval = va_arg (ap, int64_t);
+ else
+#endif
+ Rval = va_arg (ap, int32_t);
dst = __wrn (dst, 10, addsign, Rval, len, pad, LMASK);
}
break;
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 7984f77..f2d2f30 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -1147,7 +1147,7 @@ read (int fd, void *ptr, size_t len)
cfd->read (ptr, res = len);
done:
- syscall_printf ("%R = read(%d, %p, %d)", res, fd, ptr, len);
+ syscall_printf ("%lR = read(%d, %p, %d)", res, fd, ptr, len);
MALLOC_CHECK;
return (ssize_t) res;
}
@@ -1189,7 +1189,7 @@ readv (int fd, const struct iovec *const iov, const int iovcnt)
res = cfd->readv (iov, iovcnt, tot);
done:
- syscall_printf ("%R = readv(%d, %p, %d)", res, fd, iov, iovcnt);
+ syscall_printf ("%lR = readv(%d, %p, %d)", res, fd, iov, iovcnt);
MALLOC_CHECK;
return res;
}
@@ -1206,7 +1206,7 @@ pread (int fd, void *ptr, size_t len, off_t off)
else
res = cfd->pread (ptr, len, off);
- syscall_printf ("%R = pread(%d, %p, %d, %d)", res, fd, ptr, len, off);
+ syscall_printf ("%lR = pread(%d, %p, %d, %d)", res, fd, ptr, len, off);
return res;
}
@@ -1240,7 +1240,7 @@ write (int fd, const void *ptr, size_t len)
res = cfd->write (ptr, len);
done:
- syscall_printf ("%R = write(%d, %p, %d)", res, fd, ptr, len);
+ syscall_printf ("%lR = write(%d, %p, %d)", res, fd, ptr, len);
MALLOC_CHECK;
return res;
@@ -1286,9 +1286,9 @@ writev (const int fd, const struct iovec *const iov, const int iovcnt)
done:
if (fd == 1 || fd == 2)
- paranoid_printf ("%R = writev(%d, %p, %d)", res, fd, iov, iovcnt);
+ paranoid_printf ("%lR = writev(%d, %p, %d)", res, fd, iov, iovcnt);
else
- syscall_printf ("%R = writev(%d, %p, %d)", res, fd, iov, iovcnt);
+ syscall_printf ("%lR = writev(%d, %p, %d)", res, fd, iov, iovcnt);
MALLOC_CHECK;
return res;
@@ -1306,7 +1306,7 @@ pwrite (int fd, void *ptr, size_t len, off_t off)
else
res = cfd->pwrite (ptr, len, off);
- syscall_printf ("%R = pwrite(%d, %p, %d, %d)", res, fd, ptr, len, off);
+ syscall_printf ("%lR = pwrite(%d, %p, %d, %d)", res, fd, ptr, len, off);
return res;
}
@@ -1413,7 +1413,7 @@ lseek64 (int fd, off_t pos, int dir)
else
res = -1;
}
- /* Can't use %R here since res is 8 bytes */
+ /* Can't use %R/%lR here since res is always 8 bytes */
syscall_printf (res == -1 ? "%D = lseek(%d, %D, %d), errno %d"
: "%D = lseek(%d, %D, %d)",
res, fd, pos, dir, get_errno ());