Akses baris perintah ke 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
Seperti alat flock
, juga dapat beroperasi pada deskriptor file.
Akses baris perintah untuk mengontrol peristiwa pemantauan tekanan memori grup
Usage: cgroup_memory_pressure_monitor {low|medium|critical} /sys/fs/cgroup/memory/your_cgroup
Isi memori dengan konten bukan nol yang dapat dikompres dengan Penggabungan Halaman Sama Kernel Ultra.
Rundll untuk Linux. Memuat simbol seperti utama dari perpustakaan dan menjalankannya.
$ ./runso ./runso main ./runso main
Usage: runso ./libsomelibrary.so main <args>
Setel oom_score_adj, lalu isi memori dengan angka nol.
$ ./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
Port UDP terdaftar dan lakukan dua hal:
Juga mencoba meningkatkan prioritas penjadwalannya dan mengunci semua halaman ke memori.
Ditujukan untuk mengontrol berbagai kenop /sys/class/{brightness,gpio,pwm}/ dari jarak jauh dengan cara yang sederhana.
Dengarkan dua port UDP dan tukar informasi di antara keduanya. Setiap balasan dikirim ke alamat rekan yang terakhir diterima. Sesuatu seperti:
socat udp-l:1234 udp-l:1235
Tapi itu tidak "mengunci" pada satu rekan.
Ukur batas waktu koneksi UDP di NAT dengan memeriksa penundaan yang berbeda dan menguji apakah koneksi masih berfungsi atau tidak. Bagian server membalas paket UDP berdasarkan batas waktu paket UDP yang masuk. Klien memeriksa peningkatan batas waktu hingga mendeteksi paket balasan yang hilang, lalu "membagi dua" untuk mengetahui penundaan penghentian yang lebih tepat. Rentangnya dari 2 hingga 512 detik. Mungkin ada server publik yang berjalan di port 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
Tambahkan setiap paket UDP dengan stempel waktu nanodetik 12 byte (8 byte untuk detik, 4 untuk nanodetik) dan 4 byte nomor urut per klien dan kirimkan kembali.
$ ./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}
...