X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Fhelper%2Freplacements.h;h=f43b7e0f3c1a8b2cea969baa59c14933bd46dfdf;hb=refs%2Fchanges%2F12%2F4312%2F9;hp=7c2e44b0deb59f0f4cf99bb6deeab139d7f7f8e4;hpb=7bfcc10839d2a9190cb7ae9fae02280e643b3450;p=openocd.git
diff --git a/src/helper/replacements.h b/src/helper/replacements.h
index 7c2e44b0de..f43b7e0f3c 100644
--- a/src/helper/replacements.h
+++ b/src/helper/replacements.h
@@ -19,13 +19,11 @@
* 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, write to the *
- * Free Software Foundation, Inc., *
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ * along with this program. If not, see . *
***************************************************************************/
-#ifndef REPLACEMENTS_H
-#define REPLACEMENTS_H
+#ifndef OPENOCD_HELPER_REPLACEMENTS_H
+#define OPENOCD_HELPER_REPLACEMENTS_H
/* MIN,MAX macros */
#ifndef MIN
@@ -135,7 +133,6 @@ static inline unsigned usleep(unsigned int usecs)
/* Windows specific */
#ifdef _WIN32
-#define WIN32_LEAN_AND_MEAN
#include
#include
@@ -202,6 +199,17 @@ static inline int close_socket(int sock)
#endif
}
+static inline void socket_block(int fd)
+{
+#ifdef _WIN32
+ unsigned long nonblock = 0;
+ ioctlsocket(fd, FIONBIO, &nonblock);
+#else
+ int oldopts = fcntl(fd, F_GETFL, 0);
+ fcntl(fd, F_SETFL, oldopts & ~O_NONBLOCK);
+#endif
+}
+
static inline void socket_nonblock(int fd)
{
#ifdef _WIN32
@@ -279,4 +287,8 @@ typedef struct {
#endif /* HAVE_ELF_H */
-#endif /* REPLACEMENTS_H */
+#if defined HAVE_LIBUSB1 && !defined HAVE_LIBUSB_ERROR_NAME
+const char *libusb_error_name(int error_code);
+#endif /* defined HAVE_LIBUSB1 && !defined HAVE_LIBUSB_ERROR_NAME */
+
+#endif /* OPENOCD_HELPER_REPLACEMENTS_H */