MFC - tracking commit.
This commit is contained in:
commit
72acff0f07
@ -38,6 +38,8 @@
|
||||
# xargs -n1 | sort | uniq -d;
|
||||
# done
|
||||
|
||||
# 20131009: freebsd-version moved from /libexec to /bin
|
||||
OLD_FILES+=/libexec/freebsd-version
|
||||
# 20131001: ar and ranlib from binutils not used
|
||||
OLD_FILES+=usr/bin/gnu-ar
|
||||
OLD_FILES+=usr/bin/gnu-ranlib
|
||||
|
@ -15,6 +15,7 @@ SUBDIR= cat \
|
||||
echo \
|
||||
ed \
|
||||
expr \
|
||||
freebsd-version \
|
||||
getfacl \
|
||||
hostname \
|
||||
kenv \
|
||||
|
@ -2,12 +2,11 @@
|
||||
|
||||
SCRIPTS = freebsd-version
|
||||
MAN = freebsd-version.1
|
||||
BINDIR = /libexec
|
||||
CLEANFILES = freebsd-version.sh
|
||||
NEWVERS = ${.CURDIR}/../../sys/conf/newvers.sh
|
||||
|
||||
freebsd-version.sh.in: ${NEWVERS}
|
||||
freebsd-version.sh: freebsd-version.sh.in
|
||||
freebsd-version.sh: ${.CURDIR}/freebsd-version.sh.in
|
||||
eval $$(egrep '^(TYPE|REVISION|BRANCH)=' ${NEWVERS}) ; \
|
||||
if ! sed -e "\
|
||||
s/@@TYPE@@/$${TYPE}/g; \
|
@ -100,13 +100,13 @@ and the kernel.
|
||||
.Sh EXAMPLES
|
||||
To determine the version of the currently running userland:
|
||||
.Bd -literal -offset indent
|
||||
/libexec/freebsd-version -u
|
||||
/bin/freebsd-version -u
|
||||
.Ed
|
||||
.Pp
|
||||
To inspect a system being repaired using a live CD:
|
||||
.Bd -literal -offset indent
|
||||
mount -rt ufs /dev/ada0p2 /mnt
|
||||
env ROOT=/mnt /mnt/libexec/freebsd-version -ku
|
||||
env ROOT=/mnt /mnt/bin/freebsd-version -ku
|
||||
.Ed
|
||||
.Sh SEE ALSO
|
||||
.Xr uname 1 ,
|
@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/conf.h>
|
||||
#include <sys/ksem.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/capability.h>
|
||||
#define _KERNEL
|
||||
#include <sys/mount.h>
|
||||
#include <sys/pipe.h>
|
||||
@ -395,7 +396,10 @@ filestat_new_entry(void *typedep, int type, int fd, int fflags, int uflags,
|
||||
entry->fs_ref_count = refcount;
|
||||
entry->fs_offset = offset;
|
||||
entry->fs_path = path;
|
||||
entry->fs_cap_rights = *cap_rightsp;
|
||||
if (cap_rightsp != NULL)
|
||||
entry->fs_cap_rights = *cap_rightsp;
|
||||
else
|
||||
cap_rights_init(&entry->fs_cap_rights);
|
||||
return (entry);
|
||||
}
|
||||
|
||||
@ -478,21 +482,21 @@ procstat_getfiles_kvm(struct procstat *procstat, struct kinfo_proc *kp, int mmap
|
||||
/* root directory vnode, if one. */
|
||||
if (filed.fd_rdir) {
|
||||
entry = filestat_new_entry(filed.fd_rdir, PS_FST_TYPE_VNODE, -1,
|
||||
PS_FST_FFLAG_READ, PS_FST_UFLAG_RDIR, 0, 0, NULL, 0);
|
||||
PS_FST_FFLAG_READ, PS_FST_UFLAG_RDIR, 0, 0, NULL, NULL);
|
||||
if (entry != NULL)
|
||||
STAILQ_INSERT_TAIL(head, entry, next);
|
||||
}
|
||||
/* current working directory vnode. */
|
||||
if (filed.fd_cdir) {
|
||||
entry = filestat_new_entry(filed.fd_cdir, PS_FST_TYPE_VNODE, -1,
|
||||
PS_FST_FFLAG_READ, PS_FST_UFLAG_CDIR, 0, 0, NULL, 0);
|
||||
PS_FST_FFLAG_READ, PS_FST_UFLAG_CDIR, 0, 0, NULL, NULL);
|
||||
if (entry != NULL)
|
||||
STAILQ_INSERT_TAIL(head, entry, next);
|
||||
}
|
||||
/* jail root, if any. */
|
||||
if (filed.fd_jdir) {
|
||||
entry = filestat_new_entry(filed.fd_jdir, PS_FST_TYPE_VNODE, -1,
|
||||
PS_FST_FFLAG_READ, PS_FST_UFLAG_JAIL, 0, 0, NULL, 0);
|
||||
PS_FST_FFLAG_READ, PS_FST_UFLAG_JAIL, 0, 0, NULL, NULL);
|
||||
if (entry != NULL)
|
||||
STAILQ_INSERT_TAIL(head, entry, next);
|
||||
}
|
||||
@ -500,14 +504,14 @@ procstat_getfiles_kvm(struct procstat *procstat, struct kinfo_proc *kp, int mmap
|
||||
if (kp->ki_tracep) {
|
||||
entry = filestat_new_entry(kp->ki_tracep, PS_FST_TYPE_VNODE, -1,
|
||||
PS_FST_FFLAG_READ | PS_FST_FFLAG_WRITE,
|
||||
PS_FST_UFLAG_TRACE, 0, 0, NULL, 0);
|
||||
PS_FST_UFLAG_TRACE, 0, 0, NULL, NULL);
|
||||
if (entry != NULL)
|
||||
STAILQ_INSERT_TAIL(head, entry, next);
|
||||
}
|
||||
/* text vnode, if one */
|
||||
if (kp->ki_textvp) {
|
||||
entry = filestat_new_entry(kp->ki_textvp, PS_FST_TYPE_VNODE, -1,
|
||||
PS_FST_FFLAG_READ, PS_FST_UFLAG_TEXT, 0, 0, NULL, 0);
|
||||
PS_FST_FFLAG_READ, PS_FST_UFLAG_TEXT, 0, 0, NULL, NULL);
|
||||
if (entry != NULL)
|
||||
STAILQ_INSERT_TAIL(head, entry, next);
|
||||
}
|
||||
@ -515,7 +519,7 @@ procstat_getfiles_kvm(struct procstat *procstat, struct kinfo_proc *kp, int mmap
|
||||
if ((vp = getctty(kd, kp)) != NULL) {
|
||||
entry = filestat_new_entry(vp, PS_FST_TYPE_VNODE, -1,
|
||||
PS_FST_FFLAG_READ | PS_FST_FFLAG_WRITE,
|
||||
PS_FST_UFLAG_CTTY, 0, 0, NULL, 0);
|
||||
PS_FST_UFLAG_CTTY, 0, 0, NULL, NULL);
|
||||
if (entry != NULL)
|
||||
STAILQ_INSERT_TAIL(head, entry, next);
|
||||
}
|
||||
@ -578,7 +582,7 @@ procstat_getfiles_kvm(struct procstat *procstat, struct kinfo_proc *kp, int mmap
|
||||
}
|
||||
/* XXXRW: No capability rights support for kvm yet. */
|
||||
entry = filestat_new_entry(data, type, i,
|
||||
to_filestat_flags(file.f_flag), 0, 0, 0, NULL, 0);
|
||||
to_filestat_flags(file.f_flag), 0, 0, 0, NULL, NULL);
|
||||
if (entry != NULL)
|
||||
STAILQ_INSERT_TAIL(head, entry, next);
|
||||
}
|
||||
@ -637,7 +641,7 @@ do_mmapped:
|
||||
*/
|
||||
entry = filestat_new_entry(object.handle,
|
||||
PS_FST_TYPE_VNODE, -1, fflags,
|
||||
PS_FST_UFLAG_MMAP, 0, 0, NULL, 0);
|
||||
PS_FST_UFLAG_MMAP, 0, 0, NULL, NULL);
|
||||
if (entry != NULL)
|
||||
STAILQ_INSERT_TAIL(head, entry, next);
|
||||
}
|
||||
@ -878,7 +882,7 @@ procstat_getfiles_sysctl(struct procstat *procstat, struct kinfo_proc *kp,
|
||||
path = NULL;
|
||||
entry = filestat_new_entry(kve, PS_FST_TYPE_VNODE, -1,
|
||||
fflags, PS_FST_UFLAG_MMAP, refcount, offset, path,
|
||||
0);
|
||||
NULL);
|
||||
if (entry != NULL)
|
||||
STAILQ_INSERT_TAIL(head, entry, next);
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ SUBDIR= ${_atf} \
|
||||
bootpd \
|
||||
${_comsat} \
|
||||
fingerd \
|
||||
freebsd-version \
|
||||
ftpd \
|
||||
getty \
|
||||
${_mail.local} \
|
||||
|
@ -950,7 +950,7 @@ cxgbe_probe(device_t dev)
|
||||
|
||||
#define T4_CAP (IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | \
|
||||
IFCAP_VLAN_HWCSUM | IFCAP_TSO | IFCAP_JUMBO_MTU | IFCAP_LRO | \
|
||||
IFCAP_VLAN_HWTSO | IFCAP_LINKSTATE | IFCAP_HWCSUM_IPV6)
|
||||
IFCAP_VLAN_HWTSO | IFCAP_LINKSTATE | IFCAP_HWCSUM_IPV6 | IFCAP_HWSTATS)
|
||||
#define T4_CAP_ENABLE (T4_CAP)
|
||||
|
||||
static int
|
||||
|
@ -153,11 +153,16 @@ isci_io_request_complete(SCI_CONTROLLER_HANDLE_T scif_controller,
|
||||
|
||||
case SCI_IO_FAILURE_REMOTE_DEVICE_RESET_REQUIRED:
|
||||
isci_remote_device_reset(isci_remote_device, NULL);
|
||||
ccb->ccb_h.status |= CAM_REQ_TERMIO;
|
||||
isci_log_message(0, "ISCI",
|
||||
"isci: bus=%x target=%x lun=%x cdb[0]=%x remote device reset required\n",
|
||||
ccb->ccb_h.path_id, ccb->ccb_h.target_id,
|
||||
ccb->ccb_h.target_lun, ccb->csio.cdb_io.cdb_bytes[0]);
|
||||
break;
|
||||
|
||||
/* drop through */
|
||||
case SCI_IO_FAILURE_TERMINATED:
|
||||
ccb->ccb_h.status |= CAM_REQ_TERMIO;
|
||||
isci_log_message(1, "ISCI",
|
||||
isci_log_message(0, "ISCI",
|
||||
"isci: bus=%x target=%x lun=%x cdb[0]=%x terminated\n",
|
||||
ccb->ccb_h.path_id, ccb->ccb_h.target_id,
|
||||
ccb->ccb_h.target_lun, ccb->csio.cdb_io.cdb_bytes[0]);
|
||||
|
@ -193,6 +193,35 @@ isci_sysctl_start_phy(SYSCTL_HANDLER_ARGS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
isci_sysctl_log_frozen_lun_masks(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
struct isci_softc *isci = (struct isci_softc *)arg1;
|
||||
struct ISCI_REMOTE_DEVICE *device;
|
||||
int32_t log_frozen_devices = 0;
|
||||
int error, i, j;
|
||||
|
||||
error = sysctl_handle_int(oidp, &log_frozen_devices, 0, req);
|
||||
|
||||
if (error || log_frozen_devices == 0)
|
||||
return (error);
|
||||
|
||||
for (i = 0; i < isci->controller_count; i++) {
|
||||
for (j = 0; j < SCI_MAX_REMOTE_DEVICES; j++) {
|
||||
device = isci->controllers[i].remote_device[j];
|
||||
|
||||
if (device == NULL)
|
||||
continue;
|
||||
|
||||
device_printf(isci->device,
|
||||
"controller %d device %3d frozen_lun_mask 0x%02x\n",
|
||||
i, j, device->frozen_lun_mask);
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void isci_sysctl_initialize(struct isci_softc *isci)
|
||||
{
|
||||
struct sysctl_ctx_list *sysctl_ctx = device_get_sysctl_ctx(isci->device);
|
||||
@ -225,5 +254,10 @@ void isci_sysctl_initialize(struct isci_softc *isci)
|
||||
SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO,
|
||||
"start_phy", CTLTYPE_UINT| CTLFLAG_RW, isci, 0,
|
||||
isci_sysctl_start_phy, "IU", "Start PHY on a controller");
|
||||
|
||||
SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO,
|
||||
"log_frozen_lun_masks", CTLTYPE_UINT| CTLFLAG_RW, isci, 0,
|
||||
isci_sysctl_log_frozen_lun_masks, "IU",
|
||||
"Log frozen lun masks to kernel log");
|
||||
}
|
||||
|
||||
|
@ -194,11 +194,20 @@ isci_task_request_complete(SCI_CONTROLLER_HANDLE_T scif_controller,
|
||||
break;
|
||||
|
||||
case SCI_TASK_FAILURE_INVALID_STATE:
|
||||
case SCI_TASK_FAILURE_INSUFFICIENT_RESOURCES:
|
||||
case SCI_FAILURE_TIMEOUT:
|
||||
retry_task = TRUE;
|
||||
isci_log_message(0, "ISCI",
|
||||
"unhandled task completion code 0x%x\n", completion_status);
|
||||
"task failure (invalid state) - retrying\n");
|
||||
break;
|
||||
|
||||
case SCI_TASK_FAILURE_INSUFFICIENT_RESOURCES:
|
||||
retry_task = TRUE;
|
||||
isci_log_message(0, "ISCI",
|
||||
"task failure (insufficient resources) - retrying\n");
|
||||
break;
|
||||
|
||||
case SCI_FAILURE_TIMEOUT:
|
||||
retry_task = TRUE;
|
||||
isci_log_message(0, "ISCI", "task timeout - retrying\n");
|
||||
break;
|
||||
|
||||
case SCI_TASK_FAILURE:
|
||||
|
@ -564,6 +564,7 @@ icl_conn_receive_pdu(struct icl_conn *ic, size_t *availablep)
|
||||
"MaxDataSegmentLength %zd; "
|
||||
"dropping connection",
|
||||
len, ic->ic_max_data_segment_length);
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -950,40 +950,59 @@ iscsi_pdu_handle_data_in(struct icl_pdu *response)
|
||||
|
||||
csio = &io->io_ccb->csio;
|
||||
|
||||
if (ntohl(bhsdi->bhsdi_buffer_offset) + data_segment_len >
|
||||
csio->dxfer_len) {
|
||||
if (io->io_received + data_segment_len > csio->dxfer_len) {
|
||||
ISCSI_SESSION_WARN(is, "oversize data segment (%zd bytes "
|
||||
"at offset %d, buffer is %d)",
|
||||
data_segment_len, ntohl(bhsdi->bhsdi_buffer_offset),
|
||||
csio->dxfer_len);
|
||||
"at offset %zd, buffer is %d)",
|
||||
data_segment_len, io->io_received, csio->dxfer_len);
|
||||
icl_pdu_free(response);
|
||||
iscsi_session_reconnect(is);
|
||||
return;
|
||||
}
|
||||
|
||||
icl_pdu_get_data(response, 0, csio->data_ptr + ntohl(bhsdi->bhsdi_buffer_offset), data_segment_len);
|
||||
icl_pdu_get_data(response, 0, csio->data_ptr + io->io_received, data_segment_len);
|
||||
io->io_received += data_segment_len;
|
||||
|
||||
/*
|
||||
* XXX: Check DataSN.
|
||||
* XXX: Check F.
|
||||
*/
|
||||
if (bhsdi->bhsdi_flags & BHSDI_FLAGS_S) {
|
||||
//ISCSI_SESSION_DEBUG(is, "got S flag; status 0x%x", bhsdi->bhsdi_status);
|
||||
if (bhsdi->bhsdi_status == 0) {
|
||||
io->io_ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
} else {
|
||||
if ((io->io_ccb->ccb_h.status & CAM_DEV_QFRZN) == 0) {
|
||||
xpt_freeze_devq(io->io_ccb->ccb_h.path, 1);
|
||||
ISCSI_SESSION_DEBUG(is, "freezing devq");
|
||||
}
|
||||
io->io_ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR | CAM_DEV_QFRZN;
|
||||
csio->scsi_status = bhsdi->bhsdi_status;
|
||||
}
|
||||
xpt_done(io->io_ccb);
|
||||
iscsi_outstanding_remove(is, io);
|
||||
if ((bhsdi->bhsdi_flags & BHSDI_FLAGS_S) == 0) {
|
||||
/*
|
||||
* Nothing more to do.
|
||||
*/
|
||||
icl_pdu_free(response);
|
||||
return;
|
||||
}
|
||||
|
||||
//ISCSI_SESSION_DEBUG(is, "got S flag; status 0x%x", bhsdi->bhsdi_status);
|
||||
if (bhsdi->bhsdi_status == 0) {
|
||||
io->io_ccb->ccb_h.status = CAM_REQ_CMP;
|
||||
} else {
|
||||
if ((io->io_ccb->ccb_h.status & CAM_DEV_QFRZN) == 0) {
|
||||
xpt_freeze_devq(io->io_ccb->ccb_h.path, 1);
|
||||
ISCSI_SESSION_DEBUG(is, "freezing devq");
|
||||
}
|
||||
io->io_ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR | CAM_DEV_QFRZN;
|
||||
csio->scsi_status = bhsdi->bhsdi_status;
|
||||
}
|
||||
|
||||
if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
|
||||
KASSERT(io->io_received <= csio->dxfer_len,
|
||||
("io->io_received > csio->dxfer_len"));
|
||||
if (io->io_received < csio->dxfer_len) {
|
||||
csio->resid = ntohl(bhsdi->bhsdi_residual_count);
|
||||
if (csio->resid != csio->dxfer_len - io->io_received) {
|
||||
ISCSI_SESSION_WARN(is, "underflow mismatch: "
|
||||
"target indicates %d, we calculated %zd",
|
||||
csio->resid,
|
||||
csio->dxfer_len - io->io_received);
|
||||
}
|
||||
csio->resid = csio->dxfer_len - io->io_received;
|
||||
}
|
||||
}
|
||||
|
||||
xpt_done(io->io_ccb);
|
||||
iscsi_outstanding_remove(is, io);
|
||||
icl_pdu_free(response);
|
||||
}
|
||||
|
||||
@ -1033,8 +1052,24 @@ iscsi_pdu_handle_r2t(struct icl_pdu *response)
|
||||
*/
|
||||
|
||||
io->io_datasn = 0;
|
||||
|
||||
off = ntohl(bhsr2t->bhsr2t_buffer_offset);
|
||||
if (off > csio->dxfer_len) {
|
||||
ISCSI_SESSION_WARN(is, "target requested invalid offset "
|
||||
"%zd, buffer is is %d; reconnecting", off, csio->dxfer_len);
|
||||
icl_pdu_free(response);
|
||||
iscsi_session_reconnect(is);
|
||||
return;
|
||||
}
|
||||
|
||||
total_len = ntohl(bhsr2t->bhsr2t_desired_data_transfer_length);
|
||||
if (total_len == 0 || total_len > csio->dxfer_len) {
|
||||
ISCSI_SESSION_WARN(is, "target requested invalid length "
|
||||
"%zd, buffer is %d; reconnecting", total_len, csio->dxfer_len);
|
||||
icl_pdu_free(response);
|
||||
iscsi_session_reconnect(is);
|
||||
return;
|
||||
}
|
||||
|
||||
//ISCSI_SESSION_DEBUG(is, "r2t; off %zd, len %zd", off, total_len);
|
||||
|
||||
@ -1045,7 +1080,8 @@ iscsi_pdu_handle_r2t(struct icl_pdu *response)
|
||||
len = is->is_max_data_segment_length;
|
||||
|
||||
if (off + len > csio->dxfer_len) {
|
||||
ISCSI_SESSION_WARN(is, "bad off %zd, len %d",
|
||||
ISCSI_SESSION_WARN(is, "target requested invalid "
|
||||
"length/offset %zd, buffer is %d; reconnecting",
|
||||
off + len, csio->dxfer_len);
|
||||
icl_pdu_free(response);
|
||||
iscsi_session_reconnect(is);
|
||||
@ -1068,8 +1104,11 @@ iscsi_pdu_handle_r2t(struct icl_pdu *response)
|
||||
bhsr2t->bhsr2t_target_transfer_tag;
|
||||
bhsdo->bhsdo_datasn = htonl(io->io_datasn++);
|
||||
bhsdo->bhsdo_buffer_offset = htonl(off);
|
||||
error = icl_pdu_append_data(request, csio->data_ptr + off, len, M_NOWAIT);
|
||||
error = icl_pdu_append_data(request, csio->data_ptr + off, len,
|
||||
M_NOWAIT);
|
||||
if (error != 0) {
|
||||
ISCSI_SESSION_WARN(is, "failed to allocate memory; "
|
||||
"reconnecting");
|
||||
icl_pdu_free(request);
|
||||
icl_pdu_free(response);
|
||||
iscsi_session_reconnect(is);
|
||||
|
@ -2662,7 +2662,8 @@ ixgbe_setup_interface(device_t dev, struct adapter *adapter)
|
||||
ifp->if_capabilities |= IFCAP_LRO;
|
||||
ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING
|
||||
| IFCAP_VLAN_HWTSO
|
||||
| IFCAP_VLAN_MTU;
|
||||
| IFCAP_VLAN_MTU
|
||||
| IFCAP_HWSTATS;
|
||||
ifp->if_capenable = ifp->if_capabilities;
|
||||
|
||||
/*
|
||||
|
@ -119,6 +119,7 @@ static int closefp(struct filedesc *fdp, int fd, struct file *fp,
|
||||
static int fd_first_free(struct filedesc *fdp, int low, int size);
|
||||
static int fd_last_used(struct filedesc *fdp, int size);
|
||||
static void fdgrowtable(struct filedesc *fdp, int nfd);
|
||||
static void fdgrowtable_exp(struct filedesc *fdp, int nfd);
|
||||
static void fdunused(struct filedesc *fdp, int fd);
|
||||
static void fdused(struct filedesc *fdp, int fd);
|
||||
static int fill_pipe_info(struct pipe *pi, struct kinfo_file *kif);
|
||||
@ -129,6 +130,7 @@ static int fill_sem_info(struct file *fp, struct kinfo_file *kif);
|
||||
static int fill_shm_info(struct file *fp, struct kinfo_file *kif);
|
||||
static int fill_socket_info(struct socket *so, struct kinfo_file *kif);
|
||||
static int fill_vnode_info(struct vnode *vp, struct kinfo_file *kif);
|
||||
static int getmaxfd(struct proc *p);
|
||||
|
||||
/*
|
||||
* Each process has:
|
||||
@ -771,6 +773,18 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg)
|
||||
return (error);
|
||||
}
|
||||
|
||||
static int
|
||||
getmaxfd(struct proc *p)
|
||||
{
|
||||
int maxfd;
|
||||
|
||||
PROC_LOCK(p);
|
||||
maxfd = min((int)lim_cur(p, RLIMIT_NOFILE), maxfilesperproc);
|
||||
PROC_UNLOCK(p);
|
||||
|
||||
return (maxfd);
|
||||
}
|
||||
|
||||
/*
|
||||
* Common code for dup, dup2, fcntl(F_DUPFD) and fcntl(F_DUP2FD).
|
||||
*/
|
||||
@ -797,9 +811,7 @@ do_dup(struct thread *td, int flags, int old, int new,
|
||||
return (EBADF);
|
||||
if (new < 0)
|
||||
return (flags & DUP_FCNTL ? EINVAL : EBADF);
|
||||
PROC_LOCK(p);
|
||||
maxfd = min((int)lim_cur(p, RLIMIT_NOFILE), maxfilesperproc);
|
||||
PROC_UNLOCK(p);
|
||||
maxfd = getmaxfd(p);
|
||||
if (new >= maxfd)
|
||||
return (flags & DUP_FCNTL ? EINVAL : EBADF);
|
||||
|
||||
@ -844,7 +856,7 @@ do_dup(struct thread *td, int flags, int old, int new,
|
||||
return (EMFILE);
|
||||
}
|
||||
#endif
|
||||
fdgrowtable(fdp, new + 1);
|
||||
fdgrowtable_exp(fdp, new + 1);
|
||||
oldfde = &fdp->fd_ofiles[old];
|
||||
}
|
||||
newfde = &fdp->fd_ofiles[new];
|
||||
@ -1467,6 +1479,24 @@ filecaps_validate(const struct filecaps *fcaps, const char *func)
|
||||
("%s: ioctls without CAP_IOCTL", func));
|
||||
}
|
||||
|
||||
static void
|
||||
fdgrowtable_exp(struct filedesc *fdp, int nfd)
|
||||
{
|
||||
int nfd1, maxfd;
|
||||
|
||||
FILEDESC_XLOCK_ASSERT(fdp);
|
||||
|
||||
nfd1 = fdp->fd_nfiles * 2;
|
||||
if (nfd1 < nfd)
|
||||
nfd1 = nfd;
|
||||
maxfd = getmaxfd(curproc);
|
||||
if (maxfd < nfd1)
|
||||
nfd1 = maxfd;
|
||||
KASSERT(nfd <= nfd1,
|
||||
("too low nfd1 %d %d %d %d", nfd, fdp->fd_nfiles, maxfd, nfd1));
|
||||
fdgrowtable(fdp, nfd1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Grow the file table to accomodate (at least) nfd descriptors.
|
||||
*/
|
||||
@ -1563,9 +1593,7 @@ fdalloc(struct thread *td, int minfd, int *result)
|
||||
if (fdp->fd_freefile > minfd)
|
||||
minfd = fdp->fd_freefile;
|
||||
|
||||
PROC_LOCK(p);
|
||||
maxfd = min((int)lim_cur(p, RLIMIT_NOFILE), maxfilesperproc);
|
||||
PROC_UNLOCK(p);
|
||||
maxfd = getmaxfd(p);
|
||||
|
||||
/*
|
||||
* Search the bitmap for a free descriptor starting at minfd.
|
||||
@ -1587,7 +1615,7 @@ fdalloc(struct thread *td, int minfd, int *result)
|
||||
* fd is already equal to first free descriptor >= minfd, so
|
||||
* we only need to grow the table and we are done.
|
||||
*/
|
||||
fdgrowtable(fdp, allocfd);
|
||||
fdgrowtable_exp(fdp, allocfd);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1652,9 +1680,7 @@ fdavail(struct thread *td, int n)
|
||||
* call racct_add() from there instead of dealing with containers
|
||||
* here.
|
||||
*/
|
||||
PROC_LOCK(p);
|
||||
lim = min((int)lim_cur(p, RLIMIT_NOFILE), maxfilesperproc);
|
||||
PROC_UNLOCK(p);
|
||||
lim = getmaxfd(p);
|
||||
if ((i = lim - fdp->fd_nfiles) > 0 && (n -= i) <= 0)
|
||||
return (1);
|
||||
last = min(fdp->fd_nfiles, lim);
|
||||
|
@ -2076,7 +2076,8 @@ getnewbuf_bufd_help(struct vnode *vp, int gbflags, int slpflag, int slptimeo,
|
||||
wait = MNT_NOWAIT;
|
||||
mtx_lock(&nblock);
|
||||
while (needsbuffer & flags) {
|
||||
if (vp != NULL && (td->td_pflags & TDP_BUFNEED) == 0) {
|
||||
if (vp != NULL && vp->v_type != VCHR &&
|
||||
(td->td_pflags & TDP_BUFNEED) == 0) {
|
||||
mtx_unlock(&nblock);
|
||||
|
||||
/*
|
||||
|
@ -1315,6 +1315,8 @@ vinvalbuf(struct vnode *vp, int flags, int slpflag, int slptimeo)
|
||||
|
||||
CTR3(KTR_VFS, "%s: vp %p with flags %d", __func__, vp, flags);
|
||||
ASSERT_VOP_LOCKED(vp, "vinvalbuf");
|
||||
if (vp->v_object != NULL && vp->v_object->handle != vp)
|
||||
return (0);
|
||||
return (bufobj_invalbuf(&vp->v_bufobj, flags, slpflag, slptimeo));
|
||||
}
|
||||
|
||||
|
@ -231,6 +231,7 @@ struct if_data {
|
||||
#define IFCAP_NETMAP 0x100000 /* netmap mode supported/enabled */
|
||||
#define IFCAP_RXCSUM_IPV6 0x200000 /* can offload checksum on IPv6 RX */
|
||||
#define IFCAP_TXCSUM_IPV6 0x400000 /* can offload checksum on IPv6 TX */
|
||||
#define IFCAP_HWSTATS 0x800000 /* manages counters internally */
|
||||
|
||||
#define IFCAP_HWCSUM_IPV6 (IFCAP_RXCSUM_IPV6 | IFCAP_TXCSUM_IPV6)
|
||||
|
||||
|
@ -528,7 +528,8 @@ ether_input_internal(struct ifnet *ifp, struct mbuf *m)
|
||||
m->m_flags &= ~M_HASFCS;
|
||||
}
|
||||
|
||||
ifp->if_ibytes += m->m_pkthdr.len;
|
||||
if (!(ifp->if_capenable & IFCAP_HWSTATS))
|
||||
ifp->if_ibytes += m->m_pkthdr.len;
|
||||
|
||||
/* Allow monitor mode to claim this frame, after stats are updated. */
|
||||
if (ifp->if_flags & IFF_MONITOR) {
|
||||
|
@ -347,6 +347,7 @@ lagg_clone_create(struct if_clone *ifc, int unit, caddr_t params)
|
||||
ifp->if_init = lagg_init;
|
||||
ifp->if_ioctl = lagg_ioctl;
|
||||
ifp->if_flags = IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST;
|
||||
ifp->if_capenable = ifp->if_capabilities = IFCAP_HWSTATS;
|
||||
|
||||
/*
|
||||
* Attach as an ordinary ethernet device, children will be attached
|
||||
|
@ -1,4 +1,4 @@
|
||||
\"
|
||||
.\"
|
||||
.\" Copyright (c) 2012 NetApp Inc
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
|
Loading…
x
Reference in New Issue
Block a user