1 #include 2 #include 3 4 #include 5 #include 6 #include 7 #include 8 #include 9 10 int11 main()12 {13 int fd;14 struct ifreq ifr;15 16 fd...
分类:
系统相关 时间:
2015-03-04 12:52:31
阅读次数:
176
1. open() O_RONLY O_WONLY O_RDWR 返回值为 文件描述符fd2. creat() 创建新文件,这个函数的产生是因为最开始open函数没有O_CREAT 功能,所以单独开发的该函数注:不是create,没有e3. read() 读取fd对应的文件内容4. write(.....
分类:
其他好文 时间:
2015-02-28 00:14:06
阅读次数:
165
1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 void main(void) 9 {10 int fd,size,len;11 char *buf="Hel...
分类:
其他好文 时间:
2015-02-28 00:13:46
阅读次数:
331
tcgetattr(fd,&oldios); //获得与终端相关的参数,参数保存在oldios中newios.c_cflag = nSpeed | CS8 | CLOCAL | CREAD; //newios.c_cflag &=~CRTSCTS; newios.c_iflag = IGNPAR; ...
分类:
其他好文 时间:
2015-02-25 14:05:06
阅读次数:
148
功能:获取文件元数据#include
#include
#include
int stat(const char *path, struct stat *buf);
int fstat(int fd, struct stat *buf);
int lstat(const char *path, struct stat *buf);stat结构体struct stat
{
dev_t ...
分类:
其他好文 时间:
2015-02-18 10:44:09
阅读次数:
176
新blog地址:http://hengyunabc.github.io/netstat-difference-proc-fd-socket-stat/最近,线上一个应用,发现socket数缓慢增长,并且不回收,超过警告线之后,被运维监控自动重启了。首先到zabbix上观察JVM历史记录,发现JVM-Perm space最近两周没有数据,猜测是程序从JDK7切换到JDK8了。问过开发人员之后,程序已经...
分类:
Web程序 时间:
2015-02-17 11:42:43
阅读次数:
685
引入: 有时对设备不仅仅是进行一些读写操作,还需要进行一些对设备的控制,比如LED的点燃与熄灭,电机的转速等。那就需要使用到ioctl这个系统调用。先来看看他的函数原型: intioctl(int fd,unsigned int cmd, ...); 参数: fd:字符设备文件的文件描述...
分类:
其他好文 时间:
2015-02-16 19:32:51
阅读次数:
166