projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
spl5 not splimp
[unix-history]
/
usr
/
src
/
sys
/
kern
/
vfs_syscalls.c
diff --git
a/usr/src/sys/kern/vfs_syscalls.c
b/usr/src/sys/kern/vfs_syscalls.c
index
0048c8b
..
c8ad364
100644
(file)
--- a/
usr/src/sys/kern/vfs_syscalls.c
+++ b/
usr/src/sys/kern/vfs_syscalls.c
@@
-1,4
+1,4
@@
-/* vfs_syscalls.c 4.1
0 81/04/28
*/
+/* vfs_syscalls.c 4.1
7 82/01/19
*/
#include "../h/param.h"
#include "../h/systm.h"
#include "../h/param.h"
#include "../h/systm.h"
@@
-14,6
+14,8
@@
#include "../h/conf.h"
#include "../h/stat.h"
#include "../h/inline.h"
#include "../h/conf.h"
#include "../h/stat.h"
#include "../h/inline.h"
+#include "../h/socket.h"
+#include "../h/socketvar.h"
/*
* the fstat system call.
/*
* the fstat system call.
@@
-28,17
+30,16
@@
fstat()
uap = (struct a *)u.u_ap;
fp = getf(uap->fdes);
uap = (struct a *)u.u_ap;
fp = getf(uap->fdes);
- if(fp == NULL)
+ if
(fp == NULL)
return;
return;
- if (fp->f_flag&FPORT) {
- ptstat(fp);
- return;
- }
- stat1(fp->f_inode, uap->sb);
+ if (fp->f_flag & FSOCKET)
+ u.u_error = sostat(fp->f_socket, uap->sb);
+ else
+ stat1(fp->f_inode, uap->sb);
}
/*
}
/*
- *
the s
tat system call.
+ *
S
tat system call.
*/
stat()
{
*/
stat()
{
@@
-50,7
+51,7
@@
stat()
uap = (struct a *)u.u_ap;
ip = namei(uchar, 0);
uap = (struct a *)u.u_ap;
ip = namei(uchar, 0);
- if(ip == NULL)
+ if
(ip == NULL)
return;
stat1(ip, uap->sb);
iput(ip);
return;
stat1(ip, uap->sb);
iput(ip);
@@
-61,8
+62,8
@@
stat()
* get the inode and pass appropriate parts back.
*/
stat1(ip, ub)
* get the inode and pass appropriate parts back.
*/
stat1(ip, ub)
-register struct inode *ip;
-struct stat *ub;
+
register struct inode *ip;
+
struct stat *ub;
{
register struct dinode *dp;
register struct buf *bp;
{
register struct dinode *dp;
register struct buf *bp;
@@
-70,7
+71,7
@@
struct stat *ub;
IUPDAT(ip, &time, &time, 0);
/*
IUPDAT(ip, &time, &time, 0);
/*
- *
f
irst copy from inode table
+ *
F
irst copy from inode table
*/
ds.st_dev = ip->i_dev;
ds.st_ino = ip->i_number;
*/
ds.st_dev = ip->i_dev;
ds.st_ino = ip->i_number;
@@
-81,7
+82,7
@@
struct stat *ub;
ds.st_rdev = (dev_t)ip->i_un.i_rdev;
ds.st_size = ip->i_size;
/*
ds.st_rdev = (dev_t)ip->i_un.i_rdev;
ds.st_size = ip->i_size;
/*
- *
n
ext the dates in the disk
+ *
N
ext the dates in the disk
*/
bp = bread(ip->i_dev, itod(ip->i_number));
dp = bp->b_un.b_dino;
*/
bp = bread(ip->i_dev, itod(ip->i_number));
dp = bp->b_un.b_dino;
@@
-95,7
+96,7
@@
struct stat *ub;
}
/*
}
/*
- *
the d
up system call.
+ *
D
up system call.
*/
dup()
{
*/
dup()
{
@@
-110,7
+111,7
@@
dup()
m = uap->fdes & ~077;
uap->fdes &= 077;
fp = getf(uap->fdes);
m = uap->fdes & ~077;
uap->fdes &= 077;
fp = getf(uap->fdes);
- if(fp == NULL)
+ if
(fp == NULL)
return;
if ((m&0100) == 0) {
if ((i = ufalloc()) < 0)
return;
if ((m&0100) == 0) {
if ((i = ufalloc()) < 0)
@@
-121,24
+122,23
@@
dup()
u.u_error = EBADF;
return;
}
u.u_error = EBADF;
return;
}
- if (u.u_vrpages[i]) {
- u.u_error = ETXTBSY;
- return;
- }
u.u_r.r_val1 = i;
}
u.u_r.r_val1 = i;
}
- if (i
!=
uap->fdes) {
+ if (i
!=
uap->fdes) {
if (u.u_ofile[i]!=NULL)
if (u.u_ofile[i]!=NULL)
- closef(u.u_ofile[i]);
+ closef(u.u_ofile[i], 0);
+ if (u.u_error)
+ return;
u.u_ofile[i] = fp;
fp->f_count++;
}
}
/*
u.u_ofile[i] = fp;
fp->f_count++;
}
}
/*
- *
the m
ount system call.
+ *
M
ount system call.
*/
*/
-smount() {
+smount()
+{
dev_t dev;
register struct inode *ip;
register struct mount *mp;
dev_t dev;
register struct inode *ip;
register struct mount *mp;
@@
-154,31
+154,31
@@
smount() {
uap = (struct a *)u.u_ap;
dev = getmdev();
uap = (struct a *)u.u_ap;
dev = getmdev();
- if(u.u_error)
+ if
(u.u_error)
return;
u.u_dirp = (caddr_t)uap->freg;
ip = namei(uchar, 0);
return;
u.u_dirp = (caddr_t)uap->freg;
ip = namei(uchar, 0);
- if(ip == NULL)
+ if
(ip == NULL)
return;
return;
- if
(ip->i_count!=1 || (ip->i_mode&(IFBLK&IFCHR))!=0
)
+ if
(ip->i_count!=1 || (ip->i_mode&IFMT) != IFDIR
)
goto out;
smp = NULL;
goto out;
smp = NULL;
- for(mp = &mount[0]; mp < &mount[NMOUNT]; mp++) {
- if(mp->m_bufp != NULL) {
- if(dev == mp->m_dev)
+ for
(mp = &mount[0]; mp < &mount[NMOUNT]; mp++) {
+ if
(mp->m_bufp != NULL) {
+ if
(dev == mp->m_dev)
goto out;
} else
goto out;
} else
- if(smp == NULL)
+ if
(smp == NULL)
smp = mp;
}
mp = smp;
smp = mp;
}
mp = smp;
- if(mp == NULL)
+ if
(mp == NULL)
goto out;
(*bdevsw[major(dev)].d_open)(dev, !uap->ronly);
goto out;
(*bdevsw[major(dev)].d_open)(dev, !uap->ronly);
- if(u.u_error)
+ if
(u.u_error)
goto out;
bp = bread(dev, SUPERB);
goto out;
bp = bread(dev, SUPERB);
- if(u.u_error) {
+ if
(u.u_error) {
brelse(bp);
goto out1;
}
brelse(bp);
goto out1;
}
@@
-199,7
+199,7
@@
smount() {
*cp = 0;
brelse(bp);
ip->i_flag |= IMOUNT;
*cp = 0;
brelse(bp);
ip->i_flag |= IMOUNT;
-
p
rele(ip);
+
i
rele(ip);
return;
out:
return;
out:
@@
-223,19
+223,19
@@
sumount()
};
dev = getmdev();
};
dev = getmdev();
- if(u.u_error)
+ if
(u.u_error)
return;
xumount(dev); /* remove unused sticky files from text table */
return;
xumount(dev); /* remove unused sticky files from text table */
- update();
- for(mp = &mount[0]; mp < &mount[NMOUNT]; mp++)
- if(mp->m_bufp != NULL && dev == mp->m_dev)
+ update(
0
);
+ for
(mp = &mount[0]; mp < &mount[NMOUNT]; mp++)
+ if
(mp->m_bufp != NULL && dev == mp->m_dev)
goto found;
u.u_error = EINVAL;
return;
found:
stillopen = 0;
goto found;
u.u_error = EINVAL;
return;
found:
stillopen = 0;
- for(ip = inode; ip < inodeNINODE; ip++)
+ for
(ip = inode; ip < inodeNINODE; ip++)
if (ip->i_number != 0 && dev == ip->i_dev) {
u.u_error = EBUSY;
return;
if (ip->i_number != 0 && dev == ip->i_dev) {
u.u_error = EBUSY;
return;
@@
-244,7
+244,7
@@
found:
stillopen++;
ip = mp->m_inodp;
ip->i_flag &= ~IMOUNT;
stillopen++;
ip = mp->m_inodp;
ip->i_flag &= ~IMOUNT;
-
p
lock(ip);
+
i
lock(ip);
iput(ip);
if ((bp = getblk(dev, SUPERB)) != mp->m_bufp)
panic("umount");
iput(ip);
if ((bp = getblk(dev, SUPERB)) != mp->m_bufp)
panic("umount");
@@
-273,12
+273,12
@@
getmdev()
if (!suser())
return(NODEV);
ip = namei(uchar, 0);
if (!suser())
return(NODEV);
ip = namei(uchar, 0);
- if(ip == NULL)
+ if
(ip == NULL)
return(NODEV);
return(NODEV);
- if((ip->i_mode&IFMT) != IFBLK)
+ if
((ip->i_mode&IFMT) != IFBLK)
u.u_error = ENOTBLK;
dev = (dev_t)ip->i_un.i_rdev;
u.u_error = ENOTBLK;
dev = (dev_t)ip->i_un.i_rdev;
- if(major(dev) >= nblkdev)
+ if
(major(dev) >= nblkdev)
u.u_error = ENXIO;
iput(ip);
return(dev);
u.u_error = ENXIO;
iput(ip);
return(dev);