UNIX pseudo terminal

Introduce the relevant theoretical knowledge about UNIX in recent research, and record relevant important concept memos here. Overview Pseudo-terminal means that to an application, it looks like a terminal, but in fact it is not a real terminal. Usually a process opens a pseudo-terminal master and calls fork. The child process establishes a new session, opens a corresponding pseudo-terminal slave device, copies its file descriptor to stdin, and then calls exec. The pseudo-terminal slave device is called the controlling terminal of the child process. Looking like a bidirectional pipe, the terminal line discipline on the slave device gives us additional processing power that a normal pipe doesn't have. Typical uses of pseudo-terminals The most typical examples of network login servers are telnetd and rlogind… Read more

UNIX terminal I/O

Introduction I read and learned about terminal I/O on UNIX systems. Some of the more key concepts are documented here. Introduction Terminal I/O is complex, one of the reasons it is used for many things. Summarize the two working modes of terminal I/O: normal mode input processing (default), non-normal mode input processing. In canonical mode, the terminal driver returns at most one line for each read request. Terminal devices can be considered to be controlled by the terminal driver in the kernel, and each terminal device has an input queue and an output queue. When echoing is turned on, there is an implicit connection between the input queue and the output queue. The input queue length is a finite value. Although the output queue is also limited, the program cannot obtain this value. exist… Read more

Resize hard disk partitions via Gparted Live ISO bootable image

Introduction I have an 8G TF card with Openwrt installed, and the capacity of the root partition is not enough to meet my needs. So start working on increasing the size of the root partition. The file system format used for the root partition is Ext4. First of all, try to use DiskGenius and other tools under Windows to expand, unfortunately, you can't. So ready to use Gparted for expansion. Since the tool needs to run in a Linux environment, I don't really want to install a Linux distribution virtual machine for this, so I use Gparted's lightweight ISO image with the Virtual Box virtual machine. Preparations First download and install the VirtualBox virtual machine and VM… Read more

YouCompleteMe builds an index of C/C++ CMmake projects

Introduction If YouCompleteMe is installed and configured (this site has a process record, click here to view), you can use a single file to detect the effect of code prompts. However, when S&E opened his C/C++ project, he found that functions such as code hints and jumps could not be used normally. After consulting the documentation, S&E found that the index database related to YouCompleteMe was not established, and the related compilation options were incorrect, so the clangd used by YouCompleteMe could not link multiple source files. Method If you use CMake to build the project, you can add set( CMAKE_EX … Read more

Vim code prompt plugin YouCompleteMe installation and configuration

Introduction For C/C++ program writing under Vim, if there is a code prompt plug-in, the writing efficiency will be greatly improved. Large IDEs are used a lot, and S&E, which has just returned to Vim, is more dependent on this. Just YouCompleteMe can meet his related needs. Simply record the installation and configuration process here for future recall. In addition to C/C++, YouCompleteMe supports Java, Go, C#, Objective-C, CUDA, etc., which can be said to be relatively powerful. But in other words, why use Vim to write Java? IDEA seems to be better. After using it, I found that this plugin also supports operations such as code jumping, reference lookup, function name modification and format adjustment, which is quite convenient. … Read more

Installation and use of Vim theme spf13-vim.sh

Introduction to Vim Themes I often use vim as the main code editor under Linux. Whenever SSH enters a new development system environment, for the convenience of writing, he always needs to manually install Vim and configure various common plug-ins. spf13-vim.sh is a distribution for plugins and related resources for Vim. A single command can automatically install the commonly used supporting plug-in environment. Github repository address: https://github.com/spf13/spf13-vim Experience S&E feels that this is like quickly installing a Vim-centric IDE (which can be compared to Vscode). Then, spf13-vim.sh produces a comparison spec... Read more

Vim 8.2 source code compilation and installation add Python3 extension

Introduction In order to install plugins like YouCompleteMe, you need to upgrade Vim to a higher version and enable the Python3 extension. Therefore, what is provided here is a record of the process of installing the latest version of Vim through source code. The address of the Vim source code repository used here: https://github.com/vim/vim/ Compiling and installing the default version Before compiling and installing, you must install the relevant tools and dependencies % sudo apt install git make clang libpython3-dev Select the appropriate one Execute the clone command % git clone https://github.com/vim/… Read more