#!/bin/sh SYSCTL="/proc/sys" TARGET="${SYSCTL}/kernel/domainname" ORIG=$(cat "${TARGET}") TEST_STR="Testing sysctl" . ./common_tests # Only string sysctls support seeking/appending. MAXLEN=65 echo -n "Writing entire sysctl in short writes ... " set_orig dd if="${TEST_FILE}" of="${TARGET}" bs=1 2>/dev/null if ! verify "${TARGET}"; then echo "FAIL" >&2 rc=1 else echo "ok" fi echo -n "Writing middle of sysctl after unsynchronized seek ... " set_test dd if="${TEST_FILE}" of="${TARGET}" bs=1 seek=1 2>/dev/null if verify "${TARGET}"; then echo "FAIL" >&2 rc=1 else echo "ok" fi echo -n "Checking sysctl maxlen is at least $MAXLEN ... " set_orig perl -e 'print "A" x ('"${MAXLEN}"'-2), "B";' | \ dd of="${TARGET}" bs="${MAXLEN}" 2>/dev/null if ! grep -q B "${TARGET}"; then echo "FAIL" >&2 rc=1 else echo "ok" fi echo -n "Checking sysctl keeps original string on overflow append ... " set_orig perl -e 'print "A" x ('"${MAXLEN}"'-1), "B";' | \ dd of="${TARGET}" bs=$(( MAXLEN - 1 )) 2>/dev/null if grep -q B "${TARGET}"; then echo "FAIL" >&2 rc=1 else echo "ok" fi echo -n "Checking sysctl stays NULL terminated on write ... " set_orig perl -e 'print "A" x ('"${MAXLEN}"'-1), "B";' | \ dd of="${TARGET}" bs="${MAXLEN}" 2>/dev/null if grep -q B "${TARGET}"; then echo "FAIL" >&2 rc=1 else echo "ok" fi echo -n "Checking sysctl stays NULL terminated on overwrite ... " set_orig perl -e 'print "A" x ('"${MAXLEN}"'-1), "BB";' | \ dd of="${TARGET}" bs=$(( $MAXLEN + 1 )) 2>/dev/null if grep -q B "${TARGET}"; then echo "FAIL" >&2 rc=1 else echo "ok" fi exit $rc fs/?id=624374a56419c2d6d428c862f32cc1b20519095d'>refs</a><a class='active' href='/cgit.cgi/linux/net-next.git/log/tools/perf/Documentation/manpage-base.xsl'>log</a><a href='/cgit.cgi/linux/net-next.git/tree/tools/perf/Documentation/manpage-base.xsl?id=624374a56419c2d6d428c862f32cc1b20519095d'>tree</a><a href='/cgit.cgi/linux/net-next.git/commit/tools/perf/Documentation/manpage-base.xsl?id=624374a56419c2d6d428c862f32cc1b20519095d'>commit</a><a href='/cgit.cgi/linux/net-next.git/diff/tools/perf/Documentation/manpage-base.xsl?id=624374a56419c2d6d428c862f32cc1b20519095d'>diff</a></td><td class='form'><form class='right' method='get' action='/cgit.cgi/linux/net-next.git/log/tools/perf/Documentation/manpage-base.xsl'> <input type='hidden' name='id' value='624374a56419c2d6d428c862f32cc1b20519095d'/><select name='qt'> <option value='grep'>log msg</option> <option value='author'>author</option> <option value='committer'>committer</option> <option value='range'>range</option> </select> <input class='txt' type='search' size='10' name='q' value=''/> <input type='submit' value='search'/> </form> </td></tr></table> <div class='path'>path: <a href='/cgit.cgi/linux/net-next.git/log/?id=624374a56419c2d6d428c862f32cc1b20519095d'>root</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools?id=624374a56419c2d6d428c862f32cc1b20519095d'>tools</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools/perf?id=624374a56419c2d6d428c862f32cc1b20519095d'>perf</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools/perf/Documentation?id=624374a56419c2d6d428c862f32cc1b20519095d'>Documentation</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools/perf/Documentation/manpage-base.xsl?id=624374a56419c2d6d428c862f32cc1b20519095d'>manpage-base.xsl</a></div><div class='content'><table class='list nowrap'><tr class='nohover'><th class='left'>Age</th><th class='left'>Commit message (<a href='/cgit.cgi/linux/net-next.git/log/tools/perf/Documentation/manpage-base.xsl?id=624374a56419c2d6d428c862f32cc1b20519095d&showmsg=1'>Expand</a>)</th><th class='left'>Author</th><th class='left'>Files</th><th class='left'>Lines</th></tr>