summaryrefslogtreecommitdiff
path: root/ace/Process.i
blob: 6d0859c304f3ce34ffd2798ce9f12a7c8d8faab7 (plain)
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/* -*- C++ -*- */
// $Id$

#if defined (ACE_WIN32)
ACE_INLINE PROCESS_INFORMATION 
ACE_ProcessEx::process_info (void)
{
  return process_info_;
}
#endif /* ACE_WIN32 */


ACE_INLINE pid_t
ACE_ProcessEx::getpid (void)
{
#if defined (ACE_WIN32)
  return process_info_.dwProcessId;
#else /* ACE_WIN32 */
  return child_id_;
#endif /* ACE_WIN32 */
}

ACE_INLINE int
ACE_ProcessEx::kill (int signum)
{
  return ACE_OS::kill (this->getpid (), signum);
}

// ************************************************************

ACE_INLINE pid_t
ACE_Process::getpid (void)
{
#if defined (ACE_WIN32)
  return process_info_.dwProcessId;
#else /* ACE_WIN32 */
  return child_id_;
#endif /* ACE_WIN32 */
}

ACE_INLINE int
ACE_Process::kill (int signum)
{
  return ACE_OS::kill (this->getpid (), signum);
}

// ************************************************************

#if defined (ACE_WIN32)

ACE_INLINE int
ACE_Process_Options::new_console (void) const
{
  return new_console_;
}

ACE_INLINE void
ACE_Process_Options::new_console (int nc)
{
  new_console_ = nc;
}

ACE_INLINE STARTUPINFO *
ACE_Process_Options::startup_info (void)
{
  return &startup_info_;
}

ACE_INLINE const LPSECURITY_ATTRIBUTES 
ACE_Process_Options::get_process_attributes (void) const
{  
  return process_attributes_;
}
 
ACE_INLINE LPSECURITY_ATTRIBUTES 
ACE_Process_Options::set_process_attributes (void)
{
  process_attributes_ = &security_buf1_;
  return process_attributes_;
}
 
ACE_INLINE const LPSECURITY_ATTRIBUTES 
ACE_Process_Options::get_thread_attributes (void) const
{
  return thread_attributes_;
}

ACE_INLINE LPSECURITY_ATTRIBUTES 
ACE_Process_Options::set_thread_attributes (void)
{
  thread_attributes_ = &security_buf2_;
  return thread_attributes_;
}


ACE_INLINE int
ACE_Process_Options::handle_inheritence (void)
{
  return handle_inheritence_;
}

ACE_INLINE void
ACE_Process_Options::handle_inheritence (int hi)
{
  handle_inheritence_ = hi;
}

#else /* !defined (ACE_WIN32) */

ACE_INLINE ACE_HANDLE
ACE_Process_Options::get_stdin (void)
{
  return stdin_;
}

ACE_INLINE ACE_HANDLE 
ACE_Process_Options::get_stdout (void)
{
  return stdout_;
}

ACE_INLINE ACE_HANDLE 
ACE_Process_Options::get_stderr (void)
{
  return stderr_;
}

#endif /* ACE_WIN32 */

ACE_INLINE LPTSTR
ACE_Process_Options::cl_options_buf (void)
{
  return cl_options_;
}

ACE_INLINE LPTSTR 
ACE_Process_Options::working_directory (void)
{
  if (working_directory_[0] == '\0')
    return 0;
  else
    return working_directory_;
}

ACE_INLINE void
ACE_Process_Options::working_directory (const TCHAR *wd)
{
  ACE_OS::strcpy (working_directory_, wd);
}

ACE_INLINE LPCTSTR
ACE_Process_Options::path (void) const
{
  return path_;
}

ACE_INLINE void
ACE_Process_Options::path (LPCTSTR p)
{
  ACE_OS::strcpy (path_, p);
}