2012-12-24 15:36:14 +04:00
|
|
|
#ifndef __CR_IMAGE_H__
|
|
|
|
#define __CR_IMAGE_H__
|
2011-09-23 12:00:45 +04:00
|
|
|
|
|
|
|
#include "types.h"
|
|
|
|
#include "compiler.h"
|
|
|
|
|
2012-07-19 17:37:25 +04:00
|
|
|
/*
|
|
|
|
* Basic multi-file images
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define CRTOOLS_IMAGES_V1 1
|
|
|
|
|
2012-08-02 07:42:41 +04:00
|
|
|
/*
|
|
|
|
* Raw images are images in which data is stored in some
|
|
|
|
* non-crtool format (ip tool dumps, tarballs, etc.)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define RAW_IMAGE_MAGIC 0x0
|
|
|
|
|
2012-01-26 19:45:50 +04:00
|
|
|
/*
|
|
|
|
* The magic-s below correspond to coordinates
|
|
|
|
* of various Russian towns in the NNNNEEEE form.
|
|
|
|
*/
|
|
|
|
|
2012-07-19 17:37:25 +04:00
|
|
|
#define INVENTORY_MAGIC 0x58313116 /* Veliky Novgorod */
|
2012-04-13 18:02:50 +04:00
|
|
|
#define PSTREE_MAGIC 0x50273030 /* Kyiv */
|
|
|
|
#define FDINFO_MAGIC 0x56213732 /* Dmitrov */
|
|
|
|
#define PAGES_MAGIC 0x56084025 /* Vladimir */
|
2012-05-12 03:10:19 +04:00
|
|
|
#define SHMEM_PAGES_MAGIC PAGES_MAGIC
|
2012-04-13 18:02:50 +04:00
|
|
|
#define CORE_MAGIC 0x55053847 /* Kolomna */
|
|
|
|
#define VMAS_MAGIC 0x54123737 /* Tula */
|
|
|
|
#define PIPES_MAGIC 0x56513555 /* Tver */
|
|
|
|
#define PIPES_DATA_MAGIC 0x56453709 /* Dubna */
|
2012-06-26 02:36:13 +04:00
|
|
|
#define FIFO_MAGIC 0x58364939 /* Kirov */
|
|
|
|
#define FIFO_DATA_MAGIC 0x59333054 /* Tosno */
|
2012-04-13 18:02:50 +04:00
|
|
|
#define SIGACT_MAGIC 0x55344201 /* Murom */
|
|
|
|
#define UNIXSK_MAGIC 0x54373943 /* Ryazan */
|
|
|
|
#define INETSK_MAGIC 0x56443851 /* Pereslavl */
|
2012-08-09 16:17:41 +04:00
|
|
|
#define PACKETSK_MAGIC 0x60454618 /* Veliky Ustyug */
|
2012-04-13 18:02:50 +04:00
|
|
|
#define ITIMERS_MAGIC 0x57464056 /* Kostroma */
|
|
|
|
#define SK_QUEUES_MAGIC 0x56264026 /* Suzdal */
|
|
|
|
#define UTSNS_MAGIC 0x54473203 /* Smolensk */
|
|
|
|
#define CREDS_MAGIC 0x54023547 /* Kozelsk */
|
|
|
|
#define IPCNS_VAR_MAGIC 0x53115007 /* Samara */
|
|
|
|
#define IPCNS_SHM_MAGIC 0x46283044 /* Odessa */
|
|
|
|
#define IPCNS_MSG_MAGIC 0x55453737 /* Moscow */
|
|
|
|
#define IPCNS_SEM_MAGIC 0x59573019 /* St. Petersburg */
|
|
|
|
#define REG_FILES_MAGIC 0x50363636 /* Belgorod */
|
|
|
|
#define FS_MAGIC 0x51403912 /* Voronezh */
|
|
|
|
#define MM_MAGIC 0x57492820 /* Pskov */
|
|
|
|
#define REMAP_FPATH_MAGIC 0x59133954 /* Vologda */
|
|
|
|
#define GHOST_FILE_MAGIC 0x52583605 /* Oryol */
|
2012-04-28 17:29:14 +04:00
|
|
|
#define TCP_STREAM_MAGIC 0x51465506 /* Orenburg */
|
2012-05-04 13:38:00 +04:00
|
|
|
#define EVENTFD_MAGIC 0x44523722 /* Anapa */
|
2012-05-04 13:38:00 +04:00
|
|
|
#define EVENTPOLL_MAGIC 0x45023858 /* Krasnodar */
|
|
|
|
#define EVENTPOLL_TFD_MAGIC 0x44433746 /* Novorossiysk */
|
2012-08-02 12:26:35 +04:00
|
|
|
#define SIGNALFD_MAGIC 0x57323820 /* Uglich */
|
2012-05-04 13:38:00 +04:00
|
|
|
#define INOTIFY_MAGIC 0x48424431 /* Volgograd */
|
2012-05-12 03:10:19 +04:00
|
|
|
#define INOTIFY_WD_MAGIC 0x54562009 /* Svetlogorsk (Rauschen) */
|
2012-05-12 03:30:10 +04:00
|
|
|
#define MOUNTPOINTS_MAGIC 0x55563928 /* Petushki */
|
2012-08-02 08:17:27 +04:00
|
|
|
#define NETDEV_MAGIC 0x57373951 /* Yaroslavl */
|
2012-09-12 20:00:54 +04:00
|
|
|
#define TTY_MAGIC 0x59433025 /* Pushkin */
|
|
|
|
#define TTY_INFO_MAGIC 0x59453036 /* Kolpino */
|
2011-09-23 12:00:45 +04:00
|
|
|
|
2012-08-02 08:26:43 +04:00
|
|
|
#define IFADDR_MAGIC RAW_IMAGE_MAGIC
|
2012-08-02 08:31:46 +04:00
|
|
|
#define ROUTE_MAGIC RAW_IMAGE_MAGIC
|
2012-08-09 19:51:22 +04:00
|
|
|
#define TMPFS_MAGIC RAW_IMAGE_MAGIC
|
2012-08-02 08:26:43 +04:00
|
|
|
|
2011-09-23 12:00:45 +04:00
|
|
|
#define PAGE_IMAGE_SIZE 4096
|
|
|
|
#define PAGE_RSS 1
|
2011-11-25 18:04:36 +04:00
|
|
|
#define PAGE_ANON 2
|
2011-09-23 12:00:45 +04:00
|
|
|
|
2012-04-13 17:54:36 +04:00
|
|
|
/*
|
|
|
|
* Top bit set in the tgt id means we've remapped
|
|
|
|
* to a ghost file.
|
|
|
|
*/
|
|
|
|
#define REMAP_GHOST (1 << 31)
|
|
|
|
|
2012-04-19 11:48:00 +04:00
|
|
|
#define USK_EXTERN (1 << 0)
|
|
|
|
|
2011-11-15 13:37:17 +04:00
|
|
|
#define VMA_AREA_NONE (0 << 0)
|
2011-11-15 11:57:24 +04:00
|
|
|
#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)
|
2011-09-23 12:00:45 +04:00
|
|
|
|
2012-02-14 20:19:49 +03:00
|
|
|
#define VMA_AREA_SYSVIPC (1 << 10)
|
2012-11-02 16:00:18 +03:00
|
|
|
#define VMA_AREA_SOCKET (1 << 11)
|
2012-02-14 20:19:49 +03:00
|
|
|
|
2012-11-20 20:39:12 +04:00
|
|
|
#define vma_premmaped_start(vma) ((vma)->shmid)
|
2011-11-15 17:12:29 +04:00
|
|
|
#define vma_entry_is(vma, s) (((vma)->status & (s)) == (s))
|
|
|
|
#define vma_entry_len(vma) ((vma)->end - (vma)->start)
|
2011-09-23 12:00:45 +04:00
|
|
|
|
|
|
|
struct page_entry {
|
|
|
|
u64 va;
|
|
|
|
u8 data[PAGE_IMAGE_SIZE];
|
|
|
|
} __packed;
|
|
|
|
|
2012-01-27 21:43:32 +04:00
|
|
|
#define CR_CAP_SIZE 2
|
|
|
|
|
2011-09-23 12:00:45 +04:00
|
|
|
#ifdef CONFIG_X86_64
|
|
|
|
|
|
|
|
#define GDT_ENTRY_TLS_ENTRIES 3
|
2011-10-01 13:24:34 +04:00
|
|
|
#define TASK_COMM_LEN 16
|
2011-09-23 12:00:45 +04:00
|
|
|
|
2011-10-10 17:05:12 +04:00
|
|
|
#define TASK_PF_USED_MATH 0x00002000
|
|
|
|
|
2012-01-23 14:44:23 +04:00
|
|
|
#ifdef CONFIG_X86_64
|
|
|
|
# define AT_VECTOR_SIZE 44
|
|
|
|
#else
|
|
|
|
# define AT_VECTOR_SIZE 22 /* Not needed at moment */
|
|
|
|
#endif
|
|
|
|
|
ctrools: Rewrite task/threads stopping engine is back
This commit brings the former "Rewrite task/threads stopping engine"
commit back. Handling it separately is too complex so better try
to handle it in-place.
Note some tests might fault, it's expected.
---
Stopping tasks with STOP and proceeding with SEIZE is actually excessive --
the SEIZE if enough. Moreover, just killing a task with STOP is also racy,
since task should be given some time to come to sleep before its proc
can be parsed.
Rewrite all this code to SEIZE task and all its threads from the very beginning.
With this we can distinguish stopped task state and migrate it properly (not
supported now, need to implement).
This thing however has one BIG problem -- after we SEIZE-d a task we should
seize
it's threads, but we should do it in a loop -- reading /proc/pid/task and
seizing
them again and again, until the contents of this dir stops changing (not done
now).
Besides, after we seized a task and all its threads we cannot scan it's children
list once -- task can get reparented to init and any task's child can call clone
with CLONE_PARENT flag thus repopulating the children list of the already seized
task (not done also)
This patch is ugly, yes, but splitting it doesn't help to review it much, sorry
:(
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-02-01 19:45:31 +04:00
|
|
|
#define TASK_ALIVE 0x1
|
|
|
|
#define TASK_DEAD 0x2
|
|
|
|
#define TASK_STOPPED 0x3 /* FIXME - implement */
|
2012-06-22 00:38:00 +04:00
|
|
|
#define TASK_HELPER 0x4
|
2012-01-22 20:24:04 +04:00
|
|
|
|
2011-09-23 12:00:45 +04:00
|
|
|
#endif /* CONFIG_X86_64 */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* There are always 4 magic bytes at the
|
|
|
|
* beginning of the every file.
|
|
|
|
*/
|
|
|
|
#define MAGIC_OFFSET (sizeof(u32))
|
|
|
|
#define GET_FILE_OFF(s, m) (offsetof(s,m) + MAGIC_OFFSET)
|
|
|
|
#define GET_FILE_OFF_AFTER(s) (sizeof(s) + MAGIC_OFFSET)
|
|
|
|
|
|
|
|
#endif /* CR_IMAGE_H */
|