svn commit: r281193 - in projects/ifnet: sys/boot/forth sys/contrib/ipfilter/netinet sys/dev/usb sys/dev/usb/net sys/vm usr.bin/lockf usr.bin/netstat usr.bin/sort
Gleb Smirnoff
glebius at FreeBSD.org
Tue Apr 7 06:25:35 UTC 2015
Author: glebius
Date: Tue Apr 7 06:25:29 2015
New Revision: 281193
URL: https://svnweb.freebsd.org/changeset/base/281193
Log:
Merge head r257698 through r281192.
Modified:
projects/ifnet/sys/boot/forth/loader.4th
projects/ifnet/sys/boot/forth/logo-beastie.4th
projects/ifnet/sys/boot/forth/logo-orb.4th
projects/ifnet/sys/boot/forth/menu.4th
projects/ifnet/sys/boot/forth/menu.rc
projects/ifnet/sys/boot/forth/version.4th
projects/ifnet/sys/contrib/ipfilter/netinet/ip_compat.h
projects/ifnet/sys/dev/usb/net/if_axge.c
projects/ifnet/sys/dev/usb/usbdevs
projects/ifnet/sys/vm/vm_pageout.c
projects/ifnet/usr.bin/lockf/lockf.1
projects/ifnet/usr.bin/netstat/netstat.1
projects/ifnet/usr.bin/netstat/route.c
projects/ifnet/usr.bin/sort/bwstring.c
projects/ifnet/usr.bin/sort/file.c
projects/ifnet/usr.bin/sort/file.h
projects/ifnet/usr.bin/sort/sort.c
Directory Properties:
projects/ifnet/ (props changed)
projects/ifnet/sys/ (props changed)
projects/ifnet/sys/boot/ (props changed)
projects/ifnet/sys/contrib/ipfilter/ (props changed)
Modified: projects/ifnet/sys/boot/forth/loader.4th
==============================================================================
--- projects/ifnet/sys/boot/forth/loader.4th Tue Apr 7 06:22:22 2015 (r281192)
+++ projects/ifnet/sys/boot/forth/loader.4th Tue Apr 7 06:25:29 2015 (r281193)
@@ -53,7 +53,7 @@ only forth definitions
loader_color? dup ( -- bool bool )
if 7 fg 4 bg then
." Booting..."
- if me then
+ if escc ." 0m" then
cr
;
Modified: projects/ifnet/sys/boot/forth/logo-beastie.4th
==============================================================================
--- projects/ifnet/sys/boot/forth/logo-beastie.4th Tue Apr 7 06:22:22 2015 (r281192)
+++ projects/ifnet/sys/boot/forth/logo-beastie.4th Tue Apr 7 06:25:29 2015 (r281193)
@@ -40,11 +40,11 @@
s" @[31m, ," logo+
s" /( )`" logo+
s" \ \___ / |" logo+
- s" /- @[m_@[31m `-/ '" logo+
- s" (@[m/\/ \@[31m \ /\" logo+
- s" @[m/ / |@[31m ` \" logo+
- s" @[34mO O @[m) @[31m/ |" logo+
- s" @[m`-^--'@[31m`< '" logo+
+ s" /- @[37m_@[31m `-/ '" logo+
+ s" (@[37m/\/ \@[31m \ /\" logo+
+ s" @[37m/ / |@[31m ` \" logo+
+ s" @[34mO O @[37m) @[31m/ |" logo+
+ s" @[37m`-^--'@[31m`< '" logo+
s" (_.) _ ) /" logo+
s" `.___/` /" logo+
s" `-----' /" logo+
@@ -55,7 +55,7 @@
s" \ / /\" logo+
s" @[36m______@[31m( (_ / \______/" logo+
s" @[36m,' ,-----' |" logo+
- s" `--{__________)@[m" logo+
+ s" `--{__________)@[37m" logo+
2drop
;
Modified: projects/ifnet/sys/boot/forth/logo-orb.4th
==============================================================================
--- projects/ifnet/sys/boot/forth/logo-orb.4th Tue Apr 7 06:22:22 2015 (r281192)
+++ projects/ifnet/sys/boot/forth/logo-orb.4th Tue Apr 7 06:25:29 2015 (r281193)
@@ -49,7 +49,7 @@
s" -- @[31;1m-.@[31m" logo+
s" `:` @[31;1m`:`" logo+
s" @[31;1m.-- `--." logo+
- s" .---.....----.@[m" logo+
+ s" .---.....----.@[37m" logo+
2drop
;
Modified: projects/ifnet/sys/boot/forth/menu.4th
==============================================================================
--- projects/ifnet/sys/boot/forth/menu.4th Tue Apr 7 06:22:22 2015 (r281192)
+++ projects/ifnet/sys/boot/forth/menu.4th Tue Apr 7 06:25:29 2015 (r281193)
@@ -206,6 +206,8 @@ also menu-infrastructure definitions
\
: printmenuitem ( menu_item_str -- ascii_keycode )
+ loader_color? if [char] ^ escc! then
+
menurow dup @ 1+ swap ! ( increment menurow )
menuidx dup @ 1+ swap ! ( increment menuidx )
@@ -219,7 +221,7 @@ also menu-infrastructure definitions
loader_color? dup ( -- bool bool )
if b then
menuidx @ .
- if me then
+ if 7 fg then
\ Move the cursor forward 1 column
dup menuX @ 1+ swap at-xy
Modified: projects/ifnet/sys/boot/forth/menu.rc
==============================================================================
--- projects/ifnet/sys/boot/forth/menu.rc Tue Apr 7 06:22:22 2015 (r281192)
+++ projects/ifnet/sys/boot/forth/menu.rc Tue Apr 7 06:25:29 2015 (r281193)
@@ -17,6 +17,7 @@ menu-init \ initialize the menu area
\ Initialize main menu constructs (see `menu.4th')
\ NOTE: To use `non-ansi' variants, add `loader_color=0' to loader.conf(5)
+\ NOTE: ANSI variants can use `^' in place of literal `Esc' (ASCII 27)
\
\ MAIN MENU
@@ -28,22 +29,22 @@ set mainmenu_init[1]="init_boot"
set mainmenu_caption[1]="Boot Multi User [Enter]"
set maintoggled_text[1]="Boot [S]ingle User [Enter]"
set mainmenu_command[1]="boot"
-set mainansi_caption[1]="[1mB[moot Multi User [1m[Enter][m"
-set maintoggled_ansi[1]="Boot [1mS[mingle User [1m[Enter][m"
+set mainansi_caption[1]="^[1mB^[37moot Multi User ^[1m[Enter]^[37m"
+set maintoggled_ansi[1]="Boot ^[1mS^[37mingle User ^[1m[Enter]^[37m"
\ keycode set by init_boot
set mainmenu_init[2]="init_altboot"
set mainmenu_caption[2]="Boot [S]ingle User"
set maintoggled_text[2]="Boot [M]ulti User"
set mainmenu_command[2]="altboot"
-set mainansi_caption[2]="Boot [1mS[mingle User"
-set maintoggled_ansi[2]="Boot [1mM[multi User"
+set mainansi_caption[2]="Boot ^[1mS^[37mingle User"
+set maintoggled_ansi[2]="Boot ^[1mM^[37multi User"
\ keycode set by init_altboot
set mainmenu_caption[3]="[Esc]ape to loader prompt"
set mainmenu_command[3]="goto_prompt"
set mainmenu_keycode[3]=27
-set mainansi_caption[3]="[1mEsc[mape to loader prompt"
+set mainansi_caption[3]="^[1mEsc^[37mape to loader prompt"
\ Enable built-in "Reboot" trailing menuitem
\ NOTE: appears before menu_options if configured
@@ -62,7 +63,7 @@ set mainmenu_keycode[5]=107
set mainmenu_caption[6]="Configure Boot [O]ptions..."
set mainmenu_command[6]="2 goto_menu"
set mainmenu_keycode[6]=111
-set mainansi_caption[6]="Configure Boot [1mO[mptions..."
+set mainansi_caption[6]="Configure Boot ^[1mO^[37mptions..."
\
\ BOOT OPTIONS MENU
@@ -73,12 +74,12 @@ set menuset_name2="options"
set optionsmenu_caption[1]="Back to Main Menu [Backspace]"
set optionsmenu_command[1]="1 goto_menu"
set optionsmenu_keycode[1]=8
-set optionsansi_caption[1]="Back to Main Menu [1m[Backspace][m"
+set optionsansi_caption[1]="Back to Main Menu ^[1m[Backspace]^[37m"
set optionsmenu_caption[2]="Load System [D]efaults"
set optionsmenu_command[2]="set_default_boot_options"
set optionsmenu_keycode[2]=100
-set optionsansi_caption[2]="Load System [1mD[mefaults"
+set optionsansi_caption[2]="Load System ^[1mD^[37mefaults"
set optionsmenu_options=3
set optionsmenu_optionstext="Boot Options:"
@@ -88,32 +89,32 @@ set optionsmenu_caption[3]="[A]CPI Suppo
set optionstoggled_text[3]="[A]CPI Support On"
set optionsmenu_command[3]="toggle_acpi"
set optionsmenu_keycode[3]=97
-set optionsansi_caption[3]="[1mA[mCPI Support [34;1mOff[m"
-set optionstoggled_ansi[3]="[1mA[mCPI Support [32;7mOn[m"
+set optionsansi_caption[3]="^[1mA^[37mCPI Support ^[34;1mOff^[37m"
+set optionstoggled_ansi[3]="^[1mA^[37mCPI Support ^[32;7mOn^[0;37m"
set optionsmenu_init[4]="init_safemode"
set optionsmenu_caption[4]="Safe [M]ode... off"
set optionstoggled_text[4]="Safe [M]ode... On"
set optionsmenu_command[4]="toggle_safemode"
set optionsmenu_keycode[4]=109
-set optionsansi_caption[4]="Safe [1mM[mode... [34;1mOff[m"
-set optionstoggled_ansi[4]="Safe [1mM[mode... [32;7mOn[m"
+set optionsansi_caption[4]="Safe ^[1mM^[37mode... ^[34;1mOff^[37m"
+set optionstoggled_ansi[4]="Safe ^[1mM^[37mode... ^[32;7mOn^[0;37m"
set optionsmenu_init[5]="init_singleuser"
set optionsmenu_caption[5]="[S]ingle User. off"
set optionstoggled_text[5]="[S]ingle User. On"
set optionsmenu_command[5]="toggle_singleuser"
set optionsmenu_keycode[5]=115
-set optionsansi_caption[5]="[1mS[mingle User. [34;1mOff[m"
-set optionstoggled_ansi[5]="[1mS[mingle User. [32;7mOn[m"
+set optionsansi_caption[5]="^[1mS^[37mingle User. ^[34;1mOff^[37m"
+set optionstoggled_ansi[5]="^[1mS^[37mingle User. ^[32;7mOn^[0;37m"
set optionsmenu_init[6]="init_verbose"
set optionsmenu_caption[6]="[V]erbose..... off"
set optionstoggled_text[6]="[V]erbose..... On"
set optionsmenu_command[6]="toggle_verbose"
set optionsmenu_keycode[6]=118
-set optionsansi_caption[6]="[1mV[merbose..... [34;1mOff[m"
-set optionstoggled_ansi[6]="[1mV[merbose..... [32;7mOn[m"
+set optionsansi_caption[6]="^[1mV^[37merbose..... ^[34;1mOff^[37m"
+set optionstoggled_ansi[6]="^[1mV^[37merbose..... ^[32;7mOn^[0;37m"
\ Enable automatic booting (add ``autoboot_delay=N'' to loader.conf(5) to
\ customize the timeout; default is 10-seconds)
Modified: projects/ifnet/sys/boot/forth/version.4th
==============================================================================
--- projects/ifnet/sys/boot/forth/version.4th Tue Apr 7 06:22:22 2015 (r281192)
+++ projects/ifnet/sys/boot/forth/version.4th Tue Apr 7 06:25:29 2015 (r281193)
@@ -88,7 +88,7 @@ only forth definitions also version-proc
loader_color? dup ( -- bool bool )
if 6 fg then
type
- if me then
+ if 7 fg then
;
only forth definitions
Modified: projects/ifnet/sys/contrib/ipfilter/netinet/ip_compat.h
==============================================================================
--- projects/ifnet/sys/contrib/ipfilter/netinet/ip_compat.h Tue Apr 7 06:22:22 2015 (r281192)
+++ projects/ifnet/sys/contrib/ipfilter/netinet/ip_compat.h Tue Apr 7 06:25:29 2015 (r281193)
@@ -153,7 +153,8 @@ struct ether_addr {
# include <sys/rwlock.h>
# define KMUTEX_T struct mtx
# define KRWLOCK_T struct rwlock
-# ifdef _KERNEL
+
+#ifdef _KERNEL
# define READ_ENTER(x) rw_rlock(&(x)->ipf_lk)
# define WRITE_ENTER(x) rw_wlock(&(x)->ipf_lk)
# define MUTEX_DOWNGRADE(x) rw_downgrade(&(x)->ipf_lk)
@@ -165,16 +166,7 @@ struct ether_addr {
else \
rw_runlock(&(x)->ipf_lk); \
} while (0)
-# endif
-
# include <net/if_var.h>
-# define IFNAME(x) ((struct ifnet *)x)->if_xname
-# define COPYIFNAME(v, x, b) \
- (void) strncpy(b, \
- ((struct ifnet *)x)->if_xname, \
- LIFNAMSIZ)
-
-# ifdef _KERNEL
# define GETKTIME(x) microtime((struct timeval *)x)
# include <netinet/in_systm.h>
@@ -216,8 +208,28 @@ struct ether_addr {
# define M_DUP(m) m_dup(m, M_NOWAIT)
# define IPF_PANIC(x,y) if (x) { printf y; panic("ipf_panic"); }
typedef struct mbuf mb_t;
-# endif /* _KERNEL */
+#else /* !_KERNEL */
+#ifndef _NET_IF_VAR_H_
+/*
+ * Userland emulation of struct ifnet.
+ */
+struct route;
+struct mbuf;
+struct ifnet {
+ char if_xname[IFNAMSIZ];
+ TAILQ_HEAD(, ifaddr) if_addrlist;
+ int (*if_output)(struct ifnet *, struct mbuf *,
+ const struct sockaddr *, struct route *);
+};
+#endif /* _NET_IF_VAR_H_ */
+#endif /* _KERNEL */
+
+# define IFNAME(x) ((struct ifnet *)x)->if_xname
+# define COPYIFNAME(v, x, b) \
+ (void) strncpy(b, \
+ ((struct ifnet *)x)->if_xname, \
+ LIFNAMSIZ)
typedef u_long ioctlcmd_t;
typedef struct uio uio_t;
Modified: projects/ifnet/sys/dev/usb/net/if_axge.c
==============================================================================
--- projects/ifnet/sys/dev/usb/net/if_axge.c Tue Apr 7 06:22:22 2015 (r281192)
+++ projects/ifnet/sys/dev/usb/net/if_axge.c Tue Apr 7 06:25:29 2015 (r281193)
@@ -67,6 +67,7 @@ static const STRUCT_USB_HOST_ID axge_dev
AXGE_DEV(ASIX, AX88178A),
AXGE_DEV(ASIX, AX88179),
AXGE_DEV(DLINK, DUB1312),
+ AXGE_DEV(LENOVO, GIGALAN),
AXGE_DEV(SITECOMEU, LN032),
#undef AXGE_DEV
};
Modified: projects/ifnet/sys/dev/usb/usbdevs
==============================================================================
--- projects/ifnet/sys/dev/usb/usbdevs Tue Apr 7 06:22:22 2015 (r281192)
+++ projects/ifnet/sys/dev/usb/usbdevs Tue Apr 7 06:25:29 2015 (r281193)
@@ -2627,6 +2627,7 @@ product LARSENBRUSGAARD ALTITRACK 0x0001
product LEADTEK 9531 0x2101 9531 GPS
/* Lenovo products */
+product LENOVO GIGALAN 0x304b USB 3.0 Ethernet
product LENOVO ETHERNET 0x7203 USB 2.0 Ethernet
/* Lexar products */
Modified: projects/ifnet/sys/vm/vm_pageout.c
==============================================================================
--- projects/ifnet/sys/vm/vm_pageout.c Tue Apr 7 06:22:22 2015 (r281192)
+++ projects/ifnet/sys/vm/vm_pageout.c Tue Apr 7 06:25:29 2015 (r281193)
@@ -118,7 +118,8 @@ __FBSDID("$FreeBSD$");
/* the kernel process "vm_pageout"*/
static void vm_pageout(void);
static void vm_pageout_init(void);
-static int vm_pageout_clean(vm_page_t);
+static int vm_pageout_clean(vm_page_t m);
+static int vm_pageout_cluster(vm_page_t m);
static void vm_pageout_scan(struct vm_domain *vmd, int pass);
static void vm_pageout_mightbe_oom(struct vm_domain *vmd, int pass);
@@ -347,7 +348,7 @@ vm_pageout_page_lock(vm_page_t m, vm_pag
* late and we cannot do anything that will mess with the page.
*/
static int
-vm_pageout_clean(vm_page_t m)
+vm_pageout_cluster(vm_page_t m)
{
vm_object_t object;
vm_page_t mc[2*vm_pageout_page_count], pb, ps;
@@ -906,6 +907,115 @@ vm_pageout_map_deactivate_pages(map, des
#endif /* !defined(NO_SWAPPING) */
/*
+ * Attempt to acquire all of the necessary locks to launder a page and
+ * then call through the clustering layer to PUTPAGES. Wait a short
+ * time for a vnode lock.
+ *
+ * Requires the page and object lock on entry, releases both before return.
+ * Returns 0 on success and an errno otherwise.
+ */
+static int
+vm_pageout_clean(vm_page_t m)
+{
+ struct vnode *vp;
+ struct mount *mp;
+ vm_object_t object;
+ vm_pindex_t pindex;
+ int error, lockmode;
+
+ vm_page_assert_locked(m);
+ object = m->object;
+ VM_OBJECT_ASSERT_WLOCKED(object);
+ error = 0;
+ vp = NULL;
+ mp = NULL;
+
+ /*
+ * The object is already known NOT to be dead. It
+ * is possible for the vget() to block the whole
+ * pageout daemon, but the new low-memory handling
+ * code should prevent it.
+ *
+ * We can't wait forever for the vnode lock, we might
+ * deadlock due to a vn_read() getting stuck in
+ * vm_wait while holding this vnode. We skip the
+ * vnode if we can't get it in a reasonable amount
+ * of time.
+ */
+ if (object->type == OBJT_VNODE) {
+ vm_page_unlock(m);
+ vp = object->handle;
+ if (vp->v_type == VREG &&
+ vn_start_write(vp, &mp, V_NOWAIT) != 0) {
+ mp = NULL;
+ error = EDEADLK;
+ goto unlock_all;
+ }
+ KASSERT(mp != NULL,
+ ("vp %p with NULL v_mount", vp));
+ vm_object_reference_locked(object);
+ pindex = m->pindex;
+ VM_OBJECT_WUNLOCK(object);
+ lockmode = MNT_SHARED_WRITES(vp->v_mount) ?
+ LK_SHARED : LK_EXCLUSIVE;
+ if (vget(vp, lockmode | LK_TIMELOCK, curthread)) {
+ vp = NULL;
+ error = EDEADLK;
+ goto unlock_mp;
+ }
+ VM_OBJECT_WLOCK(object);
+ vm_page_lock(m);
+ /*
+ * While the object and page were unlocked, the page
+ * may have been:
+ * (1) moved to a different queue,
+ * (2) reallocated to a different object,
+ * (3) reallocated to a different offset, or
+ * (4) cleaned.
+ */
+ if (m->queue != PQ_INACTIVE || m->object != object ||
+ m->pindex != pindex || m->dirty == 0) {
+ vm_page_unlock(m);
+ error = ENXIO;
+ goto unlock_all;
+ }
+
+ /*
+ * The page may have been busied or held while the object
+ * and page locks were released.
+ */
+ if (vm_page_busied(m) || m->hold_count != 0) {
+ vm_page_unlock(m);
+ error = EBUSY;
+ goto unlock_all;
+ }
+ }
+
+ /*
+ * If a page is dirty, then it is either being washed
+ * (but not yet cleaned) or it is still in the
+ * laundry. If it is still in the laundry, then we
+ * start the cleaning operation.
+ */
+ if (vm_pageout_cluster(m) == 0)
+ error = EIO;
+
+unlock_all:
+ VM_OBJECT_WUNLOCK(object);
+
+unlock_mp:
+ vm_page_lock_assert(m, MA_NOTOWNED);
+ if (mp != NULL) {
+ if (vp != NULL)
+ vput(vp);
+ vm_object_deallocate(object);
+ vn_finished_write(mp);
+ }
+
+ return (error);
+}
+
+/*
* vm_pageout_scan does the dirty work for the pageout daemon.
*
* pass 0 - Update active LRU/deactivate pages
@@ -921,7 +1031,6 @@ vm_pageout_scan(struct vm_domain *vmd, i
int act_delta, addl_page_shortage, deficit, maxscan, page_shortage;
int vnodes_skipped = 0;
int maxlaunder;
- int lockmode;
boolean_t queues_locked;
/*
@@ -1155,9 +1264,7 @@ vm_pageout_scan(struct vm_domain *vmd, i
* on the inactive queue, we may have to go all out.
*/
int swap_pageouts_ok;
- struct vnode *vp = NULL;
- struct mount *mp = NULL;
- vm_pindex_t pindex;
+ int error;
if ((object->type != OBJT_SWAP) && (object->type != OBJT_DEFAULT)) {
swap_pageouts_ok = 1;
@@ -1180,124 +1287,20 @@ vm_pageout_scan(struct vm_domain *vmd, i
vm_page_requeue_locked(m);
goto relock_queues;
}
-
+ error = vm_pageout_clean(m);
/*
- * The object is already known NOT to be dead. It
- * is possible for the vget() to block the whole
- * pageout daemon, but the new low-memory handling
- * code should prevent it.
- *
- * The previous code skipped locked vnodes and, worse,
- * reordered pages in the queue. This results in
- * completely non-deterministic operation and, on a
- * busy system, can lead to extremely non-optimal
- * pageouts. For example, it can cause clean pages
- * to be freed and dirty pages to be moved to the end
- * of the queue. Since dirty pages are also moved to
- * the end of the queue once-cleaned, this gives
- * way too large a weighting to deferring the freeing
- * of dirty pages.
- *
- * We can't wait forever for the vnode lock, we might
- * deadlock due to a vn_read() getting stuck in
- * vm_wait while holding this vnode. We skip the
- * vnode if we can't get it in a reasonable amount
- * of time.
- */
- if (object->type == OBJT_VNODE) {
- vm_page_unlock(m);
- vp = object->handle;
- if (vp->v_type == VREG &&
- vn_start_write(vp, &mp, V_NOWAIT) != 0) {
- mp = NULL;
- ++pageout_lock_miss;
- if (object->flags & OBJ_MIGHTBEDIRTY)
- vnodes_skipped++;
- goto unlock_and_continue;
- }
- KASSERT(mp != NULL,
- ("vp %p with NULL v_mount", vp));
- vm_object_reference_locked(object);
- pindex = m->pindex;
- VM_OBJECT_WUNLOCK(object);
- lockmode = MNT_SHARED_WRITES(vp->v_mount) ?
- LK_SHARED : LK_EXCLUSIVE;
- if (vget(vp, lockmode | LK_TIMELOCK,
- curthread)) {
- VM_OBJECT_WLOCK(object);
- ++pageout_lock_miss;
- if (object->flags & OBJ_MIGHTBEDIRTY)
- vnodes_skipped++;
- vp = NULL;
- goto unlock_and_continue;
- }
- VM_OBJECT_WLOCK(object);
- vm_page_lock(m);
- /*
- * While the object and page were unlocked,
- * the page may have been
- * (1) moved to a different queue,
- * (2) reallocated to a different object,
- * (3) reallocated to a different offset, or
- * (4) cleaned.
- */
- if (m->queue != PQ_INACTIVE ||
- m->object != object ||
- m->pindex != pindex ||
- m->dirty == 0) {
- vm_page_unlock(m);
- if (object->flags & OBJ_MIGHTBEDIRTY)
- vnodes_skipped++;
- goto unlock_and_continue;
- }
-
- /*
- * The page may have been busied during the
- * blocking in vget(). We don't move the
- * page back onto the end of the queue so that
- * statistics are more correct if we don't.
- */
- if (vm_page_busied(m)) {
- vm_page_unlock(m);
- addl_page_shortage++;
- goto unlock_and_continue;
- }
-
- /*
- * If the page has become held it might
- * be undergoing I/O, so skip it
- */
- if (m->hold_count != 0) {
- vm_page_unlock(m);
- addl_page_shortage++;
- if (object->flags & OBJ_MIGHTBEDIRTY)
- vnodes_skipped++;
- goto unlock_and_continue;
- }
- }
-
- /*
- * If a page is dirty, then it is either being washed
- * (but not yet cleaned) or it is still in the
- * laundry. If it is still in the laundry, then we
- * start the cleaning operation.
- *
- * decrement page_shortage on success to account for
+ * Decrement page_shortage on success to account for
* the (future) cleaned page. Otherwise we could wind
* up laundering or cleaning too many pages.
*/
- if (vm_pageout_clean(m) != 0) {
- --page_shortage;
- --maxlaunder;
- }
-unlock_and_continue:
- vm_page_lock_assert(m, MA_NOTOWNED);
- VM_OBJECT_WUNLOCK(object);
- if (mp != NULL) {
- if (vp != NULL)
- vput(vp);
- vm_object_deallocate(object);
- vn_finished_write(mp);
+ if (error == 0) {
+ page_shortage--;
+ maxlaunder--;
+ } else if (error == EDEADLK) {
+ pageout_lock_miss++;
+ vnodes_skipped++;
+ } else if (error == EBUSY) {
+ addl_page_shortage++;
}
vm_page_lock_assert(m, MA_NOTOWNED);
goto relock_queues;
Modified: projects/ifnet/usr.bin/lockf/lockf.1
==============================================================================
--- projects/ifnet/usr.bin/lockf/lockf.1 Tue Apr 7 06:22:22 2015 (r281192)
+++ projects/ifnet/usr.bin/lockf/lockf.1 Tue Apr 7 06:25:29 2015 (r281193)
@@ -162,6 +162,7 @@ but may have been signaled or stopped.
.El
.Sh SEE ALSO
.Xr flock 2 ,
+.Xr lockf 3 ,
.Xr sysexits 3
.Sh HISTORY
A
Modified: projects/ifnet/usr.bin/netstat/netstat.1
==============================================================================
--- projects/ifnet/usr.bin/netstat/netstat.1 Tue Apr 7 06:22:22 2015 (r281192)
+++ projects/ifnet/usr.bin/netstat/netstat.1 Tue Apr 7 06:25:29 2015 (r281193)
@@ -78,11 +78,9 @@
.Op Fl I Ar interface
.It Nm Fl r
.Op Fl -libxo
-.Op Fl 46AnW
+.Op Fl 46nW
.Op Fl F Ar fibnum
.Op Fl f Ar address_family
-.Op Fl M Ar core
-.Op Fl N Ar system
.It Nm Fl rs
.Op Fl -libxo
.Op Fl s
@@ -581,9 +579,6 @@ See
Show IPv6 only.
See
.Sx GENERAL OPTIONS .
-.It Fl A
-Show the contents of the internal Patricia tree
-structures; used for debugging.
.It Fl n
Do not resolve numeric addresses and port numbers to names.
See
Modified: projects/ifnet/usr.bin/netstat/route.c
==============================================================================
--- projects/ifnet/usr.bin/netstat/route.c Tue Apr 7 06:22:22 2015 (r281192)
+++ projects/ifnet/usr.bin/netstat/route.c Tue Apr 7 06:25:29 2015 (r281193)
@@ -40,22 +40,18 @@ __FBSDID("$FreeBSD$");
#include <sys/protosw.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
+#include <sys/sysctl.h>
#include <sys/time.h>
#include <net/ethernet.h>
#include <net/if.h>
-#include <net/if_var.h>
#include <net/if_dl.h>
#include <net/if_types.h>
-#include <net/radix.h>
-#define _WANT_RTENTRY
#include <net/route.h>
#include <netinet/in.h>
#include <netgraph/ng_socket.h>
-#include <sys/sysctl.h>
-
#include <arpa/inet.h>
#include <ifaddrs.h>
#include <libutil.h>
@@ -72,8 +68,6 @@ __FBSDID("$FreeBSD$");
#include <libxo/xo.h>
#include "netstat.h"
-#define kget(p, d) (kread((u_long)(p), (char *)&(d), sizeof (d)))
-
/*
* Definitions for showing gateway flags.
*/
@@ -108,9 +102,7 @@ struct bits {
static struct nlist rl[] = {
#define N_RTSTAT 0
{ .n_name = "_rtstat" },
-#define N_RTREE 1
- { .n_name = "_rt_tables"},
-#define N_RTTRASH 2
+#define N_RTTRASH 1
{ .n_name = "_rttrash" },
{ .n_name = NULL },
};
@@ -121,33 +113,14 @@ typedef union {
u_short u_data[128];
} sa_u;
-static sa_u pt_u;
-
struct ifmap_entry {
char ifname[IFNAMSIZ];
};
-
static struct ifmap_entry *ifmap;
static int ifmap_size;
-
-int do_rtent = 0;
-struct rtentry rtentry;
-struct radix_node rnode;
-struct radix_mask rmask;
-
-int NewTree = 1;
-
struct timespec uptime;
-static struct sockaddr *kgetsa(struct sockaddr *);
-static void size_cols(int ef, struct radix_node *rn);
-static void size_cols_tree(struct radix_node *rn);
-static void size_cols_rtentry(struct rtentry *rt);
-static void p_rtnode_kvm(void);
static void p_rtable_sysctl(int, int);
-static void p_rtable_kvm(int, int );
-static void p_rtree_kvm(const char *name, struct radix_node *);
-static void p_rtentry_kvm(const char *name, struct rtentry *);
static void p_rtentry_sysctl(const char *name, struct rt_msghdr *);
static void p_sockaddr(const char *name, struct sockaddr *, struct sockaddr *,
int, int);
@@ -166,6 +139,9 @@ routepr(int fibnum, int af)
size_t intsize;
int numfibs;
+ if (live == 0)
+ return;
+
intsize = sizeof(int);
if (fibnum == -1 &&
sysctlbyname("net.my_fibnum", &fibnum, &intsize, NULL, 0) == -1)
@@ -187,11 +163,7 @@ routepr(int fibnum, int af)
if (fibnum)
xo_emit(" ({L:fib}: {:fib/%d})", fibnum);
xo_emit("\n");
-
- if (Aflag == 0 && live != 0 && NewTree)
- p_rtable_sysctl(fibnum, af);
- else
- p_rtable_kvm(fibnum, af);
+ p_rtable_sysctl(fibnum, af);
xo_close_container("route-information");
}
@@ -253,100 +225,6 @@ static int wid_mtu;
static int wid_if;
static int wid_expire;
-static void
-size_cols(int ef, struct radix_node *rn)
-{
- wid_dst = WID_DST_DEFAULT(ef);
- wid_gw = WID_GW_DEFAULT(ef);
- wid_flags = 6;
- wid_pksent = 8;
- wid_mtu = 6;
- wid_if = WID_IF_DEFAULT(ef);
- wid_expire = 6;
-
- if (Wflag && rn != NULL)
- size_cols_tree(rn);
-}
-
-static void
-size_cols_tree(struct radix_node *rn)
-{
-again:
- if (kget(rn, rnode) != 0)
- return;
- if (!(rnode.rn_flags & RNF_ACTIVE))
- return;
- if (rnode.rn_bit < 0) {
- if ((rnode.rn_flags & RNF_ROOT) == 0) {
- if (kget(rn, rtentry) != 0)
- return;
- size_cols_rtentry(&rtentry);
- }
- if ((rn = rnode.rn_dupedkey))
- goto again;
- } else {
- rn = rnode.rn_right;
- size_cols_tree(rnode.rn_left);
- size_cols_tree(rn);
- }
-}
-
-static void
-size_cols_rtentry(struct rtentry *rt)
-{
- static struct ifnet ifnet, *lastif;
- static char buffer[100];
- const char *bp;
- struct sockaddr *sa;
- sa_u addr, mask;
- int len;
-
- bzero(&addr, sizeof(addr));
- if ((sa = kgetsa(rt_key(rt))))
- bcopy(sa, &addr, sa->sa_len);
- bzero(&mask, sizeof(mask));
- if (rt_mask(rt) && (sa = kgetsa(rt_mask(rt))))
- bcopy(sa, &mask, sa->sa_len);
- bp = fmt_sockaddr(&addr.u_sa, &mask.u_sa, rt->rt_flags);
- len = strlen(bp);
- wid_dst = MAX(len, wid_dst);
-
- bp = fmt_sockaddr(kgetsa(rt->rt_gateway), NULL, RTF_HOST);
- len = strlen(bp);
- wid_gw = MAX(len, wid_gw);
-
- bp = fmt_flags(rt->rt_flags);
- len = strlen(bp);
- wid_flags = MAX(len, wid_flags);
-
- if (Wflag) {
- len = snprintf(buffer, sizeof(buffer), "%ju",
- (uintmax_t )kread_counter((u_long )rt->rt_pksent));
- wid_pksent = MAX(len, wid_pksent);
- }
- if (rt->rt_ifp) {
- if (rt->rt_ifp != lastif) {
- if (kget(rt->rt_ifp, ifnet) == 0)
- len = strlen(ifnet.if_xname);
- else
- len = strlen("---");
- lastif = rt->rt_ifp;
- wid_if = MAX(len, wid_if);
- }
- if (rt->rt_expire) {
- time_t expire_time;
-
- if ((expire_time =
- rt->rt_expire - uptime.tv_sec) > 0) {
- len = snprintf(buffer, sizeof(buffer), "%d",
- (int)expire_time);
- wid_expire = MAX(len, wid_expire);
- }
- }
- }
-}
-
-
/*
* Print header for routing table columns.
*/
@@ -377,210 +255,6 @@ pr_rthdr(int af1)
}
}
-static struct sockaddr *
-kgetsa(struct sockaddr *dst)
-{
-
- if (kget(dst, pt_u.u_sa) != 0)
- return (NULL);
- if (pt_u.u_sa.sa_len > sizeof (pt_u.u_sa))
- kread((u_long)dst, (char *)pt_u.u_data, pt_u.u_sa.sa_len);
- return (&pt_u.u_sa);
-}
-
-/*
- * Print kernel routing tables for given fib
- * using debugging kvm(3) interface.
- */
-static void
-p_rtable_kvm(int fibnum, int af)
-{
- struct radix_node_head **rnhp, *rnh, head;
- struct radix_node_head **rt_tables;
- u_long rtree;
- int fam, af_size;
- bool did_rt_family = false;
-
- kresolve_list(rl);
- if ((rtree = rl[N_RTREE].n_value) == 0) {
- xo_emit("rt_tables: symbol not in namelist\n");
- return;
- }
-
- af_size = (AF_MAX + 1) * sizeof(struct radix_node_head *);
- rt_tables = calloc(1, af_size);
- if (rt_tables == NULL)
- err(EX_OSERR, "memory allocation failed");
-
- if (kread((u_long)(rtree), (char *)(rt_tables) + fibnum * af_size,
- af_size) != 0)
- err(EX_OSERR, "error retrieving radix pointers");
- xo_open_container("route-table");
- for (fam = 0; fam <= AF_MAX; fam++) {
- int tmpfib;
-
- switch (fam) {
- case AF_INET6:
- case AF_INET:
- tmpfib = fibnum;
- break;
- default:
- tmpfib = 0;
- }
- rnhp = (struct radix_node_head **)*rt_tables;
- /* Calculate the in-kernel address. */
- rnhp += tmpfib * (AF_MAX + 1) + fam;
- /* Read the in kernel rhn pointer. */
- if (kget(rnhp, rnh) != 0)
- continue;
- if (rnh == NULL)
- continue;
- /* Read the rnh data. */
- if (kget(rnh, head) != 0)
- continue;
- if (fam == AF_UNSPEC) {
- if (Aflag && af == 0) {
- xo_emit("{T:Netmasks}:\n");
- xo_open_list("netmasks");
- p_rtree_kvm("netmasks", head.rnh_treetop);
- xo_close_list("netmasks");
- }
- } else if (af == AF_UNSPEC || af == fam) {
- if (!did_rt_family) {
- xo_open_list("rt-family");
- did_rt_family = true;
- }
- size_cols(fam, head.rnh_treetop);
- xo_open_instance("rt-family");
- pr_family(fam);
- do_rtent = 1;
- xo_open_list("rt-entry");
- pr_rthdr(fam);
- p_rtree_kvm("rt-entry", head.rnh_treetop);
- xo_close_list("rt-entry");
- xo_close_instance("rt-family");
- }
- }
- if (did_rt_family)
- xo_close_list("rt-family");
- xo_close_container("route-table");
-
- free(rt_tables);
-}
-
-/*
- * Print given kernel radix tree using
- * debugging kvm(3) interface.
- */
-static void
-p_rtree_kvm(const char *name, struct radix_node *rn)
-{
- bool opened;
-
- opened = false;
-
-#define DOOPEN() do { \
- if (!opened) { xo_open_instance(name); opened = true; } \
- } while (0)
-#define DOCLOSE() do { \
- if (opened) { opened = false; xo_close_instance(name); } \
- } while(0)
-
-again:
- if (kget(rn, rnode) != 0)
- return;
- if (!(rnode.rn_flags & RNF_ACTIVE))
- return;
- if (rnode.rn_bit < 0) {
- if (Aflag) {
- DOOPEN();
- xo_emit("{q:radix-node/%-8.8lx} ", (u_long)rn);
- }
- if (rnode.rn_flags & RNF_ROOT) {
- if (Aflag) {
- DOOPEN();
- xo_emit("({:root/root} node){L:/%s}",
- rnode.rn_dupedkey ? " =>\n" : "\n");
- }
- } else if (do_rtent) {
- if (kget(rn, rtentry) == 0) {
- DOOPEN();
- p_rtentry_kvm(name, &rtentry);
- if (Aflag) {
- DOOPEN();
- p_rtnode_kvm();
- DOCLOSE();
- }
- }
- } else {
- DOOPEN();
- p_sockaddr("address",
- kgetsa((struct sockaddr *)rnode.rn_key),
- NULL, 0, 44);
- xo_emit("\n");
- }
- DOCLOSE();
- if ((rn = rnode.rn_dupedkey))
- goto again;
- } else {
- if (Aflag && do_rtent) {
- DOOPEN();
- xo_emit("{q:radix-node/%-8.8lx} ", (u_long)rn);
- p_rtnode_kvm();
- DOCLOSE();
- }
- rn = rnode.rn_right;
- p_rtree_kvm(name, rnode.rn_left);
- p_rtree_kvm(name, rn);
- }
-}
-
-char nbuf[20];
-
-static void
-p_rtnode_kvm(void)
-{
- struct radix_mask *rm = rnode.rn_mklist;
-
- if (rnode.rn_bit < 0) {
- if (rnode.rn_mask) {
- xo_emit("\t {L:mask} ");
- p_sockaddr("netmask",
- kgetsa((struct sockaddr *)rnode.rn_mask),
- NULL, 0, -1);
- } else if (rm == 0)
- return;
- } else {
- xo_emit("{[:6}{:bit/(%d)}{]:} {q:left-node/%8.8lx} "
- ": {q:right-node/%8.8lx}", rnode.rn_bit,
- (u_long)rnode.rn_left, (u_long)rnode.rn_right);
- }
- while (rm) {
- if (kget(rm, rmask) != 0)
- break;
- sprintf(nbuf, " %d refs, ", rmask.rm_refs);
- xo_emit(" mk = {q:node/%8.8lx} \\{({:bit/%d}),{nbufs/%s}",
- (u_long)rm, -1 - rmask.rm_bit, rmask.rm_refs ? nbuf : " ");
- if (rmask.rm_flags & RNF_NORMAL) {
- struct radix_node rnode_aux;
- xo_emit(" <{:mode/normal}>, ");
- if (kget(rmask.rm_leaf, rnode_aux) == 0)
- p_sockaddr("netmask",
- kgetsa(/*XXX*/(void *)rnode_aux.rn_mask),
- NULL, 0, -1);
- else
- p_sockaddr(NULL, NULL, NULL, 0, -1);
- } else
- p_sockaddr("netmask",
- kgetsa((struct sockaddr *)rmask.rm_mask),
- NULL, 0, -1);
- xo_emit("\\}");
- if ((rm = rmask.rm_mklist))
- xo_emit(" {D:->}");
- }
- xo_emit("\n");
-}
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-projects
mailing list