Пример #1
0
Файл: token.c Проект: taysom/tau
int main (int argc, char *argv[])
{
	char	*t;
	int	id = -1;

	open_token(
		"/sys/kernel/debug/tracing/events"
		"/raw_syscalls/sys_enter/format",
		" \n\t");
	for (;;) {
		t = get_token();
		if (!t) break;
		printf("%s\n", t);
	}
	open_token(
		"/sys/kernel/debug/tracing/events"
		"/raw_syscalls/sys_enter/format",
		" \n\t");
	for (;;) {
		t = get_token();
		if (!t) break;
		if (strcmp(t, "ID:") == 0) {
			t = get_token();
			if (!t) break;
			id = atoi(t);
		}
	}
	printf("id = %d\n", id);
	return 0;
}
Пример #2
0
static int get_event_id (char *sys_call)
{
	char file_name[MAX_PATH];
	char *t;

	snprintf(file_name, MAX_PATH,
		"%s/%s/%s/format",
		Trace_path, Event_path, sys_call);
	open_token(file_name, " \n\t");
	for (;;) {
		t = get_token();
		if (!t) break;
		if (strcmp(t, "ID:") == 0) {
			t = get_token();
			if (!t) break;
			close_token();
			return atoi(t);
		}
	}
	close_token();
	fatal("event id for %s not found in %s", sys_call, file_name);
	return 0;
}