-
-/*****************************************************************************
- *Get system information
- ****************************************************************************/
-#if 0
-gint getSystemInfo(LttSystemDescription* des, gchar * pathname)
-{
- int fd;
- GIOChannel *iochan;
- gchar *buf = NULL;
- gsize length;
-
- GMarkupParseContext * context;
- GError * error = NULL;
- GMarkupParser markup_parser =
- {
- parser_start_element,
- NULL,
- parser_characters,
- NULL, /* passthrough */
- NULL /* error */
- };
-
- fd = g_open(pathname, O_RDONLY, 0);
- if(fd == -1){
- g_warning("Can not open file : %s\n", pathname);
- return -1;
- }
-
- iochan = g_io_channel_unix_new(fd);
-
- context = g_markup_parse_context_new(&markup_parser, 0, des,NULL);
-
- //while(fgets(buf,DIR_NAME_SIZE, fp) != NULL){
- while(g_io_channel_read_line(iochan, &buf, &length, NULL, &error)
- != G_IO_STATUS_EOF) {
-
- if(error != NULL) {
- g_warning("Can not read xml file: \n%s\n", error->message);
- g_error_free(error);
- }
- if(!g_markup_parse_context_parse(context, buf, length, &error)){
- if(error != NULL) {
- g_warning("Can not parse xml file: \n%s\n", error->message);
- g_error_free(error);
- }
- g_markup_parse_context_free(context);
-
- g_io_channel_shutdown(iochan, FALSE, &error); /* No flush */
- if(error != NULL) {
- g_warning("Can not close file: \n%s\n", error->message);
- g_error_free(error);
- }
-
- close(fd);
- return -1;
- }
- }
- g_markup_parse_context_free(context);
-
- g_io_channel_shutdown(iochan, FALSE, &error); /* No flush */
- if(error != NULL) {
- g_warning("Can not close file: \n%s\n", error->message);
- g_error_free(error);
- }
-
- g_close(fd);
-
- g_free(buf);
- return 0;
-}
-#endif //0
-
-/*****************************************************************************
- *The following functions get facility/tracefile information
- ****************************************************************************/
-#if 0
-gint getFacilityInfo(LttTrace *t, gchar* eventdefs)
-{
- GDir * dir;
- const gchar * name;
- unsigned int i,j;
- LttFacility * f;
- LttEventType * et;
- gchar fullname[DIR_NAME_SIZE];
- GError * error = NULL;
-
- dir = g_dir_open(eventdefs, 0, &error);
-
- if(error != NULL) {
- g_warning("Can not open directory: %s, %s\n", eventdefs, error->message);
- g_error_free(error);
- return -1;
- }
-
- while((name = g_dir_read_name(dir)) != NULL){
- if(!g_pattern_match_simple("*.xml", name)) continue;
- strcpy(fullname,eventdefs);
- strcat(fullname,name);
- ltt_facility_open(t,fullname);
- }
- g_dir_close(dir);
-
- for(j=0;j<t->facility_number;j++){
- f = (LttFacility*)g_ptr_array_index(t->facilities, j);
- for(i=0; i<f->event_number; i++){
- et = f->events[i];
- setFieldsOffset(NULL, et, NULL, t);
- }
- }
- return 0;
-}
-#endif //0
-
-/*****************************************************************************
- *A trace is specified as a pathname to the directory containing all the
- *associated data (control tracefiles, per cpu tracefiles, event
- *descriptions...).
- *
- *When a trace is closed, all the associated facilities, types and fields
- *are released as well.
- */
-
-