上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 46 下一页

2020年3月1日

c 解析so文件

摘要: 1. 生成so文件 https://www.cnblogs.com/luckygxf/p/11894773.html 2. 解析so文件 3. 调用so库函数 // // Created by gxf on 2020/2/27. // #include "hello.h" #include <std 阅读全文

posted @ 2020-03-01 11:55 luckygxf 阅读(808) 评论(0) 推荐(0) 编辑

2020年2月27日

c 读写锁 -demo

摘要: #include <pthread.h> #include <stdio.h> #include <unistd.h> void readFunc(); void writeFunc(); int data = 0; pthread_rwlock_t rwlock; int main() { pth 阅读全文

posted @ 2020-02-27 00:47 luckygxf 阅读(438) 评论(0) 推荐(0) 编辑

2020年2月23日

c信号量demo

摘要: 1. semget创建/获取信号量 2. semop操作信号量,pv 3. semctl执行型号量命令,设置值、获取值、删除信号量等 锁一般用于线程间通信,进程间通信可以用信号量。还有其他的共享内存,消息队列,socket,管道等 模拟写了一个类似消费者/生产模式,消费者进程释放信号量,生产者进程获 阅读全文

posted @ 2020-02-23 19:59 luckygxf 阅读(697) 评论(0) 推荐(0) 编辑

2020年2月19日

c strncpy strncat函数 demo

摘要: #include <stdio.h> #include <string.h> int main(int argc, char **argv) { char city[50] = "chengdu"; char name[30] = "guanxianseng"; char cityAndName[9 阅读全文

posted @ 2020-02-19 23:27 luckygxf 阅读(194) 评论(0) 推荐(0) 编辑

2020年2月15日

c gethostbyname函数使用

摘要: 1. 使用gethostbyname(char*)函数,拿到struct hostent 2. 使用inet_ntop()转换成ip地址 #include <stdio.h> #include <signal.h> #include <unistd.h> #include <stdlib.h> #i 阅读全文

posted @ 2020-02-15 20:43 luckygxf 阅读(928) 评论(0) 推荐(0) 编辑

shell 递归遍历文件夹文件

摘要: #!/bin/bash dirpath=$1 function read_dir() { for file in `ls $1` do #echo "$1:"$1 if [ -d $1/$file ];then cd $1/$file read_dir $1"/"$file cd - else ec 阅读全文

posted @ 2020-02-15 14:20 luckygxf 阅读(667) 评论(0) 推荐(0) 编辑

2020年2月13日

c 消息队列

摘要: 1. 使用头文件<sys/msg.h> 2. ftok函数获取key,内核使用key作为唯一标识创建消息队列 3. msgsnd, msgrcv函数,发送/接收消息 4. 消息结果第一个字段要为long type ipc-msg.h // // Created by gxf on 2020/2/13 阅读全文

posted @ 2020-02-13 12:35 luckygxf 阅读(877) 评论(0) 推荐(0) 编辑

c 信号处理

摘要: 1. 使用signal(int signal, function)向内核注册信号处理函数 2. 使用raise()向本进程发送信号,通过kill()向其他进程发送信号 #include <stdio.h> #include <signal.h> #include <unistd.h> #includ 阅读全文

posted @ 2020-02-13 11:47 luckygxf 阅读(479) 评论(0) 推荐(0) 编辑

2020年2月11日

shell source命令

摘要: 功能:在当前shell环境执行脚本,修改当前shell环境变量生效 sh test.sh会新建shell环境执行脚本,修改变量不会再当前shell环境生效 . test.sh/source test.sh会在当前环境执行,修改变量在当前shell生效 阅读全文

posted @ 2020-02-11 22:59 luckygxf 阅读(4955) 评论(0) 推荐(0) 编辑

2020年2月10日

linux内核list使用demo(待调试)

摘要: 1. list.h需要拷贝到/usr/local/include, https://www.cnblogs.com/muahao/p/8109733.html 这里有个list.h可以放到该目录下 2. 结构体中添加list_head成员 //// Created by gxf on 2020/2/ 阅读全文

posted @ 2020-02-10 21:56 luckygxf 阅读(348) 评论(0) 推荐(0) 编辑

上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 46 下一页

导航