Lines Matching refs:file

239 show(file_info_t *file)  in show()  argument
243 while ((ch = getc(file->fp)) != EOF) { in show()
244 if (last != file && no_files > 1) { in show()
247 file->file_name); in show()
248 last = file; in show()
254 if (ferror(file->fp)) { in show()
255 (void) fclose(file->fp); in show()
256 file->fp = NULL; in show()
257 ierr(file->file_name); in show()
260 clearerr(file->fp); in show()
265 associate(file_info_t *file, boolean_t assoc, port_event_t *ev) in associate() argument
270 if (action != USE_PORT || file->fp == NULL) in associate()
273 if (!S_ISREG(file->st.st_mode)) { in associate()
279 fileno(file->fp), POLLIN, file); in associate()
282 fileno(file->fp)); in associate()
288 bzero(&file->fobj, sizeof (file->fobj)); in associate()
310 sizeof (buf), "/proc/self/fd/%d", fileno(file->fp)); in associate()
313 name = file->file_name; in associate()
324 file->fobj[0].fo_name = name; in associate()
325 file->fobj[1].fo_name = name; in associate()
346 (uintptr_t)&file->fobj[0], FILE_TRUNC, file); in associate()
348 (uintptr_t)&file->fobj[1]); in associate()
355 (uintptr_t)&file->fobj[1], FILE_MODIFIED, file); in associate()
360 (uintptr_t)&file->fobj[i]); in associate()
369 file_info_t *file; in set_events() local
371 for (i = 0, file = files; i < no_files; i++, file++) { in set_events()
372 if (! file->fp) in set_events()
375 (void) fstat(fileno(file->fp), &file->st); in set_events()
377 associate(file, B_TRUE, NULL); in set_events()
390 file_info_t *file; in follow() local
396 file = files; in follow()
399 for (i = 0; i < no_files; i++, file++) { in follow()
400 if (file->fp) { in follow()
405 file->file_name); in follow()
406 forward(file->fp, file->file_name, style, off, in follow()
407 &file->st); in follow()
408 if (Fflag && fileno(file->fp) != STDIN_FILENO) in follow()
415 last = --file; in follow()
427 for (i = 0, file = files; i < no_files; i++, file++) { in follow()
428 if (!file->fp) { in follow()
429 file->fp = fopen(file->file_name, "r"); in follow()
430 if (file->fp != NULL && in follow()
431 fstat(fileno(file->fp), &file->st) in follow()
433 (void) fclose(file->fp); in follow()
434 file->fp = NULL; in follow()
436 if (file->fp != NULL) in follow()
440 if (fileno(file->fp) == STDIN_FILENO) in follow()
442 if (stat(file->file_name, &sb2) == -1) { in follow()
444 ierr(file->file_name); in follow()
445 (void) show(file); in follow()
446 (void) fclose(file->fp); in follow()
447 file->fp = NULL; in follow()
452 if (sb2.st_ino != file->st.st_ino || in follow()
453 sb2.st_dev != file->st.st_dev || in follow()
455 (void) show(file); in follow()
456 associate(file, B_FALSE, NULL); in follow()
457 file->fp = freopen(file->file_name, "r", in follow()
458 file->fp); in follow()
459 if (file->fp != NULL) { in follow()
460 (void) memcpy(&file->st, &sb2, in follow()
463 ierr(file->file_name); in follow()
469 for (i = 0, file = files; i < no_files; i++, file++) in follow()
470 if (file->fp && !show(file)) in follow()
488 file = (file_info_t *)ev.portev_user; in follow()
489 associate(file, B_TRUE, &ev); in follow()
492 (void) fseek(file->fp, 0, SEEK_SET); in follow()