Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Linux Kernel | tools/thermal/lib/mainloop.c |
void mainloop_exit(void) { exit_mainloop = 1; } | [
0,
0
] |
Linux Kernel | tools/thermal/thermal-engine/thermal-engine.c |
static int tz_disable(int tz_id, void *arg) {
struct thermal_data *td = arg;
struct thermal_zone *tz = thermal_zone_find_by_id(td->tz, tz_id);
INFO("Thermal zone %d ('%s') disabled\n", tz_id, tz->name);
return 0;
} | [
0,
0
] |
Linux Kernel | tools/thermal/thermal-engine/thermal-engine.c |
static int trip_high(int tz_id, int trip_id, int temp, void *arg) {
struct thermal_data *td = arg;
struct thermal_zone *tz = thermal_zone_find_by_id(td->tz, tz_id);
INFO("Thermal zone %d ('%s'): trip point %d crossed way up with %d °C\n",
tz_id, tz->name, trip_id, temp);
return 0;
} | [
0,
0
] |
Linux Kernel | tools/thermal/thermal-engine/thermal-engine.c |
static int trip_add(int tz_id, int trip_id, int type, int temp, int hyst,
__maybe_unused void *arg) {
INFO("Trip point added %d: id=%d, type=%d, temp=%d, hyst=%d\n", tz_id,
trip_id, type, temp, hyst);
return 0;
} | [
0,
0
] |
Linux Kernel | tools/thermal/thermal-engine/thermal-engine.c |
static int cdev_update(int cdev_id, int cur_state, __maybe_unused void *arg) {
INFO("cdev:%d state:%d\n", cdev_id, cur_state);
return 0;
} | [
0,
0
] |
Linux Kernel | tools/thermal/thermal-engine/thermal-engine.c |
static void usage(const char *cmd) {
printf("%s : A thermal monitoring engine based on notifications\n", cmd);
printf("Usage: %s [options]\n", cmd);
printf("\t-h, --help\t\tthis help\n");
printf("\t-d, --daemonize\n");
printf("\t-l <level>, --loglevel <level>\tlog level: ");
printf("DEBUG, INFO, NOTICE, WA... | [
0,
0
] |
Linux Kernel | tools/thermal/thermal-engine/thermal-engine.c | static int options_init(int argc, char *argv[], struct options *options) {
int opt;
struct option long_options[] = {{"help", no_argument, NULL, 'h'},
{"daemonize", no_argument, NULL, 'd'},
{"syslog", no_argument, NULL, 's'},
... | [
0,
0
] |
Linux Kernel | tools/thermal/thermometer/thermometer.c |
static int thermometer_add_tz(const char *path, const char *name, int polling,
struct thermometer *thermometer) {
int fd;
char tz_path[PATH_MAX];
sprintf(tz_path, CLASS_THERMAL "/%s/temp", path);
fd = open(tz_path, O_RDONLY);
if (fd < 0) {
ERROR("Failed to open '%s': %m\n"... | [
1,
0
] |
Linux Kernel | tools/thermal/thermometer/thermometer.c |
static int timer_temperature_callback(int fd, void *arg) {
struct tz *tz = arg;
char buf[16] = {0};
pread(tz->fd_temp, buf, sizeof(buf), 0);
fprintf(tz->file_out, "%ld %s", getuptimeofday_ms(), buf);
read(fd, buf, sizeof(buf));
return 0;
} | [
1,
0
] |
Linux Kernel | tools/thermal/thermometer/thermometer.c |
static int thermometer_execute(int argc, char *argv[], char *const envp[],
pid_t *pid) {
if (!argc)
return 0;
*pid = fork();
if (*pid < 0) {
ERROR("Failed to fork process: %m");
return -1;
}
if (!(*pid)) {
execvpe(argv[0], argv, envp);
exit(1);
}
retu... | [
1,
0
] |
Linux Kernel | tools/thermal/thermometer/thermometer.c |
static int exit_mainloop(__maybe_unused int fd, __maybe_unused void *arg) {
mainloop_exit();
return 0;
} | [
0,
0
] |
Linux Kernel | tools/thermal/thermometer/thermometer.c |
static int thermometer_stop(struct thermometer *thermometer) {
int i;
INFO("Closing/flushing output files\n");
for (i = 0; i < thermometer->nr_tz; i++)
fclose(thermometer->tz[i].file_out);
return 0;
} | [
1,
0
] |
Linux Kernel | tools/thermal/tmon/pid.c | void controller_reset(void) {
syslog(LOG_DEBUG, "TC inactive, relax p-state\n");
p_param.y_k = 0.0;
xk_1 = 0.0;
xk_2 = 0.0;
set_ctrl_state(0);
}
/* To be called at time interval Ts. Type C PID controller.
* y[k] = y[k-1] - kp*(x[k] - x[k-1]) + Ki*Ts*e[k] - Kd*(x[k]
* - 2*x[k-1]+x[k-2])/Ts
* T... | [
0,
1
] |
Linux Kernel | tools/thermal/tmon/sysfs.c | static int probe_cdev(struct cdev_info *cdi, char *path) {
sysfs_get_string(path, "type", cdi->type);
sysfs_get_ulong(path, "max_state", &cdi->max_state);
sysfs_get_ulong(path, "cur_state", &cdi->cur_state);
syslog(LOG_INFO, "%s: %s: type %s, max %lu, curr %lu inst %d\n", __func__,
path, cdi->type, cd... | [
1,
0
] |
Linux Kernel | tools/thermal/tmon/sysfs.c | static int get_trip_point_data(char *tz_path, int tzid, int tpid) {
char filename[256];
char temp_str[256];
int trip_type;
if (tpid >= MAX_NR_TRIP)
return -EINVAL;
snprintf(filename, sizeof(filename), "trip_point_%d_type", tpid);
sysfs_get_string(tz_path, filename, temp_str);
trip_type = str_to_trip... | [
1,
1
] |
Linux Kernel | tools/thermal/tmon/sysfs.c | static int get_instance_id(char *name, int pos, int skip) {
char *ch;
int i = 0;
ch = strtok(name, "_");
while (ch != NULL) {
++i;
syslog(LOG_INFO, "%s:%s:%s:%d", __func__, name, ch, i);
ch = strtok(NULL, "_");
if (pos == i)
return atol(ch + skip);
}
return -1;
} | [
1,
0
] |
Linux Kernel | tools/thermal/tmon/sysfs.c | static int scan_tzones(void) {
DIR *dir;
struct dirent **namelist;
char tz_name[256];
int i, j, n, k = 0;
if (!ptdata.nr_tz_sensor)
return -1;
for (i = 0; i <= ptdata.max_tz_instance; i++) {
memset(tz_name, 0, sizeof(tz_name));
snprintf(tz_name, 256, "%s/%s%d", THERMAL_SYSFS, TZONE, i);
d... | [
1,
1
] |
Linux Kernel | tools/thermal/tmon/sysfs.c | int update_thermal_data() {
int i;
int next_thermal_record = cur_thermal_record + 1;
char tz_name[256];
static unsigned long samples;
if (!ptdata.nr_tz_sensor) {
syslog(LOG_ERR, "No thermal zones found!\n");
return -1;
}
if (next_thermal_record >= NR_THERMAL_RECORDS)
next_thermal_record = 0;... | [
1,
0
] |
Linux Kernel | tools/thermal/tmon/sysfs.c | void set_ctrl_state(unsigned long state) {
char ctrl_cdev_path[256];
int i;
unsigned long cdev_state;
if (no_control)
return;
for (i = 0; i < ptdata.nr_cooling_dev; i++) {
if (ptdata.cdi[i].flag & CDEV_FLAG_IN_CONTROL) {
if (ptdata.cdi[i].max_state < 10) {
strcpy(ctrl_cdev, "None.");
... | [
1,
0
] |
Linux Kernel | tools/thermal/tmon/tmon.c | void usage(void) {
printf("Usage: tmon [OPTION...]\n");
printf(" -c, --control cooling device in control\n");
printf(" -d, --daemon run as daemon, no TUI\n");
printf(" -g, --debug debug message in syslog\n");
printf(" -h, --help show this help message\n");
printf(" ... | [
1,
0
] |
Linux Kernel | tools/thermal/tmon/tmon.c | static void tmon_cleanup(void) {
syslog(LOG_INFO, "TMON exit cleanup\n");
fflush(stdout);
refresh();
if (tmon_log)
fclose(tmon_log);
if (event_tid) {
pthread_mutex_lock(&input_lock);
pthread_cancel(event_tid);
pthread_mutex_unlock(&input_lock);
pthread_mutex_destroy(&input_lock);
}
clo... | [
1,
0
] |
Linux Kernel | tools/thermal/tmon/tui.c | void show_dialogue(void) {
int j, x = 0, y = 0;
int rows, cols;
WINDOW *w = dialogue_window;
if (tui_disabled || !w)
return;
getmaxyx(w, rows, cols);
(void)cols;
werase(w);
box(w, 0, 0);
mvwprintw(w, 0, maxx / 4, DIAG_TITLE);
/* list all the available tunables */
for (j = 0; j <= ptdata.nr... | [
1,
0
] |
Linux Kernel | tools/thermal/tmon/tui.c |
void write_dialogue_win(char *buf, int y, int x) {
WINDOW *w = dialogue_window;
mvwprintw(w, y, x, "%s", buf);
} | [
0,
0
] |
Linux Kernel | tools/thermal/tmon/tui.c | static void draw_tp_line(int tz, int y) {
int j;
int x;
for (j = 0; j < ptdata.tzi[tz].nr_trip_pts; j++) {
x = ptdata.tzi[tz].tp[j].temp / 1000;
mvwprintw(thermal_data_window, y + 0, x + TDATA_LEFT, "%c%d",
trip_type_to_char(ptdata.tzi[tz].tp[j].type), x);
syslog(LOG_INFO, "%s:tz %d tp ... | [
0,
0
] |
Linux Kernel | tools/tracing/latency/latency-collector.c |
static __always_inline void mutex_unlock(pthread_mutex_t *mtx) {
errno = pthread_mutex_unlock(mtx);
if (unlikely(errno))
err(EXIT_FAILURE, "pthread_mutex_unlock() failed");
} | [
0,
0
] |
Linux Kernel | tools/tracing/latency/latency-collector.c |
static __always_inline void mutexattr_settype(pthread_mutexattr_t *attr,
int type) {
errno = pthread_mutexattr_settype(attr, type);
if (errno)
err(EXIT_FAILURE, "pthread_mutexattr_settype() failed");
} | [
0,
0
] |
Linux Kernel | tools/tracing/latency/latency-collector.c |
static __always_inline void condattr_init(pthread_condattr_t *attr) {
errno = pthread_condattr_init(attr);
if (errno)
err(EXIT_FAILURE, "pthread_condattr_init() failed");
} | [
0,
0
] |
Linux Kernel | tools/tracing/latency/latency-collector.c |
static void init_print_mtx(void) {
pthread_mutexattr_t mattr;
mutexattr_init(&mattr);
mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE);
mutex_init(&print_mtx, &mattr);
mutexattr_destroy(&mattr);
} | [
0,
0
] |
Linux Kernel | tools/tracing/latency/latency-collector.c |
static __always_inline bool time_has_passed(const struct timespec *time) {
struct timespec now;
clock_gettime_or_die(CLOCK_MONOTONIC, &now);
if (now.tv_sec > time->tv_sec)
return true;
if (now.tv_sec < time->tv_sec)
return false;
return (now.tv_nsec >= time->tv_nsec);
} | [
0,
0
] |
Linux Kernel | tools/tracing/latency/latency-collector.c |
static void restore_trace_opts(const struct ftrace_state *state,
const bool *cur) {
int i;
int r;
for (i = 0; i < OPTIDX_NR; i++)
if (state->opt_valid[i] && state->opt[i] != cur[i]) {
r = set_trace_opt(optstr[i], state->opt[i]);
if (r < 0)
warnx("Failed to ... | [
0,
0
] |
Linux Kernel | tools/tracing/latency/latency-collector.c |
static __always_inline bool
printstate_has_new_req_arrived(const struct entry *req) {
return (printstate.ticket_counter != req->ticket);
} | [
0,
0
] |
Linux Kernel | tools/tracing/latency/latency-collector.c |
static __always_inline bool prev_req_won_race(const struct entry *req) {
return (printstate.ticket_completed != req->ticket_completed_ref);
} | [
0,
0
] |
Linux Kernel | tools/tracing/latency/latency-collector.c |
static __always_inline int queue_try_to_add_entry(struct queue *q,
const struct entry *e) {
int r = 0;
mutex_lock(&q->mutex);
if (queue_nr_free(q) > 0) {
queue_push_to_back(q, e);
cond_signal(&q->cond);
} else
r = -1;
mutex_unlock(&q->mutex);
r... | [
0,
0
] |
Linux Kernel | tools/tracing/latency/latency-collector.c |
static struct entry queue_wait_for_entry(struct queue *q) {
struct entry e;
mutex_lock(&q->mutex);
while (true) {
if (queue_len(&printqueue) > 0) {
e = queue_pop_from_front(q);
break;
}
queue_cond_wait(q);
}
mutex_unlock(&q->mutex);
return e;
} | [
0,
0
] |
Linux Kernel | tools/tracing/latency/latency-collector.c | static __always_inline void
__print_skipmessage(const struct short_msg *resize_msg,
const struct timespec *timestamp, char *buffer,
size_t bufspace, const struct entry *req, bool excuse,
const char *str) {
ssize_t bytes = 0;
char *p = &buffer[0];
long us... | [
1,
0
] |
Linux Kernel | tools/tracing/latency/latency-collector.c |
static char *find_next_optstr(const char *allopt, const char **next) {
const char *begin;
const char *end;
char *r;
int s = 0;
if (allopt == NULL)
return NULL;
for (begin = allopt; *begin != '\0'; begin++) {
if (isgraph(*begin))
break;
}
if (*begin == '\0')
return NULL;
for (end... | [
1,
0
] |
Linux Kernel | tools/tracing/latency/latency-collector.c |
static int set_trace_opt(const char *opt, bool value) {
char *str;
int r;
if (value)
str = strdup(opt);
else
str = get_no_opt(opt);
r = tracefs_instance_file_write(NULL, TR_OPTIONS, str);
free(str);
return r;
} | [
1,
0
] |
Linux Kernel | tools/tracing/latency/latency-collector.c | static void write_file(const char *file, const char *cur, const char *new,
enum errhandling h) {
int r;
static const char *emsg = "Failed to write to the %s file!";
if (cur && !needs_change(cur, new))
return;
r = tracefs_instance_file_write(NULL, file, new);
if (r < 0) {
if (h... | [
0,
0
] |
Linux Kernel | tools/tracing/latency/latency-collector.c |
static void save_and_disable_tracer(void) {
char *orig_th;
char *tracer;
bool need_nop = false;
mutex_lock(&save_state.mutex);
save_trace_opts(&save_state);
tracer = read_file(TR_CURRENT, ERR_EXIT);
orig_th = read_file(TR_THRESH, ERR_EXIT);
if (needs_change(tracer, NOP_TRACER)) {
mutex_lock(&pri... | [
0,
0
] |
Linux Kernel | tools/tracing/rtla/src/osnoise.c | int osnoise_set_cpus(struct osnoise_context *context, char *cpus) {
char *orig_cpus = osnoise_get_cpus(context);
char buffer[1024];
int retval;
if (!orig_cpus)
return -1;
context->curr_cpus = strdup(cpus);
if (!context->curr_cpus)
return -1;
snprintf(buffer, 1024, "%s\n", cpus);
debug_msg("s... | [
1,
0
] |
Linux Kernel | tools/tracing/rtla/src/osnoise.c | void osnoise_restore_cpus(struct osnoise_context *context) {
int retval;
if (!context->orig_cpus)
return;
if (!context->curr_cpus)
return;
if (!strcmp(context->orig_cpus, context->curr_cpus))
goto out_done;
debug_msg("restoring cpus to %s", context->orig_cpus);
retval =
tracefs_instan... | [
1,
0
] |
Linux Kernel | tools/tracing/rtla/src/osnoise.c | unsigned long long osnoise_get_period(struct osnoise_context *context) {
long long period_us;
if (context->period_us != OSNOISE_TIME_INIT_VAL)
return context->period_us;
if (context->orig_period_us != OSNOISE_TIME_INIT_VAL)
return context->orig_period_us;
period_us = osnoise_read_ll_config("osnoise/p... | [
0,
0
] |
Linux Kernel | tools/tracing/rtla/src/osnoise.c | void osnoise_put_runtime_period(struct osnoise_context *context) {
osnoise_restore_runtime_period(context);
if (context->orig_runtime_us != OSNOISE_TIME_INIT_VAL)
context->orig_runtime_us = OSNOISE_TIME_INIT_VAL;
if (context->orig_period_us != OSNOISE_TIME_INIT_VAL)
context->orig_period_us = OSNOISE_TIM... | [
0,
0
] |
Linux Kernel | tools/tracing/rtla/src/osnoise.c | void osnoise_restore_timerlat_period_us(struct osnoise_context *context) {
int retval;
if (context->orig_timerlat_period_us == OSNOISE_TIME_INIT_VAL)
return;
if (context->orig_timerlat_period_us == context->timerlat_period_us)
goto out_done;
retval = osnoise_write_ll_config("osnoise/timerlat_period_u... | [
0,
0
] |
Linux Kernel | tools/tracing/rtla/src/osnoise.c | void osnoise_put_stop_us(struct osnoise_context *context) {
osnoise_restore_stop_us(context);
if (context->orig_stop_us == OSNOISE_OPTION_INIT_VAL)
return;
context->orig_stop_us = OSNOISE_OPTION_INIT_VAL;
} | [
0,
0
] |
Linux Kernel | tools/tracing/rtla/src/osnoise.c | int osnoise_set_stop_total_us(struct osnoise_context *context,
long long stop_total_us) {
long long curr_stop_total_us = osnoise_get_stop_total_us(context);
int retval;
if (curr_stop_total_us == OSNOISE_OPTION_INIT_VAL)
return -1;
retval =
osnoise_write_ll_config("osnoi... | [
0,
0
] |
Linux Kernel | tools/tracing/rtla/src/osnoise.c | void osnoise_restore_print_stack(struct osnoise_context *context) {
int retval;
if (context->orig_print_stack == OSNOISE_OPTION_INIT_VAL)
return;
if (context->orig_print_stack == context->print_stack)
goto out_done;
retval =
osnoise_write_ll_config("osnoise/print_stack", context->orig_print_sta... | [
0,
0
] |
Linux Kernel | tools/tracing/rtla/src/osnoise.c | void osnoise_put_print_stack(struct osnoise_context *context) {
osnoise_restore_print_stack(context);
if (context->orig_print_stack == OSNOISE_OPTION_INIT_VAL)
return;
context->orig_print_stack = OSNOISE_OPTION_INIT_VAL;
} | [
0,
0
] |
Linux Kernel | tools/tracing/rtla/src/osnoise.c | int osnoise_get_context(struct osnoise_context *context) {
int ret;
if (context->flags & FLAG_CONTEXT_DELETED) {
ret = -1;
} else {
context->ref++;
ret = 0;
}
return ret;
} | [
0,
0
] |
Linux Kernel | tools/tracing/rtla/src/osnoise.c | void osnoise_put_context(struct osnoise_context *context) {
if (--context->ref < 1)
context->flags |= FLAG_CONTEXT_DELETED;
if (!(context->flags & FLAG_CONTEXT_DELETED))
return;
osnoise_put_cpus(context);
osnoise_put_runtime_period(context);
osnoise_put_stop_us(context);
osnoise_put_stop_total_us(... | [
1,
0
] |
Linux Kernel | tools/tracing/rtla/src/osnoise.c | void osnoise_destroy_tool(struct osnoise_tool *top) {
if (!top)
return;
trace_instance_destroy(&top->trace);
if (top->context)
osnoise_put_context(top->context);
free(top);
} | [
1,
0
] |
Linux Kernel | tools/tracing/rtla/src/osnoise.c | struct osnoise_tool *osnoise_init_tool(char *tool_name) {
struct osnoise_tool *top;
int retval;
top = calloc(1, sizeof(*top));
if (!top)
return NULL;
top->context = osnoise_context_alloc();
if (!top->context)
goto out_err;
retval = trace_instance_init(&top->trace, tool_name);
if (retval)
... | [
1,
0
] |
Linux Kernel | tools/tracing/rtla/src/osnoise_hist.c | static void osnoise_free_histogram(struct osnoise_hist_data *data) {
int cpu;
for (cpu = 0; cpu < data->nr_cpus; cpu++) {
if (data->hist[cpu].samples)
free(data->hist[cpu].samples);
}
/* one set of histograms per CPU */
if (data->hist)
free(data->hist);
free(data);
} | [
1,
0
] |
Linux Kernel | tools/tracing/rtla/src/osnoise_hist.c |
static void osnoise_hist_update_multiple(struct osnoise_tool *tool, int cpu,
unsigned long long duration,
int count) {
struct osnoise_hist_params *params = tool->params;
struct osnoise_hist_data *data = tool->data;
int entries = da... | [
0,
0
] |
Linux Kernel | tools/tracing/rtla/src/osnoise_top.c | static struct osnoise_top_data *osnoise_alloc_top(int nr_cpus) {
struct osnoise_top_data *data;
data = calloc(1, sizeof(*data));
if (!data)
return NULL;
data->nr_cpus = nr_cpus;
data->cpu_data = calloc(1, sizeof(*data->cpu_data) * nr_cpus);
if (!data->cpu_data)
goto cleanup;
return data;
clea... | [
1,
0
] |
Linux Kernel | tools/tracing/rtla/src/osnoise_top.c | static void clear_terminal(struct trace_seq *seq) {
if (!config_debug)
trace_seq_printf(seq, "\033c");
} | [
0,
0
] |
Linux Kernel | tools/tracing/rtla/src/osnoise_top.c | static void osnoise_top_print(struct osnoise_tool *tool, int cpu) {
struct trace_seq *s = tool->trace.seq;
struct osnoise_top_cpu *cpu_data;
struct osnoise_top_data *data;
int percentage;
int decimal;
data = tool->data;
cpu_data = &data->cpu_data[cpu];
if (!cpu_data->sum_runtime)
return;
percen... | [
1,
0
] |
Linux Kernel | tools/tracing/rtla/src/osnoise_top.c | static void osnoise_print_stats(struct osnoise_top_params *params,
struct osnoise_tool *top) {
struct trace_instance *trace = &top->trace;
static int nr_cpus = -1;
int i;
if (nr_cpus == -1)
nr_cpus = sysconf(_SC_NPROCESSORS_CONF);
if (!params->quiet)
clear_terminal(tr... | [
0,
0
] |
Linux Kernel | tools/tracing/rtla/src/osnoise_top.c | static void osnoise_top_set_signals(struct osnoise_top_params *params) {
signal(SIGINT, stop_top);
if (params->duration) {
signal(SIGALRM, stop_top);
alarm(params->duration);
}
} | [
0,
0
] |
Linux Kernel | tools/tracing/rtla/src/timerlat_hist.c | static void timerlat_free_histogram(struct timerlat_hist_data *data) {
int cpu;
for (cpu = 0; cpu < data->nr_cpus; cpu++) {
if (data->hist[cpu].irq)
free(data->hist[cpu].irq);
if (data->hist[cpu].thread)
free(data->hist[cpu].thread);
}
/* one set of histograms per CPU */
if (data->hist)... | [
1,
0
] |
Linux Kernel | tools/tracing/rtla/src/timerlat_hist.c | static int timerlat_hist_handler(struct trace_seq *s, struct tep_record *record,
struct tep_event *event, void *data) {
struct trace_instance *trace = data;
unsigned long long thread, latency;
struct osnoise_tool *tool;
int cpu = record->cpu;
tool = container_of(trace, struct... | [
0,
0
] |
Linux Kernel | tools/tracing/rtla/src/timerlat_top.c | static struct timerlat_top_data *timerlat_alloc_top(int nr_cpus) {
struct timerlat_top_data *data;
int cpu;
data = calloc(1, sizeof(*data));
if (!data)
return NULL;
data->nr_cpus = nr_cpus;
data->cpu_data = calloc(1, sizeof(*data->cpu_data) * nr_cpus);
if (!data->cpu_data)
goto cleanup;
/* s... | [
1,
0
] |
Linux Kernel | tools/tracing/rtla/src/timerlat_top.c | static void stop_top(int sig) { stop_tracing = 1; } | [
0,
0
] |
Linux Kernel | tools/tracing/rtla/src/trace.c | void disable_tracer(struct tracefs_instance *inst) {
enum tracefs_tracers t = TRACEFS_TRACER_NOP;
int retval;
retval = tracefs_tracer_set(inst, t);
if (retval < 0)
err_msg("Oops, error disabling tracer\n");
} | [
0,
0
] |
Linux Kernel | tools/tracing/rtla/src/trace.c | void destroy_instance(struct tracefs_instance *inst) {
tracefs_instance_destroy(inst);
tracefs_instance_free(inst);
} | [
0,
0
] |
Linux Kernel | tools/tracing/rtla/src/trace.c | struct trace_events *trace_event_alloc(const char *event_string) {
struct trace_events *tevent;
tevent = calloc(1, sizeof(*tevent));
if (!tevent)
return NULL;
tevent->system = strdup(event_string);
if (!tevent->system) {
free(tevent);
return NULL;
}
tevent->event = strstr(tevent->system, ":... | [
1,
0
] |
Linux Kernel | tools/tracing/rtla/src/trace.c | static void trace_event_disable_filter(struct trace_instance *instance,
struct trace_events *tevent) {
char filter[1024];
int retval;
if (!tevent->filter)
return;
if (!tevent->filter_enabled)
return;
debug_msg("Disabling %s:%s filter %s\n", tevent->system, tev... | [
0,
0
] |
Linux Kernel | tools/tracing/rtla/src/trace.c | static void trace_event_save_hist(struct trace_instance *instance,
struct trace_events *tevent) {
int retval, index, out_fd;
mode_t mode = 0644;
char path[1024];
char *hist;
if (!tevent)
return;
if (!tevent->trigger)
return;
/* is this a hist: trigger? */
ret... | [
1,
0
] |
Linux Kernel | tools/tracing/rtla/src/trace.c | static void trace_event_disable_trigger(struct trace_instance *instance,
struct trace_events *tevent) {
char trigger[1024];
int retval;
if (!tevent->trigger)
return;
if (!tevent->trigger_enabled)
return;
debug_msg("Disabling %s:%s trigger %s\n", tevent->syste... | [
0,
0
] |
Linux Kernel | tools/tracing/rtla/src/trace.c | static int trace_event_enable_trigger(struct trace_instance *instance,
struct trace_events *tevent) {
char trigger[1024];
int retval;
if (!tevent->trigger)
return 0;
if (!tevent->event) {
err_msg(
"Trigger %s applies only for single events, not for all %s:... | [
0,
0
] |
Linux Kernel | tools/tracing/rtla/src/trace.c | int trace_events_enable(struct trace_instance *instance,
struct trace_events *events) {
struct trace_events *tevent = events;
int retval;
while (tevent) {
debug_msg("Enabling event %s:%s\n", tevent->system, tevent->event ?: "*");
retval =
tracefs_event_enable(instance->ins... | [
0,
0
] |
Linux Kernel | tools/tracing/rtla/src/utils.c | void err_msg(const char *fmt, ...) {
char message[MAX_MSG_LENGTH];
va_list ap;
va_start(ap, fmt);
vsnprintf(message, sizeof(message), fmt, ap);
va_end(ap);
fprintf(stderr, "%s", message);
} | [
1,
0
] |
Linux Kernel | tools/tracing/rtla/src/utils.c | long long get_llong_from_str(char *start) {
long long value;
char *end;
errno = 0;
value = strtoll(start, &end, 10);
if (errno || start == end)
return -1;
return value;
} | [
0,
0
] |
Linux Kernel | tools/tracing/rtla/src/utils.c |
static inline int sched_getattr(pid_t pid, struct sched_attr *attr,
unsigned int size, unsigned int flags) {
return syscall(__NR_sched_getattr, pid, attr, size, flags);
} | [
0,
0
] |
Linux Kernel | tools/usb/ffs-aio-example/multibuff/device_app/aio_multibuff.c |
static void handle_ep0(int ep0, bool *ready) {
int ret;
struct usb_functionfs_event event;
ret = read(ep0, &event, sizeof(event));
if (!ret) {
perror("unable to read event from ep0");
return;
}
display_event(&event);
switch (event.type) {
case FUNCTIONFS_SETUP:
if (event.u.setup.bRequestTy... | [
1,
0
] |
Linux Kernel | tools/usb/ffs-aio-example/multibuff/device_app/aio_multibuff.c |
void delete_bufs(struct io_buffer *iobuf) {
unsigned i;
for (i = 0; i < iobuf->cnt; ++i) {
free(iobuf->buf[i]);
free(iobuf->iocb[i]);
}
free(iobuf->buf);
free(iobuf->iocb);
} | [
1,
0
] |
Linux Kernel | tools/usb/ffs-aio-example/simple/device_app/aio_simple.c | static void display_event(struct usb_functionfs_event *event) {
static const char *const names[] = {
[FUNCTIONFS_BIND] = "BIND", [FUNCTIONFS_UNBIND] = "UNBIND",
[FUNCTIONFS_ENABLE] = "ENABLE", [FUNCTIONFS_DISABLE] = "DISABLE",
[FUNCTIONFS_SETUP] = "SETUP", [FUNCTIONFS_SUSPEND] = "SUSPEND",
... | [
1,
0
] |
Linux Kernel | tools/usb/ffs-aio-example/simple/host_app/test.c |
int main(void) {
struct test_state state;
struct libusb_config_descriptor *conf;
struct libusb_interface_descriptor const *iface;
unsigned char in_addr, out_addr;
if (test_init(&state))
return 1;
libusb_get_config_descriptor(state.found, 0, &conf);
iface = &conf->interface[0].altsetting[0];
in_ad... | [
0,
0
] |
Linux Kernel | tools/usb/ffs-test.c |
static void init_thread(struct thread *t) {
t->buf = malloc(t->buf_size);
die_on(!t->buf, "malloc");
t->fd = open(t->filename, O_RDWR);
die_on(t->fd < 0, "%s", t->filename);
} | [
1,
0
] |
Linux Kernel | tools/usb/ffs-test.c |
static ssize_t fill_in_buf(struct thread *ignore, void *buf, size_t nbytes) {
size_t i;
__u8 *p;
(void)ignore;
switch (pattern) {
case PAT_ZERO:
memset(buf, 0, nbytes);
break;
case PAT_SEQ:
for (p = buf, i = 0; i < nbytes; ++i, ++p)
*p = i % 63;
break;
case PAT_PIPE:
return ... | [
1,
0
] |
Linux Kernel | tools/usb/ffs-test.c |
static ssize_t ep0_consume(struct thread *ignore, const void *buf,
size_t nbytes) {
static const char *const names[] = {
[FUNCTIONFS_BIND] = "BIND", [FUNCTIONFS_UNBIND] = "UNBIND",
[FUNCTIONFS_ENABLE] = "ENABLE", [FUNCTIONFS_DISABLE] = "DISABLE",
[FUNCTIONFS_SETUP] = ... | [
1,
0
] |
Linux Kernel | tools/usb/testusb.c | static char *speed(enum usb_device_speed s) {
switch (s) {
case USB_SPEED_UNKNOWN:
return "unknown";
case USB_SPEED_LOW:
return "low";
case USB_SPEED_FULL:
return "full";
case USB_SPEED_HIGH:
return "high";
case USB_SPEED_WIRELESS:
return "wireless";
case USB_SPEED_SUPER:
return "s... | [
0,
0
] |
Linux Kernel | tools/usb/testusb.c |
static int usbdev_ioctl(int fd, int ifno, unsigned request, void *param) {
struct usbdevfs_ioctl wrapper;
wrapper.ifno = ifno;
wrapper.ioctl_code = request;
wrapper.data = param;
return ioctl(fd, USBDEVFS_IOCTL, &wrapper);
} | [
0,
0
] |
Linux Kernel | tools/usb/testusb.c | static void *handle_testdev(void *arg) {
struct testdev *dev = arg;
int fd, i;
int status;
if ((fd = open(dev->name, O_RDWR)) < 0) {
perror("can't open dev file r/w");
return 0;
}
status = ioctl(fd, USBDEVFS_GET_SPEED, NULL);
if (status < 0)
fprintf(stderr, "USBDEVFS_GET_SPEED failed %d\n", ... | [
1,
1
] |
Linux Kernel | tools/usb/usbip/libsrc/list.h |
static inline void INIT_LIST_HEAD(struct list_head *list) {
list->next = list;
list->prev = list;
} | [
0,
0
] |
Linux Kernel | tools/usb/usbip/libsrc/names.c |
const char *names_product(u_int16_t vendorid, u_int16_t productid) {
struct product *p;
p = products[hashnum((vendorid << 16) | productid)];
for (; p; p = p->next)
if (p->vendorid == vendorid && p->productid == productid)
return p->name;
return NULL;
} | [
1,
0
] |
Linux Kernel | tools/usb/usbip/libsrc/names.c |
const char *names_subclass(u_int8_t classid, u_int8_t subclassid) {
struct subclass *s;
s = subclasses[hashnum((classid << 8) | subclassid)];
for (; s; s = s->next)
if (s->classid == classid && s->subclassid == subclassid)
return s->name;
return NULL;
} | [
1,
0
] |
Linux Kernel | tools/usb/usbip/libsrc/names.c |
const char *names_protocol(u_int8_t classid, u_int8_t subclassid,
u_int8_t protocolid) {
struct protocol *p;
p = protocols[hashnum((classid << 16) | (subclassid << 8) | protocolid)];
for (; p; p = p->next)
if (p->classid == classid && p->subclassid == subclassid &&
p->prot... | [
1,
0
] |
Linux Kernel | tools/usb/usbip/libsrc/names.c |
static int new_subclass(const char *name, u_int8_t classid,
u_int8_t subclassid) {
struct subclass *s;
unsigned int h = hashnum((classid << 8) | subclassid);
s = subclasses[h];
for (; s; s = s->next)
if (s->classid == classid && s->subclassid == subclassid)
return -1;
s = m... | [
1,
0
] |
Linux Kernel | tools/usb/usbip/libsrc/usbip_common.c |
void dump_usb_interface(struct usbip_usb_interface *uinf) {
char buff[100];
usbip_names_get_class(buff, sizeof(buff), uinf->bInterfaceClass,
uinf->bInterfaceSubClass, uinf->bInterfaceProtocol);
dbg("%-20s = %s", "Interface(C/SC/P)", buff);
} | [
1,
0
] |
Linux Kernel | tools/usb/usbip/libsrc/usbip_common.c |
void usbip_names_free(void) { names_free(); } | [
0,
0
] |
Linux Kernel | tools/usb/usbip/libsrc/usbip_device_driver.c |
static int is_my_device(struct udev_device *dev) {
const char *driver;
driver = udev_device_get_property_value(dev, "USB_UDC_NAME");
return driver != NULL && !strcmp(driver, USBIP_DEVICE_DRV_NAME);
} | [
1,
0
] |
Linux Kernel | tools/usb/usbip/libsrc/usbip_device_driver.c |
static int usbip_device_driver_open(struct usbip_host_driver *hdriver) {
int ret;
hdriver->ndevs = 0;
INIT_LIST_HEAD(&hdriver->edev_list);
ret = usbip_generic_driver_open(hdriver);
if (ret)
err("please load " USBIP_CORE_MOD_NAME ".ko and " USBIP_DEVICE_DRV_NAME
".ko!");
return ret;
} | [
0,
0
] |
Linux Kernel | tools/usb/usbip/libsrc/usbip_host_common.c |
static void usbip_exported_device_destroy(struct list_head *devs) {
struct list_head *i, *tmp;
struct usbip_exported_device *edev;
list_for_each_safe(i, tmp, devs) {
edev = list_entry(i, struct usbip_exported_device, node);
list_del(i);
free(edev);
}
} | [
1,
0
] |
Linux Kernel | tools/usb/usbip/libsrc/vhci_driver.c |
static int get_ncontrollers(void) {
struct dirent **namelist;
struct udev_device *platform;
int n;
platform = udev_device_get_parent(vhci_driver->hc_device);
if (platform == NULL)
return -1;
n = scandir(udev_device_get_syspath(platform), &namelist, vhci_hcd_filter,
NULL);
if (n < 0)
... | [
1,
0
] |
Linux Kernel | tools/usb/usbip/libsrc/vhci_driver.c |
void usbip_vhci_driver_close(void) {
if (!vhci_driver)
return;
udev_device_unref(vhci_driver->hc_device);
free(vhci_driver);
vhci_driver = NULL;
udev_unref(udev_context);
} | [
1,
0
] |
Linux Kernel | tools/usb/usbip/libsrc/vhci_driver.c | int usbip_vhci_detach_device(uint8_t port) {
char detach_attr_path[SYSFS_PATH_MAX];
char attr_detach[] = "detach";
char buff[200];
const char *path;
int ret;
snprintf(buff, sizeof(buff), "%u", port);
dbg("writing: %s", buff);
path = udev_device_get_syspath(vhci_driver->hc_device);
snprintf(detach_at... | [
1,
0
] |
Linux Kernel | tools/usb/usbip/src/usbipd.c |
static void usbipd_help(void) { printf("%s\n", usbipd_help_string); } | [
0,
0
] |
Linux Kernel | tools/usb/usbip/src/usbipd.c |
static int recv_request_devlist(int connfd) {
struct op_devlist_request req;
int rc;
memset(&req, 0, sizeof(req));
rc = usbip_net_recv(connfd, &req, sizeof(req));
if (rc < 0) {
dbg("usbip_net_recv failed: devlist request");
return -1;
}
rc = send_reply_devlist(connfd);
if (rc < 0) {
dbg(... | [
1,
0
] |
Linux Kernel | tools/usb/usbip/src/usbipd.c | static int listen_all_addrinfo(struct addrinfo *ai_head, int sockfdlist[],
int maxsockfd) {
struct addrinfo *ai;
int ret, nsockfd = 0;
const size_t ai_buf_size = NI_MAXHOST + NI_MAXSERV + 2;
char ai_buf[ai_buf_size];
for (ai = ai_head; ai && nsockfd < maxsockfd; ai = ai->ai_nex... | [
0,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.