-//ust// EXPORT_SYMBOL_GPL(ust_marker_iter_reset);
-
-#ifdef CONFIG_UST_MARKER_USERSPACE
-/*
- * must be called with current->user_ust_marker_mutex held
- */
-static void free_user_ust_marker(char __user *state, struct cds_hlist_head *head)
-{
- struct user_ust_marker *umark;
- struct cds_hlist_node *pos, *n;
-
- cds_hlist_for_each_entry_safe(umark, pos, n, head, hlist) {
- if (umark->state == state) {
- cds_hlist_del(&umark->hlist);
- free(umark);
- }
- }
-}
-
-/*
- * Update current process.
- * Note that we have to wait a whole scheduler period before we are sure that
- * every running userspace threads have their ust_marker updated.
- * (synchronize_sched() can be used to insure this).
- */
-//ust// void ust_marker_update_process(void)
-//ust// {
-//ust// struct user_ust_marker *umark;
-//ust// struct hlist_node *pos;
-//ust// struct ust_marker_entry *entry;
-//ust//
-//ust// pthread_mutex_lock(&ust_marker_mutex);
-//ust// pthread_mutex_lock(¤t->group_leader->user_ust_marker_mutex);
-//ust// if (strcmp(current->comm, "testprog") == 0)
-//ust// DBG("do update pending for testprog");
-//ust// hlist_for_each_entry(umark, pos,
-//ust// ¤t->group_leader->user_ust_marker, hlist) {
-//ust// DBG("Updating ust_marker %s in %s", umark->name, current->comm);
-//ust// entry = get_ust_marker("userspace", umark->name);
-//ust// if (entry) {
-//ust// if (entry->format &&
-//ust// strcmp(entry->format, umark->format) != 0) {
-//ust// WARN("error, wrong format in process %s",
-//ust// current->comm);
-//ust// break;
-//ust// }
-//ust// if (put_user(!!entry->refcount, umark->state)) {
-//ust// WARN("ust_marker in %s caused a fault",
-//ust// current->comm);
-//ust// break;
-//ust// }
-//ust// } else {
-//ust// if (put_user(0, umark->state)) {
-//ust// WARN("ust_marker in %s caused a fault", current->comm);
-//ust// break;
-//ust// }
-//ust// }
-//ust// }
-//ust// clear_thread_flag(TIF_UST_MARKER_PENDING);
-//ust// pthread_mutex_unlock(¤t->group_leader->user_ust_marker_mutex);
-//ust// pthread_mutex_unlock(&ust_marker_mutex);
-//ust// }
-
-/*
- * Called at process exit and upon do_execve().
- * We assume that when the leader exits, no more references can be done to the
- * leader structure by the other threads.
- */
-void exit_user_ust_marker(struct task_struct *p)
-{
- struct user_ust_marker *umark;
- struct cds_hlist_node *pos, *n;
-
- if (thread_group_leader(p)) {
- pthread_mutex_lock(&ust_marker_mutex);
- pthread_mutex_lock(&p->user_ust_marker_mutex);
- cds_hlist_for_each_entry_safe(umark, pos, n, &p->user_ust_marker,
- hlist)
- free(umark);
- INIT_HLIST_HEAD(&p->user_ust_marker);
- p->user_ust_marker_sequence++;
- pthread_mutex_unlock(&p->user_ust_marker_mutex);
- pthread_mutex_unlock(&ust_marker_mutex);
- }
-}
-
-int is_ust_marker_enabled(const char *channel, const char *name)
-{
- struct ust_marker_entry *entry;
-
- pthread_mutex_lock(&ust_marker_mutex);
- entry = get_ust_marker(channel, name);
- pthread_mutex_unlock(&ust_marker_mutex);
-
- return entry && !!entry->refcount;
-}
-//ust// #endif
-
-int ust_marker_module_notify(struct notifier_block *self,
- unsigned long val, void *data)
-{
- struct module *mod = data;
-
- switch (val) {
- case MODULE_STATE_COMING:
- ust_marker_update_probe_range(mod->ust_marker,
- mod->ust_marker + mod->num_ust_marker);
- break;
- case MODULE_STATE_GOING:
- ust_marker_update_probe_range(mod->ust_marker,
- mod->ust_marker + mod->num_ust_marker);
- break;
- }
- return 0;
-}
-
-struct notifier_block ust_marker_module_nb = {
- .notifier_call = ust_marker_module_notify,
- .priority = 0,
-};
-
-//ust// static int init_ust_marker(void)
-//ust// {
-//ust// return register_module_notifier(&ust_marker_module_nb);
-//ust// }
-//ust// __initcall(init_ust_marker);
-/* TODO: call ust_marker_module_nb() when a library is linked at runtime (dlopen)? */
-
-#endif /* CONFIG_MODULES */