1 /* Copyright 2016 The TensorFlow Authors. All Rights Reserved. 2 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14 ==============================================================================*/ 15 16 #ifndef TENSORFLOW_PLATFORM_SUBPROCESS_H_ 17 #define TENSORFLOW_PLATFORM_SUBPROCESS_H_ 18 19 namespace tensorflow { 20 21 // Channel identifiers. 22 enum Channel { 23 CHAN_STDIN = 0, 24 CHAN_STDOUT = 1, 25 CHAN_STDERR = 2, 26 }; 27 28 // Specify how a channel is handled. 29 enum ChannelAction { 30 // Close the file descriptor when the process starts. 31 // This is the default behavior. 32 ACTION_CLOSE, 33 34 // Make a pipe to the channel. It is used in the Communicate() method to 35 // transfer data between the parent and child processes. 36 ACTION_PIPE, 37 38 // Duplicate the parent's file descriptor. Useful if stdout/stderr should 39 // go to the same place that the parent writes it. 40 ACTION_DUPPARENT, 41 }; 42 43 // Supports spawning and killing child processes. 44 class SubProcess; 45 46 } // namespace tensorflow 47 48 #include "tensorflow/core/platform/platform.h" 49 50 #if defined(PLATFORM_GOOGLE) 51 #include "tensorflow/core/platform/google/subprocess.h" 52 #elif defined(PLATFORM_POSIX) || defined(PLATFORM_POSIX_ANDROID) || \ 53 defined(PLATFORM_GOOGLE_ANDROID) 54 #include "tensorflow/core/platform/posix/subprocess.h" 55 #elif defined(PLATFORM_WINDOWS) 56 #include "tensorflow/core/platform/windows/subprocess.h" 57 #else 58 #error Define the appropriate PLATFORM_<foo> macro for this platform 59 #endif 60 61 #endif // TENSORFLOW_PLATFORM_SUBPROCESS_H_ 62