docs: fix typo in manual
[fw/openocd] / src / helper / replacements.h
index 1e2fbf20f9ef349484cd48dde2aefcc12aede0cd..ac5009549a347166f035b4f71e32ffea1814d388 100644 (file)
@@ -25,6 +25,8 @@
 #ifndef OPENOCD_HELPER_REPLACEMENTS_H
 #define OPENOCD_HELPER_REPLACEMENTS_H
 
+#include <stdint.h>
+
 /* MIN,MAX macros */
 #ifndef MIN
 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
@@ -199,6 +201,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