Update to FreeBSD head 2018-06-01

Git mirror commit fb63610a69b0eb7f69a201ba05c4c1a7a2739cf9.

Update #3472.
This commit is contained in:
Sebastian Huber
2018-08-21 13:47:02 +02:00
parent 2df56dbd60
commit bcdce02d9b
340 changed files with 27754 additions and 11720 deletions

View File

@@ -42,7 +42,6 @@
__FBSDID("$FreeBSD$");
#include <rtems/bsd/local/opt_capsicum.h>
#include <rtems/bsd/local/opt_compat.h>
#include <rtems/bsd/local/opt_ktrace.h>
#include <sys/param.h>
@@ -201,9 +200,7 @@ struct read_args {
};
#endif
int
sys_read(td, uap)
struct thread *td;
struct read_args *uap;
sys_read(struct thread *td, struct read_args *uap)
{
struct uio auio;
struct iovec aiov;
@@ -296,10 +293,9 @@ int
kern_readv(struct thread *td, int fd, struct uio *auio)
{
struct file *fp;
cap_rights_t rights;
int error;
error = fget_read(td, fd, cap_rights_init(&rights, CAP_READ), &fp);
error = fget_read(td, fd, &cap_read_rights, &fp);
if (error)
return (error);
error = dofileread(td, fd, fp, auio, (off_t)-1, 0);
@@ -333,17 +329,12 @@ sys_preadv(struct thread *td, struct preadv_args *uap)
}
int
kern_preadv(td, fd, auio, offset)
struct thread *td;
int fd;
struct uio *auio;
off_t offset;
kern_preadv(struct thread *td, int fd, struct uio *auio, off_t offset)
{
struct file *fp;
cap_rights_t rights;
int error;
error = fget_read(td, fd, cap_rights_init(&rights, CAP_PREAD), &fp);
error = fget_read(td, fd, &cap_pread_rights, &fp);
if (error)
return (error);
if (!(fp->f_ops->fo_flags & DFLAG_SEEKABLE))
@@ -362,13 +353,8 @@ kern_preadv(td, fd, auio, offset)
* from a file using the passed in uio, offset, and flags.
*/
static int
dofileread(td, fd, fp, auio, offset, flags)
struct thread *td;
int fd;
struct file *fp;
struct uio *auio;
off_t offset;
int flags;
dofileread(struct thread *td, int fd, struct file *fp, struct uio *auio,
off_t offset, int flags)
{
ssize_t cnt;
int error;
@@ -415,9 +401,7 @@ struct write_args {
};
#endif
int
sys_write(td, uap)
struct thread *td;
struct write_args *uap;
sys_write(struct thread *td, struct write_args *uap)
{
struct uio auio;
struct iovec aiov;
@@ -511,10 +495,9 @@ int
kern_writev(struct thread *td, int fd, struct uio *auio)
{
struct file *fp;
cap_rights_t rights;
int error;
error = fget_write(td, fd, cap_rights_init(&rights, CAP_WRITE), &fp);
error = fget_write(td, fd, &cap_write_rights, &fp);
if (error)
return (error);
error = dofilewrite(td, fd, fp, auio, (off_t)-1, 0);
@@ -548,17 +531,12 @@ sys_pwritev(struct thread *td, struct pwritev_args *uap)
}
int
kern_pwritev(td, fd, auio, offset)
struct thread *td;
struct uio *auio;
int fd;
off_t offset;
kern_pwritev(struct thread *td, int fd, struct uio *auio, off_t offset)
{
struct file *fp;
cap_rights_t rights;
int error;
error = fget_write(td, fd, cap_rights_init(&rights, CAP_PWRITE), &fp);
error = fget_write(td, fd, &cap_pwrite_rights, &fp);
if (error)
return (error);
if (!(fp->f_ops->fo_flags & DFLAG_SEEKABLE))
@@ -577,13 +555,8 @@ kern_pwritev(td, fd, auio, offset)
* a file using the passed in uio, offset, and flags.
*/
static int
dofilewrite(td, fd, fp, auio, offset, flags)
struct thread *td;
int fd;
struct file *fp;
struct uio *auio;
off_t offset;
int flags;
dofilewrite(struct thread *td, int fd, struct file *fp, struct uio *auio,
off_t offset, int flags)
{
ssize_t cnt;
int error;
@@ -632,19 +605,15 @@ dofilewrite(td, fd, fp, auio, offset, flags)
* descriptor isn't writable.
*/
int
kern_ftruncate(td, fd, length)
struct thread *td;
int fd;
off_t length;
kern_ftruncate(struct thread *td, int fd, off_t length)
{
struct file *fp;
cap_rights_t rights;
int error;
AUDIT_ARG_FD(fd);
if (length < 0)
return (EINVAL);
error = fget(td, fd, cap_rights_init(&rights, CAP_FTRUNCATE), &fp);
error = fget(td, fd, &cap_ftruncate_rights, &fp);
if (error)
return (error);
AUDIT_ARG_FILE(td->td_proc, fp);
@@ -665,9 +634,7 @@ struct ftruncate_args {
};
#endif
int
sys_ftruncate(td, uap)
struct thread *td;
struct ftruncate_args *uap;
sys_ftruncate(struct thread *td, struct ftruncate_args *uap)
{
return (kern_ftruncate(td, uap->fd, uap->length));
@@ -681,9 +648,7 @@ struct oftruncate_args {
};
#endif
int
oftruncate(td, uap)
struct thread *td;
struct oftruncate_args *uap;
oftruncate(struct thread *td, struct oftruncate_args *uap)
{
return (kern_ftruncate(td, uap->fd, uap->length));
@@ -772,9 +737,6 @@ kern_ioctl(struct thread *td, int fd, u_long com, caddr_t data)
{
struct file *fp;
struct filedesc *fdp;
#ifndef CAPABILITIES
cap_rights_t rights;
#endif
int error, tmp, locked;
AUDIT_ARG_FD(fd);
@@ -813,7 +775,7 @@ kern_ioctl(struct thread *td, int fd, u_long com, caddr_t data)
locked = LA_UNLOCKED;
}
#else
error = fget(td, fd, cap_rights_init(&rights, CAP_IOCTL), &fp);
error = fget(td, fd, &cap_ioctl_rights, &fp);
if (error != 0) {
fp = NULL;
goto out;
@@ -1284,11 +1246,8 @@ selsetbits(fd_mask **ibits, fd_mask **obits, int idx, fd_mask bit, int events)
static __inline int
getselfd_cap(struct filedesc *fdp, int fd, struct file **fpp)
{
cap_rights_t rights;
cap_rights_init(&rights, CAP_EVENT);
return (fget_unlocked(fdp, fd, &rights, fpp, NULL));
return (fget_unlocked(fdp, fd, &cap_event_rights, fpp, NULL));
}
/*
@@ -1342,10 +1301,7 @@ selrescan(struct thread *td, fd_mask **ibits, fd_mask **obits)
* each selinfo.
*/
static int
selscan(td, ibits, obits, nfd)
struct thread *td;
fd_mask **ibits, **obits;
int nfd;
selscan(struct thread *td, fd_mask **ibits, fd_mask **obits, int nfd)
{
struct filedesc *fdp;
struct file *fp;
@@ -1573,9 +1529,6 @@ pollrescan(struct thread *td)
struct filedesc *fdp;
struct file *fp;
struct pollfd *fd;
#ifdef CAPABILITIES
cap_rights_t rights;
#endif
int n;
n = 0;
@@ -1600,8 +1553,7 @@ pollrescan(struct thread *td)
#endif /* __rtems__ */
#ifdef CAPABILITIES
if (fp == NULL ||
cap_check(cap_rights(fdp, fd->fd),
cap_rights_init(&rights, CAP_EVENT)) != 0)
cap_check(cap_rights(fdp, fd->fd), &cap_event_rights) != 0)
#else
if (fp == NULL)
#endif
@@ -1630,11 +1582,7 @@ pollrescan(struct thread *td)
static int
pollout(td, fds, ufds, nfd)
struct thread *td;
struct pollfd *fds;
struct pollfd *ufds;
u_int nfd;
pollout(struct thread *td, struct pollfd *fds, struct pollfd *ufds, u_int nfd)
{
int error = 0;
u_int i = 0;
@@ -1655,10 +1603,7 @@ pollout(td, fds, ufds, nfd)
}
static int
pollscan(td, fds, nfd)
struct thread *td;
struct pollfd *fds;
u_int nfd;
pollscan(struct thread *td, struct pollfd *fds, u_int nfd)
{
#ifndef __rtems__
struct filedesc *fdp = td->td_proc->p_fd;
@@ -1666,9 +1611,6 @@ pollscan(td, fds, nfd)
struct filedesc *fdp = NULL;
#endif /* __rtems__ */
struct file *fp;
#ifdef CAPABILITIES
cap_rights_t rights;
#endif
int i, n = 0;
FILEDESC_SLOCK(fdp);
@@ -1690,8 +1632,7 @@ pollscan(td, fds, nfd)
#endif /* __rtems__ */
#ifdef CAPABILITIES
if (fp == NULL ||
cap_check(cap_rights(fdp, fds->fd),
cap_rights_init(&rights, CAP_EVENT)) != 0)
cap_check(cap_rights(fdp, fds->fd), &cap_event_rights) != 0)
#else
if (fp == NULL)
#endif
@@ -1822,8 +1763,7 @@ selfdfree(struct seltd *stp, struct selfd *sfp)
/* Drain the waiters tied to all the selfd belonging the specified selinfo. */
void
seldrain(sip)
struct selinfo *sip;
seldrain(struct selinfo *sip)
{
/*
@@ -1841,9 +1781,7 @@ seldrain(sip)
* Record a select request.
*/
void
selrecord(selector, sip)
struct thread *selector;
struct selinfo *sip;
selrecord(struct thread *selector, struct selinfo *sip)
{
struct selfd *sfp;
struct seltd *stp;
@@ -1892,17 +1830,14 @@ selrecord(selector, sip)
/* Wake up a selecting thread. */
void
selwakeup(sip)
struct selinfo *sip;
selwakeup(struct selinfo *sip)
{
doselwakeup(sip, -1);
}
/* Wake up a selecting thread, and set its priority. */
void
selwakeuppri(sip, pri)
struct selinfo *sip;
int pri;
selwakeuppri(struct selinfo *sip, int pri)
{
doselwakeup(sip, pri);
}
@@ -1911,9 +1846,7 @@ selwakeuppri(sip, pri)
* Do a wakeup when a selectable event occurs.
*/
static void
doselwakeup(sip, pri)
struct selinfo *sip;
int pri;
doselwakeup(struct selinfo *sip, int pri)
{
struct selfd *sfp;
struct selfd *sfn;