导航

上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 13 下一页

2021年5月24日 #

关于sockfd设置非阻塞模式

摘要: 今早测试的时候,发现改完的代码,socket出现EPOLLHUP | EPOLLERR 然后connect的时候返回值为-1,errno为 #define EINPROGRESS 115 /* Operation now in progress */ 这是正常的,因为connect设置的是不阻塞直接 阅读全文

posted @ 2021-05-24 09:14 toughcactus 阅读(87) 评论(0) 推荐(0) 编辑

2021年5月21日 #

看代码学到的哈希表遍历处理

摘要: 在遍历哈希表的时候,{}里,其实就是对bucket的处理。 每回遍历哈希表的目的,就是对bucket作不同处理。 那么实现处理函数就好了,需要遍历的时候,传入处理函数。 阅读全文

posted @ 2021-05-21 08:55 toughcactus 阅读(98) 评论(0) 推荐(0) 编辑

2021年5月20日 #

小脚本

摘要: 文件A 1.1.1.1 33 2.2.2.2 44 3.3.3.3 55 4.4.4.4 66 文件B 2.2.2.2 hello I donot 4.4.4.4 what this is 要求:将文件A的第二项加入到文件B同一条目的最后 注意:sed那不能用单引号,原因,原因就是用了不生效 #! 阅读全文

posted @ 2021-05-20 11:36 toughcactus 阅读(88) 评论(0) 推荐(0) 编辑

2021年5月18日 #

关于连接释放的信号

摘要: 如果没有要读的数据,但调用read,返回值为-1,errno为11,即EAGAIN https://baike.baidu.com/item/errno/11040395?fr=aladdin 经验证,当client调用close,此时server进行read,n为0 测试程序代码 //server 阅读全文

posted @ 2021-05-18 14:16 toughcactus 阅读(43) 评论(0) 推荐(0) 编辑

2021年5月14日 #

信号处理2

摘要: #include <sys/signalfd.h> #include <signal.h> #include <unistd.h> #include <stdio.h> #include <sys/wait.h> int main(void) { sigset_t set; int fd; stru 阅读全文

posted @ 2021-05-14 17:27 toughcactus 阅读(43) 评论(0) 推荐(0) 编辑

markdown学习

摘要: 很多开源项目里一定会有README.md文件,我org-mode撸不熟,所以吧,先找个能用的 https://www.zhihu.com/question/269925359 阅读全文

posted @ 2021-05-14 17:13 toughcactus 阅读(21) 评论(0) 推荐(0) 编辑

成就感 sed -i哈哈哈哈

摘要: 今天有个实操,就是config_0,config_1,config_2,config_3四个文件均要修改log路径 sed -i '/logpath/d' congfig_* echo "logpath xxxxxxx" > log_patch sed -i '/debug/r log_patch' 阅读全文

posted @ 2021-05-14 11:23 toughcactus 阅读(21) 评论(0) 推荐(0) 编辑

2021年5月13日 #

sed 学习 3

摘要: $cat test (1) (4) (2) (5) (3) (6) $cat test | awk '{print $2}' | sed "s/\(.*\)/\1/g" (4) (5) (6) #没有办法去掉括弧 我查了两本书,都没有sed -i选项,很坑啊 sed -i命令详解 - Ev_zhk 阅读全文

posted @ 2021-05-13 15:29 toughcactus 阅读(38) 评论(0) 推荐(0) 编辑

2021年5月12日 #

文件操作-读写

摘要: 往文件格式化写入 //打印到文件 fprintf(fp, "%s\n", p); 阅读全文

posted @ 2021-05-12 14:10 toughcactus 阅读(39) 评论(0) 推荐(0) 编辑

sed学习 2

摘要: 场景:配置文件一项配置一行,现在通过脚本,使得指定配置项的内容做修改 我觉得应该是清除当前的指定配置项,使用模式匹配 sed '/config_name/d' data.txt 在最后一行的下一行写入包含配置项的文件 sed '$r configAdd' data.txt 在最后一行的下一行添加数据 阅读全文

posted @ 2021-05-12 10:26 toughcactus 阅读(48) 评论(0) 推荐(0) 编辑

上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 13 下一页