svn commit: r216195 - head/sys/dev/iwn

2010-12-05 Thread Bernhard Schmidt
Author: bschmidt
Date: Sun Dec  5 09:00:32 2010
New Revision: 216195
URL: http://svn.freebsd.org/changeset/base/216195

Log:
  For 6000 series and newer devices the DC calibration results are no
  longer requested of the boot firmware. Instead of sending those results
  to the runtime firmware the firmware is told to do the DC calibration
  itself.
  
  MFC after:1 week

Modified:
  head/sys/dev/iwn/if_iwn.c
  head/sys/dev/iwn/if_iwnvar.h

Modified: head/sys/dev/iwn/if_iwn.c
==
--- head/sys/dev/iwn/if_iwn.c   Sun Dec  5 03:20:55 2010(r216194)
+++ head/sys/dev/iwn/if_iwn.c   Sun Dec  5 09:00:32 2010(r216195)
@@ -223,7 +223,7 @@ static int  iwn5000_save_calib_result(str
struct iwn_phy_calib *, int, int);
 static voidiwn5000_free_calib_results(struct iwn_softc *);
 static int iwn5000_chrystal_calib(struct iwn_softc *);
-static int iwn5000_send_calib_query(struct iwn_softc *);
+static int iwn5000_send_calib_query(struct iwn_softc *, uint32_t);
 static int iwn5000_rx_calib_result(struct iwn_softc *,
struct iwn_rx_desc *, struct iwn_rx_data *);
 static int iwn5000_send_wimax_coex(struct iwn_softc *);
@@ -756,6 +756,7 @@ iwn_hal_attach(struct iwn_softc *sc)
default:
sc->txchainmask = IWN_ANT_ABC;
sc->rxchainmask = IWN_ANT_ABC;
+   sc->calib_runtime = IWN_CALIB_DC;
break;
}
sc->calib_init = IWN_CALIB_XTAL | IWN_CALIB_LO |
@@ -767,8 +768,9 @@ iwn_hal_attach(struct iwn_softc *sc)
sc->fwname = "iwn6050fw";
sc->txchainmask = IWN_ANT_AB;
sc->rxchainmask = IWN_ANT_AB;
-   sc->calib_init = IWN_CALIB_XTAL | IWN_CALIB_DC | IWN_CALIB_LO |
+   sc->calib_init = IWN_CALIB_XTAL | IWN_CALIB_LO |
IWN_CALIB_TX_IQ | IWN_CALIB_BASE_BAND;
+   sc->calib_runtime = IWN_CALIB_DC;
break;
case IWN_HW_REV_TYPE_6005:
sc->sc_hal = &iwn5000_hal;
@@ -778,6 +780,7 @@ iwn_hal_attach(struct iwn_softc *sc)
sc->rxchainmask = IWN_ANT_AB;
sc->calib_init = IWN_CALIB_XTAL | IWN_CALIB_LO |
IWN_CALIB_TX_IQ | IWN_CALIB_BASE_BAND;
+   sc->calib_runtime = IWN_CALIB_DC;
break;
default:
device_printf(sc->sc_dev, "adapter type %d not supported\n",
@@ -5316,7 +5319,7 @@ iwn5000_chrystal_calib(struct iwn_softc 
  * only once at first boot.
  */
 static int
-iwn5000_send_calib_query(struct iwn_softc *sc)
+iwn5000_send_calib_query(struct iwn_softc *sc, uint32_t cfg)
 {
 #defineCALIB_INIT_CFG  0x;
struct iwn5000_calib_config cmd;
@@ -5324,12 +5327,15 @@ iwn5000_send_calib_query(struct iwn_soft
 
memset(&cmd, 0, sizeof cmd);
cmd.ucode.once.enable = CALIB_INIT_CFG;
-   cmd.ucode.once.start  = CALIB_INIT_CFG;
-   cmd.ucode.once.send   = CALIB_INIT_CFG;
-   cmd.ucode.flags   = CALIB_INIT_CFG;
+   if (cfg == 0) {
+   cmd.ucode.once.start  = CALIB_INIT_CFG;
+   cmd.ucode.once.send   = CALIB_INIT_CFG;
+   cmd.ucode.flags   = CALIB_INIT_CFG;
+   } else
+   cmd.ucode.once.start  = cfg;
 
-   DPRINTF(sc, IWN_DEBUG_CALIBRATE, "%s: query calibration results\n",
-   __func__);
+   DPRINTF(sc, IWN_DEBUG_CALIBRATE,
+   "%s: query calibration results, cfg %x\n", __func__, cfg);
 
error = iwn_cmd(sc, IWN5000_CMD_CALIB_CONFIG, &cmd, sizeof cmd, 0);
if (error != 0)
@@ -5559,7 +5565,7 @@ iwn5000_post_alive(struct iwn_softc *sc)
 * Query other calibration results from the initialization
 * firmware.
 */
-   error = iwn5000_send_calib_query(sc);
+   error = iwn5000_send_calib_query(sc, 0);
if (error != 0) {
device_printf(sc->sc_dev,
"%s: could not query calibration, error=%d\n",
@@ -5579,6 +5585,19 @@ iwn5000_post_alive(struct iwn_softc *sc)
 * firmware to the runtime firmware.
 */
error = iwn5000_send_calib_results(sc);
+
+   /*
+* Tell the runtime firmware to do certain calibration types.
+*/
+   if (sc->calib_runtime != 0) {
+   error = iwn5000_send_calib_query(sc, sc->calib_runtime);
+   if (error != 0) {
+   device_printf(sc->sc_dev,
+   "%s: could not send query calibration, "
+   "error=%d, cfg=%x\n", __func__, error,
+   sc->calib_runtime);
+   }
+   }
 

svn commit: r216196 - head/usr.bin/stat

2010-12-05 Thread Doug Barton
Author: dougb
Date: Sun Dec  5 09:33:04 2010
New Revision: 216196
URL: http://svn.freebsd.org/changeset/base/216196

Log:
  Bring in the change from NetBSD 1.18:
  
  "If using stat (the -L flag) and it fails, fall back to lstat().  It
  may be the case that we're examining a broken symlink, and anything is
  better than nothing."
  
  The changes in 1.14 through 1.17 were not relevant to us.
  
  Obtained from:ata...@netbsd.org

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

Modified: head/usr.bin/stat/stat.c
==
--- head/usr.bin/stat/stat.cSun Dec  5 09:00:32 2010(r216195)
+++ head/usr.bin/stat/stat.cSun Dec  5 09:33:04 2010(r216196)
@@ -30,7 +30,7 @@
 #include 
 #if 0
 #ifndef lint
-__RCSID("$NetBSD: stat.c,v 1.13 2003/07/25 03:21:17 atatat Exp $");
+__RCSID("$NetBSD: stat.c,v 1.18 2004/05/28 04:48:31 atatat Exp $");
 #endif
 #endif
 
@@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -313,8 +314,17 @@ main(int argc, char *argv[])
rc = fstat(STDIN_FILENO, &st);
} else {
file = argv[0];
-   if (usestat)
-   rc = stat(file, &st);
+   if (usestat) {
+   /*
+* Try stat() and if it fails, fall back to
+* lstat() just in case we're examining a
+* broken symlink.
+*/
+   if ((rc = stat(file, &st)) == -1 &&
+   errno == ENOENT &&
+   (rc = lstat(file, &st)) == -1)
+   errno = ENOENT;
+   }
else
rc = lstat(file, &st);
}
___
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: r216197 - head/usr.bin/stat

2010-12-05 Thread Doug Barton
Author: dougb
Date: Sun Dec  5 09:35:07 2010
New Revision: 216197
URL: http://svn.freebsd.org/changeset/base/216197

Log:
  Add my own documentation for the change in our r216196, aka NetBSD's 1.18
  For -L if stat(2) fails, fall back to lstat(2).
  
  .Dd purposely not bumped because more changes are coming.

Modified:
  head/usr.bin/stat/stat.1

Modified: head/usr.bin/stat/stat.1
==
--- head/usr.bin/stat/stat.1Sun Dec  5 09:33:04 2010(r216196)
+++ head/usr.bin/stat/stat.1Sun Dec  5 09:35:07 2010(r216197)
@@ -107,6 +107,10 @@ will refer to the target of
 if file is a symbolic link, and not to
 .Ar file
 itself.
+If the link is broken or the target does not exist,
+fall back on
+.Xr lstat 2
+and report information about the link.
 .It Fl n
 Do not force a newline to appear at the end of each piece of output.
 .It Fl q
___
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: r216198 - head/sys/teken

2010-12-05 Thread Ed Schouten
Author: ed
Date: Sun Dec  5 10:15:23 2010
New Revision: 216198
URL: http://svn.freebsd.org/changeset/base/216198

Log:
  Use proper bounds checking on VPA.
  
  We must check against tp->t_cursor.tp_row, not row, to figure out
  whether we must clamp the cursor position.
  
  Submitted by: luigi
  MFC after:3 weeks

Modified:
  head/sys/teken/teken_subr.h

Modified: head/sys/teken/teken_subr.h
==
--- head/sys/teken/teken_subr.h Sun Dec  5 09:35:07 2010(r216197)
+++ head/sys/teken/teken_subr.h Sun Dec  5 10:15:23 2010(r216198)
@@ -1299,10 +1299,9 @@ teken_subr_vertical_position_absolute(te
 {
 
t->t_cursor.tp_row = t->t_originreg.ts_begin + row - 1;
-   if (row >= t->t_originreg.ts_end)
+   if (t->t_cursor.tp_row >= t->t_originreg.ts_end)
t->t_cursor.tp_row = t->t_originreg.ts_end - 1;
 
-
t->t_stateflags &= ~TS_WRAPPED;
teken_funcs_cursor(t);
 }
___
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: r216191 - head/sys/i386/i386

2010-12-05 Thread Bruce Evans

On Sat, 4 Dec 2010, Colin Percival wrote:


Log:
 Remove gratuitous i386/amd64 inconsistency in favour of the less verbose
 version of declaring a variable initialized to zero.


This is resolved backwardsly.  style(9) forbids initializing variables in
declarations (except for the bug in it which allows this).


Modified: head/sys/i386/i386/busdma_machdep.c
==
--- head/sys/i386/i386/busdma_machdep.c Sat Dec  4 23:24:35 2010
(r216190)
+++ head/sys/i386/i386/busdma_machdep.c Sat Dec  4 23:36:40 2010
(r216191)
@@ -858,7 +858,7 @@ bus_dmamap_load_uio(bus_dma_tag_t dmat,
bus_dmamap_callback2_t *callback, void *callback_arg,
int flags)
{
-   bus_addr_t lastaddr;
+   bus_addr_t lastaddr = 0;
int nsegs, error, first, i;
bus_size_t resid;
struct iovec *iov;
@@ -878,7 +878,6 @@ bus_dmamap_load_uio(bus_dma_tag_t dmat,
nsegs = 0;
error = 0;
first = 1;
-   lastaddr = (bus_addr_t) 0;


Also, here this is inconsisent with all the other initializations, since
those actually follow style(9).

Other style bugs visible in this patch:
- the declarations are totally disordered.  The initializations are at least
  in the same order as the declarations
- the cast in the old initialization of `lastaddr' was followed by a space.
  It is unclear if this cast is needed, and the new initialization doesn't
  have it.  It is not needed if bus_addr_t is a integer or pointer type,
  but bus_addr_t should be opaque.  If it is a pointer type, then the variable
  is not initialized to zero, but to a null pointer.  MD code like this can
  know what it is, but then you can't copy this code around.

Some of the other functions in this file have larger style bugs in
declarations/initializations than this.

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"


svn commit: r216199 - head/bin/sh

2010-12-05 Thread Jilles Tjoelker
Author: jilles
Date: Sun Dec  5 16:09:03 2010
New Revision: 216199
URL: http://svn.freebsd.org/changeset/base/216199

Log:
  sh: jobs -p: Do not ask the kernel for the pgid.
  
  The getpgid() call will fail if the first process in the job has already
  terminated, resulting in output of "-1".
  
  The pgid of a job is always the pid of the first process in the job and
  other code already relies on this.

Modified:
  head/bin/sh/jobs.c

Modified: head/bin/sh/jobs.c
==
--- head/bin/sh/jobs.c  Sun Dec  5 10:15:23 2010(r216198)
+++ head/bin/sh/jobs.c  Sun Dec  5 16:09:03 2010(r216199)
@@ -308,7 +308,6 @@ showjob(struct job *jp, pid_t pid, int m
struct procstat *ps;
struct job *j;
int col, curr, i, jobno, prev, procno;
-   pid_t ppid;
char c;
 
procno = (mode == SHOWJOBS_PGIDS) ? 1 : jp->nprocs;
@@ -323,9 +322,7 @@ showjob(struct job *jp, pid_t pid, int m
 #endif
for (ps = jp->ps ; ; ps++) {/* for each process */
if (mode == SHOWJOBS_PIDS || mode == SHOWJOBS_PGIDS) {
-   ppid = (mode == SHOWJOBS_PIDS) ? ps->pid :
-   getpgid(ps->pid);
-   out1fmt("%d\n", (int)ppid);
+   out1fmt("%d\n", (int)ps->pid);
goto skip;
}
if (mode != SHOWJOBS_VERBOSE && ps != jp->ps && pid == 0)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r216202 - head/usr.bin/stat

2010-12-05 Thread Doug Barton
Author: dougb
Date: Sun Dec  5 20:47:53 2010
New Revision: 216202
URL: http://svn.freebsd.org/changeset/base/216202

Log:
  Bring in the change from NetBSD 1.22:
  
  "Fix a trivial truncation case, and eliminate a corner case that might
  print a nul character."
  
  I am purposely bypassing the following versions:
  1.19  A build infrastructure change that does not apply to us
  1.20  A feature I am not interested in, but don't object if someone else
wants to pick it up
  1.21  A build infrastructure change that does not apply to us
  
  Obtained from:ata...@netbsd.org

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

Modified: head/usr.bin/stat/stat.c
==
--- head/usr.bin/stat/stat.cSun Dec  5 20:47:36 2010(r216201)
+++ head/usr.bin/stat/stat.cSun Dec  5 20:47:53 2010(r216202)
@@ -30,7 +30,7 @@
 #include 
 #if 0
 #ifndef lint
-__RCSID("$NetBSD: stat.c,v 1.18 2004/05/28 04:48:31 atatat Exp $");
+__RCSID("$NetBSD: stat.c,v 1.22 2005/04/22 03:36:48 atatat Exp $");
 #endif
 #endif
 
@@ -381,7 +381,7 @@ output(const struct stat *st, const char
 const char *statfmt, int fn, int nonl, int quiet)
 {
int flags, size, prec, ofmt, hilo, what;
-   char buf[PATH_MAX];
+   char buf[PATH_MAX + 4 + 1];
const char *subfmt;
int nl, t, i;
 
@@ -550,7 +550,7 @@ output(const struct stat *st, const char
 buf, sizeof(buf),
 flags, size, prec, ofmt, hilo, what);
 
-   for (i = 0; i < t && i < sizeof(buf); i++)
+   for (i = 0; i < t && i < sizeof(buf) - 1; i++)
addchar(stdout, buf[i], &nl);
 
continue;
___
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: r216203 - head/usr.bin/stat

2010-12-05 Thread Doug Barton
Author: dougb
Date: Sun Dec  5 21:11:45 2010
New Revision: 216203
URL: http://svn.freebsd.org/changeset/base/216203

Log:
  Bring in a new feature, adding a -f option to readlink to print the path
  of the target, similar to realpath(1). See the discussion at:
  http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=34662
  
  This brings in the following changes:
  1.24
  "PR/34662: martijnb at atlas dot ipv6 dot stack dot nl: readlink doesn't
  grok -f, and there's no alternative (+fix)
  
  Patch applied with minor tweak (%y -> %R, as it was already taken) plus
  some nits from myself. Thanks!"
  
  Obtained from:e...@netbsd.org
  
  1.25
  "Fix a segfault when doing 'stat -f %R' on the stdin file handle, instead
  fake the filename '(stdin)' like the %N format."
  
  Obtained from:mlel...@netbsd.org
  
  1.27
  "The ofmt variable is actually a bit mask (not the character that was
  in the format string) so that we can "or" it with the bits in the
  formats variable.  This fixes the missing " -> " in front of the real
  path (when you use %SR).
  
  Also, the ?: needs another space."
  
  Obtained from:ata...@netbsd.org
  
  I am purposely omitting the following changes:
  1.23  A humanize_number(3) clone that should better be implemented by
actually using humanize_number(3)
  1.26  This is the removal of license clause 3 and 4, already handled
by imp in r203971

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

Modified: head/usr.bin/stat/stat.c
==
--- head/usr.bin/stat/stat.cSun Dec  5 20:47:53 2010(r216202)
+++ head/usr.bin/stat/stat.cSun Dec  5 21:11:45 2010(r216203)
@@ -30,7 +30,7 @@
 #include 
 #if 0
 #ifndef lint
-__RCSID("$NetBSD: stat.c,v 1.22 2005/04/22 03:36:48 atatat Exp $");
+__RCSID("$NetBSD: stat.c,v 1.27 2008/05/16 17:58:33 atatat Exp $");
 #endif
 #endif
 
@@ -153,6 +153,7 @@ __FBSDID("$FreeBSD$");
 #define MIDDLE_PIECE   'M'
 #define LOW_PIECE  'L'
 
+#defineSHOW_realpath   'R'
 #define SHOW_st_dev'd'
 #define SHOW_st_ino'i'
 #define SHOW_st_mode   'p'
@@ -218,8 +219,8 @@ main(int argc, char *argv[])
 
if (strcmp(getprogname(), "readlink") == 0) {
am_readlink = 1;
-   options = "n";
-   synopsis = "[-n] [file ...]";
+   options = "fn";
+   synopsis = "[-fn] [file ...]";
statfmt = "%Y";
fmtchar = 'f';
quiet = 1;
@@ -243,6 +244,10 @@ main(int argc, char *argv[])
quiet = 1;
break;
case 'f':
+   if (am_readlink) {
+   statfmt = "%R";
+   break;
+   }
statfmt = optarg;
/* FALLTHROUGH */
case 'l':
@@ -518,6 +523,7 @@ output(const struct stat *st, const char
}
 
switch (*statfmt) {
+   fmtcase(what, SHOW_realpath);
fmtcase(what, SHOW_st_dev);
fmtcase(what, SHOW_st_ino);
fmtcase(what, SHOW_st_mode);
@@ -776,6 +782,26 @@ format1(const struct stat *st,
ofmt = FMTF_UNSIGNED;
break;
 #endif /* HAVE_STRUCT_STAT_ST_GEN */
+   case SHOW_realpath:
+   small = 0;
+   data = 0;
+   if (file == NULL) {
+   (void)strncpy(path, "(stdin)", sizeof(path));
+   sdata = path;
+   } else {
+   snprintf(path, sizeof(path), " -> ");
+   if (realpath(file, path + 4) == NULL) {
+   linkfail = 1;
+   l = 0;
+   path[0] = '\0';
+   }
+   sdata = path + (ofmt == FMTF_STRING ? 0 : 4);
+   }
+
+   formats = FMTF_STRING;
+   if (ofmt == 0)
+   ofmt = FMTF_STRING;
+   break;
case SHOW_symlink:
small = 0;
data = 0;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r216204 - head/usr.bin/stat

2010-12-05 Thread Doug Barton
Author: dougb
Date: Sun Dec  5 21:17:02 2010
New Revision: 216204
URL: http://svn.freebsd.org/changeset/base/216204

Log:
  Bring in the update from NetBSD 1.19, the documentation of readlink -f
  
  "PR/34662: martijnb at atlas dot ipv6 dot stack dot nl: readlink doesn't
  grok -f, and there's no alternative (+fix)
  
  Patch applied with minor tweak (%y -> %R, as it was already taken) plus
  some nits from myself. Thanks!"
  
  Obtained from:e...@netbsd.org

Modified:
  head/usr.bin/stat/stat.1

Modified: head/usr.bin/stat/stat.1
==
--- head/usr.bin/stat/stat.1Sun Dec  5 21:11:45 2010(r216203)
+++ head/usr.bin/stat/stat.1Sun Dec  5 21:17:02 2010(r216204)
@@ -1,4 +1,4 @@
-.\"$NetBSD: stat.1,v 1.11 2003/05/08 13:07:10 wiz Exp $
+.\"$NetBSD: stat.1,v 1.19 2006/10/07 10:41:50 elad Exp $
 .\"
 .\" Copyright (c) 2002 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -43,7 +43,7 @@
 .Op Fl t Ar timefmt
 .Op Ar
 .Nm readlink
-.Op Fl n
+.Op Fl fn
 .Op Ar
 .Sh DESCRIPTION
 The
@@ -60,9 +60,20 @@ displays information about the file desc
 When invoked as
 .Nm readlink ,
 only the target of the symbolic link is printed.
-If the given argument is not a symbolic link,
+If the given argument is not a symbolic link and the
+.Fl f
+option is not specified,
 .Nm readlink
 will print nothing and exit with an error.
+If the
+.Fl f
+option is specified, the output is canonicalized by following every symlink
+in every component of the given path recursively. 
+.Nm readlink
+will resolve both absolute and relative paths, and return the absolute pathname
+corresponding to
+.Ar file .
+In this case, the argument does not need to be a symbolic link.
 .Pp
 The information displayed is obtained by calling
 .Xr lstat 2
@@ -374,13 +385,15 @@ User defined flags for
 Inode generation number.
 .El
 .Pp
-The following four field specifiers are not drawn directly from the
+The following five field specifiers are not drawn directly from the
 data in
 .Vt "struct stat" ,
 but are:
 .Bl -tag -width indent
 .It Cm N
 The name of the file.
+.It Cm R
+The absolute pathname corresponding to the file.
 .It Cm T
 The file type, either as in
 .Nm ls Fl F
___
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: r216205 - head/usr.bin/stat

2010-12-05 Thread Doug Barton
Author: dougb
Date: Sun Dec  5 21:29:20 2010
New Revision: 216205
URL: http://svn.freebsd.org/changeset/base/216205

Log:
  Bring in the update from NetBSD 1.28:
  
  "Fix WARNS=4 issues (-Wcast-qual -Wsign-compare)"
  
  Because of code differences I had to hand-apply parts of the patch,
  so responsibility for errors goes to me.
  
  Obtained from:lu...@netbsd.org

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

Modified: head/usr.bin/stat/stat.c
==
--- head/usr.bin/stat/stat.cSun Dec  5 21:17:02 2010(r216204)
+++ head/usr.bin/stat/stat.cSun Dec  5 21:29:20 2010(r216205)
@@ -30,7 +30,7 @@
 #include 
 #if 0
 #ifndef lint
-__RCSID("$NetBSD: stat.c,v 1.27 2008/05/16 17:58:33 atatat Exp $");
+__RCSID("$NetBSD: stat.c,v 1.28 2009/04/13 23:02:36 lukem Exp $");
 #endif
 #endif
 
@@ -188,7 +188,7 @@ int format1(const struct stat *,/* stat
 char   *xfflagstostr(unsigned long);
 #endif
 
-char *timefmt;
+const char *timefmt;
 int linkfail;
 
 #define addchar(s, c, nl) \
@@ -203,7 +203,7 @@ main(int argc, char *argv[])
struct stat st;
int ch, rc, errs, am_readlink;
int lsF, fmtchar, usestat, fn, nonl, quiet;
-   char *statfmt, *options, *synopsis;
+   const char *statfmt, *options, *synopsis;
char dname[sizeof _PATH_DEV + SPECNAMELEN] = _PATH_DEV;
const char *file;
 
@@ -556,7 +556,7 @@ output(const struct stat *st, const char
 buf, sizeof(buf),
 flags, size, prec, ofmt, hilo, what);
 
-   for (i = 0; i < t && i < sizeof(buf) - 1; i++)
+   for (i = 0; i < t && i < (int)(sizeof(buf) - 1); i++)
addchar(stdout, buf[i], &nl);
 
continue;
@@ -583,7 +583,8 @@ format1(const struct stat *st,
 int hilo, int what)
 {
u_int64_t data;
-   char *sdata, lfmt[24], tmp[20];
+   char *stmp, lfmt[24], tmp[20];
+   const char *sdata;
char smode[12], sid[12], path[PATH_MAX + 4];
struct passwd *pw;
struct group *gr;
@@ -644,28 +645,29 @@ format1(const struct stat *st,
small = (sizeof(st->st_mode) == 4);
data = st->st_mode;
strmode(st->st_mode, smode);
-   sdata = smode;
-   l = strlen(sdata);
-   if (sdata[l - 1] == ' ')
-   sdata[--l] = '\0';
+   stmp = smode;
+   l = strlen(stmp);
+   if (stmp[l - 1] == ' ')
+   stmp[--l] = '\0';
if (hilo == HIGH_PIECE) {
data >>= 12;
-   sdata += 1;
-   sdata[3] = '\0';
+   stmp += 1;
+   stmp[3] = '\0';
hilo = 0;
}
else if (hilo == MIDDLE_PIECE) {
data = (data >> 9) & 07;
-   sdata += 4;
-   sdata[3] = '\0';
+   stmp += 4;
+   stmp[3] = '\0';
hilo = 0;
}
else if (hilo == LOW_PIECE) {
data &= 0777;
-   sdata += 7;
-   sdata[3] = '\0';
+   stmp += 7;
+   stmp[3] = '\0';
hilo = 0;
}
+   sdata = stmp;
formats = FMTF_DECIMAL | FMTF_OCTAL | FMTF_UNSIGNED | FMTF_HEX |
FMTF_STRING;
if (ofmt == 0)
@@ -827,24 +829,23 @@ format1(const struct stat *st,
case SHOW_filetype:
small = 0;
data = 0;
-   sdata = smode;
-   sdata[0] = '\0';
+   sdata = "";
if (hilo == 0 || hilo == LOW_PIECE) {
switch (st->st_mode & S_IFMT) {
-   case S_IFIFO:   (void)strcat(sdata, "|");   break;
-   case S_IFDIR:   (void)strcat(sdata, "/");   break;
+   case S_IFIFO:   sdata = "|";break;
+   case S_IFDIR:   sdata = "/";break;
case S_IFREG:
if (st->st_mode &
(S_IXUSR | S_IXGRP | S_IXOTH))
-   (void)strcat(sdata, "*");
+   sdata = "*";
break;
-   case S_IFLNK:   (void)strcat(sdata, "@");   break;
-   case S_IFSOCK:  (void)strcat(sdata, "=");   break;
+   case S_IFLNK:   sdata = "@";break;
+   case S_IFSOCK:  sdata = "=";break;
 #ifdef S_IFWHT
-   case S_IFWHT:   (void)strcat(sdata, "%");   break;
+   case S_IFWHT:

svn commit: r216206 - head/usr.bin/stat

2010-12-05 Thread Doug Barton
Author: dougb
Date: Sun Dec  5 21:33:05 2010
New Revision: 216206
URL: http://svn.freebsd.org/changeset/base/216206

Log:
  Fix an "unused variable" error that gets us all the way to WARNS=6

Modified:
  head/usr.bin/stat/Makefile
  head/usr.bin/stat/stat.c

Modified: head/usr.bin/stat/Makefile
==
--- head/usr.bin/stat/Makefile  Sun Dec  5 21:29:20 2010(r216205)
+++ head/usr.bin/stat/Makefile  Sun Dec  5 21:33:05 2010(r216206)
@@ -1,7 +1,6 @@
 # $FreeBSD$
 
 PROG=  stat
-WARNS?=2
 
 LINKS= ${BINDIR}/stat ${BINDIR}/readlink
 MLINKS=stat.1 readlink.1

Modified: head/usr.bin/stat/stat.c
==
--- head/usr.bin/stat/stat.cSun Dec  5 21:29:20 2010(r216205)
+++ head/usr.bin/stat/stat.cSun Dec  5 21:33:05 2010(r216206)
@@ -177,7 +177,7 @@ __FBSDID("$FreeBSD$");
 
 void   usage(const char *);
 void   output(const struct stat *, const char *,
-   const char *, int, int, int);
+   const char *, int, int);
 intformat1(const struct stat *,/* stat info */
const char *,   /* the file name */
const char *, int,  /* the format string itself */
@@ -341,7 +341,7 @@ main(int argc, char *argv[])
warn("%s: stat", file);
}
else
-   output(&st, file, statfmt, fn, nonl, quiet);
+   output(&st, file, statfmt, fn, nonl);
 
argv++;
argc--;
@@ -383,7 +383,7 @@ usage(const char *synopsis)
  */
 void
 output(const struct stat *st, const char *file,
-const char *statfmt, int fn, int nonl, int quiet)
+const char *statfmt, int fn, int nonl)
 {
int flags, size, prec, ofmt, hilo, what;
char buf[PATH_MAX + 4 + 1];
___
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: r216207 - head/usr.bin/stat

2010-12-05 Thread Doug Barton
Author: dougb
Date: Sun Dec  5 21:53:12 2010
New Revision: 216207
URL: http://svn.freebsd.org/changeset/base/216207

Log:
  Bring in the following changes from NetBSD. See the discussion at:
  http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=44128
  
  1.29
  "Don't printf time_t with %d; fixes PR 44128 from yamt. With this change it
  successfully prints mtimes after 2038."
  
  1.30
  "Improve previous with comments."
  
  Obtained from:dholl...@netbsd.org (both)

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

Modified: head/usr.bin/stat/stat.c
==
--- head/usr.bin/stat/stat.cSun Dec  5 21:33:05 2010(r216206)
+++ head/usr.bin/stat/stat.cSun Dec  5 21:53:12 2010(r216207)
@@ -30,7 +30,7 @@
 #include 
 #if 0
 #ifndef lint
-__RCSID("$NetBSD: stat.c,v 1.28 2009/04/13 23:02:36 lukem Exp $");
+__RCSID("$NetBSD: stat.c,v 1.30 2010/11/25 04:33:30 dholland Exp $");
 #endif
 #endif
 
@@ -728,7 +728,6 @@ format1(const struct stat *st,
ts = *tsp;  /* copy so we can muck with it */
small = (sizeof(ts.tv_sec) == 4);
data = ts.tv_sec;
-   small = 1;
tm = localtime(&ts.tv_sec);
(void)strftime(path, sizeof(path), timefmt, tm);
sdata = path;
@@ -951,8 +950,9 @@ format1(const struct stat *st,
(void)snprintf(tmp, sizeof(tmp), "%d", size);
(void)strcat(lfmt, tmp);
}
-   (void)strcat(lfmt, "d");
-   return (snprintf(buf, blen, lfmt, ts.tv_sec));
+   (void)strcat(lfmt, "lld");
+   return (snprintf(buf, blen, lfmt,
+   (long long)ts.tv_sec));
}
 
/*
@@ -975,7 +975,8 @@ format1(const struct stat *st,
(void)snprintf(tmp, sizeof(tmp), "%d", size);
(void)strcat(lfmt, tmp);
}
-   (void)strcat(lfmt, "d");
+   /* Seconds: time_t cast to long long. */
+   (void)strcat(lfmt, "lld");
 
/*
 * The stuff after the decimal point always needs zero
@@ -986,8 +987,10 @@ format1(const struct stat *st,
/*
 * We can "print" at most nine digits of precision.  The
 * rest we will pad on at the end.
+*
+* Nanoseconds: long.
 */
-   (void)snprintf(tmp, sizeof(tmp), "%dd", prec > 9 ? 9 : prec);
+   (void)snprintf(tmp, sizeof(tmp), "%dld", prec > 9 ? 9 : prec);
(void)strcat(lfmt, tmp);
 
/*
@@ -1001,7 +1004,7 @@ format1(const struct stat *st,
 * Use the format, and then tack on any zeroes that
 * might be required to make up the requested precision.
 */
-   l = snprintf(buf, blen, lfmt, ts.tv_sec, ts.tv_nsec);
+   l = snprintf(buf, blen, lfmt, (long long)ts.tv_sec, ts.tv_nsec);
for (; prec > 9 && l < (int)blen; prec--, l++)
(void)strcat(buf, "0");
return (l);
___
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: r216208 - head/bin/sh

2010-12-05 Thread Jilles Tjoelker
Author: jilles
Date: Sun Dec  5 21:53:29 2010
New Revision: 216208
URL: http://svn.freebsd.org/changeset/base/216208

Log:
  sh: Avoid marking a job as done before it is fully created.
  
  In r208489, I added code to reap zombies when forking new processes, to
  limit the amount of zombies. However, this can lead to marking a job as done
  or stopped if it consists of multiple processes and the first process ends
  very quickly. Fix this by only checking for zombies before forking the first
  process of a job and not marking any jobs without processes as done or
  stopped.

Modified:
  head/bin/sh/jobs.c

Modified: head/bin/sh/jobs.c
==
--- head/bin/sh/jobs.c  Sun Dec  5 21:53:12 2010(r216207)
+++ head/bin/sh/jobs.c  Sun Dec  5 21:53:29 2010(r216208)
@@ -766,7 +766,7 @@ forkshell(struct job *jp, union node *n,
TRACE(("forkshell(%%%td, %p, %d) called\n", jp - jobtab, (void *)n,
mode));
INTOFF;
-   if (mode == FORK_BG)
+   if (mode == FORK_BG && (jp == NULL || jp->nprocs == 0))
checkzombies();
flushall();
pid = fork();
@@ -980,7 +980,7 @@ dowait(int block, struct job *job)
INTOFF;
thisjob = NULL;
for (jp = jobtab ; jp < jobtab + njobs ; jp++) {
-   if (jp->used) {
+   if (jp->used && jp->nprocs > 0) {
done = 1;
stopped = 1;
for (sp = jp->ps ; sp < jp->ps + jp->nprocs ; sp++) {
___
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: r216210 - head/lib/msun/src

2010-12-05 Thread David Schultz
Author: das
Date: Sun Dec  5 22:11:03 2010
New Revision: 216210
URL: http://svn.freebsd.org/changeset/base/216210

Log:
  Add a "kernel" log function, based on e_log.c, which is useful for
  implementing accurate logarithms in different bases.  This is based
  on an approach bde coded up years ago.
  
  This function should always be inlined; it will be used in only a few
  places, and rudimentary tests show a 40% performance improvement in
  implementations of log2() and log10() on amd64.
  
  The kernel takes a reduced argument x and returns the same polynomial
  approximation as e_log.c, but omitting the low-order term. The low-order
  term is much larger than the rest of the approximation, so the caller of
  the kernel function can scale it to the appropriate base in extra precision
  and obtain a much more accurate answer than by using log(x)/log(b).

Added:
  head/lib/msun/src/k_log.h
 - copied, changed from r216174, head/lib/msun/src/e_log.c
  head/lib/msun/src/k_logf.h
 - copied, changed from r216174, head/lib/msun/src/e_logf.c

Copied and modified: head/lib/msun/src/k_log.h (from r216174, 
head/lib/msun/src/e_log.c)
==
--- head/lib/msun/src/e_log.c   Sat Dec  4 02:42:52 2010(r216174, copy 
source)
+++ head/lib/msun/src/k_log.h   Sun Dec  5 22:11:03 2010(r216210)
@@ -14,8 +14,13 @@
 #include 
 __FBSDID("$FreeBSD$");
 
-/* __ieee754_log(x)
- * Return the logrithm of x
+/* __kernel_log(x)
+ * Return log(x) - (x-1) for x in ~[sqrt(2)/2, sqrt(2)].
+ *
+ * The following describes the overall strategy for computing
+ * logarithms in base e.  The argument reduction and adding the final
+ * term of the polynomial are done by the caller for increased accuracy
+ * when different bases are used.
  *
  * Method :  
  *   1. Argument Reduction: find k and f such that 
@@ -65,13 +70,7 @@ __FBSDID("$FreeBSD$");
  * to produce the hexadecimal values shown.
  */
 
-#include "math.h"
-#include "math_private.h"
-
 static const double
-ln2_hi  =  6.93147180369123816490e-01, /* 3fe62e42 fee0 */
-ln2_lo  =  1.90821492927058770002e-10, /* 3dea39ef 35793c76 */
-two54   =  1.8014398509481984e+16,  /* 4350  */
 Lg1 = 6.735130e-01,  /* 3FE5 5593 */
 Lg2 = 3.9940941908e-01,  /* 3FD9 9997FA04 */
 Lg3 = 2.857142874366239149e-01,  /* 3FD24924 94229359 */
@@ -80,48 +79,27 @@ Lg5 = 1.818357216161805012e-01,  /* 3FC7
 Lg6 = 1.531383769920937332e-01,  /* 3FC39A09 D078C69F */
 Lg7 = 1.479819860511658591e-01;  /* 3FC2F112 DF3E5244 */
 
-static const double zero   =  0.0;
-
-double
-__ieee754_log(double x)
+/*
+ * We always inline __kernel_log(), since doing so produces a
+ * substantial performance improvement (~40% on amd64).
+ */
+static inline double
+__kernel_log(double x)
 {
-   double hfsq,f,s,z,R,w,t1,t2,dk;
-   int32_t k,hx,i,j;
+   double hfsq,f,s,z,R,w,t1,t2;
+   int32_t hx,i,j;
u_int32_t lx;
 
EXTRACT_WORDS(hx,lx,x);
 
-   k=0;
-   if (hx < 0x0010) {  /* x < 2**-1022  */
-   if (((hx&0x7fff)|lx)==0) 
-   return -two54/zero; /* log(+-0)=-inf */
-   if (hx<0) return (x-x)/zero;/* log(-#) = NaN */
-   k -= 54; x *= two54; /* subnormal number, scale up x */
-   GET_HIGH_WORD(hx,x);
-   } 
-   if (hx >= 0x7ff0) return x+x;
-   k += (hx>>20)-1023;
-   hx &= 0x000f;
-   i = (hx+0x95f64)&0x10;
-   SET_HIGH_WORD(x,hx|(i^0x3ff0)); /* normalize x or x/2 */
-   k += (i>>20);
f = x-1.0;
if((0x000f&(2+hx))<3) { /* -2**-20 <= f < 2**-20 */
-   if(f==zero) {
-   if(k==0) {
-   return zero;
-   } else {
-   dk=(double)k;
-   return dk*ln2_hi+dk*ln2_lo;
-   }
-   }
-   R = f*f*(0.5-0.3*f);
-   if(k==0) return f-R; else {dk=(double)k;
-return dk*ln2_hi-((R-dk*ln2_lo)-f);}
+   if(f==0.0) return 0.0;
+   return f*f*(0.3*f-0.5);
}
s = f/(2.0+f); 
-   dk = (double)k;
z = s*s;
+   hx &= 0x000f;
i = hx-0x6147a;
w = z*z;
j = 0x6b851-hx;
@@ -129,12 +107,10 @@ __ieee754_log(double x)
t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7))); 
i |= j;
R = t2+t1;
-   if(i>0) {
+   if (i>0) {
hfsq=0.5*f*f;
-   if(k==0) return f-(hfsq-s*(hfsq+R)); else
-return dk*ln2_hi-((hfsq-(s*(hfsq+R)+dk*ln2_lo))-f);
+   return s*(hfsq+R) - hfsq;
} else {
-   if(k==0) return f-s*(f-R); else
-return dk*ln2_hi-((s*(f-R)-dk*ln2_lo)-f);
+   return s*(R-f);
}
 }

Copied and modified: head/lib/msun/src/k_logf.h (from r216174, 
head/lib/msun/src/e_logf.c)
=

svn commit: r216211 - in head/lib/msun: . man src

2010-12-05 Thread David Schultz
Author: das
Date: Sun Dec  5 22:11:22 2010
New Revision: 216211
URL: http://svn.freebsd.org/changeset/base/216211

Log:
  Add log2() and log2f().

Added:
  head/lib/msun/src/e_log2.c
 - copied, changed from r216174, head/lib/msun/src/e_log10.c
  head/lib/msun/src/e_log2f.c
 - copied, changed from r216174, head/lib/msun/src/e_log10f.c
Modified:
  head/lib/msun/Makefile
  head/lib/msun/Symbol.map
  head/lib/msun/man/log.3
  head/lib/msun/man/math.3
  head/lib/msun/src/math.h
  head/lib/msun/src/math_private.h

Modified: head/lib/msun/Makefile
==
--- head/lib/msun/Makefile  Sun Dec  5 22:11:03 2010(r216210)
+++ head/lib/msun/Makefile  Sun Dec  5 22:11:22 2010(r216211)
@@ -45,7 +45,8 @@ COMMON_SRCS= b_exp.c b_log.c b_tgamma.c 
e_expf.c e_fmod.c e_fmodf.c e_gamma.c e_gamma_r.c e_gammaf.c \
e_gammaf_r.c e_hypot.c e_hypotf.c e_j0.c e_j0f.c e_j1.c e_j1f.c \
e_jn.c e_jnf.c e_lgamma.c e_lgamma_r.c e_lgammaf.c e_lgammaf_r.c \
-   e_log.c e_log10.c e_log10f.c e_logf.c e_pow.c e_powf.c e_rem_pio2.c \
+   e_log.c e_log10.c e_log10f.c e_log2.c e_log2f.c e_logf.c \
+   e_pow.c e_powf.c e_rem_pio2.c \
e_rem_pio2f.c e_remainder.c e_remainderf.c e_scalb.c e_scalbf.c \
e_sinh.c e_sinhf.c e_sqrt.c e_sqrtf.c fenv.c \
k_cos.c k_cosf.c k_rem_pio2.c k_sin.c k_sinf.c \
@@ -175,7 +176,7 @@ MLINKS+=j0.3 j1.3 j0.3 jn.3 j0.3 y0.3 j0
 MLINKS+=j0.3 j0f.3 j0.3 j1f.3 j0.3 jnf.3 j0.3 y0f.3 j0.3 ynf.3
 MLINKS+=lgamma.3 gamma.3 lgamma.3 gammaf.3 lgamma.3 lgammaf.3 \
lgamma.3 tgamma.3 lgamma.3 tgammaf.3
-MLINKS+=log.3 log10.3 log.3 log10f.3 log.3 log1p.3 log.3 log1pf.3 log.3 logf.3
+MLINKS+=log.3 log10.3 log.3 log10f.3 log.3 log1p.3 log.3 log1pf.3 log.3 logf.3 
log.3 log2.3 log.3 log2f.3
 MLINKS+=lrint.3 llrint.3 lrint.3 llrintf.3 lrint.3 llrintl.3 \
lrint.3 lrintf.3 lrint.3 lrintl.3
 MLINKS+=lround.3 llround.3 lround.3 llroundf.3 lround.3 llroundl.3 \

Modified: head/lib/msun/Symbol.map
==
--- head/lib/msun/Symbol.mapSun Dec  5 22:11:03 2010(r216210)
+++ head/lib/msun/Symbol.mapSun Dec  5 22:11:22 2010(r216211)
@@ -222,4 +222,6 @@ FBSD_1.1 {
 /* First added in 9.0-CURRENT */
 FBSD_1.2 {
__isnanf;
+   log2;
+   log2f;
 };

Modified: head/lib/msun/man/log.3
==
--- head/lib/msun/man/log.3 Sun Dec  5 22:11:03 2010(r216210)
+++ head/lib/msun/man/log.3 Sun Dec  5 22:11:22 2010(r216211)
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2008 David Schultz 
+.\" Copyright (c) 2008-2010 David Schultz 
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 17, 2008
+.Dd December 5, 2010
 .Dt LOG 3
 .Os
 .Sh NAME
@@ -33,6 +33,8 @@
 .Nm logl ,
 .Nm log10 ,
 .Nm log10f ,
+.Nm log2 ,
+.Nm log2f ,
 .Nm log1p ,
 .Nm log1pf
 .Nd logarithm functions
@@ -49,6 +51,10 @@
 .Ft float
 .Fn log10f "float x"
 .Ft double
+.Fn log2 "double x"
+.Ft float
+.Fn log2f "float x"
+.Ft double
 .Fn log1p "double x"
 .Ft float
 .Fn log1pf "float x"
@@ -65,6 +71,12 @@ The
 and
 .Fn log10f
 functions compute the logarithm base 10 of
+.Fa x ,
+while
+.Fn log2
+and
+.Fn log2f
+compute the logarithm base 2 of
 .Fa x .
 .Pp
 The
@@ -97,6 +109,8 @@ The
 .Fn logf ,
 .Fn log10 ,
 .Fn log10f ,
+.Fn log2 ,
+.Fn log2f ,
 .Fn log1p ,
 and
 .Fn log1pf

Modified: head/lib/msun/man/math.3
==
--- head/lib/msun/man/math.3Sun Dec  5 22:11:03 2010(r216210)
+++ head/lib/msun/man/math.3Sun Dec  5 22:11:22 2010(r216211)
@@ -28,7 +28,7 @@
 .\"from: @(#)math.36.10 (Berkeley) 5/6/91
 .\" $FreeBSD$
 .\"
-.Dd December 16, 2007
+.Dd December 5, 2010
 .Dt MATH 3
 .Os
 .Sh NAME
@@ -182,7 +182,7 @@ lgamma  log gamma function
 lognatural logarithm
 log10  logarithm to base 10
 log1p  log(1+x)
-.\" log2   base 2 logarithm
+log2   base 2 logarithm
 powexponential x**y
 sintrigonometric function
 sinh   hyperbolic function
@@ -194,7 +194,7 @@ y1  Bessel function of the second kind of
 yn Bessel function of the second kind of the order n
 .El
 .Pp
-Unlike the algebraic functions listed earlier, the routines
+The routines
 in this section may not produce a result that is correctly rounded,
 so reproducible results cannot be guaranteed across platforms.
 For most of these functions, however, incorrect rounding occurs
@@ -221,18 +221,20 @@ and
 values, were written for or imported into subsequent versions of FreeBSD.
 .Sh BUGS
 The
-.Fn log2
-function is missing, and many functions are not available in their
+.Fn cbrt
+function and many of the transcendental functions
+are not available in their
 .Vt "long

svn commit: r216209 - head/usr.bin/stat

2010-12-05 Thread Doug Barton
Author: dougb
Date: Sun Dec  5 22:01:01 2010
New Revision: 216209
URL: http://svn.freebsd.org/changeset/base/216209

Log:
  Bring in the change from NetBSD 1.12:
  
  "document default format."
  
  Obtained from:y...@netbsd.org

Modified:
  head/usr.bin/stat/stat.1

Modified: head/usr.bin/stat/stat.1
==
--- head/usr.bin/stat/stat.1Sun Dec  5 21:53:29 2010(r216208)
+++ head/usr.bin/stat/stat.1Sun Dec  5 22:01:01 2010(r216209)
@@ -438,6 +438,13 @@ which default to
 .Sh EXIT STATUS
 .Ex -std stat readlink
 .Sh EXAMPLES
+If no options are specified, default format is
+"%d %i %Sp %l %Su %Sg %r %z \\"%Sa\\" \\"%Sm\\" \\"%Sc\\" \\"%SB\\" %k %b %#Xf 
%N".
+.Bd -literal -offset indent
+\*[Gt] stat /tmp/bar
+0 78852 -rw-r--r-- 1 root wheel 0 0 "Jul  8 10:26:03 2004" "Jul  8 10:26:03 
2004" "Jul  8 10:28:13 2004" "Jan  1 09:00:00 1970" 16384 0 0 /tmp/bar
+.Ed
+.Pp
 Given a symbolic link
 .Pa foo
 that points from
___
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: r216212 - head/sys/sys

2010-12-05 Thread David Schultz
Author: das
Date: Sun Dec  5 22:12:07 2010
New Revision: 216212
URL: http://svn.freebsd.org/changeset/base/216212

Log:
  Bump __FreeBSD_version for the addition of log2().  This is mainly for the
  benefit of ports such as opencity and inkscape that have workarounds for
  the lack of a log2() in the base system.

Modified:
  head/sys/sys/param.h

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hSun Dec  5 22:11:22 2010(r216211)
+++ head/sys/sys/param.hSun Dec  5 22:12:07 2010(r216212)
@@ -58,7 +58,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 900026   /* Master, propagated to newvers */
+#define __FreeBSD_version 900027   /* Master, propagated to newvers */
 
 #ifdef _KERNEL
 #defineP_OSREL_SIGSEGV 74
___
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: r216213 - head/usr.bin/stat

2010-12-05 Thread Doug Barton
Author: dougb
Date: Sun Dec  5 22:16:51 2010
New Revision: 216213
URL: http://svn.freebsd.org/changeset/base/216213

Log:
  Bring in the changes from NetBSD 1.13 that we did not already have, with
  some differences.
  
  "Sort options. Use more mdoc macros. Some nit fixes. Bump date."
  
  Obtained from:w...@netbsd.org

Modified:
  head/usr.bin/stat/stat.1

Modified: head/usr.bin/stat/stat.1
==
--- head/usr.bin/stat/stat.1Sun Dec  5 22:12:07 2010(r216212)
+++ head/usr.bin/stat/stat.1Sun Dec  5 22:16:51 2010(r216213)
@@ -50,7 +50,7 @@ The
 .Nm
 utility displays information about the file pointed to by
 .Ar file .
-Read, write or execute permissions of the named file are not required, but
+Read, write, or execute permissions of the named file are not required, but
 all directories listed in the path name leading to the file must be
 searchable.
 If no argument is given,
@@ -122,6 +122,10 @@ If the link is broken or the target does
 fall back on
 .Xr lstat 2
 and report information about the link.
+.It Fl l
+Display output in
+.Ic ls Fl lT
+format.
 .It Fl n
 Do not force a newline to appear at the end of each piece of output.
 .It Fl q
@@ -151,7 +155,8 @@ display the raw, numerical value (for ex
 epoch, etc.).
 .It Fl s
 Display information in
-.Dq "shell output" ,
+.Dq shell output
+format,
 suitable for initializing variables.
 .It Fl x
 Display information in a more verbose way as known from some
@@ -438,7 +443,7 @@ which default to
 .Sh EXIT STATUS
 .Ex -std stat readlink
 .Sh EXAMPLES
-If no options are specified, default format is
+If no options are specified, the default format is
 "%d %i %Sp %l %Su %Sg %r %z \\"%Sa\\" \\"%Sm\\" \\"%Sc\\" \\"%SB\\" %k %b %#Xf 
%N".
 .Bd -literal -offset indent
 \*[Gt] stat /tmp/bar
@@ -446,7 +451,7 @@ If no options are specified, default for
 .Ed
 .Pp
 Given a symbolic link
-.Pa foo
+.Dq foo
 that points from
 .Pa /tmp/foo
 to
___
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: r216214 - head/tools/regression/lib/msun

2010-12-05 Thread David Schultz
Author: das
Date: Sun Dec  5 22:18:35 2010
New Revision: 216214
URL: http://svn.freebsd.org/changeset/base/216214

Log:
  Add regression tests for logarithmic functions in the math library.

Added:
  head/tools/regression/lib/msun/test-logarithm.c
 - copied, changed from r215587, 
head/tools/regression/lib/msun/test-exponential.c
  head/tools/regression/lib/msun/test-logarithm.t
 - copied unchanged from r215587, 
head/tools/regression/lib/msun/test-exponential.t
Modified:
  head/tools/regression/lib/msun/Makefile

Modified: head/tools/regression/lib/msun/Makefile
==
--- head/tools/regression/lib/msun/Makefile Sun Dec  5 22:16:51 2010
(r216213)
+++ head/tools/regression/lib/msun/Makefile Sun Dec  5 22:18:35 2010
(r216214)
@@ -1,7 +1,7 @@
 # $FreeBSD$
 
 TESTS= test-conj test-csqrt test-exponential test-fenv test-fma \
-   test-fmaxmin test-ilogb test-invtrig test-lrint \
+   test-fmaxmin test-ilogb test-invtrig test-logarithm test-lrint \
test-lround test-nan test-nearbyint test-next test-rem test-trig
 CFLAGS+= -O0 -lm
 

Copied and modified: head/tools/regression/lib/msun/test-logarithm.c (from 
r215587, head/tools/regression/lib/msun/test-exponential.c)
==
--- head/tools/regression/lib/msun/test-exponential.c   Sat Nov 20 20:04:29 
2010(r215587, copy source)
+++ head/tools/regression/lib/msun/test-logarithm.c Sun Dec  5 22:18:35 
2010(r216214)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2008 David Schultz 
+ * Copyright (c) 2008-2010 David Schultz 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -25,7 +25,7 @@
  */
 
 /*
- * Tests for corner cases in exp*().
+ * Tests for corner cases in log*().
  */
 
 #include 
@@ -66,19 +66,20 @@ __FBSDID("$FreeBSD$");
assert(((func), fetestexcept(exceptmask) == (excepts)));\
 } while (0)
 
-/* Test all the functions that compute b^x. */
+/* Test all the functions that compute log(x). */
 #definetestall0(x, result, exceptmask, excepts)do {
\
-   test(exp, x, result, exceptmask, excepts);  \
-   test(expf, x, result, exceptmask, excepts); \
-   test(exp2, x, result, exceptmask, excepts); \
-   test(exp2f, x, result, exceptmask, excepts);\
-   test(exp2l, x, result, exceptmask, excepts);\
+   test(log, x, result, exceptmask, excepts);  \
+   test(logf, x, result, exceptmask, excepts); \
+   test(log2, x, result, exceptmask, excepts); \
+   test(log2f, x, result, exceptmask, excepts);\
+   test(log10, x, result, exceptmask, excepts);\
+   test(log10f, x, result, exceptmask, excepts);   \
 } while (0)
 
-/* Test all the functions that compute b^x - 1. */
+/* Test all the functions that compute log(1+x). */
 #definetestall1(x, result, exceptmask, excepts)do {
\
-   test(expm1, x, result, exceptmask, excepts);\
-   test(expm1f, x, result, exceptmask, excepts);   \
+   test(log1p, x, result, exceptmask, excepts);\
+   test(log1pf, x, result, exceptmask, excepts);   \
 } while (0)
 
 /*
@@ -96,54 +97,47 @@ void
 run_generic_tests(void)
 {
 
-   /* exp(0) == 1, no exceptions raised */
-   testall0(0.0, 1.0, ALL_STD_EXCEPT, 0);
+   /* exp(1) == 0, no exceptions raised */
+   testall0(1.0, 0.0, ALL_STD_EXCEPT, 0);
testall1(0.0, 0.0, ALL_STD_EXCEPT, 0);
-   testall0(-0.0, 1.0, ALL_STD_EXCEPT, 0);
testall1(-0.0, -0.0, ALL_STD_EXCEPT, 0);
 
-   /* exp(NaN) == NaN, no exceptions raised */
+   /* log(NaN) == NaN, no exceptions raised */
testall0(NAN, NAN, ALL_STD_EXCEPT, 0);
testall1(NAN, NAN, ALL_STD_EXCEPT, 0);
 
-   /* exp(Inf) == Inf, no exceptions raised */
+   /* log(Inf) == Inf, no exceptions raised */
testall0(INFINITY, INFINITY, ALL_STD_EXCEPT, 0);
testall1(INFINITY, INFINITY, ALL_STD_EXCEPT, 0);
 
-   /* exp(-Inf) == 0, no exceptions raised */
-   testall0(-INFINITY, 0.0, ALL_STD_EXCEPT, 0);
-   testall1(-INFINITY, -1.0, ALL_STD_EXCEPT, 0);
-
-   /* exp(big) == Inf, overflow exception */
-   testall0(5.0, INFINITY, ALL_STD_EXCEPT & ~FE_INEXACT, FE_OVERFLOW);
-   testall1(5.0, INFINITY, ALL_STD_EXCEPT & ~FE_INEXACT, FE_OVERFLOW);
-
-   /* exp(small) == 0, underflow and inexact exceptions */
-   testall0(-5.0, 0.0, ALL_STD_EXCEPT, FE_UNDERFLOW | FE_INEXACT);
-   testall1(-5.0, -1.0, ALL_STD_EXCEPT, FE_INEXACT);
+   /* log(x) == NaN for x < 0, invalid exception r

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

2010-12-05 Thread Ben Kaduk
On Sun, Dec 5, 2010 at 5:12 PM, David Schultz  wrote:
> Author: das
> Date: Sun Dec  5 22:12:07 2010
> New Revision: 216212
> URL: http://svn.freebsd.org/changeset/base/216212
>
> Log:
>  Bump __FreeBSD_version for the addition of log2().  This is mainly for the
>  benefit of ports such as opencity and inkscape that have workarounds for
>  the lack of a log2() in the base system.


Awesome; thanks!

-Ben Kaduk
___
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: r216215 - head/usr.bin/stat

2010-12-05 Thread Doug Barton
Author: dougb
Date: Sun Dec  5 22:20:08 2010
New Revision: 216215
URL: http://svn.freebsd.org/changeset/base/216215

Log:
  Bring in the changes from NetBSD 1.16 that we did not already have.
  
  "Some fixes from j...@openbsd."
  
  Obtained from:w...@netbsd.org

Modified:
  head/usr.bin/stat/stat.1

Modified: head/usr.bin/stat/stat.1
==
--- head/usr.bin/stat/stat.1Sun Dec  5 22:18:35 2010(r216214)
+++ head/usr.bin/stat/stat.1Sun Dec  5 22:20:08 2010(r216215)
@@ -51,7 +51,7 @@ The
 utility displays information about the file pointed to by
 .Ar file .
 Read, write, or execute permissions of the named file are not required, but
-all directories listed in the path name leading to the file must be
+all directories listed in the pathname leading to the file must be
 searchable.
 If no argument is given,
 .Nm
@@ -372,7 +372,7 @@ Device number for character and block de
 .It Cm a , m , c , B
 The time
 .Ar file
-was last accessed or modified, of when the inode was last changed, or
+was last accessed or modified, or when the inode was last changed, or
 the birth time of the inode.
 .It Cm z
 The size of
___
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: r216216 - head/usr.bin/stat

2010-12-05 Thread Doug Barton
Author: dougb
Date: Sun Dec  5 22:24:34 2010
New Revision: 216216
URL: http://svn.freebsd.org/changeset/base/216216

Log:
  Bring in the change from NetBSD 1.20:
  
  "Make sentence easier to parse. From js...@openbsd via j...@openbsd."
  
  Obtained from:w...@netbsd.org

Modified:
  head/usr.bin/stat/stat.1

Modified: head/usr.bin/stat/stat.1
==
--- head/usr.bin/stat/stat.1Sun Dec  5 22:20:08 2010(r216215)
+++ head/usr.bin/stat/stat.1Sun Dec  5 22:24:34 2010(r216216)
@@ -428,12 +428,12 @@ as an output form, with the
 exception of
 .Cm p
 which defaults to
-.Cm O ,
+.Cm O ;
 .Cm a , m ,
 and
 .Cm c
 which default to
-.Cm D ,
+.Cm D ;
 and
 .Cm Y , T ,
 and
___
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: r216217 - head/bin/sh

2010-12-05 Thread Jilles Tjoelker
Author: jilles
Date: Sun Dec  5 22:37:01 2010
New Revision: 216217
URL: http://svn.freebsd.org/changeset/base/216217

Log:
  sh: Improve jobs output of pipelines.
  
  If describing the status of a pipeline, write all elements of the pipeline
  and show the status of the last process (which would also end up in $?).
  Only write one report per job, not one for every process that exits.
  
  To keep some earlier behaviour, if any process started by the shell in a
  foreground job terminates because of a signal, write a message about the
  signal (at most one message per job, however).
  
  Also, do not write messages about signals in the wait builtin in
  non-interactive shells. Only true foreground jobs now write such messages
  (for example, "Terminated").

Modified:
  head/bin/sh/jobs.c

Modified: head/bin/sh/jobs.c
==
--- head/bin/sh/jobs.c  Sun Dec  5 22:24:34 2010(r216216)
+++ head/bin/sh/jobs.c  Sun Dec  5 22:37:01 2010(r216217)
@@ -100,7 +100,8 @@ static void setcurjob(struct job *);
 static void deljob(struct job *);
 static struct job *getcurjob(struct job *);
 #endif
-static void showjob(struct job *, pid_t, int);
+static void printjobcmd(struct job *);
+static void showjob(struct job *, int);
 
 
 /*
@@ -205,8 +206,7 @@ fgcmd(int argc __unused, char **argv)
jp = getjob(argv[1]);
if (jp->jobctl == 0)
error("job not created under job control");
-   out1str(jp->ps[0].cmd);
-   out1c('\n');
+   printjobcmd(jp);
flushout(&output);
pgrp = jp->ps[0].pid;
tcsetpgrp(ttyfd, pgrp);
@@ -235,8 +235,7 @@ bgcmd(int argc, char **argv)
jp->foreground = 0;
fmtstr(s, 64, "[%td] ", jp - jobtab + 1);
out1str(s);
-   out1str(jp->ps[0].cmd);
-   out1c('\n');
+   printjobcmd(jp);
} while (--argc > 1);
return 0;
 }
@@ -296,15 +295,30 @@ jobscmd(int argc, char *argv[])
showjobs(0, mode);
else
while ((id = *argv++) != NULL)
-   showjob(getjob(id), 0, mode);
+   showjob(getjob(id), mode);
 
return (0);
 }
 
 static void
-showjob(struct job *jp, pid_t pid, int mode)
+printjobcmd(struct job *jp)
+{
+   struct procstat *ps;
+   int i;
+
+   for (ps = jp->ps, i = jp->nprocs ; --i >= 0 ; ps++) {
+   out1str(ps->cmd);
+   if (i > 0)
+   out1str(" | ");
+   }
+   out1c('\n');
+}
+
+static void
+showjob(struct job *jp, int mode)
 {
char s[64];
+   char statestr[64];
struct procstat *ps;
struct job *j;
int col, curr, i, jobno, prev, procno;
@@ -320,14 +334,44 @@ showjob(struct job *jp, pid_t pid, int m
prev = j - jobtab + 1;
}
 #endif
+   ps = jp->ps + jp->nprocs - 1;
+   if (jp->state == 0) {
+   strcpy(statestr, "Running");
+#if JOBS
+   } else if (jp->state == JOBSTOPPED) {
+   while (!WIFSTOPPED(ps->status) && ps > jp->ps)
+   ps--;
+   if (WIFSTOPPED(ps->status))
+   i = WSTOPSIG(ps->status);
+   else
+   i = -1;
+   if (i > 0 && i < sys_nsig && sys_siglist[i])
+   strcpy(statestr, sys_siglist[i]);
+   else
+   strcpy(statestr, "Suspended");
+#endif
+   } else if (WIFEXITED(ps->status)) {
+   if (WEXITSTATUS(ps->status) == 0)
+   strcpy(statestr, "Done");
+   else
+   fmtstr(statestr, 64, "Done (%d)",
+   WEXITSTATUS(ps->status));
+   } else {
+   i = WTERMSIG(ps->status);
+   if (i > 0 && i < sys_nsig && sys_siglist[i])
+   strcpy(statestr, sys_siglist[i]);
+   else
+   fmtstr(statestr, 64, "Signal %d", i);
+   if (WCOREDUMP(ps->status))
+   strcat(statestr, " (core dumped)");
+   }
+
for (ps = jp->ps ; ; ps++) {/* for each process */
if (mode == SHOWJOBS_PIDS || mode == SHOWJOBS_PGIDS) {
out1fmt("%d\n", (int)ps->pid);
goto skip;
}
-   if (mode != SHOWJOBS_VERBOSE && ps != jp->ps && pid == 0)
-   goto skip;
-   if (pid != 0 && pid != ps->pid)
+   if (mode != SHOWJOBS_VERBOSE && ps != jp->ps)
goto skip;
if (jobno == curr && ps == jp->ps)
c = '+';
@@ -346,39 +390,19 @@ showjob(struct job *jp, pid_t pid, int m
out1str(s);
col += strlen(s);
}
-   s[0] = '\0';
-   if (ps != jp->ps)

svn commit: r216218 - head/usr.bin/stat

2010-12-05 Thread Doug Barton
Author: dougb
Date: Sun Dec  5 22:41:58 2010
New Revision: 216218
URL: http://svn.freebsd.org/changeset/base/216218

Log:
  Bring in the following changes from NetBSD:
  
  1.21
  "Document the flags displayed by the default format, and mention their short
  names. From es...@openbsd via j...@openbsd."
  
  1.24
  "Fix three variable names.
  From Todd T. Fries via Jason McIntyre."
  
  Obtained from:w...@netbsd.org (previous 2)
  
  1.25
  "Be consistent: document the birthtime field of struct stat for
  the "B" field specifier."
  
  Obtained from:r...@netbsd.org
  
  1.26
  "Drop trailing space."
  
  Obtained from:w...@netbsd.org
  
  1.27
  "Since we have st_birthtime in struct stat, it is in default display."
  
  Obtained from:en...@netbsd.org
  
  Purposely skipping the following revisions:
  1.22  NetBSD-specific change
  1.23  Removal of license clauses 3 and 4, already handled by imp
in our r203971

Modified:
  head/usr.bin/stat/stat.1

Modified: head/usr.bin/stat/stat.1
==
--- head/usr.bin/stat/stat.1Sun Dec  5 22:37:01 2010(r216217)
+++ head/usr.bin/stat/stat.1Sun Dec  5 22:41:58 2010(r216218)
@@ -1,4 +1,4 @@
-.\"$NetBSD: stat.1,v 1.19 2006/10/07 10:41:50 elad Exp $
+.\"$NetBSD: stat.1,v 1.27 2010/03/11 21:37:01 enami Exp $
 .\"
 .\" Copyright (c) 2002 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -68,7 +68,7 @@ will print nothing and exit with an erro
 If the
 .Fl f
 option is specified, the output is canonicalized by following every symlink
-in every component of the given path recursively. 
+in every component of the given path recursively.
 .Nm readlink
 will resolve both absolute and relative paths, and return the absolute pathname
 corresponding to
@@ -78,6 +78,24 @@ In this case, the argument does not need
 The information displayed is obtained by calling
 .Xr lstat 2
 with the given argument and evaluating the returned structure.
+The default format displays the
+.Fa st_dev ,
+.Fa st_ino ,
+.Fa st_mode ,
+.Fa st_nlink ,
+.Fa st_uid ,
+.Fa st_gid ,
+.Fa st_rdev ,
+.Fa st_size ,
+.Fa st_atime ,
+.Fa st_mtime ,
+.Fa st_ctime ,
+.Fa st_birthtime ,
+.Fa st_blksize ,
+.Fa st_blocks ,
+and
+.Fa st_flags
+fields, in that order.
 .Pp
 The options are as follows:
 .Bl -tag -width indent
@@ -354,40 +372,51 @@ A required field specifier, being one of
 .It Cm d
 Device upon which
 .Ar file
-resides.
+resides
+.Pq Fa st_dev .
 .It Cm i
 .Ar file Ns 's
-inode number.
+inode number
+.Pq Fa st_ino .
 .It Cm p
-File type and permissions.
+File type and permissions
+.Pq Fa st_mode .
 .It Cm l
 Number of hard links to
-.Ar file .
+.Ar file
+.Pq Fa st_nlink .
 .It Cm u , g
 User ID and group ID of
 .Ar file Ns 's
-owner.
+owner
+.Pq Fa st_uid , st_gid .
 .It Cm r
-Device number for character and block device special files.
+Device number for character and block device special files
+.Pq Fa st_rdev .
 .It Cm a , m , c , B
 The time
 .Ar file
 was last accessed or modified, or when the inode was last changed, or
-the birth time of the inode.
+the birth time of the inode
+.Pq Fa st_atime , st_mtime , st_ctime , st_birthtime .
 .It Cm z
 The size of
 .Ar file
-in bytes.
+in bytes
+.Pq Fa st_size .
 .It Cm b
 Number of blocks allocated for
-.Ar file .
+.Ar file
+.Pq Fa st_blocks .
 .It Cm k
-Optimal file system I/O operation block size.
+Optimal file system I/O operation block size
+.Pq Fa st_blksize .
 .It Cm f
 User defined flags for
 .Ar file .
 .It Cm v
-Inode generation number.
+Inode generation number
+.Pq Fa st_gen .
 .El
 .Pp
 The following five field specifiers are not drawn directly from the
___
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: r216219 - head/usr.bin/stat

2010-12-05 Thread Doug Barton
Author: dougb
Date: Sun Dec  5 22:47:08 2010
New Revision: 216219
URL: http://svn.freebsd.org/changeset/base/216219

Log:
  Bring in the change from NetBSD 1.28:
  
  "\\ -> \e"
  
  Obtained from:jo...@netbsd.org
  
  Bump .Dd because we're now up to date with the latest NetBSD version

Modified:
  head/usr.bin/stat/stat.1

Modified: head/usr.bin/stat/stat.1
==
--- head/usr.bin/stat/stat.1Sun Dec  5 22:41:58 2010(r216218)
+++ head/usr.bin/stat/stat.1Sun Dec  5 22:47:08 2010(r216219)
@@ -1,4 +1,4 @@
-.\"$NetBSD: stat.1,v 1.27 2010/03/11 21:37:01 enami Exp $
+.\"$NetBSD: stat.1,v 1.28 2010/04/05 21:25:01 joerg Exp $
 .\"
 .\" Copyright (c) 2002 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 24, 2010
+.Dd December 5, 2010
 .Dt STAT 1
 .Os
 .Sh NAME
@@ -473,7 +473,7 @@ which default to
 .Ex -std stat readlink
 .Sh EXAMPLES
 If no options are specified, the default format is
-"%d %i %Sp %l %Su %Sg %r %z \\"%Sa\\" \\"%Sm\\" \\"%Sc\\" \\"%SB\\" %k %b %#Xf 
%N".
+"%d %i %Sp %l %Su %Sg %r %z \e"%Sa\e" \e"%Sm\e" \e"%Sc\e" \e"%SB\e" %k %b %#Xf 
%N".
 .Bd -literal -offset indent
 \*[Gt] stat /tmp/bar
 0 78852 -rw-r--r-- 1 root wheel 0 0 "Jul  8 10:26:03 2004" "Jul  8 10:26:03 
2004" "Jul  8 10:28:13 2004" "Jan  1 09:00:00 1970" 16384 0 0 /tmp/bar
___
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: r216220 - head/bin/sh

2010-12-05 Thread Jilles Tjoelker
Author: jilles
Date: Sun Dec  5 22:56:46 2010
New Revision: 216220
URL: http://svn.freebsd.org/changeset/base/216220

Log:
  sh: POSIX says there should not be a space between Done and (exitstatus).
  
  (On the other hand, (core dumped) does need a space and so does [1] +.)

Modified:
  head/bin/sh/jobs.c

Modified: head/bin/sh/jobs.c
==
--- head/bin/sh/jobs.c  Sun Dec  5 22:47:08 2010(r216219)
+++ head/bin/sh/jobs.c  Sun Dec  5 22:56:46 2010(r216220)
@@ -354,7 +354,7 @@ showjob(struct job *jp, int mode)
if (WEXITSTATUS(ps->status) == 0)
strcpy(statestr, "Done");
else
-   fmtstr(statestr, 64, "Done (%d)",
+   fmtstr(statestr, 64, "Done(%d)",
WEXITSTATUS(ps->status));
} else {
i = WTERMSIG(ps->status);
___
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: r216221 - head/tools/regression/lib/msun

2010-12-05 Thread David Schultz
Author: das
Date: Sun Dec  5 23:50:49 2010
New Revision: 216221
URL: http://svn.freebsd.org/changeset/base/216221

Log:
  Fix some warnings.

Modified:
  head/tools/regression/lib/msun/test-fmaxmin.c

Modified: head/tools/regression/lib/msun/test-fmaxmin.c
==
--- head/tools/regression/lib/msun/test-fmaxmin.c   Sun Dec  5 22:56:46 
2010(r216220)
+++ head/tools/regression/lib/msun/test-fmaxmin.c   Sun Dec  5 23:50:49 
2010(r216221)
@@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$");
  *   fpequal(NaN, NaN) is true
  *   fpequal(+0.0, -0.0) is false
  */
-inline int
+static inline int
 fpequal(long double x, long double y)
 {
 
@@ -63,7 +63,7 @@ fpequal(long double x, long double y)
feclearexcept(ALL_STD_EXCEPT);\
long double __result = func((__x), (__y));\
if (fetestexcept(ALL_STD_EXCEPT)) {   \
-   fprintf(stderr, #func "(%L.20g, %L.20g) raised 0x%x\n",   \
+   fprintf(stderr, #func "(%.20Lg, %.20Lg) raised 0x%x\n",   \
(x), (y), fetestexcept(FE_ALL_EXCEPT));   \
ok = 0;   \
} \
@@ -104,7 +104,7 @@ testall_r(long double big, long double s
  * in all rounding modes and with the arguments in different orders.
  * The input 'big' must be >= 'small'.
  */
-int
+void
 testall(int testnum, long double big, long double small)
 {
static const int rmodes[] = {
___
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: r216222 - head/tools/regression/lib/msun

2010-12-05 Thread David Schultz
Author: das
Date: Mon Dec  6 00:02:49 2010
New Revision: 216222
URL: http://svn.freebsd.org/changeset/base/216222

Log:
  signbit() returns nonzero for negative arguments, but we shouldn't assume
  that it always returns the same nonzero value.

Modified:
  head/tools/regression/lib/msun/test-exponential.c
  head/tools/regression/lib/msun/test-fma.c
  head/tools/regression/lib/msun/test-fmaxmin.c
  head/tools/regression/lib/msun/test-invtrig.c
  head/tools/regression/lib/msun/test-logarithm.c
  head/tools/regression/lib/msun/test-trig.c

Modified: head/tools/regression/lib/msun/test-exponential.c
==
--- head/tools/regression/lib/msun/test-exponential.c   Sun Dec  5 23:50:49 
2010(r216221)
+++ head/tools/regression/lib/msun/test-exponential.c   Mon Dec  6 00:02:49 
2010(r216222)
@@ -89,7 +89,7 @@ __FBSDID("$FreeBSD$");
 int
 fpequal(long double x, long double y)
 {
-   return ((x == y && signbit(x) == signbit(y)) || isnan(x) && isnan(y));
+   return ((x == y && !signbit(x) == !signbit(y)) || isnan(x) && isnan(y));
 }
 
 void

Modified: head/tools/regression/lib/msun/test-fma.c
==
--- head/tools/regression/lib/msun/test-fma.c   Sun Dec  5 23:50:49 2010
(r216221)
+++ head/tools/regression/lib/msun/test-fma.c   Mon Dec  6 00:02:49 2010
(r216222)
@@ -85,7 +85,8 @@ int
 fpequal(long double x, long double y)
 {
 
-   return ((x == y && signbit(x) == signbit(y)) || (isnan(x) && isnan(y)));
+   return ((x == y && !signbit(x) == !signbit(y))
+   || (isnan(x) && isnan(y)));
 }
 
 static void

Modified: head/tools/regression/lib/msun/test-fmaxmin.c
==
--- head/tools/regression/lib/msun/test-fmaxmin.c   Sun Dec  5 23:50:49 
2010(r216221)
+++ head/tools/regression/lib/msun/test-fmaxmin.c   Mon Dec  6 00:02:49 
2010(r216222)
@@ -50,7 +50,8 @@ static inline int
 fpequal(long double x, long double y)
 {
 
-   return ((x == y && signbit(x) == signbit(y)) || (isnan(x) && isnan(y)));
+   return ((x == y && !signbit(x) == !signbit(y))
+   || (isnan(x) && isnan(y)));
 }
 
 /*

Modified: head/tools/regression/lib/msun/test-invtrig.c
==
--- head/tools/regression/lib/msun/test-invtrig.c   Sun Dec  5 23:50:49 
2010(r216221)
+++ head/tools/regression/lib/msun/test-invtrig.c   Mon Dec  6 00:02:49 
2010(r216222)
@@ -118,7 +118,7 @@ fpequal(long double x, long double y, lo
 
if (isnan(x) && isnan(y))
return (1);
-   if (signbit(x) != signbit(y))
+   if (!signbit(x) != !signbit(y))
return (0);
if (x == y)
return (1);

Modified: head/tools/regression/lib/msun/test-logarithm.c
==
--- head/tools/regression/lib/msun/test-logarithm.c Sun Dec  5 23:50:49 
2010(r216221)
+++ head/tools/regression/lib/msun/test-logarithm.c Mon Dec  6 00:02:49 
2010(r216222)
@@ -90,7 +90,7 @@ __FBSDID("$FreeBSD$");
 int
 fpequal(long double x, long double y)
 {
-   return ((x == y && signbit(x) == signbit(y)) || isnan(x) && isnan(y));
+   return ((x == y && !signbit(x) == !signbit(y)) || isnan(x) && isnan(y));
 }
 
 void

Modified: head/tools/regression/lib/msun/test-trig.c
==
--- head/tools/regression/lib/msun/test-trig.c  Sun Dec  5 23:50:49 2010
(r216221)
+++ head/tools/regression/lib/msun/test-trig.c  Mon Dec  6 00:02:49 2010
(r216222)
@@ -90,7 +90,7 @@ __FBSDID("$FreeBSD$");
 int
 fpequal(long double x, long double y)
 {
-   return ((x == y && signbit(x) == signbit(y)) || isnan(x) && isnan(y));
+   return ((x == y && !signbit(x) == !signbit(y)) || isnan(x) && isnan(y));
 }
 
 /*
___
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: r216223 - head/tools/regression/lib/msun

2010-12-05 Thread David Schultz
Author: das
Date: Mon Dec  6 00:19:56 2010
New Revision: 216223
URL: http://svn.freebsd.org/changeset/base/216223

Log:
  Work around gcc constant folding bugs.

Modified:
  head/tools/regression/lib/msun/test-lrint.c

Modified: head/tools/regression/lib/msun/test-lrint.c
==
--- head/tools/regression/lib/msun/test-lrint.c Mon Dec  6 00:02:49 2010
(r216222)
+++ head/tools/regression/lib/msun/test-lrint.c Mon Dec  6 00:19:56 2010
(r216223)
@@ -41,9 +41,14 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif
 
+/*
+ * XXX The volatile here is to avoid gcc's bogus constant folding and work
+ * around the lack of support for the FENV_ACCESS pragma.
+ */
 #definetest(func, x, result, excepts)  do {
\
+   volatile double _d = x; \
assert(feclearexcept(FE_ALL_EXCEPT) == 0);  \
-   assert((func)(x) == (result) || fetestexcept(FE_INVALID));  \
+   assert((func)(_d) == (result) || fetestexcept(FE_INVALID)); \
assert(fetestexcept(FE_ALL_EXCEPT) == (excepts));   \
 } while (0)
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r216210 - head/lib/msun/src

2010-12-05 Thread Bruce Evans

On Sun, 5 Dec 2010, David Schultz wrote:


Log:
 Add a "kernel" log function, based on e_log.c, which is useful for
 implementing accurate logarithms in different bases.  This is based
 on an approach bde coded up years ago.


Thanks for doing lots of work to make this production quality.

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"