server: Remove no longer used snapshot requests.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
747573f1e4
commit
1ff8fe20bf
|
@ -2420,67 +2420,6 @@ struct is_same_mapping_reply
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#define SNAP_PROCESS 0x00000001
|
|
||||||
#define SNAP_THREAD 0x00000002
|
|
||||||
|
|
||||||
struct create_snapshot_request
|
|
||||||
{
|
|
||||||
struct request_header __header;
|
|
||||||
unsigned int attributes;
|
|
||||||
unsigned int flags;
|
|
||||||
char __pad_20[4];
|
|
||||||
};
|
|
||||||
struct create_snapshot_reply
|
|
||||||
{
|
|
||||||
struct reply_header __header;
|
|
||||||
obj_handle_t handle;
|
|
||||||
char __pad_12[4];
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct next_process_request
|
|
||||||
{
|
|
||||||
struct request_header __header;
|
|
||||||
obj_handle_t handle;
|
|
||||||
int reset;
|
|
||||||
char __pad_20[4];
|
|
||||||
};
|
|
||||||
struct next_process_reply
|
|
||||||
{
|
|
||||||
struct reply_header __header;
|
|
||||||
int count;
|
|
||||||
process_id_t pid;
|
|
||||||
process_id_t ppid;
|
|
||||||
int threads;
|
|
||||||
int priority;
|
|
||||||
int handles;
|
|
||||||
int unix_pid;
|
|
||||||
/* VARARG(filename,unicode_str); */
|
|
||||||
char __pad_36[4];
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct next_thread_request
|
|
||||||
{
|
|
||||||
struct request_header __header;
|
|
||||||
obj_handle_t handle;
|
|
||||||
int reset;
|
|
||||||
char __pad_20[4];
|
|
||||||
};
|
|
||||||
struct next_thread_reply
|
|
||||||
{
|
|
||||||
struct reply_header __header;
|
|
||||||
int count;
|
|
||||||
process_id_t pid;
|
|
||||||
thread_id_t tid;
|
|
||||||
int base_pri;
|
|
||||||
int delta_pri;
|
|
||||||
int unix_tid;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
struct thread_info
|
struct thread_info
|
||||||
{
|
{
|
||||||
thread_id_t tid;
|
thread_id_t tid;
|
||||||
|
@ -5926,9 +5865,6 @@ enum request
|
||||||
REQ_get_mapping_committed_range,
|
REQ_get_mapping_committed_range,
|
||||||
REQ_add_mapping_committed_range,
|
REQ_add_mapping_committed_range,
|
||||||
REQ_is_same_mapping,
|
REQ_is_same_mapping,
|
||||||
REQ_create_snapshot,
|
|
||||||
REQ_next_process,
|
|
||||||
REQ_next_thread,
|
|
||||||
REQ_list_processes,
|
REQ_list_processes,
|
||||||
REQ_wait_debug_event,
|
REQ_wait_debug_event,
|
||||||
REQ_queue_exception_event,
|
REQ_queue_exception_event,
|
||||||
|
@ -6230,9 +6166,6 @@ union generic_request
|
||||||
struct get_mapping_committed_range_request get_mapping_committed_range_request;
|
struct get_mapping_committed_range_request get_mapping_committed_range_request;
|
||||||
struct add_mapping_committed_range_request add_mapping_committed_range_request;
|
struct add_mapping_committed_range_request add_mapping_committed_range_request;
|
||||||
struct is_same_mapping_request is_same_mapping_request;
|
struct is_same_mapping_request is_same_mapping_request;
|
||||||
struct create_snapshot_request create_snapshot_request;
|
|
||||||
struct next_process_request next_process_request;
|
|
||||||
struct next_thread_request next_thread_request;
|
|
||||||
struct list_processes_request list_processes_request;
|
struct list_processes_request list_processes_request;
|
||||||
struct wait_debug_event_request wait_debug_event_request;
|
struct wait_debug_event_request wait_debug_event_request;
|
||||||
struct queue_exception_event_request queue_exception_event_request;
|
struct queue_exception_event_request queue_exception_event_request;
|
||||||
|
@ -6532,9 +6465,6 @@ union generic_reply
|
||||||
struct get_mapping_committed_range_reply get_mapping_committed_range_reply;
|
struct get_mapping_committed_range_reply get_mapping_committed_range_reply;
|
||||||
struct add_mapping_committed_range_reply add_mapping_committed_range_reply;
|
struct add_mapping_committed_range_reply add_mapping_committed_range_reply;
|
||||||
struct is_same_mapping_reply is_same_mapping_reply;
|
struct is_same_mapping_reply is_same_mapping_reply;
|
||||||
struct create_snapshot_reply create_snapshot_reply;
|
|
||||||
struct next_process_reply next_process_reply;
|
|
||||||
struct next_thread_reply next_thread_reply;
|
|
||||||
struct list_processes_reply list_processes_reply;
|
struct list_processes_reply list_processes_reply;
|
||||||
struct wait_debug_event_reply wait_debug_event_reply;
|
struct wait_debug_event_reply wait_debug_event_reply;
|
||||||
struct queue_exception_event_reply queue_exception_event_reply;
|
struct queue_exception_event_reply queue_exception_event_reply;
|
||||||
|
@ -6741,7 +6671,7 @@ union generic_reply
|
||||||
|
|
||||||
/* ### protocol_version begin ### */
|
/* ### protocol_version begin ### */
|
||||||
|
|
||||||
#define SERVER_PROTOCOL_VERSION 615
|
#define SERVER_PROTOCOL_VERSION 616
|
||||||
|
|
||||||
/* ### protocol_version end ### */
|
/* ### protocol_version end ### */
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,6 @@ C_SRCS = \
|
||||||
semaphore.c \
|
semaphore.c \
|
||||||
serial.c \
|
serial.c \
|
||||||
signal.c \
|
signal.c \
|
||||||
snapshot.c \
|
|
||||||
sock.c \
|
sock.c \
|
||||||
symlink.c \
|
symlink.c \
|
||||||
thread.c \
|
thread.c \
|
||||||
|
|
|
@ -1086,36 +1086,6 @@ int set_process_debug_flag( struct process *process, int flag )
|
||||||
return write_process_memory( process, process->peb + 2, 1, &data );
|
return write_process_memory( process, process->peb + 2, 1, &data );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* take a snapshot of currently running processes */
|
|
||||||
struct process_snapshot *process_snap( int *count )
|
|
||||||
{
|
|
||||||
struct process_snapshot *snapshot, *ptr;
|
|
||||||
struct process *process;
|
|
||||||
|
|
||||||
if (!running_processes) return NULL;
|
|
||||||
if (!(snapshot = mem_alloc( sizeof(*snapshot) * running_processes )))
|
|
||||||
return NULL;
|
|
||||||
ptr = snapshot;
|
|
||||||
LIST_FOR_EACH_ENTRY( process, &process_list, struct process, entry )
|
|
||||||
{
|
|
||||||
if (!process->running_threads) continue;
|
|
||||||
ptr->process = process;
|
|
||||||
ptr->threads = process->running_threads;
|
|
||||||
ptr->count = process->obj.refcount;
|
|
||||||
ptr->priority = process->priority;
|
|
||||||
ptr->handles = get_handle_table_count(process);
|
|
||||||
grab_object( process );
|
|
||||||
ptr++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(*count = ptr - snapshot))
|
|
||||||
{
|
|
||||||
free( snapshot );
|
|
||||||
snapshot = NULL;
|
|
||||||
}
|
|
||||||
return snapshot;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* create a new process */
|
/* create a new process */
|
||||||
DECL_HANDLER(new_process)
|
DECL_HANDLER(new_process)
|
||||||
{
|
{
|
||||||
|
|
|
@ -100,15 +100,6 @@ struct process
|
||||||
struct list kernel_object; /* list of kernel object pointers */
|
struct list kernel_object; /* list of kernel object pointers */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct process_snapshot
|
|
||||||
{
|
|
||||||
struct process *process; /* process ptr */
|
|
||||||
int count; /* process refcount */
|
|
||||||
int threads; /* number of threads */
|
|
||||||
int priority; /* priority class */
|
|
||||||
int handles; /* number of handles */
|
|
||||||
};
|
|
||||||
|
|
||||||
#define CPU_FLAG(cpu) (1 << (cpu))
|
#define CPU_FLAG(cpu) (1 << (cpu))
|
||||||
#define CPU_64BIT_MASK (CPU_FLAG(CPU_x86_64) | CPU_FLAG(CPU_ARM64))
|
#define CPU_64BIT_MASK (CPU_FLAG(CPU_x86_64) | CPU_FLAG(CPU_ARM64))
|
||||||
|
|
||||||
|
@ -137,7 +128,6 @@ extern void kill_process( struct process *process, int violent_death );
|
||||||
extern void kill_console_processes( struct thread *renderer, 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 kill_debugged_processes( struct thread *debugger, int exit_code );
|
||||||
extern void detach_debugged_processes( struct thread *debugger );
|
extern void detach_debugged_processes( struct thread *debugger );
|
||||||
extern struct process_snapshot *process_snap( int *count );
|
|
||||||
extern void enum_processes( int (*cb)(struct process*, void*), void *user);
|
extern void enum_processes( int (*cb)(struct process*, void*), void *user);
|
||||||
|
|
||||||
/* console functions */
|
/* console functions */
|
||||||
|
|
|
@ -1868,47 +1868,6 @@ enum char_info_mode
|
||||||
@END
|
@END
|
||||||
|
|
||||||
|
|
||||||
#define SNAP_PROCESS 0x00000001
|
|
||||||
#define SNAP_THREAD 0x00000002
|
|
||||||
/* Create a snapshot */
|
|
||||||
@REQ(create_snapshot)
|
|
||||||
unsigned int attributes; /* object attributes */
|
|
||||||
unsigned int flags; /* snapshot flags (SNAP_*) */
|
|
||||||
@REPLY
|
|
||||||
obj_handle_t handle; /* handle to the snapshot */
|
|
||||||
@END
|
|
||||||
|
|
||||||
|
|
||||||
/* Get the next process from a snapshot */
|
|
||||||
@REQ(next_process)
|
|
||||||
obj_handle_t handle; /* handle to the snapshot */
|
|
||||||
int reset; /* reset snapshot position? */
|
|
||||||
@REPLY
|
|
||||||
int count; /* process usage count */
|
|
||||||
process_id_t pid; /* process id */
|
|
||||||
process_id_t ppid; /* parent process id */
|
|
||||||
int threads; /* number of threads */
|
|
||||||
int priority; /* process priority */
|
|
||||||
int handles; /* number of handles */
|
|
||||||
int unix_pid; /* Unix pid */
|
|
||||||
VARARG(filename,unicode_str); /* file name of main exe */
|
|
||||||
@END
|
|
||||||
|
|
||||||
|
|
||||||
/* Get the next thread from a snapshot */
|
|
||||||
@REQ(next_thread)
|
|
||||||
obj_handle_t handle; /* handle to the snapshot */
|
|
||||||
int reset; /* reset snapshot position? */
|
|
||||||
@REPLY
|
|
||||||
int count; /* thread usage count */
|
|
||||||
process_id_t pid; /* process id */
|
|
||||||
thread_id_t tid; /* thread id */
|
|
||||||
int base_pri; /* base priority */
|
|
||||||
int delta_pri; /* delta priority */
|
|
||||||
int unix_tid; /* thread native pid */
|
|
||||||
@END
|
|
||||||
|
|
||||||
|
|
||||||
struct thread_info
|
struct thread_info
|
||||||
{
|
{
|
||||||
thread_id_t tid;
|
thread_id_t tid;
|
||||||
|
|
|
@ -211,9 +211,6 @@ DECL_HANDLER(unmap_view);
|
||||||
DECL_HANDLER(get_mapping_committed_range);
|
DECL_HANDLER(get_mapping_committed_range);
|
||||||
DECL_HANDLER(add_mapping_committed_range);
|
DECL_HANDLER(add_mapping_committed_range);
|
||||||
DECL_HANDLER(is_same_mapping);
|
DECL_HANDLER(is_same_mapping);
|
||||||
DECL_HANDLER(create_snapshot);
|
|
||||||
DECL_HANDLER(next_process);
|
|
||||||
DECL_HANDLER(next_thread);
|
|
||||||
DECL_HANDLER(list_processes);
|
DECL_HANDLER(list_processes);
|
||||||
DECL_HANDLER(wait_debug_event);
|
DECL_HANDLER(wait_debug_event);
|
||||||
DECL_HANDLER(queue_exception_event);
|
DECL_HANDLER(queue_exception_event);
|
||||||
|
@ -514,9 +511,6 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
|
||||||
(req_handler)req_get_mapping_committed_range,
|
(req_handler)req_get_mapping_committed_range,
|
||||||
(req_handler)req_add_mapping_committed_range,
|
(req_handler)req_add_mapping_committed_range,
|
||||||
(req_handler)req_is_same_mapping,
|
(req_handler)req_is_same_mapping,
|
||||||
(req_handler)req_create_snapshot,
|
|
||||||
(req_handler)req_next_process,
|
|
||||||
(req_handler)req_next_thread,
|
|
||||||
(req_handler)req_list_processes,
|
(req_handler)req_list_processes,
|
||||||
(req_handler)req_wait_debug_event,
|
(req_handler)req_wait_debug_event,
|
||||||
(req_handler)req_queue_exception_event,
|
(req_handler)req_queue_exception_event,
|
||||||
|
@ -1336,32 +1330,6 @@ C_ASSERT( sizeof(struct add_mapping_committed_range_request) == 40 );
|
||||||
C_ASSERT( FIELD_OFFSET(struct is_same_mapping_request, base1) == 16 );
|
C_ASSERT( FIELD_OFFSET(struct is_same_mapping_request, base1) == 16 );
|
||||||
C_ASSERT( FIELD_OFFSET(struct is_same_mapping_request, base2) == 24 );
|
C_ASSERT( FIELD_OFFSET(struct is_same_mapping_request, base2) == 24 );
|
||||||
C_ASSERT( sizeof(struct is_same_mapping_request) == 32 );
|
C_ASSERT( sizeof(struct is_same_mapping_request) == 32 );
|
||||||
C_ASSERT( FIELD_OFFSET(struct create_snapshot_request, attributes) == 12 );
|
|
||||||
C_ASSERT( FIELD_OFFSET(struct create_snapshot_request, flags) == 16 );
|
|
||||||
C_ASSERT( sizeof(struct create_snapshot_request) == 24 );
|
|
||||||
C_ASSERT( FIELD_OFFSET(struct create_snapshot_reply, handle) == 8 );
|
|
||||||
C_ASSERT( sizeof(struct create_snapshot_reply) == 16 );
|
|
||||||
C_ASSERT( FIELD_OFFSET(struct next_process_request, handle) == 12 );
|
|
||||||
C_ASSERT( FIELD_OFFSET(struct next_process_request, reset) == 16 );
|
|
||||||
C_ASSERT( sizeof(struct next_process_request) == 24 );
|
|
||||||
C_ASSERT( FIELD_OFFSET(struct next_process_reply, count) == 8 );
|
|
||||||
C_ASSERT( FIELD_OFFSET(struct next_process_reply, pid) == 12 );
|
|
||||||
C_ASSERT( FIELD_OFFSET(struct next_process_reply, ppid) == 16 );
|
|
||||||
C_ASSERT( FIELD_OFFSET(struct next_process_reply, threads) == 20 );
|
|
||||||
C_ASSERT( FIELD_OFFSET(struct next_process_reply, priority) == 24 );
|
|
||||||
C_ASSERT( FIELD_OFFSET(struct next_process_reply, handles) == 28 );
|
|
||||||
C_ASSERT( FIELD_OFFSET(struct next_process_reply, unix_pid) == 32 );
|
|
||||||
C_ASSERT( sizeof(struct next_process_reply) == 40 );
|
|
||||||
C_ASSERT( FIELD_OFFSET(struct next_thread_request, handle) == 12 );
|
|
||||||
C_ASSERT( FIELD_OFFSET(struct next_thread_request, reset) == 16 );
|
|
||||||
C_ASSERT( sizeof(struct next_thread_request) == 24 );
|
|
||||||
C_ASSERT( FIELD_OFFSET(struct next_thread_reply, count) == 8 );
|
|
||||||
C_ASSERT( FIELD_OFFSET(struct next_thread_reply, pid) == 12 );
|
|
||||||
C_ASSERT( FIELD_OFFSET(struct next_thread_reply, tid) == 16 );
|
|
||||||
C_ASSERT( FIELD_OFFSET(struct next_thread_reply, base_pri) == 20 );
|
|
||||||
C_ASSERT( FIELD_OFFSET(struct next_thread_reply, delta_pri) == 24 );
|
|
||||||
C_ASSERT( FIELD_OFFSET(struct next_thread_reply, unix_tid) == 28 );
|
|
||||||
C_ASSERT( sizeof(struct next_thread_reply) == 32 );
|
|
||||||
C_ASSERT( sizeof(struct list_processes_request) == 16 );
|
C_ASSERT( sizeof(struct list_processes_request) == 16 );
|
||||||
C_ASSERT( FIELD_OFFSET(struct list_processes_reply, info_size) == 8 );
|
C_ASSERT( FIELD_OFFSET(struct list_processes_reply, info_size) == 8 );
|
||||||
C_ASSERT( FIELD_OFFSET(struct list_processes_reply, process_count) == 12 );
|
C_ASSERT( FIELD_OFFSET(struct list_processes_reply, process_count) == 12 );
|
||||||
|
|
|
@ -1,223 +0,0 @@
|
||||||
/*
|
|
||||||
* Server-side snapshots
|
|
||||||
*
|
|
||||||
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
||||||
*
|
|
||||||
* FIXME: heap snapshots not implemented
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include "wine/port.h"
|
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
|
|
||||||
#include "ntstatus.h"
|
|
||||||
#define WIN32_NO_STATUS
|
|
||||||
#include "windef.h"
|
|
||||||
#include "winternl.h"
|
|
||||||
|
|
||||||
#include "handle.h"
|
|
||||||
#include "process.h"
|
|
||||||
#include "thread.h"
|
|
||||||
#include "request.h"
|
|
||||||
|
|
||||||
|
|
||||||
struct snapshot
|
|
||||||
{
|
|
||||||
struct object obj; /* object header */
|
|
||||||
struct process_snapshot *processes; /* processes snapshot */
|
|
||||||
int process_count; /* count of processes */
|
|
||||||
int process_pos; /* current position in proc snapshot */
|
|
||||||
struct thread_snapshot *threads; /* threads snapshot */
|
|
||||||
int thread_count; /* count of threads */
|
|
||||||
int thread_pos; /* current position in thread snapshot */
|
|
||||||
};
|
|
||||||
|
|
||||||
static void snapshot_dump( struct object *obj, int verbose );
|
|
||||||
static void snapshot_destroy( struct object *obj );
|
|
||||||
|
|
||||||
static const struct object_ops snapshot_ops =
|
|
||||||
{
|
|
||||||
sizeof(struct snapshot), /* size */
|
|
||||||
snapshot_dump, /* dump */
|
|
||||||
no_get_type, /* get_type */
|
|
||||||
no_add_queue, /* add_queue */
|
|
||||||
NULL, /* remove_queue */
|
|
||||||
NULL, /* signaled */
|
|
||||||
NULL, /* satisfied */
|
|
||||||
no_signal, /* signal */
|
|
||||||
no_get_fd, /* get_fd */
|
|
||||||
no_map_access, /* map_access */
|
|
||||||
default_get_sd, /* get_sd */
|
|
||||||
default_set_sd, /* set_sd */
|
|
||||||
no_lookup_name, /* lookup_name */
|
|
||||||
no_link_name, /* link_name */
|
|
||||||
NULL, /* unlink_name */
|
|
||||||
no_open_file, /* open_file */
|
|
||||||
no_kernel_obj_list, /* get_kernel_obj_list */
|
|
||||||
no_close_handle, /* close_handle */
|
|
||||||
snapshot_destroy /* destroy */
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* create a new snapshot */
|
|
||||||
static struct snapshot *create_snapshot( unsigned int flags )
|
|
||||||
{
|
|
||||||
struct snapshot *snapshot;
|
|
||||||
|
|
||||||
if (!(snapshot = alloc_object( &snapshot_ops ))) return NULL;
|
|
||||||
|
|
||||||
snapshot->process_pos = 0;
|
|
||||||
snapshot->process_count = 0;
|
|
||||||
if (flags & SNAP_PROCESS)
|
|
||||||
snapshot->processes = process_snap( &snapshot->process_count );
|
|
||||||
|
|
||||||
snapshot->thread_pos = 0;
|
|
||||||
snapshot->thread_count = 0;
|
|
||||||
if (flags & SNAP_THREAD)
|
|
||||||
snapshot->threads = thread_snap( &snapshot->thread_count );
|
|
||||||
|
|
||||||
return snapshot;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get the next process in the snapshot */
|
|
||||||
static int snapshot_next_process( struct snapshot *snapshot, struct next_process_reply *reply )
|
|
||||||
{
|
|
||||||
struct process_snapshot *ptr;
|
|
||||||
struct process_dll *exe_module;
|
|
||||||
|
|
||||||
if (!snapshot->process_count)
|
|
||||||
{
|
|
||||||
set_error( STATUS_INVALID_PARAMETER ); /* FIXME */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (snapshot->process_pos >= snapshot->process_count)
|
|
||||||
{
|
|
||||||
set_error( STATUS_NO_MORE_FILES );
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
ptr = &snapshot->processes[snapshot->process_pos++];
|
|
||||||
reply->count = ptr->count;
|
|
||||||
reply->pid = get_process_id( ptr->process );
|
|
||||||
reply->ppid = ptr->process->parent_id;
|
|
||||||
reply->threads = ptr->threads;
|
|
||||||
reply->priority = ptr->priority;
|
|
||||||
reply->handles = ptr->handles;
|
|
||||||
reply->unix_pid = ptr->process->unix_pid;
|
|
||||||
if ((exe_module = get_process_exe_module( ptr->process )) && exe_module->filename)
|
|
||||||
{
|
|
||||||
data_size_t len = min( exe_module->namelen, get_reply_max_size() );
|
|
||||||
set_reply_data( exe_module->filename, len );
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get the next thread in the snapshot */
|
|
||||||
static int snapshot_next_thread( struct snapshot *snapshot, struct next_thread_reply *reply )
|
|
||||||
{
|
|
||||||
struct thread_snapshot *ptr;
|
|
||||||
|
|
||||||
if (!snapshot->thread_count)
|
|
||||||
{
|
|
||||||
set_error( STATUS_INVALID_PARAMETER ); /* FIXME */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (snapshot->thread_pos >= snapshot->thread_count)
|
|
||||||
{
|
|
||||||
set_error( STATUS_NO_MORE_FILES );
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
ptr = &snapshot->threads[snapshot->thread_pos++];
|
|
||||||
reply->count = ptr->count;
|
|
||||||
reply->pid = get_process_id( ptr->thread->process );
|
|
||||||
reply->tid = get_thread_id( ptr->thread );
|
|
||||||
reply->base_pri = ptr->priority;
|
|
||||||
reply->delta_pri = 0; /* FIXME */
|
|
||||||
reply->unix_tid = ptr->thread->unix_tid;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void snapshot_dump( struct object *obj, int verbose )
|
|
||||||
{
|
|
||||||
struct snapshot *snapshot = (struct snapshot *)obj;
|
|
||||||
assert( obj->ops == &snapshot_ops );
|
|
||||||
fprintf( stderr, "Snapshot: %d procs %d threads\n",
|
|
||||||
snapshot->process_count, snapshot->thread_count );
|
|
||||||
}
|
|
||||||
|
|
||||||
static void snapshot_destroy( struct object *obj )
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
struct snapshot *snapshot = (struct snapshot *)obj;
|
|
||||||
assert( obj->ops == &snapshot_ops );
|
|
||||||
if (snapshot->process_count)
|
|
||||||
{
|
|
||||||
for (i = 0; i < snapshot->process_count; i++)
|
|
||||||
release_object( snapshot->processes[i].process );
|
|
||||||
free( snapshot->processes );
|
|
||||||
}
|
|
||||||
if (snapshot->thread_count)
|
|
||||||
{
|
|
||||||
for (i = 0; i < snapshot->thread_count; i++)
|
|
||||||
release_object( snapshot->threads[i].thread );
|
|
||||||
free( snapshot->threads );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* create a snapshot */
|
|
||||||
DECL_HANDLER(create_snapshot)
|
|
||||||
{
|
|
||||||
struct snapshot *snapshot;
|
|
||||||
|
|
||||||
reply->handle = 0;
|
|
||||||
if ((snapshot = create_snapshot( req->flags )))
|
|
||||||
{
|
|
||||||
reply->handle = alloc_handle( current->process, snapshot, 0, req->attributes );
|
|
||||||
release_object( snapshot );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get the next process from a snapshot */
|
|
||||||
DECL_HANDLER(next_process)
|
|
||||||
{
|
|
||||||
struct snapshot *snapshot;
|
|
||||||
|
|
||||||
if ((snapshot = (struct snapshot *)get_handle_obj( current->process, req->handle,
|
|
||||||
0, &snapshot_ops )))
|
|
||||||
{
|
|
||||||
if (req->reset) snapshot->process_pos = 0;
|
|
||||||
snapshot_next_process( snapshot, reply );
|
|
||||||
release_object( snapshot );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get the next thread from a snapshot */
|
|
||||||
DECL_HANDLER(next_thread)
|
|
||||||
{
|
|
||||||
struct snapshot *snapshot;
|
|
||||||
|
|
||||||
if ((snapshot = (struct snapshot *)get_handle_obj( current->process, req->handle,
|
|
||||||
0, &snapshot_ops )))
|
|
||||||
{
|
|
||||||
if (req->reset) snapshot->thread_pos = 0;
|
|
||||||
snapshot_next_thread( snapshot, reply );
|
|
||||||
release_object( snapshot );
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1299,30 +1299,6 @@ static unsigned int get_context_system_regs( enum cpu_type cpu )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* take a snapshot of currently running threads */
|
|
||||||
struct thread_snapshot *thread_snap( int *count )
|
|
||||||
{
|
|
||||||
struct thread_snapshot *snapshot, *ptr;
|
|
||||||
struct thread *thread;
|
|
||||||
int total = 0;
|
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY( thread, &thread_list, struct thread, entry )
|
|
||||||
if (thread->state != TERMINATED) total++;
|
|
||||||
if (!total || !(snapshot = mem_alloc( sizeof(*snapshot) * total ))) return NULL;
|
|
||||||
ptr = snapshot;
|
|
||||||
LIST_FOR_EACH_ENTRY( thread, &thread_list, struct thread, entry )
|
|
||||||
{
|
|
||||||
if (thread->state == TERMINATED) continue;
|
|
||||||
ptr->thread = thread;
|
|
||||||
ptr->count = thread->obj.refcount;
|
|
||||||
ptr->priority = thread->priority;
|
|
||||||
grab_object( thread );
|
|
||||||
ptr++;
|
|
||||||
}
|
|
||||||
*count = total;
|
|
||||||
return snapshot;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* gets the current impersonation token */
|
/* gets the current impersonation token */
|
||||||
struct token *thread_get_impersonation_token( struct thread *thread )
|
struct token *thread_get_impersonation_token( struct thread *thread )
|
||||||
{
|
{
|
||||||
|
|
|
@ -93,13 +93,6 @@ struct thread
|
||||||
WCHAR *desc; /* thread description string */
|
WCHAR *desc; /* thread description string */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct thread_snapshot
|
|
||||||
{
|
|
||||||
struct thread *thread; /* thread ptr */
|
|
||||||
int count; /* thread refcount */
|
|
||||||
int priority; /* priority class */
|
|
||||||
};
|
|
||||||
|
|
||||||
extern struct thread *current;
|
extern struct thread *current;
|
||||||
|
|
||||||
/* thread functions */
|
/* thread functions */
|
||||||
|
@ -125,7 +118,6 @@ extern int thread_queue_apc( struct process *process, struct thread *thread, str
|
||||||
extern void thread_cancel_apc( struct thread *thread, struct object *owner, enum apc_type type );
|
extern void thread_cancel_apc( struct thread *thread, struct object *owner, enum apc_type type );
|
||||||
extern int thread_add_inflight_fd( struct thread *thread, int client, int server );
|
extern int thread_add_inflight_fd( struct thread *thread, int client, int server );
|
||||||
extern int thread_get_inflight_fd( struct thread *thread, int client );
|
extern int thread_get_inflight_fd( struct thread *thread, int client );
|
||||||
extern struct thread_snapshot *thread_snap( int *count );
|
|
||||||
extern struct token *thread_get_impersonation_token( struct thread *thread );
|
extern struct token *thread_get_impersonation_token( struct thread *thread );
|
||||||
extern int set_thread_affinity( struct thread *thread, affinity_t affinity );
|
extern int set_thread_affinity( struct thread *thread, affinity_t affinity );
|
||||||
extern int is_cpu_supported( enum cpu_type cpu );
|
extern int is_cpu_supported( enum cpu_type cpu );
|
||||||
|
|
|
@ -2397,51 +2397,6 @@ static void dump_is_same_mapping_request( const struct is_same_mapping_request *
|
||||||
dump_uint64( ", base2=", &req->base2 );
|
dump_uint64( ", base2=", &req->base2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dump_create_snapshot_request( const struct create_snapshot_request *req )
|
|
||||||
{
|
|
||||||
fprintf( stderr, " attributes=%08x", req->attributes );
|
|
||||||
fprintf( stderr, ", flags=%08x", req->flags );
|
|
||||||
}
|
|
||||||
|
|
||||||
static void dump_create_snapshot_reply( const struct create_snapshot_reply *req )
|
|
||||||
{
|
|
||||||
fprintf( stderr, " handle=%04x", req->handle );
|
|
||||||
}
|
|
||||||
|
|
||||||
static void dump_next_process_request( const struct next_process_request *req )
|
|
||||||
{
|
|
||||||
fprintf( stderr, " handle=%04x", req->handle );
|
|
||||||
fprintf( stderr, ", reset=%d", req->reset );
|
|
||||||
}
|
|
||||||
|
|
||||||
static void dump_next_process_reply( const struct next_process_reply *req )
|
|
||||||
{
|
|
||||||
fprintf( stderr, " count=%d", req->count );
|
|
||||||
fprintf( stderr, ", pid=%04x", req->pid );
|
|
||||||
fprintf( stderr, ", ppid=%04x", req->ppid );
|
|
||||||
fprintf( stderr, ", threads=%d", req->threads );
|
|
||||||
fprintf( stderr, ", priority=%d", req->priority );
|
|
||||||
fprintf( stderr, ", handles=%d", req->handles );
|
|
||||||
fprintf( stderr, ", unix_pid=%d", req->unix_pid );
|
|
||||||
dump_varargs_unicode_str( ", filename=", cur_size );
|
|
||||||
}
|
|
||||||
|
|
||||||
static void dump_next_thread_request( const struct next_thread_request *req )
|
|
||||||
{
|
|
||||||
fprintf( stderr, " handle=%04x", req->handle );
|
|
||||||
fprintf( stderr, ", reset=%d", req->reset );
|
|
||||||
}
|
|
||||||
|
|
||||||
static void dump_next_thread_reply( const struct next_thread_reply *req )
|
|
||||||
{
|
|
||||||
fprintf( stderr, " count=%d", req->count );
|
|
||||||
fprintf( stderr, ", pid=%04x", req->pid );
|
|
||||||
fprintf( stderr, ", tid=%04x", req->tid );
|
|
||||||
fprintf( stderr, ", base_pri=%d", req->base_pri );
|
|
||||||
fprintf( stderr, ", delta_pri=%d", req->delta_pri );
|
|
||||||
fprintf( stderr, ", unix_tid=%d", req->unix_tid );
|
|
||||||
}
|
|
||||||
|
|
||||||
static void dump_list_processes_request( const struct list_processes_request *req )
|
static void dump_list_processes_request( const struct list_processes_request *req )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -4752,9 +4707,6 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
|
||||||
(dump_func)dump_get_mapping_committed_range_request,
|
(dump_func)dump_get_mapping_committed_range_request,
|
||||||
(dump_func)dump_add_mapping_committed_range_request,
|
(dump_func)dump_add_mapping_committed_range_request,
|
||||||
(dump_func)dump_is_same_mapping_request,
|
(dump_func)dump_is_same_mapping_request,
|
||||||
(dump_func)dump_create_snapshot_request,
|
|
||||||
(dump_func)dump_next_process_request,
|
|
||||||
(dump_func)dump_next_thread_request,
|
|
||||||
(dump_func)dump_list_processes_request,
|
(dump_func)dump_list_processes_request,
|
||||||
(dump_func)dump_wait_debug_event_request,
|
(dump_func)dump_wait_debug_event_request,
|
||||||
(dump_func)dump_queue_exception_event_request,
|
(dump_func)dump_queue_exception_event_request,
|
||||||
|
@ -5052,9 +5004,6 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
|
||||||
(dump_func)dump_get_mapping_committed_range_reply,
|
(dump_func)dump_get_mapping_committed_range_reply,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
(dump_func)dump_create_snapshot_reply,
|
|
||||||
(dump_func)dump_next_process_reply,
|
|
||||||
(dump_func)dump_next_thread_reply,
|
|
||||||
(dump_func)dump_list_processes_reply,
|
(dump_func)dump_list_processes_reply,
|
||||||
(dump_func)dump_wait_debug_event_reply,
|
(dump_func)dump_wait_debug_event_reply,
|
||||||
(dump_func)dump_queue_exception_event_reply,
|
(dump_func)dump_queue_exception_event_reply,
|
||||||
|
@ -5352,9 +5301,6 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
|
||||||
"get_mapping_committed_range",
|
"get_mapping_committed_range",
|
||||||
"add_mapping_committed_range",
|
"add_mapping_committed_range",
|
||||||
"is_same_mapping",
|
"is_same_mapping",
|
||||||
"create_snapshot",
|
|
||||||
"next_process",
|
|
||||||
"next_thread",
|
|
||||||
"list_processes",
|
"list_processes",
|
||||||
"wait_debug_event",
|
"wait_debug_event",
|
||||||
"queue_exception_event",
|
"queue_exception_event",
|
||||||
|
@ -5649,7 +5595,6 @@ static const struct
|
||||||
{ "NO_IMPERSONATION_TOKEN", STATUS_NO_IMPERSONATION_TOKEN },
|
{ "NO_IMPERSONATION_TOKEN", STATUS_NO_IMPERSONATION_TOKEN },
|
||||||
{ "NO_MEMORY", STATUS_NO_MEMORY },
|
{ "NO_MEMORY", STATUS_NO_MEMORY },
|
||||||
{ "NO_MORE_ENTRIES", STATUS_NO_MORE_ENTRIES },
|
{ "NO_MORE_ENTRIES", STATUS_NO_MORE_ENTRIES },
|
||||||
{ "NO_MORE_FILES", STATUS_NO_MORE_FILES },
|
|
||||||
{ "NO_SUCH_DEVICE", STATUS_NO_SUCH_DEVICE },
|
{ "NO_SUCH_DEVICE", STATUS_NO_SUCH_DEVICE },
|
||||||
{ "NO_SUCH_FILE", STATUS_NO_SUCH_FILE },
|
{ "NO_SUCH_FILE", STATUS_NO_SUCH_FILE },
|
||||||
{ "NO_TOKEN", STATUS_NO_TOKEN },
|
{ "NO_TOKEN", STATUS_NO_TOKEN },
|
||||||
|
|
Loading…
Reference in New Issue