pipe实现进程间通信,首先关闭第一个子进程的读入端,然后关闭第二个子进程的写入端#include#include#includeint main(){ int fd[2]; pipe(fd); pid_t pid = fork(); if(pid==0) { close(fd[0]); write...
分类:
系统相关 时间:
2015-06-08 19:31:07
阅读次数:
130
今天想导出svg格式的图片支持webFont,结果AI打不开了,文件好像损坏了,于是就想办法在PS里面导出。网上搜索到一篇文章,腾讯的http://isux.tencent.com/ps-photoshop-cc-fd.html,同时还会引用到一个三方脚本 http://hackingui.com/...
分类:
其他好文 时间:
2015-06-08 13:07:22
阅读次数:
17921
#include#include#include#includeintmain(intargc,char*argv[]){intfd;intlock_result;structflocklock;char*pFileName="tmp.lck";fd=open(pFileName,O_RDWR);i...
分类:
系统相关 时间:
2015-06-05 16:59:40
阅读次数:
161
epoll - I/O event notification facility在linux的网络编程中,非常长的时间都在使用select来做事件触发。在linux新的内核中,有了一种替换它的机制,就是epoll。相比于select,epoll最大的优点在于它不会随着监听fd数目的增长而减少效率。由于...
分类:
其他好文 时间:
2015-06-05 12:01:15
阅读次数:
146
Poll 与系统select调用相对应 int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)Poll设备方法完成流程...
分类:
其他好文 时间:
2015-06-04 06:08:17
阅读次数:
114
Because generating and reading the select() bit arrays takes time proportional to the largest fd that you provided for select(), the select() call sca...
分类:
其他好文 时间:
2015-06-04 00:56:33
阅读次数:
567
ioctl控制设备除了读写设备之外,其他功能的实现需要ioctl。如串口的波特率的设定。用户空间:ioctl的应用apiint ioctl(int fd, unsigned long cmd, ...)fd 文件描述符cmd 发送的命令...依赖cmd命令内核空间api int (*ioctl)(....
分类:
其他好文 时间:
2015-06-03 00:53:58
阅读次数:
151
int write(intfd, const void *buf, size_tcount);如果是堵塞fd,则返回值是count,或者是0,-1;如果是非堵塞fd,则返回值是写入的字节数,或者是0,-1;非堵塞fd,在缓冲区大小小于count时候,不堵塞直接返回写入的字节数。无论是是read还是w...
分类:
系统相关 时间:
2015-06-01 12:57:59
阅读次数:
136
linux下libpcap支持从多网卡抓包,设置为any即可在IOS或者mac上就无法通过次方法抓取所有网卡报文1.通过设置libevent事件回调,每个网卡注册读事件, fd通过 pd = pcap_open_live(device, snaplen, dopromisc, timeout, e....
分类:
移动开发 时间:
2015-05-28 19:39:22
阅读次数:
311
最近做了一下linux C网络方面的项目,简单的写了一下服务器于客户端之间上传,下载文件,利用并发服务器,可以实现多个客户端同时上传,下载。
写的不好,还请大神多多指教!多的不说,一切都在代码中,部分代码如下所示:
/*server.c */ 服务器端
void *recvmation(void *arg) //接收客户端发送过来的信息,线程
{
int my_fd = *((int *...
分类:
系统相关 时间:
2015-05-25 10:17:38
阅读次数:
263