aboutsummaryrefslogtreecommitdiffstats
path: root/swapon.c
blob: 8200a9b5d00588896309dd4af2354c3dcf050183 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "defs.h"

#include <sys/swap.h>

#ifndef SWAP_FLAG_PREFER
# define SWAP_FLAG_PREFER 0x8000
#endif
#ifndef SWAP_FLAG_DISCARD
# define SWAP_FLAG_DISCARD 0x10000
#endif
#ifndef SWAP_FLAG_DISCARD_ONCE
# define SWAP_FLAG_DISCARD_ONCE 0x20000
#endif
#ifndef SWAP_FLAG_DISCARD_PAGES
# define SWAP_FLAG_DISCARD_PAGES 0x40000
#endif

#include "xlat/swap_flags.h"

int
sys_swapon(struct tcb *tcp)
{
	if (entering(tcp)) {
		int flags = tcp->u_arg[1];
		printpath(tcp, tcp->u_arg[0]);
		tprints(", ");
		printflags(swap_flags, flags & ~SWAP_FLAG_PRIO_MASK,
			"SWAP_FLAG_???");
		if (flags & SWAP_FLAG_PREFER)
			tprintf("|%d", flags & SWAP_FLAG_PRIO_MASK);
	}
	return 0;
}