svn commit: r233229 - head/share/man/man4

2012-03-20 Thread Maxim Konovalov
Author: maxim
Date: Tue Mar 20 12:24:36 2012
New Revision: 233229
URL: http://svn.freebsd.org/changeset/base/233229

Log:
  o Xr siftr.4 in order to expose it to a wider audience.
  
  Reviewed by:  lstewart

Modified:
  head/share/man/man4/tcp.4

Modified: head/share/man/man4/tcp.4
==
--- head/share/man/man4/tcp.4   Tue Mar 20 07:59:36 2012(r233228)
+++ head/share/man/man4/tcp.4   Tue Mar 20 12:24:36 2012(r233229)
@@ -562,6 +562,7 @@ address.
 .Xr intro 4 ,
 .Xr ip 4 ,
 .Xr mod_cc 4 ,
+.Xr siftr 4 ,
 .Xr syncache 4 ,
 .Xr setkey 8
 .Rs
___
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


Re: svn commit: r232721 - head/sys/x86/include

2012-03-20 Thread John Baldwin
On Friday, March 09, 2012 6:48:56 am Tijl Coosemans wrote:
 Author: tijl
 Date: Fri Mar  9 11:48:56 2012
 New Revision: 232721
 URL: http://svn.freebsd.org/changeset/base/232721
 
 Log:
   Clean up x86 endian.h:
   - Remove extern C. There are no functions with external linkage here. 
[1]
   - Rename bswapNN_const(x) to bswapNN_gen(x) to indicate that these macros
 are generic implementations that can take non-constant arguments. [1]
   - Split up __GNUCLIKE_ASM  __GNUCLIKE_BUILTIN_CONSTANT_P and deal with
 each separately.
   - Replace _LP64 with __amd64__ because asm instructions are machine
 dependent, not ABI dependent.
   
   Submitted by:   bde [1]
   Reviewed by:bde

BTW, I think I found an old bug in this file.  The _gen() variants
should only use the _gen() variants of smaller types rather than using
the version that re-checks __build_constant_p() I think.  That is:

Index: x86/include/endian.h
===
--- endian.h(revision 233184)
+++ endian.h(working copy)
@@ -65,9 +65,9 @@
 
 #define__bswap16_gen(x)(__uint16_t)((x)  8 | (x)  8)
 #define__bswap32_gen(x)\
-   (((__uint32_t)__bswap16(x)  16) | __bswap16((x)  16))
+   (((__uint32_t)__bswap16_gen(x)  16) | __bswap16_gen((x)  16))
 #define__bswap64_gen(x)\
-   (((__uint64_t)__bswap32(x)  32) | __bswap32((x)  32))
+   (((__uint64_t)__bswap32_gen(x)  32) | __bswap32_gen((x)  32))
 
 #ifdef __GNUCLIKE_BUILTIN_CONSTANT_P
 #define__bswap16(x)\

I ran into this while porting the __builtin_constant_p() functionality
over to ia64.

-- 
John Baldwin
___
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: r233230 - in head/sys/boot: fdt uboot/common

2012-03-20 Thread Rafal Jaworowski
Author: raj
Date: Tue Mar 20 13:08:57 2012
New Revision: 233230
URL: http://svn.freebsd.org/changeset/base/233230

Log:
  Improve device tree blob (DTB) handling in loader(8).
  
  Enable using the statically embedded blob from the kernel, if present. The KLD
  loaded DTB takes precedence, but they are both recognized and handled in the
  same way.
  
  Submitted by: Lukasz Wojcik
  Obtained from:Semihalf
  MFC after:1 week

Modified:
  head/sys/boot/fdt/fdt_loader_cmd.c
  head/sys/boot/uboot/common/metadata.c

Modified: head/sys/boot/fdt/fdt_loader_cmd.c
==
--- head/sys/boot/fdt/fdt_loader_cmd.c  Tue Mar 20 12:24:36 2012
(r233229)
+++ head/sys/boot/fdt/fdt_loader_cmd.c  Tue Mar 20 13:08:57 2012
(r233230)
@@ -33,6 +33,9 @@ __FBSDID($FreeBSD$);
 #include stand.h
 #include fdt.h
 #include libfdt.h
+#include sys/param.h
+#include sys/linker.h
+#include machine/elf.h
 
 #include bootstrap.h
 #include glue.h
@@ -56,6 +59,10 @@ __FBSDID($FreeBSD$);
 
 #define MIN(num1, num2)(((num1)  (num2)) ? (num1):(num2))
 
+#define COPYOUT(s,d,l) archsw.arch_copyout((vm_offset_t)(s), d, l)
+
+#define FDT_STATIC_DTB_SYMBOL  fdt_static_dtb
+
 static struct fdt_header *fdtp = NULL;
 
 static int fdt_cmd_nyi(int argc, char *argv[]);
@@ -92,6 +99,86 @@ static const struct cmdtab commands[] = 
 
 static char cwd[FDT_CWD_LEN] = /;
 
+static vm_offset_t
+fdt_find_static_dtb(void)
+{
+   Elf_Sym sym;
+   vm_offset_t dyntab, esym;
+   uint64_t offs;
+   struct preloaded_file *kfp;
+   struct file_metadata *md;
+   Elf_Sym *symtab;
+   Elf_Dyn *dyn;
+   char *strtab, *strp;
+   int i;
+
+   esym = strtab = symtab = 0;
+
+   offs = __elfN(relocation_offset);
+
+   kfp = file_findfile(NULL, NULL);
+   if (kfp == NULL)
+   return (0);
+
+   md = file_findmetadata(kfp, MODINFOMD_ESYM);
+   if (md == NULL)
+   return (0);
+   COPYOUT(md-md_data, esym, sizeof(esym));
+
+   md = file_findmetadata(kfp, MODINFOMD_DYNAMIC);
+   if (md == NULL)
+   return (0);
+   COPYOUT(md-md_data, dyntab, sizeof(dyntab));
+   dyntab += offs;
+
+   /* Locate STRTAB and DYNTAB */
+   for (dyn = (Elf_Dyn *)dyntab; dyn-d_tag != DT_NULL; dyn++) {
+   if (dyn-d_tag == DT_STRTAB) {
+   strtab = (char *)(uintptr_t)(dyn-d_un.d_ptr + offs);
+   continue;
+   } else if (dyn-d_tag == DT_SYMTAB) {
+   symtab = (Elf_Sym *)(uintptr_t)
+   (dyn-d_un.d_ptr + offs);
+   continue;
+   }
+   }
+
+   if (symtab == NULL || strtab == NULL) {
+   /*
+* No symtab? No strtab? That should not happen here,
+* and should have been verified during __elfN(loadimage).
+* This must be some kind of a bug.
+*/
+   return (0);
+   }
+
+   /*
+* The most efficent way to find a symbol would be to calculate a
+* hash, find proper bucket and chain, and thus find a symbol.
+* However, that would involve code duplication (e.g. for hash
+* function). So we're using simpler and a bit slower way: we're
+* iterating through symbols, searching for the one which name is
+* 'equal' to 'fdt_static_dtb'. To speed up the process a little bit,
+* we are eliminating symbols type of which is not STT_NOTYPE, or(and)
+* those which binding attribute is not STB_GLOBAL.
+*/
+   for (i = 0; (vm_offset_t)(symtab + i)  esym; i++) {
+   COPYOUT(symtab + i, sym, sizeof(sym));
+   if (ELF_ST_BIND(sym.st_info) != STB_GLOBAL ||
+   ELF_ST_TYPE(sym.st_info) != STT_NOTYPE)
+   continue;
+
+   strp = strdupout((vm_offset_t)(strtab + sym.st_name));
+   if (strcmp(strp, FDT_STATIC_DTB_SYMBOL) == 0) {
+   /* Found a match ! */
+   free(strp);
+   return ((vm_offset_t)(sym.st_value + offs));
+   }
+   free(strp);
+   }
+   return (0);
+}
+
 static int
 fdt_setup_fdtp()
 {
@@ -103,10 +190,14 @@ fdt_setup_fdtp()
 */
bfp = file_findfile(NULL, dtb);
if (bfp == NULL) {
-   command_errmsg = no device tree blob loaded;
-   return (CMD_ERROR);
+   if ((fdtp = (struct fdt_head *)fdt_find_static_dtb()) == 0) {
+   command_errmsg = no device tree blob found!;
+   return (CMD_ERROR);
+   }
+   } else {
+   /* Dynamic blob has precedence over static. */
+   fdtp = (struct fdt_header *)bfp-f_addr;
}
-   fdtp = (struct fdt_header *)bfp-f_addr;
 
/*
 * Validate the 

svn commit: r233231 - in head/libexec/rtld-elf: . amd64 arm i386 ia64 mips powerpc powerpc64 sparc64

2012-03-20 Thread Konstantin Belousov
Author: kib
Date: Tue Mar 20 13:20:49 2012
New Revision: 233231
URL: http://svn.freebsd.org/changeset/base/233231

Log:
  Fix several problems with our ELF filters implementation.
  
  Do not relocate twice an object which happens to be needed by loaded
  binary (or dso) and some filtee opened due to symbol resolution when
  relocating need objects.  Record the state of the relocation
  processing in Obj_Entry and short-circuit relocate_objects() if
  current object already processed.
  
  Do not call constructors for filtees loaded during the early
  relocation processing before image is initialized enough to run
  user-provided code.  Filtees are loaded using dlopen_object(), which
  normally performs relocation and initialization.  If filtee is
  lazy-loaded during the relocation of dso needed by the main object,
  dlopen_object() runs too earlier, when most runtime services are not
  yet ready.
  
  Postpone the constructors call to the time when main binary and
  depended libraries constructors are run, passing the new flag
  RTLD_LO_EARLY to dlopen_object().  Symbol lookups callers inform
  symlook_* functions about early stage of initialization with
  SYMLOOK_EARLY.  Pass flags through all functions participating in
  object relocation.
  
  Use the opportunity and fix flags argument to find_symdef() in
  arch-specific reloc.c to use proper name SYMLOOK_IN_PLT instead of
  true, which happen to have the same numeric value.
  
  Reported and tested by:   theraven
  Reviewed by:  kan
  MFC after:2 weeks

Modified:
  head/libexec/rtld-elf/amd64/reloc.c
  head/libexec/rtld-elf/arm/reloc.c
  head/libexec/rtld-elf/i386/reloc.c
  head/libexec/rtld-elf/ia64/reloc.c
  head/libexec/rtld-elf/mips/reloc.c
  head/libexec/rtld-elf/powerpc/reloc.c
  head/libexec/rtld-elf/powerpc64/reloc.c
  head/libexec/rtld-elf/rtld.c
  head/libexec/rtld-elf/rtld.h
  head/libexec/rtld-elf/sparc64/reloc.c

Modified: head/libexec/rtld-elf/amd64/reloc.c
==
--- head/libexec/rtld-elf/amd64/reloc.c Tue Mar 20 13:08:57 2012
(r233230)
+++ head/libexec/rtld-elf/amd64/reloc.c Tue Mar 20 13:20:49 2012
(r233231)
@@ -82,6 +82,7 @@ do_copy_relocations(Obj_Entry *dstobj)
size = dstsym-st_size;
symlook_init(req, name);
req.ventry = fetch_ventry(dstobj, ELF_R_SYM(rela-r_info));
+   req.flags = SYMLOOK_EARLY;
 
for (srcobj = dstobj-next;  srcobj != NULL;  srcobj = 
srcobj-next) {
res = symlook_obj(req, srcobj);
@@ -118,7 +119,8 @@ init_pltgot(Obj_Entry *obj)
 
 /* Process the non-PLT relocations. */
 int
-reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, RtldLockState *lockstate)
+reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags,
+RtldLockState *lockstate)
 {
const Elf_Rela *relalim;
const Elf_Rela *rela;
@@ -151,7 +153,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry 
const Obj_Entry *defobj;
 
def = find_symdef(ELF_R_SYM(rela-r_info), obj, defobj,
- false, cache, lockstate);
+ flags, cache, lockstate);
if (def == NULL)
goto done;
 
@@ -170,7 +172,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry 
const Obj_Entry *defobj;
 
def = find_symdef(ELF_R_SYM(rela-r_info), obj, defobj,
- false, cache, lockstate);
+ flags, cache, lockstate);
if (def == NULL)
goto done;
 
@@ -200,7 +202,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry 
const Obj_Entry *defobj;
 
def = find_symdef(ELF_R_SYM(rela-r_info), obj, defobj,
- false, cache, lockstate);
+ flags, cache, lockstate);
if (def == NULL)
goto done;
 
@@ -214,7 +216,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry 
const Obj_Entry *defobj;
 
def = find_symdef(ELF_R_SYM(rela-r_info), obj, defobj,
- false, cache, lockstate);
+ flags, cache, lockstate);
if (def == NULL)
goto done;
 
@@ -245,7 +247,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry 
const Obj_Entry *defobj;
 
def = find_symdef(ELF_R_SYM(rela-r_info), obj, defobj,
- false, cache, lockstate);
+ flags, cache, lockstate);
if (def == NULL)
goto done;
 
@@ -277,7 +279,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry 
const Obj_Entry *defobj;
 
def = find_symdef(ELF_R_SYM(rela-r_info), obj, defobj,
- false, cache, lockstate);
+ flags, cache, lockstate);
if (def == NULL)

Re: svn commit: r232721 - head/sys/x86/include

2012-03-20 Thread Tijl Coosemans
On Tuesday 20 March 2012 13:34:10 John Baldwin wrote:
 On Friday, March 09, 2012 6:48:56 am Tijl Coosemans wrote:
 Author: tijl
 Date: Fri Mar  9 11:48:56 2012
 New Revision: 232721
 URL: http://svn.freebsd.org/changeset/base/232721
 
 Log:
   Clean up x86 endian.h:
   - Remove extern C. There are no functions with external linkage here. [1]
   - Rename bswapNN_const(x) to bswapNN_gen(x) to indicate that these macros
 are generic implementations that can take non-constant arguments. [1]
   - Split up __GNUCLIKE_ASM  __GNUCLIKE_BUILTIN_CONSTANT_P and deal with
 each separately.
   - Replace _LP64 with __amd64__ because asm instructions are machine
 dependent, not ABI dependent.
   
   Submitted by:  bde [1]
   Reviewed by:   bde
 
 BTW, I think I found an old bug in this file.  The _gen() variants
 should only use the _gen() variants of smaller types rather than using
 the version that re-checks __build_constant_p() I think.  That is:
 
 Index: x86/include/endian.h
 ===
 --- endian.h  (revision 233184)
 +++ endian.h  (working copy)
 @@ -65,9 +65,9 @@
  
  #define  __bswap16_gen(x)(__uint16_t)((x)  8 | (x)  8)
  #define  __bswap32_gen(x)\
 - (((__uint32_t)__bswap16(x)  16) | __bswap16((x)  16))
 + (((__uint32_t)__bswap16_gen(x)  16) | __bswap16_gen((x)  16))
  #define  __bswap64_gen(x)\
 - (((__uint64_t)__bswap32(x)  32) | __bswap32((x)  32))
 + (((__uint64_t)__bswap32_gen(x)  32) | __bswap32_gen((x)  32))
  
  #ifdef __GNUCLIKE_BUILTIN_CONSTANT_P
  #define  __bswap16(x)\
 
 I ran into this while porting the __builtin_constant_p() functionality
 over to ia64.

No, on i386 bswap64 with a variable argument currently expands to two
bswap instructions. With your change it would be many shifts and logical
operations. The _gen variants are more like fallback implementations.
If bswapNN cannot be implemented directly it is split up. If those
smaller problems can be implemented directly, good, if not split it up
again and so on.


signature.asc
Description: This is a digitally signed message part.


Re: svn commit: r233045 - in head/sys: conf kern

2012-03-20 Thread Gleb Smirnoff
On Mon, Mar 19, 2012 at 09:06:36PM +0100, Davide Italiano wrote:
D  These indented ifdefs look like a major violation of style used throughout
D  the FreeBSD kernel code. Can you please keep with common style?
D 
D 
D  Heh,
D  sorry, also Juli Mallet noticed this, I'm writing a fix for this and
D  after I'll have approval from my mentor I'll commit.

Looks okay, apart from additional empty line in NOTES. Isn't single
empty line enough?

-- 
Totus tuus, Glebius.
___
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: r233232 - head/share/man/man9

2012-03-20 Thread Sergey Kandaurov
Author: pluknet
Date: Tue Mar 20 16:56:35 2012
New Revision: 233232
URL: http://svn.freebsd.org/changeset/base/233232

Log:
  Update the list of struct ifnet fields.
  - Document if_vnet, if_home_vnet, if_carp, if_vlantrunk, if_multiaddrs,
if_amcount, if_addr, if_llsoftc stub, if_broadcastaddr, if_bridge,
if_label, if_afdata, if_afdata_initialized, if_afdata_lock, if_linktask,
if_addr_mtx (now if_addr_lock), if_clones, if_groups, if_pf_kif, if_lagg,
if_alloctype
  - G/c now defunct and/or commented out in the manual page if_ipending,
if_poll_slowq, if_done, if_poll_recv, if_poll_xmit, if_poll_slowinput,
if_poll_intren
  - Update if_snd type changed with ALTQ integration.
  
  MFC after:1 week

Modified:
  head/share/man/man9/ifnet.9

Modified: head/share/man/man9/ifnet.9
==
--- head/share/man/man9/ifnet.9 Tue Mar 20 13:20:49 2012(r233231)
+++ head/share/man/man9/ifnet.9 Tue Mar 20 16:56:35 2012(r233232)
@@ -28,7 +28,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd March 7, 2012
+.Dd March 20, 2012
 .Dt IFNET 9
 .Os
 .Sh NAME
@@ -229,6 +229,18 @@ A pointer to the driver's private state 
 A pointer to the common data for the interface's layer 2 protocol.
 (Initialized by
 .Fn if_alloc . )
+.It Va if_vnet
+.Pq Vt struct vnet *
+A pointer to the virtual network stack instance.
+(Initialized by
+.Fn if_attach . )
+.It Va if_home_vnet
+.Pq Vt struct vnet *
+A pointer to the parent virtual network stack, where this
+.Vt struct ifnet
+originates from.
+(Initialized by
+.Fn if_attach . )
 .It Va if_link
 .Pq Fn TAILQ_ENTRY ifnet
 .Xr queue 3
@@ -276,6 +288,13 @@ A count of promiscuous listeners on this
 reference-count the
 .Dv IFF_PROMISC
 flag.
+.It Va if_carp
+.Pq Vt struct carp_if *
+A pointer to the CARP interface structure,
+.Xr carp 4 .
+(Initialized by the driver-specific
+.Fn if_ioctl
+routine.)
 .It Va if_bpf
 .Pq Vt struct bpf_if *
 Opaque per-interface data for the packet filter,
@@ -293,6 +312,13 @@ to refer to a particular interface by in
 .Xr link_addr 3 ) .
 (Initialized by
 .Fn if_alloc . )
+.It Va if_vlantrunk
+.Pq Vt struct ifvlantrunk *
+A pointer to 802.1Q trunk structure,
+.Xr vlan 4 .
+(Initialized by the driver-specific
+.Fn if_ioctl
+routine.)
 .It Va if_flags
 .Pq Vt int
 Flags describing operational parameters of this interface (see below).
@@ -307,17 +333,6 @@ Flags describing the capabilities the in
 .It Va if_capenable
 .Pq Vt int
 Flags describing the enabled capabilities of the interface (see below).
-.\ .It Va if_ipending
-.\ Interrupt-pending bits for polled operation:
-.\ .Dv IFI_XMIT
-.\ (transmit complete interrupt)
-.\ and
-.\ .Dv IFI_RECV
-.\ (received packet ready interrupt).
-.\ See the
-.\ .Sx Polling
-.\ section, below.
-.\ (Manipulated by driver.)
 .It Va if_linkmib
 .Pq Vt void *
 A pointer to an interface-specific MIB structure exported by
@@ -334,18 +349,97 @@ More statistics and information; see
 below.
 (Initialized by driver, manipulated by both driver and generic
 code.)
+.It Va if_multiaddrs
+.Pq Vt struct ifmultihead
+The head of the
+.Xr queue 3
+.Li TAILQ
+containing the list of multicast addresses assigned to this interface.
+.It Va if_amcount
+.Pq Vt int
+A number of multicast requests on this interface, used to
+reference-count the
+.Dv IFF_ALLMULTI
+flag.
+.It Va if_addr
+.Pq Vt struct ifaddr *
+A pointer to the link-level interface address.
+(Initialized by
+.Fn if_alloc . )
+.\ .It Va if_llsoftc
+.\ .Pq Vt void *
+.\ The purpose of the field is unclear.
 .It Va if_snd
-.Pq Vt struct ifqueue
+.Pq Vt struct ifaltq
 The output queue.
 (Manipulated by driver.)
-.\.It Va if_poll_slowq
-.\.Pq Vt struct ifqueue *
-.\A pointer to the input queue for devices which do not support polling
-.\well.
-.\See the
-.\.Sx Polling
-.\section, below.
-.\(Initialized by driver.)
+.It Va if_broadcastaddr
+.Pq Vt const u_int8_t *
+A link-level broadcast bytestring for protocols with variable address
+length.
+.It Va if_bridge
+.Pq Vt void *
+A pointer to the bridge interface structure,
+.Xr if_bridge 4 .
+(Initialized by the driver-specific
+.Fn if_ioctl
+routine.)
+.It Va if_label
+.Pq Vt struct label *
+A pointer to the MAC Framework label structure,
+.Xr mac 4 .
+(Initialized by
+.Fn if_alloc . )
+.It Va if_afdata
+.Pq Vt void *
+An address family dependent data region.
+.It Va if_afdata_initialized
+.Pq Vt int
+Used to track the current state of address family initialization.
+.It Va if_afdata_lock
+.Pq Vt struct rwlock
+An
+.Xr rwlock 9
+lock used to protect
+.Va if_afdata
+internals.
+.It Va if_linktask
+.Pq Vt struct task
+A
+.Xr taskqueue 9
+task scheduled for link state change events of the interface.
+.It Va if_addr_lock
+.Pq Vt struct rwlock
+An
+.Xr rwlock 9
+lock used to protect interface-related address lists.
+.It Va if_clones
+.Pq Fn LIST_ENTRY ifnet
+.Xr queue 3
+macro glue for the list of clonable network interfaces.
+.It Va if_groups
+.Pq Fn TAILQ_HEAD , 

Re: svn commit: r233045 - in head/sys: conf kern

2012-03-20 Thread Davide Italiano
2012/3/20 Gleb Smirnoff gleb...@freebsd.org:
 On Mon, Mar 19, 2012 at 09:06:36PM +0100, Davide Italiano wrote:
 D  These indented ifdefs look like a major violation of style used 
 throughout
 D  the FreeBSD kernel code. Can you please keep with common style?
 D 
 D 
 D  Heh,
 D  sorry, also Juli Mallet noticed this, I'm writing a fix for this and
 D  after I'll have approval from my mentor I'll commit.

 Looks okay, apart from additional empty line in NOTES. Isn't single
 empty line enough?

 --
 Totus tuus, Glebius.

Well, I removed that in my previous commit.
It was a mistake.
But if you think it's ok to remove that line, I have no objections on this.

Davide
___
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: r233235 - in head: contrib/libcxxrt lib/libcxxrt

2012-03-20 Thread David Chisnall
Author: theraven
Date: Tue Mar 20 17:58:15 2012
New Revision: 233235
URL: http://svn.freebsd.org/changeset/base/233235

Log:
  Import new version of libcxxrt.  Now works correctly with libobjc2 to 
implement
  the unified exception model for Objective-C++.
  
  Approved by:  dim (mentor)

Deleted:
  head/contrib/libcxxrt/typeinfo
Modified:
  head/contrib/libcxxrt/dynamic_cast.cc
  head/contrib/libcxxrt/exception.cc
  head/contrib/libcxxrt/typeinfo.h
  head/lib/libcxxrt/Version.map
Directory Properties:
  head/contrib/libcxxrt/   (props changed)

Modified: head/contrib/libcxxrt/dynamic_cast.cc
==
--- head/contrib/libcxxrt/dynamic_cast.cc   Tue Mar 20 17:43:30 2012
(r233234)
+++ head/contrib/libcxxrt/dynamic_cast.cc   Tue Mar 20 17:58:15 2012
(r233235)
@@ -46,9 +46,65 @@ struct vtable_header
  */
 #define ADD_TO_PTR(x, off) (__typeof__(x))(((char*)x) + off)
 
-bool __class_type_info::can_cast_to(const struct __class_type_info *other) 
const
+bool std::type_info::__do_catch(std::type_info const *ex_type,
+void **exception_object,
+unsigned int outer) const
 {
-return this == other;
+   const type_info *type = this;
+
+   if (type == ex_type)
+   {
+   return true;
+   }
+   if (const __class_type_info *cti = dynamic_castconst __class_type_info 
*(type))
+   {
+   return ex_type-__do_upcast(cti, exception_object);
+   }
+   return false;
+}
+
+bool __pbase_type_info::__do_catch(std::type_info const *ex_type,
+   void **exception_object,
+   unsigned int outer) const
+{
+   if (ex_type == this)
+   {
+   return true;
+   }
+   if (!ex_type-__is_pointer_p())
+   {
+   // Can't catch a non-pointer type in a pointer catch
+   return false;
+   }
+
+   if (!(outer  1))
+   {
+   // If the low bit is cleared on this means that we've gone
+   // through a pointer that is not const qualified.
+   return false;
+   }
+   // Clear the low bit on outer if we're not const qualified.
+   if (!(__flags  __const_mask))
+   {
+   outer = ~1;
+   }
+
+   const __pbase_type_info *ptr_type =
+   static_castconst __pbase_type_info*(ex_type);
+
+   if (ptr_type-__flags  ~__flags)
+   {
+   // Handler pointer is less qualified
+   return false;
+   }
+
+   // Special case for void* handler.  
+   if(*__pointee == typeid(void))
+   {
+   return true;
+   }
+
+   return __pointee-__do_catch(ptr_type-__pointee, exception_object, 
outer);
 }
 
 void *__class_type_info::cast_to(void *obj, const struct __class_type_info 
*other) const
@@ -60,12 +116,6 @@ void *__class_type_info::cast_to(void *o
return 0;
 }
 
-
-bool __si_class_type_info::can_cast_to(const struct __class_type_info *other) 
const
-{
-return this == other || __base_type-can_cast_to(other);
-}
-
 void *__si_class_type_info::cast_to(void *obj, const struct __class_type_info 
*other) const
 {
if (this == other)
@@ -74,31 +124,32 @@ void *__si_class_type_info::cast_to(void
}
return __base_type-cast_to(obj, other);
 }
-
-
-bool __vmi_class_type_info::can_cast_to(const struct __class_type_info *other) 
const
+bool __si_class_type_info::__do_upcast(const __class_type_info *target,
+ void **thrown_object) const
 {
-   if (this == other)
+   if (this == target)
{
return true;
}
-   for (unsigned int i=0 ; i__base_count ; i++)
-   {
-   const __base_class_type_info *info = __base_info[i];
-if(info-isPublic()  info-__base_type-can_cast_to(other))
-{
-return true;
-}
-   }
-   return false;
+   return __base_type-__do_upcast(target, thrown_object);
 }
 
 void *__vmi_class_type_info::cast_to(void *obj, const struct __class_type_info 
*other) const
 {
-   if (this == other)
+   if (__do_upcast(other, obj))
{
return obj;
}
+   return 0;
+}
+
+bool __vmi_class_type_info::__do_upcast(const __class_type_info *target,
+ void **thrown_object) const
+{
+   if (this == target)
+   {
+   return true;
+   }
for (unsigned int i=0 ; i__base_count ; i++)
{
const __base_class_type_info *info = __base_info[i];
@@ -111,6 +162,7 @@ void *__vmi_class_type_info::cast_to(voi
// virtual table of the virtual base offset for the virtual base
// referenced (negative).'
 
+   void *obj = *thrown_object;
if (info-isVirtual())
{
 

svn commit: r233236 - head/sys

2012-03-20 Thread John Baldwin
Author: jhb
Date: Tue Mar 20 18:05:15 2012
New Revision: 233236
URL: http://svn.freebsd.org/changeset/base/233236

Log:
  Add sys/ofed to the 'make cscope' target.
  
  MFC after:1 week

Modified:
  head/sys/Makefile

Modified: head/sys/Makefile
==
--- head/sys/Makefile   Tue Mar 20 17:58:15 2012(r233235)
+++ head/sys/Makefile   Tue Mar 20 18:05:15 2012(r233236)
@@ -11,7 +11,7 @@ SUBDIR=   boot
 CSCOPEDIRS=boot bsm cam cddl compat conf contrib crypto ddb dev fs gdb \
geom gnu isa kern libkern modules net net80211 netatalk \
netgraph netinet netinet6 netipsec netipx netnatm netncp \
-   netsmb nfs nfsclient nfsserver nlm opencrypto \
+   netsmb nfs nfsclient nfsserver nlm ofed opencrypto \
pci rpc security sys ufs vm xdr xen ${CSCOPE_ARCHDIR}
 .if !defined(CSCOPE_ARCHDIR)
 .if defined(ALL_ARCH)
___
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


Re: svn commit: r233045 - in head/sys: conf kern

2012-03-20 Thread Gleb Smirnoff
On Tue, Mar 20, 2012 at 06:00:50PM +0100, Davide Italiano wrote:
D 2012/3/20 Gleb Smirnoff gleb...@freebsd.org:
D  On Mon, Mar 19, 2012 at 09:06:36PM +0100, Davide Italiano wrote:
D  D  These indented ifdefs look like a major violation of style used 
throughout
D  D  the FreeBSD kernel code. Can you please keep with common style?
D  D 
D  D 
D  D  Heh,
D  D  sorry, also Juli Mallet noticed this, I'm writing a fix for this and
D  D  after I'll have approval from my mentor I'll commit.
D 
D  Looks okay, apart from additional empty line in NOTES. Isn't single
D  empty line enough?
D 
D  --
D  Totus tuus, Glebius.
D 
D Well, I removed that in my previous commit.
D It was a mistake.
D But if you think it's ok to remove that line, I have no objections on this.

Well, I'm not that style(9)-evident person :) I just personally dislike
multiple empty lines, since less code fits on a terminal. So I won't insist
on any choice here.

I just noticed incorrect indentation of ifdefs, and that's all.

-- 
Totus tuus, Glebius.
___
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


Re: svn commit: r233052 - head/share/mk

2012-03-20 Thread John Baldwin
On Monday, March 19, 2012 5:39:53 pm Doug Barton wrote:
 On 3/19/2012 12:37 PM, Dimitry Andric wrote:
  It would be much nicer to be able to write:
  
  .if defined(FOO)
.if defined(BAR)
  CFLAGS+=-DFOO_BAR
.endif
  .endif
 
 Take a look at /usr/ports/Mk/bsd.port.mk for how this can be done.

Hmm, do yoo have a specific example?  The bits in I see in bsd.port.mk suffer
from the limitation Dimitry raises, e.g.:

.if defined(OPTIONS)
# include OPTIONSFILE first if exists
.   if exists(${OPTIONSFILE})  !make(rmconfig)
.   include ${OPTIONSFILE}
.   endif
.   if exists(${OPTIONSFILE}.local)
.   include ${OPTIONSFILE}.local
.   endif
WITHOUT:=
WITH:=
.   if defined(OPTIONS)
REALOPTIONS=${OPTIONS:C/.*//g}
.   for O in ${REALOPTIONS}
RO:=${O}
.   if ${RO:L} == off
WITHOUT:=   ${WITHOUT} ${OPT}
.   endif
.   if ${RO:L} == on
WITH:=  ${WITH} ${OPT}
.   endif
OPT:=${RO}
.   endfor
.   endif

That is, all the lines that don't start with a . are not indented, and
even this indentation is rather horrible (it doesn't nest, and it
has the odd structure of 'if defined(OPTIONS) { if defined(OPTIONS) {} }'.

-- 
John Baldwin
___
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


Re: svn commit: r233103 - head/lib/libthr/thread

2012-03-20 Thread John Baldwin
On Monday, March 19, 2012 7:53:43 pm David Xu wrote:
 On 2012/3/20 1:50, John Baldwin wrote:
  On Monday, March 19, 2012 11:41:53 am David Xu wrote:
  On 2012/3/19 20:33, John Baldwin wrote:
  On Saturday, March 17, 2012 8:22:29 pm David Xu wrote:
  Author: davidxu
  Date: Sun Mar 18 00:22:29 2012
  New Revision: 233103
  URL: http://svn.freebsd.org/changeset/base/233103
 
  Log:
  Some software think a mutex can be destroyed after it owned it, for
  example, it uses a serialization point like following:
   pthread_mutex_lock(mutex);
   pthread_mutex_unlock(mutex);
   pthread_mutex_destroy(muetx);
  They think a previous lock holder should have already left the mutex 
  and
  is no longer referencing it, so they destroy it. To be maximum 
  compatible
  with such code, we use IA64 version to unlock the mutex in kernel, 
  remove
  the two steps unlocking code.
  But this means they destroy the lock while another thread holds it?  That
  seems wrong.  It's one thing if they know that no other thread has a 
  reference
  to the lock (e.g. it's in a refcounted object and the current thread just
  dropped the reference count to zero).  However, in that case no other 
  thread
  can unlock it after this thread destroys it.  Code that does this seems 
  very
  buggy, since if the address can be unmapped it can also be remapped and
  assigned to another lock, etc., so you could have a thread try to unlock a
  lock it doesn't hold.
  They have handshake code to indicate that the mutex is no longer used by
  previous
  holder. e.g:
 
  thread 1:
pthread_mutex_lock(mutex);
done = 1;
pthread_mutex_unlock(mutex);
  thread 2:
pthread_mutex_lock(mutex);
temp = done;
pthread_mutex_unlock(mutex);
if (temp == 1)
pthread_mutex_destroy(mutex);
  Hmm, so how does this result in the crash you fixed?  That is, thread 1 has
  to fully finish pthread_mutex_unlock() before thread2's pthread_mutex_lock()
  can succeed, so I don't see how thread 1 could still be in
  pthread_mutex_unlock() when thread 2 calls pthread_mutex_destroy().
 This is implementation detail,thread1 does unlocking in two steps:
 first it clears lock bit, but leaves contention bit there,
 then thread2 enters and sets lock bit, and then destroy it.
 T1:
 clear lock bit, contention bit is still set.
 T2:
 lock the mutex by setting lock bit.
 do some work.
 unlock the mutex by clearing lock it,
   enters kernel, and see no waiters, clears contention bit.
 destroy the mutex, unmap memory
 T1:
 enter kernel to clear contention bit, because the memory
 is unmmaped, it returns EINVAL.

Ah, ok.  So we should still be able to do an uncontested unlock
in userland directly.

-- 
John Baldwin
___
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


Re: svn commit: r233136 - in head/secure: usr.bin/ssh usr.sbin/sshd

2012-03-20 Thread John Baldwin
On Monday, March 19, 2012 7:12:25 pm Eitan Adler wrote:
 2012/3/19 Dag-Erling Smørgrav d...@des.no:
  John Baldwin j...@freebsd.org writes:
 
 Looking at the original contents of the two files
 
 sshd:
 -.if defined(X11BASE) || defined(LOCALBASE)
 
 ssh:
 -.if defined(X11BASE)
 
 which I think was the cause of my original confusion. The change *was*
 a no-op for ssh but resulted in behavior change when LOCALBASE was
 defined in sshd.
 
 What do you think of the following patch which uses the same .defined
 version as the original restores LOCALBASE support in sshd and and
 adds support to ssh? Is there a reason for the difference between the
 two? [ build tested only ]

This looks good to me.  I suspect it was just a bug in the ssh Makefile 
originally.

 commit 3b4f7b77abc6a0fadb3a15ebd7e8e8d475047842
 Author: Eitan Adler li...@eitanadler.com
 Date:   Mon Mar 19 19:07:35 2012 -0400
 
 Restore the ability to use a non-standard LOCALBASE to sshd
 Add the ability to use a non-standard LOCALBASE to ssh
 
 Submitted by: jhb
 Reviewed by:  des
 Approved by:  cperciva
 MFC after:0 days (with r233136)
 
 diff --git a/secure/usr.bin/ssh/Makefile b/secure/usr.bin/ssh/Makefile
 index 619c44a..9304fd55 100644
 --- a/secure/usr.bin/ssh/Makefile
 +++ b/secure/usr.bin/ssh/Makefile
 @@ -28,6 +28,10 @@ LDADD+= -lgssapi
  DPADD+=  ${LIBCRYPT} ${LIBCRYPTO}
  LDADD+=  -lcrypt -lcrypto
 
 +.if defined(LOCALBASE)
 +CFLAGS+= -DXAUTH_PATH=\${LOCALBASE}/bin/xauth\
 +.endif
 +
  .include bsd.prog.mk
 
  .PATH:   ${SSHDIR}
 diff --git a/secure/usr.sbin/sshd/Makefile b/secure/usr.sbin/sshd/Makefile
 index 0120771..cc914c4 100644
 --- a/secure/usr.sbin/sshd/Makefile
 +++ b/secure/usr.sbin/sshd/Makefile
 @@ -43,6 +43,10 @@ LDADD+= -lgssapi_krb5 -lgssapi -lkrb5 -lasn1
  DPADD+=  ${LIBCRYPTO} ${LIBCRYPT}
  LDADD+=  -lcrypto -lcrypt
 
 +.if defined(LOCALBASE)
 +CFLAGS+= -DXAUTH_PATH=\${LOCALBASE}/bin/xauth\
 +.endif
 +
  .include bsd.prog.mk
 
  .PATH:   ${SSHDIR}
 
 
 
 -- 
 Eitan Adler
 Source  Ports committer
 X11, Bugbusting teams
 

-- 
John Baldwin
___
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


Re: svn commit: r232721 - head/sys/x86/include

2012-03-20 Thread John Baldwin
On Tuesday, March 20, 2012 10:19:07 am Tijl Coosemans wrote:
 On Tuesday 20 March 2012 13:34:10 John Baldwin wrote:
  On Friday, March 09, 2012 6:48:56 am Tijl Coosemans wrote:
  Author: tijl
  Date: Fri Mar  9 11:48:56 2012
  New Revision: 232721
  URL: http://svn.freebsd.org/changeset/base/232721
  
  Log:
Clean up x86 endian.h:
- Remove extern C. There are no functions with external linkage here. 
[1]
- Rename bswapNN_const(x) to bswapNN_gen(x) to indicate that these 
macros
  are generic implementations that can take non-constant arguments. [1]
- Split up __GNUCLIKE_ASM  __GNUCLIKE_BUILTIN_CONSTANT_P and deal 
with
  each separately.
- Replace _LP64 with __amd64__ because asm instructions are machine
  dependent, not ABI dependent.

Submitted by:bde [1]
Reviewed by: bde
  
  BTW, I think I found an old bug in this file.  The _gen() variants
  should only use the _gen() variants of smaller types rather than using
  the version that re-checks __build_constant_p() I think.  That is:
  
  Index: x86/include/endian.h
  ===
  --- endian.h(revision 233184)
  +++ endian.h(working copy)
  @@ -65,9 +65,9 @@
   
   #define__bswap16_gen(x)(__uint16_t)((x)  8 | (x)  8)
   #define__bswap32_gen(x)\
  -   (((__uint32_t)__bswap16(x)  16) | __bswap16((x)  16))
  +   (((__uint32_t)__bswap16_gen(x)  16) | __bswap16_gen((x)  16))
   #define__bswap64_gen(x)\
  -   (((__uint64_t)__bswap32(x)  32) | __bswap32((x)  32))
  +   (((__uint64_t)__bswap32_gen(x)  32) | __bswap32_gen((x)  32))
   
   #ifdef __GNUCLIKE_BUILTIN_CONSTANT_P
   #define__bswap16(x)\
  
  I ran into this while porting the __builtin_constant_p() functionality
  over to ia64.
 
 No, on i386 bswap64 with a variable argument currently expands to two
 bswap instructions. With your change it would be many shifts and logical
 operations. The _gen variants are more like fallback implementations.
 If bswapNN cannot be implemented directly it is split up. If those
 smaller problems can be implemented directly, good, if not split it up
 again and so on.

Oh, I now parse the comment in __bswap64_var() correctly.  That's fugly.

Still, it seems that if I keep the patch to port this to ia64 (so it
can do constants as constants), then it will need to use this approach
since it won't have the i386 problem (in its case the _gen variants
are only used for constants).

-- 
John Baldwin
___
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: r233249 - head/sys/amd64/acpica

2012-03-20 Thread Jung-uk Kim
Author: jkim
Date: Tue Mar 20 20:37:23 2012
New Revision: 233249
URL: http://svn.freebsd.org/changeset/base/233249

Log:
  Fix another witness panic.  We cannot enter critical section at all because
  AcpiEnterSleepState() executes (optional) _GTS method since ACPICA 20120215
  (r231844).  To evaluate the method, we need malloc(9), which may sleep.
  
  Reported by:  bschmidt
  MFC after:3 days

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

Modified: head/sys/amd64/acpica/acpi_wakeup.c
==
--- head/sys/amd64/acpica/acpi_wakeup.c Tue Mar 20 19:47:59 2012
(r233248)
+++ head/sys/amd64/acpica/acpi_wakeup.c Tue Mar 20 20:37:23 2012
(r233249)
@@ -223,6 +223,7 @@ acpi_sleep_machdep(struct acpi_softc *sc
 #ifdef SMP
cpuset_twakeup_cpus;
 #endif
+   register_t  rf;
ACPI_STATUS status;
int ret;
 
@@ -241,8 +242,8 @@ acpi_sleep_machdep(struct acpi_softc *sc
 
AcpiSetFirmwareWakingVector(WAKECODE_PADDR(sc));
 
+   rf = intr_disable();
intr_suspend();
-   spinlock_enter();
 
if (savectx(susppcbs[0])) {
ctx_fpusave(suspfpusave[0]);
@@ -299,8 +300,8 @@ out:
 #endif
 
mca_resume();
-   spinlock_exit();
intr_resume();
+   intr_restore(rf);
 
AcpiSetFirmwareWakingVector(0);
 
___
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


Re: svn commit: r233052 - head/share/mk

2012-03-20 Thread Chris Rees
On 20 March 2012 14:19, John Baldwin j...@freebsd.org wrote:
 On Monday, March 19, 2012 5:39:53 pm Doug Barton wrote:
 On 3/19/2012 12:37 PM, Dimitry Andric wrote:
  It would be much nicer to be able to write:
 
  .if defined(FOO)
    .if defined(BAR)
      CFLAGS+=        -DFOO_BAR
    .endif
  .endif

 Take a look at /usr/ports/Mk/bsd.port.mk for how this can be done.

 Hmm, do yoo have a specific example?  The bits in I see in bsd.port.mk suffer
 from the limitation Dimitry raises, e.g.:

 .if defined(OPTIONS)
 # include OPTIONSFILE first if exists
 .       if exists(${OPTIONSFILE})  !make(rmconfig)
 .       include ${OPTIONSFILE}
 .       endif
 .       if exists(${OPTIONSFILE}.local)
 .       include ${OPTIONSFILE}.local
 .       endif
 WITHOUT:=
 WITH:=
 .       if defined(OPTIONS)
 REALOPTIONS=${OPTIONS:C/.*//g}
 .       for O in ${REALOPTIONS}
 RO:=${O}
 .       if ${RO:L} == off
 WITHOUT:=       ${WITHOUT} ${OPT}
 .       endif
 .       if ${RO:L} == on
 WITH:=          ${WITH} ${OPT}
 .       endif
 OPT:=${RO}
 .       endfor
 .       endif

 That is, all the lines that don't start with a . are not indented, and
 even this indentation is rather horrible (it doesn't nest, and it
 has the odd structure of 'if defined(OPTIONS) { if defined(OPTIONS) {} }'.

I don't see how it's any more horrible than the kernel style's rules
on indented #ifs (though I can see the reasoning for that)

It's an unfortunate consequence of the fact that any line starting
with whitespace must be a shell command-- from before Makefiles were
allowed conditionals etc.

It's got to be an improvement on:

.if defined(ONE)
.if !defined(TWO)
.for one in two three four
.if ${VAR} == ${one}
.if defined(VERBOSE)
.warning VAR = one
.endif
.endif
.endfor
.elif ${VAR} == four
.if defined(VERBOSE)
.warning VAR = four
.endif
.else
.warning VAR is not four, and VERBOSE is ignored
.endif#  Which one is this for??
.endif

which is what a lot of the Makefiles look like... debugging if-less
endifs etc is infinitely easier if we indent, however horrible it
looks.

We shouldn't be *trying* to make Makefiles hard to read ;)

Chris
___
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


Re: svn commit: r233052 - head/share/mk

2012-03-20 Thread John Baldwin
On Tuesday, March 20, 2012 5:20:04 pm Chris Rees wrote:
 On 20 March 2012 14:19, John Baldwin j...@freebsd.org wrote:
  On Monday, March 19, 2012 5:39:53 pm Doug Barton wrote:
  On 3/19/2012 12:37 PM, Dimitry Andric wrote:
   It would be much nicer to be able to write:
  
   .if defined(FOO)
 .if defined(BAR)
   CFLAGS+=-DFOO_BAR
 .endif
   .endif
 
  Take a look at /usr/ports/Mk/bsd.port.mk for how this can be done.
 
  Hmm, do yoo have a specific example?  The bits in I see in bsd.port.mk 
suffer
  from the limitation Dimitry raises, e.g.:
 
  .if defined(OPTIONS)
  # include OPTIONSFILE first if exists
  .   if exists(${OPTIONSFILE})  !make(rmconfig)
  .   include ${OPTIONSFILE}
  .   endif
  .   if exists(${OPTIONSFILE}.local)
  .   include ${OPTIONSFILE}.local
  .   endif
  WITHOUT:=
  WITH:=
  .   if defined(OPTIONS)
  REALOPTIONS=${OPTIONS:C/.*//g}
  .   for O in ${REALOPTIONS}
  RO:=${O}
  .   if ${RO:L} == off
  WITHOUT:=   ${WITHOUT} ${OPT}
  .   endif
  .   if ${RO:L} == on
  WITH:=  ${WITH} ${OPT}
  .   endif
  OPT:=${RO}
  .   endfor
  .   endif
 
  That is, all the lines that don't start with a . are not indented, and
  even this indentation is rather horrible (it doesn't nest, and it
  has the odd structure of 'if defined(OPTIONS) { if defined(OPTIONS) {} }'.
 
 I don't see how it's any more horrible than the kernel style's rules
 on indented #ifs (though I can see the reasoning for that)
 
 It's an unfortunate consequence of the fact that any line starting
 with whitespace must be a shell command-- from before Makefiles were
 allowed conditionals etc.
 
 It's got to be an improvement on:
 
 .if defined(ONE)
 .if !defined(TWO)
 .for one in two three four
 .if ${VAR} == ${one}
 .if defined(VERBOSE)
 .warning VAR = one
 .endif
 .endif
 .endfor
 .elif ${VAR} == four
 .if defined(VERBOSE)
 .warning VAR = four
 .endif
 .else
 .warning VAR is not four, and VERBOSE is ignored
 .endif#  Which one is this for??
 .endif
 
 which is what a lot of the Makefiles look like... debugging if-less
 endifs etc is infinitely easier if we indent, however horrible it
 looks.
 
 We shouldn't be *trying* to make Makefiles hard to read ;)

Oh, it may be that I was reading it in less or some such and that bsd.port.mk 
requires 4 space tabs, so when viewed in things like less the indentation 
doesn't actually look like indentation.  In that respect, this is no better 
than the above (and is what bsd.ports.mk looks like to me at least):

.  if defined(ONE)
.  if !defined(TWO)
.  for one in two three four

etc.  To be worthwhile the spacing has to actually look like indentation:

.if defined(ONE)
.  if !defined(TWO)
.for one in two three four

etc.

Regardless, the

.if defined(OPTIONS)
.if defined(OPTIONS)
.endif
.endif

is lame.  You have to admit that at least. :)

-- 
John Baldwin
___
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: r233250 - in head: share/man/man4 sys/amd64/acpica sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/debugger sys/co...

2012-03-20 Thread Jung-uk Kim
Author: jkim
Date: Tue Mar 20 21:37:52 2012
New Revision: 233250
URL: http://svn.freebsd.org/changeset/base/233250

Log:
  Merge ACPICA 20120320.

Added:
  head/sys/contrib/dev/acpica/compiler/preprocess.h
 - copied unchanged from r233238, 
vendor-sys/acpica/dist/source/compiler/preprocess.h
  head/sys/contrib/dev/acpica/compiler/prexpress.c
 - copied, changed from r233238, 
vendor-sys/acpica/dist/source/compiler/prexpress.c
  head/sys/contrib/dev/acpica/compiler/prmacros.c
 - copied, changed from r233238, 
vendor-sys/acpica/dist/source/compiler/prmacros.c
  head/sys/contrib/dev/acpica/compiler/prparser.l
 - copied, changed from r233238, 
vendor-sys/acpica/dist/source/compiler/prparser.l
  head/sys/contrib/dev/acpica/compiler/prparser.y
 - copied, changed from r233238, 
vendor-sys/acpica/dist/source/compiler/prparser.y
  head/sys/contrib/dev/acpica/compiler/prscan.c
 - copied, changed from r233238, 
vendor-sys/acpica/dist/source/compiler/prscan.c
  head/sys/contrib/dev/acpica/compiler/prutils.c
 - copied, changed from r233238, 
vendor-sys/acpica/dist/source/compiler/prutils.c
Modified:
  head/share/man/man4/acpi.4
  head/sys/amd64/acpica/acpi_wakeup.c
  head/sys/contrib/dev/acpica/acpica_prep.sh
  head/sys/contrib/dev/acpica/changes.txt
  head/sys/contrib/dev/acpica/common/adisasm.c
  head/sys/contrib/dev/acpica/common/getopt.c
  head/sys/contrib/dev/acpica/compiler/aslcodegen.c
  head/sys/contrib/dev/acpica/compiler/aslcompile.c
  head/sys/contrib/dev/acpica/compiler/aslcompiler.h
  head/sys/contrib/dev/acpica/compiler/aslcompiler.y
  head/sys/contrib/dev/acpica/compiler/aslerror.c
  head/sys/contrib/dev/acpica/compiler/aslfiles.c
  head/sys/contrib/dev/acpica/compiler/aslglobal.h
  head/sys/contrib/dev/acpica/compiler/aslmain.c
  head/sys/contrib/dev/acpica/compiler/aslmessages.h
  head/sys/contrib/dev/acpica/compiler/aslstartup.c
  head/sys/contrib/dev/acpica/compiler/asltypes.h
  head/sys/contrib/dev/acpica/compiler/aslutils.c
  head/sys/contrib/dev/acpica/compiler/dtcompile.c
  head/sys/contrib/dev/acpica/compiler/dtcompiler.h
  head/sys/contrib/dev/acpica/compiler/dtexpress.c
  head/sys/contrib/dev/acpica/compiler/dtio.c
  head/sys/contrib/dev/acpica/compiler/dtparser.y
  head/sys/contrib/dev/acpica/components/debugger/dbcmds.c
  head/sys/contrib/dev/acpica/components/hardware/hwesleep.c
  head/sys/contrib/dev/acpica/components/hardware/hwsleep.c
  head/sys/contrib/dev/acpica/components/hardware/hwxfsleep.c
  head/sys/contrib/dev/acpica/components/namespace/nsdump.c
  head/sys/contrib/dev/acpica/components/namespace/nsdumpdv.c
  head/sys/contrib/dev/acpica/components/namespace/nspredef.c
  head/sys/contrib/dev/acpica/components/namespace/nsrepair.c
  head/sys/contrib/dev/acpica/components/namespace/nsutils.c
  head/sys/contrib/dev/acpica/components/tables/tbfadt.c
  head/sys/contrib/dev/acpica/components/tables/tbinstal.c
  head/sys/contrib/dev/acpica/components/tables/tbutils.c
  head/sys/contrib/dev/acpica/include/achware.h
  head/sys/contrib/dev/acpica/include/aclocal.h
  head/sys/contrib/dev/acpica/include/acnames.h
  head/sys/contrib/dev/acpica/include/acnamesp.h
  head/sys/contrib/dev/acpica/include/acoutput.h
  head/sys/contrib/dev/acpica/include/acpixf.h
  head/sys/contrib/dev/acpica/include/actypes.h
  head/sys/dev/acpica/acpi.c
  head/sys/dev/acpica/acpivar.h
  head/sys/i386/acpica/acpi_wakeup.c
  head/usr.sbin/acpi/iasl/Makefile
Directory Properties:
  head/sys/contrib/dev/acpica/   (props changed)
  head/sys/contrib/dev/acpica/common/   (props changed)
  head/sys/contrib/dev/acpica/compiler/   (props changed)
  head/sys/contrib/dev/acpica/components/debugger/   (props changed)
  head/sys/contrib/dev/acpica/components/hardware/   (props changed)
  head/sys/contrib/dev/acpica/components/namespace/   (props changed)
  head/sys/contrib/dev/acpica/components/tables/   (props changed)
  head/sys/contrib/dev/acpica/include/   (props changed)

Modified: head/share/man/man4/acpi.4
==
--- head/share/man/man4/acpi.4  Tue Mar 20 20:37:23 2012(r233249)
+++ head/share/man/man4/acpi.4  Tue Mar 20 21:37:52 2012(r233250)
@@ -25,7 +25,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd October 26, 2010
+.Dd March 20, 2012
 .Dt ACPI 4
 .Os
 .Sh NAME
@@ -214,6 +214,14 @@ Override any automatic quirks completely
 Beep the PC speaker on resume.
 This can help diagnose suspend/resume problems.
 Default is 0 (disabled).
+.It Va debug.acpi.sleep_flags
+Execute optional ACPI methods for suspend/resume.
+If the bit 0 is set (1), it will try to execute _GTS (Going To Sleep) method
+when entering suspend state.
+If the bit 1 is set (2), it will try to execute _BFS (Back From Sleep) method
+when leaving suspend state.
+If both the bits are set (3), both the methods will be tried.
+Default is 0 (disabled).
 .It Va hint.acpi.0.disabled
 Set this to 1 to disable all of ACPI.
 If ACPI has been disabled on your system due

Re: svn commit: r233052 - head/share/mk

2012-03-20 Thread Chris Rees
On 20 March 2012 21:28, John Baldwin j...@freebsd.org wrote:
 On Tuesday, March 20, 2012 5:20:04 pm Chris Rees wrote:
 On 20 March 2012 14:19, John Baldwin j...@freebsd.org wrote:
  On Monday, March 19, 2012 5:39:53 pm Doug Barton wrote:
  On 3/19/2012 12:37 PM, Dimitry Andric wrote:
   It would be much nicer to be able to write:
  
   .if defined(FOO)
     .if defined(BAR)
       CFLAGS+=        -DFOO_BAR
     .endif
   .endif
 
  Take a look at /usr/ports/Mk/bsd.port.mk for how this can be done.
 
  Hmm, do yoo have a specific example?  The bits in I see in bsd.port.mk
 suffer
  from the limitation Dimitry raises, e.g.:
 
  .if defined(OPTIONS)
  # include OPTIONSFILE first if exists
  .       if exists(${OPTIONSFILE})  !make(rmconfig)
  .       include ${OPTIONSFILE}
  .       endif
  .       if exists(${OPTIONSFILE}.local)
  .       include ${OPTIONSFILE}.local
  .       endif
  WITHOUT:=
  WITH:=
  .       if defined(OPTIONS)
  REALOPTIONS=${OPTIONS:C/.*//g}
  .       for O in ${REALOPTIONS}
  RO:=${O}
  .       if ${RO:L} == off
  WITHOUT:=       ${WITHOUT} ${OPT}
  .       endif
  .       if ${RO:L} == on
  WITH:=          ${WITH} ${OPT}
  .       endif
  OPT:=${RO}
  .       endfor
  .       endif
 
  That is, all the lines that don't start with a . are not indented, and
  even this indentation is rather horrible (it doesn't nest, and it
  has the odd structure of 'if defined(OPTIONS) { if defined(OPTIONS) {} }'.

 I don't see how it's any more horrible than the kernel style's rules
 on indented #ifs (though I can see the reasoning for that)

 It's an unfortunate consequence of the fact that any line starting
 with whitespace must be a shell command-- from before Makefiles were
 allowed conditionals etc.

 It's got to be an improvement on:

 .if defined(ONE)
 .if !defined(TWO)
 .for one in two three four
 .if ${VAR} == ${one}
 .if defined(VERBOSE)
 .warning VAR = one
 .endif
 .endif
 .endfor
 .elif ${VAR} == four
 .if defined(VERBOSE)
 .warning VAR = four
 .endif
 .else
 .warning VAR is not four, and VERBOSE is ignored
 .endif    #  Which one is this for??
 .endif

 which is what a lot of the Makefiles look like... debugging if-less
 endifs etc is infinitely easier if we indent, however horrible it
 looks.

 We shouldn't be *trying* to make Makefiles hard to read ;)

 Oh, it may be that I was reading it in less or some such and that bsd.port.mk
 requires 4 space tabs, so when viewed in things like less the indentation
 doesn't actually look like indentation.  In that respect, this is no better
 than the above (and is what bsd.ports.mk looks like to me at least):

 .      if defined(ONE)
 .      if !defined(TWO)
 .      for one in two three four

 etc.  To be worthwhile the spacing has to actually look like indentation:

 .if defined(ONE)
 .  if !defined(TWO)
 .    for one in two three four

 etc.

Yes-- it'd be nice if less could read the ex:ts=4 bit.

That can go on my todo list.

Chris
___
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


Re: svn commit: r233052 - head/share/mk

2012-03-20 Thread Daniel O'Connor

On 21/03/2012, at 8:10, Chris Rees wrote:
 Yes-- it'd be nice if less could read the ex:ts=4 bit.
 
 That can go on my todo list.


Are you going to teach it emacs commands for the same? ;)

IMO any file which wants to be viewed with tabs != 8 spaces is broken.

The extra cost of disk to store 4 spaces for your odd number of indent lines is 
trivial..

I understand that bsd.port.mk and friends have legacy and that is fine but I 
don't think it's a good precedent to use when indenting other makefiles (which 
is a great idea IMO)

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C






___
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


Re: svn commit: r233052 - head/share/mk

2012-03-20 Thread Mark Linimon
The style in bsd.port.mk is not consistent.  (I know, this is shocking
for something that's at r1.706.)

Here's what I recall seeing in it, that I found readable:

.if defined(USE_GL)
. if ${USE_GL:L} == yes
USE_GL= glu
. endif
. for _component in ${USE_GL}
.  if !defined(_GL_${_component}_LIB_DEPENDS)  \
!defined(_GL_${_component}_RUN_DEPENDS)
IGNORE= uses unknown GL component
.  else
LIB_DEPENDS+=   ${_GL_${_component}_LIB_DEPENDS}
RUN_DEPENDS+=   ${_GL_${_component}_RUN_DEPENDS}
.  endif
. endfor
.endif

Various other bits of ports/Mk/*.mk use this same indentation; others
use two spaces, tabs, ...

Unfortunately the counter-argument of let's just go fix it to have one
style is all the patches against bsd.port.mk that would then no longer
apply.

Personally, I'd like to see us pick a recommended way for new code,
whether it's one or two spaces, whatever.  (8 spaces seems too much.)

mcl
___
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


Re: svn commit: r233052 - head/share/mk

2012-03-20 Thread Daniel O'Connor

On 21/03/2012, at 11:18, Mark Linimon wrote:
 Personally, I'd like to see us pick a recommended way for new code,
 whether it's one or two spaces, whatever.  (8 spaces seems too much.)

2 space indents are fine IMO, but they are spaces.

A tab character should be viewed as 8 spaces wide, but that doesn't force you 
to have 8 space wide indents.

If you change tab width then you need to teach each editor and viewer that 
could possibly read your file what that width is, which is basically an 
impossible task.

Yes using just spaces, or coalescing 8 spaces into a tab uses more disk space 
than just tabs, but that amounts to sweet FA these days.

--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C






___
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: r233255 - head/sys/net80211

2012-03-20 Thread Adrian Chadd
Author: adrian
Date: Wed Mar 21 03:19:50 2012
New Revision: 233255
URL: http://svn.freebsd.org/changeset/base/233255

Log:
  Re-commit this - store the alq payload in network order.

Modified:
  head/sys/net80211/ieee80211_alq.c

Modified: head/sys/net80211/ieee80211_alq.c
==
--- head/sys/net80211/ieee80211_alq.c   Wed Mar 21 03:13:25 2012
(r233254)
+++ head/sys/net80211/ieee80211_alq.c   Wed Mar 21 03:19:50 2012
(r233255)
@@ -152,7 +152,7 @@ ieee80211_alq_log(struct ieee80211vap *v
r-r_version = 1;
r-r_wlan = htons(vap-iv_ifp-if_dunit);
r-r_op = op;
-   r-r_threadid = (uint32_t) curthread-td_tid;
+   r-r_threadid = htonl((uint32_t) curthread-td_tid);
memcpy(r-r_payload, p, MIN(l, sizeof(r-r_payload)));
alq_post(ieee80211_alq, ale);
 }
___
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: r233256 - in head/sys: amd64/amd64 amd64/conf conf

2012-03-20 Thread Alan Cox
Author: alc
Date: Wed Mar 21 04:00:58 2012
New Revision: 233256
URL: http://svn.freebsd.org/changeset/base/233256

Log:
  Eliminate vm.pmap.shpgperproc and vm.pmap.pv_entry_max because they no
  longer serve any purpose.  Prior to r157446, they served a purpose
  because there was a fixed amount of kernel virtual address space
  reserved for pv entries at boot time.  However, since that change pv
  entries are accessed through the direct map, and so there is no limit
  imposed by a fixed amount of kernel virtual address space.
  
  Fix a couple of nearby style issues.
  
  Reviewed by:  jhb, kib
  MFC after:1 week

Modified:
  head/sys/amd64/amd64/pmap.c
  head/sys/amd64/conf/NOTES
  head/sys/conf/options.amd64

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Wed Mar 21 03:19:50 2012(r233255)
+++ head/sys/amd64/amd64/pmap.c Wed Mar 21 04:00:58 2012(r233256)
@@ -148,10 +148,6 @@ __FBSDID($FreeBSD$);
 #include machine/smp.h
 #endif
 
-#ifndef PMAP_SHPGPERPROC
-#define PMAP_SHPGPERPROC 200
-#endif
-
 #if !defined(DIAGNOSTIC)
 #ifdef __GNUC_GNU_INLINE__
 #define PMAP_INLINE__attribute__((__gnu_inline__)) inline
@@ -206,9 +202,8 @@ static u_int64_tDMPDPphys;  /* phys addr
 /*
  * Data for the pv entry allocation mechanism
  */
-static int pv_entry_count = 0, pv_entry_max = 0, pv_entry_high_water = 0;
+static int pv_entry_count;
 static struct md_page *pv_table;
-static int shpgperproc = PMAP_SHPGPERPROC;
 
 /*
  * All those kernel PT submaps that BSD is so fond of
@@ -222,7 +217,7 @@ caddr_t CADDR1 = 0;
 static caddr_t crashdumpmap;
 
 static voidfree_pv_entry(pmap_t pmap, pv_entry_t pv);
-static pv_entry_t get_pv_entry(pmap_t locked_pmap, int try);
+static pv_entry_t get_pv_entry(pmap_t locked_pmap, boolean_t try);
 static voidpmap_pv_demote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa);
 static boolean_t pmap_pv_insert_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t 
pa);
 static voidpmap_pv_promote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa);
@@ -731,16 +726,6 @@ pmap_init(void)
}
 
/*
-* Initialize the address space (zone) for the pv entries.  Set a
-* high water mark so that the system can recover from excessive
-* numbers of pv entries.
-*/
-   TUNABLE_INT_FETCH(vm.pmap.shpgperproc, shpgperproc);
-   pv_entry_max = shpgperproc * maxproc + cnt.v_page_count;
-   TUNABLE_INT_FETCH(vm.pmap.pv_entries, pv_entry_max);
-   pv_entry_high_water = 9 * (pv_entry_max / 10);
-
-   /*
 * If the kernel is running in a virtual machine on an AMD Family 10h
 * processor, then it must assume that MCA is enabled by the virtual
 * machine monitor.
@@ -775,36 +760,6 @@ pmap_init(void)
TAILQ_INIT(pv_table[i].pv_list);
 }
 
-static int
-pmap_pventry_proc(SYSCTL_HANDLER_ARGS)
-{
-   int error;
-
-   error = sysctl_handle_int(oidp, oidp-oid_arg1, oidp-oid_arg2, req);
-   if (error == 0  req-newptr) {
-   shpgperproc = (pv_entry_max - cnt.v_page_count) / maxproc;
-   pv_entry_high_water = 9 * (pv_entry_max / 10);
-   }
-   return (error);
-}
-SYSCTL_PROC(_vm_pmap, OID_AUTO, pv_entry_max, CTLTYPE_INT|CTLFLAG_RW, 
-pv_entry_max, 0, pmap_pventry_proc, IU, Max number of PV entries);
-
-static int
-pmap_shpgperproc_proc(SYSCTL_HANDLER_ARGS)
-{
-   int error;
-
-   error = sysctl_handle_int(oidp, oidp-oid_arg1, oidp-oid_arg2, req);
-   if (error == 0  req-newptr) {
-   pv_entry_max = shpgperproc * maxproc + cnt.v_page_count;
-   pv_entry_high_water = 9 * (pv_entry_max / 10);
-   }
-   return (error);
-}
-SYSCTL_PROC(_vm_pmap, OID_AUTO, shpgperproc, CTLTYPE_INT|CTLFLAG_RW, 
-shpgperproc, 0, pmap_shpgperproc_proc, IU, Page share factor per 
proc);
-
 static SYSCTL_NODE(_vm_pmap, OID_AUTO, pde, CTLFLAG_RD, 0,
 2MB page mapping counters);
 
@@ -2184,10 +2139,8 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv
  * when needed.
  */
 static pv_entry_t
-get_pv_entry(pmap_t pmap, int try)
+get_pv_entry(pmap_t pmap, boolean_t try)
 {
-   static const struct timeval printinterval = { 60, 0 };
-   static struct timeval lastprint;
struct vpgqueues *pq;
int bit, field;
pv_entry_t pv;
@@ -2197,12 +2150,6 @@ get_pv_entry(pmap_t pmap, int try)
PMAP_LOCK_ASSERT(pmap, MA_OWNED);
mtx_assert(vm_page_queue_mtx, MA_OWNED);
PV_STAT(pv_entry_allocs++);
-   pv_entry_count++;
-   if (pv_entry_count  pv_entry_high_water)
-   if (ratecheck(lastprint, printinterval))
-   printf(Approaching the limit on PV entries, consider 
-   increasing either the vm.pmap.shpgperproc or the 
-   vm.pmap.pv_entry_max sysctl.\n);
pq = NULL;
 retry:
pc = TAILQ_FIRST(pmap-pm_pvchunk);

Re: svn commit: r233052 - head/share/mk

2012-03-20 Thread Alexey Dokuchaev
On Tue, Mar 20, 2012 at 07:48:36PM -0500, Mark Linimon wrote:
 Personally, I'd like to see us pick a recommended way for new code,
 whether it's one or two spaces, whatever.  (8 spaces seems too much.)

+1.  I always hesitate between one or two spaces; but last time I recall I
was using one.  If people agree on two, let it be so.  But please don't make
it four or even eight, as the distance from the leading dot starts getting
annoying at these extremities.

./danfe
___
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