
Linux
文章平均质量分 54
CaspianSea
这个作者很懒,什么都没留下…
展开
-
A Quick Gettext Tutorial
A Quick Gettext Tutorial。转载 2024-06-11 02:35:08 · 103 阅读 · 0 评论 -
如何找到发送信号杀死其他进程的程序
信号原创 2022-08-24 10:32:18 · 221 阅读 · 0 评论 -
How to find Which Process Is Killing mysqld With SIGKILL or SIGTERM on Linux
linux signal转载 2022-08-24 08:42:18 · 336 阅读 · 0 评论 -
Linux下怎么检查网线是否接上了
1. $ cat /sys/class/net/enp0s25/carrier11表示接上,0表示没接上。下面的命令表示网线状态是 UP还是DOWN:$ cat /sys/class/net/enp0s25/operstate upDown的话可以用命令 UP起来:ip link set dev eth1 up2.使用 ethtool$ ethtool enp0s25 | grep Link\ dCannot get wake-on-lan settings原创 2022-02-23 22:53:31 · 9603 阅读 · 2 评论 -
Opening a port on Linux
Before we learn about opening a port on Linux, let’s understand what network ports are. A port is a communication endpoint. Within an operating system, a port allows the data packets specific processes or network services.Typically, ports identify a spec转载 2022-02-23 22:30:59 · 411 阅读 · 0 评论 -
关于SIGBUS 信号
最近遇到一个程序因为收到 SIGBUS死机的问题。刚开始不清楚是哪个模块导致的,用 address sanitizer 也查不出来。后来想了一下,可以用gdb来执行程序,当收到了 BUS 消息的时候, gdb会自动在出问题的代码行停下来。下面是一个例子。// C program to demonstrate Bus Error#include <stdlib.h>#include <signal.h>#include <pthread.h>#incl原创 2022-01-09 23:46:42 · 5029 阅读 · 0 评论 -
Simple HTTP Server
ython has a super useful tool for serving files over HTTP. This is great if you just want to create a quick network share that other machines on your network can access. To do that just go to the directory you want to share and run:$ python -m SimpleH转载 2021-07-17 15:09:15 · 380 阅读 · 0 评论 -
怎么查看进程是不是有root privilege ?
可以用ps 命令看。ps elf | grep root$ ps -elf | grep root4 S root 1 0 0 80 0 - 6046 - 08:54 ? 00:00:02 /sbin/init1 S root 2 0 0 80 0 - 0 - 08:54 ? 00:00:00 [kthreadd]1 S root 3 2 0原创 2021-07-17 14:25:49 · 860 阅读 · 0 评论 -
std::async
std::async是用来异步的执行一个任务(通过一个函数)。它的声明如下:unspecified policy (1) template <class Fn, class... Args> future<typename result_of<Fn(Args...)>::type> async (Fn&& fn, Args&&... args);specific policy (2) template &l原创 2021-04-03 22:07:14 · 1141 阅读 · 0 评论 -
What is this GLIBCXX error?
If you use enterprise or stable Linux distributions, sooner or later you will see an error like this:app: /lib64/libc.so.6: version `GLIBC_3.1.45' not found (required by ./app)Or like this:app: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not f转载 2021-03-27 23:41:48 · 313 阅读 · 0 评论 -
安装UltraEdit (linux).
根据https://www.ultraedit.com/downloads/uex.html可以选择 rpm/deb包安装,也可以选择 tar包。因为我的破电脑还是32位系统,而rpm/deb包都是64位的,所以只能选择安装 tar包。下载后,解压,执行:$ ./uex ./uex: /usr/lib/i386-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.22' not found (required by ./uex)确认一下:.原创 2021-03-27 22:24:49 · 1629 阅读 · 1 评论 -
编译libwepb
1. 下载源码:https://github.com/webmproject/libwebp/2. 编译:./autogen.sh./configure --prefix=/home/charles/install --enable-libwebpmux --enable-libwebpdemux --enable-libwebpdecoder --enable-libwebpext...原创 2021-01-31 13:16:31 · 819 阅读 · 0 评论 -
Linux 性能分析valgrind(二)之callgrind使用
Callgrind概述和gprof类似的分析工具,但它对程序的运行观察更是入微,能给我们提供更多的信息。和gprof不同,它不需要在编译源代码时附加特殊选项,但加上调试选项是推荐的。Callgrind收集程序运行时的一些数据,建立函数调用关系图,还可以有选择地进行cache模拟。在运行结束时,它会把分析数据写入一个文件。callgrind_annotate可以把这个文件的内容转化成可读的形式。使用callgrind工具生成性能分析数据命令格式如下:valgrind --tool=callg转载 2021-01-15 11:29:28 · 2563 阅读 · 0 评论 -
ubuntu 源更新时的签名问题(The following signatures couldn‘t be verified)
W: GPG error: https://cloud.r-project.org//bin/linux/ubuntu xenial/ InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 51716619E084DAB9W: The repository 'https://cloud.r-project.org//bin/linux/u...原创 2020-12-30 23:03:13 · 1308 阅读 · 0 评论 -
A Complete Guide to Create GIF in Linux
This tutorial is the complete collection of everything you need to know for creating a GIF image in Linux.The GIF aka Graphics Interchange Format was introduces on 1987 and became popular in web because of its low size, animation feature and of course po转载 2020-12-15 08:37:13 · 251 阅读 · 0 评论 -
内存问题之找不到地址对应的模块。
先看一个内存问题:(gdb) bt full#0 0x080485e1 in main () at test1.c:12 handle = 0x8bcc018 p = 0xb7726014(gdb) p *pCannot access memory at address 0xb7726014(gdb) info proc mappings Mapped address spaces: Start Addr End Addr Size原创 2020-09-14 00:02:53 · 436 阅读 · 0 评论 -
对有两个元素被交换的有序数组排序。
一个有序数组,有两个元素被交换了,找出这两个元素,交换回来,这样数组仍然是有序的void findTwoSwapped(int *arr, int size){ int x = - 1; int y = -1; int i; for(i = 0; i < size -1; ++i) { if( arr[i+1] < arr[i]) { y = i + 1; if( x == -1) { x = i; } else {原创 2020-07-06 01:24:46 · 855 阅读 · 0 评论 -
嵌入式系统节省内存的一种方法
嵌入式系统内存往往是有限制的(成本考虑),因此需要尽量支持更多的功能,同时尽量减少使用的内存。一种方法是把需要支持的功能做成共享库的形式,需要这个功能的时候加载共享库,不需要的时候卸载共享库,从而把内存释放出来。下面举个例子说明。$ cat 1.c #include <stdio.h>static int g_array[1024 * 1024 * 5];int *g_p = 0;__attribute__((constructor)) void init1(void)原创 2020-06-02 01:21:48 · 551 阅读 · 0 评论 -
ubuntu 16.04上 安装 opencv4.
cmake 命令: cmake -D UILD_opencv_python3=YES -D CMAKE_BUILD_TYPE=Debug -D CMAKE_INSTALL_PREFIX=/home/dinghtao/install -D OPENCV_EXTRA_MODULES=../opencv_contrib-4.3.0/modules D OPENCV_GENERATE_PKGCONFIG=ON -D INSTALL_PYTHON_EXAMPLES=ON -D INSTALL_C_EXAMPL原创 2020-05-21 09:02:59 · 504 阅读 · 0 评论 -
怎么判断linux库文件在编译的时候与没有用 -g 选项
先写一个简单的文件1.c:$ cat 1.cvoid foo(void){}然后编译两个库,一个不加 -g, 一个加:gcc 1.c -cgdb -shared -fpic -o lib1.so 1.ocp 1.c 2.cgcc -c -g 2.cgcc -shared -fpic -o lib2.so 2.o下面介绍几种判断的方法:1. 使用 ob...原创 2020-04-17 00:20:22 · 1412 阅读 · 0 评论 -
使用 meson编译 EFL库
最近EFL(https://www.enlightenment.org/download) 代码使用meson来编译了。编译方法如下:CFLAGS="-O -g -ffast-math -march=native -ggdb3" meson --prefix=$HOME/install -Dopengl=full . buildninja -C buildsudo ninja -...原创 2020-04-16 23:56:15 · 1417 阅读 · 0 评论 -
ASLR – Address Space Layout Randomization
The LPIC-3 certification for Linux security wants you to be a master of managing security on a Linux system. The topic is, of course broad but one of the smaller objectives is to know how Linux protec...转载 2019-12-18 08:30:39 · 445 阅读 · 0 评论 -
在 doxygen文档中嵌入 sequence diagram (PNG格式)
今天,公司的一位牛人说,在 doxygen 中借助于mscgen工具支持在生成的文档中嵌入 sequence diagram.自己在网上搜了一下,大体上知道了怎么用这个工具了。1. 下载 mscgen 工具http://www.mcternan.me.uk/mscgen/yum/fedora/15/i386/mscgen-0.20-1.fc15.i686.rpm yum l原创 2011-06-27 23:38:00 · 1944 阅读 · 0 评论 -
使用 objcopy把图片文件转换为 ELF格式的 obj 文件
$ objcopy --readonly-text -I binary \ -O elf32-i386 -B i386 ally.jpg ally.o $ objdump -x ally.o | grep allyally.o: 檔案格式 elf转载 2011-10-13 01:43:38 · 1730 阅读 · 0 评论 -
Debian 6 (Squeeze) 下编译内核
安装完基本系统后,为编译内核,一般只需要安装 ncurses-dev, 即:apt-get install ncurses-dev注意的有两点:1. 制作 inital ram disk 用 mkinitramfs mkinitramfs -v -o /boot/initrd.img-2.6.32.5charles 2.6.32.5charles2. 没有 /b原创 2011-07-12 07:01:25 · 1186 阅读 · 0 评论 -
无法写入文件到 NFS目录
在qemu的网络和主机能通信后,就可以使用nfs来从虚拟机访问主机了,方法是在虚拟机内执行命令:mount -t nfs -o nolock 192.168.1.100:/home/charles /mnt但是,后面发现i一个问题,无法在 /mnt目录下写入新文件,或者删除i一个文件,总是提示不允许。经过排查,发现主机的nfs 配置有问题, /etc/exports 缺少了一个选项 no_原创 2013-11-18 02:32:17 · 6199 阅读 · 1 评论 -
solib-absolute-prefix 和solib-search-path的区别
solib-absolute-prefix 和solib-search-path是 gdb比较常用的选项,用来设置符号文件的位置。那么,它们有什么区别呢?solib-abu一solute-prefix设置的是被搜索文件路径的前缀,solib-search-path设置的是被搜索文件的路径。下面以一个例子说明。先载入一个 core dump文件:(gdb) core-file c原创 2013-11-18 03:14:54 · 18063 阅读 · 1 评论 -
测试进程占用的虚拟内存大小
可以把 /proc/PID/maps文件里的各项累加起来,取和即是。$ (echo 'a=0'; sed -r 's;^([^-]*)-([^- ]*).*;a=$((a+0x\2-0x\1));' /proc/2451/maps;printf 'echo Calculated mmap size : $((a>>10)) KB' ) | sh -Calculated mmap s原创 2013-11-05 03:04:06 · 1107 阅读 · 0 评论 -
Windows 无法访问linux 的符号链接(通过samba)
最近遇到一个问题,windows 无法通过samba访问linux 服务器共享的 符号链接目录。能看到,但是无法访问。在网上查了下,发现在 smb.conf 中做如下设置可以解决:follow symlinks = yeswide links = yesunix extensions = no原创 2013-11-09 09:35:56 · 3641 阅读 · 1 评论 -
可执行文件和debug文件分离的时候的 debug
可执行文件如果包含了debug信息,会变得很大,这样在资源受限的嵌入式系统里是不允许的,所以,一种解决方案是, 编译代码的时候,输出两个文件,一个是没有debug信息的文件,另一个是包含debug信息的文件。 前一个放到目标板上,后一个则是放在开发机器上,用来在debug的时候用。下面通过一个例子说名如何这样做。先写个简单的程序:$ cat test20.c int main(voi原创 2013-12-11 22:43:55 · 1710 阅读 · 0 评论 -
Debug Stack Overflow的问题
例子代码如下:#include #include void return_input(){ char array[20]; gets(array); printf("%s\n", array);}int main(int argc, char **argv){ return_input();}gcc -fno-stack-protector原创 2013-12-13 02:57:20 · 2054 阅读 · 0 评论 -
在QE MU上模拟SD Card Rootfs
1. 编译 busybox的 ARM版本。2. 拷贝必要的动态库文件到 _install/lib下面。-rwxr-xr-x 1 charles charles 93476 Oct 7 2011 ld-2.13.solrwxrwxrwx 1 charles charles 10 Apr 25 2012 ld-linux.so.3 -> ld-2.13.so-rwxr-原创 2013-12-15 01:09:56 · 1531 阅读 · 0 评论 -
QEMU 调试内核
这个比较简单,首先,启动 qemu的时候,加上 -S -s 参数: qemu-system-arm -S -s -M vexpress-a9 -kernel ./linux-3.2/arch/arm/boot/zImage -sd rootfs.img --append "root=/dev/mmcblk0 rw rootfs=ext3 rootdelay=3 physmap.enabled原创 2013-12-16 09:13:22 · 1775 阅读 · 0 评论 -
tar:time stamp in the future
如果解压一个拷贝自一个系统时间在当前系统之后的 包,会提示如题目这样。tar: openssl-1.0.1e/apps/openssl.cnf: time stamp 2013-12-31 15:26:04 is 1360584537.139999998 s in the futureopenssl-1.0.1e/apps/openssl-vms.cnftar: openssl-1.0.1原创 2013-12-31 08:13:12 · 6454 阅读 · 0 评论 -
Understanding and optimizing Memory utilization
Understanding and optimizing Memory utilizationAdded by Bhavin Turakhia, last edited by Bhavin Turakhia on Mar 20, 2013 (view change) | PermaLink | Toggle SidebarUn转载 2013-12-18 02:04:31 · 2838 阅读 · 0 评论 -
交叉编译需要 configure的代码
很多代码都有 configure文件,需要执行一下 configure 才能产生Makefile。如果要对这样的代码进行交叉编译,需要做一些设置。首先,把交叉工具链的位置加入到 PATH里,然后执行 ./configure --host=cross-compile-prefix就可以了。比如,我现在用的 arm gcc名称为arm-linux-gnueabi-gcc, 前缀原创 2014-01-01 23:06:17 · 4222 阅读 · 0 评论 -
Unhandled Page fault
“Unhandled Page fault" 是在内核代码里输出的 (arch/arm/mm/fault.c):static void__do_user_fault(struct task_struct *tsk, unsigned long addr, unsigned int fsr, unsigned int sig, int code,原创 2013-12-23 10:22:59 · 14885 阅读 · 0 评论 -
制作mipsel 交叉工具链
1. 在 ~/code 下建立目录 cross-compile, 在 cross-compile 下建立setup, 保存下载的文件: ls ~/code/cross-compile/setup/binutils-2.24.tar.bz2 gcc-4.6.4.tar.bz2 glibc-2.18.tar.bz2 glibc-linuxthreads-2.5.tar.bz2 linux原创 2013-12-22 00:35:22 · 4963 阅读 · 0 评论 -
Remove Old Kernels In Ubuntu With One Command
A while back I wrote a post on how to remove old kernels from your Ubuntu system. While that process works just fine, it is a four step process. One person who read that post left a comment with a n转载 2014-03-01 14:48:15 · 1350 阅读 · 0 评论 -
ARM GCC Inline Assembler Cookbook
About this documentThe GNU C compiler for ARM RISC processors offers, to embed assembly language code into C programs. This cool feature may be used for manually optimizing time critical parts of th转载 2014-03-12 22:58:49 · 1409 阅读 · 0 评论