Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F131626930
D8854.id23094.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
8 KB
Referenced Files
None
Subscribers
None
D8854.id23094.diff
View Options
Index: lib/libc/sys/getfsstat.2
===================================================================
--- lib/libc/sys/getfsstat.2
+++ lib/libc/sys/getfsstat.2
@@ -41,7 +41,7 @@
.In sys/ucred.h
.In sys/mount.h
.Ft int
-.Fn getfsstat "struct statfs *buf" "long bufsize" "int flags"
+.Fn getfsstat "struct statfs *buf" "long bufsize" "int flag"
.Sh DESCRIPTION
The
.Fn getfsstat
@@ -74,11 +74,11 @@
returns just the number of mounted file systems.
.Pp
Normally
-.Fa flags
+.Fa flag
should be specified as
.Dv MNT_WAIT .
If
-.Fa flags
+.Fa flag
is set to
.Dv MNT_NOWAIT ,
.Fn getfsstat
@@ -108,6 +108,12 @@
.Fa buf
argument
points to an invalid address.
+.It Bq Er EINVAL
+.Fa flag
+is set to a value other than
+.Dv MNT_WAIT
+or
+.Dv MNT_NOWAIT .
.It Bq Er EIO
An
.Tn I/O
Index: sys/compat/freebsd32/freebsd32_misc.c
===================================================================
--- sys/compat/freebsd32/freebsd32_misc.c
+++ sys/compat/freebsd32/freebsd32_misc.c
@@ -253,7 +253,7 @@
count = uap->bufsize / sizeof(struct statfs32);
size = count * sizeof(struct statfs);
- error = kern_getfsstat(td, &buf, size, &count, UIO_SYSSPACE, uap->flags);
+ error = kern_getfsstat(td, &buf, size, &count, UIO_SYSSPACE, uap->flag);
if (size > 0) {
sp = buf;
copycount = count;
Index: sys/compat/freebsd32/freebsd32_proto.h
===================================================================
--- sys/compat/freebsd32/freebsd32_proto.h
+++ sys/compat/freebsd32/freebsd32_proto.h
@@ -917,7 +917,7 @@
struct freebsd4_freebsd32_getfsstat_args {
char buf_l_[PADL_(struct statfs32 *)]; struct statfs32 * buf; char buf_r_[PADR_(struct statfs32 *)];
char bufsize_l_[PADL_(long)]; long bufsize; char bufsize_r_[PADR_(long)];
- char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
+ char flag_l_[PADL_(int)]; int flag; char flag_r_[PADR_(int)];
};
struct freebsd4_freebsd32_statfs_args {
char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
Index: sys/compat/freebsd32/freebsd32_systrace_args.c
===================================================================
--- sys/compat/freebsd32/freebsd32_systrace_args.c
+++ sys/compat/freebsd32/freebsd32_systrace_args.c
@@ -1960,7 +1960,7 @@
struct getfsstat_args *p = params;
uarg[0] = (intptr_t) p->buf; /* struct statfs * */
iarg[1] = p->bufsize; /* long */
- iarg[2] = p->flags; /* int */
+ iarg[2] = p->flag; /* int */
*n_args = 3;
break;
}
Index: sys/compat/freebsd32/syscalls.master
===================================================================
--- sys/compat/freebsd32/syscalls.master
+++ sys/compat/freebsd32/syscalls.master
@@ -89,7 +89,7 @@
obreak_args int
18 AUE_GETFSSTAT COMPAT4 { int freebsd32_getfsstat( \
struct statfs32 *buf, long bufsize, \
- int flags); }
+ int flag); }
19 AUE_LSEEK COMPAT { int freebsd32_lseek(int fd, int offset, \
int whence); }
20 AUE_GETPID NOPROTO { pid_t getpid(void); }
@@ -711,7 +711,7 @@
off_t *sbytes, int flags); }
394 AUE_NULL UNIMPL mac_syscall
395 AUE_GETFSSTAT NOPROTO { int getfsstat(struct statfs *buf, \
- long bufsize, int flags); }
+ long bufsize, int flag); }
396 AUE_STATFS NOPROTO { int statfs(char *path, \
struct statfs *buf); }
397 AUE_FSTATFS NOPROTO { int fstatfs(int fd, struct statfs *buf); }
Index: sys/kern/syscalls.master
===================================================================
--- sys/kern/syscalls.master
+++ sys/kern/syscalls.master
@@ -85,7 +85,7 @@
17 AUE_NULL STD { int obreak(char *nsize); } break \
obreak_args int
18 AUE_GETFSSTAT COMPAT4 { int getfsstat(struct ostatfs *buf, \
- long bufsize, int flags); }
+ long bufsize, int flag); }
19 AUE_LSEEK COMPAT { long lseek(int fd, long offset, \
int whence); }
20 AUE_GETPID STD { pid_t getpid(void); }
@@ -706,7 +706,7 @@
394 AUE_NULL STD { int mac_syscall(const char *policy, \
int call, void *arg); }
395 AUE_GETFSSTAT STD { int getfsstat(struct statfs *buf, \
- long bufsize, int flags); }
+ long bufsize, int flag); }
396 AUE_STATFS STD { int statfs(char *path, \
struct statfs *buf); }
397 AUE_FSTATFS STD { int fstatfs(int fd, struct statfs *buf); }
Index: sys/kern/systrace_args.c
===================================================================
--- sys/kern/systrace_args.c
+++ sys/kern/systrace_args.c
@@ -2072,7 +2072,7 @@
struct getfsstat_args *p = params;
uarg[0] = (intptr_t) p->buf; /* struct statfs * */
iarg[1] = p->bufsize; /* long */
- iarg[2] = p->flags; /* int */
+ iarg[2] = p->flag; /* int */
*n_args = 3;
break;
}
Index: sys/kern/vfs_syscalls.c
===================================================================
--- sys/kern/vfs_syscalls.c
+++ sys/kern/vfs_syscalls.c
@@ -412,7 +412,7 @@
struct getfsstat_args {
struct statfs *buf;
long bufsize;
- int flags;
+ int flag;
};
#endif
int
@@ -421,7 +421,7 @@
register struct getfsstat_args /* {
struct statfs *buf;
long bufsize;
- int flags;
+ int flag;
} */ *uap;
{
size_t count;
@@ -430,7 +430,7 @@
if (uap->bufsize < 0 || uap->bufsize > SIZE_MAX)
return (EINVAL);
error = kern_getfsstat(td, &uap->buf, uap->bufsize, &count,
- UIO_USERSPACE, uap->flags);
+ UIO_USERSPACE, uap->flag);
if (error == 0)
td->td_retval[0] = count;
return (error);
@@ -443,13 +443,20 @@
*/
int
kern_getfsstat(struct thread *td, struct statfs **buf, size_t bufsize,
- size_t *countp, enum uio_seg bufseg, int flags)
+ size_t *countp, enum uio_seg bufseg, int flag)
{
struct mount *mp, *nmp;
struct statfs *sfsp, *sp, sb, *tofree;
size_t count, maxcount;
int error;
+ switch (flag) {
+ case MNT_WAIT:
+ case MNT_NOWAIT:
+ break;
+ default:
+ return (EINVAL);
+ }
restart:
maxcount = bufsize / sizeof(struct statfs);
if (bufsize == 0) {
@@ -483,7 +490,7 @@
continue;
}
#endif
- if (flags == MNT_WAIT) {
+ if (flag == MNT_WAIT) {
if (vfs_busy(mp, MBF_MNTLSTLOCK) != 0) {
/*
* If vfs_busy() failed, and MBF_NOWAIT
@@ -515,7 +522,7 @@
* If MNT_NOWAIT or MNT_LAZY is specified, do not
* refresh the fsstat cache.
*/
- if (flags != MNT_LAZY && flags != MNT_NOWAIT) {
+ if (flag != MNT_LAZY && flag != MNT_NOWAIT) {
error = VFS_STATFS(mp, sp);
if (error != 0) {
mtx_lock(&mountlist_mtx);
@@ -620,7 +627,7 @@
struct freebsd4_getfsstat_args {
struct ostatfs *buf;
long bufsize;
- int flags;
+ int flag;
};
#endif
int
@@ -629,7 +636,7 @@
register struct freebsd4_getfsstat_args /* {
struct ostatfs *buf;
long bufsize;
- int flags;
+ int flag;
} */ *uap;
{
struct statfs *buf, *sp;
@@ -644,7 +651,7 @@
return (EINVAL);
size = count * sizeof(struct statfs);
error = kern_getfsstat(td, &buf, size, &count, UIO_SYSSPACE,
- uap->flags);
+ uap->flag);
td->td_retval[0] = count;
if (size != 0) {
sp = buf;
Index: sys/sys/syscallsubr.h
===================================================================
--- sys/sys/syscallsubr.h
+++ sys/sys/syscallsubr.h
@@ -109,7 +109,7 @@
int kern_getdirentries(struct thread *td, int fd, char *buf, u_int count,
long *basep, ssize_t *residp, enum uio_seg bufseg);
int kern_getfsstat(struct thread *td, struct statfs **buf, size_t bufsize,
- size_t *countp, enum uio_seg bufseg, int flags);
+ size_t *countp, enum uio_seg bufseg, int flag);
int kern_getitimer(struct thread *, u_int, struct itimerval *);
int kern_getppid(struct thread *);
int kern_getpeername(struct thread *td, int fd, struct sockaddr **sa,
Index: sys/sys/sysproto.h
===================================================================
--- sys/sys/sysproto.h
+++ sys/sys/sysproto.h
@@ -1102,7 +1102,7 @@
struct getfsstat_args {
char buf_l_[PADL_(struct statfs *)]; struct statfs * buf; char buf_r_[PADR_(struct statfs *)];
char bufsize_l_[PADL_(long)]; long bufsize; char bufsize_r_[PADR_(long)];
- char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
+ char flag_l_[PADL_(int)]; int flag; char flag_r_[PADR_(int)];
};
struct statfs_args {
char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
@@ -2350,7 +2350,7 @@
struct freebsd4_getfsstat_args {
char buf_l_[PADL_(struct ostatfs *)]; struct ostatfs * buf; char buf_r_[PADR_(struct ostatfs *)];
char bufsize_l_[PADL_(long)]; long bufsize; char bufsize_r_[PADR_(long)];
- char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
+ char flag_l_[PADL_(int)]; int flag; char flag_r_[PADR_(int)];
};
struct freebsd4_statfs_args {
char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Oct 10, 9:03 PM (9 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
23546902
Default Alt Text
D8854.id23094.diff (8 KB)
Attached To
Mode
D8854: Rename the 'flags' argument to getfsstat() to 'flag' and validate it.
Attached
Detach File
Event Timeline
Log In to Comment