LINUX
wy3950282
这个作者很懒,什么都没留下…
展开
-
socket demo1
client:#include #include #include #include #include #include #include int main(int argc,char *argv[]){ int cli_fd,ser_fd; struct sockaddr_in cli_addr,ser_addr;原创 2015-10-12 17:16:32 · 265 阅读 · 0 评论 -
rsync使用小结
rsync工作的基本配置如图,如果要从中心同步数据到节点就在节点上运行rsync --daemon,中心节点上用rsync指令进行同步原创 2015-08-20 09:33:48 · 287 阅读 · 0 评论 -
Makefile相关知识
最简单的示例:test:test.o listen_sock.ogcc -o test test.o listen_sock.otest.o:test.c listen_sock.hgcc -c test.clisten_sock.o:listen_sock.c listen_sock.hgcc -c listen_sock.c1.每一个 *.c文件都可以对应一个*.o原创 2015-10-23 10:43:38 · 205 阅读 · 0 评论 -
管道pipe&&fifo
1.pipe#include #include #include #include #include #include #include int main(int argc,char *argv[]){ pid_t pid1; int pipefd[2]; char buf; if(pipe(p原创 2015-10-08 19:57:14 · 271 阅读 · 0 评论 -
fcntl文件锁
fcntl的非强制文件锁(锁定后仍可读写),通过F_GETLK判断是否锁定,再决定是否加锁#include #include #include #include #include #include #include #include extern int errno;int main(){ pid_t pid1;原创 2015-10-08 19:54:49 · 284 阅读 · 0 评论 -
epoll IO EVENT NOTIFICATION FACILITY学习
EPOLL :epoll_create/epoll_ctl/epoll_wait水平触发和边缘触发:使用水平触发的epoll和poll相同。EPOLLET1.管道的read端口rfd注册到epoll2.管道的write端口写2K的数据3.调用epoll_wait等待rfd资源可用4.从rfd读1K的数据5.再次调用epoll_wait步骤5中调用的epoll_wai原创 2015-11-05 10:15:01 · 350 阅读 · 0 评论 -
使用open方式的文件锁
#include #include #include #include #include int main(int argc,char *argv[]){ pid_t pid1; int file1; char *path1="/home/wy/whatfuck"; pid1=fork();原创 2015-09-07 15:59:11 · 626 阅读 · 0 评论 -
bash中使用文件锁
#!/bin/shLOCKFILE=/tmp/$(basename $0)if [ -f "$LOCKFILE" ]then echo "file had been locked !cant open" exit 1else echo "now,the file locking !" touch $LOCKFILEfisleep原创 2015-09-09 14:33:43 · 1142 阅读 · 0 评论 -
linux更换硬盘后的网络设置
两台linux,交换硬盘后执行ifconfig发现没有eth0和eth1,反而有eth2和eth3,其中eth2(对应eth0)为有效网卡,eth3(eth1)未配置。network-script目录下只有eth0(192.168.1.176)和eth1的配置文件,ifconfig显示eth2为dhcp自动分配的ip(192.168.1.254)。解决方法:/etc/udev/rules.d/原创 2015-07-31 17:43:26 · 1043 阅读 · 0 评论 -
sql状态查看
[root@controller2 ~]# mysqlWelcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connection id is 106Server version: 5.5.40-MariaDB-wsrep MariaDB Server, wsrep_25.11.r4026C原创 2018-01-04 21:14:52 · 833 阅读 · 0 评论