summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bio/b_sock.c
diff options
context:
space:
mode:
authorbcook <>2014-12-03 22:14:38 +0000
committerbcook <>2014-12-03 22:14:38 +0000
commit3339178a7b37aca236756b5c97ee1a4fe72c768f (patch)
treeec0d6eb647087e2fbc3c6af2a81b45d6593562d4 /src/lib/libcrypto/bio/b_sock.c
parent4269f19abeb7cbb7878b44e8f882a74ca4646ea9 (diff)
downloadopenbsd-3339178a7b37aca236756b5c97ee1a4fe72c768f.tar.gz
openbsd-3339178a7b37aca236756b5c97ee1a4fe72c768f.tar.bz2
openbsd-3339178a7b37aca236756b5c97ee1a4fe72c768f.zip
Move Windows OS-specific functions to make porting easier.
Several functions that need to be redefined for a Windows port are right in the middle of other code that is relatively portable. This patch isolates the functions that need Windows-specific implementations so they can be built conditionally in the portable tree. ok jsing@ deraadt@
Diffstat (limited to 'src/lib/libcrypto/bio/b_sock.c')
-rw-r--r--src/lib/libcrypto/bio/b_sock.c25
1 files changed, 1 insertions, 24 deletions
diff --git a/src/lib/libcrypto/bio/b_sock.c b/src/lib/libcrypto/bio/b_sock.c
index 92a62b2c4c..ece88277df 100644
--- a/src/lib/libcrypto/bio/b_sock.c
+++ b/src/lib/libcrypto/bio/b_sock.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: b_sock.c,v 1.60 2014/12/03 21:55:51 bcook Exp $ */ 1/* $OpenBSD: b_sock.c,v 1.61 2014/12/03 22:14:38 bcook Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -65,7 +65,6 @@
65#include <netinet/tcp.h> 65#include <netinet/tcp.h>
66 66
67#include <errno.h> 67#include <errno.h>
68#include <fcntl.h>
69#include <limits.h> 68#include <limits.h>
70#include <netdb.h> 69#include <netdb.h>
71#include <stdio.h> 70#include <stdio.h>
@@ -194,17 +193,6 @@ BIO_gethostbyname(const char *name)
194} 193}
195 194
196int 195int
197BIO_sock_init(void)
198{
199 return (1);
200}
201
202void
203BIO_sock_cleanup(void)
204{
205}
206
207int
208BIO_socket_ioctl(int fd, long type, void *arg) 196BIO_socket_ioctl(int fd, long type, void *arg)
209{ 197{
210 int ret; 198 int ret;
@@ -454,14 +442,3 @@ BIO_set_tcp_ndelay(int s, int on)
454{ 442{
455 return (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on)) == 0); 443 return (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on)) == 0);
456} 444}
457
458int
459BIO_socket_nbio(int s, int mode)
460{
461 int flags = fcntl(s, F_GETFD);
462 if (mode && !(flags & O_NONBLOCK))
463 return (fcntl(s, F_SETFL, flags | O_NONBLOCK) != -1);
464 else if (!mode && (flags & O_NONBLOCK))
465 return (fcntl(s, F_SETFL, flags & ~O_NONBLOCK) != -1);
466 return (1);
467}