From owner-p4-projects@FreeBSD.ORG Mon Jul 16 21:33:00 2012 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 188FF106566C; Mon, 16 Jul 2012 21:32:59 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4A73106566B for ; Mon, 16 Jul 2012 21:32:58 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id ADFCA8FC0C for ; Mon, 16 Jul 2012 21:32:58 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id q6GLWw0G011709 for ; Mon, 16 Jul 2012 21:32:58 GMT (envelope-from brooks@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id q6GLWwxs011706 for perforce@freebsd.org; Mon, 16 Jul 2012 21:32:58 GMT (envelope-from brooks@freebsd.org) Date: Mon, 16 Jul 2012 21:32:58 GMT Message-Id: <201207162132.q6GLWwxs011706@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to brooks@freebsd.org using -f From: Brooks Davis To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 214483 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2012 21:33:00 -0000 http://p4web.freebsd.org/@@214483?ac=10 Change 214483 by brooks@brooks_ecr_current on 2012/07/16 21:32:32 Only display one of the photos on the main screen so we can steal the right corner for the browser. Rework child management to catch dead child processes in a SIGCHLD handler rather than polling periodically. Affected files ... .. //depot/projects/ctsrd/beribsd/src/ctsrd/pictview/img/Makefile#2 edit .. //depot/projects/ctsrd/beribsd/src/ctsrd/pictview/img/browser-thumb.png#1 add .. //depot/projects/ctsrd/beribsd/src/ctsrd/pictview/pictview.c#9 edit Differences ... ==== //depot/projects/ctsrd/beribsd/src/ctsrd/pictview/img/Makefile#2 (text+ko) ==== @@ -7,6 +7,7 @@ CatSword.png \ Quill.png \ Terminal.png \ + browser-thumb.png \ busy0.png \ busy1.png \ keyboardA.png \ ==== //depot/projects/ctsrd/beribsd/src/ctsrd/pictview/pictview.c#9 (text+ko) ==== @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -48,12 +49,31 @@ #include +static pid_t browser_pid; +static pid_t kbd_pid; // send keyboard output to stdout by default static int kbdfd = 0; u_int32_t *fb_buf; +static void +handle_sigchld(int sig __unused) +{ + pid_t pid; + + if ((pid = wait4(-1, NULL, 0, NULL)) < 1) + err(1, "wait4"); + else { + if (pid == browser_pid) + browser_pid = 0; + else if (pid == kbd_pid) + kbd_pid = 0; + else + warnx("unexpected pid from wait4(): %d", pid); + } +} + void pen_drawing_clear_screen(void) { @@ -174,7 +194,6 @@ int wait_poll_timeout = poll_timeout; static int pmaster; - static pid_t pid; int pslave, n; char *devpath, buf[1024]; ssize_t rlen; @@ -209,13 +228,12 @@ keymap[2][1][3] = '\xff'; if (kbdfd < 0) { - /* XXX: need to handle the case of the shell exiting. */ if (openpty(&pmaster, &pslave, NULL, NULL, NULL) == -1) err(1, "openpty"); - pid = fork(); - if (pid < 0) + kbd_pid = fork(); + if (kbd_pid < 0) err(1, "fork()"); - else if (pid > 0) { + else if (kbd_pid > 0) { close(pslave); kbdfd = pmaster; } else { @@ -306,28 +324,26 @@ } if (kbdfd != 0) { + if (kbd_pid == 0) + break; + if (wait_poll_timeout > 0) { wait_poll_timeout--; continue; } wait_poll_timeout = poll_timeout; - /* - * If the child has exited, reset the state and return to the - * main screen. - */ - if (wait4(pid, NULL, WNOHANG, NULL) != 0) { - kbdfd = -1; - close(pmaster); - break; - } - /* Check for output from the child and post it if needed */ pfd[0].fd = pmaster; pfd[0].events = POLLIN; n = poll(pfd, 1, 0); if (n == 0) continue; + else if (n < 0) { + if (errno == EINTR) + continue; + err(1, "poll"); + } if (n < 0) { syslog(LOG_ALERT, "poll failed with %s", strerror(errno)); err(1, "poll"); @@ -381,9 +397,10 @@ * Picture viewer including PNG image loader *****************************************************************************/ -static const int pictview_numimg=6; +static const int pictview_numimg=7; //static u_int32_t* pictview_imgs[pictview_numimg]; -static u_int32_t* pictview_imgs[6]; +static u_int32_t* pictview_imgs[7]; +static int pictview_browser_img; static int pictview_quill_img; static int pictview_term_img; static int pictview_num_photo; @@ -429,8 +446,11 @@ busy_indicator(); read_png_file("/usr/share/images/Terminal.png", pictview_imgs[5], fb_width, fb_height); busy_indicator(); + read_png_file("/usr/share/images/browser-thumb.png", pictview_imgs[6], fb_width, fb_height); + busy_indicator(); pictview_quill_img = 4; pictview_term_img = 5; + pictview_browser_img = 6; pictview_num_photo = 3; } @@ -454,8 +474,8 @@ imgmap[2][1] = -1; imgmap[0][2] = 1; - imgmap[1][2] = 2; - imgmap[2][2] = 3; + imgmap[1][2] = -1; + imgmap[2][2] = pictview_browser_img; // display off fb_fade2off(); @@ -591,6 +611,70 @@ void +run_browser(void) +{ + static int pmaster; + int pslave, n; + char buf[1024]; + ssize_t rlen; + struct pollfd pfd[1]; + + if (openpty(&pmaster, &pslave, NULL, NULL, NULL) == -1) + err(1, "openpty"); + browser_pid = fork(); + if (browser_pid < 0) + err(1, "fork()"); + else if (browser_pid > 0) + close(pslave); + else { + close(pmaster); + if (login_tty(pslave) < 0) { + syslog(LOG_ALERT, "login_tty failed in child: %s", strerror(errno)); + err(1, "tty_login"); + } + execl("/usr/bin/browser", "browser", "-f", "-T", "/demo", NULL); + syslog(LOG_ALERT, "exec of /usr/bin/browser failed: %s", strerror(errno)); + err(1, "execl()"); + } + + for(;;) { + /* + * If the child has exited, reset the state and return to the + * main screen. + */ + if (browser_pid == 0) { + close(pmaster); + break; + } + + /* Check for output from the child and post it if needed */ + pfd[0].fd = pmaster; + pfd[0].events = POLLIN; + n = poll(pfd, 1, INFTIM); + if (n == 0) + continue; + else if (n < 0) { + if (errno == EINTR) + continue; + err(1, "poll"); + } + if (n < 0) { + syslog(LOG_ALERT, "poll failed with %s", strerror(errno)); + err(1, "poll"); + } + if (pfd[0].revents & POLLIN) { + rlen = read(pfd[0].fd, buf, sizeof(buf)); + if (rlen < 0) { + syslog(LOG_ALERT, "read failed: %s", strerror(errno)); + err(1, "read"); + } else if (rlen > 0) + writeall(0, buf, rlen); + } + } +} + + +void pictview_slideshow() { int j, k; @@ -626,6 +710,8 @@ // show_text_buffer(); else if(display_image == pictview_quill_img) pen_drawing(); + else if(display_image == pictview_browser_img) + run_browser(); else if((display_image>=1) && (display_image<=pictview_num_photo)) pictview_pan(display_image); } @@ -638,6 +724,7 @@ { int tty; char *devpath; + struct sigaction act; fb_buf = malloc(sizeof(*fb_buf) * fb_width * fb_height); @@ -652,6 +739,11 @@ // pen_drawing(); // line_pattern(); + memset (&act, 0, sizeof(act)); + act.sa_handler = handle_sigchld; + if (sigaction(SIGCHLD, &act, 0)) + err(1, "sigacation"); + if (argc > 2) errx(1, "usage: pictview [tty]"); if (argc == 2) { From owner-p4-projects@FreeBSD.ORG Tue Jul 17 09:18:40 2012 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 17D2E1065674; Tue, 17 Jul 2012 09:18:39 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA9BE1065673 for ; Tue, 17 Jul 2012 09:18:38 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id A2D5F8FC18 for ; Tue, 17 Jul 2012 09:18:38 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id q6H9IcFh039723 for ; Tue, 17 Jul 2012 09:18:38 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id q6H9IcU5039720 for perforce@freebsd.org; Tue, 17 Jul 2012 09:18:38 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Tue, 17 Jul 2012 09:18:38 GMT Message-Id: <201207170918.q6H9IcU5039720@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 214502 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jul 2012 09:18:40 -0000 http://p4web.freebsd.org/@@214502?ac=10 Change 214502 by rwatson@rwatson_svr_ctsrd_mipsbuild on 2012/07/17 09:17:35 Merge CHERI assembler enhancements from CTSRD-CHERI/binutils: commit 7248f6e0b1e1262bebc404c50ac618e6f7d9c60e Author: Steven Murdoch Date: Thu Jul 5 14:41:05 2012 +0100 Use indexed notation when instructions have an offset value or register cscr, clcr cl[bhwd] cl[bhwd]r cs[bhwd] cs[bhwd]r cjr cjalr Affected files ... .. //depot/projects/ctsrd/cheribsd/src/contrib/binutils/opcodes/mips-opc.c#3 edit Differences ... ==== //depot/projects/ctsrd/cheribsd/src/contrib/binutils/opcodes/mips-opc.c#3 (text+ko) ==== @@ -197,8 +197,6 @@ {"cincbase","+w,+b,m", 0x48800001, 0xffe0003f, 0, 0, I1 }, {"cmove", "+w,+b", 0x48800001, 0xffe007ff, 0, 0, I1 }, {"csetlen", "+w,+b,m", 0x48800000, 0xffe0003f, 0, 0, I1 }, -{"cdeclen", "+w,+b,m", 0x48800000, 0xffe0003f, 0, 0, I1 }, /* DEPRECATED */ -{"cdecleng","+w,+b,m", 0x48800000, 0xffe0003f, 0, 0, I1 }, /* DEPRECATED */ {"candperm","+w,+b,m", 0x48800006, 0xffe0003f, 0, 0, I1 }, {"cscr", "+w,+b,m", 0x49200000, 0xffe0003f, 0, 0, I1 }, {"clcr", "+w,+b,m", 0x49400000, 0xffe0003f, 0, 0, I1 }, From owner-p4-projects@FreeBSD.ORG Tue Jul 17 09:24:09 2012 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 870591065677; Tue, 17 Jul 2012 09:24:08 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3EAD1106566C for ; Tue, 17 Jul 2012 09:24:08 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id 26A028FC16 for ; Tue, 17 Jul 2012 09:24:08 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id q6H9O7rH039865 for ; Tue, 17 Jul 2012 09:24:07 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id q6H9O7aT039862 for perforce@freebsd.org; Tue, 17 Jul 2012 09:24:07 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Tue, 17 Jul 2012 09:24:07 GMT Message-Id: <201207170924.q6H9O7aT039862@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 214503 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jul 2012 09:24:09 -0000 http://p4web.freebsd.org/@@214503?ac=10 Change 214503 by rwatson@rwatson_svr_ctsrd_mipsbuild on 2012/07/17 09:24:03 Back out last change -- misuse of git led to premature merging of one change, and lack of merging of another. Affected files ... .. //depot/projects/ctsrd/cheribsd/src/contrib/binutils/opcodes/mips-opc.c#4 edit Differences ... ==== //depot/projects/ctsrd/cheribsd/src/contrib/binutils/opcodes/mips-opc.c#4 (text+ko) ==== @@ -197,6 +197,8 @@ {"cincbase","+w,+b,m", 0x48800001, 0xffe0003f, 0, 0, I1 }, {"cmove", "+w,+b", 0x48800001, 0xffe007ff, 0, 0, I1 }, {"csetlen", "+w,+b,m", 0x48800000, 0xffe0003f, 0, 0, I1 }, +{"cdeclen", "+w,+b,m", 0x48800000, 0xffe0003f, 0, 0, I1 }, /* DEPRECATED */ +{"cdecleng","+w,+b,m", 0x48800000, 0xffe0003f, 0, 0, I1 }, /* DEPRECATED */ {"candperm","+w,+b,m", 0x48800006, 0xffe0003f, 0, 0, I1 }, {"cscr", "+w,+b,m", 0x49200000, 0xffe0003f, 0, 0, I1 }, {"clcr", "+w,+b,m", 0x49400000, 0xffe0003f, 0, 0, I1 }, From owner-p4-projects@FreeBSD.ORG Tue Jul 17 09:26:22 2012 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 65D49106566C; Tue, 17 Jul 2012 09:26:21 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0D1961065675 for ; Tue, 17 Jul 2012 09:26:21 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id E47F88FC1F for ; Tue, 17 Jul 2012 09:26:20 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id q6H9QKUM039920 for ; Tue, 17 Jul 2012 09:26:20 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id q6H9QKoQ039917 for perforce@freebsd.org; Tue, 17 Jul 2012 09:26:20 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Tue, 17 Jul 2012 09:26:20 GMT Message-Id: <201207170926.q6H9QKoQ039917@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 214504 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jul 2012 09:26:22 -0000 http://p4web.freebsd.org/@@214504?ac=10 Change 214504 by rwatson@rwatson_svr_ctsrd_mipsbuild on 2012/07/17 09:26:10 Merge CHERI assembler enhancements from CTSRD-CHERI/binutils: commit 7248f6e0b1e1262bebc404c50ac618e6f7d9c60e Author: Steven Murdoch Date: Thu Jul 5 14:41:05 2012 +0100 Use indexed notation when instructions have an offset value or register cscr, clcr cl[bhwd] cl[bhwd]r cs[bhwd] cs[bhwd]r cjr cjalr Affected files ... .. //depot/projects/ctsrd/cheribsd/src/contrib/binutils/gas/config/tc-mips.c#3 edit .. //depot/projects/ctsrd/cheribsd/src/contrib/binutils/opcodes/mips-opc.c#5 edit Differences ... ==== //depot/projects/ctsrd/cheribsd/src/contrib/binutils/gas/config/tc-mips.c#3 (text+ko) ==== @@ -8796,6 +8796,8 @@ s += strspn (s, " \t"); is_mdmx = 0; + /* Switch on first character of operand (+ options are handled by + a nested case statement, inside this switch) */ switch (*args) { case '\0': /* end of args */ @@ -9055,7 +9057,8 @@ /* This is dependent on the next operand specifier is a base register specification. */ assert (args[1] == 'b' || args[1] == '5' - || args[1] == '-' || args[1] == '4'); + || args[1] == '-' || args[1] == '4' + || (args[1] == '+' && args[2] == 'b')); if (*s == '\0') return; ==== //depot/projects/ctsrd/cheribsd/src/contrib/binutils/opcodes/mips-opc.c#5 (text+ko) ==== @@ -200,26 +200,26 @@ {"cdeclen", "+w,+b,m", 0x48800000, 0xffe0003f, 0, 0, I1 }, /* DEPRECATED */ {"cdecleng","+w,+b,m", 0x48800000, 0xffe0003f, 0, 0, I1 }, /* DEPRECATED */ {"candperm","+w,+b,m", 0x48800006, 0xffe0003f, 0, 0, I1 }, -{"cscr", "+w,+b,m", 0x49200000, 0xffe0003f, 0, 0, I1 }, -{"clcr", "+w,+b,m", 0x49400000, 0xffe0003f, 0, 0, I1 }, -{"clb", "t,+b,+o", 0x4a000000, 0xffe00000, 0, 0, I1 }, -{"clh", "t,+b,+o", 0x4a200000, 0xffe00000, 0, 0, I1 }, -{"clw", "t,+b,+o", 0x4a400000, 0xffe00000, 0, 0, I1 }, -{"cld", "t,+b,+o", 0x4a600000, 0xffe00000, 0, 0, I1 }, -{"clbr", "t,+b,m", 0x4a800000, 0xffe0003f, 0, 0, I1 }, -{"clhr", "t,+b,m", 0x4aa00000, 0xffe0003f, 0, 0, I1 }, -{"clwr", "t,+b,m", 0x4ac00000, 0xffe0003f, 0, 0, I1 }, -{"cldr", "t,+b,m", 0x4ae00000, 0xffe0003f, 0, 0, I1 }, -{"csb", "t,+b,+o", 0x4b000000, 0xffe00000, 0, 0, I1 }, -{"csh", "t,+b,+o", 0x4b200000, 0xffe00000, 0, 0, I1 }, -{"csw", "t,+b,+o", 0x4b400000, 0xffe00000, 0, 0, I1 }, -{"csd", "t,+b,+o", 0x4b600000, 0xffe00000, 0, 0, I1 }, -{"csbr", "t,+b,m", 0x4b800000, 0xffe0003f, 0, 0, I1 }, -{"cshr", "t,+b,m", 0x4ba00000, 0xffe0003f, 0, 0, I1 }, -{"cswr", "t,+b,m", 0x4bc00000, 0xffe0003f, 0, 0, I1 }, -{"csdr", "t,+b,m", 0x4be00000, 0xffe0003f, 0, 0, I1 }, -{"cjr", "+b,m", 0x49000000, 0xffff003f, 0, 0, I1 }, -{"cjalr", "+b,m", 0x48e00000, 0xffff003f, 0, 0, I1 }, +{"cscr", "+w,m(+b)", 0x49200000, 0xffe0003f, 0, 0, I1 }, +{"clcr", "+w,m(+b)", 0x49400000, 0xffe0003f, 0, 0, I1 }, +{"clb", "t,+o(+b)", 0x4a000000, 0xffe00000,0, 0, I1 }, +{"clh", "t,+o(+b)", 0x4a200000, 0xffe00000, 0, 0, I1 }, +{"clw", "t,+o(+b)", 0x4a400000, 0xffe00000, 0, 0, I1 }, +{"cld", "t,+o(+b)", 0x4a600000, 0xffe00000, 0, 0, I1 }, +{"clbr", "t,m(+b)", 0x4a800000, 0xffe0003f, 0, 0, I1 }, +{"clhr", "t,m(+b)", 0x4aa00000, 0xffe0003f, 0, 0, I1 }, +{"clwr", "t,m(+b)", 0x4ac00000, 0xffe0003f, 0, 0, I1 }, +{"cldr", "t,m(+b)", 0x4ae00000, 0xffe0003f, 0, 0, I1 }, +{"csb", "t,+o(+b)", 0x4b000000, 0xffe00000, 0, 0, I1 }, +{"csh", "t,+o(+b)", 0x4b200000, 0xffe00000, 0, 0, I1 }, +{"csw", "t,+o(+b)", 0x4b400000, 0xffe00000, 0, 0, I1 }, +{"csd", "t,+o(+b)", 0x4b600000, 0xffe00000, 0, 0, I1 }, +{"csbr", "t,m(+b)", 0x4b800000, 0xffe0003f, 0, 0, I1 }, +{"cshr", "t,m(+b)", 0x4ba00000, 0xffe0003f, 0, 0, I1 }, +{"cswr", "t,m(+b)", 0x4bc00000, 0xffe0003f, 0, 0, I1 }, +{"csdr", "t,m(+b)", 0x4be00000, 0xffe0003f, 0, 0, I1 }, +{"cjr", "m(+b)", 0x49000000, 0xffff003f, 0, 0, I1 }, +{"cjalr", "m(+b)", 0x48e00000, 0xffff003f, 0, 0, I1 }, {"csealcode","+w,+b", 0x48200000, 0xffe007ff, 0, 0, I1 }, {"csealdata","+w,+b,+v",0x48400000, 0xffe0003f, 0, 0, I1 }, {"cunseal", "+w,+b,+v", 0x48600000, 0xffe0003f, 0, 0, I1 }, From owner-p4-projects@FreeBSD.ORG Tue Jul 17 09:27:29 2012 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 894E9106567D; Tue, 17 Jul 2012 09:27:28 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 324F71065679 for ; Tue, 17 Jul 2012 09:27:28 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id 74EB68FC16 for ; Tue, 17 Jul 2012 09:27:27 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id q6H9RRbS039953 for ; Tue, 17 Jul 2012 09:27:27 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id q6H9RQmO039950 for perforce@freebsd.org; Tue, 17 Jul 2012 09:27:26 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Tue, 17 Jul 2012 09:27:26 GMT Message-Id: <201207170927.q6H9RQmO039950@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 214505 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jul 2012 09:27:29 -0000 http://p4web.freebsd.org/@@214505?ac=10 Change 214505 by rwatson@rwatson_svr_ctsrd_mipsbuild on 2012/07/17 09:26:53 Merge CHERI assembler enhancements from CTSRD-CHERI/binutils: commit 42cb3b3c2171be12b6deb4428094c1b9072f82cf Author: Steven Murdoch Date: Thu Jul 5 14:44:12 2012 +0100 Remove deprecated cdeclen and cdecleng Affected files ... .. //depot/projects/ctsrd/cheribsd/src/contrib/binutils/opcodes/mips-opc.c#6 edit Differences ... ==== //depot/projects/ctsrd/cheribsd/src/contrib/binutils/opcodes/mips-opc.c#6 (text+ko) ==== @@ -197,8 +197,6 @@ {"cincbase","+w,+b,m", 0x48800001, 0xffe0003f, 0, 0, I1 }, {"cmove", "+w,+b", 0x48800001, 0xffe007ff, 0, 0, I1 }, {"csetlen", "+w,+b,m", 0x48800000, 0xffe0003f, 0, 0, I1 }, -{"cdeclen", "+w,+b,m", 0x48800000, 0xffe0003f, 0, 0, I1 }, /* DEPRECATED */ -{"cdecleng","+w,+b,m", 0x48800000, 0xffe0003f, 0, 0, I1 }, /* DEPRECATED */ {"candperm","+w,+b,m", 0x48800006, 0xffe0003f, 0, 0, I1 }, {"cscr", "+w,m(+b)", 0x49200000, 0xffe0003f, 0, 0, I1 }, {"clcr", "+w,m(+b)", 0x49400000, 0xffe0003f, 0, 0, I1 }, From owner-p4-projects@FreeBSD.ORG Tue Jul 17 11:30:59 2012 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 407E41065676; Tue, 17 Jul 2012 11:30:57 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id DC5D01065673 for ; Tue, 17 Jul 2012 11:30:56 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id C2F5E8FC1D for ; Tue, 17 Jul 2012 11:30:56 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id q6HBUuRs046385 for ; Tue, 17 Jul 2012 11:30:56 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id q6HBUuWJ046382 for perforce@freebsd.org; Tue, 17 Jul 2012 11:30:56 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Tue, 17 Jul 2012 11:30:56 GMT Message-Id: <201207171130.q6HBUuWJ046382@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 214509 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jul 2012 11:30:59 -0000 http://p4web.freebsd.org/@@214509?ac=10 Change 214509 by rwatson@rwatson_svr_ctsrd_mipsbuild on 2012/07/17 11:30:23 Catch up on CHERI kernel compilation following integration from the FreeBSD/BERI branch (adding options CAPABILITIES) and CHERI assembler changes: - Replace CHERI-level "struct capability" with "struct chericap" to avoid a collision with Capsicum. This may lead to further pondering. - Reorder arguments to CHERI load and store via capability instruction use to employ new indexed notation. - Prefer csetlen to removed cdecleng. Affected files ... .. //depot/projects/ctsrd/cheribsd/src/sys/mips/cheri/cp2.c#10 edit .. //depot/projects/ctsrd/cheribsd/src/sys/mips/include/cheri.h#5 edit .. //depot/projects/ctsrd/cheribsd/src/sys/mips/include/cheriasm.h#4 edit Differences ... ==== //depot/projects/ctsrd/cheribsd/src/sys/mips/cheri/cp2.c#10 (text+ko) ==== @@ -67,7 +67,7 @@ */ void -cp2_capability_set(struct capability *cp, uint32_t uperms, +cp2_capability_set(struct chericap *cp, uint32_t uperms, void *otypep /* eaddr */, void *basep, uint64_t length) { @@ -86,7 +86,7 @@ * contexts. */ void -cp2_capability_set_priv(struct capability *cp) +cp2_capability_set_priv(struct chericap *cp) { cp2_capability_set(cp, CHERI_CAP_PRIV_UPERMS, CHERI_CAP_PRIV_OTYPE, @@ -94,7 +94,7 @@ } void -cp2_capability_set_user(struct capability *cp) +cp2_capability_set_user(struct chericap *cp) { cp2_capability_set(cp, CHERI_CAP_USER_UPERMS, CHERI_CAP_USER_OTYPE, @@ -102,7 +102,7 @@ } void -cp2_capability_set_null(struct capability *cp) +cp2_capability_set_null(struct chericap *cp) { cp2_capability_set(cp, CHERI_CAP_NOPRIV_UPERMS, @@ -121,7 +121,7 @@ * XXXRW: Compiler should be providing us with the temporary register. */ void -cp2_capability_copy(struct capability *cp_to, struct capability *cp_from) +cp2_capability_copy(struct chericap *cp_to, struct chericap *cp_from) { cp2_capability_load(CHERI_CR_CT0, cp_from); @@ -488,7 +488,7 @@ #ifdef DDB #define DB_CP2_REG_PRINT_NUM(crn, num) do { \ - struct capability c; \ + struct chericap c; \ \ CP2_CR_GET((crn), c); \ db_printf("C%u perms %08jx otype %016jx\n", num, \ @@ -561,14 +561,14 @@ /* Laboriously load and print each capability. */ for (i = 0; i < 25; i++) { cp2_capability_load(CHERI_CR_CT0, - (struct capability *)&cfp->cf_c0 + i); + (struct chericap *)&cfp->cf_c0 + i); DB_CP2_REG_PRINT_NUM(CHERI_CR_CT0, i); } db_printf("\nTSC and PCC:\n"); - cp2_capability_load(CHERI_CR_CT0, (struct capability *)&cfp->cf_c0 + + cp2_capability_load(CHERI_CR_CT0, (struct chericap *)&cfp->cf_c0 + CHERI_CR_TSC_OFF); DB_CP2_REG_PRINT_NUM(CHERI_CR_CT0, CHERI_CR_TSC); - cp2_capability_load(CHERI_CR_CT0, (struct capability *)&cfp->cf_c0 + + cp2_capability_load(CHERI_CR_CT0, (struct chericap *)&cfp->cf_c0 + CHERI_CR_PCC_OFF); DB_CP2_REG_PRINT_NUM(CHERI_CR_CT0, CHERI_CR_EPCC); } ==== //depot/projects/ctsrd/cheribsd/src/sys/mips/include/cheri.h#5 (text+ko) ==== @@ -41,7 +41,7 @@ * Canonical C-language representation of a capability. */ #define CAPABILITY_SIZE 32 -struct capability { +struct chericap { uint32_t c_uperms; uint32_t c_reserved; union { @@ -52,7 +52,7 @@ uint64_t c_length; } __packed __aligned(CAPABILITY_SIZE); #ifdef _KERNEL -CTASSERT(sizeof(struct capability) == CAPABILITY_SIZE); +CTASSERT(sizeof(struct chericap) == CAPABILITY_SIZE); #endif /* @@ -65,7 +65,7 @@ #ifdef _KERNEL struct cp2_frame { /* c0 has special properties for MIPS load/store instructions. */ - struct capability cf_c0; + struct chericap cf_c0; /* * General-purpose capabilities -- note, numbering is from v1.3 of @@ -73,21 +73,21 @@ * purpose capabilities to be at the bottom, rather than the top, of * the capability register space (per Ross Anderson's suggestion). */ - struct capability cf_c1, cf_c2, cf_c3, cf_c4; - struct capability cf_c5, cf_c6, cf_c7; - struct capability cf_c8, cf_c9, cf_c10, cf_c11, cf_c12; - struct capability cf_c13, cf_c14, cf_c15, cf_c16, cf_c17; - struct capability cf_c18, cf_c19, cf_c20, cf_c21, cf_c22; - struct capability cf_c23, cf_c24; + struct chericap cf_c1, cf_c2, cf_c3, cf_c4; + struct chericap cf_c5, cf_c6, cf_c7; + struct chericap cf_c8, cf_c9, cf_c10, cf_c11, cf_c12; + struct chericap cf_c13, cf_c14, cf_c15, cf_c16, cf_c17; + struct chericap cf_c18, cf_c19, cf_c20, cf_c21, cf_c22; + struct chericap cf_c23, cf_c24; /* * Special-purpose capability registers that must be preserved on a * user context switch. Note that KT0, KT1, KCC, and KDC are omitted. */ - struct capability cf_tsc; + struct chericap cf_tsc; /* Program counter capability. */ - struct capability cf_pcc; + struct chericap cf_pcc; }; CTASSERT(sizeof(struct cp2_frame) == (27 * CAPABILITY_SIZE)); #endif @@ -123,8 +123,8 @@ #define CP2_CR_STORE(crn_from, crn_base, offset) do { \ __asm__ __volatile__ ( \ - "cscr $c%0, $c%1, %2; " : \ - : "i" (crn_from), "i" (crn_base), "r" (offset)); \ + "cscr $c%0, %1($c%2); " : \ + : "i" (crn_from), "r" (offset), "i" (crn_base)); \ } while (0) /* @@ -188,36 +188,36 @@ #define CP2_CR_SET_LENGTH(crn_to, crn_from, v) do { \ if ((crn_to) == 0) \ __asm__ __volatile__ ( \ - "cdecleng $c%0, $c%1, %2; " : \ + "csetlen $c%0, $c%1, %2; " : \ : "i" (crn_to), "i" (crn_from), "r" (v) : \ "memory"); \ else \ __asm__ __volatile__ ( \ - "cdecleng $c%0, $c%1, %2; " : \ + "csetlen $c%0, $c%1, %2; " : \ : "i" (crn_to), "i" (crn_from), "r" (v)); \ } while (0) #define CP2_CR_LOAD(crn_to, crn_base, offset) do { \ if ((crn_to) == 0) \ __asm__ __volatile__ ( \ - "clcr $c%0, $c%1, %2; " : \ - : "i" (crn_to), "i" (crn_base), "r" (offset) : \ + "clcr $c%0, %1($c%2); " : \ + : "i" (crn_to), "r" (offset), "i" (crn_base) : \ "memory"); \ else \ __asm__ __volatile__ ( \ - "clcr $c%0, $c%1, %2; " : \ - : "i" (crn_to), "i" (crn_base), "r" (offset)); \ + "clcr $c%0, %1($c%2); " : \ + : "i" (crn_to), "r" (offset), "i" (crn_base)); \ } while (0) static inline void -cp2_capability_load(u_int crn_to, struct capability *cp) +cp2_capability_load(u_int crn_to, struct chericap *cp) { CP2_CR_LOAD(crn_to, CHERI_CR_KDC, cp); } static inline void -cp2_capability_store(u_int crn_from, struct capability *cp) +cp2_capability_store(u_int crn_from, struct chericap *cp) { CP2_CR_STORE(crn_from, CHERI_CR_KDC, cp); @@ -257,50 +257,50 @@ */ #define CP2_LOAD_BYTE_VIA(crn, offset, b) do { \ __asm__ __volatile__ ( \ - "clbr %0, $c%1, %2; " : \ - "=r" (b) : "i" (crn), "r" (offset) : "memory"); \ + "clbr %0, %1($c%2); " : \ + "=r" (b) : "r" (offset), "i" (crn) : "memory"); \ } while (0) #define CP2_LOAD_HWORD_VIA(crn, offset, h) do { \ __asm__ __volatile__ ( \ - "clhr %0, $c%1, %2; " : \ - "=r" (b) : "i" (crn), "r" (offset) : "memory"); \ + "clhr %0, %1($c%2); " : \ + "=r" (b) : "r" (offset), "i" (crn) : "memory"); \ } while (0) #define CP2_LOAD_WORD_VIA(crn, offset, w) do { \ __asm__ __volatile__ ( \ - "clwr %0, $c%1, %2; " : \ - "=r" (w) : "i" (crn), "r" (offset) : "memory"); \ + "clwr %0, %1($c%2); " : \ + "=r" (w) : "r" (offset), "i" (crn) : "memory"); \ } while (0) #define CP2_LOAD_DWORD_VIA(crn, offset, d) do { \ __asm__ __volatile__ ( \ - "cldr %0, $c%1, %2; " : \ - "=r" (d) : "i" (crn), "r" (offset) : "memory"); \ + "cldr %0, %1($c%2); " : \ + "=r" (d) : "r" (offset), "i" (crn) : "memory"); \ } while (0) #define CP2_STORE_BYTE_VIA(crn, offset, b) do { \ __asm__ __volatile__ ( \ - "csbr %0, $c%1, %2; " : \ - : "r" (b), "i" (crn), "r" (offset) : "memory"); \ + "csbr %0, %1($c%2); " : \ + : "r" (b), "r" (offset), "i" (crn) : "memory"); \ } while (0) #define CP2_STORE_HWORD_VIA(crn, offset, h) do { \ __asm__ __volatile__ ( \ - "cshr %0, $c%1, %2; " : \ - : "r" (h), "i" (crn), "r" (offset) : "memory"); \ + "cshr %0, %1($c%2); " : \ + : "r" (h), "r" (offset), "i" (crn) : "memory"); \ } while (0) #define CP2_STORE_WORD_VIA(crn, offset, w) do { \ __asm__ __volatile__ ( \ - "cswr %0, $c%1, %2; " : \ - : "r" (w), "i" (crn), "r" (offset) : "memory"); \ + "cswr %0, %1($c%2); " : \ + : "r" (w), "r" (offset), "i" (crn) : "memory"); \ } while (0) #define CP2_STORE_DWORD_VIA(crn, offset, d) do { \ __asm__ __volatile__ ( \ - "csdr %0, $c%1, %2; " : \ - : "r" (d), "i" (crn), "r" (offset) : "memory"); \ + "csdr %0, %1($c%2); " : \ + : "r" (d), "r" (offset), "i" (crn) : "memory"); \ } while (0) /* @@ -315,13 +315,12 @@ * APIs that act on C language representations of capabilities -- but not * capabilities themselves. */ -void cp2_capability_copy(struct capability *cp_to, - struct capability *cp_from); -void cp2_capability_set(struct capability *cp, uint32_t uperms, +void cp2_capability_copy(struct chericap *cp_to, struct chericap *cp_from); +void cp2_capability_set(struct chericap *cp, uint32_t uperms, void *otypep /* eaddr */, void *basep, uint64_t length); -void cp2_capability_set_priv(struct capability *cp); -void cp2_capability_set_user(struct capability *cp); -void cp2_capability_set_null(struct capability *cp); +void cp2_capability_set_priv(struct chericap *cp); +void cp2_capability_set_user(struct chericap *cp); +void cp2_capability_set_null(struct chericap *cp); #ifdef _KERNEL /* ==== //depot/projects/ctsrd/cheribsd/src/sys/mips/include/cheriasm.h#4 (text+ko) ==== @@ -79,11 +79,11 @@ #define SZCAP 32 #define SAVE_U_PCB_CP2REG(treg, creg, offs, base) \ daddu treg, base, U_PCB_CP2FRAME + (SZCAP * offs); \ - cscr creg, $c30, treg + cscr creg, treg($c30) #define RESTORE_U_PCB_CP2REG(treg, creg, offs, base) \ daddu treg, base, U_PCB_CP2FRAME + (SZCAP * offs); \ - clcr creg, $c30, treg + clcr creg, treg($c30) /* * XXXRW: Update once the assembler supports reserved CP2 register names to From owner-p4-projects@FreeBSD.ORG Tue Jul 17 23:25:40 2012 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3A35E1065766; Tue, 17 Jul 2012 23:25:40 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F06A21065670 for ; Tue, 17 Jul 2012 23:25:39 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id D85478FC08 for ; Tue, 17 Jul 2012 23:25:39 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id q6HNPdtN076051 for ; Tue, 17 Jul 2012 23:25:39 GMT (envelope-from brooks@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id q6HNPd5D076048 for perforce@freebsd.org; Tue, 17 Jul 2012 23:25:39 GMT (envelope-from brooks@freebsd.org) Date: Tue, 17 Jul 2012 23:25:39 GMT Message-Id: <201207172325.q6HNPd5D076048@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to brooks@freebsd.org using -f From: Brooks Davis To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 214532 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jul 2012 23:25:40 -0000 http://p4web.freebsd.org/@@214532?ac=10 Change 214532 by brooks@brooks_ecr_current on 2012/07/17 23:25:33 Move the busy_indicator() code and support files to the touch screen library. Add a new type of dialog box to facilitate a (not yet working) text viewer. Add png viewing support the the browser. Hide most browser output under a -v flag so it doesn't clutter up pictview's text console. Affected files ... .. //depot/projects/ctsrd/beribsd/src/ctsrd-lib/libde4tc/Makefile#4 edit .. //depot/projects/ctsrd/beribsd/src/ctsrd-lib/libde4tc/de4tc.c#9 edit .. //depot/projects/ctsrd/beribsd/src/ctsrd-lib/libde4tc/de4tc.h#9 edit .. //depot/projects/ctsrd/beribsd/src/ctsrd-lib/libde4tc/images/Makefile#1 add .. //depot/projects/ctsrd/beribsd/src/ctsrd-lib/libde4tc/images/busy0.png#1 branch .. //depot/projects/ctsrd/beribsd/src/ctsrd-lib/libde4tc/images/busy0.svg#1 branch .. //depot/projects/ctsrd/beribsd/src/ctsrd-lib/libde4tc/images/busy1.png#1 branch .. //depot/projects/ctsrd/beribsd/src/ctsrd-lib/libde4tc/images/busy1.svg#1 branch .. //depot/projects/ctsrd/beribsd/src/ctsrd/browser/browser.c#12 edit .. //depot/projects/ctsrd/beribsd/src/ctsrd/browser/images/Makefile#2 edit .. //depot/projects/ctsrd/beribsd/src/ctsrd/browser/images/browser.png#2 edit .. //depot/projects/ctsrd/beribsd/src/ctsrd/pictview/img/Makefile#3 edit .. //depot/projects/ctsrd/beribsd/src/ctsrd/pictview/img/busy0.png#2 delete .. //depot/projects/ctsrd/beribsd/src/ctsrd/pictview/img/busy0.svg#2 delete .. //depot/projects/ctsrd/beribsd/src/ctsrd/pictview/img/busy1.png#2 delete .. //depot/projects/ctsrd/beribsd/src/ctsrd/pictview/img/busy1.svg#2 delete .. //depot/projects/ctsrd/beribsd/src/ctsrd/pictview/pictview.c#10 edit Differences ... ==== //depot/projects/ctsrd/beribsd/src/ctsrd-lib/libde4tc/Makefile#4 (text+ko) ==== @@ -17,4 +17,6 @@ #WARNS?= 0 +SUBDIR= images + .include ==== //depot/projects/ctsrd/beribsd/src/ctsrd-lib/libde4tc/de4tc.c#9 (text+ko) ==== @@ -152,7 +152,7 @@ struct tsstate* ts_poll(void) { - struct timespec stime = {0, 0.1}; + struct timespec stime = {0, 1000000}; static struct tsstate *sp; int init = 0; struct tsstate tmp_s; @@ -430,9 +430,22 @@ * PNG image loader *****************************************************************************/ -void +int read_png_file(const char* file_name, u_int32_t* imgbuf, int maxwidth, int maxheight) { + int fd, ret; + + fd = open(file_name, O_RDONLY); + if (fd < 0) + return(-1); + ret = read_png_fd(fd, imgbuf, maxwidth, maxheight); + /* read_png_fd() closes the file */ + return (ret); +} + +int +read_png_fd(int fd, u_int32_t* imgbuf, int maxwidth, int maxheight) +{ unsigned char header[8]; // 8 is the maximum size that can be checked size_t tmp; int x,y; @@ -448,23 +461,23 @@ int bppx; // bytes per pixel /* open file and test for it being a png */ - FILE *fp = fopen(file_name, "rb"); + FILE *fp = fdopen(fd, "rb"); if (!fp) - err(1,"fopen - failed to read from %s",file_name); + return (-1); tmp=fread(header, 1, 8, fp); if (png_sig_cmp(header, 0, 8)) - err(1,"file %s not PNG", file_name); + return (-1); png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (!png_ptr) - err(1,"png_create_read_struct failed"); + return (-1); info_ptr = png_create_info_struct(png_ptr); if (!info_ptr) - err(1,"png_create_info_struct failed"); + return (-1); if (setjmp(png_jmpbuf(png_ptr))) - err(1,"Error during init_io"); + return (-1); png_init_io(png_ptr, fp); png_set_sig_bytes(png_ptr, 8); @@ -476,20 +489,17 @@ colour_type = png_get_color_type(png_ptr, info_ptr); bit_depth = png_get_bit_depth(png_ptr, info_ptr); - //printf("image=%s, width=%1d, height=%1d, colour_type=%1d, bit_depth=%1d\n", - // file_name, width, height, colour_type, bit_depth); - if((colour_type != PNG_COLOR_TYPE_RGB) && (colour_type != 6)) - err(1,"colour type is not RGB - panic!"); + return (-1); if(bit_depth != 8) - err(1,"bit depth is not 8 - panic!"); + return (-1); number_of_passes = png_set_interlace_handling(png_ptr); png_read_update_info(png_ptr, info_ptr); /* read file */ if (setjmp(png_jmpbuf(png_ptr))) - err(1,"Error during read_image"); + return (-1); row_pointers = (png_bytep*) malloc(sizeof(png_bytep) * height); @@ -530,8 +540,37 @@ for(y=height; y fb_width) + titlewidth = fb_width - FBD_BORDER_WIDTH * 2; titleheight = fb_get_font_height() * 2; textlines = 0; @@ -565,18 +606,17 @@ textlines++; textwidth = (linewidth > textwidth) ? linewidth : textwidth; textwidth *= fb_get_font_width() * 2; + if (textwidth + FBD_BORDER_WIDTH * 2 > fb_width) + textwidth = fb_width - FBD_BORDER_WIDTH * 2; textheight = fb_get_font_height() * 2; + if (textheight + FBD_BORDER_WIDTH * 2 + titleheight > fb_height) + textheight = fb_height - FBD_BORDER_WIDTH * 2 + titleheight; maxwidth = (textwidth > titlewidth) ? textwidth : titlewidth; - dwidth = FBD_BORDER_WIDTH + maxwidth + FBD_BORDER_WIDTH; - if (dwidth > fb_width) - errx(1, "text too wide"); dheight = FBD_BORDER_WIDTH + titleheight + FBD_BORDER_WIDTH + textheight * textlines + FBD_BORDER_WIDTH; - if (dheight > fb_height) - errx(1, "text too tall"); x0 = (fb_width - dwidth) / 2; y0 = (fb_height - dheight) / 2; @@ -657,6 +697,23 @@ return(FBDA_OK); } } + case FBDT_PINCH_OR_VSCROLL: + for (;;) { + ts = ts_poll(); + switch (ts->ts_gesture) { + case TSG2_ZOOM_OUT: + fb_post(bgimage); + return(FBDA_OK); + case TSG_NORTH: + case TSG2_NORTH: + fb_post(bgimage); + return(FBDA_DOWN); + case TSG_SOUTH: + case TSG2_SOUTH: + fb_post(bgimage); + return(FBDA_UP); + } + } default: err(1, "Unhandled dialog type"); } ==== //depot/projects/ctsrd/beribsd/src/ctsrd-lib/libde4tc/de4tc.h#9 (text+ko) ==== @@ -61,11 +61,14 @@ FBDA_CANCEL, FBDA_OK, FBDA_YES, - FBDA_NO + FBDA_NO, + FBDA_DOWN, + FBDA_UP } fb_dialog_action; typedef enum { FBDT_PINCH2CLOSE, + FBDT_PINCH_OR_VSCROLL, #ifdef NOTYET FBDT_OK, FBDT_OKCANCEL, @@ -116,7 +119,10 @@ void fb_fade2text(int textbg_alpha); void plot_line(int x1, int y1, int x2, int y2, unsigned int colour); -void read_png_file(const char* file_name, u_int32_t* imgbuf, int maxwidth, int maxheight); +int read_png_file(const char* file_name, u_int32_t* imgbuf, int maxwidth, int maxheight); +int read_png_fd(int fd, u_int32_t* imgbuf, int maxwidth, int maxheight); + +void busy_indicator(void); void fb_load_syscons_font(const char *type, const char *filename); int fb_get_font_height(void); ==== //depot/projects/ctsrd/beribsd/src/ctsrd/browser/browser.c#12 (text+ko) ==== @@ -182,16 +182,18 @@ static u_int32_t *icons; static magic_t magic; static int zombies_waiting = 0; +static int verbose = 0; static void usage(void) { - printf("usage: browser [-f] \n"); - printf(" browser [-f] -T \n"); + printf("usage: browser [-fv] \n"); + printf(" browser [-fv] -T \n"); printf("\n"); printf(" -f Fork and monitor a child instance\n"); printf(" -T Don't open a tty\n"); + printf(" -v Verbose mode\n"); exit(1); } @@ -286,7 +288,6 @@ err(1, "poll"); } if (zombies_waiting) { - printf("zombie!\n"); wait4(pid, &status, 0, NULL); if (WIFEXITED(status) && WEXITSTATUS(status) != 0) { warnx("child exited with %d", @@ -305,10 +306,8 @@ warn("child killed by signal %d", WTERMSIG(status)); } else { - printf("child exited cleanly, exiting\n"); exit(0); } - printf("child exited badly, restarting\n"); zombies_waiting = 0; close(pmaster); /* XXX: should we drain it first? */ fb_fill_region(vwhite(128), 0, 0, fb_width, fb_height); @@ -556,11 +555,13 @@ struct tsstate *ts; int col, i, row; - printf("entering get_action\n"); + if (verbose) + printf("entering get_action\n"); for (;;) { ts = ts_poll(); - printf("gesture = %x\n", ts->ts_gesture); + if (verbose) + printf("gesture = %x\n", ts->ts_gesture); if (ts->ts_gesture == TSG_CLICK) { if (ts->ts_y1 < FROW) { if (ts->ts_x1 > fb_width - 40) @@ -570,7 +571,9 @@ for (col = NCOL - 1; col > 0 && ts->ts_x1 < colstart[col]; col--) /* do nothing */; - printf("row = %d, col = %d\n", row, col); + if (verbose) + printf("row = %d, col = %d\n", + row, col); return (col * NROW + row); } else { if (ts->ts_x1 >= SB_MINCOL && @@ -597,6 +600,89 @@ } static int +show_png(int dfd, const char *name) +{ + int fd; + u_int32_t *image, *previmage; + + image = malloc(sizeof(u_int32_t) * fb_width * fb_height); + previmage = malloc(sizeof(u_int32_t) * fb_width * fb_height); + if (image == NULL || previmage == NULL) + err(1, "malloc"); + fb_save(previmage); + busy_indicator(); + if ((fd = openat(dfd, name, O_RDONLY)) == -1) + return (-1); + busy_indicator(); + if (read_png_fd(fd, image, fb_width, fb_height) != 0) + return (-1); + /* read_png_fd() closes the descriptor */ + fb_post(image); + for (;;) + if(ts_poll()->ts_gesture == TSG2_ZOOM_OUT) + break; + fb_post(previmage); + free(previmage); + free(image); + + return (0); +} + +#ifdef NOTYET +static int +show_text_file(int dfd, const char *name) +{ + FILE *fp; + int fd, i, nlines, topline; + size_t linelen; + fb_dialog_action da; + char *lines[1024], buf[14 * 50]; + + if ((fd = openat(dfd, name, O_RDONLY)) == -1) + return (-1); + if ((fp = fdopen(fd, "rb")) == NULL) + return (-1); + for (nlines = 0; nlines++; nlines++) { + lines[nlines] = NULL; + linelen = 0; + if (getdelim(&lines[nlines], &linelen, '\n', fp) == -1) + break; + if (linelen >= 50) + lines[nlines][50] = '\0'; + } + if (nlines == 0) + return (-1); + + topline = 0; + for (;;) { + buf[0] = '\0'; + /* XXX: inefficient, assumes re-termination above */ + for (i = topline; i < nlines && i < topline + 14; i++) + strcat(buf, lines[i]); + + da = fb_dialog(FBDT_PINCH_OR_VSCROLL, blue, black, blue, + name, buf); + switch (da) { + case FBDA_OK: + for (i = 0; i < nlines; i++) + free(lines[nlines]); + return (0); + case FBDA_UP: + if (topline > 0) + topline -= 14; + break; + case FBDA_DOWN: + if (topline + 14 < nlines) + topline += 14; + break; + default: + err(1, "unhandled action"); + } + } +} +#endif + +static int browsedir(int dfd) { int action, topslot, j, curslot, maxdents, nfd, ndents, retfd; @@ -643,8 +729,9 @@ if (dent->icon == NULL) dent->icon = get_icon(dent->desc); - printf("%2d %20s %s\n", curslot, dent->entry->d_name, - dent->desc); + if (verbose) + printf("%2d %20s %s\n", curslot, dent->entry->d_name, + dent->desc); update_slot(curslot, dent->icon, dent->entry->d_name); } if (curslot == NSLOTS) @@ -652,7 +739,8 @@ for (;;) { action = get_action(); - printf("action %d\n", action); + if (verbose) + printf("action %d\n", action); switch (action) { case ACT_NEXT: if (topslot + curslot < ndents) { @@ -689,8 +777,22 @@ goto render; /* XXX: display error */ retfd = nfd; goto cleanup; + } else if (strcmp("image/png", + dents[topslot + action]->desc) == 0) { + show_png(dfd, + dents[topslot + action]->entry->d_name); + goto render; +#ifdef NOTYET + } else if (strcmp("text/plain", + dents[topslot + action]->desc) == 0) { + show_text_file(dfd, + dents[topslot + action]->entry->d_name); + goto render; +#endif } else { - printf ("opening non-directory not supported\n"); + if (verbose) + printf("opening non-directory not " + "supported\n"); goto render; } } @@ -715,7 +817,7 @@ int ch, dfd; int ttyflag = 1, forkflag = 0; - while ((ch = getopt(argc, argv, "fT")) != -1) { + while ((ch = getopt(argc, argv, "fTv")) != -1) { switch (ch) { case 'f': forkflag = 1; @@ -723,6 +825,9 @@ case 'T': ttyflag = 0; break; + case 'v': + verbose++; + break; default: usage(); } @@ -741,21 +846,27 @@ } fb_init(); + busy_indicator(); + fb_fade2on(); fb_load_syscons_font(NULL, "/usr/share/syscons/fonts/iso-8x16.fnt"); + busy_indicator(); if (forkflag) fork_child(); + busy_indicator(); init_magic(); + busy_indicator(); init_bgimage(); + busy_indicator(); icons = malloc(sizeof(u_int32_t) * ICON_WH * 640); if (icons == NULL) err(1, "malloc"); read_png_file(ICONS, icons, 32, 640); + busy_indicator(); fb_post(bgimage); - fb_fade2on(); //fb_fade2text(127); fb_text_cursor(255, 255); ==== //depot/projects/ctsrd/beribsd/src/ctsrd/browser/images/Makefile#2 (text+ko) ==== @@ -1,7 +1,8 @@ # From: @(#)Makefile 8.1 (Berkeley) 6/8/93 # $FreeBSD: src/share/misc/Makefile,v 1.27 2007/12/19 01:28:17 imp Exp $ -FILES= browser.png +FILES= browser.png \ + icons.png NO_OBJ= BINDIR?= ${SHAREDIR} ==== //depot/projects/ctsrd/beribsd/src/ctsrd/browser/images/browser.png#2 (text+ko) ==== @@ -1,9 +1,32 @@ PNG  -- 9fطi4ˊXmdf8jԜZ$5g*pBDDCq`FA.~pZZ׽?{4J GqDq… [l;k֬^xa˼7~|͛ cСѩSҥK\wuSOE޽;뮋_1f̘馛On-rJ :4 lN::ths91tw[V__'tR~sc=^{m~-ng]]]p _*}Ѹ3Έڪfe~5]v%"]-n0ZkС9f̘O -7ߋ={v߿t{lΜ9C7xcm۶ISO=533__\m;bĈXCKkĉ33nqoFff^ի@{gFDi&_T766 7zk9wl׮]qC _Wu~ᇫáCf]]]ylywӦM<:-mRjM%_߿N:]XJ)wQ}y:sȑ9ph3L>㙙A!C6lni~_w}MS ƍ˅ 棏>\pAqѺ-gu2e J)&Vr+4 il\CCCΝ;73?]C̷~+Wg.Jlf5 /p [J)&UGcI/>ZU̚5+_ߚ]1,XĢ1=xgbCC9$x≸[WJ"-x ,1^ȵZɸ~:33̙ݻwo2g?Yff}kgxYgxW.i+kWn??yti"]wmڴ>Iq}Ӛƪo}+L={z*۬>x衇M6OW\n/< P9Ah׮]u]w[mUagyf1mڴz̟??v_gvx뭷Z|H9bʃʻKնuuu?)[o%nߚlE>Ua֊[oji޴rusuYw^mֲ VUeĢ.m+,x+O?= {fVM0nܸtZqy5Yg^zi;vXmk?:\wu9dȐjW oᖖ_ ncKў={wǏC9"–mm̼ W۾Yƪ:]pf[o#F;3'O\g׮]Lڽ-ܒg}vȉ'o[ffwロÇ;/N8ɲoW:O=<믯۰x=_E{_9||뭷r…շ_wu3yw.kMWЗpΣo߾5I*}-2DDz>?6m4NyU-~]__n2>s[/p ͯm۶g~ /v2/Wk%DD}ն5ߍUY]vn涿{y6{^Dd6mCcno} pD7;_z&Ϛ5+9f˪!C|lg͚?oXcl뭷ӊw}7O:׿- \ No newline at end of file ++tUݲ+;aM7(V||RJm۶)trʩs)Zree%8++.0੩s\rX Uv~x%"fg=RJ#G(H)oy)cY "QFY@QU+N#FX233R.ս{wRΝsz{ٙ)S,7\xQ.]kHVVJKKW׮] 999j٪jժO&Lp֭[?J)fΜ/B)ԛoYg>RJe=zPJ)x⼟mذA)U@@@=888ܳQ#G,t7 EQűQFRC5c+ݖ{WRRRĉRD K+\޽{rG1{lo*O[fͼ΂u35n,wbUȑ#Օ+WRJ_>:@2e=Yrxر3U7;wneyٻn~}~Y"קTJ3g,+y'7eEQű +ʕ|oa-߿ EQŹ~uռhϞ=bcc?!W/zw=ܓӦMjҤI꥗^Rb@>ue˖J*{G}4%Kǫ=0333 7g}?#yϟ_?R?cSO#FoFٳRןN'QF{/ᏇRʕsi)[\ f#PEyՂ Ta.]^{g*r˝+nm?EQTq*~~ae+ΟA+rRJ  .Ujjz+ɑCNYZre8m6ٵk:5jp{:_+ +ݻK߾}~RJR+WNDD]&N'Oʉ'd2gѐ222$##02dW"##EDѣ|/"tvmV?HaÆIMM+VȒ%K$..NN>]qIٲe IOO" K6\'33cdɒN_rHYfҭ[7i׮kNVjŋe'qqq`:qŝsSŧԙ3gL o|7֋/h:!CXj瀄W^yE4ibcc]ގ3WÆ ofBCCմiMʕ+Uv4u5~fΜ}K/nӏ?߭˗ըQ#W=wi_ٳ*[swT-*FcWLVBvFe-wȟ'uΊSNN:iy>}v[).]&OJ,qN:*!!tF~v+ hw cۥM6m޼Yh7.s̱؊w臦VZI||T^cm:ce?Nj 5k֔˗KXX >tok{{=He˖-n5v2ĕP+7o&O=jy{=ov-[oey7VmCEGGR-*UdyY=*,,̰̀%JȺu{<6o Xg~1*.\0[ti)޶n6HŊM޽[zt'?8,_cmիEjfIpp/_^ʖ-kxM!CHTTS>\1Ɠm۶ ׭['IIIϙ~`o߾v1l'66OǎM?l+Kki<ҤI1ҥK/7駟?{]r y̾^V"^i[Q+̾s8r̙"cf݆˫U汾N>n7CdϞ='ȠA$,,Lbbb,ɻeΜ9nIqSf^d6CoXqr!۴i#tرП߿?3Wvz)WDDDet#))ɥKW\"_}[n-sΕ$ѣG=cxY'q\%XsuBBBx\K 40\&=z8 MiUFF\|#m)rrrd%C_*Vh޽{< ,|u 64 W_}{95h աCհaC*T5kz衆&OvV?GȭtDDTݺuUjj{>sUNK={NkϞ=ncy')nƌ{oPK,i޽{U޽U@@Go>K?>+߰ߨcǎnյkW2eGO8pǏ'xB~RСCզMLHHHp}e\~ɂ ߿x>^Ξ=+ΝXT^]U&2h r-\P ڴi#6mnzzHVV[}JJJ1&&Hg\n4p@7ouO8!qqqfټyorռ塡RfM뮻K.裏Zҥ[7s<QVk:mv$^~eWm} ^g-{oP 2335s= +7n7?׊+ߪU,uEg>PgϞU.]r &iw)i|+  7@nnnnnnnnnnnnnnlE@DDDDD+***]zrdeeU""\Ĝܾ}[VZ%fpuuWWW1 l7ED믿nzuh}DDd^C&յk䷿mӜx@{e[Njj{F?OO]W^i|}}W_}%~~~۶m$''9a0 ' \Mݻ7|||ꊥK"""ᨯt3-۷+ +R;..;c` /#$$HII={Y>} &&aaaGAA?xBK3f "##;wXf d㥗^O<www>}v닉'5}l̽6lxzzwP=#G|}}ܔL+???+V]fj]]jkk+e^/!mo\~]6l ,76 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5C2F71065674; Wed, 18 Jul 2012 14:19:00 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D8601065672 for ; Wed, 18 Jul 2012 14:19:00 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id EAA8F8FC0C for ; Wed, 18 Jul 2012 14:18:59 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id q6IEIxQi016227 for ; Wed, 18 Jul 2012 14:18:59 GMT (envelope-from brooks@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id q6IEIxDU016224 for perforce@freebsd.org; Wed, 18 Jul 2012 14:18:59 GMT (envelope-from brooks@freebsd.org) Date: Wed, 18 Jul 2012 14:18:59 GMT Message-Id: <201207181418.q6IEIxDU016224@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to brooks@freebsd.org using -f From: Brooks Davis To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 214561 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 14:19:01 -0000 http://p4web.freebsd.org/@@214561?ac=10 Change 214561 by brooks@brooks_ecr_current on 2012/07/18 14:18:29 In the modern world it is vanishingly unlikely that the serial console will be connected anything other than a termainal emulating an xterm so change the default value. Affected files ... .. //depot/projects/ctsrd/beribsd/src/etc/etc.mips/ttys#3 edit Differences ... ==== //depot/projects/ctsrd/beribsd/src/etc/etc.mips/ttys#3 (text+ko) ==== @@ -41,7 +41,7 @@ ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure # Serial terminals # The 'dialup' keyword identifies dialin lines to login, fingerd etc. -ttyu0 "/usr/libexec/getty std.115200" dialup on secure +ttyu0 "/usr/libexec/getty std.115200" xterm on secure ttyu1 "/usr/libexec/getty std.115200" dialup off secure ttyu2 "/usr/libexec/getty std.115200" dialup off secure ttyu3 "/usr/libexec/getty std.115200" dialup off secure From owner-p4-projects@FreeBSD.ORG Wed Jul 18 21:48:12 2012 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 440A210657F7; Wed, 18 Jul 2012 21:48:11 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF4C210657E2 for ; Wed, 18 Jul 2012 21:48:10 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id BF07A8FC15 for ; Wed, 18 Jul 2012 21:48:10 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id q6ILmAZl034051 for ; Wed, 18 Jul 2012 21:48:10 GMT (envelope-from brooks@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id q6ILmAOD034048 for perforce@freebsd.org; Wed, 18 Jul 2012 21:48:10 GMT (envelope-from brooks@freebsd.org) Date: Wed, 18 Jul 2012 21:48:10 GMT Message-Id: <201207182148.q6ILmAOD034048@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to brooks@freebsd.org using -f From: Brooks Davis To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 214576 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 21:48:12 -0000 http://p4web.freebsd.org/@@214576?ac=10 Change 214576 by brooks@brooks_ecr_current on 2012/07/18 21:47:43 Remove the save/restore function from the dialog box. When (ab)using it as a text viewer the refresh is distracting noise. Remove some debug printf()s. Debounce gestures in the dialog code. The current code isn't ideal due to the apparent lack of a release event when you leave the screen area, but it's better than the previous behavior where we got several swipe gestures queued up and couldn't scroll properly. Affected files ... .. //depot/projects/ctsrd/beribsd/src/ctsrd-lib/libde4tc/de4tc.c#10 edit Differences ... ==== //depot/projects/ctsrd/beribsd/src/ctsrd-lib/libde4tc/de4tc.c#10 (text+ko) ==== @@ -583,7 +583,7 @@ int textheight, textwidth, titleheight, titlewidth; char **lines; char *textdup; - u_int32_t *textbuf, *titlebuf, *bgimage; + u_int32_t *textbuf, *titlebuf; struct tsstate *ts; titlewidth = strlen(title) * fb_get_font_width() * 2; @@ -637,11 +637,6 @@ } textlines++; - bgimage = malloc(sizeof(u_int32_t) * fb_width * fb_height); - if (bgimage == NULL) - err(1, "malloc"); - fb_save(bgimage); - fb_fill_region(bgcolor, x0, y0, dwidth, dheight); for (x = x0 + FBD_BORDER_SPACE; x < x0 + dwidth - FBD_BORDER_SPACE; x++) { @@ -672,12 +667,10 @@ titlewidth, titleheight); free(titlebuf); - printf("text width %d height %d\n", textwidth, textheight); textbuf = malloc(sizeof(u_int32_t) * textwidth * textheight); if (textbuf == NULL) err(1, "malloc"); for(i = 0; i < textlines; i++) { - printf("writing text '%s'\n", lines[i]); fb_fill_buf(textbuf, bgcolor, textwidth, textheight); fb_render_text(lines[i], 2, tcolor, bgcolor, textbuf, textwidth, textheight); @@ -693,7 +686,8 @@ for (;;) { ts = ts_poll(); if (ts->ts_gesture == TSG2_ZOOM_OUT) { - fb_post(bgimage); + while (ts_poll()->ts_count != 0) + /* do nothing */; return(FBDA_OK); } } @@ -702,15 +696,18 @@ ts = ts_poll(); switch (ts->ts_gesture) { case TSG2_ZOOM_OUT: - fb_post(bgimage); + while (ts_poll()->ts_count != 0) + /* do nothing */; return(FBDA_OK); case TSG_NORTH: case TSG2_NORTH: - fb_post(bgimage); + while (ts_poll()->ts_count != 0) + /* do nothing */; return(FBDA_DOWN); case TSG_SOUTH: case TSG2_SOUTH: - fb_post(bgimage); + while (ts_poll()->ts_count != 0) + /* do nothing */; return(FBDA_UP); } } From owner-p4-projects@FreeBSD.ORG Wed Jul 18 21:51:30 2012 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 724AE1065679; Wed, 18 Jul 2012 21:51:29 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 294BA106566C for ; Wed, 18 Jul 2012 21:51:29 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id 127308FC0C for ; Wed, 18 Jul 2012 21:51:29 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id q6ILpS7P034168 for ; Wed, 18 Jul 2012 21:51:28 GMT (envelope-from brooks@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id q6ILpS6g034165 for perforce@freebsd.org; Wed, 18 Jul 2012 21:51:28 GMT (envelope-from brooks@freebsd.org) Date: Wed, 18 Jul 2012 21:51:28 GMT Message-Id: <201207182151.q6ILpS6g034165@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to brooks@freebsd.org using -f From: Brooks Davis To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 214578 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 21:51:30 -0000 http://p4web.freebsd.org/@@214578?ac=10 Change 214578 by brooks@brooks_ecr_current on 2012/07/18 21:51:01 Checkpoint a working if toy like text viewer application. Files wider that 49 colums have their lines truncated and there are arbitrary limits of 1024 lines and 32kb in size. That being side, it renders the README file in the demo directory which was the main point. Affected files ... .. //depot/projects/ctsrd/beribsd/src/ctsrd/browser/browser.c#13 edit Differences ... ==== //depot/projects/ctsrd/beribsd/src/ctsrd/browser/browser.c#13 (text+ko) ==== @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -115,7 +116,7 @@ #define SB_IMG_CHERI_ECOL 445 #define SB_MINCOL SB_IMG_NONE_BCOL #define SB_MAXCOL SB_IMG_CHERI_ECOL -#define SB_MINROW (fb_height - 39) +#define SB_MINROW (fb_height - 38) #define SB_MAXROW (fb_height - 1) /* Start offsets for browser columns */ @@ -249,6 +250,7 @@ struct sigaction act; struct pollfd pfd[1]; char buf[1024]; + u_int32_t *image; restart: if (openpty(&pmaster, &pslave, NULL, NULL, NULL) == -1) @@ -259,7 +261,8 @@ else if (pid == 0) { close(pmaster); if (login_tty(pslave) < 0) { - syslog(LOG_ALERT, "login_tty failed in child: %s", strerror(errno)); + syslog(LOG_ALERT, "login_tty failed in child: %s", + strerror(errno)); err(1, "tty_login"); } /* return to begin normal processing */ @@ -294,6 +297,11 @@ WEXITSTATUS(status)); if (WEXITSTATUS(status) == 99) { warnx("child was exploited"); + image = malloc(sizeof(u_int32_t) * + fb_width * fb_height); + if (image == NULL) + err(1, "malloc"); + fb_save(image); fb_dialog(FBDT_PINCH2CLOSE, black, white, black, "Browser Exited", @@ -301,6 +309,8 @@ "\n" "Pinch to close dialog and restart" ); + fb_post(image); + free(image); } } else if(WIFSIGNALED(status)) { warn("child killed by signal %d", @@ -602,7 +612,7 @@ static int show_png(int dfd, const char *name) { - int fd; + int fd, ret = 0; u_int32_t *image, *previmage; image = malloc(sizeof(u_int32_t) * fb_width * fb_height); @@ -611,16 +621,21 @@ err(1, "malloc"); fb_save(previmage); busy_indicator(); - if ((fd = openat(dfd, name, O_RDONLY)) == -1) - return (-1); + if ((fd = openat(dfd, name, O_RDONLY)) == -1) { + ret = -1; + goto end; + } busy_indicator(); - if (read_png_fd(fd, image, fb_width, fb_height) != 0) - return (-1); + if (read_png_fd(fd, image, fb_width, fb_height) != 0) { + ret = -1; + goto end; + } /* read_png_fd() closes the descriptor */ fb_post(image); for (;;) if(ts_poll()->ts_gesture == TSG2_ZOOM_OUT) break; +end: fb_post(previmage); free(previmage); free(image); @@ -628,59 +643,96 @@ return (0); } -#ifdef NOTYET static int show_text_file(int dfd, const char *name) { - FILE *fp; int fd, i, nlines, topline; - size_t linelen; + size_t fbuflen; + ssize_t len; fb_dialog_action da; - char *lines[1024], buf[14 * 50]; + char dbuf[14 * 50], *dbufp, *fbuf, *lines[1024]; + const size_t maxbuflen = 32 * 1024 - 1; + u_int32_t *image; + + printf("entering show_text_file\n"); - if ((fd = openat(dfd, name, O_RDONLY)) == -1) + if ((fd = openat(dfd, name, O_RDONLY)) < 0) return (-1); - if ((fp = fdopen(fd, "rb")) == NULL) - return (-1); - for (nlines = 0; nlines++; nlines++) { - lines[nlines] = NULL; - linelen = 0; - if (getdelim(&lines[nlines], &linelen, '\n', fp) == -1) + printf("fd = %d\n", fd); + + fbuf = malloc(maxbuflen + 1); + if (fbuf == NULL) + err(1, "malloc"); + for (fbuflen = 0; fbuflen < maxbuflen; fbuflen += len) { + len = read(fd, fbuf + fbuflen, + (fbuflen - maxbuflen < 4096) ? fbuflen - maxbuflen : 4096); + if (len < 0) { + warn("read"); + if (fbuflen > 0) + break; /* Use what we have if anything */ + free(fbuf); + return (-1); + } + if (len == 0) break; - if (linelen >= 50) + } + /* NUL terminate the buffer, replacing the last \n if there */ + if (fbuf[fbuflen - 1] == '\n') + fbuf[fbuflen - 1] = '\0'; + else + fbuf[fbuflen] = '\0'; + + printf("fbuf = '%s'\n", fbuf); + nlines = 0; + while (nlines <= 1024 && + (lines[nlines] = strsep(&fbuf, "\n")) != NULL) { + if (strlen(lines[nlines]) > 50) lines[nlines][50] = '\0'; + nlines++; } - if (nlines == 0) + if (nlines == 0) { + free(fbuf); return (-1); + } + image = malloc(sizeof(u_int32_t) * fb_width * fb_height); + if (image == NULL) + err(1, "malloc"); + fb_save(image); + topline = 0; for (;;) { - buf[0] = '\0'; - /* XXX: inefficient, assumes re-termination above */ - for (i = topline; i < nlines && i < topline + 14; i++) - strcat(buf, lines[i]); + dbufp = dbuf; + for (i = topline; i < topline + 13; i++) { + len = sprintf(dbufp, "%-49s%s", + (i < nlines) ? lines[i] : "", + (i < topline + 13 - 1) ? "\n" : ""); + dbufp += len; + } da = fb_dialog(FBDT_PINCH_OR_VSCROLL, blue, black, blue, - name, buf); + name, dbuf); switch (da) { case FBDA_OK: for (i = 0; i < nlines; i++) free(lines[nlines]); + free(fbuf); + fb_post(image); + free(image); return (0); case FBDA_UP: if (topline > 0) - topline -= 14; + topline -= 13; break; case FBDA_DOWN: if (topline + 14 < nlines) - topline += 14; + topline += 13; break; default: err(1, "unhandled action"); } } } -#endif static int browsedir(int dfd) @@ -782,13 +834,11 @@ show_png(dfd, dents[topslot + action]->entry->d_name); goto render; -#ifdef NOTYET } else if (strcmp("text/plain", dents[topslot + action]->desc) == 0) { show_text_file(dfd, dents[topslot + action]->entry->d_name); goto render; -#endif } else { if (verbose) printf("opening non-directory not " From owner-p4-projects@FreeBSD.ORG Wed Jul 18 22:39:46 2012 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 6DE221065676; Wed, 18 Jul 2012 22:39:46 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F8811065674 for ; Wed, 18 Jul 2012 22:39:46 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id F28C38FC08 for ; Wed, 18 Jul 2012 22:39:45 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id q6IMdjxc036484 for ; Wed, 18 Jul 2012 22:39:45 GMT (envelope-from brooks@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id q6IMdjDh036481 for perforce@freebsd.org; Wed, 18 Jul 2012 22:39:45 GMT (envelope-from brooks@freebsd.org) Date: Wed, 18 Jul 2012 22:39:45 GMT Message-Id: <201207182239.q6IMdjDh036481@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to brooks@freebsd.org using -f From: Brooks Davis To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 214580 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2012 22:39:46 -0000 http://p4web.freebsd.org/@@214580?ac=10 Change 214580 by brooks@brooks_ecr_current on 2012/07/18 22:39:42 Sort argument processing. Add a vstripes subcommand to draw black and white stripes on the screen. Affected files ... .. //depot/projects/ctsrd/beribsd/src/ctsrd/mtlctl/mtlctl.c#2 edit Differences ... ==== //depot/projects/ctsrd/beribsd/src/ctsrd/mtlctl/mtlctl.c#2 (text+ko) ==== @@ -81,10 +81,12 @@ usage(void) { - printf("usage: mtlclt gesture\n"); - printf(" mtlclt gestures\n"); + printf("usage: \n"); printf(" mtlclt fbdump \n"); printf(" mtlclt fbloaddump \n"); + printf(" mtlclt gesture\n"); + printf(" mtlclt gestures\n"); + printf(" mtlclt vstripes \n"); exit(1); } @@ -166,7 +168,7 @@ int main(int argc, char *argv[] __unused) { - int b, fd, i; + int b, fd, i, j; u_int32_t *image; if (argc < 2) @@ -174,12 +176,7 @@ fb_init(); - if (strcmp(argv[1], "gesture") == 0) - print_gesture(); - else if (strcmp(argv[1], "gestures") == 0) - for (;;) - print_gesture(); - else if (strcmp(argv[1], "fbdump") == 0) { + if (strcmp(argv[1], "fbdump") == 0) { if (argc != 3) usage(); image = malloc(fb_width * fb_height * 4); @@ -187,8 +184,7 @@ err(1, "malloc"); if ((fd = open(argv[2], O_WRONLY|O_CREAT|O_TRUNC)) == -1) err(1, "open"); - for (i = 0; i < fb_width * fb_height; i++) - image[i] = pfbp[i]; + fb_save(image); for (i = 0; i < fb_width * fb_height * 4; i += b) { b = write(fd, image, fb_width * fb_height * 4 - i); if (b == -1) @@ -199,7 +195,7 @@ usage(); image = malloc(fb_width * fb_height * 4); if (image == NULL) - err(1, "malloc"); + err(1, "malloc image buf"); if ((fd = open(argv[2], O_RDONLY)) == -1) err(1, "open"); for (i = 0; i < fb_width * fb_height * 4; i += b) { @@ -208,7 +204,34 @@ err(1, "read"); } fb_post(image); - } + } else if (strcmp(argv[1], "gesture") == 0) { + print_gesture(); + } else if (strcmp(argv[1], "gestures") == 0) { + for (;;) + print_gesture(); + } else if (strcmp(argv[1], "vstripes") == 0) { + int width; + char *endp; + if (argc != 3) + usage(); + width = strtoul(argv[2], &endp, 0); + if (*endp != '\0' || width > fb_width) { + warnx("Invalid width '%s'", argv[2]); + usage(); + } + + image = malloc(fb_width * fb_height * 4); + if (image == NULL) + err(1, "malloc image buf"); + for (i = 0; i < fb_width; i++) + for (j = 0; j < fb_height; j++) + image[i + j * fb_width] = + (((i / width) & 0x1) == 1) ? + fb_colour(0xff, 0xff, 0xff) : + fb_colour(0, 0, 0); + fb_post(image); + } else + usage(); return (0); } From owner-p4-projects@FreeBSD.ORG Thu Jul 19 15:31:38 2012 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 68E771065673; Thu, 19 Jul 2012 15:31:36 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 15A8F1065670 for ; Thu, 19 Jul 2012 15:31:36 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id F27198FC1F for ; Thu, 19 Jul 2012 15:31:35 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id q6JFVZdm080921 for ; Thu, 19 Jul 2012 15:31:35 GMT (envelope-from brooks@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id q6JFVZAi080918 for perforce@freebsd.org; Thu, 19 Jul 2012 15:31:35 GMT (envelope-from brooks@freebsd.org) Date: Thu, 19 Jul 2012 15:31:35 GMT Message-Id: <201207191531.q6JFVZAi080918@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to brooks@freebsd.org using -f From: Brooks Davis To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 214610 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 15:31:38 -0000 http://p4web.freebsd.org/@@214610?ac=10 Change 214610 by brooks@brooks_ecr_current on 2012/07/19 15:30:46 The data written by the child is not NUL terminated so keep all the bytes. This fixes image viewing in capsicum mode. Affected files ... .. //depot/projects/ctsrd/beribsd/src/ctsrd/browser/browser.c#14 edit Differences ... ==== //depot/projects/ctsrd/beribsd/src/ctsrd/browser/browser.c#14 (text+ko) ==== @@ -413,7 +413,7 @@ return "unknown"; /* Don't trust the result */ desc = buf + rlen; - strvisx(desc, buf, rlen - 1, 0); + strvisx(desc, buf, rlen, 0); return (desc); } } From owner-p4-projects@FreeBSD.ORG Thu Jul 19 18:03:01 2012 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7D4141065672; Thu, 19 Jul 2012 18:03:00 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 356E31065670 for ; Thu, 19 Jul 2012 18:03:00 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id 05B5A8FC15 for ; Thu, 19 Jul 2012 18:03:00 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id q6JI2x2H086865 for ; Thu, 19 Jul 2012 18:02:59 GMT (envelope-from brooks@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id q6JI2xx9086862 for perforce@freebsd.org; Thu, 19 Jul 2012 18:02:59 GMT (envelope-from brooks@freebsd.org) Date: Thu, 19 Jul 2012 18:02:59 GMT Message-Id: <201207191802.q6JI2xx9086862@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to brooks@freebsd.org using -f From: Brooks Davis To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 214614 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 18:03:01 -0000 http://p4web.freebsd.org/@@214614?ac=10 Change 214614 by brooks@brooks_ecr_current on 2012/07/19 18:02:40 Improve the quality of touch screen events by ignoring release events which are not followed by invalid (no-contact) readings on the next cycle. Also manufacture release events in the event that we start a ts_poll, get a no-contact reading the first time, and the previous event returned was a contact event. Convert pictview_pan() to use ts_poll.. Affected files ... .. //depot/projects/ctsrd/beribsd/src/ctsrd-lib/libde4tc/de4tc.c#11 edit Differences ... ==== //depot/projects/ctsrd/beribsd/src/ctsrd-lib/libde4tc/de4tc.c#11 (text+ko) ==== @@ -153,9 +153,10 @@ ts_poll(void) { struct timespec stime = {0, 1000000}; - static struct tsstate *sp; - int init = 0; - struct tsstate tmp_s; + static struct tsstate *sp = NULL; + int init = 0, first_pass = 1; + int check_release = 0; + struct tsstate tmp_s, rel_s; if (sp == NULL) { sp = malloc(sizeof(struct tsstate)); @@ -171,6 +172,22 @@ tmp_s.ts_y2 = le32toh(mtlctrl[6]); tmp_s.ts_gesture = le32toh(mtlctrl[7]); if (tmp_s.ts_gesture < 0) { + if (check_release) { + check_release = 0; + *sp = rel_s; + return (sp); + } + if (first_pass && !init && sp->ts_count > 0) { + /* + * If we returned a touch last time around + * then fake up a release now. + * XXX: we should probably have a timelimit + */ + sp->ts_count = 0; + sp->ts_gesture = 0; + return(sp); + } + first_pass = 0; nanosleep(&stime, NULL); continue; } @@ -182,9 +199,19 @@ tmp_s.ts_x2 != sp->ts_x2 || tmp_s.ts_y2 != sp->ts_y2 || tmp_s.ts_count != sp->ts_count || tmp_s.ts_gesture != sp->ts_gesture) { - *sp = tmp_s; - return (sp); + /* + * If we get an release event, differ returning + * it until we sleep and get a non-event. + */ + if (tmp_s.ts_count == 0) { + check_release = 1; + rel_s = tmp_s; + } else { + *sp = tmp_s; + return (sp); + } } + first_pass = 0; nanosleep(&stime, NULL); } } From owner-p4-projects@FreeBSD.ORG Thu Jul 19 23:20:16 2012 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 308E8106566B; Thu, 19 Jul 2012 23:20:15 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD3691065670 for ; Thu, 19 Jul 2012 23:20:14 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id C59B98FC14 for ; Thu, 19 Jul 2012 23:20:14 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id q6JNKEFa001104 for ; Thu, 19 Jul 2012 23:20:14 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id q6JNKEM3001101 for perforce@freebsd.org; Thu, 19 Jul 2012 23:20:14 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Thu, 19 Jul 2012 23:20:14 GMT Message-Id: <201207192320.q6JNKEM3001101@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 214623 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jul 2012 23:20:16 -0000 http://p4web.freebsd.org/@@214623?ac=10 Change 214623 by rwatson@rwatson_svr_ctsrd_mipsbuild on 2012/07/19 23:19:51 When printing CP2 registers in CheriBSD's DDB, call it CP2 and not CP0 in error. Labeling rather than functional change. Affected files ... .. //depot/projects/ctsrd/cheribsd/src/sys/mips/cheri/cp2.c#11 edit Differences ... ==== //depot/projects/ctsrd/cheribsd/src/sys/mips/cheri/cp2.c#11 (text+ko) ==== @@ -502,10 +502,10 @@ /* * Variation that prints live register state from CP2. */ -DB_SHOW_COMMAND(cp0, ddb_dump_cp0) +DB_SHOW_COMMAND(cp2, ddb_dump_cp2) { - db_printf("CP0 registers\n"); + db_printf("CP2 registers\n"); DB_CP2_REG_PRINT(0); DB_CP2_REG_PRINT(1); DB_CP2_REG_PRINT(2); @@ -543,7 +543,7 @@ /* * Variation that prints the saved userspace CP2 register frame for a thread. */ -DB_SHOW_COMMAND(cp0frame, ddb_dump_cp0frame) +DB_SHOW_COMMAND(cp2frame, ddb_dump_cp2frame) { struct thread *td; struct cp2_frame *cfp; From owner-p4-projects@FreeBSD.ORG Fri Jul 20 22:34:59 2012 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3A24B1065673; Fri, 20 Jul 2012 22:34:59 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CB457106564A for ; Fri, 20 Jul 2012 22:34:58 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id B45258FC1B for ; Fri, 20 Jul 2012 22:34:58 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id q6KMYwOk063774 for ; Fri, 20 Jul 2012 22:34:58 GMT (envelope-from brooks@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id q6KMYwS3063771 for perforce@freebsd.org; Fri, 20 Jul 2012 22:34:58 GMT (envelope-from brooks@freebsd.org) Date: Fri, 20 Jul 2012 22:34:58 GMT Message-Id: <201207202234.q6KMYwS3063771@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to brooks@freebsd.org using -f From: Brooks Davis To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 214660 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 22:34:59 -0000 http://p4web.freebsd.org/@@214660?ac=10 Change 214660 by brooks@brooks_ecr_current on 2012/07/20 22:33:55 Convert pictview_pan() to use ts_poll(). With the new version that debounces releases and fakes extra releases when one wasn't generated properly this is much smoother than the old version. Affected files ... .. //depot/projects/ctsrd/beribsd/src/ctsrd/pictview/pictview.c#11 edit Differences ... ==== //depot/projects/ctsrd/beribsd/src/ctsrd/pictview/pictview.c#11 (text+ko) ==== @@ -494,8 +494,8 @@ int pan_direction = -1; int next_display_image = display_image; int k,x,y; - int touch_release = false; - int prev_touch_x0; + int prev_ts_x1; + struct tsstate *ts; if((display_image<1) || (display_image>pictview_num_photo)) { printf("pictview_pan assertion error: display_image=%1d out of range\n", @@ -505,9 +505,6 @@ // display image for(y=0; yts_gesture == TSG2_ZOOM_OUT) + break; - // while no pinch gesture - while(!((touch_count==2) && (touch_gesture==0x49))) { - // multitouch_pole(); - multitouch_filter(); - - if((touch_count==0) && (pan_direction!=-1)) { + if((ts->ts_count==0) && (pan_direction!=-1)) { // touch released so decide which image to view - if((pan_direction==0) && (touch_x0>(fb_width/2))) + if((pan_direction==0) && (ts->ts_x1>(fb_width/2))) display_image = next_display_image; - if((pan_direction==1) && (touch_x0<(fb_width/2))) + if((pan_direction==1) && (ts->ts_x1<(fb_width/2))) display_image = next_display_image; pan_direction = -1; for(k=0; k(5*fb_width/6))) { // pan image to right + if(ts->ts_count==1) { + if((pan_direction==-1) && (ts->ts_x1>(5*fb_width/6))) { // pan image to right pan_direction=1; next_display_image = (display_image % pictview_num_photo)+1; - prev_touch_x0 = fb_width-1; + prev_ts_x1 = fb_width-1; //printf("display_image=%1d next_display_image=%1d\n",display_image,next_display_image); } - if((pan_direction==-1) && (touch_x0<(fb_width/6))) { // pan image to left + if((pan_direction==-1) && (ts->ts_x1<(fb_width/6))) { // pan image to left pan_direction=0; next_display_image = ((pictview_num_photo+display_image-2) % pictview_num_photo)+1; - prev_touch_x0 = 0; + prev_ts_x1 = 0; // printf("display_image=%1d next_display_image=%1d\n",display_image,next_display_image); } if(pan_direction!=-1) { @@ -565,13 +554,13 @@ // printf("%1d",pan_direction); for(y=0; yts_x1; x++) fb_buf[x+k] = pictview_imgs[img0][x+k]; - for(x=touch_x0; x<=prev_touch_x0; x++) + for(x=ts->ts_x1; x<=prev_ts_x1; x++) fb_buf[x+k] = pictview_imgs[img1][x+k]; } fb_post(fb_buf); - prev_touch_x0 = touch_x0; + prev_ts_x1 = ts->ts_x1; } } } From owner-p4-projects@FreeBSD.ORG Fri Jul 20 22:36:06 2012 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C32DD106566C; Fri, 20 Jul 2012 22:36:05 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0ECDA106564A for ; Fri, 20 Jul 2012 22:36:05 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id E353F8FC0C for ; Fri, 20 Jul 2012 22:36:04 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id q6KMa4DL063810 for ; Fri, 20 Jul 2012 22:36:04 GMT (envelope-from brooks@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id q6KMa4Mp063807 for perforce@freebsd.org; Fri, 20 Jul 2012 22:36:04 GMT (envelope-from brooks@freebsd.org) Date: Fri, 20 Jul 2012 22:36:04 GMT Message-Id: <201207202236.q6KMa4Mp063807@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to brooks@freebsd.org using -f From: Brooks Davis To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 214661 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2012 22:36:06 -0000 http://p4web.freebsd.org/@@214661?ac=10 Change 214661 by brooks@brooks_ecr_current on 2012/07/20 22:35:10 Update the capsicum code to return the mime result via a pipe rather than relying on a shared stdout. This is more similar to the code in browser, but is not identical. Affected files ... .. //depot/projects/ctsrd/beribsd/src/ctsrd/minifile/minifile.c#2 edit Differences ... ==== //depot/projects/ctsrd/beribsd/src/ctsrd/minifile/minifile.c#2 (text+ko) ==== @@ -4,12 +4,15 @@ #include #include +#include #include #include +#define _WITH_DPRINTF #include #include #include #include +#include enum _sbtype { SB_NONE = 0, @@ -30,10 +33,14 @@ char ch; const char *fname; int fd, status; + ssize_t rlen; pid_t pid; const char *type; struct magic_set *magic; + char buf[4096], *ttype; + int pfd[2]; + while ((ch = getopt(argc, argv, "s:")) != -1) { switch(ch) { case 's': @@ -52,7 +59,7 @@ argc -= optind; argv += optind; - magic = magic_open(0); + magic = magic_open(MAGIC_MIME_TYPE); if (magic == NULL) errx(1, "magic_open()"); if (magic_load(magic, NULL) == -1) { @@ -76,30 +83,55 @@ if (type == NULL) errx(1, "magic_file(): %s", magic_error(magic)); - printf("%s: %s\n", fname, type); break; case SB_CAPSICUM: + if (pipe(pfd) == -1) + err(1, "pipe()"); pid = fork(); if (pid < 0) err(1, "fork()"); else if (pid == 0) { + close(fd); + close(pfd[0]); + /* XXX: do more cleanup here */ cap_enter(); type = magic_descriptor(magic, fd); if (type == NULL) - errx(1, "magic_file(): %s", - magic_error(magic)); - printf("%s: %s\n", fname, type); - exit(0); + dprintf(pfd[1], "badmagic"); + else + dprintf(pfd[1], "%s", type); + close(pfd[1]); + exit(0); } else { - if (wait4(pid, &status, 0, NULL) == -1) - err(1, "wait4()"); + close(pfd[1]); + while (wait4(pid, &status, 0, NULL) == -1) + if (errno != EINTR) + err(1, "wait4()"); if (WIFEXITED(status) && - WEXITSTATUS(status) != 0) - errx(1, "child exited with %d", + WEXITSTATUS(status) != 0) { + warnx("child exited with %d", WEXITSTATUS(status)); - else if(WIFSIGNALED(status)) - errx(1, "child killed by signal %d", + close(pfd[0]); + type = "badmagic"; + } else if(WIFSIGNALED(status)) { + warn("child killed by signal %d", WTERMSIG(status)); + close(pfd[0]); + type = "badmagic"; + } else { + rlen = read(pfd[0], buf, 128); + close(pfd[0]); + if (rlen == -1) + type = "read error"; + else if (rlen == 0 || rlen == 1) + type = "unknown"; + else { + /* Don't trust the result */ + ttype = buf + rlen; + strvisx(ttype, buf, rlen, 0); + type = ttype; + } + } } break; case SB_CHERI: @@ -107,5 +139,6 @@ default: errx(1, "invalid sandbox type"); } + printf("%s: %s\n", fname, type); } }