File: process.h

package info (click to toggle)
wine 0.0.20020411-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 43,012 kB
  • ctags: 104,265
  • sloc: ansic: 550,196; perl: 21,747; yacc: 3,990; sh: 3,904; makefile: 3,297; tcl: 2,616; lex: 2,443
file content (111 lines) | stat: -rw-r--r-- 5,066 bytes parent folder | download
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*
 * Wine server processes
 *
 * Copyright (C) 1999 Alexandre Julliard
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef __WINE_SERVER_PROCESS_H
#define __WINE_SERVER_PROCESS_H

#include "object.h"

struct msg_queue;
struct atom_table;

/* process structures */

struct process_dll
{
    struct process_dll  *next;            /* per-process dll list */
    struct process_dll  *prev;
    struct file         *file;            /* dll file */
    void                *base;            /* dll base address (in process addr space) */
    size_t               size;            /* dll size */
    void                *name;            /* ptr to ptr to name (in process addr space) */
    int                  dbg_offset;      /* debug info offset */
    int                  dbg_size;        /* debug info size */
    size_t               namelen;         /* length of dll file name */
    char                *filename;        /* dll file name */
};

struct process
{
    struct object        obj;             /* object header */
    struct process      *next;            /* system-wide process list */
    struct process      *prev;
    struct process      *parent;          /* parent process */
    struct thread       *thread_list;     /* head of the thread list */
    struct thread       *debugger;        /* thread debugging this process */
    struct object       *handles;         /* handle entries */
    int                  exit_code;       /* process exit code */
    int                  running_threads; /* number of threads running in this process */
    struct timeval       start_time;      /* absolute time at process start */
    struct timeval       end_time;        /* absolute time at process end */
    int                  priority;        /* priority class */
    int                  affinity;        /* process affinity mask */
    int                  suspend;         /* global process suspend count */
    int                  create_flags;    /* process creation flags */
    struct console_input*console;         /* console input */
    struct event        *init_event;      /* event for init done */
    struct event        *idle_event;      /* event for input idle */
    struct msg_queue    *queue;           /* main message queue */
    struct atom_table   *atom_table;      /* pointer to local atom table */
    struct process_dll   exe;             /* main exe file */
    void                *ldt_copy;        /* pointer to LDT copy in client addr space */
    void                *ldt_flags;       /* pointer to LDT flags in client addr space */
};

struct process_snapshot
{
    struct process *process;  /* process ptr */
    int             count;    /* process refcount */
    int             threads;  /* number of threads */
    int             priority; /* priority class */
};

struct module_snapshot
{
    void           *base;     /* module base addr */
    size_t          size;     /* module size */
    size_t          namelen;  /* length of file name */
    char           *filename; /* module file name */
};

/* process functions */

extern struct thread *create_process( int fd );
extern struct process *get_process_from_id( void *id );
extern struct process *get_process_from_handle( handle_t handle, unsigned int access );
extern int process_set_debugger( struct process *process, struct thread *thread );
extern int debugger_detach( struct process* process, struct thread* debugger );

extern void add_process_thread( struct process *process,
                                struct thread *thread );
extern void remove_process_thread( struct process *process,
                                   struct thread *thread );
extern void suspend_process( struct process *process );
extern void resume_process( struct process *process );
extern void kill_process( struct process *process, struct thread *skip, int exit_code );
extern void kill_console_processes( struct thread *renderer, int exit_code );
extern void kill_debugged_processes( struct thread *debugger, int exit_code );
extern void detach_debugged_processes( struct thread *debugger );
extern struct process_snapshot *process_snap( int *count );
extern struct module_snapshot *module_snap( struct process *process, int *count );

static inline void *get_process_id( struct process *process ) { return process; }

#endif  /* __WINE_SERVER_PROCESS_H */