view toys/swapoff.c @ 543:60b97ba66a70

Extensive semi-gratuitous refactoring: factor out common code, handle euid!=uid and egid!=gid cases. (Note: test suite requires root access, possibly container support.)
author Rob Landley <>
date Mon, 12 Mar 2012 23:00:28 -0500
parents b4a9fd8773d6
line wrap: on
line source

/* vi: set sw=4 ts=4:
 * swapoff.c - Disable region for swapping
 * Copyright 2012 Elie De Brauwer <>
 * Not in SUSv4.


config SWAPOFF
	bool "swapoff"
	default y
	  usage: swapoff swapregion

	  Disable swapping on a given swapregion.

#include "toys.h"

void swapoff_main(void)
	if (swapoff(toys.optargs[0]))
		perror_exit("failed to remove swaparea");