/*++ /* NAME /* load_file 3 /* SUMMARY /* load file with some prejudice /* SYNOPSIS /* #include <load_file.h> /* /* void load_file(path, action, context) /* const char *path; /* void (*action)(VSTREAM, void *); /* void *context; /* DESCRIPTION /* This routine reads a file and reads it again when the /* file changed recently. /* /* Arguments: /* .IP path /* The file to be opened, read-only. /* .IP action /* The function that presumably reads the file. /* .IP context /* Application-specific context for the action routine. /* DIAGNOSTICS /* Fatal errors: out of memory, cannot open file. /* LICENSE /* .ad /* .fi /* The Secure Mailer license must be distributed with this software. /* AUTHOR(S) /* Wietse Venema /* IBM T.J. Watson Research /* P.O. Box 704 /* Yorktown Heights, NY 10598, USA
/*--*/
/* *Readthefileagainifitishot.Thismayresultinreadingapartial *parameternameormissingendmarkerwhenafilechangesinthemiddle *ofaread.
*/ for (before = time((time_t *) 0); /* see below */ ; before = after) { if ((fp = vstream_fopen(path, O_RDONLY, 0)) == 0)
msg_fatal("open %s: %m", path);
action(fp, context); if (fstat(vstream_fileno(fp), &st) < 0)
msg_fatal("fstat %s: %m", path); if (vstream_ferror(fp) || vstream_fclose(fp))
msg_fatal("read %s: %m", path);
after = time((time_t *) 0); if (st.st_mtime < before - 1 || st.st_mtime > after) break; if (msg_verbose)
msg_info("pausing to let %s cool down", path);
doze(300000);
}
}
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.5Bemerkung:
(vorverarbeitet am 2026-09-27)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.