+
+static void lttng_get_new_info(void)
+{
+ unsigned long cpu_addr, fac_addr;
+ unsigned int i, first_empty;
+ int active, filter;
+ int ret;
+
+ /* Get all the new traces */
+ while(1) {
+ cpu_addr = fac_addr = 0;
+ active = filter = 0;
+ ret = ltt_update(&cpu_addr, &fac_addr, &active, &filter);
+ if(ret) {
+ printf("LTTng : error in ltt_update\n");
+ exit(1);
+ }
+
+ if(!cpu_addr || !fac_addr) break;
+
+ first_empty = MAX_TRACES;
+ /* Try to find the trace */
+ for(i=0;i<MAX_TRACES;i++) {
+ if(i<first_empty && !lttng_trace_info[i].channel.cpu.start)
+ first_empty = i;
+ if(cpu_addr ==
+ (unsigned long)lttng_trace_info[i].channel.cpu.start &&
+ fac_addr ==
+ (unsigned long)lttng_trace_info[i].channel.facilities.start) {
+
+ lttng_trace_info[i].filter = filter;
+ lttng_trace_info[i].active = active;
+ }
+
+ }
+ if(i == MAX_TRACES) {
+ /* Not found. Must take an empty slot */
+ if(first_empty == MAX_TRACES) {
+ printf(
+ "LTTng WARNING : too many traces requested for pid %d by the kernel.\n"
+ " Compilation defined maximum is %u\n",
+ getpid(), MAX_TRACES);
+
+ } else {
+ lttng_trace_info[first_empty].channel.cpu.start = (void*)cpu_addr;
+ lttng_trace_info[first_empty].channel.facilities.start =
+ (void*)fac_addr;
+ lttng_trace_info[first_empty].filter = filter;
+ lttng_trace_info[first_empty].active = active;
+ }
+ }
+ }
+}
+
+