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