7 #include <linux/ptrace.h>
8 #include <linux/slab.h>
23 unsigned long bytes = 0, sbytes = 0, slack = 0,
size;
73 "Slack:\t%8lu bytes\n"
74 "Shared:\t%8lu bytes\n",
75 bytes, slack, sbytes);
84 unsigned long vsize = 0;
97 unsigned long *
data,
unsigned long *resident)
121 size += *text + *
data;
126 static void pad_len_spaces(
struct seq_file *
m,
int len)
128 len = 25 +
sizeof(
void*) * 6 - len;
142 unsigned long ino = 0;
146 unsigned long long pgoff = 0;
153 dev = inode->
i_sb->s_dev;
159 "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n",
162 flags & VM_READ ?
'r' :
'-',
163 flags & VM_WRITE ?
'w' :
'-',
164 flags & VM_EXEC ?
'x' :
'-',
165 flags & VM_MAYSHARE ? flags & VM_SHARED ?
'S' :
's' :
'p',
170 pad_len_spaces(m, len);
176 pad_len_spaces(m, len);
196 static int show_map(
struct seq_file *m,
void *_p,
int is_pid)
204 static int show_pid_map(
struct seq_file *m,
void *_p)
206 return show_map(m, _p, 1);
209 static int show_tid_map(
struct seq_file *m,
void *_p)
211 return show_map(m, _p, 0);
214 static void *m_start(
struct seq_file *m, loff_t *
pos)
224 return ERR_PTR(-
ESRCH);
227 if (!mm || IS_ERR(mm)) {
228 put_task_struct(priv->
task);
241 static void m_stop(
struct seq_file *m,
void *_vml)
249 put_task_struct(priv->
task);
253 static void *m_next(
struct seq_file *m,
void *_p, loff_t *pos)
275 static int maps_open(
struct inode *
inode,
struct file *file,
283 priv->
pid = proc_pid(inode);
295 static int pid_maps_open(
struct inode *inode,
struct file *file)
297 return maps_open(inode, file, &proc_pid_maps_ops);
300 static int tid_maps_open(
struct inode *inode,
struct file *file)
302 return maps_open(inode, file, &proc_tid_maps_ops);
306 .open = pid_maps_open,
313 .open = tid_maps_open,