File tree Expand file tree Collapse file tree 3 files changed +68
-3
lines changed Expand file tree Collapse file tree 3 files changed +68
-3
lines changed Original file line number Diff line number Diff line change 1
1
# [ package file list] ( /2022/03/list_package_file.md )
2
2
3
- ## pacman
3
+ ## package file list
4
4
5
+ ```
5
6
pacman -Ql bcc
7
+ yum/dnf repoquery -l bcc
8
+ ```
6
9
7
- ## yum/dnf
10
+ ## which package contains file
8
11
9
- yum/dnf repoquery -l bcc
12
+ ` pacman -F ` or ` dnf provides `
13
+
14
+ ```
15
+ [w@ww temp]$ pacman -F libssl.so
16
+ core/openssl 1.1.1.m-1 [installed]
17
+ usr/lib/libssl.so
18
+ core/openssl-1.0 1.0.2.u-1
19
+ usr/lib/openssl-1.0/libssl.so
20
+ community/cuda-tools 11.6.0-1
21
+ opt/cuda/nsight_compute/host/linux-desktop-glibc_2_11_3-x64/libssl.so
22
+ opt/cuda/nsight_systems/host-linux-x64/libssl.so
23
+ community/libressl 3.4.2-1
24
+ usr/lib/libressl/libssl.so
25
+ multilib/lib32-openssl 1:1.1.1.m-1 [installed]
26
+ usr/lib32/libssl.so
27
+ multilib/lib32-openssl-1.0 1.0.2.u-1
28
+ usr/lib32/openssl-1.0/libssl.so
29
+ ```
Original file line number Diff line number Diff line change
1
+ # [ brk] ( /2022/04/brk.md )
2
+
3
+ 用 strace -f 看进程系统调用(-f 参数表示记录子进程调用)时经常能看到 brk(NULL) 这个系统调用,因好奇而写下本文
4
+
5
+ ## brk 与进程地址空间
6
+
7
+ brk/sbrk 看上去就是设置进程地址空间的 BSS(放常量字符串的) 区跟堆之间的分界线指针
8
+
9
+ < https://www.cnblogs.com/arnoldlu/p/10272466.html >
10
+
11
+ 这篇文章说 top 里面 VIRT 列是虚拟内存占用而 RES 列才是实际占用内存
12
+
13
+ ## ldd 动态库
14
+
15
+ ```
16
+ ldd a.out
17
+ linux-vdso.so.1 (0x00007ffcd9db5000)
18
+ libc.so.6 => /usr/lib/libc.so.6 (0x00007f6e57fc3000)
19
+ /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f6e58202000)
20
+ ```
21
+
22
+ 1 . vdso 是为了解决 glibc 跟内核版本兼容问题
23
+ 2 . libc.so 我很熟悉了
24
+ 3 . ld-linux-x86-64.so 是所有带动态库可执行文件的 linker + 解释器?
25
+
26
+ 也就 ./a.out 的执行会变成 /lib64/ld-linux-x86-64.so.2 ./a.out 然后再 execve
27
+
28
+ rust 应用会额外多一个 libgcc_s.so 的动态库引入 gcc runtime 的一些符号和 main/_ start 函数吧
29
+
30
+ ## clone & fork
31
+
32
+ 国内的文章喜欢说 clone 是轻量级的 fork
33
+
34
+ 不管是 clone 还是 fork 复制当前进程都是 Copy On Write 开销较小
35
+
36
+ Rust 的 spawn 用的是 clone (不清楚什么时候会用 posix_spawn)
37
+
38
+ 根据 man 文档说也就 clone 提供了更细粒度的子进程控制,例如父子进程共享虚拟内存
39
+
40
+ ## strace 必经流程
41
+
42
+ 1 . execve
43
+ 2 . brk
44
+ 3 . mmap (进程地址空间动态库)
Original file line number Diff line number Diff line change 1
1
- [ 归档 - 吴翱翔的博客] ( / )
2
2
- ** 2022-04**
3
+ - [ brk] ( /2022/04/brk.md )
3
4
- [ 用时序图理解接口业务] ( /2022/04/uml_sequence_diagram.md )
4
5
- ** 2022-03**
5
6
- [ docker scratch] ( /2022/03/docker_scratch.md )
You can’t perform that action at this time.
0 commit comments