Skip to content

Instantly share code, notes, and snippets.

@erickt
Created October 26, 2010 01:15
Show Gist options
  • Save erickt/646130 to your computer and use it in GitHub Desktop.
Save erickt/646130 to your computer and use it in GitHub Desktop.
function __task_file_handle_filp:long(task:long, fd:long) %{ /* pure */
struct task_struct *p = (struct task_struct *)((long)THIS->task);
struct files_struct *files;
struct file *filp;
rcu_read_lock();
if ((files = kread(&p->files))) {
if ((filp = fcheck_files(files, THIS->fd))) {
THIS->__retvalue = (long)filp;
}
}
CATCH_DEREF_FAULT();
rcu_read_unlock();
%}
function startswith:long (haystack:string, needle:string)
%{
THIS->__retvalue = strstr(THIS->haystack, THIS->needle) == THIS->haystack;
%}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment