Re: svn commit: r228616 - head/usr.bin/tar

2011-12-17 Thread Kostik Belousov
On Sat, Dec 17, 2011 at 01:36:51AM +, Dimitry Andric wrote:
 Author: dim
 Date: Sat Dec 17 01:36:50 2011
 New Revision: 228616
 URL: http://svn.freebsd.org/changeset/base/228616
 
 Log:
   In usr.bin/tar/tree.c, if you really want to poke to NULL, you must use
   volatile, otherwise the indirection will not be emitted.
   
   MFC after:  1 week
 
 Modified:
   head/usr.bin/tar/tree.c
 
 Modified: head/usr.bin/tar/tree.c
 ==
 --- head/usr.bin/tar/tree.c   Sat Dec 17 01:29:46 2011(r228615)
 +++ head/usr.bin/tar/tree.c   Sat Dec 17 01:36:50 2011(r228616)
 @@ -315,7 +315,7 @@ tree_next(struct tree *t)
   const char *msg = Unable to continue traversing
directory hierarchy after a fatal error.;
   write(2, msg, strlen(msg));
 - *(int *)0 = 1; /* Deliberate SEGV; NULL pointer dereference. */
 + *(volatile int *)0 = 1; /* Deliberate SEGV; NULL pointer 
 dereference. */
   exit(1); /* In case the SEGV didn't work. */
   }
  
Why this hack is used instead of abort(3) or abort2(2) ?


pgpbz6mmAicxU.pgp
Description: PGP signature


svn commit: r228621 - in head/sys: dev/an dev/ath dev/bwi dev/bwn dev/if_ndis dev/ipw dev/iwi dev/iwn dev/malo dev/mwl dev/ral dev/usb/wlan dev/wi dev/wpi net80211

2011-12-17 Thread Bernhard Schmidt
Author: bschmidt
Date: Sat Dec 17 10:23:17 2011
New Revision: 228621
URL: http://svn.freebsd.org/changeset/base/228621

Log:
  Fix some net80211 enum nits:
  - ic_vap_create() uses an ieee80211_opmode argument
  - ieee80211_rate2media() takes an ieee80211_phymode argument
  - ieee80211_plcp2rate() takes an ieee80211_phytype argument
  - cast to enum ieee80211_protmode and ieee80211_roamingmode to silence
compiler warnings
  
  Submitted by: arundel@

Modified:
  head/sys/dev/an/if_an.c
  head/sys/dev/ath/if_ath.c
  head/sys/dev/bwi/if_bwi.c
  head/sys/dev/bwn/if_bwn.c
  head/sys/dev/if_ndis/if_ndis.c
  head/sys/dev/ipw/if_ipw.c
  head/sys/dev/iwi/if_iwi.c
  head/sys/dev/iwn/if_iwn.c
  head/sys/dev/malo/if_malo.c
  head/sys/dev/mwl/if_mwl.c
  head/sys/dev/ral/rt2560.c
  head/sys/dev/ral/rt2661.c
  head/sys/dev/usb/wlan/if_rum.c
  head/sys/dev/usb/wlan/if_run.c
  head/sys/dev/usb/wlan/if_uath.c
  head/sys/dev/usb/wlan/if_upgt.c
  head/sys/dev/usb/wlan/if_ural.c
  head/sys/dev/usb/wlan/if_urtw.c
  head/sys/dev/usb/wlan/if_zyd.c
  head/sys/dev/wi/if_wi.c
  head/sys/dev/wpi/if_wpi.c
  head/sys/net80211/ieee80211.c
  head/sys/net80211/ieee80211_ht.c
  head/sys/net80211/ieee80211_ioctl.c
  head/sys/net80211/ieee80211_var.h

Modified: head/sys/dev/an/if_an.c
==
--- head/sys/dev/an/if_an.c Sat Dec 17 06:57:35 2011(r228620)
+++ head/sys/dev/an/if_an.c Sat Dec 17 10:23:17 2011(r228621)
@@ -797,7 +797,7 @@ an_attach(struct an_softc *sc, int flags
ADD(IFM_AUTO, IFM_IEEE80211_ADHOC);
for (i = 0; i  nrate; i++) {
r = sc-an_caps.an_rates[i];
-   mword = ieee80211_rate2media(NULL, r, IEEE80211_T_DS);
+   mword = ieee80211_rate2media(NULL, r, IEEE80211_MODE_AUTO);
if (mword == 0)
continue;
printf(%s%d%sMbps, (i != 0 ?   : ),
@@ -3299,7 +3299,7 @@ an_media_status(struct ifnet *ifp, struc
if (sc-an_config.an_opmode == AN_OPMODE_IBSS_ADHOC)
imr-ifm_active |= IFM_IEEE80211_ADHOC;
imr-ifm_active |= ieee80211_rate2media(NULL,
-   status.an_current_tx_rate, IEEE80211_T_DS);
+   status.an_current_tx_rate, IEEE80211_MODE_AUTO);
imr-ifm_status = IFM_AVALID;
if (status.an_opmode  AN_STATUS_OPMODE_ASSOCIATED)
imr-ifm_status |= IFM_ACTIVE;

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Sat Dec 17 06:57:35 2011(r228620)
+++ head/sys/dev/ath/if_ath.c   Sat Dec 17 10:23:17 2011(r228621)
@@ -128,9 +128,9 @@ __FBSDID($FreeBSD$);
 CTASSERT(ATH_BCBUF = 8);
 
 static struct ieee80211vap *ath_vap_create(struct ieee80211com *,
-   const char name[IFNAMSIZ], int unit, int opmode,
-   int flags, const uint8_t bssid[IEEE80211_ADDR_LEN],
-   const uint8_t mac[IEEE80211_ADDR_LEN]);
+   const char [IFNAMSIZ], int, enum ieee80211_opmode, int,
+   const uint8_t [IEEE80211_ADDR_LEN],
+   const uint8_t [IEEE80211_ADDR_LEN]);
 static voidath_vap_delete(struct ieee80211vap *);
 static voidath_init(void *);
 static voidath_stop_locked(struct ifnet *);
@@ -885,16 +885,17 @@ assign_bslot(struct ath_softc *sc)
 }
 
 static struct ieee80211vap *
-ath_vap_create(struct ieee80211com *ic,
-   const char name[IFNAMSIZ], int unit, int opmode, int flags,
-   const uint8_t bssid[IEEE80211_ADDR_LEN],
-   const uint8_t mac0[IEEE80211_ADDR_LEN])
+ath_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit,
+enum ieee80211_opmode opmode, int flags,
+const uint8_t bssid[IEEE80211_ADDR_LEN],
+const uint8_t mac0[IEEE80211_ADDR_LEN])
 {
struct ath_softc *sc = ic-ic_ifp-if_softc;
struct ath_vap *avp;
struct ieee80211vap *vap;
uint8_t mac[IEEE80211_ADDR_LEN];
-   int ic_opmode, needbeacon, error;
+   int needbeacon, error;
+   enum ieee80211_opmode ic_opmode;
 
avp = (struct ath_vap *) malloc(sizeof(struct ath_vap),
M_80211_VAP, M_WAITOK | M_ZERO);

Modified: head/sys/dev/bwi/if_bwi.c
==
--- head/sys/dev/bwi/if_bwi.c   Sat Dec 17 06:57:35 2011(r228620)
+++ head/sys/dev/bwi/if_bwi.c   Sat Dec 17 10:23:17 2011(r228621)
@@ -96,9 +96,9 @@ struct bwi_myaddr_bssid {
 } __packed;
 
 static struct ieee80211vap *bwi_vap_create(struct ieee80211com *,
-  const char [IFNAMSIZ], int, int, int,
-  const uint8_t [IEEE80211_ADDR_LEN],
-  const uint8_t [IEEE80211_ADDR_LEN]);
+   const char [IFNAMSIZ], int, enum ieee80211_opmode, int,
+   const uint8_t [IEEE80211_ADDR_LEN],
+   const uint8_t 

svn commit: r228622 - head/sys/net80211

2011-12-17 Thread Bernhard Schmidt
Author: bschmidt
Date: Sat Dec 17 10:32:31 2011
New Revision: 228622
URL: http://svn.freebsd.org/changeset/base/228622

Log:
  Remove now redundant mac argument.
  
  Discussed with:   adrian@

Modified:
  head/sys/net80211/ieee80211_acl.c
  head/sys/net80211/ieee80211_hostap.c
  head/sys/net80211/ieee80211_mesh.c
  head/sys/net80211/ieee80211_proto.h

Modified: head/sys/net80211/ieee80211_acl.c
==
--- head/sys/net80211/ieee80211_acl.c   Sat Dec 17 10:23:17 2011
(r228621)
+++ head/sys/net80211/ieee80211_acl.c   Sat Dec 17 10:32:31 2011
(r228622)
@@ -152,8 +152,7 @@ _acl_free(struct aclstate *as, struct ac
 }
 
 static int
-acl_check(struct ieee80211vap *vap, const struct ieee80211_frame *wh,
-const uint8_t mac[IEEE80211_ADDR_LEN])
+acl_check(struct ieee80211vap *vap, const struct ieee80211_frame *wh)
 {
struct aclstate *as = vap-iv_as;
 
@@ -162,9 +161,9 @@ acl_check(struct ieee80211vap *vap, cons
case ACL_POLICY_RADIUS:
return 1;
case ACL_POLICY_ALLOW:
-   return _find_acl(as, mac) != NULL;
+   return _find_acl(as, wh-i_addr2) != NULL;
case ACL_POLICY_DENY:
-   return _find_acl(as, mac) == NULL;
+   return _find_acl(as, wh-i_addr2) == NULL;
}
return 0;   /* should not happen */
 }

Modified: head/sys/net80211/ieee80211_hostap.c
==
--- head/sys/net80211/ieee80211_hostap.cSat Dec 17 10:23:17 2011
(r228621)
+++ head/sys/net80211/ieee80211_hostap.cSat Dec 17 10:32:31 2011
(r228622)
@@ -1797,8 +1797,7 @@ hostap_recv_mgmt(struct ieee80211_node *
/*
 * Consult the ACL policy module if setup.
 */
-   if (vap-iv_acl != NULL 
-   !vap-iv_acl-iac_check(vap, wh, wh-i_addr2)) {
+   if (vap-iv_acl != NULL  !vap-iv_acl-iac_check(vap, wh)) {
IEEE80211_DISCARD(vap, IEEE80211_MSG_ACL,
wh, NULL, %s, disallowed by ACL);
vap-iv_stats.is_rx_acl++;
@@ -1883,8 +1882,7 @@ hostap_recv_mgmt(struct ieee80211_node *
/*
 * Consult the ACL policy module if setup.
 */
-   if (vap-iv_acl != NULL 
-   !vap-iv_acl-iac_check(vap, wh, wh-i_addr2)) {
+   if (vap-iv_acl != NULL  !vap-iv_acl-iac_check(vap, wh)) {
IEEE80211_DISCARD(vap, IEEE80211_MSG_ACL,
wh, NULL, %s, disallowed by ACL);
vap-iv_stats.is_rx_acl++;

Modified: head/sys/net80211/ieee80211_mesh.c
==
--- head/sys/net80211/ieee80211_mesh.c  Sat Dec 17 10:23:17 2011
(r228621)
+++ head/sys/net80211/ieee80211_mesh.c  Sat Dec 17 10:32:31 2011
(r228622)
@@ -1120,8 +1120,7 @@ mesh_input(struct ieee80211_node *ni, st
 *
 * NB: this check is also done upon peering link initiation.
 */
-   if (vap-iv_acl != NULL 
-   !vap-iv_acl-iac_check(vap, wh, wh-i_addr2)) {
+   if (vap-iv_acl != NULL  !vap-iv_acl-iac_check(vap, wh)) {
IEEE80211_DISCARD(vap, IEEE80211_MSG_ACL,
wh, NULL, %s, disallowed by ACL);
vap-iv_stats.is_rx_acl++;
@@ -1379,8 +1378,7 @@ mesh_recv_mgmt(struct ieee80211_node *ni
/*
 * Peer only based on the current ACL policy.
 */
-   if (vap-iv_acl != NULL 
-   !vap-iv_acl-iac_check(vap, wh, wh-i_addr2)) {
+   if (vap-iv_acl != NULL  !vap-iv_acl-iac_check(vap, wh)) {
IEEE80211_DISCARD(vap, IEEE80211_MSG_ACL,
wh, NULL, %s, disallowed by ACL);
vap-iv_stats.is_rx_acl++;

Modified: head/sys/net80211/ieee80211_proto.h
==
--- head/sys/net80211/ieee80211_proto.h Sat Dec 17 10:23:17 2011
(r228621)
+++ head/sys/net80211/ieee80211_proto.h Sat Dec 17 10:32:31 2011
(r228622)
@@ -215,8 +215,7 @@ struct ieee80211_aclator {
int (*iac_attach)(struct ieee80211vap *);
void(*iac_detach)(struct ieee80211vap *);
int (*iac_check)(struct ieee80211vap *,
-   const struct ieee80211_frame *wh,
-   const uint8_t mac[IEEE80211_ADDR_LEN]);
+   const struct ieee80211_frame *wh);
int (*iac_add)(struct ieee80211vap *,
const uint8_t mac[IEEE80211_ADDR_LEN]);
int (*iac_remove)(struct ieee80211vap *,
___
svn-src-all@freebsd.org mailing list

Re: svn commit: r228621 - in head/sys: dev/an dev/ath dev/bwi dev/bwn dev/if_ndis dev/ipw dev/iwi dev/iwn dev/malo dev/mwl dev/ral dev/usb/wlan dev/wi dev/wpi net80211

2011-12-17 Thread Alexander Best
On Sat Dec 17 11, Bernhard Schmidt wrote:
 Author: bschmidt
 Date: Sat Dec 17 10:23:17 2011
 New Revision: 228621
 URL: http://svn.freebsd.org/changeset/base/228621
 
 Log:
   Fix some net80211 enum nits:
   - ic_vap_create() uses an ieee80211_opmode argument
   - ieee80211_rate2media() takes an ieee80211_phymode argument
   - ieee80211_plcp2rate() takes an ieee80211_phytype argument
   - cast to enum ieee80211_protmode and ieee80211_roamingmode to silence
 compiler warnings
   
   Submitted by:   arundel@

actually i merely submitted a problem report via kern/162475. ;) i didn't write 
a
single patch. so all the credit goes to bernhard. :)

 
 Modified:
   head/sys/dev/an/if_an.c
   head/sys/dev/ath/if_ath.c
   head/sys/dev/bwi/if_bwi.c
   head/sys/dev/bwn/if_bwn.c
   head/sys/dev/if_ndis/if_ndis.c
   head/sys/dev/ipw/if_ipw.c
   head/sys/dev/iwi/if_iwi.c
   head/sys/dev/iwn/if_iwn.c
   head/sys/dev/malo/if_malo.c
   head/sys/dev/mwl/if_mwl.c
   head/sys/dev/ral/rt2560.c
   head/sys/dev/ral/rt2661.c
   head/sys/dev/usb/wlan/if_rum.c
   head/sys/dev/usb/wlan/if_run.c
   head/sys/dev/usb/wlan/if_uath.c
   head/sys/dev/usb/wlan/if_upgt.c
   head/sys/dev/usb/wlan/if_ural.c
   head/sys/dev/usb/wlan/if_urtw.c
   head/sys/dev/usb/wlan/if_zyd.c
   head/sys/dev/wi/if_wi.c
   head/sys/dev/wpi/if_wpi.c
   head/sys/net80211/ieee80211.c
   head/sys/net80211/ieee80211_ht.c
   head/sys/net80211/ieee80211_ioctl.c
   head/sys/net80211/ieee80211_var.h
 
 Modified: head/sys/dev/an/if_an.c
 ==
 --- head/sys/dev/an/if_an.c   Sat Dec 17 06:57:35 2011(r228620)
 +++ head/sys/dev/an/if_an.c   Sat Dec 17 10:23:17 2011(r228621)
 @@ -797,7 +797,7 @@ an_attach(struct an_softc *sc, int flags
   ADD(IFM_AUTO, IFM_IEEE80211_ADHOC);
   for (i = 0; i  nrate; i++) {
   r = sc-an_caps.an_rates[i];
 - mword = ieee80211_rate2media(NULL, r, IEEE80211_T_DS);
 + mword = ieee80211_rate2media(NULL, r, IEEE80211_MODE_AUTO);
   if (mword == 0)
   continue;
   printf(%s%d%sMbps, (i != 0 ?   : ),
 @@ -3299,7 +3299,7 @@ an_media_status(struct ifnet *ifp, struc
   if (sc-an_config.an_opmode == AN_OPMODE_IBSS_ADHOC)
   imr-ifm_active |= IFM_IEEE80211_ADHOC;
   imr-ifm_active |= ieee80211_rate2media(NULL,
 - status.an_current_tx_rate, IEEE80211_T_DS);
 + status.an_current_tx_rate, IEEE80211_MODE_AUTO);
   imr-ifm_status = IFM_AVALID;
   if (status.an_opmode  AN_STATUS_OPMODE_ASSOCIATED)
   imr-ifm_status |= IFM_ACTIVE;
 
 Modified: head/sys/dev/ath/if_ath.c
 ==
 --- head/sys/dev/ath/if_ath.c Sat Dec 17 06:57:35 2011(r228620)
 +++ head/sys/dev/ath/if_ath.c Sat Dec 17 10:23:17 2011(r228621)
 @@ -128,9 +128,9 @@ __FBSDID($FreeBSD$);
  CTASSERT(ATH_BCBUF = 8);
  
  static struct ieee80211vap *ath_vap_create(struct ieee80211com *,
 - const char name[IFNAMSIZ], int unit, int opmode,
 - int flags, const uint8_t bssid[IEEE80211_ADDR_LEN],
 - const uint8_t mac[IEEE80211_ADDR_LEN]);
 + const char [IFNAMSIZ], int, enum ieee80211_opmode, int,
 + const uint8_t [IEEE80211_ADDR_LEN],
 + const uint8_t [IEEE80211_ADDR_LEN]);
  static void  ath_vap_delete(struct ieee80211vap *);
  static void  ath_init(void *);
  static void  ath_stop_locked(struct ifnet *);
 @@ -885,16 +885,17 @@ assign_bslot(struct ath_softc *sc)
  }
  
  static struct ieee80211vap *
 -ath_vap_create(struct ieee80211com *ic,
 - const char name[IFNAMSIZ], int unit, int opmode, int flags,
 - const uint8_t bssid[IEEE80211_ADDR_LEN],
 - const uint8_t mac0[IEEE80211_ADDR_LEN])
 +ath_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], int unit,
 +enum ieee80211_opmode opmode, int flags,
 +const uint8_t bssid[IEEE80211_ADDR_LEN],
 +const uint8_t mac0[IEEE80211_ADDR_LEN])
  {
   struct ath_softc *sc = ic-ic_ifp-if_softc;
   struct ath_vap *avp;
   struct ieee80211vap *vap;
   uint8_t mac[IEEE80211_ADDR_LEN];
 - int ic_opmode, needbeacon, error;
 + int needbeacon, error;
 + enum ieee80211_opmode ic_opmode;
  
   avp = (struct ath_vap *) malloc(sizeof(struct ath_vap),
   M_80211_VAP, M_WAITOK | M_ZERO);
 
 Modified: head/sys/dev/bwi/if_bwi.c
 ==
 --- head/sys/dev/bwi/if_bwi.c Sat Dec 17 06:57:35 2011(r228620)
 +++ head/sys/dev/bwi/if_bwi.c Sat Dec 17 10:23:17 2011(r228621)
 @@ -96,9 +96,9 @@ struct bwi_myaddr_bssid {
  } __packed;
  
  static struct ieee80211vap *bwi_vap_create(struct ieee80211com *,
 -const char [IFNAMSIZ], int, int, int,
 -const uint8_t [IEEE80211_ADDR_LEN],
 -

svn commit: r228623 - head/contrib/bsnmp/snmp_mibII

2011-12-17 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Dec 17 11:06:22 2011
New Revision: 228623
URL: http://svn.freebsd.org/changeset/base/228623

Log:
  Adter r228571 unbreak architectures with strict alignment rules
  by copying rather than casting.

Modified:
  head/contrib/bsnmp/snmp_mibII/mibII.c

Modified: head/contrib/bsnmp/snmp_mibII/mibII.c
==
--- head/contrib/bsnmp/snmp_mibII/mibII.c   Sat Dec 17 10:32:31 2011
(r228622)
+++ head/contrib/bsnmp/snmp_mibII/mibII.c   Sat Dec 17 11:06:22 2011
(r228623)
@@ -941,7 +941,7 @@ handle_rtmsg(struct rt_msghdr *rtm)
 {
struct sockaddr *addrs[RTAX_MAX];
struct if_msghdr *ifm;
-   struct ifa_msghdr *ifam;
+   struct ifa_msghdr ifam;
struct ifma_msghdr *ifmam;
 #ifdef RTM_IFANNOUNCE
struct if_announcemsghdr *ifan;
@@ -961,17 +961,17 @@ handle_rtmsg(struct rt_msghdr *rtm)
switch (rtm-rtm_type) {
 
  case RTM_NEWADDR:
-   ifam = (struct ifa_msghdr *)rtm;
-   mib_extract_addrs(ifam-ifam_addrs, (u_char *)(ifam + 1), 
addrs);
+   memcpy(ifam, rtm, sizeof(ifam));
+   mib_extract_addrs(ifam.ifam_addrs, (u_char *)(ifam + 1), 
addrs);
if (addrs[RTAX_IFA] == NULL || addrs[RTAX_NETMASK] == NULL)
break;
 
sa = (struct sockaddr_in *)(void *)addrs[RTAX_IFA];
if ((ifa = mib_find_ifa(sa-sin_addr)) == NULL) {
/* unknown address */
-   if ((ifp = mib_find_if_sys(ifam-ifam_index)) == NULL) {
+   if ((ifp = mib_find_if_sys(ifam.ifam_index)) == NULL) {
syslog(LOG_WARNING, RTM_NEWADDR for unknown 
-   interface %u, ifam-ifam_index);
+   interface %u, ifam.ifam_index);
break;
}
if ((ifa = alloc_ifa(ifp-index, sa-sin_addr)) == NULL)
@@ -988,8 +988,8 @@ handle_rtmsg(struct rt_msghdr *rtm)
break;
 
  case RTM_DELADDR:
-   ifam = (struct ifa_msghdr *)rtm;
-   mib_extract_addrs(ifam-ifam_addrs, (u_char *)(ifam + 1), 
addrs);
+   memcpy(ifam, rtm, sizeof(ifam));
+   mib_extract_addrs(ifam.ifam_addrs, (u_char *)(ifam + 1), 
addrs);
if (addrs[RTAX_IFA] == NULL)
break;
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r228614 - head/sbin/dhclient

2011-12-17 Thread Joerg Sonnenberger
On Sat, Dec 17, 2011 at 01:19:07AM +, Dimitry Andric wrote:
 Log:
   In sbin/dhclient, work around warnings about the size argument to
   strlcpy appearing to be the size of the source buffer, instead of the
   destination.

If you touch this and don't want to use strdup-like functions, at least
make it a memcpy. strlcpy is very crappy from a performance PoV...

Joerg
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r228616 - head/usr.bin/tar

2011-12-17 Thread Dimitry Andric
On 2011-12-17 09:33, Kostik Belousov wrote:
  const char *msg = Unable to continue traversing
   directory hierarchy after a fatal error.;
  write(2, msg, strlen(msg));
 -*(int *)0 = 1; /* Deliberate SEGV; NULL pointer dereference. */
 +*(volatile int *)0 = 1; /* Deliberate SEGV; NULL pointer 
 dereference. */
  exit(1); /* In case the SEGV didn't work. */
  }
  
 Why this hack is used instead of abort(3) or abort2(2) ?

No idea, but it seems to be done that way now in upstream:

http://code.google.com/p/libarchive/source/browse/trunk/tar/tree.c#423

I didn't want to change the intent of the code at this time, just fix
warnings.  Maybe Tim will import another drop of libarchive soon.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228624 - head/contrib/bzip2

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sat Dec 17 12:52:58 2011
New Revision: 228624
URL: http://svn.freebsd.org/changeset/base/228624

Log:
  In contrib/bzip2/bzip2recover.c, use the correct printf length modifier
  for unsigned long long.
  
  MFC after:1 week

Modified:
  head/contrib/bzip2/bzip2recover.c

Modified: head/contrib/bzip2/bzip2recover.c
==
--- head/contrib/bzip2/bzip2recover.c   Sat Dec 17 11:06:22 2011
(r228623)
+++ head/contrib/bzip2/bzip2recover.c   Sat Dec 17 12:52:58 2011
(r228624)
@@ -37,7 +37,7 @@
 */
 #ifdef __GNUC__
typedef  unsigned long long int  MaybeUInt64;
-#  define MaybeUInt64_FMT %Lu
+#  define MaybeUInt64_FMT %llu
 #else
 #ifdef _MSC_VER
typedef  unsigned __int64  MaybeUInt64;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228625 - head/usr.bin/csup

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sat Dec 17 13:14:44 2011
New Revision: 228625
URL: http://svn.freebsd.org/changeset/base/228625

Log:
  In usr.bin/csup/auth.c, use the correct number of bytes for zeroing the
  shared secret, and use long long format to snprintf a time_t.
  
  MFC after:1 week

Modified:
  head/usr.bin/csup/auth.c

Modified: head/usr.bin/csup/auth.c
==
--- head/usr.bin/csup/auth.cSat Dec 17 12:52:58 2011(r228624)
+++ head/usr.bin/csup/auth.cSat Dec 17 13:14:44 2011(r228625)
@@ -254,7 +254,7 @@ auth_makesecret(struct srvrecord *auth, 
MD5_Update(md5, :, 1);
MD5_Update(md5, auth-password, strlen(auth-password));
MD5_Final(md5sum, md5);
-   memset(secret, 0, sizeof(secret));
+   memset(secret, 0, MD5_CHARS_MAX);
strcpy(secret, md5salt);
auth_readablesum(md5sum, secret + strlen(md5salt));
 }
@@ -302,8 +302,9 @@ auth_makechallenge(struct config *config
}
gettimeofday(tv, NULL);
MD5_Init(md5);
-   snprintf(buf, sizeof(buf), %s:%ld:%ld:%ld:%d:%d,
-   inet_ntoa(laddr.sin_addr), tv.tv_sec, tv.tv_usec, random(), pid, 
ppid);
+   snprintf(buf, sizeof(buf), %s:%lld:%ld:%ld:%d:%d,
+   inet_ntoa(laddr.sin_addr), (long long)tv.tv_sec, tv.tv_usec,
+   random(), pid, ppid);
MD5_Update(md5, buf, strlen(buf));
MD5_Final(md5sum, md5);
auth_readablesum(md5sum, challenge);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228626 - head/usr.bin/csup

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sat Dec 17 13:52:53 2011
New Revision: 228626
URL: http://svn.freebsd.org/changeset/base/228626

Log:
  In usr.bin/csup/proto.c, use the correct printf length modifier to print
  an off_t.
  
  MFC after:1 week

Modified:
  head/usr.bin/csup/proto.c

Modified: head/usr.bin/csup/proto.c
==
--- head/usr.bin/csup/proto.c   Sat Dec 17 13:14:44 2011(r228625)
+++ head/usr.bin/csup/proto.c   Sat Dec 17 13:52:53 2011(r228626)
@@ -35,6 +35,7 @@
 #include assert.h
 #include err.h
 #include errno.h
+#include inttypes.h
 #include netdb.h
 #include pthread.h
 #include signal.h
@@ -751,7 +752,7 @@ proto_printf(struct stream *wr, const ch
break;
case 'O':
off = va_arg(ap, off_t);
-   rv = stream_printf(wr, %llu, off);
+   rv = stream_printf(wr, % PRId64, off);
break;
case 'S':
s = va_arg(ap, char *);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228627 - head/contrib/ee

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sat Dec 17 14:26:16 2011
New Revision: 228627
URL: http://svn.freebsd.org/changeset/base/228627

Log:
  In contrib/ee/ee.c, fix a few warnings about format strings not being
  literals.  Also, change the direction argument to move_rel() from char
  to int; KR function definions cause it to be promoted to an int anyway,
  and this way we avoid clang warning about it.
  
  MFC after:1 week

Modified:
  head/contrib/ee/ee.c

Modified: head/contrib/ee/ee.c
==
--- head/contrib/ee/ee.cSat Dec 17 13:52:53 2011(r228626)
+++ head/contrib/ee/ee.cSat Dec 17 14:26:16 2011(r228627)
@@ -307,7 +307,7 @@ void undel_word P_((void));
 void del_line P_((void));
 void undel_line P_((void));
 void adv_word P_((void));
-void move_rel P_((char direction, int lines));
+void move_rel P_((int direction, int lines));
 void eol P_((void));
 void bol P_((void));
 void adv_line P_((void));
@@ -2105,10 +2105,10 @@ char *arguments[];
else if (!strcmp(-?, buff))
{
fprintf(stderr, usage0, arguments[0]);
-   fprintf(stderr, usage1);
-   fprintf(stderr, usage2);
-   fprintf(stderr, usage3);
-   fprintf(stderr, usage4);
+   fputs(usage1, stderr);
+   fputs(usage2, stderr);
+   fputs(usage3, stderr);
+   fputs(usage4, stderr);
exit(1);
}
else if ((*buff == '+')  (start_at_line == NULL))
@@ -2939,7 +2939,7 @@ while ((position  curr_line-line_lengt
 
 void 
 move_rel(direction, lines) /* move relative to current line*/
-char direction;
+int direction;
 int lines;
 {
int i;
@@ -3242,7 +3242,7 @@ char *string; /* string containing user
}
if (shell_fork)
{
-   printf(continue_msg);
+   fputs(continue_msg, stdout);
fflush(stdout);
while ((in = getchar()) != '\n')
;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228628 - head/usr.bin/gprof

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sat Dec 17 14:37:41 2011
New Revision: 228628
URL: http://svn.freebsd.org/changeset/base/228628

Log:
  In usr.bin/gprof/aout.c, use the correct printf length modifier for a
  uint32_t.
  
  MFC after:1 week

Modified:
  head/usr.bin/gprof/aout.c

Modified: head/usr.bin/gprof/aout.c
==
--- head/usr.bin/gprof/aout.c   Sat Dec 17 14:26:16 2011(r228627)
+++ head/usr.bin/gprof/aout.c   Sat Dec 17 14:37:41 2011(r228628)
@@ -175,7 +175,7 @@ gettextspace(FILE *nfile)
 
 textspace = (u_char *) malloc( xbuf.a_text );
 if ( textspace == 0 ) {
-   warnx(no room for %lu bytes of text space: can't do -c ,
+   warnx(no room for %u bytes of text space: can't do -c ,
  xbuf.a_text );
return;
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228629 - head/usr.bin/gprof

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sat Dec 17 14:51:24 2011
New Revision: 228629
URL: http://svn.freebsd.org/changeset/base/228629

Log:
  More fixes for correct printf length modifiers usr.bin/gprof.
  
  MFC after:1 week

Modified:
  head/usr.bin/gprof/aout.c
  head/usr.bin/gprof/arcs.c

Modified: head/usr.bin/gprof/aout.c
==
--- head/usr.bin/gprof/aout.c   Sat Dec 17 14:37:41 2011(r228628)
+++ head/usr.bin/gprof/aout.c   Sat Dec 17 14:51:24 2011(r228629)
@@ -134,7 +134,7 @@ getsymtab(FILE *nfile, const char *filen
 askfor = nname + 1;
 nl = (nltype *) calloc( askfor , sizeof(nltype) );
 if (nl == 0)
-   errx( 1 , no room for %d bytes of symbol table ,
+   errx( 1 , no room for %zu bytes of symbol table ,
askfor * sizeof(nltype) );
 
 /* pass2 - read symbols */

Modified: head/usr.bin/gprof/arcs.c
==
--- head/usr.bin/gprof/arcs.c   Sat Dec 17 14:37:41 2011(r228628)
+++ head/usr.bin/gprof/arcs.c   Sat Dec 17 14:51:24 2011(r228629)
@@ -378,7 +378,7 @@ cyclelink()
 */
 cyclenl = (nltype *) calloc( ncycle + 1 , sizeof( nltype ) );
 if ( cyclenl == 0 )
-   errx( 1 , no room for %d bytes of cycle headers ,
+   errx( 1 , no room for %zu bytes of cycle headers ,
   ( ncycle + 1 ) * sizeof( nltype ) );
/*
 *  now link cycles to true cycleheads,
@@ -481,7 +481,7 @@ cycleanalyze()
done = FALSE;
 cyclestack = (arctype **) calloc( size + 1 , sizeof( arctype *) );
if ( cyclestack == 0 )
-   errx( 1, no room for %d bytes of cycle stack ,
+   errx( 1, no room for %zu bytes of cycle stack ,
   ( size + 1 ) * sizeof( arctype * ) );
 #  ifdef DEBUG
if ( debug  BREAKCYCLE ) {
@@ -599,7 +599,7 @@ addcycle( stkstart , stkend )
 clp = (cltype *)
calloc( 1 , sizeof ( cltype ) + ( size - 1 ) * sizeof( arctype * ) );
 if ( clp == 0 ) {
-   warnx( no room for %d bytes of subcycle storage ,
+   warnx( no room for %zu bytes of subcycle storage ,
sizeof ( cltype ) + ( size - 1 ) * sizeof( arctype * ) );
return( FALSE );
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228630 - head/lib/libc/net

2011-12-17 Thread Michael Tuexen
Author: tuexen
Date: Sat Dec 17 14:55:19 2011
New Revision: 228630
URL: http://svn.freebsd.org/changeset/base/228630

Log:
  Address warnings found by clang.
  
  MFC after: 3 months.

Modified:
  head/lib/libc/net/sctp_sys_calls.c

Modified: head/lib/libc/net/sctp_sys_calls.c
==
--- head/lib/libc/net/sctp_sys_calls.c  Sat Dec 17 14:51:24 2011
(r228629)
+++ head/lib/libc/net/sctp_sys_calls.c  Sat Dec 17 14:55:19 2011
(r228630)
@@ -245,7 +245,8 @@ sctp_bindx(int sd, struct sockaddr *addr
struct sockaddr *sa;
struct sockaddr_in *sin;
struct sockaddr_in6 *sin6;
-   int i, sz, argsz;
+   int i;
+   size_t argsz;
uint16_t sport = 0;
 
/* validate the flags */
@@ -269,7 +270,6 @@ sctp_bindx(int sd, struct sockaddr *addr
/* First pre-screen the addresses */
sa = addrs;
for (i = 0; i  addrcnt; i++) {
-   sz = sa-sa_len;
if (sa-sa_family == AF_INET) {
if (sa-sa_len != sizeof(struct sockaddr_in))
goto out_error;
@@ -307,7 +307,7 @@ sctp_bindx(int sd, struct sockaddr *addr
goto out_error;
}
 
-   sa = (struct sockaddr *)((caddr_t)sa + sz);
+   sa = (struct sockaddr *)((caddr_t)sa + sa-sa_len);
}
sa = addrs;
/*
@@ -319,7 +319,6 @@ sctp_bindx(int sd, struct sockaddr *addr
sin-sin_port = sport;
}
for (i = 0; i  addrcnt; i++) {
-   sz = sa-sa_len;
if (sa-sa_family == AF_INET) {
if (sa-sa_len != sizeof(struct sockaddr_in))
goto out_error;
@@ -335,13 +334,13 @@ sctp_bindx(int sd, struct sockaddr *addr
}
memset(gaddrs, 0, argsz);
gaddrs-sget_assoc_id = 0;
-   memcpy(gaddrs-addr, sa, sz);
+   memcpy(gaddrs-addr, sa, sa-sa_len);
if (setsockopt(sd, IPPROTO_SCTP, flags, gaddrs,
(socklen_t) argsz) != 0) {
free(gaddrs);
return (-1);
}
-   sa = (struct sockaddr *)((caddr_t)sa + sz);
+   sa = (struct sockaddr *)((caddr_t)sa + sa-sa_len);
}
free(gaddrs);
return (0);
@@ -430,10 +429,9 @@ sctp_getpaddrs(int sd, sctp_assoc_t id, 
 {
struct sctp_getaddresses *addrs;
struct sockaddr *sa;
-   struct sockaddr *re;
sctp_assoc_t asoc;
caddr_t lim;
-   socklen_t siz;
+   socklen_t opt_len;
int cnt;
 
if (raddrs == NULL) {
@@ -441,30 +439,28 @@ sctp_getpaddrs(int sd, sctp_assoc_t id, 
return (-1);
}
asoc = id;
-   siz = sizeof(sctp_assoc_t);
+   opt_len = (socklen_t) sizeof(sctp_assoc_t);
if (getsockopt(sd, IPPROTO_SCTP, SCTP_GET_REMOTE_ADDR_SIZE,
-   asoc, siz) != 0) {
+   asoc, opt_len) != 0) {
return (-1);
}
/* size required is returned in 'asoc' */
-   siz = (size_t)asoc;
-   siz += sizeof(struct sctp_getaddresses);
-   addrs = calloc(1, siz);
+   opt_len = (socklen_t) ((size_t)asoc + sizeof(struct sctp_getaddresses));
+   addrs = calloc(1, (size_t)opt_len);
if (addrs == NULL) {
return (-1);
}
addrs-sget_assoc_id = id;
/* Now lets get the array of addresses */
if (getsockopt(sd, IPPROTO_SCTP, SCTP_GET_PEER_ADDRESSES,
-   addrs, siz) != 0) {
+   addrs, opt_len) != 0) {
free(addrs);
return (-1);
}
-   re = (struct sockaddr *)addrs-addr[0];
-   *raddrs = re;
+   *raddrs = (struct sockaddr *)addrs-addr[0];
cnt = 0;
sa = (struct sockaddr *)addrs-addr[0];
-   lim = (caddr_t)addrs + siz;
+   lim = (caddr_t)addrs + opt_len;
while (((caddr_t)sa  lim)  (sa-sa_len  0)) {
sa = (struct sockaddr *)((caddr_t)sa + sa-sa_len);
cnt++;
@@ -487,11 +483,10 @@ int
 sctp_getladdrs(int sd, sctp_assoc_t id, struct sockaddr **raddrs)
 {
struct sctp_getaddresses *addrs;
-   struct sockaddr *re;
caddr_t lim;
struct sockaddr *sa;
-   int size_of_addresses;
-   socklen_t siz;
+   size_t size_of_addresses;
+   socklen_t opt_len;
int cnt;
 
if (raddrs == NULL) {
@@ -499,9 +494,9 @@ sctp_getladdrs(int sd, sctp_assoc_t id, 
return (-1);
}
size_of_addresses = 0;
-   siz = sizeof(int);
+   opt_len = (socklen_t) sizeof(int);
if (getsockopt(sd, IPPROTO_SCTP, SCTP_GET_LOCAL_ADDR_SIZE,
-   size_of_addresses, siz) != 0) {
+   size_of_addresses, opt_len) != 0) {
errno = ENOMEM;
return (-1);
}
@@ 

svn commit: r228631 - in head/sys: dev/cfe dev/dcons dev/ofw dev/sio dev/syscons dev/uart dev/usb/serial dev/xen/console gdb ia64/ia64 kern mips/adm5120 pc98/cbus powerpc/mambo sys

2011-12-17 Thread Andriy Gapon
Author: avg
Date: Sat Dec 17 15:08:43 2011
New Revision: 228631
URL: http://svn.freebsd.org/changeset/base/228631

Log:
  kern cons: introduce infrastructure for console grabbing by kernel
  
  At the moment grab and ungrab methods of all console drivers are no-ops.
  
  Current intended meaning of the calls is that the kernel takes control of
  console input.  In the future the semantics may be extended to mean that
  the calling thread takes full ownership of the console (e.g. console
  output from other threads could be suspended).
  
  Inspired by:  bde
  MFC after:2 months

Modified:
  head/sys/dev/cfe/cfe_console.c
  head/sys/dev/dcons/dcons_os.c
  head/sys/dev/ofw/ofw_console.c
  head/sys/dev/sio/sio.c
  head/sys/dev/syscons/syscons.c
  head/sys/dev/uart/uart_tty.c
  head/sys/dev/usb/serial/usb_serial.c
  head/sys/dev/xen/console/console.c
  head/sys/gdb/gdb_cons.c
  head/sys/ia64/ia64/ssc.c
  head/sys/kern/kern_cons.c
  head/sys/mips/adm5120/console.c
  head/sys/pc98/cbus/sio.c
  head/sys/powerpc/mambo/mambo_console.c
  head/sys/sys/cons.h

Modified: head/sys/dev/cfe/cfe_console.c
==
--- head/sys/dev/cfe/cfe_console.c  Sat Dec 17 14:55:19 2011
(r228630)
+++ head/sys/dev/cfe/cfe_console.c  Sat Dec 17 15:08:43 2011
(r228631)
@@ -76,6 +76,8 @@ static cn_init_t  cfe_cninit;
 static cn_term_t   cfe_cnterm;
 static cn_getc_t   cfe_cngetc;
 static cn_putc_t   cfe_cnputc;
+static cn_grab_t   cfe_cngrab;
+static cn_ungrab_t cfe_cnungrab;
 
 CONSOLE_DRIVER(cfe);
 
@@ -183,6 +185,18 @@ cfe_cnterm(struct consdev *cp)
 
 }
 
+static void
+cfe_cngrab(struct consdev *cp)
+{
+
+}
+
+static void
+cfe_cnungrab(struct consdev *cp)
+{
+
+}
+
 static int
 cfe_cngetc(struct consdev *cp)
 {

Modified: head/sys/dev/dcons/dcons_os.c
==
--- head/sys/dev/dcons/dcons_os.c   Sat Dec 17 14:55:19 2011
(r228630)
+++ head/sys/dev/dcons/dcons_os.c   Sat Dec 17 15:08:43 2011
(r228631)
@@ -109,6 +109,8 @@ static cn_init_tdcons_cninit;
 static cn_term_t   dcons_cnterm;
 static cn_getc_t   dcons_cngetc;
 static cn_putc_t   dcons_cnputc;
+static cn_grab_t   dcons_cngrab;
+static cn_ungrab_t dcons_cnungrab;
 
 CONSOLE_DRIVER(dcons);
 
@@ -246,6 +248,16 @@ dcons_cnterm(struct consdev *cp)
 {
 }
 
+static void
+dcons_cngrab(struct consdev *cp)
+{
+}
+
+static void
+dcons_cnungrab(struct consdev *cp)
+{
+}
+
 static int
 dcons_cngetc(struct consdev *cp)
 {

Modified: head/sys/dev/ofw/ofw_console.c
==
--- head/sys/dev/ofw/ofw_console.c  Sat Dec 17 14:55:19 2011
(r228630)
+++ head/sys/dev/ofw/ofw_console.c  Sat Dec 17 15:08:43 2011
(r228631)
@@ -74,6 +74,8 @@ static cn_init_t  ofw_cninit;
 static cn_term_t   ofw_cnterm;
 static cn_getc_t   ofw_cngetc;
 static cn_putc_t   ofw_cnputc;
+static cn_grab_t   ofw_cngrab;
+static cn_ungrab_t ofw_cnungrab;
 
 CONSOLE_DRIVER(ofw);
 
@@ -192,6 +194,16 @@ ofw_cnterm(struct consdev *cp)
 {
 }
 
+static void
+ofw_cngrab(struct consdev *cp)
+{
+}
+
+static void
+ofw_cnungrab(struct consdev *cp)
+{
+}
+
 static int
 ofw_cngetc(struct consdev *cp)
 {

Modified: head/sys/dev/sio/sio.c
==
--- head/sys/dev/sio/sio.c  Sat Dec 17 14:55:19 2011(r228630)
+++ head/sys/dev/sio/sio.c  Sat Dec 17 15:08:43 2011(r228631)
@@ -2293,6 +2293,8 @@ static cn_init_t sio_cninit;
 static cn_term_t sio_cnterm;
 static cn_getc_t sio_cngetc;
 static cn_putc_t sio_cnputc;
+static cn_grab_t sio_cngrab;
+static cn_ungrab_t sio_cnungrab;
 
 CONSOLE_DRIVER(sio);
 
@@ -2512,6 +2514,16 @@ sio_cnterm(cp)
comconsole = -1;
 }
 
+static void
+sio_cngrab(struct consdev *cp)
+{
+}
+
+static void
+sio_cnungrab(struct consdev *cp)
+{
+}
+
 static int
 sio_cngetc(struct consdev *cd)
 {

Modified: head/sys/dev/syscons/syscons.c
==
--- head/sys/dev/syscons/syscons.c  Sat Dec 17 14:55:19 2011
(r228630)
+++ head/sys/dev/syscons/syscons.c  Sat Dec 17 15:08:43 2011
(r228631)
@@ -229,6 +229,8 @@ static cn_init_tsc_cninit;
 static cn_term_t   sc_cnterm;
 static cn_getc_t   sc_cngetc;
 static cn_putc_t   sc_cnputc;
+static cn_grab_t   sc_cngrab;
+static cn_ungrab_t sc_cnungrab;
 
 CONSOLE_DRIVER(sc);
 
@@ -1609,6 +1611,16 @@ sc_cnterm(struct consdev *cp)
 }
 
 static void
+sc_cngrab(struct consdev *cp)
+{
+}
+
+static void
+sc_cnungrab(struct consdev *cp)
+{
+}
+
+static void
 sc_cnputc(struct consdev *cd, int c)
 {
 u_char buf[1];

Modified: head/sys/dev/uart/uart_tty.c
==
--- 

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

2011-12-17 Thread Nathan Whitehorn
This broke PowerPC really, really badly. Basically every 
dynamically-linked executable dies with an illegal instruction trap.

-Nathan

On 12/12/11 05:03, Konstantin Belousov wrote:

Author: kib
Date: Mon Dec 12 11:03:14 2011
New Revision: 228435
URL: http://svn.freebsd.org/changeset/base/228435

Log:
   Add support for STT_GNU_IFUNC and R_MACHINE_IRELATIVE GNU extensions to
   rtld on 386 and amd64. This adds runtime bits neccessary for the use
   of the dispatch functions from the dynamically-linked executables and
   shared libraries.

   To allow use of external references from the dispatch function, resolution
   of the R_MACHINE_IRESOLVE relocations in PLT is postponed until GOT entries
   for PLT are prepared, and normal resolution of the GOT entries is finished.
   Similar to how it is done by GNU, IRELATIVE relocations are resolved in
   advance, instead of normal lazy handling for PLT.

   Move the init_pltgot() call before the relocations for the object are
   processed.

   MFC after:   3 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 Mon Dec 12 10:10:49 2011
(r228434)
+++ head/libexec/rtld-elf/amd64/reloc.c Mon Dec 12 11:03:14 2011
(r228435)
@@ -344,11 +344,22 @@ reloc_plt(Obj_Entry *obj)
  for (rela = obj-pltrela;  rela  relalim;  rela++) {
Elf_Addr *where;

-   assert(ELF_R_TYPE(rela-r_info) == R_X86_64_JMP_SLOT);
-
-   /* Relocate the GOT slot pointing into the PLT. */
-   where = (Elf_Addr *)(obj-relocbase + rela-r_offset);
-   *where += (Elf_Addr)obj-relocbase;
+   switch(ELF_R_TYPE(rela-r_info)) {
+   case R_X86_64_JMP_SLOT:
+ /* Relocate the GOT slot pointing into the PLT. */
+ where = (Elf_Addr *)(obj-relocbase + rela-r_offset);
+ *where += (Elf_Addr)obj-relocbase;
+ break;
+
+   case R_X86_64_IRELATIVE:
+ obj-irelative = true;
+ break;
+
+   default:
+ _rtld_error(Unknown relocation type %x in PLT,
+   (unsigned int)ELF_R_TYPE(rela-r_info));
+ return (-1);
+   }
  }
  return 0;
  }
@@ -368,19 +379,91 @@ reloc_jmpslots(Obj_Entry *obj, RtldLockS
const Elf_Sym *def;
const Obj_Entry *defobj;

-   assert(ELF_R_TYPE(rela-r_info) == R_X86_64_JMP_SLOT);
-   where = (Elf_Addr *)(obj-relocbase + rela-r_offset);
-   def = find_symdef(ELF_R_SYM(rela-r_info), obj,defobj, true, NULL,
-   lockstate);
-   if (def == NULL)
-   return -1;
-   target = (Elf_Addr)(defobj-relocbase + def-st_value + rela-r_addend);
-   reloc_jmpslot(where, target, defobj, obj, (const Elf_Rel *)rela);
+   switch (ELF_R_TYPE(rela-r_info)) {
+   case R_X86_64_JMP_SLOT:
+ where = (Elf_Addr *)(obj-relocbase + rela-r_offset);
+ def = find_symdef(ELF_R_SYM(rela-r_info), obj,defobj, true, NULL,
+ lockstate);
+ if (def == NULL)
+ return (-1);
+ if (ELF_ST_TYPE(def-st_info) == STT_GNU_IFUNC) {
+ obj-gnu_ifunc = true;
+ continue;
+ }
+ target = (Elf_Addr)(defobj-relocbase + def-st_value + 
rela-r_addend);
+ reloc_jmpslot(where, target, defobj, obj, (const Elf_Rel *)rela);
+ break;
+
+   case R_X86_64_IRELATIVE:
+ break;
+
+   default:
+ _rtld_error(Unknown relocation type %x in PLT,
+   (unsigned int)ELF_R_TYPE(rela-r_info));
+ return (-1);
+   }
  }
  obj-jmpslots_done = true;
  return 0;
  }

+int
+reloc_iresolve(Obj_Entry *obj, RtldLockState *lockstate)
+{
+const Elf_Rela *relalim;
+const Elf_Rela *rela;
+
+relalim = (const Elf_Rela *)((char *)obj-pltrela + obj-pltrelasize);
+for (rela = obj-pltrela;  rela  relalim;  rela++) {
+   Elf_Addr *where, target, *ptr;
+
+   switch (ELF_R_TYPE(rela-r_info)) {
+   case R_X86_64_JMP_SLOT:
+ break;
+
+   case R_X86_64_IRELATIVE:
+ ptr = (Elf_Addr *)(obj-relocbase + rela-r_addend);
+ where = (Elf_Addr *)(obj-relocbase + rela-r_offset);
+ target = ((Elf_Addr (*)(void))ptr)();
+ *where = target;
+ break;
+   }
+}
+return (0);
+}
+
+int
+reloc_gnu_ifunc(Obj_Entry *obj, RtldLockState *lockstate)
+{
+const Elf_Rela *relalim;
+const Elf_Rela *rela;
+
+if (!obj-gnu_ifunc)
+   return (0);
+relalim = (const Elf_Rela *)((char *)obj-pltrela + obj-pltrelasize);
+for (rela = obj-pltrela;  rela  relalim;  rela++) {
+ 

svn commit: r228632 - head/sys/kern

2011-12-17 Thread Andriy Gapon
Author: avg
Date: Sat Dec 17 15:11:22 2011
New Revision: 228632
URL: http://svn.freebsd.org/changeset/base/228632

Log:
  introduce cngrab/cnungrab stub calls in some places where they make sense
  
  MFC after:2 months

Modified:
  head/sys/kern/kern_cons.c
  head/sys/kern/kern_shutdown.c
  head/sys/kern/subr_kdb.c

Modified: head/sys/kern/kern_cons.c
==
--- head/sys/kern/kern_cons.c   Sat Dec 17 15:08:43 2011(r228631)
+++ head/sys/kern/kern_cons.c   Sat Dec 17 15:11:22 2011(r228632)
@@ -427,8 +427,10 @@ cnputc(int c)
if (console_pausing  c == '\n'  !kdb_active) {
for (cp = console_pausestr; *cp != '\0'; cp++)
cnputc(*cp);
+   cngrab();
if (cngetc() == '.')
console_pausing = 0;
+   cnungrab();
cnputc('\r');
for (cp = console_pausestr; *cp != '\0'; cp++)
cnputc(' ');

Modified: head/sys/kern/kern_shutdown.c
==
--- head/sys/kern/kern_shutdown.c   Sat Dec 17 15:08:43 2011
(r228631)
+++ head/sys/kern/kern_shutdown.c   Sat Dec 17 15:11:22 2011
(r228632)
@@ -443,6 +443,8 @@ kern_reboot(int howto)
 
print_uptime();
 
+   cngrab();
+
/*
 * Ok, now do things that assume all filesystem activity has
 * been completed.
@@ -613,6 +615,7 @@ panic(const char *fmt, ...)
if (newpanic) {
(void)vsnprintf(buf, sizeof(buf), fmt, ap);
panicstr = buf;
+   cngrab();
printf(panic: %s\n, buf);
} else {
printf(panic: );

Modified: head/sys/kern/subr_kdb.c
==
--- head/sys/kern/subr_kdb.cSat Dec 17 15:08:43 2011(r228631)
+++ head/sys/kern/subr_kdb.cSat Dec 17 15:11:22 2011(r228632)
@@ -32,6 +32,7 @@ __FBSDID($FreeBSD$);
 
 #include sys/param.h
 #include sys/systm.h
+#include sys/cons.h
 #include sys/kdb.h
 #include sys/kernel.h
 #include sys/malloc.h
@@ -622,6 +623,8 @@ kdb_trap(int type, int code, struct trap
makectx(tf, kdb_pcb);
kdb_thr_select(curthread);
 
+   cngrab();
+
for (;;) {
handled = be-dbbe_trap(type, code);
if (be == kdb_dbbe)
@@ -632,6 +635,8 @@ kdb_trap(int type, int code, struct trap
printf(Switching to %s back-end\n, be-dbbe_name);
}
 
+   cnungrab();
+
kdb_active--;
 
 #ifdef SMP
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228633 - in head/sys: kern sys

2011-12-17 Thread Andriy Gapon
Author: avg
Date: Sat Dec 17 15:16:54 2011
New Revision: 228633
URL: http://svn.freebsd.org/changeset/base/228633

Log:
  introduce cngets, a method for kernel to read a string from console
  
  This is intended as a replacement for libkern's gets and mostly borrows
  its implementation.  It uses cngrab/cnungrab to delimit kernel's access
  to console input.
  
  Note: libkern's gets obviously doesn't share any bits of implementation
  iwth libc's gets.  They also have different APIs and the former doesn't
  have the overflow problems of the latter.
  
  Inspired by:  bde
  MFC after:2 months

Modified:
  head/sys/kern/kern_cons.c
  head/sys/sys/cons.h

Modified: head/sys/kern/kern_cons.c
==
--- head/sys/kern/kern_cons.c   Sat Dec 17 15:11:22 2011(r228632)
+++ head/sys/kern/kern_cons.c   Sat Dec 17 15:16:54 2011(r228633)
@@ -408,6 +408,55 @@ cncheckc(void)
 }
 
 void
+cngets(char *cp, size_t size, int visible)
+{
+   char *lp, *end;
+   int c;
+
+   cngrab();
+
+   lp = cp;
+   end = cp + size - 1;
+   for (;;) {
+   c = cngetc()  0177;
+   switch (c) {
+   case '\n':
+   case '\r':
+   cnputc(c);
+   *lp = '\0';
+   cnungrab();
+   return;
+   case '\b':
+   case '\177':
+   if (lp  cp) {
+   if (visible) {
+   cnputc(c);
+   cnputs( \b);
+   }
+   lp--;
+   }
+   continue;
+   case '\0':
+   continue;
+   default:
+   if (lp  end) {
+   switch (visible) {
+   case GETS_NOECHO:
+   break;
+   case GETS_ECHOPASS:
+   cnputc('*');
+   break;
+   default:
+   cnputc(c);
+   break;
+   }
+   *lp++ = c;
+   }
+   }
+   }
+}
+
+void
 cnputc(int c)
 {
struct cn_device *cnd;

Modified: head/sys/sys/cons.h
==
--- head/sys/sys/cons.h Sat Dec 17 15:11:22 2011(r228632)
+++ head/sys/sys/cons.h Sat Dec 17 15:16:54 2011(r228633)
@@ -121,6 +121,7 @@ voidcngrab(void);
 void   cnungrab(void);
 intcncheckc(void);
 intcngetc(void);
+void   cngets(char *, size_t, int);
 void   cnputc(int);
 void   cnputs(char *);
 intcnunavailable(void);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228634 - in head/sys: geom/eli kern

2011-12-17 Thread Andriy Gapon
Author: avg
Date: Sat Dec 17 15:26:34 2011
New Revision: 228634
URL: http://svn.freebsd.org/changeset/base/228634

Log:
  replace uses of libkern gets with cngets
  
  MFC after:2 months

Modified:
  head/sys/geom/eli/g_eli.c
  head/sys/kern/vfs_mountroot.c

Modified: head/sys/geom/eli/g_eli.c
==
--- head/sys/geom/eli/g_eli.c   Sat Dec 17 15:16:54 2011(r228633)
+++ head/sys/geom/eli/g_eli.c   Sat Dec 17 15:26:34 2011(r228634)
@@ -29,6 +29,7 @@ __FBSDID($FreeBSD$);
 
 #include sys/param.h
 #include sys/systm.h
+#include sys/cons.h
 #include sys/kernel.h
 #include sys/linker.h
 #include sys/module.h
@@ -1085,7 +1086,7 @@ g_eli_taste(struct g_class *mp, struct g
/* Ask for the passphrase if defined. */
if (md.md_iterations = 0) {
printf(Enter passphrase for %s: , pp-name);
-   gets(passphrase, sizeof(passphrase),
+   cngets(passphrase, sizeof(passphrase),
g_eli_visible_passphrase);
}
 

Modified: head/sys/kern/vfs_mountroot.c
==
--- head/sys/kern/vfs_mountroot.c   Sat Dec 17 15:16:54 2011
(r228633)
+++ head/sys/kern/vfs_mountroot.c   Sat Dec 17 15:26:34 2011
(r228634)
@@ -42,10 +42,10 @@ __FBSDID($FreeBSD$);
 
 #include sys/param.h
 #include sys/conf.h
+#include sys/cons.h
 #include sys/fcntl.h
 #include sys/jail.h
 #include sys/kernel.h
-#include sys/libkern.h
 #include sys/malloc.h
 #include sys/mdioctl.h
 #include sys/mount.h
@@ -486,7 +486,7 @@ parse_dir_ask(char **conf)
do {
error = EINVAL;
printf(\nmountroot );
-   gets(name, sizeof(name), GETS_ECHO);
+   cngets(name, sizeof(name), GETS_ECHO);
if (name[0] == '\0')
break;
if (name[0] == '?'  name[1] == '\0') {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r228415 - head/sys/dev/e1000

2011-12-17 Thread Bjoern A. Zeeb

On 12. Dec 2011, at 13:08 , Luigi Rizzo wrote:

 On Sun, Dec 11, 2011 at 06:46:14PM +, Jack F Vogel wrote:
 Author: jfv
 Date: Sun Dec 11 18:46:14 2011
 New Revision: 228415
 URL: http://svn.freebsd.org/changeset/base/228415
 
 Log:
  Last change still had an issue, one more time...
 
 Jack,
 the previous commit (rev. 228387) removed netmap support from if_igb.c
 I believe it was unintentional. Can you put it back, or do you want
 me to handle it ?
 

I am not sure why yet (and it could be someone broke the clean parts of the 
build system) but I am seeing this and cannot remember reports the last days:

In file included from 
/scratch/tmp/bz/head.universe/sys/modules/em/../../dev/e1000/if_em.c:400:
@/dev/netmap/if_em_netmap.h: In function 'em_netmap_rxsync':
@/dev/netmap/if_em_netmap.h:332: warning: dereferencing 'void *' pointer
@/dev/netmap/if_em_netmap.h:332: error: request for member 'dt_mt' in something 
not a structure or union

for a LINT build on sparc64.



 cheers
 luigi
 
 Modified:
  head/sys/dev/e1000/if_em.c
  head/sys/dev/e1000/if_igb.c
 
 Modified: head/sys/dev/e1000/if_em.c
 ==
 --- head/sys/dev/e1000/if_em.c   Sun Dec 11 17:32:37 2011
 (r228414)
 +++ head/sys/dev/e1000/if_em.c   Sun Dec 11 18:46:14 2011
 (r228415)
 @@ -1045,8 +1045,8 @@ em_ioctl(struct ifnet *ifp, u_long comma
  struct ifreq*ifr = (struct ifreq *)data;
 #if defined(INET) || defined(INET6)
  struct ifaddr   *ifa = (struct ifaddr *)data;
 -boolavoid_reset = FALSE;
 #endif
 +boolavoid_reset = FALSE;
  int error = 0;
 
  if (adapter-in_detach)
 @@ -1062,7 +1062,6 @@ em_ioctl(struct ifnet *ifp, u_long comma
  if (ifa-ifa_addr-sa_family == AF_INET6)
  avoid_reset = TRUE;
 #endif
 -#if defined(INET) || defined(INET6)
  /*
  ** Calling init results in link renegotiation,
  ** so we avoid doing it when possible.
 @@ -1071,11 +1070,12 @@ em_ioctl(struct ifnet *ifp, u_long comma
  ifp-if_flags |= IFF_UP;
  if (!(ifp-if_drv_flags  IFF_DRV_RUNNING))
  em_init(adapter);
 +#ifdef INET
  if (!(ifp-if_flags  IFF_NOARP))
  arp_ifinit(ifp, ifa);
 +#endif
  } else
  error = ether_ioctl(ifp, command, data);
 -#endif
  break;
  case SIOCSIFMTU:
  {
 
 Modified: head/sys/dev/e1000/if_igb.c
 ==
 --- head/sys/dev/e1000/if_igb.c  Sun Dec 11 17:32:37 2011
 (r228414)
 +++ head/sys/dev/e1000/if_igb.c  Sun Dec 11 18:46:14 2011
 (r228415)
 @@ -992,8 +992,8 @@ igb_ioctl(struct ifnet *ifp, u_long comm
  struct ifreq*ifr = (struct ifreq *)data;
 #if defined(INET) || defined(INET6)
  struct ifaddr   *ifa = (struct ifaddr *)data;
 -boolavoid_reset = FALSE;
 #endif
 +boolavoid_reset = FALSE;
  int error = 0;
 
  if (adapter-in_detach)
 @@ -1009,7 +1009,6 @@ igb_ioctl(struct ifnet *ifp, u_long comm
  if (ifa-ifa_addr-sa_family == AF_INET6)
  avoid_reset = TRUE;
 #endif
 -#if defined(INET) || defined(INET6)
  /*
  ** Calling init results in link renegotiation,
  ** so we avoid doing it when possible.
 @@ -1018,11 +1017,12 @@ igb_ioctl(struct ifnet *ifp, u_long comm
  ifp-if_flags |= IFF_UP;
  if (!(ifp-if_drv_flags  IFF_DRV_RUNNING))
  igb_init(adapter);
 +#ifdef INET
  if (!(ifp-if_flags  IFF_NOARP))
  arp_ifinit(ifp, ifa);
 +#endif
  } else
  error = ether_ioctl(ifp, command, data);
 -#endif
  break;
  case SIOCSIFMTU:
  {

-- 
Bjoern A. Zeeb You have to have visions!
 Stop bit received. Insert coin for new address family.

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r228631 - in head/sys: dev/cfe dev/dcons dev/ofw dev/sio dev/syscons dev/uart dev/usb/serial dev/xen/console gdb ia64/ia64 kern mips/adm5120 pc98/cbus powerpc/mambo sys

2011-12-17 Thread Andriy Gapon
on 17/12/2011 17:08 Andriy Gapon said the following:
 +void
 +cngrab()
 +{
 + struct cn_device *cnd;
 + struct consdev *cn;
 +
 + STAILQ_FOREACH(cnd, cn_devlist, cnd_next) {
 + cn = cnd-cnd_cn;
 + if (!kdb_active || !(cn-cn_flags  CN_FLAG_NODEBUG))
 + cn-cn_ops-cn_grab(cn);
 + }
 +}

BTW, it seems that CN_FLAG_NODEBUG is not set for any of the current console
drivers.  A candidate for removal?

-- 
Andriy Gapon
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228635 - head/libexec/rtld-elf/powerpc

2011-12-17 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Sat Dec 17 15:31:00 2011
New Revision: 228635
URL: http://svn.freebsd.org/changeset/base/228635

Log:
  Fix RTLD on PowerPC after r228435. Changing the order of init_pltgot()
  caused the icache to be invalidated at the wrong time, resulting in
  an icache full of nonsense in the PLT section.

Modified:
  head/libexec/rtld-elf/powerpc/reloc.c

Modified: head/libexec/rtld-elf/powerpc/reloc.c
==
--- head/libexec/rtld-elf/powerpc/reloc.c   Sat Dec 17 15:26:34 2011
(r228634)
+++ head/libexec/rtld-elf/powerpc/reloc.c   Sat Dec 17 15:31:00 2011
(r228635)
@@ -366,7 +366,7 @@ reloc_plt_object(Obj_Entry *obj, const E

 
/*
-* The icache will be sync'd in init_pltgot, which is called
+* The icache will be sync'd in reloc_plt, which is called
 * after all the slots have been updated
 */
 
@@ -382,6 +382,7 @@ reloc_plt(Obj_Entry *obj)
 {
const Elf_Rela *relalim;
const Elf_Rela *rela;
+   int N = obj-pltrelasize / sizeof(Elf_Rela);
 
if (obj-pltrelasize != 0) {
 
@@ -396,6 +397,13 @@ reloc_plt(Obj_Entry *obj)
}
}
 
+   /*
+* Sync the icache for the byte range represented by the
+* trampoline routines and call slots.
+*/
+   if (obj-pltgot != NULL)
+   __syncicache(obj-pltgot, JMPTAB_BASE(N)*4);
+
return (0);
 }
 
@@ -595,10 +603,9 @@ init_pltgot(Obj_Entry *obj)
pltresolve[4] |= _ppc_la(obj);
 
/*
-* Sync the icache for the byte range represented by the
-* trampoline routines and call slots.
+* The icache will be sync'd in reloc_plt, which is called
+* after all the slots have been updated
 */
-   __syncicache(obj-pltgot, JMPTAB_BASE(N)*4);
 }
 
 void
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2011-12-17 Thread Nathan Whitehorn

Fixed in r228635.
-Nathan

On 12/17/11 09:09, Nathan Whitehorn wrote:
This broke PowerPC really, really badly. Basically every 
dynamically-linked executable dies with an illegal instruction trap.

-Nathan

On 12/12/11 05:03, Konstantin Belousov wrote:

Author: kib
Date: Mon Dec 12 11:03:14 2011
New Revision: 228435
URL: http://svn.freebsd.org/changeset/base/228435

Log:
   Add support for STT_GNU_IFUNC and R_MACHINE_IRELATIVE GNU 
extensions to

   rtld on 386 and amd64. This adds runtime bits neccessary for the use
   of the dispatch functions from the dynamically-linked executables and
   shared libraries.

   To allow use of external references from the dispatch function, 
resolution
   of the R_MACHINE_IRESOLVE relocations in PLT is postponed until 
GOT entries
   for PLT are prepared, and normal resolution of the GOT entries is 
finished.
   Similar to how it is done by GNU, IRELATIVE relocations are 
resolved in

   advance, instead of normal lazy handling for PLT.

   Move the init_pltgot() call before the relocations for the object are
   processed.

   MFC after:3 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.cMon Dec 12 10:10:49 
2011(r228434)
+++ head/libexec/rtld-elf/amd64/reloc.cMon Dec 12 11:03:14 
2011(r228435)

@@ -344,11 +344,22 @@ reloc_plt(Obj_Entry *obj)
  for (rela = obj-pltrela;  rela  relalim;  rela++) {
  Elf_Addr *where;

-assert(ELF_R_TYPE(rela-r_info) == R_X86_64_JMP_SLOT);
-
-/* Relocate the GOT slot pointing into the PLT. */
-where = (Elf_Addr *)(obj-relocbase + rela-r_offset);
-*where += (Elf_Addr)obj-relocbase;
+switch(ELF_R_TYPE(rela-r_info)) {
+case R_X86_64_JMP_SLOT:
+  /* Relocate the GOT slot pointing into the PLT. */
+  where = (Elf_Addr *)(obj-relocbase + rela-r_offset);
+  *where += (Elf_Addr)obj-relocbase;
+  break;
+
+case R_X86_64_IRELATIVE:
+  obj-irelative = true;
+  break;
+
+default:
+  _rtld_error(Unknown relocation type %x in PLT,
+(unsigned int)ELF_R_TYPE(rela-r_info));
+  return (-1);
+}
  }
  return 0;
  }
@@ -368,19 +379,91 @@ reloc_jmpslots(Obj_Entry *obj, RtldLockS
  const Elf_Sym *def;
  const Obj_Entry *defobj;

-assert(ELF_R_TYPE(rela-r_info) == R_X86_64_JMP_SLOT);
-where = (Elf_Addr *)(obj-relocbase + rela-r_offset);
-def = find_symdef(ELF_R_SYM(rela-r_info), obj,defobj, true, NULL,
-lockstate);
-if (def == NULL)
-return -1;
-target = (Elf_Addr)(defobj-relocbase + def-st_value + 
rela-r_addend);

-reloc_jmpslot(where, target, defobj, obj, (const Elf_Rel *)rela);
+switch (ELF_R_TYPE(rela-r_info)) {
+case R_X86_64_JMP_SLOT:
+  where = (Elf_Addr *)(obj-relocbase + rela-r_offset);
+  def = find_symdef(ELF_R_SYM(rela-r_info), obj,defobj, true, 
NULL,

+  lockstate);
+  if (def == NULL)
+  return (-1);
+  if (ELF_ST_TYPE(def-st_info) == STT_GNU_IFUNC) {
+  obj-gnu_ifunc = true;
+  continue;
+  }
+  target = (Elf_Addr)(defobj-relocbase + def-st_value + 
rela-r_addend);

+  reloc_jmpslot(where, target, defobj, obj, (const Elf_Rel *)rela);
+  break;
+
+case R_X86_64_IRELATIVE:
+  break;
+
+default:
+  _rtld_error(Unknown relocation type %x in PLT,
+(unsigned int)ELF_R_TYPE(rela-r_info));
+  return (-1);
+}
  }
  obj-jmpslots_done = true;
  return 0;
  }

+int
+reloc_iresolve(Obj_Entry *obj, RtldLockState *lockstate)
+{
+const Elf_Rela *relalim;
+const Elf_Rela *rela;
+
+relalim = (const Elf_Rela *)((char *)obj-pltrela + 
obj-pltrelasize);

+for (rela = obj-pltrela;  rela  relalim;  rela++) {
+Elf_Addr *where, target, *ptr;
+
+switch (ELF_R_TYPE(rela-r_info)) {
+case R_X86_64_JMP_SLOT:
+  break;
+
+case R_X86_64_IRELATIVE:
+  ptr = (Elf_Addr *)(obj-relocbase + rela-r_addend);
+  where = (Elf_Addr *)(obj-relocbase + rela-r_offset);
+  target = ((Elf_Addr (*)(void))ptr)();
+  *where = target;
+  break;
+}
+}
+return (0);
+}
+
+int
+reloc_gnu_ifunc(Obj_Entry *obj, RtldLockState *lockstate)
+{
+const Elf_Rela *relalim;
+const Elf_Rela *rela;
+
+if (!obj-gnu_ifunc)
+return (0);
+relalim = (const Elf_Rela *)((char *)obj-pltrela + 
obj-pltrelasize);

+for (rela = obj-pltrela;  rela  relalim;  rela++) {
+Elf_Addr *where, target;
+const Elf_Sym *def;
+const Obj_Entry *defobj;
+
+

svn commit: r228636 - head/usr.bin/hexdump

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sat Dec 17 15:33:26 2011
New Revision: 228636
URL: http://svn.freebsd.org/changeset/base/228636

Log:
  Correct a logic error in usr.bin/hexdump/conv.c, found by clang.
  
  Whenever the conv_c() function encounters an incomplete multibyte char,
  it peeks ahead.  It also sets p to peekbuf, to indicate it is still
  processing the incomplete character.
  
  However, on the next retry, it compares buf against peekbuf, which
  always returns false, since both buf and peekbuf are local char arrays,
  whose addresses are never the same.
  
  Fix this by comparing against p instead, which was the intention.  Also
  turn peekbuf into an array of u_char, to prevent conversion warnings.
  
  MFC after:1 week

Modified:
  head/usr.bin/hexdump/conv.c

Modified: head/usr.bin/hexdump/conv.c
==
--- head/usr.bin/hexdump/conv.c Sat Dec 17 15:31:00 2011(r228635)
+++ head/usr.bin/hexdump/conv.c Sat Dec 17 15:33:26 2011(r228636)
@@ -53,7 +53,7 @@ conv_c(PR *pr, u_char *p, size_t bufsize
wchar_t wc;
size_t clen, oclen;
int converr, pad, width;
-   char peekbuf[MB_LEN_MAX];
+   u_char peekbuf[MB_LEN_MAX];
 
if (pr-mbleft  0) {
str = **;
@@ -103,7 +103,7 @@ retry:
if (clen == 0)
clen = 1;
else if (clen == (size_t)-1 || (clen == (size_t)-2 
-   buf == peekbuf)) {
+   p == peekbuf)) {
memset(pr-mbstate, 0, sizeof(pr-mbstate));
wc = *p;
clen = 1;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r228629 - head/usr.bin/gprof

2011-12-17 Thread Garrett Cooper
On Sat, Dec 17, 2011 at 6:51 AM, Dimitry Andric d...@freebsd.org wrote:
 Author: dim
 Date: Sat Dec 17 14:51:24 2011
 New Revision: 228629
 URL: http://svn.freebsd.org/changeset/base/228629

 Log:
  More fixes for correct printf length modifiers usr.bin/gprof.

These fixes should be contributed upstream.
Thanks!
-Garrett
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228637 - in head/sys/dev/usb: . net

2011-12-17 Thread Kevin Lo
Author: kevlo
Date: Sat Dec 17 15:38:16 2011
New Revision: 228637
URL: http://svn.freebsd.org/changeset/base/228637

Log:
  Another axe(4), found in ASUS zenbook.

Modified:
  head/sys/dev/usb/net/if_axe.c
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/net/if_axe.c
==
--- head/sys/dev/usb/net/if_axe.c   Sat Dec 17 15:33:26 2011
(r228636)
+++ head/sys/dev/usb/net/if_axe.c   Sat Dec 17 15:38:16 2011
(r228637)
@@ -151,6 +151,7 @@ static const STRUCT_USB_HOST_ID axe_devs
AXE_DEV(ASIX, AX88772, AXE_FLAG_772),
AXE_DEV(ASIX, AX88772A, AXE_FLAG_772A),
AXE_DEV(ASIX, AX88772B, AXE_FLAG_772B),
+   AXE_DEV(ASIX, AX88772B_1, AXE_FLAG_772B),
AXE_DEV(ATEN, UC210T, 0),
AXE_DEV(BELKIN, F5D5055, AXE_FLAG_178),
AXE_DEV(BILLIONTON, USB2AR, 0),

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsSat Dec 17 15:33:26 2011(r228636)
+++ head/sys/dev/usb/usbdevsSat Dec 17 15:38:16 2011(r228637)
@@ -1050,6 +1050,7 @@ product ASIX AX88178  0x1780  AX88178
 product ASIX AX88772   0x7720  AX88772
 product ASIX AX88772A  0x772a  AX88772A USB 2.0 10/100 Ethernet
 product ASIX AX88772B  0x772b  AX88772B USB 2.0 10/100 Ethernet
+product ASIX AX88772B_10x7e2b  AX88772B USB 2.0 10/100 Ethernet
 
 /* ASUS products */
 product ASUS2 USBN11   0x0b05  USB-N11
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228638 - head/sys/sys

2011-12-17 Thread Andriy Gapon
Author: avg
Date: Sat Dec 17 15:39:14 2011
New Revision: 228638
URL: http://svn.freebsd.org/changeset/base/228638

Log:
  move GETS_*ECHO* defintions from libkern.h to cons.h
  
  MFC after:2 months

Modified:
  head/sys/sys/cons.h
  head/sys/sys/libkern.h

Modified: head/sys/sys/cons.h
==
--- head/sys/sys/cons.h Sat Dec 17 15:38:16 2011(r228637)
+++ head/sys/sys/cons.h Sat Dec 17 15:39:14 2011(r228638)
@@ -86,6 +86,11 @@ struct consdev {
 #defineCN_FLAG_NODEBUG 0x0001  /* Not supported with debugger. 
*/
 #defineCN_FLAG_NOAVAIL 0x0002  /* Temporarily not available. */
 
+/* Visibility of characters in cngets() */
+#defineGETS_NOECHO 0   /* Disable echoing of characters. */
+#defineGETS_ECHO   1   /* Enable echoing of characters. */
+#defineGETS_ECHOPASS   2   /* Print a * for every character. */
+
 #ifdef _KERNEL
 
 extern struct msgbuf consmsgbuf; /* Message buffer for constty. */

Modified: head/sys/sys/libkern.h
==
--- head/sys/sys/libkern.h  Sat Dec 17 15:38:16 2011(r228637)
+++ head/sys/sys/libkern.h  Sat Dec 17 15:39:14 2011(r228638)
@@ -188,9 +188,4 @@ strrchr(const char *p, int ch)
 #defineFNM_IGNORECASE  FNM_CASEFOLD
 #defineFNM_FILE_NAME   FNM_PATHNAME
 
-/* Visibility of characters in gets() */
-#defineGETS_NOECHO 0   /* Disable echoing of characters. */
-#defineGETS_ECHO   1   /* Enable echoing of characters. */
-#defineGETS_ECHOPASS   2   /* Print a * for every character. */
-
 #endif /* !_SYS_LIBKERN_H_ */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228639 - head/usr.bin/indent

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sat Dec 17 15:41:58 2011
New Revision: 228639
URL: http://svn.freebsd.org/changeset/base/228639

Log:
  In usr.bin/indent/io.c, fix a few warnings about format strings not being 
literals.
  
  MFC after:1 week

Modified:
  head/usr.bin/indent/io.c

Modified: head/usr.bin/indent/io.c
==
--- head/usr.bin/indent/io.cSat Dec 17 15:39:14 2011(r228638)
+++ head/usr.bin/indent/io.cSat Dec 17 15:41:58 2011(r228639)
@@ -581,12 +581,12 @@ diag2(int level, const char *msg)
found_err = 1;
 if (output == stdout) {
fprintf(stdout, /**INDENT** %s@%d: , level == 0 ? Warning : 
Error, line_no);
-   fprintf(stdout, msg);
+   fprintf(stdout, %s, msg);
fprintf(stdout,  */\n);
 }
 else {
fprintf(stderr, %s@%d: , level == 0 ? Warning : Error, line_no);
-   fprintf(stderr, msg);
+   fprintf(stderr, %s, msg);
fprintf(stderr, \n);
 }
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228640 - head/sys/mips/cavium/usb

2011-12-17 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Dec 17 15:42:37 2011
New Revision: 228640
URL: http://svn.freebsd.org/changeset/base/228640

Log:
  Unbreak the OCTEON1 kernel build after r228483 removing the left over
  declaration.
  
  MFC after:11 days

Modified:
  head/sys/mips/cavium/usb/octusb_octeon.c

Modified: head/sys/mips/cavium/usb/octusb_octeon.c
==
--- head/sys/mips/cavium/usb/octusb_octeon.cSat Dec 17 15:41:58 2011
(r228639)
+++ head/sys/mips/cavium/usb/octusb_octeon.cSat Dec 17 15:42:37 2011
(r228640)
@@ -69,7 +69,6 @@ static device_identify_t octusb_octeon_i
 static device_probe_t octusb_octeon_probe;
 static device_attach_t octusb_octeon_attach;
 static device_detach_t octusb_octeon_detach;
-static device_shutdown_t octusb_octeon_shutdown;
 
 struct octusb_octeon_softc {
struct octusb_softc sc_dci; /* must be first */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228641 - head/sbin/ifconfig

2011-12-17 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Dec 17 15:44:34 2011
New Revision: 228641
URL: http://svn.freebsd.org/changeset/base/228641

Log:
  Allow toggling of IFCAP_VLAN_HWCSUM for hardware that supports checksum
  offloading on vlans and document the new option.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sbin/ifconfig/ifconfig.8
  head/sbin/ifconfig/ifvlan.c

Modified: head/sbin/ifconfig/ifconfig.8
==
--- head/sbin/ifconfig/ifconfig.8   Sat Dec 17 15:42:37 2011
(r228640)
+++ head/sbin/ifconfig/ifconfig.8   Sat Dec 17 15:44:34 2011
(r228641)
@@ -28,7 +28,7 @@
 .\ From: @(#)ifconfig.8   8.3 (Berkeley) 1/5/94
 .\ $FreeBSD$
 .\
-.Dd December 16, 2011
+.Dd December 17, 2011
 .Dt IFCONFIG 8
 .Os
 .Sh NAME
@@ -423,10 +423,10 @@ they support in their capabilities.
 is a synonym for enabling all available WOL mechanisms.
 To disable WOL use
 .Fl wol .
-.It Cm vlanmtu , vlanhwtag, vlanhwfilter, vlanhwtso
+.It Cm vlanmtu , vlanhwtag, vlanhwfilter, vlanhwcsum, vlanhwtso
 If the driver offers user-configurable VLAN support, enable
 reception of extended frames, tag processing in hardware,
-frame filtering in hardware, or TSO on VLAN,
+frame filtering in hardware, checksum offloading, or TSO on VLAN,
 respectively.
 Note that this must be issued on a physical interface associated with
 .Xr vlan 4 ,

Modified: head/sbin/ifconfig/ifvlan.c
==
--- head/sbin/ifconfig/ifvlan.c Sat Dec 17 15:42:37 2011(r228640)
+++ head/sbin/ifconfig/ifvlan.c Sat Dec 17 15:44:34 2011(r228641)
@@ -183,6 +183,8 @@ static struct cmd vlan_cmds[] = {
DEF_CMD(-vlanhwfilter, -IFCAP_VLAN_HWFILTER,  setifcap),
DEF_CMD(-vlanhwtso,   -IFCAP_VLAN_HWTSO,  setifcap),
DEF_CMD(vlanhwtso,IFCAP_VLAN_HWTSO,   setifcap),
+   DEF_CMD(vlanhwcsum,   IFCAP_VLAN_HWCSUM,  setifcap),
+   DEF_CMD(-vlanhwcsum,  -IFCAP_VLAN_HWCSUM, setifcap),
 };
 static struct afswtch af_vlan = {
.af_name= af_vlan,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228642 - in head/sys: conf libkern sys

2011-12-17 Thread Andriy Gapon
Author: avg
Date: Sat Dec 17 15:48:55 2011
New Revision: 228642
URL: http://svn.freebsd.org/changeset/base/228642

Log:
  retire libkern gets
  
  Inspired by:  bde
  MFC after:2 months
  X-MFC-Note:   if deemed a part of KPI, just call cngets internally

Deleted:
  head/sys/libkern/gets.c
Modified:
  head/sys/conf/files
  head/sys/sys/libkern.h

Modified: head/sys/conf/files
==
--- head/sys/conf/files Sat Dec 17 15:44:34 2011(r228641)
+++ head/sys/conf/files Sat Dec 17 15:48:55 2011(r228642)
@@ -2530,7 +2530,6 @@ libkern/bcd.c standard
 libkern/bsearch.c  standard
 libkern/crc32.cstandard
 libkern/fnmatch.c  standard
-libkern/gets.c standard
 libkern/iconv.coptional libiconv
 libkern/iconv_converter_if.m   optional libiconv
 libkern/iconv_ucs.coptional libiconv

Modified: head/sys/sys/libkern.h
==
--- head/sys/sys/libkern.h  Sat Dec 17 15:44:34 2011(r228641)
+++ head/sys/sys/libkern.h  Sat Dec 17 15:48:55 2011(r228642)
@@ -90,7 +90,6 @@ intfls(int);
 int flsl(long);
 #endif
 int fnmatch(const char *, const char *, int);
-voidgets(char *, size_t, int);
 int locc(int, char *, u_int);
 void   *memchr(const void *s, int c, size_t n);
 int memcmp(const void *b1, const void *b2, size_t len);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228643 - head/sys/kern

2011-12-17 Thread Andriy Gapon
Author: avg
Date: Sat Dec 17 15:50:45 2011
New Revision: 228643
URL: http://svn.freebsd.org/changeset/base/228643

Log:
  belatedly transfer copyrights from libkern/gets.c to kern_cons.c
  
  MFC after:2 months
  MFC with: r228642

Modified:
  head/sys/kern/kern_cons.c

Modified: head/sys/kern/kern_cons.c
==
--- head/sys/kern/kern_cons.c   Sat Dec 17 15:48:55 2011(r228642)
+++ head/sys/kern/kern_cons.c   Sat Dec 17 15:50:45 2011(r228643)
@@ -1,6 +1,9 @@
 /*-
  * Copyright (c) 1988 University of Utah.
  * Copyright (c) 1991 The Regents of the University of California.
+ * Copyright (c) 1999 Michael Smith
+ * Copyright (c) 2005 Pawel Jakub Dawidek p...@freebsd.org
+ *
  * All rights reserved.
  *
  * This code is derived from software contributed to Berkeley by
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228644 - head/sys/dev/syscons

2011-12-17 Thread Andriy Gapon
Author: avg
Date: Sat Dec 17 15:57:39 2011
New Revision: 228644
URL: http://svn.freebsd.org/changeset/base/228644

Log:
  syscons: provide a first iteration of cngrab/cnungrab implementation
  
  - put underlying keyboard(s) into the polling mode for the whole
duration of the grab, instead of the previous behavior of going into
and out of the polling mode around each polling attempt
  - ditto for setting K_XLATE mode and enabling a disabled keyboard
  
  Inspired by:  bde
  MFC after:2 months

Modified:
  head/sys/dev/syscons/syscons.c
  head/sys/dev/syscons/syscons.h

Modified: head/sys/dev/syscons/syscons.c
==
--- head/sys/dev/syscons/syscons.c  Sat Dec 17 15:50:45 2011
(r228643)
+++ head/sys/dev/syscons/syscons.c  Sat Dec 17 15:57:39 2011
(r228644)
@@ -1613,11 +1613,46 @@ sc_cnterm(struct consdev *cp)
 static void
 sc_cngrab(struct consdev *cp)
 {
+scr_stat *scp;
+
+scp = sc_console-sc-cur_scp;
+if (scp-sc-kbd == NULL)
+   return;
+
+if (scp-grabbed++  0)
+   return;
+
+/*
+ * Make sure the keyboard is accessible even when the kbd device
+ * driver is disabled.
+ */
+kbdd_enable(scp-sc-kbd);
+
+/* we shall always use the keyboard in the XLATE mode here */
+scp-kbd_prev_mode = scp-kbd_mode;
+scp-kbd_mode = K_XLATE;
+(void)kbdd_ioctl(scp-sc-kbd, KDSKBMODE, (caddr_t)scp-kbd_mode);
+
+kbdd_poll(scp-sc-kbd, TRUE);
 }
 
 static void
 sc_cnungrab(struct consdev *cp)
 {
+scr_stat *scp;
+
+scp = sc_console-sc-cur_scp; /* XXX */
+if (scp-sc-kbd == NULL)
+   return;
+
+if (--scp-grabbed  0)
+   return;
+
+kbdd_poll(scp-sc-kbd, FALSE);
+
+scp-kbd_mode = scp-kbd_prev_mode;
+(void)kbdd_ioctl(scp-sc-kbd, KDSKBMODE, (caddr_t)scp-kbd_mode);
+kbdd_disable(scp-sc-kbd);
 }
 
 static void
@@ -1675,7 +1710,6 @@ sc_cngetc(struct consdev *cd)
 static int fkeycp;
 scr_stat *scp;
 const u_char *p;
-int cur_mode;
 int s = spltty();  /* block sckbdevent and scrn_timer while we poll */
 int c;
 
@@ -1699,25 +1733,7 @@ sc_cngetc(struct consdev *cd)
return -1;
 }
 
-/* 
- * Make sure the keyboard is accessible even when the kbd device
- * driver is disabled.
- */
-kbdd_enable(scp-sc-kbd);
-
-/* we shall always use the keyboard in the XLATE mode here */
-cur_mode = scp-kbd_mode;
-scp-kbd_mode = K_XLATE;
-(void)kbdd_ioctl(scp-sc-kbd, KDSKBMODE, (caddr_t)scp-kbd_mode);
-
-kbdd_poll(scp-sc-kbd, TRUE);
 c = scgetc(scp-sc, SCGETC_CN | SCGETC_NONBLOCK);
-kbdd_poll(scp-sc-kbd, FALSE);
-
-scp-kbd_mode = cur_mode;
-(void)kbdd_ioctl(scp-sc-kbd, KDSKBMODE, (caddr_t)scp-kbd_mode);
-kbdd_disable(scp-sc-kbd);
-splx(s);
 
 switch (KEYFLAGS(c)) {
 case 0:/* normal char */

Modified: head/sys/dev/syscons/syscons.h
==
--- head/sys/dev/syscons/syscons.h  Sat Dec 17 15:50:45 2011
(r228643)
+++ head/sys/dev/syscons/syscons.h  Sat Dec 17 15:57:39 2011
(r228644)
@@ -301,7 +301,9 @@ typedef struct scr_stat {
void*ts;
 
int status; /* status (bitfield) */
+   int grabbed;
int kbd_mode;   /* keyboard I/O mode */
+   int kbd_prev_mode;  /* keyboard I/O mode */
 
int cursor_pos; /* cursor buffer position */
int cursor_oldpos;  /* cursor old buffer position */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228645 - head/contrib/less

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sat Dec 17 16:10:14 2011
New Revision: 228645
URL: http://svn.freebsd.org/changeset/base/228645

Log:
  In contrib/less, cast away const a bunch of times, to make it build
  without conversion warnings.  This code desparately needs a good dose of
  const poison, but fixing all the issues would be rather disruptive.
  
  MFC after:1 week

Modified:
  head/contrib/less/command.c
  head/contrib/less/prompt.c

Modified: head/contrib/less/command.c
==
--- head/contrib/less/command.c Sat Dec 17 15:57:39 2011(r228644)
+++ head/contrib/less/command.c Sat Dec 17 16:10:14 2011(r228645)
@@ -1461,7 +1461,7 @@ commands()
error(Command not available, NULL_PARG);
break;
}
-   start_mca(A_EXAMINE, Examine: , ml_examine, 0);
+   start_mca(A_EXAMINE, Examine: , (void*)ml_examine, 0);
c = getcc();
goto again;
 #else
@@ -1491,7 +1491,7 @@ commands()
error(WARNING: This file was viewed via 
LESSOPEN,
NULL_PARG);
}
-   start_mca(A_SHELL, !, ml_shell, 0);
+   start_mca(A_SHELL, !, (void*)ml_shell, 0);
/*
 * Expand the editor prototype string
 * and pass it to the system to execute.
@@ -1655,7 +1655,7 @@ commands()
error(Command not available, NULL_PARG);
break;
}
-   start_mca(A_SHELL, !, ml_shell, 0);
+   start_mca(A_SHELL, !, (void*)ml_shell, 0);
c = getcc();
goto again;
 #else
@@ -1706,7 +1706,7 @@ commands()
if (badmark(c))
break;
pipec = c;
-   start_mca(A_PIPE, !, ml_shell, 0);
+   start_mca(A_PIPE, !, (void*)ml_shell, 0);
c = getcc();
goto again;
 #else

Modified: head/contrib/less/prompt.c
==
--- head/contrib/less/prompt.c  Sat Dec 17 15:57:39 2011(r228644)
+++ head/contrib/less/prompt.c  Sat Dec 17 16:10:14 2011(r228645)
@@ -555,7 +555,7 @@ pr_expand(proto, maxwidth)
public char *
 eq_message()
 {
-   return (pr_expand(eqproto, 0));
+   return (pr_expand((char*)eqproto, 0));
 }
 
 /*
@@ -572,7 +572,7 @@ pr_string()
 
type = (!less_is_more) ? pr_type : pr_type ? 0 : 1;
prompt = pr_expand((ch_getflags()  CH_HELPFILE) ?
-   hproto : prproto[type],
+   (char*)hproto : prproto[type],
sc_width-so_s_width-so_e_width-2);
new_file = 0;
return (prompt);
@@ -584,5 +584,5 @@ pr_string()
public char *
 wait_message()
 {
-   return (pr_expand(wproto, sc_width-so_s_width-so_e_width-2));
+   return (pr_expand((char*)wproto, sc_width-so_s_width-so_e_width-2));
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r228644 - head/sys/dev/syscons

2011-12-17 Thread Andriy Gapon
on 17/12/2011 17:57 Andriy Gapon said the following:
 Author: avg
 Date: Sat Dec 17 15:57:39 2011
 New Revision: 228644
 URL: http://svn.freebsd.org/changeset/base/228644
 
 Log:
   syscons: provide a first iteration of cngrab/cnungrab implementation
   
   - put underlying keyboard(s) into the polling mode for the whole
 duration of the grab, instead of the previous behavior of going into
 and out of the polling mode around each polling attempt
   - ditto for setting K_XLATE mode and enabling a disabled keyboard
   
   Inspired by:bde
   MFC after:  2 months
 
 Modified:
   head/sys/dev/syscons/syscons.c
   head/sys/dev/syscons/syscons.h
 
 Modified: head/sys/dev/syscons/syscons.c
 ==
 --- head/sys/dev/syscons/syscons.cSat Dec 17 15:50:45 2011
 (r228643)
 +++ head/sys/dev/syscons/syscons.cSat Dec 17 15:57:39 2011
 (r228644)
 @@ -1613,11 +1613,46 @@ sc_cnterm(struct consdev *cp)
  static void
  sc_cngrab(struct consdev *cp)
  {
 +scr_stat *scp;
 +
 +scp = sc_console-sc-cur_scp;
 +if (scp-sc-kbd == NULL)
 + return;
 +
 +if (scp-grabbed++  0)
 + return;
 +
 +/*
 + * Make sure the keyboard is accessible even when the kbd device
 + * driver is disabled.
 + */
 +kbdd_enable(scp-sc-kbd);
 +
 +/* we shall always use the keyboard in the XLATE mode here */
 +scp-kbd_prev_mode = scp-kbd_mode;
 +scp-kbd_mode = K_XLATE;
 +(void)kbdd_ioctl(scp-sc-kbd, KDSKBMODE, (caddr_t)scp-kbd_mode);
 +
 +kbdd_poll(scp-sc-kbd, TRUE);
  }

What people think about adding something like the following best effort attempt
to switch to console VTY?

Index: sys/dev/syscons/syscons.c
===
--- sys/dev/syscons/syscons.c   (revision 228644)
+++ sys/dev/syscons/syscons.c   (working copy)
@@ -1615,7 +1615,14 @@
 {
 scr_stat *scp;

+if (!cold 
+   sc_console-sc-cur_scp-index != sc_console-index 
+   sc_console-sc-cur_scp-smode.mode == VT_AUTO 
+   sc_console-smode.mode == VT_AUTO)
+   sc_switch_scr(sc_console-sc, sc_console-index);
+
 scp = sc_console-sc-cur_scp;
+
 if (scp-sc-kbd == NULL)
return;

The code is borrowed from scshutdown().

-- 
Andriy Gapon
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228646 - in head/libexec/rtld-elf: powerpc powerpc64

2011-12-17 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Sat Dec 17 16:20:27 2011
New Revision: 228646
URL: http://svn.freebsd.org/changeset/base/228646

Log:
  Additional icache paranoia: non-PLT relocations can modify the text segment.
  It is then important to make sure the icache is synchronized again to
  prevent (rare) random seg faults and illegal instructions.
  
  MFC after:3 days

Modified:
  head/libexec/rtld-elf/powerpc/reloc.c
  head/libexec/rtld-elf/powerpc64/reloc.c

Modified: head/libexec/rtld-elf/powerpc/reloc.c
==
--- head/libexec/rtld-elf/powerpc/reloc.c   Sat Dec 17 16:10:14 2011
(r228645)
+++ head/libexec/rtld-elf/powerpc/reloc.c   Sat Dec 17 16:20:27 2011
(r228646)
@@ -317,6 +317,10 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry 
 done:
if (cache != NULL)
free(cache);
+
+   /* Synchronize icache for text seg in case we made any changes */
+   __syncicache(obj-mapbase, obj-textsize);
+
return (r);
 }
 

Modified: head/libexec/rtld-elf/powerpc64/reloc.c
==
--- head/libexec/rtld-elf/powerpc64/reloc.c Sat Dec 17 16:10:14 2011
(r228645)
+++ head/libexec/rtld-elf/powerpc64/reloc.c Sat Dec 17 16:20:27 2011
(r228646)
@@ -313,9 +313,12 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry 
}
r = 0;
 done:
-   if (cache) {
+   if (cache)
munmap(cache, bytes);
-   }
+
+   /* Synchronize icache for text seg in case we made any changes */
+   __syncicache(obj-mapbase, obj-textsize);
+
return (r);
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228647 - head/usr.bin/mail

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sat Dec 17 16:30:42 2011
New Revision: 228647
URL: http://svn.freebsd.org/changeset/base/228647

Log:
  In usr.bin/mail/cmd1.c, use the correct printf length modifier for a
  ptrdiff_t.  In usr.bin/mail/main.c, cast a field width to int.
  
  MFC after:1 week

Modified:
  head/usr.bin/mail/cmd1.c
  head/usr.bin/mail/main.c

Modified: head/usr.bin/mail/cmd1.c
==
--- head/usr.bin/mail/cmd1.cSat Dec 17 16:20:27 2011(r228646)
+++ head/usr.bin/mail/cmd1.cSat Dec 17 16:30:42 2011(r228647)
@@ -210,7 +210,7 @@ printhead(int mesg)
 int
 pdot(void)
 {
-   printf(%d\n, dot - message[0] + 1);
+   printf(%td\n, dot - message[0] + 1);
return (0);
 }
 

Modified: head/usr.bin/mail/main.c
==
--- head/usr.bin/mail/main.cSat Dec 17 16:20:27 2011(r228646)
+++ head/usr.bin/mail/main.cSat Dec 17 16:30:42 2011(r228647)
@@ -206,7 +206,7 @@ Usage: %s [-dEiInv] [-s subject] [-c cc-
%*s [-sendmail-option ...]\n\
%s [-dEHiInNv] [-F] -f [name]\n\
%s [-dEHiInNv] [-F] [-u user]\n\
-   %s [-d] -e [-f name]\n, __progname, strlen(__progname), ,
+   %s [-d] -e [-f name]\n, __progname, (int)strlen(__progname), ,
__progname, __progname, __progname);
exit(1);
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228648 - in head/sys: kern sys

2011-12-17 Thread Mikolaj Golub
Author: trociny
Date: Sat Dec 17 16:59:22 2011
New Revision: 228648
URL: http://svn.freebsd.org/changeset/base/228648

Log:
  On start most of sysctl_kern_proc functions use the same pattern:
  locate a process calling pfind() and do some additional checks like
  p_candebug(). To reduce this code duplication a new function pget() is
  introduced and used.
  
  As the function may be useful not only in kern_proc.c it is in the
  kernel name space.
  
  Suggested by: kib
  Reviewed by:  kib
  MFC after:2 weeks

Modified:
  head/sys/kern/kern_proc.c
  head/sys/sys/proc.h

Modified: head/sys/kern/kern_proc.c
==
--- head/sys/kern/kern_proc.c   Sat Dec 17 16:30:42 2011(r228647)
+++ head/sys/kern/kern_proc.c   Sat Dec 17 16:59:22 2011(r228648)
@@ -330,6 +330,55 @@ pgfind(pgid)
 }
 
 /*
+ * Locate process and do additional manipulations, depending on flags.
+ */
+int
+pget(pid_t pid, int flags, struct proc **pp)
+{
+   struct proc *p;
+   int error;
+
+   p = pfind(pid);
+   if (p == NULL)
+   return (ESRCH);
+   if ((flags  PGET_CANSEE) != 0) {
+   error = p_cansee(curthread, p);
+   if (error != 0)
+   goto errout;
+   }
+   if ((flags  PGET_CANDEBUG) != 0) {
+   error = p_candebug(curthread, p);
+   if (error != 0)
+   goto errout;
+   }
+   if ((flags  PGET_ISCURRENT) != 0  curproc != p) {
+   error = EPERM;
+   goto errout;
+   }
+   if ((flags  PGET_NOTWEXIT) != 0  (p-p_flag  P_WEXIT) != 0) {
+   error = ESRCH;
+   goto errout;
+   }
+   if ((flags  PGET_NOTINEXEC) != 0  (p-p_flag  P_INEXEC) != 0) {
+   /*
+* XXXRW: Not clear ESRCH is the right error during proc
+* execve().
+*/
+   error = ESRCH;
+   goto errout;
+   }
+   if ((flags  PGET_HOLD) != 0) {
+   _PHOLD(p);
+   PROC_UNLOCK(p);
+   }
+   *pp = p;
+   return (0);
+errout:
+   PROC_UNLOCK(p);
+   return (error);
+}
+
+/*
  * Create a new process group.
  * pgid must be equal to the pid of p.
  * Begin a new session if required.
@@ -1177,13 +1226,9 @@ sysctl_kern_proc(SYSCTL_HANDLER_ARGS)
error = sysctl_wire_old_buffer(req, 0);
if (error)
return (error); 
-   p = pfind((pid_t)name[0]);
-   if (!p)
-   return (ESRCH);
-   if ((error = p_cansee(curthread, p))) {
-   PROC_UNLOCK(p);
+   error = pget((pid_t)name[0], PGET_CANSEE, p);
+   if (error != 0)
return (error);
-   }
error = sysctl_out_proc(p, req, flags);
return (error);
}
@@ -1661,24 +1706,17 @@ sysctl_kern_proc_args(SYSCTL_HANDLER_ARG
struct pargs *newpa, *pa;
struct proc *p;
struct sbuf sb;
-   int error = 0, error2;
+   int flags, error = 0, error2;
 
if (namelen != 1) 
return (EINVAL);
 
-   p = pfind((pid_t)name[0]);
-   if (!p)
-   return (ESRCH);
-
-   if ((error = p_cansee(curthread, p)) != 0) {
-   PROC_UNLOCK(p);
+   flags = PGET_CANSEE;
+   if (req-newptr != NULL)
+   flags |= PGET_ISCURRENT;
+   error = pget((pid_t)name[0], flags, p);
+   if (error)
return (error);
-   }
-
-   if (req-newptr  curproc != p) {
-   PROC_UNLOCK(p);
-   return (EPERM);
-   }
 
pa = p-p_args;
if (pa != NULL) {
@@ -1733,23 +1771,14 @@ sysctl_kern_proc_env(SYSCTL_HANDLER_ARGS
if (namelen != 1)
return (EINVAL);
 
-   p = pfind((pid_t)name[0]);
-   if (p == NULL)
-   return (ESRCH);
-   if ((p-p_flag  P_WEXIT) != 0) {
-   PROC_UNLOCK(p);
-   return (ESRCH);
-   }
-   if ((error = p_candebug(curthread, p)) != 0) {
-   PROC_UNLOCK(p);
+   error = pget((pid_t)name[0], PGET_WANTREAD, p);
+   if (error != 0)
return (error);
-   }
if ((p-p_flag  P_SYSTEM) != 0) {
-   PROC_UNLOCK(p);
+   PRELE(p);
return (0);
}
-   _PHOLD(p);
-   PROC_UNLOCK(p);
+
sbuf_new_for_sysctl(sb, NULL, GET_PS_STRINGS_CHUNK_SZ, req);
error = proc_getenvv(curthread, p, sb, req-oldlen);
error2 = sbuf_finish(sb);
@@ -1775,24 +1804,13 @@ sysctl_kern_proc_auxv(SYSCTL_HANDLER_ARG
if (namelen != 1)
return (EINVAL);
 
-   p = pfind((pid_t)name[0]);
-   if (p == NULL)
-   return (ESRCH);
-   if (p-p_flag  P_WEXIT) {
-   PROC_UNLOCK(p);
- 

svn commit: r228649 - head/usr.bin/ncplist

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sat Dec 17 17:04:30 2011
New Revision: 228649
URL: http://svn.freebsd.org/changeset/base/228649

Log:
  Use NO_WCAST_ALIGN for usr.bin/ncplist, as there are many potential
  alignment issues in it.  (Though I doubt anyone still cares about
  NetWare support...)
  
  MFC after:1 week

Modified:
  head/usr.bin/ncplist/Makefile

Modified: head/usr.bin/ncplist/Makefile
==
--- head/usr.bin/ncplist/Makefile   Sat Dec 17 16:59:22 2011
(r228648)
+++ head/usr.bin/ncplist/Makefile   Sat Dec 17 17:04:30 2011
(r228649)
@@ -1,6 +1,7 @@
 # $FreeBSD$
 
 PROG=  ncplist
+NO_WCAST_ALIGN=
 
 DPADD= ${LIBNCP} ${LIBIPX}
 LDADD= -lncp -lipx
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228650 - head/usr.bin/netstat

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sat Dec 17 17:21:47 2011
New Revision: 228650
URL: http://svn.freebsd.org/changeset/base/228650

Log:
  In usr.bin/netstat/atalk.c, work around a clang false positive with
  printf format warnings and conditional operators.
  
  MFC after:1 week

Modified:
  head/usr.bin/netstat/atalk.c

Modified: head/usr.bin/netstat/atalk.c
==
--- head/usr.bin/netstat/atalk.cSat Dec 17 17:04:30 2011
(r228649)
+++ head/usr.bin/netstat/atalk.cSat Dec 17 17:21:47 2011
(r228650)
@@ -81,7 +81,7 @@ staticchar mybuf[50];
return(*);
}
}
-   sprintf(mybuf,%hu,ntohs(sat-sat_addr.s_net));
+   sprintf(mybuf,%hu,(short)ntohs(sat-sat_addr.s_net));
return mybuf;
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228651 - head/contrib/telnet/telnet

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sat Dec 17 18:18:36 2011
New Revision: 228651
URL: http://svn.freebsd.org/changeset/base/228651

Log:
  In contrib/telnet/telnet/utilities.c, fix a few warnings about format
  strings not being literals.
  
  MFC after:1 week

Modified:
  head/contrib/telnet/telnet/utilities.c

Modified: head/contrib/telnet/telnet/utilities.c
==
--- head/contrib/telnet/telnet/utilities.c  Sat Dec 17 17:21:47 2011
(r228650)
+++ head/contrib/telnet/telnet/utilities.c  Sat Dec 17 18:18:36 2011
(r228651)
@@ -782,7 +782,7 @@ printsub(char direction, unsigned char *
fprintf(NetTrace, \ VAR  + noquote);
} else
 #endif /* OLD_ENVIRON */
-   fprintf(NetTrace, \ VALUE  + noquote);
+   fprintf(NetTrace, %s, \ VALUE  + noquote);
noquote = 2;
break;
 
@@ -798,17 +798,17 @@ printsub(char direction, unsigned char *
fprintf(NetTrace, \ VALUE  + noquote);
} else
 #endif /* OLD_ENVIRON */
-   fprintf(NetTrace, \ VAR  + noquote);
+   fprintf(NetTrace, %s, \ VAR  + noquote);
noquote = 2;
break;
 
case ENV_ESC:
-   fprintf(NetTrace, \ ESC  + noquote);
+   fprintf(NetTrace, %s, \ ESC  + noquote);
noquote = 2;
break;
 
case ENV_USERVAR:
-   fprintf(NetTrace, \ USERVAR  + noquote);
+   fprintf(NetTrace, %s, \ USERVAR  + noquote);
noquote = 2;
break;
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228652 - head/usr.bin/vacation

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sat Dec 17 18:39:04 2011
New Revision: 228652
URL: http://svn.freebsd.org/changeset/base/228652

Log:
  Unfortunately, clang gives warnings about sendmail code that cannot be
  turned off yet.  Since this is contrib code, and we don't really care
  about the warnings, just turn make them non-fatal for now.
  
  MFC after:1 week

Modified:
  head/usr.bin/vacation/Makefile

Modified: head/usr.bin/vacation/Makefile
==
--- head/usr.bin/vacation/Makefile  Sat Dec 17 18:18:36 2011
(r228651)
+++ head/usr.bin/vacation/Makefile  Sat Dec 17 18:39:04 2011
(r228652)
@@ -11,6 +11,13 @@ CFLAGS+=-D_FFR_LISTDB -D_FFR_DEBUG
 
 WARNS?=2
 
+.if ${CC:T:Mclang} == clang
+# Unfortunately, clang gives warnings about sendmail code that cannot
+# be turned off yet.  Since this is contrib code, and we don't really
+# care about the warnings, just turn make them non-fatal for now.
+NO_WERROR=
+.endif
+
 LIBSMDIR=  ${.OBJDIR}/../../lib/libsm
 LIBSM= ${LIBSMDIR}/libsm.a
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228653 - in head/sys: netinet netinet6

2011-12-17 Thread Michael Tuexen
Author: tuexen
Date: Sat Dec 17 19:21:40 2011
New Revision: 228653
URL: http://svn.freebsd.org/changeset/base/228653

Log:
  Fix unused parameter warnings.
  While there, fix some whitespace issues.
  
  MFC after: 3 months.

Modified:
  head/sys/netinet/sctp.h
  head/sys/netinet/sctp_asconf.c
  head/sys/netinet/sctp_asconf.h
  head/sys/netinet/sctp_auth.c
  head/sys/netinet/sctp_auth.h
  head/sys/netinet/sctp_bsd_addr.c
  head/sys/netinet/sctp_bsd_addr.h
  head/sys/netinet/sctp_cc_functions.c
  head/sys/netinet/sctp_constants.h
  head/sys/netinet/sctp_crc32.h
  head/sys/netinet/sctp_dtrace_declare.h
  head/sys/netinet/sctp_dtrace_define.h
  head/sys/netinet/sctp_header.h
  head/sys/netinet/sctp_indata.c
  head/sys/netinet/sctp_indata.h
  head/sys/netinet/sctp_input.c
  head/sys/netinet/sctp_input.h
  head/sys/netinet/sctp_os.h
  head/sys/netinet/sctp_output.c
  head/sys/netinet/sctp_output.h
  head/sys/netinet/sctp_pcb.c
  head/sys/netinet/sctp_pcb.h
  head/sys/netinet/sctp_peeloff.c
  head/sys/netinet/sctp_peeloff.h
  head/sys/netinet/sctp_ss_functions.c
  head/sys/netinet/sctp_structs.h
  head/sys/netinet/sctp_sysctl.c
  head/sys/netinet/sctp_sysctl.h
  head/sys/netinet/sctp_timer.c
  head/sys/netinet/sctp_timer.h
  head/sys/netinet/sctp_uio.h
  head/sys/netinet/sctp_usrreq.c
  head/sys/netinet/sctp_var.h
  head/sys/netinet/sctputil.c
  head/sys/netinet/sctputil.h
  head/sys/netinet6/sctp6_usrreq.c
  head/sys/netinet6/sctp6_var.h

Modified: head/sys/netinet/sctp.h
==
--- head/sys/netinet/sctp.h Sat Dec 17 18:39:04 2011(r228652)
+++ head/sys/netinet/sctp.h Sat Dec 17 19:21:40 2011(r228653)
@@ -7,11 +7,11 @@
  * modification, are permitted provided that the following conditions are met:
  *
  * a) Redistributions of source code must retain the above copyright notice,
- *   this list of conditions and the following disclaimer.
+ *this list of conditions and the following disclaimer.
  *
  * b) Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in
- *   the documentation and/or other materials provided with the distribution.
+ *the documentation and/or other materials provided with the distribution.
  *
  * c) Neither the name of Cisco Systems, Inc. nor the names of its
  *contributors may be used to endorse or promote products derived

Modified: head/sys/netinet/sctp_asconf.c
==
--- head/sys/netinet/sctp_asconf.c  Sat Dec 17 18:39:04 2011
(r228652)
+++ head/sys/netinet/sctp_asconf.c  Sat Dec 17 19:21:40 2011
(r228653)
@@ -7,11 +7,11 @@
  * modification, are permitted provided that the following conditions are met:
  *
  * a) Redistributions of source code must retain the above copyright notice,
- *   this list of conditions and the following disclaimer.
+ *this list of conditions and the following disclaimer.
  *
  * b) Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in
- *   the documentation and/or other materials provided with the distribution.
+ *the documentation and/or other materials provided with the distribution.
  *
  * c) Neither the name of Cisco Systems, Inc. nor the names of its
  *contributors may be used to endorse or promote products derived
@@ -1261,8 +1261,7 @@ sctp_path_check_and_react(struct sctp_tc
  * flag: 1=success, 0=failure.
  */
 static void
-sctp_asconf_addr_mgmt_ack(struct sctp_tcb *stcb, struct sctp_ifa *addr,
-uint16_t type, uint32_t flag)
+sctp_asconf_addr_mgmt_ack(struct sctp_tcb *stcb, struct sctp_ifa *addr, 
uint32_t flag)
 {
/*
 * do the necessary asoc list work- if we get a failure indication,
@@ -1712,7 +1711,7 @@ sctp_asconf_process_param_ack(struct sct
case SCTP_ADD_IP_ADDRESS:
SCTPDBG(SCTP_DEBUG_ASCONF1,
process_param_ack: added IP address\n);
-   sctp_asconf_addr_mgmt_ack(stcb, aparam-ifa, param_type, flag);
+   sctp_asconf_addr_mgmt_ack(stcb, aparam-ifa, flag);
break;
case SCTP_DEL_IP_ADDRESS:
SCTPDBG(SCTP_DEBUG_ASCONF1,
@@ -2102,7 +2101,7 @@ sctp_addr_mgmt_assoc(struct sctp_inpcb *
 
 
 int
-sctp_asconf_iterator_ep(struct sctp_inpcb *inp, void *ptr, uint32_t val)
+sctp_asconf_iterator_ep(struct sctp_inpcb *inp, void *ptr, uint32_t val 
SCTP_UNUSED)
 {
struct sctp_asconf_iterator *asc;
struct sctp_ifa *ifa;
@@ -2150,7 +2149,7 @@ sctp_asconf_iterator_ep(struct sctp_inpc
 }
 
 static int
-sctp_asconf_iterator_ep_end(struct sctp_inpcb *inp, void *ptr, uint32_t val)
+sctp_asconf_iterator_ep_end(struct sctp_inpcb *inp, void *ptr, uint32_t val 
SCTP_UNUSED)
 {
struct sctp_ifa *ifa;
struct sctp_asconf_iterator *asc;
@@ -2182,7 

svn commit: r228654 - head/usr.bin/vmstat

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sat Dec 17 19:22:24 2011
New Revision: 228654
URL: http://svn.freebsd.org/changeset/base/228654

Log:
  In usr.bin/vmstat/vmstat.c, cast several printf field widths to int, and
  use printf format specifiers from inttypes.h for uint64_t's.
  
  MFC after:1 week

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

Modified: head/usr.bin/vmstat/vmstat.c
==
--- head/usr.bin/vmstat/vmstat.cSat Dec 17 19:21:40 2011
(r228653)
+++ head/usr.bin/vmstat/vmstat.cSat Dec 17 19:22:24 2011
(r228654)
@@ -62,6 +62,7 @@ __FBSDID($FreeBSD$);
 #include devstat.h
 #include err.h
 #include errno.h
+#include inttypes.h
 #include kvm.h
 #include limits.h
 #include memstat.h
@@ -1185,18 +1186,18 @@ dointr(void)
istrnamlen = clen;
tintrname += clen + 1;
}
-   (void)printf(%-*s %20s %10s\n, istrnamlen, interrupt, total,
+   (void)printf(%-*s %20s %10s\n, (int)istrnamlen, interrupt, total,
rate);
inttotal = 0;
for (i = 0; i  nintr; i++) {
if (intrname[0] != '\0'  (*intrcnt != 0 || aflag))
-   (void)printf(%-*s %20lu %10lu\n, istrnamlen, intrname,
-   *intrcnt, *intrcnt / uptime);
+   (void)printf(%-*s %20lu %10lu\n, (int)istrnamlen,
+   intrname, *intrcnt, *intrcnt / uptime);
intrname += strlen(intrname) + 1;
inttotal += *intrcnt++;
}
-   (void)printf(%-*s %20llu %10llu\n, istrnamlen, Total,
-   (long long)inttotal, (long long)(inttotal / uptime));
+   (void)printf(%-*s %20 PRIu64  %10 PRIu64 \n, (int)istrnamlen,
+   Total, inttotal, inttotal / uptime);
 }
 
 static void
@@ -1235,9 +1236,9 @@ domemstat_malloc(void)
if (memstat_get_numallocs(mtp) == 0 
memstat_get_count(mtp) == 0)
continue;
-   printf(%13s %5lld %5lldK %7s %8lld  ,
+   printf(%13s %5 PRIu64  %5 PRIu64 K %7s %8 PRIu64   ,
memstat_get_name(mtp), memstat_get_count(mtp),
-   ((int64_t)memstat_get_bytes(mtp) + 1023) / 1024, -,
+   (memstat_get_bytes(mtp) + 1023) / 1024, -,
memstat_get_numallocs(mtp));
first = 1;
for (i = 0; i  32; i++) {
@@ -1289,7 +1290,8 @@ domemstat_zone(void)
mtp = memstat_mtl_next(mtp)) {
strlcpy(name, memstat_get_name(mtp), MEMTYPE_MAXNAME);
strcat(name, :);
-   printf(%-20s %6llu, 
%6llu,%8llu,%8llu,%8llu,%4llu,%4llu\n,name,
+   printf(%-20s %6 PRIu64 , %6 PRIu64 ,%8 PRIu64 ,%8 PRIu64
+   ,%8 PRIu64 ,%4 PRIu64 ,%4 PRIu64 \n, name,
memstat_get_size(mtp), memstat_get_countlimit(mtp),
memstat_get_count(mtp), memstat_get_free(mtp),
memstat_get_numallocs(mtp), memstat_get_failures(mtp),
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228655 - head/usr.sbin/bluetooth/sdpd

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sat Dec 17 19:26:03 2011
New Revision: 228655
URL: http://svn.freebsd.org/changeset/base/228655

Log:
  In usr.sbin/bluetooth/sdpd/server.c, don't use the size of a pointer as
  the length argument to memset, but the size of the object pointed to.
  
  MFC after:1 week

Modified:
  head/usr.sbin/bluetooth/sdpd/server.c

Modified: head/usr.sbin/bluetooth/sdpd/server.c
==
--- head/usr.sbin/bluetooth/sdpd/server.c   Sat Dec 17 19:22:24 2011
(r228654)
+++ head/usr.sbin/bluetooth/sdpd/server.c   Sat Dec 17 19:26:03 2011
(r228655)
@@ -73,7 +73,7 @@ server_init(server_p srv, char const *co
assert(srv != NULL);
assert(control != NULL);
 
-   memset(srv, 0, sizeof(srv));
+   memset(srv, 0, sizeof(*srv));
 
/* Open control socket */
if (unlink(control)  0  errno != ENOENT) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228656 - head/usr.sbin/boot0cfg

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sat Dec 17 19:33:26 2011
New Revision: 228656
URL: http://svn.freebsd.org/changeset/base/228656

Log:
  Use NO_WCAST_ALIGN for usr.sbin/boot0cfg; because this is only built for
  x86, any alignment warnings can be safely ignored.
  
  MFC after:1 week

Modified:
  head/usr.sbin/boot0cfg/Makefile

Modified: head/usr.sbin/boot0cfg/Makefile
==
--- head/usr.sbin/boot0cfg/Makefile Sat Dec 17 19:26:03 2011
(r228655)
+++ head/usr.sbin/boot0cfg/Makefile Sat Dec 17 19:33:26 2011
(r228656)
@@ -6,4 +6,6 @@ MAN=boot0cfg.8
 DPADD= ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF}
 LDADD= -lgeom -lbsdxml -lsbuf
 
+NO_WCAST_ALIGN=
+
 .include bsd.prog.mk
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228657 - head/usr.sbin/bsnmpd/modules/snmp_wlan

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sat Dec 17 19:53:08 2011
New Revision: 228657
URL: http://svn.freebsd.org/changeset/base/228657

Log:
  In usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.h, use the correct
  enumeration types for the mesh_peering and mesh_forwarding members of
  struct wlan_iface, to fix enum conversion warnings.
  
  MFC after:1 week

Modified:
  head/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.h

Modified: head/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.h
==
--- head/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.h  Sat Dec 17 19:33:26 
2011(r228656)
+++ head/usr.sbin/bsnmpd/modules/snmp_wlan/wlan_snmp.h  Sat Dec 17 19:53:08 
2011(r228657)
@@ -175,8 +175,8 @@ struct wlan_iface {
struct wlan_maclist mac_maclist;
 
uint32_tmesh_ttl;
-   enum TruthValue mesh_peering;
-   enum TruthValue mesh_forwarding;
+   enum wlanMeshPeeringEnabled mesh_peering;
+   enum wlanMeshForwardingEnabled  mesh_forwarding;
enum wlanMeshMetric mesh_metric;
enum wlanMeshPath   mesh_path;
enum wlanHWMPRootMode   hwmp_root_mode;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228658 - head/usr.sbin/cpucontrol

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sat Dec 17 19:58:48 2011
New Revision: 228658
URL: http://svn.freebsd.org/changeset/base/228658

Log:
  Use NO_WCAST_ALIGN for usr.sbin/cpucontrol; because this is only built
  for x86, any alignment warnings can be safely ignored.
  
  MFC after:1 week

Modified:
  head/usr.sbin/cpucontrol/Makefile

Modified: head/usr.sbin/cpucontrol/Makefile
==
--- head/usr.sbin/cpucontrol/Makefile   Sat Dec 17 19:53:08 2011
(r228657)
+++ head/usr.sbin/cpucontrol/Makefile   Sat Dec 17 19:58:48 2011
(r228658)
@@ -4,4 +4,6 @@ PROG=   cpucontrol
 MAN=   cpucontrol.8
 SRCS=  cpucontrol.c intel.c amd.c via.c
 
+NO_WCAST_ALIGN=
+
 .include bsd.prog.mk
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228659 - head/usr.sbin/ctm/ctm_dequeue

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sat Dec 17 20:07:42 2011
New Revision: 228659
URL: http://svn.freebsd.org/changeset/base/228659

Log:
  In usr.sbin/ctm/ctm_dequeue/ctm_dequeue.c, cast a printf field width
  parameter to int.
  
  MFC after:1 week

Modified:
  head/usr.sbin/ctm/ctm_dequeue/ctm_dequeue.c

Modified: head/usr.sbin/ctm/ctm_dequeue/ctm_dequeue.c
==
--- head/usr.sbin/ctm/ctm_dequeue/ctm_dequeue.c Sat Dec 17 19:58:48 2011
(r228658)
+++ head/usr.sbin/ctm/ctm_dequeue/ctm_dequeue.c Sat Dec 17 20:07:42 2011
(r228659)
@@ -143,7 +143,7 @@ main(int argc, char **argv)
 */
npieces = atoi(ftsent-fts_name[ftsent-fts_namelen-3]);
piece = atoi(ftsent-fts_name[ftsent-fts_namelen-7]);
-   err(%.*s %d/%d sent, ftsent-fts_namelen-8, ftsent-fts_name,
+   err(%.*s %d/%d sent, (int)(ftsent-fts_namelen-8), ftsent-fts_name,
piece, npieces);
 
if (chunk++ == num_to_send)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228660 - head/usr.sbin/i2c

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sat Dec 17 20:12:17 2011
New Revision: 228660
URL: http://svn.freebsd.org/changeset/base/228660

Log:
  In usr.sbin/i2c/i2c.c, fix a few warnings about format strings not being
  literals.
  
  MFC after:1 week

Modified:
  head/usr.sbin/i2c/i2c.c

Modified: head/usr.sbin/i2c/i2c.c
==
--- head/usr.sbin/i2c/i2c.c Sat Dec 17 20:07:42 2011(r228659)
+++ head/usr.sbin/i2c/i2c.c Sat Dec 17 20:12:17 2011(r228660)
@@ -360,7 +360,7 @@ err1:
fprintf(stderr, error sending stop condtion\n);
 err2:
if (err_msg)
-   fprintf(stderr, err_msg);
+   fprintf(stderr, %s, err_msg);
 
close(fd);
return (1);
@@ -453,7 +453,7 @@ err1:
fprintf(stderr, error sending stop condtion\n);
 err2:
if (err_msg)
-   fprintf(stderr, err_msg);
+   fprintf(stderr, %s, err_msg);
 
close(fd);
return (1);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228661 - head/usr.sbin/iostat

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sat Dec 17 20:25:23 2011
New Revision: 228661
URL: http://svn.freebsd.org/changeset/base/228661

Log:
  In usr.sbin/iostat/iostat.c, use printf format specifiers from
  inttypes.h for u_int64_t's.  While here, sort #include directives.
  
  MFC after:1 week

Modified:
  head/usr.sbin/iostat/iostat.c

Modified: head/usr.sbin/iostat/iostat.c
==
--- head/usr.sbin/iostat/iostat.c   Sat Dec 17 20:12:17 2011
(r228660)
+++ head/usr.sbin/iostat/iostat.c   Sat Dec 17 20:25:23 2011
(r228661)
@@ -101,19 +101,20 @@
 #include sys/resource.h
 #include sys/sysctl.h
 
-#include err.h
 #include ctype.h
+#include devstat.h
+#include err.h
 #include fcntl.h
+#include inttypes.h
 #include kvm.h
+#include limits.h
+#include math.h
 #include nlist.h
 #include stdio.h
 #include stdlib.h
 #include string.h
 #include termios.h
 #include unistd.h
-#include limits.h
-#include devstat.h
-#include math.h
 
 struct nlist namelist[] = {
 #define X_TK_NIN   0
@@ -818,7 +819,7 @@ devstats(int perf_select, long double et
mb_per_second_write  ((long double).0005)/1024 ||
busy_pct  0.5) {
if (Iflag == 0)
-   printf(%-8.8s %5.1Lf %5.1Lf %7.1Lf 
%7.1Lf %4qu %5.1Lf %3.0Lf ,
+   printf(%-8.8s %5.1Lf %5.1Lf %7.1Lf 
%7.1Lf %4 PRIu64  %5.1Lf %3.0Lf ,
devname, transfers_per_second_read,
transfers_per_second_write,
mb_per_second_read * 1024,
@@ -826,7 +827,7 @@ devstats(int perf_select, long double et
queue_len,
ms_per_transaction, busy_pct);
else
-   printf(%-8.8s %5.1Lf %5.1Lf %7.1Lf 
%7.1Lf %4qu %5.1Lf %3.0Lf ,
+   printf(%-8.8s %5.1Lf %5.1Lf %7.1Lf 
%7.1Lf %4 PRIu64  %5.1Lf %3.0Lf ,
devname,
(long double)total_transfers_read,
(long double)total_transfers_write,
@@ -863,7 +864,7 @@ devstats(int perf_select, long double et
   msdig,
   ms_per_transaction);
else
-   printf(%4.1qu%4.1qu%5.*Lf ,
+   printf(%4.1 PRIu64 %4.1 PRIu64 %5.*Lf ,
   total_blocks,
   total_transfers,
   msdig,
@@ -878,7 +879,7 @@ devstats(int perf_select, long double et
total_mb = total_bytes;
total_mb /= 1024 * 1024;
 
-   printf( %5.2Lf %3.1qu %5.2Lf ,
+   printf( %5.2Lf %3.1 PRIu64  %5.2Lf ,
   kb_per_transfer,
   total_transfers,
   total_mb);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228662 - head/usr.sbin/keyserv

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sat Dec 17 20:53:06 2011
New Revision: 228662
URL: http://svn.freebsd.org/changeset/base/228662

Log:
  In usr.sbin/keyserv, fix some implicit enum conversions, and use the
  correct printf length modifiers for uid_t.
  
  MFC after:1 week

Modified:
  head/usr.sbin/keyserv/crypt_server.c
  head/usr.sbin/keyserv/keyserv.c

Modified: head/usr.sbin/keyserv/crypt_server.c
==
--- head/usr.sbin/keyserv/crypt_server.cSat Dec 17 20:25:23 2011
(r228661)
+++ head/usr.sbin/keyserv/crypt_server.cSat Dec 17 20:53:06 2011
(r228662)
@@ -223,8 +223,8 @@ des_crypt_1_svc(desargs *argp, struct sv
 
bcopy(argp-des_key, dparm.des_key, 8);
bcopy(argp-des_ivec, dparm.des_ivec, 8);
-   dparm.des_mode = argp-des_mode;
-   dparm.des_dir = argp-des_dir;
+   dparm.des_mode = (argp-des_mode == CBC_DES) ? CBC : ECB;
+   dparm.des_dir = (argp-des_dir == ENCRYPT_DES) ? ENCRYPT : DECRYPT;
 #ifdef BROKEN_DES
dparm.UDES.UDES_buf = argp-desbuf.desbuf_val;
 #endif

Modified: head/usr.sbin/keyserv/keyserv.c
==
--- head/usr.sbin/keyserv/keyserv.c Sat Dec 17 20:25:23 2011
(r228661)
+++ head/usr.sbin/keyserv/keyserv.c Sat Dec 17 20:53:06 2011
(r228662)
@@ -361,7 +361,7 @@ key_set_1_svc_prog(uid, key)
static keystatus status;
 
if (debugging) {
-   (void) fprintf(stderr, set(%ld, %.*s) = , uid,
+   (void) fprintf(stderr, set(%u, %.*s) = , uid,
(int) sizeof (keybuf), key);
}
status = pk_setkey(uid, key);
@@ -380,7 +380,7 @@ key_encrypt_pk_2_svc_prog(uid, arg)
static cryptkeyres res;
 
if (debugging) {
-   (void) fprintf(stderr, encrypt(%ld, %s, %08x%08x) = , uid,
+   (void) fprintf(stderr, encrypt(%u, %s, %08x%08x) = , uid,
arg-remotename, arg-deskey.key.high,
arg-deskey.key.low);
}
@@ -408,7 +408,7 @@ key_decrypt_pk_2_svc_prog(uid, arg)
static cryptkeyres res;
 
if (debugging) {
-   (void) fprintf(stderr, decrypt(%ld, %s, %08x%08x) = , uid,
+   (void) fprintf(stderr, decrypt(%u, %s, %08x%08x) = , uid,
arg-remotename, arg-deskey.key.high,
arg-deskey.key.low);
}
@@ -460,7 +460,7 @@ key_net_get_2_svc_prog(uid, arg)
static key_netstres keynetname;
 
if (debugging)
-   (void) fprintf(stderr, net_get(%ld) = , uid);
+   (void) fprintf(stderr, net_get(%u) = , uid);
 
keynetname.status = pk_netget(uid, keynetname.key_netstres_u.knet);
if (debugging) {
@@ -489,8 +489,8 @@ key_get_conv_2_svc_prog(uid, arg)
static cryptkeyres  res;
 
if (debugging)
-   (void) fprintf(stderr, get_conv(%ld, %.*s) = , uid,
-   (int)sizeof (arg), arg);
+   (void) fprintf(stderr, get_conv(%u, %.*s) = , uid,
+   (int)sizeof (keybuf), arg);
 
 
res.status = pk_get_conv_key(uid, arg, res);
@@ -517,7 +517,7 @@ key_encrypt_1_svc_prog(uid, arg)
static cryptkeyres res;
 
if (debugging) {
-   (void) fprintf(stderr, encrypt(%ld, %s, %08x%08x) = , uid,
+   (void) fprintf(stderr, encrypt(%u, %s, %08x%08x) = , uid,
arg-remotename, arg-deskey.key.high,
arg-deskey.key.low);
}
@@ -545,7 +545,7 @@ key_decrypt_1_svc_prog(uid, arg)
static cryptkeyres res;
 
if (debugging) {
-   (void) fprintf(stderr, decrypt(%ld, %s, %08x%08x) = , uid,
+   (void) fprintf(stderr, decrypt(%u, %s, %08x%08x) = , uid,
arg-remotename, arg-deskey.key.high,
arg-deskey.key.low);
}
@@ -789,7 +789,7 @@ root_auth(trans, rqstp)
}
 
if (debugging)
-   fprintf(stderr, local_uid  %ld\n, uid);
+   fprintf(stderr, local_uid  %u\n, uid);
if (uid == 0)
return (1);
if (rqstp-rq_cred.oa_flavor == AUTH_SYS) {
@@ -800,7 +800,7 @@ root_auth(trans, rqstp)
} else {
if (debugging)
fprintf(stderr,
-   local_uid  %ld mismatches auth %ld\n, uid,
+   local_uid  %u mismatches auth %u\n, uid,
 ((uid_t) ((struct authunix_parms *)rqstp-rq_clntcred)-aup_uid));
return (0);
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r228625 - head/usr.bin/csup

2011-12-17 Thread mdf
On Sat, Dec 17, 2011 at 5:14 AM, Dimitry Andric d...@freebsd.org wrote:
 Author: dim
 Date: Sat Dec 17 13:14:44 2011
 New Revision: 228625
 URL: http://svn.freebsd.org/changeset/base/228625

 Log:
  In usr.bin/csup/auth.c, use the correct number of bytes for zeroing the
  shared secret, and use long long format to snprintf a time_t.

If casting is necessary, style prefers intmax_t or uintmax_t, since
those are always wide enough.

Thanks,
matthew

  MFC after:    1 week

 Modified:
  head/usr.bin/csup/auth.c

 Modified: head/usr.bin/csup/auth.c
 ==
 --- head/usr.bin/csup/auth.c    Sat Dec 17 12:52:58 2011        (r228624)
 +++ head/usr.bin/csup/auth.c    Sat Dec 17 13:14:44 2011        (r228625)
 @@ -254,7 +254,7 @@ auth_makesecret(struct srvrecord *auth,
        MD5_Update(md5, :, 1);
        MD5_Update(md5, auth-password, strlen(auth-password));
        MD5_Final(md5sum, md5);
 -       memset(secret, 0, sizeof(secret));
 +       memset(secret, 0, MD5_CHARS_MAX);
        strcpy(secret, md5salt);
        auth_readablesum(md5sum, secret + strlen(md5salt));
  }
 @@ -302,8 +302,9 @@ auth_makechallenge(struct config *config
        }
        gettimeofday(tv, NULL);
        MD5_Init(md5);
 -       snprintf(buf, sizeof(buf), %s:%ld:%ld:%ld:%d:%d,
 -           inet_ntoa(laddr.sin_addr), tv.tv_sec, tv.tv_usec, random(), pid, 
 ppid);
 +       snprintf(buf, sizeof(buf), %s:%lld:%ld:%ld:%d:%d,
 +           inet_ntoa(laddr.sin_addr), (long long)tv.tv_sec, tv.tv_usec,
 +           random(), pid, ppid);
        MD5_Update(md5, buf, strlen(buf));
        MD5_Final(md5sum, md5);
        auth_readablesum(md5sum, challenge);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228663 - head/usr.sbin/lpr/filters

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sat Dec 17 21:37:21 2011
New Revision: 228663
URL: http://svn.freebsd.org/changeset/base/228663

Log:
  In usr.sbin/lpr/filters/lpf.c, use a less obtuse way of clearing the
  buffer, that also avoids warnings.
  
  MFC after:1 week

Modified:
  head/usr.sbin/lpr/filters/lpf.c

Modified: head/usr.sbin/lpr/filters/lpf.c
==
--- head/usr.sbin/lpr/filters/lpf.c Sat Dec 17 20:53:06 2011
(r228662)
+++ head/usr.sbin/lpr/filters/lpf.c Sat Dec 17 21:37:21 2011
(r228663)
@@ -55,6 +55,7 @@ __FBSDID($FreeBSD$);
 #include unistd.h
 #include stdlib.h
 #include stdio.h
+#include string.h
 
 #define MAXWIDTH  132
 #define MAXREP10
@@ -115,7 +116,7 @@ main(int argc, char *argv[])
acctfile = cp;
}
 
-   for (cp = buf[0], limit = buf[MAXREP]; cp  limit; *cp++ = ' ');
+   memset(buf, ' ', sizeof(buf));
done = 0;
 
while (!done) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r228663 - head/usr.sbin/lpr/filters

2011-12-17 Thread Kostik Belousov
On Sat, Dec 17, 2011 at 09:37:22PM +, Dimitry Andric wrote:
 Author: dim
 Date: Sat Dec 17 21:37:21 2011
 New Revision: 228663
 URL: http://svn.freebsd.org/changeset/base/228663
 
 Log:
   In usr.sbin/lpr/filters/lpf.c, use a less obtuse way of clearing the
   buffer, that also avoids warnings.
   
   MFC after:  1 week
 
 Modified:
   head/usr.sbin/lpr/filters/lpf.c
 
 Modified: head/usr.sbin/lpr/filters/lpf.c
 ==
 --- head/usr.sbin/lpr/filters/lpf.c   Sat Dec 17 20:53:06 2011
 (r228662)
 +++ head/usr.sbin/lpr/filters/lpf.c   Sat Dec 17 21:37:21 2011
 (r228663)
 @@ -55,6 +55,7 @@ __FBSDID($FreeBSD$);
  #include unistd.h
  #include stdlib.h
  #include stdio.h
 +#include string.h
  
  #define MAXWIDTH  132
  #define MAXREP10
 @@ -115,7 +116,7 @@ main(int argc, char *argv[])
   acctfile = cp;
   }
  
 - for (cp = buf[0], limit = buf[MAXREP]; cp  limit; *cp++ = ' ');
 + memset(buf, ' ', sizeof(buf));
   done = 0;
buf is two-dimensional array. This change looks wrong.

  
   while (!done) {


pgpR71ytY8TYv.pgp
Description: PGP signature


Re: svn commit: r228663 - head/usr.sbin/lpr/filters

2011-12-17 Thread Dimitry Andric
On 2011-12-17 22:44, Kostik Belousov wrote:
  #define MAXWIDTH  132
  #define MAXREP10
 @@ -115,7 +116,7 @@ main(int argc, char *argv[])
  acctfile = cp;
  }
  
 -for (cp = buf[0], limit = buf[MAXREP]; cp  limit; *cp++ = ' ');
 +memset(buf, ' ', sizeof(buf));
  done = 0;
 buf is two-dimensional array. This change looks wrong.

The for loop took the address of the left-top corner of the
two-dimensional array, and iterated with a char pointer to the address
just after the right-bottom corner of the array.  It was in effect a
memset, just hand-written.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r228650 - head/usr.bin/netstat

2011-12-17 Thread Bjoern A. Zeeb

On 17. Dec 2011, at 17:21 , Dimitry Andric wrote:

 Author: dim
 Date: Sat Dec 17 17:21:47 2011
 New Revision: 228650
 URL: http://svn.freebsd.org/changeset/base/228650
 
 Log:
  In usr.bin/netstat/atalk.c, work around a clang false positive with
  printf format warnings and conditional operators.
 

This does not sound like a good idea.  Make clang work.


  MFC after:   1 week
 
 Modified:
  head/usr.bin/netstat/atalk.c
 
 Modified: head/usr.bin/netstat/atalk.c
 ==
 --- head/usr.bin/netstat/atalk.c  Sat Dec 17 17:04:30 2011
 (r228649)
 +++ head/usr.bin/netstat/atalk.c  Sat Dec 17 17:21:47 2011
 (r228650)
 @@ -81,7 +81,7 @@ static  char mybuf[50];
   return(*);
   }
   }
 - sprintf(mybuf,%hu,ntohs(sat-sat_addr.s_net));
 + sprintf(mybuf,%hu,(short)ntohs(sat-sat_addr.s_net));
   return mybuf;
 }
 

-- 
Bjoern A. Zeeb You have to have visions!
 Stop bit received. Insert coin for new address family.

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r228625 - head/usr.bin/csup

2011-12-17 Thread Dimitry Andric
On 2011-12-17 22:32, m...@freebsd.org wrote:
...
  In usr.bin/csup/auth.c, use the correct number of bytes for zeroing the
  shared secret, and use long long format to snprintf a time_t.
 If casting is necessary, style prefers intmax_t or uintmax_t, since
 those are always wide enough.

I don't see anything about that in style(9), maybe it should be added
then?  In any case, I only changed the %ld format to %lld, because
time_t is int, long or long long depending on arch.  Long long is just
the widest type required in this case.

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r228625 - head/usr.bin/csup

2011-12-17 Thread Bjoern A. Zeeb

On 17. Dec 2011, at 21:54 , Dimitry Andric wrote:

 On 2011-12-17 22:32, m...@freebsd.org wrote:
 ...
 In usr.bin/csup/auth.c, use the correct number of bytes for zeroing the
 shared secret, and use long long format to snprintf a time_t.
 If casting is necessary, style prefers intmax_t or uintmax_t, since
 those are always wide enough.
 
 I don't see anything about that in style(9), maybe it should be added
 then?  In any case, I only changed the %ld format to %lld, because
 time_t is int, long or long long depending on arch.  Long long is just
 the widest type required in this case.

time_t is not always int.  See sparc64.

-- 
Bjoern A. Zeeb You have to have visions!
 Stop bit received. Insert coin for new address family.

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r228650 - head/usr.bin/netstat

2011-12-17 Thread Dimitry Andric
On 2011-12-17 22:53, Bjoern A. Zeeb wrote:
 
 On 17. Dec 2011, at 17:21 , Dimitry Andric wrote:
 
 Author: dim
 Date: Sat Dec 17 17:21:47 2011
 New Revision: 228650
 URL: http://svn.freebsd.org/changeset/base/228650

 Log:
  In usr.bin/netstat/atalk.c, work around a clang false positive with
  printf format warnings and conditional operators.

 
 This does not sound like a good idea.  Make clang work.

It's already being worked on, see:

  http://lists.cs.uiuc.edu/pipermail/cfe-dev/2011-November/018464.html

and:

  http://llvm.org/bugs/show_bug.cgi?id=11313

Meanwhile, this is just a temporary workaround.  If you think it is too
disruptive, I can just add NO_WFORMAT to the Makefile instead.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r228625 - head/usr.bin/csup

2011-12-17 Thread Bjoern A. Zeeb

On 17. Dec 2011, at 21:56 , Bjoern A. Zeeb wrote:

 
 On 17. Dec 2011, at 21:54 , Dimitry Andric wrote:
 
 On 2011-12-17 22:32, m...@freebsd.org wrote:
 ...
 In usr.bin/csup/auth.c, use the correct number of bytes for zeroing the
 shared secret, and use long long format to snprintf a time_t.
 If casting is necessary, style prefers intmax_t or uintmax_t, since
 those are always wide enough.
 
 I don't see anything about that in style(9), maybe it should be added
 then?  In any case, I only changed the %ld format to %lld, because
 time_t is int, long or long long depending on arch.  Long long is just
 the widest type required in this case.
 
 time_t is not always int.  See sparc64.

gnargh, sorry.  But yes we prefer a well defined type to a type that is 
different
per arch.  %lld has constantly been a printf problem in the past.

/bz

-- 
Bjoern A. Zeeb You have to have visions!
 Stop bit received. Insert coin for new address family.

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r228650 - head/usr.bin/netstat

2011-12-17 Thread Bjoern A. Zeeb

On 17. Dec 2011, at 21:58 , Dimitry Andric wrote:

 On 2011-12-17 22:53, Bjoern A. Zeeb wrote:
 
 On 17. Dec 2011, at 17:21 , Dimitry Andric wrote:
 
 Author: dim
 Date: Sat Dec 17 17:21:47 2011
 New Revision: 228650
 URL: http://svn.freebsd.org/changeset/base/228650
 
 Log:
 In usr.bin/netstat/atalk.c, work around a clang false positive with
 printf format warnings and conditional operators.
 
 
 This does not sound like a good idea.  Make clang work.
 
 It's already being worked on, see:
 
  http://lists.cs.uiuc.edu/pipermail/cfe-dev/2011-November/018464.html
 
 and:
 
  http://llvm.org/bugs/show_bug.cgi?id=11313
 
 Meanwhile, this is just a temporary workaround.  If you think it is too
 disruptive, I can just add NO_WFORMAT to the Makefile instead.

I'd prefer we do not start mangling source code for things that are
not a problem with the code and just a problem with the warning level.

Especially if the change will not be required anymore in the future.
A Makefile option we can easily identify and grep for, a cast we just
forget.

/bz

-- 
Bjoern A. Zeeb You have to have visions!
 Stop bit received. Insert coin for new address family.

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228664 - head/usr.sbin/lpr/lpd

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sat Dec 17 22:05:28 2011
New Revision: 228664
URL: http://svn.freebsd.org/changeset/base/228664

Log:
  In usr.sbin/lpr/lpd/printjob.c, use the correct printf length modifiers
  for off_t (aka int64_t).
  
  MFC after:1 week

Modified:
  head/usr.sbin/lpr/lpd/printjob.c

Modified: head/usr.sbin/lpr/lpd/printjob.c
==
--- head/usr.sbin/lpr/lpd/printjob.cSat Dec 17 21:37:21 2011
(r228663)
+++ head/usr.sbin/lpr/lpd/printjob.cSat Dec 17 22:05:28 2011
(r228664)
@@ -62,6 +62,7 @@ __FBSDID($FreeBSD$);
 #include fcntl.h
 #include dirent.h
 #include errno.h
+#include inttypes.h
 #include stdio.h
 #include string.h
 #include stdlib.h
@@ -1138,9 +1139,10 @@ sendagain:
copycnt++;
 
if (copycnt  2)
-   (void) sprintf(buf, %c%qd %s\n, type, stb.st_size, file);
+   (void) sprintf(buf, %c% PRId64  %s\n, type, stb.st_size,
+   file);
else
-   (void) sprintf(buf, %c%qd %s_c%d\n, type, stb.st_size,
+   (void) sprintf(buf, %c% PRId64  %s_c%d\n, type, stb.st_size,
file, copycnt);
amt = strlen(buf);
for (i = 0;  ; i++) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228665 - head/usr.sbin/ndiscvt

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sat Dec 17 22:16:27 2011
New Revision: 228665
URL: http://svn.freebsd.org/changeset/base/228665

Log:
  Use NO_WCAST_ALIGN for usr.sbin/ndiscvt; because this is only built for
  x86, any alignment warnings can be safely ignored.  Define YY_NO_INPUT
  in usr.sbin/ndiscvt/inf-token.l, so no unused lex functions are defined.
  
  MFC after:1 week

Modified:
  head/usr.sbin/ndiscvt/Makefile
  head/usr.sbin/ndiscvt/inf-token.l

Modified: head/usr.sbin/ndiscvt/Makefile
==
--- head/usr.sbin/ndiscvt/Makefile  Sat Dec 17 22:05:28 2011
(r228664)
+++ head/usr.sbin/ndiscvt/Makefile  Sat Dec 17 22:16:27 2011
(r228665)
@@ -11,6 +11,7 @@ MAN=  ndiscvt.8
 MAN+=  ndisgen.8
 
 WARNS?=4
+NO_WCAST_ALIGN=
 
 DPADD=  ${LIBL}
 LDADD=  -ll

Modified: head/usr.sbin/ndiscvt/inf-token.l
==
--- head/usr.sbin/ndiscvt/inf-token.l   Sat Dec 17 22:05:28 2011
(r228664)
+++ head/usr.sbin/ndiscvt/inf-token.l   Sat Dec 17 22:16:27 2011
(r228665)
@@ -44,6 +44,7 @@ __FBSDID($FreeBSD$);
 
 int lineno = 1;
 #define YY_NO_UNPUT
+#define YY_NO_INPUT
 
 int yylex(void);
 void yyerror(const char *);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228666 - head/sys/kern

2011-12-17 Thread Mikolaj Golub
Author: trociny
Date: Sat Dec 17 22:18:26 2011
New Revision: 228666
URL: http://svn.freebsd.org/changeset/base/228666

Log:
  Fix style and white spaces.
  
  MFC after:1 week

Modified:
  head/sys/kern/kern_proc.c

Modified: head/sys/kern/kern_proc.c
==
--- head/sys/kern/kern_proc.c   Sat Dec 17 22:16:27 2011(r228665)
+++ head/sys/kern/kern_proc.c   Sat Dec 17 22:18:26 2011(r228666)
@@ -1206,7 +1206,7 @@ sysctl_out_proc(struct proc *p, struct s
 static int
 sysctl_kern_proc(SYSCTL_HANDLER_ARGS)
 {
-   int *name = (int*) arg1;
+   int *name = (int *)arg1;
u_int namelen = arg2;
struct proc *p;
int flags, doingzomb, oid_number;
@@ -1221,11 +1221,11 @@ sysctl_kern_proc(SYSCTL_HANDLER_ARGS)
oid_number = ~KERN_PROC_INC_THREAD;
}
if (oid_number == KERN_PROC_PID) {
-   if (namelen != 1) 
+   if (namelen != 1)
return (EINVAL);
error = sysctl_wire_old_buffer(req, 0);
if (error)
-   return (error); 
+   return (error);
error = pget((pid_t)name[0], PGET_CANSEE, p);
if (error != 0)
return (error);
@@ -1247,7 +1247,7 @@ sysctl_kern_proc(SYSCTL_HANDLER_ARGS)
return (EINVAL);
break;
}
-   
+
if (!req-oldptr) {
/* overestimate by 5 procs */
error = SYSCTL_OUT(req, 0, sizeof (struct kinfo_proc) * 5);
@@ -1327,7 +1327,7 @@ sysctl_kern_proc(SYSCTL_HANDLER_ARGS)
/* XXX proctree_lock */
SESS_LOCK(p-p_session);
if (p-p_session-s_ttyp == NULL ||
-   tty_udev(p-p_session-s_ttyp) != 
+   tty_udev(p-p_session-s_ttyp) !=
(dev_t)name[0]) {
SESS_UNLOCK(p-p_session);
PROC_UNLOCK(p);
@@ -1701,14 +1701,14 @@ proc_getenvv(struct thread *td, struct p
 static int
 sysctl_kern_proc_args(SYSCTL_HANDLER_ARGS)
 {
-   int *name = (int*) arg1;
+   int *name = (int *)arg1;
u_int namelen = arg2;
struct pargs *newpa, *pa;
struct proc *p;
struct sbuf sb;
int flags, error = 0, error2;
 
-   if (namelen != 1) 
+   if (namelen != 1)
return (EINVAL);
 
flags = PGET_CANSEE;
@@ -1762,7 +1762,7 @@ sysctl_kern_proc_args(SYSCTL_HANDLER_ARG
 static int
 sysctl_kern_proc_env(SYSCTL_HANDLER_ARGS)
 {
-   int *name = (int*) arg1;
+   int *name = (int *)arg1;
u_int namelen = arg2;
struct proc *p;
struct sbuf sb;
@@ -1794,7 +1794,7 @@ sysctl_kern_proc_env(SYSCTL_HANDLER_ARGS
 static int
 sysctl_kern_proc_auxv(SYSCTL_HANDLER_ARGS)
 {
-   int *name = (int*) arg1;
+   int *name = (int *)arg1;
u_int namelen = arg2;
struct proc *p;
size_t vsize, size;
@@ -1882,7 +1882,7 @@ sysctl_kern_proc_sv_name(SYSCTL_HANDLER_
int error;
 
namelen = arg2;
-   if (namelen != 1) 
+   if (namelen != 1)
return (EINVAL);
 
name = (int *)arg1;
@@ -2379,7 +2379,7 @@ sysctl_kern_proc_groups(SYSCTL_HANDLER_A
 static int
 sysctl_kern_proc_rlimit(SYSCTL_HANDLER_ARGS)
 {
-   int *name = (int*) arg1;
+   int *name = (int *)arg1;
u_int namelen = arg2;
struct plimit *limp;
struct proc *p;
@@ -2415,7 +2415,7 @@ sysctl_kern_proc_rlimit(SYSCTL_HANDLER_A
 static int
 sysctl_kern_proc_ps_strings(SYSCTL_HANDLER_ARGS)
 {
-   int *name = (int*) arg1;
+   int *name = (int *)arg1;
u_int namelen = arg2;
struct proc *p;
vm_offset_t ps_strings;
@@ -2467,10 +2467,10 @@ static SYSCTL_NODE(_kern_proc, KERN_PROC
 static SYSCTL_NODE(_kern_proc, KERN_PROC_SESSION, sid, CTLFLAG_RD |
CTLFLAG_MPSAFE, sysctl_kern_proc, Process table);
 
-static SYSCTL_NODE(_kern_proc, KERN_PROC_TTY, tty, CTLFLAG_RD | 
CTLFLAG_MPSAFE, 
+static SYSCTL_NODE(_kern_proc, KERN_PROC_TTY, tty, CTLFLAG_RD | CTLFLAG_MPSAFE,
sysctl_kern_proc, Process table);
 
-static SYSCTL_NODE(_kern_proc, KERN_PROC_UID, uid, CTLFLAG_RD | 
CTLFLAG_MPSAFE, 
+static SYSCTL_NODE(_kern_proc, KERN_PROC_UID, uid, CTLFLAG_RD | CTLFLAG_MPSAFE,
sysctl_kern_proc, Process table);
 
 static SYSCTL_NODE(_kern_proc, KERN_PROC_RUID, ruid, CTLFLAG_RD | 
CTLFLAG_MPSAFE,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228667 - head/usr.bin/csup

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sat Dec 17 22:20:46 2011
New Revision: 228667
URL: http://svn.freebsd.org/changeset/base/228667

Log:
  In usr.bin/csup/auth.c, cast time_t to intmax_t instead, and use the
  corresponding printf length modifier.
  
  Requested by: mdf
  MFC after:1 week

Modified:
  head/usr.bin/csup/auth.c

Modified: head/usr.bin/csup/auth.c
==
--- head/usr.bin/csup/auth.cSat Dec 17 22:18:26 2011(r228666)
+++ head/usr.bin/csup/auth.cSat Dec 17 22:20:46 2011(r228667)
@@ -302,8 +302,8 @@ auth_makechallenge(struct config *config
}
gettimeofday(tv, NULL);
MD5_Init(md5);
-   snprintf(buf, sizeof(buf), %s:%lld:%ld:%ld:%d:%d,
-   inet_ntoa(laddr.sin_addr), (long long)tv.tv_sec, tv.tv_usec,
+   snprintf(buf, sizeof(buf), %s:%jd:%ld:%ld:%d:%d,
+   inet_ntoa(laddr.sin_addr), (intmax_t)tv.tv_sec, tv.tv_usec,
random(), pid, ppid);
MD5_Update(md5, buf, strlen(buf));
MD5_Final(md5sum, md5);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228668 - head/usr.bin/netstat

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sat Dec 17 22:32:00 2011
New Revision: 228668
URL: http://svn.freebsd.org/changeset/base/228668

Log:
  Revert r228650, and work around the clang false positive with printf
  formats in usr.bin/netstat/atalk.c by conditionally adding NO_WFORMAT to
  the Makefile instead.
  
  MFC after:1 week

Modified:
  head/usr.bin/netstat/Makefile
  head/usr.bin/netstat/atalk.c

Modified: head/usr.bin/netstat/Makefile
==
--- head/usr.bin/netstat/Makefile   Sat Dec 17 22:20:46 2011
(r228667)
+++ head/usr.bin/netstat/Makefile   Sat Dec 17 22:32:00 2011
(r228668)
@@ -8,6 +8,11 @@ SRCS=  if.c inet.c main.c mbuf.c mroute.c
unix.c atalk.c mroute6.c ipsec.c bpf.c pfkey.c sctp.c
 
 WARNS?=3
+.if ${CC:T:Mclang} == clang
+# XXX: Work around a clang false positive with format string warnings
+# and ntohs macros (see LLVM PR 11313).
+NO_WFORMAT=
+.endif
 CFLAGS+=-fno-strict-aliasing
 
 CFLAGS+=-DIPSEC

Modified: head/usr.bin/netstat/atalk.c
==
--- head/usr.bin/netstat/atalk.cSat Dec 17 22:20:46 2011
(r228667)
+++ head/usr.bin/netstat/atalk.cSat Dec 17 22:32:00 2011
(r228668)
@@ -81,7 +81,7 @@ staticchar mybuf[50];
return(*);
}
}
-   sprintf(mybuf,%hu,(short)ntohs(sat-sat_addr.s_net));
+   sprintf(mybuf,%hu,ntohs(sat-sat_addr.s_net));
return mybuf;
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r228668 - head/usr.bin/netstat

2011-12-17 Thread Dimitry Andric
On 2011-12-17 23:32, Dimitry Andric wrote:
 Author: dim
 Date: Sat Dec 17 22:32:00 2011
 New Revision: 228668
 URL: http://svn.freebsd.org/changeset/base/228668
 
 Log:
   Revert r228650, and work around the clang false positive with printf
   formats in usr.bin/netstat/atalk.c by conditionally adding NO_WFORMAT to
   the Makefile instead.
   
   MFC after:  1 week

Requested by:   bz
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228669 - head/usr.bin/du

2011-12-17 Thread Jilles Tjoelker
Author: jilles
Date: Sat Dec 17 23:18:14 2011
New Revision: 228669
URL: http://svn.freebsd.org/changeset/base/228669

Log:
  du: Allow multiple -HLP options, the last one wins.
  
  This matches 4.4BSD tradition and other utilities with these options and is
  required by POSIX (POSIX does not specify -P, only -HL).
  
  MFC after:2 weeks

Modified:
  head/usr.bin/du/du.1
  head/usr.bin/du/du.c

Modified: head/usr.bin/du/du.1
==
--- head/usr.bin/du/du.1Sat Dec 17 22:32:00 2011(r228668)
+++ head/usr.bin/du/du.1Sat Dec 17 23:18:14 2011(r228669)
@@ -28,7 +28,7 @@
 .\@(#)du.18.2 (Berkeley) 4/1/94
 .\ $FreeBSD$
 .\
-.Dd December 8, 2011
+.Dd December 17, 2011
 .Dt DU 1
 .Os
 .Sh NAME
@@ -155,6 +155,13 @@ or
 .Fl L
 option is specified, storage used by any symbolic links which are
 followed is not counted (or displayed).
+The
+.Fl H ,
+.Fl L
+and
+.Fl P
+options override each other and the command's actions are determined
+by the last one specified.
 .Pp
 The
 .Fl h, k

Modified: head/usr.bin/du/du.c
==
--- head/usr.bin/du/du.cSat Dec 17 22:32:00 2011(r228668)
+++ head/usr.bin/du/du.cSat Dec 17 23:18:14 2011(r228669)
@@ -89,18 +89,18 @@ main(int argc, char *argv[])
off_t   threshold, threshold_sign;
int ftsoptions;
int depth;
-   int Hflag, Lflag, Pflag, aflag, sflag, dflag, cflag;
+   int Hflag, Lflag, aflag, sflag, dflag, cflag;
int hflag, lflag, ch, notused, rval;
char**save;
static char dot[] = .;
 
setlocale(LC_ALL, );
 
-   Hflag = Lflag = Pflag = aflag = sflag = dflag = cflag = hflag =
+   Hflag = Lflag = aflag = sflag = dflag = cflag = hflag =
lflag = Aflag = 0;
 
save = argv;
-   ftsoptions = 0;
+   ftsoptions = FTS_PHYSICAL;
savednumber = 0;
threshold = 0;
threshold_sign = 1;
@@ -125,19 +125,17 @@ main(int argc, char *argv[])
break;
case 'H':
Hflag = 1;
+   Lflag = 0;
break;
case 'I':
ignoreadd(optarg);
break;
case 'L':
-   if (Pflag)
-   usage();
Lflag = 1;
+   Hflag = 0;
break;
case 'P':
-   if (Lflag)
-   usage();
-   Pflag = 1;
+   Hflag = Lflag = 0;
break;
case 'a':
aflag = 1;
@@ -210,20 +208,12 @@ main(int argc, char *argv[])
 * the man page, so it's a feature.
 */
 
-   if (Hflag + Lflag + Pflag  1)
-   usage();
-
-   if (Hflag + Lflag + Pflag == 0)
-   Pflag = 1;  /* -P (physical) is default */
-
if (Hflag)
ftsoptions |= FTS_COMFOLLOW;
-
-   if (Lflag)
+   if (Lflag) {
+   ftsoptions = ~FTS_PHYSICAL;
ftsoptions |= FTS_LOGICAL;
-
-   if (Pflag)
-   ftsoptions |= FTS_PHYSICAL;
+   }
 
if (!Aflag  (cblocksize % DEV_BSIZE) != 0)
cblocksize = howmany(cblocksize, DEV_BSIZE) * DEV_BSIZE;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228670 - head/usr.sbin/pkg_install/updating

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sat Dec 17 23:35:46 2011
New Revision: 228670
URL: http://svn.freebsd.org/changeset/base/228670

Log:
  In usr.sbin/pkg_install/updating/main.c, use the size of the destination
  buffer as size argument to strlcpy(), not the length of the source.
  
  MFC after:1 week

Modified:
  head/usr.sbin/pkg_install/updating/main.c

Modified: head/usr.sbin/pkg_install/updating/main.c
==
--- head/usr.sbin/pkg_install/updating/main.c   Sat Dec 17 23:18:14 2011
(r228669)
+++ head/usr.sbin/pkg_install/updating/main.c   Sat Dec 17 23:35:46 2011
(r228670)
@@ -141,7 +141,7 @@ main(int argc, char *argv[])
strcmp(pkgdbdir-d_name, ..) != 0) {
 
/* Create path to +CONTENTS file for 
each installed port */
-   n = strlcpy(tmp_file, pkgdbpath, 
strlen(pkgdbpath)+1);
+   n = strlcpy(tmp_file, pkgdbpath, 
sizeof(tmp_file));
n = strlcpy(tmp_file + n, /, 
sizeof(tmp_file) - n);
n = strlcat(tmp_file + n, 
pkgdbdir-d_name,
sizeof(tmp_file) - n);
@@ -181,7 +181,7 @@ main(int argc, char *argv[])

(void)exit(EXIT_FAILURE);
if (pname[strlen(pname) 
- 1] == '\n')

pname[strlen(pname) - 1] = '\0';
-   strlcpy (curr-name, 
pname, strlen(pname)+1);
+   strlcpy (curr-name, 
pname, sizeof(curr-name));
curr-next = head;
head = curr;
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228671 - head/usr.sbin/pmccontrol

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sat Dec 17 23:39:13 2011
New Revision: 228671
URL: http://svn.freebsd.org/changeset/base/228671

Log:
  In usr.sbin/pmccontrol/pmccontrol.c, fix a few warnings about format
  strings not being literals.
  
  MFC after:1 week

Modified:
  head/usr.sbin/pmccontrol/pmccontrol.c

Modified: head/usr.sbin/pmccontrol/pmccontrol.c
==
--- head/usr.sbin/pmccontrol/pmccontrol.c   Sat Dec 17 23:35:46 2011
(r228670)
+++ head/usr.sbin/pmccontrol/pmccontrol.c   Sat Dec 17 23:39:13 2011
(r228671)
@@ -452,7 +452,7 @@ main(int argc, char **argv)
 
case '?':
warnx(Unrecognized option \-%c\, optopt);
-   errx(EX_USAGE, usage_message);
+   errx(EX_USAGE, %s, usage_message);
break;
 
default:
@@ -462,7 +462,7 @@ main(int argc, char **argv)
}
 
if (command == PMCC_PRINT_USAGE)
-   (void) errx(EX_USAGE, usage_message);
+   (void) errx(EX_USAGE, %s, usage_message);
 
if (error)
exit(EX_USAGE);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228672 - head/contrib/pnpinfo

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sat Dec 17 23:43:40 2011
New Revision: 228672
URL: http://svn.freebsd.org/changeset/base/228672

Log:
  In contrib/pnpinfo/pnpinfo.c, remove an extraneous parameter from the
  call to isolation_protocol().
  
  MFC after:1 week

Modified:
  head/contrib/pnpinfo/pnpinfo.c

Modified: head/contrib/pnpinfo/pnpinfo.c
==
--- head/contrib/pnpinfo/pnpinfo.c  Sat Dec 17 23:39:13 2011
(r228671)
+++ head/contrib/pnpinfo/pnpinfo.c  Sat Dec 17 23:43:40 2011
(r228672)
@@ -599,7 +599,7 @@ main(int argc, char **argv)
 /* Try various READ_DATA ports from 0x203-0x3ff */
 for (rd_port = 0x80; (rd_port  0xff); rd_port += 0x10) {
DEB(printf(Trying Read_Port at %x...\n, (rd_port  2) | 0x3) );
-   num_pnp_devs = isolation_protocol(rd_port);
+   num_pnp_devs = isolation_protocol();
if (num_pnp_devs)
break;
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228673 - head/usr.sbin/pw

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sat Dec 17 23:46:47 2011
New Revision: 228673
URL: http://svn.freebsd.org/changeset/base/228673

Log:
  In usr.sbin/pw/pw_user.c, use the correct printf length modifier for a
  ptrdiff_t.
  
  MFC after:1 week

Modified:
  head/usr.sbin/pw/pw_user.c

Modified: head/usr.sbin/pw/pw_user.c
==
--- head/usr.sbin/pw/pw_user.c  Sat Dec 17 23:43:40 2011(r228672)
+++ head/usr.sbin/pw/pw_user.c  Sat Dec 17 23:46:47 2011(r228673)
@@ -1208,7 +1208,7 @@ pw_checkname(u_char *name, int gecos)
if (reject) {
snprintf(showch, sizeof(showch), (*ch = ' '  *ch  127)
? `%c' : 0x%02x, *ch);
-   errx(EX_DATAERR, invalid character %s at position %d in %s,
+   errx(EX_DATAERR, invalid character %s at position %td in %s,
showch, (ch - name), showtype);
}
if (!gecos  (ch - name)  LOGNAMESIZE)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r228625 - head/usr.bin/csup

2011-12-17 Thread mdf
On Sat, Dec 17, 2011 at 1:54 PM, Dimitry Andric d...@freebsd.org wrote:
 On 2011-12-17 22:32, m...@freebsd.org wrote:
 ...
  In usr.bin/csup/auth.c, use the correct number of bytes for zeroing the
  shared secret, and use long long format to snprintf a time_t.
 If casting is necessary, style prefers intmax_t or uintmax_t, since
 those are always wide enough.

 I don't see anything about that in style(9), maybe it should be added
 then?

Probably; Bruce has mentioned it many times in the past, and as bz@
notes, it's a well-defined type with a well-defined conversion
specifier.  Also, long long is a bit of a hack that came in before C99
standardized on a few wider types, and the PRIu64 macros are really
hideous.

Thanks,
matthew

 In any case, I only changed the %ld format to %lld, because
 time_t is int, long or long long depending on arch.  Long long is just
 the widest type required in this case.

___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r228625 - head/usr.bin/csup

2011-12-17 Thread Dimitry Andric
On 2011-12-18 00:49, m...@freebsd.org wrote:
...
 Also, long long is a bit of a hack that came in before C99
 standardized on a few wider types, and the PRIu64 macros are really
 hideous.

I agree they're ugly, but C99 should simply have defined length
modifiers for int64_t and friends, then the PRI macros could have been
avoided.  (Although not without backwards compatibility problems, but
you would have those anyway. :)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228674 - head/usr.sbin/route6d

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sun Dec 18 00:03:03 2011
New Revision: 228674
URL: http://svn.freebsd.org/changeset/base/228674

Log:
  In usr.sbin/route6d/route6d.c, use the correct printf length modifier
  for an ssize_t.
  
  MFC after:1 week

Modified:
  head/usr.sbin/route6d/route6d.c

Modified: head/usr.sbin/route6d/route6d.c
==
--- head/usr.sbin/route6d/route6d.c Sat Dec 17 23:46:47 2011
(r228673)
+++ head/usr.sbin/route6d/route6d.c Sun Dec 18 00:03:03 2011
(r228674)
@@ -1238,7 +1238,7 @@ riprecv()
if (iff_find(ifcp, 'N') != NULL)
return;
 
-   tracet(1, Recv(%s): from %s.%d info(%d)\n,
+   tracet(1, Recv(%s): from %s.%d info(%zd)\n,
ifcp-ifc_name, inet6_n2p(nh), ntohs(fsock.sin6_port), nn);
 
t = time(NULL);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228675 - head/share/mk

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sun Dec 18 00:24:11 2011
New Revision: 228675
URL: http://svn.freebsd.org/changeset/base/228675

Log:
  Disable yet another clang warning (-Wconversion) when WARNS = 3.
  
  MFC after:1 week

Modified:
  head/share/mk/bsd.sys.mk

Modified: head/share/mk/bsd.sys.mk
==
--- head/share/mk/bsd.sys.mkSun Dec 18 00:03:03 2011(r228674)
+++ head/share/mk/bsd.sys.mkSun Dec 18 00:24:11 2011(r228675)
@@ -62,7 +62,8 @@ CWARNFLAGS+=  -Wno-pointer-sign
 .  if ${CC:T:Mclang} == clang
 .   if ${WARNS} = 3
 CWARNFLAGS +=  -Wno-tautological-compare -Wno-unused-value\
-   -Wno-parentheses-equality -Wno-unused-function
+   -Wno-parentheses-equality -Wno-unused-function\
+   -Wno-conversion
 .   endif
 .   if ${WARNS} = 2
 CWARNFLAGS +=  -Wno-switch-enum
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228677 - head/share/mk

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sun Dec 18 00:34:42 2011
New Revision: 228677
URL: http://svn.freebsd.org/changeset/base/228677

Log:
  Disable another clang warning (-Wempty-body) when WARNS = 2.
  
  MFC after:1 week

Modified:
  head/share/mk/bsd.sys.mk

Modified: head/share/mk/bsd.sys.mk
==
--- head/share/mk/bsd.sys.mkSun Dec 18 00:31:06 2011(r228676)
+++ head/share/mk/bsd.sys.mkSun Dec 18 00:34:42 2011(r228677)
@@ -66,7 +66,7 @@ CWARNFLAGS+=  -Wno-tautological-compare 
-Wno-conversion
 .   endif
 .   if ${WARNS} = 2
-CWARNFLAGS +=  -Wno-switch-enum
+CWARNFLAGS +=  -Wno-switch-enum -Wno-empty-body
 .   endif
 .   if ${WARNS} = 1
 CWARNFLAGS +=  -Wno-parentheses
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228678 - head/usr.sbin/rpc.ypupdated

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sun Dec 18 00:40:30 2011
New Revision: 228678
URL: http://svn.freebsd.org/changeset/base/228678

Log:
  In usr.sbin/rpc.ypupdated/yp_dbupdate.c, use the appropriate printf
  length modifier for time_t (after casting it to intmax_t).
  
  MFC after:1 week

Modified:
  head/usr.sbin/rpc.ypupdated/yp_dbupdate.c

Modified: head/usr.sbin/rpc.ypupdated/yp_dbupdate.c
==
--- head/usr.sbin/rpc.ypupdated/yp_dbupdate.c   Sun Dec 18 00:34:42 2011
(r228677)
+++ head/usr.sbin/rpc.ypupdated/yp_dbupdate.c   Sun Dec 18 00:40:30 2011
(r228678)
@@ -130,7 +130,7 @@ ypmap_update(char *netname, char *map, u
return(rval);
}
 
-   snprintf(yplastbuf, sizeof(yplastbuf), %lu, time(NULL));
+   snprintf(yplastbuf, sizeof(yplastbuf), %ju, (intmax_t)time(NULL));
key.data = yp_last;
key.size = strlen(yp_last);
data.data = (char *)yplastbuf;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228679 - head/usr.sbin/rpc.ypupdated

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sun Dec 18 00:44:59 2011
New Revision: 228679
URL: http://svn.freebsd.org/changeset/base/228679

Log:
  In usr.sbin/rpc.ypupdated/yp_dbupdate.c, include stdint.h, so intmax_t
  is known, otherwise it won't build.
  
  Pointy hat to:dim
  MFC after:1 week

Modified:
  head/usr.sbin/rpc.ypupdated/yp_dbupdate.c

Modified: head/usr.sbin/rpc.ypupdated/yp_dbupdate.c
==
--- head/usr.sbin/rpc.ypupdated/yp_dbupdate.c   Sun Dec 18 00:40:30 2011
(r228678)
+++ head/usr.sbin/rpc.ypupdated/yp_dbupdate.c   Sun Dec 18 00:44:59 2011
(r228679)
@@ -35,6 +35,7 @@ __FBSDID($FreeBSD$);
 
 #include sys/fcntl.h
 
+#include stdint.h
 #include stdio.h
 #include stdlib.h
 #include string.h
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228680 - head/usr.sbin/rpc.ypupdated

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sun Dec 18 00:55:46 2011
New Revision: 228680
URL: http://svn.freebsd.org/changeset/base/228680

Log:
  In usr.sbin/rpc.ypupdated/yp_dbupdate.c, since intmax_t is signed, just
  like time_t, better use %jd instead of %ju.  Strangely enough, neither
  gcc, clang nor gcc 4.6 warn about this discrepancy...
  
  MFC after:1 week

Modified:
  head/usr.sbin/rpc.ypupdated/yp_dbupdate.c

Modified: head/usr.sbin/rpc.ypupdated/yp_dbupdate.c
==
--- head/usr.sbin/rpc.ypupdated/yp_dbupdate.c   Sun Dec 18 00:44:59 2011
(r228679)
+++ head/usr.sbin/rpc.ypupdated/yp_dbupdate.c   Sun Dec 18 00:55:46 2011
(r228680)
@@ -131,7 +131,7 @@ ypmap_update(char *netname, char *map, u
return(rval);
}
 
-   snprintf(yplastbuf, sizeof(yplastbuf), %ju, (intmax_t)time(NULL));
+   snprintf(yplastbuf, sizeof(yplastbuf), %jd, (intmax_t)time(NULL));
key.data = yp_last;
key.size = strlen(yp_last);
data.data = (char *)yplastbuf;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228681 - head/usr.sbin/sa

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sun Dec 18 01:08:25 2011
New Revision: 228681
URL: http://svn.freebsd.org/changeset/base/228681

Log:
  In usr.sbin/sa/db.c, avoid warnings about assigning two const char
  arrays to non-const void pointers, by casting away const explicitly.
  
  MFC after:1 week

Modified:
  head/usr.sbin/sa/db.c

Modified: head/usr.sbin/sa/db.c
==
--- head/usr.sbin/sa/db.c   Sun Dec 18 00:55:46 2011(r228680)
+++ head/usr.sbin/sa/db.c   Sun Dec 18 01:08:25 2011(r228681)
@@ -79,7 +79,7 @@ db_copy_in(DB **mdb, const char *dbname,
 
/* Obtain/set version. */
version = 1;
-   key.data = VERSION_KEY;
+   key.data = (void*)VERSION_KEY;
key.size = sizeof(VERSION_KEY);
 
rv = DB_GET(ddb, key, data, 0);
@@ -175,7 +175,7 @@ db_copy_out(DB *mdb, const char *dbname,
 
 out:
/* Add a version record. */
-   key.data = VERSION_KEY;
+   key.data = (void*)VERSION_KEY;
key.size = sizeof(VERSION_KEY);
version = 2;
data.data = version;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228682 - head/usr.sbin/sade

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sun Dec 18 01:13:21 2011
New Revision: 228682
URL: http://svn.freebsd.org/changeset/base/228682

Log:
  In usr.sbin/sade/install.c and usr.sbin/sade/label.c, fix a few warnings
  about format strings not being literals.
  
  MFC after:1 week

Modified:
  head/usr.sbin/sade/install.c

Modified: head/usr.sbin/sade/install.c
==
--- head/usr.sbin/sade/install.cSun Dec 18 01:08:25 2011
(r228681)
+++ head/usr.sbin/sade/install.cSun Dec 18 01:13:21 2011
(r228682)
@@ -104,10 +104,10 @@ performNewfs(PartInfo *pi, char *dname, 
}
 
if (queue == QUEUE_YES) {
-   command_shell_add(pi-mountpoint, buffer);
+   command_shell_add(pi-mountpoint, %s, buffer);
return (0);
} else
-   return (vsystem(buffer));
+   return (vsystem(%s, buffer));
}
return (0);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r228683 - head/usr.sbin/sade

2011-12-17 Thread Dimitry Andric
Author: dim
Date: Sun Dec 18 01:14:38 2011
New Revision: 228683
URL: http://svn.freebsd.org/changeset/base/228683

Log:
  Forgot to add usr.sbin/sade/label.c in the previous commit.
  
  MFC after:1 week

Modified:
  head/usr.sbin/sade/label.c

Modified: head/usr.sbin/sade/label.c
==
--- head/usr.sbin/sade/label.c  Sun Dec 18 01:13:21 2011(r228682)
+++ head/usr.sbin/sade/label.c  Sun Dec 18 01:14:38 2011(r228683)
@@ -933,7 +933,7 @@ diskLabel(Device *dev)
}
if (msg) {
if (req) {
-   msgConfirm(msg);
+   msgConfirm(%s, msg);
clear_wins();
msg = NULL;
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r228668 - head/usr.bin/netstat

2011-12-17 Thread David Schultz
On Sat, Dec 17, 2011, Dimitry Andric wrote:
 On 2011-12-17 23:32, Dimitry Andric wrote:
  Author: dim
  Date: Sat Dec 17 22:32:00 2011
  New Revision: 228668
  URL: http://svn.freebsd.org/changeset/base/228668
  
  Log:
Revert r228650, and work around the clang false positive with printf
formats in usr.bin/netstat/atalk.c by conditionally adding NO_WFORMAT to
the Makefile instead.

MFC after:1 week
 
 Requested by: bz

Have you been keeping track of the other hacks you've been
sprinkling throughout the tree to work around clang bugs, e.g.,
the one in fsdb?  It would be unfortunate if someone else has to
waste their time later on figuring out what you did, when we could
just as easily have waited a month for the clang bug to be fixed.

Incidentally, the bug you fixed in telnet/utilities.c is also a
false positive; clang doesn't understand that an index into a
string constant is also a string constant.

By the way, I think it's great that you've found so many actual
bugs in the tree.  I'm just complaining about a small subset of
the changes, which fixed non-bugs. :)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r228668 - head/usr.bin/netstat

2011-12-17 Thread David Schultz
On Sat, Dec 17, 2011, David Schultz wrote:
 On Sat, Dec 17, 2011, Dimitry Andric wrote:
  On 2011-12-17 23:32, Dimitry Andric wrote:
   Author: dim
   Date: Sat Dec 17 22:32:00 2011
   New Revision: 228668
   URL: http://svn.freebsd.org/changeset/base/228668
   
   Log:
 Revert r228650, and work around the clang false positive with printf
 formats in usr.bin/netstat/atalk.c by conditionally adding NO_WFORMAT to
 the Makefile instead.
 
 MFC after:  1 week
  
  Requested by:   bz
 
 Have you been keeping track of the other hacks you've been
 sprinkling throughout the tree to work around clang bugs, e.g.,
 the one in fsdb?  It would be unfortunate if someone else has to
 waste their time later on figuring out what you did, when we could
 just as easily have waited a month for the clang bug to be fixed.
 
 Incidentally, the bug you fixed in telnet/utilities.c is also a
 false positive; clang doesn't understand that an index into a
 string constant is also a string constant.
 
 By the way, I think it's great that you've found so many actual
 bugs in the tree.  I'm just complaining about a small subset of
 the changes, which fixed non-bugs. :)

Sorry, one more: In less(1), you cast away a bunch of const qualifiers
to fix some warnings, but that seems like a step in the wrong
direction.  The warnings were complaining about genuinely bad code.
Disabling the warnings with casts doesn't make less(1) any better;
instead, it guarantees that nobody will ever fix the code.

Perhaps the larger question is whether it makes sense to fix non-bugs
in contributed code at all.  What do we get out of it?  Maybe if the
contrib software is poorly maintained we'll find a bunch of real bugs
that won't be addressed upstream.  Otherwise, the diffs are only creating
headaches for whoever imports the next version.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r228650 - head/usr.bin/netstat

2011-12-17 Thread Joerg Sonnenberger
On Sat, Dec 17, 2011 at 09:53:56PM +, Bjoern A. Zeeb wrote:
 
 On 17. Dec 2011, at 17:21 , Dimitry Andric wrote:
 
  Author: dim
  Date: Sat Dec 17 17:21:47 2011
  New Revision: 228650
  URL: http://svn.freebsd.org/changeset/base/228650
  
  Log:
   In usr.bin/netstat/atalk.c, work around a clang false positive with
   printf format warnings and conditional operators.
  
 
 This does not sound like a good idea.  Make clang work.

Strictly speaking, clang is correct here. While the 'h' modifier is
effectively a nop due to integer promotion rules, the intention is
clearly I am going to use a unsigned short here. Of course, the bug in
the change is that it is using short...

Joerg
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r228670 - head/usr.sbin/pkg_install/updating

2011-12-17 Thread Joerg Sonnenberger
On Sat, Dec 17, 2011 at 11:35:46PM +, Dimitry Andric wrote:
 Modified: head/usr.sbin/pkg_install/updating/main.c
 ==
 --- head/usr.sbin/pkg_install/updating/main.c Sat Dec 17 23:18:14 2011
 (r228669)
 +++ head/usr.sbin/pkg_install/updating/main.c Sat Dec 17 23:35:46 2011
 (r228670)
 @@ -141,7 +141,7 @@ main(int argc, char *argv[])
   strcmp(pkgdbdir-d_name, ..) != 0) {
  
   /* Create path to +CONTENTS file for 
 each installed port */
 - n = strlcpy(tmp_file, pkgdbpath, 
 strlen(pkgdbpath)+1);
 + n = strlcpy(tmp_file, pkgdbpath, 
 sizeof(tmp_file));
   n = strlcpy(tmp_file + n, /, 
 sizeof(tmp_file) - n);
   n = strlcat(tmp_file + n, 
 pkgdbdir-d_name,
   sizeof(tmp_file) - n);

Either use strlcat without the pointer modifications or just go with
snprintf in first place. This is bogus...

Joerg
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r228631 - in head/sys: dev/cfe dev/dcons dev/ofw dev/sio dev/syscons dev/uart dev/usb/serial dev/xen/console gdb ia64/ia64 kern mips/adm5120 pc98/cbus powerpc/mambo sys

2011-12-17 Thread Bruce Evans

On Sat, 17 Dec 2011, Andriy Gapon wrote:


Log:
 kern cons: introduce infrastructure for console grabbing by kernel

 At the moment grab and ungrab methods of all console drivers are no-ops.

 Current intended meaning of the calls is that the kernel takes control of
 console input.  In the future the semantics may be extended to mean that
 the calling thread takes full ownership of the console (e.g. console
 output from other threads could be suspended).

 Inspired by:   bde
 MFC after: 2 months


Thanks.  I didn't keep up with the details.


Modified: head/sys/dev/cfe/cfe_console.c
==
--- head/sys/dev/cfe/cfe_console.c  Sat Dec 17 14:55:19 2011
(r228630)
+++ head/sys/dev/cfe/cfe_console.c  Sat Dec 17 15:08:43 2011
(r228631)
@@ -76,6 +76,8 @@ static cn_init_t  cfe_cninit;
static cn_term_tcfe_cnterm;
static cn_getc_tcfe_cngetc;
static cn_putc_tcfe_cnputc;
+static cn_grab_t   cfe_cngrab;
+static cn_ungrab_t cfe_cnungrab;

CONSOLE_DRIVER(cfe);

@@ -183,6 +185,18 @@ cfe_cnterm(struct consdev *cp)

}

+static void
+cfe_cngrab(struct consdev *cp)
+{
+
+}
+
+static void
+cfe_cnungrab(struct consdev *cp)
+{
+
+}
+
static int
cfe_cngetc(struct consdev *cp)
{


I prefer NULL function pointers to dummy functions.  The horrible
CONSOLE_DRIVER() macro gets in the way of this.  FreeBSD[3-4] and maybe
FreeBSD-2 use the slightly less horrible CONS_DRIVER() macro.  FreeBSD-1
uses a normal unobfuscated struct initializer but with an even more
horrible implementation (the entry points had to exist and be public
functions, so that the initializer could be hard-coded in another file
depending on ifdefs for driver existence, and this file was not even
generated by config.  cdevsw initialization was similarly horrible in
FreeBSD-1).


...
Modified: head/sys/sys/cons.h
==
--- head/sys/sys/cons.h Sat Dec 17 14:55:19 2011(r228630)
+++ head/sys/sys/cons.h Sat Dec 17 15:08:43 2011(r228631)
@@ -58,6 +60,10 @@ struct consdev_ops {
/* kernel getchar interface */
cn_putc_t   *cn_putc;
/* kernel putchar interface */
+   cn_grab_t   *cn_grab;
+   /* grab console for exclusive kernel use */
+   cn_ungrab_t *cn_ungrab;
+   /* ungrab console */
};

struct consdev {
@@ -99,6 +105,8 @@ extern   struct tty *constty;/* Temporary
.cn_term = name##_cnterm,   \
.cn_getc = name##_cngetc,   \
.cn_putc = name##_cnputc,   \
+   .cn_grab = name##_cngrab,   \
+   .cn_ungrab = name##_cnungrab,   \
};  \
CONSOLE_DEVICE(name##_consdev, name##_consdev_ops, NULL)



With C99 initializers, which are already used here, the macros become
just obfuscations.  The CONSOLE_DEVICE() macro handles the minor problem
that without it the driver would have to know the order of the parameters
in a macro like the old CONS_DRIVER() one (to invoke such a macro), or
the order of struct members including ones not supported by the driver
(to declare an initializer).  This was only a minor problem, and the
macros were silly, since there were approximately a whole 2 console
drivers but there were hundreds of generic drivers and dozens of file
systems that face the problem without any macros to obfuscate it, and
just declared the initializers for the much larger cdevsw and vfsops
structs.  CONSOLE_DRIVER() has the costs of requiring actual functions
with a specific spelling for all entry points.

Now C99 initializers under full control of the driver or file system
are used for cdevsw and vfsops structs, but the silly macros are still
used for console drivers.

BTW, there is probably lots of disorder in the C99 initializers.  I
think most cdevsw initializers are in bad historical order.  ufs_vfsops
was converted to alphabetical ordering on the struct member name when
it was converted to a C99 initializer, but has accreted insertion sort
errors for .vfs_cmount in the middle and .vfs_susp_clean at the end.
It also has a namespace error for the .vfs_susp_clean entry (the
public function for this is not in the ffs_ namespace).

Bruce
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r228625 - head/usr.bin/csup

2011-12-17 Thread Bruce Evans

On Sat, 17 Dec 2011 m...@freebsd.org wrote:


On Sat, Dec 17, 2011 at 1:54 PM, Dimitry Andric d...@freebsd.org wrote:

On 2011-12-17 22:32, m...@freebsd.org wrote:
...

?In usr.bin/csup/auth.c, use the correct number of bytes for zeroing the
?shared secret, and use long long format to snprintf a time_t.

If casting is necessary, style prefers intmax_t or uintmax_t, since
those are always wide enough.


I don't see anything about that in style(9), maybe it should be added
then?


style(9) decoments the uncouthness of long long and %lld by providing
no examples of them.  Unfortunately for my cause, it also provides no
examples of intmax_t.  It is basically just too old to provide examples
of either.


Probably; Bruce has mentioned it many times in the past, and as bz@


I tried to get [u]intmax_t used, and [unsigned] long long and [u]quad_t
killed, before C99, so that FreeBSD would never use the long long
abomination.  There was a problem printing the [u]intmax_t's before
C99.  I don't remember anything that would have worked except %q, and
in userland, also %ll.  %ll was intentionally left out of the kernel
printf(), but this has been broken.


notes, it's a well-defined type with a well-defined conversion
specifier.  Also, long long is a bit of a hack that came in before C99


s/a bit of/gross/


standardized on a few wider types, and the PRIu64 macros are really
hideous.


Bruce___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org