rcu_read_unlock();
#endif /* 2.6.31 */
THIS->__retvalue = (long)t;
- CATCH_DEREF_FAULT();
%}
// Return the name of the given process id
struct task_struct *t = (struct task_struct *)(long)THIS->task;
#ifdef STAPCONF_TASK_UID
THIS->__retvalue = kread(&(t->gid));
+ CATCH_DEREF_FAULT();
#else
/* XXX: We can't easily kread this rcu-protected field. */
/* XXX: no task_gid() in 2.6.28 */
rcu_read_unlock();
THIS->__retvalue = cred->gid;
#endif
-
- CATCH_DEREF_FAULT();
%}
struct task_struct *t = (struct task_struct *)(long)THIS->task;
#ifdef STAPCONF_TASK_UID
THIS->__retvalue = kread(&(t->egid));
+ CATCH_DEREF_FAULT();
#else
/* XXX: We can't easily kread this rcu-protected field. */
/* XXX: no task_egid() in 2.6.28 */
rcu_read_unlock();
THIS->__retvalue = cred->egid;
#endif
- CATCH_DEREF_FAULT();
%}
struct task_struct *t = (struct task_struct *)(long)THIS->task;
#ifdef STAPCONF_TASK_UID
THIS->__retvalue = kread(&(t->uid));
+ CATCH_DEREF_FAULT();
#else
/* XXX: We can't easily kread this rcu-protected field. */
THIS->__retvalue = task_uid (t);
#endif
-
- CATCH_DEREF_FAULT();
%}
struct task_struct *t = (struct task_struct *)(long)THIS->task;
#ifdef STAPCONF_TASK_UID
THIS->__retvalue = kread(&(t->euid));
+ CATCH_DEREF_FAULT();
#else
/* XXX: We can't easily kread this rcu-protected field. */
THIS->__retvalue = task_euid (t);
#endif
- CATCH_DEREF_FAULT();
%}
function task_open_file_handles:long (task:long)
%( kernel_v >= "2.6.15" %?
%{ /* pure */
+ int locked = 0;
unsigned int count=0, fd, max;
struct task_struct *t;
struct files_struct *fs;
fs = kread(&(t->files));
f = kread(&(fs->fdt));
rcu_read_lock();
+ locked = 1;
max = kread(&(f->max_fds));
for (fd = 0; fd < max; fd++) {
if ( kread(&(f->fd[fd])) != NULL)
count ++;
}
- rcu_read_unlock();
THIS->__retvalue = count;
CATCH_DEREF_FAULT();
+ if (locked)
+ rcu_read_unlock();
%}
%:
%{ /* pure */
+ int locked = 0;
unsigned int count=0, fd, max;
struct task_struct *t;
struct files_struct *f;
t = (struct task_struct *)(long)THIS->task;
f = kread(&(t->files));
rcu_read_lock();
+ locked = 1;
max = kread(&(f->max_fds));
for (fd = 0; fd < max; fd++) {
if ( kread(&(f->fd[fd])) != NULL)
count ++;
}
- rcu_read_unlock();
THIS->__retvalue = count;
CATCH_DEREF_FAULT();
+ if (locked)
+ rcu_read_unlock();
%}
%)
function task_max_file_handles:long (task:long)
%( kernel_v >= "2.6.15" %?
%{ /* pure */
+ int locked = 0;
struct task_struct *t;
struct files_struct *fs;
struct fdtable *f;
fs = kread (&(t->files));
f = kread(&(fs->fdt));
rcu_read_lock();
+ locked = 1;
THIS->__retvalue = kread(&(f->max_fds));
- rcu_read_unlock();
CATCH_DEREF_FAULT();
+ if (locked)
+ rcu_read_unlock();
%}
%:
%{ /* pure */
+ int locked = 0;
struct task_struct *t;
struct files_struct *f;
t = (struct task_struct *)(long)THIS->task;
f = kread(&(t->files));
rcu_read_lock();
+ locked = 1;
THIS->__retvalue = kread(&(f->max_fds));
- rcu_read_unlock();
CATCH_DEREF_FAULT();
+ if (locked)
+ rcu_read_unlock();
%}
%)