• Home
  • Raw
  • Download

Lines Matching refs:dom

87 static int parseLogConfig(int dom, unsigned short mask, char* filenames){  in parseLogConfig()  argument
112 …VERIFY_IPRINTF("%s: #files: %d max_len: %d\n", log_config_watcher[dom].fileToWatch, filesToLogLen,… in parseLogConfig()
129 VERIFY_IPRINTF("%s: %s\n", log_config_watcher[dom].fileToWatch, filesToLog[i].data); in parseLogConfig()
134 handle = get_adsp_current_process1_handle(dom); in parseLogConfig()
158 …VERIFY_EPRINTF("Error %x: parse log config failed. domain %d, mask %x, filename %s\n", nErr, dom, … in parseLogConfig()
163 static int readLogConfigFromPath(int dom, const char* base, const char* file){ in readLogConfigFromPath() argument
181 VERIFY_IPRINTF("%s: Couldn't find file: %s\n",log_config_watcher[dom].fileToWatch, path); in readLogConfigFromPath()
185 if (log_config_watcher[dom].adspmsgdEnabled == FALSE){ in readLogConfigFromPath()
186 handle = get_adspmsgd_adsp1_handle(dom); in readLogConfigFromPath()
195 log_config_watcher[dom].adspmsgdEnabled = TRUE; in readLogConfigFromPath()
197 VERIFY_EPRINTF("Found %s. adspmsgd enabled \n", log_config_watcher[dom].fileToWatch); in readLogConfigFromPath()
209 …VERIFY_IPRINTF("%s: Config file %s contents: %s\n", log_config_watcher[dom].fileToWatch, path, buf… in readLogConfigFromPath()
214 VERIFY_IPRINTF("%s: Setting log mask:0x%x", log_config_watcher[dom].fileToWatch, mask); in readLogConfigFromPath()
215 handle = get_adsp_current_process1_handle(dom); in readLogConfigFromPath()
223 VERIFY(AEE_SUCCESS == (nErr = parseLogConfig(dom, mask,filenames))); in readLogConfigFromPath()
224 …VERIFY_IPRINTF("%s: Setting log mask:0x%x, filename:%s", log_config_watcher[dom].fileToWatch, mask… in readLogConfigFromPath()
227 …VERIFY_EPRINTF("%s: No valid data found in config file %s", log_config_watcher[dom].fileToWatch, p… in readLogConfigFromPath()
260 static int readLogConfigFromEvent(int dom, struct inotify_event *event){ in readLogConfigFromEvent() argument
264 for (i = 0; i < (int)log_config_watcher[dom].numPaths; ++i){ in readLogConfigFromEvent()
265 if (log_config_watcher[dom].wd[i] == event->wd ){ in readLogConfigFromEvent()
266 if(std_strcmp(log_config_watcher[dom].fileToWatch, event->name) == 0){ in readLogConfigFromEvent()
267 …return readLogConfigFromPath(dom, log_config_watcher[dom].paths[i].data, log_config_watcher[dom].f… in readLogConfigFromEvent()
268 }else if (std_strcmp(log_config_watcher[dom].asidFileToWatch, event->name) == 0) { in readLogConfigFromEvent()
269 …return readLogConfigFromPath(dom, log_config_watcher[dom].paths[i].data, log_config_watcher[dom].a… in readLogConfigFromEvent()
270 }else if (std_strcmp(log_config_watcher[dom].pidFileToWatch, event->name) == 0){ in readLogConfigFromEvent()
271 …return readLogConfigFromPath(dom, log_config_watcher[dom].paths[i].data, log_config_watcher[dom].p… in readLogConfigFromEvent()
275 …VERIFY_IPRINTF("%s: Watch descriptor %d not valid for current process", log_config_watcher[dom].fi… in readLogConfigFromEvent()
281 static int resetLogConfigFromEvent(int dom, struct inotify_event *event) { in resetLogConfigFromEvent() argument
286 for (i = 0; i < (int)log_config_watcher[dom].numPaths; ++i){ in resetLogConfigFromEvent()
287 if (log_config_watcher[dom].wd[i] == event->wd ){ in resetLogConfigFromEvent()
288 if( (std_strcmp(log_config_watcher[dom].fileToWatch, event->name) == 0)|| in resetLogConfigFromEvent()
289 (std_strcmp(log_config_watcher[dom].asidFileToWatch, event->name) == 0) || in resetLogConfigFromEvent()
290 (std_strcmp(log_config_watcher[dom].pidFileToWatch, event->name) == 0) ) { in resetLogConfigFromEvent()
291 if (log_config_watcher[dom].adspmsgdEnabled == TRUE){ in resetLogConfigFromEvent()
292 handle = get_adspmsgd_adsp1_handle(dom); in resetLogConfigFromEvent()
299 handle = get_adsp_current_process1_handle(dom); in resetLogConfigFromEvent()
308 …VERIFY_IPRINTF("%s: Watch descriptor %d not valid for current process", log_config_watcher[dom].fi… in resetLogConfigFromEvent()
314 int dom = (int)(uintptr_t)arg; in file_watcher_thread() local
321 {log_config_watcher[dom].fd, POLLIN, 0}, in file_watcher_thread()
322 {log_config_watcher[dom].event_fd, POLLIN, 0} in file_watcher_thread()
329 for (i = 0; i < (int)log_config_watcher[dom].numPaths; ++i){ in file_watcher_thread()
330 …if (0 == readLogConfigFromPath(dom, log_config_watcher[dom].paths[i].data, log_config_watcher[dom]… in file_watcher_thread()
331 …F("%s: Log config File %s found.\n", log_config_watcher[dom].fileToWatch, log_config_watcher[dom].… in file_watcher_thread()
335 while(log_config_watcher[dom].stopThread == 0){ in file_watcher_thread()
339 …ntime FARF will not work for this process. errno=%x !", log_config_watcher[dom].fileToWatch, errno… in file_watcher_thread()
345 length = read( log_config_watcher[dom].fd, buffer, EVENT_BUF_LEN ); in file_watcher_thread()
352 if (log_config_watcher[dom].asidToWatch == -1){ in file_watcher_thread()
353 handle = get_adsp_current_process1_handle(dom); in file_watcher_thread()
355 …Err = adsp_current_process1_getASID(handle,(unsigned int*)&log_config_watcher[dom].asidToWatch ))); in file_watcher_thread()
357 …SS == (nErr = adsp_current_process_getASID((unsigned int*)&log_config_watcher[dom].asidToWatch ))); in file_watcher_thread()
360 …VERIFYC(NULL != (log_config_watcher[dom].asidFileToWatch = malloc(sizeof(char) * len)), AEE_ENOMEM… in file_watcher_thread()
361 …snprintf(log_config_watcher[dom].asidFileToWatch, len, "%d%s", log_config_watcher[dom].asidToWatch… in file_watcher_thread()
362 …RINTF("%s: Watching ASID file %s\n", log_config_watcher[dom].fileToWatch, log_config_watcher[dom].… in file_watcher_thread()
365 … VERIFY_IPRINTF("%s: %s %d.\n", log_config_watcher[dom].fileToWatch, event->name, event->mask ); in file_watcher_thread()
367 … VERIFY_IPRINTF("%s: File %s created.\n", log_config_watcher[dom].fileToWatch, event->name ); in file_watcher_thread()
368 if (0 != readLogConfigFromEvent(dom, event)){ in file_watcher_thread()
369 …("%s: Error reading config file %s", log_config_watcher[dom].fileToWatch, log_config_watcher[dom].… in file_watcher_thread()
373 … VERIFY_IPRINTF("%s: File %s deleted.\n", log_config_watcher[dom].fileToWatch, event->name ); in file_watcher_thread()
374 if (0 != resetLogConfigFromEvent(dom, event)){ in file_watcher_thread()
375 …VERIFY_EPRINTF("%s: Error resetting FARF runtime log config" ,log_config_watcher[dom].fileToWatch); in file_watcher_thread()
386 …me FARF will not work for this process. filename %s\n", nErr, log_config_watcher[dom].fileToWatch); in file_watcher_thread()
391 void deinitFileWatcher(int dom) { in deinitFileWatcher() argument
396 log_config_watcher[dom].stopThread = 1; in deinitFileWatcher()
397 if (0 < log_config_watcher[dom].event_fd) { in deinitFileWatcher()
398 if (write(log_config_watcher[dom].event_fd, &stop, sizeof(uint64)) != sizeof(uint64)) { in deinitFileWatcher()
402 if (log_config_watcher[dom].thread) { in deinitFileWatcher()
403 pthread_join(log_config_watcher[dom].thread, NULL); in deinitFileWatcher()
404 log_config_watcher[dom].thread = 0; in deinitFileWatcher()
406 if (log_config_watcher[dom].fileToWatch){ in deinitFileWatcher()
407 free (log_config_watcher[dom].fileToWatch); in deinitFileWatcher()
408 log_config_watcher[dom].fileToWatch = 0; in deinitFileWatcher()
410 if (log_config_watcher[dom].asidFileToWatch){ in deinitFileWatcher()
411 free (log_config_watcher[dom].asidFileToWatch); in deinitFileWatcher()
412 log_config_watcher[dom].asidFileToWatch = 0; in deinitFileWatcher()
414 if (log_config_watcher[dom].pidFileToWatch){ in deinitFileWatcher()
415 free (log_config_watcher[dom].pidFileToWatch); in deinitFileWatcher()
416 log_config_watcher[dom].pidFileToWatch = 0; in deinitFileWatcher()
418 if (log_config_watcher[dom].wd){ in deinitFileWatcher()
419 for (i = 0; i < (int)log_config_watcher[dom].numPaths; ++i){ in deinitFileWatcher()
420 if (log_config_watcher[dom].wd[i] != 0){ in deinitFileWatcher()
421 inotify_rm_watch( log_config_watcher[dom].fd, log_config_watcher[dom].wd[i] ); in deinitFileWatcher()
424 free(log_config_watcher[dom].wd); in deinitFileWatcher()
425 log_config_watcher[dom].wd = NULL; in deinitFileWatcher()
427 if (log_config_watcher[dom].paths){ in deinitFileWatcher()
428 for (i = 0; i < (int)log_config_watcher[dom].numPaths; ++i){ in deinitFileWatcher()
429 if (log_config_watcher[dom].paths[i].data){ in deinitFileWatcher()
430 free(log_config_watcher[dom].paths[i].data); in deinitFileWatcher()
431 log_config_watcher[dom].paths[i].data = NULL; in deinitFileWatcher()
434 free(log_config_watcher[dom].paths); in deinitFileWatcher()
435 log_config_watcher[dom].paths = NULL; in deinitFileWatcher()
437 if(log_config_watcher[dom].fd != 0){ in deinitFileWatcher()
438 close(log_config_watcher[dom].fd); in deinitFileWatcher()
439 log_config_watcher[dom].fd = 0; in deinitFileWatcher()
441 if (log_config_watcher[dom].adspmsgdEnabled == TRUE){ in deinitFileWatcher()
442 handle = get_adspmsgd_adsp1_handle(dom); in deinitFileWatcher()
448 log_config_watcher[dom].adspmsgdEnabled = FALSE; in deinitFileWatcher()
451 if(log_config_watcher[dom].event_fd != 0){ in deinitFileWatcher()
452 close(log_config_watcher[dom].event_fd); in deinitFileWatcher()
453 log_config_watcher[dom].event_fd = 0; in deinitFileWatcher()
456 log_config_watcher[dom].numPaths = 0; in deinitFileWatcher()
459 int initFileWatcher(int dom) { in initFileWatcher() argument
467 memset(&log_config_watcher[dom], 0, sizeof(struct log_config_watcher_params)); in initFileWatcher()
468 log_config_watcher[dom].asidToWatch = 0; in initFileWatcher()
473 …VERIFYC(NULL != (log_config_watcher[dom].fileToWatch = malloc(sizeof(char) * len)), AEE_ENOMEMORY); in initFileWatcher()
474 snprintf(log_config_watcher[dom].fileToWatch, len, "%s%s", name, fileExtension); in initFileWatcher()
477 …VERIFYC(NULL != (log_config_watcher[dom].pidFileToWatch = malloc(sizeof(char) * len)), AEE_ENOMEMO… in initFileWatcher()
478 snprintf(log_config_watcher[dom].pidFileToWatch, len, "%d%s", getpid(), fileExtension); in initFileWatcher()
480 …RINTF("%s: Watching PID file: %s\n", log_config_watcher[dom].fileToWatch, log_config_watcher[dom].… in initFileWatcher()
482 log_config_watcher[dom].fd = inotify_init(); in initFileWatcher()
483 if (log_config_watcher[dom].fd < 0){ in initFileWatcher()
490 log_config_watcher[dom].event_fd = eventfd(0, 0); in initFileWatcher()
491 if (log_config_watcher[dom].event_fd < 0){ in initFileWatcher()
496 …VERIFY_IPRINTF("fd = %d dupfd=%d\n", log_config_watcher[dom].fd, log_config_watcher[dom].event_fd); in initFileWatcher()
500 &log_config_watcher[dom].numPaths, &maxPathLen); in initFileWatcher()
505 VERIFYC(NULL != (log_config_watcher[dom].paths in initFileWatcher()
506 = malloc(sizeof(_cstring1_t) * log_config_watcher[dom].numPaths)), AEE_ENOMEMORY); in initFileWatcher()
507 VERIFYC(NULL != (log_config_watcher[dom].wd in initFileWatcher()
508 = malloc(sizeof(int) * log_config_watcher[dom].numPaths)), AEE_ENOMEMORY); in initFileWatcher()
510 for (i = 0; i < (int)log_config_watcher[dom].numPaths; ++i){ in initFileWatcher()
511 VERIFYC( NULL != (log_config_watcher[dom].paths[i].data in initFileWatcher()
513 log_config_watcher[dom].paths[i].dataLen = maxPathLen; in initFileWatcher()
518 log_config_watcher[dom].paths, log_config_watcher[dom].numPaths, &len, &maxPathLen))); in initFileWatcher()
522 VERIFY_IPRINTF("%s: Watching folders:\n", log_config_watcher[dom].fileToWatch); in initFileWatcher()
523 for (i = 0; i < (int)log_config_watcher[dom].numPaths; ++i){ in initFileWatcher()
525 …IPRINTF("log file watcher: %s: %s\n",log_config_watcher[dom].fileToWatch, log_config_watcher[dom].… in initFileWatcher()
526 if((log_config_watcher[dom].wd[i] = inotify_add_watch (log_config_watcher[dom].fd, in initFileWatcher()
527 log_config_watcher[dom].paths[i].data, IN_CREATE | IN_DELETE)) < 0) { in initFileWatcher()
528 …VERIFY_EPRINTF("Unable to add watcher for folder %s : errno is %s\n", log_config_watcher[dom].path… in initFileWatcher()
533 log_config_watcher[dom].asidToWatch = -1; in initFileWatcher()
534 log_config_watcher[dom].stopThread = 0; in initFileWatcher()
535 … pthread_create(&log_config_watcher[dom].thread, NULL, file_watcher_thread, (void*)(uintptr_t)dom); in initFileWatcher()
538 … Runtime FARF will not work for the process %s!", nErr, log_config_watcher[dom].fileToWatch, name); in initFileWatcher()
539 deinitFileWatcher(dom); in initFileWatcher()