mmap,mmap64,munmap---map or unmap files or devices into memoryvoid *mmap(void* addr,size_t length, int prot, int flags, int fd, off_t offset);void *mm...
分类:
系统相关 时间:
2014-12-11 01:32:59
阅读次数:
351
//指向文件类型的指针
//在C语言的文件你的读写一般使用系统的库函数来对数据进行读写
//文件的类型的指针
//文件的结构
#include
#include
using namespace std;
typedef struct
{
short level;
//缓冲区满或者是空的程度
unsigned flags;
//文件状态标志
char fd;
//...
分类:
其他好文 时间:
2014-12-10 09:19:09
阅读次数:
187
#include #include int truncate(const char *path, off_t length);int ftruncate(int fd,off_t length);The truncate and ftruncate function cause the regula...
分类:
系统相关 时间:
2014-12-09 00:20:15
阅读次数:
249
先执行如下命令: lsof?-i:端口号 会有类似下面的结果:? COMMAND?????PID???????USER???FD???TYPE?????????????DEVICE?SIZE/OFF?NODE?NAME
WebProces?42624?davidzhang??...
分类:
系统相关 时间:
2014-12-08 19:54:06
阅读次数:
10263
read_timeout函数封装//读超时函数,但不包含读操作
int read_timeout(int fd, long waitSec)
{
int returnValue = 0;
if (waitSec > 0)
{
fd_set readSet;
FD_ZERO(&readSet); //清零
FD_SET...
这是头文件包含顺序的问题,原因与解决办法见下面代码的注释。/*包含下面这两个头文件时,必须把winsock2.h放在前面否则编译报错,N多的重定义错误:例如 error C2011: 'fd_set' : 'struct' type redefinition*/#include #include i...
分类:
其他好文 时间:
2014-12-07 19:02:46
阅读次数:
168
Name------------fcntl int fcntl(int fd, int cmd, ... /*arg*/) - ---------------manipulate file descriptor/*操作文件描述符*/ //要包含头文件: #include #incl...
分类:
系统相关 时间:
2014-12-07 01:18:11
阅读次数:
444
Select函数Man-Page/* According to POSIX.1-2001 */
#include
/* According to earlier standards */
#include
#include
#include
int select(int nfds, fd_set *readfds, fd_set *writefds,
fd_set...
分类:
其他好文 时间:
2014-12-06 21:36:28
阅读次数:
269
epoll与select/poll的区别
select,poll,epoll都是IO多路复用的机制。I/O多路复用就通过一种机制,可以监视多个描述符,一旦某个描述符就绪,能够通知程序进行相应的操作。
select的本质是采用32个整数的32位,即32*32= 1024来标识,fd值为1-1024。当fd的值超过1024限制时,就必须修改FD_SETSIZE的大小。这个时...
分类:
系统相关 时间:
2014-12-06 14:07:16
阅读次数:
326
erwr protected void Button1_Click(object sender, EventArgs e) { } sdfds fd sdf df protected void Page_Load(object sender, EventArgs e) { string sql = ...
分类:
其他好文 时间:
2014-12-05 14:10:25
阅读次数:
202