From owner-svn-soc-all@FreeBSD.ORG Sun Aug 14 14:27:56 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id C3E071065672 for ; Sun, 14 Aug 2011 14:27:54 +0000 (UTC) (envelope-from zy@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sun, 14 Aug 2011 14:27:54 +0000 Date: Sun, 14 Aug 2011 14:27:54 +0000 From: zy@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110814142754.C3E071065672@hub.freebsd.org> Cc: Subject: socsvn commit: r225111 - in soc2011/zy/nvi-iconv/head: contrib/nvi2/common contrib/nvi2/ex contrib/nvi2/vi usr.bin/vi X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Aug 2011 14:27:56 -0000 Author: zy Date: Sun Aug 14 14:27:54 2011 New Revision: 225111 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=225111 Log: Updates to git:0c15828; this version features: * Stable :vsplit support; * Standard and general file encoding detection (UTF-8 & UTF-16); * UTF-16 support. The patch is ready for testing in the community. Added: soc2011/zy/nvi-iconv/head/contrib/nvi2/common/encoding.c Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/common/conv.c soc2011/zy/nvi-iconv/head/contrib/nvi2/common/exf.c soc2011/zy/nvi-iconv/head/contrib/nvi2/common/exf.h soc2011/zy/nvi-iconv/head/contrib/nvi2/common/extern.h soc2011/zy/nvi-iconv/head/contrib/nvi2/common/line.c soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex.h soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_write.c soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/vi.c soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/vs_refresh.c soc2011/zy/nvi-iconv/head/usr.bin/vi/Makefile Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/common/conv.c ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/common/conv.c Sun Aug 14 13:37:38 2011 (r225110) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/common/conv.c Sun Aug 14 14:27:54 2011 (r225111) @@ -10,7 +10,7 @@ #include "config.h" #ifndef lint -static const char sccsid[] = "$Id: conv.c,v 1.28 2011/07/16 14:40:06 zy Exp $ (Berkeley) $Date: 2011/07/16 14:40:06 $"; +static const char sccsid[] = "$Id: conv.c,v 1.29 2011/08/13 12:53:23 zy Exp $ (Berkeley) $Date: 2011/08/13 12:53:23 $"; #endif /* not lint */ #include @@ -23,6 +23,7 @@ #include #include #include +#include #include #include "common.h" @@ -89,6 +90,10 @@ default_char2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw, size_t *tolen, CHAR_T **dst, char *enc) { + /* XXX UTF-16 linesep hack */ + if (!strncasecmp(enc, "utf-16", 6) && len % 2) + len -= 1; + int i = 0, j; CHAR_T **tostr = &cw->b_wc1; size_t *blen = &cw->blen1; Added: soc2011/zy/nvi-iconv/head/contrib/nvi2/common/encoding.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/common/encoding.c Sun Aug 14 14:27:54 2011 (r225111) @@ -0,0 +1,162 @@ +/*- + * Copyright (c) 2011 + * Zhihao Yuan. All rights reserved. + * + * See the LICENSE file for redistribution information. + */ + +#ifndef lint +static const char sccsid[] = "$Id: encoding.c,v 1.2 2011/08/13 22:58:03 zy Exp $ (Berkeley) $Date: 2011/08/13 22:58:03 $"; +#endif /* not lint */ + +#include + +#define F 0 /* character never appears in text */ +#define T 1 /* character appears in plain ASCII text */ +#define I 2 /* character appears in ISO-8859 text */ +#define X 3 /* character appears in non-ISO extended ASCII (Mac, IBM PC) */ + +static char text_chars[256] = { + /* BEL BS HT LF FF CR */ + F, F, F, F, F, F, F, T, T, T, T, F, T, T, F, F, /* 0x0X */ + /* ESC */ + F, F, F, F, F, F, F, F, F, F, F, T, F, F, F, F, /* 0x1X */ + T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x2X */ + T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x3X */ + T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x4X */ + T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x5X */ + T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, /* 0x6X */ + T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, F, /* 0x7X */ + /* NEL */ + X, X, X, X, X, T, X, X, X, X, X, X, X, X, X, X, /* 0x8X */ + X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, X, /* 0x9X */ + I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xaX */ + I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xbX */ + I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xcX */ + I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xdX */ + I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, /* 0xeX */ + I, I, I, I, I, I, I, I, I, I, I, I, I, I, I, I /* 0xfX */ +}; + +/* + * looks_utf8 -- + * Decide whether some text looks like UTF-8. Returns: + * + * -1: invalid UTF-8 + * 0: uses odd control characters, so doesn't look like text + * 1: 7-bit text + * 2: definitely UTF-8 text (valid high-bit set bytes) + * + * Based on RFC 3629. UTF-8 with BOM is not accepted. + * + * PUBLIC: int looks_utf8 __P((const char *, size_t)); + */ +int +looks_utf8(const char *buf, size_t nbytes) +{ + size_t i; + int n; + int gotone = 0, ctrl = 0; + + for (i = 0; i < nbytes; i++) { + if ((buf[i] & 0x80) == 0) { /* 0xxxxxxx is plain ASCII */ + /* + * Even if the whole file is valid UTF-8 sequences, + * still reject it if it uses weird control characters. + */ + + if (text_chars[(u_char)buf[i]] != T) + ctrl = 1; + } else if ((buf[i] & 0x40) == 0) { /* 10xxxxxx never 1st byte */ + return -1; + } else { /* 11xxxxxx begins UTF-8 */ + int following; + + if ((buf[i] & 0x20) == 0) /* 110xxxxx */ + if ((buf[1] & 0x3e)) /* C0, C1 */ + following = 1; + else return -1; + else if ((buf[i] & 0x10) == 0) /* 1110xxxx */ + following = 2; + else if ((buf[i] & 0x08) == 0) /* 11110xxx */ + if ((u_char)buf[i] < 0xf5 || 0xf7 < (u_char)buf[i]) + following = 3; + else return -1; /* F5, F6, F7 */ + else + return -1; + + for (n = 0; n < following; n++) { + i++; + if (i >= nbytes) + goto done; + + if (buf[i] & 0x40) /* 10xxxxxx */ + return -1; + } + + gotone = 1; + } + } +done: + return ctrl ? 0 : (gotone ? 2 : 1); +} + +/* + * looks_utf16 -- + * Decide whether some text looks like UTF-16. Returns: + * + * 0: invalid UTF-16 + * 1: Little-endian UTF-16 + * 2: Big-endian UTF-16 + * + * PUBLIC: int looks_utf16 __P((const char *, size_t)); + */ +int +looks_utf16(const char *buf, size_t nbytes) +{ + int bigend; + size_t i; + unsigned int c; + int bom; + int following = 0; + + if (nbytes < 2) + return 0; + + bom = ((u_char)buf[0] << 8) + (u_char)buf[1]; + if (bom == 0xfffe) + bigend = 0; + else if (bom == 0xfeff) + bigend = 1; + else + return 0; + + for (i = 2; i + 1 < nbytes; i += 2) { + if (bigend) + c = (u_char)buf[i + 1] + 256 * (u_char)buf[i]; + else + c = (u_char)buf[i] + 256 * (u_char)buf[i + 1]; + + if (!following) + if (c < 0xD800 || c > 0xDFFF) + if (c < 128 && text_chars[(size_t)c] != T) + return 0; + else + following = 0; + else if (!(0xD800 <= c && c <= 0xDBFF)) + return 0; + else { + following = 1; + continue; + } + else if (!(0xDC00 <= c && c <= 0xDFFF)) + return 0; + } + + return 1 + bigend; +} + +#undef F +#undef T +#undef I +#undef X Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/common/exf.c ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/common/exf.c Sun Aug 14 13:37:38 2011 (r225110) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/common/exf.c Sun Aug 14 14:27:54 2011 (r225111) @@ -10,7 +10,7 @@ #include "config.h" #ifndef lint -static const char sccsid[] = "$Id: exf.c,v 10.52 2011/07/18 16:58:54 zy Exp $ (Berkeley) $Date: 2011/07/18 16:58:54 $"; +static const char sccsid[] = "$Id: exf.c,v 10.53 2011/07/20 00:38:28 zy Exp $ (Berkeley) $Date: 2011/07/20 00:38:28 $"; #endif /* not lint */ #include @@ -39,6 +39,7 @@ static int file_backup __P((SCR *, char *, char *)); static void file_cinit __P((SCR *)); +static void file_encinit __P((SCR *)); static void file_comment __P((SCR *)); static int file_spath __P((SCR *, FREF *, struct stat *, int *)); @@ -404,12 +405,12 @@ sp->ep = ep; sp->frp = frp; + /* Detect and set the file encoding */ + file_encinit(sp); + /* Set the initial cursor position, queue initial command. */ file_cinit(sp); - /* Report conversion errors again. */ - F_CLR(sp, SC_CONV_ERROR); - /* Redraw the screen from scratch, schedule a welcome message. */ F_SET(sp, SC_SCR_REFORMAT | SC_STATUS); @@ -721,7 +722,7 @@ free(ep->rcv_path); if (ep->rcv_mpath != NULL) free(ep->rcv_mpath); - if (ep->c_lp != NULL) + if (ep->c_blen > 0) free(ep->c_lp); free(ep); @@ -1207,12 +1208,63 @@ } if (estr) msgq_str(sp, M_SYSERR, estr, "%s"); + if (d != NULL) + free(d); if (bp != NULL) FREE_SPACE(sp, bp, blen); return (1); } /* + * file_encinit -- + * Read the first line and set the O_FILEENCODING. + */ +static void +file_encinit(SCR *sp) +{ +#if defined(USE_WIDECHAR) && defined(USE_ICONV) + size_t len; + char *p; + size_t blen = 0; + char buf[4096]; /* not need to be '\0'-terminated */ + recno_t ln = 1; + + while (!db_rget(sp, ln++, &p, &len)) { + if (blen + len > sizeof(buf)) + len = sizeof(buf) - blen; + memcpy(buf + blen, p, len); + blen += len; + if (blen == sizeof(buf)) + break; + else + buf[blen++] = '\n'; + } + + if (looks_utf8(buf, blen) > 1) + o_set(sp, O_FILEENCODING, OS_STRDUP, "utf-8", 0); + else { + int st = looks_utf16(buf, blen); + if (st > 0) { + char *np; + size_t nlen; + db_rget(sp, 1, &p, &len); + nlen = len-2; + GET_SPACE_GOTOC(sp, np, nlen, nlen); + memcpy(sp->ep->_bom, p, 2); + memcpy(np, p+2, len-2); + db_rset(sp, 1, np, len-2); /* store w/o the BOM */ + } + if (st == 1) + o_set(sp, O_FILEENCODING, OS_STRDUP, "utf-16le", 0); + else if (st == 2) + o_set(sp, O_FILEENCODING, OS_STRDUP, "utf-16be", 0); + } + /* Fallback to locale encoding */ +alloc_err:; +#endif +} + +/* * file_comment -- * Skip the first comment. */ Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/common/exf.h ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/common/exf.h Sun Aug 14 13:37:38 2011 (r225110) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/common/exf.h Sun Aug 14 14:27:54 2011 (r225111) @@ -6,7 +6,7 @@ * * See the LICENSE file for redistribution information. * - * @(#)exf.h 10.7 (Berkeley) 7/9/96 + * $Id: exf.h,v 10.8 2011/08/13 17:59:41 zy Exp $ (Berkeley) $Date: 2011/08/13 17:59:41 $ */ /* Undo direction. */ /* @@ -17,6 +17,10 @@ int refcnt; /* Reference count. */ /* Underlying database state. */ + union { + uint16_t bom; /* Byte-order-mark */ + char _bom[2]; + }; DB *db; /* File db structure. */ CHAR_T *c_lp; /* Cached line. */ size_t c_len; /* Cached line length. */ Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/common/extern.h ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/common/extern.h Sun Aug 14 13:37:38 2011 (r225110) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/common/extern.h Sun Aug 14 14:27:54 2011 (r225111) @@ -7,6 +7,8 @@ void text_lfree __P((TEXTH *)); void text_free __P((TEXT *)); int del __P((SCR *, MARK *, MARK *, int)); +int looks_utf8 __P((const char *, size_t)); +int looks_utf16 __P((const char *, size_t)); FREF *file_add __P((SCR *, char *)); int file_init __P((SCR *, FREF *, char *, int)); int file_end __P((SCR *, EXF *, int)); @@ -34,6 +36,8 @@ int db_set __P((SCR *, recno_t, CHAR_T *, size_t)); int db_exist __P((SCR *, recno_t)); int db_last __P((SCR *, recno_t *)); +int db_rget __P((SCR *, recno_t, char **, size_t *)); +int db_rset __P((SCR *, recno_t, char *, size_t)); void db_err __P((SCR *, recno_t)); int log_init __P((SCR *, EXF *)); int log_end __P((SCR *, EXF *)); Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/common/line.c ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/common/line.c Sun Aug 14 13:37:38 2011 (r225110) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/common/line.c Sun Aug 14 14:27:54 2011 (r225111) @@ -10,7 +10,7 @@ #include "config.h" #ifndef lint -static const char sccsid[] = "$Id: line.c,v 10.24 2011/07/18 16:10:48 zy Exp $ (Berkeley) $Date: 2011/07/18 16:10:48 $"; +static const char sccsid[] = "$Id: line.c,v 10.26 2011/08/12 12:36:41 zy Exp $ (Berkeley) $Date: 2011/08/12 12:36:41 $"; #endif /* not lint */ #include @@ -580,6 +580,72 @@ } /* + * db_rget -- + * Retrieve a raw line from database. No cache, no conversion. + * + * PUBLIC: int db_rget __P((SCR *, recno_t, char **, size_t *)); + */ +int +db_rget( + SCR *sp, + recno_t lno, /* Line number. */ + char **pp, /* Pointer store. */ + size_t *lenp) /* Length store. */ +{ + DBT data, key; + EXF *ep; + + /* Check for no underlying file. */ + if ((ep = sp->ep) == NULL) + return (1); + + /* Get the line from the underlying database. */ + key.data = &lno; + key.size = sizeof(lno); + if (ep->db->get(ep->db, &key, &data, 0)) + /* We do not report error, and do not ensure the size! */ + return (1); + + if (lenp != NULL) + *lenp = data.size; + if (pp != NULL) + *pp = data.data; + return (0); +} + +/* + * db_rset -- + * Store a line in the file. No log, no conversion. + * + * PUBLIC: int db_rset __P((SCR *, recno_t, char *, size_t)); + */ +int +db_rset( + SCR *sp, + recno_t lno, + char *p, + size_t len) +{ + DBT data, key; + EXF *ep; + + /* Check for no underlying file. */ + if ((ep = sp->ep) == NULL) + return (1); + + /* Update file. */ + key.data = &lno; + key.size = sizeof(lno); + data.data = p; + data.size = len; + if (ep->db->put(ep->db, &key, &data, 0) == -1) + /* We do not report error, and do not ensure the size! */ + return (1); + + return (0); +} + +/* * db_err -- * Report a line error. * Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex.h ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex.h Sun Aug 14 13:37:38 2011 (r225110) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex.h Sun Aug 14 14:27:54 2011 (r225111) @@ -133,7 +133,7 @@ #define E_C_PRINT 0x01000 /* p flag. */ u_int16_t iflags; /* User input information. */ -#define __INUSE2 0x000007ff /* Same name space as EXCMDLIST. */ +#define __INUSE2 0x000004ff /* Same name space as EXCMDLIST. */ #define E_BLIGNORE 0x00000800 /* Ignore blank lines. */ #define E_NAMEDISCARD 0x00001000 /* Free/discard the name. */ #define E_NOAUTO 0x00002000 /* Don't do autoprint output. */ Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_write.c ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_write.c Sun Aug 14 13:37:38 2011 (r225110) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_write.c Sun Aug 14 14:27:54 2011 (r225111) @@ -10,7 +10,7 @@ #include "config.h" #ifndef lint -static const char sccsid[] = "$Id: ex_write.c,v 10.38 2001/06/25 15:19:22 skimo Exp $ (Berkeley) $Date: 2001/06/25 15:19:22 $"; +static const char sccsid[] = "$Id: ex_write.c,v 10.39 2011/08/13 18:28:15 zy Exp $ (Berkeley) $Date: 2011/08/13 18:28:15 $"; #endif /* not lint */ #include @@ -25,6 +25,7 @@ #include #include #include +#include #include #include "../common/common.h" @@ -287,6 +288,7 @@ CHAR_T *p; char *f; size_t flen; + int isutf16; gp = sp->gp; fline = fm->lno; @@ -315,7 +317,12 @@ ccnt = 0; lcnt = 0; msg = "253|Writing..."; - if (tline != 0) + + isutf16 = !strncasecmp(O_STR(sp, O_FILEENCODING), "utf-16", 6); + + if (tline != 0) { + if (sp->ep->bom && fwrite(&sp->ep->bom, 2, 1, fp) != 1) + goto err; for (; fline <= tline; ++fline, ++lcnt) { /* Caller has to provide any interrupt message. */ if ((lcnt + 1) % INTERRUPT_CHECK == 0) { @@ -333,10 +340,13 @@ if (fwrite(f, 1, flen, fp) != flen) goto err; ccnt += len; + if (isutf16 && putc('\0', fp) != '\0') + break; /* UTF-16 uses '000a' as EOL */ if (putc('\n', fp) != '\n') break; ++ccnt; } + } if (fflush(fp)) goto err; Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/vi.c ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/vi.c Sun Aug 14 13:37:38 2011 (r225110) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/vi.c Sun Aug 14 14:27:54 2011 (r225111) @@ -403,6 +403,7 @@ if (F_ISSET(gp, G_SRESTART) || F_ISSET(sp, SC_EX)) { *spp = sp; v_dtoh(sp); + gp->scr_discard(sp, NULL); break; } } @@ -1015,6 +1016,9 @@ } CIRCLEQ_REMOVE(&gp->dq, tsp, q); CIRCLEQ_INSERT_TAIL(&gp->hq, tsp, q); + /* XXXX Change if hidden screens per window */ + tsp->gp = 0; + gp->scr_discard(tsp, NULL); } /* Move current screen back to the display queue. */ Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/vs_refresh.c ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/vs_refresh.c Sun Aug 14 13:37:38 2011 (r225110) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/vs_refresh.c Sun Aug 14 14:27:54 2011 (r225111) @@ -345,7 +345,7 @@ tmp.lno = LNO; tmp.coff = HMAP->coff; tmp.soff = 1; - lcnt = vs_sm_nlines(sp, &tmp, lastline+1, sp->t_rows); + lcnt = vs_sm_nlines(sp, &tmp, lastline, sp->t_rows); if (lcnt < HALFTEXT(sp)) { if (vs_sm_fill(sp, lastline, P_BOTTOM)) return (1); Modified: soc2011/zy/nvi-iconv/head/usr.bin/vi/Makefile ============================================================================== --- soc2011/zy/nvi-iconv/head/usr.bin/vi/Makefile Sun Aug 14 13:37:38 2011 (r225110) +++ soc2011/zy/nvi-iconv/head/usr.bin/vi/Makefile Sun Aug 14 14:27:54 2011 (r225111) @@ -57,8 +57,9 @@ SRCS+= cl_bsd.c cl_funcs.c cl_main.c cl_read.c cl_screen.c cl_term.c # General sources. -SRCS+= cut.c conv.c delete.c exf.c key.c line.c log.c main.c mark.c msg.c \ - options.c options_f.c put.c screen.c search.c seq.c recover.c util.c +SRCS+= cut.c conv.c delete.c encoding.c exf.c key.c line.c log.c main.c \ + mark.c msg.c options.c options_f.c put.c screen.c search.c seq.c \ + recover.c util.c # Ex source. SRCS+= ex.c ex_abbrev.c ex_append.c ex_args.c ex_argv.c ex_at.c ex_bang.c \ From owner-svn-soc-all@FreeBSD.ORG Sun Aug 14 15:17:11 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 5862A1065670 for ; Sun, 14 Aug 2011 15:17:09 +0000 (UTC) (envelope-from xxp@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sun, 14 Aug 2011 15:17:09 +0000 Date: Sun, 14 Aug 2011 15:17:09 +0000 From: xxp@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110814151709.5862A1065670@hub.freebsd.org> Cc: Subject: socsvn commit: r225113 - in soc2011/xxp/xxp-head/libexec/rtld-elf: amd64 i386 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Aug 2011 15:17:11 -0000 Author: xxp Date: Sun Aug 14 15:17:09 2011 New Revision: 225113 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=225113 Log: review rtld Modified: soc2011/xxp/xxp-head/libexec/rtld-elf/amd64/rtld_start.S soc2011/xxp/xxp-head/libexec/rtld-elf/i386/rtld_start.S Modified: soc2011/xxp/xxp-head/libexec/rtld-elf/amd64/rtld_start.S ============================================================================== --- soc2011/xxp/xxp-head/libexec/rtld-elf/amd64/rtld_start.S Sun Aug 14 14:36:32 2011 (r225112) +++ soc2011/xxp/xxp-head/libexec/rtld-elf/amd64/rtld_start.S Sun Aug 14 15:17:09 2011 (r225113) @@ -31,16 +31,13 @@ .type .rtld_start,@function .rtld_start: xorq %rbp,%rbp # Clear frame pointer for good form - cfi_def_cfa(%rsp,0) subq $24,%rsp # A place to store exit procedure addr - cfi_adjust_cfa_offset(24) movq %rdi,%r12 movq %rsp,%rsi # save address of exit proc movq %rsp,%rdx # construct address of obj_main addq $8,%rdx call _rtld@PLT # Call rtld(sp); returns entry point popq %rsi # Get exit procedure address - cfi_adjust_cfa_offset(-8) movq %r12,%rdi # *ap /* * At this point, %rax contains the entry point of the main program, and @@ -83,27 +80,16 @@ .type _rtld_bind_start,@function _rtld_bind_start: subq $8,%rsp - cfi_adjust_cfa_offset(8) pushfq # Save rflags - cfi_adjust_cfa_offset(8) pushq %rax # Save %rax - cfi_adjust_cfa_offset(8) pushq %rdx # Save %rdx - cfi_adjust_cfa_offset(8) pushq %rcx # Save %rcx - cfi_adjust_cfa_offset(8) pushq %rsi # Save %rsi - cfi_adjust_cfa_offset(8) pushq %rdi # Save %rdi - cfi_adjust_cfa_offset(8) pushq %r8 # Save %r8 - cfi_adjust_cfa_offset(8) pushq %r9 # Save %r9 - cfi_adjust_cfa_offset(8) pushq %r10 # Save %r10 - cfi_adjust_cfa_offset(8) pushq %r11 # Save %r11 - cfi_adjust_cfa_offset(8) movq 0x58(%rsp),%rdi # Fetch obj argument movq 0x60(%rsp),%rsi # Fetch reloff argument @@ -115,25 +101,15 @@ movq %rax,0x60(%rsp) # Store target over reloff argument popq %r11 # Restore %r11 - cfi_adjust_cfa_offset(-8) popq %r10 # Restore %r10 - cfi_adjust_cfa_offset(-8) popq %r9 # Restore %r9 - cfi_adjust_cfa_offset(-8) popq %r8 # Restore %r8 - cfi_adjust_cfa_offset(-8) popq %rdi # Restore %rdi - cfi_adjust_cfa_offset(-8) popq %rsi # Restore %rsi - cfi_adjust_cfa_offset(-8) popq %rcx # Restore %rcx - cfi_adjust_cfa_offset(-8) popq %rdx # Restore %rdx - cfi_adjust_cfa_offset(-8) popq %rax # Restore %rax - cfi_adjust_cfa_offset(-8) popfq # Restore rflags - cfi_adjust_cfa_offset(-8) leaq 16(%rsp),%rsp # Discard spare, obj, do not change rflags ret # "Return" to target address Modified: soc2011/xxp/xxp-head/libexec/rtld-elf/i386/rtld_start.S ============================================================================== --- soc2011/xxp/xxp-head/libexec/rtld-elf/i386/rtld_start.S Sun Aug 14 14:36:32 2011 (r225112) +++ soc2011/xxp/xxp-head/libexec/rtld-elf/i386/rtld_start.S Sun Aug 14 15:17:09 2011 (r225113) @@ -34,27 +34,18 @@ movl %esp,%eax # Save initial stack pointer movl %esp,%esi # Save initial stack pointer andl $0xfffffff0,%esp # Align stack pointer - cfi_def_cfa(%esp,0) subl $16,%esp # A place to store exit procedure addr - cfi_adjust_cfa_offset(16) movl %esp,%ebx # save address of exit proc movl %esp,%ecx # construct address of obj_main addl $4,%ecx subl $4,%esp # Keep stack aligned - cfi_adjust_cfa_offset(4) pushl %ecx # Pass address of obj_main - cfi_adjust_cfa_offset(4) pushl %ebx # Pass address of exit proc - cfi_adjust_cfa_offset(4) pushl %eax # Pass initial stack pointer to rtld - cfi_adjust_cfa_offset(4) call _rtld@PLT # Call rtld(sp); returns entry point addl $16,%esp # Remove arguments from stack - cfi_adjust_cfa_offset(-16) popl %edx # Get exit procedure address - cfi_adjust_cfa_offset(-4) movl %esi,%esp # Ignore obj_main - cfi_def_cfa(%esp,0) /* * At this point, %eax contains the entry point of the main program, and * %edx contains a pointer to a termination function that should be @@ -81,32 +72,21 @@ .type _rtld_bind_start,@function _rtld_bind_start: pushf # Save eflags - cfi_adjust_cfa_offset(4) pushl %eax # Save %eax - cfi_adjust_cfa_offset(4) pushl %edx # Save %edx - cfi_adjust_cfa_offset(4) pushl %ecx # Save %ecx - cfi_adjust_cfa_offset(4) pushl 20(%esp) # Copy reloff argument - cfi_adjust_cfa_offset(4) pushl 20(%esp) # Copy obj argument - cfi_adjust_cfa_offset(4) call _rtld_bind@PLT # Transfer control to the binder /* Now %eax contains the entry point of the function being called. */ addl $8,%esp # Discard binder arguments - cfi_adjust_cfa_offset(-8) movl %eax,20(%esp) # Store target over obj argument popl %ecx # Restore %ecx - cfi_adjust_cfa_offset(-4) popl %edx # Restore %edx - cfi_adjust_cfa_offset(-4) popl %eax # Restore %eax - cfi_adjust_cfa_offset(-4) popf # Restore eflags - cfi_adjust_cfa_offset(-4) leal 4(%esp),%esp # Discard reloff, do not change eflags ret # "Return" to target address From owner-svn-soc-all@FreeBSD.ORG Mon Aug 15 03:54:52 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id E2A1F106564A for ; Mon, 15 Aug 2011 03:54:51 +0000 (UTC) (envelope-from xxp@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 15 Aug 2011 03:54:51 +0000 Date: Mon, 15 Aug 2011 03:54:51 +0000 From: xxp@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110815035451.E2A1F106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r225121 - soc2011/xxp/xxp-head/lib/libthr/arch/i386/i386 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2011 03:54:53 -0000 Author: xxp Date: Mon Aug 15 03:54:51 2011 New Revision: 225121 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=225121 Log: fix _umtx_op_err.S Modified: soc2011/xxp/xxp-head/lib/libthr/arch/i386/i386/_umtx_op_err.S Modified: soc2011/xxp/xxp-head/lib/libthr/arch/i386/i386/_umtx_op_err.S ============================================================================== --- soc2011/xxp/xxp-head/lib/libthr/arch/i386/i386/_umtx_op_err.S Mon Aug 15 00:38:14 2011 (r225120) +++ soc2011/xxp/xxp-head/lib/libthr/arch/i386/i386/_umtx_op_err.S Mon Aug 15 03:54:51 2011 (r225121) @@ -31,7 +31,8 @@ #define SYSCALL_ERR(x) \ ENTRY(__CONCAT(x, _err)); \ - mov __CONCAT($SYS_,x),%eax; int $0x80; ret + mov __CONCAT($SYS_,x),%eax; int $0x80; ret \ + END(__CONCAT(x, _err)); SYSCALL_ERR(_umtx_op) From owner-svn-soc-all@FreeBSD.ORG Mon Aug 15 06:46:59 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id E2BF6106564A for ; Mon, 15 Aug 2011 06:46:56 +0000 (UTC) (envelope-from xxp@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 15 Aug 2011 06:46:56 +0000 Date: Mon, 15 Aug 2011 06:46:56 +0000 From: xxp@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110815064656.E2BF6106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r225123 - soc2011/xxp/xxp-head/lib/libthr/arch/i386/i386 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2011 06:46:59 -0000 Author: xxp Date: Mon Aug 15 06:46:56 2011 New Revision: 225123 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=225123 Log: fix _umtx_op_err.S Modified: soc2011/xxp/xxp-head/lib/libthr/arch/i386/i386/_umtx_op_err.S Modified: soc2011/xxp/xxp-head/lib/libthr/arch/i386/i386/_umtx_op_err.S ============================================================================== --- soc2011/xxp/xxp-head/lib/libthr/arch/i386/i386/_umtx_op_err.S Mon Aug 15 03:41:48 2011 (r225122) +++ soc2011/xxp/xxp-head/lib/libthr/arch/i386/i386/_umtx_op_err.S Mon Aug 15 06:46:56 2011 (r225123) @@ -31,7 +31,7 @@ #define SYSCALL_ERR(x) \ ENTRY(__CONCAT(x, _err)); \ - mov __CONCAT($SYS_,x),%eax; int $0x80; ret \ + mov __CONCAT($SYS_,x),%eax; int $0x80; ret; \ END(__CONCAT(x, _err)); SYSCALL_ERR(_umtx_op) From owner-svn-soc-all@FreeBSD.ORG Tue Aug 16 22:13:10 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id E8693106564A for ; Tue, 16 Aug 2011 22:13:07 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 16 Aug 2011 22:13:07 +0000 Date: Tue, 16 Aug 2011 22:13:07 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110816221307.E8693106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r225169 - in soc2011/oleksandr/oleksandr-head/head/sys: cam kern sys X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 22:13:10 -0000 Author: oleksandr Date: Tue Aug 16 22:13:07 2011 New Revision: 225169 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=225169 Log: Review the type of errors Modified: soc2011/oleksandr/oleksandr-head/head/sys/cam/cam_periph.c soc2011/oleksandr/oleksandr-head/head/sys/kern/subr_devstat.c soc2011/oleksandr/oleksandr-head/head/sys/sys/devicestat.h Modified: soc2011/oleksandr/oleksandr-head/head/sys/cam/cam_periph.c ============================================================================== --- soc2011/oleksandr/oleksandr-head/head/sys/cam/cam_periph.c Tue Aug 16 21:51:29 2011 (r225168) +++ soc2011/oleksandr/oleksandr-head/head/sys/cam/cam_periph.c Tue Aug 16 22:13:07 2011 (r225169) @@ -1701,7 +1701,8 @@ openings = relsim_flags = 0; struct devstat *device_error = NULL; - devstat_error_flags error_flag_ret = 0, error_flag_type = 0; + devstat_error_flags error_flag_ret = 0, error_flag_type = 0, + error_flag_sense = 0; /* * If the error is not critical refer it to the type of retry able. */ @@ -1732,17 +1733,30 @@ */ if ((ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_NONE && error_flag_ret != 0) - error_flag_type=DEVSTAT_ERROR_OTHER_ERROR; + error_flag_type = DEVSTAT_ERROR_OTHER_ERROR; /* * If an error is present, search for an appropriate structure * in devstat and increase the corresponding counter of errors. */ + int sense_key, error_code, asc, ascq; + scsi_extract_sense(&ccb->csio.sense_data, + &error_code, &sense_key, &asc, &ascq); + if (sense_key == SSD_KEY_RECOVERED_ERROR && error_flag_ret != 0) + error_flag_sense = DEVSTAT_ERROR_RECOVERED; + if (sense_key == SSD_KEY_NOT_READY && error_flag_ret != 0) + error_flag_sense = DEVSTAT_ERROR_NOT_READY; + if (sense_key == SSD_KEY_MEDIUM_ERROR && error_flag_ret != 0) + error_flag_sense = DEVSTAT_ERROR_MEDIUM_ERROR; + if (sense_key == SSD_KEY_HARDWARE_ERROR && error_flag_ret != 0) + error_flag_sense = DEVSTAT_ERROR_HARDWARE; + if (sense_key == SSD_KEY_ILLEGAL_REQUEST && error_flag_ret != 0) + error_flag_sense = DEVSTAT_ERROR_ILLEGAL_REQ; if (error_flag_ret) { if ((device_error = devstat_search( ccb->ccb_h.path->periph->periph_name, ccb->ccb_h.path->periph->unit_number)) != NULL) { - devstat_add_error(device_error, - error_flag_ret | error_flag_type); + devstat_add_error(device_error, error_flag_ret | + error_flag_type | error_flag_sense); } } switch (status) { Modified: soc2011/oleksandr/oleksandr-head/head/sys/kern/subr_devstat.c ============================================================================== --- soc2011/oleksandr/oleksandr-head/head/sys/kern/subr_devstat.c Tue Aug 16 21:51:29 2011 (r225168) +++ soc2011/oleksandr/oleksandr-head/head/sys/kern/subr_devstat.c Tue Aug 16 22:13:07 2011 (r225169) @@ -385,6 +385,16 @@ ds->dev_error.read_error++; if ((error_flag | DEVSTAT_ERROR_OTHER_ERROR) == error_flag) ds->dev_error.other_error++; + if ((error_flag | DEVSTAT_ERROR_RECOVERED) == error_flag) + ds->dev_error.recovered++; + if ((error_flag | DEVSTAT_ERROR_NOT_READY) == error_flag) + ds->dev_error.not_ready++; + if ((error_flag | DEVSTAT_ERROR_MEDIUM_ERROR) == error_flag) + ds->dev_error.medium_error++; + if ((error_flag | DEVSTAT_ERROR_HARDWARE) == error_flag) + ds->dev_error.hardware++; + if ((error_flag | DEVSTAT_ERROR_ILLEGAL_REQ) == error_flag) + ds->dev_error.illegal_req++; } /* * This is the sysctl handler for the devstat package. The data pushed out Modified: soc2011/oleksandr/oleksandr-head/head/sys/sys/devicestat.h ============================================================================== --- soc2011/oleksandr/oleksandr-head/head/sys/sys/devicestat.h Tue Aug 16 21:51:29 2011 (r225168) +++ soc2011/oleksandr/oleksandr-head/head/sys/sys/devicestat.h Tue Aug 16 22:13:07 2011 (r225169) @@ -98,11 +98,16 @@ * These flags indicates the type of disk error. */ typedef enum { - DEVSTAT_ERROR_RETRIABLE = 0x01, - DEVSTAT_ERROR_NON_RETRIABLE = 0x02, - DEVSTAT_ERROR_READ_ERROR = 0x04, - DEVSTAT_ERROR_WRITE_ERROR = 0x08, - DEVSTAT_ERROR_OTHER_ERROR = 0x10 + DEVSTAT_ERROR_RETRIABLE = 0x001, + DEVSTAT_ERROR_NON_RETRIABLE = 0x002, + DEVSTAT_ERROR_READ_ERROR = 0x004, + DEVSTAT_ERROR_WRITE_ERROR = 0x008, + DEVSTAT_ERROR_OTHER_ERROR = 0x010, + DEVSTAT_ERROR_RECOVERED = 0x020, + DEVSTAT_ERROR_NOT_READY = 0x040, + DEVSTAT_ERROR_MEDIUM_ERROR = 0x080, + DEVSTAT_ERROR_HARDWARE = 0x100, + DEVSTAT_ERROR_ILLEGAL_REQ = 0x200 } devstat_error_flags; /* * These types are intended to aid statistics gathering/display programs. @@ -146,6 +151,11 @@ int read_error; int write_error; int other_error; + int recovered; + int not_ready; + int medium_error; + int hardware; + int illegal_req; } devstat_device_error; /* * XXX: Next revision should add @@ -209,7 +219,7 @@ devstat_support_flags flags, devstat_type_flags device_type, devstat_priority priority); -struct devstat *devstat_search(const char *dev_name, u_int32_t unit_namber); +struct devstat *devstat_search(const char *dev_name, u_int32_t unit_number); void devstat_remove_entry(struct devstat *ds); void devstat_start_transaction(struct devstat *ds, struct bintime *now); void devstat_start_transaction_bio(struct devstat *ds, struct bio *bp); From owner-svn-soc-all@FreeBSD.ORG Tue Aug 16 22:17:56 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 45578106564A for ; Tue, 16 Aug 2011 22:17:54 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 16 Aug 2011 22:17:54 +0000 Date: Tue, 16 Aug 2011 22:17:54 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110816221754.45578106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r225170 - soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 22:17:56 -0000 Author: oleksandr Date: Tue Aug 16 22:17:54 2011 New Revision: 225170 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=225170 Log: Add new type of errors to iostat Modified: soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat/iostat.c Modified: soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat/iostat.c ============================================================================== --- soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat/iostat.c Tue Aug 16 22:13:07 2011 (r225169) +++ soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat/iostat.c Tue Aug 16 22:17:54 2011 (r225170) @@ -762,11 +762,8 @@ printf("us ni sy in id "); printf("\n"); } - if (Eflag>0) { - printf(" error device statistics\n"); - printf("device retriable non-retriable read write other"); - printf("\n"); - } + if (Eflag>0) + printf(" Error Device Statistics\n"); for (dn = 0; dn < num_devices; dn++) { int di; @@ -816,13 +813,22 @@ if (asprintf(&devname, "%s%d", cur.dinfo->devices[di].device_name, cur.dinfo->devices[di].unit_number) == -1) - err(1, "asprintf"); - printf("%-8.8s %-10d %-14d %-5d %-6d %-6d", - devname, cur.dinfo->devices[di].dev_error.retriable, - cur.dinfo->devices[di].dev_error.non_retriable, - cur.dinfo->devices[di].dev_error.read_error, - cur.dinfo->devices[di].dev_error.write_error, - cur.dinfo->devices[di].dev_error.other_error); + err(1, "aspRintf"); + printf("Device: %-8.8s Retriable: %d Non-retriable: %d " + "Read: %d Write: %d Other: %d Recovered: %d " + "Device Not Ready: %d Medium: %d Hardware: %d " + "Illegal Request: %d", + devname, + cur.dinfo->devices[di].dev_error.retriable, + cur.dinfo->devices[di].dev_error.non_retriable, + cur.dinfo->devices[di].dev_error.read_error, + cur.dinfo->devices[di].dev_error.write_error, + cur.dinfo->devices[di].dev_error.other_error, + cur.dinfo->devices[di].dev_error.recovered, + cur.dinfo->devices[di].dev_error.not_ready, + cur.dinfo->devices[di].dev_error.medium_error, + cur.dinfo->devices[di].dev_error.hardware, + cur.dinfo->devices[di].dev_error.illegal_req); printf("\n"); free(devname); } From owner-svn-soc-all@FreeBSD.ORG Wed Aug 17 05:24:03 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 327B7106564A for ; Wed, 17 Aug 2011 05:24:01 +0000 (UTC) (envelope-from zy@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 17 Aug 2011 05:24:01 +0000 Date: Wed, 17 Aug 2011 05:24:01 +0000 From: zy@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110817052401.327B7106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r225177 - in soc2011/zy/nvi-iconv/head: contrib/nvi2 contrib/nvi2/cl contrib/nvi2/common contrib/nvi2/docs/man contrib/nvi2/ex contrib/nvi2/regex contrib/nvi2/vi usr.bin/vi X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 05:24:03 -0000 Author: zy Date: Wed Aug 17 05:24:00 2011 New Revision: 225177 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=225177 Log: Updates to git:63b3b92. Version 2.0.1 presents. * Correct UTF-16LE support; * Restore XTerm title when 'windowname' is on (xprop); * Use a modified regex lib to support wide characters (nvi-1.8x); * Some bugfixes. Note that this version is WARNS-free with gcc. Added: soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/ soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/COPYRIGHT soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/WHATSNEW soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/cclass.h soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/cname.h soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/engine.c soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/re_format.7 soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/regcomp.c soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/regerror.c soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/regex.3 soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/regex.h soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/regex2.h soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/regexec.c soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/regfree.c soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/utils.h Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/README soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl.h soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_funcs.c soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_main.c soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/extern.h soc2011/zy/nvi-iconv/head/contrib/nvi2/common/conv.c soc2011/zy/nvi-iconv/head/contrib/nvi2/common/cut.h soc2011/zy/nvi-iconv/head/contrib/nvi2/common/encoding.c soc2011/zy/nvi-iconv/head/contrib/nvi2/common/exf.c soc2011/zy/nvi-iconv/head/contrib/nvi2/common/mark.h soc2011/zy/nvi-iconv/head/contrib/nvi2/common/multibyte.h soc2011/zy/nvi-iconv/head/contrib/nvi2/common/options.c soc2011/zy/nvi-iconv/head/contrib/nvi2/common/screen.h soc2011/zy/nvi-iconv/head/contrib/nvi2/docs/man/vi.1 soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex.h soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_version.c soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_write.c soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/version.h soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/vi.c soc2011/zy/nvi-iconv/head/usr.bin/vi/Makefile Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/README ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/README Wed Aug 17 03:44:47 2011 (r225176) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/README Wed Aug 17 05:24:00 2011 (r225177) @@ -1,6 +1,6 @@ -# $Id: README,v 8.155 2011/07/15 04:45:07 zy Exp $ (Berkeley) $Date: 2011/07/15 04:45:07 $ +# $Id: README,v 8.156 2011/08/16 13:55:14 zy Exp $ (Berkeley) $Date: 2011/08/16 13:55:14 $ -This is version 2.0.0 (2011-07-11) of nex/nvi, a reimplementation of the ex/vi +This is version 2.0.1 (2011-08-16) of nex/nvi, a reimplementation of the ex/vi text editors originally distributed as part of the Fourth Berkeley Software Distribution (4BSD), by the University of California, Berkeley. @@ -15,6 +15,7 @@ docs .......... Ex/vi documentation, both current and historic. ex ............ Ex source code. include ....... Replacement include files. + regex ......... Modified regex library with wide character support. vi ............ Vi source code. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl.h ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl.h Wed Aug 17 03:44:47 2011 (r225176) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl.h Wed Aug 17 05:24:00 2011 (r225177) @@ -6,7 +6,7 @@ * * See the LICENSE file for redistribution information. * - * $Id: cl.h,v 10.33 2011/07/14 15:14:00 zy Exp $ (Berkeley) $Date: 2011/07/14 15:14:00 $ + * $Id: cl.h,v 10.34 2011/08/15 20:07:32 zy Exp $ (Berkeley) $Date: 2011/08/15 20:07:32 $ */ #ifdef USE_SLANG_CURSES @@ -15,6 +15,9 @@ #ifdef HAVE_NCURSESW_NCURSES_H /* { */ #include #else /* } { */ +#if defined(USE_WIDECHAR) && !defined(_XOPEN_SOURCE_EXTENDED) +#define _XOPEN_SOURCE_EXTENDED 1 +#endif #ifdef HAVE_NCURSES_H /* { */ #include #else /* } { */ @@ -42,6 +45,8 @@ char *rmso, *smso; /* Inverse video terminal strings. */ char *smcup, *rmcup; /* Terminal start/stop strings. */ + char *oname; /* Original screen window name. */ + SCR *focus; /* Screen that has the "focus". */ int killersig; /* Killer signal. */ @@ -83,9 +88,6 @@ #define RCNO(sp, cno) (cno) #define RLNO(sp, lno) (lno) -/* X11 xterm escape sequence to rename the icon/window. */ -#define XTERM_RENAME "\033]0;%s\007" - /* * XXX * Some implementations of curses.h don't define these for us. Used for Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_funcs.c ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_funcs.c Wed Aug 17 03:44:47 2011 (r225176) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_funcs.c Wed Aug 17 05:24:00 2011 (r225177) @@ -10,7 +10,7 @@ #include "config.h" #ifndef lint -static const char sccsid[] = "$Id: cl_funcs.c,v 10.72 2002/03/02 23:18:33 skimo Exp $ (Berkeley) $Date: 2002/03/02 23:18:33 $"; +static const char sccsid[] = "$Id: cl_funcs.c,v 10.73 2011/08/15 19:55:33 zy Exp $ (Berkeley) $Date: 2011/08/15 19:55:33 $"; #endif /* not lint */ #include @@ -638,34 +638,60 @@ { GS *gp; CL_PRIVATE *clp; - char *ttype; + FILE *pfp; + char buf[256], *s, *e; + char * wid; + char cmd[64]; gp = sp->gp; clp = CLP(sp); - ttype = OG_STR(gp, GO_TERM); - /* * XXX * We can only rename windows for xterm. */ if (on) { clp->focus = sp; - if (F_ISSET(clp, CL_RENAME_OK) && - !strncmp(ttype, "xterm", sizeof("xterm") - 1)) { - F_SET(clp, CL_RENAME); - (void)printf(XTERM_RENAME, name); - (void)fflush(stdout); + if (!F_ISSET(clp, CL_RENAME_OK) || + strcmp(OG_STR(gp, GO_TERM), "xterm")) + return (0); + + if (clp->oname == NULL && (wid = getenv("WINDOWID"))) { + snprintf(cmd, sizeof(cmd), "xprop -id %s WM_NAME", wid); + if ((pfp = popen(cmd, "r")) && fgets(buf, sizeof(buf), pfp) && + (s = strchr(buf, '"')) && (e = strrchr(buf, '"'))) + clp->oname = strndup(s + 1, e - s - 1); } + + cl_setname(gp, name); + + F_SET(clp, CL_RENAME); } else if (F_ISSET(clp, CL_RENAME)) { + cl_setname(gp, clp->oname); + F_CLR(clp, CL_RENAME); - (void)printf(XTERM_RENAME, ttype); - (void)fflush(stdout); } return (0); } +/* + * cl_setname -- + * Set a X11 icon/window name. + * + * PUBLIC: void cl_setname __P((GS *, char *)); + */ +void +cl_setname(GS *gp, char *name) +{ +/* X11 xterm escape sequence to rename the icon/window. */ +#define XTERM_RENAME "\033]0;%s\007" + + (void)printf(XTERM_RENAME, name == NULL ? OG_STR(gp, GO_TERM) : name); + (void)fflush(stdout); +#undef XTERM_RENAME +} + /* * cl_split -- * Split a screen. Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_main.c ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_main.c Wed Aug 17 03:44:47 2011 (r225176) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_main.c Wed Aug 17 05:24:00 2011 (r225177) @@ -10,7 +10,7 @@ #include "config.h" #ifndef lint -static const char sccsid[] = "$Id: cl_main.c,v 10.54 2001/07/29 19:07:27 skimo Exp $ (Berkeley) $Date: 2001/07/29 19:07:27 $"; +static const char sccsid[] = "$Id: cl_main.c,v 10.55 2011/08/15 19:52:28 zy Exp $ (Berkeley) $Date: 2011/08/15 19:52:28 $"; #endif /* not lint */ #include @@ -139,10 +139,8 @@ * XXX * Reset the X11 xterm icon/window name. */ - if (F_ISSET(clp, CL_RENAME)) { - (void)printf(XTERM_RENAME, ttype); - (void)fflush(stdout); - } + if (F_ISSET(clp, CL_RENAME)) + cl_setname(gp, clp->oname); /* If a killer signal arrived, pretend we just got it. */ if (clp->killersig) { @@ -153,6 +151,8 @@ /* Free the global and CL private areas. */ #if defined(DEBUG) || defined(PURIFY) || defined(LIBRARY) + if (clp->oname != NULL) + free(clp->oname); free(clp); free(gp); #endif Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/extern.h ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/extern.h Wed Aug 17 03:44:47 2011 (r225176) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/extern.h Wed Aug 17 05:24:00 2011 (r225177) @@ -42,6 +42,7 @@ int cl_move __P((SCR *, size_t, size_t)); int cl_refresh __P((SCR *, int)); int cl_rename __P((SCR *, char *, int)); +void cl_setname __P((GS *, char *)); int cl_split __P((SCR *, SCR *)); int cl_suspend __P((SCR *, int *)); void cl_usage __P((void)); Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/common/conv.c ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/common/conv.c Wed Aug 17 03:44:47 2011 (r225176) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/common/conv.c Wed Aug 17 05:24:00 2011 (r225177) @@ -92,7 +92,7 @@ { /* XXX UTF-16 linesep hack */ if (!strncasecmp(enc, "utf-16", 6) && len % 2) - len -= 1; + str[--len] != '\0' && str++; /* shortern by 1, shift if LE */ int i = 0, j; CHAR_T **tostr = &cw->b_wc1; @@ -206,7 +206,7 @@ for (i = 0; i < len; ++i) (*tostr)[i] = str[i]; - *dst = cw->b_wc1; + *dst = cw->b_c1; return 0; } @@ -339,10 +339,16 @@ sp->conv.input2int = ie_char2int; #endif #ifdef USE_ICONV - o_set(sp, O_FILEENCODING, OS_STRDUP, nl_langinfo(CODESET), 0); o_set(sp, O_INPUTENCODING, OS_STRDUP, nl_langinfo(CODESET), 0); #endif } + /* XXX + * Do not inherit file encoding from the old screen, + * but overwrite the fileencoding option in .exrc + */ +#ifdef USE_ICONV + o_set(sp, O_FILEENCODING, OS_STRDUP, nl_langinfo(CODESET), 0); +#endif } /* Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/common/cut.h ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/common/cut.h Wed Aug 17 03:44:47 2011 (r225176) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/common/cut.h Wed Aug 17 05:24:00 2011 (r225177) @@ -6,7 +6,7 @@ * * See the LICENSE file for redistribution information. * - * $Id: cut.h,v 10.10 2011/07/16 18:06:00 zy Exp $ (Berkeley) $Date: 2011/07/16 18:06:00 $ + * $Id: cut.h,v 10.9 2000/07/22 17:31:18 skimo Exp $ (Berkeley) $Date: 2000/07/22 17:31:18 $ */ typedef struct _texth TEXTH; /* TEXT list head structure. */ @@ -16,7 +16,8 @@ struct _cb { LIST_ENTRY(_cb) q; /* Linked list of cut buffers. */ TEXTH textq; /* Linked list of TEXT structures. */ - char name; /* Cut buffer name. */ + /* XXXX Needed ? Can non ascii-chars be cut buffer names ? */ + CHAR_T name; /* Cut buffer name. */ size_t len; /* Total length of cut text. */ #define CB_LMODE 0x01 /* Cut was in line mode. */ Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/common/encoding.c ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/common/encoding.c Wed Aug 17 03:44:47 2011 (r225176) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/common/encoding.c Wed Aug 17 05:24:00 2011 (r225177) @@ -73,17 +73,17 @@ int following; if ((buf[i] & 0x20) == 0) /* 110xxxxx */ - if ((buf[1] & 0x3e)) /* C0, C1 */ + if (buf[i] > '\xc1') /* C0, C1 */ following = 1; else return -1; else if ((buf[i] & 0x10) == 0) /* 1110xxxx */ following = 2; else if ((buf[i] & 0x08) == 0) /* 11110xxx */ - if ((u_char)buf[i] < 0xf5 || 0xf7 < (u_char)buf[i]) + if (buf[i] < '\xf5') following = 3; else return -1; /* F5, F6, F7 */ else - return -1; + return -1; /* F8~FF */ for (n = 0; n < following; n++) { i++; Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/common/exf.c ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/common/exf.c Wed Aug 17 03:44:47 2011 (r225176) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/common/exf.c Wed Aug 17 05:24:00 2011 (r225177) @@ -1246,21 +1246,26 @@ int st = looks_utf16(buf, blen); if (st > 0) { char *np; - size_t nlen; db_rget(sp, 1, &p, &len); - nlen = len-2; - GET_SPACE_GOTOC(sp, np, nlen, nlen); - memcpy(sp->ep->_bom, p, 2); - memcpy(np, p+2, len-2); - db_rset(sp, 1, np, len-2); /* store w/o the BOM */ + if ((np = malloc(len-2))) { + memcpy(sp->ep->_bom, p, 2); + memcpy(np, p+2, len-2); + db_rset(sp, 1, np, len-2); /* store w/o the BOM */ + free(np); + } } - if (st == 1) + if (st == 1) { + DBT key, data; + recno_t lno; + key.data = &lno; + key.size = sizeof(lno); + !sp->ep->db->seq(sp->ep->db, &key, &data, R_LAST) && + *(char*)data.data == '\0' && sp->ep->db->del(sp->ep->db, &key, 0); o_set(sp, O_FILEENCODING, OS_STRDUP, "utf-16le", 0); - else if (st == 2) + } else if (st == 2) o_set(sp, O_FILEENCODING, OS_STRDUP, "utf-16be", 0); } /* Fallback to locale encoding */ -alloc_err:; #endif } Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/common/mark.h ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/common/mark.h Wed Aug 17 03:44:47 2011 (r225176) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/common/mark.h Wed Aug 17 05:24:00 2011 (r225177) @@ -6,7 +6,7 @@ * * See the LICENSE file for redistribution information. * - * $Id: mark.h,v 10.7 2011/07/16 18:07:30 zy Exp $ (Berkeley) $Date: 2011/07/16 18:07:30 $ + * $Id: mark.h,v 10.6 2011/07/04 14:41:51 zy Exp $ (Berkeley) $Date: 2011/07/04 14:41:51 $ */ /* @@ -31,7 +31,8 @@ LIST_ENTRY(_lmark) q; /* Linked list of marks. */ recno_t lno; /* Line number. */ size_t cno; /* Column number. */ - char name; /* Mark name. */ + /* XXXX Needed ? Can non ascii-chars be mark names ? */ + CHAR_T name; /* Mark name. */ #define MARK_DELETED 0x01 /* Mark was deleted. */ #define MARK_USERSET 0x02 /* User set this mark. */ Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/common/multibyte.h ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/common/multibyte.h Wed Aug 17 03:44:47 2011 (r225176) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/common/multibyte.h Wed Aug 17 05:24:00 2011 (r225177) @@ -33,6 +33,9 @@ typedef wchar_t CHAR_T; #define MAX_CHAR_T 0x7fffffff typedef u_int UCHAR_T; +typedef wchar_t RCHAR_T; +#define RCHAR_T_MAX ((1 << 24)-1) +#define RCHAR_BIT 24 #define STRLEN wcslen #define STRTOL wcstol @@ -50,10 +53,13 @@ typedef u_char CHAR_T; #define MAX_CHAR_T 0xff typedef u_char UCHAR_T; +typedef char RCHAR_T; +#define RCHAR_T_MAX CHAR_MAX +#define RCHAR_BIT CHAR_BIT #define STRLEN strlen -#define STRTOL strtol -#define STRTOUL strtoul +#define STRTOL(a,b,c) (strtol(a,(char**)b,c)) +#define STRTOUL(a,b,c) (strtoul(a,(char**)b,c)) #define SPRINTF snprintf #define STRCMP strcmp #define STRPBRK strpbrk Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/common/options.c ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/common/options.c Wed Aug 17 03:44:47 2011 (r225176) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/common/options.c Wed Aug 17 05:24:00 2011 (r225177) @@ -358,7 +358,7 @@ (void)SPRINTF(b2, SIZE(b2), L("directory=%s"), (s = getenv("TMPDIR")) == NULL ? _PATH_TMP : s); OI(O_TMPDIR, b2); - OI(O_ESCAPETIME, L("escapetime=1")); + OI(O_ESCAPETIME, L("escapetime=6")); OI(O_KEYTIME, L("keytime=6")); OI(O_MATCHTIME, L("matchtime=7")); (void)SPRINTF(b2, SIZE(b2), L("msgcat=%s"), _PATH_MSGCAT); Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/common/screen.h ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/common/screen.h Wed Aug 17 03:44:47 2011 (r225176) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/common/screen.h Wed Aug 17 05:24:00 2011 (r225177) @@ -107,8 +107,8 @@ #define RE_C_SUBST 0x0008 /* Compile substitute replacement. */ #define RE_C_TAG 0x0010 /* Compile ctag pattern. */ -#define RE_WSTART "[[:<:]]" /* Ex/vi: not-in-word search pattern. */ -#define RE_WSTOP "[[:>:]]" +#define RE_WSTART L("[[:<:]]") /* Ex/vi: not-in-word search pattern. */ +#define RE_WSTOP L("[[:>:]]") #define RE_WSTART_LEN (sizeof(RE_WSTART)/sizeof(CHAR_T)-1) #define RE_WSTOP_LEN (sizeof(RE_WSTOP)/sizeof(CHAR_T)-1) /* Ex/vi: flags to search routines. */ Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/docs/man/vi.1 ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/docs/man/vi.1 Wed Aug 17 03:44:47 2011 (r225176) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/docs/man/vi.1 Wed Aug 17 05:24:00 2011 (r225177) @@ -8,9 +8,9 @@ .\" .\" See the LICENSE file for redistribution information. .\" -.\" $Id: vi.1,v 8.54 2011/07/14 00:25:04 zy Exp $ (Berkeley) $Date: 2011/07/14 00:25:04 $ +.\" $Id: vi.1,v 8.55 2011/08/16 12:31:39 zy Exp $ (Berkeley) $Date: 2011/08/16 12:31:39 $ .\" -.TH VI 1 "%Q%" +.TH VI 1 "16 August, 2011" .UC .SH NAME ex, vi, view \- text editors @@ -1380,8 +1380,7 @@ Set the window size for the screen. .TP .B "windowname [off]" -Change the icon/window name to the current file name even if it can't -be restored on editor exit. +Change the icon/window name to the current file name. .TP .B "wraplen, wl [0]" .I \&Vi @@ -1592,14 +1591,7 @@ source for all of these documents is distributed with .I nex/nvi in the -.I nvi/USD.doc -directory of the -.I nex/nvi -source code. -.sp -The files ``autowrite'', ``input'', ``quoting'' and ``structures'' -found in the -.I nvi/docs/internals +.I nvi/docs directory of the .I nex/nvi source code. Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex.h ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex.h Wed Aug 17 03:44:47 2011 (r225176) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex.h Wed Aug 17 05:24:00 2011 (r225177) @@ -133,7 +133,7 @@ #define E_C_PRINT 0x01000 /* p flag. */ u_int16_t iflags; /* User input information. */ -#define __INUSE2 0x000004ff /* Same name space as EXCMDLIST. */ +#define __INUSE2 0x000007ff /* Same name space as EXCMDLIST. */ #define E_BLIGNORE 0x00000800 /* Ignore blank lines. */ #define E_NAMEDISCARD 0x00001000 /* Free/discard the name. */ #define E_NOAUTO 0x00002000 /* Don't do autoprint output. */ Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_version.c ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_version.c Wed Aug 17 03:44:47 2011 (r225176) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_version.c Wed Aug 17 05:24:00 2011 (r225177) @@ -32,6 +32,7 @@ int ex_version(SCR *sp, EXCMD *cmdp) { - msgq(sp, M_INFO, VI_VERSION); + msgq(sp, M_INFO, "Version "VI_VERSION + " The CSRG, University of California, Berkeley."); return (0); } Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_write.c ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_write.c Wed Aug 17 03:44:47 2011 (r225176) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_write.c Wed Aug 17 05:24:00 2011 (r225177) @@ -318,7 +318,11 @@ lcnt = 0; msg = "253|Writing..."; +#if defined(USE_WIDECHAR) && defined(USE_ICONV) isutf16 = !strncasecmp(O_STR(sp, O_FILEENCODING), "utf-16", 6); +#else + isutf16 = 0; +#endif if (tline != 0) { if (sp->ep->bom && fwrite(&sp->ep->bom, 2, 1, fp) != 1) @@ -340,9 +344,14 @@ if (fwrite(f, 1, flen, fp) != flen) goto err; ccnt += len; - if (isutf16 && putc('\0', fp) != '\0') - break; /* UTF-16 uses '000a' as EOL */ - if (putc('\n', fp) != '\n') + /* UTF-16 w/o BOM is big-endian */ + if (isutf16 && sp->ep->_bom[0] != '\xff') { /* UTF-16BE */ + if (fwrite("\0\x0a", 1, 2, fp) != 2) + break; + } else if (sp->ep->_bom[0] == '\xff') { /* UTF-16LE */ + if (fwrite("\x0a\0", 1, 2, fp) != 2) + break; + } else if (putc('\n', fp) != '\n') break; ++ccnt; } Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/version.h ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/version.h Wed Aug 17 03:44:47 2011 (r225176) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/version.h Wed Aug 17 05:24:00 2011 (r225177) @@ -1,2 +1 @@ -#define VI_VERSION \ - "nvi-2.0.0 (2011/07/11) The CSRG, University of California, Berkeley." +#define VI_VERSION "nvi-2.0.1 (2011-08-16)" Added: soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/COPYRIGHT ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/COPYRIGHT Wed Aug 17 05:24:00 2011 (r225177) @@ -0,0 +1,56 @@ +Copyright 1992, 1993, 1994 Henry Spencer. All rights reserved. +This software is not subject to any license of the American Telephone +and Telegraph Company or of the Regents of the University of California. + +Permission is granted to anyone to use this software for any purpose on +any computer system, and to alter it and redistribute it, subject +to the following restrictions: + +1. The author is not responsible for the consequences of use of this + software, no matter how awful, even if they arise from flaws in it. + +2. The origin of this software must not be misrepresented, either by + explicit claim or by omission. Since few users ever read sources, + credits must appear in the documentation. + +3. Altered versions must be plainly marked as such, and must not be + misrepresented as being the original software. Since few users + ever read sources, credits must appear in the documentation. + +4. This notice may not be removed or altered. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= +/*- + * Copyright (c) 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)COPYRIGHT 8.1 (Berkeley) 3/16/94 + */ Added: soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/WHATSNEW ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/WHATSNEW Wed Aug 17 05:24:00 2011 (r225177) @@ -0,0 +1,94 @@ +# @(#)WHATSNEW 8.3 (Berkeley) 3/18/94 + +New in alpha3.4: The complex bug alluded to below has been fixed (in a +slightly kludgey temporary way that may hurt efficiency a bit; this is +another "get it out the door for 4.4" release). The tests at the end of +the tests file have accordingly been uncommented. The primary sign of +the bug was that something like a?b matching ab matched b rather than ab. +(The bug was essentially specific to this exact situation, else it would +have shown up earlier.) + +New in alpha3.3: The definition of word boundaries has been altered +slightly, to more closely match the usual programming notion that "_" +is an alphabetic. Stuff used for pre-ANSI systems is now in a subdir, +and the makefile no longer alludes to it in mysterious ways. The +makefile has generally been cleaned up some. Fixes have been made +(again!) so that the regression test will run without -DREDEBUG, at +the cost of weaker checking. A workaround for a bug in some folks' + has been added. And some more things have been added to +tests, including a couple right at the end which are commented out +because the code currently flunks them (complex bug; fix coming). +Plus the usual minor cleanup. + +New in alpha3.2: Assorted bits of cleanup and portability improvement +(the development base is now a BSDI system using GCC instead of an ancient +Sun system, and the newer compiler exposed some glitches). Fix for a +serious bug that affected REs using many [] (including REG_ICASE REs +because of the way they are implemented), *sometimes*, depending on +memory-allocation patterns. The header-file prototypes no longer name +the parameters, avoiding possible name conflicts. The possibility that +some clot has defined CHAR_MIN as (say) `-128' instead of `(-128)' is +now handled gracefully. "uchar" is no longer used as an internal type +name (too many people have the same idea). Still the same old lousy +performance, alas. + +New in alpha3.1: Basically nothing, this release is just a bookkeeping +convenience. Stay tuned. + +New in alpha3.0: Performance is no better, alas, but some fixes have been +made and some functionality has been added. (This is basically the "get +it out the door in time for 4.4" release.) One bug fix: regfree() didn't +free the main internal structure (how embarrassing). It is now possible +to put NULs in either the RE or the target string, using (resp.) a new +REG_PEND flag and the old REG_STARTEND flag. The REG_NOSPEC flag to +regcomp() makes all characters ordinary, so you can match a literal +string easily (this will become more useful when performance improves!). +There are now primitives to match beginnings and ends of words, although +the syntax is disgusting and so is the implementation. The REG_ATOI +debugging interface has changed a bit. And there has been considerable +internal cleanup of various kinds. + +New in alpha2.3: Split change list out of README, and moved flags notes +into Makefile. Macro-ized the name of regex(7) in regex(3), since it has +to change for 4.4BSD. Cleanup work in engine.c, and some new regression +tests to catch tricky cases thereof. + +New in alpha2.2: Out-of-date manpages updated. Regerror() acquires two +small extensions -- REG_ITOA and REG_ATOI -- which avoid debugging kludges +in my own test program and might be useful to others for similar purposes. +The regression test will now compile (and run) without REDEBUG. The +BRE \$ bug is fixed. Most uses of "uchar" are gone; it's all chars now. +Char/uchar parameters are now written int/unsigned, to avoid possible +portability problems with unpromoted parameters. Some unsigned casts have +been introduced to minimize portability problems with shifting into sign +bits. + +New in alpha2.1: Lots of little stuff, cleanup and fixes. The one big +thing is that regex.h is now generated, using mkh, rather than being +supplied in the distribution; due to circularities in dependencies, +you have to build regex.h explicitly by "make h". The two known bugs +have been fixed (and the regression test now checks for them), as has a +problem with assertions not being suppressed in the absence of REDEBUG. +No performance work yet. + +New in alpha2: Backslash-anything is an ordinary character, not an +error (except, of course, for the handful of backslashed metacharacters +in BREs), which should reduce script breakage. The regression test +checks *where* null strings are supposed to match, and has generally +been tightened up somewhat. Small bug fixes in parameter passing (not +harmful, but technically errors) and some other areas. Debugging +invoked by defining REDEBUG rather than not defining NDEBUG. + +New in alpha+3: full prototyping for internal routines, using a little +helper program, mkh, which extracts prototypes given in stylized comments. +More minor cleanup. Buglet fix: it's CHAR_BIT, not CHAR_BITS. Simple +pre-screening of input when a literal string is known to be part of the +RE; this does wonders for performance. + +New in alpha+2: minor bits of cleanup. Notably, the number "32" for the +word width isn't hardwired into regexec.c any more, the public header +file prototypes the functions if __STDC__ is defined, and some small typos +in the manpages have been fixed. + +New in alpha+1: improvements to the manual pages, and an important +extension, the REG_STARTEND option to regexec(). Added: soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/cclass.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/cclass.h Wed Aug 17 05:24:00 2011 (r225177) @@ -0,0 +1,83 @@ +/*- + * Copyright (c) 1992, 1993, 1994 Henry Spencer. + * Copyright (c) 1992, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Henry Spencer of the University of Toronto. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)cclass.h 8.2 (Berkeley) 3/16/94 + */ + +RCHAR_T ALNUM[] = {'a','l','n','u','m',0}; +RCHAR_T ALPHA[] = {'a','l','p','h','a',0}; +RCHAR_T BLANK[] = {'b','l','a','n','k',0}; +RCHAR_T CNTRL[] = {'c','n','t','r','l',0}; +RCHAR_T DIGIT[] = {'d','i','g','i','t',0}; +RCHAR_T GRAPH[] = {'g','r','a','p','h',0}; +RCHAR_T LOWER[] = {'l','o','w','e','r',0}; +RCHAR_T PRINT[] = {'p','r','i','n','t',0}; +RCHAR_T PUNCT[] = {'p','u','n','c','t',0}; +RCHAR_T SPACE[] = {'s','p','a','c','e',0}; +RCHAR_T UPPER[] = {'u','p','p','e','r',0}; +RCHAR_T XDIGIT[] = {'x','d','i','g','i','t',0}; + +/* character-class table */ +static struct cclass { + RCHAR_T *name; + char *chars; + char *multis; +} cclasses[] = { + ALNUM, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\ +0123456789", "", + ALPHA, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", + "", + BLANK, " \t", "", + CNTRL, "\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\ +\25\26\27\30\31\32\33\34\35\36\37\177", "", + DIGIT, "0123456789", "", + GRAPH, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\ +0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", + "", + LOWER, "abcdefghijklmnopqrstuvwxyz", + "", + PRINT, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\ +0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ ", + "", + PUNCT, "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", + "", + SPACE, "\t\n\v\f\r ", "", + UPPER, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", + "", + XDIGIT, "0123456789ABCDEFabcdef", + "", + NULL, 0, "" +}; Added: soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/cname.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/cname.h Wed Aug 17 05:24:00 2011 (r225177) @@ -0,0 +1,141 @@ +/*- + * Copyright (c) 1992, 1993, 1994 Henry Spencer. + * Copyright (c) 1992, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Henry Spencer of the University of Toronto. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)cname.h 8.2 (Berkeley) 3/16/94 + */ + +/* character-name table */ +static struct cname { + RCHAR_T *name; + char code; +} cnames[] = { + L("NUL"), '\0', + L("SOH"), '\001', + L("STX"), '\002', + L("ETX"), '\003', + L("EOT"), '\004', + L("ENQ"), '\005', + L("ACK"), '\006', + L("BEL"), '\007', + L("alert"), '\007', + L("BS"), '\010', + L("backspace"), '\b', + L("HT"), '\011', + L("tab"), '\t', + L("LF"), '\012', + L("newline"), '\n', + L("VT"), '\013', + L("vertical-tab"), '\v', + L("FF"), '\014', + L("form-feed"), '\f', + L("CR"), '\015', + L("carriage-return"), '\r', + L("SO"), '\016', + L("SI"), '\017', + L("DLE"), '\020', + L("DC1"), '\021', + L("DC2"), '\022', + L("DC3"), '\023', + L("DC4"), '\024', + L("NAK"), '\025', + L("SYN"), '\026', + L("ETB"), '\027', + L("CAN"), '\030', + L("EM"), '\031', + L("SUB"), '\032', + L("ESC"), '\033', + L("IS4"), '\034', + L("FS"), '\034', + L("IS3"), '\035', + L("GS"), '\035', + L("IS2"), '\036', + L("RS"), '\036', + L("IS1"), '\037', + L("US"), '\037', + L("space"), ' ', + L("exclamation-mark"), '!', + L("quotation-mark"), '"', + L("number-sign"), '#', + L("dollar-sign"), '$', + L("percent-sign"), '%', + L("ampersand"), '&', + L("apostrophe"), '\'', + L("left-parenthesis"), '(', + L("right-parenthesis"), ')', + L("asterisk"), '*', + L("plus-sign"), '+', + L("comma"), ',', + L("hyphen"), '-', + L("hyphen-minus"), '-', + L("period"), '.', + L("full-stop"), '.', + L("slash"), '/', + L("solidus"), '/', + L("zero"), '0', + L("one"), '1', + L("two"), '2', + L("three"), '3', + L("four"), '4', + L("five"), '5', + L("six"), '6', + L("seven"), '7', + L("eight"), '8', + L("nine"), '9', + L("colon"), ':', + L("semicolon"), ';', + L("less-than-sign"), '<', + L("equals-sign"), '=', + L("greater-than-sign"), '>', + L("question-mark"), '?', + L("commercial-at"), '@', + L("left-square-bracket"), '[', + L("backslash"), '\\', + L("reverse-solidus"), '\\', + L("right-square-bracket"), ']', + L("circumflex"), '^', + L("circumflex-accent"), '^', + L("underscore"), '_', + L("low-line"), '_', + L("grave-accent"), '`', + L("left-brace"), '{', + L("left-curly-bracket"), '{', + L("vertical-line"), '|', + L("right-brace"), '}', + L("right-curly-bracket"), '}', + L("tilde"), '~', + L("DEL"), '\177', + NULL, 0, +}; Added: soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/engine.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/engine.c Wed Aug 17 05:24:00 2011 (r225177) @@ -0,0 +1,1091 @@ +/*- + * Copyright (c) 1992, 1993, 1994 Henry Spencer. + * Copyright (c) 1992, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Henry Spencer of the University of Toronto. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)engine.c 8.4 (Berkeley) 3/19/94 + */ + +/* + * The matching engine and friends. This file is #included by regexec.c + * after suitable #defines of a variety of macros used herein, so that + * different state representations can be used without duplicating masses + * of code. + */ + +#ifdef SNAMES +#define matcher smatcher +#define fast sfast +#define slow sslow +#define dissect sdissect +#define backref sbackref +#define step sstep +#define print sprint +#define at sat +#define match smat +#endif +#ifdef LNAMES +#define matcher lmatcher +#define fast lfast +#define slow lslow +#define dissect ldissect +#define backref lbackref +#define step lstep +#define print lprint +#define at lat +#define match lmat +#endif + +/* another structure passed up and down to avoid zillions of parameters */ +struct match { + struct re_guts *g; + int eflags; + regmatch_t *pmatch; /* [nsub+1] (0 element unused) */ + const RCHAR_T *offp; /* offsets work from here */ + const RCHAR_T *beginp; /* start of string -- virtual NUL precedes */ + const RCHAR_T *endp; /* end of string -- virtual NUL here */ + const RCHAR_T *coldp; /* can be no match starting before here */ + const RCHAR_T **lastpos; /* [nplus+1] */ + STATEVARS; + states st; /* current states */ + states fresh; /* states for a fresh start */ + states tmp; /* temporary */ + states empty; /* empty set of states */ +}; + +/* ========= begin header generated by ./mkh ========= */ +#ifdef __cplusplus +extern "C" { +#endif + +/* === engine.c === */ +static int matcher __P((struct re_guts *g, const RCHAR_T *string, size_t nmatch, regmatch_t pmatch[], int eflags)); +static const RCHAR_T *dissect __P((struct match *m, const RCHAR_T *start, const RCHAR_T *stop, sopno startst, sopno stopst)); +static const RCHAR_T *backref __P((struct match *m, const RCHAR_T *start, const RCHAR_T *stop, sopno startst, sopno stopst, sopno lev)); +static const RCHAR_T *fast __P((struct match *m, const RCHAR_T *start, const RCHAR_T *stop, sopno startst, sopno stopst)); +static const RCHAR_T *slow __P((struct match *m, const RCHAR_T *start, const RCHAR_T *stop, sopno startst, sopno stopst)); +static states step __P((struct re_guts *g, sopno start, sopno stop, states bef, int ch, states aft)); +#define BOL (OUT+1) +#define EOL (BOL+1) +#define BOLEOL (BOL+2) +#define NOTHING (BOL+3) +#define BOW (BOL+4) +#define EOW (BOL+5) +#define CODEMAX (BOL+5) /* highest code used */ +#define NONCHAR(c) ((c) > RCHAR_T_MAX) +#define NNONCHAR (CODEMAX-CHAR_MAX) +#ifdef REDEBUG +static void print __P((struct match *m, char *caption, states st, int ch, FILE *d)); +#endif +#ifdef REDEBUG +static void at __P((struct match *m, char *title, char *start, char *stop, sopno startst, sopno stopst)); +#endif +#ifdef REDEBUG +static char *pchar __P((int ch)); +#endif + +#ifdef __cplusplus +} +#endif +/* ========= end header generated by ./mkh ========= */ + +#ifdef REDEBUG +#define SP(t, s, c) print(m, t, s, c, stdout) +#define AT(t, p1, p2, s1, s2) at(m, t, p1, p2, s1, s2) +#define NOTE(str) { if (m->eflags®_TRACE) printf("=%s\n", (str)); } +#else +#define SP(t, s, c) /* nothing */ +#define AT(t, p1, p2, s1, s2) /* nothing */ +#define NOTE(s) /* nothing */ +#endif + +/* + - matcher - the actual matching engine *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Wed Aug 17 07:38:49 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 5CE161065673 for ; Wed, 17 Aug 2011 07:38:47 +0000 (UTC) (envelope-from zy@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 17 Aug 2011 07:38:47 +0000 Date: Wed, 17 Aug 2011 07:38:47 +0000 From: zy@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110817073847.5CE161065673@hub.freebsd.org> Cc: Subject: socsvn commit: r225179 - soc2011/zy/nvi-iconv/head/rescue/rescue X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 07:38:49 -0000 Author: zy Date: Wed Aug 17 07:38:47 2011 New Revision: 225179 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=225179 Log: Links to libcursesw if WITH_ICONV is defined. - Fixes vi (multibyte nvi2) in rescue. Modified: soc2011/zy/nvi-iconv/head/rescue/rescue/Makefile Modified: soc2011/zy/nvi-iconv/head/rescue/rescue/Makefile ============================================================================== --- soc2011/zy/nvi-iconv/head/rescue/rescue/Makefile Wed Aug 17 06:21:34 2011 (r225178) +++ soc2011/zy/nvi-iconv/head/rescue/rescue/Makefile Wed Aug 17 07:38:47 2011 (r225179) @@ -52,7 +52,7 @@ CRUNCH_PROGS_bin= cat chflags chio chmod cp date dd df echo \ ed expr getfacl hostname kenv kill ln ls mkdir mv \ pkill ps pwd realpath rm rmdir setfacl sh stty sync test -CRUNCH_LIBS+= -lcrypt -ledit -lkvm -ll -ltermcap -lutil +CRUNCH_LIBS+= -lcrypt -ledit -lkvm -ll -lutil CRUNCH_BUILDTOOLS+= bin/sh # Additional options for specific programs @@ -118,7 +118,13 @@ # crunchgen does not like C++ programs; this should be fixed someday # CRUNCH_PROGS+= devd -CRUNCH_LIBS+= -lalias -lcam -lcurses -ldevstat -lipsec +.ifdef (WITH_ICONV) +CRUNCH_LIBS+= -lcursesw +.else +CRUNCH_LIBS+= -lcurses -ltermcap +.endif + +CRUNCH_LIBS+= -lalias -lcam -ldevstat -lipsec .if ${MK_IPX} != "no" CRUNCH_LIBS+= -lipx .endif From owner-svn-soc-all@FreeBSD.ORG Wed Aug 17 07:54:47 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 376B6106564A for ; Wed, 17 Aug 2011 07:54:45 +0000 (UTC) (envelope-from zy@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 17 Aug 2011 07:54:45 +0000 Date: Wed, 17 Aug 2011 07:54:45 +0000 From: zy@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110817075445.376B6106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r225180 - in soc2011/zy/nvi-iconv/head: contrib/nvi2/ex contrib/nvi2/regex usr.bin/vi X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 07:54:47 -0000 Author: zy Date: Wed Aug 17 07:54:44 2011 New Revision: 225180 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=225180 Log: WARNS-free with either gcc or clang. Pass make buildworld. Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_print.c soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/engine.c soc2011/zy/nvi-iconv/head/usr.bin/vi/Makefile Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_print.c ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_print.c Wed Aug 17 07:38:47 2011 (r225179) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_print.c Wed Aug 17 07:54:44 2011 (r225180) @@ -116,7 +116,7 @@ */ if (LF_ISSET(E_C_HASH)) { if (from <= 999999) { - SPRINTF(buf, SIZE(buf), L("%6lu "), from); + SPRINTF(buf, SIZE(buf), L("%6u "), from); p = buf; } else p = L("TOOBIG "); Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/engine.c ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/engine.c Wed Aug 17 07:38:47 2011 (r225179) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/engine.c Wed Aug 17 07:54:44 2011 (r225180) @@ -686,6 +686,7 @@ /* "can't happen" */ assert(nope); /* NOTREACHED */ + return L("shut up clang"); } /* Modified: soc2011/zy/nvi-iconv/head/usr.bin/vi/Makefile ============================================================================== --- soc2011/zy/nvi-iconv/head/usr.bin/vi/Makefile Wed Aug 17 07:38:47 2011 (r225179) +++ soc2011/zy/nvi-iconv/head/usr.bin/vi/Makefile Wed Aug 17 07:54:44 2011 (r225180) @@ -7,7 +7,7 @@ #if using ncurses: CFLAGS+= -DSYSV_CURSES -WARNS?= 0 +WARNS?= 1 VI= nvi EX= nex From owner-svn-soc-all@FreeBSD.ORG Wed Aug 17 12:32:29 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 50C3C1065672 for ; Wed, 17 Aug 2011 12:32:27 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 17 Aug 2011 12:32:27 +0000 Date: Wed, 17 Aug 2011 12:32:27 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110817123227.50C3C1065672@hub.freebsd.org> Cc: Subject: socsvn commit: r225189 - soc2011/oleksandr/oleksandr-head/head/sys/cam X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 12:32:29 -0000 Author: oleksandr Date: Wed Aug 17 12:32:27 2011 New Revision: 225189 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=225189 Log: Review the format of errors Modified: soc2011/oleksandr/oleksandr-head/head/sys/cam/cam_periph.c Modified: soc2011/oleksandr/oleksandr-head/head/sys/cam/cam_periph.c ============================================================================== --- soc2011/oleksandr/oleksandr-head/head/sys/cam/cam_periph.c Wed Aug 17 09:52:34 2011 (r225188) +++ soc2011/oleksandr/oleksandr-head/head/sys/cam/cam_periph.c Wed Aug 17 12:32:27 2011 (r225189) @@ -1735,22 +1735,35 @@ error_flag_ret != 0) error_flag_type = DEVSTAT_ERROR_OTHER_ERROR; /* + * If function code is equal to XPT_SCSI_IO it means that the + * error information can be found in the structure sense_data. + */ + if (ccb->ccb_h.func_code == XPT_SCSI_IO && error_flag_ret != 0) { + int sense_key, error_code, asc, ascq; + scsi_extract_sense(&ccb->csio.sense_data, + &error_code, &sense_key, &asc, &ascq); + switch(sense_key) { + case SSD_KEY_RECOVERED_ERROR: + error_flag_sense = DEVSTAT_ERROR_RECOVERED; + break; + case SSD_KEY_NOT_READY: + error_flag_sense = DEVSTAT_ERROR_NOT_READY; + break; + case SSD_KEY_MEDIUM_ERROR: + error_flag_sense = DEVSTAT_ERROR_MEDIUM_ERROR; + break; + case SSD_KEY_HARDWARE_ERROR: + error_flag_sense = DEVSTAT_ERROR_HARDWARE; + break; + case SSD_KEY_ILLEGAL_REQUEST: + error_flag_sense = DEVSTAT_ERROR_ILLEGAL_REQ; + break; + } + } + /* * If an error is present, search for an appropriate structure * in devstat and increase the corresponding counter of errors. */ - int sense_key, error_code, asc, ascq; - scsi_extract_sense(&ccb->csio.sense_data, - &error_code, &sense_key, &asc, &ascq); - if (sense_key == SSD_KEY_RECOVERED_ERROR && error_flag_ret != 0) - error_flag_sense = DEVSTAT_ERROR_RECOVERED; - if (sense_key == SSD_KEY_NOT_READY && error_flag_ret != 0) - error_flag_sense = DEVSTAT_ERROR_NOT_READY; - if (sense_key == SSD_KEY_MEDIUM_ERROR && error_flag_ret != 0) - error_flag_sense = DEVSTAT_ERROR_MEDIUM_ERROR; - if (sense_key == SSD_KEY_HARDWARE_ERROR && error_flag_ret != 0) - error_flag_sense = DEVSTAT_ERROR_HARDWARE; - if (sense_key == SSD_KEY_ILLEGAL_REQUEST && error_flag_ret != 0) - error_flag_sense = DEVSTAT_ERROR_ILLEGAL_REQ; if (error_flag_ret) { if ((device_error = devstat_search( ccb->ccb_h.path->periph->periph_name, From owner-svn-soc-all@FreeBSD.ORG Wed Aug 17 17:04:07 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id E200D1065679 for ; Wed, 17 Aug 2011 17:04:04 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 17 Aug 2011 17:04:04 +0000 Date: Wed, 17 Aug 2011 17:04:04 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110817170404.E200D1065679@hub.freebsd.org> Cc: Subject: socsvn commit: r225203 - soc2011/oleksandr/oleksandr-head/head/share/man/man9 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 17:04:07 -0000 Author: oleksandr Date: Wed Aug 17 17:04:04 2011 New Revision: 225203 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=225203 Log: Review man for devstat(9) Modified: soc2011/oleksandr/oleksandr-head/head/share/man/man9/devstat.9 Modified: soc2011/oleksandr/oleksandr-head/head/share/man/man9/devstat.9 ============================================================================== --- soc2011/oleksandr/oleksandr-head/head/share/man/man9/devstat.9 Wed Aug 17 15:45:40 2011 (r225202) +++ soc2011/oleksandr/oleksandr-head/head/share/man/man9/devstat.9 Wed Aug 17 17:04:04 2011 (r225203) @@ -391,15 +391,20 @@ Statistics of disk errors determined by the following parameters: .Bd -literal -offset indent typedef enum { - DEVSTAT_ERROR_RETRIABLE = 0x01, - DEVSTAT_ERROR_NON_RETRIABLE = 0x02, - DEVSTAT_ERROR_READ_ERROR = 0x04, - DEVSTAT_ERROR_WRITE_ERROR = 0x08, - DEVSTAT_ERROR_OTHER_ERROR = 0x10 + DEVSTAT_ERROR_RETRIABLE = 0x001, + DEVSTAT_ERROR_NON_RETRIABLE = 0x002, + DEVSTAT_ERROR_READ_ERROR = 0x004, + DEVSTAT_ERROR_WRITE_ERROR = 0x008, + DEVSTAT_ERROR_OTHER_ERROR = 0x010, + DEVSTAT_ERROR_RECOVERABLE = 0x020, + DEVSTAT_ERROR_NOT_READY = 0x040, + DEVSTAT_ERROR_MEDIA_ERROR = 0x080, + DEVSTAT_ERROR_HARDWARE = 0x100, + DEVSTAT_ERROR_ILLEGAL_REQ = 0x200 } devstat_error_flags; .Ed .Pp -The number of disk errors recorded in the field of the structure +The number of disk errors recorded into the field of the structure .Nm devstat_device_error. It looks: .Bd -literal -offset indent @@ -409,6 +414,11 @@ int read_error; int write_error; int other_error; + int recoverable; + int not_ready; + int media_error; + int hardware; + int illegal_req; } devstat_device_error; .Ed .Pp From owner-svn-soc-all@FreeBSD.ORG Wed Aug 17 17:07:06 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 0F3821065675 for ; Wed, 17 Aug 2011 17:07:04 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 17 Aug 2011 17:07:04 +0000 Date: Wed, 17 Aug 2011 17:07:04 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110817170704.0F3821065675@hub.freebsd.org> Cc: Subject: socsvn commit: r225204 - soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 17:07:06 -0000 Author: oleksandr Date: Wed Aug 17 17:07:03 2011 New Revision: 225204 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=225204 Log: Modification of output Modified: soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat/iostat.8 soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat/iostat.c Modified: soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat/iostat.8 ============================================================================== --- soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat/iostat.8 Wed Aug 17 17:04:04 2011 (r225203) +++ soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat/iostat.8 Wed Aug 17 17:07:03 2011 (r225204) @@ -120,21 +120,31 @@ is also specified to enable the display of CPU or TTY statistics. .It Fl E Display device error statistics. -There are several different types of device errors. +There are types of device errors. .Pp .Bl -tag -width indent -compact .It Type of errors: -.Bl -tag -width 13n -compact -.It retriable +.Bl -tag -width 18n -compact +.It Retriable Errors are not critical -.It not_retriable +.It Not_retriable Critical errors -.It read +.It Read Read errors -.It write +.It Write Write errors -.It other +.It Other Read/write errors +.It Recoverable +Recovered errors +.It Device Not Ready +Device is not ready +.It Media +Errors appeared in the disk device +.It Hardware +Errors associated with hardware +.It Illegal Request +The request to the device was illegal .El .El .It Fl h Modified: soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat/iostat.c ============================================================================== --- soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat/iostat.c Wed Aug 17 17:04:04 2011 (r225203) +++ soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat/iostat.c Wed Aug 17 17:07:03 2011 (r225204) @@ -763,7 +763,7 @@ printf("\n"); } if (Eflag>0) - printf(" Error Device Statistics\n"); + printf(" Error Device Statistics\n"); for (dn = 0; dn < num_devices; dn++) { int di; @@ -815,18 +815,18 @@ cur.dinfo->devices[di].unit_number) == -1) err(1, "aspRintf"); printf("Device: %-8.8s Retriable: %d Non-retriable: %d " - "Read: %d Write: %d Other: %d Recovered: %d " - "Device Not Ready: %d Medium: %d Hardware: %d " - "Illegal Request: %d", + "Read: %d Write: %d Other: %d " + "Recovered: %d Device Not Ready: %d Media: %d " + "Hardware: %d Illegal Request: %d", devname, cur.dinfo->devices[di].dev_error.retriable, cur.dinfo->devices[di].dev_error.non_retriable, cur.dinfo->devices[di].dev_error.read_error, cur.dinfo->devices[di].dev_error.write_error, cur.dinfo->devices[di].dev_error.other_error, - cur.dinfo->devices[di].dev_error.recovered, + cur.dinfo->devices[di].dev_error.recoverable, cur.dinfo->devices[di].dev_error.not_ready, - cur.dinfo->devices[di].dev_error.medium_error, + cur.dinfo->devices[di].dev_error.media_error, cur.dinfo->devices[di].dev_error.hardware, cur.dinfo->devices[di].dev_error.illegal_req); printf("\n"); From owner-svn-soc-all@FreeBSD.ORG Wed Aug 17 17:14:17 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 124C31065674 for ; Wed, 17 Aug 2011 17:14:15 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 17 Aug 2011 17:14:15 +0000 Date: Wed, 17 Aug 2011 17:14:15 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110817171415.124C31065674@hub.freebsd.org> Cc: Subject: socsvn commit: r225205 - in soc2011/oleksandr/oleksandr-head/head/sys: cam kern sys X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 17:14:17 -0000 Author: oleksandr Date: Wed Aug 17 17:14:14 2011 New Revision: 225205 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=225205 Log: Change some field namew Modified: soc2011/oleksandr/oleksandr-head/head/sys/cam/cam_periph.c soc2011/oleksandr/oleksandr-head/head/sys/kern/subr_devstat.c soc2011/oleksandr/oleksandr-head/head/sys/sys/devicestat.h Modified: soc2011/oleksandr/oleksandr-head/head/sys/cam/cam_periph.c ============================================================================== --- soc2011/oleksandr/oleksandr-head/head/sys/cam/cam_periph.c Wed Aug 17 17:07:03 2011 (r225204) +++ soc2011/oleksandr/oleksandr-head/head/sys/cam/cam_periph.c Wed Aug 17 17:14:14 2011 (r225205) @@ -1744,13 +1744,13 @@ &error_code, &sense_key, &asc, &ascq); switch(sense_key) { case SSD_KEY_RECOVERED_ERROR: - error_flag_sense = DEVSTAT_ERROR_RECOVERED; + error_flag_sense = DEVSTAT_ERROR_RECOVERABLE; break; case SSD_KEY_NOT_READY: error_flag_sense = DEVSTAT_ERROR_NOT_READY; break; case SSD_KEY_MEDIUM_ERROR: - error_flag_sense = DEVSTAT_ERROR_MEDIUM_ERROR; + error_flag_sense = DEVSTAT_ERROR_MEDIA_ERROR; break; case SSD_KEY_HARDWARE_ERROR: error_flag_sense = DEVSTAT_ERROR_HARDWARE; Modified: soc2011/oleksandr/oleksandr-head/head/sys/kern/subr_devstat.c ============================================================================== --- soc2011/oleksandr/oleksandr-head/head/sys/kern/subr_devstat.c Wed Aug 17 17:07:03 2011 (r225204) +++ soc2011/oleksandr/oleksandr-head/head/sys/kern/subr_devstat.c Wed Aug 17 17:14:14 2011 (r225205) @@ -385,12 +385,12 @@ ds->dev_error.read_error++; if ((error_flag | DEVSTAT_ERROR_OTHER_ERROR) == error_flag) ds->dev_error.other_error++; - if ((error_flag | DEVSTAT_ERROR_RECOVERED) == error_flag) - ds->dev_error.recovered++; + if ((error_flag | DEVSTAT_ERROR_RECOVERABLE) == error_flag) + ds->dev_error.recoverable++; if ((error_flag | DEVSTAT_ERROR_NOT_READY) == error_flag) ds->dev_error.not_ready++; - if ((error_flag | DEVSTAT_ERROR_MEDIUM_ERROR) == error_flag) - ds->dev_error.medium_error++; + if ((error_flag | DEVSTAT_ERROR_MEDIA_ERROR) == error_flag) + ds->dev_error.media_error++; if ((error_flag | DEVSTAT_ERROR_HARDWARE) == error_flag) ds->dev_error.hardware++; if ((error_flag | DEVSTAT_ERROR_ILLEGAL_REQ) == error_flag) Modified: soc2011/oleksandr/oleksandr-head/head/sys/sys/devicestat.h ============================================================================== --- soc2011/oleksandr/oleksandr-head/head/sys/sys/devicestat.h Wed Aug 17 17:07:03 2011 (r225204) +++ soc2011/oleksandr/oleksandr-head/head/sys/sys/devicestat.h Wed Aug 17 17:14:14 2011 (r225205) @@ -103,9 +103,9 @@ DEVSTAT_ERROR_READ_ERROR = 0x004, DEVSTAT_ERROR_WRITE_ERROR = 0x008, DEVSTAT_ERROR_OTHER_ERROR = 0x010, - DEVSTAT_ERROR_RECOVERED = 0x020, + DEVSTAT_ERROR_RECOVERABLE = 0x020, DEVSTAT_ERROR_NOT_READY = 0x040, - DEVSTAT_ERROR_MEDIUM_ERROR = 0x080, + DEVSTAT_ERROR_MEDIA_ERROR = 0x080, DEVSTAT_ERROR_HARDWARE = 0x100, DEVSTAT_ERROR_ILLEGAL_REQ = 0x200 } devstat_error_flags; @@ -151,9 +151,9 @@ int read_error; int write_error; int other_error; - int recovered; + int recoverable; int not_ready; - int medium_error; + int media_error; int hardware; int illegal_req; } devstat_device_error; From owner-svn-soc-all@FreeBSD.ORG Thu Aug 18 14:33:46 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 28A751065679 for ; Thu, 18 Aug 2011 14:33:44 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 18 Aug 2011 14:33:44 +0000 Date: Thu, 18 Aug 2011 14:33:44 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110818143344.28A751065679@hub.freebsd.org> Cc: Subject: socsvn commit: r225226 - in soc2011/oleksandr/oleksandr-head/head/sys: cam kern sys X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2011 14:33:46 -0000 Author: oleksandr Date: Thu Aug 18 14:33:43 2011 New Revision: 225226 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=225226 Log: Errors associated with status func_code= XPT_ATA_IO Modified: soc2011/oleksandr/oleksandr-head/head/sys/cam/cam_periph.c soc2011/oleksandr/oleksandr-head/head/sys/kern/subr_devstat.c soc2011/oleksandr/oleksandr-head/head/sys/sys/devicestat.h Modified: soc2011/oleksandr/oleksandr-head/head/sys/cam/cam_periph.c ============================================================================== --- soc2011/oleksandr/oleksandr-head/head/sys/cam/cam_periph.c Thu Aug 18 13:33:34 2011 (r225225) +++ soc2011/oleksandr/oleksandr-head/head/sys/cam/cam_periph.c Thu Aug 18 14:33:43 2011 (r225226) @@ -1715,7 +1715,8 @@ */ if (status == CAM_REQ_CMP_ERR || status == CAM_TID_INVALID || status == CAM_SCSI_STATUS_ERROR || status == CAM_AUTOSENSE_FAIL || - status == CAM_LUN_INVALID || status == CAM_AUTOSNS_VALID) + status == CAM_LUN_INVALID || status == CAM_AUTOSNS_VALID || + status == CAM_ATA_STATUS_ERROR) error_flag_ret = DEVSTAT_ERROR_NON_RETRIABLE; /* * If the error is write error refer it to the type of write error. @@ -1736,7 +1737,7 @@ error_flag_type = DEVSTAT_ERROR_OTHER_ERROR; /* * If function code is equal to XPT_SCSI_IO it means that the - * error information can be found in the structure sense_data. + * information about error can be found in the structure sense_data. */ if (ccb->ccb_h.func_code == XPT_SCSI_IO && error_flag_ret != 0) { int sense_key, error_code, asc, ascq; @@ -1758,9 +1759,38 @@ case SSD_KEY_ILLEGAL_REQUEST: error_flag_sense = DEVSTAT_ERROR_ILLEGAL_REQ; break; + case SSD_KEY_UNIT_ATTENTION: + error_flag_sense = DEVSTAT_ERROR_UNIT_ATTENTION; + break; + case SSD_KEY_ABORTED_COMMAND: + error_flag_sense = DEVSTAT_ERROR_ABORTED_COMMAND; + break; } } /* + * If function code is equal to XPT_ATA_IO it means that the + * information about error can be found in the structure ataio.res. + */ + if (ccb->ccb_h.func_code == XPT_ATA_IO && error_flag_ret != 0) { + if ((ccb->ataio.res.status & 0x20) && (!ccb->ataio.res.error)) + error_flag_sense = DEVSTAT_ERROR_HARDWARE; + if (ccb->ataio.res.status & 0x10) { + if (ccb->ataio.res.error && 0x02) + error_flag_sense = DEVSTAT_ERROR_NOT_READY; + if ((ccb->ataio.res.error && 0x40) || + (ccb->ataio.res.error && 0x01) || + (ccb->ataio.res.error && 0x10)) + error_flag_sense = DEVSTAT_ERROR_MEDIA_ERROR; + if (ccb->ataio.res.error && 0x04) + error_flag_sense = DEVSTAT_ERROR_ILLEGAL_REQ; + if ((ccb->ataio.res.error && 0x20) || + (ccb->ataio.res.error && 0x08)) + error_flag_sense = DEVSTAT_ERROR_UNIT_ATTENTION; + if (ccb->ataio.res.error && 0x80) + error_flag_sense = DEVSTAT_ERROR_ABORTED_COMMAND; + } + } + /* * If an error is present, search for an appropriate structure * in devstat and increase the corresponding counter of errors. */ Modified: soc2011/oleksandr/oleksandr-head/head/sys/kern/subr_devstat.c ============================================================================== --- soc2011/oleksandr/oleksandr-head/head/sys/kern/subr_devstat.c Thu Aug 18 13:33:34 2011 (r225225) +++ soc2011/oleksandr/oleksandr-head/head/sys/kern/subr_devstat.c Thu Aug 18 14:33:43 2011 (r225226) @@ -395,6 +395,10 @@ ds->dev_error.hardware++; if ((error_flag | DEVSTAT_ERROR_ILLEGAL_REQ) == error_flag) ds->dev_error.illegal_req++; + if ((error_flag | DEVSTAT_ERROR_UNIT_ATTENTION) == error_flag) + ds->dev_error.illegal_req++; + if ((error_flag | DEVSTAT_ERROR_ABORTED_COMMAND) == error_flag) + ds->dev_error.aborted_command++; } /* * This is the sysctl handler for the devstat package. The data pushed out Modified: soc2011/oleksandr/oleksandr-head/head/sys/sys/devicestat.h ============================================================================== --- soc2011/oleksandr/oleksandr-head/head/sys/sys/devicestat.h Thu Aug 18 13:33:34 2011 (r225225) +++ soc2011/oleksandr/oleksandr-head/head/sys/sys/devicestat.h Thu Aug 18 14:33:43 2011 (r225226) @@ -98,16 +98,18 @@ * These flags indicates the type of disk error. */ typedef enum { - DEVSTAT_ERROR_RETRIABLE = 0x001, - DEVSTAT_ERROR_NON_RETRIABLE = 0x002, - DEVSTAT_ERROR_READ_ERROR = 0x004, - DEVSTAT_ERROR_WRITE_ERROR = 0x008, - DEVSTAT_ERROR_OTHER_ERROR = 0x010, - DEVSTAT_ERROR_RECOVERABLE = 0x020, - DEVSTAT_ERROR_NOT_READY = 0x040, - DEVSTAT_ERROR_MEDIA_ERROR = 0x080, - DEVSTAT_ERROR_HARDWARE = 0x100, - DEVSTAT_ERROR_ILLEGAL_REQ = 0x200 + DEVSTAT_ERROR_RETRIABLE = 0x001, + DEVSTAT_ERROR_NON_RETRIABLE = 0x002, + DEVSTAT_ERROR_READ_ERROR = 0x004, + DEVSTAT_ERROR_WRITE_ERROR = 0x008, + DEVSTAT_ERROR_OTHER_ERROR = 0x010, + DEVSTAT_ERROR_RECOVERABLE = 0x020, + DEVSTAT_ERROR_NOT_READY = 0x040, + DEVSTAT_ERROR_MEDIA_ERROR = 0x080, + DEVSTAT_ERROR_HARDWARE = 0x100, + DEVSTAT_ERROR_ILLEGAL_REQ = 0x200, + DEVSTAT_ERROR_UNIT_ATTENTION = 0x400, + DEVSTAT_ERROR_ABORTED_COMMAND = 0x800 } devstat_error_flags; /* * These types are intended to aid statistics gathering/display programs. @@ -156,6 +158,8 @@ int media_error; int hardware; int illegal_req; + int unit_attention; + int aborted_command; } devstat_device_error; /* * XXX: Next revision should add From owner-svn-soc-all@FreeBSD.ORG Thu Aug 18 14:54:55 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 1C0581065672 for ; Thu, 18 Aug 2011 14:54:53 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 18 Aug 2011 14:54:53 +0000 Date: Thu, 18 Aug 2011 14:54:53 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110818145453.1C0581065672@hub.freebsd.org> Cc: Subject: socsvn commit: r225227 - soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2011 14:54:55 -0000 Author: oleksandr Date: Thu Aug 18 14:54:52 2011 New Revision: 225227 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=225227 Log: Add new type of error to iostat Modified: soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat/iostat.8 soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat/iostat.c Modified: soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat/iostat.8 ============================================================================== --- soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat/iostat.8 Thu Aug 18 14:33:43 2011 (r225226) +++ soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat/iostat.8 Thu Aug 18 14:54:52 2011 (r225227) @@ -136,15 +136,19 @@ .It Other Read/write errors .It Recoverable -Recovered errors +Recovered data with retries .It Device Not Ready -Device is not ready +Medium not present .It Media -Errors appeared in the disk device +Address mark not found or logical block of address out of range .It Hardware -Errors associated with hardware +Internal target failure .It Illegal Request -The request to the device was illegal +Invalid field or parameter value invalid +.It Unit Attention +Operator medium removal request +.It Aborted Command +Command phase error .El .El .It Fl h Modified: soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat/iostat.c ============================================================================== --- soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat/iostat.c Thu Aug 18 14:33:43 2011 (r225226) +++ soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat/iostat.c Thu Aug 18 14:54:52 2011 (r225227) @@ -817,7 +817,8 @@ printf("Device: %-8.8s Retriable: %d Non-retriable: %d " "Read: %d Write: %d Other: %d " "Recovered: %d Device Not Ready: %d Media: %d " - "Hardware: %d Illegal Request: %d", + "Hardware: %d Illegal Request: %d " + "Unit Attention: %d Aborted Command: %d", devname, cur.dinfo->devices[di].dev_error.retriable, cur.dinfo->devices[di].dev_error.non_retriable, @@ -828,7 +829,9 @@ cur.dinfo->devices[di].dev_error.not_ready, cur.dinfo->devices[di].dev_error.media_error, cur.dinfo->devices[di].dev_error.hardware, - cur.dinfo->devices[di].dev_error.illegal_req); + cur.dinfo->devices[di].dev_error.illegal_req, + cur.dinfo->devices[di].dev_error.unit_attention, + cur.dinfo->devices[di].dev_error.aborted_command); printf("\n"); free(devname); } From owner-svn-soc-all@FreeBSD.ORG Thu Aug 18 17:50:57 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 60EDE1065688 for ; Thu, 18 Aug 2011 17:50:55 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 18 Aug 2011 17:50:55 +0000 Date: Thu, 18 Aug 2011 17:50:55 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110818175055.60EDE1065688@hub.freebsd.org> Cc: Subject: socsvn commit: r225240 - soc2011/oleksandr/oleksandr-head/head/share/man/man9 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2011 17:50:57 -0000 Author: oleksandr Date: Thu Aug 18 17:50:55 2011 New Revision: 225240 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=225240 Log: Some change in man devstat(9) Modified: soc2011/oleksandr/oleksandr-head/head/share/man/man9/devstat.9 Modified: soc2011/oleksandr/oleksandr-head/head/share/man/man9/devstat.9 ============================================================================== --- soc2011/oleksandr/oleksandr-head/head/share/man/man9/devstat.9 Thu Aug 18 16:57:51 2011 (r225239) +++ soc2011/oleksandr/oleksandr-head/head/share/man/man9/devstat.9 Thu Aug 18 17:50:55 2011 (r225240) @@ -391,16 +391,18 @@ Statistics of disk errors determined by the following parameters: .Bd -literal -offset indent typedef enum { - DEVSTAT_ERROR_RETRIABLE = 0x001, - DEVSTAT_ERROR_NON_RETRIABLE = 0x002, - DEVSTAT_ERROR_READ_ERROR = 0x004, - DEVSTAT_ERROR_WRITE_ERROR = 0x008, - DEVSTAT_ERROR_OTHER_ERROR = 0x010, - DEVSTAT_ERROR_RECOVERABLE = 0x020, - DEVSTAT_ERROR_NOT_READY = 0x040, - DEVSTAT_ERROR_MEDIA_ERROR = 0x080, - DEVSTAT_ERROR_HARDWARE = 0x100, - DEVSTAT_ERROR_ILLEGAL_REQ = 0x200 + DEVSTAT_ERROR_RETRIABLE = 0x001, + DEVSTAT_ERROR_NON_RETRIABLE = 0x002, + DEVSTAT_ERROR_READ_ERROR = 0x004, + DEVSTAT_ERROR_WRITE_ERROR = 0x008, + DEVSTAT_ERROR_OTHER_ERROR = 0x010, + DEVSTAT_ERROR_RECOVERABLE = 0x020, + DEVSTAT_ERROR_NOT_READY = 0x040, + DEVSTAT_ERROR_MEDIA_ERROR = 0x080, + DEVSTAT_ERROR_HARDWARE = 0x100, + DEVSTAT_ERROR_ILLEGAL_REQ = 0x200, + DEVSTAT_ERROR_UNIT_ATTENTION = 0x400, + DEVSTAT_ERROR_ABORTED_COMMAND = 0x800 } devstat_error_flags; .Ed .Pp @@ -419,6 +421,8 @@ int media_error; int hardware; int illegal_req; + int unit_attention; + int aborted_command; } devstat_device_error; .Ed .Pp From owner-svn-soc-all@FreeBSD.ORG Fri Aug 19 03:10:07 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 7EB511065672 for ; Fri, 19 Aug 2011 03:10:05 +0000 (UTC) (envelope-from xxp@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 19 Aug 2011 03:10:05 +0000 Date: Fri, 19 Aug 2011 03:10:05 +0000 From: xxp@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110819031005.7EB511065672@hub.freebsd.org> Cc: Subject: socsvn commit: r225256 - in soc2011/xxp/xxp-head: . sys/amd64/include X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2011 03:10:07 -0000 Author: xxp Date: Fri Aug 19 03:10:04 2011 New Revision: 225256 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=225256 Log: delete file log Deleted: soc2011/xxp/xxp-head/log Modified: soc2011/xxp/xxp-head/sys/amd64/include/asm.h Modified: soc2011/xxp/xxp-head/sys/amd64/include/asm.h ============================================================================== --- soc2011/xxp/xxp-head/sys/amd64/include/asm.h Fri Aug 19 02:37:13 2011 (r225255) +++ soc2011/xxp/xxp-head/sys/amd64/include/asm.h Fri Aug 19 03:10:04 2011 (r225256) @@ -59,25 +59,35 @@ #define _START_ENTRY .text; .p2align 4,0x90 #define _ENTRY(x) _START_ENTRY; \ - .globl CNAME(x); .type CNAME(x),@function; CNAME(x): + .globl CNAME(x); .type CNAME(x),@function; CNAME(x):; \ + cfi_startproc; #ifdef PROF #define ALTENTRY(x) _ENTRY(x); \ - pushq %rbp; movq %rsp,%rbp; \ + pushq %rbp;\ + cfi_adjust_cfa_offset(8); \ + movq %rsp,%rbp; \ + cfi_def_cfa_register(%rbp); \ call PIC_PLT(HIDENAME(mcount)); \ popq %rbp; \ + cfi_def_cfa(%rsp,4); \ jmp 9f #define ENTRY(x) _ENTRY(x); \ - pushq %rbp; movq %rsp,%rbp; \ + pushq %rbp; \ + cfi_adjust_cfa_offset(8); \ + movq %rsp,%rbp; \ + cfi_def_cfa_register(%rbp); \ call PIC_PLT(HIDENAME(mcount)); \ popq %rbp; \ + cfi_def_cfa(%rsp,4); \ 9: #else #define ALTENTRY(x) _ENTRY(x) #define ENTRY(x) _ENTRY(x) #endif -#define END(x) .size x, . - x +#define END(x) cfi_endproc; \ + .size x, . - x #define RCSID(x) .text; .asciz x From owner-svn-soc-all@FreeBSD.ORG Fri Aug 19 09:26:51 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 05BAD1065670 for ; Fri, 19 Aug 2011 09:26:49 +0000 (UTC) (envelope-from xxp@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 19 Aug 2011 09:26:49 +0000 Date: Fri, 19 Aug 2011 09:26:49 +0000 From: xxp@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110819092649.05BAD1065670@hub.freebsd.org> Cc: Subject: socsvn commit: r225262 - in soc2011/xxp/xxp-head/lib: libc/amd64/gen libthr/arch/amd64/amd64 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2011 09:26:51 -0000 Author: xxp Date: Fri Aug 19 09:26:48 2011 New Revision: 225262 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=225262 Log: Review amd64. Modified: soc2011/xxp/xxp-head/lib/libc/amd64/gen/rfork_thread.S soc2011/xxp/xxp-head/lib/libc/amd64/gen/setjmp.S soc2011/xxp/xxp-head/lib/libc/amd64/gen/sigsetjmp.S soc2011/xxp/xxp-head/lib/libthr/arch/amd64/amd64/_umtx_op_err.S Modified: soc2011/xxp/xxp-head/lib/libc/amd64/gen/rfork_thread.S ============================================================================== --- soc2011/xxp/xxp-head/lib/libc/amd64/gen/rfork_thread.S Fri Aug 19 08:29:10 2011 (r225261) +++ soc2011/xxp/xxp-head/lib/libc/amd64/gen/rfork_thread.S Fri Aug 19 09:26:48 2011 (r225262) @@ -47,10 +47,14 @@ ENTRY(rfork_thread) pushq %rbx cfi_adjust_cfa_offset(8) + cfi_rel_offset(%rbx, 0) pushq %r12 cfi_adjust_cfa_offset(8) + cfi_rel_offset(%r12, 0) movq %rdx, %rbx + cfi_register(%rdx, %rbx) movq %rcx, %r12 + cfi_register(%rcx, %r12) /* * Prepare and execute the thread creation syscall @@ -66,8 +70,10 @@ jnz 1f popq %r12 cfi_adjust_cfa_offset(-8) + cfi_restore(%r12) popq %rbx cfi_adjust_cfa_offset(-8) + cfi_restore(%rbx) ret /* @@ -77,7 +83,9 @@ */ 1: movq %rsi, %rsp + cfi_register(%rsi, %rsp) movq %r12, %rdi + cfi_register(%r12, %rdi) call *%rbx movl %eax, %edi @@ -97,8 +105,10 @@ 2: popq %r12 cfi_adjust_cfa_offset(-8) + cfi_restore(%r12) popq %rbx cfi_adjust_cfa_offset(-8) + cfi_restore(%rbx) #ifdef PIC movq PIC_GOT(HIDENAME(cerror)), %rdx jmp *%rdx Modified: soc2011/xxp/xxp-head/lib/libc/amd64/gen/setjmp.S ============================================================================== --- soc2011/xxp/xxp-head/lib/libc/amd64/gen/setjmp.S Fri Aug 19 08:29:10 2011 (r225261) +++ soc2011/xxp/xxp-head/lib/libc/amd64/gen/setjmp.S Fri Aug 19 09:26:48 2011 (r225262) @@ -51,14 +51,18 @@ ENTRY(setjmp) pushq %rdi cfi_adjust_cfa_offset(8) + cfi_rel_offset(%rdi, 0) movq %rdi,%rcx + cfi_register(%rdi, %rcx) movq $1,%rdi /* SIG_BLOCK */ movq $0,%rsi /* (sigset_t*)set */ leaq 72(%rcx),%rdx /* 9,10; (sigset_t*)oset */ call PIC_PLT(CNAME(_sigprocmask)) popq %rdi cfi_adjust_cfa_offset(-8) + cfi_restore(%rdi) movq %rdi,%rcx + cfi_register(%rdi, %rcx) movq 0(%rsp),%rdx /* retval */ movq %rdx, 0(%rcx) /* 0; retval */ movq %rbx, 8(%rcx) /* 1; rbx */ Modified: soc2011/xxp/xxp-head/lib/libc/amd64/gen/sigsetjmp.S ============================================================================== --- soc2011/xxp/xxp-head/lib/libc/amd64/gen/sigsetjmp.S Fri Aug 19 08:29:10 2011 (r225261) +++ soc2011/xxp/xxp-head/lib/libc/amd64/gen/sigsetjmp.S Fri Aug 19 09:26:48 2011 (r225262) @@ -59,14 +59,18 @@ jz 2f pushq %rdi cfi_adjust_cfa_offset(8) + cfi_rel_offset(%rdi, 0) movq %rdi,%rcx + cfi_register(%rdi, %rcx) movq $1,%rdi /* SIG_BLOCK */ movq $0,%rsi /* (sigset_t*)set */ leaq 72(%rcx),%rdx /* 9,10 (sigset_t*)oset */ call PIC_PLT(CNAME(_sigprocmask)) popq %rdi cfi_adjust_cfa_offset(-8) + cfi_restore(%rdi) 2: movq %rdi,%rcx + cfi_register(%rdi, %rcx) movq 0(%rsp),%rdx /* retval */ movq %rdx, 0(%rcx) /* 0; retval */ movq %rbx, 8(%rcx) /* 1; rbx */ @@ -87,20 +91,27 @@ cmpl $0,88(%rdi) jz 2f movq %rdi,%rdx + cfi_register(%rdi, %rdx) pushq %rdi cfi_adjust_cfa_offset(8) + cfi_rel_offset(%rdi, 0) pushq %rsi cfi_adjust_cfa_offset(8) + cfi_rel_offset(%rsi, 0) movq $3,%rdi /* SIG_SETMASK */ leaq 72(%rdx),%rsi /* (sigset_t*)set */ movq $0,%rdx /* (sigset_t*)oset */ call PIC_PLT(CNAME(_sigprocmask)) popq %rsi cfi_adjust_cfa_offset(-8) + cfi_restore(%rsi) popq %rdi /* jmpbuf */ cfi_adjust_cfa_offset(-8) + cfi_restore(%rdi) 2: movq %rdi,%rdx + cfi_register(%rdi, %rdx) movq %rsi,%rax /* retval */ + cfi_register(%rsi, %rax) movq 0(%rdx),%rcx movq 8(%rdx),%rbx movq 16(%rdx),%rsp Modified: soc2011/xxp/xxp-head/lib/libthr/arch/amd64/amd64/_umtx_op_err.S ============================================================================== --- soc2011/xxp/xxp-head/lib/libthr/arch/amd64/amd64/_umtx_op_err.S Fri Aug 19 08:29:10 2011 (r225261) +++ soc2011/xxp/xxp-head/lib/libthr/arch/amd64/amd64/_umtx_op_err.S Fri Aug 19 09:26:48 2011 (r225262) @@ -32,7 +32,7 @@ #define RSYSCALL_ERR(x) ENTRY(__CONCAT(x, _err)); \ mov __CONCAT($SYS_,x),%rax; KERNCALL; ret; -#define KERNCALL movq %rcx, %r10; syscall +#define KERNCALL movq %rcx, %r10; cfi_register(%rcx, %r10); syscall RSYSCALL_ERR(_umtx_op) From owner-svn-soc-all@FreeBSD.ORG Sat Aug 20 02:14:45 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id BCE6B106564A for ; Sat, 20 Aug 2011 02:14:43 +0000 (UTC) (envelope-from xxp@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sat, 20 Aug 2011 02:14:43 +0000 Date: Sat, 20 Aug 2011 02:14:43 +0000 From: xxp@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110820021443.BCE6B106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r225284 - in soc2011/xxp/xxp-head/lib: libc/amd64/gen libc/amd64/sys libthr/arch/amd64/amd64 msun/amd64 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 02:14:46 -0000 Author: xxp Date: Sat Aug 20 02:14:43 2011 New Revision: 225284 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=225284 Log: review amd64 Modified: soc2011/xxp/xxp-head/lib/libc/amd64/gen/_setjmp.S soc2011/xxp/xxp-head/lib/libc/amd64/sys/cerror.S soc2011/xxp/xxp-head/lib/libc/amd64/sys/sbrk.S soc2011/xxp/xxp-head/lib/libthr/arch/amd64/amd64/_umtx_op_err.S soc2011/xxp/xxp-head/lib/msun/amd64/e_remainder.S soc2011/xxp/xxp-head/lib/msun/amd64/e_remainderf.S soc2011/xxp/xxp-head/lib/msun/amd64/e_remainderl.S soc2011/xxp/xxp-head/lib/msun/amd64/e_sqrtl.S soc2011/xxp/xxp-head/lib/msun/amd64/s_llrintl.S soc2011/xxp/xxp-head/lib/msun/amd64/s_logbl.S soc2011/xxp/xxp-head/lib/msun/amd64/s_lrintl.S soc2011/xxp/xxp-head/lib/msun/amd64/s_remquol.S soc2011/xxp/xxp-head/lib/msun/amd64/s_rintl.S Modified: soc2011/xxp/xxp-head/lib/libc/amd64/gen/_setjmp.S ============================================================================== --- soc2011/xxp/xxp-head/lib/libc/amd64/gen/_setjmp.S Fri Aug 19 21:59:47 2011 (r225283) +++ soc2011/xxp/xxp-head/lib/libc/amd64/gen/_setjmp.S Sat Aug 20 02:14:43 2011 (r225284) @@ -48,7 +48,7 @@ ENTRY(_setjmp) movq %rdi,%rax - cfi_register(%rdi, $rax) + cfi_register(%rdi, %rax) movq 0(%rsp),%rdx /* retval */ movq %rdx, 0(%rax) /* 0; retval */ movq %rbx, 8(%rax) /* 1; rbx */ @@ -68,7 +68,7 @@ .set CNAME(_longjmp),CNAME(___longjmp) ENTRY(___longjmp) movq %rdi,%rdx - cfi_register(%rdi, $rdx) + cfi_register(%rdi, %rdx) /* Restore the mxcsr, but leave exception flags intact. */ stmxcsr -4(%rsp) movl 68(%rdx),%eax @@ -79,7 +79,7 @@ movl %edi,-4(%rsp) ldmxcsr -4(%rsp) movq %rsi,%rax /* retval */ - cfi_register(%rsi, $rax) + cfi_register(%rsi, %rax) movq 0(%rdx),%rcx movq 8(%rdx),%rbx movq 16(%rdx),%rsp Modified: soc2011/xxp/xxp-head/lib/libc/amd64/sys/cerror.S ============================================================================== --- soc2011/xxp/xxp-head/lib/libc/amd64/sys/cerror.S Fri Aug 19 21:59:47 2011 (r225283) +++ soc2011/xxp/xxp-head/lib/libc/amd64/sys/cerror.S Sat Aug 20 02:14:43 2011 (r225284) @@ -48,6 +48,7 @@ .globl CNAME(__error) .type CNAME(__error),@function HIDENAME(cerror): + cfi_startproc pushq %rax cfi_adjust_cfa_offset(8) call PIC_PLT(CNAME(__error)) @@ -57,5 +58,6 @@ movq $-1,%rax movq $-1,%rdx ret + cfi_endproc .section .note.GNU-stack,"",%progbits Modified: soc2011/xxp/xxp-head/lib/libc/amd64/sys/sbrk.S ============================================================================== --- soc2011/xxp/xxp-head/lib/libc/amd64/sys/sbrk.S Fri Aug 19 21:59:47 2011 (r225283) +++ soc2011/xxp/xxp-head/lib/libc/amd64/sys/sbrk.S Sat Aug 20 02:14:43 2011 (r225284) @@ -51,7 +51,7 @@ pushq %rdi cfi_adjust_cfa_offset(8) movq %rdi,%rcx - cif_register(%rdi, %rcx) + cfi_register(%rdi, %rcx) #ifdef PIC movq PIC_GOT(HIDENAME(curbrk)),%rdx movq (%rdx),%rax Modified: soc2011/xxp/xxp-head/lib/libthr/arch/amd64/amd64/_umtx_op_err.S ============================================================================== --- soc2011/xxp/xxp-head/lib/libthr/arch/amd64/amd64/_umtx_op_err.S Fri Aug 19 21:59:47 2011 (r225283) +++ soc2011/xxp/xxp-head/lib/libthr/arch/amd64/amd64/_umtx_op_err.S Sat Aug 20 02:14:43 2011 (r225284) @@ -35,5 +35,6 @@ #define KERNCALL movq %rcx, %r10; cfi_register(%rcx, %r10); syscall RSYSCALL_ERR(_umtx_op) +END(_umtx_op) .section .note.GNU-stack,"",%progbits Modified: soc2011/xxp/xxp-head/lib/msun/amd64/e_remainder.S ============================================================================== --- soc2011/xxp/xxp-head/lib/msun/amd64/e_remainder.S Fri Aug 19 21:59:47 2011 (r225283) +++ soc2011/xxp/xxp-head/lib/msun/amd64/e_remainder.S Sat Aug 20 02:14:43 2011 (r225284) @@ -51,5 +51,6 @@ movsd -8(%rsp),%xmm0 fstp %st ret +END(remainder) .section .note.GNU-stack,"",%progbits Modified: soc2011/xxp/xxp-head/lib/msun/amd64/e_remainderf.S ============================================================================== --- soc2011/xxp/xxp-head/lib/msun/amd64/e_remainderf.S Fri Aug 19 21:59:47 2011 (r225283) +++ soc2011/xxp/xxp-head/lib/msun/amd64/e_remainderf.S Sat Aug 20 02:14:43 2011 (r225284) @@ -21,5 +21,6 @@ movss -4(%rsp),%xmm0 fstp %st ret +END(remainderf) .section .note.GNU-stack,"",%progbits Modified: soc2011/xxp/xxp-head/lib/msun/amd64/e_remainderl.S ============================================================================== --- soc2011/xxp/xxp-head/lib/msun/amd64/e_remainderl.S Fri Aug 19 21:59:47 2011 (r225283) +++ soc2011/xxp/xxp-head/lib/msun/amd64/e_remainderl.S Sat Aug 20 02:14:43 2011 (r225284) @@ -46,5 +46,6 @@ jne 1b fstp %st(1) ret +END(remainderl) .section .note.GNU-stack,"",%progbits Modified: soc2011/xxp/xxp-head/lib/msun/amd64/e_sqrtl.S ============================================================================== --- soc2011/xxp/xxp-head/lib/msun/amd64/e_sqrtl.S Fri Aug 19 21:59:47 2011 (r225283) +++ soc2011/xxp/xxp-head/lib/msun/amd64/e_sqrtl.S Sat Aug 20 02:14:43 2011 (r225284) @@ -31,5 +31,6 @@ fldt 8(%rsp) fsqrt ret +END(sqrtl) .section .note.GNU-stack,"",%progbits Modified: soc2011/xxp/xxp-head/lib/msun/amd64/s_llrintl.S ============================================================================== --- soc2011/xxp/xxp-head/lib/msun/amd64/s_llrintl.S Fri Aug 19 21:59:47 2011 (r225283) +++ soc2011/xxp/xxp-head/lib/msun/amd64/s_llrintl.S Sat Aug 20 02:14:43 2011 (r225284) @@ -35,5 +35,6 @@ popq %rax cfi_adjust_cfa_offset(-8) ret +END(llrintl) .section .note.GNU-stack,"",%progbits Modified: soc2011/xxp/xxp-head/lib/msun/amd64/s_logbl.S ============================================================================== --- soc2011/xxp/xxp-head/lib/msun/amd64/s_logbl.S Fri Aug 19 21:59:47 2011 (r225283) +++ soc2011/xxp/xxp-head/lib/msun/amd64/s_logbl.S Sat Aug 20 02:14:43 2011 (r225284) @@ -41,5 +41,6 @@ fxtract fstp %st ret +END(logbl) .section .note.GNU-stack,"",%progbits Modified: soc2011/xxp/xxp-head/lib/msun/amd64/s_lrintl.S ============================================================================== --- soc2011/xxp/xxp-head/lib/msun/amd64/s_lrintl.S Fri Aug 19 21:59:47 2011 (r225283) +++ soc2011/xxp/xxp-head/lib/msun/amd64/s_lrintl.S Sat Aug 20 02:14:43 2011 (r225284) @@ -35,5 +35,6 @@ popq %rax cfi_adjust_cfa_offset(-8) ret +END(lrintl) .section .note.GNU-stack,"",%progbits Modified: soc2011/xxp/xxp-head/lib/msun/amd64/s_remquol.S ============================================================================== --- soc2011/xxp/xxp-head/lib/msun/amd64/s_remquol.S Fri Aug 19 21:59:47 2011 (r225283) +++ soc2011/xxp/xxp-head/lib/msun/amd64/s_remquol.S Sat Aug 20 02:14:43 2011 (r225284) @@ -60,5 +60,6 @@ /* Store the quotient and return. */ movl %eax,(%rdi) ret +END(remquol) .section .note.GNU-stack,"",%progbits Modified: soc2011/xxp/xxp-head/lib/msun/amd64/s_rintl.S ============================================================================== --- soc2011/xxp/xxp-head/lib/msun/amd64/s_rintl.S Fri Aug 19 21:59:47 2011 (r225283) +++ soc2011/xxp/xxp-head/lib/msun/amd64/s_rintl.S Sat Aug 20 02:14:43 2011 (r225284) @@ -41,5 +41,6 @@ fldt 8(%rsp) frndint ret +END(rintl) .section .note.GNU-stack,"",%progbits From owner-svn-soc-all@FreeBSD.ORG Sat Aug 20 02:23:57 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id E48F0106564A for ; Sat, 20 Aug 2011 02:23:56 +0000 (UTC) (envelope-from xxp@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sat, 20 Aug 2011 02:23:56 +0000 Date: Sat, 20 Aug 2011 02:23:56 +0000 From: xxp@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110820022356.E48F0106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r225285 - soc2011/xxp/test X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 02:23:58 -0000 Author: xxp Date: Sat Aug 20 02:23:56 2011 New Revision: 225285 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=225285 Log: make new dir test Added: soc2011/xxp/test/ From owner-svn-soc-all@FreeBSD.ORG Sat Aug 20 02:31:48 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id A08B4106566B for ; Sat, 20 Aug 2011 02:31:46 +0000 (UTC) (envelope-from xxp@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sat, 20 Aug 2011 02:31:46 +0000 Date: Sat, 20 Aug 2011 02:31:46 +0000 From: xxp@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110820023146.A08B4106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r225286 - in soc2011/xxp/test: . config lib testscripts X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 02:31:48 -0000 Author: xxp Date: Sat Aug 20 02:31:46 2011 New Revision: 225286 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=225286 Log: add test files Added: soc2011/xxp/test/clean.sh (contents, props changed) soc2011/xxp/test/config/ soc2011/xxp/test/config/arm-ice.exp soc2011/xxp/test/config/cfdbug.exp soc2011/xxp/test/config/cygmon.exp soc2011/xxp/test/config/d10v.exp soc2011/xxp/test/config/default.exp soc2011/xxp/test/config/dve.exp soc2011/xxp/test/config/gdbserver.exp soc2011/xxp/test/config/h8300.exp soc2011/xxp/test/config/i386-bozo.exp soc2011/xxp/test/config/i960.exp soc2011/xxp/test/config/m32r-stub.exp soc2011/xxp/test/config/m32r.exp soc2011/xxp/test/config/mips-idt.exp soc2011/xxp/test/config/mips.exp soc2011/xxp/test/config/mn10300-eval.exp soc2011/xxp/test/config/monitor.exp soc2011/xxp/test/config/proelf.exp soc2011/xxp/test/config/rom68k.exp soc2011/xxp/test/config/sh.exp soc2011/xxp/test/config/sid.exp soc2011/xxp/test/config/sim.exp soc2011/xxp/test/config/slite.exp soc2011/xxp/test/config/unix.exp soc2011/xxp/test/config/vr4300.exp soc2011/xxp/test/config/vr5000.exp soc2011/xxp/test/config/vx.exp soc2011/xxp/test/config/vxworks.exp soc2011/xxp/test/config/vxworks29k.exp soc2011/xxp/test/lib/ soc2011/xxp/test/lib/ada.exp soc2011/xxp/test/lib/cell.exp soc2011/xxp/test/lib/compiler.c soc2011/xxp/test/lib/compiler.cc soc2011/xxp/test/lib/cp-support.exp soc2011/xxp/test/lib/gdb.exp soc2011/xxp/test/lib/gdbserver-support.exp soc2011/xxp/test/lib/java.exp soc2011/xxp/test/lib/mi-support.exp soc2011/xxp/test/lib/pascal.exp soc2011/xxp/test/lib/prelink-support.exp soc2011/xxp/test/lib/set_unbuffered_mode.c soc2011/xxp/test/lib/trace-support.exp soc2011/xxp/test/run_test.sh (contents, props changed) soc2011/xxp/test/site.exp soc2011/xxp/test/testscripts/ soc2011/xxp/test/testscripts/bcmp.c soc2011/xxp/test/testscripts/bcmp.exp soc2011/xxp/test/testscripts/bcopy.c soc2011/xxp/test/testscripts/bcopy.exp soc2011/xxp/test/testscripts/bzero.c soc2011/xxp/test/testscripts/bzero.exp soc2011/xxp/test/testscripts/ceil.c soc2011/xxp/test/testscripts/ceil.exp soc2011/xxp/test/testscripts/ceilf.c soc2011/xxp/test/testscripts/ceilf.exp soc2011/xxp/test/testscripts/ceill.c soc2011/xxp/test/testscripts/ceill.exp soc2011/xxp/test/testscripts/copysign.c soc2011/xxp/test/testscripts/copysign.exp soc2011/xxp/test/testscripts/copysignf.c soc2011/xxp/test/testscripts/copysignf.exp soc2011/xxp/test/testscripts/copysignl.c soc2011/xxp/test/testscripts/copysignl.exp soc2011/xxp/test/testscripts/cos.c soc2011/xxp/test/testscripts/cos.exp soc2011/xxp/test/testscripts/exp.c soc2011/xxp/test/testscripts/exp.exp soc2011/xxp/test/testscripts/ffs.c soc2011/xxp/test/testscripts/ffs.exp soc2011/xxp/test/testscripts/finite.c soc2011/xxp/test/testscripts/finite.exp soc2011/xxp/test/testscripts/floor.c soc2011/xxp/test/testscripts/floor.exp soc2011/xxp/test/testscripts/floorf.c soc2011/xxp/test/testscripts/floorf.exp soc2011/xxp/test/testscripts/floorl.c soc2011/xxp/test/testscripts/floorl.exp soc2011/xxp/test/testscripts/fmod.c soc2011/xxp/test/testscripts/fmod.exp soc2011/xxp/test/testscripts/index.c soc2011/xxp/test/testscripts/index.exp soc2011/xxp/test/testscripts/llrint.c soc2011/xxp/test/testscripts/llrint.exp soc2011/xxp/test/testscripts/llrintf.c soc2011/xxp/test/testscripts/llrintf.exp soc2011/xxp/test/testscripts/log.c soc2011/xxp/test/testscripts/log.exp soc2011/xxp/test/testscripts/log10.c soc2011/xxp/test/testscripts/log10.exp soc2011/xxp/test/testscripts/log10f.c soc2011/xxp/test/testscripts/log10f.exp soc2011/xxp/test/testscripts/logb.c soc2011/xxp/test/testscripts/logb.exp soc2011/xxp/test/testscripts/logbf.c soc2011/xxp/test/testscripts/logbf.exp soc2011/xxp/test/testscripts/logbl.c soc2011/xxp/test/testscripts/logbl.exp soc2011/xxp/test/testscripts/logf.c soc2011/xxp/test/testscripts/logf.exp soc2011/xxp/test/testscripts/lrint.c soc2011/xxp/test/testscripts/lrint.exp soc2011/xxp/test/testscripts/lrintf.c soc2011/xxp/test/testscripts/lrintf.exp soc2011/xxp/test/testscripts/lrintl.c soc2011/xxp/test/testscripts/lrintl.exp soc2011/xxp/test/testscripts/memchr.c soc2011/xxp/test/testscripts/memchr.exp soc2011/xxp/test/testscripts/memcmp.c soc2011/xxp/test/testscripts/memcmp.exp soc2011/xxp/test/testscripts/memcpy.c soc2011/xxp/test/testscripts/memcpy.exp soc2011/xxp/test/testscripts/memmove.c soc2011/xxp/test/testscripts/memmove.exp soc2011/xxp/test/testscripts/memset.c soc2011/xxp/test/testscripts/memset.exp soc2011/xxp/test/testscripts/remainder.c soc2011/xxp/test/testscripts/remainder.exp soc2011/xxp/test/testscripts/remainderf.c soc2011/xxp/test/testscripts/remainderf.exp soc2011/xxp/test/testscripts/remquo.c soc2011/xxp/test/testscripts/remquo.exp soc2011/xxp/test/testscripts/remquof.c soc2011/xxp/test/testscripts/remquof.exp soc2011/xxp/test/testscripts/remquol.c soc2011/xxp/test/testscripts/remquol.exp soc2011/xxp/test/testscripts/rindex.c soc2011/xxp/test/testscripts/rindex.exp soc2011/xxp/test/testscripts/rint.c soc2011/xxp/test/testscripts/rint.exp soc2011/xxp/test/testscripts/rintf.c soc2011/xxp/test/testscripts/rintf.exp soc2011/xxp/test/testscripts/rintl.c soc2011/xxp/test/testscripts/rintl.exp soc2011/xxp/test/testscripts/scalbn.c soc2011/xxp/test/testscripts/scalbn.exp soc2011/xxp/test/testscripts/scalbnf.c soc2011/xxp/test/testscripts/scalbnf.exp soc2011/xxp/test/testscripts/scalbnl.c soc2011/xxp/test/testscripts/scalbnl.exp soc2011/xxp/test/testscripts/significand.c soc2011/xxp/test/testscripts/significand.exp soc2011/xxp/test/testscripts/significandf.c soc2011/xxp/test/testscripts/significandf.exp soc2011/xxp/test/testscripts/sin.c soc2011/xxp/test/testscripts/sin.exp soc2011/xxp/test/testscripts/sqrt.c soc2011/xxp/test/testscripts/sqrt.exp soc2011/xxp/test/testscripts/sqrtf.c soc2011/xxp/test/testscripts/sqrtf.exp soc2011/xxp/test/testscripts/sqrtl.c soc2011/xxp/test/testscripts/sqrtl.exp soc2011/xxp/test/testscripts/strcat.c soc2011/xxp/test/testscripts/strcat.exp soc2011/xxp/test/testscripts/strchr.c soc2011/xxp/test/testscripts/strchr.exp soc2011/xxp/test/testscripts/strcmp.c soc2011/xxp/test/testscripts/strcmp.exp soc2011/xxp/test/testscripts/strncmp.c soc2011/xxp/test/testscripts/strncmp.exp soc2011/xxp/test/testscripts/swab.c soc2011/xxp/test/testscripts/swab.exp soc2011/xxp/test/testscripts/tan.c soc2011/xxp/test/testscripts/tan.exp soc2011/xxp/test/testscripts/trunc.c soc2011/xxp/test/testscripts/trunc.exp soc2011/xxp/test/testscripts/truncf.c soc2011/xxp/test/testscripts/truncf.exp soc2011/xxp/test/testscripts/truncl.c soc2011/xxp/test/testscripts/truncl.exp soc2011/xxp/test/testscripts/wcschr.c soc2011/xxp/test/testscripts/wcschr.exp soc2011/xxp/test/testscripts/wcscmp.c soc2011/xxp/test/testscripts/wcscmp.exp soc2011/xxp/test/testscripts/wcslen.c soc2011/xxp/test/testscripts/wcslen.exp soc2011/xxp/test/testscripts/wmemchr.c soc2011/xxp/test/testscripts/wmemchr.exp Added: soc2011/xxp/test/clean.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/xxp/test/clean.sh Sat Aug 20 02:31:46 2011 (r225286) @@ -0,0 +1,6 @@ + + +EXECUTABLES="bcmp bcopy bzero ceil ceilf ceill copysign copysignf copysignl cos exp ffs finite floor floorf floorl fmod index llrint llrintf log log10 log10f logb logbf logbl logf lrint lrintf lrintl memchr memcmp memcpy memmove memset remainder remainderf remquo remquof remquol rindex rint rintf rintl scalbn scalbnf scalbnl significand significandf sin sqrt sqrtf sqrtl strcat strchr strcmp strncmp swab tan trunc truncf truncl wcschr wcscmp wcslen wmemchr" + +cd testscripts +rm -f $EXECUTABLES Added: soc2011/xxp/test/config/arm-ice.exp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/xxp/test/config/arm-ice.exp Sat Aug 20 02:31:46 2011 (r225286) @@ -0,0 +1 @@ +load_lib "../config/monitor.exp"; Added: soc2011/xxp/test/config/cfdbug.exp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/xxp/test/config/cfdbug.exp Sat Aug 20 02:31:46 2011 (r225286) @@ -0,0 +1,17 @@ +# Copyright 1997, 1999, 2007, 2008, 2009, 2010 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +load_lib "../config/monitor.exp" Added: soc2011/xxp/test/config/cygmon.exp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/xxp/test/config/cygmon.exp Sat Aug 20 02:31:46 2011 (r225286) @@ -0,0 +1 @@ +load_lib "../config/monitor.exp"; Added: soc2011/xxp/test/config/d10v.exp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/xxp/test/config/d10v.exp Sat Aug 20 02:31:46 2011 (r225286) @@ -0,0 +1,16 @@ +# Copyright (C) 1997, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +load_lib "../config/monitor.exp" Added: soc2011/xxp/test/config/default.exp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/xxp/test/config/default.exp Sat Aug 20 02:31:46 2011 (r225286) @@ -0,0 +1,16 @@ +# Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +load_lib gdb.exp Added: soc2011/xxp/test/config/dve.exp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/xxp/test/config/dve.exp Sat Aug 20 02:31:46 2011 (r225286) @@ -0,0 +1,19 @@ +# Copyright 1998, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +load_lib ../config/monitor.exp +set timeout 1000 +verbose "Timeout is now $timeout seconds" 2 + Added: soc2011/xxp/test/config/gdbserver.exp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/xxp/test/config/gdbserver.exp Sat Aug 20 02:31:46 2011 (r225286) @@ -0,0 +1,87 @@ +# Copyright 2000, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Test framework for GDB (remote protocol) using a "gdbserver", +# ie. a debug agent running as a native process on the same or +# a different host. + +# +# This module to be used for testing gdb with a "gdbserver" +# built either from libremote or from gdb/gdbserver. +# + +# +# To be addressed or set in your baseboard config file: +# +# set_board_info gdb_protocol "remote" +# Unles you have a gdbserver that uses a different protocol... +# +# set_board_info use_gdb_stub 1 +# This tells the rest of the test suite not to do things +# like "run" which don't work well on remote targets. +# +# set_board_info gdb,do_reload_on_run 1 +# Unles you have a gdbserver that can handle multiple sessions. +# +# set_board_info noargs 1 +# At present there is no provision in the remote protocol +# for passing arguments. This test framework does not +# address the issue, so it's best to set this variable +# in your baseboard configuration file. +# FIXME: there's no reason why the test harness couldn't +# pass commandline args when it spawns gdbserver. +# +# set_board_info gdb,noinferiorio 1 +# Neither the traditional gdbserver nor the one in libremote +# can presently capture stdout and relay it to GDB via the +# 'O' packet. This means that tests involving printf will +# fail unles you set this varibale in your baseboard +# configuration file. +# +# set_board_info gdb,no_hardware_watchpoints 1 +# Unles you have a gdbserver that supports hardware watchpoints. +# FIXME: gdb should detect if the target doesn't support them, +# and fall back to using software watchpoints. +# +# set_board_info gdb_server_prog +# This will be the path to the gdbserver program you want to test. +# Defaults to "gdbserver". +# +# set_board_info sockethost +# The name of the host computer whose socket is being used. +# Defaults to "localhost". Note: old gdbserver requires +# that you define this, but libremote/gdbserver does not. +# +# set_board_info gdb,socketport +# Port id to use for socket connection. If not set explicitly, +# it will start at "2345" and increment for each use. +# + +# The guts live in gdbserver-support.exp now. + +load_lib gdbserver-support.exp + +proc gdbserver_gdb_load { } { + return [gdbserver_spawn ""] +} + +proc gdb_reload { } { + return [gdbserver_run ""] +} + +proc gdb_reconnect { } { + return [gdbserver_reconnect] +} Added: soc2011/xxp/test/config/h8300.exp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/xxp/test/config/h8300.exp Sat Aug 20 02:31:46 2011 (r225286) @@ -0,0 +1 @@ +load_lib "../config/monitor.exp"; Added: soc2011/xxp/test/config/i386-bozo.exp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/xxp/test/config/i386-bozo.exp Sat Aug 20 02:31:46 2011 (r225286) @@ -0,0 +1 @@ +load_lib "../config/monitor.exp" Added: soc2011/xxp/test/config/i960.exp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/xxp/test/config/i960.exp Sat Aug 20 02:31:46 2011 (r225286) @@ -0,0 +1,16 @@ +# Copyright 1997, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +load_lib ../config/monitor.exp Added: soc2011/xxp/test/config/m32r-stub.exp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/xxp/test/config/m32r-stub.exp Sat Aug 20 02:31:46 2011 (r225286) @@ -0,0 +1 @@ +load_lib "../../testsuite/config/sparclet.exp" Added: soc2011/xxp/test/config/m32r.exp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/xxp/test/config/m32r.exp Sat Aug 20 02:31:46 2011 (r225286) @@ -0,0 +1,19 @@ +# Copyright 1997, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +load_lib ../config/monitor.exp +set timeout 120 +verbose "Timeout is now $timeout seconds" 2 + Added: soc2011/xxp/test/config/mips-idt.exp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/xxp/test/config/mips-idt.exp Sat Aug 20 02:31:46 2011 (r225286) @@ -0,0 +1,17 @@ +# Copyright (C) 1993, 1997, 2007, 2008, 2009, 2010 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +load_lib ../config/monitor.exp Added: soc2011/xxp/test/config/mips.exp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/xxp/test/config/mips.exp Sat Aug 20 02:31:46 2011 (r225286) @@ -0,0 +1,17 @@ +# Copyright (C) 1993, 1997, 2007, 2008, 2009, 2010 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +load_lib ../config/monitor.exp Added: soc2011/xxp/test/config/mn10300-eval.exp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/xxp/test/config/mn10300-eval.exp Sat Aug 20 02:31:46 2011 (r225286) @@ -0,0 +1,19 @@ +# Copyright 1998, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +load_lib ../config/monitor.exp +set timeout 1000 +verbose "Timeout is now $timeout seconds" 2 + Added: soc2011/xxp/test/config/monitor.exp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/xxp/test/config/monitor.exp Sat Aug 20 02:31:46 2011 (r225286) @@ -0,0 +1,259 @@ +# Test Framework Driver for GDB driving a ROM monitor (via monitor.c). +# Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2007, 2008, 2009, 2010 +# Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +load_lib gdb.exp +# puts "***** DID USE MONITOR ******" + +# +# gdb_target_cmd +# Send gdb the "target" command +# +proc gdb_target_cmd { targetname serialport } { + global gdb_prompt + + for {set i 1} {$i <= 3} {incr i} { + send_gdb "target $targetname $serialport\n" + gdb_expect 60 { + -re "A program is being debugged already.*ill it.*y or n. $" { + send_gdb "y\n"; + exp_continue; + } + -re "Couldn't establish connection to remote.*$gdb_prompt" { + verbose "Connection failed"; + } + -re "Remote MIPS debugging.*$gdb_prompt" { + verbose "Set target to $targetname"; + return 0; + } + -re "Remote debugging using .*$serialport.*$gdb_prompt" { + verbose "Set target to $targetname"; + return 0; + } + -re "Remote target $targetname connected to.*$gdb_prompt" { + verbose "Set target to $targetname"; + return 0; + } + -re "Connected to.*$gdb_prompt" { + verbose "Set target to $targetname"; + return 0; + } + -re "Ending remote.*$gdb_prompt" { } + -re "Connection refused.*$gdb_prompt" { + verbose "Connection refused by remote target. Pausing, and trying again." + sleep 30 + continue + } + -re "Timeout reading from remote system.*$gdb_prompt" { + verbose "Got timeout error from gdb."; + } + timeout { + send_gdb ""; + break + } + } + } + return 1 +} + + + +# +# gdb_target_monitor +# Set gdb to target the monitor +# +proc gdb_target_monitor { exec_file } { + global gdb_prompt + global exit_status + global timeout + + if [target_info exists gdb_protocol] { + set targetname "[target_info gdb_protocol]" + } else { + perror "No protocol specified for [target_info name]."; + return -1; + } + if [target_info exists baud] { + gdb_test "set remotebaud [target_info baud]" "" "" + } + if [target_info exists binarydownload] { + gdb_test "set remotebinarydownload [target_info binarydownload]" "" "" + } + if { [ target_info exists disable_x_packet ] } { + gdb_test "set remote X-packet disable" "" + } + if { [ target_info exists disable_z_packet ] } { + gdb_test "set remote Z-packet disable" "" + } + if [target_info exists gdb_serial] { + set serialport "[target_info gdb_serial]"; + } elseif [target_info exists netport] { + set serialport "[target_info netport]" + } else { + set serialport "[target_info serial]" + } + + for {set j 1} {$j <= 2} {incr j} { + if [gdb_file_cmd $exec_file] { return -1; } + + if ![gdb_target_cmd $targetname $serialport] { return 0; } + + gdb_target_exec; + + if { $j == 1 && ![reboot_target] } { + break; + } + } + + perror "Couldn't set target for $targetname, port is $serialport."; + return -1; +} + +proc gdb_target_exec { } { + gdb_test "target exec" "No executable file now." "" ".*Kill it.*y or n.*" "y" + +} +# +# gdb_load -- load a file into the debugger. +# return a -1 if anything goes wrong. +# +proc gdb_load { arg } { + global verbose + global loadpath + global loadfile + global GDB + global gdb_prompt + global timeout + global last_gdb_file; + + if { $arg == "" } { + if [info exists last_gdb_file] { + set arg $last_gdb_file; + } else { + send_gdb "info files\n"; + gdb_expect 30 { + -re "Symbols from \"(\[^\"\]+)\"" { + set arg $expect_out(1,string); + exp_continue; + } + -re "Local exec file:\[\r\n\]+\[ \t\]*`(\[^'\]+)'," { + set arg $expect_out(1,string); + exp_continue; + } + -re "$gdb_prompt $" { } + } + } + } + + set last_gdb_file $arg; + + for { set j 1; } { $j <= 2 } {incr j; } { + if [target_info exists gdb,use_standard_load] { + gdb_target_exec; + if ![target_info exists gdb,no_push_conn] { + remote_push_conn host; + } + set state [remote_ld target $arg]; + if ![target_info exists gdb,no_push_conn] { + remote_close target; + remote_pop_conn host; + } + if { $state == "pass" } { + if [gdb_target_monitor $arg] { return -1; } + gdb_test "list main" ".*" "" + verbose "Loaded $arg into $GDB\n"; + return 0; + } + } else { + + if [gdb_target_monitor $arg] { return -1 } + + if [is_remote host] { + # FIXME: Multiple downloads. bleah. + set farg [remote_download host $arg]; + } else { + set farg $arg; + } + + if { $arg != "" && [target_info exists gdb_sect_offset] } { + set textoff [target_info gdb_sect_offset]; + send_gdb "sect .text $textoff\n"; + gdb_expect 30 { + -re "(0x\[0-9a-z]+) - 0x\[0-9a-z\]+ is \\.data" { + set dataoff $expect_out(1,string); + exp_continue; + } + -re "(0x\[0-9a-z\]+) - 0x\[0-9a-z\]+ is \\.bss" { + set bssoff $expect_out(1,string); + exp_continue; + } + -re "$gdb_prompt" { } + } + set dataoff [format 0x%x [expr $dataoff + $textoff]]; + set bssoff [format 0x%x [expr $bssoff + $textoff]]; + send_gdb "sect .data $dataoff\n"; + gdb_expect 30 { + -re "$gdb_prompt" { } + } + send_gdb "sect .bss $bssoff\n"; + gdb_expect 30 { + -re "$gdb_prompt" { } + } + } + + verbose "Loading $farg" + if [target_info exists gdb_load_offset] { + set command "load $farg [target_info gdb_load_offset]\n"; + } else { + set command "load $farg\n"; + } + if [target_info exists gdb_load_timeout] { + set loadtimeout [target_info gdb_load_timeout] + } else { + set loadtimeout 1600 + } + + send_gdb $command; + gdb_expect $loadtimeout { + -re "\[Ff\]ailed.*$gdb_prompt $" { + verbose "load failed"; + } + -re "Timeout reading from remote.*$gdb_prompt" { + } + -re "$gdb_prompt $" { + verbose "Loaded $farg into $GDB\n" + return 0; + } + timeout { + if { $verbose > 1 } { + perror "Timed out trying to load $farg." + } + } + } + } + + # Make sure we don't have an open connection to the target. + gdb_target_exec; + + if { $j == 1 } { + if { ![reboot_target] } { + break; + } + } + } + perror "Couldn't load file into GDB."; + return -1; +} Added: soc2011/xxp/test/config/proelf.exp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/xxp/test/config/proelf.exp Sat Aug 20 02:31:46 2011 (r225286) @@ -0,0 +1,16 @@ +# Copyright 1997, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +load_lib ../config/monitor.exp Added: soc2011/xxp/test/config/rom68k.exp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/xxp/test/config/rom68k.exp Sat Aug 20 02:31:46 2011 (r225286) @@ -0,0 +1,16 @@ +# Copyright 1997, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +load_lib ../config/monitor.exp Added: soc2011/xxp/test/config/sh.exp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/xxp/test/config/sh.exp Sat Aug 20 02:31:46 2011 (r225286) @@ -0,0 +1,16 @@ +# Copyright 1997, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +load_lib ../config/monitor.exp Added: soc2011/xxp/test/config/sid.exp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/xxp/test/config/sid.exp Sat Aug 20 02:31:46 2011 (r225286) @@ -0,0 +1,218 @@ +# Test Framework Driver for GDB driving an external simulator +# Copyright 1999, 2001, 2007, 2008, 2009, 2010 +# Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +load_lib gdb.exp + +proc sid_start {} { + global verbose + + set port [lindex [split [target_info netport] ":"] 1] + + # Set a default endianness + case [target_info multilib_flags] in { + { *big-endian* *-EB* *-meb* } { set sidendian "-EB" } + { *little-endian* *-EL* *-mel* } { set sidendian "-EL" } + default { + if {[target_info exists sim,defaultendian]} then { + set sidendian [target_info sim,defaultendian] + } else { + # rely on endianness settings in sid configuration defaults + set sidendian "" + } + } + } + case $sidendian in { + { -EB } { set sidendian2 {-e "set cpu endian big"} } + { -EL } { set sidendian2 {-e "set cpu endian little"} } + default { set sidendian2 {} } + } + + # test to see whether to use use sid in build or install tree + set use_build_tree [file exists ../../sid] + + if {$use_build_tree} then { + set pre_spawn { + global env + set env(SID_LIBRARY_PATH) [join [glob "../../sid/component/*"] ":"] + set env(SID) "../../sid/main/dynamic/sid" + if {! [file exists $env(SID)]} then { error "Cannot find sid in build tree" } + } + if { [board_info target sim,protocol] == "sid" } { + set spawncmd "[target_info sim] [target_info sim,options] $sidendian2 -e \"set cpu-gdb-socket sockaddr-local 0.0.0.0:$port\"" + } elseif { [board_info target sim,protocol] == "rawsid" } { + set spawncmd "[target_info sim] [target_info sim,options] -$sidendian --gdb=$port" + } else { + set spawncmd "../../sid/bsp/[target_info sim] $sidendian --gdb=$port [target_info sim,options]" + } + set post_spawn { + global env + unset env(SID_LIBRARY_PATH) + unset env(SID) + } + } else { + set pre_spawn {} + if { [board_info target sim,protocol] == "sid" } { + # FIXME: sim,options may be from the build tree, should find + # it in the install tree. + set spawncmd "sid [target_info sim,options] $sidendian2 -e \"set cpu-gdb-socket sockaddr-local 0.0.0.0:$port\"" + } elseif { [board_info target sim,protocol] == "rawsid" } { + set spawncmd "[target_info sim] [target_info sim,options] -$sidendian --gdb=$port" + } else { + set spawncmd "[target_info sim] $sidendian --gdb=$port [target_info sim,options]" + } + set post_spawn {} + } + + eval $pre_spawn + if {[catch [list remote_spawn host $spawncmd] msg]} { + perror $msg + exit 1 + } + eval $post_spawn + + # Don't do the following any more; it breaks with "runtest ... < /dev/null" +# expect_background { +# -re \[^\n\]*\n { +# regsub "\n" $expect_out(buffer) {} msg +# verbose "SID: $msg" 2 +# } +# } + + # There should be no need to sleep to give SID time to start; + # GDB would wait for a fair while for the stub to respond. + sleep 4 + + if ![target_info exists gdb,no_push_conn] { + remote_push_conn host; + } +} + +# +# Handle GDB talking to SID +# + +proc gdb_start {} { + sid_start + return [default_gdb_start] +} + +proc sid_exit {} { + if ![target_info exists gdb,no_push_conn] { + remote_close host; + remote_pop_conn host; + } +} + +proc gdb_exit {} { + set result [default_gdb_exit] + sid_exit + return $result +} + +# +# gdb_target_sid +# Set gdb to target the simulator +# +proc send_target_sid { } { + # wait a little while, giving sid time to shut down & restart its + # gdb socket + sleep 4 + send_gdb "target [target_info gdb_protocol] [target_info netport]\n" +} + +proc gdb_target_sid { } { + global gdb_prompt + global exit_status + + send_target_sid + + global timeout + set prev_timeout $timeout + set timeout 60 + verbose "Timeout is now $timeout seconds" 2 + gdb_expect { + -re ".*\[Ee\]rror.*$gdb_prompt $" { + perror "Couldn't set target for remote simulator." + cleanup + gdb_exit + } + -re "Remote debugging using.*$gdb_prompt" { + verbose "Set target to sid" + } + timeout { + perror "Couldn't set target for remote simulator." + cleanup + gdb_exit + } + } + set timeout $prev_timeout + verbose "Timeout is now $timeout seconds" 2 +} + +# +# gdb_load -- load a file into the debugger. +# return a -1 if anything goes wrong. +# +proc gdb_load { arg } { + global verbose + global loadpath + global loadfile + global GDB + global gdb_prompt + global retval + + if { $arg != "" } { + if [gdb_file_cmd $arg] then { return -1 } + } + + gdb_target_sid + + send_gdb "load\n" + global timeout + set prev_timeout $timeout + set timeout 2400 + verbose "Timeout is now $timeout seconds" 2 + gdb_expect { + -re ".*\[Ee\]rror.*$gdb_prompt $" { + if $verbose>1 then { + perror "Error during download." + } + set retval -1; + } + -re ".*$gdb_prompt $" { + if $verbose>1 then { + send_user "Loaded $arg into $GDB\n" + } + set retval 0; + } + -re "$gdb_prompt $" { + if $verbose>1 then { + perror "GDB couldn't load." + } + set retval -1; + } + timeout { + if $verbose>1 then { + perror "Timed out trying to load $arg." + } + set retval -1; + } + } + set timeout $prev_timeout + verbose "Timeout is now $timeout seconds" 2 + return $retval; +} Added: soc2011/xxp/test/config/sim.exp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/xxp/test/config/sim.exp Sat Aug 20 02:31:46 2011 (r225286) @@ -0,0 +1,88 @@ +# Test Framework Driver for GDB driving a builtin simulator +# Copyright 1994, 1997, 1998, 2004, 2007, 2008, 2009, 2010 +# Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +load_lib gdb.exp + +# +# gdb_target_sim +# Set gdb to target the simulator +# +proc gdb_target_sim { } { + global gdb_prompt + + set target_sim_options "[board_info target gdb,target_sim_options]"; + + send_gdb "target sim $target_sim_options\n" + set timeout 60 + verbose "Timeout is now $timeout seconds" 2 + gdb_expect { + -re "Connected to the simulator.*$gdb_prompt $" { + verbose "Set target to sim" + } + timeout { + perror "Couldn't set target for simulator." + cleanup + return -1 + } + } + set timeout 10 + verbose "Timeout is now $timeout seconds" 2 + return 0 +} + +# +# gdb_load -- load a file into the debugger. +# return a -1 if anything goes wrong. +# +proc gdb_load { arg } { + global verbose + global loadpath + global loadfile + global GDB + global gdb_prompt + + if { $arg != "" } { + if [gdb_file_cmd $arg] then { return -1 } + } + + if [gdb_target_sim] then { return -1 } + + send_gdb "load\n" + set timeout 2400 + verbose "Timeout is now $timeout seconds" 2 + gdb_expect { + -re ".*$gdb_prompt $" { + if $verbose>1 then { + send_user "Loaded $arg into $GDB\n" + } + set timeout 30 + verbose "Timeout is now $timeout seconds" 2 + return 0 + } + -re "$gdb_prompt $" { + if $verbose>1 then { + perror "GDB couldn't load." + } + } + timeout { + if $verbose>1 then { + perror "Timed out trying to load $arg." + } + } + } + return -1 +} Added: soc2011/xxp/test/config/slite.exp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2011/xxp/test/config/slite.exp Sat Aug 20 02:31:46 2011 (r225286) @@ -0,0 +1,180 @@ +# Copyright 1993, 1997, 1998, 2007, 2008, 2009, 2010 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# This file was written by Ian Lance Taylor . + +# GDB support routines for a board using the MIPS remote debugging +# protocol. These are actually pretty generic. + +# DejaGnu currently assumes that debugging is being done over the main +# console port. It would probably be more convenient for people using +# IDT boards to permit the debugging port and the connected port to be +# different, since an IDT board has two ports. This would require +# extending some of the tests in a fashion similar to that done for +# VxWorks, because the test output would appear on the other port, +# rather than being displayed by gdb. + +load_lib remote.exp +load_lib gdb.exp +set gdb_prompt "\\(gdb\\)" + +# +# gdb_load -- load a file into the GDB. +# Returns a 0 if there was an error, +# 1 if it load successfully. +# +proc gdb_load { arg } { + global verbose + global loadpath + global loadfile + global gdb_prompt + global GDB + global expect_out + + set loadfile [file tail $arg] + set loadpath [file dirname $arg] + + gdb_file_cmd $arg + + if [target_info exists gdb_protocol] { + set protocol [target_info gdb_protocol]; + } else { + set protocol "sparclite" + } + + if [target_info exists serial] { + set targetname [target_info serial]; + set command "target $protocol [target_info serial]\n"; + } else { + if ![target_info exists netport] { + perror "Need either netport or gdb_serial entry for [target_info name]."; + return -1; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Sat Aug 20 15:22:49 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 5556D106564A for ; Sat, 20 Aug 2011 15:22:47 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sat, 20 Aug 2011 15:22:47 +0000 Date: Sat, 20 Aug 2011 15:22:47 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110820152247.5556D106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r225304 - soc2011/oleksandr/oleksandr-head/head/share/man/man9 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 15:22:49 -0000 Author: oleksandr Date: Sat Aug 20 15:22:47 2011 New Revision: 225304 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=225304 Log: Review man for devstat(9) Modified: soc2011/oleksandr/oleksandr-head/head/share/man/man9/devstat.9 Modified: soc2011/oleksandr/oleksandr-head/head/share/man/man9/devstat.9 ============================================================================== --- soc2011/oleksandr/oleksandr-head/head/share/man/man9/devstat.9 Sat Aug 20 14:21:32 2011 (r225303) +++ soc2011/oleksandr/oleksandr-head/head/share/man/man9/devstat.9 Sat Aug 20 15:22:47 2011 (r225304) @@ -396,11 +396,11 @@ DEVSTAT_ERROR_READ_ERROR = 0x004, DEVSTAT_ERROR_WRITE_ERROR = 0x008, DEVSTAT_ERROR_OTHER_ERROR = 0x010, - DEVSTAT_ERROR_RECOVERABLE = 0x020, + DEVSTAT_ERROR_RECOVERED_ERROR = 0x020, DEVSTAT_ERROR_NOT_READY = 0x040, - DEVSTAT_ERROR_MEDIA_ERROR = 0x080, - DEVSTAT_ERROR_HARDWARE = 0x100, - DEVSTAT_ERROR_ILLEGAL_REQ = 0x200, + DEVSTAT_ERROR_MEDIUM_ERROR = 0x080, + DEVSTAT_ERROR_HARDWARE_ERROR = 0x100, + DEVSTAT_ERROR_ILLEGAL_REQUEST = 0x200, DEVSTAT_ERROR_UNIT_ATTENTION = 0x400, DEVSTAT_ERROR_ABORTED_COMMAND = 0x800 } devstat_error_flags; @@ -408,7 +408,7 @@ .Pp The number of disk errors recorded into the field of the structure .Nm devstat_device_error. -It looks: +This structure looks like: .Bd -literal -offset indent typedef enum { int retriable; @@ -416,11 +416,11 @@ int read_error; int write_error; int other_error; - int recoverable; + int recovered; int not_ready; - int media_error; + int medium_error; int hardware; - int illegal_req; + int illegal_request; int unit_attention; int aborted_command; } devstat_device_error; From owner-svn-soc-all@FreeBSD.ORG Sat Aug 20 15:35:49 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 15D411065670 for ; Sat, 20 Aug 2011 15:35:47 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sat, 20 Aug 2011 15:35:47 +0000 Date: Sat, 20 Aug 2011 15:35:47 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110820153547.15D411065670@hub.freebsd.org> Cc: Subject: socsvn commit: r225305 - in soc2011/oleksandr/oleksandr-head/head/sys: cam dev/ata dev/usb/storage kern sys X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 15:35:49 -0000 Author: oleksandr Date: Sat Aug 20 15:35:46 2011 New Revision: 225305 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=225305 Log: Deleting test files and change some name of errors Modified: soc2011/oleksandr/oleksandr-head/head/sys/cam/cam_periph.c soc2011/oleksandr/oleksandr-head/head/sys/dev/ata/ata-all.c soc2011/oleksandr/oleksandr-head/head/sys/dev/usb/storage/umass.c soc2011/oleksandr/oleksandr-head/head/sys/kern/subr_devstat.c soc2011/oleksandr/oleksandr-head/head/sys/sys/devicestat.h Modified: soc2011/oleksandr/oleksandr-head/head/sys/cam/cam_periph.c ============================================================================== --- soc2011/oleksandr/oleksandr-head/head/sys/cam/cam_periph.c Sat Aug 20 15:22:47 2011 (r225304) +++ soc2011/oleksandr/oleksandr-head/head/sys/cam/cam_periph.c Sat Aug 20 15:35:46 2011 (r225305) @@ -1745,19 +1745,19 @@ &error_code, &sense_key, &asc, &ascq); switch(sense_key) { case SSD_KEY_RECOVERED_ERROR: - error_flag_sense = DEVSTAT_ERROR_RECOVERABLE; + error_flag_sense = DEVSTAT_ERROR_RECOVERED_ERROR; break; case SSD_KEY_NOT_READY: error_flag_sense = DEVSTAT_ERROR_NOT_READY; break; case SSD_KEY_MEDIUM_ERROR: - error_flag_sense = DEVSTAT_ERROR_MEDIA_ERROR; + error_flag_sense = DEVSTAT_ERROR_MEDIUM_ERROR; break; case SSD_KEY_HARDWARE_ERROR: - error_flag_sense = DEVSTAT_ERROR_HARDWARE; + error_flag_sense = DEVSTAT_ERROR_HARDWARE_ERROR; break; case SSD_KEY_ILLEGAL_REQUEST: - error_flag_sense = DEVSTAT_ERROR_ILLEGAL_REQ; + error_flag_sense = DEVSTAT_ERROR_ILLEGAL_REQUEST; break; case SSD_KEY_UNIT_ATTENTION: error_flag_sense = DEVSTAT_ERROR_UNIT_ATTENTION; @@ -1766,33 +1766,33 @@ error_flag_sense = DEVSTAT_ERROR_ABORTED_COMMAND; break; } - } + } /* * If function code is equal to XPT_ATA_IO it means that the * information about error can be found in the structure ataio.res. */ if (ccb->ccb_h.func_code == XPT_ATA_IO && error_flag_ret != 0) { - if ((ccb->ataio.res.status & 0x20) && (!ccb->ataio.res.error)) - error_flag_sense = DEVSTAT_ERROR_HARDWARE; - if (ccb->ataio.res.status & 0x10) { - if (ccb->ataio.res.error && 0x02) - error_flag_sense = DEVSTAT_ERROR_NOT_READY; - if ((ccb->ataio.res.error && 0x40) || - (ccb->ataio.res.error && 0x01) || - (ccb->ataio.res.error && 0x10)) - error_flag_sense = DEVSTAT_ERROR_MEDIA_ERROR; - if (ccb->ataio.res.error && 0x04) - error_flag_sense = DEVSTAT_ERROR_ILLEGAL_REQ; - if ((ccb->ataio.res.error && 0x20) || - (ccb->ataio.res.error && 0x08)) - error_flag_sense = DEVSTAT_ERROR_UNIT_ATTENTION; - if (ccb->ataio.res.error && 0x80) - error_flag_sense = DEVSTAT_ERROR_ABORTED_COMMAND; - } + if ((ccb->ataio.res.status & 0x20) && (!ccb->ataio.res.error)) + error_flag_sense = DEVSTAT_ERROR_HARDWARE_ERROR; + if (ccb->ataio.res.status & 0x10) { + if (ccb->ataio.res.error && 0x02) + error_flag_sense = DEVSTAT_ERROR_NOT_READY; + if ((ccb->ataio.res.error && 0x40) || + (ccb->ataio.res.error && 0x01) || + (ccb->ataio.res.error && 0x10)) + error_flag_sense = DEVSTAT_ERROR_MEDIUM_ERROR; + if (ccb->ataio.res.error && 0x04) + error_flag_sense = DEVSTAT_ERROR_ILLEGAL_REQUEST; + if ((ccb->ataio.res.error && 0x20) || + (ccb->ataio.res.error && 0x08)) + error_flag_sense = DEVSTAT_ERROR_UNIT_ATTENTION; + if (ccb->ataio.res.error && 0x80) + error_flag_sense = DEVSTAT_ERROR_ABORTED_COMMAND; + } } /* - * If an error is present, search for an appropriate structure - * in devstat and increase the corresponding counter of errors. + * If the error is present, search for appropriate structure + * in devstat and increase the corresponding counters of errors. */ if (error_flag_ret) { if ((device_error = devstat_search( Modified: soc2011/oleksandr/oleksandr-head/head/sys/dev/ata/ata-all.c ============================================================================== --- soc2011/oleksandr/oleksandr-head/head/sys/dev/ata/ata-all.c Sat Aug 20 15:22:47 2011 (r225304) +++ soc2011/oleksandr/oleksandr-head/head/sys/dev/ata/ata-all.c Sat Aug 20 15:35:46 2011 (r225305) @@ -1612,8 +1612,6 @@ (ccb->ccb_h.flags & CAM_DIS_AUTOSENSE) == 0) ata_cam_request_sense(dev, request); else { - KFAIL_POINT_CODE(DEBUG_FP, fail_atadevice, - ccb->ccb_h.status=RETURN_VALUE); ata_free_request(request); xpt_done(ccb); } Modified: soc2011/oleksandr/oleksandr-head/head/sys/dev/usb/storage/umass.c ============================================================================== --- soc2011/oleksandr/oleksandr-head/head/sys/dev/usb/storage/umass.c Sat Aug 20 15:22:47 2011 (r225304) +++ soc2011/oleksandr/oleksandr-head/head/sys/dev/usb/storage/umass.c Sat Aug 20 15:35:46 2011 (r225305) @@ -2585,8 +2585,6 @@ page_list->length++; } } - KFAIL_POINT_CODE(DEBUG_FP, fail_usbdevice, - ccb->ccb_h.status = RETURN_VALUE); xpt_done(ccb); break; Modified: soc2011/oleksandr/oleksandr-head/head/sys/kern/subr_devstat.c ============================================================================== --- soc2011/oleksandr/oleksandr-head/head/sys/kern/subr_devstat.c Sat Aug 20 15:22:47 2011 (r225304) +++ soc2011/oleksandr/oleksandr-head/head/sys/kern/subr_devstat.c Sat Aug 20 15:35:46 2011 (r225305) @@ -385,18 +385,18 @@ ds->dev_error.read_error++; if ((error_flag | DEVSTAT_ERROR_OTHER_ERROR) == error_flag) ds->dev_error.other_error++; - if ((error_flag | DEVSTAT_ERROR_RECOVERABLE) == error_flag) - ds->dev_error.recoverable++; + if ((error_flag | DEVSTAT_ERROR_RECOVERED_ERROR) == error_flag) + ds->dev_error.recovered++; if ((error_flag | DEVSTAT_ERROR_NOT_READY) == error_flag) ds->dev_error.not_ready++; - if ((error_flag | DEVSTAT_ERROR_MEDIA_ERROR) == error_flag) - ds->dev_error.media_error++; - if ((error_flag | DEVSTAT_ERROR_HARDWARE) == error_flag) + if ((error_flag | DEVSTAT_ERROR_MEDIUM_ERROR) == error_flag) + ds->dev_error.medium_error++; + if ((error_flag | DEVSTAT_ERROR_HARDWARE_ERROR) == error_flag) ds->dev_error.hardware++; - if ((error_flag | DEVSTAT_ERROR_ILLEGAL_REQ) == error_flag) - ds->dev_error.illegal_req++; + if ((error_flag | DEVSTAT_ERROR_ILLEGAL_REQUEST) == error_flag) + ds->dev_error.illegal_request++; if ((error_flag | DEVSTAT_ERROR_UNIT_ATTENTION) == error_flag) - ds->dev_error.illegal_req++; + ds->dev_error.unit_attention++; if ((error_flag | DEVSTAT_ERROR_ABORTED_COMMAND) == error_flag) ds->dev_error.aborted_command++; } Modified: soc2011/oleksandr/oleksandr-head/head/sys/sys/devicestat.h ============================================================================== --- soc2011/oleksandr/oleksandr-head/head/sys/sys/devicestat.h Sat Aug 20 15:22:47 2011 (r225304) +++ soc2011/oleksandr/oleksandr-head/head/sys/sys/devicestat.h Sat Aug 20 15:35:46 2011 (r225305) @@ -103,11 +103,11 @@ DEVSTAT_ERROR_READ_ERROR = 0x004, DEVSTAT_ERROR_WRITE_ERROR = 0x008, DEVSTAT_ERROR_OTHER_ERROR = 0x010, - DEVSTAT_ERROR_RECOVERABLE = 0x020, + DEVSTAT_ERROR_RECOVERED_ERROR = 0x020, DEVSTAT_ERROR_NOT_READY = 0x040, - DEVSTAT_ERROR_MEDIA_ERROR = 0x080, - DEVSTAT_ERROR_HARDWARE = 0x100, - DEVSTAT_ERROR_ILLEGAL_REQ = 0x200, + DEVSTAT_ERROR_MEDIUM_ERROR = 0x080, + DEVSTAT_ERROR_HARDWARE_ERROR = 0x100, + DEVSTAT_ERROR_ILLEGAL_REQUEST = 0x200, DEVSTAT_ERROR_UNIT_ATTENTION = 0x400, DEVSTAT_ERROR_ABORTED_COMMAND = 0x800 } devstat_error_flags; @@ -153,14 +153,14 @@ int read_error; int write_error; int other_error; - int recoverable; + int recovered; int not_ready; - int media_error; + int medium_error; int hardware; - int illegal_req; + int illegal_request; int unit_attention; int aborted_command; -} devstat_device_error; +} devstat_device_error; /* * XXX: Next revision should add * off_t offset[DEVSTAT_N_TRANS_FLAGS]; From owner-svn-soc-all@FreeBSD.ORG Sat Aug 20 15:44:08 2011 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id B563C106572C for ; Sat, 20 Aug 2011 15:44:03 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sat, 20 Aug 2011 15:44:03 +0000 Date: Sat, 20 Aug 2011 15:44:03 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20110820154407.B563C106572C@hub.freebsd.org> Cc: Subject: socsvn commit: r225306 - soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 15:44:08 -0000 Author: oleksandr Date: Sat Aug 20 15:44:03 2011 New Revision: 225306 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=225306 Log: Some change in iostat Modified: soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat/iostat.8 soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat/iostat.c Modified: soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat/iostat.8 ============================================================================== --- soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat/iostat.8 Sat Aug 20 15:35:46 2011 (r225305) +++ soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat/iostat.8 Sat Aug 20 15:44:03 2011 (r225306) @@ -135,11 +135,11 @@ Write errors .It Other Read/write errors -.It Recoverable +.It Recovered Recovered data with retries .It Device Not Ready Medium not present -.It Media +.It Medium Address mark not found or logical block of address out of range .It Hardware Internal target failure Modified: soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat/iostat.c ============================================================================== --- soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat/iostat.c Sat Aug 20 15:35:46 2011 (r225305) +++ soc2011/oleksandr/oleksandr-head/head/usr.sbin/iostat/iostat.c Sat Aug 20 15:44:03 2011 (r225306) @@ -814,10 +814,10 @@ cur.dinfo->devices[di].device_name, cur.dinfo->devices[di].unit_number) == -1) err(1, "aspRintf"); - printf("Device: %-8.8s Retriable: %d Non-retriable: %d " - "Read: %d Write: %d Other: %d " - "Recovered: %d Device Not Ready: %d Media: %d " - "Hardware: %d Illegal Request: %d " + printf("Device: %-8.8s Retriable: %d Non-retriable: %d " + "Read: %d Write: %d Other: %d\n" + "Recovered: %d Device Not Ready: %d Medium: %d " + "Hardware: %d Illegal Request: %d\n" "Unit Attention: %d Aborted Command: %d", devname, cur.dinfo->devices[di].dev_error.retriable, @@ -825,11 +825,11 @@ cur.dinfo->devices[di].dev_error.read_error, cur.dinfo->devices[di].dev_error.write_error, cur.dinfo->devices[di].dev_error.other_error, - cur.dinfo->devices[di].dev_error.recoverable, + cur.dinfo->devices[di].dev_error.recovered, cur.dinfo->devices[di].dev_error.not_ready, - cur.dinfo->devices[di].dev_error.media_error, + cur.dinfo->devices[di].dev_error.medium_error, cur.dinfo->devices[di].dev_error.hardware, - cur.dinfo->devices[di].dev_error.illegal_req, + cur.dinfo->devices[di].dev_error.illegal_request, cur.dinfo->devices[di].dev_error.unit_attention, cur.dinfo->devices[di].dev_error.aborted_command); printf("\n");