1. The Stat Family #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> int stat(const char *path, struct stat *buf); int fstat(int fd, struct stat *buf); int lstat(const char *path, struct stat *buf); struct stat{      dev_t…
微型电脑或嵌入式与电脑还是有点不同的,在微型电脑上ros indigo 版本下利用catkin编译如果你遇到如下错误: CMake error:System Error:No such file or directory CMake error:Could not open file for write in copy operation xxxx.ros_Config.cmake.tmp. CMake error:at /opt/ros/indigo/share/catkin/cmake/ca…
Run Build Command:"/usr/bin/make" "cmTC_162a3/fast"/usr/bin/make -f CMakeFiles/cmTC_162a3.dir/build.make CMakeFiles/cmTC_162a3.dir/buildmake[1]: Entering directory '/home/program/opencv-3.2.0/build/CMakeFiles/CMakeTmp'Building C object…
sudo apt-get install libv4l-dev* file yum install libv4l-dev* yum install libv4l-dev* 上面错误的问题是两个2.4以上的内核里面都没有包含videodev.h这个文件了.但是有的在include/linux/下面有videodev.h文件和videodev2.h这个文件,但是在v4lgrab.c文件中只有部分包含了videodev2.h这个文件.这样导致了就算是包含了videodev2.h这个文件,但是还是会报错…
文件和目录管理 一.文件与其元数据 我们首先看一下一个简单的文本文件是怎么保存的: 打开vim,编辑一段文本: [root@localhost ~]# vim hello.txt 编辑内容如下: opencfg.com is best website for java 查看其属性: [root@localhost ~]# ls -l -rw-r--r-- 1 root root 37 9月 4 19:03 hello.txt 据这个例子的目的,是为了说明Linux系统中文件是由3个部分组成:  …
你们先休息下,我先哭哭! 今天在做交接项目的bug修改的时候,在创建文件的时候报错 No such file or directory 然后跟着路径去linux中查看了该路径,但确实存在,并且权限都是拥有的,(虽然报错提示是没有找到该文件或者目录,但是确实是有的啊! O(∩_∩)O哈哈~,抠脑袋中...)鼓捣了半个小时,确实不知道什么原因了,于是厚着脸皮找了下项目经理,最后才发现,我们项目是docker,Jenkins进行自动打包,部署的,原来是要在项目配置中加入路径映射 所以说啊 !有些东西不…
1.缺少Linux kernel头文件 To install just the headers in Ubuntu: sudo apt-get install linux-headers-$(uname -r) To install the entire Linux kernel source in Ubuntu: sudo apt-get install linux-source Note that you should use the kernel headers that match th…
1. 文件和元数据 每个文件都是通过inode引用,每个inode索引节点都具有文件系统中唯一的inode number 一个inode索引节点是存储在Linux文件系统的磁盘介质上的物理对象,也是LInux内核通过数据结构表示的实体 inode存储相关联文件的元数据   ls -i 命令获取文件的inode number   /* obtaining the metadata of a file */ #include <sys/types.h> #include <sys/stat.…
1. 进程调度 the process scheduler is the component of a kernel that selects which process to run next. 进程调度器需要使 处理器使用率最大化,并且提供 使多个进程并发执行的虚拟   Deciding which processes run, when, and for how long is the process scheduler's fundamental responsibility.   时间…
1. Scatter/Gather I/O a single system call  to  read or write data between single data stream and multiple buffers This type of I/O is so named because the data is scattered into or gathered from the given vector of buffers Scatter/Gather I/O 相比于 C标准…
1.每个Linux进程都有一个最大打开文件数,默认情况下,最大值是1024 文件描述符不仅可以引用普通文件,也可以引用套接字socket,目录,管道(everything is a file) 默认情况下,子进程会获得其父进程文件表的完整拷贝   2.打开文件 open系统调用必须包含 O_RDONLY,O_WRONLY,O_RDWR 三种存取模式之一 注意 O_NONBLOCK模式 ) ) 3.读文件 read系统调用会有以下结果: (1)返回值与请求数len相同,所有len字节都存储在buf…
这一章的标题是 "信号" ,所以本文将对信号的各个方面进行介绍,由于Linux中的信号机制远比想象的要复杂,所以,本文不会讲的很全面... 信号机制是进程之间相互传递消息的一种方法,信号全称为软中断信号,也有人称作软中断.从它的命名可以看出,它的实质和使用很象中断.所以,信号可以说是进程控制的一部分. 一.信号的基本概念 本节先介绍信号的一些基本概念,然后给出一些基本的信号类型和信号对应的事件.基本概念对于理解和使用信号,对于理解信号机制都特别重要.下面就来看看什么是信号. 1.基本概…
内存管理 一.分配动态内存的几个函数 用户空间内存分配:malloc.calloc.realloc1.malloc原型如下:extern void *malloc(unsigned int num_bytes);功能:分配长度为num_bytes字节块.工作机制:malloc函数的实质体现在,它有一个将可用的内存块连接为一个长长的列表的所谓空闲链表.调用malloc函数时,它沿连接表寻找一个大到足以满足用户请求所需要的内存块.然后,将该内存块一分为二(一块的大小与用户请求的大小相等,另一块的大小…
1. 内核提供三种不同的方式来记录时间 Wall time (or real time):actual time and date in the real world Process time:the time that a process spends executing on a processor 包括用户时间user time 和 系统时间system time Monotonic time:use the system's uptime (time since boot) for th…
1. Threading is the creation and management of multiple units of execution within a single process 二进制文件是驻留在存储介质上,已被编译成操作系统可以使用,准备执行但没有正运行的休眠程序 进程是操作系统对 正在执行中的二进制文件的抽象:已加载的二进制.虚拟内存.内核资源 线程是进程内的执行单元 processes are running binaries, threads are the smal…
1. partial block operations are inefficient. The operating system has to “fix up” your I/O by ensuring that everything occurs on block-aligned boundaries and rounding up to the next largest block   用户级程序可能在某一时刻仅仅读写一个字节,这是极大的浪费.Each of those one-byte…
1. Linux系统编程的三大基石:系统调用.C语言库.C编译器 系统调用:内核向用户级程序提供服务的唯一接口.在i386中,用户级程序执行软件中断指令 INT n 之后切换至内核空间 用户程序通过寄存器告知内核执行系统调用的所需参数   2. API 和 ABI API:application programming interface 定义源码级接口,必须确保源码级兼容 ABI:application binary interface 定义二进制接口,必须确保二进制兼容 ABI包括:调用约定…
这本书附录的名字是 "GCC对C语言的扩展" ,一下的内容是对扩展的总结 类型发现 GCC 允许通过变量的引用识别类型.这种操作支持泛型编程.在 C++.Ada 和 Java™ 语言等许多现代编程语言中都可以找到相似的功能.Linux 使用 typeof 构建 min 和 max 等依赖于类型的操作.清单 1 演示如何使用 typeof 构建一个泛型宏(见 ./linux/include/linux/kernel.h). 清单一:使用 typeof 构建一个泛型宏 #define mi…
这一章的题目是--高级进程管理,这篇文章将以书中所叙的顺序进行讲解 1.让出处理器 Linux提供一个系统调用运行进程主动让出执行权:sched_yield.进程运行的好好的,为什么需要这个函数呢?有一种情况是用户空间线程的锁定.如果一个线程试图取得另一个线程所持有的锁,则新的线程应该让出处理器知道该锁变为可用.用户空间锁没有内核的支持,这是一个最间单.最有效率的做法.但是现在Linux线程实现引入一个使用futexes的优化解决方案. 另一个情况是在有处理器密集型程序可用周期性调用sched_…
1. 信号是软中断,提供处理异步事件的机制 异步事件可以是来源于系统外部(例如用户输入Ctrl-C)也可以来源于系统内(例如除0)   内核使用以下三种方法之一来处理信号: (1) 忽略该信号.SIGKILL和SIGSTOP不能被忽略. (2) 捕捉并且处理该信号.The kernel will suspend execution of the process’s current code path and jump to a previously registered function. SI…
1. 进程地址空间 Linux中,进程并不是直接操作物理内存地址,而是每个进程关联一个虚拟地址空间 内存页是memory management unit (MMU) 可以管理的最小地址单元 机器的体系结构决定了内存页大小,32位系统通常是 4KB, 64位系统通常是 8KB 内存页分为 valid or invalid: A valid page is associated with an actual page of data,例如RAM或者磁盘上的文件 An invalid page is…
1. 进程是unix系统中两个最重要的基础抽象之一(另一个是文件) A process is a running program A thread is the unit of activity inside of a process   the virtualization of memory is associated with the process, the threads all share the same memory address space   2. pid The idle…
File System Basics The file systems in OS X and iOS handle the persistent storage of data files, apps, and the files associated with the operating system itself. Therefore, the file system is one of the fundamental resources used by all processes. OS…
分区的过程正常: [root@db1 /]# fdisk -l   Disk /dev/sda: 21.4 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes      Device Boot      Start         End      Blocks   Id  System /dev/sda1   *  …
一.故障现象 1.用secure CRT连接服务器时显示: /bin/bash:No such file or directory 翻译成中文是:没有此类文件或目录 2.直接登录服务器执行命令时显示: /lib/ld-linux-x86-64.so.2: bad ELF interpreter: No such file or directory 翻译成中文大概的意思是:找不到/lib/ld-linux-x86-64.so.2文件 只有cd命令可以正常使用 二.故障原因 1.背景介绍 此服务器需…
将一个raspberry下编译好的可执行文件放在android的system/bin下,修改为777权限,运行,出现下面的错误: /system/bin/sh: XXX: No such file or directory 这一般是系统的动态链接器与XXX这个程序中的动态链接器的名字或路径不对,在raspberry下执行: readelf -l 可执行文件名 输出: Elf file type is EXEC (Executable file) Entry point 0x9e3c There…
Now in this article I will show you steps to prevent or restrict access of root user to access certain files or directories. Now by default root is the super user who has access to all the files and directories available on the Linux node but it is a…
linux输入yum后提示: -bash: /usr/bin/yum: No such file or directory的解决方案 今天在安装程序时,发现有一个插件未安装,我就随手敲了一个命令,看都没看 yum remove yum 然后就杯具了... 1 [root@localhost ~]# yum 2 -bash: /usr/bin/yum: No such file or directory   这个粗心的手误倒不至于让整个系统瘫痪,yum 却无法使用了.于是,我试着折腾了一番 1 r…
问题情形 本地NodeJS应用使用Egg脚手架构建,本地运行测试完全没有问题,发布后App Service后不能运行.通过登录到kudu后(https://<your web site>.scm.chinacloudsites.cn)后,在日志中发现找不到一个文件或路径的错误.通过在kudu的CMD窗口执行npm start命令,发现错误是一致,怀疑是对Egg中某个框架的不支持. 详细日志 Application has thrown an uncaught exception and is…
linux查看某个包是否安装    dpkg -l libuu*    用gcc编译发生nux 错误:fatal error: uuid/uuid.h: No such file or directory     这是因为没有uuid库和头文件,需要安装e2fsprogs,试过yum命令安装,问题没解决,需要从源码编译 wget http://downloads.sourceforge.net/e2fsprogs/e2fsprogs-1.41.14.tar.gz tar xvzf e2fspro…