Exemplo n.º 1
0
/*
 * display a single VMA to a sequenced file
 */
static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma,
                          int is_pid)
{
    struct mm_struct *mm = vma->vm_mm;
    struct proc_maps_private *priv = m->private;
    unsigned long ino = 0;
    struct file *file;
    dev_t dev = 0;
    int flags;
    unsigned long long pgoff = 0;

    flags = vma->vm_flags;
    file = vma->vm_file;

    if (file) {
        struct inode *inode = file_inode(vma->vm_file);
        dev = inode->i_sb->s_dev;
        ino = inode->i_ino;
        pgoff = (loff_t)vma->vm_pgoff << PAGE_SHIFT;
    }

    seq_setwidth(m, 25 + sizeof(void *) * 6 - 1);
    seq_printf(m,
               "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu ",
               vma->vm_start,
               vma->vm_end,
               flags & VM_READ ? 'r' : '-',
               flags & VM_WRITE ? 'w' : '-',
               flags & VM_EXEC ? 'x' : '-',
               flags & VM_MAYSHARE ? flags & VM_SHARED ? 'S' : 's' : 'p',
               pgoff,
               MAJOR(dev), MINOR(dev), ino);

    if (file) {
        seq_pad(m, ' ');
        seq_file_path(m, file, "");
    } else if (mm) {
        pid_t tid = pid_of_stack(priv, vma, is_pid);

        if (tid != 0) {
            seq_pad(m, ' ');
            /*
             * Thread stack in /proc/PID/task/TID/maps or
             * the main process stack.
             */
            if (!is_pid || (vma->vm_start <= mm->start_stack &&
                            vma->vm_end >= mm->start_stack))
                seq_printf(m, "[stack]");
            else
                seq_printf(m, "[stack:%d]", tid);
        }
    }

    seq_putc(m, '\n');
    return 0;
}
Exemplo n.º 2
0
/*
 * display a single VMA to a sequenced file
 */
static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma,
			  int is_pid)
{
	struct mm_struct *mm = vma->vm_mm;
	struct proc_maps_private *priv = m->private;
	unsigned long ino = 0;
	struct file *file;
	dev_t dev = 0;
	int flags;
	unsigned long long pgoff = 0;

	flags = vma->vm_flags;
	file = vma->vm_file;

	if (file) {
		struct inode *inode = file_inode(vma->vm_file);
		dev = inode->i_sb->s_dev;
		ino = inode->i_ino;
		pgoff = (loff_t)vma->vm_pgoff << PAGE_SHIFT;
	}

	seq_setwidth(m, 25 + sizeof(void *) * 6 - 1);
	seq_printf(m,
		   "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu ",
		   vma->vm_start,
		   vma->vm_end,
		   flags & VM_READ ? 'r' : '-',
		   flags & VM_WRITE ? 'w' : '-',
		   flags & VM_EXEC ? 'x' : '-',
		   flags & VM_MAYSHARE ? flags & VM_SHARED ? 'S' : 's' : 'p',
		   pgoff,
		   MAJOR(dev), MINOR(dev), ino);

	if (file) {
		seq_pad(m, ' ');
		seq_file_path(m, file, "");
	} else if (mm && is_stack(priv, vma, is_pid)) {
		seq_pad(m, ' ');
		seq_printf(m, "[stack]");
	}

	seq_putc(m, '\n');
	return 0;
}
Exemplo n.º 3
0
/*
 * display a single region to a sequenced file
 */
static int nommu_region_show(struct seq_file *m, struct vm_region *region)
{
	unsigned long ino = 0;
	struct file *file;
	dev_t dev = 0;
	int flags;

	flags = region->vm_flags;
	file = region->vm_file;

	if (file) {
		struct inode *inode;

		file = vmr_pr_or_file(region);
		inode = file_inode(file);
		dev = inode->i_sb->s_dev;
		ino = inode->i_ino;
	}

	seq_setwidth(m, 25 + sizeof(void *) * 6 - 1);
	seq_printf(m,
		   "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu ",
		   region->vm_start,
		   region->vm_end,
		   flags & VM_READ ? 'r' : '-',
		   flags & VM_WRITE ? 'w' : '-',
		   flags & VM_EXEC ? 'x' : '-',
		   flags & VM_MAYSHARE ? flags & VM_SHARED ? 'S' : 's' : 'p',
		   ((loff_t)region->vm_pgoff) << PAGE_SHIFT,
		   MAJOR(dev), MINOR(dev), ino);

	if (file) {
		seq_pad(m, ' ');
		seq_file_path(m, file, "");
	}

	seq_putc(m, '\n');
	return 0;
}