<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>81482</bug_id>
          
          <creation_ts>2012-03-18 20:12:24 -0700</creation_ts>
          <short_desc>Cross-platform processor core counter: fix build on FreeBSD.</short_desc>
          <delta_ts>2012-03-29 01:56:22 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Web Template Framework</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Raphael Kubo da Costa (:rakuco)">rakuco</reporter>
          <assigned_to name="Raphael Kubo da Costa (:rakuco)">rakuco</assigned_to>
          <cc>landry</cc>
    
    <cc>webkit.review.bot</cc>
    
    <cc>zherczeg</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>581583</commentid>
    <comment_count>0</comment_count>
    <who name="Raphael Kubo da Costa (:rakuco)">rakuco</who>
    <bug_when>2012-03-18 20:12:24 -0700</bug_when>
    <thetext>Cross-platform processor core counter: fix build on FreeBSD.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>581584</commentid>
    <comment_count>1</comment_count>
      <attachid>132530</attachid>
    <who name="Raphael Kubo da Costa (:rakuco)">rakuco</who>
    <bug_when>2012-03-18 20:13:22 -0700</bug_when>
    <thetext>Created attachment 132530
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>581586</commentid>
    <comment_count>2</comment_count>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2012-03-18 20:15:14 -0700</bug_when>
    <thetext>Attachment 132530 did not pass style-queue:

Failed to run &quot;[&apos;Tools/Scripts/check-webkit-style&apos;, &apos;--diff-files&apos;, u&apos;Source/JavaScriptCore/ChangeLog&apos;, u&apos;Source...&quot; exit_code: 1
Source/JavaScriptCore/wtf/NumberOfCores.cpp:31:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 1 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>581590</commentid>
    <comment_count>3</comment_count>
    <who name="Raphael Kubo da Costa (:rakuco)">rakuco</who>
    <bug_when>2012-03-18 20:19:04 -0700</bug_when>
    <thetext>(In reply to comment #2)
&gt; Attachment 132530 [details] did not pass style-queue:
&gt; 
&gt; Failed to run &quot;[&apos;Tools/Scripts/check-webkit-style&apos;, &apos;--diff-files&apos;, u&apos;Source/JavaScriptCore/ChangeLog&apos;, u&apos;Source...&quot; exit_code: 1
&gt; Source/JavaScriptCore/wtf/NumberOfCores.cpp:31:  Alphabetical sorting problem.  [build/include_order] [4]
&gt; Total errors found: 1 in 2 files
&gt; 
&gt; 
&gt; If any of these errors are false positives, please file a bug against check-webkit-style.

This is a false positive, sys/types.h must come before sys/sysctl.h.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>581665</commentid>
    <comment_count>4</comment_count>
    <who name="Zoltan Herczeg">zherczeg</who>
    <bug_when>2012-03-19 00:16:56 -0700</bug_when>
    <thetext>There is no other OS where this include order caused any trouble. Where is this documentation (a link please)? If this is only FreeBSD specific then add a comment please.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>581790</commentid>
    <comment_count>5</comment_count>
    <who name="Raphael Kubo da Costa (:rakuco)">rakuco</who>
    <bug_when>2012-03-19 07:46:26 -0700</bug_when>
    <thetext>(In reply to comment #4)
&gt; There is no other OS where this include order caused any trouble.

It may have broken OpenBSD and NetBSD too, since the requirements are pretty much the same. I don&apos;t have access to an OS X machine to check what they do differently for this include order reversal to work (this part of their libraries comes from FreeBSD).

&gt; Where is this documentation (a link please)? If this is only FreeBSD specific then add a comment please.

The man pages for NetBSD, OpenBSD, FreeBSD and Darwin all show that sys/sysctl.h must be included after either sys/param.h or sys/types.h:

 - http://netbsd.gw.com/cgi-bin/man-cgi?sysctl+3+NetBSD-current
 - http://www.openbsd.org/cgi-bin/man.cgi?query=sysctl&amp;sektion=3&amp;arch=i386&amp;apropos=0&amp;manpath=OpenBSD+Current
 - http://www.freebsd.org/cgi/man.cgi?query=sysctl&amp;sektion=3&amp;apropos=0&amp;manpath=FreeBSD+9.0-RELEASE
 - https://developer.apple.com/library/mac/#documentation/Darwin/Reference/Manpages/man3/sysctl.3.html#//apple_ref/doc/man/3/sysctl

u_int is a typedef defined in sys/types.h on FreeBSD (and probably other BSDs too). And including sys/types.h or sys/param.h before is part of the OpenBSD and FreeBSD style guides:

 - http://www.freebsd.org/cgi/man.cgi?query=style&amp;apropos=0&amp;sektion=0&amp;manpath=FreeBSD+9.0-RELEASE&amp;arch=default&amp;format=html
 - http://www.openbsd.org/cgi-bin/man.cgi?query=style&amp;apropos=0&amp;sektion=0&amp;manpath=OpenBSD+Current&amp;arch=i386&amp;format=html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>581804</commentid>
    <comment_count>6</comment_count>
    <who name="Zoltan Herczeg">zherczeg</who>
    <bug_when>2012-03-19 08:00:39 -0700</bug_when>
    <thetext>Poor design :( Headers should include what they need. Do you think this will be fixed in the future?

Ok, if noone objects I can give you an r+ but please upload a new patch with a comment in the header file which clearly states why we break the WK style guides.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>581849</commentid>
    <comment_count>7</comment_count>
      <attachid>132594</attachid>
    <who name="Raphael Kubo da Costa (:rakuco)">rakuco</who>
    <bug_when>2012-03-19 09:13:48 -0700</bug_when>
    <thetext>Created attachment 132594
Same patch with some additional comments in the code</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>581852</commentid>
    <comment_count>8</comment_count>
    <who name="Raphael Kubo da Costa (:rakuco)">rakuco</who>
    <bug_when>2012-03-19 09:14:41 -0700</bug_when>
    <thetext>(In reply to comment #6)
&gt; Poor design :( Headers should include what they need. Do you think this will be fixed in the future?

I don&apos;t think so, I guess it&apos;s part of the design. See select(2) or stat(2) on Linux as well -- they too need additional headers in a certain order.

&gt; Ok, if noone objects I can give you an r+ but please upload a new patch with a comment in the header file which clearly states why we break the WK style guides.

Done.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>581853</commentid>
    <comment_count>9</comment_count>
    <who name="WebKit Review Bot">webkit.review.bot</who>
    <bug_when>2012-03-19 09:17:49 -0700</bug_when>
    <thetext>Attachment 132594 did not pass style-queue:

Failed to run &quot;[&apos;Tools/Scripts/check-webkit-style&apos;, &apos;--diff-files&apos;, u&apos;Source/JavaScriptCore/ChangeLog&apos;, u&apos;Source...&quot; exit_code: 1
Source/JavaScriptCore/wtf/NumberOfCores.cpp:33:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 1 in 2 files


If any of these errors are false positives, please file a bug against check-webkit-style.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>581877</commentid>
    <comment_count>10</comment_count>
      <attachid>132594</attachid>
    <who name="Zoltan Herczeg">zherczeg</who>
    <bug_when>2012-03-19 09:40:10 -0700</bug_when>
    <thetext>Comment on attachment 132594
Same patch with some additional comments in the code

r=me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>581886</commentid>
    <comment_count>11</comment_count>
      <attachid>132594</attachid>
    <who name="Raphael Kubo da Costa (:rakuco)">rakuco</who>
    <bug_when>2012-03-19 09:48:49 -0700</bug_when>
    <thetext>Comment on attachment 132594
Same patch with some additional comments in the code

Clearing flags on attachment: 132594

Committed r111195: &lt;http://trac.webkit.org/changeset/111195&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>581887</commentid>
    <comment_count>12</comment_count>
    <who name="Raphael Kubo da Costa (:rakuco)">rakuco</who>
    <bug_when>2012-03-19 09:48:58 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>590939</commentid>
    <comment_count>13</comment_count>
    <who name="Landry Breuil">landry</who>
    <bug_when>2012-03-29 01:28:59 -0700</bug_when>
    <thetext>Note that on OpenBSD it also needs sys/param.h before sys/sysctl.h and sys/types.h, otherwise some #defines are missing (as stated in comment #5). Should i reopen this bug or file a new one ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>590948</commentid>
    <comment_count>14</comment_count>
    <who name="Zoltan Herczeg">zherczeg</who>
    <bug_when>2012-03-29 01:48:33 -0700</bug_when>
    <thetext>File a new one.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>590953</commentid>
    <comment_count>15</comment_count>
    <who name="Landry Breuil">landry</who>
    <bug_when>2012-03-29 01:56:22 -0700</bug_when>
    <thetext>#82585.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>132530</attachid>
            <date>2012-03-18 20:13:22 -0700</date>
            <delta_ts>2012-03-19 09:13:42 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-81482-20120319001320.patch</filename>
            <type>text/plain</type>
            <size>1559</size>
            <attacher name="Raphael Kubo da Costa (:rakuco)">rakuco</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMTExMTMzCmRpZmYgLS1naXQgYS9Tb3VyY2UvSmF2YVNjcmlw
dENvcmUvQ2hhbmdlTG9nIGIvU291cmNlL0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwppbmRleCBm
OGJlYTM3M2I0MmI1NDEzZDFlZGY3YjA2NGE1Y2QxNTU5MDU0NmNhLi5mOGViNWI3MzA3ODI5MzYy
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dFeHAuZXhlYyAtPiBSZWdFeHAudGVzdApkaWZmIC0tZ2l0IGEvU291cmNlL0phdmFTY3JpcHRD
b3JlL3d0Zi9OdW1iZXJPZkNvcmVzLmNwcCBiL1NvdXJjZS9KYXZhU2NyaXB0Q29yZS93dGYvTnVt
YmVyT2ZDb3Jlcy5jcHAKaW5kZXggMWU3ZjQ1ZjVjNjkxMDNjNTI3NzQ5YzMxM2FmYThkOWY5Yzcx
YTBhMi4uODAxYTdiZTc2ZjEyZTRlMGVmZGY0ZWE0MzFlZDYwYzEyZDE5MzhhYyAxMDA2NDQKLS0t
IGEvU291cmNlL0phdmFTY3JpcHRDb3JlL3d0Zi9OdW1iZXJPZkNvcmVzLmNwcAorKysgYi9Tb3Vy
Y2UvSmF2YVNjcmlwdENvcmUvd3RmL051bWJlck9mQ29yZXMuY3BwCkBAIC0yNyw4ICsyNyw4IEBA
CiAjaW5jbHVkZSAiTnVtYmVyT2ZDb3Jlcy5oIgogCiAjaWYgT1MoREFSV0lOKSB8fCBPUyhPUEVO
QlNEKSB8fCBPUyhORVRCU0QpIHx8IE9TKEZSRUVCU0QpCi0jaW5jbHVkZSA8c3lzL3N5c2N0bC5o
PgogI2luY2x1ZGUgPHN5cy90eXBlcy5oPgorI2luY2x1ZGUgPHN5cy9zeXNjdGwuaD4KICNlbGlm
IE9TKExJTlVYKSB8fCBPUyhBSVgpIHx8IE9TKFNPTEFSSVMpCiAjaW5jbHVkZSA8dW5pc3RkLmg+
CiAjZWxpZiBPUyhXSU5ET1dTKQo=
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>132594</attachid>
            <date>2012-03-19 09:13:48 -0700</date>
            <delta_ts>2012-03-19 09:48:49 -0700</delta_ts>
            <desc>Same patch with some additional comments in the code</desc>
            <filename>bug-81482-20120319131505.patch</filename>
            <type>text/plain</type>
            <size>1750</size>
            <attacher name="Raphael Kubo da Costa (:rakuco)">rakuco</attacher>
            
              <data encoding="base64">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