多个程序或者进程使用一个文件时进行truncate操作
假设A进程正在对文件file进行写操作,offset为 offseta,现在执行
truncate -s offseta file
则文件起始位置到offseta之间的数据被置为0,offset开始是进程A写入的内容。
https://superuser.com/questions/881777/what-happens-when-i-truncate-a-file-that-is-in-use
https://stackoverflow.com/questions/980283/truncating-a-file-while-its-being-used-linux
「Talk is cheap. Show me the code」

浙公网安备 33010602011771号