fstat.c (84221) | fstat.c (92913) |
---|---|
1/* $NetBSD: fstat.c,v 1.1 1996/01/13 22:25:38 leo Exp $ */ 2 3/*- 4 * Copyright (c) 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 22 unchanged lines hidden (view full) --- 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * 35 * @(#)stat.c 8.1 (Berkeley) 6/11/93 36 */ 37 38#include <sys/cdefs.h> | 1/* $NetBSD: fstat.c,v 1.1 1996/01/13 22:25:38 leo Exp $ */ 2 3/*- 4 * Copyright (c) 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 22 unchanged lines hidden (view full) --- 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * 35 * @(#)stat.c 8.1 (Berkeley) 6/11/93 36 */ 37 38#include <sys/cdefs.h> |
39__FBSDID("$FreeBSD: head/lib/libstand/fstat.c 84221 2001-09-30 22:28:01Z dillon $"); | 39__FBSDID("$FreeBSD: head/lib/libstand/fstat.c 92913 2002-03-21 23:39:28Z obrien $"); |
40 41#include "stand.h" 42 43int 44fstat(fd, sb) 45 int fd; 46 struct stat *sb; 47{ | 40 41#include "stand.h" 42 43int 44fstat(fd, sb) 45 int fd; 46 struct stat *sb; 47{ |
48 register struct open_file *f = &files[fd]; | 48 struct open_file *f = &files[fd]; |
49 50 if ((unsigned)fd >= SOPEN_MAX || f->f_flags == 0) { 51 errno = EBADF; 52 return (-1); 53 } 54 55 /* operation not defined on raw devices */ 56 if (f->f_flags & F_RAW) { 57 errno = EOPNOTSUPP; 58 return (-1); 59 } 60 61 errno = (f->f_ops->fo_stat)(f, sb); 62 return (0); 63} | 49 50 if ((unsigned)fd >= SOPEN_MAX || f->f_flags == 0) { 51 errno = EBADF; 52 return (-1); 53 } 54 55 /* operation not defined on raw devices */ 56 if (f->f_flags & F_RAW) { 57 errno = EOPNOTSUPP; 58 return (-1); 59 } 60 61 errno = (f->f_ops->fo_stat)(f, sb); 62 return (0); 63} |