annotate toys/swapoff.c @ 562:4d802d438983

Match uint64_t with PRIu64 to avoid warnings on 64 bit builds.
author Rob Landley <rob@landley.net>
date Sat, 14 Apr 2012 21:27:00 -0500
parents b4a9fd8773d6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
482
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
1 /* vi: set sw=4 ts=4:
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
2 *
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
3 * swapoff.c - Disable region for swapping
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
4 *
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
5 * Copyright 2012 Elie De Brauwer <eliedebrauwer@gmail.com>
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
6 *
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
7 * Not in SUSv4.
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
8
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
9 USE_SWAPOFF(NEWTOY(swapoff, "<1>1", TOYFLAG_BIN|TOYFLAG_NEEDROOT))
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
10
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
11 config SWAPOFF
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
12 bool "swapoff"
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
13 default y
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
14 help
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
15 usage: swapoff swapregion
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
16
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
17 Disable swapping on a given swapregion.
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
18 */
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
19
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
20 #include "toys.h"
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
21
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
22 void swapoff_main(void)
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
23 {
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
24 if (swapoff(toys.optargs[0]))
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
25 perror_exit("failed to remove swaparea");
b4a9fd8773d6 Adding swapon and swapoff
Elie De Brauwer <eliedebrauwer@gmail.com>
parents:
diff changeset
26 }