type
stringclasses
5 values
content
stringlengths
9
163k
functions
void vmd_decode(VmdVideoContext *s) { int i; unsigned int *palette32; unsigned char r, g, b; /* point to the start of the encoded data */ const unsigned char *p = s->buf + 16; const unsigned char *pb; unsigned char meth; unsigned char *dp; /* pointer to current frame */ unsigned ...
functions
int vmdvideo_decode_init(AVCodecContext *avctx) { VmdVideoContext *s = avctx->priv_data; int i; unsigned int *palette32; int palette_index = 0; unsigned char r, g, b; unsigned char *vmd_header; unsigned char *raw_palette; s->avctx = avctx; avctx->pix_fmt = PIX_FMT_PAL8; /* make...
functions
int vmdvideo_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; VmdVideoContext *s = avctx->priv_data; s->buf = buf; s->size = buf_size; ...
functions
int vmdvideo_decode_end(AVCodecContext *avctx) { VmdVideoContext *s = avctx->priv_data; if (s->prev_frame.data[0]) avctx->release_buffer(avctx, &s->prev_frame); av_free(s->unpack_buffer); return 0; }
functions
int vmdaudio_decode_init(AVCodecContext *avctx) { VmdAudioContext *s = avctx->priv_data; s->avctx = avctx; s->channels = avctx->channels; s->bits = avctx->bits_per_coded_sample; s->block_align = avctx->block_align; avctx->sample_fmt = SAMPLE_FMT_S16; av_log(s->avctx, AV_LOG_DEBUG, "%d chan...
functions
void vmdaudio_decode_audio(VmdAudioContext *s, unsigned char *data, const uint8_t *buf, int buf_size, int stereo) { int i; int chan = 0; int16_t *out = (int16_t*)data; for(i = 0; i < buf_size; i++) { if(buf[i] & 0x80) s->predictors[chan] -= vmdaudio_table[buf[i] & 0x7F]; ...
functions
int vmdaudio_loadsound(VmdAudioContext *s, unsigned char *data, const uint8_t *buf, int silence, int data_size) { int bytes_decoded = 0; int i; // if (silence) // av_log(s->avctx, AV_LOG_INFO, "silent block!\n"); if (s->channels == 2) { /* stereo handling */ if (silence) { ...
functions
int vmdaudio_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; VmdAudioContext *s = avctx->priv_data; unsigned char *output_samples = (unsigned...
functions
else if (buf[6] == 2) { /* initial chunk, may contain audio and silence */ uint32_t flags = AV_RB32(p); int raw_block_size = s->block_align * s->bits / 8; int silent_chunks; if(flags == 0xFFFFFFFF) silent_chunks = 32; else silent_chunks = av_log2(f...
functions
else if (buf[6] == 3) { /* silent chunk */ *data_size = vmdaudio_loadsound(s, output_samples, p, 1, 0); }
includes
#include <asm/uaccess.h>
includes
#include <linux/errno.h>
includes
#include <linux/time.h>
includes
#include <linux/proc_fs.h>
includes
#include <linux/stat.h>
includes
#include <linux/task_io_accounting_ops.h>
includes
#include <linux/init.h>
includes
#include <linux/capability.h>
includes
#include <linux/file.h>
includes
#include <linux/fdtable.h>
includes
#include <linux/string.h>
includes
#include <linux/seq_file.h>
includes
#include <linux/namei.h>
includes
#include <linux/mnt_namespace.h>
includes
#include <linux/mm.h>
includes
#include <linux/rcupdate.h>
includes
#include <linux/kallsyms.h>
includes
#include <linux/stacktrace.h>
includes
#include <linux/resource.h>
includes
#include <linux/module.h>
includes
#include <linux/mount.h>
includes
#include <linux/security.h>
includes
#include <linux/ptrace.h>
includes
#include <linux/tracehook.h>
includes
#include <linux/cgroup.h>
includes
#include <linux/cpuset.h>
includes
#include <linux/audit.h>
includes
#include <linux/poll.h>
includes
#include <linux/nsproxy.h>
includes
#include <linux/oom.h>
includes
#include <linux/elf.h>
includes
#include <linux/pid_namespace.h>
includes
#include <linux/fs_struct.h>
defines
#define NOD(NAME, MODE, IOP, FOP, OP) { \
defines
#define DIR(NAME, MODE, iops, fops) \
defines
#define LNK(NAME, get_link) \
defines
#define REG(NAME, MODE, fops) \
defines
#define INF(NAME, MODE, read) \
defines
#define ONE(NAME, MODE, show) \
defines
#define MAX_STACK_TRACE_DEPTH 64
defines
#define PROC_BLOCK_SIZE (3*1024) /* 4K page size but our output routines use some slack for overruns */
defines
#define mem_write NULL
defines
#define TMPBUFLEN 21
defines
#define PROC_FDINFO_MAX 64
defines
#define TGID_OFFSET (FIRST_PROCESS_ENTRY + ARRAY_SIZE(proc_base_stuff))
structs
struct pid_entry { char *name; int len; mode_t mode; const struct inode_operations *iop; const struct file_operations *fop; union proc_op op; };
structs
struct limit_names { char *name; char *unit; };
structs
struct tgid_iter { unsigned int tgid; struct task_struct *task; };
functions
int pid_entry_count_dirs(const struct pid_entry *entries, unsigned int n) { unsigned int i; unsigned int count; count = 0; for (i = 0; i < n; ++i) { if (S_ISDIR(entries[i].mode)) ++count; }
functions
int get_fs_path(struct task_struct *task, struct path *path, bool root) { struct fs_struct *fs; int result = -ENOENT; task_lock(task); fs = task->fs; if (fs) { read_lock(&fs->lock); *path = root ? fs->root : fs->pwd; path_get(path); read_unlock(&fs->lock); result = 0; }
functions
int get_nr_threads(struct task_struct *tsk) { unsigned long flags; int count = 0; if (lock_task_sighand(tsk, &flags)) { count = atomic_read(&tsk->signal->count); unlock_task_sighand(tsk, &flags); }
functions
int proc_cwd_link(struct inode *inode, struct path *path) { struct task_struct *task = get_proc_task(inode); int result = -ENOENT; if (task) { result = get_fs_path(task, path, 0); put_task_struct(task); }
functions
int proc_root_link(struct inode *inode, struct path *path) { struct task_struct *task = get_proc_task(inode); int result = -ENOENT; if (task) { result = get_fs_path(task, path, 1); put_task_struct(task); }
functions
int check_mem_permission(struct task_struct *task) { /* * A task can always look at itself, in case it chooses * to use system calls instead of load instructions. */ if (task == current) return 0; /* * If current is actively ptrace'ing, and would also be * permitted to freshly attach with ptrace now, pe...
functions
int proc_pid_cmdline(struct task_struct *task, char * buffer) { int res = 0; unsigned int len; struct mm_struct *mm = get_task_mm(task); if (!mm) goto out; if (!mm->arg_end) goto out_mm; /* Shh! No looking before we're done */ len = mm->arg_end - mm->arg_start; if (len > PAGE_SIZE) len = PAGE_SIZE; ...
functions
int proc_pid_auxv(struct task_struct *task, char *buffer) { int res = 0; struct mm_struct *mm = get_task_mm(task); if (mm) { unsigned int nwords = 0; do { nwords += 2; }
functions
int proc_pid_wchan(struct task_struct *task, char *buffer) { unsigned long wchan; char symname[KSYM_NAME_LEN]; wchan = get_wchan(task); if (lookup_symbol_name(wchan, symname) < 0) if (!ptrace_may_access(task, PTRACE_MODE_READ)) return 0; else return sprintf(buffer, "%lu", wchan); else return sprintf(...
functions
int proc_pid_stack(struct seq_file *m, struct pid_namespace *ns, struct pid *pid, struct task_struct *task) { struct stack_trace trace; unsigned long *entries; int i; entries = kmalloc(MAX_STACK_TRACE_DEPTH * sizeof(*entries), GFP_KERNEL); if (!entries) return -ENOMEM; trace.nr_entries = 0; trace.max_en...
functions
int proc_pid_schedstat(struct task_struct *task, char *buffer) { return sprintf(buffer, "%llu %llu %lu\n", (unsigned long long)task->se.sum_exec_runtime, (unsigned long long)task->sched_info.run_delay, task->sched_info.pcount); }
functions
int lstats_show_proc(struct seq_file *m, void *v) { int i; struct inode *inode = m->private; struct task_struct *task = get_proc_task(inode); if (!task) return -ESRCH; seq_puts(m, "Latency Top version : v0.1\n"); for (i = 0; i < 32; i++) { if (task->latency_record[i].backtrace[0]) { int q; seq_printf(m...
functions
int lstats_open(struct inode *inode, struct file *file) { return single_open(file, lstats_show_proc, inode); }
functions
ssize_t lstats_write(struct file *file, const char __user *buf, size_t count, loff_t *offs) { struct task_struct *task = get_proc_task(file->f_dentry->d_inode); if (!task) return -ESRCH; clear_all_latency_tracing(task); put_task_struct(task); return count; }
functions
int proc_oom_score(struct task_struct *task, char *buffer) { unsigned long points; struct timespec uptime; do_posix_clock_monotonic_gettime(&uptime); read_lock(&tasklist_lock); points = badness(task, uptime.tv_sec); read_unlock(&tasklist_lock); return sprintf(buffer, "%lu\n", points); }
functions
int proc_pid_limits(struct task_struct *task, char *buffer) { unsigned int i; int count = 0; unsigned long flags; char *bufptr = buffer; struct rlimit rlim[RLIM_NLIMITS]; if (!lock_task_sighand(task, &flags)) return 0; memcpy(rlim, task->signal->rlim, sizeof(struct rlimit) * RLIM_NLIMITS); unlock_task_sigha...
functions
int proc_pid_syscall(struct task_struct *task, char *buffer) { long nr; unsigned long args[6], sp, pc; if (task_current_syscall(task, &nr, args, 6, &sp, &pc)) return sprintf(buffer, "running\n"); if (nr < 0) return sprintf(buffer, "%ld 0x%lx 0x%lx\n", nr, sp, pc); return sprintf(buffer, "%ld 0x%lx ...
functions
int proc_fd_access_allowed(struct inode *inode) { struct task_struct *task; int allowed = 0; /* Allow access to a task's file descriptors if it is us or we * may use ptrace attach to the process and find out that * information. */ task = get_proc_task(inode); if (task) { allowed = ptrace_may_access(task, P...
functions
int proc_setattr(struct dentry *dentry, struct iattr *attr) { int error; struct inode *inode = dentry->d_inode; if (attr->ia_valid & ATTR_MODE) return -EPERM; error = inode_change_ok(inode, attr); if (!error) error = inode_setattr(inode, attr); return error; }
functions
int mounts_open_common(struct inode *inode, struct file *file, const struct seq_operations *op) { struct task_struct *task = get_proc_task(inode); struct nsproxy *nsp; struct mnt_namespace *ns = NULL; struct path root; struct proc_mounts *p; int ret = -EINVAL; if (task) { rcu_read_lock(); nsp = tas...
functions
int mounts_release(struct inode *inode, struct file *file) { struct proc_mounts *p = file->private_data; path_put(&p->root); put_mnt_ns(p->ns); return seq_release(inode, file); }
functions
unsigned mounts_poll(struct file *file, poll_table *wait) { struct proc_mounts *p = file->private_data; struct mnt_namespace *ns = p->ns; unsigned res = POLLIN | POLLRDNORM; poll_wait(file, &ns->poll, wait); spin_lock(&vfsmount_lock); if (p->event != ns->event) { p->event = ns->event; res |= POLLERR | POLLP...
functions
int mounts_open(struct inode *inode, struct file *file) { return mounts_open_common(inode, file, &mounts_op); }
functions
int mountinfo_open(struct inode *inode, struct file *file) { return mounts_open_common(inode, file, &mountinfo_op); }
functions
int mountstats_open(struct inode *inode, struct file *file) { return mounts_open_common(inode, file, &mountstats_op); }
functions
ssize_t proc_info_read(struct file * file, char __user * buf, size_t count, loff_t *ppos) { struct inode * inode = file->f_path.dentry->d_inode; unsigned long page; ssize_t length; struct task_struct *task = get_proc_task(inode); length = -ESRCH; if (!task) goto out_no_task; if (count > PROC_BLOCK_SIZE)...
functions
int proc_single_show(struct seq_file *m, void *v) { struct inode *inode = m->private; struct pid_namespace *ns; struct pid *pid; struct task_struct *task; int ret; ns = inode->i_sb->s_fs_info; pid = proc_pid(inode); task = get_pid_task(pid, PIDTYPE_PID); if (!task) return -ESRCH; ret = PROC_I(inode)->op.p...
functions
int proc_single_open(struct inode *inode, struct file *filp) { int ret; ret = single_open(filp, proc_single_show, NULL); if (!ret) { struct seq_file *m = filp->private_data; m->private = inode; }
functions
int mem_open(struct inode* inode, struct file* file) { file->private_data = (void*)((long)current->self_exec_id); return 0; }
functions
ssize_t mem_read(struct file * file, char __user * buf, size_t count, loff_t *ppos) { struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode); char *page; unsigned long src = *ppos; int ret = -ESRCH; struct mm_struct *mm; if (!task) goto out_no_task; if (check_mem_permission(task)) goto o...
functions
ssize_t mem_write(struct file * file, const char __user *buf, size_t count, loff_t *ppos) { int copied; char *page; struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode); unsigned long dst = *ppos; copied = -ESRCH; if (!task) goto out_no_task; if (check_mem_permission(task)) goto out; ...
functions
loff_t mem_lseek(struct file *file, loff_t offset, int orig) { switch (orig) { case 0: file->f_pos = offset; break; case 1: file->f_pos += offset; break; default: return -EINVAL; }
functions
ssize_t environ_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { struct task_struct *task = get_proc_task(file->f_dentry->d_inode); char *page; unsigned long src = *ppos; int ret = -ESRCH; struct mm_struct *mm; if (!task) goto out_no_task; if (!ptrace_may_access(task, PTRACE_MODE_RE...
functions
ssize_t oom_adjust_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode); char buffer[PROC_NUMBUF]; size_t len; int oom_adjust; if (!task) return -ESRCH; oom_adjust = task->oomkilladj; put_task_struct(task); len = s...
functions
ssize_t oom_adjust_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) { struct task_struct *task; char buffer[PROC_NUMBUF], *end; int oom_adjust; memset(buffer, 0, sizeof(buffer)); if (count > sizeof(buffer) - 1) count = sizeof(buffer) - 1; if (copy_from_user(buffer, buf, count)) ...
functions
ssize_t proc_loginuid_read(struct file * file, char __user * buf, size_t count, loff_t *ppos) { struct inode * inode = file->f_path.dentry->d_inode; struct task_struct *task = get_proc_task(inode); ssize_t length; char tmpbuf[TMPBUFLEN]; if (!task) return -ESRCH; length = scnprintf(tmpbuf, TMPBUFLEN, "%u...
functions
ssize_t proc_loginuid_write(struct file * file, const char __user * buf, size_t count, loff_t *ppos) { struct inode * inode = file->f_path.dentry->d_inode; char *page, *tmp; ssize_t length; uid_t loginuid; if (!capable(CAP_AUDIT_CONTROL)) return -EPERM; if (current != pid_task(proc_pid(inode), PIDTYPE_...
functions
ssize_t proc_sessionid_read(struct file * file, char __user * buf, size_t count, loff_t *ppos) { struct inode * inode = file->f_path.dentry->d_inode; struct task_struct *task = get_proc_task(inode); ssize_t length; char tmpbuf[TMPBUFLEN]; if (!task) return -ESRCH; length = scnprintf(tmpbuf, TMPBUFLEN, "%...
functions
ssize_t proc_fault_inject_read(struct file * file, char __user * buf, size_t count, loff_t *ppos) { struct task_struct *task = get_proc_task(file->f_dentry->d_inode); char buffer[PROC_NUMBUF]; size_t len; int make_it_fail; if (!task) return -ESRCH; make_it_fail = task->make_it_fail; put_task_struct(...
functions
ssize_t proc_fault_inject_write(struct file * file, const char __user * buf, size_t count, loff_t *ppos) { struct task_struct *task; char buffer[PROC_NUMBUF], *end; int make_it_fail; if (!capable(CAP_SYS_RESOURCE)) return -EPERM; memset(buffer, 0, sizeof(buffer)); if (count > sizeof(buffer) - 1) count = s...
functions
int sched_show(struct seq_file *m, void *v) { struct inode *inode = m->private; struct task_struct *p; p = get_proc_task(inode); if (!p) return -ESRCH; proc_sched_show_task(p, m); put_task_struct(p); return 0; }
functions
ssize_t sched_write(struct file *file, const char __user *buf, size_t count, loff_t *offset) { struct inode *inode = file->f_path.dentry->d_inode; struct task_struct *p; p = get_proc_task(inode); if (!p) return -ESRCH; proc_sched_set_task(p); put_task_struct(p); return count; }