all: iothrottle true iothrottle: iothrottle.hex iothrottle.in perl -pe 's/hex=.*/"hex=".`cat iothrottle.hex`/e' iothrottle.in > iothrottle chmod +x iothrottle iothrottle.so: iothrottle.c gcc -O2 -shared -fPIC -o iothrottle.so iothrottle.c -ldl strip iothrottle.so iothrottle.hex: iothrottle.so hexdump -ve '1/1 "%.2x"' iothrottle.so > iothrottle.hex LC_ALL=C awk '{for (i=1; i<=length($$0); i+=2) printf "%c", strtonum("0x" substr($$0, i, 2))}' iothrottle.hex > iothrottle.bin md5sum iothrottle.so iothrottle.bin test: iothrottle seq 10000000 | cat | pv > big ./iothrottle cat big | pv > /dev/null ./iothrottle -i 20M cat big | pv > /dev/null ./iothrottle -o 20000K cat big | pv > /dev/null rm big clean: rm -f iothrottle.so iothrottle.hex iothrottle.bin iothrottle iothrottle.1 iothrottle~