- 博客(6)
- 收藏
- 关注
原创 树莓派字符驱动模板
#include<linux/fs.h>//file_operations声明 #include<linux/module.h>//module_init module_exit声明 #include<linux/init.h>//_init _exit宏定义声明 #include<linux/device.h>//class device声明 #include<linux/uaccess.h>//copy_from_user的头文件 #in
2020-08-05 23:33:47 122
原创 Linux 进程间通信
管道 半双工具有固定的读写端 只能用于父子或兄弟进程的通信 可用read write等函数读写,但不属于文件系统,只存在与内存中。 原型 #include<unistd.h> int pipe(int fd[2]);//返回0则成功,-1失败 fd[0]为读打开,fd[1]为写打开 ...
2020-08-03 22:58:19 67
原创 LINUX父子进程
在一些项目中需要父进程等待子进程的退出,并且收集子进程的退出状态 如果子进程exit退出后没有收集状态就会变成僵尸进程 调用wait函数 #include <sys/types.h> #include <sys/wait.h> pid_t wait(int *status); pid_t waitpid(pid_t pid, int *status, int options); int waitid(idtype_t idtype, id_t id, siginfo
2020-08-01 14:52:22 141
原创 linux fork 进程
fork函数用法 pid_t fork(void); fork函数调用成功会返回2次, 返回值为0,代表当前是子进程 返回值为非负整数,代表当前是父进程 失败返回-1. #include<stdio.h> #include<sys/types.h> #include<unistd.h> int main(){ pid_t pid; pid=getpid(); fork(); if(pid==getpid()){ printf("this is father p
2020-07-22 16:39:51 84
原创 LINUX文件编程应用
实现cp功能 #include<stdio.h> #include<string.h> #include<sys/types.h> #include<sys/stat.h> #include<fcntl.h> #include<stdlb.h> int main(int argc,char **argv){ int fdSrc; int fdDes; char *readbuf=NULL if(argc!=3){ pr
2020-07-22 14:54:23 51
原创 linux 学习记录 文件编程
** linux学习记录 ** 文件的系统编程 open函数 包含头文件 #include<sys/types.h> #include<sys/stat.h> #include<fcntl.h> 定义函数 int open( const char * pathname,int flags); int open( const char * pathname,int flags,mode_t mode); int open( const char * pathnam
2020-07-22 12:24:35 67
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人