fix dom_init prototype (no args => __P((void)), not empty)
[unix-history] / usr / src / sys / stand.att / stat.c
CommitLineData
d87bb019
KB
1/*-
2 * Copyright (c) 1991 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * %sccs.include.redist.c%
6 *
38a01dbe 7 * @(#)stat.c 7.2 (Berkeley) %G%
d87bb019
KB
8 */
9
10#include <sys/param.h>
11#include <sys/stat.h>
38a01dbe 12#include <stand/saio.h>
d87bb019
KB
13
14#ifndef SMALL
15fstat(fd, sb)
16 int fd;
17 struct stat *sb;
18{
19 register struct iob *io;
20
21 fd -= 3;
22 if (fd < 0 || fd >= SOPEN_MAX ||
23 ((io = &iob[fd])->i_flgs & F_ALLOC) == 0) {
24 errno = EBADF;
25 return (-1);
26 }
27 /* only important stuff */
28 sb->st_mode = io->i_ino.di_mode;
29 sb->st_uid = io->i_ino.di_uid;
30 sb->st_gid = io->i_ino.di_gid;
31 sb->st_size = io->i_ino.di_size;
32 return (0);
33}
34
35stat(str, sb)
36 const char *str;
37 struct stat *sb;
38{
39 int fd, rv;
40
41 fd = open(str, 0);
42 if (fd < 0)
43 return(-1);
44 rv = fstat(fd, sb);
45 close(fd);
46 return(rv);
47}
48#endif SMALL