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