return bytessent;
}
+int ioctl(int d, unsigned long request, int *p)
+{
+ u_long arg = 0;
+
+ if(ioctlsocket(d, request, &arg) == SOCKET_ERROR) {
+ errno = wsa_errno();
+ return -1;
+ }
+
+ if(arg > INT_MAX) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ *p = arg;
+ return 0;
+}
+
int uname(struct utsname *buf)
{
SYSTEM_INFO si;
#endif
+// Windows doesn't have ioctl but offers ioctlsocket for some socket-related
+// functions. Unfortunately, argument types differ, so we implement a
+// (restricted) wrapper.
+int ioctl(int d, unsigned long request, int *p);
+
+
// Windows logically doesn't have uname, so we supply a replacement.
struct utsname {