<commit_before>#ifndef CR_IMAGE_H
#define CR_IMAGE_H

#include "types.h"
#include "compiler.h"

#define FDINFO_MAGIC	0x01010101
#define PAGES_MAGIC	0x20202020
#define CORE_MAGIC	0xa75b8d43
#define SHMEM_MAGIC	0x03300330
#define PIPEFS_MAGIC	0x50495045
#define PSTREE_MAGIC	0x40044004
#define PIPES_MAGIC	0x05055050

#define FDINFO_FD	1
#define FDINFO_MAP	2

#define PAGE_IMAGE_SIZE	4096
#define PAGE_RSS	1

struct fdinfo_entry {
	u8	type;
	u8	len;
	u16	flags;
	u32	pos;
	u64	addr;
	u8	name[0];
} __packed;

struct shmem_entry {
	u64	start;
	u64	end;
	u64	shmid;
} __packed;

struct pstree_entry {
	u32	pid;
	u32	nr_children;
	u32	children[0];
} __packed;

struct pipe_entry {
	u32	fd;
	u32	pipeid;
	u32	flags;
	u32	bytes;
	u8	data[0];
} __packed;

#define VMA_AREA_REGULAR	(1 << 0)
#define VMA_AREA_STACK		(1 << 1)
#define VMA_AREA_VSYSCALL	(1 << 2)
#define VMA_AREA_VDSO		(1 << 3)
#define VMA_FORCE_READ		(1 << 4)
#define VMA_AREA_HEAP		(1 << 5)
#define VMA_FILE_PRIVATE	(1 << 6)
#define VMA_FILE_SHARED		(1 << 7)
#define VMA_ANON_SHARED		(1 << 8)
#define VMA_ANON_PRIVATE	(1 << 9)
#define VMA_FORCE_WRITE		(1 << 10)
#define VMA_DUMP_ALL		(1 << 11)

#define vma_entry_has(vma, s)	(((vma)->status & (s)) == (s))

struct vma_entry {
	u64	start;
	u64	end;
	u64	pgoff;
	u32	prot;
	u32	flags;
	u32	status;
	u32	pid;
	s64	fd;
	u64	ino;
	u32	dev_maj;
	u32	dev_min;
} __packed;

struct page_entry {
	u64	va;
	u8	data[PAGE_IMAGE_SIZE];
} __packed;

#define HEADER_VERSION		1
#define HEADER_ARCH_X86_64	1

struct image_header {
	u16	version;
	u16	arch;<commit_msg>Add comments on VMA area status flags<commit_after>#ifndef CR_IMAGE_H
#define CR_IMAGE_H

#include "types.h"
#include "compiler.h"

#define FDINFO_MAGIC	0x01010101
#define PAGES_MAGIC	0x20202020
#define CORE_MAGIC	0xa75b8d43
#define SHMEM_MAGIC	0x03300330
#define PIPEFS_MAGIC	0x50495045
#define PSTREE_MAGIC	0x40044004
#define PIPES_MAGIC	0x05055050

#define FDINFO_FD	1
#define FDINFO_MAP	2

#define PAGE_IMAGE_SIZE	4096
#define PAGE_RSS	1

struct fdinfo_entry {
	u8	type;
	u8	len;
	u16	flags;
	u32	pos;
	u64	addr;
	u8	name[0];
} __packed;

struct shmem_entry {
	u64	start;
	u64	end;
	u64	shmid;
} __packed;

struct pstree_entry {
	u32	pid;
	u32	nr_children;
	u32	children[0];
} __packed;

struct pipe_entry {
	u32	fd;
	u32	pipeid;
	u32	flags;
	u32	bytes;
	u8	data[0];
} __packed;

#define VMA_AREA_REGULAR	(1 << 0)	/* Dumpable area */
#define VMA_AREA_STACK		(1 << 1)
#define VMA_AREA_VSYSCALL	(1 << 2)
#define VMA_AREA_VDSO		(1 << 3)
#define VMA_FORCE_READ		(1 << 4)	/* VMA changed to be readable */
#define VMA_AREA_HEAP		(1 << 5)

#define VMA_FILE_PRIVATE	(1 << 6)
#define VMA_FILE_SHARED		(1 << 7)
#define VMA_ANON_SHARED		(1 << 8)
#define VMA_ANON_PRIVATE	(1 << 9)
#define VMA_FORCE_WRITE		(1 << 10)	/* VMA changed to be writable */

#define VMA_DUMP_ALL		(1 << 11)	/* Dump the whole VMA area pages */

#define vma_entry_has(vma, s)	(((vma)->status & (s)) == (s))

struct vma_entry {
	u64	start;
	u64	end;
	u64	pgoff;
	u32	prot;
	u32	flags;
	u32	status;
	u32	pid;
	s64	fd;
	u64	ino;
	u32	dev_maj;
	u32	dev_min;
} __packed;

struct page_entry {
	u64	va;
	u8	data[PAGE_IMAGE_SIZE];
} __packed;

#define HEADER_VERSION		1
#define HEADER_ARCH_X86_64	1

struct image_header {
	u16	version;
	u16	arch;
{'fraction_non_alphanumeric': 0.10558624923265807, 'fraction_numerical': 0.09883364027010436, 'mean_word_length': 4.6092943201376935, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6669110', 'n_tokens_mistral': 1770, 'n_tokens_neox': 1607, 'n_words': 393}