![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Linux应用
天灰易冷
这个作者很懒,什么都没留下…
展开
-
linux内核链表
#include <stdio.h>#include <stdlib.h>struct list_head{ struct list_head* prev; struct list_head* next;};struct mylist { struct list_head head; int val;};void __list_add(struct list_head* new, struct list_head* prev, .原创 2021-03-22 12:34:32 · 80 阅读 · 0 评论 -
单链表操作
LinkList.h#ifndef _LINKLIST_H#define _LINKLIST_H#include <stdlib.h>struct LinkListNode { struct LinkListNode* next;};struct LinkListHead { struct LinkListNode head; int length;};void LinkList_Init(struct L原创 2021-03-23 21:36:47 · 78 阅读 · 0 评论 -
socket编程
本文参考韦东山嵌入式linux应用编程教学视频//客户端#include <stdio.h>#include <sys/types.h> /* See NOTES */#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>#include <string.h>#include <unistd.h>#d.原创 2021-03-30 21:21:58 · 60 阅读 · 0 评论 -
Makefile 自动生成依赖关系并加载依赖文件
.PHONY: all clean EXE := app.outDIR_OBJS := objsDIR_EXES := exesDIR_DEPS := depsDIRS := $(DIR_OBJS) $(DIR_EXES) $(DIR_DEPS)SRCS := $(wildcard *.c)OBJS := $(SRCS:.c=.o)OBJS := $(addprefix $(DIR_OBJS)/, $(OBJS))DEPS := $(SRCS:.c=....原创 2021-04-05 22:52:15 · 211 阅读 · 0 评论 -
两个线程同时使用两个互斥锁访问临界资源,无死锁
思路与qt中那个多线程中的死锁类似,链接如下:https://blog.csdn.net/weixin_47564352/article/details/115019008#include<stdio.h>#include <pthread.h>#include <unistd.h>#include <stdlib.h>pthread_mutex_t mutex1;pthread_mutex_t mutex2;void* threa.原创 2021-04-08 22:36:50 · 354 阅读 · 1 评论 -
inet_ntoa() inet_aton()
int inet_aton(const char *cp, struct in_addr *inp);将形如“192.168.1.1"类型的点分十进制ip转换成二进制,并存放在struct in_addr中192 = 0xc0168 = 0xa81 = 0x01因此转换后的值为0xc0a811char *inet_ntoa(struct in_addr in);将二进制的ip转成点分十进制形式,转换结果作为返回值struct hostent *gethostbyadd..原创 2021-03-20 22:20:12 · 2587 阅读 · 0 评论