+ if(info->active) {
+ printf(
+ "LTTng ERROR : lttng_free_trace_info should be called on inactive trace\n");
+ exit(1);
+ }
+ if(!info->destroy) {
+ printf(
+ "LTTng ERROR : lttng_free_trace_info should be called on destroyed trace\n");
+ exit(1);
+ }
+ if(atomic_read(&info->nesting) > 0) {
+ printf(
+ "LTTng ERROR : lttng_free_trace_info should not be nested on tracing\n");
+ exit(1);
+ }
+
+ /* Remove the maps */
+ ret = munmap(info->channel.cpu.start, info->channel.cpu.length);
+ if(ret) {
+ perror("LTTNG : error in munmap");
+ }
+ ret = munmap(info->channel.facilities.start, info->channel.facilities.length);
+ if(ret) {
+ perror("LTTNG : error in munmap");
+ }
+
+ /* Zero the structure */
+ memset(info, 0, sizeof(struct lttng_trace_info));
+}
+
+
+static struct lttng_trace_info* find_info(unsigned long cpu_addr,
+ unsigned long fac_addr, unsigned int *first_empty)
+{
+ struct lttng_trace_info *found = NULL;
+ unsigned int i;
+
+ *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) {
+ /* Found */
+ found = <tng_trace_info[i];
+ break;
+ }
+ }
+ return found;
+}
+
+
+static void lttng_get_new_info(void)
+{
+ unsigned long cpu_addr, fac_addr;
+ unsigned int i, first_empty;
+ int active, filter, destroy;
+ int ret;
+ struct lttng_trace_info *info;
+ sigset_t set, oldset;
+