* tailing reliable realtime streaming feeder for inn
* infile.c - monitoring and handling of input files
*
- * Copyright (C) 2010 Ian Jackson <ijackson@chiark.greenend.org.uk>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * (I believe that when you compile and link this as part of the inn2
- * build, with the Makefile runes I have provided, all the libraries
- * and files which end up included in innduct are licence-compatible
- * with GPLv3. If not then please let me know. -Ian Jackson.)
+ * Copyright Ian Jackson <ijackson@chiark.greenend.org.uk>
+ * and contributors; see LICENCE.txt.
+ * SPDX-License-Identifier: GPL-3.0-or-later
*/
#include "innduct.h"
LIST_INIT(ipf->queue);
strcpy(ipf->path, path);
+ dbg("started input file %p %s", ipf, path);
+
return ipf;
}
* on_cancel which will cancel this callback */
InputFile *ipf= user;
- dbg("**TRACT** ipf=%p called",ipf);
+ //dbg("**TRACT** ipf=%p called",ipf);
if (!ipf->fake_readable) return OOP_CONTINUE;
/* we just keep calling readable until our caller (oop_rd)
* has called try_read, and try_read has found EOF so given EAGAIN */
- dbg("**TRACT** ipf=%p reschedule",ipf);
+ //dbg("**TRACT** ipf=%p reschedule",ipf);
tailing_rable_on_time(ipf);
assert(ipf->readable_callback);
static void tailing_on_cancel(struct oop_readable *rable) {
InputFile *ipf= (void*)rable;
- dbg("**TOR** ipf=%p on_cancel",ipf);
+ //dbg("**TOR** ipf=%p on_cancel",ipf);
if (ipf->filemon) filemon_stop(ipf);
- dbg("**TRACT** ipf=%p cancel",ipf);
+ //dbg("**TRACT** ipf=%p cancel",ipf);
loop->cancel_time(loop, OOP_TIME_NOW, tailing_rable_call_time, ipf);
ipf->readable_callback= 0;
}
void tailing_make_readable(InputFile *ipf) {
- dbg("**TRACT** ipf=%p makereadable rcb=%p",ipf,
- (void*)ipf?ipf->readable_callback:0);
+ //dbg("**TRACT** ipf=%p makereadable rcb=%p",ipf,
+ // (void*)ipf?ipf->readable_callback:0);
if (!ipf || !ipf->readable_callback) /* so callers can be naive */
return;
ipf->fake_readable= 1;
static int tailing_on_readable(struct oop_readable *rable,
oop_readable_call *cb, void *user) {
InputFile *ipf= (void*)rable;
- dbg("**TOR** ipf=%p on_readable",ipf);
+ //dbg("**TOR** ipf=%p on_readable",ipf);
tailing_on_cancel(rable);
ipf->readable_callback= cb;
abort();
}
}
- dbg("**TOR** ipf=%p try_read r=%d",ipf,r);
+ //dbg("**TOR** ipf=%p try_read r=%d",ipf,r);
return r;
}
}
}
char *dbg_report_ipf(InputFile *ipf) {
- if (!ipf) return xasprintf("none");
+ if (!ipf) return masprintf("none");
const char *slash= strrchr(ipf->path,'/');
const char *path= slash ? slash+1 : ipf->path;
- return xasprintf("%p/%s:queue=%d,ip=%ld,autodef=%ld,off=%ld,fd=%d%s%s%s",
+ return masprintf("%p/%s:queue=%d,ip=%ld,autodef=%ld,off=%ld,fd=%d%s%s%s",
ipf, path,
ipf->queue.count, ipf->inprogress, ipf->autodefer,
(long)ipf->offset, ipf->fd,