=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/aucat/Attic/pipe.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- src/usr.bin/aucat/Attic/pipe.c 2010/04/03 17:59:17 1.10 +++ src/usr.bin/aucat/Attic/pipe.c 2010/04/06 20:07:01 1.11 @@ -139,3 +139,54 @@ close(f->fd); } + +off_t +pipe_endpos(struct file *file) +{ + struct pipe *f = (struct pipe *)file; + off_t pos; + + pos = lseek(f->fd, 0, SEEK_END); + if (pos < 0) { +#ifdef DEBUG + file_dbg(&f->file); + dbg_puts(": couldn't get file size\n"); +#endif + return 0; + } + return pos; +} + +int +pipe_seek(struct file *file, off_t pos) +{ + struct pipe *f = (struct pipe *)file; + off_t newpos; + + newpos = lseek(f->fd, pos, SEEK_SET); + if (newpos < 0) { +#ifdef DEBUG + file_dbg(&f->file); + dbg_puts(": couldn't seek\n"); +#endif + /* XXX: call eof() */ + return 0; + } + return 1; +} + +int +pipe_trunc(struct file *file, off_t pos) +{ + struct pipe *f = (struct pipe *)file; + + if (ftruncate(f->fd, pos) < 0) { +#ifdef DEBUG + file_dbg(&f->file); + dbg_puts(": couldn't truncate file\n"); +#endif + /* XXX: call hup() */ + return 0; + } + return 1; +}