Exemple #1
0
static inline void task_name(struct seq_file *m, struct task_struct *p)
{
	char *buf;
	size_t size;
	char tcomm[sizeof(p->comm)];
	int ret;

	get_task_comm(tcomm, p);

	seq_puts(m, "Name:\t");

	size = seq_get_buf(m, &buf);
	ret = string_escape_str(tcomm, buf, size, ESCAPE_SPACE | ESCAPE_SPECIAL, "\n\\");
	seq_commit(m, ret < size ? ret : -1);

	seq_putc(m, '\n');
}
Exemple #2
0
static inline void task_name(struct seq_file *m, struct task_struct *p)
{
	char *buf;
	char tcomm[sizeof(p->comm)];

	get_task_comm(tcomm, p);

	seq_puts(m, "Name:\t");
	buf = m->buf + m->count;

	/* Ignore error for now */
	string_escape_str(tcomm, &buf, m->size - m->count,
			  ESCAPE_SPACE | ESCAPE_SPECIAL, "\n\\");

	m->count = buf - m->buf;
	seq_putc(m, '\n');
}
Exemple #3
0
void proc_task_name(struct seq_file *m, struct task_struct *p, bool escape)
{
	char *buf;
	size_t size;
	char tcomm[64];
	int ret;

	if (p->flags & PF_WQ_WORKER)
		wq_worker_comm(tcomm, sizeof(tcomm), p);
	else
		__get_task_comm(tcomm, sizeof(tcomm), p);

	size = seq_get_buf(m, &buf);
	if (escape) {
		ret = string_escape_str(tcomm, buf, size,
					ESCAPE_SPACE | ESCAPE_SPECIAL, "\n\\");
		if (ret >= size)
			ret = -1;
	} else {
		ret = strscpy(buf, tcomm, size);
	}

	seq_commit(m, ret);
}