Date: Fri, 29 Jul 2011 01:15:59 +0200 From: Robert Millan <rmh@debian.org> To: freebsd-hackers@freebsd.org, freebsd-emulation@freebsd.org, Ed Maste <emaste@freebsd.org> Subject: [PATCH] Linux-like /proc/swaps for linprocfs Message-ID: <CAOfDtXN9sctWJZ4G=oCubQo0Si1BUYz0nyE=qhqmn2skZHOhEw@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
--20cf303dd906095a4404a92959de Content-Type: text/plain; charset=UTF-8 Please consider this patch, it implements Linux-like /proc/swaps for linprocfs. E.g. $ cat /proc/swaps Filename Type Size Used Priority /dev/zvol/dimoni/swap unknown 2097152 0 -1 -- Robert Millan --20cf303dd906095a4404a92959de Content-Type: text/x-patch; charset=US-ASCII; name="linprocfs_swaps.diff" Content-Disposition: attachment; filename="linprocfs_swaps.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gqocd3wm0 LS0tIGEvc3lzL2NvbXBhdC9saW5wcm9jZnMvbGlucHJvY2ZzLmMKKysrIGIvc3lzL2NvbXBhdC9s aW5wcm9jZnMvbGlucHJvY2ZzLmMKQEAgLTQ5OCw2ICs0OTgsNDQgQEAKIAlyZXR1cm4gKDApOwog fQogCitzdGF0aWMgaW50CitsaW5wcm9jZnNfZG9zd2FwcyhQRlNfRklMTF9BUkdTKQoreworCXN0 cnVjdCB4c3dkZXYgeHN3OworCWludCBtaWJbM10sIG1pYnNpemU7CisJc2l6ZV90IHNpemU7CisJ aW50IG47CisJbG9uZyBsb25nIHRvdGFsLCB1c2VkOworCWNoYXIgZGV2bmFtZVtTUEVDTkFNRUxF TiArIDFdOworCisJc2J1Zl9wcmludGYoc2IsICJGaWxlbmFtZVx0XHRcdFx0VHlwZVx0XHRTaXpl XHRVc2VkXHRQcmlvcml0eVxuIik7CisKKwltaWJzaXplID0gc2l6ZW9mIG1pYiAvIHNpemVvZiBt aWJbMF07CisKKwltaWJbMF0gPSBDVExfVk07CisJbWliWzFdID0gVk1fU1dBUF9JTkZPOworCisJ Zm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AqLworI2RlZmluZQlWTV9NQVhJRAkJMTMJ LyogbnVtYmVyIG9mIHZhbGlkIHZtIGlkcyAqLwogCiAjZGVmaW5lIENUTF9WTV9OQU1FUyB7IFwK IAl7IDAsIDAgfSwgXApAQCAtOTksNiArMTAwLDcgQEAKIAl7ICJ2X3BhZ2VvdXRfZnJlZV9taW4i LCBDVExUWVBFX1VJTlR9LCBcCiAJeyAicGFnZW91dF9hbGdvcml0aG0iLCBDVExUWVBFX0lOVH0s IFwKIAl7ICJzd2FwX2VuYWJsZWQiLCBDVExUWVBFX0lOVH0sXAorCXsgInN3YXBfaW5mbyIsIENU TFRZUEVfU1RSVUNUfSxcCiB9CiAKIC8qCg== --20cf303dd906095a4404a92959de--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOfDtXN9sctWJZ4G=oCubQo0Si1BUYz0nyE=qhqmn2skZHOhEw>