blob: 9fa69de9eeda4e37b364c19201935963ba6ed9c1 [file] [log] [blame]
Nathan Harmatabf98f392016-01-07 22:58:29 +00001// Copyright 2016 The Bazel 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.
Nathan Harmatabf98f392016-01-07 22:58:29 +000014
michajlof40241c2019-07-17 17:43:15 -070015#ifndef BAZEL_SRC_MAIN_CPP_SERVER_PROCESS_INFO_H_
16#define BAZEL_SRC_MAIN_CPP_SERVER_PROCESS_INFO_H_
Nathan Harmatabf98f392016-01-07 22:58:29 +000017
Nathan Harmatabf98f392016-01-07 22:58:29 +000018#include <sys/types.h>
laszlocsomor6f665392019-08-27 08:15:51 -070019
Nathan Harmatabf98f392016-01-07 22:58:29 +000020#include <string>
21#include <vector>
22
laszlocsomor6f665392019-08-27 08:15:51 -070023#include "src/main/cpp/util/path.h"
Laszlo Csomor3b89d2d2016-11-28 14:04:27 +000024#include "src/main/cpp/util/port.h" // pid_t on Windows/MSVC
25
Nathan Harmatabf98f392016-01-07 22:58:29 +000026namespace blaze {
27
michajlof40241c2019-07-17 17:43:15 -070028// Encapsulates information around the blaze server process and its
29// configuration.
30class ServerProcessInfo final {
31 public:
laszlocsomor6f665392019-08-27 08:15:51 -070032 ServerProcessInfo(const blaze_util::Path &output_base,
33 const blaze_util::Path &server_jvm_out);
Thiago Farina676cb9f2016-10-06 11:00:43 +000034
michajlof40241c2019-07-17 17:43:15 -070035 // When running as a daemon, where the deamonized server's stdout and stderr
36 // should be written.
laszlocsomor6f665392019-08-27 08:15:51 -070037 const blaze_util::Path jvm_log_file_;
michajlof74f9fe2018-01-29 09:06:44 -080038
39 // Whether or not the jvm_log_file should be opened with O_APPEND.
michajlof40241c2019-07-17 17:43:15 -070040 const bool jvm_log_file_append_;
Nathan Harmatabf98f392016-01-07 22:58:29 +000041
jingwen68c57f02018-11-21 16:17:17 -080042 // TODO(laszlocsomor) 2016-11-28: move pid_t usage out of here and wherever
Laszlo Csomor3b89d2d2016-11-28 14:04:27 +000043 // else it appears. Find some way to not have to declare a pid_t here, either
44 // by making PID handling platform-independent or some other idea.
michajlof40241c2019-07-17 17:43:15 -070045 pid_t server_pid_;
Nathan Harmatabf98f392016-01-07 22:58:29 +000046};
47
48} // namespace blaze
Thiago Farina319fd3a2016-01-14 19:42:24 +000049
michajlof40241c2019-07-17 17:43:15 -070050#endif // BAZEL_SRC_MAIN_CPP_SERVER_PROCESS_INFO_H_