2 * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca>
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; only version 2
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.
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.
19 #ifndef _TRACEABLE_APP_H
20 #define _TRACEABLE_APP_H
23 #include <urcu/list.h>
25 #include "trace-ust.h"
28 * Application registration data structure.
30 struct ust_register_msg
{
41 * Traceable application list.
43 struct ltt_traceable_app_list
{
45 * This lock protects any read/write access to the list and count (which is
46 * basically the list size). All public functions in traceable-app.c
47 * acquire this lock and release it before returning. If none of those
48 * functions are used, the lock MUST be acquired in order to iterate or/and
49 * do any actions on that list.
54 * Number of element in the list. The session list lock MUST be acquired if
55 * this counter is used when iterating over the session list.
59 /* Linked list head */
60 struct cds_list_head head
;
63 /* Registered traceable applications. Libust registers to the session daemon
64 * and a linked list is kept of all running traceable app.
66 struct ltt_traceable_app
{
67 int sock
; /* Communication socket with the application */
70 uid_t uid
; /* User ID that owns the apps */
71 gid_t gid
; /* Group ID that owns the apps */
72 uint32_t v_major
; /* Verion major number */
73 uint32_t v_minor
; /* Verion minor number */
74 char name
[17]; /* Process name (short) */
75 struct ltt_ust_channel_list channels
;
76 struct cds_list_head list
;
79 int register_traceable_app(struct ust_register_msg
*msg
, int sock
);
80 void unregister_traceable_app(int sock
);
81 unsigned int get_app_count(void);
83 void lock_apps_list(void);
84 void unlock_apps_list(void);
85 void clean_traceable_apps_list(void);
86 struct ltt_traceable_app_list
*get_traceable_apps_list(void);
88 struct ltt_traceable_app
*traceable_app_get_by_pid(pid_t pid
);
90 #endif /* _TRACEABLE_APP_H */