4 * Copyright (c) 2014 Samsung Electronics Co., Ltd. All rights reserved.
8 * Vyacheslav Cherkashin <v.cherkashin@samsung.com>
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
23 * - Samsung RnD Institute Russia
37 #include "da_protocol.h"
40 #define UNKNOWN_PID ((pid_t)(-1))
41 #define UNKNOWN_FD (-1)
45 enum app_type_t app_type; /* calculated when connecting */
46 int64_t allocmem; /* written only by recv thread */
47 pid_t pid; /* written only by recv thread */
48 pid_t ppid; /* written only by recv thread */
49 int socket; /* written only by main thread */
50 pthread_t recv_thread; /* written only by main thread */
51 int event_fd; /* for thread communication
52 * (from recv thread to main thread) */
53 int initial_log; /* written only by main thread */
54 Ecore_Fd_Handler *handler; /* calculated when connecting */
58 struct target *target_ctor(void);
59 void target_dtor(struct target *t);
61 int target_accept(struct target *t, int sockfd);
63 int target_send_msg(struct target *t, struct msg_target_t *msg);
64 int target_recv_msg(struct target *t, struct msg_target_t *msg);
67 int target_start(struct target *t, void *(*start_routine) (void *));
68 int target_wait(struct target *t);
71 pid_t target_get_pid(struct target *t);
72 void target_set_pid(struct target *t, pid_t pid);
74 pid_t target_get_ppid(struct target *t);
75 void target_set_ppid(struct target *t, pid_t ppid);
78 void target_cnt_set(int cnt);
79 int target_cnt_get(void);
80 int target_cnt_sub_and_fetch(void);
82 struct target *target_get(int i);
85 int target_send_msg_to_all(struct msg_target_t *msg);
86 void target_wait_all(void);
87 uint64_t target_get_total_alloc(pid_t pid);
90 #endif /* _TARGER_H_ */