-asmlinkage long sys_marker(char __user *name, char __user *format,
- char __user *state, int reg)
-{
- struct user_marker *umark;
- long len;
- struct marker_entry *entry;
- int ret = 0;
-
- printk(KERN_DEBUG "Program %s %s marker [%p, %p]\n",
- current->comm, reg ? "registers" : "unregisters",
- name, state);
- if (reg) {
- umark = kmalloc(sizeof(struct user_marker), GFP_KERNEL);
- umark->name[MAX_USER_MARKER_NAME_LEN - 1] = '\0';
- umark->format[MAX_USER_MARKER_FORMAT_LEN - 1] = '\0';
- umark->state = state;
- len = strncpy_from_user(umark->name, name,
- MAX_USER_MARKER_NAME_LEN - 1);
- if (len < 0) {
- ret = -EFAULT;
- goto error;
- }
- len = strncpy_from_user(umark->format, format,
- MAX_USER_MARKER_FORMAT_LEN - 1);
- if (len < 0) {
- ret = -EFAULT;
- goto error;
- }
- printk(KERN_DEBUG "Marker name : %s, format : %s", umark->name,
- umark->format);
- mutex_lock(&markers_mutex);
- entry = get_marker("userspace", umark->name);
- if (entry) {
- if (entry->format &&
- strcmp(entry->format, umark->format) != 0) {
- printk(" error, wrong format in process %s",
- current->comm);
- ret = -EPERM;
- goto error_unlock;
- }
- printk(" %s", !!entry->refcount
- ? "enabled" : "disabled");
- if (put_user(!!entry->refcount, state)) {
- ret = -EFAULT;
- goto error_unlock;
- }
- printk("\n");
- } else {
- printk(" disabled\n");
- if (put_user(0, umark->state)) {
- printk(KERN_WARNING
- "Marker in %s caused a fault\n",
- current->comm);
- goto error_unlock;
- }
- }
- mutex_lock(¤t->group_leader->user_markers_mutex);
- hlist_add_head(&umark->hlist,
- ¤t->group_leader->user_markers);
- current->group_leader->user_markers_sequence++;
- mutex_unlock(¤t->group_leader->user_markers_mutex);
- mutex_unlock(&markers_mutex);
- } else {
- mutex_lock(¤t->group_leader->user_markers_mutex);
- free_user_marker(state,
- ¤t->group_leader->user_markers);
- current->group_leader->user_markers_sequence++;
- mutex_unlock(¤t->group_leader->user_markers_mutex);
- }
- goto end;
-error_unlock:
- mutex_unlock(&markers_mutex);
-error:
- kfree(umark);
-end:
- return ret;
-}
-
-/*
- * Types :
- * string : 0
- */
-asmlinkage long sys_trace(int type, uint16_t id,
- char __user *ubuf)
-{
- long ret = -EPERM;
- char *page;
- int len;
-
- switch (type) {
- case 0: /* String */
- ret = -ENOMEM;
- page = (char *)__get_free_page(GFP_TEMPORARY);
- if (!page)
- goto string_out;
- len = strncpy_from_user(page, ubuf, PAGE_SIZE);
- if (len < 0) {
- ret = -EFAULT;
- goto string_err;
- }
- trace_mark(userspace, string, "string %s", page);
-string_err:
- free_page((unsigned long) page);
-string_out:
- break;
- default:
- break;
- }
- return ret;
-}
-
-static void marker_update_processes(void)
-{
- struct task_struct *g, *t;
-
- /*
- * markers_mutex is taken to protect the p->user_markers read.
- */
- mutex_lock(&markers_mutex);
- read_lock(&tasklist_lock);
- for_each_process(g) {
- WARN_ON(!thread_group_leader(g));
- if (hlist_empty(&g->user_markers))
- continue;
- if (strcmp(g->comm, "testprog") == 0)
- printk(KERN_DEBUG "set update pending for testprog\n");
- t = g;
- do {
- /* TODO : implement this thread flag in each arch. */
- set_tsk_thread_flag(t, TIF_MARKER_PENDING);
- } while ((t = next_thread(t)) != g);
- }
- read_unlock(&tasklist_lock);
- mutex_unlock(&markers_mutex);
-}
+//ust// asmlinkage long sys_marker(char __user *name, char __user *format,
+//ust// char __user *state, int reg)
+//ust// {
+//ust// struct user_marker *umark;
+//ust// long len;
+//ust// struct marker_entry *entry;
+//ust// int ret = 0;
+//ust//
+//ust// printk(KERN_DEBUG "Program %s %s marker [%p, %p]\n",
+//ust// current->comm, reg ? "registers" : "unregisters",
+//ust// name, state);
+//ust// if (reg) {
+//ust// umark = kmalloc(sizeof(struct user_marker), GFP_KERNEL);
+//ust// umark->name[MAX_USER_MARKER_NAME_LEN - 1] = '\0';
+//ust// umark->format[MAX_USER_MARKER_FORMAT_LEN - 1] = '\0';
+//ust// umark->state = state;
+//ust// len = strncpy_from_user(umark->name, name,
+//ust// MAX_USER_MARKER_NAME_LEN - 1);
+//ust// if (len < 0) {
+//ust// ret = -EFAULT;
+//ust// goto error;
+//ust// }
+//ust// len = strncpy_from_user(umark->format, format,
+//ust// MAX_USER_MARKER_FORMAT_LEN - 1);
+//ust// if (len < 0) {
+//ust// ret = -EFAULT;
+//ust// goto error;
+//ust// }
+//ust// printk(KERN_DEBUG "Marker name : %s, format : %s", umark->name,
+//ust// umark->format);
+//ust// mutex_lock(&markers_mutex);
+//ust// entry = get_marker("userspace", umark->name);
+//ust// if (entry) {
+//ust// if (entry->format &&
+//ust// strcmp(entry->format, umark->format) != 0) {
+//ust// printk(" error, wrong format in process %s",
+//ust// current->comm);
+//ust// ret = -EPERM;
+//ust// goto error_unlock;
+//ust// }
+//ust// printk(" %s", !!entry->refcount
+//ust// ? "enabled" : "disabled");
+//ust// if (put_user(!!entry->refcount, state)) {
+//ust// ret = -EFAULT;
+//ust// goto error_unlock;
+//ust// }
+//ust// printk("\n");
+//ust// } else {
+//ust// printk(" disabled\n");
+//ust// if (put_user(0, umark->state)) {
+//ust// printk(KERN_WARNING
+//ust// "Marker in %s caused a fault\n",
+//ust// current->comm);
+//ust// goto error_unlock;
+//ust// }
+//ust// }
+//ust// mutex_lock(¤t->group_leader->user_markers_mutex);
+//ust// hlist_add_head(&umark->hlist,
+//ust// ¤t->group_leader->user_markers);
+//ust// current->group_leader->user_markers_sequence++;
+//ust// mutex_unlock(¤t->group_leader->user_markers_mutex);
+//ust// mutex_unlock(&markers_mutex);
+//ust// } else {
+//ust// mutex_lock(¤t->group_leader->user_markers_mutex);
+//ust// free_user_marker(state,
+//ust// ¤t->group_leader->user_markers);
+//ust// current->group_leader->user_markers_sequence++;
+//ust// mutex_unlock(¤t->group_leader->user_markers_mutex);
+//ust// }
+//ust// goto end;
+//ust// error_unlock:
+//ust// mutex_unlock(&markers_mutex);
+//ust// error:
+//ust// kfree(umark);
+//ust// end:
+//ust// return ret;
+//ust// }
+//ust//
+//ust// /*
+//ust// * Types :
+//ust// * string : 0
+//ust// */
+//ust// asmlinkage long sys_trace(int type, uint16_t id,
+//ust// char __user *ubuf)
+//ust// {
+//ust// long ret = -EPERM;
+//ust// char *page;
+//ust// int len;
+//ust//
+//ust// switch (type) {
+//ust// case 0: /* String */
+//ust// ret = -ENOMEM;
+//ust// page = (char *)__get_free_page(GFP_TEMPORARY);
+//ust// if (!page)
+//ust// goto string_out;
+//ust// len = strncpy_from_user(page, ubuf, PAGE_SIZE);
+//ust// if (len < 0) {
+//ust// ret = -EFAULT;
+//ust// goto string_err;
+//ust// }
+//ust// trace_mark(userspace, string, "string %s", page);
+//ust// string_err:
+//ust// free_page((unsigned long) page);
+//ust// string_out:
+//ust// break;
+//ust// default:
+//ust// break;
+//ust// }
+//ust// return ret;
+//ust// }
+
+//ust// static void marker_update_processes(void)
+//ust// {
+//ust// struct task_struct *g, *t;
+//ust//
+//ust// /*
+//ust// * markers_mutex is taken to protect the p->user_markers read.
+//ust// */
+//ust// mutex_lock(&markers_mutex);
+//ust// read_lock(&tasklist_lock);
+//ust// for_each_process(g) {
+//ust// WARN_ON(!thread_group_leader(g));
+//ust// if (hlist_empty(&g->user_markers))
+//ust// continue;
+//ust// if (strcmp(g->comm, "testprog") == 0)
+//ust// printk(KERN_DEBUG "set update pending for testprog\n");
+//ust// t = g;
+//ust// do {
+//ust// /* TODO : implement this thread flag in each arch. */
+//ust// set_tsk_thread_flag(t, TIF_MARKER_PENDING);
+//ust// } while ((t = next_thread(t)) != g);
+//ust// }
+//ust// read_unlock(&tasklist_lock);
+//ust// mutex_unlock(&markers_mutex);
+//ust// }