Re: svn commit: r226151 - head/usr.bin/kdump

2011-10-11 Thread Dag-Erling Smørgrav
Jaakko Heinonen j...@freebsd.org writes:
 Dag-Erling Smorgrav d...@freebsd.org writes:
  +#define print_number(i,n,c)\
  +   do {\
  +   if (decimal)\
  +   printf(%c%jd, c, (intmax_t)*i);   \
  +   else\
  +   printf(%c%#jx, c, (intmax_t)*i);  \
  +   i++;\
  +   n--;\
  +   c = ',';\
  +   } while (0)
 Are you sure that this change doesn't cause a regression on platforms
 where sizeof(long) != sizeof(intmax_t)?

 For example, previously, on i386 print_number() printed 0x for
 -1 while after your change it will print 0x (with %#jx).

You are right, the cast for the hex case should be to uintmax_t.  I
think I got all the other instances right...

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
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: r226151 - head/usr.bin/kdump

2011-10-11 Thread Dag-Erling Smørgrav
Jaakko Heinonen j...@freebsd.org writes:
 I am not sure if you understood what I meant here. Casting to uintmax_t
 is obviously more correct but print_number() will still print the
 negative range in 64-bit format on i386.

Hmm, you are right, it would have worked if *i was first cast to an
unsigned type of the correct size.  Unfortunately, the print_number()
macro does not know the correct size, so we have to play games with
sizeof() and hope the compiler optimizes away the unused code:

@@ -113,6 +114,8 @@
 #define print_number(i,n,c) do {   \
if (decimal)\
printf(%c%jd, c, (intmax_t)*i);   \
+   else if (sizeof(*i) == sizeof(long))\
+   printf(%c%#lx, c, (unsigned long)*i); \
else\
printf(%c%#jx, c, (uintmax_t)*i); \
i++;\

The root of the problem is that register_t is signed, which it shouldn't
be, IMHO.

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
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: r226247 - head/sys/compat/linux

2011-10-11 Thread Christian Brueffer
Author: brueffer
Date: Tue Oct 11 10:32:23 2011
New Revision: 226247
URL: http://svn.freebsd.org/changeset/base/226247

Log:
  Properly free linux_gidset in case of an error.
  
  CID:  4136
  Found with:   Coverity Prevent(tm)
  MFC after:1 week

Modified:
  head/sys/compat/linux/linux_uid16.c

Modified: head/sys/compat/linux/linux_uid16.c
==
--- head/sys/compat/linux/linux_uid16.c Tue Oct 11 07:46:45 2011
(r226246)
+++ head/sys/compat/linux/linux_uid16.c Tue Oct 11 10:32:23 2011
(r226247)
@@ -114,6 +114,7 @@ linux_setgroups16(struct thread *td, str
linux_gidset = malloc(ngrp * sizeof(*linux_gidset), M_TEMP, M_WAITOK);
error = copyin(args-gidset, linux_gidset, ngrp * sizeof(l_gid16_t));
if (error)
+   free(linux_gidset, M_TEMP);
return (error);
newcred = crget();
p = td-td_proc;
___
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: r226247 - head/sys/compat/linux

2011-10-11 Thread Giovanni Trematerra
On Tue, Oct 11, 2011 at 12:32 PM, Christian Brueffer
bruef...@freebsd.org wrote:
 Author: brueffer
 Date: Tue Oct 11 10:32:23 2011
 New Revision: 226247
 URL: http://svn.freebsd.org/changeset/base/226247

 Log:
  Properly free linux_gidset in case of an error.

  CID:          4136
  Found with:   Coverity Prevent(tm)
  MFC after:    1 week

 Modified:
  head/sys/compat/linux/linux_uid16.c

 Modified: head/sys/compat/linux/linux_uid16.c
 ==
 --- head/sys/compat/linux/linux_uid16.c Tue Oct 11 07:46:45 2011        
 (r226246)
 +++ head/sys/compat/linux/linux_uid16.c Tue Oct 11 10:32:23 2011        
 (r226247)
 @@ -114,6 +114,7 @@ linux_setgroups16(struct thread *td, str
        linux_gidset = malloc(ngrp * sizeof(*linux_gidset), M_TEMP, M_WAITOK);
        error = copyin(args-gidset, linux_gidset, ngrp * sizeof(l_gid16_t));
        if (error)
 +               free(linux_gidset, M_TEMP);
                return (error);
        newcred = crget();
        p = td-td_proc;

Did you miss { } ?

--
Gianni
___
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: r226247 - head/sys/compat/linux

2011-10-11 Thread John Baldwin
On Tuesday, October 11, 2011 6:32:23 am Christian Brueffer wrote:
 Author: brueffer
 Date: Tue Oct 11 10:32:23 2011
 New Revision: 226247
 URL: http://svn.freebsd.org/changeset/base/226247
 
 Log:
   Properly free linux_gidset in case of an error.
   
   CID:4136
   Found with: Coverity Prevent(tm)
   MFC after:  1 week
 
 Modified:
   head/sys/compat/linux/linux_uid16.c
 
 Modified: head/sys/compat/linux/linux_uid16.c
 
==
 --- head/sys/compat/linux/linux_uid16.c   Tue Oct 11 07:46:45 2011
(r226246)
 +++ head/sys/compat/linux/linux_uid16.c   Tue Oct 11 10:32:23 2011
(r226247)
 @@ -114,6 +114,7 @@ linux_setgroups16(struct thread *td, str
   linux_gidset = malloc(ngrp * sizeof(*linux_gidset), M_TEMP, M_WAITOK);
   error = copyin(args-gidset, linux_gidset, ngrp * sizeof(l_gid16_t));
   if (error)
 + free(linux_gidset, M_TEMP);
   return (error);

This need braces now.

   newcred = crget();
   p = td-td_proc;
 

-- 
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: r226252 - head/sys/netinet

2011-10-11 Thread Michael Tuexen
Author: tuexen
Date: Tue Oct 11 13:24:37 2011
New Revision: 226252
URL: http://svn.freebsd.org/changeset/base/226252

Log:
  Use the most significant 6 bits of the dscp instead of the least
  significant ones.
  This has changed in the latest version of the socket API ID and
  provides backwards compatibility and gets it in syn with the
  usage of the IP_TOS socket option.
  
  MFC after: 3 days.

Modified:
  head/sys/netinet/sctp_usrreq.c

Modified: head/sys/netinet/sctp_usrreq.c
==
--- head/sys/netinet/sctp_usrreq.c  Tue Oct 11 13:22:35 2011
(r226251)
+++ head/sys/netinet/sctp_usrreq.c  Tue Oct 11 13:24:37 2011
(r226252)
@@ -2435,7 +2435,7 @@ flags_out:
paddrp-spp_flags |= 
SPP_PMTUD_DISABLE;
}
if (net-dscp  0x01) {
-   paddrp-spp_dscp = net-dscp  
2;
+   paddrp-spp_dscp = net-dscp  
0xfc;
paddrp-spp_flags |= SPP_DSCP;
}
 #ifdef INET6
@@ -2453,7 +2453,7 @@ flags_out:
paddrp-spp_pathmaxrxt = 
stcb-asoc.def_net_failure;
paddrp-spp_pathmtu = 
sctp_get_frag_point(stcb, stcb-asoc);
if (stcb-asoc.default_dscp  0x01) {
-   paddrp-spp_dscp = 
stcb-asoc.default_dscp  2;
+   paddrp-spp_dscp = 
stcb-asoc.default_dscp  0xfc;
paddrp-spp_flags |= SPP_DSCP;
}
 #ifdef INET6
@@ -2488,7 +2488,7 @@ flags_out:
paddrp-spp_assoc_id = 
SCTP_FUTURE_ASSOC;
/* get inp's default */
if (inp-sctp_ep.default_dscp  0x01) {
-   paddrp-spp_dscp = 
inp-sctp_ep.default_dscp  2;
+   paddrp-spp_dscp = 
inp-sctp_ep.default_dscp  0xfc;
paddrp-spp_flags |= SPP_DSCP;
}
 #ifdef INET6
@@ -4691,7 +4691,7 @@ sctp_setopt(struct socket *so, int optna
net-failure_threshold = 
paddrp-spp_pathmaxrxt;
}
if (paddrp-spp_flags  SPP_DSCP) {
-   net-dscp = paddrp-spp_dscp  
2;
+   net-dscp = paddrp-spp_dscp  
0xfc;
net-dscp |= 0x01;
}
 #ifdef INET6
@@ -4794,10 +4794,10 @@ sctp_setopt(struct socket *so, int optna
}
if (paddrp-spp_flags  SPP_DSCP) {
TAILQ_FOREACH(net, 
stcb-asoc.nets, sctp_next) {
-   net-dscp = 
paddrp-spp_dscp  2;
+   net-dscp = 
paddrp-spp_dscp  0xfc;
net-dscp |= 0x01;
}
-   stcb-asoc.default_dscp = 
paddrp-spp_dscp  2;
+   stcb-asoc.default_dscp = 
paddrp-spp_dscp  0xfc;
stcb-asoc.default_dscp |= 0x01;
}
 #ifdef INET6
@@ -4851,7 +4851,7 @@ sctp_setopt(struct socket *so, int optna
sctp_feature_on(inp, 
SCTP_PCB_FLAGS_DO_NOT_PMTUD);
}
if (paddrp-spp_flags  SPP_DSCP) {
-   inp-sctp_ep.default_dscp = 
paddrp-spp_dscp  2;
+   inp-sctp_ep.default_dscp = 
paddrp-spp_dscp  0xfc;
inp-sctp_ep.default_dscp |= 
0x01;
}
 #ifdef INET6
___
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: r226253 - head/sys/compat/linux

2011-10-11 Thread Christian Brueffer
Author: brueffer
Date: Tue Oct 11 13:40:37 2011
New Revision: 226253
URL: http://svn.freebsd.org/changeset/base/226253

Log:
  Add curly braces missed in r226247.
  
  Pointy hat to:brueffer
  Submitted by: many
  MFC after:1 week

Modified:
  head/sys/compat/linux/linux_uid16.c

Modified: head/sys/compat/linux/linux_uid16.c
==
--- head/sys/compat/linux/linux_uid16.c Tue Oct 11 13:24:37 2011
(r226252)
+++ head/sys/compat/linux/linux_uid16.c Tue Oct 11 13:40:37 2011
(r226253)
@@ -113,9 +113,10 @@ linux_setgroups16(struct thread *td, str
return (EINVAL);
linux_gidset = malloc(ngrp * sizeof(*linux_gidset), M_TEMP, M_WAITOK);
error = copyin(args-gidset, linux_gidset, ngrp * sizeof(l_gid16_t));
-   if (error)
+   if (error) {
free(linux_gidset, M_TEMP);
return (error);
+   }
newcred = crget();
p = td-td_proc;
PROC_LOCK(p);
___
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: r226247 - head/sys/compat/linux

2011-10-11 Thread Christian Brueffer

On 10/11/11 13:26 , Giovanni Trematerra wrote:

On Tue, Oct 11, 2011 at 12:32 PM, Christian Brueffer
bruef...@freebsd.org  wrote:

Author: brueffer
Date: Tue Oct 11 10:32:23 2011
New Revision: 226247
URL: http://svn.freebsd.org/changeset/base/226247

Log:
  Properly free linux_gidset in case of an error.

  CID:  4136
  Found with:   Coverity Prevent(tm)
  MFC after:1 week

Modified:
  head/sys/compat/linux/linux_uid16.c

Modified: head/sys/compat/linux/linux_uid16.c
==
--- head/sys/compat/linux/linux_uid16.c Tue Oct 11 07:46:45 2011
(r226246)
+++ head/sys/compat/linux/linux_uid16.c Tue Oct 11 10:32:23 2011
(r226247)
@@ -114,6 +114,7 @@ linux_setgroups16(struct thread *td, str
linux_gidset = malloc(ngrp * sizeof(*linux_gidset), M_TEMP, M_WAITOK);
error = copyin(args-gidset, linux_gidset, ngrp * sizeof(l_gid16_t));
if (error)
+   free(linux_gidset, M_TEMP);
return (error);
newcred = crget();
p = td-td_proc;


Did you miss { } ?



Gah, one of those things not cought by compile-testing.

Fixing it now, thanks!

Christian

___
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: r226151 - head/usr.bin/kdump

2011-10-11 Thread Jaakko Heinonen
On 2011-10-11, Dag-Erling Smørgrav wrote:
 @@ -113,6 +114,8 @@
  #define print_number(i,n,c) do { \
   if (decimal)\
   printf(%c%jd, c, (intmax_t)*i);   \
 + else if (sizeof(*i) == sizeof(long))\
 + printf(%c%#lx, c, (unsigned long)*i); \
   else\
   printf(%c%#jx, c, (uintmax_t)*i); \
   i++;\

This assumes that sizeof(*i) is always sizeof(long) or
sizeof(uintmax_t). I prefer the fix bde suggested in another mail if
it's possible (I don't know if *i is always type of register_t).

-- 
Jaakko
___
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: r226151 - head/usr.bin/kdump

2011-10-11 Thread Dag-Erling Smørgrav
Jaakko Heinonen j...@freebsd.org writes:
 This assumes that sizeof(*i) is always sizeof(long) or
 sizeof(uintmax_t). I prefer the fix bde suggested in another mail if
 it's possible (I don't know if *i is always type of register_t).

It is.  I didn't realize there was a u_register_t.

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
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: r226262 - head/usr.bin/kdump

2011-10-11 Thread Dag-Erling Smorgrav
Author: des
Date: Tue Oct 11 15:04:58 2011
New Revision: 226262
URL: http://svn.freebsd.org/changeset/base/226262

Log:
  The previous commit did not fix the issue since it did not prevent sign
  extension.  Cast to u_register_t first, then to uintmax_t.
  
  Submitted by: bde@

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

Modified: head/usr.bin/kdump/kdump.c
==
--- head/usr.bin/kdump/kdump.c  Tue Oct 11 15:03:42 2011(r226261)
+++ head/usr.bin/kdump/kdump.c  Tue Oct 11 15:04:58 2011(r226262)
@@ -110,14 +110,14 @@ struct ktr_header ktr_header;
 #define TIME_FORMAT%b %e %T %Y
 #define eqs(s1, s2)(strcmp((s1), (s2)) == 0)
 
-#define print_number(i,n,c) do {   \
-   if (decimal)\
-   printf(%c%jd, c, (intmax_t)*i);   \
-   else\
-   printf(%c%#jx, c, (uintmax_t)*i); \
-   i++;\
-   n--;\
-   c = ',';\
+#define print_number(i,n,c) do {   \
+   if (decimal)\
+   printf(%c%jd, c, (intmax_t)*i);   \
+   else\
+   printf(%c%#jx, c, (uintmax_t)(u_register_t)*i);   \
+   i++;\
+   n--;\
+   c = ',';\
 } while (0)
 
 #if defined(__amd64__) || defined(__i386__)
___
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: r226263 - head/share/man/man4

2011-10-11 Thread Gleb Smirnoff
Author: glebius
Date: Tue Oct 11 15:41:07 2011
New Revision: 226263
URL: http://svn.freebsd.org/changeset/base/226263

Log:
  Properly document default number of rx/tx descriptors for Intel cards.

Modified:
  head/share/man/man4/em.4
  head/share/man/man4/igb.4

Modified: head/share/man/man4/em.4
==
--- head/share/man/man4/em.4Tue Oct 11 15:04:58 2011(r226262)
+++ head/share/man/man4/em.4Tue Oct 11 15:41:07 2011(r226263)
@@ -31,7 +31,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd May 14, 2010
+.Dd October 11, 2010
 .Dt EM 4
 .Os
 .Sh NAME
@@ -199,12 +199,14 @@ prompt before booting the kernel or stor
 .Bl -tag -width indent
 .It Va hw.em.rxd
 Number of receive descriptors allocated by the driver.
-The default value is 256.
+The default value is 1024 for adapters newer than 82547,
+and 256 for older ones.
 The 82542 and 82543-based adapters can handle up to 256 descriptors,
 while others can have up to 4096.
 .It Va hw.em.txd
 Number of transmit descriptors allocated by the driver.
-The default value is 256.
+The default value is 1024 for adapters newer than 82547,
+and 256 for older ones.
 The 82542 and 82543-based adapters can handle up to 256 descriptors,
 while others can have up to 4096.
 .It Va hw.em.rx_int_delay

Modified: head/share/man/man4/igb.4
==
--- head/share/man/man4/igb.4   Tue Oct 11 15:04:58 2011(r226262)
+++ head/share/man/man4/igb.4   Tue Oct 11 15:41:07 2011(r226263)
@@ -31,7 +31,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd May 14, 2010
+.Dd October 11, 2011
 .Dt IGB 4
 .Os
 .Sh NAME
@@ -151,11 +151,11 @@ prompt before booting the kernel or stor
 .Bl -tag -width indent
 .It Va hw.igb.rxd
 Number of receive descriptors allocated by the driver.
-The default value is 256.
+The default value is 1024.
 The minimum is 80, and the maximum is 4096.
 .It Va hw.igb.txd
 Number of transmit descriptors allocated by the driver.
-The default value is 256.
+The default value is 1024.
 The minimum is 80, and the maximum is 4096.
 .It Va hw.igb.enable_aim
 If set to 1, enable Adaptive Interrupt Moderation.
___
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: r226157 - head/usr.bin/kdump

2011-10-11 Thread Garrett Cooper
On Sat, Oct 8, 2011 at 5:47 AM, Dag-Erling Smorgrav d...@freebsd.org wrote:
 Author: des
 Date: Sat Oct  8 12:47:00 2011
 New Revision: 226157
 URL: http://svn.freebsd.org/changeset/base/226157

 Log:
  Bring ioctlname() in line with all the other *name() functions, which
  actually print the name (or the numeric value, if they can't figure out
  the correct name) instead of just returning a pointer to it.  Also, since
  ioctl numbers are not and probably never will be unique, drop support for
  using a switch statement instead of an if/else chain.

Hi Des!
Seeing that you've committed quite a bit to kdump recently, could
you please take a look at
http://www.freebsd.org/cgi/query-pr.cgi?pr=161478 ?
Thanks!
-Garrett
___
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: r226264 - head/share/man/man4

2011-10-11 Thread Gleb Smirnoff
Author: glebius
Date: Tue Oct 11 18:26:31 2011
New Revision: 226264
URL: http://svn.freebsd.org/changeset/base/226264

Log:
  Fix date in last commit.
  
  Noticed by:   Larry Rosenman ler lerctr.org

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

Modified: head/share/man/man4/em.4
==
--- head/share/man/man4/em.4Tue Oct 11 15:41:07 2011(r226263)
+++ head/share/man/man4/em.4Tue Oct 11 18:26:31 2011(r226264)
@@ -31,7 +31,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd October 11, 2010
+.Dd October 11, 2011
 .Dt EM 4
 .Os
 .Sh NAME
___
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: r226265 - head/sys/kern

2011-10-11 Thread Kirk McKusick
Author: mckusick
Date: Tue Oct 11 18:46:41 2011
New Revision: 226265
URL: http://svn.freebsd.org/changeset/base/226265

Log:
  When unmounting a filesystem always wait for the vfs_busy lock to clear
  so that if no vnodes in the filesystem are actively in use the unmount
  will succeed rather than failing with EBUSY.
  
  Reported by: Garrett Cooper
  Reviewed by: Attilio Rao and Kostik Belousov
  Tested by:   Garrett Cooper
  PR:  kern/161016
  MFC after:   3 weeks

Modified:
  head/sys/kern/vfs_mount.c

Modified: head/sys/kern/vfs_mount.c
==
--- head/sys/kern/vfs_mount.c   Tue Oct 11 18:26:31 2011(r226264)
+++ head/sys/kern/vfs_mount.c   Tue Oct 11 18:46:41 2011(r226265)
@@ -1227,18 +1227,6 @@ dounmount(mp, flags, td)
mp-mnt_kern_flag |= MNTK_UNMOUNTF;
error = 0;
if (mp-mnt_lockref) {
-   if ((flags  MNT_FORCE) == 0) {
-   mp-mnt_kern_flag = ~(MNTK_UNMOUNT | MNTK_NOINSMNTQ |
-   MNTK_UNMOUNTF);
-   if (mp-mnt_kern_flag  MNTK_MWAIT) {
-   mp-mnt_kern_flag = ~MNTK_MWAIT;
-   wakeup(mp);
-   }
-   MNT_IUNLOCK(mp);
-   if (coveredvp)
-   VOP_UNLOCK(coveredvp, 0);
-   return (EBUSY);
-   }
mp-mnt_kern_flag |= MNTK_DRAINING;
error = msleep(mp-mnt_lockref, MNT_MTX(mp), PVFS,
mount drain, 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


svn commit: r226266 - head/sbin/tunefs

2011-10-11 Thread Kirk McKusick
Author: mckusick
Date: Tue Oct 11 19:03:57 2011
New Revision: 226266
URL: http://svn.freebsd.org/changeset/base/226266

Log:
  After creating a filesystem using newfs -j the time stamps are all
  zero and thus report as having been made in January 1970. Apart
  from looking a bit silly, it also triggers alarms from scripts
  that detect weird time stamps. This update sets all 4 (or 3, in
  the case of UFS1) time stamps to the current time when enabling
  journaling during newfs or later when enabling it with tunefs.
  
  Reported by: Hans Ottevanger h...@beastielabs.net
  MFC after:   1 week

Modified:
  head/sbin/tunefs/tunefs.c

Modified: head/sbin/tunefs/tunefs.c
==
--- head/sbin/tunefs/tunefs.c   Tue Oct 11 18:46:41 2011(r226265)
+++ head/sbin/tunefs/tunefs.c   Tue Oct 11 19:03:57 2011(r226266)
@@ -64,6 +64,7 @@ __FBSDID($FreeBSD$);
 #include stdlib.h
 #include stdint.h
 #include string.h
+#include time.h
 #include unistd.h
 
 /* the optimization warning string template */
@@ -923,6 +924,7 @@ journal_alloc(int64_t size)
ino_t ino;
int blks;
int mode;
+   time_t utime;
int i;
 
cgp = disk.d_cg;
@@ -983,18 +985,26 @@ journal_alloc(int64_t size)
 */
dp2 = ip;
dp1 = ip;
+   time(utime);
if (sblock.fs_magic == FS_UFS1_MAGIC) {
bzero(dp1, sizeof(*dp1));
dp1-di_size = size;
dp1-di_mode = IFREG | IREAD;
dp1-di_nlink = 1;
dp1-di_flags = SF_IMMUTABLE | SF_NOUNLINK | UF_NODUMP;
+   dp1-di_atime = utime;
+   dp1-di_mtime = utime;
+   dp1-di_ctime = utime;
} else {
bzero(dp2, sizeof(*dp2));
dp2-di_size = size;
dp2-di_mode = IFREG | IREAD;
dp2-di_nlink = 1;
dp2-di_flags = SF_IMMUTABLE | SF_NOUNLINK | UF_NODUMP;
+   dp2-di_atime = utime;
+   dp2-di_mtime = utime;
+   dp2-di_ctime = utime;
+   dp2-di_birthtime = utime;
}
for (i = 0; i  NDADDR  resid; i++, resid--) {
blk = journal_balloc();
___
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: r226157 - head/usr.bin/kdump

2011-10-11 Thread Dag-Erling Smørgrav
Garrett Cooper yaneg...@gmail.com writes:
 Seeing that you've committed quite a bit to kdump recently, could
 you please take a look at
 http://www.freebsd.org/cgi/query-pr.cgi?pr=161478 ?

Hmm, that patch actually removes code, but if the point is make ktrace
and kdump build at WARNS level 6, I'll take care of it.

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
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: r226157 - head/usr.bin/kdump

2011-10-11 Thread Garrett Cooper
2011/10/11 Dag-Erling Smørgrav d...@des.no:
 Garrett Cooper yaneg...@gmail.com writes:
     Seeing that you've committed quite a bit to kdump recently, could
 you please take a look at
 http://www.freebsd.org/cgi/query-pr.cgi?pr=161478 ?

 Hmm, that patch actually removes code, but if the point is make ktrace
 and kdump build at WARNS level 6, I'll take care of it.

Awesome! If you can find out where capname was at, I don't have an
issue with re-adding that portion of the patch. The issue is that the
compile fails with WARNS  0 because it can't find the identifier in
any of the included headers (and it's new code because I had to remove
it last night before running make universe). I searched for it in
src/sys/sys and I couldn't find it, fell back to looking in src/ and
didn't come up with anything. I could have overlooked something
obvious though (it happens), or it might have been a typo that I
didn't look to closely at in my search to find the proper analog.
Thanks!
-Garrett
___
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: r226269 - in head: lib/libc/sys sys/kern sys/sys usr.bin/kdump usr.bin/ktrace

2011-10-11 Thread Dag-Erling Smorgrav
Author: des
Date: Tue Oct 11 20:37:10 2011
New Revision: 226269
URL: http://svn.freebsd.org/changeset/base/226269

Log:
  Add a new trace point, KTRFAC_CAPFAIL, which traces capability check
  failures.  It is included in the default set for ktrace(1) and kdump(1).

Modified:
  head/lib/libc/sys/ktrace.2
  head/sys/kern/kern_ktrace.c
  head/sys/kern/sys_capability.c
  head/sys/sys/ktrace.h
  head/usr.bin/kdump/kdump.c
  head/usr.bin/ktrace/ktrace.1
  head/usr.bin/ktrace/ktrace.h
  head/usr.bin/ktrace/subr.c

Modified: head/lib/libc/sys/ktrace.2
==
--- head/lib/libc/sys/ktrace.2  Tue Oct 11 19:31:02 2011(r226268)
+++ head/lib/libc/sys/ktrace.2  Tue Oct 11 20:37:10 2011(r226269)
@@ -28,7 +28,7 @@
 .\ @(#)ktrace.2   8.1 (Berkeley) 6/4/93
 .\ $FreeBSD$
 .\
-.Dd October 9, 2011
+.Dd October 10, 2011
 .Dt KTRACE 2
 .Os
 .Sh NAME
@@ -67,9 +67,9 @@ The
 argument specifies the requested ktrace operation.
 The defined operations are:
 .Bl -column KTRFLAG_DESCENDXXX -offset indent
-.It KTROP_SET Enable trace points specified in
+.It KTROP_SET Enable trace points specified in
 .Fa trpoints .
-.It KTROP_CLEAR   Disable trace points specified in
+.It KTROP_CLEAR   Disable trace points specified in
 .Fa trpoints .
 .It KTROP_CLEARFILE   Stop all tracing.
 .It KTRFLAG_DESCEND   The tracing change should apply to the
@@ -93,6 +93,7 @@ generate much output).
 .It KTRFAC_SYSCTL Trace sysctls.
 .It KTRFAC_PROCCTOR   Trace process construction.
 .It KTRFAC_PROCDTOR   Trace process destruction.
+.It KTRFAC_CAPFAILTrace capability failures.
 .It KTRFAC_INHERITInherit tracing to future children.
 .El
 .Pp

Modified: head/sys/kern/kern_ktrace.c
==
--- head/sys/kern/kern_ktrace.c Tue Oct 11 19:31:02 2011(r226268)
+++ head/sys/kern/kern_ktrace.c Tue Oct 11 20:37:10 2011(r226269)
@@ -95,6 +95,7 @@ struct ktr_request {
void*ktr_buffer;
union {
struct  ktr_proc_ctor ktr_proc_ctor;
+   struct  ktr_cap_fail ktr_cap_fail;
struct  ktr_syscall ktr_syscall;
struct  ktr_sysret ktr_sysret;
struct  ktr_genio ktr_genio;
@@ -117,6 +118,7 @@ static int data_lengths[] = {
0,  /* KTR_SYSCTL */
sizeof(struct ktr_proc_ctor),   /* KTR_PROCCTOR */
0,  /* KTR_PROCDTOR */
+   sizeof(struct ktr_cap_fail),/* KTR_CAPFAIL */
 };
 
 static STAILQ_HEAD(, ktr_request) ktr_free;
@@ -768,6 +770,25 @@ ktrstruct(name, data, datalen)
req-ktr_header.ktr_len = buflen;
ktr_submitrequest(curthread, req);
 }
+
+void
+ktrcapfail(needed, held)
+   cap_rights_t needed;
+   cap_rights_t held;
+{
+   struct thread *td = curthread;
+   struct ktr_request *req;
+   struct ktr_cap_fail *kcf;
+
+   req = ktr_getrequest(KTR_CAPFAIL);
+   if (req == NULL)
+   return;
+   kcf = req-ktr_data.ktr_cap_fail;
+   kcf-cap_needed = needed;
+   kcf-cap_held = held;
+   ktr_enqueuerequest(td, req);
+   ktrace_exit(td);
+}
 #endif /* KTRACE */
 
 /* Interface and common routines */

Modified: head/sys/kern/sys_capability.c
==
--- head/sys/kern/sys_capability.c  Tue Oct 11 19:31:02 2011
(r226268)
+++ head/sys/kern/sys_capability.c  Tue Oct 11 20:37:10 2011
(r226269)
@@ -52,6 +52,7 @@
  */
 
 #include opt_capsicum.h
+#include opt_ktrace.h
 
 #include sys/cdefs.h
 __FBSDID($FreeBSD$);
@@ -68,6 +69,8 @@ __FBSDID($FreeBSD$);
 #include sys/sysctl.h
 #include sys/systm.h
 #include sys/ucred.h
+#include sys/uio.h
+#include sys/ktrace.h
 
 #include security/audit/audit.h
 
@@ -212,8 +215,13 @@ static int
 cap_check(struct capability *c, cap_rights_t rights)
 {
 
-   if ((c-cap_rights | rights) != c-cap_rights)
+   if ((c-cap_rights | rights) != c-cap_rights) {
+#ifdef KTRACE
+   if (KTRPOINT(curthread, KTR_CAPFAIL))
+   ktrcapfail(rights, c-cap_rights);
+#endif
return (ENOTCAPABLE);
+   }
return (0);
 }
 

Modified: head/sys/sys/ktrace.h
==
--- head/sys/sys/ktrace.h   Tue Oct 11 19:31:02 2011(r226268)
+++ head/sys/sys/ktrace.h   Tue Oct 11 20:37:10 2011(r226269)
@@ -178,6 +178,15 @@ struct ktr_proc_ctor {
 #define KTR_PROCDTOR   11
 
 /*
+ * KTR_CAPFAIL - trace capability check failures
+ */
+#define KTR_CAPFAIL12
+struct ktr_cap_fail {
+   cap_rights_tcap_needed;
+   cap_rights_tcap_held;
+};
+
+/*
  * KTR_DROP - If this bit is set in ktr_type, then at least one event
  * between the previous record and this record was 

Re: svn commit: r226157 - head/usr.bin/kdump

2011-10-11 Thread Dag-Erling Smørgrav
Garrett Cooper yaneg...@gmail.com writes:
 Awesome! If you can find out where capname was at, I don't have an
 issue with re-adding that portion of the patch. The issue is that the
 compile fails with WARNS  0 because it can't find the identifier in
 any of the included headers (and it's new code because I had to remove
 it last night before running make universe). I searched for it in
 src/sys/sys and I couldn't find it, fell back to looking in src/ and
 didn't come up with anything. I could have overlooked something
 obvious though (it happens), or it might have been a typo that I
 didn't look to closely at in my search to find the proper analog.
 Thanks!

The capname function is generated by mksubr, along with all the other
*name functions.  It's part of the code I added this weekend.  This is
what svn log and svn diff are for, you know :)

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
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: r226157 - head/usr.bin/kdump

2011-10-11 Thread Garrett Cooper
2011/10/11 Dag-Erling Smørgrav d...@des.no:
 Garrett Cooper yaneg...@gmail.com writes:
 Awesome! If you can find out where capname was at, I don't have an
 issue with re-adding that portion of the patch. The issue is that the
 compile fails with WARNS  0 because it can't find the identifier in
 any of the included headers (and it's new code because I had to remove
 it last night before running make universe). I searched for it in
 src/sys/sys and I couldn't find it, fell back to looking in src/ and
 didn't come up with anything. I could have overlooked something
 obvious though (it happens), or it might have been a typo that I
 didn't look to closely at in my search to find the proper analog.
 Thanks!

 The capname function is generated by mksubr, along with all the other
 *name functions.  It's part of the code I added this weekend.  This is
 what svn log and svn diff are for, you know :)

And svn blame/praise. Yeah.. kind of a derp moment.
-Garrett
___
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: r226270 - head/sys/dev/lge

2011-10-11 Thread Marius Strobl
Author: marius
Date: Tue Oct 11 21:52:24 2011
New Revision: 226270
URL: http://svn.freebsd.org/changeset/base/226270

Log:
  - Remove unused remnants of MII bitbang'ing.
  - Sprinkle const.

Modified:
  head/sys/dev/lge/if_lge.c
  head/sys/dev/lge/if_lgereg.h

Modified: head/sys/dev/lge/if_lge.c
==
--- head/sys/dev/lge/if_lge.c   Tue Oct 11 20:37:10 2011(r226269)
+++ head/sys/dev/lge/if_lge.c   Tue Oct 11 21:52:24 2011(r226270)
@@ -110,7 +110,7 @@ __FBSDID($FreeBSD$);
 /*
  * Various supported device vendors/types and their names.
  */
-static struct lge_type lge_devs[] = {
+static const struct lge_type const lge_devs[] = {
{ LGE_VENDORID, LGE_DEVICEID, Level 1 Gigabit Ethernet },
{ 0, 0, NULL }
 };
@@ -442,7 +442,7 @@ static int
 lge_probe(dev)
device_tdev;
 {
-   struct lge_type *t;
+   const struct lge_type   *t;
 
t = lge_devs;
 

Modified: head/sys/dev/lge/if_lgereg.h
==
--- head/sys/dev/lge/if_lgereg.hTue Oct 11 20:37:10 2011
(r226269)
+++ head/sys/dev/lge/if_lgereg.hTue Oct 11 21:52:24 2011
(r226270)
@@ -475,26 +475,9 @@ struct lge_list_data {
 struct lge_type {
u_int16_t   lge_vid;
u_int16_t   lge_did;
-   char*lge_name;
+   const char  *lge_name;
 };
 
-struct lge_mii_frame {
-   u_int8_tmii_stdelim;
-   u_int8_tmii_opcode;
-   u_int8_tmii_phyaddr;
-   u_int8_tmii_regaddr;
-   u_int8_tmii_turnaround;
-   u_int16_t   mii_data;
-};
-
-/*
- * MII constants
- */
-#define LGE_MII_STARTDELIM 0x01
-#define LGE_MII_READOP 0x02
-#define LGE_MII_WRITEOP0x01
-#define LGE_MII_TURNAROUND 0x02
-
 #define LGE_JUMBO_FRAMELEN 9018
 #define LGE_JUMBO_MTU  (LGE_JUMBO_FRAMELEN-ETHER_HDR_LEN-ETHER_CRC_LEN)
 #define LGE_JSLOTS 384
___
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: r226157 - head/usr.bin/kdump

2011-10-11 Thread Dag-Erling Smørgrav
Would you mind reviewing the attached patch, which cleans up ktrace(1)?

DES
-- 
Dag-Erling Smørgrav - d...@des.no

Index: usr.bin/ktrace/ktrace.c
===
--- usr.bin/ktrace/ktrace.c	(revision 226262)
+++ usr.bin/ktrace/ktrace.c	(working copy)
@@ -43,14 +43,15 @@
 __FBSDID($FreeBSD$);
 
 #include sys/param.h
+#include sys/file.h
 #include sys/stat.h
-#include sys/file.h
 #include sys/time.h
-#include sys/errno.h
 #include sys/uio.h
 #include sys/ktrace.h
 
 #include err.h
+#include errno.h
+#include inttypes.h
 #include stdio.h
 #include stdlib.h
 #include unistd.h
@@ -59,21 +60,22 @@
 
 static char def_tracefile[] = DEF_TRACEFILE;
 
+static enum clear { NOTSET, CLEAR, CLEARALL } clear = NOTSET;
+static int pid;
+
 static void no_ktrace(int);
-static int rpid(char *);
+static void set_pid_clear(const char *, enum clear);
 static void usage(void);
 
 int
 main(int argc, char *argv[])
 {
-	enum { NOTSET, CLEAR, CLEARALL } clear;
-	int append, ch, fd, inherit, ops, pid, pidset, trpoints;
+	int append, ch, fd, inherit, ops, trpoints;
 	const char *tracefile;
 	mode_t omask;
 	struct stat sb;
 
-	clear = NOTSET;
-	append = ops = pidset = inherit = 0;
+	append = ops = inherit = 0;
 	trpoints = DEF_POINTS;
 	tracefile = def_tracefile;
 	while ((ch = getopt(argc,argv,aCcdf:g:ip:t:)) != -1)
@@ -82,11 +84,10 @@
 			append = 1;
 			break;
 		case 'C':
-			clear = CLEARALL;
-			pidset = 1;
+			set_pid_clear(1, CLEARALL);
 			break;
 		case 'c':
-			clear = CLEAR;
+			set_pid_clear(NULL, CLEAR);
 			break;
 		case 'd':
 			ops |= KTRFLAG_DESCEND;
@@ -95,15 +96,14 @@
 			tracefile = optarg;
 			break;
 		case 'g':
-			pid = -rpid(optarg);
-			pidset = 1;
+			set_pid_clear(optarg, NOTSET);
+			pid = -pid;
 			break;
 		case 'i':
 			inherit = 1;
 			break;
 		case 'p':
-			pid = rpid(optarg);
-			pidset = 1;
+			set_pid_clear(optarg, NOTSET);
 			break;
 		case 't':
 			trpoints = getpoints(optarg);
@@ -115,12 +115,19 @@
 		default:
 			usage();
 		}
+
 	argv += optind;
 	argc -= optind;
-	
-	if ((pidset  *argv) || (!pidset  clear == NOTSET  !*argv))
+
+	/* must have either -[Cc], a pid or a command */
+	if (clear == NOTSET  pid == 0  argc == 0)
 		usage();
-			
+	/* can't have both a pid and a command */
+	/* (note that -C sets pid to 1) */
+	if (pid != 0  argc  0) {
+		usage();
+	}
+
 	if (inherit)
 		trpoints |= KTRFAC_INHERIT;
 
@@ -129,10 +136,9 @@
 		if (clear == CLEARALL) {
 			ops = KTROP_CLEAR | KTRFLAG_DESCEND;
 			trpoints = ALL_POINTS;
-			pid = 1;
-		} else
-			ops |= pidset ? KTROP_CLEAR : KTROP_CLEARFILE;
-
+		} else {
+			ops |= pid ? KTROP_CLEAR : KTROP_CLEARFILE;
+		}
 		if (ktrace(tracefile, ops, trpoints, pid)  0)
 			err(1, %s, tracefile);
 		exit(0);
@@ -160,46 +166,75 @@
 
 	trpoints |= PROC_ABI_POINTS;
 
-	if (*argv) { 
+	if (argc  0) { 
 		if (ktrace(tracefile, ops, trpoints, getpid())  0)
 			err(1, %s, tracefile);
-		execvp(argv[0], argv[0]);
-		err(1, exec of '%s' failed, argv[0]);
+		execvp(*argv, argv);
+		err(1, exec of '%s' failed, *argv);
 	}
-	else if (ktrace(tracefile, ops, trpoints, pid)  0)
+	if (ktrace(tracefile, ops, trpoints, pid)  0)
 		err(1, %s, tracefile);
 	exit(0);
 }
 
-static int
-rpid(char *p)
+static void
+set_pid_clear(const char *p, enum clear cl)
 {
-	static int first;
+	intmax_t n;
+	char *e;
 
-	if (first++) {
-		warnx(only one -g or -p flag is permitted);
+	if (clear != NOTSET  cl != NOTSET) {
+		/* either -c and -C or either of them twice */
+		warnx(only one -c or -C flag is permitted);
 		usage();
 	}
-	if (!*p) {
-		warnx(illegal process id);
+	if ((clear == CLEARALL  p != NULL) || (cl == CLEARALL  pid != 0)) {
+		/* both -C and a pid or pgid */
+		warnx(the -C flag may not be combined with -g or -p);
 		usage();
 	}
-	return(atoi(p));
+	if (p != NULL  pid != 0) {
+		/* either -p and -g or either of them twice */
+		warnx(only one -g or -p flag is permitted);
+		usage();
+	}
+	if (p != NULL) {
+		errno = 0;
+		n = strtoimax(p, e, 10);
+		/*
+		 * 1) not a number, or outside the range of an intmax_t
+		 * 2) inside the range of intmax_t but outside the range
+		 *of an int, keeping in mind that the pid may be
+		 *negated if it's actually a pgid.
+		 */
+		if (*e != '\0' || n  1 || errno == ERANGE ||
+		n  (intmax_t)INT_MAX || n  -(intmax_t)INT_MIN) {
+			warnx(invalid process or group id);
+			usage();
+		}
+		pid = n;
+	}
+	if (cl != NOTSET)
+		if ((clear = cl) == CLEARALL)
+			pid = 1;
 }
 
 static void
 usage(void)
 {
-	(void)fprintf(stderr, %s\n%s\n,
-usage: ktrace [-aCcdi] [-f trfile] [-g pgrp | -p pid] [-t trstr],
-   ktrace [-adi] [-f trfile] [-t trstr] command);
+
+	fprintf(stderr, %s\n%s\n,
+	usage: ktrace [-aCcdi] [-f trfile] [-g pgrp | -p pid] [-t trstr],
+	   ktrace [-adi] [-f trfile] [-t trstr] command);
 	exit(1);
 }
 
 static void
 no_ktrace(int sig __unused)
 {
-(void)fprintf(stderr,
-error:\tktrace() system call not supported in the running 

svn commit: r226271 - in head/usr.bin/grep: . regex

2011-10-11 Thread Gabor Kovesdan
Author: gabor
Date: Tue Oct 11 22:27:23 2011
New Revision: 226271
URL: http://svn.freebsd.org/changeset/base/226271

Log:
  - Use getprogname() instead of __progname
  - Allow disabling bzip2 support with WITHOUT_BZIP2
  - Fix handling patterns that start with a dot
  - Remove superfluous semicolon
  
  Approved by:  delphij (mentor)

Modified:
  head/usr.bin/grep/Makefile
  head/usr.bin/grep/file.c
  head/usr.bin/grep/grep.c
  head/usr.bin/grep/regex/tre-fastmatch.c

Modified: head/usr.bin/grep/Makefile
==
--- head/usr.bin/grep/Makefile  Tue Oct 11 21:52:24 2011(r226270)
+++ head/usr.bin/grep/Makefile  Tue Oct 11 22:27:23 2011(r226271)
@@ -26,9 +26,6 @@ LINKS=${BINDIR}/grep ${BINDIR}/egrep \
${BINDIR}/grep ${BINDIR}/zgrep \
${BINDIR}/grep ${BINDIR}/zegrep \
${BINDIR}/grep ${BINDIR}/zfgrep \
-   ${BINDIR}/grep ${BINDIR}/bzgrep \
-   ${BINDIR}/grep ${BINDIR}/bzegrep \
-   ${BINDIR}/grep ${BINDIR}/bzfgrep \
${BINDIR}/grep ${BINDIR}/xzgrep \
${BINDIR}/grep ${BINDIR}/xzegrep \
${BINDIR}/grep ${BINDIR}/xzfgrep \
@@ -41,9 +38,6 @@ MLINKS= grep.1 egrep.1 \
grep.1 zgrep.1 \
grep.1 zegrep.1 \
grep.1 zfgrep.1 \
-   grep.1 bzgrep.1 \
-   grep.1 bzegrep.1 \
-   grep.1 bzfgrep.1 \
grep.1 xzgrep.1 \
grep.1 xzegrep.1 \
grep.1 xzfgrep.1 \
@@ -52,8 +46,22 @@ MLINKS= grep.1 egrep.1 \
grep.1 lzfgrep.1
 .endif
 
-LDADD= -lz -lbz2 -llzma
-DPADD= ${LIBZ} ${LIBBZ2} ${LIBLZMA}
+LDADD= -lz -llzma
+DPADD= ${LIBZ} ${LIBLZMA}
+
+.if !defined(WITHOUT_BZIP2)
+LDADD+=-lbz2
+DPADD+=${LIBBZ2}
+
+LINKS+= ${BINDIR}/grep ${BINDIR}/bzgrep \
+   ${BINDIR}/grep ${BINDIR}/bzegrep \
+   ${BINDIR}/grep ${BINDIR}/bzfgrep
+MLINKS+= grep.1 bzgrep.1 \
+grep.1 bzegrep.1 \
+grep.1 bzfgrep.1
+.else
+CFLAGS+= -DWITHOUT_BZIP2
+.endif
 
 .if !defined(WITHOUT_GNU_COMPAT)
 CFLAGS+= -I/usr/include/gnu

Modified: head/usr.bin/grep/file.c
==
--- head/usr.bin/grep/file.cTue Oct 11 21:52:24 2011(r226270)
+++ head/usr.bin/grep/file.cTue Oct 11 22:27:23 2011(r226271)
@@ -38,7 +38,6 @@ __FBSDID($FreeBSD$);
 #include sys/stat.h
 #include sys/types.h
 
-#include bzlib.h
 #include err.h
 #include errno.h
 #include fcntl.h
@@ -51,14 +50,20 @@ __FBSDID($FreeBSD$);
 #include wctype.h
 #include zlib.h
 
+#ifndef WITHOUT_BZIP2
+#include bzlib.h
+#endif
+
 #include grep.h
 
 #defineMAXBUFSIZ   (32 * 1024)
 #defineLNBUFBUMP   80
 
 static gzFile gzbufdesc;
-static BZFILE* bzbufdesc;
 static lzma_stream lstrm = LZMA_STREAM_INIT;
+#ifndef WITHOUT_BZIP2
+static BZFILE* bzbufdesc;
+#endif
 
 static unsigned char *buffer;
 static unsigned char *bufpos;
@@ -72,7 +77,6 @@ static inline int
 grep_refill(struct file *f)
 {
ssize_t nr;
-   int bzerr;
 
if (filebehave == FILE_MMAP)
return (0);
@@ -80,9 +84,12 @@ grep_refill(struct file *f)
bufpos = buffer;
bufrem = 0;
 
-   if (filebehave == FILE_GZIP)
+   if (filebehave == FILE_GZIP) {
nr = gzread(gzbufdesc, buffer, MAXBUFSIZ);
-   else if (filebehave == FILE_BZIP  bzbufdesc != NULL) {
+#ifndef WITHOUT_BZIP2
+   } else if (filebehave == FILE_BZIP  bzbufdesc != NULL) {
+   int bzerr;
+
nr = BZ2_bzRead(bzerr, bzbufdesc, buffer, MAXBUFSIZ);
switch (bzerr) {
case BZ_OK:
@@ -108,6 +115,7 @@ grep_refill(struct file *f)
/* Make sure we exit with an error */
nr = -1;
}
+#endif
} else if ((filebehave == FILE_XZ) || (filebehave == FILE_LZMA)) {
lzma_action action = LZMA_RUN;
uint8_t in_buf[MAXBUFSIZ];
@@ -271,9 +279,11 @@ grep_open(const char *path)
(gzbufdesc = gzdopen(f-fd, r)) == NULL)
goto error2;
 
+#ifndef WITHOUT_BZIP2
if (filebehave == FILE_BZIP 
(bzbufdesc = BZ2_bzdopen(f-fd, r)) == NULL)
goto error2;
+#endif
 
/* Fill read buffer, also catches errors early */
if (bufrem == 0  grep_refill(f) != 0)

Modified: head/usr.bin/grep/grep.c
==
--- head/usr.bin/grep/grep.cTue Oct 11 21:52:24 2011(r226270)
+++ head/usr.bin/grep/grep.cTue Oct 11 22:27:23 2011(r226271)
@@ -150,15 +150,13 @@ bool   prev;  /* flag whether or not the 
 int tail;  /* lines left to print */
 boolnotfound;  /* file not found */
 
-extern char*__progname;
-
 /*
  * Prints usage information and returns 2.
  */
 static void
 usage(void)
 {
-   fprintf(stderr, getstr(4), __progname);
+   fprintf(stderr, getstr(4), 

Re: svn commit: r226266 - head/sbin/tunefs

2011-10-11 Thread Alexander Best
On Tue Oct 11 11, Kirk McKusick wrote:
 Author: mckusick
 Date: Tue Oct 11 19:03:57 2011
 New Revision: 226266
 URL: http://svn.freebsd.org/changeset/base/226266
 
 Log:
   After creating a filesystem using newfs -j the time stamps are all
   zero and thus report as having been made in January 1970. Apart
   from looking a bit silly, it also triggers alarms from scripts
   that detect weird time stamps. This update sets all 4 (or 3, in
   the case of UFS1) time stamps to the current time when enabling
   journaling during newfs or later when enabling it with tunefs.

on an already existing UFS2 fs with SU+SUJ enabled, will a `touch .sujournal`
also set those 4 time stamps to sensible values, or will this somehow break
the journal?

cheers.
alex

   
   Reported by: Hans Ottevanger h...@beastielabs.net
   MFC after:   1 week
 
 Modified:
   head/sbin/tunefs/tunefs.c
 
 Modified: head/sbin/tunefs/tunefs.c
 ==
 --- head/sbin/tunefs/tunefs.c Tue Oct 11 18:46:41 2011(r226265)
 +++ head/sbin/tunefs/tunefs.c Tue Oct 11 19:03:57 2011(r226266)
 @@ -64,6 +64,7 @@ __FBSDID($FreeBSD$);
  #include stdlib.h
  #include stdint.h
  #include string.h
 +#include time.h
  #include unistd.h
  
  /* the optimization warning string template */
 @@ -923,6 +924,7 @@ journal_alloc(int64_t size)
   ino_t ino;
   int blks;
   int mode;
 + time_t utime;
   int i;
  
   cgp = disk.d_cg;
 @@ -983,18 +985,26 @@ journal_alloc(int64_t size)
*/
   dp2 = ip;
   dp1 = ip;
 + time(utime);
   if (sblock.fs_magic == FS_UFS1_MAGIC) {
   bzero(dp1, sizeof(*dp1));
   dp1-di_size = size;
   dp1-di_mode = IFREG | IREAD;
   dp1-di_nlink = 1;
   dp1-di_flags = SF_IMMUTABLE | SF_NOUNLINK | UF_NODUMP;
 + dp1-di_atime = utime;
 + dp1-di_mtime = utime;
 + dp1-di_ctime = utime;
   } else {
   bzero(dp2, sizeof(*dp2));
   dp2-di_size = size;
   dp2-di_mode = IFREG | IREAD;
   dp2-di_nlink = 1;
   dp2-di_flags = SF_IMMUTABLE | SF_NOUNLINK | UF_NODUMP;
 + dp2-di_atime = utime;
 + dp2-di_mtime = utime;
 + dp2-di_ctime = utime;
 + dp2-di_birthtime = utime;
   }
   for (i = 0; i  NDADDR  resid; i++, resid--) {
   blk = journal_balloc();
___
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: r226157 - head/usr.bin/kdump

2011-10-11 Thread Dag-Erling Smørgrav
Garrett Cooper yaneg...@gmail.com writes:
 Seeing that you've committed quite a bit to kdump recently, could
 you please take a look at
 http://www.freebsd.org/cgi/query-pr.cgi?pr=161478 ?

Hmm, did you run across this while testing your patch?

% make
cc -O2 -pipe  -I/usr/src/usr.bin/kdump/../ktrace -I/usr/src/usr.bin/kdump 
-I/usr/src/usr.bin/kdump/../.. -I. -g -std=gnu99 -fstack-protector 
-Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter 
-Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type 
-Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align 
-Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls 
-Wold-style-definition -Wno-pointer-sign -c ioctl.c
cc1: warnings being treated as errors
In file included from ioctl.c:80:
/usr/include/netinet/ip_fil.h:1284: warning: redundant redeclaration of 
'bcopywrap'
/usr/include/netinet/ip_compat.h:1543: warning: previous declaration of 
'bcopywrap' was here
*** Error code 1

Stop in /usr/src/usr.bin/kdump.

I don't understand why it complains, since both declarations are
identical, modulo whitespace:

% grep -r bcopywrap /usr/include/netinet
/usr/include/netinet/ip_fil.h:extern int  bcopywrap __P((void *, void 
*, size_t));
/usr/include/netinet/ip_compat.h:# defineCOPYIN(a,b,c)  bcopywrap((a), (b), 
(c))
/usr/include/netinet/ip_compat.h:# defineCOPYOUT(a,b,c) bcopywrap((a), (b), 
(c))
/usr/include/netinet/ip_compat.h:extern  intbcopywrap __P((void 
*, void *, size_t));
% make DEBUG_FLAGS=-g -save-temps
[...]
% grep bcopywrap /usr/obj/usr/src/usr.bin/kdump/ioctl.i
extern int bcopywrap (void *, void *, size_t);
extern int bcopywrap (void *, void *, size_t);

BTW, the extern keyword is completely pointless, since it is implicit
for functions.

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
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: r226157 - head/usr.bin/kdump

2011-10-11 Thread Garrett Cooper
2011/10/11 Dag-Erling Smørgrav d...@des.no:
 Garrett Cooper yaneg...@gmail.com writes:
 Seeing that you've committed quite a bit to kdump recently, could
 you please take a look at
 http://www.freebsd.org/cgi/query-pr.cgi?pr=161478 ?

 Hmm, did you run across this while testing your patch?

 % make
 cc -O2 -pipe  -I/usr/src/usr.bin/kdump/../ktrace -I/usr/src/usr.bin/kdump 
 -I/usr/src/usr.bin/kdump/../.. -I. -g -std=gnu99 -fstack-protector 
 -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter 
 -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type 
 -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align 
 -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls 
 -Wold-style-definition -Wno-pointer-sign -c ioctl.c
 cc1: warnings being treated as errors
 In file included from ioctl.c:80:
 /usr/include/netinet/ip_fil.h:1284: warning: redundant redeclaration of 
 'bcopywrap'
 /usr/include/netinet/ip_compat.h:1543: warning: previous declaration of 
 'bcopywrap' was here
 *** Error code 1

 Stop in /usr/src/usr.bin/kdump.

 I don't understand why it complains, since both declarations are
 identical, modulo whitespace:

 % grep -r bcopywrap /usr/include/netinet
 /usr/include/netinet/ip_fil.h:extern         int  bcopywrap __P((void *, void 
 *, size_t));
 /usr/include/netinet/ip_compat.h:# define    COPYIN(a,b,c)  bcopywrap((a), 
 (b), (c))
 /usr/include/netinet/ip_compat.h:# define    COPYOUT(a,b,c) bcopywrap((a), 
 (b), (c))
 /usr/include/netinet/ip_compat.h:extern      int            bcopywrap 
 __P((void *, void *, size_t));
 % make DEBUG_FLAGS=-g -save-temps
 [...]
 % grep bcopywrap /usr/obj/usr/src/usr.bin/kdump/ioctl.i
 extern int bcopywrap (void *, void *, size_t);
 extern int bcopywrap (void *, void *, size_t);

 BTW, the extern keyword is completely pointless, since it is implicit
 for functions.

I didn't run into that particular issue, but then again.. it looks
like it hasn't been generating my files properly (which seems like a
Makefile bug because all of the generated files should be cleaned with
make clean).
-Garrett
___
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: r226273 - head/usr.bin/grep

2011-10-11 Thread Gabor Kovesdan
Author: gabor
Date: Wed Oct 12 01:09:57 2011
New Revision: 226273
URL: http://svn.freebsd.org/changeset/base/226273

Log:
  - Fix counting of match limit (-m)
  
  Reported by:  Nali Toja nalit...@gmail.com
  Approved by:  delphij (mentor)

Modified:
  head/usr.bin/grep/util.c

Modified: head/usr.bin/grep/util.c
==
--- head/usr.bin/grep/util.cWed Oct 12 00:17:43 2011(r226272)
+++ head/usr.bin/grep/util.cWed Oct 12 01:09:57 2011(r226273)
@@ -233,7 +233,7 @@ procfile(const char *fn)
linesqueued++;
}
c += t;
-   if (mflag  mcount  0)
+   if (mflag  mcount = 0)
break;
}
if (Bflag  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


svn commit: r226274 - head/usr.bin/newgrp

2011-10-11 Thread Xin LI
Author: delphij
Date: Wed Oct 12 01:19:12 2011
New Revision: 226274
URL: http://svn.freebsd.org/changeset/base/226274

Log:
   - Fix an off-by-one bug in addgroup().
   - Fix the error message when setgid() failed.
  
  PR:   bin/161509
  Submitted by: Jeremy Huddleston jeremyhu apple com
  MFC after:2 weeks

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

Modified: head/usr.bin/newgrp/newgrp.c
==
--- head/usr.bin/newgrp/newgrp.cWed Oct 12 01:09:57 2011
(r226273)
+++ head/usr.bin/newgrp/newgrp.cWed Oct 12 01:19:12 2011
(r226274)
@@ -140,7 +140,7 @@ restoregrps(void)
if (initres  0)
warn(initgroups);
if (setres  0)
-   warn(setgroups);
+   warn(setgid);
 }
 
 static void
@@ -220,7 +220,7 @@ addgroup(const char *grpname)
 
/* Add old effective gid to supp. list if it does not exist. */
if (egid != grp-gr_gid  !inarray(egid, grps, ngrps)) {
-   if (ngrps == ngrps_max)
+   if (ngrps + 1 = ngrps_max)
warnx(too many groups);
else {
grps[ngrps++] = egid;
___
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: r226277 - head/etc

2011-10-11 Thread Colin Percival
Author: cperciva
Date: Wed Oct 12 03:29:12 2011
New Revision: 226277
URL: http://svn.freebsd.org/changeset/base/226277

Log:
  Now that the portsnap buildbox is generating the raw bits for INDEX-9,
  add it to the set of INDEX files built by portsnap.

Modified:
  head/etc/portsnap.conf

Modified: head/etc/portsnap.conf
==
--- head/etc/portsnap.conf  Wed Oct 12 01:57:39 2011(r226276)
+++ head/etc/portsnap.conf  Wed Oct 12 03:29:12 2011(r226277)
@@ -32,3 +32,4 @@ KEYPRINT=9b5feee6d69f170e3dd0a2c8e469ddb
 # List of INDEX files to build and the DESCRIBE file to use for each
 INDEX INDEX-7 DESCRIBE.7
 INDEX INDEX-8 DESCRIBE.8
+INDEX INDEX-9 DESCRIBE.9
___
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