off_t #else int #endif ffpos( int fd, int cmd, #if defined(__mips) || defined(_LITTLE_ENDIAN) void *arg, #else long *arg, #endif int len, struct ffsw *stat ) { struct fdinfo *fio; _ffseek_t ret; fio = GETIOB(fd); CHECK_FIOPTR(fio, stat); #if defined(__mips) || defined(_LITTLE_ENDIAN) if (cmd == FP_BSEEK) ERETURN(stat, FDC_ERR_NOSUP, 0); #endif ret = XRCALL(fio, posrtn) fio, cmd, arg, len, stat); return (ret); }
ffreada(int fd, char *buf, int nbytes, struct ffsw *stat, ...) { struct fdinfo *fio; int ret, locfulp; bitptr bufptr; int locubc, *pubc, na; /* need a place to put result */ va_list ap; fio = GETIOB(fd); SET_BPTR(bufptr, CPTR2BP(buf)); /* adjust number of bits requested if ubc passed in */ NUMARG(na); locubc = 0; pubc = &locubc; locfulp = FULL; if (na < 4 || na > 6) { errno = FDC_ERR_NOPARM; return(ERR); } va_start(ap, stat); if (na > 4) locfulp = va_arg(ap, int); if (na > 5) pubc = va_arg(ap, int *); CHECK_FIOPTR(fio, stat); ret = XRCALL(fio, readartn) fio, bufptr, nbytes, stat, locfulp, pubc); return (ret); }
ffbksp(int fd, ...) #endif { struct fdinfo *fio; int ret, na; struct ffsw locstat, *pstat; #ifdef _CRAY va_list ap; #endif fio = GETIOB(fd); #ifdef _CRAY NUMARG(na); if (na < 2) pstat = &locstat; else { va_start(ap, fd); pstat = va_arg(ap, struct ffsw *); } #else pstat = &locstat; na = 1; #endif CHECK_FIOPTR(fio, pstat); ret = XRCALL(fio, backrtn) fio, pstat); /* set errno only if stat was not passed */ if (na < 2) errno = locstat.sw_error; return (ret); }
ffweof(int fd, ...) #endif { struct fdinfo *fio; int ret, na; struct ffsw locstat, *pstat; #if !defined(__mips) && !defined(_LITTLE_ENDIAN) va_list ap; #endif fio = GETIOB(fd); #if defined(__mips) || defined(_LITTLE_ENDIAN) na = 1; pstat = &locstat; #else NUMARG(na); if (na < 2) pstat = &locstat; else { va_start(ap, fd); pstat = va_arg(ap, struct ffsw *); } #endif CHECK_FIOPTR(fio, pstat); ret = XRCALL(fio, weofrtn) fio, pstat); #if !defined(__mips) && !defined(_LITTLE_ENDIAN) if (na < 2) errno = locstat.sw_error; #endif return (ret); }
int ffbkspf(int fd, struct ffsw *pstat) { struct fdinfo *fio; fio = GETIOB(fd); CHECK_FIOPTR(fio, pstat); return(XRCALL(fio, backrtn) fio, pstat)); }
/* * This routine is like ffweof, except it expects 2 parameters */ ffweoff(int fd, struct ffsw *pstat) { struct fdinfo *fio; int ret; fio = GETIOB(fd); CHECK_FIOPTR(fio, pstat); ret = XRCALL(fio, weofrtn) fio, pstat); return (ret); }
int ffread(int fd, char *buf, int nbytes, ...) #endif { struct fdinfo *fio; ssize_t ret; int locfulp; bitptr bufptr; int locubc, *pubc, na; /* need a place to put result */ struct ffsw locstat, *pstat; /* need a place to put result */ #if !defined(__mips) && !defined(_LITTLE_ENDIAN) va_list ap; #endif fio = GETIOB(fd); SET_BPTR(bufptr, CPTR2BP(buf)); /* adjust number of bits requested if ubc passed in */ #ifdef _CRAY NUMARG(na); #elif defined(__mips) || defined(_LITTLE_ENDIAN) na = 3; #endif locubc = 0; pubc = &locubc; locfulp = FULL; pstat = &locstat; #if !defined(__mips) && !defined(_LITTLE_ENDIAN) va_start(ap, nbytes); if (na < 3 || na > 6) { errno = FDC_ERR_NOPARM; return(ERR); } if (na > 3) pstat = va_arg(ap, struct ffsw *); if (na > 4) locfulp = va_arg(ap, int); if (na > 5) pubc = va_arg(ap, int *); #endif CHECK_FIOPTR(fio, pstat); ret = XRCALL(fio, readrtn) fio, bufptr, nbytes, pstat, locfulp, pubc); if (na < 4) errno = locstat.sw_error; return (ret); }
/* * This routine is like ffread, except it expects all parameters . * If ubc == NULL, then do not return ubc information to user. */ ssize_t ffreadf(int fd, void *buf, size_t nbytes, struct ffsw *pstat, int locfulp, int *ubc) { struct fdinfo *fio; ssize_t ret; bitptr bufptr; int locubc, *pubc; if (ubc == NULL) { pubc = &locubc; locubc = 0; } else { pubc = ubc; } fio = GETIOB(fd); SET_BPTR(bufptr, CPTR2BP(buf)); CHECK_FIOPTR(fio, pstat); ret = XRCALL(fio, readrtn) fio, bufptr, nbytes, pstat, locfulp, pubc); return (ret); }
ffsetsp(int fd, ...) { struct fdinfo *fio; struct ffsw locstat, *pstat; int ret, na; va_list ap; fio = GETIOB(fd); NUMARG(na); if (na < 2) pstat = &locstat; else { va_start(ap, fd); pstat = va_arg(ap, struct ffsw *); } CHECK_FIOPTR(fio, pstat); _eov_load(1); /* Call a routine that provides hard references */ /* to eov routines. */ ret = XRCALL(fio, fcntlrtn) fio, FC_SETSP, 1, pstat); if (na < 2) errno = locstat.sw_error; return (ret); }