~mysql/mysql-server/mysql-6.0

« back to all changes in this revision

Viewing changes to innobase/os/os0proc.c

  • Committer: monty at mysql
  • Date: 2001-02-17 12:19:19 UTC
  • mto: (554.1.1)
  • mto: This revision was merged to the branch mainline in revision 556.
  • Revision ID: sp1r-monty@donna.mysql.com-20010217121919-07904
Added Innobase to source distribution

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/******************************************************
 
2
The interface to the operating system
 
3
process control primitives
 
4
 
 
5
(c) 1995 Innobase Oy
 
6
 
 
7
Created 9/30/1995 Heikki Tuuri
 
8
*******************************************************/
 
9
 
 
10
#include "os0proc.h"
 
11
#ifdef UNIV_NONINL
 
12
#include "os0proc.ic"
 
13
#endif
 
14
 
 
15
#ifdef __WIN__
 
16
#include <windows.h>
 
17
#endif
 
18
 
 
19
#include "ut0mem.h"
 
20
 
 
21
/********************************************************************
 
22
Allocates non-cacheable memory. */
 
23
 
 
24
void*
 
25
os_mem_alloc_nocache(
 
26
/*=================*/
 
27
                        /* out: allocated memory */
 
28
        ulint   n)      /* in: number of bytes */
 
29
{
 
30
#ifdef __WIN__
 
31
        void*   ptr;
 
32
 
 
33
        ptr = VirtualAlloc(NULL, n, MEM_COMMIT,
 
34
                                        PAGE_READWRITE | PAGE_NOCACHE);
 
35
        ut_a(ptr);
 
36
 
 
37
        return(ptr);
 
38
#else
 
39
        return(ut_malloc(n));
 
40
#endif
 
41
}
 
42
 
 
43
#ifdef notdefined
 
44
/********************************************************************
 
45
Creates a new process. */
 
46
 
 
47
ibool
 
48
os_process_create(
 
49
/*==============*/
 
50
        char*           name,   /* in: name of the executable to start
 
51
                                or its full path name */
 
52
        char*           cmd,    /* in: command line for the starting
 
53
                                process, or NULL if no command line
 
54
                                specified */
 
55
        os_process_t*   proc,   /* out: handle to the process */
 
56
        os_process_id_t* id)    /* out: process id */
 
57
 
 
58
{
 
59
        BOOL                    ret;
 
60
        PROCESS_INFORMATION     pinfo;
 
61
        STARTUPINFO             sinfo;
 
62
 
 
63
        /* The following assignments are default for the startupinfo
 
64
        structure */
 
65
        sinfo.cb                = sizeof(STARTUPINFO);
 
66
        sinfo.lpReserved        = NULL;
 
67
        sinfo.lpDesktop         = NULL;
 
68
        sinfo.cbReserved2       = 0;
 
69
        sinfo.lpReserved        = NULL;
 
70
        
 
71
        ret = CreateProcess(name,
 
72
                              cmd,
 
73
                              NULL,     /* No security attributes */
 
74
                              NULL,     /* No thread security attrs */
 
75
                              FALSE,    /* Do not inherit handles */
 
76
                              0,        /* No creation flags */
 
77
                              NULL,     /* No environment */
 
78
                              NULL,     /* Same current directory */
 
79
                              &sinfo,
 
80
                              &pinfo);
 
81
 
 
82
        *proc = pinfo.hProcess;
 
83
        *id   = pinfo.dwProcessId;
 
84
 
 
85
        return(ret);
 
86
}
 
87
 
 
88
/**************************************************************************
 
89
Exits a process. */
 
90
 
 
91
void
 
92
os_process_exit(
 
93
/*============*/
 
94
        ulint   code)   /* in: exit code */
 
95
{
 
96
        ExitProcess((UINT)code);
 
97
}
 
98
 
 
99
/**************************************************************************
 
100
Gets a process exit code. */
 
101
 
 
102
ibool
 
103
os_process_get_exit_code(
 
104
/*=====================*/
 
105
                                /* out: TRUE if succeed, FALSE if fail */
 
106
        os_process_t    proc,   /* in: handle to the process */
 
107
        ulint*          code)   /* out: exit code */
 
108
{
 
109
        DWORD           ex_code;
 
110
        BOOL            ret;
 
111
 
 
112
        ret = GetExitCodeProcess(proc, &ex_code);
 
113
 
 
114
        *code = (ulint)ex_code;
 
115
        
 
116
        return(ret);
 
117
}
 
118
#endif /* notdedfined */
 
119
 
 
120
/********************************************************************
 
121
Sets the priority boost for threads released from waiting within the current
 
122
process. */
 
123
 
 
124
void
 
125
os_process_set_priority_boost(
 
126
/*==========================*/
 
127
        ibool   do_boost)       /* in: TRUE if priority boost should be done,
 
128
                                FALSE if not */
 
129
{
 
130
#ifdef __WIN__
 
131
        ibool   no_boost;
 
132
 
 
133
        if (do_boost) {
 
134
                no_boost = FALSE;
 
135
        } else {
 
136
                no_boost = TRUE;
 
137
        }
 
138
 
 
139
        ut_a(TRUE == 1);
 
140
 
 
141
/* Does not do anything currently!
 
142
        SetProcessPriorityBoost(GetCurrentProcess(), no_boost);
 
143
*/
 
144
        printf(
 
145
        "Warning: process priority boost setting currently not functional!\n"
 
146
        );
 
147
#else
 
148
        UT_NOT_USED(do_boost);
 
149
#endif
 
150
}