File: msync.c

package info (click to toggle)
trinity 1.9%2Bgit20250902.294c465-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,104 kB
  • sloc: ansic: 33,473; sh: 574; makefile: 164
file content (44 lines) | stat: -rw-r--r-- 989 bytes parent folder | download | duplicates (4)
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
34
35
36
37
38
39
40
41
42
43
44
/*
 * SYSCALL_DEFINE3(msync, unsigned long, start, size_t, len, int, flags)
 */
#include "maps.h"
#include "random.h"
#include "sanitise.h"
#include "shm.h"
#include "syscall.h"
#include "trinity.h"

#if !defined(MS_ASYNC)
#define MS_ASYNC        1               /* Sync memory asynchronously.  */
#endif
#if !defined(MS_SYNC)
#define MS_SYNC         4               /* Synchronous memory sync.  */
#endif
#if !defined(MS_INVALIDATE)
#define MS_INVALIDATE   2               /* Invalidate the caches.  */
#endif

static void sanitise_msync(struct syscallrecord *rec)
{
       (void) common_set_mmap_ptr_len();

	if (RAND_BOOL())
		rec->a3 |= MS_INVALIDATE;
}

static unsigned long msync_flags[] = {
	MS_ASYNC, MS_SYNC,
};

struct syscallentry syscall_msync = {
	.name = "msync",
	.num_args = 3,
	.arg1name = "start",
	.arg1type = ARG_MMAP,
	.arg2name = "len",
	.arg3name = "flags",
	.arg3type = ARG_OP,
	.arg3list = ARGLIST(msync_flags),
	.group = GROUP_VM,
	.sanitise = sanitise_msync,
};