Add support for UST application registration
[lttng-tools.git] / ltt-sessiond / traceable-app.h
CommitLineData
91d76f53
DG
1/*
2 * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca>
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
82a3637f
DG
6 * as published by the Free Software Foundation; only version 2
7 * of the License.
91d76f53
DG
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19#ifndef _TRACEABLE_APP_H
20#define _TRACEABLE_APP_H
21
099e26bd 22#include <stdint.h>
1e307fab
DG
23#include <urcu/list.h>
24
099e26bd
DG
25/*
26 * Application registration data structure.
27 */
28struct ust_register_msg {
29 uint32_t major;
30 uint32_t minor;
31 pid_t pid;
32 pid_t ppid;
33 uid_t uid;
34 gid_t gid;
35 char name[16];
36};
37
38/*
39 * Traceable application list.
40 */
91d76f53 41struct ltt_traceable_app_list {
099e26bd
DG
42 /*
43 * This lock protects any read/write access to the list and count (which is
44 * basically the list size). All public functions in traceable-app.c
45 * acquire this lock and release it before returning. If none of those
46 * functions are used, the lock MUST be acquired in order to iterate or/and
47 * do any actions on that list.
48 */
49 pthread_mutex_t lock;
50
51 /*
52 * Number of element in the list. The session list lock MUST be acquired if
53 * this counter is used when iterating over the session list.
54 */
55 unsigned int count;
56
57 /* Linked list head */
91d76f53
DG
58 struct cds_list_head head;
59};
60
050349bb
DG
61/* Registered traceable applications. Libust registers to the session daemon
62 * and a linked list is kept of all running traceable app.
91d76f53
DG
63 */
64struct ltt_traceable_app {
099e26bd 65 int sock; /* Communication socket with the application */
91d76f53 66 pid_t pid;
099e26bd
DG
67 pid_t ppid;
68 uid_t uid; /* User ID that owns the apps */
69 gid_t gid; /* Group ID that owns the apps */
70 uint32_t v_major; /* Verion major number */
71 uint32_t v_minor; /* Verion minor number */
72 char name[17]; /* Process name (short) */
73 struct cds_list_head list;
91d76f53
DG
74};
75
099e26bd
DG
76int register_traceable_app(struct ust_register_msg *msg, int sock);
77void unregister_traceable_app(int sock);
91d76f53
DG
78unsigned int get_app_count(void);
79
099e26bd
DG
80void lock_apps_list(void);
81void unlock_apps_list(void);
82void clean_traceable_apps_list(void);
83struct ltt_traceable_app_list *get_traceable_apps_list(void);
84
91d76f53 85#endif /* _TRACEABLE_APP_H */
This page took 0.037315 seconds and 4 git commands to generate.