自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

HotIce0

0618

  • 博客(144)
  • 收藏
  • 关注

原创 02-NT驱动加载

记录《Windows驱动开发技术详解》学习一、如何加载编译好的NT驱动1.1环境系统版本:win10 1909 64位虚拟机用到的工具为DriverMonitor(书中建议的工具)查看已经加载的驱动程的工具:winobj.exe1.2 加载驱动关闭windows驱动强制签名验证(如果是win10必须做这一步)具体方法可以百度按照书里面的打开DriverMonitor. 打开驱动文件运行驱动程序1.3 使用winobj.exe查看已经加载的驱动程序原书中.

2021-12-21 23:25:19 2071 2

原创 ubuntu stm32 vscode环境配置

文章目录一、环境二、需要安装三、安装步骤3.1 安装STM32CubeMX(工程代码生成)3.2 安装openocd(调试和烧写固件)3.3 安装gcc-arm-none-eabi(编译和gdb调试)3.4 安装vscode四、工程创建五、VSCODE工程配置5.1 VSCODE打开工程5.2 打开terminal(Ctrl+~),直接make编译生成elf5.3 配置Debug,创建launch.json六、烧写固件一、环境PC: Ubuntu20.04 x64开发板: stm32f407disc

2021-04-13 02:06:11 743

原创 Linux fopen/freopen/fdopen 函数

文章目录一、函数声明二、实例2.1 fopen2.2 fopen运行结果2.3 fdopen2.4 运行结果2.5 fclose会关闭文件句柄?2.6 运行结果一、函数声明#include <stdio.h>FILE *fopen(const char *pathname, const char *mode);// 从文件描述符创建并关联一个FILE.FILE *fdopen(int fd, const char *mode);// freopen,重新打开文件,并清除原来的定向(

2020-08-09 22:38:06 772

原创 Linux fflush 函数

一、函数声明#include <stdio.h>int fflush(FILE *stream);冲洗该缓冲区,即进行同步二、实例#include <stdio.h>#include <stdlib.h>#include <unistd.h>int main(int argc, char **args){ printf("hotice0"); sleep(3); printf("hotice0");

2020-08-09 22:13:44 609

原创 Linux setbuf/setvbuf 函数

一、函数声明#include <stdio.h>void setbuf(FILE *stream, char *buf);void setbuffer(FILE *stream, char *buf, size_t size);void setlinebuf(FILE *stream);int setvbuf(FILE *stream, char *buf, int mode, size_t size);// mode 可选值:_IOFBF 全缓冲, _IOLBF 行缓冲, _IO

2020-08-09 22:06:02 1407

原创 Linux fwide 函数 TODO

一、函数定义// fwide - set and determine the orientation of a FILE stream#include <wchar.h>int fwide(FILE *stream, int mode);二、实例获取文件初始的文件流方向#include <stdio.h>#include <stdlib.h>#include <wchar.h>#include <fcntl.h>#incl

2020-08-09 18:23:26 515 1

原创 Linux major/minor 函数 以及 st_dev和st_rdev区别

一、函数声明#include <sys/sysmacros.h>dev_t makedev(unsigned int maj, unsigned int min);unsigned int major(dev_t dev);unsigned int minor(dev_t dev);A device ID consists of two parts: a major ID, identifying the class of the device, and a minor ID,

2020-08-09 17:15:01 3926

原创 Linux chdir/fchdir/getcwd函数

文章目录一、函数声明二、实例2.1 运行结果一、函数声明// 获取当前的工作目录#include <unistd.h>char *getcwd(char *buf, size_t size);char *getwd(char *buf);char *get_current_dir_name(void);// 设置当前工作目录#include <unistd.h>int chdir(const char *path);int fchdir(int fd);二、

2020-08-09 16:16:35 337

原创 Linux opendir/opendirat/readdir/rewinddir/closedir 函数

文章目录一、函数声明二、实例2.1 运行结果一、函数声明//opendir#include <sys/types.h>#include <dirent.h>DIR *opendir(const char *name); // 打开文件夹。DIR *fdopendir(int fd);//readdir#include <dirent.h>struct dirent *readdir(DIR *dirp); //读取文件夹内文件信息,并且移动到文件夹内的下

2020-08-09 15:54:13 241

原创 Linux mkdir/mkdirat/rmdir 函数

文章目录一、函数声明二、实例2.1 运行结果一、函数声明#include <sys/stat.h>#include <sys/types.h>int mkdir(const char *pathname, mode_t mode);#include <fcntl.h> /* Definition of AT_* constants */#include <sys/stat.h>int mkdirat(int dirfd, c

2020-08-09 15:19:53 556

原创 Linux utimensat/futimens/utime/utimes等等 函数(修改文件时间)

一、函数声明// utimensat, futimens - change file timestamps with nanosecond precision(即都支持纳秒级)#include <fcntl.h> /* Definition of AT_* constants */#include <sys/stat.h>int utimensat(int dirfd, const char *pathname, const struct time

2020-08-09 00:42:14 1007

原创 Linux change time和modify time的区别

一、声明struct stat {.../* Since Linux 2.6, the kernel supports nanosecond precision for the following timestamp fields. For the details before Linux 2.6, see NOTES. */struct timespec st_atim; /* Time of last access */

2020-08-08 23:50:41 1095

原创 Linux symlink/symlinkat/readlink/readlinkat 函数

文章目录一、函数声明二、实例2.1 运行结果一、函数声明// symlink#include <unistd.h>int symlink(const char *target, const char *linkpath);#include <fcntl.h> /* Definition of AT_* constants */#include <unistd.h>int symlinkat(const char *target, i

2020-08-08 23:41:10 662

原创 Linux 各文件操作函数是否跟随符号链接表

参考自:Unix环境高级编程

2020-08-08 19:22:26 211

原创 Linux rename/renameat 函数

文章目录一、函数定义1.1 函数的简单说明二、实例2.1 文件重命名2.2 (文件重命名)运行结果2.3 文件移动并重命名(验证)2.4 (文件移动并重命名)运行结果一、函数定义#include <stdio.h>int rename(const char *oldpath, const char *newpath);#include <fcntl.h> /* Definition of AT_* constants */#include <s

2020-08-08 19:07:58 1266

原创 Linux unlink/unlinkat/remove 函数

一、函数声明#include <unistd.h>int unlink(const char *pathname);#include <fcntl.h> /* Definition of AT_* constants */#include <unistd.h>int unlinkat(int dirfd, const char *pathname, int flags);二、实例2.1 基本使用(删除文件,与目录)2.1.1 u

2020-08-08 15:15:40 2707

原创 Linux link/linkat 函数

文章目录一、函数定义二、实例2.1 运行结果一、函数定义#include <unistd.h>int link(const char *oldpath, const char *newpath);#include <fcntl.h> /* Definition of AT_* constants */#include <unistd.h>int linkat(int olddirfd, const char *oldpath,

2020-08-07 00:16:11 1435

原创 Linux 限制shell脚本并发执行(通过flock对文件加锁)

一、flock声明Usage: flock [options] <file>|<directory> <command> [<argument>...] flock [options] <file>|<directory> -c <command> flock [options] <file descriptor number>Manage file locks from shell scripts.

2020-08-06 23:09:58 2219

原创 Linux truncate/ftruncate 函数

一、函数声明#include <unistd.h>#include <sys/types.h>int truncate(const char *path, off_t length);int ftruncate(int fd, off_t length);功能:直接截短文件的大小,将文件的长度缩小为length指定的长度。二、实例#define __USE_XOPEN_EXTENDED#define __USE_FILE_OFFSET64#include

2020-08-05 21:11:55 555

原创 Linux S_ISVTX 黏着位的作用

一、声明#if defined __USE_MISC || defined __USE_XOPEN/* Save swapped text after use (sticky bit). This is pretty well obsolete(已经过时了). */# define S_ISVTX __S_ISVTX#endifS_ISVTX是文件(文件夹)权限位(mode_t)中的一位。也称保存正文位。正文,即text段,代码段。对于可执行文件:如果,可执行文件设置了该位,则程序运行完,

2020-08-04 08:18:52 880

原创 Linux chmod/fchmod/fchmodat 函数

一、函数声明#include <sys/stat.h>int chmod(const char *pathname, mode_t mode);int fchmod(int fd, mode_t mode);#include <fcntl.h> /* Definition of AT_* constants */#include <sys/stat.h>int fchmodat(int dirfd, const char *pathn

2020-08-04 07:19:55 537

原创 Linux umask 函数

一、函数声明#include <sys/types.h>#include <sys/stat.h>mode_t umask(mode_t mask);umask() sets the calling process’s file mode creation mask (umask) to mask & 0777The umask is used by open(2), mkdir(2), and other system calls that crea

2020-08-04 07:01:25 382

原创 Linux access/faccessat/eaccess 函数

文章目录一、函数声明二、实例2.1 前置准备2.2 未设置S_ISUID运行结果2.3 设置S_ISUID运行结果三、其他一、函数声明https://man7.org/linux/man-pages/man2/access.2.html中的定义#include <unistd.h>int access(const char *pathname, int mode);#include <fcntl.h> /* Definition of AT_*

2020-08-03 22:25:50 1043

原创 Linux 文件夹的读写执行权限 的理解

文章目录一、定义1.1 读1.2 执行1.3 写二、结论一、定义对于文件夹,读、写、执行 权限分别代表1.1 读对文件夹的读权限,实际上是能不能读取文件夹内的文件列表。(可以立即为,文件夹存的内容就是,内部有哪些文件)只是不能读取,内部文件列表,但是可以访问文件夹内的文件。1.2 执行对于文件夹的执行权限,实际上是能不能访问,文件夹内的某个文件。执行权限去掉了之后。文件夹内部任何文件无法访问。也无法cd到文件夹。但是可以读取到dir的文件列表。1.3 写对于文件夹的写权限,实

2020-08-02 20:18:44 5807

原创 Linux S_ISUID/ S_ISGID

一、声明#define S_ISUID __S_ISUID /* Set user ID on execution. */#define S_ISGID __S_ISGID /* Set group ID on execution. */二、作用举例子:passwd,原理是通过修改/etc/shadow文件从而实现用户账号密码的修改。而shadow文件只有root用户可以修改的。那普通用户为什么可以通过passwd修改字节的账号密码呢。其原理其实就是,passwd程序st_mode被设置了

2020-08-02 19:31:31 1233

原创 Linux stat获取文件类型

一、函数声明#include <sys/types.h>#include <sys/stat.h>#include <unistd.h>int stat(const char *pathname, struct stat *statbuf);int fstat(int fd, struct stat *statbuf);int lstat(const char *pathname, struct stat *statbuf);#include <f

2020-08-02 18:42:20 473

原创 Linux ioctl 函数

一、函数声明#include <sys/ioctl.h>int ioctl(int fd, unsigned long request, ...);额外的操作,工具箱二、

2020-08-02 16:49:25 191

原创 Linux fcntl F_SETLKW实现超时返回

文章目录一、函数声明二、fcntl,F_SETLKW超时返回原理依据三、实现方式3.1 通过alarm函数最基础的实现3.1.1 运行结果(失败)3.1.2 查找原因3.1.3 重新封装后的_signal函数3.1.3 (运行结果)重新封装后的_signal函数3.1.4 优化后的fcntl超时返回3.1.5 (运行结果)优化后的fcntl超时返回以下所有代码都是ubuntu20.4系统下运行测试通过一、函数声明#include <unistd.h>#include <fcnt

2020-08-02 16:25:52 1474

原创 Linux fcntl 函数全解

文章目录一、函数声明1.1 cmd可选值注意:二、实例2.1 F_DUPFD / F_DUP_CLOEXEC(Duplicating a file descriptor)2.2 F_GETFD / F_SETFD(File descriptor flags)2.3 F_GETFT / F_SETFT (File status flags)2.4 F_SETLK / F_SETLKW / F_GETLK (Advisory record locking)2.4.1 更多关于文件锁的内容可以查看我的另一篇博客

2020-07-31 01:33:07 1193

原创 Linux fcntl与文件锁

文章目录一、基本概念2.1 基础2.2 文件锁(读锁,写锁)2.2 加锁范围(实际上就是锁的粒度)二、相关函数和数据结构声明三、实例3.1 F_SETLK验证:写的时候不可以读。没写的时候可以同时读。3.1.1运行结果3.2 struct flock 中的pid参数3.3 F_GETLK 文件加锁信息的获取3.3.1 运行结果3.3.2 如果,l_start, l_len指定的范围中有两个不同的锁呢。信息会返回什么3.4 F_GETLKW 与F_GETLK的区别3.4.1 验证一下 F_GETLKW3.4.

2020-07-31 01:30:39 621

原创 Linux fcntl中FD_CLOEXEC 作用

文章目录一、FD_CLOEXEC 说明二、实例2.1 当启动CLOSEXEC时2.2 当关闭CLOSEXEC时一、FD_CLOEXEC 说明FD_CLOSEXEC是文件描述符的标志位之一(标志位现在只有这一个)。意思是,标志当前文件描述符,在执行exec时(exec指定的程序执行之前),是否关闭该文件描述符。二、实例因为要用到exec这里,我们就写两个程序。并且由于子程序的标准输出,不连接到terminal。所以我们把内容打印到文件中。// fcntl.c主程序代码#include <f

2020-07-30 01:06:36 2258

原创 Linux sync/fsync/fdatasync 函数

一、函数声明#include <unistd.h>int fsync(int fd);int fdatasync(int fd);void sync(void);二、意义sync,将所有修改过的缓冲区块,排入到写队列。就立即返回。【并不等待系统的update守护进程,将数据写入到物理硬盘】update守护进程会周期性的执行磁盘写入任务。【延迟写】fsync,将等待update将数据写入到物理硬盘后才返回。fdatasync,等待update将数据写入到物理硬

2020-07-29 23:09:26 844

原创 Linux dup/dup2 函数

一、函数声明#include <unistd.h>int dup(int oldfd);int dup2(int oldfd, int newfd);二、解释dup将复制oldfd文件描述符,返回新的描述符dup2将复制oldfd到指定的newfd上,如果newfd有已经存在的描述符则关闭(如果oldfd==newfd就不会关闭)三、实例#include <stdio.h>#include <unistd.h>#define FD_STDOUT

2020-07-29 21:52:33 374

原创 Linux pwrite/pread 函数

一、函数声明#include <unistd.h>ssize_t pread(int fd, void *buf, size_t count, off_t offset);ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset); 二、解释pread其实是lseek和read的组合成的原子操作。(通过一次系统调用完成,lseek和read)write同理。lseek和write三、实例#inclu

2020-07-29 21:11:38 1764

原创 Linux open/openat/creat/lseek 函数

一、头文件以及声明#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 creat(const char *pathname, mode_t mode);

2020-07-28 00:01:28 291

原创 复习C++智能指针

一、概念总体理解即通过存在于栈区的对象的生命周期,控制存在于堆区的存储空间的生命周期。防止内存泄露。二、类别2.1 auto_ptrauto_ptr可以实现最基础的栈区对象控制堆区内存生命周期控制。// 示例一、#include <iostream>using namespace std;class Test{public: Test() { printf("Test() call\n"); } ~Test() {

2020-07-19 16:13:05 738

原创 复习C++ static关键字

static 关键字实际作用改变作用域(变量及函数)改变存储位置及生命周期(相对于变量来说)

2020-07-18 13:51:30 143

原创 python命令行参数处理

使用的包: getopt一、调用实例python main.py -h -o test kkkk bbb二、实例注释中将包括上面的调用实例时,变量的具体的值import getoptopts, args = getopt.getopt(sys.argv[1:], 'ho:', ['help', 'output'])# opts: (('-h',),('-o', 'test')...

2020-04-27 17:40:43 206

原创 项目路径变化后virtualenv(venv)无法激活

环境说明:win10pycharm现象因为项目路径变化的原因,重新使用pycharm打开项目的terminal后,发现无法自动激活venv环境。通过where命令查找pip路径显示如下D:\SBC\SBC>where pipC:\Users\VDITadmin\AppData\Local\Programs\Python\Python36-32\Scripts\pip.exe...

2020-04-27 17:34:58 2446

原创 vue regeneratorRuntime is not defined错误

一、背景vue4.x 版本,通过vue-cli创建项目,使用第三方UI组件库时。导入了之后,出现该错误。二、解决方式npm install -D babel-polyfill因为babel-eslint是创建项目时就有所以不需要再次安装在main.js的第一行中,写入import 'babel-polyfill'...

2020-03-12 09:42:07 2580 1

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除