Lines Matching refs:tf
278 static int write_rotate(struct logfile *tf, int len)
282 isreg = (!fstat(tf->logfd, &statf) && S_ISREG(statf.st_mode));
288 int i = strlen(tf->filename) + 3 + 1;
293 sprintf(new_file, "%s.%d", tf->filename, i);
295 sprintf(old_file, "%s.%d", tf->filename, --i);
298 rename(tf->filename, new_file);
299 unlink(tf->filename);
300 close(tf->logfd);
301 tf->logfd = open(tf->filename, O_CREAT | O_WRONLY | O_APPEND, 0666);
302 if (tf->logfd < 0) {
303 perror_msg("can't open %s", tf->filename);
307 ftruncate(tf->logfd, 0);
310 return write(tf->logfd, toybuf, len);
320 struct logfile *tf = TT.lfiles;
359 for (; tf; tf = tf->next) {
360 if (tf->logfd > 0) {
361 if (!((tf->facility[lvl] & (1 << fac)) || (tf->level[fac] & (1<<lvl)))) {
362 int wlen, isNetwork = *tf->filename == '@';
364 wlen = sendto(tf->logfd, omsg, olen, 0, (struct sockaddr*)&tf->saddr, sizeof(tf->saddr));
365 else wlen = write_rotate(tf, len);
366 if (wlen < 0) perror_msg("write failed file : %s ", tf->filename + isNetwork);