svn commit: r231257 - head/usr.sbin/wpa/hostapd

2012-02-09 Thread Kevin Lo
Author: kevlo
Date: Thu Feb  9 08:33:04 2012
New Revision: 231257
URL: http://svn.freebsd.org/changeset/base/231257

Log:
  Mention run(4)

Modified:
  head/usr.sbin/wpa/hostapd/hostapd.8

Modified: head/usr.sbin/wpa/hostapd/hostapd.8
==
--- head/usr.sbin/wpa/hostapd/hostapd.8 Thu Feb  9 07:52:45 2012
(r231256)
+++ head/usr.sbin/wpa/hostapd/hostapd.8 Thu Feb  9 08:33:04 2012
(r231257)
@@ -112,6 +112,7 @@ Store PID in
 .Xr ipw 4 ,
 .Xr iwi 4 ,
 .Xr ral 4 ,
+.Xr run 4 ,
 .Xr ural 4 ,
 .Xr wi 4 ,
 .Xr hostapd.conf 5 ,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r231220 - head/sys/sys

2012-02-09 Thread Konstantin Belousov
On Wed, Feb 08, 2012 at 11:21:59AM -0800, m...@freebsd.org wrote:
> On Wed, Feb 8, 2012 at 10:36 AM, Konstantin Belousov  wrote:
> > Author: kib
> > Date: Wed Feb  8 18:36:07 2012
> > New Revision: 231220
> > URL: http://svn.freebsd.org/changeset/base/231220
> >
> > Log:
> >  Trim 8 unused bytes from struct vnode on 64-bit architectures.
> 
> Doesn't this change the KBI?  So should __FreeBSD_version be bumped?
Definitely, it changes the KBI. This is the reason I did not specified
MFC period (but really wanted it).

We do not track KBI changes on HEAD with __FreeBSD_version. IMO,
__FreeBSD_version is more about KPI, and even for KPI, it is more at the
discretion of the committer and usefulness of notification.

With this change, all VFS modules must be recompiled. But HEAD had a lot
of changes related to VFS interface which went in silently.


pgpWqHJa17uSn.pgp
Description: PGP signature


svn commit: r231265 - in head: share/man/man5 sys/fs/devfs

2012-02-09 Thread Martin Matuska
Author: mm
Date: Thu Feb  9 10:09:12 2012
New Revision: 231265
URL: http://svn.freebsd.org/changeset/base/231265

Log:
  Introduce the "ruleset=number" option for devfs(5) mounts.
  Add support for updating the devfs mount (currently only changing the
  ruleset number is supported).
  Check mnt_optnew with vfs_filteropt(9).
  
  This new option sets the specified ruleset number as the active ruleset
  of the new devfs mount and applies all its rules at mount time. If the
  specified ruleset doesn't exist, a new empty ruleset is created.
  
  MFC after:1 month

Modified:
  head/share/man/man5/devfs.5
  head/sys/fs/devfs/devfs.h
  head/sys/fs/devfs/devfs_rule.c
  head/sys/fs/devfs/devfs_vfsops.c

Modified: head/share/man/man5/devfs.5
==
--- head/share/man/man5/devfs.5 Thu Feb  9 09:24:52 2012(r231264)
+++ head/share/man/man5/devfs.5 Thu Feb  9 10:09:12 2012(r231265)
@@ -38,7 +38,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 18, 2010
+.Dd February 9, 2012
 .Dt DEVFS 5
 .Os
 .Sh NAME
@@ -90,6 +90,29 @@ and
 .Pa 2 .
 .Xr fdescfs 5
 creates files for all open descriptors.
+.Pp
+The options are as follows:
+.Bl -tag -width indent
+.It Fl o Ar options
+Use the specified mount
+.Ar options ,
+as described in
+.Xr mount 8 .
+The following devfs file system-specific options are available:
+.Bl -tag -width indent
+.It Cm ruleset Ns No = Ns Ar ruleset
+Set ruleset number
+.Ar ruleset
+as the current ruleset for the mount-point and apply all its rules. If the
+ruleset number
+.Ar ruleset
+does not exist, an empty ruleset with the number
+.Ar ruleset
+is created. See
+.Xr devfs 8
+for more information on working with devfs rulesets.
+.El
+.El
 .Sh FILES
 .Bl -tag -width /dev/ -compact
 .It Pa /dev

Modified: head/sys/fs/devfs/devfs.h
==
--- head/sys/fs/devfs/devfs.h   Thu Feb  9 09:24:52 2012(r231264)
+++ head/sys/fs/devfs/devfs.h   Thu Feb  9 10:09:12 2012(r231265)
@@ -182,6 +182,8 @@ voiddevfs_rules_apply(struct devfs_moun
 void   devfs_rules_cleanup(struct devfs_mount *);
 intdevfs_rules_ioctl(struct devfs_mount *, u_long, caddr_t,
struct thread *);
+void   devfs_ruleset_set(devfs_rsnum rsnum, struct devfs_mount *dm);
+void   devfs_ruleset_apply(struct devfs_mount *dm);
 intdevfs_allocv(struct devfs_dirent *, struct mount *, int,
struct vnode **);
 char   *devfs_fqpn(char *, struct devfs_mount *, struct devfs_dirent *,

Modified: head/sys/fs/devfs/devfs_rule.c
==
--- head/sys/fs/devfs/devfs_rule.c  Thu Feb  9 09:24:52 2012
(r231264)
+++ head/sys/fs/devfs/devfs_rule.c  Thu Feb  9 10:09:12 2012
(r231265)
@@ -771,3 +771,38 @@ devfs_rules_cleanup(struct devfs_mount *
devfs_ruleset_reap(ds);
}
 }
+
+/*
+ * Make rsnum the active ruleset for dm (locked)
+ */
+void
+devfs_ruleset_set(devfs_rsnum rsnum, struct devfs_mount *dm)
+{
+
+   sx_assert(&dm->dm_lock, SX_XLOCKED);
+
+   sx_xlock(&sx_rules);
+   devfs_ruleset_use(rsnum, dm);
+   sx_xunlock(&sx_rules);
+}
+
+/*
+ * Apply the current active ruleset on a mount
+ */
+void
+devfs_ruleset_apply(struct devfs_mount *dm)
+{
+   struct devfs_ruleset *ds;
+
+   sx_assert(&dm->dm_lock, SX_XLOCKED);
+
+   sx_xlock(&sx_rules);
+   if (dm->dm_ruleset == 0) {
+   sx_xunlock(&sx_rules);
+   return;
+   }
+   ds = devfs_ruleset_bynum(dm->dm_ruleset);
+   if (ds != NULL)
+   devfs_ruleset_applydm(ds, dm);
+   sx_xunlock(&sx_rules);
+}

Modified: head/sys/fs/devfs/devfs_vfsops.c
==
--- head/sys/fs/devfs/devfs_vfsops.cThu Feb  9 09:24:52 2012
(r231264)
+++ head/sys/fs/devfs/devfs_vfsops.cThu Feb  9 10:09:12 2012
(r231265)
@@ -56,6 +56,10 @@ static vfs_unmount_t devfs_unmount;
 static vfs_root_t  devfs_root;
 static vfs_statfs_tdevfs_statfs;
 
+static const char *devfs_opts[] = {
+   "from", "ruleset", NULL
+};
+
 /*
  * Mount the filesystem
  */
@@ -65,15 +69,46 @@ devfs_mount(struct mount *mp)
int error;
struct devfs_mount *fmp;
struct vnode *rvp;
+   int rsnum;
 
if (devfs_unr == NULL)
devfs_unr = new_unrhdr(0, INT_MAX, NULL);
 
error = 0;
 
-   if (mp->mnt_flag & (MNT_UPDATE | MNT_ROOTFS))
+   if (mp->mnt_flag & MNT_ROOTFS)
return (EOPNOTSUPP);
 
+   rsnum = 0;
+
+   if (mp->mnt_optnew != NULL) {
+   if (vfs_filteropt(mp->mnt_optnew, devfs_opts))
+   return (EINVAL);
+
+   if (vfs_getopt(mp->mnt_optnew, "ruleset", NULL, NULL) == 0 &&
+   (vfs_scanopt(mp->mnt_optnew, "ruleset", "%d",
+  

svn commit: r231266 - in head: share/man/man4 sys/dev/sdhci

2012-02-09 Thread Gleb Smirnoff
Author: glebius
Date: Thu Feb  9 10:20:41 2012
New Revision: 231266
URL: http://svn.freebsd.org/changeset/base/231266

Log:
  Add support for RICOH R5CE823 card reader, that can be found in
  some Lenovo laptops.
  
  The conroller needs a quirk to lower its frequency, and after
  that it operates normally.

Modified:
  head/share/man/man4/sdhci.4
  head/sys/dev/sdhci/sdhci.c
  head/sys/dev/sdhci/sdhci.h

Modified: head/share/man/man4/sdhci.4
==
--- head/share/man/man4/sdhci.4 Thu Feb  9 10:09:12 2012(r231265)
+++ head/share/man/man4/sdhci.4 Thu Feb  9 10:20:41 2012(r231266)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 14, 2009
+.Dd February 9, 2012
 .Dt SDHCI 4
 .Os
 .Sh NAME
@@ -69,6 +69,8 @@ ENE CB714
 .It
 RICOH R5C822
 .It
+RICOH R5CE823
+.It
 TI PCIXX21/XX11
 .El
 .Sh SEE ALSO

Modified: head/sys/dev/sdhci/sdhci.c
==
--- head/sys/dev/sdhci/sdhci.c  Thu Feb  9 10:09:12 2012(r231265)
+++ head/sys/dev/sdhci/sdhci.c  Thu Feb  9 10:20:41 2012(r231266)
@@ -74,6 +74,8 @@ __FBSDID("$FreeBSD$");
 #define SDHCI_QUIRK_INCR_TIMEOUT_CONTROL   (1<<7)
 /* Controller has broken read timings */
 #define SDHCI_QUIRK_BROKEN_TIMINGS (1<<8)
+/* Controller needs lowered frequency */
+#defineSDHCI_QUIRK_LOWER_FREQUENCY (1<<9)
 
 static const struct sdhci_device {
uint32_tmodel;
@@ -85,6 +87,8 @@ static const struct sdhci_device {
SDHCI_QUIRK_FORCE_DMA },
{ 0xe8221180,   0x, "RICOH SD",
SDHCI_QUIRK_FORCE_DMA },
+   { 0xe8231180,   0x, "RICOH R5CE823 SD",
+   SDHCI_QUIRK_LOWER_FREQUENCY },
{ 0x8034104c,   0x, "TI XX21/XX11 SD",
SDHCI_QUIRK_FORCE_DMA },
{ 0x05501524,   0x, "ENE CB712 SD",
@@ -350,6 +354,24 @@ sdhci_init(struct sdhci_slot *slot)
 }
 
 static void
+sdhci_lower_frequency(device_t dev)
+{
+
+   /* Enable SD2.0 mode. */
+   pci_write_config(dev, SDHC_PCI_MODE_KEY, 0xfc, 1);
+   pci_write_config(dev, SDHC_PCI_MODE, SDHC_PCI_MODE_SD20, 1);
+   pci_write_config(dev, SDHC_PCI_MODE_KEY, 0x00, 1);
+
+   /*
+* Some SD/MMC cards don't work with the default base
+* clock frequency of 200MHz.  Lower it to 50Hz.
+*/
+   pci_write_config(dev, SDHC_PCI_BASE_FREQ_KEY, 0x01, 1);
+   pci_write_config(dev, SDHC_PCI_BASE_FREQ, 50, 1);
+   pci_write_config(dev, SDHC_PCI_BASE_FREQ_KEY, 0x00, 1);
+}
+
+static void
 sdhci_set_clock(struct sdhci_slot *slot, uint32_t clock)
 {
uint32_t res;
@@ -631,6 +653,9 @@ sdhci_attach(device_t dev)
break;
}
}
+   /* Some controllers need to be bumped into the right mode. */
+   if (sc->quirks & SDHCI_QUIRK_LOWER_FREQUENCY)
+   sdhci_lower_frequency(dev);
/* Read slots info from PCI registers. */
slots = pci_read_config(dev, PCI_SLOT_INFO, 1);
bar = PCI_SLOT_INFO_FIRST_BAR(slots);

Modified: head/sys/dev/sdhci/sdhci.h
==
--- head/sys/dev/sdhci/sdhci.h  Thu Feb  9 10:09:12 2012(r231265)
+++ head/sys/dev/sdhci/sdhci.h  Thu Feb  9 10:20:41 2012(r231266)
@@ -38,6 +38,15 @@
 #define  PCI_SLOT_INFO_FIRST_BAR(x)((x) & 7)
 
 /*
+ * RICOH specific PCI registers
+ */
+#defineSDHC_PCI_MODE_KEY   0xf9
+#defineSDHC_PCI_MODE   0x150
+#defineSDHC_PCI_MODE_SD20  0x10
+#defineSDHC_PCI_BASE_FREQ_KEY  0xfc
+#defineSDHC_PCI_BASE_FREQ  0xe1
+
+/*
  * Controller registers
  */
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r231267 - in head: sys/fs/devfs sys/kern sys/sys usr.sbin/jail

2012-02-09 Thread Martin Matuska
Author: mm
Date: Thu Feb  9 10:22:08 2012
New Revision: 231267
URL: http://svn.freebsd.org/changeset/base/231267

Log:
  Add support for mounting devfs inside jails.
  
  A new jail(8) option "devfs_ruleset" defines the ruleset enforcement for
  mounting devfs inside jails. A value of -1 disables mounting devfs in
  jails, a value of zero means no restrictions. Nested jails can only
  have mounting devfs disabled or inherit parent's enforcement as jails are
  not allowed to view or manipulate devfs(8) rules.
  
  Utilizes new functions introduced in r231265.
  
  Reviewed by:  jamie
  MFC after:1 month

Modified:
  head/sys/fs/devfs/devfs_vfsops.c
  head/sys/kern/kern_jail.c
  head/sys/sys/jail.h
  head/usr.sbin/jail/jail.8

Modified: head/sys/fs/devfs/devfs_vfsops.c
==
--- head/sys/fs/devfs/devfs_vfsops.cThu Feb  9 10:20:41 2012
(r231266)
+++ head/sys/fs/devfs/devfs_vfsops.cThu Feb  9 10:22:08 2012
(r231267)
@@ -44,6 +44,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -69,6 +70,7 @@ devfs_mount(struct mount *mp)
int error;
struct devfs_mount *fmp;
struct vnode *rvp;
+   struct thread *td = curthread;
int rsnum;
 
if (devfs_unr == NULL)
@@ -91,6 +93,16 @@ devfs_mount(struct mount *mp)
error = EINVAL;
}
 
+   /* jails enforce their ruleset, prison0 has no restrictions */
+   if (td->td_ucred->cr_prison->pr_devfs_rsnum != 0) {
+   rsnum = td->td_ucred->cr_prison->pr_devfs_rsnum;
+   if (rsnum == -1)
+   return (EPERM);
+   /* check rsnum for sanity, devfs_rsnum is uint16_t */
+   if (rsnum < 0 || rsnum > 65535)
+   error = EINVAL;
+   }
+
if (error) {
vfs_mount_error(mp, "%s", "invalid ruleset specification");
return (error);
@@ -227,4 +239,4 @@ static struct vfsops devfs_vfsops = {
.vfs_unmount =  devfs_unmount,
 };
 
-VFS_SET(devfs_vfsops, devfs, VFCF_SYNTHETIC);
+VFS_SET(devfs_vfsops, devfs, VFCF_SYNTHETIC | VFCF_JAIL);

Modified: head/sys/kern/kern_jail.c
==
--- head/sys/kern/kern_jail.c   Thu Feb  9 10:20:41 2012(r231266)
+++ head/sys/kern/kern_jail.c   Thu Feb  9 10:22:08 2012(r231267)
@@ -103,6 +103,7 @@ struct prison prison0 = {
.pr_uref= 1,
.pr_path= "/",
.pr_securelevel = -1,
+   .pr_devfs_rsnum = 0,
.pr_childmax= JAIL_MAX,
.pr_hostuuid= DEFAULT_HOSTUUID,
.pr_children= LIST_HEAD_INITIALIZER(prison0.pr_children),
@@ -216,8 +217,10 @@ const size_t pr_allow_nonames_size = siz
 
 #defineJAIL_DEFAULT_ALLOW  PR_ALLOW_SET_HOSTNAME
 #defineJAIL_DEFAULT_ENFORCE_STATFS 2
+#defineJAIL_DEFAULT_DEVFS_RSNUM-1
 static unsigned jail_default_allow = JAIL_DEFAULT_ALLOW;
 static int jail_default_enforce_statfs = JAIL_DEFAULT_ENFORCE_STATFS;
+static int jail_default_devfs_rsnum = JAIL_DEFAULT_DEVFS_RSNUM;
 #if defined(INET) || defined(INET6)
 static unsigned jail_max_af_ips = 255;
 #endif
@@ -529,9 +532,9 @@ kern_jail_set(struct thread *td, struct 
unsigned long hid;
size_t namelen, onamelen;
int created, cuflags, descend, enforce, error, errmsg_len, errmsg_pos;
-   int gotchildmax, gotenforce, gothid, gotslevel;
+   int gotchildmax, gotenforce, gothid, gotrsnum, gotslevel;
int fi, jid, jsys, len, level;
-   int childmax, slevel, vfslocked;
+   int childmax, rsnum, slevel, vfslocked;
int fullpath_disabled;
 #if defined(INET) || defined(INET6)
int ii, ij;
@@ -612,6 +615,14 @@ kern_jail_set(struct thread *td, struct 
} else
gotenforce = 1;
 
+   error = vfs_copyopt(opts, "devfs_ruleset", &rsnum, sizeof(rsnum));
+   if (error == ENOENT)
+   gotrsnum = 0;
+   else if (error != 0)
+   goto done_free;
+   else
+   gotrsnum = 1;
+
pr_flags = ch_flags = 0;
for (fi = 0; fi < sizeof(pr_flag_names) / sizeof(pr_flag_names[0]);
fi++) {
@@ -1268,6 +1279,7 @@ kern_jail_set(struct thread *td, struct 
pr->pr_securelevel = ppr->pr_securelevel;
pr->pr_allow = JAIL_DEFAULT_ALLOW & ppr->pr_allow;
pr->pr_enforce_statfs = JAIL_DEFAULT_ENFORCE_STATFS;
+   pr->pr_devfs_rsnum = JAIL_DEFAULT_DEVFS_RSNUM;
 
LIST_INIT(&pr->pr_children);
mtx_init(&pr->pr_mtx, "jail mutex", NULL, MTX_DEF | MTX_DUPOK);
@@ -1346,6 +1358,27 @@ kern_jail_set(struct thread *td, struct 
goto done_deref_locked;
}
}
+   if (gotrsnum) {
+   /*
+* devfs_rsnum is a uint16_t
+   

Re: svn commit: r231266 - in head: share/man/man4 sys/dev/sdhci

2012-02-09 Thread Gleb Smirnoff
On Thu, Feb 09, 2012 at 10:20:42AM +, Gleb Smirnoff wrote:
T> Author: glebius
T> Date: Thu Feb  9 10:20:41 2012
T> New Revision: 231266
T> URL: http://svn.freebsd.org/changeset/base/231266
T> 
T> Log:
T>   Add support for RICOH R5CE823 card reader, that can be found in
T>   some Lenovo laptops.
T>   
T>   The conroller needs a quirk to lower its frequency, and after
T>   that it operates normally.

Forgot to mention:

Obtained from:  OpenBSD

Also, I suppose, it is neccessary to run the quirk in sdhci_resume(),
but it is definitely not sufficient to get controller resumed. It
looks like sdhci_resume(4) lacks some more generic resume code.

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


svn commit: r231269 - head/sys/fs/nullfs

2012-02-09 Thread Martin Matuska
Author: mm
Date: Thu Feb  9 10:39:01 2012
New Revision: 231269
URL: http://svn.freebsd.org/changeset/base/231269

Log:
  Allow mounting nullfs(5) inside jails.
  
  This is now possible thanks to r230129.
  
  MFC after:1 month

Modified:
  head/sys/fs/nullfs/null_vfsops.c

Modified: head/sys/fs/nullfs/null_vfsops.c
==
--- head/sys/fs/nullfs/null_vfsops.cThu Feb  9 10:30:45 2012
(r231268)
+++ head/sys/fs/nullfs/null_vfsops.cThu Feb  9 10:39:01 2012
(r231269)
@@ -357,4 +357,4 @@ static struct vfsops null_vfsops = {
.vfs_vget = nullfs_vget,
 };
 
-VFS_SET(null_vfsops, nullfs, VFCF_LOOPBACK);
+VFS_SET(null_vfsops, nullfs, VFCF_LOOPBACK | VFCF_JAIL);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r231273 - head/sys/pc98/conf

2012-02-09 Thread Takahashi Yoshihiro
Author: nyan
Date: Thu Feb  9 14:00:49 2012
New Revision: 231273
URL: http://svn.freebsd.org/changeset/base/231273

Log:
  - Disable the olpt driver.   Because it conflicts with the ppc/lpt driver.
  - Remove obsolete comment.
  
  MFC after:3 days

Modified:
  head/sys/pc98/conf/GENERIC

Modified: head/sys/pc98/conf/GENERIC
==
--- head/sys/pc98/conf/GENERIC  Thu Feb  9 13:23:44 2012(r231272)
+++ head/sys/pc98/conf/GENERIC  Thu Feb  9 14:00:49 2012(r231273)
@@ -167,8 +167,7 @@ device  plip# TCP/IP over parallel
 device ppi # Parallel port interface device
 #devicevpo # Requires scbus and da
 # OLD Parallel port
-# Please stay olpt driver after ppc driver
-device olpt
+#deviceolpt
 
 # PCI Ethernet NICs.
 device de  # DEC/Intel DC21x4x (``Tulip'')
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r231274 - head/usr.bin/calendar/calendars

2012-02-09 Thread Matthew Seaman
Author: matthew (ports committer)
Date: Thu Feb  9 14:13:56 2012
New Revision: 231274
URL: http://svn.freebsd.org/changeset/base/231274

Log:
  Add myself as a new committer
  
  Approved by:  shaun (mentor)

Modified:
  head/usr.bin/calendar/calendars/calendar.freebsd

Modified: head/usr.bin/calendar/calendars/calendar.freebsd
==
--- head/usr.bin/calendar/calendars/calendar.freebsdThu Feb  9 14:00:49 
2012(r231273)
+++ head/usr.bin/calendar/calendars/calendar.freebsdThu Feb  9 14:13:56 
2012(r231274)
@@ -274,6 +274,7 @@
 09/12  Weongyo Jeong  born in Haman, Korea, 1980
 09/12  Benedict Christopher Reuschling  born in Darmstadt, 
Germany, 1981
 09/12  William C. Fumerola II  born in Detroit, Michigan, 
United States, 1981
+09/14  Matthew Seaman  born in Bristol, United Kingdom, 
1965
 09/15  Aleksandr Rybalko  born in Odessa, Ukraine, 1977
 09/15  Dima Panov  born in Khabarovsk, Russian Federation, 
1978
 09/17  Maxim Bolotin  born in Rostov-on-Don, Russian 
Federation, 1976
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r231275 - head/share/misc

2012-02-09 Thread Matthew Seaman
Author: matthew (ports committer)
Date: Thu Feb  9 14:15:20 2012
New Revision: 231275
URL: http://svn.freebsd.org/changeset/base/231275

Log:
  Adding myself as a new committer
  
  Approved by:  shaun (mentor)

Modified:
  head/share/misc/committers-ports.dot

Modified: head/share/misc/committers-ports.dot
==
--- head/share/misc/committers-ports.dotThu Feb  9 14:13:56 2012
(r231274)
+++ head/share/misc/committers-ports.dotThu Feb  9 14:15:20 2012
(r231275)
@@ -134,6 +134,7 @@ marcus [label="Joe Marcus Clarke\nmarcus
 markus [label="Markus Brueffer\nmar...@freebsd.org\n2004/02/21"]
 martymac [label="Ganael Laplanche\nmarty...@freebsd.org\n2010/09/24"]
 mat [label="Mathieu Arnold\n...@freebsd.org\n2003/08/15"]
+matthew [label="Matthew Seaman\nmatt...@freebsd.org\n2012/02/07"]
 mezz [label="Jeremy Messenger\nm...@freebsd.org\n2004/04/30"]
 miwi [label="Martin Wilke\nm...@freebsd.org\n2006/06/04"]
 mm [label="Martin Matuska\n...@freebsd.org\n2007/04/04"]
@@ -413,6 +414,7 @@ sem -> delphij
 sem -> stas
 
 shaun -> timur
+shaun -> matthew
 
 sobomax -> demon
 sobomax -> glewis
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r231276 - head/sys/pc98/conf

2012-02-09 Thread Takahashi Yoshihiro
Author: nyan
Date: Thu Feb  9 14:15:56 2012
New Revision: 231276
URL: http://svn.freebsd.org/changeset/base/231276

Log:
  Remove full debugger options and enable KDB_TRACE option instead to decrease
  kernel size and increase performance.

Modified:
  head/sys/pc98/conf/GENERIC

Modified: head/sys/pc98/conf/GENERIC
==
--- head/sys/pc98/conf/GENERIC  Thu Feb  9 14:15:20 2012(r231275)
+++ head/sys/pc98/conf/GENERIC  Thu Feb  9 14:15:56 2012(r231276)
@@ -67,20 +67,8 @@ options  CAPABILITY_MODE # Capsicum cap
 optionsCAPABILITIES# Capsicum capabilities
 optionsMAC # TrustedBSD MAC Framework
 optionsINCLUDE_CONFIG_FILE # Include this file in kernel
-
-# Debugging support.  Always need this:
-optionsKDB # Enable kernel debugger support.
-# For minimum debugger support (stable branch) use:
-#options   KDB_TRACE   # Print a stack trace for a panic.
-# For full debugger support use this instead:
-optionsDDB # Support DDB.
-optionsGDB # Support remote GDB.
-optionsDEADLKRES   # Enable the deadlock resolver
-optionsINVARIANTS  # Enable calls of extra sanity checking
-optionsINVARIANT_SUPPORT   # Extra sanity checks of internal 
structures, required by INVARIANTS
-optionsWITNESS # Enable checks to detect deadlocks and 
cycles
-optionsWITNESS_SKIPSPIN# Don't run witness on spinlocks for 
speed
-optionsMALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones
+optionsKDB # Kernel debugger related code
+optionsKDB_TRACE   # Print a stack trace for a panic
 
 # To make an SMP kernel, the next two lines are needed
 #options   SMP # Symmetric MultiProcessor Kernel
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r231295 - head/sys/dev/acpica

2012-02-09 Thread Jung-uk Kim
Author: jkim
Date: Thu Feb  9 17:38:08 2012
New Revision: 231295
URL: http://svn.freebsd.org/changeset/base/231295

Log:
  Refine r231226.  Swap timecounters before suspending any device drivers.

Modified:
  head/sys/dev/acpica/acpi_timer.c

Modified: head/sys/dev/acpica/acpi_timer.c
==
--- head/sys/dev/acpica/acpi_timer.cThu Feb  9 16:58:06 2012
(r231294)
+++ head/sys/dev/acpica/acpi_timer.cThu Feb  9 17:38:08 2012
(r231295)
@@ -68,8 +68,8 @@ static u_int  acpi_timer_frequency = 1431
 static voidacpi_timer_identify(driver_t *driver, device_t parent);
 static int acpi_timer_probe(device_t dev);
 static int acpi_timer_attach(device_t dev);
-static int acpi_timer_suspend(device_t);
 static voidacpi_timer_resume_handler(struct timecounter *);
+static voidacpi_timer_suspend_handler(struct timecounter *);
 static u_int   acpi_timer_get_timecount(struct timecounter *tc);
 static u_int   acpi_timer_get_timecount_safe(struct timecounter *tc);
 static int acpi_timer_sysctl_freq(SYSCTL_HANDLER_ARGS);
@@ -81,7 +81,6 @@ static device_method_t acpi_timer_method
 DEVMETHOD(device_identify, acpi_timer_identify),
 DEVMETHOD(device_probe,acpi_timer_probe),
 DEVMETHOD(device_attach,   acpi_timer_attach),
-DEVMETHOD(device_suspend,  acpi_timer_suspend),
 
 {0, 0}
 };
@@ -249,6 +248,12 @@ acpi_timer_attach(device_t dev)
return (ENXIO);
 acpi_timer_bsh = rman_get_bushandle(acpi_timer_reg);
 acpi_timer_bst = rman_get_bustag(acpi_timer_reg);
+
+/* Register suspend event handler. */
+if (EVENTHANDLER_REGISTER(power_suspend, acpi_timer_suspend_handler,
+   &acpi_timer_timecounter, EVENTHANDLER_PRI_LAST) == NULL)
+   device_printf(dev, "failed to register suspend event handler\n");
+
 return (0);
 }
 
@@ -269,22 +274,25 @@ acpi_timer_resume_handler(struct timecou
}
 }
 
-static int
-acpi_timer_suspend(device_t dev)
+static void
+acpi_timer_suspend_handler(struct timecounter *newtc)
 {
-   struct timecounter *newtc, *tc;
-   int error;
+   struct timecounter *tc;
 
-   error = bus_generic_suspend(dev);
+   /* Deregister existing resume event handler. */
if (acpi_timer_eh != NULL) {
EVENTHANDLER_DEREGISTER(power_resume, acpi_timer_eh);
acpi_timer_eh = NULL;
}
+
+   KASSERT(newtc == &acpi_timer_timecounter,
+   ("acpi_timer_suspend_handler: wrong timecounter"));
+
tc = timecounter;
-   newtc = &acpi_timer_timecounter;
if (tc != newtc) {
if (bootverbose)
-   device_printf(dev, "switching timecounter, %s -> %s\n",
+   device_printf(acpi_timer_dev,
+   "switching timecounter, %s -> %s\n",
tc->tc_name, newtc->tc_name);
(void)acpi_timer_read();
(void)acpi_timer_read();
@@ -292,7 +300,6 @@ acpi_timer_suspend(device_t dev)
acpi_timer_eh = EVENTHANDLER_REGISTER(power_resume,
acpi_timer_resume_handler, tc, EVENTHANDLER_PRI_LAST);
}
-   return (error);
 }
 
 /*
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r231296 - in head/sys: dev/isci dev/isci/scil modules/isci

2012-02-09 Thread Jim Harris
Author: jimharris
Date: Thu Feb  9 17:50:24 2012
New Revision: 231296
URL: http://svn.freebsd.org/changeset/base/231296

Log:
  Remove explicit CC assignment in isci(4) Makefile to allow for building
  with clang.  Also fix a number of warnings uncovered when building with
  clang around some implicit enum conversions.
  
  Sponsored by: Intel
  Approved by: scottl

Modified:
  head/sys/dev/isci/isci.h
  head/sys/dev/isci/isci_io_request.c
  head/sys/dev/isci/isci_remote_device.c
  head/sys/dev/isci/scil/sati_abort_task_set.c
  head/sys/dev/isci/scil/scic_sds_controller.c
  head/sys/dev/isci/scil/scif_sas_controller.c
  head/sys/dev/isci/scil/scif_sas_controller_state_handlers.c
  head/sys/dev/isci/scil/scif_sas_io_request.c
  head/sys/dev/isci/scil/scif_sas_remote_device_ready_substates.c
  head/sys/dev/isci/scil/scif_sas_smp_remote_device.c
  head/sys/dev/isci/scil/scif_sas_stp_io_request.c
  head/sys/dev/isci/scil/scif_sas_stp_task_request.c
  head/sys/modules/isci/Makefile

Modified: head/sys/dev/isci/isci.h
==
--- head/sys/dev/isci/isci.hThu Feb  9 17:38:08 2012(r231295)
+++ head/sys/dev/isci/isci.hThu Feb  9 17:50:24 2012(r231296)
@@ -160,7 +160,6 @@ struct ISCI_REQUEST
 struct ISCI_IO_REQUEST
 {
struct ISCI_REQUEST parent;
-   SCI_STATUS  status;
SCI_IO_REQUEST_HANDLE_T sci_object;
union ccb   *ccb;
uint32_tnum_segments;

Modified: head/sys/dev/isci/isci_io_request.c
==
--- head/sys/dev/isci/isci_io_request.c Thu Feb  9 17:38:08 2012
(r231295)
+++ head/sys/dev/isci/isci_io_request.c Thu Feb  9 17:50:24 2012
(r231296)
@@ -626,16 +626,16 @@ isci_io_request_construct(void *arg, bus
return;
}
 
-   io_request->status = scif_io_request_construct(
+   status = scif_io_request_construct(
io_request->parent.controller_handle,
io_request->parent.remote_device_handle,
SCI_CONTROLLER_INVALID_IO_TAG, (void *)io_request,
(void *)((char*)io_request + sizeof(struct ISCI_IO_REQUEST)),
&io_request->sci_object);
 
-   if (io_request->status != SCI_SUCCESS) {
+   if (status != SCI_SUCCESS) {
isci_io_request_complete(io_request->parent.controller_handle,
-   device, io_request, io_request->status);
+   device, io_request, (SCI_IO_STATUS)status);
return;
}
 
@@ -650,7 +650,7 @@ isci_io_request_construct(void *arg, bus
 
if (status != SCI_SUCCESS) {
isci_io_request_complete(io_request->parent.controller_handle,
-   device, io_request, status);
+   device, io_request, (SCI_IO_STATUS)status);
return;
}
 
@@ -900,7 +900,7 @@ isci_io_request_execute_smp_io(union ccb
 
if (status != SCI_SUCCESS) {
isci_io_request_complete(controller->scif_controller_handle,
-   smp_device_handle, io_request, status);
+   smp_device_handle, io_request, (SCI_IO_STATUS)status);
return;
}
 
@@ -912,7 +912,7 @@ isci_io_request_execute_smp_io(union ccb
 
if (status != SCI_SUCCESS) {
isci_io_request_complete(controller->scif_controller_handle,
-   smp_device_handle, io_request, status);
+   smp_device_handle, io_request, (SCI_IO_STATUS)status);
return;
}
 

Modified: head/sys/dev/isci/isci_remote_device.c
==
--- head/sys/dev/isci/isci_remote_device.c  Thu Feb  9 17:38:08 2012
(r231295)
+++ head/sys/dev/isci/isci_remote_device.c  Thu Feb  9 17:50:24 2012
(r231296)
@@ -195,7 +195,7 @@ isci_remote_device_reset(struct ISCI_REM
if (status != SCI_SUCCESS) {
isci_task_request_complete(controller->scif_controller_handle,
remote_device->sci_object, task_request->sci_object,
-   status);
+   (SCI_TASK_STATUS)status);
return;
}
 
@@ -207,7 +207,7 @@ isci_remote_device_reset(struct ISCI_REM
isci_task_request_complete(
controller->scif_controller_handle,
remote_device->sci_object, task_request->sci_object,
-   status);
+   (SCI_TASK_STATUS)status);
return;
}
 }

Modified: head/sys/dev/isci/scil/sati_abort_task_set.c
==
--- head/sys/dev/isci/scil/sati_abort_task_set.cThu Feb  9 17:38:08 
2012(r231295)
+++ head/sys/dev/isci/scil/sati_abort_task_set.cThu Feb  9 17:50:24 
2012(r23129

svn commit: r231298 - head/etc

2012-02-09 Thread Eitan Adler
Author: eadler
Date: Thu Feb  9 20:44:20 2012
New Revision: 231298
URL: http://svn.freebsd.org/changeset/base/231298

Log:
  Make etc/Makefile more conflict resistant
  
  PR:   conf/163789
  Submitted by: gcooper (iXsystems)
  Approved by:  cperciva
  MFC after:3 days

Modified:
  head/etc/Makefile

Modified: head/etc/Makefile
==
--- head/etc/Makefile   Thu Feb  9 19:13:36 2012(r231297)
+++ head/etc/Makefile   Thu Feb  9 20:44:20 2012(r231298)
@@ -7,18 +7,48 @@
 SUBDIR=sendmail
 .endif
 
-BIN1=  auth.conf \
-   crontab devd.conf devfs.conf \
-   ddb.conf dhclient.conf disktab fbtab \
-   ftpusers gettytab group \
-   hosts hosts.allow hosts.equiv \
-   inetd.conf libalias.conf login.access login.conf mac.conf motd \
-   netconfig network.subr networks newsyslog.conf nsswitch.conf \
-   phones profile protocols \
-   rc rc.bsdextended rc.firewall rc.initdiskless \
-   rc.sendmail rc.shutdown \
-   rc.subr remote rpc services shells \
-   sysctl.conf syslog.conf termcap.small
+BIN1=  auth.conf
+BIN1+= crontab
+BIN1+= devd.conf
+BIN1+= devfs.conf
+BIN1+= ddb.conf
+BIN1+= dhclient.conf
+BIN1+= disktab
+BIN1+= fbtab
+BIN1+= ftpusers
+BIN1+= gettytab
+BIN1+= group
+BIN1+= hosts
+BIN1+= hosts.allow
+BIN1+= hosts.equiv
+BIN1+= inetd.conf
+BIN1+= libalias.conf
+BIN1+= login.access
+BIN1+= login.conf
+BIN1+= mac.conf
+BIN1+= motd
+BIN1+= netconfig
+BIN1+= network.subr
+BIN1+= networks
+BIN1+= newsyslog.conf
+BIN1+= nsswitch.conf
+BIN1+= phones
+BIN1+= profile
+BIN1+= protocols
+BIN1+= rc
+BIN1+= rc.bsdextended
+BIN1+= rc.firewall
+BIN1+= rc.initdiskless
+BIN1+= rc.sendmail
+BIN1+= rc.shutdown
+BIN1+= rc.subr
+BIN1+= remote
+BIN1+= rpc
+BIN1+= services
+BIN1+= shells
+BIN1+= sysctl.conf
+BIN1+= syslog.conf
+BIN1+= termcap.small
 
 .if exists(${.CURDIR}/etc.${MACHINE}/ttys)
 BIN1+= etc.${MACHINE}/ttys
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r231299 - head/lib/libc/gen

2012-02-09 Thread Eitan Adler
Author: eadler
Date: Thu Feb  9 20:49:03 2012
New Revision: 231299
URL: http://svn.freebsd.org/changeset/base/231299

Log:
  More accurately document what happens on error.
  
  PR:   docs/127908
  Submitted by: Matthew D. Fuller 
  Approved by:  cperciva
  MFC after:1 week

Modified:
  head/lib/libc/gen/directory.3

Modified: head/lib/libc/gen/directory.3
==
--- head/lib/libc/gen/directory.3   Thu Feb  9 20:44:20 2012
(r231298)
+++ head/lib/libc/gen/directory.3   Thu Feb  9 20:49:03 2012
(r231299)
@@ -122,9 +122,12 @@ function
 returns a pointer to the next directory entry.
 It returns
 .Dv NULL
-upon reaching the end of the directory or detecting an invalid
-.Fn seekdir
-operation.
+upon reaching the end of the directory or on error.
+In the event of an error,
+.Va errno
+may be set to any of the values documented for the
+.Xr getdirentries 2
+system call.
 .Pp
 The
 .Fn readdir_r
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r231300 - head/usr.sbin/pkg_install/create

2012-02-09 Thread Eitan Adler
Author: eadler
Date: Thu Feb  9 20:51:03 2012
New Revision: 231300
URL: http://svn.freebsd.org/changeset/base/231300

Log:
  Permit the use of relative paths for the prefix argument.
  Remove an unnecessary cwd from created plists when -p is specified
  
  PR:   bin/145000
  Submitted by: gcooper
  Approved by:  portmgr (flo)
  MFC after:1 month

Modified:
  head/usr.sbin/pkg_install/create/perform.c

Modified: head/usr.sbin/pkg_install/create/perform.c
==
--- head/usr.sbin/pkg_install/create/perform.c  Thu Feb  9 20:49:03 2012
(r231299)
+++ head/usr.sbin/pkg_install/create/perform.c  Thu Feb  9 20:51:03 2012
(r231300)
@@ -214,8 +214,12 @@ pkg_perform(char **pkgs)
 read_plist(&plist, pkg_in);
 
 /* Prefix should add an @cwd to the packing list */
-if (Prefix)
-   add_plist_top(&plist, PLIST_CWD, Prefix);
+if (Prefix) {
+char resolved_prefix[PATH_MAX];
+if (realpath(Prefix, resolved_prefix) != 0)
+   err(EXIT_FAILURE, "couldn't resolve path for prefix: %s", Prefix);
+   add_plist_top(&plist, PLIST_CWD, resolved_prefix);
+}
 
 /* Add the origin if asked, at the top */
 if (Origin)
@@ -260,7 +264,9 @@ pkg_perform(char **pkgs)
 /* mark_plist(&plist); */
 
 /* Now put the release specific items in */
-add_plist(&plist, PLIST_CWD, ".");
+if (!Prefix) {
+   add_plist(&plist, PLIST_CWD, ".");
+}
 write_file(COMMENT_FNAME, Comment);
 add_plist(&plist, PLIST_IGNORE, NULL);
 add_plist(&plist, PLIST_FILE, COMMENT_FNAME);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r231306 - head/lib/libutil

2012-02-09 Thread Eitan Adler
Author: eadler
Date: Thu Feb  9 21:06:47 2012
New Revision: 231306
URL: http://svn.freebsd.org/changeset/base/231306

Log:
  Fix NULL ptr dereference in setusercontext if pwd is null,
  LOGIN_SETPRIORITY is set, and setting the priority (rtprio or
  setpriority) fails.
  
  PR:   kern/164238
  Submitted by: Alexander Wittig 
  Reviewed by:  des
  Approved by:  cperciva
  MFC after:1 month

Modified:
  head/lib/libutil/login_class.c

Modified: head/lib/libutil/login_class.c
==
--- head/lib/libutil/login_class.c  Thu Feb  9 20:57:36 2012
(r231305)
+++ head/lib/libutil/login_class.c  Thu Feb  9 21:06:47 2012
(r231306)
@@ -452,18 +452,21 @@ setusercontext(login_cap_t *lc, const st
p = (rtp.prio > RTP_PRIO_MAX) ? 31 : p;
if (rtprio(RTP_SET, 0, &rtp))
syslog(LOG_WARNING, "rtprio '%s' (%s): %m",
-   pwd->pw_name, lc ? lc->lc_class : LOGIN_DEFCLASS);
+   pwd ? pwd->pw_name : "-",
+   lc ? lc->lc_class : LOGIN_DEFCLASS);
} else if (p < PRIO_MIN) {
rtp.type = RTP_PRIO_REALTIME;
rtp.prio = abs(p - PRIO_MIN + RTP_PRIO_MAX);
p = (rtp.prio > RTP_PRIO_MAX) ? 1 : p;
if (rtprio(RTP_SET, 0, &rtp))
syslog(LOG_WARNING, "rtprio '%s' (%s): %m",
-   pwd->pw_name, lc ? lc->lc_class : LOGIN_DEFCLASS);
+   pwd ? pwd->pw_name : "-",
+   lc ? lc->lc_class : LOGIN_DEFCLASS);
} else {
if (setpriority(PRIO_PROCESS, 0, (int)p) != 0)
syslog(LOG_WARNING, "setpriority '%s' (%s): %m",
-   pwd->pw_name, lc ? lc->lc_class : LOGIN_DEFCLASS);
+   pwd ? pwd->pw_name : "-",
+   lc ? lc->lc_class : LOGIN_DEFCLASS);
}
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r231300 - head/usr.sbin/pkg_install/create

2012-02-09 Thread Florian Smeets
On 09.02.12 21:51, Eitan Adler wrote:
> Author: eadler
> Date: Thu Feb  9 20:51:03 2012
> New Revision: 231300
> URL: http://svn.freebsd.org/changeset/base/231300
> 
> Log:
>   Permit the use of relative paths for the prefix argument.
>   Remove an unnecessary cwd from created plists when -p is specified
>   
>   PR: bin/145000
>   Submitted by:   gcooper
>   Approved by:portmgr (flo)

I guess this should read flz ;)

Florian



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r231269 - head/sys/fs/nullfs

2012-02-09 Thread Pawel Jakub Dawidek
On Thu, Feb 09, 2012 at 10:39:02AM +, Martin Matuska wrote:
> Author: mm
> Date: Thu Feb  9 10:39:01 2012
> New Revision: 231269
> URL: http://svn.freebsd.org/changeset/base/231269
> 
> Log:
>   Allow mounting nullfs(5) inside jails.
>   
>   This is now possible thanks to r230129.
>   
>   MFC after:  1 month

I'd really like to know that someone actually audited nullfs to see it
can be safely managed within a jail. devfs is probably even more
critical - hopefully it isn't possible to make simple administrative
mistake that will allow to get access to, eg. /dev/kmem from within a
jail or something similar. Changes like this one, which can have serious
security implications, should be really properly reviewed.

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


pgpljNQ0Hhiul.pgp
Description: PGP signature


Re: svn commit: r231298 - head/etc

2012-02-09 Thread Marcel Moolenaar

On Feb 9, 2012, at 12:44 PM, Eitan Adler wrote:

> Author: eadler
> Date: Thu Feb  9 20:44:20 2012
> New Revision: 231298
> URL: http://svn.freebsd.org/changeset/base/231298
> 
> Log:
>  Make etc/Makefile more conflict resistant

Nice. Question though: why not the less verbose

BIN1 = \
foo \
bar \
baz

It's probably faster too, and friendlier when
running "make -dv"

Just a thought...

-- 
Marcel Moolenaar
mar...@xcllnt.net


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


svn commit: r231312 - in head/sys/mips: include mips

2012-02-09 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Thu Feb  9 22:17:13 2012
New Revision: 231312
URL: http://svn.freebsd.org/changeset/base/231312

Log:
  - Emulate RDHWR instruction for TLS support
  
  Reading register $29 with RDHWR is becoming the de-facto standard to
  implement TLS.  According to linux-mips wiki, MIPS Technologies has
  reserved hardware register $29 for ABI use.  Furthermore current GCC
  makes the following assumptions:
  - RDHWR is natively available or otherwise emulated by the kernel
  - Register $29 holds the TLS pointer
  
  Submitted by: Robert Millan 

Modified:
  head/sys/mips/include/mips_opcode.h
  head/sys/mips/mips/trap.c

Modified: head/sys/mips/include/mips_opcode.h
==
--- head/sys/mips/include/mips_opcode.h Thu Feb  9 22:13:20 2012
(r231311)
+++ head/sys/mips/include/mips_opcode.h Thu Feb  9 22:17:13 2012
(r231312)
@@ -176,6 +176,11 @@ typedef union {
 #defineOP_LDL  032
 #defineOP_LDR  033
 
+#define OP_SPECIAL2034
+#define OP_JALX035
+
+#define OP_SPECIAL3037
+
 #defineOP_LB   040
 #defineOP_LH   041
 #defineOP_LWL  042
@@ -389,6 +394,11 @@ typedef union {
 #defineOP_R_BGEZALLOP_BGEZALL
 
 /*
+ * Values for the 'func' field when 'op' == OP_SPECIAL3.
+ */
+#defineOP_RDHWR073
+
+/*
  * Values for the 'rs' field when 'op' == OP_COPz.
  */
 #defineOP_MF   000

Modified: head/sys/mips/mips/trap.c
==
--- head/sys/mips/mips/trap.c   Thu Feb  9 22:13:20 2012(r231311)
+++ head/sys/mips/mips/trap.c   Thu Feb  9 22:17:13 2012(r231312)
@@ -414,6 +414,7 @@ trap(struct trapframe *trapframe)
intptr_t addr = 0;
register_t pc;
int cop;
+   register_t *frame_regs;
 
trapdebug_enter(trapframe, 0);

@@ -762,9 +763,29 @@ dofault:
}
 
case T_RES_INST + T_USER:
-   log_illegal_instruction("RES_INST", trapframe);
-   i = SIGILL;
-   addr = trapframe->pc;
+   {
+   InstFmt inst;
+   inst = *(InstFmt *)trapframe->pc;
+   switch (inst.RType.op) {
+   case OP_SPECIAL3:
+   switch (inst.RType.func) {
+   case OP_RDHWR:
+   /* Register 29 used for TLS */
+   if (inst.RType.rd == 29) {
+   frame_regs = &(trapframe->zero);
+   frame_regs[inst.RType.rt] = 
(register_t)td->td_md.md_tls;
+   trapframe->pc += sizeof(int);
+   goto out;
+   }
+   break;
+   }
+   break;
+   }
+
+   log_illegal_instruction("RES_INST", trapframe);
+   i = SIGILL;
+   addr = trapframe->pc;
+   }
break;
case T_C2E:
case T_C2E + T_USER:
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r231312 - in head/sys/mips: include mips

2012-02-09 Thread Bjoern A. Zeeb

On 9. Feb 2012, at 22:17 , Oleksandr Tymoshenko wrote:

> Author: gonzo
> Date: Thu Feb  9 22:17:13 2012
> New Revision: 231312
> URL: http://svn.freebsd.org/changeset/base/231312
> 
> Log:
>  - Emulate RDHWR instruction for TLS support
> 
>  Reading register $29 with RDHWR is becoming the de-facto standard to
>  implement TLS.  According to linux-mips wiki, MIPS Technologies has
>  reserved hardware register $29 for ABI use.  Furthermore current GCC
>  makes the following assumptions:
>  - RDHWR is natively available or otherwise emulated by the kernel
>  - Register $29 holds the TLS pointer
> 
>  Submitted by:Robert Millan 

mips XLPN32 kernel failed, check _.mips.XLPN32 for details
mips XLRN32 kernel failed, check _.mips.XLRN32 for details

/scratch/tmp/bz/head.svn/sys/mips/mips/trap.c: In function 'trap':
/scratch/tmp/bz/head.svn/sys/mips/mips/trap.c:768: warning: cast to pointer 
from integer of different size [-Wint-to-pointer-cast]
/scratch/tmp/bz/head.svn/sys/mips/mips/trap.c:776: warning: cast from pointer 
to integer of different size [-Wpointer-to-int-cast]

> 
> Modified:
>  head/sys/mips/include/mips_opcode.h
>  head/sys/mips/mips/trap.c
> 
> Modified: head/sys/mips/include/mips_opcode.h
> ==
> --- head/sys/mips/include/mips_opcode.h   Thu Feb  9 22:13:20 2012
> (r231311)
> +++ head/sys/mips/include/mips_opcode.h   Thu Feb  9 22:17:13 2012
> (r231312)
> @@ -176,6 +176,11 @@ typedef union {
> #define   OP_LDL  032
> #define   OP_LDR  033
> 
> +#define OP_SPECIAL2  034
> +#define OP_JALX  035
> +
> +#define OP_SPECIAL3  037
> +
> #define   OP_LB   040
> #define   OP_LH   041
> #define   OP_LWL  042
> @@ -389,6 +394,11 @@ typedef union {
> #define   OP_R_BGEZALLOP_BGEZALL
> 
> /*
> + * Values for the 'func' field when 'op' == OP_SPECIAL3.
> + */
> +#define  OP_RDHWR073
> +
> +/*
>  * Values for the 'rs' field when 'op' == OP_COPz.
>  */
> #define   OP_MF   000
> 
> Modified: head/sys/mips/mips/trap.c
> ==
> --- head/sys/mips/mips/trap.c Thu Feb  9 22:13:20 2012(r231311)
> +++ head/sys/mips/mips/trap.c Thu Feb  9 22:17:13 2012(r231312)
> @@ -414,6 +414,7 @@ trap(struct trapframe *trapframe)
>   intptr_t addr = 0;
>   register_t pc;
>   int cop;
> + register_t *frame_regs;
> 
>   trapdebug_enter(trapframe, 0);
>   
> @@ -762,9 +763,29 @@ dofault:
>   }
> 
>   case T_RES_INST + T_USER:
> - log_illegal_instruction("RES_INST", trapframe);
> - i = SIGILL;
> - addr = trapframe->pc;
> + {
> + InstFmt inst;
> + inst = *(InstFmt *)trapframe->pc;
> + switch (inst.RType.op) {
> + case OP_SPECIAL3:
> + switch (inst.RType.func) {
> + case OP_RDHWR:
> + /* Register 29 used for TLS */
> + if (inst.RType.rd == 29) {
> + frame_regs = &(trapframe->zero);
> + frame_regs[inst.RType.rt] = 
> (register_t)td->td_md.md_tls;
> + trapframe->pc += sizeof(int);
> + goto out;
> + }
> + break;
> + }
> + break;
> + }
> +
> + log_illegal_instruction("RES_INST", trapframe);
> + i = SIGILL;
> + addr = trapframe->pc;
> + }
>   break;
>   case T_C2E:
>   case T_C2E + T_USER:

-- 
Bjoern A. Zeeb You have to have visions!
   It does not matter how good you are. It matters what good you do!

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


svn commit: r231313 - head/sys/ufs/ffs

2012-02-09 Thread Kirk McKusick
Author: mckusick
Date: Thu Feb  9 22:34:16 2012
New Revision: 231313
URL: http://svn.freebsd.org/changeset/base/231313

Log:
  Historically when an application wrote an entire block of a file,
  the kernel allocated a buffer but did not zero it as it was about
  to be completely filled by a uiomove() from the user's buffer.
  However, if the uiomove() failed, the old contents of the buffer
  could be exposed especially if the file was being mmap'ed. The
  fix was to always zero the buffer when it was allocated.
  
  This change first attempts the uiomove() to the newly allocated
  (and dirty) buffer and only zeros it if the uiomove() fails. The
  effect is to eliminate the gratuitous zeroing of the buffer in
  the usual case where the uiomove() successfully fills it.
  
  Reviewed by:kib
  Tested by:  scottl
  MFC after:  2 weeks (to 9 only)

Modified:
  head/sys/ufs/ffs/ffs_vnops.c

Modified: head/sys/ufs/ffs/ffs_vnops.c
==
--- head/sys/ufs/ffs/ffs_vnops.cThu Feb  9 22:17:13 2012
(r231312)
+++ head/sys/ufs/ffs/ffs_vnops.cThu Feb  9 22:34:16 2012
(r231313)
@@ -718,15 +718,6 @@ ffs_write(ap)
vnode_pager_setsize(vp, ip->i_size);
break;
}
-   /*
-* If the buffer is not valid we have to clear out any
-* garbage data from the pages instantiated for the buffer.
-* If we do not, a failed uiomove() during a write can leave
-* the prior contents of the pages exposed to a userland
-* mmap().  XXX deal with uiomove() errors a better way.
-*/
-   if ((bp->b_flags & B_CACHE) == 0 && fs->fs_bsize <= xfersize)
-   vfs_bio_clrbuf(bp);
if (ioflag & IO_DIRECT)
bp->b_flags |= B_DIRECT;
if ((ioflag & (IO_SYNC|IO_INVAL)) == (IO_SYNC|IO_INVAL))
@@ -743,6 +734,26 @@ ffs_write(ap)
 
error =
uiomove((char *)bp->b_data + blkoffset, (int)xfersize, uio);
+   /*
+* If the buffer is not already filled and we encounter an
+* error while trying to fill it, we have to clear out any
+* garbage data from the pages instantiated for the buffer.
+* If we do not, a failed uiomove() during a write can leave
+* the prior contents of the pages exposed to a userland mmap.
+*
+* Note that we need only clear buffers with a transfer size
+* equal to the block size because buffers with a shorter
+* transfer size were cleared above by the call to UFS_BALLOC()
+* with the BA_CLRBUF flag set.
+*
+* If the source region for uiomove identically mmaps the
+* buffer, uiomove() performed the NOP copy, and the buffer
+* content remains valid because the page fault handler
+* validated the pages.
+*/
+   if (error != 0 && (bp->b_flags & B_CACHE) == 0 &&
+   fs->fs_bsize == xfersize)
+   vfs_bio_clrbuf(bp);
if ((ioflag & (IO_VMIO|IO_DIRECT)) &&
   (LIST_EMPTY(&bp->b_dep))) {
bp->b_flags |= B_RELBUF;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r231314 - head/sys/mips/mips

2012-02-09 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Thu Feb  9 22:48:35 2012
New Revision: 231314
URL: http://svn.freebsd.org/changeset/base/231314

Log:
  Fix n32 build breakage

Modified:
  head/sys/mips/mips/trap.c

Modified: head/sys/mips/mips/trap.c
==
--- head/sys/mips/mips/trap.c   Thu Feb  9 22:34:16 2012(r231313)
+++ head/sys/mips/mips/trap.c   Thu Feb  9 22:48:35 2012(r231314)
@@ -765,7 +765,7 @@ dofault:
case T_RES_INST + T_USER:
{
InstFmt inst;
-   inst = *(InstFmt *)trapframe->pc;
+   inst = *(InstFmt *)(intptr_t)trapframe->pc;
switch (inst.RType.op) {
case OP_SPECIAL3:
switch (inst.RType.func) {
@@ -773,7 +773,7 @@ dofault:
/* Register 29 used for TLS */
if (inst.RType.rd == 29) {
frame_regs = &(trapframe->zero);
-   frame_regs[inst.RType.rt] = 
(register_t)td->td_md.md_tls;
+   frame_regs[inst.RType.rt] = 
(register_t)(intptr_t)td->td_md.md_tls;
trapframe->pc += sizeof(int);
goto out;
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r231298 - head/etc

2012-02-09 Thread Eitan Adler
On Thu, Feb 9, 2012 at 5:15 PM, Marcel Moolenaar  wrote:
>
> On Feb 9, 2012, at 12:44 PM, Eitan Adler wrote:
>
>> Author: eadler
>> Date: Thu Feb  9 20:44:20 2012
>> New Revision: 231298
>> URL: http://svn.freebsd.org/changeset/base/231298
>>
>> Log:
>>  Make etc/Makefile more conflict resistant
>
> Nice. Question though: why not the less verbose

Either would have worked but I went with what was in the original
patch.  If it is worth it I could change to use the format you
describe.

-- 
Eitan Adler
Source & Ports committer
X11, Bugbusting teams
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r231312 - in head/sys/mips: include mips

2012-02-09 Thread Oleksandr Tymoshenko

On 09/02/2012 2:33 PM, Bjoern A. Zeeb wrote:


On 9. Feb 2012, at 22:17 , Oleksandr Tymoshenko wrote:


Author: gonzo
Date: Thu Feb  9 22:17:13 2012
New Revision: 231312
URL: http://svn.freebsd.org/changeset/base/231312

Log:
  - Emulate RDHWR instruction for TLS support

  Reading register $29 with RDHWR is becoming the de-facto standard to
  implement TLS.  According to linux-mips wiki, MIPS Technologies has
  reserved hardware register $29 for ABI use.  Furthermore current GCC
  makes the following assumptions:
  - RDHWR is natively available or otherwise emulated by the kernel
  - Register $29 holds the TLS pointer

  Submitted by: Robert Millan


mips XLPN32 kernel failed, check _.mips.XLPN32 for details
mips XLRN32 kernel failed, check _.mips.XLRN32 for details

/scratch/tmp/bz/head.svn/sys/mips/mips/trap.c: In function 'trap':
/scratch/tmp/bz/head.svn/sys/mips/mips/trap.c:768: warning: cast to pointer 
from integer of different size [-Wint-to-pointer-cast]
/scratch/tmp/bz/head.svn/sys/mips/mips/trap.c:776: warning: cast from pointer 
to integer of different size [-Wpointer-to-int-cast]


Thanks for spotting it. Fixed.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r231317 - head/sys/dev/cxgb

2012-02-09 Thread Navdeep Parhar
Author: np
Date: Thu Feb  9 23:19:09 2012
New Revision: 231317
URL: http://svn.freebsd.org/changeset/base/231317

Log:
  Add IPv6 TSO (including TSO+VLAN) support to cxgb(4).
  
  If an IPv6 packet has extension headers the kernel needs to deal with it
  itself.  For the rest it can set various CSUM_XXX flags and the driver
  will act on them.

Modified:
  head/sys/dev/cxgb/cxgb_main.c
  head/sys/dev/cxgb/cxgb_sge.c

Modified: head/sys/dev/cxgb/cxgb_main.c
==
--- head/sys/dev/cxgb/cxgb_main.c   Thu Feb  9 22:54:16 2012
(r231316)
+++ head/sys/dev/cxgb/cxgb_main.c   Thu Feb  9 23:19:09 2012
(r231317)
@@ -982,7 +982,7 @@ cxgb_makedev(struct port_info *pi)
 #define CXGB_CAP (IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | \
 IFCAP_VLAN_HWCSUM | IFCAP_TSO | IFCAP_JUMBO_MTU | IFCAP_LRO | \
 IFCAP_VLAN_HWTSO | IFCAP_LINKSTATE)
-#define CXGB_CAP_ENABLE (CXGB_CAP & ~IFCAP_TSO6)
+#define CXGB_CAP_ENABLE CXGB_CAP
 
 static int
 cxgb_port_attach(device_t dev)
@@ -2059,8 +2059,8 @@ fail:
}
if (mask & IFCAP_RXCSUM)
ifp->if_capenable ^= IFCAP_RXCSUM;
-   if (mask & IFCAP_TSO4) {
-   ifp->if_capenable ^= IFCAP_TSO4;
+   if (mask & IFCAP_TSO) {
+   ifp->if_capenable ^= IFCAP_TSO;
 
if (IFCAP_TSO & ifp->if_capenable) {
if (IFCAP_TXCSUM & ifp->if_capenable)

Modified: head/sys/dev/cxgb/cxgb_sge.c
==
--- head/sys/dev/cxgb/cxgb_sge.cThu Feb  9 22:54:16 2012
(r231316)
+++ head/sys/dev/cxgb/cxgb_sge.cThu Feb  9 23:19:09 2012
(r231317)
@@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -1492,10 +1493,10 @@ t3_encap(struct sge_qset *qs, struct mbu
check_ring_tx_db(sc, txq, 0);
return (0); 
} else if (tso_info) {
-   int eth_type;
+   uint16_t eth_type;
struct cpl_tx_pkt_lso *hdr = (struct cpl_tx_pkt_lso *)txd;
struct ether_header *eh;
-   struct ip *ip;
+   void *l3hdr;
struct tcphdr *tcp;
 
txd->flit[2] = 0;
@@ -1521,18 +1522,37 @@ t3_encap(struct sge_qset *qs, struct mbu
}
 
eh = mtod(m0, struct ether_header *);
-   if (eh->ether_type == htons(ETHERTYPE_VLAN)) {
-   eth_type = CPL_ETH_II_VLAN;
-   ip = (struct ip *)((struct ether_vlan_header *)eh + 1);
+   eth_type = eh->ether_type;
+   if (eth_type == htons(ETHERTYPE_VLAN)) {
+   struct ether_vlan_header *evh = (void *)eh;
+
+   tso_info |= V_LSO_ETH_TYPE(CPL_ETH_II_VLAN);
+   l3hdr = evh + 1;
+   eth_type = evh->evl_proto;
} else {
-   eth_type = CPL_ETH_II;
-   ip = (struct ip *)(eh + 1);
+   tso_info |= V_LSO_ETH_TYPE(CPL_ETH_II);
+   l3hdr = eh + 1;
}
-   tcp = (struct tcphdr *)(ip + 1);
 
-   tso_info |= V_LSO_ETH_TYPE(eth_type) |
-   V_LSO_IPHDR_WORDS(ip->ip_hl) |
-   V_LSO_TCPHDR_WORDS(tcp->th_off);
+   if (eth_type == htons(ETHERTYPE_IP)) {
+   struct ip *ip = l3hdr;
+
+   tso_info |= V_LSO_IPHDR_WORDS(ip->ip_hl);
+   tcp = (struct tcphdr *)(ip + 1);
+   } else if (eth_type == htons(ETHERTYPE_IPV6)) {
+   struct ip6_hdr *ip6 = l3hdr;
+
+   KASSERT(ip6->ip6_nxt == IPPROTO_TCP,
+   ("%s: CSUM_TSO with ip6_nxt %d",
+   __func__, ip6->ip6_nxt));
+
+   tso_info |= F_LSO_IPV6;
+   tso_info |= V_LSO_IPHDR_WORDS(sizeof(*ip6) >> 2);
+   tcp = (struct tcphdr *)(ip6 + 1);
+   } else
+   panic("%s: CSUM_TSO but neither ip nor ip6", __func__);
+
+   tso_info |= V_LSO_TCPHDR_WORDS(tcp->th_off);
hdr->lso_info = htonl(tso_info);
 
if (__predict_false(mlen <= PIO_LEN)) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2012-02-09 Thread Konstantin Belousov
Author: kib
Date: Fri Feb 10 00:02:13 2012
New Revision: 231320
URL: http://svn.freebsd.org/changeset/base/231320

Log:
  Mark the automatically attached child with PL_FLAG_CHILD in struct
  lwpinfo flags, for PT_FOLLOWFORK auto-attachment.
  
  In collaboration with:Dmitry Mikulin 
  MFC after: 1 week

Modified:
  head/sys/kern/kern_fork.c
  head/sys/kern/sys_process.c
  head/sys/sys/proc.h
  head/sys/sys/ptrace.h

Modified: head/sys/kern/kern_fork.c
==
--- head/sys/kern/kern_fork.c   Fri Feb 10 00:02:03 2012(r231319)
+++ head/sys/kern/kern_fork.c   Fri Feb 10 00:02:13 2012(r231320)
@@ -1035,7 +1035,9 @@ fork_return(struct thread *td, struct tr
p->p_oppid = p->p_pptr->p_pid;
proc_reparent(p, dbg);
sx_xunlock(&proctree_lock);
+   td->td_dbgflags |= TDB_CHILD;
ptracestop(td, SIGSTOP);
+   td->td_dbgflags &= ~TDB_CHILD;
} else {
/*
 * ... otherwise clear the request.

Modified: head/sys/kern/sys_process.c
==
--- head/sys/kern/sys_process.c Fri Feb 10 00:02:03 2012(r231319)
+++ head/sys/kern/sys_process.c Fri Feb 10 00:02:13 2012(r231320)
@@ -1145,6 +1145,8 @@ kern_ptrace(struct thread *td, int req, 
pl->pl_flags |= PL_FLAG_FORKED;
pl->pl_child_pid = td2->td_dbg_forked;
}
+   if (td2->td_dbgflags & TDB_CHILD)
+   pl->pl_flags |= PL_FLAG_CHILD;
pl->pl_sigmask = td2->td_sigmask;
pl->pl_siglist = td2->td_siglist;
strcpy(pl->pl_tdname, td2->td_name);

Modified: head/sys/sys/proc.h
==
--- head/sys/sys/proc.h Fri Feb 10 00:02:03 2012(r231319)
+++ head/sys/sys/proc.h Fri Feb 10 00:02:13 2012(r231320)
@@ -384,6 +384,7 @@ do {
\
  process */
 #defineTDB_STOPATFORK  0x0080 /* Stop at the return from fork 
(child
  only) */
+#defineTDB_CHILD   0x0100 /* New child indicator for ptrace() 
*/
 
 /*
  * "Private" flags kept in td_pflags:

Modified: head/sys/sys/ptrace.h
==
--- head/sys/sys/ptrace.h   Fri Feb 10 00:02:03 2012(r231319)
+++ head/sys/sys/ptrace.h   Fri Feb 10 00:02:13 2012(r231320)
@@ -107,6 +107,7 @@ struct ptrace_lwpinfo {
 #definePL_FLAG_EXEC0x10/* exec(2) succeeded */
 #definePL_FLAG_SI  0x20/* siginfo is valid */
 #definePL_FLAG_FORKED  0x40/* new child */
+#definePL_FLAG_CHILD   0x80/* I am from child */
sigset_tpl_sigmask; /* LWP signal mask */
sigset_tpl_siglist; /* LWP pending signal */
struct __siginfo pl_siginfo;/* siginfo for signal */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r231298 - head/etc

2012-02-09 Thread Marcel Moolenaar

On Feb 9, 2012, at 3:09 PM, Eitan Adler wrote:

> On Thu, Feb 9, 2012 at 5:15 PM, Marcel Moolenaar  wrote:
>> 
>> On Feb 9, 2012, at 12:44 PM, Eitan Adler wrote:
>> 
>>> Author: eadler
>>> Date: Thu Feb  9 20:44:20 2012
>>> New Revision: 231298
>>> URL: http://svn.freebsd.org/changeset/base/231298
>>> 
>>> Log:
>>>  Make etc/Makefile more conflict resistant
>> 
>> Nice. Question though: why not the less verbose
> 
> Either would have worked but I went with what was in the original
> patch.  If it is worth it I could change to use the format you
> describe.


I think it's convention (see sys/modules/Makefile or lib/Makefile),
but I could just as well be mistaken (i.e. picked the only makefiles
that do this :-)

I leave it up to you...

-- 
Marcel Moolenaar
mar...@xcllnt.net


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


Re: svn commit: r231300 - head/usr.sbin/pkg_install/create

2012-02-09 Thread Andrey Chernov
On Thu, Feb 09, 2012 at 08:51:03PM +, Eitan Adler wrote:
>  /* Prefix should add an @cwd to the packing list */
> -if (Prefix)
> - add_plist_top(&plist, PLIST_CWD, Prefix);
> +if (Prefix) {
> +char resolved_prefix[PATH_MAX];
> +if (realpath(Prefix, resolved_prefix) != 0)
> + err(EXIT_FAILURE, "couldn't resolve path for prefix: %s", Prefix);
> + add_plist_top(&plist, PLIST_CWD, resolved_prefix);
> +}

This change cause 
"pkg_create: couldn't resolve path for prefix: /usr/local: No such file or 
directory"
because test condition should really be:
if (realpath(Prefix, resolved_prefix) == NULL)
(and realpath(3) returns char *)

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


Re: svn commit: r231300 - head/usr.sbin/pkg_install/create

2012-02-09 Thread Eitan Adler
On Thu, Feb 9, 2012 at 7:26 PM, Andrey Chernov  wrote:
> On Thu, Feb 09, 2012 at 08:51:03PM +, Eitan Adler wrote:
>>      /* Prefix should add an @cwd to the packing list */
>> -    if (Prefix)
>> -     add_plist_top(&plist, PLIST_CWD, Prefix);
>> +    if (Prefix) {
>> +        char resolved_prefix[PATH_MAX];
>> +        if (realpath(Prefix, resolved_prefix) != 0)
>> +         err(EXIT_FAILURE, "couldn't resolve path for prefix: %s", Prefix);
>> +     add_plist_top(&plist, PLIST_CWD, resolved_prefix);
>> +    }
>
> This change cause
> "pkg_create: couldn't resolve path for prefix: /usr/local: No such file or
> directory"
> because test condition should really be:

Patch sent - awaiting approval. Sorry for the breakage :(



-- 
Eitan Adler
Source & Ports committer
X11, Bugbusting teams
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r231328 - head/usr.sbin/pkg_install/create

2012-02-09 Thread Eitan Adler
Author: eadler
Date: Fri Feb 10 00:53:39 2012
New Revision: 231328
URL: http://svn.freebsd.org/changeset/base/231328

Log:
  Fix r231300: Use correct test so we only bail out on error instead of on 
non-error.
  Also, fix a style bug.
  
  Submitted by: ache
  Approved by:  cperciva
  MFC after:1 month

Modified:
  head/usr.sbin/pkg_install/create/perform.c

Modified: head/usr.sbin/pkg_install/create/perform.c
==
--- head/usr.sbin/pkg_install/create/perform.c  Fri Feb 10 00:51:32 2012
(r231327)
+++ head/usr.sbin/pkg_install/create/perform.c  Fri Feb 10 00:53:39 2012
(r231328)
@@ -216,7 +216,7 @@ pkg_perform(char **pkgs)
 /* Prefix should add an @cwd to the packing list */
 if (Prefix) {
 char resolved_prefix[PATH_MAX];
-if (realpath(Prefix, resolved_prefix) != 0)
+if (realpath(Prefix, resolved_prefix) == NULL)
err(EXIT_FAILURE, "couldn't resolve path for prefix: %s", Prefix);
add_plist_top(&plist, PLIST_CWD, resolved_prefix);
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r231298 - head/etc

2012-02-09 Thread Alexey Dokuchaev
On Thu, Feb 09, 2012 at 04:15:23PM -0800, Marcel Moolenaar wrote:
> I think it's convention (see sys/modules/Makefile or lib/Makefile),
> but I could just as well be mistaken (i.e. picked the only makefiles
> that do this :-)

I also believe this is the usual way to do things in FreeBSD.  Those BIN1+='s
are too chatty.

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


svn commit: r231329 - head/libexec/rtld-elf/mips

2012-02-09 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Feb 10 03:30:57 2012
New Revision: 231329
URL: http://svn.freebsd.org/changeset/base/231329

Log:
  Fix debug output for MIPS part of rtld

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

Modified: head/libexec/rtld-elf/mips/reloc.c
==
--- head/libexec/rtld-elf/mips/reloc.c  Fri Feb 10 00:53:39 2012
(r231328)
+++ head/libexec/rtld-elf/mips/reloc.c  Fri Feb 10 03:30:57 2012
(r231329)
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 
 #include "debug.h"
 #include "rtld.h"
@@ -244,9 +245,9 @@ _mips_rtld_bind(Obj_Entry *obj, Elf_Size
_rtld_error("bind failed no symbol");
 
 target = (Elf_Addr)(defobj->relocbase + def->st_value);
-dbg("bind now/fixup at %s sym # %d in %s --> was=%p new=%p",
+dbg("bind now/fixup at %s sym # %jd in %s --> was=%p new=%p",
obj->path,
-   reloff, defobj->strtab + def->st_name, 
+   (intmax_t)reloff, defobj->strtab + def->st_name, 
(void *)got[obj->local_gotno + reloff - obj->gotsym],
(void *)target);
 got[obj->local_gotno + reloff - obj->gotsym] = target;
@@ -283,8 +284,8 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry 
 
/* Relocate the local GOT entries */
got += i;
-   dbg("got:%p for %d entries adding %x",
-   got, obj->local_gotno, (uint32_t)obj->relocbase);
+   dbg("got:%p for %d entries adding %p",
+   got, obj->local_gotno, obj->relocbase);
for (; i < obj->local_gotno; i++) {
*got += (Elf_Addr)obj->relocbase;
got++;
@@ -339,8 +340,8 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry 
 */
*got = sym->st_value + (Elf_Addr)obj->relocbase;
if ((Elf_Addr)(*got) == (Elf_Addr)obj->relocbase) {
-   dbg("Warning2, i:%d maps to relocbase 
address:%x",
-   i, (uint32_t)obj->relocbase);
+   dbg("Warning2, i:%d maps to relocbase 
address:%p",
+   i, obj->relocbase);
}
 
} else if (sym->st_info == ELF_ST_INFO(STB_GLOBAL, 
STT_SECTION)) {
@@ -349,8 +350,8 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry 
*got = sym->st_value +
(Elf_Addr)obj->relocbase;
if ((Elf_Addr)(*got) == 
(Elf_Addr)obj->relocbase) {
-   dbg("Warning3, i:%d maps to relocbase 
address:%x",
-   i, (uint32_t)obj->relocbase);
+   dbg("Warning3, i:%d maps to relocbase 
address:%p",
+   i, obj->relocbase);
}
}
} else {
@@ -363,8 +364,8 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry 
}
*got = def->st_value + (Elf_Addr)defobj->relocbase;
if ((Elf_Addr)(*got) == (Elf_Addr)obj->relocbase) {
-   dbg("Warning4, i:%d maps to relocbase 
address:%x",
-   i, (uint32_t)obj->relocbase);
+   dbg("Warning4, i:%d maps to relocbase 
address:%p",
+   i, obj->relocbase);
dbg("via first obj symbol %s",
obj->strtab + obj->symtab[i].st_name);
dbg("found in obj %p:%s",
@@ -470,8 +471,8 @@ reloc_plt(Obj_Entry *obj)
const Elf_Rel *rellim;
const Elf_Rel *rel;

-   dbg("reloc_plt obj:%p pltrel:%p sz:%d", obj, obj->pltrel, 
(int)obj->pltrelsize);
-   dbg("gottable %p num syms:%d", obj->pltgot, obj->symtabno );
+   dbg("reloc_plt obj:%p pltrel:%p sz:%s", obj, obj->pltrel, 
(int)obj->pltrelsize);
+   dbg("gottable %p num syms:%s", obj->pltgot, obj->symtabno );
dbg("*");
rellim = (const Elf_Rel *)((char *)obj->pltrel +
obj->pltrelsize);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r231331 - head/share/man/man7

2012-02-09 Thread Glen Barber
Author: gjb (doc committer)
Date: Fri Feb 10 03:34:32 2012
New Revision: 231331
URL: http://svn.freebsd.org/changeset/base/231331

Log:
  Fix date from r23.
  
  Pointy-hat to:gjb (myself, approver of r23)

Modified:
  head/share/man/man7/ports.7

Modified: head/share/man/man7/ports.7
==
--- head/share/man/man7/ports.7 Fri Feb 10 03:32:29 2012(r231330)
+++ head/share/man/man7/ports.7 Fri Feb 10 03:34:32 2012(r231331)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd Feb 06, 2012
+.Dd February 9, 2012
 .Dt PORTS 7
 .Os
 .Sh NAME
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r231298 - head/etc

2012-02-09 Thread Bruce Evans

On Thu, 9 Feb 2012, Marcel Moolenaar wrote:


On Feb 9, 2012, at 12:44 PM, Eitan Adler wrote:


Author: eadler
Date: Thu Feb  9 20:44:20 2012
New Revision: 231298
URL: http://svn.freebsd.org/changeset/base/231298

Log:
 Make etc/Makefile more conflict resistant


Nice. Question though: why not the less verbose

BIN1 = \
foo \
bar \
baz

It's probably faster too, and friendlier when
running "make -dv"


And it isn't a style bug.

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


Re: svn commit: r231298 - head/etc

2012-02-09 Thread Doug Barton
On 02/09/2012 14:15, Marcel Moolenaar wrote:
> 
> On Feb 9, 2012, at 12:44 PM, Eitan Adler wrote:
> 
>> Author: eadler
>> Date: Thu Feb  9 20:44:20 2012
>> New Revision: 231298
>> URL: http://svn.freebsd.org/changeset/base/231298
>>
>> Log:
>>  Make etc/Makefile more conflict resistant
> 
> Nice. Question though: why not the less verbose
> 
> BIN1 = \
>   foo \
>   bar \
>   baz

Yes, this change should be made to match the style in the rest of src.

FWIW, the style Eitan used is what's used in all of the ports category
Makefiles (which arguably should also be changed, but that's a whole
'nother windmill to tilt at).


Doug

-- 

It's always a long day; 86400 doesn't fit into a short.

Breadth of IT experience, and depth of knowledge in the DNS.
Yours for the right price.  :)  http://SupersetSolutions.com/

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


svn commit: r231336 - head/contrib/gcc

2012-02-09 Thread Tim Kientzle
Author: kientzle
Date: Fri Feb 10 05:05:42 2012
New Revision: 231336
URL: http://svn.freebsd.org/changeset/base/231336

Log:
  Implement -print-file-name=include (which is undocumented
  but used by some Linux boot loaders).  This option prints
  out the directory holding the include files needed by
  a freestanding program.  The default implementation of
  this doesn't work on FreeBSD because of the different
  include file layout.  But it's easy to implement:
  just return /usr/include (or the cross-compiling equivalent).
  
  Reviewed by:  kan
  MFC after:1 week

Modified:
  head/contrib/gcc/gcc.c

Modified: head/contrib/gcc/gcc.c
==
--- head/contrib/gcc/gcc.c  Fri Feb 10 04:11:04 2012(r231335)
+++ head/contrib/gcc/gcc.c  Fri Feb 10 05:05:42 2012(r231336)
@@ -2696,6 +2696,17 @@ find_a_file (const struct path_prefix *p
 return xstrdup (DEFAULT_LINKER);
 #endif
 
+#ifdef FREEBSD_NATIVE
+  if (! strcmp(name, "include"))
+{
+#ifdef CROSS_INCLUDE_DIR
+  return xstrdup(CROSS_INCLUDE_DIR);
+#else
+  return xstrdup(STANDARD_INCLUDE_DIR);
+#endif
+}
+#endif
+
   /* Determine the filename to execute (special case for absolute paths).  */
 
   if (IS_ABSOLUTE_PATH (name))
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r231341 - head/sys/kern

2012-02-09 Thread Kevin Lo
Author: kevlo
Date: Fri Feb 10 06:30:52 2012
New Revision: 231341
URL: http://svn.freebsd.org/changeset/base/231341

Log:
  Add a missing break. This bug was introduced in r228856.

Modified:
  head/sys/kern/kern_tc.c

Modified: head/sys/kern/kern_tc.c
==
--- head/sys/kern/kern_tc.c Fri Feb 10 06:12:48 2012(r231340)
+++ head/sys/kern/kern_tc.c Fri Feb 10 06:30:52 2012(r231341)
@@ -1085,6 +1085,7 @@ sysclock_snap2bintime(struct sysclock_sn
/* Boot time adjustment, for uptime/monotonic clocks. */
if (flags & FFCLOCK_UPTIME)
bintime_sub(bt, &ffclock_boottime);
+   break;
 #endif
default:
return (EINVAL);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r231313 - head/sys/ufs/ffs

2012-02-09 Thread Bruce Evans

On Thu, 9 Feb 2012, Kirk McKusick wrote:


Log:
 Historically when an application wrote an entire block of a file,
 the kernel allocated a buffer but did not zero it as it was about
 to be completely filled by a uiomove() from the user's buffer.
 However, if the uiomove() failed, the old contents of the buffer
 could be exposed especially if the file was being mmap'ed. The
 fix was to always zero the buffer when it was allocated.

 This change first attempts the uiomove() to the newly allocated
 (and dirty) buffer and only zeros it if the uiomove() fails. The
 effect is to eliminate the gratuitous zeroing of the buffer in
 the usual case where the uiomove() successfully fills it.


Lately I have been thinking again of the error handling near here:

%   if (error) {
%   if (ioflag & IO_UNIT) {
%   (void)ffs_truncate(vp, osize,
%   IO_NORMAL | (ioflag & IO_SYNC),
%   ap->a_cred, uio->uio_td);
%   uio->uio_offset -= resid - uio->uio_resid;
%   uio->uio_resid = resid;
%   }
%   } else if (resid > uio->uio_resid && (ioflag & IO_SYNC))
%   error = ffs_update(vp, 1);

This attempts to back out of the whole write after an error.  But it is
impossible to back out of a write in the middle of the file (unless you
save all the blocks written to, and don't get more i/o errors trying to
restore them).  The above makes various messes trying, and even breaks
some cases where the write is at the end of the file: suppose error != 0
and that some i/o has been done successfully (otherwise there is no
problem):

- suppose IO_UNIT is not set.  Then the above fails to do anything.
  Even if not backing out is correct in this case, it is necessary
  to call ffs_update(vp, 1) under the condition where it is called
  in the non-error case, irrespective of whether the write is at
  the end of the file.

  But I think the existence of IO_UNIT is a bug.  It is only used
  here and in VOP_WRITE() for some other file systems not including
  zfs.  The others that use it are ext2fs, msdosfs and xfs (don't
  forget to change their VOPs when changing ffs).  The 2 nfsclients
  have a comment saying that IO_UNIT is not used because all writes
  are atomic.  IO_UNIT is also passed to VOP_READ(), but it is not
  used by any read VOPs.  IO_UNIT is always set by vn_write().
  Thus it is set in almost all cases.  And I can't find any cases
  where it is not set, using grep in kern.  Thus its existence
  does nothing except to make it hard to verify that it works
  correctly because it always has no effect.

- suppose that IO_UNIT is set.
  - we don't check that ffs_truncate() succeeded, and we even explicitly
(void) it, though we should check.  We blindly proceed to resetting
the i/o count, so that upper layers see the error and don't see the
amount written, although the file may have been extended, depending
on the details of how the truncation failed.
  - when the write is not at EOF and doesn't extend beyond the original
end, ffs_truncate() usually succeeds and has no visible effect.  We
blindy proceed to resetting the i/o count, so that upper layers see
the error and don't see the amount successfully written, although
this amount is nonzero (since I specified that this case writes
something before hitting the error).  Upper layers also get no
indication of the amount of clobbered bytes beyond the end of the
successively written bytes.  POSIX write semantics work very badly
here.  If we never return a short write, but always convert it to
an error (this needs just a bit more force than the above, and might
be the natural result of fixing these bugs), then writers should
assume that the file is damaged for the whole region of the file
that the write was attempted on, but for short writes, writers
should be able to assume no damage.
  - when the write is not at EOF but extends beyond the original end,
there is a combination of the above bugs.

Just before here, we turn off the set*id bits if some i/o was done.
This is unnecessary if there was an error and the i/o is successfully
backed out of in a non-buggy way.  But it is safer to do it anyway.
It would be even safer to do it after any error.

My version has the following (mostly wrong) comments and (mostly right)
fixes in this area:

% Index: ffs_vnops.c
% ===
% RCS file: /home/ncvs/src/sys/ufs/ffs/ffs_vnops.c,v
% retrieving revision 1.130
% diff -u -2 -r1.130 ffs_vnops.c
% --- ffs_vnops.c   21 May 2004 12:05:48 -  1.130
% +++ ffs_vnops.c   28 Sep 2010 10:45:17 -
% @@ -719,4 +722,8 @@
%* we clear the setuid and setgid bits as a precaution against
%* tampering.
% +  * XXX too late, the tamperer may have opened the file while we
% +  * were writing the data (or before).

svn commit: r231347 - in head/libexec/rtld-elf: . mips

2012-02-09 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Feb 10 06:42:50 2012
New Revision: 231347
URL: http://svn.freebsd.org/changeset/base/231347

Log:
  Switch MIPS TLS implementation to Variant I

Modified:
  head/libexec/rtld-elf/mips/reloc.c
  head/libexec/rtld-elf/mips/rtld_machdep.h
  head/libexec/rtld-elf/rtld.c

Modified: head/libexec/rtld-elf/mips/reloc.c
==
--- head/libexec/rtld-elf/mips/reloc.c  Fri Feb 10 06:42:00 2012
(r231346)
+++ head/libexec/rtld-elf/mips/reloc.c  Fri Feb 10 06:42:50 2012
(r231347)
@@ -39,8 +39,11 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+
 #include "debug.h"
 #include "rtld.h"
+#include "rtld_printf.h"
 
 #ifdef __mips_n64
 #defineGOT1_MASK   0x8000UL
@@ -528,11 +531,32 @@ reloc_jmpslot(Elf_Addr *where, Elf_Addr 
 void
 allocate_initial_tls(Obj_Entry *objs)
 {
+   char *tls;

+   /*
+* Fix the size of the static TLS block by using the maximum
+* offset allocated so far and adding a bit for dynamic modules to
+* use.
+*/
+   tls_static_space = tls_last_offset + tls_last_size + 
RTLD_STATIC_TLS_EXTRA;
+
+   tls = ((char *) allocate_tls(objs, NULL, TLS_TCB_SIZE, 8) 
+   + TLS_TP_OFFSET + TLS_TCB_SIZE);
+
+   sysarch(MIPS_SET_TLS, tls);
+   rtld_printf("allocate_initial_tls -> %p(%p)\n", tls, tls - 
TLS_TP_OFFSET -  TLS_TCB_SIZE);
 }
 
 void *
 __tls_get_addr(tls_index* ti)
 {
-   return (NULL);
+   Elf_Addr** tls;
+   char *p;
+
+   sysarch(MIPS_GET_TLS, &tls);
+
+   p = tls_get_addr_common((Elf_Addr**)((Elf_Addr)tls - TLS_TP_OFFSET 
+   - TLS_TCB_SIZE), ti->ti_module, ti->ti_offset);
+
+   return (p + TLS_DTV_OFFSET);
 }

Modified: head/libexec/rtld-elf/mips/rtld_machdep.h
==
--- head/libexec/rtld-elf/mips/rtld_machdep.h   Fri Feb 10 06:42:00 2012
(r231346)
+++ head/libexec/rtld-elf/mips/rtld_machdep.h   Fri Feb 10 06:42:50 2012
(r231347)
@@ -47,21 +47,32 @@ Elf_Addr reloc_jmpslot(Elf_Addr *where, 
 
 #define call_initfini_pointer(obj, target) \
(((InitFunc)(target))())
-   
+
+/*
+ * TLS
+ */
+
+#define TLS_TP_OFFSET  0x7000
+#define TLS_DTV_OFFSET 0x8000
+#ifdef __mips_n64
+#define TLS_TCB_SIZE   16
+#else
+#define TLS_TCB_SIZE   8
+#endif
+
 typedef struct {
unsigned long ti_module;
unsigned long ti_offset;
 } tls_index;
 
 #define round(size, align) \
-   (((size) + (align) - 1) & ~((align) - 1))
+(((size) + (align) - 1) & ~((align) - 1))
 #define calculate_first_tls_offset(size, align) \
-   round(size, align) 
+round(TLS_TCB_SIZE, align)
 #define calculate_tls_offset(prev_offset, prev_size, size, align) \
-   round(prev_offset + prev_size, align)
+round(prev_offset + prev_size, align)
 #define calculate_tls_end(off, size)((off) + (size))
-   
-   
+
 /*
  * Lazy binding entry point, called via PLT.
  */

Modified: head/libexec/rtld-elf/rtld.c
==
--- head/libexec/rtld-elf/rtld.cFri Feb 10 06:42:00 2012
(r231346)
+++ head/libexec/rtld-elf/rtld.cFri Feb 10 06:42:50 2012
(r231347)
@@ -3543,7 +3543,7 @@ tls_get_addr_common(Elf_Addr** dtvp, int
 
 /* XXX not sure what variants to use for arm. */
 
-#if defined(__ia64__) || defined(__powerpc__)
+#if defined(__ia64__) || defined(__powerpc__) || defined(__mips__)
 
 /*
  * Allocate Static TLS using the Variant I method.
@@ -3625,7 +3625,7 @@ free_tls(void *tcb, size_t tcbsize, size
 #endif
 
 #if defined(__i386__) || defined(__amd64__) || defined(__sparc64__) || \
-defined(__arm__) || defined(__mips__)
+defined(__arm__)
 
 /*
  * Allocate Static TLS using the Variant II method.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r231349 - head/sys/geom/part

2012-02-09 Thread Andrey V. Elsukov
Author: ae
Date: Fri Feb 10 06:44:30 2012
New Revision: 231349
URL: http://svn.freebsd.org/changeset/base/231349

Log:
  Let's be more realistic and limit maximum number of partition to 4k.
  
  MFC after:1 week

Modified:
  head/sys/geom/part/g_part_apm.c

Modified: head/sys/geom/part/g_part_apm.c
==
--- head/sys/geom/part/g_part_apm.c Fri Feb 10 06:43:16 2012
(r231348)
+++ head/sys/geom/part/g_part_apm.c Fri Feb 10 06:44:30 2012
(r231349)
@@ -102,7 +102,7 @@ static struct g_part_scheme g_part_apm_s
sizeof(struct g_part_apm_table),
.gps_entrysz = sizeof(struct g_part_apm_entry),
.gps_minent = 16,
-   .gps_maxent = INT_MAX,
+   .gps_maxent = 4096,
 };
 G_PART_SCHEME_DECLARE(g_part_apm);
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r231350 - in head/lib/libthr/arch/mips: include mips

2012-02-09 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Feb 10 06:53:25 2012
New Revision: 231350
URL: http://svn.freebsd.org/changeset/base/231350

Log:
  Switch MIPS TLS implementation to Variant I:
  
  Save pointer to the TLS structure taking into account TP_OFFSET
  and TCB structure size.

Modified:
  head/lib/libthr/arch/mips/include/pthread_md.h
  head/lib/libthr/arch/mips/mips/pthread_md.c

Modified: head/lib/libthr/arch/mips/include/pthread_md.h
==
--- head/lib/libthr/arch/mips/include/pthread_md.h  Fri Feb 10 06:44:30 
2012(r231349)
+++ head/lib/libthr/arch/mips/include/pthread_md.h  Fri Feb 10 06:53:25 
2012(r231350)
@@ -39,15 +39,19 @@
 
 #defineCPU_SPINWAIT
 #defineDTV_OFFSET  offsetof(struct tcb, tcb_dtv)
+#ifdef __mips_n64
+#defineTP_OFFSET   0x7010
+#else
+#defineTP_OFFSET   0x7008
+#endif
 
 /*
- * Variant II tcb, first two members are required by rtld.
+ * Variant I tcb. The structure layout is fixed, don't blindly
+ * change it!
  */
 struct tcb {
-   struct tcb  *tcb_self;  /* required by rtld */
-   void*tcb_dtv;   /* required by rtld */
-   struct pthread  *tcb_thread;/* our hook */
-   void*tcb_spare[1];
+   void*tcb_dtv;
+   struct pthread  *tcb_thread;
 };
 
 /*
@@ -61,7 +65,7 @@ static __inline void
 _tcb_set(struct tcb *tcb)
 {
 
-   sysarch(MIPS_SET_TLS, tcb);
+   sysarch(MIPS_SET_TLS, ((uint8_t*)tcb + TP_OFFSET));
 }
 
 /*
@@ -70,10 +74,10 @@ _tcb_set(struct tcb *tcb)
 static __inline struct tcb *
 _tcb_get(void)
 {
-   void *tcb;
+   uint8_t *tcb;
 
sysarch(MIPS_GET_TLS, &tcb);
-   return tcb;
+   return ((struct tcb *)(tcb - TP_OFFSET));
 }
 
 extern struct pthread *_thr_initial;

Modified: head/lib/libthr/arch/mips/mips/pthread_md.c
==
--- head/lib/libthr/arch/mips/mips/pthread_md.c Fri Feb 10 06:44:30 2012
(r231349)
+++ head/lib/libthr/arch/mips/mips/pthread_md.c Fri Feb 10 06:53:25 2012
(r231350)
@@ -34,6 +34,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+
 #include "pthread_md.h"
 
 struct tcb *
@@ -41,16 +43,17 @@ _tcb_ctor(struct pthread *thread, int in
 {
struct tcb *tcb;
 
-   tcb = malloc(sizeof(struct tcb));
-   if (tcb) {
-   bzero(tcb, sizeof(struct tcb));
+   tcb = _rtld_allocate_tls((initial) ? _tcb_get() :  NULL,
+   sizeof(struct tcb), 16);
+   if (tcb)
tcb->tcb_thread = thread;
-   }
+
return (tcb);
 }
 
 void
 _tcb_dtor(struct tcb *tcb)
 {
-   free(tcb);
+
+   _rtld_free_tls(tcb, sizeof(struct tcb), 16);
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r231351 - head/sys/mips/mips

2012-02-09 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Fri Feb 10 07:03:45 2012
New Revision: 231351
URL: http://svn.freebsd.org/changeset/base/231351

Log:
  Fix-up value passed by thr_new syscall to make it compatible
  with MIPS_TLS_GET/MIPS_TLS_SET sysarch API.

Modified:
  head/sys/mips/mips/vm_machdep.c

Modified: head/sys/mips/mips/vm_machdep.c
==
--- head/sys/mips/mips/vm_machdep.c Fri Feb 10 06:53:25 2012
(r231350)
+++ head/sys/mips/mips/vm_machdep.c Fri Feb 10 07:03:45 2012
(r231351)
@@ -601,7 +601,18 @@ int
 cpu_set_user_tls(struct thread *td, void *tls_base)
 {
 
-   td->td_md.md_tls = tls_base;
+   /* 
+* tls_base passed to this function 
+ * from thr_new call and points to actual TCB struct, 
+* so we should add TP_OFFSET + sizeof(struct tcb)
+* to make it the same way TLS base is passed to 
+* MIPS_SET_TLS/MIPS_GET_TLS API 
+*/
+#ifndef __mips_n64
+   td->td_md.md_tls = (char*)tls_base + 0x7010;
+#else
+   td->td_md.md_tls = (char*)tls_base + 0x7008;
+#endif
return (0);
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"