vi_tools
Just a release to attach files
命令行访问F_SETLEASE
$ touch q
$ ./lease q rw -- sh -c 'echo Cleanup request && sleep 1 && echo Now clean'&
[1] 28330
$ echo "Before trying to access" && cat q && echo "After tying to access"
Before trying to access
Cleanup request
Now clean
[1]+ Done ./lease q rw -- sh -c 'echo Cleanup request && sleep 1 && echo Now clean'
After tying to access
与flock
工具一样,也可以对文件描述符进行操作。
命令行访问控制组内存压力监控事件
Usage: cgroup_memory_pressure_monitor {low|medium|critical} /sys/fs/cgroup/memory/your_cgroup
使用 Ultra Kernel 同页合并可压缩的非零内容填充内存。
适用于 Linux 的 Rundll。从库中加载类似 main 的符号并执行它。
$ ./runso ./runso main ./runso main
Usage: runso ./libsomelibrary.so main <args>
设置 oom_score_adj,然后用零填充内存。
$ ./mempig
Killed
$ dmesg | grep -i oom
[228859.359178] mempig invoked oom-killer: gfp_mask=0x24280ca(GFP_HIGHUSER_MOVABLE|__GFP_ZERO), nodemask=0, order=0, oom_score_adj=1000
[228859.359234] [<ffffffff81168397>] oom_kill_process+0x237/0x450
[228859.359372] [ pid ] uid tgid total_vm rss nr_ptes nr_pmds swapents oom_score_adj name
[228860.221001] oom_reaper: reaped process 27664 (mempig), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
列出 UDP 端口并做两件事:
还尝试提高其调度优先级并将所有页面锁定到内存。
旨在以简单的方式远程控制各种 /sys/class/{brightness,gpio,pwm}/ 旋钮。
监听两个 UDP 端口并在它们之间交换信息。每个回复都会发送到最后收到的对等地址。像这样的东西:
socat udp-l:1234 udp-l:1235
但它不会“锁定”某一对等点。
通过探测不同的延迟并测试 connectin 是否仍然有效来测量 NAT 中的 UDP 连接超时。服务器部分根据传入 UDP 数据包的超时来回复 UDP 数据包。客户端检查不断增加的超时,直到检测到丢失的回复数据包,然后“平分”以找出更准确的关闭延迟。范围为 2 到 512 秒。 vi-server.org:909 端口上可能正在运行公共服务器。
$ udptimeoutchecker probe 0.0.0.0 0 vi-server.org 909
Trying with timeout 1 seconds...OK
Trying with timeout 2 seconds...OK
Trying with timeout 4 seconds...OK
Trying with timeout 8 seconds...OK
Trying with timeout 16 seconds...OK
Trying with timeout 32 seconds...OK
Trying with timeout 64 seconds...OK
Trying with timeout 128 seconds...FAIL
Trying with timeout 128 seconds...FAIL
Trying with timeout 128 seconds...FAIL
Trying with timeout 96 seconds...FAIL
Trying with timeout 80 seconds...FAIL
Trying with timeout 72 seconds...FAIL
Trying with timeout 68 seconds...FAIL
Trying with timeout 66 seconds...FAIL
Intermediate result: 64
Trying with timeout 1 seconds...OK
Trying with timeout 2 seconds...OK
Trying with timeout 4 seconds...OK
Trying with timeout 8 seconds...OK
Trying with timeout 16 seconds...OK
Trying with timeout 32 seconds...OK
Trying with timeout 64 seconds...OK
Trying with timeout 128 seconds...FAIL
Trying with timeout 128 seconds...FAIL
Trying with timeout 128 seconds...FAIL
Trying with timeout 96 seconds...FAIL
Trying with timeout 80 seconds...FAIL
Trying with timeout 72 seconds...FAIL
Trying with timeout 68 seconds...FAIL
Trying with timeout 66 seconds...FAIL
Intermediate result: 64
Trying with timeout 1 seconds...OK
Trying with timeout 2 seconds...OK
Trying with timeout 4 seconds...OK
Trying with timeout 8 seconds...OK
Trying with timeout 16 seconds...OK
Trying with timeout 32 seconds...OK
Trying with timeout 64 seconds...OK
Trying with timeout 128 seconds...FAIL
Trying with timeout 128 seconds...FAIL
Trying with timeout 128 seconds...FAIL
Trying with timeout 96 seconds...FAIL
Trying with timeout 80 seconds...FAIL
Trying with timeout 72 seconds...FAIL
Trying with timeout 68 seconds...FAIL
Trying with timeout 66 seconds...FAIL
Intermediate result: 64
64
在每个 UDP 数据包前面添加 12 字节的纳秒时间戳(8 字节表示秒,4 字节表示纳秒)和 4 字节的每个客户端序列号,并将其发回。
$ ./udp_ts_seq_reply 0.0.0.0 1919&
$ socat -x -v - udp:127.0.0.1:1919 > /dev/null
123
> 2018/02/19 19:52:08.981246 length=4 from=0 to=3
31 32 33 0a 123.
--
< 2018/02/19 19:52:08.981712 length=20 from=0 to=19
00 00 00 00 00 57 2f 47 09 a8 bf 83 00 00 00 01 .....W/G........
31 32 33 0a 123.
--
ABC
> 2018/02/19 19:52:11.439685 length=4 from=4 to=7
41 42 43 0a ABC.
--
< 2018/02/19 19:52:11.440078 length=20 from=20 to=39
00 00 00 00 00 57 2f 49 24 fa c5 ed 00 00 00 02 .....W/I$.......
41 42 43 0a ABC.
--
DEF
> 2018/02/19 19:52:13.094035 length=4 from=8 to=11
44 45 46 0a DEF.
--
< 2018/02/19 19:52:13.094455 length=20 from=40 to=59
00 00 00 00 00 57 2f 4b 10 61 48 68 00 00 00 03 .....W/K.aHh....
44 45 46 0a DEF.
--
$ dump_tc_stats
Usage: dump_tc_stats <iface>
Dump interface statistics periodically. Don't forget to `tc qdisc add <iface> root ...` something
$ dump_tc_stats veth0
{"PACKETS":23514,"BYTES":2979825,"RATE_BPS":0,"RATE_PPS":0,"QLEN":0,"BACKLOG":0,"DROPS":0,"REQUEUES":0,"OVERLIMITS":0}
{"PACKETS":23526,"BYTES":2981342,"RATE_BPS":0,"RATE_PPS":0,"QLEN":0,"BACKLOG":0,"DROPS":0,"REQUEUES":0,"OVERLIMITS":0}
...