From 11ee0e1340f95ccb9954e522f6e003b3125eb109 Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Tue, 21 Oct 2008 12:17:19 +0200 Subject: Split winsock.c into many smaller files. * lib/close.c: Add _gl_close_fd_maybe_socket from winsock.c. * lib/accept.c: New file, based on winsock.c. * lib/bind.c: New file, based on winsock.c. * lib/connect.c: New file, based on winsock.c. * lib/getpeername.c: New file, based on winsock.c. * lib/getsockname.c: New file, based on winsock.c. * lib/getsockopt.c: New file, based on winsock.c. * lib/ioctl.c: New file, based on winsock.c. * lib/listen.c: New file, based on winsock.c. * lib/recv.c: New file, based on winsock.c. * lib/recvfrom.c: New file, based on winsock.c. * lib/send.c: New file, based on winsock.c. * lib/sendto.c: New file, based on winsock.c. * lib/setsockopt.c: New file, based on winsock.c. * lib/shutdown.c: New file, based on winsock.c. * lib/socket.c: New file, based on winsock.c. * lib/w32sock.h: New file, based on winsock.c. * lib/winsock.c: Remove file. * modules/accept: Likewise. * modules/bind: Likewise. * modules/connect: Likewise. * modules/getpeername: Likewise. * modules/getsockname: Likewise. * modules/getsockopt: Likewise. * modules/ioctl: Likewise. * modules/listen: Likewise. * modules/recv: Likewise. * modules/recvfrom: Likewise. * modules/send: Likewise. * modules/sendto: Likewise. * modules/setsockopt: Likewise. * modules/shutdown: Likewise. * modules/socket: Use socket.c instead of winsock.c. * modules/sys_socket: Remove (unneeded?) dependency on winsock.c. * doc/posix-functions/accept.texi: Doc fix. * doc/posix-functions/bind.texi: Doc fix. * doc/posix-functions/close.texi: Doc fix. * doc/posix-functions/connect.texi: Doc fix. * doc/posix-functions/getpeername.texi: Doc fix. * doc/posix-functions/getsockname.texi: Doc fix. * doc/posix-functions/getsockopt.texi: Doc fix. * doc/posix-functions/ioctl.texi: Doc fix. * doc/posix-functions/listen.texi: Doc fix. * doc/posix-functions/recv.texi: Doc fix. * doc/posix-functions/recvfrom.texi: Doc fix. * doc/posix-functions/send.texi: Doc fix. * doc/posix-functions/sendto.texi: Doc fix. * doc/posix-functions/setsockopt.texi: Doc fix. * doc/posix-functions/shutdown.texi: Doc fix. * doc/posix-functions/socket.texi: Doc fix. --- lib/ioctl.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 lib/ioctl.c (limited to 'lib/ioctl.c') diff --git a/lib/ioctl.c b/lib/ioctl.c new file mode 100644 index 0000000000..98a94b6721 --- /dev/null +++ b/lib/ioctl.c @@ -0,0 +1,51 @@ +/* ioctl.c --- wrappers for Windows ioctl function + + Copyright (C) 2008 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* Written by Paolo Bonzini */ + +#include + +#include + +#define WIN32_LEAN_AND_MEAN +/* Get winsock2.h. */ +#include + +/* Get set_winsock_errno, FD_TO_SOCKET etc. */ +#include "w32sock.h" + +#undef ioctl + +int +rpl_ioctl (int fd, int req, ...) +{ + void *buf; + va_list args; + SOCKET sock; + int r; + + va_start (args, req); + buf = va_arg (args, void *); + va_end (args); + + sock = FD_TO_SOCKET (fd); + r = ioctlsocket (sock, req, buf); + if (r < 0) + set_winsock_errno (); + + return r; +} -- cgit v1.2.1