svn commit: r230934 - head/usr.bin/fstat

2012-02-03 Thread Sergey Kandaurov
Author: pluknet
Date: Fri Feb  3 09:07:53 2012
New Revision: 230934
URL: http://svn.freebsd.org/changeset/base/230934

Log:
  Print the owner process for unix domain sockets when restricted to the
  specified files.
  
  PR:   bin/143962
  MFC after:2 weeks

Modified:
  head/usr.bin/fstat/fstat.c

Modified: head/usr.bin/fstat/fstat.c
==
--- head/usr.bin/fstat/fstat.c  Fri Feb  3 09:06:24 2012(r230933)
+++ head/usr.bin/fstat/fstat.c  Fri Feb  3 09:07:53 2012(r230934)
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -224,28 +225,53 @@ static void
 print_file_info(struct procstat *procstat, struct filestat *fst,
 const char *uname, const char *cmd, int pid)
 {
+   struct sockstat sock;
struct vnstat vn;
DEVS *d;
const char *filename;
int error, fsmatch = 0;
char errbuf[_POSIX2_LINE_MAX];
 
+   error = 0;
filename = NULL;
if (checkfile != 0) {
-   if (fst->fs_type != PS_FST_TYPE_VNODE &&
-   fst->fs_type != PS_FST_TYPE_FIFO)
+   switch (fst->fs_type) {
+   case PS_FST_TYPE_VNODE:
+   case PS_FST_TYPE_FIFO:
+   error = procstat_get_vnode_info(procstat, fst, &vn, 
errbuf);
+   break;
+   case PS_FST_TYPE_SOCKET:
+   error = procstat_get_socket_info(procstat, fst, &sock, 
errbuf);
+   break;
+   default:
return;
-   error = procstat_get_vnode_info(procstat, fst, &vn, errbuf);
+   }
if (error != 0)
return;
 
for (d = devs; d != NULL; d = d->next)
-   if (d->fsid == vn.vn_fsid) {
-   fsmatch = 1;
-   if ((unsigned)d->ino == vn.vn_fileid) {
-   filename = d->name;
-   break;
+   switch (fst->fs_type) {
+   case PS_FST_TYPE_VNODE:
+   case PS_FST_TYPE_FIFO:  
+   if (d->fsid == vn.vn_fsid) {
+   fsmatch = 1;
+   if ((unsigned)d->ino == vn.vn_fileid) {
+   filename = d->name;
+   break;
+   }
+   }
+   break;
+   case PS_FST_TYPE_SOCKET:
+   if (sock.dom_family == AF_UNIX) {
+   fsmatch = 1;
+   if (strcmp(((struct sockaddr_un *)
+   (&sock.sa_local))->sun_path,
+   d->name) == 0) {
+   filename = d->name;
+   break;
+   }
}
+   break;
}
if (fsmatch == 0 || (filename == NULL && fsflg == 0))
return;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r230945 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2012-02-03 Thread Martin Matuska
Author: mm
Date: Fri Feb  3 13:40:51 2012
New Revision: 230945
URL: http://svn.freebsd.org/changeset/base/230945

Log:
  Revert r230913 and r230914.
  
  The initialization was correct, the problem needs deeper analysis.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Fri Feb  3 
13:20:48 2012(r230944)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Fri Feb  3 
13:40:51 2012(r230945)
@@ -20,9 +20,6 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- *
- * Portions Copyright 2012 Sergey Kandaurov 
- * Portions Copyright 2012 Martin Matuska 
  */
 
 #include 
@@ -996,7 +993,7 @@ dnode_buf_pageout(dmu_buf_t *db, void *a
dnh->dnh_dnode = NULL;
}
kmem_free(children_dnodes, sizeof (dnode_children_t) +
-   epb * sizeof (dnode_handle_t));
+   (epb - 1) * sizeof (dnode_handle_t));
 }
 
 /*
@@ -1081,7 +1078,7 @@ dnode_hold_impl(objset_t *os, uint64_t o
int i;
dnode_children_t *winner;
children_dnodes = kmem_zalloc(sizeof (dnode_children_t) +
-   epb * sizeof (dnode_handle_t), KM_SLEEP);
+   (epb - 1) * sizeof (dnode_handle_t), KM_SLEEP);
children_dnodes->dnc_count = epb;
dnh = &children_dnodes->dnc_children[0];
for (i = 0; i < epb; i++) {
@@ -1091,7 +1088,7 @@ dnode_hold_impl(objset_t *os, uint64_t o
if (winner = dmu_buf_set_user(&db->db, children_dnodes, NULL,
dnode_buf_pageout)) {
kmem_free(children_dnodes, sizeof (dnode_children_t) +
-   epb * sizeof (dnode_handle_t));
+   (epb - 1) * sizeof (dnode_handle_t));
children_dnodes = winner;
}
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r230957 - head/sys/amd64/acpica

2012-02-03 Thread Jung-uk Kim
Author: jkim
Date: Fri Feb  3 21:21:00 2012
New Revision: 230957
URL: http://svn.freebsd.org/changeset/base/230957

Log:
  Fix a function prototype to reflect reality.  No functional change.

Modified:
  head/sys/amd64/acpica/acpi_wakeup.c

Modified: head/sys/amd64/acpica/acpi_wakeup.c
==
--- head/sys/amd64/acpica/acpi_wakeup.c Fri Feb  3 20:27:14 2012
(r230956)
+++ head/sys/amd64/acpica/acpi_wakeup.c Fri Feb  3 21:21:00 2012
(r230957)
@@ -74,7 +74,7 @@ static struct pcb **susppcbs;
 static void**suspfpusave;
 #endif
 
-intacpi_restorecpu(vm_offset_t, struct pcb *);
+intacpi_restorecpu(uint64_t, vm_offset_t);
 
 static void*acpi_alloc_wakeup_handler(void);
 static voidacpi_stop_beep(void *);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r230958 - head/sys/amd64/acpica

2012-02-03 Thread Jung-uk Kim
Author: jkim
Date: Fri Feb  3 21:24:28 2012
New Revision: 230958
URL: http://svn.freebsd.org/changeset/base/230958

Log:
  Restore callee saved registers later and micro-optimize.

Modified:
  head/sys/amd64/acpica/acpi_switch.S

Modified: head/sys/amd64/acpica/acpi_switch.S
==
--- head/sys/amd64/acpica/acpi_switch.S Fri Feb  3 21:21:00 2012
(r230957)
+++ head/sys/amd64/acpica/acpi_switch.S Fri Feb  3 21:24:28 2012
(r230958)
@@ -120,15 +120,6 @@ ENTRY(acpi_restorecpu)
 #undef SDT_SYSTSS
 #undef SDT_SYSBSY
 
-   /* Restore other callee saved registers. */
-   movqPCB_R15(%rdi), %r15
-   movqPCB_R14(%rdi), %r14
-   movqPCB_R13(%rdi), %r13
-   movqPCB_R12(%rdi), %r12
-   movqPCB_RBP(%rdi), %rbp
-   movqPCB_RSP(%rdi), %rsp
-   movqPCB_RBX(%rdi), %rbx
-
/* Restore debug registers. */
movqPCB_DR0(%rdi), %rax
movq%rax, %dr0
@@ -145,6 +136,7 @@ ENTRY(acpi_restorecpu)
 
/* Restore FPU state. */
fninit
+   movqWAKEUP_CTX(fpusave), %rbx
movqWAKEUP_CTX(xsmask), %rax
testq   %rax, %rax
jz  1f
@@ -153,19 +145,26 @@ ENTRY(acpi_restorecpu)
movl$XCR0, %ecx
 /* xsetbv  */
.byte   0x0f, 0x01, 0xd1
-   movqWAKEUP_CTX(fpusave), %rcx
-/* xrstor  (%rcx) */
-   .byte   0x0f, 0xae, 0x29
+/* xrstor  (%rbx) */
+   .byte   0x0f, 0xae, 0x2b
jmp 2f
 1:
-   movqWAKEUP_CTX(fpusave), %rcx
-   fxrstor (%rcx)
+   fxrstor (%rbx)
 2:
 
/* Reload CR0. */
movqPCB_CR0(%rdi), %rax
movq%rax, %cr0
 
+   /* Restore other callee saved registers. */
+   movqPCB_R15(%rdi), %r15
+   movqPCB_R14(%rdi), %r14
+   movqPCB_R13(%rdi), %r13
+   movqPCB_R12(%rdi), %r12
+   movqPCB_RBP(%rdi), %rbp
+   movqPCB_RSP(%rdi), %rsp
+   movqPCB_RBX(%rdi), %rbx
+
/* Restore return address. */
movqPCB_RIP(%rdi), %rax
movq%rax, (%rsp)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r230972 - in head: share/mk sys/amd64/conf sys/i386/conf sys/modules sys/modules/drm sys/modules/sound/driver sys/modules/usb tools/build/options

2012-02-03 Thread Robert Millan
Author: rmh
Date: Sat Feb  4 00:54:43 2012
New Revision: 230972
URL: http://svn.freebsd.org/changeset/base/230972

Log:
  Add MK_SOURCELESS build option. Setting MK_SOURCELESS to "no" will disable
  kernel modules that include binary-only code.
  
  More fine-grained control is provided via MK_SOURCELESS_HOST (for native code
  that runs on host CPU) and MK_SOURCELESS_UCODE (for microcode).
  
  Reviewed by:  julian, delphij, freebsd-arch
  Approved by:  kib (mentor)
  MFC after:2 weeks

Added:
  head/sys/amd64/conf/WITHOUT_SOURCELESS   (contents, props changed)
  head/sys/amd64/conf/WITHOUT_SOURCELESS_HOST   (contents, props changed)
  head/sys/amd64/conf/WITHOUT_SOURCELESS_UCODE   (contents, props changed)
  head/sys/i386/conf/WITHOUT_SOURCELESS   (contents, props changed)
  head/sys/i386/conf/WITHOUT_SOURCELESS_HOST   (contents, props changed)
  head/sys/i386/conf/WITHOUT_SOURCELESS_UCODE   (contents, props changed)
  head/tools/build/options/WITHOUT_SOURCELESS   (contents, props changed)
  head/tools/build/options/WITHOUT_SOURCELESS_HOST   (contents, props changed)
  head/tools/build/options/WITHOUT_SOURCELESS_UCODE   (contents, props changed)
Modified:
  head/share/mk/bsd.own.mk
  head/sys/modules/Makefile
  head/sys/modules/drm/Makefile
  head/sys/modules/sound/driver/Makefile
  head/sys/modules/usb/Makefile

Modified: head/share/mk/bsd.own.mk
==
--- head/share/mk/bsd.own.mkFri Feb  3 23:36:08 2012(r230971)
+++ head/share/mk/bsd.own.mkSat Feb  4 00:54:43 2012(r230972)
@@ -320,6 +320,9 @@ __DEFAULT_YES_OPTIONS = \
 BOOT \
 BSD_CPIO \
 BSNMP \
+SOURCELESS \
+SOURCELESS_HOST \
+SOURCELESS_UCODE \
 BZIP2 \
 CALENDAR \
 CAPSICUM \
@@ -511,6 +514,11 @@ MK_BIND_UTILS:=no
 MK_BIND_ETC:=  no
 .endif
 
+.if ${MK_SOURCELESS} == "no"
+MK_SOURCELESS_HOST:=   no
+MK_SOURCELESS_UCODE:= no
+.endif
+
 .if ${MK_CDDL} == "no"
 MK_ZFS:=   no
 MK_CTF:=   no

Added: head/sys/amd64/conf/WITHOUT_SOURCELESS
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/amd64/conf/WITHOUT_SOURCELESS  Sat Feb  4 00:54:43 2012
(r230972)
@@ -0,0 +1,7 @@
+#
+# WITHOUT_SOURCELESS -- Disable drivers that include sourceless code.
+#
+# $FreeBSD$
+
+include WITHOUT_SOURCELESS_HOST
+include WITHOUT_SOURCELESS_UCODE

Added: head/sys/amd64/conf/WITHOUT_SOURCELESS_HOST
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/amd64/conf/WITHOUT_SOURCELESS_HOST Sat Feb  4 00:54:43 2012
(r230972)
@@ -0,0 +1,10 @@
+#
+# WITHOUT_SOURCELESS_UCODE -- Disable drivers that include sourceless
+# native code for host CPU.
+#
+# $FreeBSD$
+
+nodevice   hpt27xx
+nodevice   hptmv
+nodevice   hptrr
+nodevice   nve

Added: head/sys/amd64/conf/WITHOUT_SOURCELESS_UCODE
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/amd64/conf/WITHOUT_SOURCELESS_UCODESat Feb  4 00:54:43 
2012(r230972)
@@ -0,0 +1,40 @@
+#
+# WITHOUT_SOURCELESS_UCODE -- Disable drivers that include sourceless
+# microcode.
+#
+# $FreeBSD$
+
+nodevice   bce
+nodevice   fatm
+nodevice   fxp
+nodevice   ispfw
+nodevice   mwlfw
+nodevice   ralfw
+nodevice   runfw
+nodevice   sf
+nodevice   sn
+nodevice   ti
+nodevice   txp
+nodevice   ce
+nodevice   cp
+nodevice   ctau
+nodevice   ipwfw
+nodevice   iwifw
+nodevice   iwnfw
+nodevice   wpifw
+
+# drm
+nodevice   mga
+nodevice   r128
+nodevice   radeon
+
+# sound
+nodevice   csa
+nodevice   ds1
+nodevice   maestro3
+
+# usb
+nodevice   rum
+nodevice   uath
+nodevice   zyd
+nodevice   kue

Added: head/sys/i386/conf/WITHOUT_SOURCELESS
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/i386/conf/WITHOUT_SOURCELESS   Sat Feb  4 00:54:43 2012
(r230972)
@@ -0,0 +1,7 @@
+#
+# WITHOUT_SOURCELESS -- Disable drivers that include sourceless code.
+#
+# $FreeBSD$
+
+include WITHOUT_SOURCELESS_HOST
+include WITHOUT_SOURCELESS_UCODE

Added: head/sys/i386/conf/WITHOUT_SOURCELESS_HOST
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/i386/conf/WITHOUT_SOURCELESS_HOST  Sat Feb  4 00:54:43 2012
(r230972)
@@ -0,0 +1,10 @@
+#
+# WITHOUT_SOURCELESS_UCODE -- Disable drivers that include sourceless
+# native code for host CPU.
+#
+# $FreeBSD$
+
+nodevice   hpt27xx
+nodevice   hptmv
+nodevice   hptrr
+no

Re: svn commit: r230869 - head/usr.sbin/daemon

2012-02-03 Thread Pawel Jakub Dawidek
On Wed, Feb 01, 2012 at 04:41:00PM +, Guy Helmer wrote:
> Author: ghelmer
> Date: Wed Feb  1 16:40:59 2012
> New Revision: 230869
> URL: http://svn.freebsd.org/changeset/base/230869
> 
> Log:
>   Change the notes about the pidfile to include Doug's preference
>   for pre-creating the pidfile with appropriate owner and permissions.
>   
>   Requested by dougb

Pre-creating pidfiles? That sounds weird. The common practise is to turn
eg. /var/run/.pid into /var/run//pid where  directory
has appropriate permissions. Pre-creating pidfiles is simply wrong,
because applications create pidfile on start and unlink it on exit.
If application has no permission to remove files from /var/run/ it will
leave pidfile with stale PID in it, which is bad. Changing application
to truncate pidfile on exit instead of unlinking it also is a bad idea
especially because there is working solution - pid directory.

-- 
Pawel Jakub Dawidek   http://www.wheelsystems.com
FreeBSD committer http://www.FreeBSD.org
Am I Evil? Yes, I Am! http://tupytaj.pl


pgpmTeqIOkaMr.pgp
Description: PGP signature


svn commit: r230976 - head/sbin/hastd

2012-02-03 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sat Feb  4 07:59:12 2012
New Revision: 230976
URL: http://svn.freebsd.org/changeset/base/230976

Log:
  Fix typo in comment.
  
  MFC after:3 days

Modified:
  head/sbin/hastd/parse.y

Modified: head/sbin/hastd/parse.y
==
--- head/sbin/hastd/parse.y Sat Feb  4 04:31:28 2012(r230975)
+++ head/sbin/hastd/parse.y Sat Feb  4 07:59:12 2012(r230976)
@@ -85,7 +85,7 @@ isitme(const char *name)
size_t bufsize;
 
/*
-* First check if the give name matches our full hostname.
+* First check if the given name matches our full hostname.
 */
if (gethostname(buf, sizeof(buf)) < 0) {
pjdlog_errno(LOG_ERR, "gethostname() failed");
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"