miwaiwai

导航

2023年2月26日 #

守护进程代码

摘要: 方法1: 直接调用系统函数:daemon(1,1) 参数说明: 非零:表示改变 0:表示不改变 方法二中参数刚好是错的,写反了 方法2:自己写后台守护进程 阅读全文

posted @ 2023-02-26 22:06 米歪歪 阅读(13) 评论(0) 推荐(0) 编辑

flock()文件锁使用例子

摘要: void *pth_fun(void *pth_arg) { int fd; fd = open("./hello", O_RDWR|O_CREAT|O_TRUNC, 0664); if (fd == -1) print_err("./hello", __LINE__, errno); while( 阅读全文

posted @ 2023-02-26 17:37 米歪歪 阅读(36) 评论(0) 推荐(0) 编辑