OSDN Git Service
(root)
/
uclinux-h8
/
uClinux-dist.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Fix no pic
[uclinux-h8/uClinux-dist.git]
/
user
/
ctorrent
/
setnonblock.cpp
1
#include "./setnonblock.h"
2
3
#ifdef WINDOWS
4
5
int setfd_nonblock(SOCKET socket)
6
{
7
unsigned long val = 1;
8
return ioctl(socket,FIONBIO,&val);
9
}
10
11
#else
12
13
#include <unistd.h>
14
#include <fcntl.h>
15
16
int setfd_nonblock(SOCKET socket)
17
{
18
int f_old;
19
f_old = fcntl(socket,F_GETFL,0);
20
if( f_old < 0 ) return -1;
21
f_old |= O_NONBLOCK;
22
return (fcntl(socket,F_SETFL,f_old));
23
}
24
25
#endif