summaryrefslogtreecommitdiff
path: root/ace/Process.i
blob: 13d1ba7a3ef45754a5ad35da64278b227f1f4c9d (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
/* -*- C++ -*- */
// $Id$

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


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)
{
#if defined (ACE_WIN32) || defined (CHORUS)
  ACE_UNUSED_ARG (signum);
  ACE_NOTSUP_RETURN (-1);
#else
  return ACE_OS::kill (this->getpid (), signum);
#endif /* ACE_WIN32 */
}

ACE_INLINE int
ACE_Process::terminate (void)
{
  return ACE::terminate_process (this->getpid ());
}

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

ACE_INLINE u_long
ACE_Process_Options::creation_flags (void) const
{
#if defined (UNICODE)  
  return creation_flags_ | CREATE_UNICODE_ENVIRONMENT;
#else
  return creation_flags_;
#endif /* UNICODE */
}

ACE_INLINE void
ACE_Process_Options::creation_flags (u_long cf)
{
  creation_flags_ = cf;
}

// ******************************
#if defined (ACE_WIN32)

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::command_line_buf (void)
{
  return command_line_buf_;
}

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 (LPCTSTR wd)
{
  ACE_OS::strcpy (working_directory_, wd);
}