1 /*
2 * Copyright 2022, The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #include "wrapper.hpp"
18
19 #include <android-base/unique_fd.h>
20
21 #include "tombstoned/tombstoned.h"
22
23 using android::base::unique_fd;
24
tombstoned_connect_files(pid_t pid,int & tombstoned_socket,int & text_output_fd,int & proto_output_fd,DebuggerdDumpType dump_type)25 bool tombstoned_connect_files(pid_t pid, int& tombstoned_socket, int& text_output_fd,
26 int& proto_output_fd, DebuggerdDumpType dump_type) {
27 unique_fd tombstoned_socket_unique, text_output_unique, proto_output_unique;
28
29 bool result = tombstoned_connect(pid, &tombstoned_socket_unique, &text_output_unique,
30 &proto_output_unique, dump_type);
31 if (result) {
32 tombstoned_socket = tombstoned_socket_unique.release();
33 text_output_fd = text_output_unique.release();
34 proto_output_fd = proto_output_unique.release();
35 }
36
37 return result;
38 }
39