From owner-svn-src-user@FreeBSD.ORG Sun Oct 12 08:33:57 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 151A41065690; Sun, 12 Oct 2008 08:33:57 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DF5EB8FC18; Sun, 12 Oct 2008 08:33:56 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9C8Xth5039279; Sun, 12 Oct 2008 08:33:55 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9C8XtLW039278; Sun, 12 Oct 2008 08:33:55 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810120833.m9C8XtLW039278@svn.freebsd.org> From: Edwin Groothuis Date: Sun, 12 Oct 2008 08:33:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183777 - user/edwin/top X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 08:33:57 -0000 Author: edwin Date: Sun Oct 12 08:33:55 2008 New Revision: 183777 URL: http://svn.freebsd.org/changeset/base/183777 Log: Create super-directory for all top-updates. Added: user/edwin/top/ From owner-svn-src-user@FreeBSD.ORG Sun Oct 12 08:37:01 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C7291065688; Sun, 12 Oct 2008 08:37:01 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 626998FC0C; Sun, 12 Oct 2008 08:37:01 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9C8b1EG039381; Sun, 12 Oct 2008 08:37:01 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9C8b1ws039380; Sun, 12 Oct 2008 08:37:01 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810120837.m9C8b1ws039380@svn.freebsd.org> From: Edwin Groothuis Date: Sun, 12 Oct 2008 08:37:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183778 - in user/edwin: top-3.8b1 top/top-3.8b1 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 08:37:01 -0000 Author: edwin Date: Sun Oct 12 08:37:01 2008 New Revision: 183778 URL: http://svn.freebsd.org/changeset/base/183778 Log: Move top-3.8b1 into the top hierarchy. Added: user/edwin/top/top-3.8b1/ - copied from r183777, user/edwin/top-3.8b1/ Deleted: user/edwin/top-3.8b1/ From owner-svn-src-user@FreeBSD.ORG Sun Oct 12 08:40:58 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 768191065690; Sun, 12 Oct 2008 08:40:58 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4CA808FC13; Sun, 12 Oct 2008 08:40:58 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9C8ewBm039483; Sun, 12 Oct 2008 08:40:58 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9C8evSP039482; Sun, 12 Oct 2008 08:40:58 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810120840.m9C8evSP039482@svn.freebsd.org> From: Edwin Groothuis Date: Sun, 12 Oct 2008 08:40:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183779 - user/edwin/top/top-3.8b1-3.5b12 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 08:40:58 -0000 Author: edwin Date: Sun Oct 12 08:40:57 2008 New Revision: 183779 URL: http://svn.freebsd.org/changeset/base/183779 Log: Tag user/edwin/top/top-3.8b1 with the original 3.5b12 code. Added: user/edwin/top/top-3.8b1-3.5b12/ - copied from r183778, user/edwin/top/top-3.8b1/ From owner-svn-src-user@FreeBSD.ORG Sun Oct 12 09:12:05 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DF393106568C; Sun, 12 Oct 2008 09:12:05 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C9FD18FC1B; Sun, 12 Oct 2008 09:12:05 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9C9C5wv040058; Sun, 12 Oct 2008 09:12:05 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9C9C5Ma040054; Sun, 12 Oct 2008 09:12:05 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810120912.m9C9C5Ma040054@svn.freebsd.org> From: Edwin Groothuis Date: Sun, 12 Oct 2008 09:12:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183780 - in user/edwin/top/top-3.8b1: contrib/top usr.bin/top X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 09:12:06 -0000 Author: edwin Date: Sun Oct 12 09:12:05 2008 New Revision: 183780 URL: http://svn.freebsd.org/changeset/base/183780 Log: All collected changes to get top 3.8b1 in the state as announced on -stable and -current as version A: http://www.mavetju.org/mail/view_thread.php?list=freebsd-current&id=2819930&thread=yes Added: user/edwin/top/top-3.8b1/contrib/top/LICENSE user/edwin/top/top-3.8b1/contrib/top/Makefile.in user/edwin/top/top-3.8b1/contrib/top/ap_snprintf.c user/edwin/top/top-3.8b1/contrib/top/color.c user/edwin/top/top-3.8b1/contrib/top/color.h user/edwin/top/top-3.8b1/contrib/top/commands.h user/edwin/top/top-3.8b1/contrib/top/config.amd64.make user/edwin/top/top-3.8b1/contrib/top/config.amd64.makeinstall user/edwin/top/top-3.8b1/contrib/top/config.default.makeinstall user/edwin/top/top-3.8b1/contrib/top/config.guess (contents, props changed) user/edwin/top/top-3.8b1/contrib/top/config.h.in user/edwin/top/top-3.8b1/contrib/top/config.sparcv9.make user/edwin/top/top-3.8b1/contrib/top/config.sparcv9.makeinstall user/edwin/top/top-3.8b1/contrib/top/config.sub (contents, props changed) user/edwin/top/top-3.8b1/contrib/top/configure (contents, props changed) user/edwin/top/top-3.8b1/contrib/top/configure.ac user/edwin/top/top-3.8b1/contrib/top/globalstate.h user/edwin/top/top-3.8b1/contrib/top/hash.c user/edwin/top/top-3.8b1/contrib/top/hash.h user/edwin/top/top-3.8b1/contrib/top/hash.m4c (contents, props changed) user/edwin/top/top-3.8b1/contrib/top/hash.m4h (contents, props changed) user/edwin/top/top-3.8b1/contrib/top/install-sh (contents, props changed) user/edwin/top/top-3.8b1/contrib/top/message.h user/edwin/top/top-3.8b1/contrib/top/top.1.in user/edwin/top/top-3.8b1/contrib/top/username.h user/edwin/top/top-3.8b1/contrib/top/version.h user/edwin/top/top-3.8b1/usr.bin/top/config.h.in user/edwin/top/top-3.8b1/usr.bin/top/machine.man Deleted: user/edwin/top/top-3.8b1/contrib/top/ADVERTISEMENT user/edwin/top/top-3.8b1/contrib/top/Configure user/edwin/top/top-3.8b1/contrib/top/DISCLAIMER user/edwin/top/top-3.8b1/contrib/top/Make.desc.X user/edwin/top/top-3.8b1/contrib/top/Makefile.X user/edwin/top/top-3.8b1/contrib/top/getans user/edwin/top/top-3.8b1/contrib/top/install user/edwin/top/top-3.8b1/contrib/top/m-template user/edwin/top/top-3.8b1/contrib/top/metatop user/edwin/top/top-3.8b1/contrib/top/patchlevel.h user/edwin/top/top-3.8b1/contrib/top/prime.c user/edwin/top/top-3.8b1/contrib/top/top.X user/edwin/top/top-3.8b1/contrib/top/top.local.H user/edwin/top/top-3.8b1/usr.bin/top/top.local.1 Modified: user/edwin/top/top-3.8b1/contrib/top/Changes user/edwin/top/top-3.8b1/contrib/top/FAQ user/edwin/top/top-3.8b1/contrib/top/INSTALL user/edwin/top/top-3.8b1/contrib/top/Porting user/edwin/top/top-3.8b1/contrib/top/README user/edwin/top/top-3.8b1/contrib/top/Y2K user/edwin/top/top-3.8b1/contrib/top/commands.c user/edwin/top/top-3.8b1/contrib/top/display.c user/edwin/top/top-3.8b1/contrib/top/display.h user/edwin/top/top-3.8b1/contrib/top/getopt.c user/edwin/top/top-3.8b1/contrib/top/layout.h user/edwin/top/top-3.8b1/contrib/top/loadavg.h user/edwin/top/top-3.8b1/contrib/top/machine.h user/edwin/top/top-3.8b1/contrib/top/os.h user/edwin/top/top-3.8b1/contrib/top/screen.c user/edwin/top/top-3.8b1/contrib/top/screen.h user/edwin/top/top-3.8b1/contrib/top/sigconv.awk user/edwin/top/top-3.8b1/contrib/top/top.c user/edwin/top/top-3.8b1/contrib/top/top.h user/edwin/top/top-3.8b1/contrib/top/username.c user/edwin/top/top-3.8b1/contrib/top/utils.c user/edwin/top/top-3.8b1/contrib/top/utils.h user/edwin/top/top-3.8b1/contrib/top/version.c user/edwin/top/top-3.8b1/usr.bin/top/Makefile user/edwin/top/top-3.8b1/usr.bin/top/machine.c Modified: user/edwin/top/top-3.8b1/contrib/top/Changes ============================================================================== --- user/edwin/top/top-3.8b1/contrib/top/Changes Sun Oct 12 08:40:57 2008 (r183779) +++ user/edwin/top/top-3.8b1/contrib/top/Changes Sun Oct 12 09:12:05 2008 (r183780) @@ -1,3 +1,320 @@ +Tue May 6 2008 - wnl (3.8beta1) + Main code: fixed bugs in screen_cleareol and in display code. Fixed + bug in i_swap when all data is 0. Added ^W patch (from thaquis). + Fixed bug in xdprintf. Added command line options for the "t" and + "m" commands. + SunOS 5 changes: Support for showing individual threads. Redid + allocation of prpsinfo structures. Added a pidthr hash that uses + both pid and thread id for a key. Changed format_process_header + and format_next_process to use a table-driven method for generating + the columns. Status files from /proc (psinfo and lpsinfo) are now + cached to avoid repeatedly reopening them. Column showing number of + LWPs is now called "NLWP" and column showing lwpid is "LWP". + FreeBSD changes: Runtime check to ensure binary is running on + the same machine type it was compiled for. Lots of cleanup and + changed nearly everything to use sysctl rather than kvm, and + inability to open kvm is no longer fatal. Improved thread reporting: + disabled for 7.x and lower. Added lwpid hash for proper tracking + of threads. Changed format_process_header and format_next_process + to use a table-driven method for generating the columns. + Dec Alpha: configure uses compile-time options to properly trap + and handle exceptions from the Alpha FPU (from Brian Maly). + +Tue Feb 26 2008 - wnl (3.7) + Prepare for version 3.7 release. + +Fri Feb 1 2008 - wnl (3.7beta4) + Using the $ notation in printf formats for freebsd apparently was + causing problems on 64-bit systems. All such usage has been + removed and the process line is formatted piecemeal. + +Thu Dec 27 2007 - wnl (3.7beta3) + Improved function comments in display.c for message_error functions. + Changed some of the error messages in top.c to be more succint. + +Fri Dec 7 2007 - wnl (3.7beta3) + Changes to freebsd port: moved some functions up front to + eliminate forward references. Use sysctl to get all vm stats + information, as some of this isn't updated in the struct + vmmeter under FreeBSD 7.0. Added routines to support large-scale + sysctl access. + +Wed Nov 28 2007 - wnl (3.7beta3) + Changes to documentation: FAQ, README, man page. + +Tue Nov 27 2007 - wnl (3.7beta3) + For freebsd, added page faults, pageins, pageouts, and pages + freed to the kernel display line. These numbers reflect the + values presented in vmstat. For sunos5, added page faults, + pageins and pageouts to the kernel display line. + +Fri Nov 2 2007 - wnl (3.7beta3) + Added copyright notices to the top of every source and include file. + Added copyright information to the man page. + Removed a few outdated things from the manifest. + Minor changes to sigconv.awk. + +Sat Oct 27 2007 - wnl (3.7beta3) + Added check for sys_signame at configure time and if it is + present then it is used in commands.c to translate signal names + in to numbers. + Added alternate snprintf and vsnprintf functions from apache (in + ap_snprintf.c). Added configure magic to define and compile them in + where needed. Added check to configure for variadic macros. + Preprocessor defintion of dprintf (in utils.h) now depends on + support for variadic macros. Cleaned up m_linux code. + +Wed Oct 3 2007 - wnl (3.7beta3) + Lots of changes, thanks to Mark Wong. Most changes were to + clean the code up so that it would compile cleanly with -Wall + (all warnings). Changed function names in screen.c so that + they all start with "screen_". Isolated all interaction with + termcap to screen.c by adding a real function for cursor + addressing (in the past it was just a macro). Only screen.c + now needs to worry about defining templates for the termcap + functions. Added configure and preprocessor magic to ensure + that all the termcap functions used in the code are defined + with templates. Changed names of some other functions and + global variables to avoid name conflicts with functions in + curses and other well established libraries. Changed dprintf + macro to use variadic arguments so that the preprocessor can + gobble up the entire call when compiling without debugging + (this will have to be made more portable). All include files + are surrounded by #ifndef statements to accomodate multiple + inclusions. Platform module is now compiled with + -fno-strict-aliasing as some of the modules do type punning + that can confuse the optimizer. + +Wed Sep 26 2007 - wnl (3.7beta3) + For freebsd, priority is no longer normalized by PZERO. This + contradicts the behavior used by ps when it displays priority. + But normalizing by PZERO has become a bit of an anachronism + and it actually obscures the meaning of the priority without + adding any real value. + +Wed Sep 19 2007 - wnl (3.7beta3) + Many changes to improve the display of threads. Changed + process summary line to use the word "threads" when showing + individual threads. Added the system command to toggle the + display of system processes. Fixed bug in hash.c remove_pos. + For freebsd: count threads correctly when they are being + displayed, nice column is more closely in line with ps + (nothing fancy for real time processes), add two more process + states that didn't exist in older releases of freebsd (wait + and lock). + For linux: Threads done right. Now track individual threads + of multi-threaded processes separately so that we always know + their %cpu. Switch to format_process_header so that we can + change the column headings and remove the THR column when + displaying individual threads. Switched process (and thread) + tracking over to use generic hash table functions included + with the new version of top. Process states and total now + include threads when they are being shown. Added "SHR" column + to show the amount of shared memory per process. Improved + calculation of elapsed time and percent cpu to avoid + overflows. Remove weighted cpu calculations entirely as it is + an anachronism. + For Solaris: Moved check for libelf to accomodate older systems. + +Sun Sep 9 2007 - wnl (3.7beta2) + Documentation changes. Fixes to sunos5 port. Added display of + thread count and selection by command name to linux port. Removed + the use of inline functions from hash.c as that doesn't appear to + be very portable. + +Wed Sep 5 2007 - wnl (3.7beta1) + Fixed freebsd and linux configuration bugs. Added configuration + options for tweaking program defaults. Rewrote top level code + (top.c) from scratch, including command handling so that adding + new commands is much easier. Changed message-line handling to + ensure that the message is displayed for at least 5 seconds + regardless of the update frequency. Added a "miniupdate" that + occurs one second after the initial screen on systems that don't + already delay the first screen. The mini-update shows cpu state + percentages. Added ability to select output by command name on + some systems. Fixed color toggling via the "C" command. Added + long options via getopt_long to complement the existing single + character options. Added the freebsd "m" command to chose + alternate display modes. On freebsd this gives a process i/o + display. Added the freebsd "H" command to select the display of + individual threads. Added "-a" option ("all") to set number of + displays and number of processes to infinity (equivalent to + "-d all all"). Added dual architecture compilation for Solaris + to generate both a 32-bit and a 64-bit binary. This is on by + default when compiling on a 64-bit system and can be explicitly + set via "configure --enable-dualarch". Added uniform hashing + functions that use bucket hash for uint, pid, and string. Changed + username.c and the sunos and freebsd modules to use these functions. + Added the "kernel" information line to the display to show + statistics on what the kernel is doing (context switches, forks, + traps, etc.). This requires explicit support by the platform + module, currently only freebsd, linux, and sunos. + +Wed Apr 18 2007 - wnl (3.6.1) + Fixed a few bugs in sigconv.awk that were causing incorrect + results on FreeBSD. Changed configure.ac to fix a few linux + problems: signal include file and /proc/1/stat. + +Fri Apr 13 2007 - wnl (3.6.1) + Removed the use of VPATH for compiling the system module and used + an explicit dependency in the Makefile instead. VPATH is now set + to just srcdir to ensure that top will compile correctly when + configured from a different directory. On systems without VPATH + support, top will still configure and compile, but only + from within the source directory. This fixes bug 1699526. + +Fri Feb 2 2007 - wnl (3.6.1) + Revised the way that configure figures out owner, group, and mode. + For systems that don't use the kernel, it tries to match install + settings to allow access to stuff in /proc. More importantly, if + mode is 755 then neither owner nor group are set. This fixes bug + 1631136. Added patch from haanjdj@xs4all.nl to fix an occasional + core dump in m_decosf1.c. This checks return code from task_threads. + Made sure all get_system_info functions are declared void. Fixed + string termination bug. Cleaned up documetation for sunos5. + +Tue Aug 8 2006 - wnl (3.6.1) + For Solaris, changed the tag "swap" to "total swap" to clarify + what is beign displayed. Note that the calculations are still the + same: the display is just showing total rather than total - free. + +Thu Apr 27 2006 - wnl (3.6) + Added patches for linux-style sort shortcuts and for Unixware + support in configure (patch 1474427). Fixed sunos5 to do slow start + and to ensure cpucount is set (patch 1477386). Added pagination + routines to display.c and modified show_help to use it, since the + help screen is now longer than 24 lines. Applied patch for unixware + support that adds check for mas library (patch #1474423). Solaris + cpu percent now reflects a percentage of the entire server, rather + than a single cpu (bug 1478138). + +Mon Mar 27 2006 - wnl (3.6) + The production release of version 3.6. Fixed a minor scaling + bug in the decosf1 module. Support for MacOS X is officially + withdrawn although the macosx module is still part of the + distribution. Hopefully this is a temporary situation. + Documentation updated. + + +Wed Feb 15 2006 - wnl (3.6beta5) + Minor changes to eliminate warnings from the Sun Studio compiler. + These were mostly sloppy argument declarations. I also added + message.h to provide an interface file for just the message + related functions of display.c. + +Mon Dec 26 2005 - wnl (3.6beta4) + Added new netbsd module, courtesy of Simon Burge. + Fixed a few bugs in SVR4 module and added its use to + configure.ac, thanks to Sanchet Dighe. Also ensured that the + novpath Makefile was in the distribution. + Fixed portability problem in display.c + + +Mon Oct 24 2005 - wnl (3.6beta3) + Set up a color tagging mechanism in color.c to allow for the + dynamic creation of tag names to contol color highlighting. + These names are partially derived from the tags used to label + memory and swap information on the screen, thus are driven by + the machine module itself. Added -T option to list color + highlighting information. Help screen now includes the actual + list of sort order names. Incorporated some minor fixes to + the main code from the Freebsd source tree. Fixed bug #1324582. + Freebsd 5: removed WCPU column and added THR column. Display + for freebsd 4 and earlier unchanged since they don't track + threads in the kernel. Added LICENSE file to distribution. + +Wed Oct 12 2005 - wnl (3.6beta2) + Major overhaul to display.c. All lines of the display are + directly tracked and controlled via display_write and its + companion display_fmt. Added support for complete control + of ANSI color on the screen: this will be used in the future + to allow for full use of color everywhere on the screen. + Signal handling code now uses sigaction on all systems that + support it. Restored the freebsd module and did away with + freebsd4, and upgraded freebsd module to support 5.x. + Fix bug #1306099 (wio(wait) timer ignored on OSF1). + +Fri Sep 23 2005 - wnl (3.6beta1) + Fixed bugs #1266341 (compilation errors with gcc 4.x), + #1156464 (cpu% field for sunos), #1156243 (compilation + errors on AIX). Applied patches #1217855 (Solaris 10 + xarch flag). Overhaul of sunos5 module, making code more + efficient and easier to follow. Got rid of need for MEMTYPE + type in utils.h. Changed all memory statistics data in the + module specification from an int to a long to better support + 64-bit systems with lots of memory. Moved all unused modules + out of the distribution (I will add them back in as needed). + Moved freebsd module to freebsd4 as it won't work with 5.x + (a new module will be necessary). Added support to configure + for makes that don't understand VPATH. Updated documentation: + man page, FAQ, README, INSTALL. + +Mon Jan 24 2005 - wnl (3.6alpha10) + Updated aix43 module with ANSI function declarations and fixed + declaration of get_system_info. Configure now uses irixsgi + module for irix6* systems. Updates to the following modules: + irixsgi, sunos5. Fixed null pointer bug in color.c. Removed + some useless code and definitions in display.c + + +Sun Nov 28 2004 - wnl (3.6alpha9) + Replace AIX 5 module with alternate (bug 1056565). + Fixed vulnerability in use of snprintf. + +Fri Oct 22 2004 - wnl (3.6alpha8) + Support for linux 2.6, added more stuff to memory and swap lines. + Updated linuxthr module, which is only useful on 2.4 and earlier. + Added some color support back in (feature request 930588), but + still need to add it back to the per-process display. Added + OSF 5 support (untested). + Fixed bug 1017951 (invalid process count argument not caught) + +Tue Apr 20 2004 - wnl (3.6alpha7) + Added 64 bit support for AIX. + +Thu Apr 15 2004 - wnl (3.6alpha6) + Included fixes for decosf1 pid size and updated module. Also + added osf1 to list of recognized operating systems in configure.ac. + +Tue Mar 30 2004 - wnl (3.6alpha5) + Minor bug fixes and some code rearrangement. Changes to install + rule. Added several more platforms including: aix 4.2 thru 5, + MacOS 10, Dec OSF, HPUX 7 thru 11. Fixed the core dumping bug + in linux. Code cleanup, including sigdesc.h (by changing + sigconv.awk). Startup error messages are displayed on the + first screen rather than beforehand (no more pause). Cleaned + up interrupt handling to avoid a race condition. Eliminated + top.local.h. REMOVED Configure!!! + +Mon Mar 22 2004 - wnl (3.6alpha1) + Now using gnu autoconf. Eliminated the need for CFLAGS and LIBS + tags in the module source files. Autoconf tries to figure all + that out now. Machine module interface now uses flags to determine + if module supports sorting, selective display of idle processes, + viewing full commands. Added display of uptime for modules that + support it. Added display of full command lines for modules that + support it. 3.5 modules must be changed a bit to work for 3.6: + ORDER is no longer defined, and the module must fill in the + appropriate fields in struct statics to get the extra features. + Added a extenstion interface to allow for putting extra stuff + on the screen -- this is still half baked and not documented. + +Mon Feb 23 2004 - wnl (3.5) + Turned rc1 in to version 3.5. Only changes were to the FAQ. + +Mon Feb 2 2004 - wnl (3.5rc1) + Changed format_k (utils.c) to use MEMTYPE for its parameter. + On most systems this is a long, but if the module defines + USE_SIZE_T, this is set to be a size_t. The sunos5 module + now defines it, so that it will work correctly on 64-bit + machines. New "linuxthr" module for rolling up processes + that are really threads. Configure autodetects when running + on a 64-bit Solaris machine. + +Tue Dec 16 2003 - wnl (3.5beta13) + Improved linux module. For Solaris, changed "THR" column + heading to "LWP" since that's what they really are. + Thu Mar 30 2000 - wnl (3.5beta12) Updated modules: m_aix41.c, m_aix43.c, m_mtxinu.c, m_sco5.c, and m_ultrix4.c. Modified: user/edwin/top/top-3.8b1/contrib/top/FAQ ============================================================================== --- user/edwin/top/top-3.8b1/contrib/top/FAQ Sun Oct 12 08:40:57 2008 (r183779) +++ user/edwin/top/top-3.8b1/contrib/top/FAQ Sun Oct 12 09:12:05 2008 (r183780) @@ -1,264 +1,340 @@ - TOP - Version 3.5 - Beta Release 11 + TOP + Version 3.8beta1 - William LeFebvre - with much help from others + William LeFebvre + with much help from others + Frequently Asked Questions and their Answers -FREQUENTLY ASKED QUESTIONS AND THEIR ANSWERS -This FAQ is broken out in to several topics. + GENERAL + + 1. What is top? + + Top provies the user with a regularly updated display showing + information about the system and its top cpu-using processes. Think + of it as a full-screen "ps" output that gets updated at regular + intervals. + + 2. Where do I get the latest version of top? + + The official site for top is "ftp.unixtop.org" in the directory + "/pub/top". Top is also a SourceForge project, and the most recent + releases are available on any of the SourceForge mirrors. The + SourceForge project page is at + http://sourceforge.net/projects/unixtop. + + 3. Is there a web page for top? + + Yes. Point your browser at http://www.unixtop.org. It includes all + documentation, a nice interactive display which describes the various + components of the output of top, web-based retrieval of the package, + year 2000 information, and other neat stuff. + + 4. Is there a mailing list or on-line bulletin board for top? + + There is a mailing list used for general announcements regarding top, + including new releases. This mailing list is available to sourceforge + members and can be accessed from the unixtop sourceforge project + page. Visit SourceForge and search for the project "unixtop", then + click on "mailing lists". There are also on-line forums available + through SourceForge where members can post questions and comments. + + 5. What about Year 2000 compliance? + + Top did not experience any problems with the transition to the year + 2000. A full statement concerning top and the year 2000 can be found + in the file "Y2K" included with the distribution. + + 6. Will there be another major release of top? Will there be a top + version 4? + + I have some great ideas for the next major release of top, and I very + much want to make those ideas a reality. What I don't have much of + these days is free time. But I will keep poking at it and I hope to + have top version 4.0 ready by the fall of 2006. + + 7. Does top really support multi-processor systems? + + On platforms that support multiple processors, top is able to detect + and correctly summarize the information about those processors. What + top does not do is break down the cpu states summary (the third line + of the display) by cpu. Instead it collects the cpu state information + from all processors and combines them in to a single line. Some + vendors include a modified version of top that presents this + information for each cpu. Top 3.7 may have this functionality but it + is not present in the standard top 3.6 release. + + 8. Is top under CVS control? Can I access the sources via SourceForge + CVS or Subversion? + + I maintain top using subversion, not CVS. Although I utilize my own + private subversion repository, it is regularly mirrored in to the + SourceForge Subversion repository. You can access the SourceForge + repository here: https://svn.unixtop.org/unixtop/top-3. + + + COMPILING + + 9. We just upgraded our operating system to a new version and top broke. + What should we do? + + Recompile it. Top is very sensitive to changes in internal kernel + data structures. It is not uncommon for a new version of the + operating system to include changes to kernel data structures. + + + RUNNING + +10. I just finished compiling top and it works fine for root, but when I + try to run it as a regular user it either complains about files it + can't open or it doesn't display all the information it should. Did I + do something wrong? + + Well, you're just not done. On many operating systems today, access + to many of the kernel memory devices and other system files is + restricted to either root or a particular group. The configure script + figures this out (usually) and makes sure that the "install" rule in + the Makefile will install top so that anyone can run it successfully. + However, you have to *install* it first. Do this with the command + "make install". + +11. Top is (not) displaying idle processes and I don't (do) want it to. + + This default has only changed about a dozen times, and I finally got + tired of people whining about it. Go read the manual page for the + current version and pay special attention to the description of the + "TOP" environment variable. + +12. We have so much memory in our machine that the memory status display + (the fourth line) ends up being longer than 80 characters. This + completely messes up top's output. Is there a patch? + + Most modules have been changed to use new memory formatting functions + which will display large values in terms of megabytes instead of + kilobytes. This should fix all occurences of this problem. Also note + that newer versions of top can use columns beyond 79, and understand + window resizes. So you can always make your window wider. + +13. I tried to compile top with gcc and it doesn't work. I get + compilation errors in the include files, or I get an executable that + dumps core, or top displays incorrect numbers in some of the + displays. What's wrong? + + Gnu CC likes very much to use its own include files. Not being a gcc + expert, I can't explain why it does this. But I can tell you that if + you upgrade your operating system (say from Solaris 2.6 to Solaris + 2.7) after installing gcc, then the include files that gcc uses will + be incorrect, especially those found in the "sys" directory. Your + choices are: (1) rebuild and reinstall the "standard" include files + for gcc (look for scripts in the distribution called "fixincludes" + and "fixinc.svr4"), (2) compile machine.c with + "CFLAGS=-I/usr/include" then make the rest of the object files + normally, or (3) use a different compiler. + +14. The cpu state percentages are all wrong, indicating that my machine + is using 95% system time when it is clearly idle. What's wrong? + + This can happen if you compiled with gcc using the wrong include + files. See the previous question. + + + FREEBSD PROBLEMS + +15. This version of top does not show individual threads with the "t" or + "H" commands. Instead it says "command not available." Why? + + Previous versions of top attempted to support the display of + individual threads under FreeBSD through the use of the "t" command. + However, the FreeBSD kernel does not supply sufficient or correct + information on the individual threads within a process. So the data + that was being displayed was incorrect and misleading. Therefore, top + version 3.8 disables the use of this command to prevent the display + of incorrect information. FreeBSD 8.0 will correctly report + per-thread information and top version 3.8 supports the use of the + "t" command for version 8.0. + +16. The "f" command (to display full command lines for the processes) + does not work and instead says "command not available". Why? + + The current version of top is able to use sysctl to retrieve almost + all of the information it needs without having to open /dev/kmem. The + one piece of information not available via sysctl is the full command + line of each argument. If you run top as a regular user and it cannot + open /dev/kmem (in other words, it is not installed set-gid to the + kmem group) then it will disable the "f" command. Make sure the top + binary is installed with a group ownership of "kmem" and with the + set-gid bit on if you want the "f" command to work properly. + + + MACOSX PROBLEMS + +17. I tried to configure top on my Mac OSX system and I got an error + claiming "macosx not supported". What up? + + Since I don't have full time root access to a Mac OSX system I cannot + provide effective support for the platform. MacOSX uses Mach, and it + is very difficult to extract accurate system and process information + from the system. It takes a lot of trial and error, along with root + access. I have included the most up-to-date version of the macosx + module in the distribution, but I do not claim that it works. If you + want to try to use it, you can configure with "./configure + --with-module=macosx". + + + SUNOS PROBLEMS + +18. I tried compiling top under SunOS version 4.1.x and it got compile + time errors or run time errors. Is there a patch? + + If you try compiling top in a "System V environment" under SunOS + (that is, /usr/5bin is before /usr/bin on your path) then the + compilation may fail. This is mostly due to the fact that top thinks + its being compiled on a System V machine when it really isn't. The + only solution is to put /usr/bin and /usr/ucb before /usr/5bin on + your path and try again. + + + SOLARIS PROBLEMS + + + NOTE: the most common source of problems with top under Solaris is + the result of compiling it with the wrong front end. Make sure that + /usr/ucb is not on your path before attempting to compile top under + Solaris. + +19. Is there somewhere I can get a pre-compiled package? + + Yes. Although I don't provide pre-compiled binaries, you can get a + Sun-style package from www.sunfreeware.com. + +20. Under Solaris 2, when I type "make", the system says "language + optional software package not installed." What's going on? + + You tried to compile with /usr/ucb/cc. Make sure /usr/ucb is not on + your path. Furthermore, you do not have a Sun compiler installed on + your system. You need a compiler to make top. Either Sun's C compiler + or the Gnu C compiler will work fine. + +21. Under Solaris 2, when I run top as root it only shows root processes, + or it only shows processes with a PID less than 1000. It refuses to + show anything else. What do I do? + + You probably compiled it with /usr/ucb/cc instead of the real C + compiler. /usr/ucb/cc is a cc front end that compiles programs in BSD + source-level compatability mode. You do not want that. Make sure that + /usr/ucb is not on your path and try compiling top again. + +22. Under Solaris 2, I compiled top using what I am sure is the correct + compiler but when I try to run it it complains about missing dynamic + libraries. What is wrong? + + Check to see if you have LD_LIBRARY_PATH defined in your shell. If + you do, make sure that /usr/ucblib is not on the path anywhere. Then + try compiling top again. + +23. Under Solaris 2, when I try to run top it complains that it can't + open the library "libucb.so.1". So I changed the LIBS line in + m_sunos5.c to include -R/usr/ucblib to make sure that the dynamic + linker will look there when top runs. I figured this was just an + oversight. Was I right? + + No, you were not right. As distributed, top requires no alterations + for successful compilation and operations under any release of + Solaris 2. You probably compiled top with /usr/ucb/cc instead of the + real C compiler. See FAQ 22 for more details. + +24. On my 64-bit system some processes show up with incorrect information + (such as zero memory). + + If you are running a 64-bit system, then you need to make sure that + you are running the 64-bit top binary. Top's configure script + attempts to detect 64-bit systems, and will automatically generate + both 32-bit and 64-bit binaries on such systems. If you use or + install the 32-bit binary on a 64-bit system top will still run but + will not produce the correct results. This will also happen if you + configure your distribution on a 32-bit system then compile with that + configuration on a 64-bit system. You must configure and compile on + the same system. For Sparc systems the 32-bit binary will be created + in the subdirectory "sparcv7" and the 64-bit binary will be created + in the subdirectory "sparcv9". For Intel systems the directories will + be "i386" (32-bit) and "amd64" (64-bit). In all cases a copy of + /usr/lib/isaexec is made in the main directory and called "top". This + program will choose the correct binary to run from one of these + subdirectories. See isaexec(3c) for more details. + +25. Can I install both 32-bit and 64-bit binaries on a central file + server and have machines which mount it automatically use the correct + one? + + Yes. If you configure and compile on a 64-bit system, top's configure + script and makefile will automatically create both 32-bit and 64-bit + binaries. The "install" rule in the makefile will install these + binaries in subdirectories of /usr/local/bin appropriate to the + architecture (sparcv7/sparcv9 or i386/amd64) then create a copy of + /usr/lib/isaexec named "top" in /usr/local/bin to ensure that the + appropriate is run when a user types "top". If you make sure that you + configure and compile on a 64-bit system, then "make install" will do + the right thing. + +26. This version of top show less available swap space than previous + versions. Why does it no longer match the output of the swap summary + produced with "swap -s"? + + Starting with version 3.6 of top, the amount of swap space reported + by top has been changed to reflect only disk-based swap space. The + swap summary produced with "swap -s" also includes memory-based swap + space. This changed was made for several reasons. It makes the + display under Solaris more like those of other operating systems. The + display is more what users expect (except those used to previous + versions of top). Most importantly, "swap -s" gets its data via an + undocumented system interface. Now that top no longer displays that + data it can use publically documented and maintained system + interfaces to retrieve its data. + + + SVR4-DERIVED PROBLEMS + +27. When I run top on my SVR4-derived operating system, it displays all + the system information at the top but does not display any process + information (or only displays process information for my own + processes). Yet when I run it as root, everything works fine. What's + wrong? + + Your system probably uses the pseudo file system "/proc", which is by + default only accessible by root. Top needs to be installed setuid + root on such systems if it is going to function correctly for normal + users. + + + SVR42 PROBLEMS + +28. The memory display doesn't work right. Why? + + This is a known bug with the svr42 module. The problem has been + traced down to a potential bug in the "mem" driver. The author of the + svr42 module is working on a fix. + + + STILL STUCK + +29. I'm still stuck. To whom do I report problems with top? + + The most common problems are caused by top's sensitivity to internal + kernel data structures. So make sure that you are using the right + include files, and make sure that you test out top on the same + machine where you compiled it. Sun's BSD Source Compatability Mode is + also a common culprit. Make sure you aren't using either /usr/ucb/cc + or any of the libraries in /usr/ucblib. Finally, make sure you are + using the correct module. If there does not appear to be one + appropriate for your computer, then top probably will not work on + your system. + + If after reading all of this file and checking everything you can you + are still stuck, then please use SourceForge to submit a support + request or a bug. Top is supported by the SourceForge project named + "unixtop". On SourceForge you will find defect tracking, a mailing + list, and on-line forums. You can also contact the author through + SourceForge. -GENERAL - - 1. "Where do I get the latest version of top?" - -The official site for top is "ftp.groupsys.com" in the directory -"/pub/top". It is also available from the following mirror sites: -"pharos.dgim.doc.ca" in /packages/top, "uiarchive.uiuc.edu" in -/pub/packages/top, "sunsite.auc.dk" in /pub/unix/top. European -users should consider using the Denmark (dk) site. - - 2. "Is there a web page for top?" - -Yes. Point your browser at http://www.groupsys.com/top. It includes -all documentation, a nice interactive display which describes the -various components of the output of top, web-based retrieval of the -package, year 2000 information, and pointers to the mailing list. - - 3. "Is there a mailing list for top?" - -The official list for announcements is "top-announce@groupsys.com". -This list is managed by "majordomo@groupsys.com". Announcements of -importance to all top users will be sent to this list, including new -releases, availability of beta test versions, emergency revisions and -patches, etc. Anyone is welcome to join top-announce. This is a -read-only list. The list of subscribers will not (intentionally) be -made available, and postings to the list are limited. - -In addition, there is a top developers mailing list that is used by -beta testers and other people who help me port the program to various -machines. Membership to this list is solely at my discretion. If you -feel qualified to act as a beta tester, or if you are doing development -work on top (such as porting to a new platform), you may submit a -request by sending a message to "top-spinners-request@groupsys.com" -containing the word "subscribe". I will contact you within a few days, -as my schedule permits. - - 4. "What about Year 2000 compliance"? - -Top should not experience any problems with the transition to the year -2000. A full statement concerning top and the year 2000 can be found -in the file "Y2K" included with the distribution. - - - 5. "Why does it take so long for a new version of top to go through the - beta test process?" - -This is completely my fault. I have just not had the time to give top -the attention it deserves. I thank everyone for their patience, and I -hope that with the recent changes in the direction of my career that I -can spend more time on this. - - 6. "Top is not written in ANSI C. Do you ever plan to change that?" - -Top predates ANSI C by about 5 years. Yeah, it'll get "fixed" eventually. -Probably in 3.6. - - -CONFIGURING - - 7. "Configure said that it saw /proc and is recommending that I install top - setuid root. Is there any way around this? Is it safe?" - -There is no way around it. Complain to POSIX. Every effort has been made -to make top a secure setuid program. However, we cannot guarantee that -there are no security problems associated with this configuration. The -places where top is most vulnerable are the builtin kill and renice -commands. There is no internal top command that causes top to start a shell -as a subprocess. Some SVR4 systems may contain a bug that enables a user to -renice his own processes downward (to lower nice values that are more -favorable for the process). This problem has been fixed for the Solaris 2.x -modules, but may still exist in others. We will hopefully fix this up in -the next release. - - 8. "Why is Configure a c-shell script? I thought c-shell scripts were - evil?" - -They are. :-) I'll probably be rewriting the Configure script for the -next release, or switching to something like Gnu configure. - - -COMPILING - - 9. "We just upgraded our operating system to a new version and top broke. - What should we do?" - -Recompile it. Top is very sensitive to changes in internal kernel data -structures. It is not uncommon for a new version of the operating system to -include changes to kernel data structures. - - -RUNNING - -10. "I just finished compiling top and it works fine for root, but when - I try to run it as a regular user it either complains about files - it can't open or it doesn't display all the information it should. - Did I do something wrong?" - -Well, you're just not done. On many operating systems today, access to -many of the kernel memory devices and other system files is restricted to -either root or a particular group. The Configure script figures this out -(usually) and makes sure that the "intsall" rule in the Makefile will -install top so that anyone can run it successfully. However, you have to -*install* it first. Do this with the command "make install". - -11. "Top is (not) displaying idle processes and I don't (do) want it to." - -This default has only changed about a dozen times, and I finally got tired -of people whining about it. Go read the manual page for the current version -and pay special attention to the description of the "TOP" environment -variable. - -12. "We have so much memory in our machine that the memory status display - (the fourth line) ends up being longer than 80 characters. This - completely messes up top's output. Is there a patch?" - -Most modules have been changed to use new memory formatting functions which -will display large values in terms of megabytes instead of kilobytes. This -should fix all occurences of this problem. If you encounter a system where -this large memory display overflow is still occurring, please let me know -(send mail to ). Also note that newer versions of top can -use columns beyond 79, and understand window resizes. So you can always -make your window bigger. - -13. "I tried to compile top with gcc and it doesn't work. I get - compilation errors in the include files, or I get an executable that - dumps core, or top displays incorrect numbers in some of the displays. - What's wrong?" - -Gnu CC likes very much to use its own include files. Not being a gcc -expert, I can't explain why it does this. But I can tell you that if -you upgrade your operating system (say from Solaris 2.4 to Solaris -2.5) after installing gcc, then the include files that gcc uses will -be incorrect, especially those found in the "sys" directory. Your -choices are: (1) rebuild and reinstall the "standard" include files -for gcc (look for scripts in the distribution called "fixincludes" and -"fixinc.svr4"), (2) compile machine.c with "CFLAGS=-I/usr/include" -then make the rest of the object files normally, or (3) use "cc". -Solaris 2.6 users should also consult FAQ #20. - -14. "The cpu state percentages are all wrong, indicating that my machine is - using 95% system time when it is clearly idle. What's wrong?" - -This can happen if you compiled with gcc using the wrong include files. -See the previous question. - - -SUNOS PROBLEMS - -15. "I tried compiling top under SunOS version 4.1.x and it got compile time - errors. Is there a patch?" - -If you try compiling top in a "System V environment" under SunOS (that is, -/usr/5bin is before /usr/bin on your path) then the compilation may fail. -This is mostly due to the fact that top thinks its being compiled on a -System V machine when it really isn't. The only solution is to put /usr/bin -and /usr/ucb before /usr/5bin on your path and try again. - - -SVR4-derived PROBLEMS - -16. "When I run top on my SVR4-derived operating system, it displays all - the system information at the top but does not display any process - information (or only displayes process information for my own - processes). Yet when I run it as root, everything works fine." - -Your system probably uses the pseudo file system "/proc", which is by -default only accessible by root. Top needs to be installed setuid root on -such systems if it is going to function correctly for normal users. - - -SOLARIS PROBLEMS - -17. "Under Solaris 2, when I run top as root it only shows root processes, - or it only shows processes with a PID less than 1000. It refuses to - show anything else. What do I do?" - -You probably compiled it with /usr/ucb/cc instead of the real C compiler. -/usr/ucb/cc is a cc front end that compiles programs in BSD source-level -compatability mode. You do not want that. Make sure that /usr/ucb is not -on your path and try compiling top again. - -18. "Under Solaris 2, I compiled top using what I am sure is the correct - compiler but when I try to run it it complains about missing dynamic - libraries. What is wrong?" - -Check to see if you have LD_LIBRARY_PATH defined in your shell. If you do, -make sure that /usr/ucblib is not on the path anywhere. Then try compiling -top again. - -19. "Under Solaris 2, when I try to run top it complains that it can't open - the library "libucb.so.1". So I changed the LIBS line in m_sunos5.c - to include -R/usr/ucblib to make sure that the dynamic linker will look - there when top runs. I figured this was just an oversight. Was I - right?" - -No, you were not right. As distributed, top requires NO alterations -for successful compilation and operations under any release of Solaris -2. You probably compiled top with /usr/ucb/cc instead of the real C -compiler. See FAQ #10 for more details. - -20. "When I try to compile top under Solaris 2.6 using gcc I get compile - time errors. There appear to be problems with the include files, - such as 'u_rlimit has incomplete type' and/or 'u_saved_rlimit has - incomplete type'. I've already run fixinc.svr4 as per FAQ #13. - Why didn't that fix it?" - -Only top versions 3.5 and later are compatible with Solaris 2.6. Make -sure you are using the most up-to-date version. Earlier beta release -copies of version 3.5 had additional problems when compiled with gcc. -Retrieve the official version 3.5 (non-beta) release from one of the -sites listed in FAQ #1 or FAQ #2. - - -SCO PROBLEMS - -21. "When I try to run Configure, it complains about a syntax error." - -Some versions of SCO's csh do not understand the syntax "$<". Earlier -releases of top depended on this syntax to read input from the installer's -terminal during the installation process. Version 3.5 fixes this. - - -SVR42 PROBLEMS - -22. "The memory display doesn't work right. Why?" - -This is a known bug with the svr42 module. The problem has been traced down -to a potential bug in the "mem" driver. The author of the svr42 module is -working on a fix. - - -STILL STUCK - -23. I'm still stuck. To whom do I report problems with top?" - -The most common problems are caused by top's sensitivity to internal kernel -data structures. So make sure that you are using the right include files, -and make sure that you test out top on the same machine where you compiled -it. Sun's BSD Source Compatability Mode is also a common culprit. Make -sure you aren't using either /usr/ucb/cc or any of the libraries in -/usr/ucblib. Finally, make sure you are using the correct module. If there -does not appear to be one appropriate for your computer, then top probably -will not work on your system. - -If after reading all of this file and checking everything you can you are -still stuck, then send mail to "wnl@groupsys.com". I will answer your mail -when I have time. Please bear with me in that regard! If it looks like the -problem is machine-specific, I will forward the report along to the module's -author. If you would like to converse directly with the module author, the -authors' names are listed at the beginning of the module .c file in the -"machine" directory. Modified: user/edwin/top/top-3.8b1/contrib/top/INSTALL ============================================================================== --- user/edwin/top/top-3.8b1/contrib/top/INSTALL Sun Oct 12 08:40:57 2008 (r183779) +++ user/edwin/top/top-3.8b1/contrib/top/INSTALL Sun Oct 12 09:12:05 2008 (r183780) @@ -1,166 +1,54 @@ TOP - Version 3.5 + Version 3.8beta1 William LeFebvre and a cast of many INSTALLATION -Configuration and installation of top is very straightforward. After -unpacking the sources, run the script "Configure". It will present you -with a series of questions, all of which should be explained in the -presentation. After you have answered all the questions, "Configure" will -perform all the necessary configuration. Once this is finished, type -"make install". Make will compile the sources then install the resulting -executable and manual page in the appropriate places. - -The most difficult step in the configuration is the choice of an -appropriate machine-specific module. The Configure script gives you a -list of choices complete with brief descriptions of when each choice is -appropriate. Each module is contained in a separate c file in the -directory "machine". The module contains all of the machine-specific code -that makes top work correctly on the architecture in question. All of the -code in the top-level directory is machine-independent (or at least -strives to be). Hints for some module choices that are not obvious are -given at the end of this file. - -The first comment in each c file in that directory contains the synopsis -AND a detailed description of the machines for which that module is -appropriate. It also contains a list of authors for that module. If you -are really stumped in this choice, use grep to find your machine -manufacturer's name or operating system name in machine/*.c. If you still -can't find one that is appropriate, then chances are very good that one -hasn't been written yet. If that is the case, then you are out of luck. - -HANDLING MULTIPLE ARCHITECTURES - -If you need to recompile top for a different architecture (that is, using -a different module) you need to reconfigure top. A short cut is available -to make this a little easier. If all of your previous answers to the -configuration questions (except for the module name of course) are -adequate for the new architecture, then you can just use the command -"Configure ". The configuration script will reconfigure top -using the new module and all the answers you gave last time. It will -finish with a "make clean". Once that completes, type "make install" -and make will compile the sources and do the installation. - -HANDLING MULTIPLE OS VERSIONS - -By far the most frequently received bug report for top is something like -this: "We just upgraded our operating system to version 99.9.9.9 and top -broke. What should we do?" The simple answer is "recompile". - -Top is very sensitive to changes in internal kernel data structures -(especially the proc and user structures). Some operating systems -(especially SunOS) are notorious for changing these structure in every -minor release of the OS. This means that a top executable made under one -version of the OS will not always work correctly (if even at all) under -another version. This is just one of those tough facts of life. There is -really no way around it. - -To make life even worse, some operating systems (SunOS again) will use -slightly different proc and user structures on different models. For -example, "top" built on a SparcStation 2 will not run correctly on a -SparcStation 10, even if they are both running SunOS 4.1.3. These -unfortunate circumstances make maintaining top very difficult, especially -in an environment that runs several different versions of the same -operating system. - -But there is hope. If your operating system has a properly functioning -"uname" command then you can handle this problem rather gracefully. -Included in the distribution is a shell file called "metatop". All this -shell file does is: *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Sun Oct 12 09:15:07 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18153106568F; Sun, 12 Oct 2008 09:15:07 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 04EF28FC12; Sun, 12 Oct 2008 09:15:07 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9C9F6l5040170; Sun, 12 Oct 2008 09:15:06 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9C9F5tq040143; Sun, 12 Oct 2008 09:15:05 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810120915.m9C9F5tq040143@svn.freebsd.org> From: Edwin Groothuis Date: Sun, 12 Oct 2008 09:15:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183781 - in user/edwin/top/top-3.8b1: contrib/top usr.bin/top X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 09:15:07 -0000 Author: edwin Date: Sun Oct 12 09:15:05 2008 New Revision: 183781 URL: http://svn.freebsd.org/changeset/base/183781 Log: All collected changes to with regarding to the feedback received on the announcement of top 3.8b1 on -stable and -current as version B. This is considered the final version and submitted to mentor (bde@) for commit approval. Modified: user/edwin/top/top-3.8b1/contrib/top/ap_snprintf.c user/edwin/top/top-3.8b1/contrib/top/boolean.h user/edwin/top/top-3.8b1/contrib/top/color.c user/edwin/top/top-3.8b1/contrib/top/color.h user/edwin/top/top-3.8b1/contrib/top/commands.c user/edwin/top/top-3.8b1/contrib/top/commands.h user/edwin/top/top-3.8b1/contrib/top/display.h user/edwin/top/top-3.8b1/contrib/top/getopt.c user/edwin/top/top-3.8b1/contrib/top/globalstate.h user/edwin/top/top-3.8b1/contrib/top/hash.c user/edwin/top/top-3.8b1/contrib/top/hash.h user/edwin/top/top-3.8b1/contrib/top/loadavg.h user/edwin/top/top-3.8b1/contrib/top/machine.h user/edwin/top/top-3.8b1/contrib/top/message.h user/edwin/top/top-3.8b1/contrib/top/os.h user/edwin/top/top-3.8b1/contrib/top/screen.h user/edwin/top/top-3.8b1/contrib/top/top.1.in user/edwin/top/top-3.8b1/contrib/top/top.c user/edwin/top/top-3.8b1/contrib/top/username.h user/edwin/top/top-3.8b1/contrib/top/utils.h user/edwin/top/top-3.8b1/contrib/top/version.c user/edwin/top/top-3.8b1/contrib/top/version.h user/edwin/top/top-3.8b1/usr.bin/top/Makefile user/edwin/top/top-3.8b1/usr.bin/top/config.h.in user/edwin/top/top-3.8b1/usr.bin/top/machine.c user/edwin/top/top-3.8b1/usr.bin/top/machine.man Modified: user/edwin/top/top-3.8b1/contrib/top/ap_snprintf.c ============================================================================== --- user/edwin/top/top-3.8b1/contrib/top/ap_snprintf.c Sun Oct 12 09:12:05 2008 (r183780) +++ user/edwin/top/top-3.8b1/contrib/top/ap_snprintf.c Sun Oct 12 09:15:05 2008 (r183781) @@ -15,6 +15,10 @@ */ /* + * $FreeBSD$ + */ + +/* * This code is based on, and used with the permission of, the * SIO stdio-replacement strx_* functions by Panos Tsirigotis * for xinetd. Modified: user/edwin/top/top-3.8b1/contrib/top/boolean.h ============================================================================== --- user/edwin/top/top-3.8b1/contrib/top/boolean.h Sun Oct 12 09:12:05 2008 (r183780) +++ user/edwin/top/top-3.8b1/contrib/top/boolean.h Sun Oct 12 09:15:05 2008 (r183781) @@ -1,3 +1,7 @@ +/* + * $FreeBSD$ + */ + /* My favorite names for boolean values */ #define No 0 #define Yes 1 Modified: user/edwin/top/top-3.8b1/contrib/top/color.c ============================================================================== --- user/edwin/top/top-3.8b1/contrib/top/color.c Sun Oct 12 09:12:05 2008 (r183780) +++ user/edwin/top/top-3.8b1/contrib/top/color.c Sun Oct 12 09:15:05 2008 (r183781) @@ -31,6 +31,10 @@ */ /* + * $FreeBSD$ + */ + +/* * Top users/processes display for Unix * Version 3 */ Modified: user/edwin/top/top-3.8b1/contrib/top/color.h ============================================================================== --- user/edwin/top/top-3.8b1/contrib/top/color.h Sun Oct 12 09:12:05 2008 (r183780) +++ user/edwin/top/top-3.8b1/contrib/top/color.h Sun Oct 12 09:15:05 2008 (r183781) @@ -31,6 +31,10 @@ */ /* + * $FreeBSD$ + */ + +/* * Top - a top users display for Unix * * Definition of the color interface. Modified: user/edwin/top/top-3.8b1/contrib/top/commands.c ============================================================================== --- user/edwin/top/top-3.8b1/contrib/top/commands.c Sun Oct 12 09:12:05 2008 (r183780) +++ user/edwin/top/top-3.8b1/contrib/top/commands.c Sun Oct 12 09:15:05 2008 (r183781) @@ -31,7 +31,7 @@ */ /* - * $FreeBSD$ + * $FreeBSD$ */ /* @@ -641,6 +641,35 @@ cmd_delay(globalstate *gstate) } int +cmd_pidonly(globalstate *gstate) + +{ + int newval; + char tmpbuf[20]; + + message_prompt("PID to show: "); + newval = readline(tmpbuf, 8, Yes); + if ((gstate->pselect.pidonly = newval) <= 0) { + gstate->pselect.pidonly = -1; + message_error(" Showing all processes"); + } else { + gstate->pselect.pidonly = newval; + message_error(" Showing only PID %d", gstate->pselect.pidonly); + } + return CMD_REFRESH; +} + +int +cmd_persecond(globalstate *gstate) + +{ + gstate->pselect.persecond = !gstate->pselect.persecond; + message_error(" Displaying IO stats per %s.", + gstate->pselect.persecond ? "second" : "delay period"); + return CMD_REFRESH; +} + +int cmd_idle(globalstate *gstate) { @@ -688,9 +717,9 @@ int cmd_thisprocess(globalstate *gstate) { - gstate->pselect.self = !gstate->pselect.self; + gstate->pselect.self = (gstate->pselect.self == -1) ? getpid() : -1; message_error(" %sisplaying self.", - gstate->pselect.self ? "D" : "Not d"); + (gstate->pselect.self != -1 ) ? "Not d" : "D"); return CMD_REFRESH; } @@ -758,6 +787,10 @@ cmd_order(globalstate *gstate) return CMD_OK; } +#ifdef nomore +/* + * This can be done via the order function + */ int cmd_order_x(globalstate *gstate, char *name, ...) @@ -822,6 +855,7 @@ cmd_order_time(globalstate *gstate) { return cmd_order_x(gstate, "time"); } +#endif #ifdef ENABLE_KILL @@ -970,11 +1004,14 @@ command command_table[] = { { 'H', cmd_threads, "toggle the display of individual threads" }, { 'j', cmd_jailid, "toggle the displaying of jail ID" }, { 'J', cmd_jailfilter, "display processes by jail ID" }, +#ifdef nomore { 'M', cmd_order_mem, "sort by memory usage" }, { 'N', cmd_order_pid, "sort by process id" }, { 'P', cmd_order_cpu, "sort by CPU usage" }, - { 'S', cmd_system, "toggle the display of system processes" }, { 'T', cmd_order_time, "sort by CPU time" }, +#endif + { 'P', cmd_pidonly, "show only this PID" }, + { 'S', cmd_system, "toggle the display of system processes" }, { 'U', cmd_useruid, "toggle the display of usernames or uids" }, { 'c', cmd_command, "display processes by command name" }, { 'd', cmd_displays, "change number of displays to show" }, @@ -993,6 +1030,7 @@ command command_table[] = { { 'r', cmd_renice, "renice a process" }, #endif { 's', cmd_delay, "change number of seconds to delay between updates" }, + { 'p', cmd_persecond, "change IO stats per second instead of per delay" }, { 't', cmd_thisprocess, "toggle the display of this process" }, { 'u', cmd_user, "display processes for only one user (+ selects all users)" }, { '\0', NULL, NULL }, Modified: user/edwin/top/top-3.8b1/contrib/top/commands.h ============================================================================== --- user/edwin/top/top-3.8b1/contrib/top/commands.h Sun Oct 12 09:12:05 2008 (r183780) +++ user/edwin/top/top-3.8b1/contrib/top/commands.h Sun Oct 12 09:15:05 2008 (r183781) @@ -30,6 +30,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* + * $FreeBSD$ + */ + /* call specifications for commands.c */ int command_process(globalstate *gstate, int cmd); Modified: user/edwin/top/top-3.8b1/contrib/top/display.h ============================================================================== --- user/edwin/top/top-3.8b1/contrib/top/display.h Sun Oct 12 09:12:05 2008 (r183780) +++ user/edwin/top/top-3.8b1/contrib/top/display.h Sun Oct 12 09:15:05 2008 (r183781) @@ -30,6 +30,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* + * $FreeBSD$ + */ + /* interface declaration for display.c */ #ifndef _DISPLAY_H Modified: user/edwin/top/top-3.8b1/contrib/top/getopt.c ============================================================================== --- user/edwin/top/top-3.8b1/contrib/top/getopt.c Sun Oct 12 09:12:05 2008 (r183780) +++ user/edwin/top/top-3.8b1/contrib/top/getopt.c Sun Oct 12 09:15:05 2008 (r183781) @@ -31,6 +31,10 @@ */ /* + * $FreeBSD$ + */ + +/* * "getopt" routine customized for top. */ Modified: user/edwin/top/top-3.8b1/contrib/top/globalstate.h ============================================================================== --- user/edwin/top/top-3.8b1/contrib/top/globalstate.h Sun Oct 12 09:12:05 2008 (r183780) +++ user/edwin/top/top-3.8b1/contrib/top/globalstate.h Sun Oct 12 09:15:05 2008 (r183781) @@ -31,6 +31,10 @@ */ /* + * $FreeBSD$ + */ + +/* * The global state of top is described in this structure. It is passed * to routines that may need to examine or alter it. */ Modified: user/edwin/top/top-3.8b1/contrib/top/hash.c ============================================================================== --- user/edwin/top/top-3.8b1/contrib/top/hash.c Sun Oct 12 09:12:05 2008 (r183780) +++ user/edwin/top/top-3.8b1/contrib/top/hash.c Sun Oct 12 09:15:05 2008 (r183781) @@ -30,6 +30,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* + * $FreeBSD$ + */ + /* hash.m4c */ /* The file hash.c is generated from hash.m4c via the preprocessor M4 */ Modified: user/edwin/top/top-3.8b1/contrib/top/hash.h ============================================================================== --- user/edwin/top/top-3.8b1/contrib/top/hash.h Sun Oct 12 09:12:05 2008 (r183780) +++ user/edwin/top/top-3.8b1/contrib/top/hash.h Sun Oct 12 09:15:05 2008 (r183781) @@ -30,6 +30,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* + * $FreeBSD$ + */ + /* hash.m4h */ /* Interface definition for hash.c */ Modified: user/edwin/top/top-3.8b1/contrib/top/loadavg.h ============================================================================== --- user/edwin/top/top-3.8b1/contrib/top/loadavg.h Sun Oct 12 09:12:05 2008 (r183780) +++ user/edwin/top/top-3.8b1/contrib/top/loadavg.h Sun Oct 12 09:15:05 2008 (r183781) @@ -31,6 +31,10 @@ */ /* + * $FreeBSD$ + */ + +/* * Top - a top users display for Berkeley Unix * * Defines required to access load average figures. Modified: user/edwin/top/top-3.8b1/contrib/top/machine.h ============================================================================== --- user/edwin/top/top-3.8b1/contrib/top/machine.h Sun Oct 12 09:12:05 2008 (r183780) +++ user/edwin/top/top-3.8b1/contrib/top/machine.h Sun Oct 12 09:15:05 2008 (r183781) @@ -108,6 +108,7 @@ struct process_select { int idle; /* show idle processes */ int self; /* show self */ + int pidonly; /* only show this PID */ int system; /* show system processes */ int fullcmd; /* show full command */ int usernames; /* show usernames */ @@ -117,6 +118,7 @@ struct process_select int threads; /* show threads separately */ int jailid; /* show jail ID */ int jailfilter; /* only this jail ID (unless jailfilter == -1) */ + int persecond; /* show IO stats per second */ }; /* routines defined by the machine dependent module */ Modified: user/edwin/top/top-3.8b1/contrib/top/message.h ============================================================================== --- user/edwin/top/top-3.8b1/contrib/top/message.h Sun Oct 12 09:12:05 2008 (r183780) +++ user/edwin/top/top-3.8b1/contrib/top/message.h Sun Oct 12 09:15:05 2008 (r183781) @@ -30,6 +30,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* + * $FreeBSD$ + */ + /* interface declaration for display messages */ /* This is a small subset of the interface from display.c that just contains the calls for displaying messages. Do not include Modified: user/edwin/top/top-3.8b1/contrib/top/os.h ============================================================================== --- user/edwin/top/top-3.8b1/contrib/top/os.h Sun Oct 12 09:12:05 2008 (r183780) +++ user/edwin/top/top-3.8b1/contrib/top/os.h Sun Oct 12 09:15:05 2008 (r183781) @@ -30,6 +30,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* + * $FreeBSD$ + */ + #include "config.h" #include Modified: user/edwin/top/top-3.8b1/contrib/top/screen.h ============================================================================== --- user/edwin/top/top-3.8b1/contrib/top/screen.h Sun Oct 12 09:12:05 2008 (r183780) +++ user/edwin/top/top-3.8b1/contrib/top/screen.h Sun Oct 12 09:15:05 2008 (r183781) @@ -31,6 +31,10 @@ */ /* + * $FreeBSD$ + */ + +/* * top - a top users display for Unix 4.2 * * This file contains all the definitions necessary to use the hand-written Modified: user/edwin/top/top-3.8b1/contrib/top/top.1.in ============================================================================== --- user/edwin/top/top-3.8b1/contrib/top/top.1.in Sun Oct 12 09:12:05 2008 (r183780) +++ user/edwin/top/top-3.8b1/contrib/top/top.1.in Sun Oct 12 09:15:05 2008 (r183781) @@ -399,6 +399,10 @@ memory, given in kilobytes. Current state (typically one of \*(lqsleep\*(rq, \*(lqrun\*(rq, \*(lqidl\*(rq, \*(lqzomb\*(rq, or \*(lqstop\*(rq). .TP +.B FLG +Same as the ps(1) "STAT" column. +See the explanation of "state" in the man-page of ps(1). +.TP .B TIME Number of system and user cpu seconds that the process has used. .TP Modified: user/edwin/top/top-3.8b1/contrib/top/top.c ============================================================================== --- user/edwin/top/top-3.8b1/contrib/top/top.c Sun Oct 12 09:12:05 2008 (r183780) +++ user/edwin/top/top-3.8b1/contrib/top/top.c Sun Oct 12 09:15:05 2008 (r183781) @@ -206,7 +206,7 @@ sig_tstop(int i) /* SIGTSTP handler */ /* NOTREACHED */ } -#ifdef SIGWINCH +#ifdef TOPSIGWINCH RETSIGTYPE sig_winch(int i) /* SIGWINCH handler */ @@ -232,7 +232,7 @@ hold_signals() sigaddset(&signalset, SIGINT); sigaddset(&signalset, SIGQUIT); sigaddset(&signalset, SIGTSTP); -#ifdef SIGWINCH +#ifdef TOPSIGWINCH sigaddset(&signalset, SIGWINCH); #endif sigprocmask(SIG_BLOCK, &signalset, NULL); @@ -243,7 +243,7 @@ hold_signals() sighold(SIGINT); sighold(SIGQUIT); sighold(SIGTSTP); -#ifdef SIGWINCH +#ifdef TOPSIGWINCH sighold(SIGWINCH); return NULL; #endif @@ -251,7 +251,7 @@ hold_signals() #ifdef BSD_SIGNALS int mask; -#ifdef SIGWINCH +#ifdef TOPSIGWINCH mask = sigblock(sigmask(SIGINT) | sigmask(SIGQUIT) | sigmask(SIGTSTP) | sigmask(SIGWINCH)); #else @@ -269,7 +269,7 @@ set_signals() (void) set_signal(SIGINT, sig_leave); (void) set_signal(SIGQUIT, sig_leave); (void) set_signal(SIGTSTP, sig_tstop); -#ifdef SIGWINCH +#ifdef TOPSIGWINCH (void) set_signal(SIGWINCH, sig_winch); #endif } @@ -286,7 +286,7 @@ release_signals(void *parm) sigrelse(SIGINT); sigrelse(SIGQUIT); sigrelse(SIGTSTP); -#ifdef SIGWINCH +#ifdef TOPSIGWINCH sigrelse(SIGWINCH); #endif #endif @@ -339,9 +339,9 @@ do_arguments(globalstate *gstate, int ac optind = 1; #ifdef HAVE_GETOPT_LONG - while ((i = getopt_long(ac, av, "CDEHSIJ:Tabcijnqtuvs:d:U:o:m:P", longopts, NULL)) != -1) + while ((i = getopt_long(ac, av, "CDEHSIJ:Tabcijnpqtuvs:d:U:o:m:P", longopts, NULL)) != -1) #else - while ((i = getopt(ac, av, "CDEHSIJ:Tabcijnqtuvs:d:U:o:m:P")) != EOF) + while ((i = getopt(ac, av, "CDEHSIJ:Tabcijnpqtuvs:d:U:o:m:P")) != EOF) #endif { switch(i) @@ -468,7 +468,11 @@ do_arguments(globalstate *gstate, int ac break; case 't': - gstate->pselect.self = !gstate->pselect.self; + gstate->pselect.self = (gstate->pselect.self == -1) ? getpid() : -1; + break; + + case 'p': + gstate->pselect.persecond = !gstate->pselect.persecond; break; case 'q': /* be quick about it */ @@ -491,7 +495,7 @@ do_arguments(globalstate *gstate, int ac default: fprintf(stderr, "Top version %s\n" -"Usage: %s [-HIPSTabcijnqu] [-d x] [-s x] [-o field] [-U username] [-J jid] [number]\n", +"Usage: %s [-HIPSTabCcijnpqu] [-d x] [-s x] [-o field] [-U username] [-J jid] [number]\n", version_string(), myname); exit(EX_USAGE); } @@ -800,6 +804,8 @@ main(int argc, char *argv[]) /* preset defaults for process selection */ gstate->pselect.idle = Yes; gstate->pselect.self = -1; + gstate->pselect.pidonly = -1; + gstate->pselect.persecond = No; gstate->pselect.threads = No; gstate->pselect.jailid = No; gstate->pselect.jailfilter = -1; @@ -928,7 +934,6 @@ main(int argc, char *argv[]) } /* check for infinity and for overflowed screen */ - gstate->topn = gstate->max_topn; if (gstate->topn == Infinity) { gstate->topn = INT_MAX; Modified: user/edwin/top/top-3.8b1/contrib/top/username.h ============================================================================== --- user/edwin/top/top-3.8b1/contrib/top/username.h Sun Oct 12 09:12:05 2008 (r183780) +++ user/edwin/top/top-3.8b1/contrib/top/username.h Sun Oct 12 09:15:05 2008 (r183781) @@ -30,6 +30,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* + * $FreeBSD$ + */ + /* interface for username.c */ #ifndef _USERNAME_H_ Modified: user/edwin/top/top-3.8b1/contrib/top/utils.h ============================================================================== --- user/edwin/top/top-3.8b1/contrib/top/utils.h Sun Oct 12 09:12:05 2008 (r183780) +++ user/edwin/top/top-3.8b1/contrib/top/utils.h Sun Oct 12 09:15:05 2008 (r183781) @@ -31,6 +31,10 @@ */ /* + * $FreeBSD$ + */ + +/* * Top users/processes display for Unix */ Modified: user/edwin/top/top-3.8b1/contrib/top/version.c ============================================================================== --- user/edwin/top/top-3.8b1/contrib/top/version.c Sun Oct 12 09:12:05 2008 (r183780) +++ user/edwin/top/top-3.8b1/contrib/top/version.c Sun Oct 12 09:15:05 2008 (r183781) @@ -31,6 +31,10 @@ */ /* + * $FreeBSD$ + */ + +/* * Top users/processes display for Unix * Version 3 */ Modified: user/edwin/top/top-3.8b1/contrib/top/version.h ============================================================================== --- user/edwin/top/top-3.8b1/contrib/top/version.h Sun Oct 12 09:12:05 2008 (r183780) +++ user/edwin/top/top-3.8b1/contrib/top/version.h Sun Oct 12 09:15:05 2008 (r183781) @@ -31,6 +31,10 @@ */ /* + * $FreeBSD$ + */ + +/* * Top users/processes display for Unix */ Modified: user/edwin/top/top-3.8b1/usr.bin/top/Makefile ============================================================================== --- user/edwin/top/top-3.8b1/usr.bin/top/Makefile Sun Oct 12 09:12:05 2008 (r183780) +++ user/edwin/top/top-3.8b1/usr.bin/top/Makefile Sun Oct 12 09:15:05 2008 (r183781) @@ -7,7 +7,7 @@ PROG= top SRCS= commands.c display.c machine.c screen.c top.c \ username.c utils.c version.c color.c hash.c SRCS+= sigdesc.h config.h -CFLAGS+= -DHAVE_GETOPT -DHAVE_STRERROR -DORDER -DSIGWINCH -DHAS_SHOWTHREADS +CFLAGS+= -DHAVE_GETOPT -DHAVE_STRERROR -DORDER -DTOPSIGWINCH -DHAS_SHOWTHREADS CFLAGS+= -I${.CURDIR} -I${TOPDIR} -I. -Wall -g # @@ -51,7 +51,7 @@ CPU!= uname -m config.h: config.h.in @${ECHO} Making config.h from config.h.in sed \ - -e 's/@DEFAULT_TOPN@/30/' \ + -e 's/@DEFAULT_TOPN@/-1/' \ -e 's/@DEFAULT_DELAY@/2/' \ -e 's/@HAVE_GETOPT_LONG@/1/' \ -e 's/@ENABLE_KILL@/1/' \ @@ -62,7 +62,7 @@ CLEANFILES+= top.1.local top.1.local: top.1.in @${ECHO} Making top.1.local from top.1.in @sed \ - -e 's/@DEFAULT_TOPN@/30/' \ + -e 's/@DEFAULT_TOPN@/-1/' \ -e 's/@DEFAULT_DELAY@/2/' \ -e 's/@HAVE_GETOPT_LONG@/1/' \ -e 's/@ENABLE_KILL@/1/' \ @@ -70,6 +70,9 @@ top.1.local: top.1.in CLEANFILES+= top.1 top.1: top.1.local machine.man - cat ${.ALLSRC} > ${.TARGET} + L=`grep -n MAN_SUPPLEMENT top.1.local | awk -F: '{ print $$1 }'`; \ + (head -`expr $$L - 1` top.1.local; \ + cat machine.man; \ + tail +`expr $$L + 1` top.1.local) > top.1 .include Modified: user/edwin/top/top-3.8b1/usr.bin/top/config.h.in ============================================================================== --- user/edwin/top/top-3.8b1/usr.bin/top/config.h.in Sun Oct 12 09:12:05 2008 (r183780) +++ user/edwin/top/top-3.8b1/usr.bin/top/config.h.in Sun Oct 12 09:15:05 2008 (r183781) @@ -214,7 +214,7 @@ #define MODULE "freebsd" /* Default number of processes to display on non-terminals when topn is all */ -#define NOMINAL_TOPN 40 +#define NOMINAL_TOPN -1 /* Define the major OS revision number. */ #define OSMAJOR 7 Modified: user/edwin/top/top-3.8b1/usr.bin/top/machine.c ============================================================================== --- user/edwin/top/top-3.8b1/usr.bin/top/machine.c Sun Oct 12 09:12:05 2008 (r183780) +++ user/edwin/top/top-3.8b1/usr.bin/top/machine.c Sun Oct 12 09:15:05 2008 (r183781) @@ -180,6 +180,7 @@ struct handle /* calculate a per-second rate using milliseconds */ #define per_second(n, msec) (((n) * 1000) / (msec)) +#define per_timeperiod(n, msec, timeperiod) (((n) * timeperiod) / (msec)) /* process state names for the "STATE" column of the display */ /* the extra nulls in the string "run" are for adding a slash and @@ -392,12 +393,15 @@ static int show_threads = 0; /* sorting orders. first is default */ char *ordernames[] = { - "cpu", "size", "res", "time", "pri", "nice", "io", "pid", "jid", NULL + "cpu", "size", "res", "time", "pri", "nice", "io", "pid", "jid", + "vcsw", "ivcsw", "read", "write", "fault", NULL }; /* compare routines */ int proc_compare(), compare_size(), compare_res(), compare_time(), - compare_prio(), compare_nice(), compare_io(), compare_pid(), compare_jid(); + compare_prio(), compare_nice(), compare_io(), compare_pid(), + compare_jid(), compare_vcsw(), compare_ivcsw(), + compare_read(), compare_write(), compare_fault(); int (*proc_compares[])() = { proc_compare, @@ -409,6 +413,11 @@ int (*proc_compares[])() = { compare_io, compare_pid, compare_jid, + compare_vcsw, + compare_ivcsw, + compare_read, + compare_write, + compare_fault, NULL }; @@ -724,6 +733,7 @@ fmt_command(char *buf, int sz, struct ki char cmd[MAX_COLS]; char *bufp; char **args; + char *ps; int argc; #if OSMAJOR <= 4 @@ -737,7 +747,7 @@ fmt_command(char *buf, int sz, struct ki /* get the pargs structure */ if ((args = kvm_getargv(kd, pp, sz)) != NULL) { - /* successfull retrieval: now convert nulls in to spaces */ + /* successfull retrieval: now convert nulls and cr/lf in to spaces */ bufp = cmd; cmd[0] = '\0'; argc = 0; @@ -748,6 +758,13 @@ fmt_command(char *buf, int sz, struct ki strcat(cmd, args[argc++]); } + while ((ps = strchr(cmd, '\r')) != NULL) { + *ps = ' '; + } + while ((ps = strchr(cmd, '\n')) != NULL) { + *ps = ' '; + } + /* format cmd as our answer */ return snprintf(buf, sz, "%s", cmd); } @@ -758,45 +775,82 @@ fmt_command(char *buf, int sz, struct ki } int -fmt_vcsw(char *buf, int sz, struct kinfo_proc *pp) +fmt_vcsw(char *buf, int sz, struct kinfo_proc *pp, int duration) { - return snprintf(buf, sz, "%6ld", per_second(SP(pp, vcsw), elapsed_msecs)); + return snprintf(buf, sz, "%6ld", per_timeperiod(SP(pp, vcsw), + elapsed_msecs, duration)); +} +int fmt_vcsw_ps(char *buf, int sz, struct kinfo_proc *pp) { + return fmt_vcsw(buf, sz, pp, 1000); +} +int fmt_vcsw_pd(char *buf, int sz, struct kinfo_proc *pp) { + return fmt_vcsw(buf, sz, pp, elapsed_msecs); } int -fmt_ivcsw(char *buf, int sz, struct kinfo_proc *pp) +fmt_ivcsw(char *buf, int sz, struct kinfo_proc *pp, int duration) { - return snprintf(buf, sz, "%6ld", per_second(SP(pp, ivcsw), elapsed_msecs)); + return snprintf(buf, sz, "%6ld", per_timeperiod(SP(pp, ivcsw), elapsed_msecs, duration)); +} +int fmt_ivcsw_ps(char *buf, int sz, struct kinfo_proc *pp) { + return fmt_ivcsw(buf, sz, pp, 1000); +} +int fmt_ivcsw_pd(char *buf, int sz, struct kinfo_proc *pp) { + return fmt_ivcsw(buf, sz, pp, elapsed_msecs); } int -fmt_read(char *buf, int sz, struct kinfo_proc *pp) +fmt_read(char *buf, int sz, struct kinfo_proc *pp, int duration) { - return snprintf(buf, sz, "%6ld", per_second(SP(pp, inblock), elapsed_msecs)); + return snprintf(buf, sz, "%6ld", per_timeperiod(SP(pp, inblock), elapsed_msecs, duration)); +} +int fmt_read_ps(char *buf, int sz, struct kinfo_proc *pp) { + return fmt_read(buf, sz, pp, 1000); +} +int fmt_read_pd(char *buf, int sz, struct kinfo_proc *pp) { + return fmt_read(buf, sz, pp, elapsed_msecs); } int -fmt_write(char *buf, int sz, struct kinfo_proc *pp) +fmt_write(char *buf, int sz, struct kinfo_proc *pp, int duration) { - return snprintf(buf, sz, "%6ld", per_second(SP(pp, oublock), elapsed_msecs)); + return snprintf(buf, sz, "%6ld", per_timeperiod(SP(pp, oublock), elapsed_msecs, duration)); +} +int fmt_write_ps(char *buf, int sz, struct kinfo_proc *pp) { + return fmt_write(buf, sz, pp, 1000); +} +int fmt_write_pd(char *buf, int sz, struct kinfo_proc *pp) { + return fmt_write(buf, sz, pp, elapsed_msecs); } int -fmt_fault(char *buf, int sz, struct kinfo_proc *pp) +fmt_fault(char *buf, int sz, struct kinfo_proc *pp, int duration) { - return snprintf(buf, sz, "%6ld", per_second(SP(pp, majflt), elapsed_msecs)); + return snprintf(buf, sz, "%6ld", per_timeperiod(SP(pp, majflt), elapsed_msecs, duration)); +} +int fmt_fault_ps(char *buf, int sz, struct kinfo_proc *pp) { + return fmt_fault(buf, sz, pp, 1000); +} +int fmt_fault_pd(char *buf, int sz, struct kinfo_proc *pp) { + return fmt_fault(buf, sz, pp, elapsed_msecs); } int -fmt_iototal(char *buf, int sz, struct kinfo_proc *pp) +fmt_iototal(char *buf, int sz, struct kinfo_proc *pp, int duration) { - return snprintf(buf, sz, "%6ld", per_second(SP(pp, totalio), elapsed_msecs)); + return snprintf(buf, sz, "%6ld", per_timeperiod(SP(pp, totalio), elapsed_msecs, duration)); +} +int fmt_iototal_ps(char *buf, int sz, struct kinfo_proc *pp) { + return fmt_iototal(buf, sz, pp, 1000); +} +int fmt_iototal_pd(char *buf, int sz, struct kinfo_proc *pp) { + return fmt_iototal(buf, sz, pp, elapsed_msecs); } int @@ -815,12 +869,14 @@ enum proc_fields { FIELD_PID = 0, FIELD_JID, FIELD_USERNAME, FIELD_UID, FIELD_THR, FIELD_PRI, FIELD_NICE, FIELD_SIZE, FIELD_RES, FIELD_STATE, FIELD_FLG, FIELD_C, FIELD_TIME, FIELD_CPU, - FIELD_COMMAND, FIELD_VCSW, FIELD_IVCSW, FIELD_READ, - FIELD_WRITE, FIELD_FAULT, FIELD_TOTAL, FIELD_PERCENT + FIELD_COMMAND, FIELD_VCSW_PS, FIELD_IVCSW_PS, FIELD_READ_PS, + FIELD_WRITE_PS, FIELD_FAULT_PS, FIELD_TOTAL_PS, FIELD_PERCENT, + FIELD_VCSW_PD, FIELD_IVCSW_PD, FIELD_READ_PD, + FIELD_WRITE_PD, FIELD_FAULT_PD, FIELD_TOTAL_PD }; -#define MAX_FIELDS 25 +#define MAX_FIELDS 31 struct proc_field proc_field[MAX_FIELDS] = { { "PID", 6, 1, 0, fmt_pid }, { "JID", 3, 1, 0, fmt_jid }, @@ -837,13 +893,19 @@ struct proc_field proc_field[MAX_FIELDS] { "TIME", 6, 1, 0, fmt_time }, { "CPU", 6, 1, 0, fmt_cpu }, { "COMMAND", 7, 0, 0, fmt_command }, - { "VCSW", 6, 1, 0, fmt_vcsw }, - { "IVCSW", 6, 1, 0, fmt_ivcsw }, - { "READ", 6, 1, 0, fmt_read }, - { "WRITE", 6, 1, 0, fmt_write }, - { "FAULT", 6, 1, 0, fmt_fault }, - { "TOTAL", 6, 1, 0, fmt_iototal }, + { "VCSW", 6, 1, 0, fmt_vcsw_ps }, + { "IVCSW", 6, 1, 0, fmt_ivcsw_ps }, + { "READ", 6, 1, 0, fmt_read_ps }, + { "WRITE", 6, 1, 0, fmt_write_ps }, + { "FAULT", 6, 1, 0, fmt_fault_ps }, + { "TOTAL", 6, 1, 0, fmt_iototal_ps }, { "PERCENT", 7, 1, 0, fmt_iopct }, + { "VCSW", 6, 1, 0, fmt_vcsw_pd }, + { "IVCSW", 6, 1, 0, fmt_ivcsw_pd }, + { "READ", 6, 1, 0, fmt_read_pd }, + { "WRITE", 6, 1, 0, fmt_write_pd }, + { "FAULT", 6, 1, 0, fmt_fault_pd }, + { "TOTAL", 6, 1, 0, fmt_iototal_pd }, { NULL, 0, 0, 0, NULL } }; @@ -1179,6 +1241,7 @@ get_process_info(struct system_info *si, /* these are copied out of sel for speed */ int show_idle; int show_self; + int show_pidonly; int show_system; int show_jailfilter; int show_uid; @@ -1230,7 +1293,8 @@ get_process_info(struct system_info *si, /* set up flags which define what we are going to select */ show_idle = sel->idle; - show_self = 0; + show_self = sel->self != -1; + show_pidonly = sel->pidonly != -1; show_system = sel->system; show_uid = sel->uid != -1; show_fullcmd = sel->fullcmd; @@ -1347,6 +1411,8 @@ get_process_info(struct system_info *si, (PP(pp, stat) == SRUN)) && (!show_uid || PRUID(pp) == (uid_t)sel->uid) && (!show_jailfilter || PP(pp, jid) == sel->jailfilter) && + (!show_self || PP(pp, pid) != sel->self) && + (!show_pidonly || PP(pp, pid) == sel->pidonly) && (show_command == NULL || strcasestr(PP(pp, comm), show_command) != NULL)) { @@ -1368,8 +1434,12 @@ get_process_info(struct system_info *si, PP(parent, runtime) += PP(pp, runtime); PPCPU(parent) += PPCPU(pp); } else { - printf("Cannot happen"); - exit(0); + /* + * XXX - Ignore it for now + * It happens when you have threaded applications + * while not showing idle processes. + */ + continue; /* This shouldn't happen! */ PP(prev_pp, pctcpu) += PP(pp, pctcpu); PP(prev_pp, runtime) += PP(pp, runtime); @@ -1435,6 +1505,23 @@ format_process_header(struct process_sel mode0_display : mode1_display; + /* Show per second instead of per delay */ + if (sel->persecond) { + field_subst(fi, FIELD_VCSW_PD, FIELD_VCSW_PS); + field_subst(fi, FIELD_IVCSW_PD, FIELD_IVCSW_PS); + field_subst(fi, FIELD_READ_PD, FIELD_READ_PS); + field_subst(fi, FIELD_WRITE_PD, FIELD_WRITE_PS); + field_subst(fi, FIELD_FAULT_PD, FIELD_FAULT_PS); + field_subst(fi, FIELD_TOTAL_PD, FIELD_TOTAL_PS); + } else { + field_subst(fi, FIELD_VCSW_PS, FIELD_VCSW_PD); + field_subst(fi, FIELD_IVCSW_PS, FIELD_IVCSW_PD); + field_subst(fi, FIELD_READ_PS, FIELD_READ_PD); + field_subst(fi, FIELD_WRITE_PS, FIELD_WRITE_PD); + field_subst(fi, FIELD_FAULT_PS, FIELD_FAULT_PD); + field_subst(fi, FIELD_TOTAL_PS, FIELD_TOTAL_PD); + } + /* set username field correctly */ if (!sel->usernames) { @@ -1622,6 +1709,21 @@ static unsigned char sorted_state[] = #define ORDERKEY_JID \ if ( (result = PP(p2, jid) - PP(p1, jid)) == 0) +#define ORDERKEY_VCSW \ + if ( (result = SP(p2, vcsw) - SP(p1, vcsw)) == 0) + +#define ORDERKEY_IVCSW \ + if ( (result = SP(p2, ivcsw) - SP(p1, ivcsw)) == 0) + +#define ORDERKEY_READ \ + if ( (result = SP(p2, inblock) - SP(p1, inblock)) == 0) + +#define ORDERKEY_WRITE \ + if ( (result = SP(p2, oublock) - SP(p1, oublock)) == 0) + +#define ORDERKEY_FAULT \ + if ( (result = SP(p2, majflt) - SP(p1, majflt)) == 0) + /* compare_cpu - the comparison function for sorting by cpu percentage */ int @@ -1826,7 +1928,107 @@ compare_pid(struct proc **pp1, struct pr return(result); } -/* compare_jid - the comparison function for sorting by jail id */ +/* compare_vcsw - the comparison function for sorting by jail id */ + +int +compare_vcsw(struct proc **pp1, struct proc **pp2) + +{ + struct kinfo_proc *p1; + struct kinfo_proc *p2; + int result; + + /* remove one level of indirection */ + p1 = *(struct kinfo_proc **) pp1; + p2 = *(struct kinfo_proc **) pp2; + + ORDERKEY_VCSW + ; + + return(result); +} + +/* compare_ivcsw - the comparison function for sorting by vcsw */ + +int +compare_ivcsw(struct proc **pp1, struct proc **pp2) + +{ + struct kinfo_proc *p1; + struct kinfo_proc *p2; + int result; + + /* remove one level of indirection */ + p1 = *(struct kinfo_proc **) pp1; + p2 = *(struct kinfo_proc **) pp2; + + ORDERKEY_IVCSW + ; + + return(result); +} + +/* compare_read - the comparison function for sorting by ivcsw */ + +int +compare_read(struct proc **pp1, struct proc **pp2) + +{ + struct kinfo_proc *p1; + struct kinfo_proc *p2; + int result; + + /* remove one level of indirection */ + p1 = *(struct kinfo_proc **) pp1; + p2 = *(struct kinfo_proc **) pp2; + + ORDERKEY_READ + ; + + return(result); +} + +/* compare_write - the comparison function for sorting by read */ + +int +compare_write(struct proc **pp1, struct proc **pp2) + +{ + struct kinfo_proc *p1; + struct kinfo_proc *p2; + int result; + + /* remove one level of indirection */ + p1 = *(struct kinfo_proc **) pp1; + p2 = *(struct kinfo_proc **) pp2; + + ORDERKEY_WRITE + ; + + return(result); +} + +/* compare_fault - the comparison function for sorting by write */ + +int +compare_fault(struct proc **pp1, struct proc **pp2) + +{ + struct kinfo_proc *p1; + struct kinfo_proc *p2; + int result; + + /* remove one level of indirection */ + p1 = *(struct kinfo_proc **) pp1; + p2 = *(struct kinfo_proc **) pp2; + + ORDERKEY_FAULT + ; + + return(result); +} + +/* compare_jid - the comparison function for sorting by fault */ int compare_jid(struct proc **pp1, struct proc **pp2) Modified: user/edwin/top/top-3.8b1/usr.bin/top/machine.man ============================================================================== --- user/edwin/top/top-3.8b1/usr.bin/top/machine.man Sun Oct 12 09:12:05 2008 (r183780) +++ user/edwin/top/top-3.8b1/usr.bin/top/machine.man Sun Oct 12 09:15:05 2008 (r183781) @@ -1,3 +1,6 @@ +.\" +.\" $FreeBSD +.\" .SH "FreeBSD NOTES" Priorities are shown the same as they exist in process data structures, ranging from 0 to 255. Note that this is not the same as the ps(1) @@ -20,8 +23,8 @@ Time sharing user threads Idle user threads .SH "FreeBSD THREADS" -Starting with FreeBSD 8.0 the display of individual threads can be -toggled with the synonymous commands +Starting with FreeBSD 7.1 and 8.0 the display of individual threads +can be toggled with the synonymous commands .B t and .BR H. From owner-svn-src-user@FreeBSD.ORG Sun Oct 12 09:16:07 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EBBF41065694; Sun, 12 Oct 2008 09:16:07 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C21528FC08; Sun, 12 Oct 2008 09:16:07 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9C9G7Wj040225; Sun, 12 Oct 2008 09:16:07 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9C9G7AI040224; Sun, 12 Oct 2008 09:16:07 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810120916.m9C9G7AI040224@svn.freebsd.org> From: Edwin Groothuis Date: Sun, 12 Oct 2008 09:16:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183782 - user/edwin/top/top-3.8b1-B X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 09:16:08 -0000 Author: edwin Date: Sun Oct 12 09:16:07 2008 New Revision: 183782 URL: http://svn.freebsd.org/changeset/base/183782 Log: Tag of version B of the top-3.8b1 integration. Added: user/edwin/top/top-3.8b1-B/ - copied from r183781, user/edwin/top/top-3.8b1/ From owner-svn-src-user@FreeBSD.ORG Sun Oct 12 09:17:17 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E0AB91065695; Sun, 12 Oct 2008 09:17:17 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B73AD8FC0C; Sun, 12 Oct 2008 09:17:17 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9C9HHjo040282; Sun, 12 Oct 2008 09:17:17 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9C9HHXF040281; Sun, 12 Oct 2008 09:17:17 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810120917.m9C9HHXF040281@svn.freebsd.org> From: Edwin Groothuis Date: Sun, 12 Oct 2008 09:17:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183783 - user/edwin/tzcode X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 09:17:18 -0000 Author: edwin Date: Sun Oct 12 09:17:17 2008 New Revision: 183783 URL: http://svn.freebsd.org/changeset/base/183783 Log: Create super-directory for all tzcode updates. Added: user/edwin/tzcode/ From owner-svn-src-user@FreeBSD.ORG Sun Oct 12 09:20:36 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D86AF106569E; Sun, 12 Oct 2008 09:20:36 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AED7F8FC1F; Sun, 12 Oct 2008 09:20:36 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9C9KagG040370; Sun, 12 Oct 2008 09:20:36 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9C9KaLO040369; Sun, 12 Oct 2008 09:20:36 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810120920.m9C9KaLO040369@svn.freebsd.org> From: Edwin Groothuis Date: Sun, 12 Oct 2008 09:20:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183784 - user/edwin/tzcode/tzcode2008e X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 09:20:36 -0000 Author: edwin Date: Sun Oct 12 09:20:36 2008 New Revision: 183784 URL: http://svn.freebsd.org/changeset/base/183784 Log: Create working directory for tzcode2008e update. Added: user/edwin/tzcode/tzcode2008e/ From owner-svn-src-user@FreeBSD.ORG Sun Oct 12 09:23:58 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE426106568A; Sun, 12 Oct 2008 09:23:58 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C49308FC12; Sun, 12 Oct 2008 09:23:58 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9C9NwIw040472; Sun, 12 Oct 2008 09:23:58 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9C9NwYW040471; Sun, 12 Oct 2008 09:23:58 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810120923.m9C9NwYW040471@svn.freebsd.org> From: Edwin Groothuis Date: Sun, 12 Oct 2008 09:23:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183785 - in user/edwin/tzcode/tzcode2008e/lib: . libc X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 09:23:59 -0000 Author: edwin Date: Sun Oct 12 09:23:58 2008 New Revision: 183785 URL: http://svn.freebsd.org/changeset/base/183785 Log: Initial creation of tzcode2008e/lib/libc Added: user/edwin/tzcode/tzcode2008e/lib/ user/edwin/tzcode/tzcode2008e/lib/libc/ - copied from r183784, head/lib/libc/ From owner-svn-src-user@FreeBSD.ORG Sun Oct 12 09:24:32 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1231F1065698; Sun, 12 Oct 2008 09:24:32 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DC7EB8FC18; Sun, 12 Oct 2008 09:24:31 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9C9OVsS040521; Sun, 12 Oct 2008 09:24:31 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9C9OVeR040520; Sun, 12 Oct 2008 09:24:31 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810120924.m9C9OVeR040520@svn.freebsd.org> From: Edwin Groothuis Date: Sun, 12 Oct 2008 09:24:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183786 - in user/edwin/tzcode/tzcode2008e/usr.sbin: . zic X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 09:24:32 -0000 Author: edwin Date: Sun Oct 12 09:24:31 2008 New Revision: 183786 URL: http://svn.freebsd.org/changeset/base/183786 Log: Initial creation of tzcode2008e/usr.sbin/zic Added: user/edwin/tzcode/tzcode2008e/usr.sbin/ user/edwin/tzcode/tzcode2008e/usr.sbin/zic/ (props changed) - copied from r183785, head/usr.sbin/zic/ From owner-svn-src-user@FreeBSD.ORG Sun Oct 12 09:29:07 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1399E1065686; Sun, 12 Oct 2008 09:29:07 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DDBD38FC12; Sun, 12 Oct 2008 09:29:06 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9C9T6DD040633; Sun, 12 Oct 2008 09:29:06 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9C9T6tD040632; Sun, 12 Oct 2008 09:29:06 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810120929.m9C9T6tD040632@svn.freebsd.org> From: Edwin Groothuis Date: Sun, 12 Oct 2008 09:29:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183787 - user/edwin/tzcode/tzcode2008e-2004a X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 09:29:07 -0000 Author: edwin Date: Sun Oct 12 09:29:06 2008 New Revision: 183787 URL: http://svn.freebsd.org/changeset/base/183787 Log: Tag of user/edwin/tzcode/tzcode2008e with the original 2004e code. Added: user/edwin/tzcode/tzcode2008e-2004a/ - copied from r183786, user/edwin/tzcode/tzcode2008e/ From owner-svn-src-user@FreeBSD.ORG Sun Oct 12 09:34:06 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 93219106569C; Sun, 12 Oct 2008 09:34:06 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 807598FC1B; Sun, 12 Oct 2008 09:34:06 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9C9Y6TW040764; Sun, 12 Oct 2008 09:34:06 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9C9Y6Hr040760; Sun, 12 Oct 2008 09:34:06 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810120934.m9C9Y6Hr040760@svn.freebsd.org> From: Edwin Groothuis Date: Sun, 12 Oct 2008 09:34:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183788 - in user/edwin/tzcode/tzcode2008e: lib/libc/stdtime usr.sbin/zic X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 09:34:06 -0000 Author: edwin Date: Sun Oct 12 09:34:06 2008 New Revision: 183788 URL: http://svn.freebsd.org/changeset/base/183788 Log: Currently the tzcode in the FreeBSD operating system is from 2004. I have updated, on my development machine at home, src/lib/libc/stdtime and src/usr.sbin/zic to tzcode version 2008e. It still works. zic compiles the zonefiles into version 2 format, zdump properly shows the data. The strftime() tests with the date regression tests (bin/127514: [patch] regression tests for date(1)) work fine. Modified: user/edwin/tzcode/tzcode2008e/lib/libc/stdtime/asctime.c user/edwin/tzcode/tzcode2008e/lib/libc/stdtime/difftime.c user/edwin/tzcode/tzcode2008e/lib/libc/stdtime/localtime.c user/edwin/tzcode/tzcode2008e/lib/libc/stdtime/private.h user/edwin/tzcode/tzcode2008e/lib/libc/stdtime/strftime.c user/edwin/tzcode/tzcode2008e/lib/libc/stdtime/time2posix.3 user/edwin/tzcode/tzcode2008e/lib/libc/stdtime/tzfile.5 user/edwin/tzcode/tzcode2008e/lib/libc/stdtime/tzfile.h user/edwin/tzcode/tzcode2008e/usr.sbin/zic/README user/edwin/tzcode/tzcode2008e/usr.sbin/zic/Theory user/edwin/tzcode/tzcode2008e/usr.sbin/zic/ialloc.c user/edwin/tzcode/tzcode2008e/usr.sbin/zic/private.h user/edwin/tzcode/tzcode2008e/usr.sbin/zic/scheck.c user/edwin/tzcode/tzcode2008e/usr.sbin/zic/tz-art.htm user/edwin/tzcode/tzcode2008e/usr.sbin/zic/tz-link.htm user/edwin/tzcode/tzcode2008e/usr.sbin/zic/zdump.8 user/edwin/tzcode/tzcode2008e/usr.sbin/zic/zdump.c user/edwin/tzcode/tzcode2008e/usr.sbin/zic/zic.8 user/edwin/tzcode/tzcode2008e/usr.sbin/zic/zic.c Modified: user/edwin/tzcode/tzcode2008e/lib/libc/stdtime/asctime.c ============================================================================== --- user/edwin/tzcode/tzcode2008e/lib/libc/stdtime/asctime.c Sun Oct 12 09:29:06 2008 (r183787) +++ user/edwin/tzcode/tzcode2008e/lib/libc/stdtime/asctime.c Sun Oct 12 09:34:06 2008 (r183788) @@ -1,12 +1,18 @@ /* ** This file is in the public domain, so clarified as of -** 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov). +** 1996-06-05 by Arthur David Olson. +*/ + +/* +** Avoid the temptation to punt entirely to strftime; +** the output of strftime is supposed to be locale specific +** whereas the output of asctime is supposed to be constant. */ #include #ifndef lint #ifndef NOID -static char elsieid[] __unused = "@(#)asctime.c 7.9"; +static char elsieid[] __unused = "@(#)asctime.c 8.2"; #endif /* !defined NOID */ #endif /* !defined lint */ __FBSDID("$FreeBSD$"); @@ -19,7 +25,57 @@ __FBSDID("$FreeBSD$"); #include "tzfile.h" /* -** A la ISO/IEC 9945-1, ANSI/IEEE Std 1003.1, Second Edition, 1996-07-12. +** Some systems only handle "%.2d"; others only handle "%02d"; +** "%02.2d" makes (most) everybody happy. +** At least some versions of gcc warn about the %02.2d; +** we conditionalize below to avoid the warning. +*/ +/* +** All years associated with 32-bit time_t values are exactly four digits long; +** some years associated with 64-bit time_t values are not. +** Vintage programs are coded for years that are always four digits long +** and may assume that the newline always lands in the same place. +** For years that are less than four digits, we pad the output with +** leading zeroes to get the newline in the traditional place. +** The -4 ensures that we get four characters of output even if +** we call a strftime variant that produces fewer characters for some years. +** The ISO C 1999 and POSIX 1003.1-2004 standards prohibit padding the year, +** but many implementations pad anyway; most likely the standards are buggy. +*/ +#ifdef __GNUC__ +#define ASCTIME_FMT "%.3s %.3s%3d %2.2d:%2.2d:%2.2d %-4s\n" +#else /* !defined __GNUC__ */ +#define ASCTIME_FMT "%.3s %.3s%3d %02.2d:%02.2d:%02.2d %-4s\n" +#endif /* !defined __GNUC__ */ +/* +** For years that are more than four digits we put extra spaces before the year +** so that code trying to overwrite the newline won't end up overwriting +** a digit within a year and truncating the year (operating on the assumption +** that no output is better than wrong output). +*/ +#ifdef __GNUC__ +#define ASCTIME_FMT_B "%.3s %.3s%3d %2.2d:%2.2d:%2.2d %s\n" +#else /* !defined __GNUC__ */ +#define ASCTIME_FMT_B "%.3s %.3s%3d %02.2d:%02.2d:%02.2d %s\n" +#endif /* !defined __GNUC__ */ + +#define STD_ASCTIME_BUF_SIZE 26 +/* +** Big enough for something such as +** ??? ???-2147483648 -2147483648:-2147483648:-2147483648 -2147483648\n +** (two three-character abbreviations, five strings denoting integers, +** seven explicit spaces, two explicit colons, a newline, +** and a trailing ASCII nul). +** The values above are for systems where an int is 32 bits and are provided +** as an example; the define below calculates the maximum for the system at +** hand. +*/ +#define MAX_ASCTIME_BUF_SIZE (2*3+5*INT_STRLEN_MAXIMUM(int)+7+2+1+1) + +static char buf_asctime[MAX_ASCTIME_BUF_SIZE]; + +/* +** A la ISO/IEC 9945-1, ANSI/IEEE Std 1003.1, 2004 Edition. */ char * @@ -36,6 +92,8 @@ char * buf; }; const char * wn; const char * mn; + char year[INT_STRLEN_MAXIMUM(int) + 2]; + char result[MAX_ASCTIME_BUF_SIZE]; if (timeptr->tm_wday < 0 || timeptr->tm_wday >= DAYSPERWEEK) wn = "???"; @@ -44,35 +102,41 @@ char * buf; mn = "???"; else mn = mon_name[timeptr->tm_mon]; /* - ** The X3J11-suggested format is - ** "%.3s %.3s%3d %02.2d:%02.2d:%02.2d %d\n" - ** Since the .2 in 02.2d is ignored, we drop it. + ** Use strftime's %Y to generate the year, to avoid overflow problems + ** when computing timeptr->tm_year + TM_YEAR_BASE. + ** Assume that strftime is unaffected by other out-of-range members + ** (e.g., timeptr->tm_mday) when processing "%Y". */ - (void) sprintf(buf, "%.3s %.3s%3d %02d:%02d:%02d %d\n", + (void) strftime(year, sizeof year, "%Y", timeptr); + /* + ** We avoid using snprintf since it's not available on all systems. + */ + (void) sprintf(result, + ((strlen(year) <= 4) ? ASCTIME_FMT : ASCTIME_FMT_B), wn, mn, timeptr->tm_mday, timeptr->tm_hour, timeptr->tm_min, timeptr->tm_sec, - TM_YEAR_BASE + timeptr->tm_year); - return buf; + year); + if (strlen(result) < STD_ASCTIME_BUF_SIZE || buf == buf_asctime) { + (void) strcpy(buf, result); + return buf; + } else { +#ifdef EOVERFLOW + errno = EOVERFLOW; +#else /* !defined EOVERFLOW */ + errno = EINVAL; +#endif /* !defined EOVERFLOW */ + return NULL; + } } /* -** A la X3J11, with core dump avoidance. +** A la ISO/IEC 9945-1, ANSI/IEEE Std 1003.1, 2004 Edition. */ char * asctime(timeptr) const struct tm * timeptr; { - /* - ** Big enough for something such as - ** ??? ???-2147483648 -2147483648:-2147483648:-2147483648 -2147483648\n - ** (two three-character abbreviations, five strings denoting integers, - ** three explicit spaces, two explicit colons, a newline, - ** and a trailing ASCII nul). - */ - static char result[3 * 2 + 5 * INT_STRLEN_MAXIMUM(int) + - 3 + 2 + 1 + 1]; - - return asctime_r(timeptr, result); + return asctime_r(timeptr, buf_asctime); } Modified: user/edwin/tzcode/tzcode2008e/lib/libc/stdtime/difftime.c ============================================================================== --- user/edwin/tzcode/tzcode2008e/lib/libc/stdtime/difftime.c Sun Oct 12 09:29:06 2008 (r183787) +++ user/edwin/tzcode/tzcode2008e/lib/libc/stdtime/difftime.c Sun Oct 12 09:34:06 2008 (r183788) @@ -1,12 +1,12 @@ /* ** This file is in the public domain, so clarified as of -** June 5, 1996 by Arthur David Olson (arthur_david_olson@nih.gov). +** 1996-06-05 by Arthur David Olson. */ #include #ifndef lint #ifndef NOID -static char elsieid[] __unused = "@(#)difftime.c 7.9"; +static char elsieid[] __unused = "@(#)difftime.c 8.1"; #endif /* !defined NOID */ #endif /* !defined lint */ __FBSDID("$FreeBSD$"); @@ -14,74 +14,56 @@ __FBSDID("$FreeBSD$"); /*LINTLIBRARY*/ #include "namespace.h" -#include "private.h" +#include "private.h" /* for time_t, TYPE_INTEGRAL, and TYPE_SIGNED */ #include "un-namespace.h" -/* -** Algorithm courtesy Paul Eggert (eggert@twinsun.com). -*/ - -#ifdef HAVE_LONG_DOUBLE -#define long_double long double -#endif /* defined HAVE_LONG_DOUBLE */ -#ifndef HAVE_LONG_DOUBLE -#define long_double double -#endif /* !defined HAVE_LONG_DOUBLE */ - double difftime(time1, time0) const time_t time1; const time_t time0; { - time_t delta; - time_t hibit; - - { - time_t tt; - double d; - long_double ld; - - if (sizeof tt < sizeof d) - return (double) time1 - (double) time0; - if (sizeof tt < sizeof ld) - return (long_double) time1 - (long_double) time0; + /* + ** If (sizeof (double) > sizeof (time_t)) simply convert and subtract + ** (assuming that the larger type has more precision). + ** This is the common real-world case circa 2004. + */ + if (sizeof (double) > sizeof (time_t)) + return (double) time1 - (double) time0; + if (!TYPE_INTEGRAL(time_t)) { + /* + ** time_t is floating. + */ + return time1 - time0; + } + if (!TYPE_SIGNED(time_t)) { + /* + ** time_t is integral and unsigned. + ** The difference of two unsigned values can't overflow + ** if the minuend is greater than or equal to the subtrahend. + */ + if (time1 >= time0) + return time1 - time0; + else return -((double) (time0 - time1)); } - if (time1 < time0) - return -difftime(time0, time1); /* - ** As much as possible, avoid loss of precision - ** by computing the difference before converting to double. + ** time_t is integral and signed. + ** Handle cases where both time1 and time0 have the same sign + ** (meaning that their difference cannot overflow). */ - delta = time1 - time0; - if (delta >= 0) - return delta; + if ((time1 < 0) == (time0 < 0)) + return time1 - time0; /* - ** Repair delta overflow. + ** time1 and time0 have opposite signs. + ** Punt if unsigned long is too narrow. */ - hibit = (~ (time_t) 0) << (TYPE_BIT(time_t) - 1); + if (sizeof (unsigned long) < sizeof (time_t)) + return (double) time1 - (double) time0; /* - ** The following expression rounds twice, which means - ** the result may not be the closest to the true answer. - ** For example, suppose time_t is 64-bit signed int, - ** long_double is IEEE 754 double with default rounding, - ** time1 = 9223372036854775807 and time0 = -1536. - ** Then the true difference is 9223372036854777343, - ** which rounds to 9223372036854777856 - ** with a total error of 513. - ** But delta overflows to -9223372036854774273, - ** which rounds to -9223372036854774784, and correcting - ** this by subtracting 2 * (long_double) hibit - ** (i.e. by adding 2**64 = 18446744073709551616) - ** yields 9223372036854776832, which - ** rounds to 9223372036854775808 - ** with a total error of 1535 instead. - ** This problem occurs only with very large differences. - ** It's too painful to fix this portably. - ** We are not alone in this problem; - ** some C compilers round twice when converting - ** large unsigned types to small floating types, - ** so if time_t is unsigned the "return delta" above - ** has the same double-rounding problem with those compilers. + ** Stay calm...decent optimizers will eliminate the complexity below. */ - return delta - 2 * (long_double) hibit; + if (time1 >= 0 /* && time0 < 0 */) + return (unsigned long) time1 + + (unsigned long) (-(time0 + 1)) + 1; + return -(double) ((unsigned long) time0 + + (unsigned long) (-(time1 + 1)) + 1); } Modified: user/edwin/tzcode/tzcode2008e/lib/libc/stdtime/localtime.c ============================================================================== --- user/edwin/tzcode/tzcode2008e/lib/libc/stdtime/localtime.c Sun Oct 12 09:29:06 2008 (r183787) +++ user/edwin/tzcode/tzcode2008e/lib/libc/stdtime/localtime.c Sun Oct 12 09:34:06 2008 (r183788) @@ -1,20 +1,19 @@ /* ** This file is in the public domain, so clarified as of -** 1996-06-05 by Arthur David Olson (arthur_david_olson@nih.gov). +** 1996-06-05 by Arthur David Olson. */ #include #ifndef lint #ifndef NOID -static char elsieid[] __unused = "@(#)localtime.c 7.78"; +static char elsieid[] __unused = "@(#)localtime.c 8.9"; #endif /* !defined NOID */ #endif /* !defined lint */ __FBSDID("$FreeBSD$"); /* -** Leap second handling from Bradley White (bww@k.gp.cs.cmu.edu). -** POSIX-style TZ environment variable handling from Guy Harris -** (guy@auspex.com). +** Leap second handling from Bradley White. +** POSIX-style TZ environment variable handling from Guy Harris. */ /*LINTLIBRARY*/ @@ -28,6 +27,20 @@ __FBSDID("$FreeBSD$"); #include "un-namespace.h" #include "tzfile.h" +#include "float.h" /* for FLT_MAX and DBL_MAX */ + +#ifndef TZ_ABBR_MAX_LEN +#define TZ_ABBR_MAX_LEN 16 +#endif /* !defined TZ_ABBR_MAX_LEN */ + +#ifndef TZ_ABBR_CHAR_SET +#define TZ_ABBR_CHAR_SET \ + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 :+-._" +#endif /* !defined TZ_ABBR_CHAR_SET */ + +#ifndef TZ_ABBR_ERR_CHAR +#define TZ_ABBR_ERR_CHAR '_' +#endif /* !defined TZ_ABBR_ERR_CHAR */ #include "libc_private.h" @@ -74,16 +87,16 @@ __FBSDID("$FreeBSD$"); ** 5. They might reference tm.TM_ZONE after calling offtime. ** What's best to do in the above cases is open to debate; ** for now, we just set things up so that in any of the five cases -** WILDABBR is used. Another possibility: initialize tzname[0] to the +** WILDABBR is used. Another possibility: initialize tzname[0] to the ** string "tzname[0] used before set", and similarly for the other cases. -** And another: initialize tzname[0] to "ERA", with an explanation in the +** And another: initialize tzname[0] to "ERA", with an explanation in the ** manual page of what this "time zone abbreviation" means (doing this so ** that tzname[0] has the "normal" length of three characters). */ #define WILDABBR " " #endif /* !defined WILDABBR */ -static char wildabbr[] = "WILDABBR"; +static char wildabbr[] = WILDABBR; /* * In June 2004 it was decided UTC was a more appropriate default time @@ -130,6 +143,8 @@ struct state { int timecnt; int typecnt; int charcnt; + int goback; + int goahead; time_t ats[TZ_MAX_TIMES]; unsigned char types[TZ_MAX_TIMES]; struct ttinfo ttis[TZ_MAX_TYPES]; @@ -155,40 +170,49 @@ struct rule { */ static long detzcode(const char * codep); +static time_t detzcode64(const char * codep); +static int differ_by_repeat(time_t t1, time_t t0); static const char * getzname(const char * strp); +static const char * getqzname(const char * strp, const int delim); static const char * getnum(const char * strp, int * nump, int min, int max); static const char * getsecs(const char * strp, long * secsp); static const char * getoffset(const char * strp, long * offsetp); static const char * getrule(const char * strp, struct rule * rulep); static void gmtload(struct state * sp); -static void gmtsub(const time_t * timep, long offset, +static struct tm * gmtsub(const time_t * timep, long offset, struct tm * tmp); -static void localsub(const time_t * timep, long offset, +static struct tm * localsub(const time_t * timep, long offset, struct tm * tmp); static int increment_overflow(int * number, int delta); +static int leaps_thru_end_of(int y); +static int long_increment_overflow(long * number, int delta); +static int long_normalize_overflow(long * tensptr, + int * unitsptr, int base); static int normalize_overflow(int * tensptr, int * unitsptr, int base); static void settzname(void); static time_t time1(struct tm * tmp, - void(*funcp) (const time_t *, + struct tm * (*funcp)(const time_t *, long, struct tm *), long offset); static time_t time2(struct tm *tmp, - void(*funcp) (const time_t *, + struct tm * (*funcp)(const time_t *, long, struct tm*), long offset, int * okayp); static time_t time2sub(struct tm *tmp, - void(*funcp) (const time_t *, + struct tm * (*funcp)(const time_t *, long, struct tm*), long offset, int * okayp, int do_norm_secs); -static void timesub(const time_t * timep, long offset, +static struct tm * timesub(const time_t * timep, long offset, const struct state * sp, struct tm * tmp); static int tmcomp(const struct tm * atmp, const struct tm * btmp); static time_t transtime(time_t janfirst, int year, const struct rule * rulep, long offset); -static int tzload(const char * name, struct state * sp); +static int typesequiv(const struct state * sp, int a, int b); +static int tzload(const char * name, struct state * sp, + int doextend); static int tzparse(const char * name, struct state * sp, int lastditch); @@ -224,7 +248,7 @@ char * tzname[2] = { ** Except for the strftime function, these functions [asctime, ** ctime, gmtime, localtime] return values in one of two static ** objects: a broken-down time structure and an array of char. -** Thanks to Paul Eggert (eggert@twinsun.com) for noting this. +** Thanks to Paul Eggert for noting this. */ static struct tm tm; @@ -245,12 +269,25 @@ const char * const codep; long result; int i; - result = (codep[0] & 0x80) ? ~0L : 0L; + result = (codep[0] & 0x80) ? ~0L : 0; for (i = 0; i < 4; ++i) result = (result << 8) | (codep[i] & 0xff); return result; } +static time_t +detzcode64(codep) +const char * const codep; +{ + register time_t result; + register int i; + + result = (codep[0] & 0x80) ? (~(int_fast64_t) 0) : 0; + for (i = 0; i < 8; ++i) + result = result * 256 + (codep[i] & 0xff); + return result; +} + static void settzname(void) { @@ -299,16 +336,58 @@ settzname(void) tzname[ttisp->tt_isdst] = &sp->chars[ttisp->tt_abbrind]; } + /* + ** Finally, scrub the abbreviations. + ** First, replace bogus characters. + */ + for (i = 0; i < sp->charcnt; ++i) + if (strchr(TZ_ABBR_CHAR_SET, sp->chars[i]) == NULL) + sp->chars[i] = TZ_ABBR_ERR_CHAR; + /* + ** Second, truncate long abbreviations. + */ + for (i = 0; i < sp->typecnt; ++i) { + register const struct ttinfo * const ttisp = &sp->ttis[i]; + register char * cp = &sp->chars[ttisp->tt_abbrind]; + + if (strlen(cp) > TZ_ABBR_MAX_LEN && + strcmp(cp, GRANDPARENTED) != 0) + *(cp + TZ_ABBR_MAX_LEN) = '\0'; + } +} + +static int +differ_by_repeat(t1, t0) +const time_t t1; +const time_t t0; +{ + int_fast64_t _t0 = t0; + int_fast64_t _t1 = t1; + + if (TYPE_INTEGRAL(time_t) && + TYPE_BIT(time_t) - TYPE_SIGNED(time_t) < SECSPERREPEAT_BITS) + return 0; + //turn ((int_fast64_t)(t1 - t0) == SECSPERREPEAT); + return _t1 - _t0 == SECSPERREPEAT; } static int -tzload(name, sp) +tzload(name, sp, doextend) const char * name; struct state * const sp; +register const int doextend; { const char * p; int i; int fid; + int stored; + int nread; + union { + struct tzhead tzhead; + char buf[2 * sizeof(struct tzhead) + + 2 * sizeof *sp + + 4 * TZ_MAX_TIMES]; + } u; /* XXX The following is from OpenBSD, and I'm not sure it is correct */ if (name != NULL && issetugid() != 0) @@ -356,18 +435,13 @@ struct state * const sp; return -1; } } - { - struct tzhead * tzhp; - union { - struct tzhead tzhead; - char buf[sizeof *sp + sizeof *tzhp]; - } u; + nread = _read(fid, u.buf, sizeof u.buf); + if (_close(fid) < 0 || nread <= 0) + return -1; + for (stored = 4; stored <= 8; stored *= 2) { int ttisstdcnt; int ttisgmtcnt; - i = _read(fid, u.buf, sizeof u.buf); - if (_close(fid) != 0) - return -1; ttisstdcnt = (int) detzcode(u.tzhead.tzh_ttisstdcnt); ttisgmtcnt = (int) detzcode(u.tzhead.tzh_ttisgmtcnt); sp->leapcnt = (int) detzcode(u.tzhead.tzh_leapcnt); @@ -382,17 +456,19 @@ struct state * const sp; (ttisstdcnt != sp->typecnt && ttisstdcnt != 0) || (ttisgmtcnt != sp->typecnt && ttisgmtcnt != 0)) return -1; - if (i - (p - u.buf) < sp->timecnt * 4 + /* ats */ + if (nread - (p - u.buf) < + sp->timecnt * stored + /* ats */ sp->timecnt + /* types */ - sp->typecnt * (4 + 2) + /* ttinfos */ + sp->typecnt * 6 + /* ttinfos */ sp->charcnt + /* chars */ - sp->leapcnt * (4 + 4) + /* lsinfos */ + sp->leapcnt * (stored + 4) + /* lsinfos */ ttisstdcnt + /* ttisstds */ ttisgmtcnt) /* ttisgmts */ return -1; for (i = 0; i < sp->timecnt; ++i) { - sp->ats[i] = detzcode(p); - p += 4; + sp->ats[i] = (stored == 4) ? + detzcode(p) : detzcode64(p); + p += stored; } for (i = 0; i < sp->timecnt; ++i) { sp->types[i] = (unsigned char) *p++; @@ -420,8 +496,9 @@ struct state * const sp; struct lsinfo * lsisp; lsisp = &sp->lsis[i]; - lsisp->ls_trans = detzcode(p); - p += 4; + lsisp->ls_trans = (stored == 4) ? + detzcode(p) : detzcode64(p); + p += stored; lsisp->ls_corr = detzcode(p); p += 4; } @@ -451,10 +528,127 @@ struct state * const sp; return -1; } } + /* + ** Out-of-sort ats should mean we're running on a + ** signed time_t system but using a data file with + ** unsigned values (or vice versa). + */ + for (i = 0; i < sp->timecnt - 2; ++i) + if (sp->ats[i] > sp->ats[i + 1]) { + ++i; + if (TYPE_SIGNED(time_t)) { + /* + ** Ignore the end (easy). + */ + sp->timecnt = i; + } else { + /* + ** Ignore the beginning (harder). + */ + register int j; + + for (j = 0; j + i < sp->timecnt; ++j) { + sp->ats[j] = sp->ats[j + i]; + sp->types[j] = sp->types[j + i]; + } + sp->timecnt = j; + } + break; + } + /* + ** If this is an old file, we're done. + */ + if (u.tzhead.tzh_version[0] == '\0') + break; + nread -= p - u.buf; + for (i = 0; i < nread; ++i) + u.buf[i] = p[i]; + /* + ** If this is a narrow integer time_t system, we're done. + */ + if (stored >= (int) sizeof(time_t) && TYPE_INTEGRAL(time_t)) + break; + } + if (doextend && nread > 2 && + u.buf[0] == '\n' && u.buf[nread - 1] == '\n' && + sp->typecnt + 2 <= TZ_MAX_TYPES) { + struct state ts; + register int result; + + u.buf[nread - 1] = '\0'; + result = tzparse(&u.buf[1], &ts, FALSE); + if (result == 0 && ts.typecnt == 2 && + sp->charcnt + ts.charcnt <= TZ_MAX_CHARS) { + for (i = 0; i < 2; ++i) + ts.ttis[i].tt_abbrind += + sp->charcnt; + for (i = 0; i < ts.charcnt; ++i) + sp->chars[sp->charcnt++] = + ts.chars[i]; + i = 0; + while (i < ts.timecnt && + ts.ats[i] <= + sp->ats[sp->timecnt - 1]) + ++i; + while (i < ts.timecnt && + sp->timecnt < TZ_MAX_TIMES) { + sp->ats[sp->timecnt] = + ts.ats[i]; + sp->types[sp->timecnt] = + sp->typecnt + + ts.types[i]; + ++sp->timecnt; + ++i; + } + sp->ttis[sp->typecnt++] = ts.ttis[0]; + sp->ttis[sp->typecnt++] = ts.ttis[1]; + } + } + sp->goback = sp->goahead = FALSE; + if (sp->timecnt > 1) { + for (i = 1; i < sp->timecnt; ++i) + if (typesequiv(sp, sp->types[i], sp->types[0]) && + differ_by_repeat(sp->ats[i], sp->ats[0])) { + sp->goback = TRUE; + break; + } + for (i = sp->timecnt - 2; i >= 0; --i) + if (typesequiv(sp, sp->types[sp->timecnt - 1], + sp->types[i]) && + differ_by_repeat(sp->ats[sp->timecnt - 1], + sp->ats[i])) { + sp->goahead = TRUE; + break; + } } return 0; } +static int +typesequiv(sp, a, b) +const struct state * const sp; +const int a; +const int b; +{ + register int result; + + if (sp == NULL || + a < 0 || a >= sp->typecnt || + b < 0 || b >= sp->typecnt) + result = FALSE; + else { + register const struct ttinfo * ap = &sp->ttis[a]; + register const struct ttinfo * bp = &sp->ttis[b]; + result = ap->tt_gmtoff == bp->tt_gmtoff && + ap->tt_isdst == bp->tt_isdst && + ap->tt_ttisstd == bp->tt_ttisstd && + ap->tt_ttisgmt == bp->tt_ttisgmt && + strcmp(&sp->chars[ap->tt_abbrind], + &sp->chars[bp->tt_abbrind]) == 0; + } + return result; +} + static const int mon_lengths[2][MONSPERYEAR] = { { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }, { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } @@ -466,7 +660,7 @@ static const int year_lengths[2] = { /* ** Given a pointer into a time zone string, scan until a character that is not -** a valid character in a zone name is found. Return a pointer to that +** a valid character in a zone name is found. Return a pointer to that ** character. */ @@ -483,6 +677,25 @@ const char * strp; } /* +** Given a pointer into an extended time zone string, scan until the ending +** delimiter of the zone name is located. Return a pointer to the delimiter. +** +** As with getzname above, the legal character set is actually quite +** restricted, with other characters producing undefined results. +** We don't do any checking here; checking is done later in common-case code. +*/ + +static const char * +getqzname(register const char *strp, const int delim) +{ + register int c; + + while ((c = *strp) != '\0' && c != delim) + ++strp; + return strp; +} + +/* ** Given a pointer into a time zone string, extract a number from that string. ** Check that the number is within a specified range; if it is not, return ** NULL. @@ -547,7 +760,7 @@ long * const secsp; *secsp += num * SECSPERMIN; if (*strp == ':') { ++strp; - /* `SECSPERMIN' allows for leap seconds. */ + /* `SECSPERMIN' allows for leap seconds. */ strp = getnum(strp, &num, 0, SECSPERMIN); if (strp == NULL) return NULL; @@ -586,7 +799,7 @@ long * const offsetp; /* ** Given a pointer into a time zone string, extract a rule in the form -** date[/time]. See POSIX section 8 for the format of "date" and "time". +** date[/time]. See POSIX section 8 for the format of "date" and "time". ** If a valid rule is not found, return NULL. ** Otherwise, return a pointer to the first character not part of the rule. */ @@ -705,7 +918,7 @@ const long offset; dow += DAYSPERWEEK; /* - ** "dow" is the day-of-week of the first day of the month. Get + ** "dow" is the day-of-week of the first day of the month. Get ** the day-of-month (zero-origin) of the first "dow" day of the ** month. */ @@ -728,7 +941,7 @@ const long offset; /* ** "value" is the Epoch-relative time of 00:00:00 UTC on the day in - ** question. To get the Epoch-relative time of the specified local + ** question. To get the Epoch-relative time of the specified local ** time on that day, add the transition time and the current offset ** from UTC. */ @@ -766,10 +979,18 @@ const int lastditch; stdlen = (sizeof sp->chars) - 1; stdoffset = 0; } else { - name = getzname(name); - stdlen = name - stdname; - if (stdlen < 3) - return -1; + if (*name == '<') { + name++; + stdname = name; + name = getqzname(name, '>'); + if (*name != '>') + return (-1); + stdlen = name - stdname; + name++; + } else { + name = getzname(name); + stdlen = name - stdname; + } if (*name == '\0') return -1; /* was "stdoffset = 0;" */ else { @@ -778,15 +999,22 @@ const int lastditch; return -1; } } - load_result = tzload(TZDEFRULES, sp); + load_result = tzload(TZDEFRULES, sp, FALSE); if (load_result != 0) sp->leapcnt = 0; /* so, we're off a little */ if (*name != '\0') { - dstname = name; - name = getzname(name); - dstlen = name - dstname; /* length of DST zone name */ - if (dstlen < 3) - return -1; + if (*name == '<') { + dstname = ++name; + name = getqzname(name, '>'); + if (*name != '>') + return -1; + dstlen = name - dstname; + name++; + } else { + dstname = name; + name = getzname(name); + dstlen = name - dstname; /* length of DST zone name */ + } if (*name != '\0' && *name != ',' && *name != ';') { name = getoffset(name, &dstoffset); if (name == NULL) @@ -813,11 +1041,8 @@ const int lastditch; return -1; sp->typecnt = 2; /* standard time and DST */ /* - ** Two transitions per year, from EPOCH_YEAR to 2037. + ** Two transitions per year, from EPOCH_YEAR forward. */ - sp->timecnt = 2 * (2037 - EPOCH_YEAR + 1); - if (sp->timecnt > TZ_MAX_TIMES) - return -1; sp->ttis[0].tt_gmtoff = -dstoffset; sp->ttis[0].tt_isdst = 1; sp->ttis[0].tt_abbrind = stdlen + 1; @@ -827,7 +1052,12 @@ const int lastditch; atp = sp->ats; typep = sp->types; janfirst = 0; - for (year = EPOCH_YEAR; year <= 2037; ++year) { + sp->timecnt = 0; + for (year = EPOCH_YEAR; + sp->timecnt + 2 <= TZ_MAX_TIMES; + ++year) { + time_t newfirst; + starttime = transtime(janfirst, year, &start, stdoffset); endtime = transtime(janfirst, year, &end, @@ -843,8 +1073,13 @@ const int lastditch; *atp++ = endtime; *typep++ = 1; /* DST ends */ } - janfirst += year_lengths[isleap(year)] * + sp->timecnt += 2; + newfirst = janfirst; + newfirst += year_lengths[isleap(year)] * SECSPERDAY; + if (newfirst <= janfirst) + break; + janfirst = newfirst; } } else { long theirstdoffset; @@ -959,7 +1194,7 @@ static void gmtload(sp) struct state * const sp; { - if (tzload(gmt, sp) != 0) + if (tzload(gmt, sp, TRUE) != 0) (void) tzparse(gmt, sp, TRUE); } @@ -990,7 +1225,7 @@ tzsetwall_basic(int rdlocked) } } #endif /* defined ALL_STATE */ - if (tzload((char *) NULL, lclptr) != 0) + if (tzload((char *) NULL, lclptr, TRUE) != 0) gmtload(lclptr); settzname(); _RWLOCK_UNLOCK(&lcl_rwlock); @@ -1053,7 +1288,7 @@ tzset_basic(int rdlocked) lclptr->ttis[0].tt_gmtoff = 0; lclptr->ttis[0].tt_abbrind = 0; (void) strcpy(lclptr->chars, gmt); - } else if (tzload(name, lclptr) != 0) + } else if (tzload(name, lclptr, TRUE) != 0) if (name[0] == ':' || tzparse(name, lclptr, FALSE) != 0) (void) gmtload(lclptr); settzname(); @@ -1072,14 +1307,14 @@ tzset(void) /* ** The easy way to behave "as if no library function calls" localtime ** is to not call it--so we drop its guts into "localsub", which can be -** freely called. (And no, the PANS doesn't require the above behavior-- +** freely called. (And no, the PANS doesn't require the above behavior-- ** but it *is* desirable.) ** ** The unused offset argument is for the benefit of mktime variants. */ /*ARGSUSED*/ -static void +static struct tm * localsub(timep, offset, tmp) const time_t * const timep; const long offset; @@ -1088,15 +1323,53 @@ struct tm * const tmp; struct state * sp; const struct ttinfo * ttisp; int i; - const time_t t = *timep; + struct tm * result; + const time_t t = *timep; sp = lclptr; #ifdef ALL_STATE - if (sp == NULL) { - gmtsub(timep, offset, tmp); - return; - } + if (sp == NULL) + return gmtsub(timep, offset, tmp); #endif /* defined ALL_STATE */ + if ((sp->goback && t < sp->ats[0]) || + (sp->goahead && t > sp->ats[sp->timecnt - 1])) { + time_t newt = t; + register time_t seconds; + register time_t tcycles; + register int_fast64_t icycles; + + if (t < sp->ats[0]) + seconds = sp->ats[0] - t; + else seconds = t - sp->ats[sp->timecnt - 1]; + --seconds; + tcycles = seconds / YEARSPERREPEAT / AVGSECSPERYEAR; + ++tcycles; + icycles = tcycles; + if (tcycles - icycles >= 1 || icycles - tcycles >= 1) + return NULL; + seconds = icycles; + seconds *= YEARSPERREPEAT; + seconds *= AVGSECSPERYEAR; + if (t < sp->ats[0]) + newt += seconds; + else newt -= seconds; + if (newt < sp->ats[0] || + newt > sp->ats[sp->timecnt - 1]) + return NULL; /* "cannot happen" */ + result = localsub(&newt, offset, tmp); + if (result == tmp) { + register time_t newy; + + newy = tmp->tm_year; + if (t < sp->ats[0]) + newy -= icycles * YEARSPERREPEAT; + else newy += icycles * YEARSPERREPEAT; + tmp->tm_year = newy; + if (tmp->tm_year != newy) + return NULL; + } + return result; + } if (sp->timecnt == 0 || t < sp->ats[0]) { i = 0; while (sp->ttis[i].tt_isdst) @@ -1105,10 +1378,17 @@ struct tm * const tmp; break; } } else { - for (i = 1; i < sp->timecnt; ++i) - if (t < sp->ats[i]) - break; - i = sp->types[i - 1]; + register int lo = 1; + register int hi = sp->timecnt; + + while (lo < hi) { + register int mid = (lo + hi) >> 1; + + if (t < sp->ats[mid]) + hi = mid; + else lo = mid + 1; + } + i = (int) sp->types[lo - 1]; } ttisp = &sp->ttis[i]; /* @@ -1117,12 +1397,13 @@ struct tm * const tmp; ** t += ttisp->tt_gmtoff; ** timesub(&t, 0L, sp, tmp); */ - timesub(&t, ttisp->tt_gmtoff, sp, tmp); + result = timesub(&t, ttisp->tt_gmtoff, sp, tmp); tmp->tm_isdst = ttisp->tt_isdst; tzname[tmp->tm_isdst] = &sp->chars[ttisp->tt_abbrind]; #ifdef TM_ZONE tmp->TM_ZONE = &sp->chars[ttisp->tt_abbrind]; #endif /* defined TM_ZONE */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Sun Oct 12 09:42:57 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C5D53106569C; Sun, 12 Oct 2008 09:42:57 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9BB2F8FC1E; Sun, 12 Oct 2008 09:42:57 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9C9gviE040937; Sun, 12 Oct 2008 09:42:57 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9C9gvCr040936; Sun, 12 Oct 2008 09:42:57 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810120942.m9C9gvCr040936@svn.freebsd.org> From: Edwin Groothuis Date: Sun, 12 Oct 2008 09:42:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183789 - user/edwin/tzcode/tzcode2008e/usr.sbin/zic X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 09:42:57 -0000 Author: edwin Date: Sun Oct 12 09:42:57 2008 New Revision: 183789 URL: http://svn.freebsd.org/changeset/base/183789 Log: This file has been removed in favour of tz-art.htm and tz-link.htm. Deleted: user/edwin/tzcode/tzcode2008e/usr.sbin/zic/Arts.htm From owner-svn-src-user@FreeBSD.ORG Sun Oct 12 09:44:25 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B6951065690; Sun, 12 Oct 2008 09:44:25 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D5F708FC18; Sun, 12 Oct 2008 09:44:24 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9C9iOTb041010; Sun, 12 Oct 2008 09:44:24 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9C9iOYO041009; Sun, 12 Oct 2008 09:44:24 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810120944.m9C9iOYO041009@svn.freebsd.org> From: Edwin Groothuis Date: Sun, 12 Oct 2008 09:44:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183790 - user/edwin/tzcode/tzcode2008e-2008e X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 09:44:25 -0000 Author: edwin Date: Sun Oct 12 09:44:24 2008 New Revision: 183790 URL: http://svn.freebsd.org/changeset/base/183790 Log: Tag of the integration of the 2004a -> 2008e changes. Added: user/edwin/tzcode/tzcode2008e-2008e/ - copied from r183789, user/edwin/tzcode/tzcode2008e/ From owner-svn-src-user@FreeBSD.ORG Sun Oct 12 09:45:20 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ABD9C1065688; Sun, 12 Oct 2008 09:45:20 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B49D8FC1D; Sun, 12 Oct 2008 09:45:20 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9C9jKJh041075; Sun, 12 Oct 2008 09:45:20 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9C9jKcP041074; Sun, 12 Oct 2008 09:45:20 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810120945.m9C9jKcP041074@svn.freebsd.org> From: Edwin Groothuis Date: Sun, 12 Oct 2008 09:45:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183791 - user/edwin/tzcode/tzcode2008e/usr.sbin/zic X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 09:45:20 -0000 Author: edwin Date: Sun Oct 12 09:45:20 2008 New Revision: 183791 URL: http://svn.freebsd.org/changeset/base/183791 Log: Merge changes for the 2008g update. Modified: user/edwin/tzcode/tzcode2008e/usr.sbin/zic/tz-art.htm Modified: user/edwin/tzcode/tzcode2008e/usr.sbin/zic/tz-art.htm ============================================================================== --- user/edwin/tzcode/tzcode2008e/usr.sbin/zic/tz-art.htm Sun Oct 12 09:44:24 2008 (r183790) +++ user/edwin/tzcode/tzcode2008e/usr.sbin/zic/tz-art.htm Sun Oct 12 09:45:20 2008 (r183791) @@ -9,7 +9,7 @@ PUBLIC "-//W3C//DTD HTML 4.01//EN"

Time and the Arts

-@(#)tz-art.htm 8.9 +@(#)tz-art.htm 8.10

Please send corrections to this web page to the @@ -320,6 +320,11 @@ zones?" was a $32,000 question on the 20 "Who Wants to Be a Millionaire?" At this rate, the million-dollar time-zone question should have been asked 2002-06-04. +

  • +A private jet's mid-flight change of time zones distorts Alison Dubois' +premonition in the "We Had a Dream" episode of "Medium" +(originally aired 2007-02-28). +

    • @@ -364,11 +369,6 @@ or are you trying to dazzle me with your (Kelsey Grammer as "Frasier Crane")
    • -A private jet's mid-flight change of time zones distorts Alison Dubois' -premonition in the "We Had a Dream" episode of "Medium" -(originally aired 2007-02-28). -
    • -
    • "Don't worry about the world coming to an end today. It is already tomorrow in Australia." (Charles M. Schulz, provided by Steve Summit) From owner-svn-src-user@FreeBSD.ORG Sun Oct 12 09:46:31 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B8EB1065689; Sun, 12 Oct 2008 09:46:31 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 01BB18FC1F; Sun, 12 Oct 2008 09:46:31 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9C9kUTK041134; Sun, 12 Oct 2008 09:46:30 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9C9kU7r041133; Sun, 12 Oct 2008 09:46:30 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810120946.m9C9kU7r041133@svn.freebsd.org> From: Edwin Groothuis Date: Sun, 12 Oct 2008 09:46:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183792 - user/edwin/tzcode/tzcode2008e-2008g X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 09:46:31 -0000 Author: edwin Date: Sun Oct 12 09:46:30 2008 New Revision: 183792 URL: http://svn.freebsd.org/changeset/base/183792 Log: Tag of the integration of the 2008e -> 2008g changes. Added: user/edwin/tzcode/tzcode2008e-2008g/ - copied from r183791, user/edwin/tzcode/tzcode2008e/ From owner-svn-src-user@FreeBSD.ORG Sun Oct 12 09:52:58 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE19C1065687; Sun, 12 Oct 2008 09:52:58 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C4D178FC14; Sun, 12 Oct 2008 09:52:58 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9C9qwZI041278; Sun, 12 Oct 2008 09:52:58 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9C9qwsG041277; Sun, 12 Oct 2008 09:52:58 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <200810120952.m9C9qwsG041277@svn.freebsd.org> From: Takahashi Yoshihiro Date: Sun, 12 Oct 2008 09:52:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183793 - user/nyan X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 09:52:59 -0000 Author: nyan Date: Sun Oct 12 09:52:58 2008 New Revision: 183793 URL: http://svn.freebsd.org/changeset/base/183793 Log: Add my user dir. Added: user/nyan/ From owner-svn-src-user@FreeBSD.ORG Sun Oct 12 09:58:11 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8AB941065687; Sun, 12 Oct 2008 09:58:11 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6137E8FC1D; Sun, 12 Oct 2008 09:58:11 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9C9wBDb041436; Sun, 12 Oct 2008 09:58:11 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9C9wBqS041435; Sun, 12 Oct 2008 09:58:11 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810120958.m9C9wBqS041435@svn.freebsd.org> From: Edwin Groothuis Date: Sun, 12 Oct 2008 09:58:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183794 - user/edwin/tftpd X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 09:58:11 -0000 Author: edwin Date: Sun Oct 12 09:58:10 2008 New Revision: 183794 URL: http://svn.freebsd.org/changeset/base/183794 Log: Create working directory for the tftp / tftpd update Added: user/edwin/tftpd/ From owner-svn-src-user@FreeBSD.ORG Sun Oct 12 10:04:25 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4047A1065696; Sun, 12 Oct 2008 10:04:25 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 15FDD8FC14; Sun, 12 Oct 2008 10:04:25 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9CA4PEM041680; Sun, 12 Oct 2008 10:04:25 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9CA4Ol3041679; Sun, 12 Oct 2008 10:04:24 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810121004.m9CA4Ol3041679@svn.freebsd.org> From: Edwin Groothuis Date: Sun, 12 Oct 2008 10:04:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183796 - in user/edwin/tftpd/usr.bin: . tftp X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 10:04:25 -0000 Author: edwin Date: Sun Oct 12 10:04:24 2008 New Revision: 183796 URL: http://svn.freebsd.org/changeset/base/183796 Log: Initial creation of tftp/usr.bin/tftp Added: user/edwin/tftpd/usr.bin/ user/edwin/tftpd/usr.bin/tftp/ - copied from r183794, head/usr.bin/tftp/ From owner-svn-src-user@FreeBSD.ORG Sun Oct 12 10:05:06 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 736EA1065694; Sun, 12 Oct 2008 10:05:06 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 494A58FC1A; Sun, 12 Oct 2008 10:05:06 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9CA568b041734; Sun, 12 Oct 2008 10:05:06 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9CA56YC041733; Sun, 12 Oct 2008 10:05:06 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810121005.m9CA56YC041733@svn.freebsd.org> From: Edwin Groothuis Date: Sun, 12 Oct 2008 10:05:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183797 - in user/edwin/tftpd/libexec: . tftpd X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 10:05:06 -0000 Author: edwin Date: Sun Oct 12 10:05:06 2008 New Revision: 183797 URL: http://svn.freebsd.org/changeset/base/183797 Log: Initial creation of tftpd/libexec/tftpd Added: user/edwin/tftpd/libexec/ user/edwin/tftpd/libexec/tftpd/ - copied from r183796, head/libexec/tftpd/ From owner-svn-src-user@FreeBSD.ORG Sun Oct 12 10:10:42 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A1B3B1065690; Sun, 12 Oct 2008 10:10:42 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8EF448FC18; Sun, 12 Oct 2008 10:10:42 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9CAAgpX041861; Sun, 12 Oct 2008 10:10:42 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9CAAgGO041854; Sun, 12 Oct 2008 10:10:42 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810121010.m9CAAgGO041854@svn.freebsd.org> From: Edwin Groothuis Date: Sun, 12 Oct 2008 10:10:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183798 - in user/edwin/tftpd: libexec/tftpd usr.bin/tftp X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 10:10:42 -0000 Author: edwin Date: Sun Oct 12 10:10:42 2008 New Revision: 183798 URL: http://svn.freebsd.org/changeset/base/183798 Log: It all started when we got some new routers, which told me the following when trying to upload configuration or download images from it: The TFTP server doesn't support the blocksize option. My curiousity was triggered, it took me some reading of RFCs and other documentation to find out what was possible and what could be done. Was plain TFTP very simple in its handshake, TFTP with options was kind of messy because of its backwards capability: The first packet returned could either be an acknowledgement of options, or the first data packet. Going through the source code of src/libexec/tftpd and going through the code of src/usr.bin/tftp showed that there was a lot of duplicate code, and the addition of options would only increase the amount of duplicate code. After all, both the client and the server can act as a sender and receiver. At the end, it ended up with a nearly complete rewrite of the tftp client and server. It has been tested against the following TFTP clients and servers: - Itself (yay!) - The standard FreeBSD tftp client and server - The Fedora Core 6 tftp client and server - Cisco router tftp client - Extreme Networks tftp client It supports the following RFCs: RFC1350 - THE TFTP PROTOCOL (REVISION 2) RFC2347 - TFTP Option Extension RFC2348 - TFTP Blocksize Option RFC2349 - TFTP Timeout Interval and Transfer Size Options RFC3617 - Uniform Resource Identifier (URI) Scheme and Applicability Statement for the Trivial File Transfer Protocol (TFTP) It supports the following unofficial TFTP Options as described at http://www.compuphase.com/tftp.htm: blksize2 - Block size restricted to powers of 2, excluding protocol headers rollover - Block counter roll-over (roll back to zero or to one) From the tftp program point of view the following things are changed: - New commands: "blocksize", "blocksize2", "rollover" and "options" - Development features: "debug" and "packetdrop" If you try this tftp/tftpd implementation, please let me know if it works (or doesn't work) and against which implementaion so I can get a list of confirmed working systems. Added: user/edwin/tftpd/libexec/tftpd/tftp-file.c user/edwin/tftpd/libexec/tftpd/tftp-file.h user/edwin/tftpd/libexec/tftpd/tftp-io.c user/edwin/tftpd/libexec/tftpd/tftp-io.h user/edwin/tftpd/libexec/tftpd/tftp-options.c user/edwin/tftpd/libexec/tftpd/tftp-options.h user/edwin/tftpd/libexec/tftpd/tftp-transfer.c user/edwin/tftpd/libexec/tftpd/tftp-transfer.h user/edwin/tftpd/libexec/tftpd/tftp-utils.c user/edwin/tftpd/libexec/tftpd/tftp-utils.h user/edwin/tftpd/usr.bin/tftp/tftp.h Deleted: user/edwin/tftpd/usr.bin/tftp/extern.h user/edwin/tftpd/usr.bin/tftp/tftpsubs.c user/edwin/tftpd/usr.bin/tftp/tftpsubs.h Modified: user/edwin/tftpd/libexec/tftpd/Makefile user/edwin/tftpd/libexec/tftpd/tftpd.8 user/edwin/tftpd/libexec/tftpd/tftpd.c user/edwin/tftpd/usr.bin/tftp/Makefile user/edwin/tftpd/usr.bin/tftp/main.c user/edwin/tftpd/usr.bin/tftp/tftp.1 user/edwin/tftpd/usr.bin/tftp/tftp.c Modified: user/edwin/tftpd/libexec/tftpd/Makefile ============================================================================== --- user/edwin/tftpd/libexec/tftpd/Makefile Sun Oct 12 10:05:06 2008 (r183797) +++ user/edwin/tftpd/libexec/tftpd/Makefile Sun Oct 12 10:10:42 2008 (r183798) @@ -2,12 +2,14 @@ # $FreeBSD$ PROG= tftpd -SRCS= tftpd.c tftpsubs.c -DPADD= ${LIBUTIL} -LDADD= -lutil +SRCS= tftpd.c tftp-io.c tftp-utils.c tftp-file.c tftp-transfer.c tftp-options.c +WARNS= 3 WFORMAT=0 MAN= tftpd.8 -CFLAGS+=-I${.CURDIR}/../../usr.bin/tftp +CFLAGS=-g -Wall +CFLAGS+=-I${.CURDIR}/../../usr.bin/tftp -I${.CURDIR}/../../libexec/tftpd .PATH: ${.CURDIR}/../../usr.bin/tftp +COPTFLAGS = -O +LDFLAGS= -lwrap .include Added: user/edwin/tftpd/libexec/tftpd/tftp-file.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tftpd/libexec/tftpd/tftp-file.c Sun Oct 12 10:10:42 2008 (r183798) @@ -0,0 +1,257 @@ +/* + * Copyright (C) 2008 Edwin Groothuis. 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. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR 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 AUTHOR 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "tftp-file.h" +#include "tftp-utils.h" + +static FILE *file; +static int convert; + +static char convbuffer[66000]; +static int gotcr = 0; + +static size_t +convert_from_net(char *buffer, size_t count) +{ + size_t i, n; + + /* + * Convert all CR/LF to LF and all CR,NUL to CR + */ + + n = 0; + for (i = 0; i < count; i++) { + + if (gotcr == 0) { + convbuffer[n++] = buffer[i]; + gotcr = (buffer[i] == '\r'); + continue; + } + + /* CR, NULL -> CR */ + if (buffer[i] == '\0') { + gotcr = 0; + continue; + } + + /* CR, LF -> LF */ + if (buffer[i] == '\n') { + if (n == 0) { + if (ftell(file) != 0) { + fseek(file, -1, SEEK_END); + convbuffer[n++] = '\n'; + } else { + /* This shouldn't happen */ + tftp_log(LOG_ERR, + "Received LF as first character"); + abort(); + } + } else + convbuffer[n-1] = '\n'; + gotcr = 0; + continue; + } + + /* Everything else just accept as is */ + convbuffer[n++] = buffer[i]; + gotcr = (buffer[i] == '\r'); + continue; + } + + return fwrite(convbuffer, 1, n, file); +} + +static size_t +convert_to_net(char *buffer, size_t count, int init) +{ + size_t i; + static size_t n = 0, read = 0; + static int newline = 0; + + if (init) { + newline = 0; + n = 0; + read = 0; + return 0 ; + } + + /* + * Convert all LF to CR,LF and all CR to CR,NUL + */ + i = 0; + + if (newline) { + buffer[i++] = newline; + newline = 0; + } + + while (i < count) { + if (n == read) { + /* When done we're done */ + if (feof(file)) break; + + /* Otherwise read another bunch */ + read = fread(convbuffer, 1, count, file); + if (read == 0) break; + n = 0; + } + + /* CR -> CR,NULL */ + if (convbuffer[n] == '\r') { + buffer[i++] = '\r'; + buffer[i++] = '\0'; + n++; + continue; + } + + /* LF -> CR,LF */ + if (convbuffer[n] == '\n') { + buffer[i++] = '\r'; + buffer[i++] = '\n'; + n++; + continue; + } + + buffer[i++] = convbuffer[n++]; + } + + if (i > count) { + /* + * Whoops... that isn't alllowed (but it will happen + * when there is a CR or LF at the end of the buffer) + */ + newline = buffer[i-1]; + } + + if (i < count) { + /* We are done! */ + return i; + } else + return count; + +} + +int +write_init(int fd, FILE *f, const char *mode) +{ + + if (f == NULL) { + file = fdopen(fd, "w"); + if (file == NULL) { + int en = errno; + tftp_log(LOG_ERR, "fdopen() failed: %s", + strerror(errno)); + return en; + } + } else + file = f; + convert = !strcmp(mode, "netascii"); + return 0; +} + +size_t +write_file(char *buffer, int count) +{ + + if (convert == 0) + return fwrite(buffer, 1, count, file); + + return convert_from_net(buffer, count); +} + +int +write_close(void) +{ + + if (fclose(file) != 0) { + tftp_log(LOG_ERR, "fclose() failed: %s", strerror(errno)); + return 1; + } + return 0; +} + +int +read_init(int fd, FILE *f, const char *mode) +{ + + convert_to_net(NULL, 0, 1); + if (f == NULL) { + file = fdopen(fd, "r"); + if (file == NULL) { + int en = errno; + tftp_log(LOG_ERR, "fdopen() failed: %s", + strerror(errno)); + return en; + } + } else + file = f; + convert = !strcmp(mode, "netascii"); + return 0; +} + +size_t +read_file(char *buffer, int count) +{ + + if (convert == 0) + return fread(buffer, 1, count, file); + + return convert_to_net(buffer, count, 0); +} + +int +read_close(void) +{ + + if (fclose(file) != 0) { + tftp_log(LOG_ERR, "fclose() failed: %s", strerror(errno)); + return 1; + } + return 0; +} + + +int +synchnet(int peer) +{ + + return 0; +} Added: user/edwin/tftpd/libexec/tftpd/tftp-file.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tftpd/libexec/tftpd/tftp-file.h Sun Oct 12 10:10:42 2008 (r183798) @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2008 Edwin Groothuis. 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. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR 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 AUTHOR 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +int write_init(int fd, FILE *f, const char *mode); +size_t write_file(char *buffer, int count); +int write_close(void); + +int read_init(int fd, FILE *f, const char *mode); +size_t read_file(char *buffer, int count); +int read_close(void); + +int synchnet(int peer); Added: user/edwin/tftpd/libexec/tftpd/tftp-io.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tftpd/libexec/tftpd/tftp-io.c Sun Oct 12 10:10:42 2008 (r183798) @@ -0,0 +1,478 @@ +/* + * Copyright (C) 2008 Edwin Groothuis. 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. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR 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 AUTHOR 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. + */ + +#include +__FBSDID("$FreeBSD"); + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "tftp-file.h" +#include "tftp-io.h" +#include "tftp-utils.h" +#include "tftp-options.h" + +struct sockaddr_storage peer_sock; +struct sockaddr_storage me_sock; + +static int send_packet(int peer, uint16_t block, char *pkt, int size); + +struct errmsg { + int e_code; + const char *e_msg; +} errmsgs[] = { + { EUNDEF, "Undefined error code" }, + { ENOTFOUND, "File not found" }, + { EACCESS, "Access violation" }, + { ENOSPACE, "Disk full or allocation exceeded" }, + { EBADOP, "Illegal TFTP operation" }, + { EBADID, "Unknown transfer ID" }, + { EEXISTS, "File already exists" }, + { ENOUSER, "No such user" }, + { EOPTNEG, "Option negotiation" }, + { -1, NULL } +}; + +#define DROPPACKET(s) \ + if (packetdroppercentage != 0 && \ + random()%100 < packetdroppercentage) { \ + tftp_log(LOG_DEBUG, "Artifical packet drop in %s", s); \ + return; \ + } +#define DROPPACKETn(s,n) \ + if (packetdroppercentage != 0 && \ + random()%100 < packetdroppercentage) { \ + tftp_log(LOG_DEBUG, "Artifical packet drop in %s", s); \ + return (n); \ + } + +const char * +errtomsg(int error) +{ + static char ebuf[40]; + struct errmsg *pe; + char buf[MAXPKTSIZE]; + + if (error == 0) + return ("success"); + for (pe = errmsgs; pe->e_code >= 0; pe++) + if (pe->e_code == error) + return (pe->e_msg); + snprintf(ebuf, sizeof(buf), "error %d", error); + return (ebuf); +} + +static int +send_packet(int peer, uint16_t block, char *pkt, int size) +{ + int i; + int t = 1; + + for (i = 0; i < 12 ; i++) { + DROPPACKETn("send_packet", 0); + + if (sendto(peer, pkt, size, 0, + (struct sockaddr *)&peer_sock, peer_sock.ss_len) + == size) { + if (i) + tftp_log(LOG_ERR, + "%s block %d, attempt %d successful", + block, i); + return (0); + } + tftp_log(LOG_ERR, + "%s block %d, attempt %d failed (Error %d: %s)", + packettype(ntohs(((struct tftphdr *)(pkt))->th_opcode)), + block, i, errno, strerror(errno)); + sleep(t); + if (t < 32) + t <<= 1; + } + tftp_log(LOG_ERR, "send_packet: %s", strerror(errno)); + return (1); +} + +/* + * Send an ERROR packet (error message). + * Error code passed in is one of the + * standard TFTP codes, or a UNIX errno + * offset by 100. + */ +void +send_error(int peer, int error) +{ + struct tftphdr *tp; + int length; + struct errmsg *pe; + char buf[MAXPKTSIZE]; + + if (debug&DEBUG_PACKETS) + tftp_log(LOG_DEBUG, "Sending ERROR %d: %s", error); + + DROPPACKET("send_error"); + + tp = (struct tftphdr *)buf; + tp->th_opcode = htons((u_short)ERROR); + tp->th_code = htons((u_short)error); + for (pe = errmsgs; pe->e_code >= 0; pe++) + if (pe->e_code == error) + break; + if (pe->e_code < 0) { + pe->e_msg = strerror(error - 100); + tp->th_code = EUNDEF; /* set 'undef' errorcode */ + } + strcpy(tp->th_msg, pe->e_msg); + length = strlen(pe->e_msg); + tp->th_msg[length] = '\0'; + length += 5; + + if (debug&DEBUG_PACKETS) + tftp_log(LOG_DEBUG, "Sending ERROR %d: %s", error, tp->th_msg); + + if (sendto(peer, buf, length, 0, + (struct sockaddr *)&peer_sock, peer_sock.ss_len) != length) + tftp_log(LOG_ERR, "send_error: %s", strerror(errno)); +} + +/* + * Send an WRQ packet (write request). + */ +int +send_wrq(int peer, char *filename, char *mode) +{ + int n; + struct tftphdr *tp; + char *bp; + char buf[MAXPKTSIZE]; + int size; + + if (debug&DEBUG_PACKETS) + tftp_log(LOG_DEBUG, "Sending WRQ: filename: '%s', mode '%s'", + filename, mode + ); + + DROPPACKETn("send_wrq", 1); + + tp = (struct tftphdr *)buf; + tp->th_opcode = htons((u_short)WRQ); + size = 2; + + bp = tp->th_stuff; + strcpy(bp, filename); + bp += strlen(filename); + *bp = 0; + bp++; + size += strlen(filename) + 1; + + strcpy(bp, mode); + bp += strlen(mode); + *bp = 0; + bp++; + size += strlen(mode) + 1; + + if (options_rfc_enabled) + size += make_options(peer, bp, sizeof(buf) - size); + + n = sendto(peer, buf, size, 0, + (struct sockaddr *)&peer_sock, peer_sock.ss_len); + if (n != size) { + tftp_log(LOG_ERR, "send_wrq: %s", strerror(errno)); + return (1); + } + return (0); +} + +/* + * Send an RRQ packet (write request). + */ +int +send_rrq(int peer, char *filename, char *mode) +{ + int n; + struct tftphdr *tp; + char *bp; + char buf[MAXPKTSIZE]; + int size; + + if (debug&DEBUG_PACKETS) + tftp_log(LOG_DEBUG, "Sending RRQ: filename: '%s', mode '%s'", + filename, mode + ); + + DROPPACKETn("send_rrq", 1); + + tp = (struct tftphdr *)buf; + tp->th_opcode = htons((u_short)RRQ); + size = 2; + + bp = tp->th_stuff; + strcpy(bp, filename); + bp += strlen(filename); + *bp = 0; + bp++; + size += strlen(filename) + 1; + + strcpy(bp, mode); + bp += strlen(mode); + *bp = 0; + bp++; + size += strlen(mode) + 1; + + if (options_rfc_enabled) { + options[OPT_TSIZE].o_request = strdup("0"); + size += make_options(peer, bp, sizeof(buf) - size); + } + + n = sendto(peer, buf, size, 0, + (struct sockaddr *)&peer_sock, peer_sock.ss_len); + if (n != size) { + tftp_log(LOG_ERR, "send_rrq: %s", n, strerror(errno)); + return (1); + } + return (0); +} + +/* + * Send an OACK packet (option acknowledgement). + */ +int +send_oack(int peer) +{ + struct tftphdr *tp; + int size, i, n; + char *bp; + char buf[MAXPKTSIZE]; + + if (debug&DEBUG_PACKETS) + tftp_log(LOG_DEBUG, "Sending OACK"); + + DROPPACKETn("send_oack", 0); + + /* + * Send back an options acknowledgement (only the ones with + * a reply for) + */ + tp = (struct tftphdr *)buf; + bp = buf + 2; + size = sizeof(buf) - 2; + tp->th_opcode = htons((u_short)OACK); + for (i = 0; options[i].o_type != NULL; i++) { + if (options[i].o_reply != NULL) { + n = snprintf(bp, size, "%s%c%s", options[i].o_type, + 0, options[i].o_reply); + bp += n+1; + size -= n+1; + if (size < 0) { + tftp_log(LOG_ERR, "oack: buffer overflow"); + exit(1); + } + } + } + size = bp - buf; + + if (sendto(peer, buf, size, 0, + (struct sockaddr *)&peer_sock, peer_sock.ss_len) != size) { + tftp_log(LOG_INFO, "send_oack: %s", strerror(errno)); + return (1); + } + + return (0); +} + +/* + * Send an ACK packet (acknowledgement). + */ +int +send_ack(int fp, uint16_t block) +{ + struct tftphdr *tp; + int size; + char *bp; + char buf[MAXPKTSIZE]; + + if (debug&DEBUG_PACKETS) + tftp_log(LOG_DEBUG, "Sending ACK for block %d", block); + + DROPPACKETn("send_ack", 0); + + tp = (struct tftphdr *)buf; + bp = buf + 2; + size = sizeof(buf) - 2; + tp->th_opcode = htons((u_short)ACK); + tp->th_block = htons((u_short)block); + size = 4; + + if (sendto(fp, buf, size, 0, + (struct sockaddr *)&peer_sock, peer_sock.ss_len) != size) { + tftp_log(LOG_INFO, "send_ack: %s", strerror(errno)); + return (1); + } + + return (0); +} + +/* + * Send a DATA packet + */ +int +send_data(int peer, uint16_t block, char *data, int size) +{ + char buf[MAXPKTSIZE]; + struct tftphdr *pkt; + int n; + + if (debug&DEBUG_PACKETS) + tftp_log(LOG_DEBUG, "Sending DATA packet %d of %d bytes", + block, size); + + DROPPACKETn("send_data", 0); + + pkt = (struct tftphdr *)buf; + + pkt->th_opcode = htons((u_short)DATA); + pkt->th_block = htons((u_short)block); + memcpy(pkt->th_data, data, size); + + n = send_packet(peer, block, (char *)pkt, size + 4); + return (n); +} + + +/* + * Receive a packet + */ +jmp_buf timeoutbuf; + +static void +timeout(int sig __unused) +{ + + /* tftp_log(LOG_DEBUG, "Timeout\n"); Inside a signal handler... */ + longjmp(timeoutbuf, 1); +} + +int +receive_packet(int peer, char *data, int size, struct sockaddr_storage *from, + int thistimeout) +{ + struct tftphdr *pkt; + struct sockaddr_storage from_local; + struct sockaddr_storage *pfrom; + socklen_t fromlen; + int n; + static int waiting; + + pfrom = (from == NULL) ? &from_local : from; + + if (debug&DEBUG_PACKETS) + tftp_log(LOG_DEBUG, + "Waiting %d seconds for packet", timeoutpacket); + + pkt = (struct tftphdr *)data; + + waiting = 0; + signal(SIGALRM, timeout); + setjmp(timeoutbuf); + alarm(thistimeout); + + if (waiting > 0) { + alarm(0); + return (RP_TIMEOUT); + } + + if (waiting > 0) { + tftp_log(LOG_ERR, "receive_packet: timeout"); + alarm(0); + return (RP_TIMEOUT); + } + + waiting++; + fromlen = sizeof(*pfrom); + n = recvfrom(peer, data, size, 0, (struct sockaddr *)pfrom, &fromlen); + + alarm(0); + + DROPPACKETn("receive_packet", RP_TIMEOUT); + + if (n < 0) { + tftp_log(LOG_ERR, "receive_packet: timeout"); + return (RP_TIMEOUT); + } + + alarm(0); + + if (n < 0) { + /* No idea what could have happened if it isn't a timeout */ + tftp_log(LOG_ERR, "receive_packet: %s", strerror(errno)); + return (RP_RECVFROM); + } + if (n < 4) { + tftp_log(LOG_ERR, + "receive_packet: packet too small (%d bytes)", n); + return (RP_TOOSMALL); + } + + pkt->th_opcode = ntohs((u_short)pkt->th_opcode); + if (pkt->th_opcode == DATA || + pkt->th_opcode == ACK) + pkt->th_block = ntohs((u_short)pkt->th_block); + + if (pkt->th_opcode == DATA && n > pktsize) { + tftp_log(LOG_ERR, "receive_packet: packet too big"); + return (RP_TOOBIG); + } + + if (((struct sockaddr_in *)(pfrom))->sin_addr.s_addr != + ((struct sockaddr_in *)(&peer_sock))->sin_addr.s_addr) { + tftp_log(LOG_ERR, + "receive_packet: received packet from wrong source"); + return (RP_WRONGSOURCE); + } + + if (pkt->th_opcode == ERROR) { + tftp_log(LOG_ERR, "Got ERROR packet: %s", pkt->th_msg); + return (RP_ERROR); + } + + if (debug&DEBUG_PACKETS) + tftp_log(LOG_DEBUG, "Received %d bytes in a %s packet", + n, packettype(pkt->th_opcode)); + + return n - 4; +} Added: user/edwin/tftpd/libexec/tftpd/tftp-io.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tftpd/libexec/tftpd/tftp-io.h Sun Oct 12 10:10:42 2008 (r183798) @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2008 Edwin Groothuis. 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. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR 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 AUTHOR 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#define RP_NONE 0 +#define RP_RECVFROM -1 +#define RP_TOOSMALL -2 +#define RP_ERROR -3 +#define RP_WRONGSOURCE -4 +#define RP_TIMEOUT -5 +#define RP_TOOBIG -6 + +const char *errtomsg(int); +void send_error(int peer, int); +int send_wrq(int peer, char *, char *); +int send_rrq(int peer, char *, char *); +int send_oack(int peer); +int send_ack(int peer, unsigned short); +int send_data(int peer, uint16_t, char *, int); +int receive_packet(int peer, char *, int, struct sockaddr_storage *, int); + +extern struct sockaddr_storage peer_sock; +extern struct sockaddr_storage me_sock; Added: user/edwin/tftpd/libexec/tftpd/tftp-options.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tftpd/libexec/tftpd/tftp-options.c Sun Oct 12 10:10:42 2008 (r183798) @@ -0,0 +1,390 @@ +/* + * Copyright (C) 2008 Edwin Groothuis. 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. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR 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 AUTHOR 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. + */ + +#include +__FBSDID("$FreeBSD"); + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include "tftp-utils.h" +#include "tftp-io.h" +#include "tftp-options.h" + +/* + * Option handlers + */ + +struct options options[] = { + { "tsize", NULL, NULL, NULL /* option_tsize */, 1 }, + { "timeout", NULL, NULL, option_timeout, 1 }, + { "blksize", NULL, NULL, option_blksize, 1 }, + { "blksize2", NULL, NULL, option_blksize2, 0 }, + { "rollover", NULL, NULL, option_rollover, 0 }, + { NULL, NULL, NULL, NULL, 0 } +}; + +/* By default allow them */ +int options_rfc_enabled = 1; +int options_extra_enabled = 1; + +/* + * Rules for the option handlers: + * - If there is no o_request, there will be no processing. + * + * For servers + * - Logging is done as warnings. + * - The handler exit()s if there is a serious problem with the + * values submitted in the option. + * + * For clients + * - Logging is done as errors. After all, the server shouldn't + * return rubbish. + * - The handler returns if there is a serious problem with the + * values submitted in the option. + * - Sending the EBADOP packets is done by the handler. + */ + +int +option_tsize(int peer, struct tftphdr *tp, int mode, struct stat *stbuf) +{ + + if (options[OPT_TSIZE].o_request == NULL) + return (0); + + if (mode == RRQ) + asprintf(&options[OPT_TSIZE].o_reply, + "%ju", stbuf->st_size); + else + /* XXX Allows writes of all sizes. */ + options[OPT_TSIZE].o_reply = + strdup(options[OPT_TSIZE].o_request); + return (0); +} + +int +option_timeout(int peer) +{ + + if (options[OPT_TIMEOUT].o_request == NULL) + return (0); + + int to = atoi(options[OPT_TIMEOUT].o_request); + if (to < TIMEOUT_MIN || to > TIMEOUT_MAX) { + tftp_log(acting_as_client ? LOG_ERR : LOG_WARNING, + "Received bad value for timeout. " + "Should be between %d and %d, received %s", + TIMEOUT_MIN, TIMEOUT_MAX); + send_error(peer, EBADOP); + if (acting_as_client) + return (1); + exit(1); + } else { + timeoutpacket = to; + options[OPT_TIMEOUT].o_reply = + strdup(options[OPT_TIMEOUT].o_request); + } + settimeouts(timeoutpacket, timeoutnetwork, maxtimeouts); + + if (debug&DEBUG_OPTIONS) + tftp_log(LOG_DEBUG, "Setting timeout to '%s'", + options[OPT_TIMEOUT].o_reply); + + return (0); +} + +int +option_rollover(int peer) +{ + + if (options[OPT_ROLLOVER].o_request == NULL) + return (0); + + if (strcmp(options[OPT_ROLLOVER].o_request, "0") != 0 + && strcmp(options[OPT_ROLLOVER].o_request, "1") != 0) { + tftp_log(acting_as_client ? LOG_ERR : LOG_WARNING, + "Bad value for rollover, " + "should be either 0 or 1, received '%s', " + "ignoring request", + options[OPT_ROLLOVER].o_request); + if (acting_as_client) { + send_error(peer, EBADOP); + return (1); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Sun Oct 12 10:47:03 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BBE901065689; Sun, 12 Oct 2008 10:47:03 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 925718FC15; Sun, 12 Oct 2008 10:47:03 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9CAl3hB044152; Sun, 12 Oct 2008 10:47:03 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9CAl3tB044151; Sun, 12 Oct 2008 10:47:03 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <200810121047.m9CAl3tB044151@svn.freebsd.org> From: Takahashi Yoshihiro Date: Sun, 12 Oct 2008 10:47:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183799 - user/nyan/pc98 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 10:47:03 -0000 Author: nyan Date: Sun Oct 12 10:47:03 2008 New Revision: 183799 URL: http://svn.freebsd.org/changeset/base/183799 Log: Create working directory for pc98 support. Added: user/nyan/pc98/ From owner-svn-src-user@FreeBSD.ORG Sun Oct 12 10:47:58 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3D5BA106569F; Sun, 12 Oct 2008 10:47:58 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from smtp.ht-systems.ru (mr0.ht-systems.ru [78.110.50.55]) by mx1.freebsd.org (Postfix) with ESMTP id E09A68FC14; Sun, 12 Oct 2008 10:47:57 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from [85.21.245.235] (helo=orion.SpringDaemons.com) by smtp.ht-systems.ru with esmtpa (Exim 4.62) (envelope-from ) id 1Koy7e-00055r-9F; Sun, 12 Oct 2008 14:24:26 +0400 Received: from orion (localhost [127.0.0.1]) by orion.SpringDaemons.com (Postfix) with SMTP id BEF0939955; Sun, 12 Oct 2008 14:24:59 +0400 (MSD) Date: Sun, 12 Oct 2008 14:24:54 +0400 From: Stanislav Sedov To: Edwin Groothuis Message-Id: <20081012142454.607c861d.stas@FreeBSD.org> In-Reply-To: <200810120915.m9C9F5tq040143@svn.freebsd.org> References: <200810120915.m9C9F5tq040143@svn.freebsd.org> Organization: The FreeBSD Project X-XMPP: ssedov@jabber.ru X-Voice: +7 916 849 20 23 X-PGP-Fingerprint: F21E D6CC 5626 9609 6CE2 A385 2BF5 5993 EB26 9581 X-Mailer: carrier-pigeon Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="PGP-SHA1"; boundary="Signature=_Sun__12_Oct_2008_14_24_54_+0400_=UBthYGUVLbcSFDn" Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r183781 - in user/edwin/top/top-3.8b1: contrib/top usr.bin/top X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 10:47:58 -0000 --Signature=_Sun__12_Oct_2008_14_24_54_+0400_=UBthYGUVLbcSFDn Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, 12 Oct 2008 09:15:05 +0000 (UTC) Edwin Groothuis mentioned: > Author: edwin > Date: Sun Oct 12 09:15:05 2008 > New Revision: 183781 > URL: http://svn.freebsd.org/changeset/base/183781 >=20 > Log: > All collected changes to with regarding to the feedback received > on the announcement of top 3.8b1 on -stable and -current as version > B. > =20 > This is considered the final version and submitted to mentor (bde@) > for commit approval. What happened to my request of preserving -a option? --=20 Stanislav Sedov ST4096-RIPE --Signature=_Sun__12_Oct_2008_14_24_54_+0400_=UBthYGUVLbcSFDn Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAkjx0HsACgkQK/VZk+smlYGtlgCdHfMVzPSrnqPsbfsASp14LOyE UQMAn1RDwVYVsfkT1ir0rmaQ5UmzBTVn =NkaA -----END PGP SIGNATURE----- --Signature=_Sun__12_Oct_2008_14_24_54_+0400_=UBthYGUVLbcSFDn-- From owner-svn-src-user@FreeBSD.ORG Sun Oct 12 11:00:13 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 55E101065686; Sun, 12 Oct 2008 11:00:13 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2AC5B8FC18; Sun, 12 Oct 2008 11:00:13 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9CB0D1O044431; Sun, 12 Oct 2008 11:00:13 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9CB0DOk044430; Sun, 12 Oct 2008 11:00:13 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <200810121100.m9CB0DOk044430@svn.freebsd.org> From: Takahashi Yoshihiro Date: Sun, 12 Oct 2008 11:00:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183800 - user/nyan/pc98/sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 11:00:13 -0000 Author: nyan Date: Sun Oct 12 11:00:12 2008 New Revision: 183800 URL: http://svn.freebsd.org/changeset/base/183800 Log: Initial import of sys. Added: user/nyan/pc98/sys/ - copied from r183799, head/sys/ From owner-svn-src-user@FreeBSD.ORG Sun Oct 12 11:39:31 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 737681065687; Sun, 12 Oct 2008 11:39:31 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 60E5A8FC17; Sun, 12 Oct 2008 11:39:31 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9CBdVOp045089; Sun, 12 Oct 2008 11:39:31 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9CBdVoW045088; Sun, 12 Oct 2008 11:39:31 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <200810121139.m9CBdVoW045088@svn.freebsd.org> From: Takahashi Yoshihiro Date: Sun, 12 Oct 2008 11:39:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183801 - user/nyan/pc98/sys/boot/pc98/btx/btx X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 11:39:31 -0000 Author: nyan Date: Sun Oct 12 11:39:30 2008 New Revision: 183801 URL: http://svn.freebsd.org/changeset/base/183801 Log: MFi386: Use real mode instead of v86 mode. Modified: user/nyan/pc98/sys/boot/pc98/btx/btx/btx.S Modified: user/nyan/pc98/sys/boot/pc98/btx/btx/btx.S ============================================================================== --- user/nyan/pc98/sys/boot/pc98/btx/btx/btx.S Sun Oct 12 11:00:12 2008 (r183800) +++ user/nyan/pc98/sys/boot/pc98/btx/btx/btx.S Sun Oct 12 11:39:30 2008 (r183801) @@ -21,11 +21,11 @@ .set MEM_BTX,0x1000 # Start of BTX memory .set MEM_ESP0,0x1800 # Supervisor stack .set MEM_BUF,0x1800 # Scratch buffer - .set MEM_ESP1,0x1e00 # Link stack - .set MEM_IDT,0x1e00 # IDT - .set MEM_TSS,0x1f98 # TSS - .set MEM_MAP,0x2000 # I/O bit map - .set MEM_TSS_END,0x3fff # Page directory + .set MEM_ESPR,0x5e00 # Real mode stack + .set MEM_IDT,0x5e00 # IDT + .set MEM_TSS,0x5f98 # TSS + .set MEM_MAP,0x6000 # I/O bit map + .set MEM_TSS_END,0x7fff # End of TSS .set MEM_ORG,0x9000 # BTX code .set MEM_USR,0xa000 # Start of user memory /* @@ -34,6 +34,13 @@ .set PAG_SIZ,0x1000 # Page size .set PAG_CNT,0x1000 # Pages to map /* + * Fields in %eflags. + */ + .set PSL_T,0x00000100 # Trap flag + .set PSL_I,0x00000200 # Interrupt enable flag + .set PSL_VM,0x00020000 # Virtual 8086 mode flag + .set PSL_AC,0x00040000 # Alignment check flag +/* * Segment selectors. */ .set SEL_SCODE,0x8 # Supervisor code @@ -48,7 +55,6 @@ */ .set TSS_ESP0,0x4 # PL 0 ESP .set TSS_SS0,0x8 # PL 0 SS - .set TSS_ESP1,0xc # PL 1 ESP .set TSS_MAP,0x66 # I/O bit map base /* * System calls. @@ -56,10 +62,20 @@ .set SYS_EXIT,0x0 # Exit .set SYS_EXEC,0x1 # Exec /* - * V86 constants. + * Fields in V86 interface structure. */ - .set V86_FLG,0x208eff # V86 flag mask - .set V86_STK,0x400 # V86 stack allowance + .set V86_CTL,0x0 # Control flags + .set V86_ADDR,0x4 # Int number/address + .set V86_ES,0x8 # V86 ES + .set V86_DS,0xc # V86 DS + .set V86_FS,0x10 # V86 FS + .set V86_GS,0x14 # V86 GS +/* + * V86 control flags. + */ + .set V86F_ADDR,0x10000 # Segment:offset address + .set V86F_CALLF,0x20000 # Emulate far call + .set V86F_FLAGS,0x40000 # Return flags /* * Dump format control bytes. */ @@ -77,13 +93,11 @@ * BIOS Data Area locations. */ .set BDA_MEM,0x501 # Free memory - .set BDA_KEYFLAGS,0x53a # Keyboard shift-state flags .set BDA_POS,0x53e # Cursor position /* * Derivations, for brevity. */ .set _ESP0H,MEM_ESP0>>0x8 # Byte 1 of ESP0 - .set _ESP1H,MEM_ESP1>>0x8 # Byte 1 of ESP1 .set _TSSIO,MEM_MAP-MEM_TSS # TSS I/O base .set _TSSLM,MEM_TSS_END-MEM_TSS # TSS limit .set _IDTLM,MEM_TSS-MEM_IDT-1 # IDT limit @@ -100,7 +114,7 @@ btx_hdr: .byte 0xeb # Machine ID .byte 0xe # Header size .ascii "BTX" # Magic .byte 0x1 # Major version - .byte 0x1 # Minor version + .byte 0x2 # Minor version .byte BTX_FLAGS # Flags .word PAG_CNT-MEM_ORG>>0xc # Paging control .word break-start # Text size @@ -121,13 +135,24 @@ init: cli # Disable interrupts */ mov $MEM_IDT,%di # Memory to initialize mov $(MEM_ORG-MEM_IDT)/2,%cx # Words to zero - push %di # Save rep # Zero-fill stosw # memory - pop %di # Restore +/* + * Update real mode IDT for reflecting hardware interrupts. + */ + mov $intr20,%bx # Address first handler + mov $0x10,%cx # Number of handlers + mov $0x20*4,%di # First real mode IDT entry +init.0: mov %bx,(%di) # Store IP + inc %di # Address next + inc %di # entry + stosw # Store CS + add $4,%bx # Next handler + loop init.0 # Next IRQ /* * Create IDT. */ + mov $MEM_IDT,%di mov $idtctl,%si # Control string init.1: lodsb # Get entry cbw # count @@ -153,7 +178,6 @@ init.3: lea 0x8(%di),%di # Next entry */ init.4: movb $_ESP0H,TSS_ESP0+1(%di) # Set ESP0 movb $SEL_SDATA,TSS_SS0(%di) # Set SS0 - movb $_ESP1H,TSS_ESP1+1(%di) # Set ESP1 movb $_TSSIO,TSS_MAP(%di) # Set I/O bit map base /* * Bring up the system. @@ -253,8 +277,8 @@ exit.2: xor %ax,%ax # Real mode segme exit.3: jz exit.3 # No movb $0xa0,%al outb %al,$0x35 - movb 0,%al - outb %al,$0xf0 + movb $0x00,%al + outb %al,$0xf0 # reboot the machine exit.4: jmp exit.4 /* * Set IRQ offsets by reprogramming 8259A PICs. @@ -285,10 +309,6 @@ setpic: in $0x02,%al # Save master retw # To caller .code32 /* - * Initiate return from V86 mode to user mode. - */ -inthlt: hlt # To supervisor mode -/* * Exception jump table. */ intx00: push $0x0 # Int 0x0: #DE @@ -314,18 +334,12 @@ intx00: push $0x0 # Int 0x0: #DE push $0xc # Int 0xc: #SS jmp except # Stack segment fault push $0xd # Int 0xd: #GP - jmp ex_v86 # General protection + jmp except # General protection push $0xe # Int 0xe: #PF jmp except # Page fault intx10: push $0x10 # Int 0x10: #MF jmp ex_noc # Floating-point error /* - * Handle #GP exception. - */ -ex_v86: testb $0x2,0x12(%esp,1) # V86 mode? - jz except # No - jmp v86mon # To monitor -/* * Save a zero error code. */ ex_noc: pushl (%esp,1) # Duplicate int no @@ -337,24 +351,17 @@ except: cld # String ops inc pushl %ds # Save pushl %es # most pusha # registers - movb $0x6,%al # Push loop count - testb $0x2,0x3a(%esp,1) # V86 mode? - jnz except.1 # Yes pushl %gs # Set GS pushl %fs # Set FS pushl %ds # Set DS pushl %es # Set ES - movb $0x2,%al # Push loop count cmpw $SEL_SCODE,0x44(%esp,1) # Supervisor mode? jne except.1 # No pushl %ss # Set SS - leal 0x50(%esp,1),%eax # Set - pushl %eax # ESP jmp except.2 # Join common code -except.1: pushl 0x50(%esp,1) # Set GS, FS, DS, ES - decb %al # (if V86 mode), and - jne except.1 # SS, ESP -except.2: push $SEL_SDATA # Set up +except.1: pushl 0x50(%esp,1) # Set SS +except.2: pushl 0x50(%esp,1) # Set ESP + push $SEL_SDATA # Set up popl %ds # to pushl %ds # address popl %es # data @@ -363,14 +370,12 @@ except.2: push $SEL_SDATA # Set up movl $MEM_BUF,%edi # Buffer pushl %eax pushl %edx -wait.1: - inb $0x60,%al +wait.1: inb $0x60,%al testb $0x04,%al jz wait.1 movb $0xe0,%al outb %al,$0x62 -wait.2: - inb $0x60,%al +wait.2: inb $0x60,%al testb $0x01,%al jz wait.2 xorl %edx,%edx @@ -399,237 +404,11 @@ wait.2: je except.3 # Yes cmpb $0x1,(%esp,1) # Debug? jne except.2a # No - testl $0x100,0x10(%esp,1) # Trap flag set? + testl $PSL_T,0x10(%esp,1) # Trap flag set? jnz except.3 # Yes except.2a: jmp exit # Exit except.3: leal 0x8(%esp,1),%esp # Discard err, int no iret # From interrupt -/* - * Return to user mode from V86 mode. - */ -intrtn: cld # String ops inc - pushl %ds # Address - popl %es # data - leal 0x3c(%ebp),%edx # V86 Segment registers - movl MEM_TSS+TSS_ESP1,%esi # Link stack pointer - lodsl # INT_V86 args pointer - movl %esi,%ebx # Saved exception frame - testl %eax,%eax # INT_V86 args? - jz intrtn.2 # No - movl $MEM_USR,%edi # User base - movl 0x1c(%esi),%ebx # User ESP - movl %eax,(%edi,%ebx,1) # Restore to user stack - leal 0x8(%edi,%eax,1),%edi # Arg segment registers - testb $0x4,-0x6(%edi) # Return flags? - jz intrtn.1 # No - movl 0x30(%ebp),%eax # Get V86 flags - movw %ax,0x18(%esi) # Set user flags -intrtn.1: leal 0x10(%esi),%ebx # Saved exception frame - xchgl %edx,%esi # Segment registers - movb $0x4,%cl # Update seg regs - rep # in INT_V86 - movsl # args -intrtn.2: xchgl %edx,%esi # Segment registers - leal 0x28(%ebp),%edi # Set up seg - movb $0x4,%cl # regs for - rep # later - movsl # pop - xchgl %ebx,%esi # Restore exception - movb $0x5,%cl # frame to - rep # supervisor - movsl # stack - movl %esi,MEM_TSS+TSS_ESP1 # Link stack pointer - popa # Restore - leal 0x8(%esp,1),%esp # Discard err, int no - popl %es # Restore - popl %ds # user - popl %fs # segment - popl %gs # registers - iret # To user mode -/* - * V86 monitor. - */ -v86mon: cld # String ops inc - pushl $SEL_SDATA # Set up for - popl %ds # flat addressing - pusha # Save registers - movl %esp,%ebp # Address stack frame - movzwl 0x2c(%ebp),%edi # Load V86 CS - shll $0x4,%edi # To linear - movl 0x28(%ebp),%esi # Load V86 IP - addl %edi,%esi # Code pointer - xorl %ecx,%ecx # Zero - movb $0x2,%cl # 16-bit operands - xorl %eax,%eax # Zero -v86mon.1: lodsb # Get opcode - cmpb $0x66,%al # Operand size prefix? - jne v86mon.2 # No - movb $0x4,%cl # 32-bit operands - jmp v86mon.1 # Continue -v86mon.2: cmpb $0xf4,%al # HLT? - jne v86mon.3 # No - cmpl $inthlt+0x1,%esi # Is inthlt? - jne v86mon.7 # No (ignore) - jmp intrtn # Return to user mode -v86mon.3: cmpb $0xf,%al # Prefixed instruction? - jne v86mon.4 # No - cmpb $0x09,(%esi) # Is it a WBINVD? - je v86wbinvd # Yes - cmpb $0x30,(%esi) # Is it a WRMSR? - je v86wrmsr # Yes - cmpb $0x32,(%esi) # Is it a RDMSR? - je v86rdmsr # Yes - cmpb $0x20,(%esi) # Is this a MOV reg,CRx? - je v86mov # Yes -v86mon.4: cmpb $0xfa,%al # CLI? - je v86cli # Yes - cmpb $0xfb,%al # STI? - je v86sti # Yes - movzwl 0x38(%ebp),%ebx # Load V86 SS - shll $0x4,%ebx # To offset - pushl %ebx # Save - addl 0x34(%ebp),%ebx # Add V86 SP - movl 0x30(%ebp),%edx # Load V86 flags - cmpb $0x9c,%al # PUSHF/PUSHFD? - je v86pushf # Yes - cmpb $0x9d,%al # POPF/POPFD? - je v86popf # Yes - cmpb $0xcd,%al # INT imm8? - je v86intn # Yes - cmpb $0xcf,%al # IRET/IRETD? - je v86iret # Yes - popl %ebx # Restore - popa # Restore - jmp except # Handle exception -v86mon.5: movl %edx,0x30(%ebp) # Save V86 flags -v86mon.6: popl %edx # V86 SS adjustment - subl %edx,%ebx # Save V86 - movl %ebx,0x34(%ebp) # SP -v86mon.7: subl %edi,%esi # From linear - movl %esi,0x28(%ebp) # Save V86 IP - popa # Restore - leal 0x8(%esp,1),%esp # Discard int no, error - iret # To V86 mode -/* - * Emulate MOV reg,CRx. - */ -v86mov: movb 0x1(%esi),%bl # Fetch Mod R/M byte - testb $0x10,%bl # Read CR2 or CR3? - jnz v86mov.1 # Yes - movl %cr0,%eax # Read CR0 - testb $0x20,%bl # Read CR4 instead? - jz v86mov.2 # No - movl %cr4,%eax # Read CR4 - jmp v86mov.2 -v86mov.1: movl %cr2,%eax # Read CR2 - testb $0x08,%bl # Read CR3 instead? - jz v86mov.2 # No - movl %cr3,%eax # Read CR3 -v86mov.2: andl $0x7,%ebx # Compute offset in - shl $2,%ebx # frame of destination - neg %ebx # register - movl %eax,0x1c(%ebp,%ebx,1) # Store CR to reg - incl %esi # Adjust IP -/* - * Return from emulating a 0x0f prefixed instruction - */ -v86preret: incl %esi # Adjust IP - jmp v86mon.7 # Finish up -/* - * Emulate WBINVD - */ -v86wbinvd: wbinvd # Write back and invalidate - # cache - jmp v86preret # Finish up -/* - * Emulate WRMSR - */ -v86wrmsr: movl 0x18(%ebp),%ecx # Get user's %ecx (MSR to write) - movl 0x14(%ebp),%edx # Load the value - movl 0x1c(%ebp),%eax # to write - wrmsr # Write MSR - jmp v86preret # Finish up -/* - * Emulate RDMSR - */ -v86rdmsr: movl 0x18(%ebp),%ecx # MSR to read - rdmsr # Read the MSR - movl %eax,0x1c(%ebp) # Return the value of - movl %edx,0x14(%ebp) # the MSR to the user - jmp v86preret # Finish up -/* - * Emulate CLI. - */ -v86cli: andb $~0x2,0x31(%ebp) # Clear IF - jmp v86mon.7 # Finish up -/* - * Emulate STI. - */ -v86sti: orb $0x2,0x31(%ebp) # Set IF - jmp v86mon.7 # Finish up -/* - * Emulate PUSHF/PUSHFD. - */ -v86pushf: subl %ecx,%ebx # Adjust SP - cmpb $0x4,%cl # 32-bit - je v86pushf.1 # Yes - data16 # 16-bit -v86pushf.1: movl %edx,(%ebx) # Save flags - jmp v86mon.6 # Finish up -/* - * Emulate IRET/IRETD. - */ -v86iret: movzwl (%ebx),%esi # Load V86 IP - movzwl 0x2(%ebx),%edi # Load V86 CS - leal 0x4(%ebx),%ebx # Adjust SP - movl %edi,0x2c(%ebp) # Save V86 CS - xorl %edi,%edi # No ESI adjustment -/* - * Emulate POPF/POPFD (and remainder of IRET/IRETD). - */ -v86popf: cmpb $0x4,%cl # 32-bit? - je v86popf.1 # Yes - movl %edx,%eax # Initialize - data16 # 16-bit -v86popf.1: movl (%ebx),%eax # Load flags - addl %ecx,%ebx # Adjust SP - andl $V86_FLG,%eax # Merge - andl $~V86_FLG,%edx # the - orl %eax,%edx # flags - jmp v86mon.5 # Finish up -/* - * trap int 15, function 87 - * reads %es:%si from saved registers on stack to find a GDT containing - * source and destination locations - * reads count of words from saved %cx - * returns success by setting %ah to 0 - */ -int15_87: pushl %esi # Save - pushl %edi # registers - movl 0x3C(%ebp),%edi # Load ES - movzwl 0x4(%ebp),%eax # Load user's SI - shll $0x4,%edi # EDI = (ES << 4) + - addl %eax,%edi # SI - movl 0x11(%edi),%eax # Read base of - movb 0x17(%edi),%al # GDT entry - ror $8,%eax # for source - xchgl %eax,%esi # into %esi - movl 0x19(%edi),%eax # Read base of - movb 0x1f(%edi),%al # GDT entry for - ror $8,%eax # destination - xchgl %eax,%edi # into %edi - pushl %ds # Make: - popl %es # es = ds - movzwl 0x18(%ebp),%ecx # Get user's CX - shll $0x1,%ecx # Convert count from words - rep # repeat... - movsb # perform copy. - popl %edi # Restore - popl %esi # registers - movb $0x0,0x1d(%ebp) # set ah = 0 to indicate - # success - andb $0xfe,%dl # clear CF - jmp v86mon.5 # Finish up /* * Reboot the machine by setting the reboot flag and exiting @@ -638,36 +417,7 @@ reboot: orb $0x1,btx_hdr+0x7 # Set the jmp exit # Terminate BTX and reboot /* - * Emulate INT imm8... also make sure to check if it's int 15/87 - */ -v86intn: lodsb # Get int no - cmpb $0x19,%al # is it int 19? - je reboot # yes, reboot the machine - cmpb $0x15,%al # is it int 15? - jne v86intn.1 # no, skip parse - cmpb $0x87,0x1d(%ebp) # is it the memcpy subfunction? - je int15_87 # yes - cmpw $0x4f53,0x1c(%ebp) # is it the delete key callout? - jne v86intn.1 # no, handle the int normally - movb BDA_KEYFLAGS,%ch # get the shift key state - andb $0x18,%ch # mask off just Ctrl and Alt - cmpb $0x18,%ch # are both Ctrl and Alt down? - je reboot # yes, reboot the machine -v86intn.1: subl %edi,%esi # From - shrl $0x4,%edi # linear - movw %dx,-0x2(%ebx) # Save flags - movw %di,-0x4(%ebx) # Save CS - leal -0x6(%ebx),%ebx # Adjust SP - movw %si,(%ebx) # Save IP - shll $0x2,%eax # Scale - movzwl (%eax),%esi # Load IP - movzwl 0x2(%eax),%edi # Load CS - movl %edi,0x2c(%ebp) # Save CS - xorl %edi,%edi # No ESI adjustment - andb $~0x1,%dh # Clear TF - jmp v86mon.5 # Finish up -/* - * Hardware interrupt jump table. + * Protected Mode Hardware interrupt jump table. */ intx20: push $0x8 # Int 0x20: IRQ0 jmp int_hw # V86 int 0x8 @@ -701,127 +451,243 @@ intx20: push $0x8 # Int 0x20: IRQ0 jmp int_hw # V86 int 0x16 push $0x17 # Int 0x2f: IRQ15 jmp int_hw # V86 int 0x17 + +/* + * Invoke real mode interrupt/function call from user mode with arguments. + */ +intx31: pushl $-1 # Dummy int no for btx_v86 /* - * Reflect hardware interrupts. + * Invoke real mode interrupt/function call from protected mode. + * + * We place a trampoline on the user stack that will return to rret_tramp + * which will reenter protected mode and then finally return to the user + * client. + * + * Kernel frame %esi points to: Real mode stack frame at MEM_ESPR: + * + * -0x00 user %ss -0x04 kernel %esp (with full frame) + * -0x04 user %esp -0x08 btx_v86 pointer + * -0x08 user %eflags -0x0c flags (only used if interrupt) + * -0x0c user %cs -0x10 real mode CS:IP return trampoline + * -0x10 user %eip -0x12 real mode flags + * -0x14 int no -0x16 real mode CS:IP (target) + * -0x18 %eax + * -0x1c %ecx + * -0x20 %edx + * -0x24 %ebx + * -0x28 %esp + * -0x2c %ebp + * -0x30 %esi + * -0x34 %edi + * -0x38 %gs + * -0x3c %fs + * -0x40 %ds + * -0x44 %es */ -int_hw: testb $0x2,0xe(%esp,1) # V86 mode? - jz intusr # No - pushl $SEL_SDATA # Address - popl %ds # data - xchgl %eax,(%esp,1) # Swap EAX, int no - pushl %ebp # Address - movl %esp,%ebp # stack frame - pushl %ebx # Save - shll $0x2,%eax # Get int - movl (%eax),%eax # vector - subl $0x6,0x14(%ebp) # Adjust V86 ESP - movzwl 0x18(%ebp),%ebx # V86 SS - shll $0x4,%ebx # * 0x10 - addl 0x14(%ebp),%ebx # + V86 ESP - xchgw %ax,0x8(%ebp) # Swap V86 IP - rorl $0x10,%eax # Swap words - xchgw %ax,0xc(%ebp) # Swap V86 CS - roll $0x10,%eax # Swap words - movl %eax,(%ebx) # CS:IP for IRET - movl 0x10(%ebp),%eax # V86 flags - movw %ax,0x4(%ebx) # Flags for IRET - andb $~0x3,0x11(%ebp) # Clear IF, TF - popl %ebx # Restore - popl %ebp # saved - popl %eax # registers - iret # To V86 mode -/* - * Invoke V86 interrupt from user mode, with arguments. - */ -intx31: stc # Have btx_v86 - pushl %eax # Missing int no -/* - * Invoke V86 interrupt from user mode. - */ -intusr: std # String ops dec - pushl %eax # Expand - pushl %eax # stack - pushl %eax # frame - pusha # Save +int_hw: cld # String ops inc + pusha # Save gp regs pushl %gs # Save - movl %esp,%eax # seg regs - pushl %fs # and - pushl %ds # point - pushl %es # to them + pushl %fs # seg + pushl %ds # regs + pushl %es push $SEL_SDATA # Set up popl %ds # to pushl %ds # address popl %es # data + leal 0x44(%esp,1),%esi # Base of frame + movl -0x14(%esi),%eax # Get Int no + cmpl $-1,%eax # Hardware interrupt? + jne intusr.2 # Yes +/* + * v86 calls save the btx_v86 pointer on the real mode stack and read the + * address and flags from the btx_v86 structure. + */ movl $MEM_USR,%ebx # User base movl %ebx,%edx # address - jc intusr.1 # If btx_v86 - xorl %edx,%edx # Control flags - xorl %ebp,%ebp # btx_v86 pointer -intusr.1: leal 0x50(%esp,1),%esi # Base of frame - pushl %esi # Save addl -0x4(%esi),%ebx # User ESP - movl MEM_TSS+TSS_ESP1,%edi # Link stack pointer - leal -0x4(%edi),%edi # Adjust for push - xorl %ecx,%ecx # Zero - movb $0x5,%cl # Push exception - rep # frame on - movsl # link stack - xchgl %eax,%esi # Saved seg regs - movl 0x40(%esp,1),%eax # Get int no - testl %edx,%edx # Have btx_v86? - jz intusr.2 # No movl (%ebx),%ebp # btx_v86 pointer - movb $0x4,%cl # Count - addl %ecx,%ebx # Adjust for pop - rep # Push saved seg regs - movsl # on link stack addl %ebp,%edx # Flatten btx_v86 ptr - leal 0x14(%edx),%esi # Seg regs pointer - movl 0x4(%edx),%eax # Get int no/address - movzwl 0x2(%edx),%edx # Get control flags -intusr.2: movl %ebp,(%edi) # Push btx_v86 and - movl %edi,MEM_TSS+TSS_ESP1 # save link stack ptr - popl %edi # Base of frame - xchgl %eax,%ebp # Save intno/address - movl 0x48(%esp,1),%eax # Get flags - testb $0x2,%dl # Simulate CALLF? - jnz intusr.3 # Yes - decl %ebx # Push flags - decl %ebx # on V86 - movw %ax,(%ebx) # stack -intusr.3: movb $0x4,%cl # Count - subl %ecx,%ebx # Push return address - movl $inthlt,(%ebx) # on V86 stack - rep # Copy seg regs to - movsl # exception frame - xchgl %eax,%ecx # Save flags - movl %ebx,%eax # User ESP - subl $V86_STK,%eax # Less bytes - ja intusr.4 # to - xorl %eax,%eax # keep -intusr.4: shrl $0x4,%eax # Gives segment - stosl # Set SS - shll $0x4,%eax # To bytes - xchgl %eax,%ebx # Swap - subl %ebx,%eax # Gives offset - stosl # Set ESP - xchgl %eax,%ecx # Get flags - btsl $0x11,%eax # Set VM - andb $~0x1,%ah # Clear TF - stosl # Set EFL - xchgl %eax,%ebp # Get int no/address - testb $0x1,%dl # Address? - jnz intusr.5 # Yes + movl %edx,MEM_ESPR-0x08 # Save btx_v86 ptr + movl V86_ADDR(%edx),%eax # Get int no/address + movl V86_CTL(%edx),%edx # Get control flags + jmp intusr.3 # Skip hardware interrupt +/* + * Hardware interrupts store a NULL btx_v86 pointer and use the address + * (interrupt number) from the stack with empty flags. Also, we clear + * the segment registers for the interrupt handler. + */ +intusr.2: xorl %edx,%edx # Control flags + movl %edx,MEM_ESPR-0x08 # NULL btx_v86 ptr + movl %edx,-0x38(%esi) # Real mode %gs of 0 + movl %edx,-0x3c(%esi) # Real mode %fs of 0 + movl %edx,-0x40(%esi) # Real mode %ds of 0 + movl %edx,-0x44(%esi) # Real mode %es of 0 +/* + * %eax now holds either the interrupt number or segment:offset of function. + * %edx now holds the V86F_* flags. + * + * For interrupt handler invocations (either hardware interrupts or VM86 + * INTx requests) we also disable interrupts, tracing, and alignment checking + * while the handler runs. + */ +intusr.3: movl -0x08(%esi),%ebx # Save user flags in %ebx + testl $V86F_ADDR,%edx # Segment:offset? + jnz intusr.4 # Yes shll $0x2,%eax # Scale movl (%eax),%eax # Load int vector -intusr.5: movl %eax,%ecx # Save - shrl $0x10,%eax # Gives segment - stosl # Set CS - movw %cx,%ax # Restore - stosl # Set EIP - leal 0x10(%esp,1),%esp # Discard seg regs - popa # Restore - iret # To V86 mode + andl $~(PSL_I|PSL_T|PSL_AC),%ebx # Disable interrupts, tracing, + # and alignment checking for + # interrupt handler + jmp intusr.5 # Skip CALLF test +intusr.4: testl $V86F_CALLF,%edx # Far call? + jnz intusr.5 # Ok + movl %edx,0x30(%esp,1) # Place VM86 flags in int no + movl $badvm86,%esi # Display bad + call putstr # VM86 call + popl %es # Restore + popl %ds # seg + popl %fs # regs + popl %gs + popal # Restore gp regs + jmp ex_noc # Panic +intusr.5: movw %bx,MEM_ESPR-0x12 # Pass user flags to real mode + # target +/* + * If this is a v86 call, copy the seg regs out of the btx_v86 structure. + */ + movl MEM_ESPR-0x08,%ecx # Get btx_v86 ptr + jecxz intusr.6 # Skip for hardware ints + leal -0x44(%esi),%edi # %edi => kernel stack seg regs + pushl %esi # Save + leal V86_ES(%ecx),%esi # %esi => btx_v86 seg regs + movl $4,%ecx # Copy seg regs + rep # from btx_v86 + movsl # to kernel stack + popl %esi # Restore +intusr.6: movl %esp,MEM_ESPR-0x04 # Save kernel stack pointer + movl -0x08(%esi),%ebx # Copy user flags to real + movl %ebx,MEM_ESPR-0x0c # mode return trampoline + movl $rret_tramp,%ebx # Set return trampoline + movl %ebx,MEM_ESPR-0x10 # CS:IP + movl %eax,MEM_ESPR-0x16 # Real mode target CS:IP + ljmpw $SEL_RCODE,$intusr.7 # Change to 16-bit segment + .code16 +intusr.7: movl %cr0,%eax # Leave + dec %al # protected + movl %eax,%cr0 # mode + ljmpw $0x0,$intusr.8 +intusr.8: xorw %ax,%ax # Reset %ds + movw %ax,%ds # and + movw %ax,%ss # %ss + lidt ivtdesc # Set IVT + popl %es # Restore + popl %ds # seg + popl %fs # regs + popl %gs + popal # Restore gp regs + movw $MEM_ESPR-0x16,%sp # Switch to real mode stack + iret # Call target routine +/* + * For the return to real mode we setup a stack frame like this on the real + * mode stack. Note that callf calls won't pop off the flags, but we just + * ignore that by repositioning %sp to be just above the btx_v86 pointer + * so it is aligned. The stack is relative to MEM_ESPR. + * + * -0x04 kernel %esp + * -0x08 btx_v86 + * -0x0c %eax + * -0x10 %ecx + * -0x14 %edx + * -0x18 %ebx + * -0x1c %esp + * -0x20 %ebp + * -0x24 %esi + * -0x28 %edi + * -0x2c %gs + * -0x30 %fs + * -0x34 %ds + * -0x38 %es + * -0x3c %eflags + */ +rret_tramp: movw $MEM_ESPR-0x08,%sp # Reset stack pointer + pushal # Save gp regs + pushl %gs # Save + pushl %fs # seg + pushl %ds # regs + pushl %es + pushfl # Save %eflags + cli # Disable interrupts + std # String ops dec + xorw %ax,%ax # Reset seg + movw %ax,%ds # regs + movw %ax,%es # (%ss is already 0) + lidt idtdesc # Set IDT + lgdt gdtdesc # Set GDT + mov %cr0,%eax # Switch to protected + inc %ax # mode + mov %eax,%cr0 # + ljmp $SEL_SCODE,$rret_tramp.1 # To 32-bit code + .code32 +rret_tramp.1: xorl %ecx,%ecx # Zero + movb $SEL_SDATA,%cl # Setup + movw %cx,%ss # 32-bit + movw %cx,%ds # seg + movw %cx,%es # regs + movl MEM_ESPR-0x04,%esp # Switch to kernel stack + leal 0x44(%esp,1),%esi # Base of frame + andb $~0x2,tss_desc+0x5 # Clear TSS busy + movb $SEL_TSS,%cl # Set task + ltr %cx # register +/* + * Now we are back in protected mode. Copy the registers off of the real + * mode stack onto the kernel stack. Also, initialize all the seg regs on + * the kernel stack. + * + * Note that the %esp in the kernel stack after this is garbage, but popa + * ignores it, so we don't have to fix it up. + */ + leal -0x18(%esi),%edi # Kernel stack GP regs + pushl %esi # Save + movl $MEM_ESPR-0x0c,%esi # Real mode stack GP regs + movl $8,%ecx # Copy GP regs from + rep # real mode stack + movsl # to kernel stack + popl %esi # Restore + movl $SEL_UDATA,%eax # Selector for data seg regs + movl $4,%ecx # Initialize %ds, + rep # %es, %fs, and + stosl # %gs +/* + * If this was a V86 call, copy the saved seg regs on the real mode stack + * back over to the btx_v86 structure. Also, conditionally update the saved + * eflags on the kernel stack based on the flags from the user. + */ + movl MEM_ESPR-0x08,%ecx # Get btx_v86 ptr + jecxz rret_tramp.3 # Skip for hardware ints + leal V86_GS(%ecx),%edi # %edi => btx_v86 seg regs + pushl %esi # Save + leal MEM_ESPR-0x2c,%esi # %esi => real mode seg regs + xchgl %ecx,%edx # Save btx_v86 ptr + movl $4,%ecx # Copy seg regs + rep # from real mode stack + movsl # to btx_v86 + popl %esi # Restore + movl V86_CTL(%edx),%edx # Read V86 control flags + testl $V86F_FLAGS,%edx # User wants flags? + jz rret_tramp.3 # No + movl MEM_ESPR-0x3c,%eax # Read real mode flags + movw %ax,-0x08(%esi) # Update user flags (low 16) +/* + * Return to the user task + */ +rret_tramp.3: popl %es # Restore + popl %ds # seg + popl %fs # regs + popl %gs + popal # Restore gp regs + addl $4,%esp # Discard int no + iret # Return to user mode + /* * System Call. */ @@ -869,7 +735,7 @@ dump.1: testb $DMP_X32,%ch # Dump long dump.2: testb $DMP_MEM,%ch # Dump memory? jz dump.8 # No pushl %ds # Save - testb $0x2,0x52(%ebx) # V86 mode? + testl $PSL_VM,0x50(%ebx) # V86 mode? jnz dump.3 # Yes verr 0x4(%esi) # Readable selector? jnz dump.3 # No @@ -1060,6 +926,61 @@ putchr.4: movw %dx,(%ebx) # Update pos ret # To caller #endif + .code16 +/* + * Real Mode Hardware interrupt jump table. + */ +intr20: push $0x8 # Int 0x20: IRQ0 + jmp int_hwr # V86 int 0x8 + push $0x9 # Int 0x21: IRQ1 + jmp int_hwr # V86 int 0x9 + push $0xa # Int 0x22: IRQ2 + jmp int_hwr # V86 int 0xa + push $0xb # Int 0x23: IRQ3 + jmp int_hwr # V86 int 0xb + push $0xc # Int 0x24: IRQ4 + jmp int_hwr # V86 int 0xc + push $0xd # Int 0x25: IRQ5 + jmp int_hwr # V86 int 0xd + push $0xe # Int 0x26: IRQ6 + jmp int_hwr # V86 int 0xe + push $0xf # Int 0x27: IRQ7 + jmp int_hwr # V86 int 0xf + push $0x10 # Int 0x28: IRQ8 + jmp int_hwr # V86 int 0x10 + push $0x11 # Int 0x29: IRQ9 + jmp int_hwr # V86 int 0x11 + push $0x12 # Int 0x2a: IRQ10 + jmp int_hwr # V86 int 0x12 + push $0x13 # Int 0x2b: IRQ11 + jmp int_hwr # V86 int 0x13 + push $0x14 # Int 0x2c: IRQ12 + jmp int_hwr # V86 int 0x14 + push $0x15 # Int 0x2d: IRQ13 + jmp int_hwr # V86 int 0x15 + push $0x16 # Int 0x2e: IRQ14 + jmp int_hwr # V86 int 0x16 + push $0x17 # Int 0x2f: IRQ15 + jmp int_hwr # V86 int 0x17 +/* + * Reflect hardware interrupts in real mode. + */ +int_hwr: push %ax # Save + push %ds # Save + push %bp # Save + mov %sp,%bp # Address stack frame + xchg %bx,6(%bp) # Swap BX, int no + xor %ax,%ax # Set %ds:%bx to + shl $2,%bx # point to + mov %ax,%ds # IDT entry + mov (%bx),%ax # Load IP + mov 2(%bx),%bx # Load CS + xchg %ax,4(%bp) # Swap saved %ax,%bx with + xchg %bx,6(%bp) # CS:IP of handler + pop %bp # Restore + pop %ds # Restore + lret # Jump to handler + .p2align 4 /* * Global descriptor table. @@ -1071,7 +992,7 @@ gdt: .word 0x0,0x0,0x0,0x0 # Null entr .word 0xffff,0x0,0x9200,0x0 # SEL_RDATA .word 0xffff,MEM_USR,0xfa00,0xcf# SEL_UCODE .word 0xffff,MEM_USR,0xf200,0xcf# SEL_UDATA - .word _TSSLM,MEM_TSS,0x8900,0x0 # SEL_TSS +tss_desc: .word _TSSLM,MEM_TSS,0x8900,0x0 # SEL_TSS gdt.1: /* * Pseudo-descriptors. @@ -1140,6 +1061,11 @@ dmpfmt: .byte '\n' # "\n" .byte 0x80|DMP_MEM|DMP_EOL,0x0 # "00 00 ... 00 00\n" .asciz "BTX halted\n" # End /* + * Bad VM86 call panic + */ +badvm86: .asciz "Invalid VM86 Request\n" + +/* * End of BTX memory. */ .p2align 4 From owner-svn-src-user@FreeBSD.ORG Sun Oct 12 11:48:22 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB64A106568B; Sun, 12 Oct 2008 11:48:21 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C85968FC1C; Sun, 12 Oct 2008 11:48:21 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9CBmLW2045286; Sun, 12 Oct 2008 11:48:21 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9CBmLCY045283; Sun, 12 Oct 2008 11:48:21 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <200810121148.m9CBmLCY045283@svn.freebsd.org> From: Takahashi Yoshihiro Date: Sun, 12 Oct 2008 11:48:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183802 - user/nyan/pc98/sys/boot/pc98/boot2 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 11:48:22 -0000 Author: nyan Date: Sun Oct 12 11:48:21 2008 New Revision: 183802 URL: http://svn.freebsd.org/changeset/base/183802 Log: Update the boot2 based on newest i386's one. Currently an output scrolling is not supported yet, since it's no enough space. Added: user/nyan/pc98/sys/boot/pc98/boot2/boot1.S (contents, props changed) user/nyan/pc98/sys/boot/pc98/boot2/boot2.c (contents, props changed) Deleted: user/nyan/pc98/sys/boot/pc98/boot2/asm.S user/nyan/pc98/sys/boot/pc98/boot2/asm.h user/nyan/pc98/sys/boot/pc98/boot2/bios.S user/nyan/pc98/sys/boot/pc98/boot2/boot.c user/nyan/pc98/sys/boot/pc98/boot2/boot.h user/nyan/pc98/sys/boot/pc98/boot2/boot2.S user/nyan/pc98/sys/boot/pc98/boot2/dinode.h user/nyan/pc98/sys/boot/pc98/boot2/disk.c user/nyan/pc98/sys/boot/pc98/boot2/fs.h user/nyan/pc98/sys/boot/pc98/boot2/inode.h user/nyan/pc98/sys/boot/pc98/boot2/io.c user/nyan/pc98/sys/boot/pc98/boot2/probe_keyboard.c user/nyan/pc98/sys/boot/pc98/boot2/quota.h user/nyan/pc98/sys/boot/pc98/boot2/serial.S user/nyan/pc98/sys/boot/pc98/boot2/serial_16550.S user/nyan/pc98/sys/boot/pc98/boot2/serial_8251.S user/nyan/pc98/sys/boot/pc98/boot2/start.S user/nyan/pc98/sys/boot/pc98/boot2/sys.c user/nyan/pc98/sys/boot/pc98/boot2/table.c Modified: user/nyan/pc98/sys/boot/pc98/boot2/Makefile Modified: user/nyan/pc98/sys/boot/pc98/boot2/Makefile ============================================================================== --- user/nyan/pc98/sys/boot/pc98/boot2/Makefile Sun Oct 12 11:39:30 2008 (r183801) +++ user/nyan/pc98/sys/boot/pc98/boot2/Makefile Sun Oct 12 11:48:21 2008 (r183802) @@ -1,113 +1,101 @@ # $FreeBSD$ -# -PROG= boot -# Order is very important on the SRCS line for this prog -SRCS= start.S table.c boot2.S boot.c asm.S bios.S serial.S -SRCS+= probe_keyboard.c io.c disk.c sys.c - -BINMODE= 444 -CFLAGS= -Os -mrtd \ - -fno-guess-branch-probability \ - -fno-unit-at-a-time \ - -D_KERNEL -DBOOTWAIT=${BOOTWAIT} -DTIMEOUT=${TIMEOUT} -CFLAGS+= -DBOOTSEG=${BOOTSEG} -DBOOTSTACK=${BOOTSTACK} -CFLAGS+= -I${.CURDIR}/../../.. -I. - -# By default, if a serial port is going to be used as console, use COM1 -# (aka /dev/ttyd0). -#BOOT_COMCONSOLE_PORT?=0x30 -BOOT_COMCONSOLE_PORT?=0x238 -BOOT_COMCONSOLE_CLK?=16 -BOOT_COMCONSOLE_MODE=0x0c -CFLAGS+= -DCOMCONSOLE=${BOOT_COMCONSOLE_PORT} \ - -DCOMCONSOLE_CLK=${BOOT_COMCONSOLE_CLK} \ - -DCOMCONSOLE_MODE=${BOOT_COMCONSOLE_MODE} - -# feature not implemented -BOOT_COMCONSOLE_SPEED?=9600 -CFLAGS+= -DCOMSPEED=${BOOT_COMCONSOLE_SPEED} - -# Enable code to take the default boot string from a fixed location on the -# disk. See nextboot(8) and README.386BSD for more info. -#CFLAGS+= -DNAMEBLOCK -#CFLAGS+= -DNAMEBLOCK_WRITEBACK - -# Bias the conversion from the BIOS drive number to the FreeBSD unit number -# for hard disks. This may be useful for people booting in a mixed IDE/SCSI -# environment (set BOOT_HD_BIAS to the number of IDE drives). -#CFLAGS+= -DBOOT_HD_BIAS=1 -# -# Details: this only applies if BOOT_HD_BIAS > 0. If the BIOS drive number -# for the boot drive is >= BOOT_HD_BIAS, then the boot drive is assumed to -# be SCSI and have unit number (BIOS_drive_number - BOOT_HD_BIAS). E.g., -# BOOT_HD_BIAS=1 makes BIOS drive 1 correspond to 1:da(0,a) instead of -# 1:wd(1,a). If `da' is given explicitly, then the drive is assumed to be -# SCSI and have BIOS drive number (da_unit_number + BOOT_HD_BIAS). E.g., -# BOOT_HD_BIAS=1 makes da(0,a) correspond to 1:da(0,a) instead of 0:da(0,a). - -CLEANFILES+= boot.nohdr boot.strip boot.ldr boot1 boot2 sizetest -LDFLAGS+= -N -Ttext 0 -e start -NO_SHARED= YES -NO_MAN= -STRIP= - -# tunable timeout parameter, waiting for keypress, calibrated in ms -BOOTWAIT?= 5000 -# tunable timeout during string input, calibrated in ms -#TIMEOUT?= 30000 - -# Location that boot2 is loaded at -BOOTSEG= 0x1000 - -# Offset in BOOTSEG for the top of the stack, keep this 16 byte aligned -BOOTSTACK= 0xFFF0 - -boot.nohdr: boot - objcopy -S -O binary boot boot.nohdr - ls -l boot.nohdr - -boot.ldr: boot.nohdr - dd if=boot.nohdr of=boot.ldr bs=8192 count=1 conv=sync - -boot1: boot.nohdr - dd if=boot.nohdr of=boot1 bs=512 count=1 - -boot2: boot.nohdr - dd if=boot.nohdr of=boot2 bs=512 skip=1 - @dd if=boot2 skip=14 of=sizetest 2> /dev/null - @if [ -s sizetest ] ; then \ - echo "boot2 is too big" >&2 ; \ - rm boot2 ; \ - exit 2 ; \ - fi - -all: boot.ldr boot1 boot2 - -install: - ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ - boot.ldr ${DESTDIR}${BINDIR}/boot - ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ - boot1 boot2 ${DESTDIR}${BINDIR} - -# If it's not there, don't consider it a target -.if exists(${.CURDIR}/../../../pc98/include) -beforedepend ${OBJS}: machine - -machine: - ln -sf ${.CURDIR}/../../../pc98/include machine - -.endif - -.if exists(${.CURDIR}/../../../i386/include) -beforedepend ${OBJS}: i386 +FILES= boot boot1 boot2 -i386: - ln -sf ${.CURDIR}/../../../i386/include i386 +NM?= nm -.endif +BOOT_COMCONSOLE_PORT?= 0x238 +BOOT_COMCONSOLE_SPEED?= 9600 +B2SIOFMT?= 0x3 + +REL1= 0x700 +ORG1= 0 +ORG2= 0x2000 + +# Decide level of UFS support. +BOOT2_UFS?= UFS1_AND_UFS2 +#BOOT2_UFS?= UFS2_ONLY +#BOOT2_UFS?= UFS1_ONLY + +CFLAGS= -Os \ + -fno-guess-branch-probability \ + -fomit-frame-pointer \ + -fno-unit-at-a-time \ + -mno-align-long-strings \ + -mrtd \ + -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 \ + -D${BOOT2_UFS} \ + -DFLAGS=${BOOT_BOOT1_FLAGS} \ + -DSIOPRT=${BOOT_COMCONSOLE_PORT} \ + -DSIOFMT=${B2SIOFMT} \ + -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \ + -I${.CURDIR}/../../.. \ + -I${.CURDIR}/../../i386/boot2 \ + -I${.CURDIR}/../../common \ + -I${.CURDIR}/../btx/lib -I. \ + -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \ + -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ + -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ + -Winline --param max-inline-insns-single=100 + +# Initialize the bi_bios_geom using the BIOS geometry +#CFLAGS+= -DGET_BIOSGEOM + +LDFLAGS=-static -N --gc-sections + +# Pick up ../Makefile.inc early. +.include + +.PATH: ${.CURDIR}/../../i386/boot2 + +CLEANFILES= boot + +boot: boot1 boot2 + cat boot1 boot2 > boot + +CLEANFILES+= boot1 boot1.out boot1.o + +boot1: boot1.out + objcopy -S -O binary boot1.out ${.TARGET} + +boot1.out: boot1.o + ${LD} ${LDFLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o + +CLEANFILES+= boot2 boot2.ld boot2.ldr boot2.bin boot2.out boot2.o \ + boot2.s boot2.s.tmp boot2.h sio.o + +boot2: boot2.ld + @set -- `ls -l boot2.ld`; x=$$((7680-$$5)); \ + echo "$$x bytes available"; test $$x -ge 0 + dd if=boot2.ld of=${.TARGET} obs=7680 conv=osync + +boot2.ld: boot2.ldr boot2.bin ${BTXKERN} + btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l boot2.ldr \ + -o ${.TARGET} -P 1 boot2.bin + +boot2.ldr: + dd if=/dev/zero of=${.TARGET} bs=276 count=1 + +boot2.bin: boot2.out + objcopy -S -O binary boot2.out ${.TARGET} + +boot2.out: ${BTXCRT} boot2.o sio.o + ${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} + +boot2.o: boot2.s + +SRCS= boot2.c boot2.h + +boot2.s: boot2.c boot2.h ${.CURDIR}/../../common/ufsread.c + ${CC} ${CFLAGS} -S -o boot2.s.tmp ${.CURDIR}/boot2.c + sed -e '/align/d' -e '/nop/d' < boot2.s.tmp > boot2.s + rm -f boot2.s.tmp + +boot2.h: boot1.out + ${NM} -t d ${.ALLSRC} | awk '/([0-9])+ T putc/ \ + { x = $$1 - ORG1; \ + printf("#define PUTCORG %#x\n", REL1 + x) }' \ + ORG1=`printf "%d" ${ORG1}` \ + REL1=`printf "%d" ${REL1}` > ${.TARGET} -CLEANFILES+= machine i386 - -CWARNFLAGS!= ${MAKE} -f bsd.own.mk -f ${.CURDIR}/../../../conf/kern.mk -V CWARNFLAGS .include Added: user/nyan/pc98/sys/boot/pc98/boot2/boot1.S ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/nyan/pc98/sys/boot/pc98/boot2/boot1.S Sun Oct 12 11:48:21 2008 (r183802) @@ -0,0 +1,330 @@ +/*- + * Copyright (c) 2008 TAKAHASHI Yoshihiro + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * $FreeBSD$ + */ + +/* Memory Locations */ + .set STACK_OFF,0x6000 # Stack offset + .set LOAD_SIZE,8192 # Load size + .set DAUA,0x0584 # DA/UA + .set MEM_REL,0x700 # Relocation address + .set MEM_ARG,0x900 # Arguments + .set MEM_BUF,0x8cec # Load area + .set MEM_BTX,0x9000 # BTX start + .set MEM_JMP,0x9010 # BTX entry point + .set MEM_USR,0xa000 # Client start + +/* PC98 machine type from sys/pc98/pc98/pc98_machdep.h */ + .set MEM_SYS, 0xa100 # System common area segment + .set PC98_MACHINE_TYPE, 0x0620 # PC98 machine type + .set EPSON_ID, 0x0624 # EPSON machine id + + .set M_NEC_PC98, 0x0001 + .set M_EPSON_PC98, 0x0002 + .set M_NOT_H98, 0x0010 + .set M_H98, 0x0020 + .set M_NOTE, 0x0040 + .set M_NORMAL, 0x1000 + .set M_8M, 0x8000 + +/* Partition Constants */ + .set PRT_OFF,0x1be # Partition offset + +/* Misc. Constants */ + .set SIZ_PAG,0x1000 # Page size + .set SIZ_SEC,0x200 # Sector size + + .set NSECT,0x10 + + .globl start + .globl putc + .code16 + +start: jmp main + +boot_cyl: .org 4 + .ascii "IPL1 " + +main: cld + + /* Setup the stack */ + xor %si,%si + mov %si,%ss + mov $STACK_OFF,%sp + + push %cx + + /* Relocate ourself to MEM_REL */ + push %cs + pop %ds + mov %si,%es + mov $MEM_REL,%di + mov $SIZ_SEC,%cx + rep + movsb + + /* Transfer PC-9801 system common area */ + xor %ax,%ax + mov %ax,%si + mov %ax,%ds + mov %ax,%di + mov $MEM_SYS,%ax + mov %ax,%es + mov $0x0600,%cx + rep + movsb + + /* Transfer EPSON machine type */ + mov $0xfd00,%ax + mov %ax,%ds + mov (0x804),%eax + and $0x00ffffff,%eax + mov %eax,%es:(EPSON_ID) + + /* Set machine type to PC98_SYSTEM_PARAMETER */ + call machine_check + + /* Setup graphic screen */ + mov $0x42,%ah /* 640x400 */ + mov $0xc0,%ch + int $0x18 + mov $0x40,%ah /* graph on */ + int $0x18 + + /* Setup text screen */ + mov $0x0a00,%ax /* 80x25 */ + int $0x18 + mov $0x0c,%ah /* text on */ + int $0x18 + mov $0x13,%ah /* cursor home */ + xor %dx,%dx + int $0x18 + mov $0x11,%ah /* cursor on */ + int $0x18 + + /* Setup keyboard */ + mov $0x03,%ah + int $0x18 + + pop %cx + + /* bootstrap passes */ + xor %ax,%ax + mov %ax,%ds + mov %ax,%es + mov %cs,%bx + cmp $0x1fe0,%bx + jz boot_fd + cmp $0x1fc0,%bx + jnz boot_hd + xor %cx,%cx + mov (DAUA),%al + and $0xf0,%al + cmp $0x30,%al + jz boot_fd + cmp $0x90,%al + jnz boot_hd +boot_fd: mov $0xd6,%ah /* read data */ + mov $0x0200,%cx + mov $0x0001,%dx + jmp boot_load +boot_hd: test %cx,%cx + jnz boot_hd.1 + mov %cs:(boot_cyl),%cx +boot_hd.1: mov $0x06,%ah /* read data */ + xor %dx,%dx +boot_load: mov %cx,MEM_ARG /* Save cylinder number */ + mov (DAUA),%al + mov $LOAD_SIZE,%bx + mov $MEM_BUF,%bp + int $0x1b + jc error + + /* Transfer boot2.bin */ + mov $MEM_BTX,%bx + mov 0xa(%bx),%si /* BTX size */ + add %bx,%si /* start of boot2.bin */ + mov $MEM_USR+SIZ_PAG*2,%di + mov $MEM_BTX+(NSECT-1)*SIZ_SEC,%cx + sub %si,%cx + rep + movsb + + /* Enable A20 */ + xor %ax,%ax + outb %al,$0xf2 + mov $0x02,%al + outb %al,$0xf6 + + /* Start BTX */ + ljmp $0x0000,$MEM_JMP + +/* + * Print out the error message, wait for a keypress, and then reboot + * the machine. + */ +error: push %cs + pop %ds + mov $msg_eread,%si + call putstr + xor %ax,%ax /* Get keypress */ + int $0x18 + xor %ax,%ax /* CPU reset */ + outb %al,$0xf0 +halt: hlt + jmp halt /* Spin */ + +/* + * Display a null-terminated string. + */ +putstr.0: push %cs + callw putc +putstr: lodsb + test %al,%al + jne putstr.0 + ret + +/* + * Display a single char. + */ +putc: push %ds + xor %dx,%dx + mov %dx,%ds + mov MEM_REL+cursor-start,%di + mov $160,%cx + cmp $0x08,%al + je putc.bs + cmp $0x0d,%al + je putc.cr + cmp $0x0a,%al + je putc.lf + cmp $0x5c,%al /* \ */ + jne 1f + mov $0xfc,%al +1: mov $0xa000,%bx + mov %bx,%es + mov $0xe1,%bl + mov %bl,%es:0x2000(%di) /* Attribute */ + stosb + inc %di + jmp putc.move +putc.bs: test %di,%di + jz putc.move + dec %di + dec %di + jmp putc.move +putc.cr: /* xor %dx,%dx */ + mov %di,%ax + div %cx + sub %dx,%di + jmp putc.move +putc.lf: add %cx,%di +putc.move: mov %di,MEM_REL+cursor-start /* Move cursor */ + mov $0x13,%ah + mov %di,%dx + int $0x18 + pop %ds + lret + +cursor: .word 0 + +/* + * Set machine type to PC98_SYSTEM_PARAMETER. + */ +machine_check: xor %edx,%edx + mov %dx,%ds +# mov $MEM_SYS,%ax +# mov %ax,%es + + /* Wait V-SYNC */ +vsync.1: inb $0x60,%al + test $0x20,%al + jnz vsync.1 +vsync.2: inb $0x60,%al + test $0x20,%al + jz vsync.2 + + /* ANK 'A' font */ + xor %al,%al + outb %al,$0xa1 + mov $0x41,%al + outb %al,$0xa3 + + /* Get 'A' font from CG window */ + push %ds + mov $0xa400,%ax + mov %ax,%ds + xor %eax,%eax + xor %bx,%bx + mov $4,%cx +font.1: add (%bx),%eax + add $4,%bx + loop font.1 + pop %ds + cmp $0x6efc58fc,%eax + jnz m_epson + +m_pc98: or $M_NEC_PC98,%edx + mov $0x0458,%bx + mov (%bx),%al + test $0x80,%al + jz m_not_h98 + or $M_H98,%edx + jmp 1f +m_epson: or $M_EPSON_PC98,%edx +m_not_h98: or $M_NOT_H98,%edx + +1: inb $0x42,%al + test $0x20,%al + jz 1f + or $M_8M,%edx + +1: mov $0x0400,%bx + mov (%bx),%al + test $0x80,%al + jz 1f + or $M_NOTE,%edx + +1: mov $PC98_MACHINE_TYPE,%bx + mov %edx,%es:(%bx) + + ret + +/* Messages */ + +msg_eread: .asciz "Error\r\n" + + .org PRT_OFF,0x90 + +/* Partition table */ + + .fill 0x30,0x1,0x0 + .byte 0x80, 0x00, 0x01, 0x00 + .byte 0xa5, 0xff, 0xff, 0xff + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x50, 0xc3, 0x00, 0x00 + + .word 0xaa55 # Magic number Added: user/nyan/pc98/sys/boot/pc98/boot2/boot2.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/nyan/pc98/sys/boot/pc98/boot2/boot2.c Sun Oct 12 11:48:21 2008 (r183802) @@ -0,0 +1,814 @@ +/*- + * Copyright (c) 2008 TAKAHASHI Yoshihiro + * Copyright (c) 1998 Robert Nordier + * All rights reserved. + * + * Redistribution and use in source and binary forms are freely + * permitted provided that the above copyright notice and this + * paragraph and the following disclaimer are duplicated in all + * such forms. + * + * This software is provided "AS IS" and without any express or + * implied warranties, including, without limitation, the implied + * warranties of merchantability and fitness for a particular + * purpose. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include + +#include + +#include + +#include "boot2.h" +#include "lib.h" + +#define IO_KEYBOARD 1 +#define IO_SERIAL 2 + +#define SECOND 1 /* Circa that many ticks in a second. */ + +#define RBX_ASKNAME 0x0 /* -a */ +#define RBX_SINGLE 0x1 /* -s */ +/* 0x2 is reserved for log2(RB_NOSYNC). */ +/* 0x3 is reserved for log2(RB_HALT). */ +/* 0x4 is reserved for log2(RB_INITNAME). */ +#define RBX_DFLTROOT 0x5 /* -r */ +#define RBX_KDB 0x6 /* -d */ +/* 0x7 is reserved for log2(RB_RDONLY). */ +/* 0x8 is reserved for log2(RB_DUMP). */ +/* 0x9 is reserved for log2(RB_MINIROOT). */ +#define RBX_CONFIG 0xa /* -c */ +#define RBX_VERBOSE 0xb /* -v */ +#define RBX_SERIAL 0xc /* -h */ +#define RBX_CDROM 0xd /* -C */ +/* 0xe is reserved for log2(RB_POWEROFF). */ +#define RBX_GDB 0xf /* -g */ +#define RBX_MUTE 0x10 /* -m */ +/* 0x11 is reserved for log2(RB_SELFTEST). */ +/* 0x12 is reserved for boot programs. */ +/* 0x13 is reserved for boot programs. */ +#define RBX_PAUSE 0x14 /* -p */ +#define RBX_QUIET 0x15 /* -q */ +#define RBX_NOINTR 0x1c /* -n */ +/* 0x1d is reserved for log2(RB_MULTIPLE) and is just misnamed here. */ +#define RBX_DUAL 0x1d /* -D */ +/* 0x1f is reserved for log2(RB_BOOTINFO). */ + +/* pass: -a, -s, -r, -d, -c, -v, -h, -C, -g, -m, -p, -D */ +#define RBX_MASK (OPT_SET(RBX_ASKNAME) | OPT_SET(RBX_SINGLE) | \ + OPT_SET(RBX_DFLTROOT) | OPT_SET(RBX_KDB ) | \ + OPT_SET(RBX_CONFIG) | OPT_SET(RBX_VERBOSE) | \ + OPT_SET(RBX_SERIAL) | OPT_SET(RBX_CDROM) | \ + OPT_SET(RBX_GDB ) | OPT_SET(RBX_MUTE) | \ + OPT_SET(RBX_PAUSE) | OPT_SET(RBX_DUAL)) + +#define PATH_CONFIG "/boot.config" +#define PATH_BOOT3 "/boot/loader" +#define PATH_KERNEL "/boot/kernel/kernel" + +#define ARGS 0x900 +#define NOPT 14 +#define NDEV 3 +#define V86_CY(x) ((x) & PSL_C) +#define V86_ZR(x) ((x) & PSL_Z) + +#define DRV_DISK 0xf0 +#define DRV_UNIT 0x0f + +#define TYPE_AD 0 +#define TYPE_DA 1 +#define TYPE_FD 2 + +#define OPT_SET(opt) (1 << (opt)) +#define OPT_CHECK(opt) ((opts) & OPT_SET(opt)) + +extern uint32_t _end; + +static const char optstr[NOPT] = "DhaCcdgmnpqrsv"; /* Also 'P', 'S' */ +static const unsigned char flags[NOPT] = { + RBX_DUAL, + RBX_SERIAL, + RBX_ASKNAME, + RBX_CDROM, + RBX_CONFIG, + RBX_KDB, + RBX_GDB, + RBX_MUTE, + RBX_NOINTR, + RBX_PAUSE, + RBX_QUIET, + RBX_DFLTROOT, + RBX_SINGLE, + RBX_VERBOSE +}; + +static const char *const dev_nm[NDEV] = {"ad", "da", "fd"}; +static const unsigned char dev_maj[NDEV] = {30, 4, 2}; +static const unsigned char dev_daua[NDEV] = {0x80, 0xa0, 0x90}; + +static struct dsk { + unsigned daua; + unsigned type; + unsigned disk; + unsigned unit; + unsigned head; + unsigned sec; + unsigned slice; + unsigned part; + unsigned start; +} dsk; +static char cmd[512], cmddup[512]; +static char kname[1024]; +static uint32_t opts; +static int comspeed = SIOSPD; +static struct bootinfo bootinfo; +static uint8_t ioctrl = IO_KEYBOARD; + +void exit(int); +static void load(void); +static int parse(void); +static int xfsread(ino_t, void *, size_t); +static int dskread(void *, unsigned, unsigned); +static void printf(const char *,...); +static void putchar(int); +static uint32_t memsize(void); +static int drvread(void *, unsigned, unsigned); +static int keyhit(unsigned); +static int xputc(int); +static int xgetc(int); +static int getc(int); + +static void memcpy(void *, const void *, int); +static void +memcpy(void *dst, const void *src, int len) +{ + const char *s = src; + char *d = dst; + + while (len--) + *d++ = *s++; +} + +static inline int +strcmp(const char *s1, const char *s2) +{ + for (; *s1 == *s2 && *s1; s1++, s2++); + return (unsigned char)*s1 - (unsigned char)*s2; +} + +#define UFS_SMALL_CGBASE +#include "ufsread.c" + +static inline int +xfsread(ino_t inode, void *buf, size_t nbyte) +{ + if ((size_t)fsread(inode, buf, nbyte) != nbyte) { + printf("Invalid %s\n", "format"); + return -1; + } + return 0; +} + +static inline uint32_t +memsize(void) +{ + u_char *p = (u_char *)PTOV(0); + + return *(p + 0x401) * 128 * 1024 + *(u_int16_t *)(p + 0x594) * 1024 * 1024; +} + +static inline void +getstr(void) +{ + char *s; + int c; + + s = cmd; + for (;;) { + switch (c = xgetc(0)) { + case 0: + break; + case '\177': + case '\b': + if (s > cmd) { + s--; + printf("\b \b"); + } + break; + case '\n': + case '\r': + *s = 0; + return; + default: + if (s - cmd < sizeof(cmd) - 1) + *s++ = c; + putchar(c); + } + } +} + +static inline void +putc(int c) +{ + + v86.ctl = V86_ADDR | V86_CALLF | V86_FLAGS; + v86.addr = PUTCORG; /* call to putc in boot1 */ + v86.eax = c; + v86int(); + v86.ctl = V86_FLAGS; +} + +static int +is_scsi_hd(void) +{ + + if ((*(u_char *)PTOV(0x482) >> dsk.unit) & 0x01) + return 1; + + return 0; +} + +static inline void +fix_sector_size(void) +{ + u_char *p = (u_char *)PTOV(0x460 + dsk.unit * 4); + + if ((p[0] & 0x1f) == 7) { /* SCSI MO */ + if (!(p[3] & 0x30)) { /* 256B / sector */ + p[3] |= 0x10; /* forced set 512B / sector */ + p[3 + 0xa1000] |= 0x10; + } + } +} + +static uint32_t +get_diskinfo(void) +{ + + if (dsk.disk == 0x30) { /* 1440KB FD */ + /* 80 cylinders, 2 heads, 18 sectors */ + return (80 << 16) | (2 << 8) | 18; + } else if (dsk.disk == 0x90) { /* 1200KB FD */ + /* 80 cylinders, 2 heads, 15 sectors */ + return (80 << 16) | (2 << 8) | 15; + } else if (dsk.disk == 0x80 || is_scsi_hd()) { /* IDE or SCSI HDD */ + v86.addr = 0x1b; + v86.eax = 0x8400 | dsk.daua; + v86int(); + return (v86.ecx << 16) | v86.edx; + } + + /* other SCSI devices */ + return (65535 << 16) | (8 << 8) | 32; +} + +#ifdef GET_BIOSGEOM +static uint32_t +bd_getbigeom(int bunit) +{ + int hds = 0; + int unit = 0x80; /* IDE HDD */ + u_int addr = 0x55d; + + while (unit < 0xa7) { + if (*(u_char *)PTOV(addr) & (1 << (unit & 0x0f))) + if (hds++ == bunit) + break; + + if (unit >= 0xA0) { + int media = ((unsigned *)PTOV(0x460))[unit & 0x0F] & 0x1F; + + if (media == 7 && hds++ == bunit) /* SCSI MO */ + return(0xFFFE0820); /* C:65535 H:8 S:32 */ + } + if (++unit == 0x84) { + unit = 0xA0; /* SCSI HDD */ + addr = 0x482; + } + } + if (unit == 0xa7) + return 0x4F020F; /* 1200KB FD C:80 H:2 S:15 */ + v86.addr = 0x1b; + v86.eax = 0x8400 | unit; + v86int(); + if (v86.efl & 0x1) + return 0x4F020F; /* 1200KB FD C:80 H:2 S:15 */ + return ((v86.ecx & 0xffff) << 16) | (v86.edx & 0xffff); +} +#endif + +int +main(void) +{ +#ifdef GET_BIOSGEOM + int i; +#endif + int autoboot; + ino_t ino; + + dmadat = (void *)(roundup2(__base + (int32_t)&_end, 0x10000) - __base); + v86.ctl = V86_FLAGS; + v86.efl = PSL_RESERVED_DEFAULT | PSL_I; + dsk.daua = *(uint8_t *)PTOV(0x584); + dsk.disk = dsk.daua & DRV_DISK; + dsk.unit = dsk.daua & DRV_UNIT; + if (dsk.disk == 0x80) + dsk.type = TYPE_AD; + else if (dsk.disk == 0xa0) + dsk.type = TYPE_DA; + else /* if (dsk.disk == 0x30 || dsk.disk == 0x90) */ + dsk.type = TYPE_FD; + dsk.slice = WHOLE_DISK_SLICE; /* XXX */ +#ifdef GET_BIOSGEOM + for (i = 0; i < N_BIOS_GEOM; i++) + bootinfo.bi_bios_geom[i] = bd_getbigeom(i); +#endif + bootinfo.bi_version = BOOTINFO_VERSION; + bootinfo.bi_size = sizeof(bootinfo); + bootinfo.bi_basemem = 0; /* XXX will be filled by loader or kernel */ + bootinfo.bi_extmem = memsize(); + bootinfo.bi_memsizes_valid++; + + /* Process configuration file */ + + autoboot = 1; + + if ((ino = lookup(PATH_CONFIG))) + fsread(ino, cmd, sizeof(cmd)); + + if (*cmd) { + memcpy(cmddup, cmd, sizeof(cmd)); + if (parse()) + autoboot = 0; + if (!OPT_CHECK(RBX_QUIET)) + printf("%s: %s", PATH_CONFIG, cmddup); + /* Do not process this command twice */ + *cmd = 0; + } + + /* + * Try to exec stage 3 boot loader. If interrupted by a keypress, + * or in case of failure, try to load a kernel directly instead. + */ + + if (autoboot && !*kname) { + memcpy(kname, PATH_BOOT3, sizeof(PATH_BOOT3)); + if (!keyhit(3*SECOND)) { + load(); + memcpy(kname, PATH_KERNEL, sizeof(PATH_KERNEL)); + } + } + + /* Present the user with the boot2 prompt. */ + + for (;;) { + if (!autoboot || !OPT_CHECK(RBX_QUIET)) + printf("\nFreeBSD/pc98 boot\n" + "Default: %u:%s(%u,%c)%s\n" + "boot: ", + dsk.unit, dev_nm[dsk.type], dsk.unit, + 'a' + dsk.part, kname); + if (ioctrl & IO_SERIAL) + sio_flush(); + if (!autoboot || keyhit(5*SECOND)) + getstr(); + else if (!autoboot || !OPT_CHECK(RBX_QUIET)) + putchar('\n'); + autoboot = 0; + if (parse()) + putchar('\a'); + else + load(); + } +} + +/* XXX - Needed for btxld to link the boot2 binary; do not remove. */ +void +exit(int x) +{ +} + +static void +load(void) +{ + union { + struct exec ex; + Elf32_Ehdr eh; + } hdr; + static Elf32_Phdr ep[2]; + static Elf32_Shdr es[2]; + caddr_t p; + ino_t ino; + uint32_t addr, x; + int fmt, i, j; + + if (!(ino = lookup(kname))) { + if (!ls) + printf("No %s\n", kname); + return; + } + if (xfsread(ino, &hdr, sizeof(hdr))) + return; + if (N_GETMAGIC(hdr.ex) == ZMAGIC) + fmt = 0; + else if (IS_ELF(hdr.eh)) + fmt = 1; + else { + printf("Invalid %s\n", "format"); + return; + } + if (fmt == 0) { + addr = hdr.ex.a_entry & 0xffffff; + p = PTOV(addr); + fs_off = PAGE_SIZE; + if (xfsread(ino, p, hdr.ex.a_text)) + return; + p += roundup2(hdr.ex.a_text, PAGE_SIZE); + if (xfsread(ino, p, hdr.ex.a_data)) + return; + p += hdr.ex.a_data + roundup2(hdr.ex.a_bss, PAGE_SIZE); + bootinfo.bi_symtab = VTOP(p); + memcpy(p, &hdr.ex.a_syms, sizeof(hdr.ex.a_syms)); + p += sizeof(hdr.ex.a_syms); + if (hdr.ex.a_syms) { + if (xfsread(ino, p, hdr.ex.a_syms)) + return; + p += hdr.ex.a_syms; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Sun Oct 12 11:58:40 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E9C210656A6; Sun, 12 Oct 2008 11:58:40 +0000 (UTC) (envelope-from edwin@mavetju.org) Received: from k7.mavetju.org (ppp121-44-40-21.lns10.syd7.internode.on.net [121.44.40.21]) by mx1.freebsd.org (Postfix) with ESMTP id 1B32B8FC08; Sun, 12 Oct 2008 11:58:40 +0000 (UTC) (envelope-from edwin@mavetju.org) Received: by k7.mavetju.org (Postfix, from userid 1001) id D7D9445039; Sun, 12 Oct 2008 21:34:22 +1100 (EST) Date: Sun, 12 Oct 2008 21:34:22 +1100 From: Edwin Groothuis To: Stanislav Sedov Message-ID: <20081012103422.GA71466@mavetju.org> References: <200810120915.m9C9F5tq040143@svn.freebsd.org> <20081012142454.607c861d.stas@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20081012142454.607c861d.stas@FreeBSD.org> User-Agent: Mutt/1.4.2.3i Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r183781 - in user/edwin/top/top-3.8b1: contrib/top usr.bin/top X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 11:58:40 -0000 On Sun, Oct 12, 2008 at 02:24:54PM +0400, Stanislav Sedov wrote: > On Sun, 12 Oct 2008 09:15:05 +0000 (UTC) > Edwin Groothuis mentioned: > > > Author: edwin > > Date: Sun Oct 12 09:15:05 2008 > > New Revision: 183781 > > URL: http://svn.freebsd.org/changeset/base/183781 > > > > Log: > > All collected changes to with regarding to the feedback received > > on the announcement of top 3.8b1 on -stable and -current as version > > B. > > > > This is considered the final version and submitted to mentor (bde@) > > for commit approval. > > What happened to my request of preserving -a option? Taken in consideration, as promised on #thatchannel. I still think that compatibility with the original program and thus other OS's on which top runs, either out of the box or via the original tar-ball of the author, is more important than the compatibility between FreeBSD versions for FreeBSD specific features. Edwin -- Edwin Groothuis Website: http://www.mavetju.org/ edwin@mavetju.org Weblog: http://www.mavetju.org/weblog/ From owner-svn-src-user@FreeBSD.ORG Sun Oct 12 12:08:10 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E415A106568F; Sun, 12 Oct 2008 12:08:09 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D1C7B8FC17; Sun, 12 Oct 2008 12:08:09 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9CC89w2045678; Sun, 12 Oct 2008 12:08:09 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9CC89nR045674; Sun, 12 Oct 2008 12:08:09 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <200810121208.m9CC89nR045674@svn.freebsd.org> From: Takahashi Yoshihiro Date: Sun, 12 Oct 2008 12:08:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183803 - in user/nyan/pc98/sys: conf geom/part pc98/conf X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 12:08:10 -0000 Author: nyan Date: Sun Oct 12 12:08:09 2008 New Revision: 183803 URL: http://svn.freebsd.org/changeset/base/183803 Log: Fix to probe pc98 disk and switch to gpart in DEFAULTS. Modified: user/nyan/pc98/sys/conf/files user/nyan/pc98/sys/geom/part/g_part_bsd.c user/nyan/pc98/sys/geom/part/g_part_pc98.c user/nyan/pc98/sys/pc98/conf/DEFAULTS Modified: user/nyan/pc98/sys/conf/files ============================================================================== --- user/nyan/pc98/sys/conf/files Sun Oct 12 11:48:21 2008 (r183802) +++ user/nyan/pc98/sys/conf/files Sun Oct 12 12:08:09 2008 (r183803) @@ -1504,7 +1504,7 @@ geom/geom_kern.c standard geom/geom_mbr.c optional geom_mbr geom/geom_mbr_enc.c optional geom_mbr geom/geom_pc98.c optional geom_pc98 -geom/geom_pc98_enc.c optional geom_pc98 +geom/geom_pc98_enc.c optional geom_pc98 | geom_part_pc98 geom/geom_slice.c standard geom/geom_subr.c standard geom/geom_sunlabel.c optional geom_sunlabel Modified: user/nyan/pc98/sys/geom/part/g_part_bsd.c ============================================================================== --- user/nyan/pc98/sys/geom/part/g_part_bsd.c Sun Oct 12 11:48:21 2008 (r183802) +++ user/nyan/pc98/sys/geom/part/g_part_bsd.c Sun Oct 12 12:08:09 2008 (r183803) @@ -341,8 +341,10 @@ g_part_bsd_read(struct g_part_table *bas printf("GEOM: %s: geometry does not match label.\n", pp->name); chs = le32dec(buf + 60); +#if 0 if (chs < 1 || chs > msize) goto invalid_label; +#endif if (chs != msize) printf("GEOM: %s: media size does not match label.\n", pp->name); Modified: user/nyan/pc98/sys/geom/part/g_part_pc98.c ============================================================================== --- user/nyan/pc98/sys/geom/part/g_part_pc98.c Sun Oct 12 11:48:21 2008 (r183802) +++ user/nyan/pc98/sys/geom/part/g_part_pc98.c Sun Oct 12 12:08:09 2008 (r183803) @@ -260,6 +260,8 @@ g_part_pc98_dumpconf(struct g_part_table /* confxml: partition entry information */ sbuf_printf(sb, "%s\n", indent, name); sbuf_printf(sb, "%s%u\n", indent, type); + if (entry->ent.dp_sid & 0x80) + sbuf_printf(sb, "%sactive\n", indent); } return (0); } @@ -304,6 +306,7 @@ static int g_part_pc98_probe(struct g_part_table *table, struct g_consumer *cp) { struct g_provider *pp; + struct pc98_partition dp; u_char *buf, *p; int error, index, res, sum; uint16_t magic; @@ -338,11 +341,14 @@ g_part_pc98_probe(struct g_part_table *t for (index = 0; index < NDOSPART; index++) { p = buf + SECSIZE + index * DOSPARTSIZE; - if (p[2] != 0 || p[3] != 0) - goto out; - if (p[1] == 0) + pc98_partition_dec(p, &dp); + if (dp.dp_mid == 0 || dp.dp_sid == 0) continue; - if (le16dec(p + 10) == 0) + if (dp.dp_ssect == dp.dp_esect && + dp.dp_shd == dp.dp_ehd && + dp.dp_scyl == dp.dp_ecyl) + goto out; + if (dp.dp_scyl == 0 || dp.dp_ecyl == 0) goto out; } @@ -381,20 +387,7 @@ g_part_pc98_read(struct g_part_table *ba for (index = NDOSPART - 1; index >= 0; index--) { p = buf + SECSIZE + index * DOSPARTSIZE; - ent.dp_mid = p[0]; - ent.dp_sid = p[1]; - ent.dp_dum1 = p[2]; - ent.dp_dum2 = p[3]; - ent.dp_ipl_sct = p[4]; - ent.dp_ipl_head = p[5]; - ent.dp_ipl_cyl = le16dec(p + 6); - ent.dp_ssect = p[8]; - ent.dp_shd = p[9]; - ent.dp_scyl = le16dec(p + 10); - ent.dp_esect = p[12]; - ent.dp_ehd = p[13]; - ent.dp_ecyl = le16dec(p + 14); - bcopy(p + 16, ent.dp_name, sizeof(ent.dp_name)); + pc98_partition_dec(p, &ent); if (ent.dp_sid == 0) continue; @@ -442,23 +435,9 @@ g_part_pc98_write(struct g_part_table *b p = table->table + (index - 1) * DOSPARTSIZE; entry = (baseentry != NULL && index == baseentry->gpe_index) ? (struct g_part_pc98_entry *)baseentry : NULL; - if (entry != NULL && !baseentry->gpe_deleted) { - p[0] = entry->ent.dp_mid; - p[1] = entry->ent.dp_sid; - p[2] = entry->ent.dp_dum1; - p[3] = entry->ent.dp_dum2; - p[4] = entry->ent.dp_ipl_sct; - p[5] = entry->ent.dp_ipl_head; - le16enc(p + 6, entry->ent.dp_ipl_cyl); - p[8] = entry->ent.dp_ssect; - p[9] = entry->ent.dp_shd; - le16enc(p + 10, entry->ent.dp_scyl); - p[12] = entry->ent.dp_esect; - p[13] = entry->ent.dp_ehd; - le16enc(p + 14, entry->ent.dp_ecyl); - bcopy(entry->ent.dp_name, p + 16, - sizeof(entry->ent.dp_name)); - } else + if (entry != NULL && !baseentry->gpe_deleted) + pc98_partition_enc(p, &entry->ent); + else bzero(p, DOSPARTSIZE); if (entry != NULL) Modified: user/nyan/pc98/sys/pc98/conf/DEFAULTS ============================================================================== --- user/nyan/pc98/sys/pc98/conf/DEFAULTS Sun Oct 12 11:48:21 2008 (r183802) +++ user/nyan/pc98/sys/pc98/conf/DEFAULTS Sun Oct 12 12:08:09 2008 (r183803) @@ -22,5 +22,7 @@ device uart_ns8250 #device uart_i8251 # Default partitioning schemes -options GEOM_BSD -options GEOM_PC98 +#options GEOM_BSD +#options GEOM_PC98 +options GEOM_PART_BSD +options GEOM_PART_PC98 From owner-svn-src-user@FreeBSD.ORG Sun Oct 12 22:01:26 2008 Return-Path: Delivered-To: svn-src-user@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 443971065693; Sun, 12 Oct 2008 22:01:26 +0000 (UTC) (envelope-from gad@FreeBSD.org) Received: from smtp5.server.rpi.edu (smtp5.server.rpi.edu [128.113.2.225]) by mx1.freebsd.org (Postfix) with ESMTP id 065318FC18; Sun, 12 Oct 2008 22:01:25 +0000 (UTC) (envelope-from gad@FreeBSD.org) Received: from [128.113.24.47] (gilead.netel.rpi.edu [128.113.24.47]) by smtp5.server.rpi.edu (8.13.1/8.13.1) with ESMTP id m9CKuUB7031846; Sun, 12 Oct 2008 16:56:31 -0400 Mime-Version: 1.0 Message-Id: In-Reply-To: <20081012103422.GA71466@mavetju.org> References: <200810120915.m9C9F5tq040143@svn.freebsd.org> <20081012142454.607c861d.stas@FreeBSD.org> <20081012103422.GA71466@mavetju.org> Date: Sun, 12 Oct 2008 16:56:29 -0400 To: Edwin Groothuis , Stanislav Sedov , Bruce Evans From: Garance A Drosehn Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-Bayes-Prob: 0.0001 (Score 0) X-RPI-SA-Score: 0.10 () [Hold at 20.00] COMBINED_FROM X-CanItPRO-Stream: outgoing X-Canit-Stats-ID: Bayes signature not available X-Scanned-By: CanIt (www . roaringpenguin . com) on 128.113.2.225 Cc: src-committers@FreeBSD.org, svn-src-user@FreeBSD.org Subject: Re: svn commit: r183781 - in user/edwin/top/top-3.8b1: contrib/top usr.bin/top X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 22:01:26 -0000 At 9:34 PM +1100 10/12/08, Edwin Groothuis wrote: >On Sun, Oct 12, 2008, Stanislav Sedov wrote: > > > URL: http://svn.freebsd.org/changeset/base/183781 >> > >> > Log: > > > All collected changes to with regarding to the feedback > > > received on the announcement of top 3.8b1 on -stable and > > > -current as version B. > > > > > > This is considered the final version and submitted to mentor > > > (bde@) for commit approval. > > >> What happened to my request of preserving -a option? > >Taken in consideration, as promised on #thatchannel. > >I still think that compatibility with the original program and thus >other OS's on which top runs, either out of the box or via the >original tar-ball of the author, is more important than the >compatibility between FreeBSD versions for FreeBSD specific features. Hmm, I didn't realize there were plans to change the -a option. The ability itself is useful, although I don't feel strongly that it needs to be on the -a option. This is the kind of option that I forget about until I actually need it for something. Does this new 'top' have some other option which does: Display command names derived from the argv[] vector, rather than real executable name. It's useful when you want to watch applications, that puts their status information there. If the real name differs from argv[0], it will be displayed in parenthesis. (hmm, that second sentence is not worded quite right, but that's what our man page says!) Apologies if it does and I'm just missing it. Also, if this version of 'top' is going to change the meaning of some options compared to previous versions of 'top' on FreeBSD, then I think it would be helpful for the man page to include some short historical footnote of that change. -- Garance Alistair Drosehn = drosehn@rpi.edu Senior Systems Programmer or gad@FreeBSD.org Rensselaer Polytechnic Institute; Troy, NY; USA From owner-svn-src-user@FreeBSD.ORG Sun Oct 12 22:12:11 2008 Return-Path: Delivered-To: svn-src-user@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 010711065687; Sun, 12 Oct 2008 22:12:11 +0000 (UTC) (envelope-from edwin@mavetju.org) Received: from k7.mavetju.org (ppp121-44-143-230.lns10.syd7.internode.on.net [121.44.143.230]) by mx1.freebsd.org (Postfix) with ESMTP id 9D6898FC22; Sun, 12 Oct 2008 22:12:10 +0000 (UTC) (envelope-from edwin@mavetju.org) Received: by k7.mavetju.org (Postfix, from userid 1001) id AEBA045039; Mon, 13 Oct 2008 09:11:27 +1100 (EST) Date: Mon, 13 Oct 2008 09:11:27 +1100 From: Edwin Groothuis To: Garance A Drosehn Message-ID: <20081012221127.GB71466@mavetju.org> References: <200810120915.m9C9F5tq040143@svn.freebsd.org> <20081012142454.607c861d.stas@FreeBSD.org> <20081012103422.GA71466@mavetju.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: Stanislav Sedov , src-committers@FreeBSD.org, Bruce Evans , svn-src-user@FreeBSD.org Subject: Re: svn commit: r183781 - in user/edwin/top/top-3.8b1: contrib/top usr.bin/top X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Oct 2008 22:12:11 -0000 On Sun, Oct 12, 2008 at 04:56:29PM -0400, Garance A Drosehn wrote: > At 9:34 PM +1100 10/12/08, Edwin Groothuis wrote: > >On Sun, Oct 12, 2008, Stanislav Sedov wrote: > > > > > URL: http://svn.freebsd.org/changeset/base/183781 > >> > > >> > Log: > > > > All collected changes to with regarding to the feedback > > > > received on the announcement of top 3.8b1 on -stable and > > > > -current as version B. > > > > > > > > This is considered the final version and submitted to mentor > > > > (bde@) for commit approval. > > > > >> What happened to my request of preserving -a option? > > > >Taken in consideration, as promised on #thatchannel. > > > >I still think that compatibility with the original program and thus > >other OS's on which top runs, either out of the box or via the > >original tar-ball of the author, is more important than the > >compatibility between FreeBSD versions for FreeBSD specific features. > > Hmm, I didn't realize there were plans to change the -a option. Change only as in the parameter, not as in the feature. It's going to be -c now because -a has been used by the original top for: -a, --all Show all processes for as long as possible. This is shorthand for "-d all all". This option is especially handy in batch mode. > Also, if this version of 'top' is going to change the meaning of > some options compared to previous versions of 'top' on FreeBSD, > then I think it would be helpful for the man page to include some > short historical footnote of that change. I understand. Edwin -- Edwin Groothuis Website: http://www.mavetju.org/ edwin@mavetju.org Weblog: http://www.mavetju.org/weblog/ From owner-svn-src-user@FreeBSD.ORG Mon Oct 13 21:09:39 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 52688106568A; Mon, 13 Oct 2008 21:09:39 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 280F58FC25; Mon, 13 Oct 2008 21:09:39 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DL9dsN086498; Mon, 13 Oct 2008 21:09:39 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DL9dTc086497; Mon, 13 Oct 2008 21:09:39 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810132109.m9DL9dTc086497@svn.freebsd.org> From: Edwin Groothuis Date: Mon, 13 Oct 2008 21:09:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183847 - in user/edwin/tzcode/tzcode2008e: head releng-7 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 21:09:39 -0000 Author: edwin Date: Mon Oct 13 21:09:38 2008 New Revision: 183847 URL: http://svn.freebsd.org/changeset/base/183847 Log: Start for the MFC to releng-7 of this project. Added: user/edwin/tzcode/tzcode2008e/head/ user/edwin/tzcode/tzcode2008e/releng-7/ From owner-svn-src-user@FreeBSD.ORG Mon Oct 13 21:14:03 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EAE7F1065692; Mon, 13 Oct 2008 21:14:03 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C01F68FC0C; Mon, 13 Oct 2008 21:14:03 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DLE3O5086626; Mon, 13 Oct 2008 21:14:03 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DLE3Sl086625; Mon, 13 Oct 2008 21:14:03 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810132114.m9DLE3Sl086625@svn.freebsd.org> From: Edwin Groothuis Date: Mon, 13 Oct 2008 21:14:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183848 - in user/edwin/tzcode/tzcode2008e: head/usr.sbin usr.sbin X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 21:14:04 -0000 Author: edwin Date: Mon Oct 13 21:14:03 2008 New Revision: 183848 URL: http://svn.freebsd.org/changeset/base/183848 Log: Move this code to the "head" branch. Added: user/edwin/tzcode/tzcode2008e/head/usr.sbin/ - copied from r183847, user/edwin/tzcode/tzcode2008e/usr.sbin/ Deleted: user/edwin/tzcode/tzcode2008e/usr.sbin/ From owner-svn-src-user@FreeBSD.ORG Mon Oct 13 21:14:47 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BEC101065688; Mon, 13 Oct 2008 21:14:47 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9450F8FC08; Mon, 13 Oct 2008 21:14:47 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DLElEU086682; Mon, 13 Oct 2008 21:14:47 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DLElMD086681; Mon, 13 Oct 2008 21:14:47 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810132114.m9DLElMD086681@svn.freebsd.org> From: Edwin Groothuis Date: Mon, 13 Oct 2008 21:14:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183849 - in user/edwin/tzcode/tzcode2008e: head/lib lib X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 21:14:47 -0000 Author: edwin Date: Mon Oct 13 21:14:47 2008 New Revision: 183849 URL: http://svn.freebsd.org/changeset/base/183849 Log: Move this code to the "head" branch. Added: user/edwin/tzcode/tzcode2008e/head/lib/ - copied from r183848, user/edwin/tzcode/tzcode2008e/lib/ Deleted: user/edwin/tzcode/tzcode2008e/lib/ From owner-svn-src-user@FreeBSD.ORG Mon Oct 13 21:20:08 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3E141065677; Mon, 13 Oct 2008 21:20:08 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B93778FC1B; Mon, 13 Oct 2008 21:20:08 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DLK8a2086817; Mon, 13 Oct 2008 21:20:08 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DLK8Ak086816; Mon, 13 Oct 2008 21:20:08 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810132120.m9DLK8Ak086816@svn.freebsd.org> From: Edwin Groothuis Date: Mon, 13 Oct 2008 21:20:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183850 - in user/edwin/tzcode/tzcode2008e/releng-7/lib: . libc X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 21:20:09 -0000 Author: edwin Date: Mon Oct 13 21:20:08 2008 New Revision: 183850 URL: http://svn.freebsd.org/changeset/base/183850 Log: Initial creation of tzcode2008e/releng-7/lib/libc Added: user/edwin/tzcode/tzcode2008e/releng-7/lib/ user/edwin/tzcode/tzcode2008e/releng-7/lib/libc/ (props changed) - copied from r183849, stable/7/lib/libc/ From owner-svn-src-user@FreeBSD.ORG Mon Oct 13 21:20:50 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C86301065687; Mon, 13 Oct 2008 21:20:50 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9D7F28FC1D; Mon, 13 Oct 2008 21:20:50 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DLKoMg086867; Mon, 13 Oct 2008 21:20:50 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DLKo6O086866; Mon, 13 Oct 2008 21:20:50 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810132120.m9DLKo6O086866@svn.freebsd.org> From: Edwin Groothuis Date: Mon, 13 Oct 2008 21:20:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183851 - in user/edwin/tzcode/tzcode2008e/releng-7/usr.sbin: . zic X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 21:20:50 -0000 Author: edwin Date: Mon Oct 13 21:20:50 2008 New Revision: 183851 URL: http://svn.freebsd.org/changeset/base/183851 Log: Initial creation of tzcode2008e/releng-7/usr.sbin/zic Added: user/edwin/tzcode/tzcode2008e/releng-7/usr.sbin/ user/edwin/tzcode/tzcode2008e/releng-7/usr.sbin/zic/ (props changed) - copied from r183850, stable/7/usr.sbin/zic/ From owner-svn-src-user@FreeBSD.ORG Mon Oct 13 21:45:14 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7CA911065687; Mon, 13 Oct 2008 21:45:14 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 522168FC0A; Mon, 13 Oct 2008 21:45:14 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DLjEJJ087415; Mon, 13 Oct 2008 21:45:14 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DLjEcF087414; Mon, 13 Oct 2008 21:45:14 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810132145.m9DLjEcF087414@svn.freebsd.org> From: Edwin Groothuis Date: Mon, 13 Oct 2008 21:45:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183853 - in user/edwin/tzcode: tzcode2008e-2004a tzcode2008e-head-2004a X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 21:45:14 -0000 Author: edwin Date: Mon Oct 13 21:45:14 2008 New Revision: 183853 URL: http://svn.freebsd.org/changeset/base/183853 Log: Change tag according to new layout: tzcode2008e-2004a -> tzcode2008e-head-2004a Added: user/edwin/tzcode/tzcode2008e-head-2004a/ - copied from r183852, user/edwin/tzcode/tzcode2008e-2004a/ Deleted: user/edwin/tzcode/tzcode2008e-2004a/ From owner-svn-src-user@FreeBSD.ORG Mon Oct 13 21:45:43 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2071C106564A; Mon, 13 Oct 2008 21:45:43 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E9FA98FC16; Mon, 13 Oct 2008 21:45:42 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DLjgLY087460; Mon, 13 Oct 2008 21:45:42 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DLjg8L087459; Mon, 13 Oct 2008 21:45:42 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810132145.m9DLjg8L087459@svn.freebsd.org> From: Edwin Groothuis Date: Mon, 13 Oct 2008 21:45:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183854 - in user/edwin/tzcode: tzcode2008e-2008e tzcode2008e-head-2008e X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 21:45:43 -0000 Author: edwin Date: Mon Oct 13 21:45:42 2008 New Revision: 183854 URL: http://svn.freebsd.org/changeset/base/183854 Log: Change tag according to new layout: tzcode2008e-2008e -> tzcode2008e-head-2008e Added: user/edwin/tzcode/tzcode2008e-head-2008e/ - copied from r183853, user/edwin/tzcode/tzcode2008e-2008e/ Deleted: user/edwin/tzcode/tzcode2008e-2008e/ From owner-svn-src-user@FreeBSD.ORG Mon Oct 13 21:46:07 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2AA151065687; Mon, 13 Oct 2008 21:46:07 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F40268FC1B; Mon, 13 Oct 2008 21:46:06 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DLk6U6087508; Mon, 13 Oct 2008 21:46:06 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DLk61a087507; Mon, 13 Oct 2008 21:46:06 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810132146.m9DLk61a087507@svn.freebsd.org> From: Edwin Groothuis Date: Mon, 13 Oct 2008 21:46:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183855 - in user/edwin/tzcode: tzcode2008e-2008g tzcode2008e-head-2008g X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 21:46:07 -0000 Author: edwin Date: Mon Oct 13 21:46:06 2008 New Revision: 183855 URL: http://svn.freebsd.org/changeset/base/183855 Log: Change tag according to new layout: tzcode2008e-2008g -> tzcode2008e-head-2008g Added: user/edwin/tzcode/tzcode2008e-head-2008g/ - copied from r183854, user/edwin/tzcode/tzcode2008e-2008g/ Deleted: user/edwin/tzcode/tzcode2008e-2008g/ From owner-svn-src-user@FreeBSD.ORG Mon Oct 13 22:04:42 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 58575106569F; Mon, 13 Oct 2008 22:04:42 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2DD5B8FC19; Mon, 13 Oct 2008 22:04:42 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DM4ge1087994; Mon, 13 Oct 2008 22:04:42 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9DM4gq5087993; Mon, 13 Oct 2008 22:04:42 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810132204.m9DM4gq5087993@svn.freebsd.org> From: Edwin Groothuis Date: Mon, 13 Oct 2008 22:04:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183856 - user/edwin/tzcode/tzcode2008e-releng7-2004a X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 22:04:42 -0000 Author: edwin Date: Mon Oct 13 22:04:41 2008 New Revision: 183856 URL: http://svn.freebsd.org/changeset/base/183856 Log: tagging of original 2004a code in releng7 Added: user/edwin/tzcode/tzcode2008e-releng7-2004a/ - copied from r183855, user/edwin/tzcode/tzcode2008e/releng-7/ From owner-svn-src-user@FreeBSD.ORG Mon Oct 13 22:24:37 2008 Return-Path: Delivered-To: svn-src-user@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38BF91065688; Mon, 13 Oct 2008 22:24:37 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from smtp.ht-systems.ru (mr0.ht-systems.ru [78.110.50.55]) by mx1.freebsd.org (Postfix) with ESMTP id A1BBD8FC20; Mon, 13 Oct 2008 22:24:36 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from [85.21.245.235] (helo=orion.SpringDaemons.com) by smtp.ht-systems.ru with esmtpa (Exim 4.62) (envelope-from ) id 1KpVq1-0008Ig-Bd; Tue, 14 Oct 2008 02:24:29 +0400 Received: from orion (localhost [127.0.0.1]) by orion.SpringDaemons.com (Postfix) with SMTP id D1D5439952; Tue, 14 Oct 2008 02:25:04 +0400 (MSD) Date: Tue, 14 Oct 2008 02:25:04 +0400 From: Stanislav Sedov To: Edwin Groothuis Message-Id: <20081014022504.ccf76b6e.stas@FreeBSD.org> In-Reply-To: <20081012221127.GB71466@mavetju.org> References: <200810120915.m9C9F5tq040143@svn.freebsd.org> <20081012142454.607c861d.stas@FreeBSD.org> <20081012103422.GA71466@mavetju.org> <20081012221127.GB71466@mavetju.org> Organization: The FreeBSD Project X-XMPP: ssedov@jabber.ru X-Voice: +7 916 849 20 23 X-PGP-Fingerprint: F21E D6CC 5626 9609 6CE2 A385 2BF5 5993 EB26 9581 X-Mailer: carrier-pigeon Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="PGP-SHA1"; boundary="Signature=_Tue__14_Oct_2008_02_25_04_+0400_hDFwSNW31/Do8n2r" Cc: src-committers@FreeBSD.org, Bruce Evans , Garance A Drosehn , svn-src-user@FreeBSD.org Subject: Re: svn commit: r183781 - in user/edwin/top/top-3.8b1: contrib/top usr.bin/top X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 22:24:37 -0000 --Signature=_Tue__14_Oct_2008_02_25_04_+0400_hDFwSNW31/Do8n2r Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, 13 Oct 2008 09:11:27 +1100 Edwin Groothuis mentioned: >=20 > Change only as in the parameter, not as in the feature. >=20 > It's going to be -c now because -a has been used by the original top for: >=20 > -a, --all > Show all processes for as long as possible. This is > shorthand for "-d all all". This option is especially > handy in batch mode. >=20 I think the new '-a' option is going to be used less frequent, then FreeBSD one. Do you understand that by changing it you are forcing FreeBSD users (not other system's users) to use something like this in scrips: ---------------------------------------------------------------- if ( `sysctl kern.osreldate` > XXXXXX ) then opt =3D "-c" else opt =3D '-a' endif top ${opt} ... ---------------------------------------------------------------- This is clearly a POLA violation and I really don't understand what we are trading it for. The most attractive thing in FreeBSD for most users is that we're truing to be as compatible with pervios revisions as possible. You're now trying to ruin that for nothing in exchange. I was asking you what other systems use this version of top in base: have you done this research? I think this at least might be asked at mailinglist what communinity will prefer - to keep the FreeBSD compatibility or the upstream compatibility. Not speaking of there's a good chance we may switch to other top verion in future. We can provide unmodified version of top in ports system - this is what that systems was done for. So users who really want the unixtop compatibility can get it there. I really don't understand why you've selected that specific top version as standard - why not try to be compatible with e.g. atop instead? I think this should be thinked around better. --=20 Stanislav Sedov ST4096-RIPE --Signature=_Tue__14_Oct_2008_02_25_04_+0400_hDFwSNW31/Do8n2r Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAkjzysAACgkQK/VZk+smlYHM9gCfY9tCySqGZfbl8vD2x2nFLbk3 JPkAn3Fw5DNd7uF0yxVIhgP8NJl9lVRo =Opz6 -----END PGP SIGNATURE----- --Signature=_Tue__14_Oct_2008_02_25_04_+0400_hDFwSNW31/Do8n2r-- From owner-svn-src-user@FreeBSD.ORG Mon Oct 13 22:32:53 2008 Return-Path: Delivered-To: svn-src-user@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B18CA106569F; Mon, 13 Oct 2008 22:32:53 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from smtp.ht-systems.ru (mr0.ht-systems.ru [78.110.50.55]) by mx1.freebsd.org (Postfix) with ESMTP id 231228FC22; Mon, 13 Oct 2008 22:32:52 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from [85.21.245.235] (helo=orion.SpringDaemons.com) by smtp.ht-systems.ru with esmtpa (Exim 4.62) (envelope-from ) id 1KpVy2-0000iM-DD; Tue, 14 Oct 2008 02:32:46 +0400 Received: from orion (localhost [127.0.0.1]) by orion.SpringDaemons.com (Postfix) with SMTP id DEE2739952; Tue, 14 Oct 2008 02:33:21 +0400 (MSD) Date: Tue, 14 Oct 2008 02:33:21 +0400 From: Stanislav Sedov To: Stanislav Sedov Message-Id: <20081014023321.45f5af38.stas@FreeBSD.org> In-Reply-To: <20081014022504.ccf76b6e.stas@FreeBSD.org> References: <200810120915.m9C9F5tq040143@svn.freebsd.org> <20081012142454.607c861d.stas@FreeBSD.org> <20081012103422.GA71466@mavetju.org> <20081012221127.GB71466@mavetju.org> <20081014022504.ccf76b6e.stas@FreeBSD.org> Organization: The FreeBSD Project X-XMPP: ssedov@jabber.ru X-Voice: +7 916 849 20 23 X-PGP-Fingerprint: F21E D6CC 5626 9609 6CE2 A385 2BF5 5993 EB26 9581 X-Mailer: carrier-pigeon Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="PGP-SHA1"; boundary="Signature=_Tue__14_Oct_2008_02_33_21_+0400_3pXXO_mcHVtY4wQS" Cc: Edwin Groothuis , src-committers@FreeBSD.org, Bruce Evans , Garance A Drosehn , svn-src-user@FreeBSD.org Subject: Re: svn commit: r183781 - in user/edwin/top/top-3.8b1: contrib/top usr.bin/top X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 22:32:53 -0000 --Signature=_Tue__14_Oct_2008_02_33_21_+0400_3pXXO_mcHVtY4wQS Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, 14 Oct 2008 02:25:04 +0400 Stanislav Sedov mentioned: > On Mon, 13 Oct 2008 09:11:27 +1100 > Edwin Groothuis mentioned: >=20 > >=20 > > Change only as in the parameter, not as in the feature. > >=20 > > It's going to be -c now because -a has been used by the original top fo= r: > >=20 > > -a, --all > > Show all processes for as long as possible. This is > > shorthand for "-d all all". This option is especially > > handy in batch mode. > >=20 >=20 > I think the new '-a' option is going to be used less frequent, then > FreeBSD one. Do you understand that by changing it you are forcing > FreeBSD users (not other system's users) to use something like this > in scrips: Do not think I'm fully against these changes. I just think we it is not really clear what way we should prefer. Sorry if the previous message sounded slightly rude. --=20 Stanislav Sedov ST4096-RIPE --Signature=_Tue__14_Oct_2008_02_33_21_+0400_3pXXO_mcHVtY4wQS Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAkjzzLEACgkQK/VZk+smlYGhrgCeJeaiAIAAMJgZFhR4k9CclXU8 p7sAnRDdaPSFkGfsOa4s/HbdcXhIUEOp =l+BK -----END PGP SIGNATURE----- --Signature=_Tue__14_Oct_2008_02_33_21_+0400_3pXXO_mcHVtY4wQS-- From owner-svn-src-user@FreeBSD.ORG Mon Oct 13 23:16:05 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B1CCD106568A; Mon, 13 Oct 2008 23:16:05 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from smtp.ht-systems.ru (mr0.ht-systems.ru [78.110.50.55]) by mx1.freebsd.org (Postfix) with ESMTP id 3F2B98FC15; Mon, 13 Oct 2008 23:16:05 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from [85.21.245.235] (helo=orion.SpringDaemons.com) by smtp.ht-systems.ru with esmtpa (Exim 4.62) (envelope-from ) id 1KpWdu-00026a-JP; Tue, 14 Oct 2008 03:16:02 +0400 Received: from orion (localhost [127.0.0.1]) by orion.SpringDaemons.com (Postfix) with SMTP id 0F67939952; Tue, 14 Oct 2008 03:16:39 +0400 (MSD) Date: Tue, 14 Oct 2008 03:16:34 +0400 From: Stanislav Sedov To: Edwin Groothuis Message-Id: <20081014031634.11ec48cd.stas@FreeBSD.org> In-Reply-To: <200810121010.m9CAAgGO041854@svn.freebsd.org> References: <200810121010.m9CAAgGO041854@svn.freebsd.org> Organization: The FreeBSD Project X-XMPP: ssedov@jabber.ru X-Voice: +7 916 849 20 23 X-PGP-Fingerprint: F21E D6CC 5626 9609 6CE2 A385 2BF5 5993 EB26 9581 X-Mailer: carrier-pigeon Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="PGP-SHA1"; boundary="Signature=_Tue__14_Oct_2008_03_16_34_+0400_pOqzUn4uF71Z9Rqk" Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r183798 - in user/edwin/tftpd: libexec/tftpd usr.bin/tftp X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 23:16:05 -0000 --Signature=_Tue__14_Oct_2008_03_16_34_+0400_pOqzUn4uF71Z9Rqk Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, 12 Oct 2008 10:10:42 +0000 (UTC) Edwin Groothuis mentioned: > Author: edwin > Date: Sun Oct 12 10:10:42 2008 > New Revision: 183798 > URL: http://svn.freebsd.org/changeset/base/183798 >=20 > Log: > It all started when we got some new routers, which told me the > following when trying to upload configuration or download images > from it: The TFTP server doesn't support the blocksize option. > =20 > My curiousity was triggered, it took me some reading of RFCs and > other documentation to find out what was possible and what could > be done. Was plain TFTP very simple in its handshake, TFTP with > options was kind of messy because of its backwards capability: The > first packet returned could either be an acknowledgement of options, > or the first data packet. > =20 > Going through the source code of src/libexec/tftpd and going through > the code of src/usr.bin/tftp showed that there was a lot of duplicate > code, and the addition of options would only increase the amount > of duplicate code. After all, both the client and the server can > act as a sender and receiver. > =20 > At the end, it ended up with a nearly complete rewrite of the tftp > client and server. It has been tested against the following TFTP > clients and servers: > =20 > - Itself (yay!) > - The standard FreeBSD tftp client and server > - The Fedora Core 6 tftp client and server > - Cisco router tftp client > - Extreme Networks tftp client > =20 > It supports the following RFCs: > =20 > RFC1350 - THE TFTP PROTOCOL (REVISION 2) > RFC2347 - TFTP Option Extension > RFC2348 - TFTP Blocksize Option > RFC2349 - TFTP Timeout Interval and Transfer Size Options > RFC3617 - Uniform Resource Identifier (URI) Scheme and Applicability > Statement for the Trivial File Transfer Protocol (TFTP) > =20 > It supports the following unofficial TFTP Options as described at > http://www.compuphase.com/tftp.htm: > =20 > blksize2 - Block size restricted to powers of 2, excluding protocol hea= ders > rollover - Block counter roll-over (roll back to zero or to one) > =20 > From the tftp program point of view the following things are changed: > =20 > - New commands: "blocksize", "blocksize2", "rollover" and "options" > - Development features: "debug" and "packetdrop" > =20 > If you try this tftp/tftpd implementation, please let me know if > it works (or doesn't work) and against which implementaion so I can > get a list of confirmed working systems. Great! The old tftp serves was quite buggy in a number of places. Just FYI, style(9) requies parenthesis around values of return. Let me know if you'll need a review. --=20 Stanislav Sedov ST4096-RIPE --Signature=_Tue__14_Oct_2008_03_16_34_+0400_pOqzUn4uF71Z9Rqk Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAkjz1tcACgkQK/VZk+smlYHiWwCbBj9mP03VNfEiOPgG+xcFhPWO trMAn2R8T5XfRlp+Z/A56we0rzdi3Far =Tya9 -----END PGP SIGNATURE----- --Signature=_Tue__14_Oct_2008_03_16_34_+0400_pOqzUn4uF71Z9Rqk-- From owner-svn-src-user@FreeBSD.ORG Mon Oct 13 23:21:03 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D7FD21065686; Mon, 13 Oct 2008 23:21:03 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from smtp.ht-systems.ru (mr0.ht-systems.ru [78.110.50.55]) by mx1.freebsd.org (Postfix) with ESMTP id 85C228FC14; Mon, 13 Oct 2008 23:21:03 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from [85.21.245.235] (helo=orion.SpringDaemons.com) by smtp.ht-systems.ru with esmtpa (Exim 4.62) (envelope-from ) id 1KpWik-0002O9-Bc; Tue, 14 Oct 2008 03:21:02 +0400 Received: from orion (localhost [127.0.0.1]) by orion.SpringDaemons.com (Postfix) with SMTP id D387B39952; Tue, 14 Oct 2008 03:21:37 +0400 (MSD) Date: Tue, 14 Oct 2008 03:21:37 +0400 From: Stanislav Sedov To: Rui Paulo Message-Id: <20081014032137.13da1212.stas@FreeBSD.org> In-Reply-To: <200810101753.m9AHrQJU097333@svn.freebsd.org> References: <200810101753.m9AHrQJU097333@svn.freebsd.org> Organization: The FreeBSD Project X-XMPP: ssedov@jabber.ru X-Voice: +7 916 849 20 23 X-PGP-Fingerprint: F21E D6CC 5626 9609 6CE2 A385 2BF5 5993 EB26 9581 X-Mailer: carrier-pigeon Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="PGP-SHA1"; boundary="Signature=_Tue__14_Oct_2008_03_21_37_+0400_e=7YVXyG+GolOhSa" Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r183751 - user/rpaulo/eeemon X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 23:21:03 -0000 --Signature=_Tue__14_Oct_2008_03_21_37_+0400_e=7YVXyG+GolOhSa Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, 10 Oct 2008 17:53:26 +0000 (UTC) Rui Paulo mentioned: > Author: rpaulo > Date: Fri Oct 10 17:53:26 2008 > New Revision: 183751 > URL: http://svn.freebsd.org/changeset/base/183751 >=20 > Log: > eeemon is a kernel module for Asus Eee notebooks that allows you to > control the fan speed, high/low voltage and it shows the cpu > temperature. > =20 > Includes fan control code by "harrow@yandex.ru". > Imported from my peronal repo. >=20 > + > +static void > +eeemon_identify(driver_t *driver, device_t parent) > +{ > + device_t child; > + > + if (device_find_child(parent, "eeemon", -1) !=3D NULL) > + return; > + > + if (eeemon_match() =3D=3D 0) > + return; > + > + child =3D BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "eeemon", -1); > + if (child =3D=3D NULL) > + device_printf(parent, "add eeemon child failed\n"); > + Do we need to attach to a 'real' bus here? Btw, should it really belong to the kernel code? As all operations are performed via inb/out it's a clear fit for a userland program. --=20 Stanislav Sedov ST4096-RIPE --Signature=_Tue__14_Oct_2008_03_21_37_+0400_e=7YVXyG+GolOhSa Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAkjz2AEACgkQK/VZk+smlYEz8gCePlaNAkDCwRPLtIzb8qwuYW49 Ib0AoILpnt8pCcWDpJSgjxzGl1Y76FJh =5QZI -----END PGP SIGNATURE----- --Signature=_Tue__14_Oct_2008_03_21_37_+0400_e=7YVXyG+GolOhSa-- From owner-svn-src-user@FreeBSD.ORG Tue Oct 14 02:22:26 2008 Return-Path: Delivered-To: svn-src-user@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F7F710656A2; Tue, 14 Oct 2008 02:22:26 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 4B46E8FC2B; Tue, 14 Oct 2008 02:22:26 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id m9E2JdM1049130; Mon, 13 Oct 2008 20:19:39 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Mon, 13 Oct 2008 20:20:41 -0600 (MDT) Message-Id: <20081013.202041.1492581255.imp@bsdimp.com> To: stas@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <20081014032137.13da1212.stas@FreeBSD.org> References: <200810101753.m9AHrQJU097333@svn.freebsd.org> <20081014032137.13da1212.stas@FreeBSD.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: src-committers@FreeBSD.org, rpaulo@FreeBSD.org, svn-src-user@FreeBSD.org Subject: Re: svn commit: r183751 - user/rpaulo/eeemon X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Oct 2008 02:22:26 -0000 In message: <20081014032137.13da1212.stas@FreeBSD.org> Stanislav Sedov writes: : On Fri, 10 Oct 2008 17:53:26 +0000 (UTC) : Rui Paulo mentioned: : : > Author: rpaulo : > Date: Fri Oct 10 17:53:26 2008 : > New Revision: 183751 : > URL: http://svn.freebsd.org/changeset/base/183751 : > : > Log: : > eeemon is a kernel module for Asus Eee notebooks that allows you to : > control the fan speed, high/low voltage and it shows the cpu : > temperature. : > : > Includes fan control code by "harrow@yandex.ru". : > Imported from my peronal repo. : > : : > + : > +static void : > +eeemon_identify(driver_t *driver, device_t parent) : > +{ : > + device_t child; : > + : > + if (device_find_child(parent, "eeemon", -1) != NULL) : > + return; : > + : > + if (eeemon_match() == 0) : > + return; : > + : > + child = BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "eeemon", -1); : > + if (child == NULL) : > + device_printf(parent, "add eeemon child failed\n"); : > + : : Do we need to attach to a 'real' bus here? In the kernel allows the kernel to control it. The isa bus is as good or a bad place as any... Warner From owner-svn-src-user@FreeBSD.ORG Tue Oct 14 20:37:16 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9C6F1065686; Tue, 14 Oct 2008 20:37:16 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from smtp.ht-systems.ru (mr0.ht-systems.ru [78.110.50.55]) by mx1.freebsd.org (Postfix) with ESMTP id 96DFB8FC16; Tue, 14 Oct 2008 20:37:16 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from [85.21.245.235] (helo=orion.SpringDaemons.com) by smtp.ht-systems.ru with esmtpa (Exim 4.62) (envelope-from ) id 1Kpqdl-00083G-MR; Wed, 15 Oct 2008 00:37:13 +0400 Received: from orion (localhost [127.0.0.1]) by orion.SpringDaemons.com (Postfix) with SMTP id CFD60398F1; Wed, 15 Oct 2008 00:37:51 +0400 (MSD) Date: Wed, 15 Oct 2008 00:37:47 +0400 From: Stanislav Sedov To: Rui Paulo Message-Id: <20081015003747.b8235271.stas@FreeBSD.org> In-Reply-To: <0D0B75E9-4C48-4A50-B34F-2CF1886A1839@FreeBSD.org> References: <200810101753.m9AHrQJU097333@svn.freebsd.org> <20081014032137.13da1212.stas@FreeBSD.org> <0D0B75E9-4C48-4A50-B34F-2CF1886A1839@FreeBSD.org> Organization: The FreeBSD Project X-XMPP: ssedov@jabber.ru X-Voice: +7 916 849 20 23 X-PGP-Fingerprint: F21E D6CC 5626 9609 6CE2 A385 2BF5 5993 EB26 9581 X-Mailer: carrier-pigeon Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="PGP-SHA1"; boundary="Signature=_Wed__15_Oct_2008_00_37_47_+0400_LGy=MyB_ivGfdWut" X-Mailman-Approved-At: Tue, 14 Oct 2008 20:53:45 +0000 Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r183751 - user/rpaulo/eeemon X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Oct 2008 20:37:17 -0000 --Signature=_Wed__15_Oct_2008_00_37_47_+0400_LGy=MyB_ivGfdWut Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, 14 Oct 2008 21:27:44 +0100 Rui Paulo mentioned: >=20 > Not necessarily, but this is what I've done, so I thought I would =20 > commit it. >=20 But moving it to userland will simplify it a lot, and eliminate a lot of possible security issues. Adding new functionality will be also much simplier in that case. I can help with rewriting, if needed. --=20 Stanislav Sedov ST4096-RIPE --Signature=_Wed__15_Oct_2008_00_37_47_+0400_LGy=MyB_ivGfdWut Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAkj1Ax8ACgkQK/VZk+smlYFc3QCcCFOJCe9IYRHXQEitD/CqkxUi S/UAnixCnKEyQ7o+xr5o4jAb0jempyLf =YLBJ -----END PGP SIGNATURE----- --Signature=_Wed__15_Oct_2008_00_37_47_+0400_LGy=MyB_ivGfdWut-- From owner-svn-src-user@FreeBSD.ORG Tue Oct 14 21:00:17 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F0C6210656A8 for ; Tue, 14 Oct 2008 21:00:17 +0000 (UTC) (envelope-from rpaulo@gmail.com) Received: from ey-out-2122.google.com (ey-out-2122.google.com [74.125.78.26]) by mx1.freebsd.org (Postfix) with ESMTP id 5E3178FC28 for ; Tue, 14 Oct 2008 21:00:17 +0000 (UTC) (envelope-from rpaulo@gmail.com) Received: by ey-out-2122.google.com with SMTP id 6so810388eyi.7 for ; Tue, 14 Oct 2008 14:00:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:cc:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:mime-version :subject:date:references:x-mailer:sender; bh=1XshWtiFqXjlWJ9Xy6EBvfkBI/rv4eMAwFNqy9kvBqc=; b=GQ5n2M55BDW3JVK0mRFHIXuFsLBeMw8ZBj8nAizXhtIvjaGDxBsoDTRhlIYLCaZpdc 7zuxeVIqp1f0seRTRM8J6uw/CVYg2FYXuYsKa+/3qHd3T0p4NAsDNdeMl1TGyaEKmbB2 ohsFAQOsuwDHtuALejHP7wbQlzh7Auc2fXfSM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=cc:message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer:sender; b=Tt9QSTvo75+3YkDbiqidE8jd58HA0Tg/6Am8mM0uH8OOFgtSJCYOT75pmjEMiHdspT VpIhRT3iidjihVBGQwOYDdM+ClqqVPMvBrRmywG/vfYuS8pn9t9zrwIzqmQEPSGYfM7g ek642ew3mU94XlzbCkN3NK9gx16W7j/hUwNR8= Received: by 10.210.16.10 with SMTP id 10mr19546ebp.17.1224016070437; Tue, 14 Oct 2008 13:27:50 -0700 (PDT) Received: from ?10.0.1.30? ([92.250.50.164]) by mx.google.com with ESMTPS id c24sm7073160ika.4.2008.10.14.13.27.47 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 14 Oct 2008 13:27:49 -0700 (PDT) Message-Id: <0D0B75E9-4C48-4A50-B34F-2CF1886A1839@FreeBSD.org> From: Rui Paulo To: Stanislav Sedov In-Reply-To: <20081014032137.13da1212.stas@FreeBSD.org> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v929.2) Date: Tue, 14 Oct 2008 21:27:44 +0100 References: <200810101753.m9AHrQJU097333@svn.freebsd.org> <20081014032137.13da1212.stas@FreeBSD.org> X-Mailer: Apple Mail (2.929.2) Sender: Rui Paulo Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r183751 - user/rpaulo/eeemon X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Oct 2008 21:00:18 -0000 On 14 Oct 2008, at 00:21, Stanislav Sedov wrote: > On Fri, 10 Oct 2008 17:53:26 +0000 (UTC) > Rui Paulo mentioned: > >> Author: rpaulo >> Date: Fri Oct 10 17:53:26 2008 >> New Revision: 183751 >> URL: http://svn.freebsd.org/changeset/base/183751 >> >> Log: >> eeemon is a kernel module for Asus Eee notebooks that allows you to >> control the fan speed, high/low voltage and it shows the cpu >> temperature. >> >> Includes fan control code by "harrow@yandex.ru". >> Imported from my peronal repo. >> > >> + >> +static void >> +eeemon_identify(driver_t *driver, device_t parent) >> +{ >> + device_t child; >> + >> + if (device_find_child(parent, "eeemon", -1) != NULL) >> + return; >> + >> + if (eeemon_match() == 0) >> + return; >> + >> + child = BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "eeemon", -1); >> + if (child == NULL) >> + device_printf(parent, "add eeemon child failed\n"); >> + > > Do we need to attach to a 'real' bus here? Technically, no. But as Warner said, the isa bus is good as any. > Btw, should it really belong to the kernel code? As all operations are > performed via inb/out it's a clear fit for a userland program. Not necessarily, but this is what I've done, so I thought I would commit it. Regards, -- Rui Paulo From owner-svn-src-user@FreeBSD.ORG Tue Oct 14 22:11:19 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4D7CD106569A; Tue, 14 Oct 2008 22:11:19 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3C6008FC18; Tue, 14 Oct 2008 22:11:19 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9EMBJgX017282; Tue, 14 Oct 2008 22:11:19 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9EMBJSY017281; Tue, 14 Oct 2008 22:11:19 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810142211.m9EMBJSY017281@svn.freebsd.org> From: Edwin Groothuis Date: Tue, 14 Oct 2008 22:11:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183897 - user/edwin/top/top-3.8b1/usr.bin/top X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Oct 2008 22:11:19 -0000 Author: edwin Date: Tue Oct 14 22:11:18 2008 New Revision: 183897 URL: http://svn.freebsd.org/changeset/base/183897 Log: Replace static filenames with .CURDIR, .TARGET and .ALLSRC on places where required. Submitted by: Modified: user/edwin/top/top-3.8b1/usr.bin/top/Makefile Modified: user/edwin/top/top-3.8b1/usr.bin/top/Makefile ============================================================================== --- user/edwin/top/top-3.8b1/usr.bin/top/Makefile Tue Oct 14 20:28:42 2008 (r183896) +++ user/edwin/top/top-3.8b1/usr.bin/top/Makefile Tue Oct 14 22:11:18 2008 (r183897) @@ -49,30 +49,32 @@ CLEANFILES+= top.local.h top.x CLEANFILES+= config.h CPU!= uname -m config.h: config.h.in - @${ECHO} Making config.h from config.h.in + @${ECHO} Making ${.TARGET} from ${.ALLSRC} sed \ -e 's/@DEFAULT_TOPN@/-1/' \ -e 's/@DEFAULT_DELAY@/2/' \ -e 's/@HAVE_GETOPT_LONG@/1/' \ -e 's/@ENABLE_KILL@/1/' \ -e "s/@CPU@/${CPU}/" \ - < config.h.in > config.h + < ${.ALLSRC} > ${.TARGET} CLEANFILES+= top.1.local top.1.local: top.1.in - @${ECHO} Making top.1.local from top.1.in + @${ECHO} Making ${.TARGET} from ${.ALLSRC} @sed \ -e 's/@DEFAULT_TOPN@/-1/' \ -e 's/@DEFAULT_DELAY@/2/' \ -e 's/@HAVE_GETOPT_LONG@/1/' \ -e 's/@ENABLE_KILL@/1/' \ - < ${TOPDIR}/top.1.in > top.1.local + < ${.ALLSRC} > ${.TARGET} CLEANFILES+= top.1 top.1: top.1.local machine.man - L=`grep -n MAN_SUPPLEMENT top.1.local | awk -F: '{ print $$1 }'`; \ - (head -`expr $$L - 1` top.1.local; \ - cat machine.man; \ - tail +`expr $$L + 1` top.1.local) > top.1 + @${ECHO} Making ${.TARGET} from ${.ALLSRC} + L=`grep -n MAN_SUPPLEMENT ${.CURDIR}/top.1.local | \ + awk -F: '{ print $$1 }'`; \ + (head -`expr $$L - 1` ${.CURDIR}/top.1.local; \ + cat ${.CURDIR}/machine.man; \ + tail +`expr $$L + 1` ${.CURDIR}/top.1.local) > ${.TARGET} .include From owner-svn-src-user@FreeBSD.ORG Tue Oct 14 23:51:31 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2BC03106568C; Tue, 14 Oct 2008 23:51:31 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1A3B28FC22; Tue, 14 Oct 2008 23:51:31 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9ENpVdE019024; Tue, 14 Oct 2008 23:51:31 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9ENpUJ4019023; Tue, 14 Oct 2008 23:51:30 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810142351.m9ENpUJ4019023@svn.freebsd.org> From: Edwin Groothuis Date: Tue, 14 Oct 2008 23:51:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183899 - user/edwin/top/top-3.8b1/usr.bin/top X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Oct 2008 23:51:31 -0000 Author: edwin Date: Tue Oct 14 23:51:30 2008 New Revision: 183899 URL: http://svn.freebsd.org/changeset/base/183899 Log: Display the original command between ()'s just like the old top did when the command and the first argument of the command-line-arguments don't match. According to include/sys/user.h, PS_INMEM is obsoleted in favour of P_INMEM, not the other way around. Modified: user/edwin/top/top-3.8b1/usr.bin/top/machine.c Modified: user/edwin/top/top-3.8b1/usr.bin/top/machine.c ============================================================================== --- user/edwin/top/top-3.8b1/usr.bin/top/machine.c Tue Oct 14 22:48:38 2008 (r183898) +++ user/edwin/top/top-3.8b1/usr.bin/top/machine.c Tue Oct 14 23:51:30 2008 (r183899) @@ -734,9 +734,10 @@ fmt_command(char *buf, int sz, struct ki char *bufp; char **args; char *ps; + char *rawcmd; int argc; -#if OSMAJOR <= 4 +#if OSMAJOR > 4 inmem = (PP(pp, flag) & P_INMEM); #else inmem = (PP(pp, sflag) & PS_INMEM); @@ -747,7 +748,9 @@ fmt_command(char *buf, int sz, struct ki /* get the pargs structure */ if ((args = kvm_getargv(kd, pp, sz)) != NULL) { - /* successfull retrieval: now convert nulls and cr/lf in to spaces */ + /* + * successfull retrieval: now convert nulls and cr/lf in to spaces + */ bufp = cmd; cmd[0] = '\0'; argc = 0; @@ -765,6 +768,17 @@ fmt_command(char *buf, int sz, struct ki *ps = ' '; } + if ((rawcmd = strrchr(args[0], '/')) != NULL) + rawcmd++; + else + rawcmd = args[0]; + + if (strcmp(rawcmd, pp->ki_comm) != 0) { + strcat(cmd, " ("); + strcat(cmd, pp->ki_comm); + strcat(cmd, ")"); + } + /* format cmd as our answer */ return snprintf(buf, sz, "%s", cmd); } From owner-svn-src-user@FreeBSD.ORG Wed Oct 15 00:54:58 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 72FCB1065694; Wed, 15 Oct 2008 00:54:58 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 61A158FC1E; Wed, 15 Oct 2008 00:54:58 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9F0swEn020129; Wed, 15 Oct 2008 00:54:58 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9F0swE6020128; Wed, 15 Oct 2008 00:54:58 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810150054.m9F0swE6020128@svn.freebsd.org> From: Edwin Groothuis Date: Wed, 15 Oct 2008 00:54:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183900 - user/edwin/top/top-3.8b1/usr.bin/top X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Oct 2008 00:54:58 -0000 Author: edwin Date: Wed Oct 15 00:54:57 2008 New Revision: 183900 URL: http://svn.freebsd.org/changeset/base/183900 Log: Replace .CURDIR -> .OBJDIR on files I generate locally. Submitted by: Modified: user/edwin/top/top-3.8b1/usr.bin/top/Makefile Modified: user/edwin/top/top-3.8b1/usr.bin/top/Makefile ============================================================================== --- user/edwin/top/top-3.8b1/usr.bin/top/Makefile Tue Oct 14 23:51:30 2008 (r183899) +++ user/edwin/top/top-3.8b1/usr.bin/top/Makefile Wed Oct 15 00:54:57 2008 (r183900) @@ -49,7 +49,7 @@ CLEANFILES+= top.local.h top.x CLEANFILES+= config.h CPU!= uname -m config.h: config.h.in - @${ECHO} Making ${.TARGET} from ${.ALLSRC} + @${ECHO} Making ${.TARGET} from ${.ALLSRC:T} sed \ -e 's/@DEFAULT_TOPN@/-1/' \ -e 's/@DEFAULT_DELAY@/2/' \ @@ -60,7 +60,7 @@ config.h: config.h.in CLEANFILES+= top.1.local top.1.local: top.1.in - @${ECHO} Making ${.TARGET} from ${.ALLSRC} + @${ECHO} Making ${.TARGET} from ${.ALLSRC:T} @sed \ -e 's/@DEFAULT_TOPN@/-1/' \ -e 's/@DEFAULT_DELAY@/2/' \ @@ -70,11 +70,11 @@ top.1.local: top.1.in CLEANFILES+= top.1 top.1: top.1.local machine.man - @${ECHO} Making ${.TARGET} from ${.ALLSRC} - L=`grep -n MAN_SUPPLEMENT ${.CURDIR}/top.1.local | \ + @${ECHO} Making ${.TARGET} from ${.ALLSRC:T} + L=`grep -n MAN_SUPPLEMENT ${.OBJDIR}/top.1.local | \ awk -F: '{ print $$1 }'`; \ - (head -`expr $$L - 1` ${.CURDIR}/top.1.local; \ + (head -`expr $$L - 1` ${.OBJDIR}/top.1.local; \ cat ${.CURDIR}/machine.man; \ - tail +`expr $$L + 1` ${.CURDIR}/top.1.local) > ${.TARGET} + tail +`expr $$L + 1` ${.OBJDIR}/top.1.local) > ${.TARGET} .include From owner-svn-src-user@FreeBSD.ORG Wed Oct 15 03:55:00 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9C7AA1065689; Wed, 15 Oct 2008 03:55:00 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 887E78FC13; Wed, 15 Oct 2008 03:55:00 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9F3t0O4023452; Wed, 15 Oct 2008 03:55:00 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9F3t0oO023451; Wed, 15 Oct 2008 03:55:00 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810150355.m9F3t0oO023451@svn.freebsd.org> From: Edwin Groothuis Date: Wed, 15 Oct 2008 03:55:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183902 - user/edwin/top/top-3.8b1/contrib/top X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Oct 2008 03:55:00 -0000 Author: edwin Date: Wed Oct 15 03:55:00 2008 New Revision: 183902 URL: http://svn.freebsd.org/changeset/base/183902 Log: Manual says to use "f" for the full list of arguments. Submitted by: swell.k@gmail.com Modified: user/edwin/top/top-3.8b1/contrib/top/commands.c Modified: user/edwin/top/top-3.8b1/contrib/top/commands.c ============================================================================== --- user/edwin/top/top-3.8b1/contrib/top/commands.c Wed Oct 15 03:38:03 2008 (r183901) +++ user/edwin/top/top-3.8b1/contrib/top/commands.c Wed Oct 15 03:55:00 2008 (r183902) @@ -1015,7 +1015,7 @@ command command_table[] = { { 'U', cmd_useruid, "toggle the display of usernames or uids" }, { 'c', cmd_command, "display processes by command name" }, { 'd', cmd_displays, "change number of displays to show" }, - { 'a', cmd_cmdline, "toggle the display of full command paths" }, + { 'f', cmd_cmdline, "toggle the display of full command paths" }, { 'i', cmd_idle, "toggle the displaying of idle processes" }, { 'I', cmd_idle, NULL }, #ifdef ENABLE_KILL From owner-svn-src-user@FreeBSD.ORG Wed Oct 15 04:57:03 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B7EF1065688; Wed, 15 Oct 2008 04:57:03 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 426658FC0C; Wed, 15 Oct 2008 04:57:03 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9F4v2YG024561; Wed, 15 Oct 2008 04:57:02 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9F4v26t024560; Wed, 15 Oct 2008 04:57:02 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810150457.m9F4v26t024560@svn.freebsd.org> From: Edwin Groothuis Date: Wed, 15 Oct 2008 04:57:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183903 - user/edwin/tzcode/tzcode2008e-releng7-2008g X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Oct 2008 04:57:03 -0000 Author: edwin Date: Wed Oct 15 04:57:02 2008 New Revision: 183903 URL: http://svn.freebsd.org/changeset/base/183903 Log: Tag of working tzcode/tzcode2008e/releng7 with the tzcode2008g code. Added: user/edwin/tzcode/tzcode2008e-releng7-2008g/ - copied from r183902, user/edwin/tzcode/tzcode2008e/releng-7/ From owner-svn-src-user@FreeBSD.ORG Wed Oct 15 05:00:50 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 901681065701; Wed, 15 Oct 2008 05:00:50 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 66F378FC1B; Wed, 15 Oct 2008 05:00:50 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9F50ofM024691; Wed, 15 Oct 2008 05:00:50 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9F50oJP024690; Wed, 15 Oct 2008 05:00:50 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810150500.m9F50oJP024690@svn.freebsd.org> From: Edwin Groothuis Date: Wed, 15 Oct 2008 05:00:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183904 - user/edwin/tzcode/regression X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Oct 2008 05:00:50 -0000 Author: edwin Date: Wed Oct 15 05:00:50 2008 New Revision: 183904 URL: http://svn.freebsd.org/changeset/base/183904 Log: Initial creation of the regression tools for the date(1) regression tools Added: user/edwin/tzcode/regression/ - copied from r183903, head/tools/regression/ From owner-svn-src-user@FreeBSD.ORG Wed Oct 15 06:21:58 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45A361065686; Wed, 15 Oct 2008 06:21:58 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3288B8FC14; Wed, 15 Oct 2008 06:21:58 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9F6LvpI026378; Wed, 15 Oct 2008 06:21:57 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9F6LsaM026296; Wed, 15 Oct 2008 06:21:54 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810150621.m9F6LsaM026296@svn.freebsd.org> From: Edwin Groothuis Date: Wed, 15 Oct 2008 06:21:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183910 - user/edwin/tzcode/regression/bin/date X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Oct 2008 06:21:58 -0000 Author: edwin Date: Wed Oct 15 06:21:54 2008 New Revision: 183910 URL: http://svn.freebsd.org/changeset/base/183910 Log: Regression tests for the date(1) +% functions. It is part of the update to the tzcode2008e in the base system. The strange name of the files, with the X_ and _x, is because of the pre-commit checkin scripts... Added: user/edwin/tzcode/regression/bin/date/ user/edwin/tzcode/regression/bin/date/Makefile user/edwin/tzcode/regression/bin/date/regress.1.A_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1.B_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1.C_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1.D_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1.F_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1.G_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1.H_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1.I_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1.M_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1.R_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1.S_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1.U_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1.V_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1.W_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1.X_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1.Y_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1.Z_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1._%.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1._+.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1._a.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1._b.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1._c.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1._d.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1._e.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1._g.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1._h.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1._j.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1._k.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1._l.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1._m.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1._p.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1._r.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1._s.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1._u.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1._v.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1._w.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1._x.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1._y.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.1._z.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2.A_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2.B_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2.C_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2.D_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2.F_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2.G_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2.H_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2.I_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2.M_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2.R_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2.S_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2.U_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2.V_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2.W_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2.X_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2.Y_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2.Z_.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2._%.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2._+.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2._a.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2._b.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2._c.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2._d.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2._e.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2._g.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2._h.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2._j.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2._k.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2._l.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2._m.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2._p.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2._r.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2._s.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2._u.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2._v.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2._w.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2._x.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2._y.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.2._z.out (contents, props changed) user/edwin/tzcode/regression/bin/date/regress.sh user/edwin/tzcode/regression/bin/date/regress.t Added: user/edwin/tzcode/regression/bin/date/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/Makefile Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +all: + @m4 ${.CURDIR}/../../usr.bin/regress.m4 ${.CURDIR}/regress.sh | sh /dev/stdin ${.CURDIR} Added: user/edwin/tzcode/regression/bin/date/regress.1.A_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1.A_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +Saturday Added: user/edwin/tzcode/regression/bin/date/regress.1.B_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1.B_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +February Added: user/edwin/tzcode/regression/bin/date/regress.1.C_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1.C_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +19 Added: user/edwin/tzcode/regression/bin/date/regress.1.D_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1.D_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +02/07/70 Added: user/edwin/tzcode/regression/bin/date/regress.1.F_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1.F_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +1970-02-07 Added: user/edwin/tzcode/regression/bin/date/regress.1.G_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1.G_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +1970 Added: user/edwin/tzcode/regression/bin/date/regress.1.H_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1.H_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +07 Added: user/edwin/tzcode/regression/bin/date/regress.1.I_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1.I_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +07 Added: user/edwin/tzcode/regression/bin/date/regress.1.M_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1.M_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +04 Added: user/edwin/tzcode/regression/bin/date/regress.1.R_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1.R_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +07:04 Added: user/edwin/tzcode/regression/bin/date/regress.1.S_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1.S_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +03 Added: user/edwin/tzcode/regression/bin/date/regress.1.U_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1.U_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +05 Added: user/edwin/tzcode/regression/bin/date/regress.1.V_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1.V_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +06 Added: user/edwin/tzcode/regression/bin/date/regress.1.W_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1.W_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +05 Added: user/edwin/tzcode/regression/bin/date/regress.1.X_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1.X_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +07:04:03 Added: user/edwin/tzcode/regression/bin/date/regress.1.Y_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1.Y_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +1970 Added: user/edwin/tzcode/regression/bin/date/regress.1.Z_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1.Z_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +UTC Added: user/edwin/tzcode/regression/bin/date/regress.1._%.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1._%.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +% Added: user/edwin/tzcode/regression/bin/date/regress.1._+.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1._+.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +Sat Feb 7 07:04:03 UTC 1970 Added: user/edwin/tzcode/regression/bin/date/regress.1._a.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1._a.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +Sat Added: user/edwin/tzcode/regression/bin/date/regress.1._b.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1._b.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +Feb Added: user/edwin/tzcode/regression/bin/date/regress.1._c.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1._c.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +Sat Feb 7 07:04:03 1970 Added: user/edwin/tzcode/regression/bin/date/regress.1._d.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1._d.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +07 Added: user/edwin/tzcode/regression/bin/date/regress.1._e.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1._e.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ + 7 Added: user/edwin/tzcode/regression/bin/date/regress.1._g.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1._g.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +70 Added: user/edwin/tzcode/regression/bin/date/regress.1._h.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1._h.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +Feb Added: user/edwin/tzcode/regression/bin/date/regress.1._j.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1._j.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +038 Added: user/edwin/tzcode/regression/bin/date/regress.1._k.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1._k.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ + 7 Added: user/edwin/tzcode/regression/bin/date/regress.1._l.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1._l.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ + 7 Added: user/edwin/tzcode/regression/bin/date/regress.1._m.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1._m.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +02 Added: user/edwin/tzcode/regression/bin/date/regress.1._p.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1._p.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +AM Added: user/edwin/tzcode/regression/bin/date/regress.1._r.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1._r.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +07:04:03 AM Added: user/edwin/tzcode/regression/bin/date/regress.1._s.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1._s.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +3222243 Added: user/edwin/tzcode/regression/bin/date/regress.1._u.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1._u.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +6 Added: user/edwin/tzcode/regression/bin/date/regress.1._v.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1._v.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ + 7-Feb-1970 Added: user/edwin/tzcode/regression/bin/date/regress.1._w.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1._w.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +6 Added: user/edwin/tzcode/regression/bin/date/regress.1._x.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1._x.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +02/07/70 Added: user/edwin/tzcode/regression/bin/date/regress.1._y.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1._y.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +70 Added: user/edwin/tzcode/regression/bin/date/regress.1._z.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.1._z.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ ++0000 Added: user/edwin/tzcode/regression/bin/date/regress.2.A_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2.A_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +Monday Added: user/edwin/tzcode/regression/bin/date/regress.2.B_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2.B_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +November Added: user/edwin/tzcode/regression/bin/date/regress.2.C_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2.C_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +20 Added: user/edwin/tzcode/regression/bin/date/regress.2.D_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2.D_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +11/12/01 Added: user/edwin/tzcode/regression/bin/date/regress.2.F_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2.F_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +2001-11-12 Added: user/edwin/tzcode/regression/bin/date/regress.2.G_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2.G_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +2001 Added: user/edwin/tzcode/regression/bin/date/regress.2.H_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2.H_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +21 Added: user/edwin/tzcode/regression/bin/date/regress.2.I_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2.I_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +09 Added: user/edwin/tzcode/regression/bin/date/regress.2.M_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2.M_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +20 Added: user/edwin/tzcode/regression/bin/date/regress.2.R_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2.R_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +21:20 Added: user/edwin/tzcode/regression/bin/date/regress.2.S_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2.S_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +00 Added: user/edwin/tzcode/regression/bin/date/regress.2.U_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2.U_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +45 Added: user/edwin/tzcode/regression/bin/date/regress.2.V_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2.V_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +46 Added: user/edwin/tzcode/regression/bin/date/regress.2.W_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2.W_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +46 Added: user/edwin/tzcode/regression/bin/date/regress.2.X_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2.X_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +21:20:00 Added: user/edwin/tzcode/regression/bin/date/regress.2.Y_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2.Y_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +2001 Added: user/edwin/tzcode/regression/bin/date/regress.2.Z_.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2.Z_.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +UTC Added: user/edwin/tzcode/regression/bin/date/regress.2._%.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2._%.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +% Added: user/edwin/tzcode/regression/bin/date/regress.2._+.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2._+.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +Mon Nov 12 21:20:00 UTC 2001 Added: user/edwin/tzcode/regression/bin/date/regress.2._a.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2._a.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +Mon Added: user/edwin/tzcode/regression/bin/date/regress.2._b.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2._b.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +Nov Added: user/edwin/tzcode/regression/bin/date/regress.2._c.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2._c.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +Mon Nov 12 21:20:00 2001 Added: user/edwin/tzcode/regression/bin/date/regress.2._d.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2._d.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +12 Added: user/edwin/tzcode/regression/bin/date/regress.2._e.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2._e.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +12 Added: user/edwin/tzcode/regression/bin/date/regress.2._g.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2._g.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +01 Added: user/edwin/tzcode/regression/bin/date/regress.2._h.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2._h.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +Nov Added: user/edwin/tzcode/regression/bin/date/regress.2._j.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2._j.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +316 Added: user/edwin/tzcode/regression/bin/date/regress.2._k.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2._k.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +21 Added: user/edwin/tzcode/regression/bin/date/regress.2._l.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2._l.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ + 9 Added: user/edwin/tzcode/regression/bin/date/regress.2._m.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2._m.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +11 Added: user/edwin/tzcode/regression/bin/date/regress.2._p.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2._p.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +PM Added: user/edwin/tzcode/regression/bin/date/regress.2._r.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2._r.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +09:20:00 PM Added: user/edwin/tzcode/regression/bin/date/regress.2._s.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2._s.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +1005600000 Added: user/edwin/tzcode/regression/bin/date/regress.2._u.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2._u.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +1 Added: user/edwin/tzcode/regression/bin/date/regress.2._v.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2._v.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +12-Nov-2001 Added: user/edwin/tzcode/regression/bin/date/regress.2._w.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2._w.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +1 Added: user/edwin/tzcode/regression/bin/date/regress.2._x.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2._x.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +11/12/01 Added: user/edwin/tzcode/regression/bin/date/regress.2._y.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2._y.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ +01 Added: user/edwin/tzcode/regression/bin/date/regress.2._z.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.2._z.out Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1 @@ ++0000 Added: user/edwin/tzcode/regression/bin/date/regress.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.sh Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1,67 @@ +# $FreeBSD$ + +echo 1..78 + +TEST1=3222243 # 1970-02-07 07:04:03 +TEST2=1005600000 # 2001-11-12 21:11:12 +export LANG=C +export TZ=UTC + +REGRESSION_START($1) + +check() +{ + S=$1 + S_lc=$(echo ${S} | tr A-Z a-z) + + if [ "${S}" = "${S_lc}" ]; then + FN="_${S}" + else + FN="${S}_" + fi + + REGRESSION_TEST(`1.${FN}', `date -r ${TEST1} +%${S}') + REGRESSION_TEST(`2.${FN}', `date -r ${TEST2} +%${S}') +} + +check A # Saturday Monday +check a # Sat Mon +check B # February November +check b # Feb Nov +check C # 19 20 +check c # "Sat Feb 7 07:04:03 1970" "Mon Nov 12 21:20:00 2001" +check D # 02/07/70 11/12/01 +check d # 07 12 +check e # " 7" 12 +check F # "1970-02-07" "2001-11-12" +check G # 1970 2001 +check g # 70 01 +check H # 07 21 +check h # Feb Nov +check I # 07 09 +check j # 038 316 +check k # " 7" 21 +check l # " 7" " 9" +check M # 04 20 +check m # 02 11 +check p # AM PM +check R # 07:04 21:20 +check r # "07:04:03 AM" "09:20:00 PM" +check S # 03 00 +check s # ${TEST1} ${TEST2} +check U # 05 45 +check u # 6 1 +check V # 06 46 +check v # " 7-Feb-1970" "12-Nov-2001" +check W # 05 46 +check w # 6 1 +check X # "07:04:03" "21:20:00" +check x # "02/07/70" "11/12/01" +check Y # 1970 2001 +check y # 70 01 +check Z # UTC UTC +check z # +0000 +0000 +check % # % % +check + # "Sat Feb 7 07:04:03 UTC 1970" "Mon Nov 12 21:20:00 UTC 2001" + +REGRESSION_END() Added: user/edwin/tzcode/regression/bin/date/regress.t ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/tzcode/regression/bin/date/regress.t Wed Oct 15 06:21:54 2008 (r183910) @@ -0,0 +1,6 @@ +#!/bin/sh +# $FreeBSD$ + +cd `dirname $0` + +m4 ../../usr.bin/regress.m4 regress.sh | sh From owner-svn-src-user@FreeBSD.ORG Wed Oct 15 14:29:35 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7CC561065688; Wed, 15 Oct 2008 14:29:35 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 671208FC22; Wed, 15 Oct 2008 14:29:35 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9FETZPA035822; Wed, 15 Oct 2008 14:29:35 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9FETZrp035819; Wed, 15 Oct 2008 14:29:35 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810151429.m9FETZrp035819@svn.freebsd.org> From: Alexander Leidinger Date: Wed, 15 Oct 2008 14:29:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183913 - in user/netchild: . coverity coverity/src coverity/src/sys coverity/src/sys/nfsclient coverity/src/sys/nfsserver deskjail deskjail/src deskjail/src/etc deskjail/src/etc/defaul... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Oct 2008 14:29:35 -0000 Author: netchild Date: Wed Oct 15 14:29:35 2008 New Revision: 183913 URL: http://svn.freebsd.org/changeset/base/183913 Log: Create a baseline in my user dir for some stuff I play with. The README's (shall) contain more info regarding them. - coverity: some fixes for CIDs I had a look at - deskjail: stuff to get a X server running in a jail - jailmount: allow some more FSes to be mounted within a jail - linuxaio: Intron's linux aio compatibility shim More stuff/semi-projects to come later (as time permits). Added: user/netchild/ user/netchild/coverity/ user/netchild/coverity/README user/netchild/coverity/src/ user/netchild/coverity/src/sys/ user/netchild/coverity/src/sys/nfsclient/ user/netchild/coverity/src/sys/nfsclient/nfs_subs.c (props changed) - copied unchanged from r183911, head/sys/nfsclient/nfs_subs.c user/netchild/coverity/src/sys/nfsserver/ user/netchild/coverity/src/sys/nfsserver/nfs_serv.c (props changed) - copied unchanged from r183911, head/sys/nfsserver/nfs_serv.c user/netchild/deskjail/ user/netchild/deskjail/README user/netchild/deskjail/src/ user/netchild/deskjail/src/etc/ user/netchild/deskjail/src/etc/defaults/ user/netchild/deskjail/src/etc/defaults/devfs.rules (props changed) - copied unchanged from r183911, head/etc/defaults/devfs.rules user/netchild/deskjail/src/sys/ user/netchild/deskjail/src/sys/kern/ user/netchild/deskjail/src/sys/kern/kern_jail.c (props changed) - copied unchanged from r183911, head/sys/kern/kern_jail.c user/netchild/deskjail/src/usr.sbin/ user/netchild/deskjail/src/usr.sbin/jail/ user/netchild/deskjail/src/usr.sbin/jail/jail.8 (props changed) - copied unchanged from r183911, head/usr.sbin/jail/jail.8 user/netchild/jailmount/ user/netchild/jailmount/README user/netchild/jailmount/src/ user/netchild/jailmount/src/sys/ user/netchild/jailmount/src/sys/fs/ user/netchild/jailmount/src/sys/fs/cd9660/ user/netchild/jailmount/src/sys/fs/cd9660/cd9660_vfsops.c (props changed) - copied unchanged from r183911, head/sys/fs/cd9660/cd9660_vfsops.c user/netchild/jailmount/src/sys/fs/msdosfs/ user/netchild/jailmount/src/sys/fs/msdosfs/msdosfs_vfsops.c (props changed) - copied unchanged from r183911, head/sys/fs/msdosfs/msdosfs_vfsops.c user/netchild/jailmount/src/sys/fs/ntfs/ user/netchild/jailmount/src/sys/fs/ntfs/ntfs_vfsops.c (props changed) - copied unchanged from r183911, head/sys/fs/ntfs/ntfs_vfsops.c user/netchild/jailmount/src/sys/fs/nullfs/ user/netchild/jailmount/src/sys/fs/nullfs/null_vfsops.c (props changed) - copied unchanged from r183911, head/sys/fs/nullfs/null_vfsops.c user/netchild/jailmount/src/sys/fs/smbfs/ user/netchild/jailmount/src/sys/fs/smbfs/smbfs_vfsops.c (props changed) - copied unchanged from r183911, head/sys/fs/smbfs/smbfs_vfsops.c user/netchild/jailmount/src/sys/fs/udf/ user/netchild/jailmount/src/sys/fs/udf/udf_vfsops.c (props changed) - copied unchanged from r183911, head/sys/fs/udf/udf_vfsops.c user/netchild/jailmount/src/sys/fs/unionfs/ user/netchild/jailmount/src/sys/fs/unionfs/union_vfsops.c (props changed) - copied unchanged from r183911, head/sys/fs/unionfs/union_vfsops.c user/netchild/jailmount/src/sys/nfsclient/ user/netchild/jailmount/src/sys/nfsclient/nfs_vfsops.c (props changed) - copied unchanged from r183911, head/sys/nfsclient/nfs_vfsops.c user/netchild/linuxaio/ user/netchild/linuxaio/README user/netchild/linuxaio/src/ user/netchild/linuxaio/src/sys/ user/netchild/linuxaio/src/sys/amd64/ user/netchild/linuxaio/src/sys/amd64/conf/ user/netchild/linuxaio/src/sys/amd64/conf/NOTES (props changed) - copied unchanged from r183911, head/sys/amd64/conf/NOTES user/netchild/linuxaio/src/sys/amd64/linux32/ user/netchild/linuxaio/src/sys/amd64/linux32/linux.h (props changed) - copied unchanged from r183911, head/sys/amd64/linux32/linux.h user/netchild/linuxaio/src/sys/amd64/linux32/linux32_dummy.c (props changed) - copied unchanged from r183911, head/sys/amd64/linux32/linux32_dummy.c user/netchild/linuxaio/src/sys/amd64/linux32/syscalls.master (props changed) - copied unchanged from r183911, head/sys/amd64/linux32/syscalls.master user/netchild/linuxaio/src/sys/conf/ user/netchild/linuxaio/src/sys/conf/files.i386 (props changed) - copied unchanged from r183911, head/sys/conf/files.i386 user/netchild/linuxaio/src/sys/conf/files.pc98 (props changed) - copied unchanged from r183911, head/sys/conf/files.pc98 user/netchild/linuxaio/src/sys/conf/options.amd64 (props changed) - copied unchanged from r183911, head/sys/conf/options.amd64 user/netchild/linuxaio/src/sys/conf/options.i386 (props changed) - copied unchanged from r183911, head/sys/conf/options.i386 user/netchild/linuxaio/src/sys/conf/options.pc98 (props changed) - copied unchanged from r183911, head/sys/conf/options.pc98 user/netchild/linuxaio/src/sys/i386/ user/netchild/linuxaio/src/sys/i386/conf/ user/netchild/linuxaio/src/sys/i386/conf/NOTES (props changed) - copied unchanged from r183911, head/sys/i386/conf/NOTES user/netchild/linuxaio/src/sys/i386/linux/ user/netchild/linuxaio/src/sys/i386/linux/linux.h (props changed) - copied unchanged from r183911, head/sys/i386/linux/linux.h user/netchild/linuxaio/src/sys/i386/linux/linux_dummy.c (props changed) - copied unchanged from r183911, head/sys/i386/linux/linux_dummy.c user/netchild/linuxaio/src/sys/i386/linux/syscalls.master (props changed) - copied unchanged from r183911, head/sys/i386/linux/syscalls.master user/netchild/linuxaio/src/sys/kern/ user/netchild/linuxaio/src/sys/kern/vfs_aio.c (props changed) - copied unchanged from r183911, head/sys/kern/vfs_aio.c user/netchild/linuxaio/src/sys/modules/ user/netchild/linuxaio/src/sys/modules/Makefile (props changed) - copied unchanged from r183911, head/sys/modules/Makefile user/netchild/linuxaio/src/sys/modules/aio/ user/netchild/linuxaio/src/sys/modules/aio/Makefile (props changed) - copied unchanged from r183911, head/sys/modules/aio/Makefile user/netchild/linuxaio/src/sys/pc98/ user/netchild/linuxaio/src/sys/pc98/conf/ user/netchild/linuxaio/src/sys/pc98/conf/NOTES (props changed) - copied unchanged from r183911, head/sys/pc98/conf/NOTES user/netchild/linuxaio/src/sys/sys/ user/netchild/linuxaio/src/sys/sys/aio.h (props changed) - copied unchanged from r183911, head/sys/sys/aio.h Added: user/netchild/coverity/README ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/netchild/coverity/README Wed Oct 15 14:29:35 2008 (r183913) @@ -0,0 +1 @@ +Improvements based upon Coverity Prevent reports. Copied: user/netchild/coverity/src/sys/nfsclient/nfs_subs.c (from r183911, head/sys/nfsclient/nfs_subs.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/netchild/coverity/src/sys/nfsclient/nfs_subs.c Wed Oct 15 14:29:35 2008 (r183913, copy of r183911, head/sys/nfsclient/nfs_subs.c) @@ -0,0 +1,1199 @@ +/*- + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Rick Macklem at The University of Guelph. + * + * 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. + * 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. + * + * @(#)nfs_subs.c 8.8 (Berkeley) 5/22/95 + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * These functions support the macros and help fiddle mbuf chains for + * the nfs op functions. They do things like create the rpc header and + * copy data between mbuf chains and uio lists. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +/* + * Note that stdarg.h and the ANSI style va_start macro is used for both + * ANSI and traditional C compilers. + */ +#include + +/* + * Data items converted to xdr at startup, since they are constant + * This is kinda hokey, but may save a little time doing byte swaps + */ +u_int32_t nfs_xdrneg1; +u_int32_t rpc_call, rpc_vers, rpc_reply, rpc_msgdenied, rpc_autherr, + rpc_mismatch, rpc_auth_unix, rpc_msgaccepted; +u_int32_t nfs_true, nfs_false; + +/* And other global data */ +static u_int32_t nfs_xid = 0; +static enum vtype nv2tov_type[8]= { + VNON, VREG, VDIR, VBLK, VCHR, VLNK, VNON, VNON +}; + +int nfs_ticks; +int nfs_pbuf_freecnt = -1; /* start out unlimited */ + +struct nfs_reqq nfs_reqq; +struct mtx nfs_reqq_mtx; +struct nfs_bufq nfs_bufq; +static struct mtx nfs_xid_mtx; + +/* + * and the reverse mapping from generic to Version 2 procedure numbers + */ +int nfsv2_procid[NFS_NPROCS] = { + NFSV2PROC_NULL, + NFSV2PROC_GETATTR, + NFSV2PROC_SETATTR, + NFSV2PROC_LOOKUP, + NFSV2PROC_NOOP, + NFSV2PROC_READLINK, + NFSV2PROC_READ, + NFSV2PROC_WRITE, + NFSV2PROC_CREATE, + NFSV2PROC_MKDIR, + NFSV2PROC_SYMLINK, + NFSV2PROC_CREATE, + NFSV2PROC_REMOVE, + NFSV2PROC_RMDIR, + NFSV2PROC_RENAME, + NFSV2PROC_LINK, + NFSV2PROC_READDIR, + NFSV2PROC_NOOP, + NFSV2PROC_STATFS, + NFSV2PROC_NOOP, + NFSV2PROC_NOOP, + NFSV2PROC_NOOP, + NFSV2PROC_NOOP, +}; + +LIST_HEAD(nfsnodehashhead, nfsnode); + +u_int32_t +nfs_xid_gen(void) +{ + uint32_t xid; + + mtx_lock(&nfs_xid_mtx); + + /* Get a pretty random xid to start with */ + if (!nfs_xid) + nfs_xid = random(); + /* + * Skip zero xid if it should ever happen. + */ + if (++nfs_xid == 0) + nfs_xid++; + xid = nfs_xid; + mtx_unlock(&nfs_xid_mtx); + return xid; +} + +/* + * Create the header for an rpc request packet + * The hsiz is the size of the rest of the nfs request header. + * (just used to decide if a cluster is a good idea) + */ +struct mbuf * +nfsm_reqhead(struct vnode *vp, u_long procid, int hsiz) +{ + struct mbuf *mb; + + MGET(mb, M_WAIT, MT_DATA); + if (hsiz >= MINCLSIZE) + MCLGET(mb, M_WAIT); + mb->m_len = 0; + return (mb); +} + +/* + * Build the RPC header and fill in the authorization info. + * The authorization string argument is only used when the credentials + * come from outside of the kernel. + * Returns the head of the mbuf list. + */ +struct mbuf * +nfsm_rpchead(struct ucred *cr, int nmflag, int procid, int auth_type, + int auth_len, struct mbuf *mrest, int mrest_len, struct mbuf **mbp, + u_int32_t **xidpp) +{ + struct mbuf *mb; + u_int32_t *tl; + caddr_t bpos; + int i; + struct mbuf *mreq; + int grpsiz, authsiz; + + authsiz = nfsm_rndup(auth_len); + MGETHDR(mb, M_WAIT, MT_DATA); + if ((authsiz + 10 * NFSX_UNSIGNED) >= MINCLSIZE) { + MCLGET(mb, M_WAIT); + } else if ((authsiz + 10 * NFSX_UNSIGNED) < MHLEN) { + MH_ALIGN(mb, authsiz + 10 * NFSX_UNSIGNED); + } else { + MH_ALIGN(mb, 8 * NFSX_UNSIGNED); + } + mb->m_len = 0; + mreq = mb; + bpos = mtod(mb, caddr_t); + + /* + * First the RPC header. + */ + tl = nfsm_build(u_int32_t *, 8 * NFSX_UNSIGNED); + + *xidpp = tl; + *tl++ = txdr_unsigned(nfs_xid_gen()); + *tl++ = rpc_call; + *tl++ = rpc_vers; + *tl++ = txdr_unsigned(NFS_PROG); + if (nmflag & NFSMNT_NFSV3) { + *tl++ = txdr_unsigned(NFS_VER3); + *tl++ = txdr_unsigned(procid); + } else { + *tl++ = txdr_unsigned(NFS_VER2); + *tl++ = txdr_unsigned(nfsv2_procid[procid]); + } + + /* + * And then the authorization cred. + */ + *tl++ = txdr_unsigned(auth_type); + *tl = txdr_unsigned(authsiz); + switch (auth_type) { + case RPCAUTH_UNIX: + tl = nfsm_build(u_int32_t *, auth_len); + *tl++ = 0; /* stamp ?? */ + *tl++ = 0; /* NULL hostname */ + *tl++ = txdr_unsigned(cr->cr_uid); + *tl++ = txdr_unsigned(cr->cr_groups[0]); + grpsiz = (auth_len >> 2) - 5; + *tl++ = txdr_unsigned(grpsiz); + for (i = 1; i <= grpsiz; i++) + *tl++ = txdr_unsigned(cr->cr_groups[i]); + break; + } + + /* + * And the verifier... + */ + tl = nfsm_build(u_int32_t *, 2 * NFSX_UNSIGNED); + *tl++ = txdr_unsigned(RPCAUTH_NULL); + *tl = 0; + mb->m_next = mrest; + mreq->m_pkthdr.len = authsiz + 10 * NFSX_UNSIGNED + mrest_len; + mreq->m_pkthdr.rcvif = NULL; + *mbp = mb; + return (mreq); +} + +/* + * copies a uio scatter/gather list to an mbuf chain. + * NOTE: can ony handle iovcnt == 1 + */ +int +nfsm_uiotombuf(struct uio *uiop, struct mbuf **mq, int siz, caddr_t *bpos) +{ + char *uiocp; + struct mbuf *mp, *mp2; + int xfer, left, mlen; + int uiosiz, clflg, rem; + char *cp; + +#ifdef DIAGNOSTIC + if (uiop->uio_iovcnt != 1) + panic("nfsm_uiotombuf: iovcnt != 1"); +#endif + + if (siz > MLEN) /* or should it >= MCLBYTES ?? */ + clflg = 1; + else + clflg = 0; + rem = nfsm_rndup(siz)-siz; + mp = mp2 = *mq; + while (siz > 0) { + left = uiop->uio_iov->iov_len; + uiocp = uiop->uio_iov->iov_base; + if (left > siz) + left = siz; + uiosiz = left; + while (left > 0) { + mlen = M_TRAILINGSPACE(mp); + if (mlen == 0) { + MGET(mp, M_WAIT, MT_DATA); + if (clflg) + MCLGET(mp, M_WAIT); + mp->m_len = 0; + mp2->m_next = mp; + mp2 = mp; + mlen = M_TRAILINGSPACE(mp); + } + xfer = (left > mlen) ? mlen : left; +#ifdef notdef + /* Not Yet.. */ + if (uiop->uio_iov->iov_op != NULL) + (*(uiop->uio_iov->iov_op)) + (uiocp, mtod(mp, caddr_t)+mp->m_len, xfer); + else +#endif + if (uiop->uio_segflg == UIO_SYSSPACE) + bcopy(uiocp, mtod(mp, caddr_t)+mp->m_len, xfer); + else + copyin(uiocp, mtod(mp, caddr_t)+mp->m_len, xfer); + mp->m_len += xfer; + left -= xfer; + uiocp += xfer; + uiop->uio_offset += xfer; + uiop->uio_resid -= xfer; + } + uiop->uio_iov->iov_base = + (char *)uiop->uio_iov->iov_base + uiosiz; + uiop->uio_iov->iov_len -= uiosiz; + siz -= uiosiz; + } + if (rem > 0) { + if (rem > M_TRAILINGSPACE(mp)) { + MGET(mp, M_WAIT, MT_DATA); + mp->m_len = 0; + mp2->m_next = mp; + } + cp = mtod(mp, caddr_t)+mp->m_len; + for (left = 0; left < rem; left++) + *cp++ = '\0'; + mp->m_len += rem; + *bpos = cp; + } else + *bpos = mtod(mp, caddr_t)+mp->m_len; + *mq = mp; + return (0); +} + +/* + * Copy a string into mbufs for the hard cases... + */ +int +nfsm_strtmbuf(struct mbuf **mb, char **bpos, const char *cp, long siz) +{ + struct mbuf *m1 = NULL, *m2; + long left, xfer, len, tlen; + u_int32_t *tl; + int putsize; + + putsize = 1; + m2 = *mb; + left = M_TRAILINGSPACE(m2); + if (left > 0) { + tl = ((u_int32_t *)(*bpos)); + *tl++ = txdr_unsigned(siz); + putsize = 0; + left -= NFSX_UNSIGNED; + m2->m_len += NFSX_UNSIGNED; + if (left > 0) { + bcopy(cp, (caddr_t) tl, left); + siz -= left; + cp += left; + m2->m_len += left; + left = 0; + } + } + /* Loop around adding mbufs */ + while (siz > 0) { + MGET(m1, M_WAIT, MT_DATA); + if (siz > MLEN) + MCLGET(m1, M_WAIT); + m1->m_len = NFSMSIZ(m1); + m2->m_next = m1; + m2 = m1; + tl = mtod(m1, u_int32_t *); + tlen = 0; + if (putsize) { + *tl++ = txdr_unsigned(siz); + m1->m_len -= NFSX_UNSIGNED; + tlen = NFSX_UNSIGNED; + putsize = 0; + } + if (siz < m1->m_len) { + len = nfsm_rndup(siz); + xfer = siz; + if (xfer < len) + *(tl+(xfer>>2)) = 0; + } else { + xfer = len = m1->m_len; + } + bcopy(cp, (caddr_t) tl, xfer); + m1->m_len = len+tlen; + siz -= xfer; + cp += xfer; + } + *mb = m1; + *bpos = mtod(m1, caddr_t)+m1->m_len; + return (0); +} + +/* + * Called once to initialize data structures... + */ +int +nfs_init(struct vfsconf *vfsp) +{ + int i; + + nfsmount_zone = uma_zcreate("NFSMOUNT", sizeof(struct nfsmount), + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); + rpc_vers = txdr_unsigned(RPC_VER2); + rpc_call = txdr_unsigned(RPC_CALL); + rpc_reply = txdr_unsigned(RPC_REPLY); + rpc_msgdenied = txdr_unsigned(RPC_MSGDENIED); + rpc_msgaccepted = txdr_unsigned(RPC_MSGACCEPTED); + rpc_mismatch = txdr_unsigned(RPC_MISMATCH); + rpc_autherr = txdr_unsigned(RPC_AUTHERR); + rpc_auth_unix = txdr_unsigned(RPCAUTH_UNIX); + nfs_true = txdr_unsigned(TRUE); + nfs_false = txdr_unsigned(FALSE); + nfs_xdrneg1 = txdr_unsigned(-1); + nfs_ticks = (hz * NFS_TICKINTVL + 500) / 1000; + if (nfs_ticks < 1) + nfs_ticks = 1; + /* Ensure async daemons disabled */ + for (i = 0; i < NFS_MAXASYNCDAEMON; i++) { + nfs_iodwant[i] = NULL; + nfs_iodmount[i] = NULL; + } + nfs_nhinit(); /* Init the nfsnode table */ + + /* + * Initialize reply list and start timer + */ + TAILQ_INIT(&nfs_reqq); + callout_init(&nfs_callout, CALLOUT_MPSAFE); + mtx_init(&nfs_reqq_mtx, "NFS reqq lock", NULL, MTX_DEF); + mtx_init(&nfs_iod_mtx, "NFS iod lock", NULL, MTX_DEF); + mtx_init(&nfs_xid_mtx, "NFS xid lock", NULL, MTX_DEF); + + nfs_pbuf_freecnt = nswbuf / 2 + 1; + + return (0); +} + +int +nfs_uninit(struct vfsconf *vfsp) +{ + int i; + + callout_stop(&nfs_callout); + + KASSERT(TAILQ_EMPTY(&nfs_reqq), + ("nfs_uninit: request queue not empty")); + + /* + * Tell all nfsiod processes to exit. Clear nfs_iodmax, and wakeup + * any sleeping nfsiods so they check nfs_iodmax and exit. + */ + mtx_lock(&nfs_iod_mtx); + nfs_iodmax = 0; + for (i = 0; i < nfs_numasync; i++) + if (nfs_iodwant[i]) + wakeup(&nfs_iodwant[i]); + /* The last nfsiod to exit will wake us up when nfs_numasync hits 0 */ + while (nfs_numasync) + msleep(&nfs_numasync, &nfs_iod_mtx, PWAIT, "ioddie", 0); + mtx_unlock(&nfs_iod_mtx); + nfs_nhuninit(); + uma_zdestroy(nfsmount_zone); + return (0); +} + +void +nfs_dircookie_lock(struct nfsnode *np) +{ + mtx_lock(&np->n_mtx); + while (np->n_flag & NDIRCOOKIELK) + (void) msleep(&np->n_flag, &np->n_mtx, PZERO, "nfsdirlk", 0); + np->n_flag |= NDIRCOOKIELK; + mtx_unlock(&np->n_mtx); +} + +void +nfs_dircookie_unlock(struct nfsnode *np) +{ + mtx_lock(&np->n_mtx); + np->n_flag &= ~NDIRCOOKIELK; + wakeup(&np->n_flag); + mtx_unlock(&np->n_mtx); +} + +int +nfs_upgrade_vnlock(struct vnode *vp) +{ + int old_lock; + + if ((old_lock = VOP_ISLOCKED(vp)) != LK_EXCLUSIVE) { + if (old_lock == LK_SHARED) { + /* Upgrade to exclusive lock, this might block */ + vn_lock(vp, LK_UPGRADE | LK_RETRY); + } else { + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + } + } + return old_lock; +} + +void +nfs_downgrade_vnlock(struct vnode *vp, int old_lock) +{ + if (old_lock != LK_EXCLUSIVE) { + if (old_lock == LK_SHARED) { + /* Downgrade from exclusive lock, this might block */ + vn_lock(vp, LK_DOWNGRADE); + } else { + VOP_UNLOCK(vp, 0); + } + } +} + +void +nfs_printf(const char *fmt, ...) +{ + va_list ap; + + mtx_lock(&Giant); + va_start(ap, fmt); + printf(fmt, ap); + va_end(ap); + mtx_unlock(&Giant); +} + +/* + * Attribute cache routines. + * nfs_loadattrcache() - loads or updates the cache contents from attributes + * that are on the mbuf list + * nfs_getattrcache() - returns valid attributes if found in cache, returns + * error otherwise + */ + +/* + * Load the attribute cache (that lives in the nfsnode entry) with + * the values on the mbuf list and + * Iff vap not NULL + * copy the attributes to *vaper + */ +int +nfs_loadattrcache(struct vnode **vpp, struct mbuf **mdp, caddr_t *dposp, + struct vattr *vaper, int dontshrink) +{ + struct vnode *vp = *vpp; + struct vattr *vap; + struct nfs_fattr *fp; + struct nfsnode *np; + int32_t t1; + caddr_t cp2; + int rdev; + struct mbuf *md; + enum vtype vtyp; + u_short vmode; + struct timespec mtime, mtime_save; + int v3 = NFS_ISV3(vp); + struct thread *td = curthread; + + md = *mdp; + t1 = (mtod(md, caddr_t) + md->m_len) - *dposp; + cp2 = nfsm_disct(mdp, dposp, NFSX_FATTR(v3), t1, M_WAIT); + if (cp2 == NULL) + return EBADRPC; + fp = (struct nfs_fattr *)cp2; + if (v3) { + vtyp = nfsv3tov_type(fp->fa_type); + vmode = fxdr_unsigned(u_short, fp->fa_mode); + rdev = makedev(fxdr_unsigned(int, fp->fa3_rdev.specdata1), + fxdr_unsigned(int, fp->fa3_rdev.specdata2)); + fxdr_nfsv3time(&fp->fa3_mtime, &mtime); + } else { + vtyp = nfsv2tov_type(fp->fa_type); + vmode = fxdr_unsigned(u_short, fp->fa_mode); + /* + * XXX + * + * The duplicate information returned in fa_type and fa_mode + * is an ambiguity in the NFS version 2 protocol. + * + * VREG should be taken literally as a regular file. If a + * server intents to return some type information differently + * in the upper bits of the mode field (e.g. for sockets, or + * FIFOs), NFSv2 mandates fa_type to be VNON. Anyway, we + * leave the examination of the mode bits even in the VREG + * case to avoid breakage for bogus servers, but we make sure + * that there are actually type bits set in the upper part of + * fa_mode (and failing that, trust the va_type field). + * + * NFSv3 cleared the issue, and requires fa_mode to not + * contain any type information (while also introduing sockets + * and FIFOs for fa_type). + */ + if (vtyp == VNON || (vtyp == VREG && (vmode & S_IFMT) != 0)) + vtyp = IFTOVT(vmode); + rdev = fxdr_unsigned(int32_t, fp->fa2_rdev); + fxdr_nfsv2time(&fp->fa2_mtime, &mtime); + + /* + * Really ugly NFSv2 kludge. + */ + if (vtyp == VCHR && rdev == 0xffffffff) + vtyp = VFIFO; + } + + /* + * If v_type == VNON it is a new node, so fill in the v_type, + * n_mtime fields. Check to see if it represents a special + * device, and if so, check for a possible alias. Once the + * correct vnode has been obtained, fill in the rest of the + * information. + */ + np = VTONFS(vp); + mtx_lock(&np->n_mtx); + if (vp->v_type != vtyp) { + vp->v_type = vtyp; + if (vp->v_type == VFIFO) + vp->v_op = &nfs_fifoops; + np->n_mtime = mtime; + } + vap = &np->n_vattr; + vap->va_type = vtyp; + vap->va_mode = (vmode & 07777); + vap->va_rdev = rdev; + mtime_save = vap->va_mtime; + vap->va_mtime = mtime; + vap->va_fsid = vp->v_mount->mnt_stat.f_fsid.val[0]; + if (v3) { + vap->va_nlink = fxdr_unsigned(u_short, fp->fa_nlink); + vap->va_uid = fxdr_unsigned(uid_t, fp->fa_uid); + vap->va_gid = fxdr_unsigned(gid_t, fp->fa_gid); + vap->va_size = fxdr_hyper(&fp->fa3_size); + vap->va_blocksize = NFS_FABLKSIZE; + vap->va_bytes = fxdr_hyper(&fp->fa3_used); + vap->va_fileid = fxdr_unsigned(int32_t, + fp->fa3_fileid.nfsuquad[1]); + fxdr_nfsv3time(&fp->fa3_atime, &vap->va_atime); + fxdr_nfsv3time(&fp->fa3_ctime, &vap->va_ctime); + vap->va_flags = 0; + vap->va_filerev = 0; + } else { + vap->va_nlink = fxdr_unsigned(u_short, fp->fa_nlink); + vap->va_uid = fxdr_unsigned(uid_t, fp->fa_uid); + vap->va_gid = fxdr_unsigned(gid_t, fp->fa_gid); + vap->va_size = fxdr_unsigned(u_int32_t, fp->fa2_size); + vap->va_blocksize = fxdr_unsigned(int32_t, fp->fa2_blocksize); + vap->va_bytes = (u_quad_t)fxdr_unsigned(int32_t, fp->fa2_blocks) + * NFS_FABLKSIZE; + vap->va_fileid = fxdr_unsigned(int32_t, fp->fa2_fileid); + fxdr_nfsv2time(&fp->fa2_atime, &vap->va_atime); + vap->va_flags = 0; + vap->va_ctime.tv_sec = fxdr_unsigned(u_int32_t, + fp->fa2_ctime.nfsv2_sec); + vap->va_ctime.tv_nsec = 0; + vap->va_gen = fxdr_unsigned(u_int32_t, fp->fa2_ctime.nfsv2_usec); + vap->va_filerev = 0; + } + np->n_attrstamp = time_second; + /* Timestamp the NFS otw getattr fetch */ + if (td->td_proc) { + np->n_ac_ts_tid = td->td_tid; + np->n_ac_ts_pid = td->td_proc->p_pid; + np->n_ac_ts_syscalls = td->td_syscalls; + } else + bzero(&np->n_ac_ts, sizeof(struct nfs_attrcache_timestamp)); + + if (vap->va_size != np->n_size) { + if (vap->va_type == VREG) { + if (dontshrink && vap->va_size < np->n_size) { + /* + * We've been told not to shrink the file; + * zero np->n_attrstamp to indicate that + * the attributes are stale. + */ + vap->va_size = np->n_size; + np->n_attrstamp = 0; + } else if (np->n_flag & NMODIFIED) { + /* + * We've modified the file: Use the larger + * of our size, and the server's size. + */ + if (vap->va_size < np->n_size) { + vap->va_size = np->n_size; + } else { + np->n_size = vap->va_size; + np->n_flag |= NSIZECHANGED; + } + } else { + np->n_size = vap->va_size; + np->n_flag |= NSIZECHANGED; + } + vnode_pager_setsize(vp, np->n_size); + } else { + np->n_size = vap->va_size; + } + } + /* + * The following checks are added to prevent a race between (say) + * a READDIR+ and a WRITE. + * READDIR+, WRITE requests sent out. + * READDIR+ resp, WRITE resp received on client. + * However, the WRITE resp was handled before the READDIR+ resp + * causing the post op attrs from the write to be loaded first + * and the attrs from the READDIR+ to be loaded later. If this + * happens, we have stale attrs loaded into the attrcache. + * We detect this by for the mtime moving back. We invalidate the + * attrcache when this happens. + */ + if (timespeccmp(&mtime_save, &vap->va_mtime, >)) + /* Size changed or mtime went backwards */ + np->n_attrstamp = 0; + if (vaper != NULL) { + bcopy((caddr_t)vap, (caddr_t)vaper, sizeof(*vap)); + if (np->n_flag & NCHG) { + if (np->n_flag & NACC) + vaper->va_atime = np->n_atim; + if (np->n_flag & NUPD) + vaper->va_mtime = np->n_mtim; + } + } + mtx_unlock(&np->n_mtx); + return (0); +} + +#ifdef NFS_ACDEBUG +#include +SYSCTL_DECL(_vfs_nfs); +static int nfs_acdebug; +SYSCTL_INT(_vfs_nfs, OID_AUTO, acdebug, CTLFLAG_RW, &nfs_acdebug, 0, ""); +#endif + +/* + * Check the time stamp + * If the cache is valid, copy contents to *vap and return 0 + * otherwise return an error + */ +int +nfs_getattrcache(struct vnode *vp, struct vattr *vaper) +{ + struct nfsnode *np; + struct vattr *vap; + struct nfsmount *nmp; + int timeo; + + np = VTONFS(vp); + vap = &np->n_vattr; + nmp = VFSTONFS(vp->v_mount); +#ifdef NFS_ACDEBUG + mtx_lock(&Giant); /* nfs_printf() */ +#endif + mtx_lock(&np->n_mtx); + /* XXX n_mtime doesn't seem to be updated on a miss-and-reload */ + timeo = (time_second - np->n_mtime.tv_sec) / 10; + +#ifdef NFS_ACDEBUG + if (nfs_acdebug>1) + nfs_printf("nfs_getattrcache: initial timeo = %d\n", timeo); +#endif + + if (vap->va_type == VDIR) { + if ((np->n_flag & NMODIFIED) || timeo < nmp->nm_acdirmin) + timeo = nmp->nm_acdirmin; + else if (timeo > nmp->nm_acdirmax) + timeo = nmp->nm_acdirmax; + } else { + if ((np->n_flag & NMODIFIED) || timeo < nmp->nm_acregmin) + timeo = nmp->nm_acregmin; + else if (timeo > nmp->nm_acregmax) + timeo = nmp->nm_acregmax; + } + +#ifdef NFS_ACDEBUG + if (nfs_acdebug > 2) + nfs_printf("acregmin %d; acregmax %d; acdirmin %d; acdirmax %d\n", + nmp->nm_acregmin, nmp->nm_acregmax, + nmp->nm_acdirmin, nmp->nm_acdirmax); + + if (nfs_acdebug) + nfs_printf("nfs_getattrcache: age = %d; final timeo = %d\n", + (time_second - np->n_attrstamp), timeo); +#endif + + if ((time_second - np->n_attrstamp) >= timeo) { + nfsstats.attrcache_misses++; + mtx_unlock(&np->n_mtx); + return( ENOENT); + } + nfsstats.attrcache_hits++; + if (vap->va_size != np->n_size) { + if (vap->va_type == VREG) { + if (np->n_flag & NMODIFIED) { + if (vap->va_size < np->n_size) + vap->va_size = np->n_size; + else + np->n_size = vap->va_size; + } else { + np->n_size = vap->va_size; + } + vnode_pager_setsize(vp, np->n_size); + } else { + np->n_size = vap->va_size; + } + } + bcopy((caddr_t)vap, (caddr_t)vaper, sizeof(struct vattr)); + if (np->n_flag & NCHG) { + if (np->n_flag & NACC) + vaper->va_atime = np->n_atim; + if (np->n_flag & NUPD) + vaper->va_mtime = np->n_mtim; + } + mtx_unlock(&np->n_mtx); +#ifdef NFS_ACDEBUG + mtx_unlock(&Giant); /* nfs_printf() */ +#endif + return (0); +} + +static nfsuint64 nfs_nullcookie = { { 0, 0 } }; +/* + * This function finds the directory cookie that corresponds to the + * logical byte offset given. + */ +nfsuint64 * +nfs_getcookie(struct nfsnode *np, off_t off, int add) +{ + struct nfsdmap *dp, *dp2; + int pos; + nfsuint64 *retval = NULL; + + pos = (uoff_t)off / NFS_DIRBLKSIZ; + if (pos == 0 || off < 0) { +#ifdef DIAGNOSTIC + if (add) + panic("nfs getcookie add at <= 0"); +#endif + return (&nfs_nullcookie); + } + pos--; + dp = LIST_FIRST(&np->n_cookies); + if (!dp) { + if (add) { + MALLOC(dp, struct nfsdmap *, sizeof (struct nfsdmap), + M_NFSDIROFF, M_WAITOK); + dp->ndm_eocookie = 0; + LIST_INSERT_HEAD(&np->n_cookies, dp, ndm_list); + } else + goto out; + } + while (pos >= NFSNUMCOOKIES) { + pos -= NFSNUMCOOKIES; + if (LIST_NEXT(dp, ndm_list)) { + if (!add && dp->ndm_eocookie < NFSNUMCOOKIES && + pos >= dp->ndm_eocookie) + goto out; + dp = LIST_NEXT(dp, ndm_list); + } else if (add) { + MALLOC(dp2, struct nfsdmap *, sizeof (struct nfsdmap), + M_NFSDIROFF, M_WAITOK); + dp2->ndm_eocookie = 0; + LIST_INSERT_AFTER(dp, dp2, ndm_list); + dp = dp2; + } else + goto out; + } + if (pos >= dp->ndm_eocookie) { + if (add) + dp->ndm_eocookie = pos + 1; + else + goto out; + } + retval = &dp->ndm_cookies[pos]; +out: + return (retval); +} + +/* + * Invalidate cached directory information, except for the actual directory + * blocks (which are invalidated separately). + * Done mainly to avoid the use of stale offset cookies. + */ +void +nfs_invaldir(struct vnode *vp) +{ + struct nfsnode *np = VTONFS(vp); + +#ifdef DIAGNOSTIC + if (vp->v_type != VDIR) + panic("nfs: invaldir not dir"); +#endif + nfs_dircookie_lock(np); + np->n_direofoffset = 0; + np->n_cookieverf.nfsuquad[0] = 0; + np->n_cookieverf.nfsuquad[1] = 0; + if (LIST_FIRST(&np->n_cookies)) + LIST_FIRST(&np->n_cookies)->ndm_eocookie = 0; + nfs_dircookie_unlock(np); +} + +/* + * The write verifier has changed (probably due to a server reboot), so all + * B_NEEDCOMMIT blocks will have to be written again. Since they are on the + * dirty block list as B_DELWRI, all this takes is clearing the B_NEEDCOMMIT + * and B_CLUSTEROK flags. Once done the new write verifier can be set for the + * mount point. + * + * B_CLUSTEROK must be cleared along with B_NEEDCOMMIT because stage 1 data + * writes are not clusterable. + */ +void +nfs_clearcommit(struct mount *mp) +{ + struct vnode *vp, *nvp; + struct buf *bp, *nbp; + struct bufobj *bo; + + MNT_ILOCK(mp); + MNT_VNODE_FOREACH(vp, mp, nvp) { + bo = &vp->v_bufobj; + VI_LOCK(vp); + if (vp->v_iflag & VI_DOOMED) { + VI_UNLOCK(vp); + continue; + } + vholdl(vp); + VI_UNLOCK(vp); + MNT_IUNLOCK(mp); + BO_LOCK(bo); + TAILQ_FOREACH_SAFE(bp, &bo->bo_dirty.bv_hd, b_bobufs, nbp) { + if (!BUF_ISLOCKED(bp) && + (bp->b_flags & (B_DELWRI | B_NEEDCOMMIT)) + == (B_DELWRI | B_NEEDCOMMIT)) + bp->b_flags &= ~(B_NEEDCOMMIT | B_CLUSTEROK); + } + BO_UNLOCK(bo); + vdrop(vp); + MNT_ILOCK(mp); + } + MNT_IUNLOCK(mp); +} + +/* + * Helper functions for former macros. Some of these should be + * moved to their callers. + */ + +int +nfsm_mtofh_xx(struct vnode *d, struct vnode **v, int v3, int *f, + struct mbuf **md, caddr_t *dpos) +{ + struct nfsnode *ttnp; + struct vnode *ttvp; + nfsfh_t *ttfhp; + u_int32_t *tl; + int ttfhsize; + int t1; + + if (v3) { + tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); + if (tl == NULL) + return EBADRPC; + *f = fxdr_unsigned(int, *tl); + } else + *f = 1; + if (*f) { + t1 = nfsm_getfh_xx(&ttfhp, &ttfhsize, (v3), md, dpos); + if (t1 != 0) + return t1; + t1 = nfs_nget(d->v_mount, ttfhp, ttfhsize, &ttnp, LK_EXCLUSIVE); + if (t1 != 0) + return t1; + *v = NFSTOV(ttnp); + } + if (v3) { + tl = nfsm_dissect_xx(NFSX_UNSIGNED, md, dpos); + if (tl == NULL) + return EBADRPC; + if (*f) + *f = fxdr_unsigned(int, *tl); + else if (fxdr_unsigned(int, *tl)) + nfsm_adv_xx(NFSX_V3FATTR, md, dpos); + } + if (*f) { + ttvp = *v; + t1 = nfs_loadattrcache(&ttvp, md, dpos, NULL, 0); + if (t1) + return t1; + *v = ttvp; + } + return 0; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Wed Oct 15 14:32:43 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C2CCC1065693; Wed, 15 Oct 2008 14:32:43 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B0C6C8FC15; Wed, 15 Oct 2008 14:32:43 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9FEWhqI035911; Wed, 15 Oct 2008 14:32:43 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9FEWhUr035909; Wed, 15 Oct 2008 14:32:43 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810151432.m9FEWhUr035909@svn.freebsd.org> From: Alexander Leidinger Date: Wed, 15 Oct 2008 14:32:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183914 - in user/netchild/coverity/src/sys: nfsclient nfsserver X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Oct 2008 14:32:43 -0000 Author: netchild Date: Wed Oct 15 14:32:43 2008 New Revision: 183914 URL: http://svn.freebsd.org/changeset/base/183914 Log: Fixes (probably) for CID 1076 and 1528. Found by: Coverity Prevent Modified: user/netchild/coverity/src/sys/nfsclient/nfs_subs.c user/netchild/coverity/src/sys/nfsserver/nfs_serv.c Modified: user/netchild/coverity/src/sys/nfsclient/nfs_subs.c ============================================================================== --- user/netchild/coverity/src/sys/nfsclient/nfs_subs.c Wed Oct 15 14:29:35 2008 (r183913) +++ user/netchild/coverity/src/sys/nfsclient/nfs_subs.c Wed Oct 15 14:32:43 2008 (r183914) @@ -980,8 +980,12 @@ nfsm_mtofh_xx(struct vnode *d, struct vn return EBADRPC; if (*f) *f = fxdr_unsigned(int, *tl); - else if (fxdr_unsigned(int, *tl)) - nfsm_adv_xx(NFSX_V3FATTR, md, dpos); + else if (fxdr_unsigned(int, *tl)) { + /* XXX: CID 1076, NFSM_ADV() can be used instead too */ + t1 = nfsm_adv_xx(NFSX_V3FATTR, md, dpos); + if (t1 != 0) + return EBADRPC; + } } if (*f) { ttvp = *v; Modified: user/netchild/coverity/src/sys/nfsserver/nfs_serv.c ============================================================================== --- user/netchild/coverity/src/sys/nfsserver/nfs_serv.c Wed Oct 15 14:29:35 2008 (r183913) +++ user/netchild/coverity/src/sys/nfsserver/nfs_serv.c Wed Oct 15 14:32:43 2008 (r183914) @@ -4062,7 +4062,14 @@ nfsrv_fsinfo(struct nfsrv_descript *nfsd } /* XXX Try to make a guess on the max file size. */ - VFS_STATFS(vp->v_mount, &sb, curthread); + error = VFS_STATFS(vp->v_mount, &sb, curthread); + if (error) { + /* XXX: CID 1528 */ + nfsm_reply(NFSX_UNSIGNED); + nfsm_srvpostop_attr(getret, &at); + error = 0; + goto nfsmout; + } maxfsize = (u_quad_t)0x80000000 * sb.f_bsize - 1; getret = VOP_GETATTR(vp, &at, cred); From owner-svn-src-user@FreeBSD.ORG Wed Oct 15 14:35:03 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BCB2D1065694; Wed, 15 Oct 2008 14:35:03 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AA8D18FC27; Wed, 15 Oct 2008 14:35:03 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9FEZ3EQ036005; Wed, 15 Oct 2008 14:35:03 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9FEZ3MO036003; Wed, 15 Oct 2008 14:35:03 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810151435.m9FEZ3MO036003@svn.freebsd.org> From: Alexander Leidinger Date: Wed, 15 Oct 2008 14:35:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183915 - in user/netchild/deskjail/src: sys/kern usr.sbin/jail X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Oct 2008 14:35:03 -0000 Author: netchild Date: Wed Oct 15 14:35:03 2008 New Revision: 183915 URL: http://svn.freebsd.org/changeset/base/183915 Log: Add 2 sysctl's to allow access to /dev/io either in all jails, or in a specific jail. Use at your own risk, it opens up the machine. This allows to run a X server in a jail. Modified: user/netchild/deskjail/src/sys/kern/kern_jail.c user/netchild/deskjail/src/usr.sbin/jail/jail.8 Modified: user/netchild/deskjail/src/sys/kern/kern_jail.c ============================================================================== --- user/netchild/deskjail/src/sys/kern/kern_jail.c Wed Oct 15 14:32:43 2008 (r183914) +++ user/netchild/deskjail/src/sys/kern/kern_jail.c Wed Oct 15 14:35:03 2008 (r183915) @@ -80,6 +80,17 @@ SYSCTL_INT(_security_jail, OID_AUTO, mou &jail_mount_allowed, 0, "Processes in jail can mount/unmount jail-friendly file systems"); +static int jail_dev_io_access_allowed = 0; +SYSCTL_INT(_security_jail, OID_AUTO, dev_io_access_allowed, CTLFLAG_RW, + &jail_dev_io_access_allowed, 0, + "Processes in all jails can get access to /dev/io if available"); + +static char jail_dev_io_access_allowed_hostname[MAXHOSTNAMELEN] = ""; +SYSCTL_STRING(_security_jail, OID_AUTO, dev_io_access_allowed_hostname, + CTLFLAG_RW, jail_dev_io_access_allowed_hostname, + sizeof(jail_dev_io_access_allowed_hostname), + "Hostname of specific jail which can get access to /dev/io if available"); + /* allprison, lastprid, and prisoncount are protected by allprison_lock. */ struct prisonlist allprison; struct sx allprison_lock; @@ -752,6 +763,26 @@ prison_priv_check(struct ucred *cred, in case PRIV_NETINET_GETCRED: return (0); + /* + * Allow access to /dev/io in a jail if the non-jailed admin + * requests this and if /dev/io exists in the jail. This + * allows Xorg to probe a card. + */ + case PRIV_IO: + if (jail_dev_io_access_allowed) + return (0); + + { + char jail_hostname[MAXHOSTNAMELEN]; + + getcredhostname(cred, jail_hostname, MAXHOSTNAMELEN); + if (strncasecmp(jail_dev_io_access_allowed_hostname, + jail_hostname, MAXHOSTNAMELEN) == 0) + return (0); + } + + return (EPERM); + default: /* * In all remaining cases, deny the privilege request. This Modified: user/netchild/deskjail/src/usr.sbin/jail/jail.8 ============================================================================== --- user/netchild/deskjail/src/usr.sbin/jail/jail.8 Wed Oct 15 14:32:43 2008 (r183914) +++ user/netchild/deskjail/src/usr.sbin/jail/jail.8 Wed Oct 15 14:35:03 2008 (r183915) @@ -33,7 +33,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 5, 2007 +.Dd March 10, 2008 .Dt JAIL 8 .Os .Sh NAME @@ -546,6 +546,38 @@ or clear system file flags; if non-zero, privileged, and may manipulate system file flags subject to the usual constraints on .Va kern.securelevel . +.It Va security.jail.dev_io_access_allowed +This MIB entry determines if a privileged user inside +.Va every +jail will be able to access +.Pa /dev/io +in case +.Xr devfs 8 +is used to show +.Pa /dev/io +in a jail. +The default value of 0 does not allow access even if +.Pa /dev/io +is visible in a jail. +A value of 1 allowes access in a jail. +This sysctl should not be used to give this access rights to only one +specific jail. +To give access to only one specific jail the sysctl +.Va security.jail.dev_io_access_allowed_hostname +should be used instead. +.It Va security.jail.dev_io_access_allowed_hostname +This MIB entry determines if a privileged user only inside the +.Va specified +jail will be able to access +.Pa /dev/io +in case +.Xr devfs 8 +is used to show +.Pa /dev/io +in a jail. +The string-value of this sysctl is compared case-insensitive with the hostname +of the jail. +Access is allowed if the string matches. .It Va security.jail.mount_allowed This MIB entry determines if a privileged user inside a jail will be able to mount and unmount file system types marked as jail-friendly. From owner-svn-src-user@FreeBSD.ORG Wed Oct 15 14:36:04 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 526ED1065688; Wed, 15 Oct 2008 14:36:04 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 419438FC48; Wed, 15 Oct 2008 14:36:04 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9FEa41B036056; Wed, 15 Oct 2008 14:36:04 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9FEa4hg036055; Wed, 15 Oct 2008 14:36:04 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810151436.m9FEa4hg036055@svn.freebsd.org> From: Alexander Leidinger Date: Wed, 15 Oct 2008 14:36:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183916 - user/netchild/deskjail/src/etc/defaults X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Oct 2008 14:36:04 -0000 Author: netchild Date: Wed Oct 15 14:36:03 2008 New Revision: 183916 URL: http://svn.freebsd.org/changeset/base/183916 Log: Add some more devfs rules which are needed when you want to run a X server in a jail. Without them you don't have much fun... Modified: user/netchild/deskjail/src/etc/defaults/devfs.rules Modified: user/netchild/deskjail/src/etc/defaults/devfs.rules ============================================================================== --- user/netchild/deskjail/src/etc/defaults/devfs.rules Wed Oct 15 14:35:03 2008 (r183915) +++ user/netchild/deskjail/src/etc/defaults/devfs.rules Wed Oct 15 14:36:03 2008 (r183916) @@ -67,3 +67,68 @@ add path stderr unhide add include $devfsrules_hide_all add include $devfsrules_unhide_basic add include $devfsrules_unhide_login + +[devfsrules_unhide_audio=5] +add path 'audio*' unhide +add path 'dsp*' unhide +add path midistat unhide +add path 'mixer*' unhide +add path 'music*' unhide +add path 'sequencer*' unhide +add path sndstat unhide +add path speaker unhide + +[devfsrules_unhide_printers=6] +add path 'lpt*' unhide +add path 'ulpt*' unhide +add path 'unlpt*' unhide + +[devfsrules_unhide_input=7] +add path 'atkbd*' unhide +add path 'kbd*' unhide +add path 'joy*' unhide +add path 'psm*' unhide +add path sysmouse unhide +add path 'ukbd*' unhide +add path 'ums*' unhide + +[devfsrules_unhide_xorg=8] +add path agpgart unhide +#add path console unhide +add path dri unhide +add path 'dri*' unhide +add path io unhide +add path mem unhide +#add path pci unhide +add path tty unhide +add path ttyv0 unhide +add path ttyv1 unhide +add path ttyv8 unhide + +[devfsrules_unhide_cddvd=9] +add path 'da*' unhide +add path 'cd*' unhide +add path 'cd*' mode 0666 +add path 'pass*' unhide +add path 'xpt*' unhide +add path 'acd*' unhide +add path 'acd*' mode 0666 + +[devfsrules_unhide_kmem=10] +add path kmem unhide + +# +# This allows to run a desktop system in a jail. Think about what you want to +# achieve before you use this, it opens up the entire machine to access from +# this jail to any sophisticated program. +# +[devfsrules_jail_desktop=11] +add include $devfsrules_hide_all +add include $devfsrules_unhide_basic +add include $devfsrules_unhide_login +add include $devfsrules_unhide_audio +add include $devfsrules_unhide_input +add include $devfsrules_unhide_xorg +add include $devfsrules_unhide_cddvd +add include $devfsrules_unhide_kmem + From owner-svn-src-user@FreeBSD.ORG Wed Oct 15 14:38:36 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A23A10656A6; Wed, 15 Oct 2008 14:38:36 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EB0618FC08; Wed, 15 Oct 2008 14:38:35 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9FEcZnF036138; Wed, 15 Oct 2008 14:38:35 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9FEcZfN036130; Wed, 15 Oct 2008 14:38:35 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810151438.m9FEcZfN036130@svn.freebsd.org> From: Alexander Leidinger Date: Wed, 15 Oct 2008 14:38:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183917 - in user/netchild/jailmount/src/sys: fs/cd9660 fs/msdosfs fs/ntfs fs/nullfs fs/smbfs fs/udf fs/unionfs nfsclient X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Oct 2008 14:38:36 -0000 Author: netchild Date: Wed Oct 15 14:38:35 2008 New Revision: 183917 URL: http://svn.freebsd.org/changeset/base/183917 Log: Allow to mount some more FSes from within a jail. Do not use this for your production jails, a jail may be able to panic a machine with this. If you want to play around (and harden some FSes), go ahead and merge it into your tree. Modified: user/netchild/jailmount/src/sys/fs/cd9660/cd9660_vfsops.c user/netchild/jailmount/src/sys/fs/msdosfs/msdosfs_vfsops.c user/netchild/jailmount/src/sys/fs/ntfs/ntfs_vfsops.c user/netchild/jailmount/src/sys/fs/nullfs/null_vfsops.c user/netchild/jailmount/src/sys/fs/smbfs/smbfs_vfsops.c user/netchild/jailmount/src/sys/fs/udf/udf_vfsops.c user/netchild/jailmount/src/sys/fs/unionfs/union_vfsops.c user/netchild/jailmount/src/sys/nfsclient/nfs_vfsops.c Modified: user/netchild/jailmount/src/sys/fs/cd9660/cd9660_vfsops.c ============================================================================== --- user/netchild/jailmount/src/sys/fs/cd9660/cd9660_vfsops.c Wed Oct 15 14:36:03 2008 (r183916) +++ user/netchild/jailmount/src/sys/fs/cd9660/cd9660_vfsops.c Wed Oct 15 14:38:35 2008 (r183917) @@ -85,7 +85,7 @@ static struct vfsops cd9660_vfsops = { .vfs_unmount = cd9660_unmount, .vfs_vget = cd9660_vget, }; -VFS_SET(cd9660_vfsops, cd9660, VFCF_READONLY); +VFS_SET(cd9660_vfsops, cd9660, VFCF_READONLY|VFCF_JAIL); MODULE_VERSION(cd9660, 1); static int iso_mountfs(struct vnode *devvp, struct mount *mp); Modified: user/netchild/jailmount/src/sys/fs/msdosfs/msdosfs_vfsops.c ============================================================================== --- user/netchild/jailmount/src/sys/fs/msdosfs/msdosfs_vfsops.c Wed Oct 15 14:36:03 2008 (r183916) +++ user/netchild/jailmount/src/sys/fs/msdosfs/msdosfs_vfsops.c Wed Oct 15 14:38:35 2008 (r183917) @@ -968,5 +968,5 @@ static struct vfsops msdosfs_vfsops = { .vfs_unmount = msdosfs_unmount, }; -VFS_SET(msdosfs_vfsops, msdosfs, 0); +VFS_SET(msdosfs_vfsops, msdosfs, VFCF_JAIL); MODULE_VERSION(msdosfs, 1); Modified: user/netchild/jailmount/src/sys/fs/ntfs/ntfs_vfsops.c ============================================================================== --- user/netchild/jailmount/src/sys/fs/ntfs/ntfs_vfsops.c Wed Oct 15 14:36:03 2008 (r183916) +++ user/netchild/jailmount/src/sys/fs/ntfs/ntfs_vfsops.c Wed Oct 15 14:38:35 2008 (r183917) @@ -791,5 +791,5 @@ static struct vfsops ntfs_vfsops = { .vfs_unmount = ntfs_unmount, .vfs_vget = ntfs_vget, }; -VFS_SET(ntfs_vfsops, ntfs, 0); +VFS_SET(ntfs_vfsops, ntfs, VFCF_JAIL); MODULE_VERSION(ntfs, 1); Modified: user/netchild/jailmount/src/sys/fs/nullfs/null_vfsops.c ============================================================================== --- user/netchild/jailmount/src/sys/fs/nullfs/null_vfsops.c Wed Oct 15 14:36:03 2008 (r183916) +++ user/netchild/jailmount/src/sys/fs/nullfs/null_vfsops.c Wed Oct 15 14:38:35 2008 (r183917) @@ -368,4 +368,4 @@ static struct vfsops null_vfsops = { .vfs_vget = nullfs_vget, }; -VFS_SET(null_vfsops, nullfs, VFCF_LOOPBACK); +VFS_SET(null_vfsops, nullfs, VFCF_LOOPBACK|VFCF_JAIL); Modified: user/netchild/jailmount/src/sys/fs/smbfs/smbfs_vfsops.c ============================================================================== --- user/netchild/jailmount/src/sys/fs/smbfs/smbfs_vfsops.c Wed Oct 15 14:36:03 2008 (r183916) +++ user/netchild/jailmount/src/sys/fs/smbfs/smbfs_vfsops.c Wed Oct 15 14:38:35 2008 (r183917) @@ -95,7 +95,7 @@ static struct vfsops smbfs_vfsops = { }; -VFS_SET(smbfs_vfsops, smbfs, VFCF_NETWORK); +VFS_SET(smbfs_vfsops, smbfs, VFCF_NETWORK|VFCF_JAIL); MODULE_DEPEND(smbfs, netsmb, NSMB_VERSION, NSMB_VERSION, NSMB_VERSION); MODULE_DEPEND(smbfs, libiconv, 1, 1, 2); Modified: user/netchild/jailmount/src/sys/fs/udf/udf_vfsops.c ============================================================================== --- user/netchild/jailmount/src/sys/fs/udf/udf_vfsops.c Wed Oct 15 14:36:03 2008 (r183916) +++ user/netchild/jailmount/src/sys/fs/udf/udf_vfsops.c Wed Oct 15 14:38:35 2008 (r183917) @@ -130,7 +130,7 @@ static struct vfsops udf_vfsops = { .vfs_unmount = udf_unmount, .vfs_vget = udf_vget, }; -VFS_SET(udf_vfsops, udf, VFCF_READONLY); +VFS_SET(udf_vfsops, udf, VFCF_READONLY|VFCF_JAIL); MODULE_VERSION(udf, 1); Modified: user/netchild/jailmount/src/sys/fs/unionfs/union_vfsops.c ============================================================================== --- user/netchild/jailmount/src/sys/fs/unionfs/union_vfsops.c Wed Oct 15 14:36:03 2008 (r183916) +++ user/netchild/jailmount/src/sys/fs/unionfs/union_vfsops.c Wed Oct 15 14:38:35 2008 (r183917) @@ -560,4 +560,4 @@ static struct vfsops unionfs_vfsops = { .vfs_vget = unionfs_vget, }; -VFS_SET(unionfs_vfsops, unionfs, VFCF_LOOPBACK); +VFS_SET(unionfs_vfsops, unionfs, VFCF_LOOPBACK|VFCF_JAIL); Modified: user/netchild/jailmount/src/sys/nfsclient/nfs_vfsops.c ============================================================================== --- user/netchild/jailmount/src/sys/nfsclient/nfs_vfsops.c Wed Oct 15 14:36:03 2008 (r183916) +++ user/netchild/jailmount/src/sys/nfsclient/nfs_vfsops.c Wed Oct 15 14:38:35 2008 (r183917) @@ -134,7 +134,7 @@ static struct vfsops nfs_vfsops = { .vfs_unmount = nfs_unmount, .vfs_sysctl = nfs_sysctl, }; -VFS_SET(nfs_vfsops, nfs, VFCF_NETWORK); +VFS_SET(nfs_vfsops, nfs, VFCF_NETWORK|VFCF_JAIL); /* So that loader and kldload(2) can find us, wherever we are.. */ MODULE_VERSION(nfs, 1); From owner-svn-src-user@FreeBSD.ORG Wed Oct 15 14:42:35 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91D4D1065692; Wed, 15 Oct 2008 14:42:35 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7CBFD8FC1F; Wed, 15 Oct 2008 14:42:35 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9FEgZCG036243; Wed, 15 Oct 2008 14:42:35 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9FEgZAt036237; Wed, 15 Oct 2008 14:42:35 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810151442.m9FEgZAt036237@svn.freebsd.org> From: Alexander Leidinger Date: Wed, 15 Oct 2008 14:42:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183918 - in user/netchild/linuxaio/src/sys: amd64/conf amd64/linux32 compat compat/linux conf i386/conf i386/linux kern modules modules/aio modules/linuxaio pc98/conf sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Oct 2008 14:42:35 -0000 Author: netchild Date: Wed Oct 15 14:42:34 2008 New Revision: 183918 URL: http://svn.freebsd.org/changeset/base/183918 Log: The most recent version (not from this year...) of Introns linux aio compatibility shim. The major flaws of the previous version should be fixed, but this needs to be verified. Submitted by: Li, Xiao Added: user/netchild/linuxaio/src/sys/compat/ user/netchild/linuxaio/src/sys/compat/linux/ user/netchild/linuxaio/src/sys/compat/linux/linux_aio.c (contents, props changed) user/netchild/linuxaio/src/sys/compat/linux/linux_aio.h (contents, props changed) user/netchild/linuxaio/src/sys/modules/linuxaio/ user/netchild/linuxaio/src/sys/modules/linuxaio/Makefile (contents, props changed) Modified: user/netchild/linuxaio/src/sys/amd64/conf/NOTES user/netchild/linuxaio/src/sys/amd64/linux32/linux.h user/netchild/linuxaio/src/sys/amd64/linux32/linux32_dummy.c user/netchild/linuxaio/src/sys/amd64/linux32/syscalls.master user/netchild/linuxaio/src/sys/conf/files.i386 user/netchild/linuxaio/src/sys/conf/files.pc98 user/netchild/linuxaio/src/sys/conf/options.amd64 user/netchild/linuxaio/src/sys/conf/options.i386 user/netchild/linuxaio/src/sys/conf/options.pc98 user/netchild/linuxaio/src/sys/i386/conf/NOTES user/netchild/linuxaio/src/sys/i386/linux/linux.h user/netchild/linuxaio/src/sys/i386/linux/linux_dummy.c user/netchild/linuxaio/src/sys/i386/linux/syscalls.master user/netchild/linuxaio/src/sys/kern/vfs_aio.c user/netchild/linuxaio/src/sys/modules/Makefile user/netchild/linuxaio/src/sys/modules/aio/Makefile user/netchild/linuxaio/src/sys/pc98/conf/NOTES user/netchild/linuxaio/src/sys/sys/aio.h Modified: user/netchild/linuxaio/src/sys/amd64/conf/NOTES ============================================================================== --- user/netchild/linuxaio/src/sys/amd64/conf/NOTES Wed Oct 15 14:38:35 2008 (r183917) +++ user/netchild/linuxaio/src/sys/amd64/conf/NOTES Wed Oct 15 14:42:34 2008 (r183918) @@ -443,16 +443,19 @@ options COMPAT_IA32 # Enable Linux ABI emulation #XXX#options COMPAT_LINUX -# Enable 32-bit Linux ABI emulation (requires COMPAT_43 and COMPAT_IA32) +# Enable 32-bit Linux ABI emulation (requires COMPAT_IA32) options COMPAT_LINUX32 # Enable the linux-like proc filesystem support (requires COMPAT_LINUX32 # and PSEUDOFS) options LINPROCFS -#Enable the linux-like sys filesystem support (requires COMPAT_LINUX32 +# Enable the linux-like sys filesystem support (requires COMPAT_LINUX32 # and PSEUDOFS) -options LINSYSFS +options LINSYSFS + +# Enable the linux aio support (requires COMPAT_LINUX32 and VFS_AIO) +options LINUXAIO # # SysVR4 ABI emulation Modified: user/netchild/linuxaio/src/sys/amd64/linux32/linux.h ============================================================================== --- user/netchild/linuxaio/src/sys/amd64/linux32/linux.h Wed Oct 15 14:38:35 2008 (r183917) +++ user/netchild/linuxaio/src/sys/amd64/linux32/linux.h Wed Oct 15 14:42:34 2008 (r183918) @@ -880,6 +880,8 @@ typedef int l_mqd_t; (LINUX_CLONE_VM | LINUX_CLONE_FS | LINUX_CLONE_FILES | \ LINUX_CLONE_SIGHAND | LINUX_CLONE_THREAD) +#include + /* robust futexes */ struct linux_robust_list { l_uintptr_t next; Modified: user/netchild/linuxaio/src/sys/amd64/linux32/linux32_dummy.c ============================================================================== --- user/netchild/linuxaio/src/sys/amd64/linux32/linux32_dummy.c Wed Oct 15 14:38:35 2008 (r183917) +++ user/netchild/linuxaio/src/sys/amd64/linux32/linux32_dummy.c Wed Oct 15 14:42:34 2008 (r183918) @@ -98,6 +98,11 @@ DUMMY(migrate_pages); DUMMY(pselect6); DUMMY(ppoll); DUMMY(unshare); +DUMMY(io_setup); +DUMMY(io_destroy); +DUMMY(io_getevents); +DUMMY(io_submit); +DUMMY(io_cancel); DUMMY(splice); DUMMY(sync_file_range); DUMMY(tee); Modified: user/netchild/linuxaio/src/sys/amd64/linux32/syscalls.master ============================================================================== --- user/netchild/linuxaio/src/sys/amd64/linux32/syscalls.master Wed Oct 15 14:38:35 2008 (r183917) +++ user/netchild/linuxaio/src/sys/amd64/linux32/syscalls.master Wed Oct 15 14:42:34 2008 (r183918) @@ -413,11 +413,11 @@ l_ulong *user_mask_ptr); } 243 AUE_NULL STD { int linux_set_thread_area(struct l_user_desc *desc); } 244 AUE_NULL UNIMPL linux_get_thread_area -245 AUE_NULL UNIMPL linux_io_setup -246 AUE_NULL UNIMPL linux_io_destroy -247 AUE_NULL UNIMPL linux_io_getevents -248 AUE_NULL UNIMPL inux_io_submit -249 AUE_NULL UNIMPL linux_io_cancel +245 AUE_NULL STD { int linux_io_setup(l_uint nr_reqs, linux_aio_context_t *ctxp); } +246 AUE_NULL STD { int linux_io_destroy(linux_aio_context_t ctx); } +247 AUE_NULL STD { int linux_io_getevents(linux_aio_context_t ctx_id, l_long min_nr, l_long nr, struct linux_io_event *events, struct l_timespec *timeout); } +248 AUE_NULL STD { int linux_io_submit(linux_aio_context_t ctx_id, l_long nr, struct linux_iocb **iocbpp); } +249 AUE_NULL STD { int linux_io_cancel(linux_aio_context_t ctx_id, struct linux_iocb *iocb, struct linux_io_event *result); } 250 AUE_NULL STD { int linux_fadvise64(void); } 251 AUE_NULL UNIMPL 252 AUE_EXIT STD { int linux_exit_group(int error_code); } Added: user/netchild/linuxaio/src/sys/compat/linux/linux_aio.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/netchild/linuxaio/src/sys/compat/linux/linux_aio.c Wed Oct 15 14:42:34 2008 (r183918) @@ -0,0 +1,1254 @@ +/*- + * Copyright (c) 2006 Li, Xiao . 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + */ +#include +__FBSDID("$FreeBSD$"); + +#include "opt_compat.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef COMPAT_LINUX32 +#include +#include +#else +#include +#include +#endif + +#define LINUX_AIO_DEBUG + +/* + * Linux Kernel Implementation of Asynchronous I/O + */ + +#ifdef LINUX_AIO_DEBUG + +/* Print arguments of syscall */ +#define DARGPRINTF(fmt, ...) printf("linux(%ld): %s("fmt")\n", \ + (long)td->td_proc->p_pid, __func__, __VA_ARGS__) +/* Print message in syscall function */ +#define DPRINTF(fmt, ...) printf(LMSG("%s(): " fmt), \ + __func__, __VA_ARGS__) +/* Print message in non-syscall function, the one more "P" means "private" */ +#define DPPRINTF(fmt, ...) printf("linux(): %s(): " fmt "\n", \ + __func__, __VA_ARGS__) + +#else + +#define DARGPRINTF(fmt, ...) +#define DPRINTF(fmt, ...) +#define DPPRINTF(fmt, ...) + +#endif + +/* + * DATA STRUCTURE HIERARCHY + * + * +--------------------+ +--------------------+ + * context_list ---> | context | ---> | context | ---> ... + * SLIST |(owned by a process)| |(owned by a process)| + * | | | | + * | ctx_req | | ctx_req | + * +----|---------------+ +----|---------------+ + * | STAILQ | STAILQ + * v v + * +------------+ +------------+ + * | request | | request | + * | | | | + * |.req_pbsd | |.req_pbsd | + * |.req_porig | |.req_porig | + * |.req_linux | |.req_linux | + * | | | | + * +------------+ +------------+ + * | | + * v v + * +------------+ +------------+ + * | request | | request | + * | | | | + * |.req_pbsd | |.req_pbsd | + * |.req_porig | |.req_porig | + * |.req_linux | |.req_linux | + * | | | | + * +------------+ +------------+ + * | | + * v v + * ... ... + */ + +struct linux_aio_context; + +struct linux_aio_request { + struct aiocb *req_pbsd; /* Userland clone for FreeBSD */ + struct linux_iocb *req_porig; /* Userland original control block */ + struct linux_iocb req_linux; /* Copy of original control block */ + STAILQ_ENTRY(linux_aio_request) req_ctx_entry; +}; + +struct linux_aio_context { + struct sx ctx_sx; + pid_t ctx_pid; + struct linux_aio_ring *ctx_pring; + int ctx_nreq_max; /* Maximum request number */ + int ctx_nreq_cur; /* Current request number */ + STAILQ_HEAD(,linux_aio_request) ctx_req; + SLIST_ENTRY(linux_aio_context) ctx_list_entry; +}; +static SLIST_HEAD(,linux_aio_context) linux_aio_context_list; + +#define LINUX_AIO_REQ_HOOK(pctx, preq) { \ + STAILQ_INSERT_TAIL(&((pctx)->ctx_req), (preq), req_ctx_entry); \ + (pctx)->ctx_nreq_cur ++; \ +} + +#define LINUX_AIO_REQ_UNHOOK(pctx, preq) { \ + STAILQ_REMOVE(&((pctx)->ctx_req), (preq), linux_aio_request, \ + req_ctx_entry); \ + (pctx)->ctx_nreq_cur --; \ +} + +#define LINUX_AIO_REQ_FOREACH(pctx, preq) \ + STAILQ_FOREACH((preq), &((pctx)->ctx_req), req_ctx_entry) + +#define LINUX_AIO_REQ_FOREACH_SAFE(pctx, preq, ptmpreq) \ + STAILQ_FOREACH_SAFE((preq), &((pctx)->ctx_req), req_ctx_entry, \ + (ptmpreq)) + +#define LINUX_AIO_CTX_LOCK(pctx) sx_xlock(&((pctx)->ctx_sx)) + +#define LINUX_AIO_CTX_UNLOCK(pctx) sx_unlock(&((pctx)->ctx_sx)) + +#define LINUX_AIO_CTX_HOOK(pctx) \ + SLIST_INSERT_HEAD(&linux_aio_context_list, (pctx), ctx_list_entry) + +#define LINUX_AIO_CTX_UNHOOK(pctx) \ + SLIST_REMOVE(&linux_aio_context_list, (pctx), \ + linux_aio_context, ctx_list_entry) + +#define LINUX_AIO_CTX_FOREACH(pctx) \ + SLIST_FOREACH((pctx), &linux_aio_context_list, ctx_list_entry) + +#define LINUX_AIO_CTX_FOREACH_SAFE(pctx, ptmpctx) \ + SLIST_FOREACH_SAFE((pctx), &linux_aio_context_list, \ + ctx_list_entry, (ptmpctx)) + +#define LINUX_AIO_CTX_MATCH(pctx, ctxid, pid) \ + ((linux_aio_context_t)(pctx)->ctx_pring == (ctxid) \ + && (pctx)->ctx_pid == (pid)) + +static struct mtx linux_aio_context_list_mtx; + +#define LINUX_AIO_CTX_LIST_LOCK() mtx_lock(&linux_aio_context_list_mtx) + +#define LINUX_AIO_CTX_LIST_UNLOCK() mtx_unlock(&linux_aio_context_list_mtx) + +/* + * The following two macros are substantially identical to the two macros + * AIO_(UN)LOCK in /sys/kern/vfs_aio.c. Thus, the mutex much be unlocked + * before calling functions of FreeBSD native AIO module. + * + * XXX + * I ASSUME the member "kaio_mtx" is the first element of "struct kaioinfo". + */ +#define LINUX_AIO_LOCK(p) { \ + if ((p)->p_aioinfo == NULL) \ + aio_init_aioinfo(p); \ + mtx_lock((struct mtx *)((p)->p_aioinfo)); \ +} + +#define LINUX_AIO_UNLOCK(p) { \ + if ((p)->p_aioinfo == NULL) \ + aio_init_aioinfo(p); \ + mtx_unlock((struct mtx *)((p)->p_aioinfo)); \ +} + +static uma_zone_t linux_aio_context_zone, linux_aio_request_zone; + +static eventhandler_tag linux_aio_exit_tag; + +/* + * To backup pointers to the dummy implementation of these + * system calls faked by the macro DUMMY() in linux_dummy.c. + */ +#define PREPARE_DUMMY_SYSCALL_BACKUP(s) \ + static sy_call_t *p_dummy_linux_ ## s +#define SHOW_REAL_SYSCALL(s) { \ + p_dummy_linux_ ## s = linux_sysent[LINUX_SYS_linux_ ## s].sy_call; \ + linux_sysent[LINUX_SYS_linux_ ## s].sy_call = \ + (sy_call_t *)(linux_ ## s); \ +} +/* + * The concept of "scope": the functions linux_io_xxx defined in this file + * always mask/screen/override/prevent homonymous functions defined in + * any other files. + */ +#define RESTORE_DUMMY_SYSCALL(s) { \ + linux_sysent[LINUX_SYS_linux_ ## s].sy_call = p_dummy_linux_ ## s; \ +} + +PREPARE_DUMMY_SYSCALL_BACKUP(io_setup); +PREPARE_DUMMY_SYSCALL_BACKUP(io_destroy); +PREPARE_DUMMY_SYSCALL_BACKUP(io_getevents); +PREPARE_DUMMY_SYSCALL_BACKUP(io_submit); +PREPARE_DUMMY_SYSCALL_BACKUP(io_cancel); + +/* + * Substantially defined in linux_sysent.c. + * Also declared in linux_sysvec.c. + */ +extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL]; + +static int user_mem_rw_verify(void *p, size_t s) +{ + char buf[256]; + size_t i; + int nerr = 0; + + for (i = 0; i < s; i += sizeof(buf)) { + /* Verify reading */ + nerr = copyin((char *)p+i, buf, MIN(sizeof(buf), s-i)); + if (nerr != 0) + break; + + /* Verify writing */ + nerr = copyout(buf, (char *)p+i, MIN(sizeof(buf), s-i)); + if (nerr != 0) + break; + } + + return (nerr); +} + +/* Allocate memory in user space */ +static int user_malloc(struct thread *td, void **pp, size_t s) +{ + struct mmap_args mmaparg; + int nerr; + register_t r; + + r = td->td_retval[0]; + + mmaparg.addr = NULL; + mmaparg.len = s; + mmaparg.prot = PROT_READ | PROT_WRITE; + mmaparg.flags = MAP_PRIVATE | MAP_ANON; + mmaparg.fd = -1; + mmaparg.pad = 0; + mmaparg.pos = 0; + + nerr = mmap(td, &mmaparg); + + if (nerr == 0) { + *pp = (void *)td->td_retval[0]; + DPPRINTF("%lu bytes allocated at %p", (unsigned long)s, *pp); + } + + td->td_retval[0] = r; + + return (nerr); +} + +/* Free memory in user space */ +static int user_free(struct thread *td, void *p, size_t s) +{ + struct munmap_args munmaparg; + int nerr; + register_t r; + + r = td->td_retval[0]; + + munmaparg.addr = p; + munmaparg.len = s; + + nerr = munmap(td, &munmaparg); + + td->td_retval[0] = r; + DPPRINTF("%lu bytes at %p", (unsigned long)s, p); + + return (nerr); +} + +#ifdef LINUX_AIO_DEBUG + +static void linux_aio_dump_freebsd_aiocb(struct aiocb *piocb, int isuserland) +{ + struct aiocb localcb, *pcb; + int nerr = 0; + + if (isuserland) { + nerr = copyin(piocb, &localcb, sizeof(localcb)); + pcb = &localcb; + } + else + pcb = piocb; + + DPPRINTF("Dump struct aiocb (%p, %s): %s", + piocb, (isuserland?"userland":"kernel"), + (nerr?"Failure":"")); + if (!nerr) { + DPPRINTF("aio_fildes: %d", + pcb->aio_fildes); + DPPRINTF("aio_offset: %lu", + (unsigned long) pcb->aio_offset); + DPPRINTF("aio_buf: %p", + pcb->aio_buf); + DPPRINTF("aio_nbytes: %lu", + (unsigned long) pcb->aio_nbytes); + DPPRINTF("aio_lio_opcode: %d", + pcb->aio_lio_opcode); + DPPRINTF("aio_reqprio: %d", + pcb->aio_reqprio); + DPPRINTF("aio_sigevent.sigev_notify: %d", + pcb->aio_sigevent.sigev_notify); + DPPRINTF("aio_sigevent.sigev_signo: %d", + pcb->aio_sigevent.sigev_signo); + } +} + +#define DUMP_FREEBSD_AIOCB(p, isu) linux_aio_dump_freebsd_aiocb((p), (isu)); + +#define DUMP_TIMESPEC(f, t ,a) \ + DPRINTF("%s%ld second + %ld nanosecond%s", \ + (f), (long)(t)->tv_sec, (long)(t)->tv_nsec, (a)); + +#else /* ! LINUX_AIO_DEBUG */ + +#define DUMP_FREEBSD_AIOCB(p, isu) +#define DUMP_TIMESPEC(f, t, a) + +#endif /* LINUX_AIO_DEBUG */ + +static int iocb_reformat(struct linux_iocb *plnx, struct aiocb *pbsd) +{ + int nerr = 0; + + bzero(pbsd, sizeof(*pbsd)); + + pbsd->aio_fildes = plnx->aio_fildes; /* File descriptor */ + pbsd->aio_offset = plnx->aio_offset; /* File offset for I/O */ + pbsd->aio_buf = (void *)(unsigned long) plnx->aio_buf; /* + * User space + * I/O buffer + */ + pbsd->aio_nbytes = plnx->aio_nbytes; /* Number of bytes for I/O */ + switch (plnx->aio_lio_opcode) { /* LIO opcode */ + case LINUX_IOCB_CMD_PREAD: + pbsd->aio_lio_opcode = LIO_READ; + break; + case LINUX_IOCB_CMD_PWRITE: + pbsd->aio_lio_opcode = LIO_WRITE; + break; + case LINUX_IOCB_CMD_FSYNC: + case LINUX_IOCB_CMD_FDSYNC: + pbsd->aio_lio_opcode = LIO_SYNC; + break; +#if 0 + case LINUX_IOCB_CMD_PREADX: + break; + case LINUX_IOCB_CMD_POLL: + break; +#endif + case LINUX_IOCB_CMD_NOOP: + pbsd->aio_lio_opcode = LIO_NOP; + break; + default: + nerr = EINVAL; + break; + } + if (nerr != 0) { + DPPRINTF("Unsupported aio_lio_opcode: %u", + (unsigned)plnx->aio_lio_opcode); + return (nerr); + } + pbsd->aio_reqprio = plnx->aio_reqprio; /* Request priority */ + pbsd->aio_sigevent.sigev_notify = SIGEV_NONE; /* No signal to deliver */ + pbsd->aio_sigevent.sigev_signo = 0; /* No signal to deliver */ + + return (nerr); +} + +/* Linux system call io_setup(2) */ +int linux_io_setup(struct thread *td, struct linux_io_setup_args *args) +{ + struct proc *p; + struct linux_aio_ring *pring, ring; + struct linux_aio_context *pctx = NULL, *ptmpctx; + linux_aio_context_t ctx_id; + int nerr = 0, nr, nrall, nq, arg_nr_reqs; + + DARGPRINTF("%u, %p", args->nr_reqs, args->ctxp); + + /* Signed integer is a little safer than unsigned */ + arg_nr_reqs = args->nr_reqs; + if (arg_nr_reqs <= 0) + return (EINVAL); + + if (arg_nr_reqs > max_aio_queue_per_proc + || arg_nr_reqs > max_aio_queue_count) { + printf(LMSG("linux_io_setup(): Please increase sysctls " + "vfs.aio.max_aio_queue_per_proc " + "and/or vfs.aio.max_aio_queue. ")); + return (ENOMEM); + } + + nerr = user_mem_rw_verify(args->ctxp, sizeof(*(args->ctxp))); + if (nerr != 0) + return (nerr); + + copyin(args->ctxp, &ctx_id, sizeof(ctx_id)); + if (ctx_id != 0) /* "Not initialized", described by io_setup(2) */ + return (EINVAL); + + p = td->td_proc; + + /* Get a new "ring" */ + nerr = user_malloc(td, (void **)&pring, sizeof(*pring)); + if (nerr != 0) + return (nerr); + + /* Get a new context */ + pctx = uma_zalloc(linux_aio_context_zone, M_WAITOK); + + LINUX_AIO_CTX_LIST_LOCK(); + + /* Count request capacity of all contexts belonging to this process */ + nr = 0; + nrall = 0; + nq = 0; + LINUX_AIO_CTX_FOREACH(ptmpctx) { + if (ptmpctx->ctx_pid == p->p_pid) { + nr += ptmpctx->ctx_nreq_max; + nq ++; + } + nrall += ptmpctx->ctx_nreq_max; + } + DPRINTF("%d queues of %d requests totally allocated for this process, " + "%d requests' total capacity for the whole system", + nq, nr, nrall); + + /* Check whether there are enough resources for requested queue */ + if (arg_nr_reqs > max_aio_queue_per_proc - nr + || arg_nr_reqs > max_aio_queue_count - nrall) { + printf(LMSG("linux_io_setup(): " + "Please increase sysctls " + "vfs.aio.max_aio_queue_per_proc " + "and/or vfs.aio.max_aio_queue. " + "Besides %d queues of %d requests totally " + "for this process, and %d requests' queues " + "totally for the whole system, " + "this Linux application needs one more " + "AIO queue of %d requests' capacity."), + nq, nr, nrall, arg_nr_reqs); + LINUX_AIO_CTX_LIST_UNLOCK(); + DPRINTF("Free context %p", pctx); + uma_zfree(linux_aio_context_zone, pctx); + user_free(td, pring, sizeof(*pring)); + return (ENOMEM); + } + + /* Initialize the new context */ + sx_init(&(pctx->ctx_sx), "linux_aio_context"); + pctx->ctx_pid = p->p_pid; + pctx->ctx_pring = pring; + pctx->ctx_nreq_max = arg_nr_reqs; + pctx->ctx_nreq_cur = 0; + STAILQ_INIT(&(pctx->ctx_req)); + + /* Hook the new context to global context list */ + LINUX_AIO_CTX_HOOK(pctx); + + LINUX_AIO_CTX_LIST_UNLOCK(); + + /* Initialize the new "ring" */ + DPRINTF("initialize the \"ring\" %p", pring); + bzero(&ring, sizeof(ring)); + ring.ring_id = 1; + ring.ring_nr = arg_nr_reqs; + ring.ring_head = 0; + ring.ring_tail = 1; + ring.ring_magic = LINUX_AIO_RING_MAGIC; + ring.ring_compat_features = LINUX_AIO_RING_COMPAT_FEATURES; + ring.ring_incompat_features = LINUX_AIO_RING_INCOMPAT_FEATURES; + ring.ring_header_length = sizeof(ring); + copyout(&ring, pring, sizeof(ring)); /* It has been hooked before */ + + /* Substantial return value */ + ctx_id = (linux_aio_context_t)pctx->ctx_pring; + copyout(&ctx_id, args->ctxp, sizeof(ctx_id)); + DPRINTF("returned context: %lx -> %p", (unsigned long)ctx_id, pctx); + + return (nerr); +} + +/* Linux system call io_destroy(2) */ +int linux_io_destroy(struct thread *td, struct linux_io_destroy_args *args) +{ + int nerr = 0; + struct proc *p; + struct linux_aio_context *pctx; + struct linux_aio_request *preq, *ptmpreq; + struct aio_cancel_args cancelargs; + struct aio_return_args aioretargs; + + DARGPRINTF("%lx", (unsigned long)args->ctx); + + p = td->td_proc; + + /* + * Locking: + * + * LINUX_AIO_LOCK(p); <----------------+ + * ... | + * LINUX_AIO_CTX_LIST_LOCK(); <--+ | + * ... | | + * LINUX_AIO_CTX_LIST_UNLOCK(); <--+ | + * ... | + * LINUX_AIO_CTX_LOCK(pctx); <---------|---+ + * LINUX_AIO_UNLOCK(p); <----------------+ | + * ... | + * LINUX_AIO_CTX_UNLOCK(pctx); <-------------+ + */ + + LINUX_AIO_LOCK(p); + + /* Find the context in context list */ + LINUX_AIO_CTX_LIST_LOCK(); + LINUX_AIO_CTX_FOREACH(pctx) { + if (LINUX_AIO_CTX_MATCH(pctx, args->ctx, p->p_pid)) + break; + } + LINUX_AIO_CTX_LIST_UNLOCK(); + + /* Unable to find the context */ + if (pctx == NULL) { + LINUX_AIO_UNLOCK(p); + return (EINVAL); + } + + DPRINTF("Found the context: %lx -> %p", (unsigned long)args->ctx, pctx); + + /* Unhook the context from context list */ + DPRINTF("Unhook context %p", pctx); + LINUX_AIO_CTX_UNHOOK(pctx); + + LINUX_AIO_CTX_LOCK(pctx); /* XXX Interlaced, seamless */ + LINUX_AIO_UNLOCK(p); /* XXX Interlaced, seamless */ + + /* Real cleanup */ + LINUX_AIO_REQ_FOREACH_SAFE(pctx, preq, ptmpreq) { + DPRINTF("Cancel request (Linux: %p, FreeBSD: %p)", + preq->req_porig, preq->req_pbsd); + + /* Cancel FreeBSD native clone */ + cancelargs.fd = preq->req_linux.aio_fildes; + cancelargs.aiocbp = preq->req_pbsd; + aio_cancel(td, &cancelargs); + DPRINTF("aio_cancel() returned %ld", (long)td->td_retval[0]); + if (td->td_retval[0] == AIO_NOTCANCELED) + printf(LMSG("linux_io_destroy(): Asynchronous IO " + "request (Linux: %p, FreeBSD: %p) " + "cannot be cancelled. " + "***** Both User Space " + "and Kernel Memory Leaked! *****"), + preq->req_porig, preq->req_pbsd); + + LINUX_AIO_REQ_UNHOOK(pctx, preq); + + if (td->td_retval[0] == AIO_ALLDONE) { + aioretargs.aiocbp = preq->req_pbsd; + aio_return(td, &aioretargs); + DPRINTF("aio_return(%p) returned %ld", + aioretargs.aiocbp, + (long)td->td_retval[0]); + + td->td_retval[0] = AIO_ALLDONE; + } + + /* Free user space clone of the request */ + if (td->td_retval[0] != AIO_NOTCANCELED) /* + * XXX How to avoid + * memory leak here? + */ + user_free(td, preq->req_pbsd, + sizeof(*(preq->req_pbsd))); + + /* Free kernel structure of the request */ + uma_zfree(linux_aio_request_zone, preq); + + td->td_retval[0] = 0; + } + + LINUX_AIO_CTX_UNLOCK(pctx); + + sx_destroy(&(pctx->ctx_sx)); + + /* Free the "ring" */ + DPRINTF("free the \"ring\" %p", pctx->ctx_pring); + user_free(td, pctx->ctx_pring, sizeof(*pctx->ctx_pring)); + + /* Free destroyed context */ + uma_zfree(linux_aio_context_zone, pctx); + + return (nerr); +} + +/* Linux system call io_getevents(2) */ +int linux_io_getevents(struct thread *td, struct linux_io_getevents_args *args) +{ + int i, j, nerr = 0; + struct proc *p; + struct l_timespec l_timeout; + struct timespec timeout, *u_ptimeout, t1, t2; + struct linux_aio_context *pctx; + struct linux_aio_request *preq, *ptmpreq; + struct linux_io_event evt; + struct aio_return_args aioretargs; + struct aio_error_args aioerrargs; + register_t aio_ret, aio_err; + struct aiocb ** u_aiocbp; + struct aio_suspend_args aiosusargs; + + DARGPRINTF("%lx, %ld, %ld, %p, %p", + (unsigned long) args->ctx_id, + (long)args->min_nr, (long)args->nr, + args->events, args->timeout); + + if (args->nr <= 0) + return (EINVAL); + + if (args->min_nr < 0) + return (EINVAL); + + nerr = user_mem_rw_verify(args->events, + sizeof(*(args->events)) * args->nr); + if (nerr != 0) + return (nerr); + + if (args->timeout != NULL) { + nerr = copyin(args->timeout, &l_timeout, sizeof(l_timeout)); + if (nerr != 0) + return (nerr); + timeout.tv_sec = l_timeout.tv_sec; + timeout.tv_nsec = l_timeout.tv_nsec; + DUMP_TIMESPEC("User specified timeout: ", &timeout, ""); + } + + p = td->td_proc; + + /* + * Locking: + * + * LINUX_AIO_LOCK(p); <----------------+ + * ... | + * LINUX_AIO_CTX_LIST_LOCK(); <--+ | + * ... | | + * LINUX_AIO_CTX_LIST_UNLOCK(); <--+ | + * ... | + * LINUX_AIO_CTX_LOCK(pctx); <---------|---+ + * LINUX_AIO_UNLOCK(p); <----------------+ | + * ... | + * LINUX_AIO_CTX_UNLOCK(pctx); <-------------+ + */ + + LINUX_AIO_LOCK(p); + + /* Find the context in context list */ + LINUX_AIO_CTX_LIST_LOCK(); + LINUX_AIO_CTX_FOREACH(pctx) { + if (LINUX_AIO_CTX_MATCH(pctx, args->ctx_id, p->p_pid)) + break; + } + LINUX_AIO_CTX_LIST_UNLOCK(); + + /* Unable to find the context */ + if (pctx == NULL) { + LINUX_AIO_UNLOCK(p); + return (EINVAL); + } + + DPRINTF("Found the context: %lx -> %p", (unsigned long)args->ctx_id, pctx); + + LINUX_AIO_CTX_LOCK(pctx); /* XXX Interlaced, seamless */ + LINUX_AIO_UNLOCK(p); /* XXX Interlaced, seamless */ + + if (STAILQ_EMPTY(&(pctx->ctx_req))) { + td->td_retval[0] = 0; /* No queued request */ + DPRINTF("No request in queue (context: %p) at all, " + "return directly", pctx); + } else { /* Deal with the request queue */ + i = 0; /* + * This variable's value will be the return value + * of linux_io_getevents() + */ + + nerr = user_malloc(td, (void **)&u_aiocbp, + sizeof(*u_aiocbp) * pctx->ctx_nreq_max); + if (nerr != 0) + goto skip_substantial_0; + + nerr = user_malloc(td, (void **)&u_ptimeout, + sizeof(*u_ptimeout)); + if (nerr != 0) + goto skip_substantial_1; + + for (i = 0;i < args->nr;) { + + /* Collecting finished requests and waiting for queued requests */ + + LINUX_AIO_REQ_FOREACH_SAFE(pctx, preq, ptmpreq) { + + /* Collect all finished requests */ + + if (i >= args->nr) /* Full */ + break; + + aioerrargs.aiocbp = preq->req_pbsd; + aio_error(td, &aioerrargs); + aio_ret = td->td_retval[0]; + td->td_retval[0] = 0; + + DPRINTF("aio_error(%p) (Linux: %p) " + "returned %ld%s", + aioerrargs.aiocbp, + preq->req_porig, + (long)aio_ret, + aio_ret == EINPROGRESS ? + "(EINPROGRESS)" : "" ); + + if (aio_ret == EINPROGRESS) + continue; + + /* Done */ + LINUX_AIO_REQ_UNHOOK(pctx, preq); + + aioretargs.aiocbp = preq->req_pbsd; + aio_err = aio_return(td, &aioretargs); + aio_ret = td->td_retval[0]; + td->td_retval[0] = 0; + + DPRINTF("aio_return(%p) (Linux: %p) " + "returned %ld, errno=%ld", + aioretargs.aiocbp, + preq->req_porig, + (long)aio_ret, + (long)aio_err); + + evt.data = preq->req_linux.aio_data; + evt.obj = (uint64_t)(unsigned long) + preq->req_porig; + if (aio_ret >= 0) { + /* Normal return (success) */ + evt.res = aio_ret; + } else { /* Error code (failure) */ + /* + * Translate FreeBSD error code + * to Linux's + */ + evt.res = + p->p_sysent->sv_errtbl[aio_err]; + } + DPRINTF("context %p (Linux: %p): " + "io_event.res=%lld", + preq->req_pbsd, + preq->req_porig, + (long long)evt.res); + evt.res2 = 0; + + copyout(&evt, &(args->events[i]), sizeof(evt)); + + uma_zfree(linux_aio_request_zone, preq); + + i ++; + } /* End of collecting all finished requests */ + + if (STAILQ_EMPTY(&(pctx->ctx_req))) { + /* No request remained in this context */ + DPRINTF("returning(context %p): " + "request queue is empty", + pctx); + break; + } + + if (i >= args->nr) { /* Full */ + DPRINTF("returning(context %p): user space " + "event array is full", + pctx); + break; + } + + if (i >= args->min_nr) { + /* Met the minimum requirement */ + DPRINTF("returning(context %p): " + "met the minimum requirement", + pctx); + break; + } + + if (args->timeout != NULL) { + if (! timespecisset(&timeout)) { /* Timed out */ + DPRINTF("returning(context %p): " + "no time remaining", + pctx); + break; + } + } + + if (args->timeout != NULL) { + nanouptime(&t1); /* Time before aio_suspend() */ + DUMP_TIMESPEC("T1: ", &t1, + " (uptime before calling aio_suspend())"); + } + + /* Prepare arguments for aio_suspend() */ + j = 0; + LINUX_AIO_REQ_FOREACH(pctx, preq) { + copyout(&(preq->req_pbsd), &(u_aiocbp[j]), + sizeof(preq->req_pbsd)); + j ++; + } + MPASS(j == pctx->ctx_nreq_cur); + aiosusargs.aiocbp = u_aiocbp; + aiosusargs.nent = j; + + if (args->timeout != NULL) { + copyout(&timeout, u_ptimeout, sizeof(timeout)); + aiosusargs.timeout = u_ptimeout; + DUMP_TIMESPEC("Time remained: ", &timeout, ""); + } else { + aiosusargs.timeout = NULL; + } + + aio_err = aio_suspend(td, &aiosusargs); + DPRINTF("aio_suspend(%p, %d, %p) returned %ld", + aiosusargs.aiocbp, aiosusargs.nent, + aiosusargs.timeout, (long)aio_err); + + if (args->timeout != NULL) { + nanouptime(&t2); /* Time after aio_suspend() */ + DUMP_TIMESPEC("T2: ", &t2, + " (uptime after calling aio_suspend())"); + timespecsub(&t2, &t1); /* + * Time spent by + * aio_suspend() + */ + DUMP_TIMESPEC("T_delta: ", &t2, + " (time spent by calling aio_suspend())"); + if (timespeccmp(&t2, &timeout, >=)) { + timespecclear(&timeout); /* Timed out */ + } else { + timespecsub(&timeout, &t2); + /* Time remaining */ + } + DUMP_TIMESPEC("Time remained: ", &timeout, ""); + } + + if (aio_err == EAGAIN) { /* Timed out */ + DPRINTF("returning(context %p): " + "timed out after calling aio_suspend()", + pctx); + break; + } + } /* + * End of collecting finished requests + * and waiting for queued requests + */ + + l_timeout.tv_sec = timeout.tv_sec; + l_timeout.tv_nsec = timeout.tv_nsec; + copyout(&l_timeout, args->timeout, sizeof(l_timeout)); + /* No matter whether successfully or not */ + + nerr = user_free(td, u_ptimeout, sizeof(*u_ptimeout)); +skip_substantial_1: + nerr = user_free(td, u_aiocbp, + sizeof(*u_aiocbp) * pctx->ctx_nreq_max); +skip_substantial_0: + td->td_retval[0] = i; + /* user_free() resets td->td_retval[0] to 0 */ + DPRINTF("%d requests are unhooked from the context %p", i, pctx); + } /* End of dealing with request queue */ + + LINUX_AIO_CTX_UNLOCK(pctx); + + return (nerr); +} + +/* Linux system call io_submit(2) */ +int linux_io_submit(struct thread *td, struct linux_io_submit_args *args) +{ + int i, nerr = 0; + struct proc *p; + struct linux_aio_context *pctx; + struct linux_aio_request req, *preq; + struct linux_iocb *porig; + struct aiocb iocb, *piocb; + + DARGPRINTF("%lx, %ld, %p", (unsigned long)args->ctx_id, (long)args->nr, args->iocbpp); + + if (args->nr <= 0) + return (EINVAL); + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Wed Oct 15 15:32:04 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3DB261065690; Wed, 15 Oct 2008 15:32:04 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 285978FC0A; Wed, 15 Oct 2008 15:32:04 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9FFW4eM037109; Wed, 15 Oct 2008 15:32:04 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9FFW34F037106; Wed, 15 Oct 2008 15:32:04 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810151532.m9FFW34F037106@svn.freebsd.org> From: Alexander Leidinger Date: Wed, 15 Oct 2008 15:32:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183919 - in user/netchild/doxygen: . src src/sys src/sys/dev src/sys/dev/sound src/sys/dev/sound/pcm src/sys/kern src/tools src/tools/kerneldoc src/tools/kerneldoc/subsys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Oct 2008 15:32:04 -0000 Author: netchild Date: Wed Oct 15 15:32:03 2008 New Revision: 183919 URL: http://svn.freebsd.org/changeset/base/183919 Log: Create baseline for my doxygen related patches. Added: user/netchild/doxygen/ user/netchild/doxygen/README user/netchild/doxygen/src/ user/netchild/doxygen/src/sys/ user/netchild/doxygen/src/sys/dev/ user/netchild/doxygen/src/sys/dev/sound/ user/netchild/doxygen/src/sys/dev/sound/pcm/ user/netchild/doxygen/src/sys/dev/sound/pcm/dsp.c (props changed) - copied unchanged from r183911, head/sys/dev/sound/pcm/dsp.c user/netchild/doxygen/src/sys/kern/ user/netchild/doxygen/src/sys/kern/subr_bus.c (props changed) - copied unchanged from r183911, head/sys/kern/subr_bus.c user/netchild/doxygen/src/tools/ user/netchild/doxygen/src/tools/kerneldoc/ user/netchild/doxygen/src/tools/kerneldoc/subsys/ user/netchild/doxygen/src/tools/kerneldoc/subsys/Doxyfile-linux (props changed) - copied unchanged from r183911, head/tools/kerneldoc/subsys/Doxyfile-linux user/netchild/doxygen/src/tools/kerneldoc/subsys/Makefile (props changed) - copied unchanged from r183911, head/tools/kerneldoc/subsys/Makefile user/netchild/doxygen/src/tools/kerneldoc/subsys/common-Doxyfile (props changed) - copied unchanged from r183911, head/tools/kerneldoc/subsys/common-Doxyfile Added: user/netchild/doxygen/README ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/netchild/doxygen/README Wed Oct 15 15:32:03 2008 (r183919) @@ -0,0 +1,2 @@ +Doxygen related changes. Either improvements to the infrastructure, +fixes of existing doxygen docs, or new doxygen docs. Copied: user/netchild/doxygen/src/sys/dev/sound/pcm/dsp.c (from r183911, head/sys/dev/sound/pcm/dsp.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/netchild/doxygen/src/sys/dev/sound/pcm/dsp.c Wed Oct 15 15:32:03 2008 (r183919, copy of r183911, head/sys/dev/sound/pcm/dsp.c) @@ -0,0 +1,2927 @@ +/*- + * Copyright (c) 1999 Cameron Grant + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + */ + +#include +#include + +SND_DECLARE_FILE("$FreeBSD$"); + +static int dsp_mmap_allow_prot_exec = 0; +SYSCTL_INT(_hw_snd, OID_AUTO, compat_linux_mmap, CTLFLAG_RW, + &dsp_mmap_allow_prot_exec, 0, "linux mmap compatibility"); + +struct dsp_cdevinfo { + struct pcm_channel *rdch, *wrch; + int busy, simplex; + TAILQ_ENTRY(dsp_cdevinfo) link; +}; + +#define PCM_RDCH(x) (((struct dsp_cdevinfo *)(x)->si_drv1)->rdch) +#define PCM_WRCH(x) (((struct dsp_cdevinfo *)(x)->si_drv1)->wrch) +#define PCM_SIMPLEX(x) (((struct dsp_cdevinfo *)(x)->si_drv1)->simplex) + +#define DSP_CDEVINFO_CACHESIZE 8 + +#define DSP_REGISTERED(x, y) (PCM_REGISTERED(x) && \ + (y) != NULL && (y)->si_drv1 != NULL) + +#define OLDPCM_IOCTL + +static d_open_t dsp_open; +static d_close_t dsp_close; +static d_read_t dsp_read; +static d_write_t dsp_write; +static d_ioctl_t dsp_ioctl; +static d_poll_t dsp_poll; +static d_mmap_t dsp_mmap; + +struct cdevsw dsp_cdevsw = { + .d_version = D_VERSION, + .d_open = dsp_open, + .d_close = dsp_close, + .d_read = dsp_read, + .d_write = dsp_write, + .d_ioctl = dsp_ioctl, + .d_poll = dsp_poll, + .d_mmap = dsp_mmap, + .d_name = "dsp", +}; + +#ifdef USING_DEVFS +static eventhandler_tag dsp_ehtag = NULL; +static int dsp_umax = -1; +static int dsp_cmax = -1; +#endif + +static int dsp_oss_syncgroup(struct pcm_channel *wrch, struct pcm_channel *rdch, oss_syncgroup *group); +static int dsp_oss_syncstart(int sg_id); +static int dsp_oss_policy(struct pcm_channel *wrch, struct pcm_channel *rdch, int policy); +#ifdef OSSV4_EXPERIMENT +static int dsp_oss_cookedmode(struct pcm_channel *wrch, struct pcm_channel *rdch, int enabled); +static int dsp_oss_getchnorder(struct pcm_channel *wrch, struct pcm_channel *rdch, unsigned long long *map); +static int dsp_oss_setchnorder(struct pcm_channel *wrch, struct pcm_channel *rdch, unsigned long long *map); +static int dsp_oss_getlabel(struct pcm_channel *wrch, struct pcm_channel *rdch, oss_label_t *label); +static int dsp_oss_setlabel(struct pcm_channel *wrch, struct pcm_channel *rdch, oss_label_t *label); +static int dsp_oss_getsong(struct pcm_channel *wrch, struct pcm_channel *rdch, oss_longname_t *song); +static int dsp_oss_setsong(struct pcm_channel *wrch, struct pcm_channel *rdch, oss_longname_t *song); +static int dsp_oss_setname(struct pcm_channel *wrch, struct pcm_channel *rdch, oss_longname_t *name); +#endif + +static struct snddev_info * +dsp_get_info(struct cdev *dev) +{ + return (devclass_get_softc(pcm_devclass, PCMUNIT(dev))); +} + +static uint32_t +dsp_get_flags(struct cdev *dev) +{ + device_t bdev; + + bdev = devclass_get_device(pcm_devclass, PCMUNIT(dev)); + + return ((bdev != NULL) ? pcm_getflags(bdev) : 0xffffffff); +} + +static void +dsp_set_flags(struct cdev *dev, uint32_t flags) +{ + device_t bdev; + + bdev = devclass_get_device(pcm_devclass, PCMUNIT(dev)); + + if (bdev != NULL) + pcm_setflags(bdev, flags); +} + +/* + * return the channels associated with an open device instance. + * lock channels specified. + */ +static int +getchns(struct cdev *dev, struct pcm_channel **rdch, struct pcm_channel **wrch, + uint32_t prio) +{ + struct snddev_info *d; + struct pcm_channel *ch; + uint32_t flags; + + if (PCM_SIMPLEX(dev) != 0) { + d = dsp_get_info(dev); + if (!PCM_REGISTERED(d)) + return (ENXIO); + pcm_lock(d); + PCM_WAIT(d); + PCM_ACQUIRE(d); + /* + * Note: order is important - + * pcm flags -> prio query flags -> wild guess + */ + ch = NULL; + flags = dsp_get_flags(dev); + if (flags & SD_F_PRIO_WR) { + ch = PCM_RDCH(dev); + PCM_RDCH(dev) = NULL; + } else if (flags & SD_F_PRIO_RD) { + ch = PCM_WRCH(dev); + PCM_WRCH(dev) = NULL; + } else if (prio & SD_F_PRIO_WR) { + ch = PCM_RDCH(dev); + PCM_RDCH(dev) = NULL; + flags |= SD_F_PRIO_WR; + } else if (prio & SD_F_PRIO_RD) { + ch = PCM_WRCH(dev); + PCM_WRCH(dev) = NULL; + flags |= SD_F_PRIO_RD; + } else if (PCM_WRCH(dev) != NULL) { + ch = PCM_RDCH(dev); + PCM_RDCH(dev) = NULL; + flags |= SD_F_PRIO_WR; + } else if (PCM_RDCH(dev) != NULL) { + ch = PCM_WRCH(dev); + PCM_WRCH(dev) = NULL; + flags |= SD_F_PRIO_RD; + } + PCM_SIMPLEX(dev) = 0; + dsp_set_flags(dev, flags); + if (ch != NULL) { + CHN_LOCK(ch); + pcm_chnref(ch, -1); + pcm_chnrelease(ch); + } + PCM_RELEASE(d); + pcm_unlock(d); + } + + *rdch = PCM_RDCH(dev); + *wrch = PCM_WRCH(dev); + + if (*rdch != NULL && (prio & SD_F_PRIO_RD)) + CHN_LOCK(*rdch); + if (*wrch != NULL && (prio & SD_F_PRIO_WR)) + CHN_LOCK(*wrch); + + return (0); +} + +/* unlock specified channels */ +static void +relchns(struct cdev *dev, struct pcm_channel *rdch, struct pcm_channel *wrch, + uint32_t prio) +{ + if (wrch != NULL && (prio & SD_F_PRIO_WR)) + CHN_UNLOCK(wrch); + if (rdch != NULL && (prio & SD_F_PRIO_RD)) + CHN_UNLOCK(rdch); +} + +static void +dsp_cdevinfo_alloc(struct cdev *dev, + struct pcm_channel *rdch, struct pcm_channel *wrch) +{ + struct snddev_info *d; + struct dsp_cdevinfo *cdi; + int simplex; + + d = dsp_get_info(dev); + + KASSERT(PCM_REGISTERED(d) && dev != NULL && dev->si_drv1 == NULL && + rdch != wrch, + ("bogus %s(), what are you trying to accomplish here?", __func__)); + PCM_BUSYASSERT(d); + mtx_assert(d->lock, MA_OWNED); + + simplex = (dsp_get_flags(dev) & SD_F_SIMPLEX) ? 1 : 0; + + /* + * Scan for free instance entry and put it into the end of list. + * Create new one if necessary. + */ + TAILQ_FOREACH(cdi, &d->dsp_cdevinfo_pool, link) { + if (cdi->busy != 0) + break; + cdi->rdch = rdch; + cdi->wrch = wrch; + cdi->simplex = simplex; + cdi->busy = 1; + TAILQ_REMOVE(&d->dsp_cdevinfo_pool, cdi, link); + TAILQ_INSERT_TAIL(&d->dsp_cdevinfo_pool, cdi, link); + dev->si_drv1 = cdi; + return; + } + pcm_unlock(d); + cdi = malloc(sizeof(*cdi), M_DEVBUF, M_WAITOK | M_ZERO); + pcm_lock(d); + cdi->rdch = rdch; + cdi->wrch = wrch; + cdi->simplex = simplex; + cdi->busy = 1; + TAILQ_INSERT_TAIL(&d->dsp_cdevinfo_pool, cdi, link); + dev->si_drv1 = cdi; +} + +static void +dsp_cdevinfo_free(struct cdev *dev) +{ + struct snddev_info *d; + struct dsp_cdevinfo *cdi, *tmp; + uint32_t flags; + int i; + + d = dsp_get_info(dev); + + KASSERT(PCM_REGISTERED(d) && dev != NULL && dev->si_drv1 != NULL && + PCM_RDCH(dev) == NULL && PCM_WRCH(dev) == NULL, + ("bogus %s(), what are you trying to accomplish here?", __func__)); + PCM_BUSYASSERT(d); + mtx_assert(d->lock, MA_OWNED); + + cdi = dev->si_drv1; + dev->si_drv1 = NULL; + cdi->rdch = NULL; + cdi->wrch = NULL; + cdi->simplex = 0; + cdi->busy = 0; + + /* + * Once it is free, move it back to the beginning of list for + * faster new entry allocation. + */ + TAILQ_REMOVE(&d->dsp_cdevinfo_pool, cdi, link); + TAILQ_INSERT_HEAD(&d->dsp_cdevinfo_pool, cdi, link); + + /* + * Scan the list, cache free entries up to DSP_CDEVINFO_CACHESIZE. + * Reset simplex flags. + */ + flags = dsp_get_flags(dev) & ~SD_F_PRIO_SET; + i = DSP_CDEVINFO_CACHESIZE; + TAILQ_FOREACH_SAFE(cdi, &d->dsp_cdevinfo_pool, link, tmp) { + if (cdi->busy != 0) { + if (cdi->simplex == 0) { + if (cdi->rdch != NULL) + flags |= SD_F_PRIO_RD; + if (cdi->wrch != NULL) + flags |= SD_F_PRIO_WR; + } + } else { + if (i == 0) { + TAILQ_REMOVE(&d->dsp_cdevinfo_pool, cdi, link); + free(cdi, M_DEVBUF); + } else + i--; + } + } + dsp_set_flags(dev, flags); +} + +void +dsp_cdevinfo_init(struct snddev_info *d) +{ + struct dsp_cdevinfo *cdi; + int i; + + KASSERT(d != NULL, ("NULL snddev_info")); + PCM_BUSYASSERT(d); + mtx_assert(d->lock, MA_NOTOWNED); + + TAILQ_INIT(&d->dsp_cdevinfo_pool); + for (i = 0; i < DSP_CDEVINFO_CACHESIZE; i++) { + cdi = malloc(sizeof(*cdi), M_DEVBUF, M_WAITOK | M_ZERO); + TAILQ_INSERT_HEAD(&d->dsp_cdevinfo_pool, cdi, link); + } +} + +void +dsp_cdevinfo_flush(struct snddev_info *d) +{ + struct dsp_cdevinfo *cdi, *tmp; + + KASSERT(d != NULL, ("NULL snddev_info")); + PCM_BUSYASSERT(d); + mtx_assert(d->lock, MA_NOTOWNED); + + cdi = TAILQ_FIRST(&d->dsp_cdevinfo_pool); + while (cdi != NULL) { + tmp = TAILQ_NEXT(cdi, link); + free(cdi, M_DEVBUF); + cdi = tmp; + } + TAILQ_INIT(&d->dsp_cdevinfo_pool); +} + +/* duplex / simplex cdev type */ +enum { + DSP_CDEV_TYPE_RDONLY, /* simplex read-only (record) */ + DSP_CDEV_TYPE_WRONLY, /* simplex write-only (play) */ + DSP_CDEV_TYPE_RDWR, /* duplex read, write, or both */ +}; + +#define DSP_F_VALID(x) ((x) & (FREAD | FWRITE)) +#define DSP_F_DUPLEX(x) (((x) & (FREAD | FWRITE)) == (FREAD | FWRITE)) +#define DSP_F_SIMPLEX(x) (!DSP_F_DUPLEX(x)) +#define DSP_F_READ(x) ((x) & FREAD) +#define DSP_F_WRITE(x) ((x) & FWRITE) + +static const struct { + int type; + char *name; + char *sep; + int use_sep; + int hw; + int max; + uint32_t fmt, spd; + int query; +} dsp_cdevs[] = { + { SND_DEV_DSP, "dsp", ".", 0, 0, 0, + AFMT_U8, DSP_DEFAULT_SPEED, DSP_CDEV_TYPE_RDWR }, + { SND_DEV_AUDIO, "audio", ".", 0, 0, 0, + AFMT_MU_LAW, DSP_DEFAULT_SPEED, DSP_CDEV_TYPE_RDWR }, + { SND_DEV_DSP16, "dspW", ".", 0, 0, 0, + AFMT_S16_LE, DSP_DEFAULT_SPEED, DSP_CDEV_TYPE_RDWR }, + { SND_DEV_DSPHW_PLAY, "dsp", ".p", 1, 1, SND_MAXHWCHAN, + AFMT_S16_LE | AFMT_STEREO, 48000, DSP_CDEV_TYPE_WRONLY }, + { SND_DEV_DSPHW_VPLAY, "dsp", ".vp", 1, 1, SND_MAXVCHANS, + AFMT_S16_LE | AFMT_STEREO, 48000, DSP_CDEV_TYPE_WRONLY }, + { SND_DEV_DSPHW_REC, "dsp", ".r", 1, 1, SND_MAXHWCHAN, + AFMT_S16_LE | AFMT_STEREO, 48000, DSP_CDEV_TYPE_RDONLY }, + { SND_DEV_DSPHW_VREC, "dsp", ".vr", 1, 1, SND_MAXVCHANS, + AFMT_S16_LE | AFMT_STEREO, 48000, DSP_CDEV_TYPE_RDONLY }, + { SND_DEV_DSPHW_CD, "dspcd", ".", 0, 0, 0, + AFMT_S16_LE | AFMT_STEREO, 44100, DSP_CDEV_TYPE_RDWR }, + { SND_DEV_DSP_MMAP, "dsp_mmap", ".", 0, 0, 0, + AFMT_S16_LE | AFMT_STEREO, 48000, DSP_CDEV_TYPE_RDWR }, +}; + +#define DSP_FIXUP_ERROR() do { \ + prio = dsp_get_flags(i_dev); \ + if (!DSP_F_VALID(flags)) \ + error = EINVAL; \ + if (!DSP_F_DUPLEX(flags) && \ + ((DSP_F_READ(flags) && d->reccount == 0) || \ + (DSP_F_WRITE(flags) && d->playcount == 0))) \ + error = ENOTSUP; \ + else if (!DSP_F_DUPLEX(flags) && (prio & SD_F_SIMPLEX) && \ + ((DSP_F_READ(flags) && (prio & SD_F_PRIO_WR)) || \ + (DSP_F_WRITE(flags) && (prio & SD_F_PRIO_RD)))) \ + error = EBUSY; \ + else if (DSP_REGISTERED(d, i_dev)) \ + error = EBUSY; \ +} while(0) + +static int +dsp_open(struct cdev *i_dev, int flags, int mode, struct thread *td) +{ + struct pcm_channel *rdch, *wrch; + struct snddev_info *d; + uint32_t fmt, spd, prio; + int i, error, rderror, wrerror, devtype, wdevunit, rdevunit; + + /* Kind of impossible.. */ + if (i_dev == NULL || td == NULL) + return (ENODEV); + + d = dsp_get_info(i_dev); + if (!PCM_REGISTERED(d)) + return (EBADF); + + PCM_GIANT_ENTER(d); + + /* Lock snddev so nobody else can monkey with it. */ + pcm_lock(d); + PCM_WAIT(d); + + /* + * Try to acquire cloned device before someone else pick it. + * ENODEV means this is not a cloned droids. + */ + error = snd_clone_acquire(i_dev); + if (!(error == 0 || error == ENODEV)) { + DSP_FIXUP_ERROR(); + pcm_unlock(d); + PCM_GIANT_EXIT(d); + return (error); + } + + error = 0; + DSP_FIXUP_ERROR(); + + if (error != 0) { + (void)snd_clone_release(i_dev); + pcm_unlock(d); + PCM_GIANT_EXIT(d); + return (error); + } + + /* + * That is just enough. Acquire and unlock pcm lock so + * the other will just have to wait until we finish doing + * everything. + */ + PCM_ACQUIRE(d); + pcm_unlock(d); + + devtype = PCMDEV(i_dev); + wdevunit = -1; + rdevunit = -1; + fmt = 0; + spd = 0; + + for (i = 0; i < (sizeof(dsp_cdevs) / sizeof(dsp_cdevs[0])); i++) { + if (devtype != dsp_cdevs[i].type) + continue; + if (DSP_F_SIMPLEX(flags) && + ((dsp_cdevs[i].query == DSP_CDEV_TYPE_WRONLY && + DSP_F_READ(flags)) || + (dsp_cdevs[i].query == DSP_CDEV_TYPE_RDONLY && + DSP_F_WRITE(flags)))) { + /* + * simplex, opposite direction? Please be gone.. + */ + (void)snd_clone_release(i_dev); + PCM_RELEASE_QUICK(d); + PCM_GIANT_EXIT(d); + return (ENOTSUP); + } + if (dsp_cdevs[i].query == DSP_CDEV_TYPE_WRONLY) + wdevunit = dev2unit(i_dev); + else if (dsp_cdevs[i].query == DSP_CDEV_TYPE_RDONLY) + rdevunit = dev2unit(i_dev); + fmt = dsp_cdevs[i].fmt; + spd = dsp_cdevs[i].spd; + break; + } + + /* No matching devtype? */ + if (fmt == 0 || spd == 0) + panic("impossible devtype %d", devtype); + + rdch = NULL; + wrch = NULL; + rderror = 0; + wrerror = 0; + + /* + * if we get here, the open request is valid- either: + * * we were previously not open + * * we were open for play xor record and the opener wants + * the non-open direction + */ + if (DSP_F_READ(flags)) { + /* open for read */ + rderror = pcm_chnalloc(d, &rdch, PCMDIR_REC, + td->td_proc->p_pid, rdevunit); + + if (rderror == 0 && (chn_reset(rdch, fmt) != 0 || + (chn_setspeed(rdch, spd) != 0))) + rderror = ENXIO; + + if (rderror != 0) { + if (rdch != NULL) + pcm_chnrelease(rdch); + if (!DSP_F_DUPLEX(flags)) { + (void)snd_clone_release(i_dev); + PCM_RELEASE_QUICK(d); + PCM_GIANT_EXIT(d); + return (rderror); + } + rdch = NULL; + } else { + if (flags & O_NONBLOCK) + rdch->flags |= CHN_F_NBIO; + pcm_chnref(rdch, 1); + CHN_UNLOCK(rdch); + } + } + + if (DSP_F_WRITE(flags)) { + /* open for write */ + wrerror = pcm_chnalloc(d, &wrch, PCMDIR_PLAY, + td->td_proc->p_pid, wdevunit); + + if (wrerror == 0 && (chn_reset(wrch, fmt) != 0 || + (chn_setspeed(wrch, spd) != 0))) + wrerror = ENXIO; + + if (wrerror != 0) { + if (wrch != NULL) + pcm_chnrelease(wrch); + if (!DSP_F_DUPLEX(flags)) { + if (rdch != NULL) { + /* + * Lock, deref and release previously + * created record channel + */ + CHN_LOCK(rdch); + pcm_chnref(rdch, -1); + pcm_chnrelease(rdch); + } + (void)snd_clone_release(i_dev); + PCM_RELEASE_QUICK(d); + PCM_GIANT_EXIT(d); + return (wrerror); + } + wrch = NULL; + } else { + if (flags & O_NONBLOCK) + wrch->flags |= CHN_F_NBIO; + pcm_chnref(wrch, 1); + CHN_UNLOCK(wrch); + } + } + + if (rdch == NULL && wrch == NULL) { + (void)snd_clone_release(i_dev); + PCM_RELEASE_QUICK(d); + PCM_GIANT_EXIT(d); + return ((wrerror != 0) ? wrerror : rderror); + } + + pcm_lock(d); + + /* + * We're done. Allocate channels information for this cdev. + */ + dsp_cdevinfo_alloc(i_dev, rdch, wrch); + + /* + * Increase clone refcount for its automatic garbage collector. + */ + (void)snd_clone_ref(i_dev); + + PCM_RELEASE(d); + pcm_unlock(d); + + PCM_GIANT_LEAVE(d); + + return (0); +} + +static int +dsp_close(struct cdev *i_dev, int flags, int mode, struct thread *td) +{ + struct pcm_channel *rdch, *wrch; + struct snddev_info *d; + int sg_ids, refs; + + d = dsp_get_info(i_dev); + if (!DSP_REGISTERED(d, i_dev)) + return (EBADF); + + PCM_GIANT_ENTER(d); + + pcm_lock(d); + PCM_WAIT(d); + + rdch = PCM_RDCH(i_dev); + wrch = PCM_WRCH(i_dev); + + if (rdch || wrch) { + PCM_ACQUIRE(d); + pcm_unlock(d); + + refs = 0; + if (rdch) { + /* + * The channel itself need not be locked because: + * a) Adding a channel to a syncgroup happens only in dsp_ioctl(), + * which cannot run concurrently to dsp_close(). + * b) The syncmember pointer (sm) is protected by the global + * syncgroup list lock. + * c) A channel can't just disappear, invalidating pointers, + * unless it's closed/dereferenced first. + */ + PCM_SG_LOCK(); + sg_ids = chn_syncdestroy(rdch); + PCM_SG_UNLOCK(); + if (sg_ids != 0) + free_unr(pcmsg_unrhdr, sg_ids); + + CHN_LOCK(rdch); + refs += pcm_chnref(rdch, -1); + chn_abort(rdch); /* won't sleep */ + rdch->flags &= ~(CHN_F_RUNNING | CHN_F_MAPPED | CHN_F_DEAD); + chn_reset(rdch, 0); + pcm_chnrelease(rdch); + PCM_RDCH(i_dev) = NULL; + } + if (wrch) { + /* + * Please see block above. + */ + PCM_SG_LOCK(); + sg_ids = chn_syncdestroy(wrch); + PCM_SG_UNLOCK(); + if (sg_ids != 0) + free_unr(pcmsg_unrhdr, sg_ids); + + CHN_LOCK(wrch); + refs += pcm_chnref(wrch, -1); + chn_flush(wrch); /* may sleep */ + wrch->flags &= ~(CHN_F_RUNNING | CHN_F_MAPPED | CHN_F_DEAD); + chn_reset(wrch, 0); + pcm_chnrelease(wrch); + PCM_WRCH(i_dev) = NULL; + } + + pcm_lock(d); + /* + * If there are no more references, release the channels. + */ + if (refs == 0 && PCM_RDCH(i_dev) == NULL && + PCM_WRCH(i_dev) == NULL) { + dsp_cdevinfo_free(i_dev); + /* + * Release clone busy state and unref it + * so the automatic garbage collector will + * get the hint and do the remaining cleanup + * process. + */ + (void)snd_clone_release(i_dev); + + /* + * destroy_dev() might sleep, so release pcm lock + * here and rely on pcm cv serialization. + */ + pcm_unlock(d); + (void)snd_clone_unref(i_dev); + pcm_lock(d); + } + PCM_RELEASE(d); + } + + pcm_unlock(d); + + PCM_GIANT_LEAVE(d); + + return (0); +} + +static __inline int +dsp_io_ops(struct cdev *i_dev, struct uio *buf) +{ + struct snddev_info *d; + struct pcm_channel **ch, *rdch, *wrch; + int (*chn_io)(struct pcm_channel *, struct uio *); + int prio, ret; + pid_t runpid; + + KASSERT(i_dev != NULL && buf != NULL && + (buf->uio_rw == UIO_READ || buf->uio_rw == UIO_WRITE), + ("%s(): io train wreck!", __func__)); + + d = dsp_get_info(i_dev); + if (!DSP_REGISTERED(d, i_dev)) + return (EBADF); + + PCM_GIANT_ENTER(d); + + switch (buf->uio_rw) { + case UIO_READ: + prio = SD_F_PRIO_RD; + ch = &rdch; + chn_io = chn_read; + break; + case UIO_WRITE: + prio = SD_F_PRIO_WR; + ch = &wrch; + chn_io = chn_write; + break; + default: + panic("invalid/corrupted uio direction: %d", buf->uio_rw); + break; + } + + rdch = NULL; + wrch = NULL; + runpid = buf->uio_td->td_proc->p_pid; + + getchns(i_dev, &rdch, &wrch, prio); + + if (*ch == NULL || !((*ch)->flags & CHN_F_BUSY)) { + PCM_GIANT_EXIT(d); + return (EBADF); + } + + if (((*ch)->flags & (CHN_F_MAPPED | CHN_F_DEAD)) || + (((*ch)->flags & CHN_F_RUNNING) && (*ch)->pid != runpid)) { + relchns(i_dev, rdch, wrch, prio); + PCM_GIANT_EXIT(d); + return (EINVAL); + } else if (!((*ch)->flags & CHN_F_RUNNING)) { + (*ch)->flags |= CHN_F_RUNNING; + (*ch)->pid = runpid; + } + + /* + * chn_read/write must give up channel lock in order to copy bytes + * from/to userland, so up the "in progress" counter to make sure + * someone else doesn't come along and muss up the buffer. + */ + ++(*ch)->inprog; + ret = chn_io(*ch, buf); + --(*ch)->inprog; + + CHN_BROADCAST(&(*ch)->cv); + + relchns(i_dev, rdch, wrch, prio); + + PCM_GIANT_LEAVE(d); + + return (ret); +} + +static int +dsp_read(struct cdev *i_dev, struct uio *buf, int flag) +{ + return (dsp_io_ops(i_dev, buf)); +} + +static int +dsp_write(struct cdev *i_dev, struct uio *buf, int flag) +{ + return (dsp_io_ops(i_dev, buf)); +} + +static int +dsp_ioctl(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, struct thread *td) +{ + struct pcm_channel *chn, *rdch, *wrch; + struct snddev_info *d; + int *arg_i, ret, kill, tmp, xcmd; + + d = dsp_get_info(i_dev); + if (!DSP_REGISTERED(d, i_dev)) + return (EBADF); + + PCM_GIANT_ENTER(d); + + arg_i = (int *)arg; + ret = 0; + xcmd = 0; + + /* + * this is an evil hack to allow broken apps to perform mixer ioctls + * on dsp devices. + */ + if (IOCGROUP(cmd) == 'M') { + /* + * This is at least, a bug to bug compatible with OSS. + */ + if (d->mixer_dev != NULL) { + PCM_ACQUIRE_QUICK(d); + ret = mixer_ioctl_cmd(d->mixer_dev, cmd, arg, -1, td, + MIXER_CMD_DIRECT); + PCM_RELEASE_QUICK(d); + } else + ret = EBADF; + + PCM_GIANT_EXIT(d); + + return (ret); + } + + /* + * Certain ioctls may be made on any type of device (audio, mixer, + * and MIDI). Handle those special cases here. + */ + if (IOCGROUP(cmd) == 'X') { + PCM_ACQUIRE_QUICK(d); + switch(cmd) { + case SNDCTL_SYSINFO: + sound_oss_sysinfo((oss_sysinfo *)arg); + break; + case SNDCTL_AUDIOINFO: + ret = dsp_oss_audioinfo(i_dev, (oss_audioinfo *)arg); + break; + case SNDCTL_MIXERINFO: + ret = mixer_oss_mixerinfo(i_dev, (oss_mixerinfo *)arg); + break; + default: + ret = EINVAL; + } + PCM_RELEASE_QUICK(d); + PCM_GIANT_EXIT(d); + return (ret); + } + + getchns(i_dev, &rdch, &wrch, 0); + + kill = 0; + if (wrch && (wrch->flags & CHN_F_DEAD)) + kill |= 1; + if (rdch && (rdch->flags & CHN_F_DEAD)) + kill |= 2; + if (kill == 3) { + relchns(i_dev, rdch, wrch, 0); + PCM_GIANT_EXIT(d); + return (EINVAL); + } + if (kill & 1) + wrch = NULL; + if (kill & 2) + rdch = NULL; + + if (wrch == NULL && rdch == NULL) { + relchns(i_dev, rdch, wrch, 0); + PCM_GIANT_EXIT(d); + return (EINVAL); + } + + switch(cmd) { +#ifdef OLDPCM_IOCTL + /* + * we start with the new ioctl interface. + */ + case AIONWRITE: /* how many bytes can write ? */ + if (wrch) { + CHN_LOCK(wrch); +/* + if (wrch && wrch->bufhard.dl) + while (chn_wrfeed(wrch) == 0); +*/ + *arg_i = sndbuf_getfree(wrch->bufsoft); + CHN_UNLOCK(wrch); + } else { + *arg_i = 0; + ret = EINVAL; + } + break; + + case AIOSSIZE: /* set the current blocksize */ + { + struct snd_size *p = (struct snd_size *)arg; + + p->play_size = 0; + p->rec_size = 0; + PCM_ACQUIRE_QUICK(d); + if (wrch) { + CHN_LOCK(wrch); + chn_setblocksize(wrch, 2, p->play_size); + p->play_size = sndbuf_getblksz(wrch->bufsoft); + CHN_UNLOCK(wrch); + } + if (rdch) { + CHN_LOCK(rdch); + chn_setblocksize(rdch, 2, p->rec_size); + p->rec_size = sndbuf_getblksz(rdch->bufsoft); + CHN_UNLOCK(rdch); + } + PCM_RELEASE_QUICK(d); + } + break; + case AIOGSIZE: /* get the current blocksize */ + { + struct snd_size *p = (struct snd_size *)arg; + + if (wrch) { + CHN_LOCK(wrch); + p->play_size = sndbuf_getblksz(wrch->bufsoft); + CHN_UNLOCK(wrch); + } + if (rdch) { + CHN_LOCK(rdch); + p->rec_size = sndbuf_getblksz(rdch->bufsoft); + CHN_UNLOCK(rdch); + } + } + break; + + case AIOSFMT: + case AIOGFMT: + { + snd_chan_param *p = (snd_chan_param *)arg; + + if (cmd == AIOSFMT && + ((p->play_format != 0 && p->play_rate == 0) || + (p->rec_format != 0 && p->rec_rate == 0))) { + ret = EINVAL; + break; + } + PCM_ACQUIRE_QUICK(d); + if (wrch) { + CHN_LOCK(wrch); + if (cmd == AIOSFMT && p->play_format != 0) { + chn_setformat(wrch, p->play_format); + chn_setspeed(wrch, p->play_rate); + } + p->play_rate = wrch->speed; + p->play_format = wrch->format; + CHN_UNLOCK(wrch); + } else { + p->play_rate = 0; + p->play_format = 0; + } + if (rdch) { + CHN_LOCK(rdch); + if (cmd == AIOSFMT && p->rec_format != 0) { + chn_setformat(rdch, p->rec_format); + chn_setspeed(rdch, p->rec_rate); + } + p->rec_rate = rdch->speed; + p->rec_format = rdch->format; + CHN_UNLOCK(rdch); + } else { + p->rec_rate = 0; + p->rec_format = 0; + } + PCM_RELEASE_QUICK(d); + } + break; + + case AIOGCAP: /* get capabilities */ + { + snd_capabilities *p = (snd_capabilities *)arg; + struct pcmchan_caps *pcaps = NULL, *rcaps = NULL; + struct cdev *pdev; + + pcm_lock(d); + if (rdch) { + CHN_LOCK(rdch); + rcaps = chn_getcaps(rdch); + } + if (wrch) { + CHN_LOCK(wrch); + pcaps = chn_getcaps(wrch); + } + p->rate_min = max(rcaps? rcaps->minspeed : 0, + pcaps? pcaps->minspeed : 0); + p->rate_max = min(rcaps? rcaps->maxspeed : 1000000, + pcaps? pcaps->maxspeed : 1000000); + p->bufsize = min(rdch? sndbuf_getsize(rdch->bufsoft) : 1000000, + wrch? sndbuf_getsize(wrch->bufsoft) : 1000000); + /* XXX bad on sb16 */ + p->formats = (rdch? chn_getformats(rdch) : 0xffffffff) & + (wrch? chn_getformats(wrch) : 0xffffffff); + if (rdch && wrch) + p->formats |= (dsp_get_flags(i_dev) & SD_F_SIMPLEX)? 0 : AFMT_FULLDUPLEX; + pdev = d->mixer_dev; + p->mixers = 1; /* default: one mixer */ + p->inputs = pdev->si_drv1? mix_getdevs(pdev->si_drv1) : 0; + p->left = p->right = 100; + if (wrch) + CHN_UNLOCK(wrch); + if (rdch) + CHN_UNLOCK(rdch); + pcm_unlock(d); + } + break; + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Wed Oct 15 15:39:21 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3E8981065697; Wed, 15 Oct 2008 15:39:21 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2ABAD8FC16; Wed, 15 Oct 2008 15:39:21 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9FFdLYo037270; Wed, 15 Oct 2008 15:39:21 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9FFdKkp037265; Wed, 15 Oct 2008 15:39:20 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810151539.m9FFdKkp037265@svn.freebsd.org> From: Alexander Leidinger Date: Wed, 15 Oct 2008 15:39:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183920 - in user/netchild/doxygen/src: sys/dev/sound/pcm sys/kern tools/kerneldoc/subsys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Oct 2008 15:39:21 -0000 Author: netchild Date: Wed Oct 15 15:39:20 2008 New Revision: 183920 URL: http://svn.freebsd.org/changeset/base/183920 Log: My current improvements: - update to the current doxygen version I have installed + do not remove the comments, less work on updates in the future - catch up with some changes in the FreeBSD source tree - some minor fixes to existing doxygen docs Modified: user/netchild/doxygen/src/sys/dev/sound/pcm/dsp.c user/netchild/doxygen/src/sys/kern/subr_bus.c user/netchild/doxygen/src/tools/kerneldoc/subsys/Doxyfile-linux user/netchild/doxygen/src/tools/kerneldoc/subsys/Makefile user/netchild/doxygen/src/tools/kerneldoc/subsys/common-Doxyfile Modified: user/netchild/doxygen/src/sys/dev/sound/pcm/dsp.c ============================================================================== --- user/netchild/doxygen/src/sys/dev/sound/pcm/dsp.c Wed Oct 15 15:32:03 2008 (r183919) +++ user/netchild/doxygen/src/sys/dev/sound/pcm/dsp.c Wed Oct 15 15:39:20 2008 (r183920) @@ -2178,7 +2178,7 @@ dsp_unit2name(char *buf, size_t len, int * @note * Calling threads must not hold any snddev_info or pcm_channel locks. * - * @param dev device on which the ioctl was issued + * @param i_dev device on which the ioctl was issued * @param ai ioctl request data container * * @retval 0 success Modified: user/netchild/doxygen/src/sys/kern/subr_bus.c ============================================================================== --- user/netchild/doxygen/src/sys/kern/subr_bus.c Wed Oct 15 15:32:03 2008 (r183919) +++ user/netchild/doxygen/src/sys/kern/subr_bus.c Wed Oct 15 15:39:20 2008 (r183920) @@ -1448,7 +1448,7 @@ devclass_delete_device(devclass_t dc, de * @param parent the parent of the new device * @param name the devclass name of the new device or @c NULL * to leave the devclass unspecified - * @parem unit the unit number of the new device of @c -1 to + * @param unit the unit number of the new device of @c -1 to * leave the unit number unspecified * * @returns the new device Modified: user/netchild/doxygen/src/tools/kerneldoc/subsys/Doxyfile-linux ============================================================================== --- user/netchild/doxygen/src/tools/kerneldoc/subsys/Doxyfile-linux Wed Oct 15 15:32:03 2008 (r183919) +++ user/netchild/doxygen/src/tools/kerneldoc/subsys/Doxyfile-linux Wed Oct 15 15:39:20 2008 (r183920) @@ -12,6 +12,8 @@ EXTRACT_ALL = YES # for un # configuration options related to the input files #--------------------------------------------------------------------------- INPUT = $(DOXYGEN_SRC_PATH)/compat/linux \ + $(DOXYGEN_SRC_PATH)/compat/linprocfs \ + $(DOXYGEN_SRC_PATH)/compat/linsysfs \ $(DOXYGEN_LINUX_PATH) $(NOTREVIEWED) GENERATE_TAGFILE = linux/linux.tag Modified: user/netchild/doxygen/src/tools/kerneldoc/subsys/Makefile ============================================================================== --- user/netchild/doxygen/src/tools/kerneldoc/subsys/Makefile Wed Oct 15 15:32:03 2008 (r183919) +++ user/netchild/doxygen/src/tools/kerneldoc/subsys/Makefile Wed Oct 15 15:39:20 2008 (r183920) @@ -73,16 +73,16 @@ usage: all: ${ALL} pdf-all:${PDF_ALL} -mfiles: ${HFILES:S/^/${.OBJDIR}\//} +mfiles: ${HFILES:S/^/${.OBJDIR}\/include\//} DOXYGEN_DEST_PATH= ${.OBJDIR} DOXYGEN_LATEX_DEST_PATH=${.OBJDIR} DOXYGEN_PDF_DEST_PATH= ${.OBJDIR} -.if exists{${S}/${TARGET_ARCH}/linux} +.if exists(${S}/${TARGET_ARCH}/linux) DOXYGEN_LINUX_PATH= ${S}/${TARGET_ARCH}/linux .endif -.if exists{${S}/${TARGET_ARCH}/linux32} +.if exists(${S}/${TARGET_ARCH}/linux32) DOXYGEN_LINUX_PATH+= ${S}/${TARGET_ARCH}/linux32 .endif @@ -98,7 +98,7 @@ ${.OBJDIR}/${target}/${target}.tag: env DOXYGEN_INCLUDE_PATH=${.CURDIR} \ DOXYGEN_SRC_PATH=${S} \ DOXYGEN_DEST_PATH=${DOXYGEN_DEST_PATH} \ - DOXYGEN_SRC_INCLUDE_PATH="${S}/sys ${S}/../include ${S}/${TARGET_ARCH}/include" \ + DOXYGEN_SRC_INCLUDE_PATH="${S}/sys ${S}/../include ${S}/${TARGET_ARCH}/include ${.OBJDIR}/include" \ DOXYGEN_TARGET_ARCH=${TARGET_ARCH} \ DOXYGEN_LINUX_PATH=${DOXYGEN_LINUX_PATH} \ NOTREVIEWED=${.CURDIR}/notreviewed.dox \ @@ -118,9 +118,10 @@ clean-${target}: .endfor .for file in ${MFILES} -CLEANDIRS+= ${.OBJDIR}/${file:T:S/.m$/.h/} -${.OBJDIR}/${file:T:S/.m$/.h/}: ${S}/${file} - cd ${.OBJDIR}; ${AWK} -f $S/tools/makeobjops.awk ${S}/${file} -h +CLEANDIRS+= ${.OBJDIR}/include/${file:T:S/.m$/.h/} +${.OBJDIR}/include/${file:T:S/.m$/.h/}: ${S}/${file} + @mkdir -p ${.OBJDIR}/include + cd ${.OBJDIR}/include && ${AWK} -f $S/tools/makeobjops.awk ${S}/${file} -h .endfor # Modified: user/netchild/doxygen/src/tools/kerneldoc/subsys/common-Doxyfile ============================================================================== --- user/netchild/doxygen/src/tools/kerneldoc/subsys/common-Doxyfile Wed Oct 15 15:32:03 2008 (r183919) +++ user/netchild/doxygen/src/tools/kerneldoc/subsys/common-Doxyfile Wed Oct 15 15:39:20 2008 (r183920) @@ -1,16 +1,80 @@ -# Doxyfile 1.4.1 +# Doxyfile 1.5.2 # $FreeBSD$ +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file that +# follow. The default is UTF-8 which is also the encoding used for all text before +# the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into +# libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of +# possible encodings. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + PROJECT_NUMBER = + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + CREATE_SUBDIRS = YES + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian, +# Italian, Japanese, Japanese-en (Japanese with English messages), Korean, +# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, +# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. + OUTPUT_LANGUAGE = English -USE_WINDOWS_ENCODING = NO + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + ABBREVIATE_BRIEF = "The $name class" \ "The $name widget" \ "The $name file" \ @@ -22,63 +86,384 @@ ABBREVIATE_BRIEF = "The $name clas a \ an \ the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like the Qt-style comments (thus requiring an +# explicit @brief command for a brief description. + JAVADOC_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + MULTILINE_CPP_IS_BRIEF = NO + +# If the DETAILS_AT_TOP tag is set to YES then Doxygen +# will output the detailed description near the top, like JavaDoc. +# If set to NO, the detailed description appears after the member +# documentation. + DETAILS_AT_TOP = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + INHERIT_DOCS = YES -DISTRIBUTE_GROUP_DOC = NO + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for Java. +# For instance, namespaces will be presented as packages, qualified scopes +# will look different, etc. + OPTIMIZE_OUTPUT_JAVA = NO + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to +# include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + SUBGROUPING = YES + #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + EXTRACT_PRIVATE = YES + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + EXTRACT_LOCAL_METHODS = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + INTERNAL_DOCS = YES + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + SHOW_INCLUDE_FILES = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + SORT_BRIEF_DOCS = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + SHOW_DIRECTORIES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from the +# version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + FILE_VERSION_FILTER = + #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + WARN_LOGFILE = + #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- + +# This tag can be used to specify the character encoding of the source files that +# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default +# input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding. +# See http://www.gnu.org/software/libiconv for the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py + FILE_PATTERNS = *.c \ *.cc \ *.cxx \ @@ -117,150 +502,761 @@ FILE_PATTERNS = *.c \ *.PHP3 \ *.M \ *.MM + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + EXCLUDE_PATTERNS = */.\#* + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the output. +# The symbol name can be a fully qualified name, a word, or if the wildcard * is used, +# a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + FILTER_SOURCE_FILES = NO + #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES (the default) +# then for each documented function all documented +# functions referencing it will be listed. + REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES (the default) +# then for each documented function all documented entities +# called/used by that function will be listed. + REFERENCES_RELATION = YES + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentstion. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + VERBATIM_HEADERS = YES + #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- -ALPHABETICAL_INDEX = NO + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + IGNORE_PREFIX = + #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + TOC_EXPAND = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. + GENERATE_TREEVIEW = YES + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + TREEVIEW_WIDTH = 250 + #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + GENERATE_LATEX = YES + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + USE_PDFLATEX = YES -LATEX_BATCHMODE = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = YES + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + LATEX_HIDE_INDICES = NO + #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + RTF_EXTENSIONS_FILE = + #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + MAN_LINKS = NO + #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Wed Oct 15 15:43:19 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51A6D1065692; Wed, 15 Oct 2008 15:43:19 +0000 (UTC) (envelope-from john@baldwin.cx) Received: from server.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id E7FA08FC08; Wed, 15 Oct 2008 15:43:18 +0000 (UTC) (envelope-from john@baldwin.cx) Received: from localhost.corp.yahoo.com (john@localhost [IPv6:::1]) (authenticated bits=0) by server.baldwin.cx (8.14.2/8.14.2) with ESMTP id m9FFgnk1035228; Wed, 15 Oct 2008 11:42:49 -0400 (EDT) (envelope-from john@baldwin.cx) From: John Baldwin To: Edwin Groothuis Date: Wed, 15 Oct 2008 10:54:58 -0400 User-Agent: KMail/1.9.7 References: <200810142351.m9ENpUJ4019023@svn.freebsd.org> In-Reply-To: <200810142351.m9ENpUJ4019023@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200810151054.59231.john@baldwin.cx> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [IPv6:::1]); Wed, 15 Oct 2008 11:42:49 -0400 (EDT) X-Virus-Scanned: ClamAV 0.93.1/8430/Wed Oct 15 08:57:56 2008 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=4.2 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r183899 - user/edwin/top/top-3.8b1/usr.bin/top X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Oct 2008 15:43:19 -0000 On Tuesday 14 October 2008 07:51:30 pm Edwin Groothuis wrote: > Author: edwin > Date: Tue Oct 14 23:51:30 2008 > New Revision: 183899 > URL: http://svn.freebsd.org/changeset/base/183899 > > Log: > Display the original command between ()'s just like the old top did > when the command and the first argument of the command-line-arguments > don't match. > > According to include/sys/user.h, PS_INMEM is obsoleted in favour > of P_INMEM, not the other way around. This change is not quite correct. You should use P_INMEM for <= 4 and >= 7, and PS_INMEM for >= 5 and <= 6. -- John Baldwin From owner-svn-src-user@FreeBSD.ORG Wed Oct 15 20:44:00 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A65311065687; Wed, 15 Oct 2008 20:44:00 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8DBB58FC08; Wed, 15 Oct 2008 20:44:00 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9FKi0ku042941; Wed, 15 Oct 2008 20:44:00 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9FKi0iL042940; Wed, 15 Oct 2008 20:44:00 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810152044.m9FKi0iL042940@svn.freebsd.org> From: Edwin Groothuis Date: Wed, 15 Oct 2008 20:44:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183924 - user/edwin/top/top-3.8b1/usr.bin/top X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Oct 2008 20:44:00 -0000 Author: edwin Date: Wed Oct 15 20:44:00 2008 New Revision: 183924 URL: http://svn.freebsd.org/changeset/base/183924 Log: Use P_INMEM for >= 7, and PS_INMEM otherwise. Fix comment about "successfull" at the same time. Submitted by: John Baldwin , bde@ Modified: user/edwin/top/top-3.8b1/usr.bin/top/machine.c Modified: user/edwin/top/top-3.8b1/usr.bin/top/machine.c ============================================================================== --- user/edwin/top/top-3.8b1/usr.bin/top/machine.c Wed Oct 15 19:24:18 2008 (r183923) +++ user/edwin/top/top-3.8b1/usr.bin/top/machine.c Wed Oct 15 20:44:00 2008 (r183924) @@ -737,7 +737,7 @@ fmt_command(char *buf, int sz, struct ki char *rawcmd; int argc; -#if OSMAJOR > 4 +#if OSMAJOR >= 7 inmem = (PP(pp, flag) & P_INMEM); #else inmem = (PP(pp, sflag) & PS_INMEM); @@ -749,7 +749,8 @@ fmt_command(char *buf, int sz, struct ki if ((args = kvm_getargv(kd, pp, sz)) != NULL) { /* - * successfull retrieval: now convert nulls and cr/lf in to spaces + * Successful retrieval. + * Now convert nulls and cr/lf in to spaces. */ bufp = cmd; cmd[0] = '\0'; From owner-svn-src-user@FreeBSD.ORG Wed Oct 15 20:48:10 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C23F31065686; Wed, 15 Oct 2008 20:48:10 +0000 (UTC) (envelope-from edwin@mavetju.org) Received: from k7.mavetju.org (ppp121-44-151-188.lns10.syd7.internode.on.net [121.44.151.188]) by mx1.freebsd.org (Postfix) with ESMTP id 3B79B8FC18; Wed, 15 Oct 2008 20:48:10 +0000 (UTC) (envelope-from edwin@mavetju.org) Received: by k7.mavetju.org (Postfix, from userid 1001) id C6E344503D; Thu, 16 Oct 2008 07:27:53 +1100 (EST) Date: Thu, 16 Oct 2008 07:27:53 +1100 From: Edwin Groothuis To: John Baldwin Message-ID: <20081015202753.GO71453@mavetju.org> References: <200810142351.m9ENpUJ4019023@svn.freebsd.org> <200810151054.59231.john@baldwin.cx> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200810151054.59231.john@baldwin.cx> User-Agent: Mutt/1.4.2.3i Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r183899 - user/edwin/top/top-3.8b1/usr.bin/top X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Oct 2008 20:48:10 -0000 On Wed, Oct 15, 2008 at 10:54:58AM -0400, John Baldwin wrote: > On Tuesday 14 October 2008 07:51:30 pm Edwin Groothuis wrote: > > Author: edwin > > Date: Tue Oct 14 23:51:30 2008 > > New Revision: 183899 > > URL: http://svn.freebsd.org/changeset/base/183899 > > > > Log: > > Display the original command between ()'s just like the old top did > > when the command and the first argument of the command-line-arguments > > don't match. > > > > According to include/sys/user.h, PS_INMEM is obsoleted in favour > > of P_INMEM, not the other way around. > > This change is not quite correct. You should use P_INMEM for <= 4 and >= 7, > and PS_INMEM for >= 5 and <= 6. Aha, that explains the strange combination of comments I saw in the include file and the piece of code. Thanks for spotting this! Edwin -- Edwin Groothuis Website: http://www.mavetju.org/ edwin@mavetju.org Weblog: http://www.mavetju.org/weblog/ From owner-svn-src-user@FreeBSD.ORG Thu Oct 16 01:46:01 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D67321065688; Thu, 16 Oct 2008 01:46:01 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AC8EF8FC08; Thu, 16 Oct 2008 01:46:01 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9G1k15U048384; Thu, 16 Oct 2008 01:46:01 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9G1k1eY048383; Thu, 16 Oct 2008 01:46:01 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200810160146.m9G1k1eY048383@svn.freebsd.org> From: Kip Macy Date: Thu, 16 Oct 2008 01:46:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183928 - user/kmacy/HEAD_ECMP X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Oct 2008 01:46:01 -0000 Author: kmacy Date: Thu Oct 16 01:46:01 2008 New Revision: 183928 URL: http://svn.freebsd.org/changeset/base/183928 Log: Create branch for ECMP changes Added: user/kmacy/HEAD_ECMP/ - copied from r183927, head/ From owner-svn-src-user@FreeBSD.ORG Thu Oct 16 10:04:34 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 850961065698; Thu, 16 Oct 2008 10:04:34 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7338B8FC0C; Thu, 16 Oct 2008 10:04:34 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9GA4Ylm057294; Thu, 16 Oct 2008 10:04:34 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9GA4Ymw057293; Thu, 16 Oct 2008 10:04:34 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810161004.m9GA4Ymw057293@svn.freebsd.org> From: Alexander Leidinger Date: Thu, 16 Oct 2008 10:04:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183931 - in user/netchild/calendar-utf8: . src src/usr.bin src/usr.bin/calendar X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Oct 2008 10:04:34 -0000 Author: netchild Date: Thu Oct 16 10:04:34 2008 New Revision: 183931 URL: http://svn.freebsd.org/changeset/base/183931 Log: Baseline for UTF-8-ification of the calendar utility. Added: user/netchild/calendar-utf8/ user/netchild/calendar-utf8/src/ user/netchild/calendar-utf8/src/usr.bin/ user/netchild/calendar-utf8/src/usr.bin/calendar/ user/netchild/calendar-utf8/src/usr.bin/calendar/Makefile (props changed) - copied unchanged from r183911, head/usr.bin/calendar/Makefile Copied: user/netchild/calendar-utf8/src/usr.bin/calendar/Makefile (from r183911, head/usr.bin/calendar/Makefile) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/netchild/calendar-utf8/src/usr.bin/calendar/Makefile Thu Oct 16 10:04:34 2008 (r183931, copy of r183911, head/usr.bin/calendar/Makefile) @@ -0,0 +1,30 @@ +# @(#)Makefile 8.1 (Berkeley) 6/6/93 +# $FreeBSD$ + +PROG= calendar +SRCS= calendar.c io.c day.c ostern.c paskha.c +INTER= de_AT.ISO_8859-15 de_DE.ISO8859-1 fr_FR.ISO8859-1 \ + hr_HR.ISO8859-2 hu_HU.ISO8859-2 ru_RU.KOI8-R uk_UA.KOI8-U +DE_LINKS= de_DE.ISO8859-15 +FR_LINKS= fr_FR.ISO8859-15 +TEXTMODE?= 444 + +beforeinstall: + ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${TEXTMODE} \ + ${.CURDIR}/calendars/calendar.* ${DESTDIR}${SHAREDIR}/calendar +.for lang in ${INTER} + mkdir -p ${DESTDIR}${SHAREDIR}/calendar/${lang} + ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${TEXTMODE} \ + ${.CURDIR}/calendars/${lang}/calendar.* \ + ${DESTDIR}${SHAREDIR}/calendar/${lang} +.endfor +.for link in ${DE_LINKS} + rm -rf ${DESTDIR}${SHAREDIR}/calendar/${link} + ln -s de_DE.ISO8859-1 ${DESTDIR}${SHAREDIR}/calendar/${link} +.endfor +.for link in ${FR_LINKS} + rm -rf ${DESTDIR}${SHAREDIR}/calendar/${link} + ln -s fr_FR.ISO8859-1 ${DESTDIR}${SHAREDIR}/calendar/${link} +.endfor + +.include From owner-svn-src-user@FreeBSD.ORG Thu Oct 16 10:06:57 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA8E71065794; Thu, 16 Oct 2008 10:06:57 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 974548FC17; Thu, 16 Oct 2008 10:06:57 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9GA6vlk057372; Thu, 16 Oct 2008 10:06:57 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9GA6vHT057364; Thu, 16 Oct 2008 10:06:57 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810161006.m9GA6vHT057364@svn.freebsd.org> From: Alexander Leidinger Date: Thu, 16 Oct 2008 10:06:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183932 - in user/netchild/calendar-utf8/src/usr.bin/calendar: . calendars calendars/de_DE.UTF-8 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Oct 2008 10:06:57 -0000 Author: netchild Date: Thu Oct 16 10:06:56 2008 New Revision: 183932 URL: http://svn.freebsd.org/changeset/base/183932 Log: Automatic translation of the German calendar from latin1 to UTF-8. Added: user/netchild/calendar-utf8/src/usr.bin/calendar/calendars/ user/netchild/calendar-utf8/src/usr.bin/calendar/calendars/de_DE.UTF-8/ user/netchild/calendar-utf8/src/usr.bin/calendar/calendars/de_DE.UTF-8/calendar.all user/netchild/calendar-utf8/src/usr.bin/calendar/calendars/de_DE.UTF-8/calendar.feiertag user/netchild/calendar-utf8/src/usr.bin/calendar/calendars/de_DE.UTF-8/calendar.geschichte user/netchild/calendar-utf8/src/usr.bin/calendar/calendars/de_DE.UTF-8/calendar.kirche user/netchild/calendar-utf8/src/usr.bin/calendar/calendars/de_DE.UTF-8/calendar.literatur user/netchild/calendar-utf8/src/usr.bin/calendar/calendars/de_DE.UTF-8/calendar.musik user/netchild/calendar-utf8/src/usr.bin/calendar/calendars/de_DE.UTF-8/calendar.wissenschaft Modified: user/netchild/calendar-utf8/src/usr.bin/calendar/Makefile Modified: user/netchild/calendar-utf8/src/usr.bin/calendar/Makefile ============================================================================== --- user/netchild/calendar-utf8/src/usr.bin/calendar/Makefile Thu Oct 16 10:04:34 2008 (r183931) +++ user/netchild/calendar-utf8/src/usr.bin/calendar/Makefile Thu Oct 16 10:06:56 2008 (r183932) @@ -3,7 +3,7 @@ PROG= calendar SRCS= calendar.c io.c day.c ostern.c paskha.c -INTER= de_AT.ISO_8859-15 de_DE.ISO8859-1 fr_FR.ISO8859-1 \ +INTER= de_AT.ISO_8859-15 de_DE.ISO8859-1 de_DE.UTF-8 fr_FR.ISO8859-1 \ hr_HR.ISO8859-2 hu_HU.ISO8859-2 ru_RU.KOI8-R uk_UA.KOI8-U DE_LINKS= de_DE.ISO8859-15 FR_LINKS= fr_FR.ISO8859-15 Added: user/netchild/calendar-utf8/src/usr.bin/calendar/calendars/de_DE.UTF-8/calendar.all ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/netchild/calendar-utf8/src/usr.bin/calendar/calendars/de_DE.UTF-8/calendar.all Thu Oct 16 10:06:56 2008 (r183932) @@ -0,0 +1,17 @@ +/* + * deutscher Kalender + * + * $FreeBSD$ + */ + +#ifndef _de_DE_UTF_8_all_ +#define _de_DE_UTF_8_all_ + +#include +#include +#include +#include +#include +#include + +#endif /* !_de_DE.UTF_8_all_ */ Added: user/netchild/calendar-utf8/src/usr.bin/calendar/calendars/de_DE.UTF-8/calendar.feiertag ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/netchild/calendar-utf8/src/usr.bin/calendar/calendars/de_DE.UTF-8/calendar.feiertag Thu Oct 16 10:06:56 2008 (r183932) @@ -0,0 +1,56 @@ +/* + * Feiertage + * + * $FreeBSD$ + */ + +#ifndef _de_DE_UTF_8_feiertag_ +#define _de_DE_UTF_8_feiertag_ + +LANG=de_DE.UTF-8 + +/* arbeitsfreie staatliche Feiertage */ +01/01 Neujahr +05/01 Maifeiertag +10/03 Tag der deutschen Einheit + +/* christliche Feiertage, meist irgendwo arbeitsfrei */ +Easter-2 Karfreitag +Easter Ostersonntag +Easter+1 Ostermontag +Easter+49 Pfingstsonntag +Easter+50 Pfingstmontag +Easter+39 Christi Himmelfahrt +Easter+60 Fronleichnam + +08/08 Friedensfest (Augsburg) +08/15 Mariä Himmelfahrt + +10/31 Reformationstag +11/01 Allerheiligen +11/02 Allerseelen +11/Wed+4 Buß- und Bettag + +12/24 Heiligabend +12/25 Erster Weihnachtstag +12/26 Zweiter Weihnachtstag +12/31 Silvester + +/* Gedenktage - nicht arbeitsfreie Feiertage :-( */ +06/17 Arbeiteraufstand am 17. Juni 1953 +01/27 Gedenktag für die Opfer des Nationalsozialismus + +/* Jahreszeiten */ +03/20* Frühlingsanfang +06/21* Sommeranfang +09/23* Herbstanfang +12/21* Winteranfang + +/* Sommer- und Winterzeit */ +03/SundayLast Anfang der Sommerzeit +10/SundayLast Ende der Sommerzeit + +/* Blumenverkäufer */ +May Sun+2 Muttertag + +#endif /*! _de_DE_UTF_8_feiertag_ */ Added: user/netchild/calendar-utf8/src/usr.bin/calendar/calendars/de_DE.UTF-8/calendar.geschichte ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/netchild/calendar-utf8/src/usr.bin/calendar/calendars/de_DE.UTF-8/calendar.geschichte Thu Oct 16 10:06:56 2008 (r183932) @@ -0,0 +1,198 @@ +/* + * deutsche Geschichte + * + * + * Die Angaben wurden überwiegend entnommen aus dem Buch: + * + * Fragen an die deutsche Geschichte, Ideen, Kräfte, Entscheidungen von + * 1800 bis zur Gegenwart; historische Ausstellung im Reichstagsgebäude + * in Berlin; Katalog, 16. Auflage, Sonderausgabe - Bonn: Deutscher + * Bundestag, Referat Öffentlichkeitsarbeit, 1990 + * + * English Title: Questions on German history + * + * ISBN 3-924521-59-X + * + * $FreeBSD$ + */ + +#ifndef _de_DE_UTF_8_geschichte_ +#define _de_DE_UTF_8_geschichte_ + +LANG=de_DE.UTF-8 + +/* 1800-1933 */ +07/11 Gründung des Rheinbundes, 1806 +10/14 Doppelschlacht bei Jena und Auerstedt, 1806 +10/16 Völkerschlacht bei Leipzig, 1813 +06/18 Niederlage Napoleons bei Waterloo, 1815 +10/18 Wartburgfest der Deutschen Burschenschaften, 1817 +01/01 Inkrafttreten des Vertrages über den deutschen Zollverein, 1834 +12/07 Erste deutsche Eisenbahn zwischen Nürnberg und Fürth, 1835 +06 Aufstand der schlesischen Weber, 1844 +12/21 Verabschiedung des Gesetzes über die Grundrechte des deutschen + Volkes durch die Frankfurter Nationalversammlung, 1848 +03/27 Annahme der deutschen Reichsverfassung in der Frankfurter + Paulskirche, Wahl von Friedrich Wilhelm IV von Preußen zum + deutschen Kaiser, 1849 +04/28 Ablehnung der deutschen Kaiserkrone durch den preußischen König, 1849 +07/03 Schlacht von Königgrätz +07/13 Emser Depesche, 1870 +07/18 Verkündung des Dogmas von der päpstlichen Unfehlbarkeit + durch das I. Vatikanische Konzil +01/18 Proklamation des deutschen Kaiserreiches in Versailles, 1871 +10/18 Verabschiedung des Sozialistengesetzes durch den Reichstag, 1878 +03/20 Entlassung von Bismarck als Reichskanzler und + preußischer Ministerpräsident, 1890 +06/21 Eröffnung des Nord-Ostsee-Kanals, 1895 +01/07 Billigung des Bürgerlichen Gesetzbuches (BGB) durch den Reichstag, 1896 +01/01 Bürgerliches Gesetzbuch tritt in Kraft, 1900 +06/28 Ermordung des österreichischen Thronfolgers Erzherzog Franz + Ferdinand durch serbische Nationalisten in Sarajewo, 1914 +07/28 Kriegserklärung Österreich-Ungarns an Serbien, 1914 +08/01 Deutsche Mobilmachung und Kriegserklärung an Rußland, 1914 +08/03 Deutsche Kriegserklärung an Frankreich, 1914 +08/04 Kriegserklärung Großbritanniens an Deutschland, 1914 +08/04 Bewilligung der Kriegskredite im Reichstag, 1914 +08/26 Schlacht bei Tannenberg, 1914 +02/21 Schlacht um Verdun, 1916 +03/08 Ausbruch der Revolution in Rußland, Abdankung von Zar Nikolaus II, 1917 +04/06 Kriegserklärung der USA an Deutschland, 1917 +12/15 Waffenstillstand zwisch Rußland und Deutschland, 1917 +03/03 Frieden von Brest-Litowsk, 1918 +11/03 Matrosenaufstand in Kiel, 1918 +11/09 Ausrufung der Republik durch Scheidemann (SPD), 1918 +02/11 Friedrich Ebert wird Reichspräsident, Weimar 1919 +06/28 Unterzeichnung des Versailler Vertrages, 1919 +03/21 Volksabstimmung in Oberschlesien, 1921 +04/16 Vertrag von Rapallo, 1922 +06/24 Ermordung von Reichsaußenminister Rathenau, 1922 +01/11 Besetzung des Ruhrgebietes durch Frankreich und Belgien, 1923 +09/10 Eintritt Deutschlands in den Völkerbund, 1926 +10/25 Schwarzer Freitag in New York, Beginn der Weltwirtschaftskrise, 1929 + + +/* II. Weltkrieg */ +10/14 Austritt Deutschlands aus dem Völkerbund, 1933 +03/16 Wiedereinführung der allgemeinen Wehrpflicht in Deutschland, 1935 +10/25 Deutsch-italienischer Vertrag, Achse Berlin-Rom, 1936 +11/25 Antikominternpakt zwischen Deutschland und Japan, 1936 +01/13 Volksabstimmung im Saargebiet über die Rückführung + ins deutsche Reich, 1935 +03/12 Einmarsch deutscher Truppen in Österreich, 1938 +09/29 Münchner Abkommen, 1938 +03/15 Einmarsch deutscher Truppen in die Tschechoslowakei, 1939 +03/23 Rückgabe des Memelgebietes an Deutschland, 1939 +08/23 Abschluß des Hitler-Stalin-Paktes, 1939 +09/03 Kriegserklärung Großbritaniens und Frankreichs an Deutschland, 1939 +04/09 Deutsche Besetzung Dänemarks, Invasion in Norwegen, 1940 +05/10 Deutscher Angriff auf Belgien, die Niederlande, Luxemburg + und Frankreich, 1940 +06/22 Deutscher Angriff gegen die Sowjetunion, 1941 +12/11 Kriegserklärung Deutschlands an die USA, 1941 +01/14 Konferenz von Casablanca, 1943 +01/31 Kapitulation der 6. deutschen Armee in Stalingrad, 1943 +06/06 Alliierte Landung in Nordwestfrankreich, 1944 +02/04 Konferenz von Jalta, 4.-11.2. 1945 +04/25 Zusammentreffen von amerikanischen und sowjetischen Truppen + bei Torgau an der Elbe, 1945 +05/08 Bedingungslose Kapitulation von Deutschland, 1945 +07/01 Rückzug britischer und amerikanischer Truppen aus Sachsen, Thüringen und + Mecklenburg, Einmarsch westlicher Truppen in Berlin, 1945 +07/17 Potsdamer Konferenz, 1945 +09/01 Deutscher Ãœberfall auf Polen, Beginn des 2. Weltkrieges, 1939 +10/01 Verkündigung der Urteile im Nürnberger Hauptkriegsverbrecherprozeß, 1946 +02/25 Auflösung der Landes Preußen durch den Kontrollrat, 1947 +08/06 Erster Atombombenabwurf auf Hiroshima, 1945 +08/08 Atombombenabwurf auf Nagasaki, 1945 +04/19 Aufstand im Warschauer Ghetto, 1943 +12/07 Japan bombardiert Pearl Harbor, 1941 + +/* Deutschland nach dem 2. Weltkrieg */ +04/11 Attentat auf Dutschke, Studentenunruhen, 1968 +04/26 GAU in Tschernobyl, 1986 +05/05 Natobeitritt, Wiederbewaffnung, Souveränität der Bundesrepublik, 1955 +05/06 Rücktritt von Brandt, 1974 +05/16 Wahl von Schmidt (SPD) zum Bundeskanzler, 1974 +05/23 Verkündung des Grundgesetzes, 1949 +05/23 Wahl von Richard von Weizsäcker zum Bundespräsidenten, 1984 +06/05 Marshallplan, 1947 +06/20 Währungsreform in den Westzonen, 1948 +06/24 Beginn der Berliner Blockade, 1948 +07/01 Wahl von Heinrich Lübke zum Bundespräsidenten, 1959 +07/01 Wirtschafts- und Währungsunion, 1990 +08/12 Deutsch-sowjetischer Gewaltverzichtsvertrag, Moskau 1970 +08/14 Wahl zum ersten deutschen Bundestag, 1949 +09/03 Vier-Mächte-Abkommen über Berlin, 1971 +09/05 Entführung und Ermordung von Arbeitgeberpräsident Schleyer, + Entführung einer Lufthansa-Maschine nach Mogadischu, 1977 +09/07 DDR-Staatsratsvorsitzender Honecker in der Bundesrepublik, 1987 +09/12 Wahl von Theodor Heuss (FDP) zum Bundespräsidenten, 1949 +09/15 Wahl von Konrad Adenauer (CDU) zum Bundeskanzler, 1949 +09/17 Bruch der Sozialliberalen Koalition, 1982 +09/18 Aufnahme von Bundesrepublik und DDR in die UNO, 1973 +10/01 Ablösung von Bundeskanzler Schmidt durch Kohl, 1982 +10/23 Volksabstimmung im Saargebiet, 1955 +12/02 Washingtoner Abkommen über Bi-Zone, 1946 +12/07 Deutsch-polnischer Vertrag, Warschau 1970 +12/10 Friedensnobelpreis für Brandt, 1971 +12/12 Nachrüstungsbeschluß des NATO-Ministerates, 1979 +12/21 Grundlagenvertrag zwischen DDR und Bundesrepublik, 1972 + + +/* Nationalsozialismus */ +11/09 Hitler-Putsch in München/Marsch auf die Feldherrenhalle, 1923 +11/09 Reichskristallnacht, 1938 +09/14 Reichstagswahl: Erdrutsch zugunsten der NSDAP, 1930 +07/31 Reichstagswahl: NSDAP wird stärkste Fraktion, 1932 +11/06 Reichstagswahl: Rückgang der NSDAP, 1932 +01/30 Ernennung von Hitler zum Reichskanzler, 1933 +02/27 Reichstagsbrand, 1933 +03/05 Reichstagswahl: Mehrheit für NSDAP+DNVP, 1933 +03/23 Annahme des Ermächtigungsgesetzes, 1933 +03/31 Erstes Gesetz zur Gleichschaltung der Länder, 1933 +04/01 Organisierter Boykott jüdischer Geschäfte, 1933 +04/07 Zweites Gesetz zur Gleichschaltung der Länder, 1933 +05/02 Auflösung der Gewerkschaften, 1933 +06 Auflösung aller Parteien außer NSDAP, 1933 +07/20 Konkordat zwischen Deutschland und dem Vatikan, 1933 +06/30 Röhm-Putsch, Ausschaltung der SA-Führung, 1934 +09/15 Nürnberger Gesetze, 1935 +01/08 Eröffnung der olympischen Spiele in Berlin, 1936 +01/20 Wannseekonferenz, 1942 +04/30 Selbstmord Hitlers, 1945 +07/29 Mussolini geboren, 1883 + +/* Sozialismus */ +01/21 Lenin gestorben, 1924 +06 Gründung des Bundes der Kommunisten in London + durch Marx und Engels, 1847 +05/23 Gründung des Allgemeinen Deutschen Arbeitervereins in Leipzig + unter Führung von Ferdinand Lassalles, 1863 +08/07 Gründung der Sozialdemokratischen Arbeiterpartei in Eisenach + unter der Führung von August Bebel und Wilhelm Liebknecht, 1869 +04/06 Gründung der Unabhängigen Sozialdemokratischen Partei, Gotha 1917 +11/07 Oktoberrevolution in Rußland, Putsch der Bolschewisten, 1917 +12/31 Gründung der KPD, 1918 +01/15 Ermordung von Rosa Luxemburg und Karl Liebknecht, 1919 +03/05 Tod Stalins, 1953 +03/18 Erste demokratische Volkskammerwahl, 1990 +04/21 Zwangsvereinigung von KPD und SPD zur SED, 1946 +05/14 Gründung der Warschauer Paktes, 1955 +06/17 Arbeiteraufstand am 17. Juni 1953 +06/25 Begin der Korea-Krieges, 1950 +08/13 Bau der Berliner Mauer, 1961 +08/21 Einmarsch des Warschauer Pakts in die Tschechoslowakei, 1968 +10/03 Offizielles Ende der DDR :-), 1990 +10/07 Gründung der DDR, 1949 +10/09 Massendemonstration in Leipzig, 1989 +10/14 Kuba-Krise, 1962 +10/18 Ablösung von Erich Honecker als SED-Generalsekretär, 1989 +11/09 Fall der Berliner Mauer, 1989 +09/09 Mao Tse-Tung gestorben im Alter von 82 Jahren, 1976 +11/10 Sowjetischer Präsident Leonid Breschnew gestorben, Alter 75, 1982 +03/27 Chruschtschow wird sowjetischer Präsident, 1958 +10/12 Chruschtschow schlägt während einer Rede in der UNO mit den + Schuhen auf den Tisch, 1960 + +#endif /* _de_DE_UTF_8_geschichte_ */ Added: user/netchild/calendar-utf8/src/usr.bin/calendar/calendars/de_DE.UTF-8/calendar.kirche ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/netchild/calendar-utf8/src/usr.bin/calendar/calendars/de_DE.UTF-8/calendar.kirche Thu Oct 16 10:06:56 2008 (r183932) @@ -0,0 +1,32 @@ +/* + * Kirche in Deutschland + * + * $FreeBSD$ + */ + +#ifndef _de_DE_UTF_8_kirche_ +#define _de_DE_UTF_8_kirche_ + +LANG=de_DE.UTF-8 + +Easter-46 Aschermittwoch +Easter-48 Rosenmontag +Easter-7 Palmsonntag + +11/Sun-3 Volkstrauertag (maybe) +11/Sun-2 Volkstrauertag oder Totensonntag +11/Sun-1 1. Advent oder Totensonntag +12/Sun+1 1. oder 2. Advent +12/Sun+2 2. oder 3. Advent +12/Sun+3 3. oder 4. Advent +12/Sun+4 4. Advent (maybe) + +12/06 Nikolaus +12/25 1. Weihnachtstag +12/26 2. Weihnachtstag + +/* Evangelische Kirche */ +11/10 Martin Luther geboren in Eisleben, 1483 +10/31 95 Thesen von Luther, Wittenberg, 1517 + +#endif /* !_de_DE_UTF_8_kirche_ */ Added: user/netchild/calendar-utf8/src/usr.bin/calendar/calendars/de_DE.UTF-8/calendar.literatur ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/netchild/calendar-utf8/src/usr.bin/calendar/calendars/de_DE.UTF-8/calendar.literatur Thu Oct 16 10:06:56 2008 (r183932) @@ -0,0 +1,54 @@ +/* + * Literatur + * + * $FreeBSD$ + */ + +#ifndef _de_DE_UTF_8_literatur_ +#define _de_DE_UTF_8_literatur_ + +LANG=de_DE.UTF-8 + +/* Schriftsteller + + Fontane + Goethe + Grass + Hegel + Heine + Schiller + */ + +01/04 Jakob Grimm geboren, 1785 +01/18 Arno Schmidt in Hamburg geboren, 1914 +02/09 Thomas Bernhard in Heerlen geboren, 1931 +02/12 Immanuel Kant in Königsberg gestorben, 1804 +02/12 Thomas Bernhard in Gmunden gestorben, 1989 +02/17 Heinrich Heine in Paris gestorben, 1856 +03/22 Johann Wolfgang von Goethe in Weimar gestorben, 1832 +04/22 Kant geboren, 1724 +05/09 Friedrich von Schiller in Weimar gestorben, 1805 +06/03 Arno Schmidt in Celle gestorben, 1979 +06/03 Franz Kafka in Prag gestorben, 1924 +06/06 Thomas Mann in Lübeck geboren, 1875 +07/03 Franz Kafka geboren, 1883 +08/12 Thomas Mann gestorben, 1955 +08/27 Georg Wilhelm Friedrich Hegel in Stuttgart geboren, 1770 +08/28 Johann Wolfgang von Goethe in Frankfurt am Main geboren, 1749 +09/20 Theodor Fontane in Berlin gestorben, 1898 +10/16 Günter Grass in Danzig geboren, 1927 +11/10 Friedrich von Schiller in Marbach geboren, 1759 +11/14 Georg Wilhelm Friedrich Hegel in Berlin gestorben, 1831 +12/13 Heinrich Heine in Düsseldorf geboren, 1797 +12/30 Theodor Fontane in Neuruppin geboren, 1819 + + +/* Verlage */ +03/09 "die tageszeitung" als erste täglich aktualisierte deutsche + Tageszeitung im WWW, 1995, Betatest, vollständige Ausgabe +05/05 Schweriner Volkszeitung als erste deutsche Tageszeitung im WWW, 1995 +05/12 "die tageszeitung" offiziell im WWW, 1995 +08/31 Hitler stellt Frankfurter Zeitung ein, 1943 +11/01 Frankfurter Allgemeine Zeitung in Leben gerufen, 1949 + +#endif /* !_de_DE_UTF_8_literatur_ */ Added: user/netchild/calendar-utf8/src/usr.bin/calendar/calendars/de_DE.UTF-8/calendar.musik ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/netchild/calendar-utf8/src/usr.bin/calendar/calendars/de_DE.UTF-8/calendar.musik Thu Oct 16 10:06:56 2008 (r183932) @@ -0,0 +1,66 @@ +/* + * Musik + * + * $FreeBSD$ + */ + +#ifndef _de_DE_UTF_8_musik_ +#define _de_DE_UTF_8_musik_ + +LANG=de_DE.UTF-8 + +/* Barock */ +02/23 Georg Friedrich Händel in Halle an der Saale geboren, 1685 +03/14 Georg Philipp Telemann in Magdeburg geboren, 1681 +03/21 Johann Sebastian Bach in Eisenach geboren, 1685 +04/14 Georg Friedrich Händel in London gestorben, 1759 +06/25 Georg Philipp Telemann in Hamburg gestorben, 1767 +07/17 Diderich Buxtehude in Lübeck gestorben, 1707 +07/28 Johann Sebastian Bach in Leipzig gestorben, 1750 + +/* Klassik */ +01/27 Wolfgang Amadeus Mozart in Salzburg geboren, 1756 +01/31 Franz Schubert in Lichtenthal bei Wien geboren, 1797 +02/03 Felix Mendelssohn Bartholdy in Hamburg geboren, 1809 +02/13 Richard Wagner in Venedig gestorben, 1883 +03/01 Frederic Chopin in Zelazowa-Wola bei Warschau geboren, 1810 +03/08 (Louis) Hector Berlioz in Paris gestorben, 1869 +03/25 Bela Bartok in Nagyszentmiklos geboren, 1881 +03/26 Ludwig van Beethoven in Wien gestorben, 1827 +03/28 Sergej Rachmaninow in Beverley Hills gestorben, 1943 +03/29 Carl Orff in München gestorben, 1982 +03/31 Joseph Haydn in Rohrau geboren, 1732 +04/01 Sergej Rachmaninow in Oneg geboren, 1873 +04/03 Johannes Brahms in Wien gestorben, 1897 +05/07 Johannes Brahms in Hamburg geboren, 1833 +05/18 Gustav Mahler in Wien gestorben, 1911 +05/22 Richard Wagner in Leipzig geboren, 1813 +05/31 Joseph Haydn in Wien gestorben, 1809 +06/03 Georges Bizet in Bougival bei Paris gestorben, 1875 +06/05 Carl Maria von Weber in London gestorben, 1826 +06/08 Robert Schumann in Zwickau geboren, 1810 +06/11 Richard Strauss in München geboren, 1864 +06/15 Edvard Grieg in Bergen geboren, 1843 +07/07 Gustav Mahler in Kalischt geboren, 1860 +07/10 Carl Orff in München geboren, 1895 +07/29 Robert Schumann in Endenich bei Bonn gestorben, 1856 +07/31 Franz Liszt in Bayreuth gestorben, 1886 +09/04 Edvard Grieg in Bergen gestorben, 1907 +09/08 Richard Strauss in Garmisch-Partenkirchen gestorben, 1949 +09/26 Bela Bartok in New York gestorben, 1945 +10/17 Frederic Chopin in Paris gestorben, 1849 +10/22 Franz Liszt in Raiding (Ungarn) geboren, 1811 +10/25 Georges Bizet in Paris geboren, 1838 +11/04 Felix Mendelssohn Bartholdy in Leipzig gestorben, 1847 +11/18 Carl Maria von Weber in Eutin geboren, 1786 +11/19 Franz Schubert in Wien gestorben, 1828 +11/26 Paul Hindemith in Hanau geboren, 1895 +12/05 Wolfgang Amadeus Mozart in Wien gestorben, 1791 +12/11 (Louis) Hector Berlioz in La-Côte-Saint-André geboren, 1803 +12/17 Ludwig van Beethoven in Bonn getauft, 1770 +12/28 Paul Hindemith in Frankfurt am Main gestorben, 1963 + +/* Pop */ +09/18 Jimi Hendrix in Paris gestorben, 1970 + +#endif /* !_de_DE_UTF_8_musik_ */ Added: user/netchild/calendar-utf8/src/usr.bin/calendar/calendars/de_DE.UTF-8/calendar.wissenschaft ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/netchild/calendar-utf8/src/usr.bin/calendar/calendars/de_DE.UTF-8/calendar.wissenschaft Thu Oct 16 10:06:56 2008 (r183932) @@ -0,0 +1,19 @@ +/* + * Wissenschaft + * + * $FreeBSD$ + */ + +#ifndef _de_DE_UTF_8_wissenschaft_ +#define _de_DE_UTF_8_wissenschaft_ + +LANG=de_DE.UTF-8 + +04/12 Erster Mann im All, Juri Gagarin, 1961 +04/18 Einstein gestorben, 1955 +06/22 Konrad Zuse geboren in Berlin, 1919 +10/04 Sputnik 1, erster Satellit im Weltraum, 1957 +12/18 Konrad Zuse gestorben in Hünfeld, 1995 + + +#endif /* ! _de_DE_UTF_8_wissenschaft_ */ From owner-svn-src-user@FreeBSD.ORG Thu Oct 16 10:15:57 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 06A891065692; Thu, 16 Oct 2008 10:15:57 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D0E658FC13; Thu, 16 Oct 2008 10:15:56 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9GAFujN057559; Thu, 16 Oct 2008 10:15:56 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9GAFu1B057558; Thu, 16 Oct 2008 10:15:56 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810161015.m9GAFu1B057558@svn.freebsd.org> From: Alexander Leidinger Date: Thu, 16 Oct 2008 10:15:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183933 - user/netchild/calendar-utf8 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Oct 2008 10:15:57 -0000 Author: netchild Date: Thu Oct 16 10:15:56 2008 New Revision: 183933 URL: http://svn.freebsd.org/changeset/base/183933 Log: Add a README to this branch, like for the others. Added: user/netchild/calendar-utf8/README Added: user/netchild/calendar-utf8/README ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/netchild/calendar-utf8/README Thu Oct 16 10:15:56 2008 (r183933) @@ -0,0 +1 @@ +UTF-8-ification of the calendar utility From owner-svn-src-user@FreeBSD.ORG Thu Oct 16 10:24:32 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F0F951065696; Thu, 16 Oct 2008 10:24:31 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DC2298FC23; Thu, 16 Oct 2008 10:24:31 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9GAOVtE057737; Thu, 16 Oct 2008 10:24:31 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9GAOV77057733; Thu, 16 Oct 2008 10:24:31 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810161024.m9GAOV77057733@svn.freebsd.org> From: Alexander Leidinger Date: Thu, 16 Oct 2008 10:24:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183934 - in user/netchild/misc: . src src/contrib src/contrib/bind9 src/contrib/bind9/bin src/contrib/bind9/bin/named src/etc src/etc/rc.d src/lib src/lib/libc src/lib/libc/stdlib src/... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Oct 2008 10:24:32 -0000 Author: netchild Date: Thu Oct 16 10:24:31 2008 New Revision: 183934 URL: http://svn.freebsd.org/changeset/base/183934 Log: Create a baseline for various fixes/improvements which do not deserve their own branch. Added: user/netchild/misc/ user/netchild/misc/README user/netchild/misc/src/ user/netchild/misc/src/contrib/ user/netchild/misc/src/contrib/bind9/ user/netchild/misc/src/contrib/bind9/bin/ user/netchild/misc/src/contrib/bind9/bin/named/ user/netchild/misc/src/contrib/bind9/bin/named/interfacemgr.c (props changed) - copied unchanged from r183911, head/contrib/bind9/bin/named/interfacemgr.c user/netchild/misc/src/etc/ user/netchild/misc/src/etc/rc.d/ user/netchild/misc/src/etc/rc.d/localpkg (props changed) - copied unchanged from r183911, head/etc/rc.d/localpkg user/netchild/misc/src/lib/ user/netchild/misc/src/lib/libc/ user/netchild/misc/src/lib/libc/stdlib/ user/netchild/misc/src/lib/libc/stdlib/Makefile.inc (props changed) - copied unchanged from r183911, head/lib/libc/stdlib/Makefile.inc user/netchild/misc/src/sbin/ user/netchild/misc/src/sbin/recoverdisk/ user/netchild/misc/src/sbin/recoverdisk/recoverdisk.c (props changed) - copied unchanged from r183911, head/sbin/recoverdisk/recoverdisk.c user/netchild/misc/src/share/ user/netchild/misc/src/share/man/ user/netchild/misc/src/share/man/man4/ user/netchild/misc/src/share/man/man4/tcp.4 (props changed) - copied unchanged from r183911, head/share/man/man4/tcp.4 user/netchild/misc/src/sys/ user/netchild/misc/src/sys/dev/ user/netchild/misc/src/sys/dev/ata/ user/netchild/misc/src/sys/dev/ata/ata-all.c (props changed) - copied unchanged from r183911, head/sys/dev/ata/ata-all.c user/netchild/misc/src/sys/dev/hptmv/ user/netchild/misc/src/sys/dev/hptmv/hptproc.c (props changed) - copied unchanged from r183911, head/sys/dev/hptmv/hptproc.c user/netchild/misc/src/sys/dev/usb/ user/netchild/misc/src/sys/dev/usb/usbdevs (props changed) - copied unchanged from r183911, head/sys/dev/usb/usbdevs user/netchild/misc/src/sys/dev/usb/uscanner.c (props changed) - copied unchanged from r183911, head/sys/dev/usb/uscanner.c user/netchild/misc/src/sys/gnu/ user/netchild/misc/src/sys/gnu/fs/ user/netchild/misc/src/sys/gnu/fs/ext2fs/ user/netchild/misc/src/sys/gnu/fs/ext2fs/ext2_vfsops.c (props changed) - copied unchanged from r183911, head/sys/gnu/fs/ext2fs/ext2_vfsops.c user/netchild/misc/src/sys/gnu/fs/reiserfs/ user/netchild/misc/src/sys/gnu/fs/reiserfs/reiserfs_vfsops.c (props changed) - copied unchanged from r183911, head/sys/gnu/fs/reiserfs/reiserfs_vfsops.c user/netchild/misc/src/sys/i386/ user/netchild/misc/src/sys/i386/i386/ user/netchild/misc/src/sys/i386/i386/support.s (props changed) - copied unchanged from r183911, head/sys/i386/i386/support.s user/netchild/misc/src/sys/i386/i386/sys_machdep.c (props changed) - copied unchanged from r183911, head/sys/i386/i386/sys_machdep.c user/netchild/misc/src/sys/i386/isa/ user/netchild/misc/src/sys/i386/isa/npx.c (props changed) - copied unchanged from r183911, head/sys/i386/isa/npx.c user/netchild/misc/src/sys/kern/ user/netchild/misc/src/sys/kern/kern_sig.c (props changed) - copied unchanged from r183911, head/sys/kern/kern_sig.c user/netchild/misc/src/sys/netinet/ user/netchild/misc/src/sys/netinet/ip_fw2.c (props changed) - copied unchanged from r183911, head/sys/netinet/ip_fw2.c user/netchild/misc/src/sys/netsmb/ user/netchild/misc/src/sys/netsmb/smb_conn.c (props changed) - copied unchanged from r183911, head/sys/netsmb/smb_conn.c user/netchild/misc/src/usr.sbin/ user/netchild/misc/src/usr.sbin/adduser/ user/netchild/misc/src/usr.sbin/adduser/adduser.sh (props changed) - copied unchanged from r183911, head/usr.sbin/adduser/adduser.sh user/netchild/misc/src/usr.sbin/adduser/rmuser.sh (props changed) - copied unchanged from r183911, head/usr.sbin/adduser/rmuser.sh Added: user/netchild/misc/README ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/netchild/misc/README Thu Oct 16 10:24:31 2008 (r183934) @@ -0,0 +1,2 @@ +Various fixes and improvements which are too small to deserve an own +directory. Copied: user/netchild/misc/src/contrib/bind9/bin/named/interfacemgr.c (from r183911, head/contrib/bind9/bin/named/interfacemgr.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/netchild/misc/src/contrib/bind9/bin/named/interfacemgr.c Thu Oct 16 10:24:31 2008 (r183934, copy of r183911, head/contrib/bind9/bin/named/interfacemgr.c) @@ -0,0 +1,979 @@ +/* + * Copyright (C) 2004-2006, 2008 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 1999-2002 Internet Software Consortium. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/* $Id: interfacemgr.c,v 1.76.18.8.44.3 2008/07/23 23:16:43 marka Exp $ */ + +/*! \file */ + +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#define IFMGR_MAGIC ISC_MAGIC('I', 'F', 'M', 'G') +#define NS_INTERFACEMGR_VALID(t) ISC_MAGIC_VALID(t, IFMGR_MAGIC) + +#define IFMGR_COMMON_LOGARGS \ + ns_g_lctx, NS_LOGCATEGORY_NETWORK, NS_LOGMODULE_INTERFACEMGR + +/*% nameserver interface manager structure */ +struct ns_interfacemgr { + unsigned int magic; /*%< Magic number. */ + int references; + isc_mutex_t lock; + isc_mem_t * mctx; /*%< Memory context. */ + isc_taskmgr_t * taskmgr; /*%< Task manager. */ + isc_socketmgr_t * socketmgr; /*%< Socket manager. */ + dns_dispatchmgr_t * dispatchmgr; + unsigned int generation; /*%< Current generation no. */ + ns_listenlist_t * listenon4; + ns_listenlist_t * listenon6; + dns_aclenv_t aclenv; /*%< Localhost/localnets ACLs */ + ISC_LIST(ns_interface_t) interfaces; /*%< List of interfaces. */ + ISC_LIST(isc_sockaddr_t) listenon; +}; + +static void +purge_old_interfaces(ns_interfacemgr_t *mgr); + +static void +clearlistenon(ns_interfacemgr_t *mgr); + +isc_result_t +ns_interfacemgr_create(isc_mem_t *mctx, isc_taskmgr_t *taskmgr, + isc_socketmgr_t *socketmgr, + dns_dispatchmgr_t *dispatchmgr, + ns_interfacemgr_t **mgrp) +{ + isc_result_t result; + ns_interfacemgr_t *mgr; + + REQUIRE(mctx != NULL); + REQUIRE(mgrp != NULL); + REQUIRE(*mgrp == NULL); + + mgr = isc_mem_get(mctx, sizeof(*mgr)); + if (mgr == NULL) + return (ISC_R_NOMEMORY); + + result = isc_mutex_init(&mgr->lock); + if (result != ISC_R_SUCCESS) + goto cleanup_mem; + + mgr->mctx = mctx; + mgr->taskmgr = taskmgr; + mgr->socketmgr = socketmgr; + mgr->dispatchmgr = dispatchmgr; + mgr->generation = 1; + mgr->listenon4 = NULL; + mgr->listenon6 = NULL; + + ISC_LIST_INIT(mgr->interfaces); + ISC_LIST_INIT(mgr->listenon); + + /* + * The listen-on lists are initially empty. + */ + result = ns_listenlist_create(mctx, &mgr->listenon4); + if (result != ISC_R_SUCCESS) + goto cleanup_mem; + ns_listenlist_attach(mgr->listenon4, &mgr->listenon6); + + result = dns_aclenv_init(mctx, &mgr->aclenv); + if (result != ISC_R_SUCCESS) + goto cleanup_listenon; + + mgr->references = 1; + mgr->magic = IFMGR_MAGIC; + *mgrp = mgr; + return (ISC_R_SUCCESS); + + cleanup_listenon: + ns_listenlist_detach(&mgr->listenon4); + ns_listenlist_detach(&mgr->listenon6); + cleanup_mem: + isc_mem_put(mctx, mgr, sizeof(*mgr)); + return (result); +} + +static void +ns_interfacemgr_destroy(ns_interfacemgr_t *mgr) { + REQUIRE(NS_INTERFACEMGR_VALID(mgr)); + dns_aclenv_destroy(&mgr->aclenv); + ns_listenlist_detach(&mgr->listenon4); + ns_listenlist_detach(&mgr->listenon6); + clearlistenon(mgr); + DESTROYLOCK(&mgr->lock); + mgr->magic = 0; + isc_mem_put(mgr->mctx, mgr, sizeof(*mgr)); +} + +dns_aclenv_t * +ns_interfacemgr_getaclenv(ns_interfacemgr_t *mgr) { + return (&mgr->aclenv); +} + +void +ns_interfacemgr_attach(ns_interfacemgr_t *source, ns_interfacemgr_t **target) { + REQUIRE(NS_INTERFACEMGR_VALID(source)); + LOCK(&source->lock); + INSIST(source->references > 0); + source->references++; + UNLOCK(&source->lock); + *target = source; +} + +void +ns_interfacemgr_detach(ns_interfacemgr_t **targetp) { + isc_result_t need_destroy = ISC_FALSE; + ns_interfacemgr_t *target = *targetp; + REQUIRE(target != NULL); + REQUIRE(NS_INTERFACEMGR_VALID(target)); + LOCK(&target->lock); + REQUIRE(target->references > 0); + target->references--; + if (target->references == 0) + need_destroy = ISC_TRUE; + UNLOCK(&target->lock); + if (need_destroy) + ns_interfacemgr_destroy(target); + *targetp = NULL; +} + +void +ns_interfacemgr_shutdown(ns_interfacemgr_t *mgr) { + REQUIRE(NS_INTERFACEMGR_VALID(mgr)); + + /*% + * Shut down and detach all interfaces. + * By incrementing the generation count, we make purge_old_interfaces() + * consider all interfaces "old". + */ + mgr->generation++; + purge_old_interfaces(mgr); +} + + +static isc_result_t +ns_interface_create(ns_interfacemgr_t *mgr, isc_sockaddr_t *addr, + const char *name, ns_interface_t **ifpret) +{ + ns_interface_t *ifp; + isc_result_t result; + + REQUIRE(NS_INTERFACEMGR_VALID(mgr)); + ifp = isc_mem_get(mgr->mctx, sizeof(*ifp)); + if (ifp == NULL) + return (ISC_R_NOMEMORY); + ifp->mgr = NULL; + ifp->generation = mgr->generation; + ifp->addr = *addr; + ifp->flags = 0; + strncpy(ifp->name, name, sizeof(ifp->name)); + ifp->name[sizeof(ifp->name)-1] = '\0'; + ifp->clientmgr = NULL; + + result = isc_mutex_init(&ifp->lock); + if (result != ISC_R_SUCCESS) + goto lock_create_failure; + + result = ns_clientmgr_create(mgr->mctx, mgr->taskmgr, + ns_g_timermgr, + &ifp->clientmgr); + if (result != ISC_R_SUCCESS) { + isc_log_write(IFMGR_COMMON_LOGARGS, ISC_LOG_ERROR, + "ns_clientmgr_create() failed: %s", + isc_result_totext(result)); + goto clientmgr_create_failure; + } + + ifp->udpdispatch = NULL; + + ifp->tcpsocket = NULL; + /* + * Create a single TCP client object. It will replace itself + * with a new one as soon as it gets a connection, so the actual + * connections will be handled in parallel even though there is + * only one client initially. + */ + ifp->ntcptarget = 1; + ifp->ntcpcurrent = 0; + + ISC_LINK_INIT(ifp, link); + + ns_interfacemgr_attach(mgr, &ifp->mgr); + ISC_LIST_APPEND(mgr->interfaces, ifp, link); + + ifp->references = 1; + ifp->magic = IFACE_MAGIC; + *ifpret = ifp; + + return (ISC_R_SUCCESS); + + clientmgr_create_failure: + DESTROYLOCK(&ifp->lock); + lock_create_failure: + ifp->magic = 0; + isc_mem_put(mgr->mctx, ifp, sizeof(*ifp)); + + return (ISC_R_UNEXPECTED); +} + +static isc_result_t +ns_interface_listenudp(ns_interface_t *ifp) { + isc_result_t result; + unsigned int attrs; + unsigned int attrmask; + + attrs = 0; + attrs |= DNS_DISPATCHATTR_UDP; + if (isc_sockaddr_pf(&ifp->addr) == AF_INET) + attrs |= DNS_DISPATCHATTR_IPV4; + else + attrs |= DNS_DISPATCHATTR_IPV6; + attrs |= DNS_DISPATCHATTR_NOLISTEN; + attrmask = 0; + attrmask |= DNS_DISPATCHATTR_UDP | DNS_DISPATCHATTR_TCP; + attrmask |= DNS_DISPATCHATTR_IPV4 | DNS_DISPATCHATTR_IPV6; + result = dns_dispatch_getudp(ifp->mgr->dispatchmgr, ns_g_socketmgr, + ns_g_taskmgr, &ifp->addr, + 4096, 1000, 32768, 8219, 8237, + attrs, attrmask, &ifp->udpdispatch); + if (result != ISC_R_SUCCESS) { + isc_log_write(IFMGR_COMMON_LOGARGS, ISC_LOG_ERROR, + "could not listen on UDP socket: %s", + isc_result_totext(result)); + goto udp_dispatch_failure; + } + + result = ns_clientmgr_createclients(ifp->clientmgr, ns_g_cpus, + ifp, ISC_FALSE); + if (result != ISC_R_SUCCESS) { + UNEXPECTED_ERROR(__FILE__, __LINE__, + "UDP ns_clientmgr_createclients(): %s", + isc_result_totext(result)); + goto addtodispatch_failure; + } + return (ISC_R_SUCCESS); + + addtodispatch_failure: + dns_dispatch_changeattributes(ifp->udpdispatch, 0, + DNS_DISPATCHATTR_NOLISTEN); + dns_dispatch_detach(&ifp->udpdispatch); + udp_dispatch_failure: + return (result); +} + +static isc_result_t +ns_interface_accepttcp(ns_interface_t *ifp) { + isc_result_t result; + + /* + * Open a TCP socket. + */ + result = isc_socket_create(ifp->mgr->socketmgr, + isc_sockaddr_pf(&ifp->addr), + isc_sockettype_tcp, + &ifp->tcpsocket); + if (result != ISC_R_SUCCESS) { + isc_log_write(IFMGR_COMMON_LOGARGS, ISC_LOG_ERROR, + "creating TCP socket: %s", + isc_result_totext(result)); + goto tcp_socket_failure; + } +#ifndef ISC_ALLOW_MAPPED + isc_socket_ipv6only(ifp->tcpsocket, ISC_TRUE); +#endif + result = isc_socket_bind(ifp->tcpsocket, &ifp->addr, + ISC_SOCKET_REUSEADDRESS); + if (result != ISC_R_SUCCESS) { + isc_log_write(IFMGR_COMMON_LOGARGS, ISC_LOG_ERROR, + "binding TCP socket: %s", + isc_result_totext(result)); + goto tcp_bind_failure; + } + result = isc_socket_listen(ifp->tcpsocket, ns_g_listen); + if (result != ISC_R_SUCCESS) { + isc_log_write(IFMGR_COMMON_LOGARGS, ISC_LOG_ERROR, + "listening on TCP socket: %s", + isc_result_totext(result)); + goto tcp_listen_failure; + } + + /* + * If/when there a multiple filters listen to the + * result. + */ + (void)isc_socket_filter(ifp->tcpsocket, "dataready"); + + result = ns_clientmgr_createclients(ifp->clientmgr, + ifp->ntcptarget, ifp, + ISC_TRUE); + if (result != ISC_R_SUCCESS) { + UNEXPECTED_ERROR(__FILE__, __LINE__, + "TCP ns_clientmgr_createclients(): %s", + isc_result_totext(result)); + goto accepttcp_failure; + } + return (ISC_R_SUCCESS); + + accepttcp_failure: + tcp_listen_failure: + tcp_bind_failure: + isc_socket_detach(&ifp->tcpsocket); + tcp_socket_failure: + return (ISC_R_SUCCESS); +} + +static isc_result_t +ns_interface_setup(ns_interfacemgr_t *mgr, isc_sockaddr_t *addr, + const char *name, ns_interface_t **ifpret, + isc_boolean_t accept_tcp) +{ + isc_result_t result; + ns_interface_t *ifp = NULL; + REQUIRE(ifpret != NULL && *ifpret == NULL); + + result = ns_interface_create(mgr, addr, name, &ifp); + if (result != ISC_R_SUCCESS) + return (result); + + result = ns_interface_listenudp(ifp); + if (result != ISC_R_SUCCESS) + goto cleanup_interface; + + if (accept_tcp == ISC_TRUE) { + result = ns_interface_accepttcp(ifp); + if (result != ISC_R_SUCCESS) { + /* + * XXXRTH We don't currently have a way to easily stop + * dispatch service, so we currently return + * ISC_R_SUCCESS (the UDP stuff will work even if TCP + * creation failed). This will be fixed later. + */ + result = ISC_R_SUCCESS; + } + } + *ifpret = ifp; + return (ISC_R_SUCCESS); + + cleanup_interface: + ISC_LIST_UNLINK(ifp->mgr->interfaces, ifp, link); + ns_interface_detach(&ifp); + return (result); +} + +void +ns_interface_shutdown(ns_interface_t *ifp) { + if (ifp->clientmgr != NULL) + ns_clientmgr_destroy(&ifp->clientmgr); +} + +static void +ns_interface_destroy(ns_interface_t *ifp) { + isc_mem_t *mctx = ifp->mgr->mctx; + REQUIRE(NS_INTERFACE_VALID(ifp)); + + ns_interface_shutdown(ifp); + + if (ifp->udpdispatch != NULL) { + dns_dispatch_changeattributes(ifp->udpdispatch, 0, + DNS_DISPATCHATTR_NOLISTEN); + dns_dispatch_detach(&ifp->udpdispatch); + } + if (ifp->tcpsocket != NULL) + isc_socket_detach(&ifp->tcpsocket); + + DESTROYLOCK(&ifp->lock); + + ns_interfacemgr_detach(&ifp->mgr); + + ifp->magic = 0; + isc_mem_put(mctx, ifp, sizeof(*ifp)); +} + +void +ns_interface_attach(ns_interface_t *source, ns_interface_t **target) { + REQUIRE(NS_INTERFACE_VALID(source)); + LOCK(&source->lock); + INSIST(source->references > 0); + source->references++; + UNLOCK(&source->lock); + *target = source; +} + +void +ns_interface_detach(ns_interface_t **targetp) { + isc_result_t need_destroy = ISC_FALSE; + ns_interface_t *target = *targetp; + REQUIRE(target != NULL); + REQUIRE(NS_INTERFACE_VALID(target)); + LOCK(&target->lock); + REQUIRE(target->references > 0); + target->references--; + if (target->references == 0) + need_destroy = ISC_TRUE; + UNLOCK(&target->lock); + if (need_destroy) + ns_interface_destroy(target); + *targetp = NULL; +} + +/*% + * Search the interface list for an interface whose address and port + * both match those of 'addr'. Return a pointer to it, or NULL if not found. + */ +static ns_interface_t * +find_matching_interface(ns_interfacemgr_t *mgr, isc_sockaddr_t *addr) { + ns_interface_t *ifp; + for (ifp = ISC_LIST_HEAD(mgr->interfaces); ifp != NULL; + ifp = ISC_LIST_NEXT(ifp, link)) { + if (isc_sockaddr_equal(&ifp->addr, addr)) + break; + } + return (ifp); +} + +/*% + * Remove any interfaces whose generation number is not the current one. + */ +static void +purge_old_interfaces(ns_interfacemgr_t *mgr) { + ns_interface_t *ifp, *next; + for (ifp = ISC_LIST_HEAD(mgr->interfaces); ifp != NULL; ifp = next) { + INSIST(NS_INTERFACE_VALID(ifp)); + next = ISC_LIST_NEXT(ifp, link); + if (ifp->generation != mgr->generation) { + char sabuf[256]; + ISC_LIST_UNLINK(ifp->mgr->interfaces, ifp, link); + isc_sockaddr_format(&ifp->addr, sabuf, sizeof(sabuf)); + isc_log_write(IFMGR_COMMON_LOGARGS, + ISC_LOG_INFO, + "no longer listening on %s", sabuf); + ns_interface_shutdown(ifp); + ns_interface_detach(&ifp); + } + } +} + +static isc_result_t +clearacl(isc_mem_t *mctx, dns_acl_t **aclp) { + dns_acl_t *newacl = NULL; + isc_result_t result; + result = dns_acl_create(mctx, 10, &newacl); + if (result != ISC_R_SUCCESS) + return (result); + dns_acl_detach(aclp); + dns_acl_attach(newacl, aclp); + dns_acl_detach(&newacl); + return (ISC_R_SUCCESS); +} + +static isc_boolean_t +listenon_is_ip6_any(ns_listenelt_t *elt) { + if (elt->acl->length != 1) + return (ISC_FALSE); + if (elt->acl->elements[0].negative == ISC_FALSE && + elt->acl->elements[0].type == dns_aclelementtype_any) + return (ISC_TRUE); /* listen-on-v6 { any; } */ + return (ISC_FALSE); /* All others */ +} + +static isc_result_t +setup_locals(ns_interfacemgr_t *mgr, isc_interface_t *interface) { + isc_result_t result; + dns_aclelement_t elt; + unsigned int family; + unsigned int prefixlen; + + family = interface->address.family; + + elt.type = dns_aclelementtype_ipprefix; + elt.negative = ISC_FALSE; + elt.u.ip_prefix.address = interface->address; + elt.u.ip_prefix.prefixlen = (family == AF_INET) ? 32 : 128; + result = dns_acl_appendelement(mgr->aclenv.localhost, &elt); + if (result != ISC_R_SUCCESS) + return (result); + + result = isc_netaddr_masktoprefixlen(&interface->netmask, + &prefixlen); + + /* Non contigious netmasks not allowed by IPv6 arch. */ + if (result != ISC_R_SUCCESS && family == AF_INET6) + return (result); + + if (result != ISC_R_SUCCESS) { + isc_log_write(IFMGR_COMMON_LOGARGS, + ISC_LOG_WARNING, + "omitting IPv4 interface %s from " + "localnets ACL: %s", + interface->name, + isc_result_totext(result)); + } else { + elt.u.ip_prefix.prefixlen = prefixlen; + if (dns_acl_elementmatch(mgr->aclenv.localnets, &elt, + NULL) == ISC_R_NOTFOUND) { + result = dns_acl_appendelement(mgr->aclenv.localnets, + &elt); + if (result != ISC_R_SUCCESS) + return (result); + } + } + + return (ISC_R_SUCCESS); +} + +static void +setup_listenon(ns_interfacemgr_t *mgr, isc_interface_t *interface, + in_port_t port) +{ + isc_sockaddr_t *addr; + isc_sockaddr_t *old; + + addr = isc_mem_get(mgr->mctx, sizeof(*addr)); + if (addr == NULL) + return; + + isc_sockaddr_fromnetaddr(addr, &interface->address, port); + + for (old = ISC_LIST_HEAD(mgr->listenon); + old != NULL; + old = ISC_LIST_NEXT(old, link)) + if (isc_sockaddr_equal(addr, old)) + break; + + if (old != NULL) + isc_mem_put(mgr->mctx, addr, sizeof(*addr)); + else + ISC_LIST_APPEND(mgr->listenon, addr, link); +} + +static void +clearlistenon(ns_interfacemgr_t *mgr) { + isc_sockaddr_t *old; + + old = ISC_LIST_HEAD(mgr->listenon); + while (old != NULL) { + ISC_LIST_UNLINK(mgr->listenon, old, link); + isc_mem_put(mgr->mctx, old, sizeof(*old)); + old = ISC_LIST_HEAD(mgr->listenon); + } +} + +static isc_result_t +do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, + isc_boolean_t verbose) +{ + isc_interfaceiter_t *iter = NULL; + isc_boolean_t scan_ipv4 = ISC_FALSE; + isc_boolean_t scan_ipv6 = ISC_FALSE; + isc_boolean_t adjusting = ISC_FALSE; + isc_boolean_t ipv6only = ISC_TRUE; + isc_boolean_t ipv6pktinfo = ISC_TRUE; + isc_result_t result; + isc_netaddr_t zero_address, zero_address6; + ns_listenelt_t *le; + isc_sockaddr_t listen_addr; + ns_interface_t *ifp; + isc_boolean_t log_explicit = ISC_FALSE; + isc_boolean_t dolistenon; + + if (ext_listen != NULL) + adjusting = ISC_TRUE; + + if (isc_net_probeipv6() == ISC_R_SUCCESS) + scan_ipv6 = ISC_TRUE; +#ifdef WANT_IPV6 + else + isc_log_write(IFMGR_COMMON_LOGARGS, + verbose ? ISC_LOG_INFO : ISC_LOG_DEBUG(1), + "no IPv6 interfaces found"); +#endif + + if (isc_net_probeipv4() == ISC_R_SUCCESS) + scan_ipv4 = ISC_TRUE; + else + isc_log_write(IFMGR_COMMON_LOGARGS, + verbose ? ISC_LOG_INFO : ISC_LOG_DEBUG(1), + "no IPv4 interfaces found"); + + /* + * A special, but typical case; listen-on-v6 { any; }. + * When we can make the socket IPv6-only, open a single wildcard + * socket for IPv6 communication. Otherwise, make separate socket + * for each IPv6 address in order to avoid accepting IPv4 packets + * as the form of mapped addresses unintentionally unless explicitly + * allowed. + */ +#ifndef ISC_ALLOW_MAPPED + if (scan_ipv6 == ISC_TRUE && + isc_net_probe_ipv6only() != ISC_R_SUCCESS) { + ipv6only = ISC_FALSE; + log_explicit = ISC_TRUE; + } +#endif + if (scan_ipv6 == ISC_TRUE && + isc_net_probe_ipv6pktinfo() != ISC_R_SUCCESS) { + ipv6pktinfo = ISC_FALSE; + log_explicit = ISC_TRUE; + } + if (scan_ipv6 == ISC_TRUE && ipv6only && ipv6pktinfo) { + for (le = ISC_LIST_HEAD(mgr->listenon6->elts); + le != NULL; + le = ISC_LIST_NEXT(le, link)) { + struct in6_addr in6a; + + if (!listenon_is_ip6_any(le)) + continue; + + in6a = in6addr_any; + isc_sockaddr_fromin6(&listen_addr, &in6a, le->port); + + ifp = find_matching_interface(mgr, &listen_addr); + if (ifp != NULL) { + ifp->generation = mgr->generation; + } else { + isc_log_write(IFMGR_COMMON_LOGARGS, + ISC_LOG_INFO, + "listening on IPv6 " + "interfaces, port %u", + le->port); + result = ns_interface_setup(mgr, &listen_addr, + "", &ifp, + ISC_TRUE); + if (result == ISC_R_SUCCESS) + ifp->flags |= NS_INTERFACEFLAG_ANYADDR; + else + isc_log_write(IFMGR_COMMON_LOGARGS, + ISC_LOG_ERROR, + "listening on all IPv6 " + "interfaces failed"); + /* Continue. */ + } + } + } + + isc_netaddr_any(&zero_address); + isc_netaddr_any6(&zero_address6); + + result = isc_interfaceiter_create(mgr->mctx, &iter); + if (result != ISC_R_SUCCESS) + return (result); + + if (adjusting == ISC_FALSE) { + result = clearacl(mgr->mctx, &mgr->aclenv.localhost); + if (result != ISC_R_SUCCESS) + goto cleanup_iter; + result = clearacl(mgr->mctx, &mgr->aclenv.localnets); + if (result != ISC_R_SUCCESS) + goto cleanup_iter; + clearlistenon(mgr); + } + + for (result = isc_interfaceiter_first(iter); + result == ISC_R_SUCCESS; + result = isc_interfaceiter_next(iter)) + { + isc_interface_t interface; + ns_listenlist_t *ll; + unsigned int family; + + result = isc_interfaceiter_current(iter, &interface); + if (result != ISC_R_SUCCESS) + break; + + family = interface.address.family; + if (family != AF_INET && family != AF_INET6) + continue; + if (scan_ipv4 == ISC_FALSE && family == AF_INET) + continue; + if (scan_ipv6 == ISC_FALSE && family == AF_INET6) + continue; + + /* + * Test for the address being nonzero rather than testing + * INTERFACE_F_UP, because on some systems the latter + * follows the media state and we could end up ignoring + * the interface for an entire rescan interval due to + * a temporary media glitch at rescan time. + */ + if (family == AF_INET && + isc_netaddr_equal(&interface.address, &zero_address)) { + continue; + } + if (family == AF_INET6 && + isc_netaddr_equal(&interface.address, &zero_address6)) { + continue; + } + + if (adjusting == ISC_FALSE) { + result = setup_locals(mgr, &interface); + if (result != ISC_R_SUCCESS) + goto ignore_interface; + } + + ll = (family == AF_INET) ? mgr->listenon4 : mgr->listenon6; + dolistenon = ISC_TRUE; + for (le = ISC_LIST_HEAD(ll->elts); + le != NULL; + le = ISC_LIST_NEXT(le, link)) + { + int match; + isc_boolean_t ipv6_wildcard = ISC_FALSE; + isc_netaddr_t listen_netaddr; + isc_sockaddr_t listen_sockaddr; + + /* + * Construct a socket address for this IP/port + * combination. + */ + if (family == AF_INET) { + isc_netaddr_fromin(&listen_netaddr, + &interface.address.type.in); + } else { + isc_netaddr_fromin6(&listen_netaddr, + &interface.address.type.in6); + isc_netaddr_setzone(&listen_netaddr, + interface.address.zone); + } + isc_sockaddr_fromnetaddr(&listen_sockaddr, + &listen_netaddr, + le->port); + + /* + * See if the address matches the listen-on statement; + * if not, ignore the interface. + */ + (void)dns_acl_match(&listen_netaddr, NULL, le->acl, + &mgr->aclenv, &match, NULL); + if (match <= 0) + continue; + + if (adjusting == ISC_FALSE && dolistenon == ISC_TRUE) { + setup_listenon(mgr, &interface, le->port); + dolistenon = ISC_FALSE; + } + + /* + * The case of "any" IPv6 address will require + * special considerations later, so remember it. + */ + if (family == AF_INET6 && ipv6only && ipv6pktinfo && + listenon_is_ip6_any(le)) + ipv6_wildcard = ISC_TRUE; + + /* + * When adjusting interfaces with extra a listening + * list, see if the address matches the extra list. + * If it does, and is also covered by a wildcard + * interface, we need to listen on the address + * explicitly. + */ + if (adjusting == ISC_TRUE) { + ns_listenelt_t *ele; + + match = 0; + for (ele = ISC_LIST_HEAD(ext_listen->elts); + ele != NULL; + ele = ISC_LIST_NEXT(ele, link)) { + (void)dns_acl_match(&listen_netaddr, + NULL, ele->acl, + NULL, &match, NULL); + if (match > 0 && ele->port == le->port) + break; + else + match = 0; + } + if (ipv6_wildcard == ISC_TRUE && match == 0) + continue; + } + + ifp = find_matching_interface(mgr, &listen_sockaddr); + if (ifp != NULL) { + ifp->generation = mgr->generation; + } else { + char sabuf[ISC_SOCKADDR_FORMATSIZE]; + + if (adjusting == ISC_FALSE && + ipv6_wildcard == ISC_TRUE) + continue; + + if (log_explicit && family == AF_INET6 && + !adjusting && listenon_is_ip6_any(le)) { + isc_log_write(IFMGR_COMMON_LOGARGS, + verbose ? ISC_LOG_INFO : + ISC_LOG_DEBUG(1), + "IPv6 socket API is " + "incomplete; explicitly " + "binding to each IPv6 " + "address separately"); + log_explicit = ISC_FALSE; + } + isc_sockaddr_format(&listen_sockaddr, + sabuf, sizeof(sabuf)); + isc_log_write(IFMGR_COMMON_LOGARGS, + ISC_LOG_INFO, + "%s" + "listening on %s interface " + "%s, %s", + (adjusting == ISC_TRUE) ? + "additionally " : "", + (family == AF_INET) ? + "IPv4" : "IPv6", + interface.name, sabuf); + + result = ns_interface_setup(mgr, + &listen_sockaddr, + interface.name, + &ifp, + (adjusting == ISC_TRUE) ? + ISC_FALSE : + ISC_TRUE); + + if (result != ISC_R_SUCCESS) { + isc_log_write(IFMGR_COMMON_LOGARGS, + ISC_LOG_ERROR, + "creating %s interface " + "%s failed; interface " + "ignored", + (family == AF_INET) ? + "IPv4" : "IPv6", + interface.name); + } + /* Continue. */ + } + + } + continue; + + ignore_interface: + isc_log_write(IFMGR_COMMON_LOGARGS, + ISC_LOG_ERROR, + "ignoring %s interface %s: %s", + (family == AF_INET) ? "IPv4" : "IPv6", + interface.name, isc_result_totext(result)); + continue; + } + if (result != ISC_R_NOMORE) + UNEXPECTED_ERROR(__FILE__, __LINE__, + "interface iteration failed: %s", + isc_result_totext(result)); + else + result = ISC_R_SUCCESS; + cleanup_iter: + isc_interfaceiter_destroy(&iter); + return (result); +} + +static void +ns_interfacemgr_scan0(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen, + isc_boolean_t verbose) +{ + isc_boolean_t purge = ISC_TRUE; + + REQUIRE(NS_INTERFACEMGR_VALID(mgr)); + + mgr->generation++; /* Increment the generation count. */ + + if (do_scan(mgr, ext_listen, verbose) != ISC_R_SUCCESS) + purge = ISC_FALSE; + + /* + * Now go through the interface list and delete anything that + * does not have the current generation number. This is + * how we catch interfaces that go away or change their + * addresses. + */ + if (purge) + purge_old_interfaces(mgr); + + /* + * Warn if we are not listening on any interface, unless + * we're in lwresd-only mode, in which case that is to + * be expected. + */ + if (ext_listen == NULL && + ISC_LIST_EMPTY(mgr->interfaces) && ! ns_g_lwresdonly) { + isc_log_write(IFMGR_COMMON_LOGARGS, ISC_LOG_WARNING, + "not listening on any interfaces"); + } +} + +void +ns_interfacemgr_scan(ns_interfacemgr_t *mgr, isc_boolean_t verbose) { + ns_interfacemgr_scan0(mgr, NULL, verbose); +} + +void +ns_interfacemgr_adjust(ns_interfacemgr_t *mgr, ns_listenlist_t *list, + isc_boolean_t verbose) +{ + ns_interfacemgr_scan0(mgr, list, verbose); +} + +void +ns_interfacemgr_setlistenon4(ns_interfacemgr_t *mgr, ns_listenlist_t *value) { + LOCK(&mgr->lock); + ns_listenlist_detach(&mgr->listenon4); + ns_listenlist_attach(value, &mgr->listenon4); + UNLOCK(&mgr->lock); +} + +void +ns_interfacemgr_setlistenon6(ns_interfacemgr_t *mgr, ns_listenlist_t *value) { + LOCK(&mgr->lock); + ns_listenlist_detach(&mgr->listenon6); + ns_listenlist_attach(value, &mgr->listenon6); + UNLOCK(&mgr->lock); +} + +void +ns_interfacemgr_dumprecursing(FILE *f, ns_interfacemgr_t *mgr) { + ns_interface_t *interface; + + LOCK(&mgr->lock); + interface = ISC_LIST_HEAD(mgr->interfaces); + while (interface != NULL) { + if (interface->clientmgr != NULL) + ns_client_dumprecursing(f, interface->clientmgr); + interface = ISC_LIST_NEXT(interface, link); + } + UNLOCK(&mgr->lock); +} + +isc_boolean_t +ns_interfacemgr_listeningon(ns_interfacemgr_t *mgr, isc_sockaddr_t *addr) { + isc_sockaddr_t *old; + + old = ISC_LIST_HEAD(mgr->listenon); + for (old = ISC_LIST_HEAD(mgr->listenon); + old != NULL; + old = ISC_LIST_NEXT(old, link)) + if (isc_sockaddr_equal(old, addr)) + return (ISC_TRUE); + return (ISC_FALSE); +} Copied: user/netchild/misc/src/etc/rc.d/localpkg (from r183911, head/etc/rc.d/localpkg) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/netchild/misc/src/etc/rc.d/localpkg Thu Oct 16 10:24:31 2008 (r183934, copy of r183911, head/etc/rc.d/localpkg) @@ -0,0 +1,77 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: localpkg +# REQUIRE: abi +# BEFORE: securelevel +# KEYWORD: shutdown + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Thu Oct 16 10:27:01 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E0B61065696; Thu, 16 Oct 2008 10:27:01 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3D4328FC13; Thu, 16 Oct 2008 10:27:01 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9GAR1VU057809; Thu, 16 Oct 2008 10:27:01 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9GAR1kB057808; Thu, 16 Oct 2008 10:27:01 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810161027.m9GAR1kB057808@svn.freebsd.org> From: Alexander Leidinger Date: Thu, 16 Oct 2008 10:27:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183935 - user/netchild/misc/src/contrib/bind9/bin/named X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Oct 2008 10:27:01 -0000 Author: netchild Date: Thu Oct 16 10:27:00 2008 New Revision: 183935 URL: http://svn.freebsd.org/changeset/base/183935 Log: Use the DNS accept filter (as explained in the mail when the dns accept filter was committed to current). Modified: user/netchild/misc/src/contrib/bind9/bin/named/interfacemgr.c Modified: user/netchild/misc/src/contrib/bind9/bin/named/interfacemgr.c ============================================================================== --- user/netchild/misc/src/contrib/bind9/bin/named/interfacemgr.c Thu Oct 16 10:24:31 2008 (r183934) +++ user/netchild/misc/src/contrib/bind9/bin/named/interfacemgr.c Thu Oct 16 10:27:00 2008 (r183935) @@ -327,7 +327,7 @@ ns_interface_accepttcp(ns_interface_t *i * If/when there a multiple filters listen to the * result. */ - (void)isc_socket_filter(ifp->tcpsocket, "dataready"); + (void)isc_socket_filter(ifp->tcpsocket, "dnsready"); result = ns_clientmgr_createclients(ifp->clientmgr, ifp->ntcptarget, ifp, From owner-svn-src-user@FreeBSD.ORG Thu Oct 16 10:28:01 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0BA591065687; Thu, 16 Oct 2008 10:28:01 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EF5F48FC1B; Thu, 16 Oct 2008 10:28:00 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9GAS06E057862; Thu, 16 Oct 2008 10:28:00 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9GAS0N3057861; Thu, 16 Oct 2008 10:28:00 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810161028.m9GAS0N3057861@svn.freebsd.org> From: Alexander Leidinger Date: Thu, 16 Oct 2008 10:28:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183936 - user/netchild/misc/src/share/man/man4 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Oct 2008 10:28:01 -0000 Author: netchild Date: Thu Oct 16 10:28:00 2008 New Revision: 183936 URL: http://svn.freebsd.org/changeset/base/183936 Log: Document the recvbuf_* sysctls in the tcp area. Modified: user/netchild/misc/src/share/man/man4/tcp.4 Modified: user/netchild/misc/src/share/man/man4/tcp.4 ============================================================================== --- user/netchild/misc/src/share/man/man4/tcp.4 Thu Oct 16 10:27:00 2008 (r183935) +++ user/netchild/misc/src/share/man/man4/tcp.4 Thu Oct 16 10:28:00 2008 (r183936) @@ -254,11 +254,29 @@ when no advice to the contrary is receiv Maximum .Tn TCP send window. +.Pq Va sendbuf_auto +Automatic send buffer resizing. +When the the size of the send buffer of a connection is set manually by an +application, +the automatic resizing of the send buffer is disabled for this connection. +.Pq Va sendbuf_inc +XXX. +.Pq Va sendbuf_max +Maximum size of the send buffer with automatic resizing. .It Dv TCPCTL_RECVSPACE .Pq Va recvspace Maximum .Tn TCP receive window. +.Pq Va recvbuf_auto +Automatic send buffer resizing. +When the the size of the receive buffer of a connection is set manually by an +application, +the automatic resizing of the receive buffer is disabled for this connection. +.Pq Va recvbuf_inc +XXX. +.Pq Va recvbuf_max +Maximum size of the receive buffer with automatic resizing. .It Va log_in_vain Log any connection attempts to ports where there is not a socket accepting connections. From owner-svn-src-user@FreeBSD.ORG Thu Oct 16 10:31:10 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB8EE1065686; Thu, 16 Oct 2008 10:31:10 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CAC518FC21; Thu, 16 Oct 2008 10:31:10 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9GAVA7u057956; Thu, 16 Oct 2008 10:31:10 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9GAVAgs057954; Thu, 16 Oct 2008 10:31:10 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810161031.m9GAVAgs057954@svn.freebsd.org> From: Alexander Leidinger Date: Thu, 16 Oct 2008 10:31:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183937 - user/netchild/misc/src/usr.sbin/adduser X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Oct 2008 10:31:10 -0000 Author: netchild Date: Thu Oct 16 10:31:10 2008 New Revision: 183937 URL: http://svn.freebsd.org/changeset/base/183937 Log: Implement plugin interface for adduser and rmuser. Currently the plugins get called with 'add' or 'rm' and the username. Modified: user/netchild/misc/src/usr.sbin/adduser/adduser.sh user/netchild/misc/src/usr.sbin/adduser/rmuser.sh Modified: user/netchild/misc/src/usr.sbin/adduser/adduser.sh ============================================================================== --- user/netchild/misc/src/usr.sbin/adduser/adduser.sh Thu Oct 16 10:28:00 2008 (r183936) +++ user/netchild/misc/src/usr.sbin/adduser/adduser.sh Thu Oct 16 10:31:10 2008 (r183937) @@ -331,6 +331,29 @@ add_user() { info "Sent welcome message to ($username)." } fi + + # If we have some plug-ins, execute them. + if [ -d ${plugindir} ]; then + slist="" + if [ -z "${script_name_sep}" ]; then + script_name_sep=" " + fi + for script in ${plugindir}/*.sh; do + slist="${slist}${script_name_sep}${script}" + done + script_save_sep="$IFS" + IFS="${script_name_sep}" + for script in ${slist}; do + if [ -x "${script}" ]; then + (set -T + trap 'exit 1' 2 + ${script} add ${username}) + elif [ -f "${script}" -o -L "${script}" ]; then + echo -n " (skipping ${script##*/}, not executable)" + fi + done + IFS="${script_save_sep}" + fi } # get_user @@ -884,6 +907,7 @@ defaultclass= defaultLgroup= defaultgroups= defaultshell="${DEFAULTSHELL}" +plugindir=/usr/local/share/adduser defaultHomePerm= # Make sure the user running this program is root. This isn't a security Modified: user/netchild/misc/src/usr.sbin/adduser/rmuser.sh ============================================================================== --- user/netchild/misc/src/usr.sbin/adduser/rmuser.sh Thu Oct 16 10:28:00 2008 (r183936) +++ user/netchild/misc/src/usr.sbin/adduser/rmuser.sh Thu Oct 16 10:31:10 2008 (r183937) @@ -218,6 +218,45 @@ show_usage() { echo " one or more user names must be given" } +reverse_list() +{ + _revlist= + for _revfile in $*; do + _revlist="$_revfile $_revlist" + done + echo $_revlist +} + +# +# plugins +# username +# execute plugins in rm mode +# +plugins() { + # If we have some plug-ins, execute them. + if [ -d ${plugindir} ]; then + slist="" + if [ -z "${script_name_sep}" ]; then + script_name_sep=" " + fi + for script in ${plugindir}/*.sh; do + slist="${slist}${script_name_sep}${script}" + done + script_save_sep="$IFS" + IFS="${script_name_sep}" + for script in `reverse_list ${slist}`; do + if [ -x "${script}" ]; then + (set -T + trap 'exit 1' 2 + ${script} rm $1) + elif [ -f "${script}" -o -L "${script}" ]; then + echo -n " (skipping ${script##*/}, not executable)" + fi + done + IFS="${script_save_sep}" + fi +} + #### END SUBROUTINE DEFENITION #### ffile= @@ -227,6 +266,7 @@ pw_rswitch= userlist= yflag= vflag= +plugindir=/usr/local/share/adduser procowner=`/usr/bin/id -u` if [ "$procowner" != "0" ]; then @@ -357,5 +397,6 @@ for _user in $userlist ; do rm_files $_user rm_mail $_user rm_user $_user + plugins $_user ! verbose && echo "." done From owner-svn-src-user@FreeBSD.ORG Thu Oct 16 10:33:36 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CFA021065687; Thu, 16 Oct 2008 10:33:36 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BF2448FC28; Thu, 16 Oct 2008 10:33:36 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9GAXa8e058045; Thu, 16 Oct 2008 10:33:36 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9GAXawm058044; Thu, 16 Oct 2008 10:33:36 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810161033.m9GAXawm058044@svn.freebsd.org> From: Alexander Leidinger Date: Thu, 16 Oct 2008 10:33:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183938 - user/netchild/misc/src/etc/rc.d X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Oct 2008 10:33:36 -0000 Author: netchild Date: Thu Oct 16 10:33:36 2008 New Revision: 183938 URL: http://svn.freebsd.org/changeset/base/183938 Log: Tell if a local start/stop script is not executable, helps with debugging and a not so god layer-8-memory sometimes. Modified: user/netchild/misc/src/etc/rc.d/localpkg Modified: user/netchild/misc/src/etc/rc.d/localpkg ============================================================================== --- user/netchild/misc/src/etc/rc.d/localpkg Thu Oct 16 10:31:10 2008 (r183937) +++ user/netchild/misc/src/etc/rc.d/localpkg Thu Oct 16 10:33:36 2008 (r183938) @@ -66,6 +66,8 @@ pkg_stop() (set -T trap 'exit 1' 2 ${script} stop) + elif [ -f "${script}" -o -L "${script}" ]; then + echo -n " (skipping ${script##*/}, not executable)" fi done [ -n "${initdone}" ] && echo '.' From owner-svn-src-user@FreeBSD.ORG Thu Oct 16 10:34:38 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 999D51065699; Thu, 16 Oct 2008 10:34:38 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 88E348FC1A; Thu, 16 Oct 2008 10:34:38 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9GAYc5T058100; Thu, 16 Oct 2008 10:34:38 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9GAYcCQ058098; Thu, 16 Oct 2008 10:34:38 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810161034.m9GAYcCQ058098@svn.freebsd.org> From: Alexander Leidinger Date: Thu, 16 Oct 2008 10:34:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183939 - user/netchild/misc/src/sys/dev/usb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Oct 2008 10:34:38 -0000 Author: netchild Date: Thu Oct 16 10:34:38 2008 New Revision: 183939 URL: http://svn.freebsd.org/changeset/base/183939 Log: Add some USB devices I had in my hands and connected to my system in the past. Modified: user/netchild/misc/src/sys/dev/usb/usbdevs user/netchild/misc/src/sys/dev/usb/uscanner.c Modified: user/netchild/misc/src/sys/dev/usb/usbdevs ============================================================================== --- user/netchild/misc/src/sys/dev/usb/usbdevs Thu Oct 16 10:33:36 2008 (r183938) +++ user/netchild/misc/src/sys/dev/usb/usbdevs Thu Oct 16 10:34:38 2008 (r183939) @@ -623,7 +623,7 @@ vendor QUALCOMMINC 0x19d2 Qualcomm, Inco vendor DLINK 0x2001 D-Link vendor PLANEX2 0x2019 Planex Communications vendor ERICSSON 0x2282 Ericsson -vendor MOTOROLA2 0x22b8 Motorola +vendor MOTOROLA2 0x22b8 Motorola Inc. vendor TRIPPLITE 0x2478 Tripp-Lite vendor HIROSE 0x2631 Hirose Electric vendor NHJ 0x2770 NHJ @@ -960,6 +960,7 @@ product BROADCOM BCM2033 0x2033 BCM2033 /* Brother Industries products */ product BROTHER HL1050 0x0002 HL-1050 laser printer +product BROTHER MFC8600_9650 0x0100 MFC8600/9650 multifunction device /* Behavior Technology Computer products */ product BTC BTC7932 0x6782 Keyboard with mouse port @@ -1755,6 +1756,7 @@ product MOTOROLA MC141555 0x1555 MC14155 product MOTOROLA SB4100 0x4100 SB4100 USB Cable Modem product MOTOROLA2 A41XV32X 0x2a22 A41x/V32x Mobile Phones product MOTOROLA2 E398 0x4810 E398 Mobile Phone +product MOTOROLA2 MOTOXXX 0x4902 Motorola MOTOxxx Mobile Phone product MOTOROLA2 USBLAN 0x600c USBLAN product MOTOROLA2 USBLAN2 0x6027 USBLAN @@ -1769,6 +1771,7 @@ product MUSTEK 1200UB 0x0006 1200 UB sc product MUSTEK 1200USBPLUS 0x0007 1200 USB Plus scanner product MUSTEK 1200CUPLUS 0x0008 1200 CU Plus scanner product MUSTEK BEARPAW1200F 0x0010 BearPaw 1200F scanner +product MUSTEK BEARPAW2400TA 0x0218 BearPaw 2400TA scanner product MUSTEK BEARPAW1200TA 0x021e BearPaw 1200TA scanner product MUSTEK 600USB 0x0873 600 USB scanner product MUSTEK MDC800 0xa800 MDC-800 digital camera Modified: user/netchild/misc/src/sys/dev/usb/uscanner.c ============================================================================== --- user/netchild/misc/src/sys/dev/usb/uscanner.c Thu Oct 16 10:33:36 2008 (r183938) +++ user/netchild/misc/src/sys/dev/usb/uscanner.c Thu Oct 16 10:34:38 2008 (r183939) @@ -157,6 +157,7 @@ static const struct uscan_info uscanner_ /* Mustek */ {{ USB_VENDOR_MUSTEK, USB_PRODUCT_MUSTEK_1200CU }, 0 }, {{ USB_VENDOR_MUSTEK, USB_PRODUCT_MUSTEK_BEARPAW1200F }, 0 }, + {{ USB_VENDOR_MUSTEK, USB_PRODUCT_MUSTEK_BEARPAW2400TA }, 0 }, {{ USB_VENDOR_MUSTEK, USB_PRODUCT_MUSTEK_BEARPAW1200TA }, 0 }, {{ USB_VENDOR_MUSTEK, USB_PRODUCT_MUSTEK_600USB }, 0 }, {{ USB_VENDOR_MUSTEK, USB_PRODUCT_MUSTEK_600CU }, 0 }, From owner-svn-src-user@FreeBSD.ORG Thu Oct 16 10:35:38 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A3BD0106568F; Thu, 16 Oct 2008 10:35:38 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 932908FC1F; Thu, 16 Oct 2008 10:35:38 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9GAZcRi058156; Thu, 16 Oct 2008 10:35:38 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9GAZc8H058155; Thu, 16 Oct 2008 10:35:38 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810161035.m9GAZc8H058155@svn.freebsd.org> From: Alexander Leidinger Date: Thu, 16 Oct 2008 10:35:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183940 - user/netchild/misc/src/sys/netsmb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Oct 2008 10:35:38 -0000 Author: netchild Date: Thu Oct 16 10:35:38 2008 New Revision: 183940 URL: http://svn.freebsd.org/changeset/base/183940 Log: I want a panic when this happens. Modified: user/netchild/misc/src/sys/netsmb/smb_conn.c Modified: user/netchild/misc/src/sys/netsmb/smb_conn.c ============================================================================== --- user/netchild/misc/src/sys/netsmb/smb_conn.c Thu Oct 16 10:34:38 2008 (r183939) +++ user/netchild/misc/src/sys/netsmb/smb_conn.c Thu Oct 16 10:35:38 2008 (r183940) @@ -350,6 +350,7 @@ smb_co_lock(struct smb_connobj *cp, int if (smb_co_lockstatus(cp, td) == LK_EXCLUSIVE && (flags & LK_CANRECURSE) == 0) { SMBERROR("recursive lock for object %d\n", cp->co_level); + panic("rescursive lock for object %p", cp); return 0; } return lockmgr(&cp->co_lock, flags, &cp->co_interlock); From owner-svn-src-user@FreeBSD.ORG Thu Oct 16 10:36:47 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1E8A106568A; Thu, 16 Oct 2008 10:36:47 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E181A8FC1D; Thu, 16 Oct 2008 10:36:47 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9GAalXP058210; Thu, 16 Oct 2008 10:36:47 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9GAalGi058209; Thu, 16 Oct 2008 10:36:47 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810161036.m9GAalGi058209@svn.freebsd.org> From: Alexander Leidinger Date: Thu, 16 Oct 2008 10:36:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183941 - user/netchild/misc/src/sys/netinet X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Oct 2008 10:36:48 -0000 Author: netchild Date: Thu Oct 16 10:36:47 2008 New Revision: 183941 URL: http://svn.freebsd.org/changeset/base/183941 Log: Be a little bit more verbose. The original error does not help. Modified: user/netchild/misc/src/sys/netinet/ip_fw2.c Modified: user/netchild/misc/src/sys/netinet/ip_fw2.c ============================================================================== --- user/netchild/misc/src/sys/netinet/ip_fw2.c Thu Oct 16 10:35:38 2008 (r183940) +++ user/netchild/misc/src/sys/netinet/ip_fw2.c Thu Oct 16 10:36:47 2008 (r183941) @@ -3389,7 +3389,7 @@ done: pullup_failed: if (V_fw_verbose) - printf("ipfw: pullup failed\n"); + printf("ipfw: pullup failed, packet too short (network problem or malicious packet)\n"); return (IP_FW_DENY); } From owner-svn-src-user@FreeBSD.ORG Thu Oct 16 10:40:07 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC7061065688; Thu, 16 Oct 2008 10:40:07 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9BCF48FC1D; Thu, 16 Oct 2008 10:40:07 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9GAe7GW058303; Thu, 16 Oct 2008 10:40:07 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9GAe7nb058302; Thu, 16 Oct 2008 10:40:07 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810161040.m9GAe7nb058302@svn.freebsd.org> From: Alexander Leidinger Date: Thu, 16 Oct 2008 10:40:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183942 - user/netchild/misc/src/sys/kern X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Oct 2008 10:40:07 -0000 Author: netchild Date: Thu Oct 16 10:40:07 2008 New Revision: 183942 URL: http://svn.freebsd.org/changeset/base/183942 Log: Log the time of a segfault. If you don't have a syslog.conf which logs such info messages to a file, there's no trace of when this happened. With this change you at least have the possibility to grab the time from the console and try to correlate this with other things. Modified: user/netchild/misc/src/sys/kern/kern_sig.c Modified: user/netchild/misc/src/sys/kern/kern_sig.c ============================================================================== --- user/netchild/misc/src/sys/kern/kern_sig.c Thu Oct 16 10:36:47 2008 (r183941) +++ user/netchild/misc/src/sys/kern/kern_sig.c Thu Oct 16 10:40:07 2008 (r183942) @@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -2718,13 +2719,18 @@ sigexit(td, sig) */ if (coredump(td) == 0) sig |= WCOREFLAG; - if (kern_logsigexit) + if (kern_logsigexit) { + struct bintime now; + + getbintime(&now); log(LOG_INFO, - "pid %d (%s), uid %d: exited on signal %d%s\n", + "%zd: pid %d (%s), uid %d: exited on signal %d%s\n", + now.sec, p->p_pid, p->p_comm, td->td_ucred ? td->td_ucred->cr_uid : -1, sig &~ WCOREFLAG, sig & WCOREFLAG ? " (core dumped)" : ""); + } } else PROC_UNLOCK(p); exit1(td, W_EXITCODE(0, sig)); From owner-svn-src-user@FreeBSD.ORG Thu Oct 16 10:41:02 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F039C106568F; Thu, 16 Oct 2008 10:41:02 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DFE038FC25; Thu, 16 Oct 2008 10:41:02 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9GAf2K3058351; Thu, 16 Oct 2008 10:41:02 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9GAf2dT058350; Thu, 16 Oct 2008 10:41:02 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810161041.m9GAf2dT058350@svn.freebsd.org> From: Alexander Leidinger Date: Thu, 16 Oct 2008 10:41:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183943 - user/netchild/misc/src/sbin/recoverdisk X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Oct 2008 10:41:03 -0000 Author: netchild Date: Thu Oct 16 10:41:02 2008 New Revision: 183943 URL: http://svn.freebsd.org/changeset/base/183943 Log: I prefer user readable errors in userland utilities. Modified: user/netchild/misc/src/sbin/recoverdisk/recoverdisk.c Modified: user/netchild/misc/src/sbin/recoverdisk/recoverdisk.c ============================================================================== --- user/netchild/misc/src/sbin/recoverdisk/recoverdisk.c Thu Oct 16 10:40:07 2008 (r183942) +++ user/netchild/misc/src/sbin/recoverdisk/recoverdisk.c Thu Oct 16 10:41:02 2008 (r183943) @@ -276,7 +276,8 @@ main(int argc, char * const argv[]) lp->len -= i; continue; } - printf("\n%jd %zu failed %d\n", lp->start, i, errno); + printf("\n%jd %zu failed: %s (errno %d)\n", lp->start, + i, strerror(errno), errno); new_lump(lp->start, i, lp->state + 1); lp->start += i; lp->len -= i; From owner-svn-src-user@FreeBSD.ORG Thu Oct 16 10:42:10 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B7AD41065693; Thu, 16 Oct 2008 10:42:10 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A70EE8FC12; Thu, 16 Oct 2008 10:42:10 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9GAgAXh058407; Thu, 16 Oct 2008 10:42:10 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9GAgAuN058406; Thu, 16 Oct 2008 10:42:10 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810161042.m9GAgAuN058406@svn.freebsd.org> From: Alexander Leidinger Date: Thu, 16 Oct 2008 10:42:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183944 - user/netchild/misc/src/sys/dev/hptmv X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Oct 2008 10:42:10 -0000 Author: netchild Date: Thu Oct 16 10:42:10 2008 New Revision: 183944 URL: http://svn.freebsd.org/changeset/base/183944 Log: Error handling of copyin/copyout. Modified: user/netchild/misc/src/sys/dev/hptmv/hptproc.c Modified: user/netchild/misc/src/sys/dev/hptmv/hptproc.c ============================================================================== --- user/netchild/misc/src/sys/dev/hptmv/hptproc.c Thu Oct 16 10:41:02 2008 (r183943) +++ user/netchild/misc/src/sys/dev/hptmv/hptproc.c Thu Oct 16 10:42:10 2008 (r183944) @@ -261,7 +261,7 @@ hpt_set_info(int length) #ifdef SUPPORT_IOCTL PUCHAR ke_area; - int err; + int err = 0; DWORD dwRet; PHPT_IOCTL_PARAM piop; #endif @@ -301,21 +301,26 @@ hpt_set_info(int length) } if (piop->nInBufferSize) - copyin((void*)(ULONG_PTR)piop->lpInBuffer, ke_area, piop->nInBufferSize); + err = copyin((void*)(ULONG_PTR)piop->lpInBuffer, ke_area, piop->nInBufferSize); /* * call kernel handler. */ - err = Kernel_DeviceIoControl(&gIal_Adapter->VBus, - piop->dwIoControlCode, ke_area, piop->nInBufferSize, - ke_area + piop->nInBufferSize, piop->nOutBufferSize, &dwRet); + if (err==0) + err = Kernel_DeviceIoControl(&gIal_Adapter->VBus, + piop->dwIoControlCode, ke_area, piop->nInBufferSize, + ke_area + piop->nInBufferSize, piop->nOutBufferSize, &dwRet); if (err==0) { - if (piop->nOutBufferSize) - copyout(ke_area + piop->nInBufferSize, (void*)(ULONG_PTR)piop->lpOutBuffer, piop->nOutBufferSize); + if (piop->nOutBufferSize) { + err = copyout(ke_area + piop->nInBufferSize, (void*)(ULONG_PTR)piop->lpOutBuffer, piop->nOutBufferSize); + if (err) KdPrintW(("Kernel_ioctl(): copyout (1) return %d\n", err)); + } - if (piop->lpBytesReturned) - copyout(&dwRet, (void*)(ULONG_PTR)piop->lpBytesReturned, sizeof(DWORD)); + if (piop->lpBytesReturned) { + err = copyout(&dwRet, (void*)(ULONG_PTR)piop->lpBytesReturned, sizeof(DWORD)); + if (err) KdPrintW(("Kernel_ioctl(): copyout (2) return %d\n", err)); + } free(ke_area, M_DEVBUF); return length; From owner-svn-src-user@FreeBSD.ORG Thu Oct 16 10:44:42 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 928C6106568A; Thu, 16 Oct 2008 10:44:42 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 820538FC13; Thu, 16 Oct 2008 10:44:42 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9GAigHh058617; Thu, 16 Oct 2008 10:44:42 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9GAig9Q058616; Thu, 16 Oct 2008 10:44:42 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810161044.m9GAig9Q058616@svn.freebsd.org> From: Alexander Leidinger Date: Thu, 16 Oct 2008 10:44:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183945 - user/netchild/misc/src/sys/i386/i386 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Oct 2008 10:44:42 -0000 Author: netchild Date: Thu Oct 16 10:44:42 2008 New Revision: 183945 URL: http://svn.freebsd.org/changeset/base/183945 Log: I prefer LDT warnings. Basically this is a backout of r??? (including typos). Modified: user/netchild/misc/src/sys/i386/i386/sys_machdep.c Modified: user/netchild/misc/src/sys/i386/i386/sys_machdep.c ============================================================================== --- user/netchild/misc/src/sys/i386/i386/sys_machdep.c Thu Oct 16 10:42:10 2008 (r183944) +++ user/netchild/misc/src/sys/i386/i386/sys_machdep.c Thu Oct 16 10:44:42 2008 (r183945) @@ -635,6 +635,12 @@ i386_set_ldt(td, uap, descs) } if (!(uap->start == LDT_AUTO_ALLOC && uap->num == 1)) { + /* complain a for a while if using old methods */ + if (ldt_warnings++ < NUM_LDT_WARNINGS) { + printf("Warning: pid %d (%s) used static ldt allocation.\n", + td->td_proc->p_pid, td->td_proc->p_comm); + printf("See the i386_set_ldt man page for more info\n"); + } /* verify range of descriptors to modify */ largest_ld = uap->start + uap->num; if (uap->start >= MAX_LD || From owner-svn-src-user@FreeBSD.ORG Thu Oct 16 10:45:40 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EA7E71065697; Thu, 16 Oct 2008 10:45:39 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D98978FC1F; Thu, 16 Oct 2008 10:45:39 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9GAjdk0059543; Thu, 16 Oct 2008 10:45:39 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9GAjdjA059541; Thu, 16 Oct 2008 10:45:39 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810161045.m9GAjdjA059541@svn.freebsd.org> From: Alexander Leidinger Date: Thu, 16 Oct 2008 10:45:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183946 - in user/netchild/misc/src/sys/i386: i386 isa X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Oct 2008 10:45:40 -0000 Author: netchild Date: Thu Oct 16 10:45:39 2008 New Revision: 183946 URL: http://svn.freebsd.org/changeset/base/183946 Log: Technically this can be used on more kinds of CPUs. Modified: user/netchild/misc/src/sys/i386/i386/support.s user/netchild/misc/src/sys/i386/isa/npx.c Modified: user/netchild/misc/src/sys/i386/i386/support.s ============================================================================== --- user/netchild/misc/src/sys/i386/i386/support.s Thu Oct 16 10:44:42 2008 (r183945) +++ user/netchild/misc/src/sys/i386/i386/support.s Thu Oct 16 10:45:39 2008 (r183946) @@ -54,7 +54,7 @@ copyin_vector: .globl copyout_vector copyout_vector: .long generic_copyout -#if defined(I586_CPU) && defined(DEV_NPX) +#if (defined(I586_CPU) || defined(I686_CPU)) && defined(DEV_NPX) kernel_fpu_lock: .byte 0xfe .space 3 @@ -202,7 +202,7 @@ do0: END(i486_bzero) #endif -#if defined(I586_CPU) && defined(DEV_NPX) +#if (defined(I586_CPU) || defined(I686_CPU)) && defined(DEV_NPX) ENTRY(i586_bzero) movl 4(%esp),%edx movl 8(%esp),%ecx @@ -359,7 +359,7 @@ intreg_i586_bzero: popl %edi ret END(i586_bzero) -#endif /* I586_CPU && defined(DEV_NPX) */ +#endif /* (I586_CPU || I686_CPU) && defined(DEV_NPX) */ ENTRY(sse2_pagezero) pushl %ebx @@ -528,7 +528,7 @@ ENTRY(generic_bcopy) ret END(generic_bcopy) -#if defined(I586_CPU) && defined(DEV_NPX) +#if (defined(I586_CPU) || defined(I686_CPU)) && defined(DEV_NPX) ENTRY(i586_bcopy) pushl %esi pushl %edi @@ -676,7 +676,7 @@ small_i586_bcopy: cld ret END(i586_bcopy) -#endif /* I586_CPU && defined(DEV_NPX) */ +#endif /* (I586_CPU || I686_CPU) && defined(DEV_NPX) */ /* * Note: memcpy does not support overlapping copies @@ -764,7 +764,7 @@ ENTRY(generic_copyout) /* bcopy(%esi, %edi, %ebx) */ movl %ebx,%ecx -#if defined(I586_CPU) && defined(DEV_NPX) +#if (defined(I586_CPU) || defined(I686_CPU)) && defined(DEV_NPX) ALIGN_TEXT slow_copyout: #endif @@ -797,7 +797,7 @@ copyout_fault: movl $EFAULT,%eax ret -#if defined(I586_CPU) && defined(DEV_NPX) +#if (defined(I586_CPU) || defined(I686_CPU)) && defined(DEV_NPX) ENTRY(i586_copyout) /* * Duplicated from generic_copyout. Could be done a bit better. @@ -850,7 +850,7 @@ ENTRY(i586_copyout) addl $4,%esp jmp done_copyout END(i586_copyout) -#endif /* I586_CPU && defined(DEV_NPX) */ +#endif /* (I586_CPU || I686_CPU) && defined(DEV_NPX) */ /* * copyin(from_user, to_kernel, len) - MP SAFE @@ -878,7 +878,7 @@ ENTRY(generic_copyin) cmpl $VM_MAXUSER_ADDRESS,%edx ja copyin_fault -#if defined(I586_CPU) && defined(DEV_NPX) +#if (defined(I586_CPU) || defined(I686_CPU)) && defined(DEV_NPX) ALIGN_TEXT slow_copyin: #endif @@ -892,7 +892,7 @@ slow_copyin: rep movsb -#if defined(I586_CPU) && defined(DEV_NPX) +#if (defined(I586_CPU) || defined(I686_CPU)) && defined(DEV_NPX) ALIGN_TEXT done_copyin: #endif @@ -913,7 +913,7 @@ copyin_fault: movl $EFAULT,%eax ret -#if defined(I586_CPU) && defined(DEV_NPX) +#if (defined(I586_CPU) || defined(I686_CPU)) && defined(DEV_NPX) ENTRY(i586_copyin) /* * Duplicated from generic_copyin. Could be done a bit better. @@ -947,9 +947,9 @@ ENTRY(i586_copyin) addl $8,%esp jmp done_copyin END(i586_copyin) -#endif /* I586_CPU && defined(DEV_NPX) */ +#endif /* (I586_CPU || I686_CPU) && defined(DEV_NPX) */ -#if defined(I586_CPU) && defined(DEV_NPX) +#if (defined(I586_CPU) || defined(I686_CPU)) && defined(DEV_NPX) /* fastmove(src, dst, len) src in %esi dst in %edi @@ -1155,7 +1155,7 @@ fastmove_tail_fault: movl $EFAULT,%eax ret END(fastmove) -#endif /* I586_CPU && defined(DEV_NPX) */ +#endif /* (I586_CPU || I686_CPU) && defined(DEV_NPX) */ /* * casuword. Compare and set user word. Returns -1 or the current value. Modified: user/netchild/misc/src/sys/i386/isa/npx.c ============================================================================== --- user/netchild/misc/src/sys/i386/isa/npx.c Thu Oct 16 10:44:42 2008 (r183945) +++ user/netchild/misc/src/sys/i386/isa/npx.c Thu Oct 16 10:45:39 2008 (r183946) @@ -160,10 +160,10 @@ static int npx_attach(device_t dev); static void npx_identify(driver_t *driver, device_t parent); static int npx_intr(void *); static int npx_probe(device_t dev); -#ifdef I586_CPU_XXX +#if defined(I586_CPU) || defined(I686_CPU) static long timezero(const char *funcname, void (*func)(void *buf, size_t len)); -#endif /* I586_CPU */ +#endif /* I586_CPU || I686_CPU */ int hw_float; /* XXX currently just alias for npx_exists */ @@ -439,9 +439,9 @@ npx_attach(dev) npx_cleanstate_ready = 1; intr_restore(s); } -#ifdef I586_CPU_XXX - if (cpu_class == CPUCLASS_586 && npx_ex16 && npx_exists && - timezero("i586_bzero()", i586_bzero) < +#if defined(I586_CPU) || defined(I686_CPU) + if ((cpu_class == CPUCLASS_586 || cpu_class == CPUCLASS_686) && + npx_ex16 && npx_exists && timezero("i586_bzero()", i586_bzero) < timezero("bzero()", bzero) * 4 / 5) { if (!(flags & NPX_DISABLE_I586_OPTIMIZED_BCOPY)) bcopy_vector = i586_bcopy; @@ -1021,7 +1021,7 @@ fpurstor(addr) frstor(addr); } -#ifdef I586_CPU_XXX +#if defined(I586_CPU) || defined(I686_CPU) static long timezero(funcname, func) const char *funcname; @@ -1049,7 +1049,7 @@ timezero(funcname, func) free(buf, M_TEMP); return (usec); } -#endif /* I586_CPU */ +#endif /* I586_CPU || I686_CPU */ static device_method_t npx_methods[] = { /* Device interface */ From owner-svn-src-user@FreeBSD.ORG Thu Oct 16 10:47:39 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D84291065687; Thu, 16 Oct 2008 10:47:39 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C6E7E8FC13; Thu, 16 Oct 2008 10:47:39 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9GAldw5059610; Thu, 16 Oct 2008 10:47:39 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9GAld9n059608; Thu, 16 Oct 2008 10:47:39 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810161047.m9GAld9n059608@svn.freebsd.org> From: Alexander Leidinger Date: Thu, 16 Oct 2008 10:47:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183947 - in user/netchild/misc/src/sys/gnu/fs: ext2fs reiserfs X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Oct 2008 10:47:39 -0000 Author: netchild Date: Thu Oct 16 10:47:39 2008 New Revision: 183947 URL: http://svn.freebsd.org/changeset/base/183947 Log: Some more error checking. XXX: Too much defensive programming? Modified: user/netchild/misc/src/sys/gnu/fs/ext2fs/ext2_vfsops.c user/netchild/misc/src/sys/gnu/fs/reiserfs/reiserfs_vfsops.c Modified: user/netchild/misc/src/sys/gnu/fs/ext2fs/ext2_vfsops.c ============================================================================== --- user/netchild/misc/src/sys/gnu/fs/ext2fs/ext2_vfsops.c Thu Oct 16 10:45:39 2008 (r183946) +++ user/netchild/misc/src/sys/gnu/fs/ext2fs/ext2_vfsops.c Thu Oct 16 10:47:39 2008 (r183947) @@ -145,7 +145,10 @@ ext2_mount(mp, td) if (vfs_filteropt(opts, ext2_opts)) return (EINVAL); - vfs_getopt(opts, "fspath", (void **)&path, NULL); + /* The fspath has to exist (invariant), but better safe than sorry. */ + error = vfs_getopt(opts, "fspath", (void **)&path, NULL); + if (error != 0) + return (error); /* Double-check the length of path.. */ if (strlen(path) >= MAXMNTLEN - 1) return (ENAMETOOLONG); Modified: user/netchild/misc/src/sys/gnu/fs/reiserfs/reiserfs_vfsops.c ============================================================================== --- user/netchild/misc/src/sys/gnu/fs/reiserfs/reiserfs_vfsops.c Thu Oct 16 10:45:39 2008 (r183946) +++ user/netchild/misc/src/sys/gnu/fs/reiserfs/reiserfs_vfsops.c Thu Oct 16 10:47:39 2008 (r183947) @@ -89,8 +89,10 @@ reiserfs_mount(struct mount *mp, struct opts = mp->mnt_optnew; /* `fspath' contains the mount point (eg. /mnt/linux); REQUIRED */ - vfs_getopt(opts, "fspath", (void **)&path, NULL); - reiserfs_log(LOG_INFO, "mount point is `%s'\n", path); + if (vfs_getopt(opts, "fspath", (void **)&path, NULL) == 0) + reiserfs_log(LOG_INFO, "mount point is `%s'\n", path); + else + reiserfs_log(LOG_WARNING, "mount point is `'\n"); /* `from' contains the device name (eg. /dev/ad0s1); REQUIRED */ fspec = NULL; From owner-svn-src-user@FreeBSD.ORG Thu Oct 16 10:48:27 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3864F1065687; Thu, 16 Oct 2008 10:48:27 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 27A378FC08; Thu, 16 Oct 2008 10:48:27 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9GAmRFq059665; Thu, 16 Oct 2008 10:48:27 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9GAmRQS059664; Thu, 16 Oct 2008 10:48:27 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810161048.m9GAmRQS059664@svn.freebsd.org> From: Alexander Leidinger Date: Thu, 16 Oct 2008 10:48:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183948 - user/netchild/misc/src/sys/dev/ata X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Oct 2008 10:48:27 -0000 Author: netchild Date: Thu Oct 16 10:48:26 2008 New Revision: 183948 URL: http://svn.freebsd.org/changeset/base/183948 Log: I prefer a longer request timeout. Modified: user/netchild/misc/src/sys/dev/ata/ata-all.c Modified: user/netchild/misc/src/sys/dev/ata/ata-all.c ============================================================================== --- user/netchild/misc/src/sys/dev/ata/ata-all.c Thu Oct 16 10:47:39 2008 (r183947) +++ user/netchild/misc/src/sys/dev/ata/ata-all.c Thu Oct 16 10:48:26 2008 (r183948) @@ -600,7 +600,7 @@ ata_getparam(struct ata_device *atadev, if (!(request = ata_alloc_request())) break; request->dev = atadev->dev; - request->timeout = 1; + request->timeout = 5; request->retries = 0; request->u.ata.command = command; request->flags = (ATA_R_READ|ATA_R_AT_HEAD|ATA_R_DIRECT|ATA_R_QUIET); From owner-svn-src-user@FreeBSD.ORG Thu Oct 16 10:50:31 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2621F1065689; Thu, 16 Oct 2008 10:50:31 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5017D8FC2B; Thu, 16 Oct 2008 10:50:30 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9GAoUI0059736; Thu, 16 Oct 2008 10:50:30 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9GAoUsm059735; Thu, 16 Oct 2008 10:50:30 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810161050.m9GAoUsm059735@svn.freebsd.org> From: Alexander Leidinger Date: Thu, 16 Oct 2008 10:50:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183949 - user/netchild/misc/src/lib/libc/stdlib X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Oct 2008 10:50:31 -0000 Author: netchild Date: Thu Oct 16 10:50:30 2008 New Revision: 183949 URL: http://svn.freebsd.org/changeset/base/183949 Log: I do not want to pollute the world-CFLAGS with this, so do it local. Modified: user/netchild/misc/src/lib/libc/stdlib/Makefile.inc Modified: user/netchild/misc/src/lib/libc/stdlib/Makefile.inc ============================================================================== --- user/netchild/misc/src/lib/libc/stdlib/Makefile.inc Thu Oct 16 10:48:26 2008 (r183948) +++ user/netchild/misc/src/lib/libc/stdlib/Makefile.inc Thu Oct 16 10:50:30 2008 (r183949) @@ -48,3 +48,8 @@ MLINKS+=strtoul.3 strtoull.3 strtoul.3 s MLINKS+=malloc.3 calloc.3 malloc.3 free.3 malloc.3 malloc.conf.5 \ malloc.3 realloc.3 malloc.3 reallocf.3 malloc.3 malloc_usable_size.3 MLINKS+=tsearch.3 tdelete.3 tsearch.3 tfind.3 tsearch.3 twalk.3 + +.if defined(MALLOC_PRODUCTION) +CFLAGS+= -DMALLOC_PRODUCTION +.endif + From owner-svn-src-user@FreeBSD.ORG Thu Oct 16 10:56:26 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 71585106568A; Thu, 16 Oct 2008 10:56:26 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D3468FC12; Thu, 16 Oct 2008 10:56:26 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9GAuQ6C059877; Thu, 16 Oct 2008 10:56:26 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9GAuQXV059873; Thu, 16 Oct 2008 10:56:26 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810161056.m9GAuQXV059873@svn.freebsd.org> From: Alexander Leidinger Date: Thu, 16 Oct 2008 10:56:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183950 - in user/netchild/obsolete: . src src/libexec src/libexec/tftpd src/sbin src/sbin/dump src/sbin/restore src/usr.sbin src/usr.sbin/ntp X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Oct 2008 10:56:26 -0000 Author: netchild Date: Thu Oct 16 10:56:25 2008 New Revision: 183950 URL: http://svn.freebsd.org/changeset/base/183950 Log: Create baseline for some stuff which is or will be obsolete soon for whatever reason. Added: user/netchild/obsolete/ user/netchild/obsolete/README user/netchild/obsolete/src/ user/netchild/obsolete/src/libexec/ user/netchild/obsolete/src/libexec/tftpd/ user/netchild/obsolete/src/libexec/tftpd/tftpd.c (props changed) - copied unchanged from r183911, head/libexec/tftpd/tftpd.c user/netchild/obsolete/src/sbin/ user/netchild/obsolete/src/sbin/dump/ user/netchild/obsolete/src/sbin/dump/dumprmt.c (props changed) - copied unchanged from r183911, head/sbin/dump/dumprmt.c user/netchild/obsolete/src/sbin/dump/itime.c (props changed) - copied unchanged from r183911, head/sbin/dump/itime.c user/netchild/obsolete/src/sbin/dump/optr.c (props changed) - copied unchanged from r183911, head/sbin/dump/optr.c user/netchild/obsolete/src/sbin/dump/tape.c (props changed) - copied unchanged from r183911, head/sbin/dump/tape.c user/netchild/obsolete/src/sbin/restore/ user/netchild/obsolete/src/sbin/restore/dirs.c (props changed) - copied unchanged from r183911, head/sbin/restore/dirs.c user/netchild/obsolete/src/sbin/restore/symtab.c (props changed) - copied unchanged from r183911, head/sbin/restore/symtab.c user/netchild/obsolete/src/sbin/restore/tape.c (props changed) - copied unchanged from r183911, head/sbin/restore/tape.c user/netchild/obsolete/src/usr.sbin/ user/netchild/obsolete/src/usr.sbin/ntp/ user/netchild/obsolete/src/usr.sbin/ntp/config.h (props changed) - copied unchanged from r183911, head/usr.sbin/ntp/config.h Added: user/netchild/obsolete/README ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/netchild/obsolete/README Thu Oct 16 10:56:25 2008 (r183950) @@ -0,0 +1 @@ +Some stuff which is or will be obsolete soon for whatever reason. Copied: user/netchild/obsolete/src/libexec/tftpd/tftpd.c (from r183911, head/libexec/tftpd/tftpd.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/netchild/obsolete/src/libexec/tftpd/tftpd.c Thu Oct 16 10:56:25 2008 (r183950, copy of r183911, head/libexec/tftpd/tftpd.c) @@ -0,0 +1,998 @@ +/* + * Copyright (c) 1983, 1993 + * 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. + */ + +#ifndef lint +static const char copyright[] = +"@(#) Copyright (c) 1983, 1993\n\ + The Regents of the University of California. All rights reserved.\n"; +#endif /* not lint */ + +#ifndef lint +#if 0 +static char sccsid[] = "@(#)tftpd.c 8.1 (Berkeley) 6/4/93"; +#endif +static const char rcsid[] = + "$FreeBSD$"; +#endif /* not lint */ + +/* + * Trivial file transfer protocol server. + * + * This version includes many modifications by Jim Guyton + * . + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "tftpsubs.h" + +#define TIMEOUT 5 +#define MAX_TIMEOUTS 5 + +int peer; +int rexmtval = TIMEOUT; +int max_rexmtval = 2*TIMEOUT; + +#define PKTSIZE SEGSIZE+4 +char buf[PKTSIZE]; +char ackbuf[PKTSIZE]; +struct sockaddr_storage from; + +void tftp(struct tftphdr *, int); +static void unmappedaddr(struct sockaddr_in6 *); + +/* + * Null-terminated directory prefix list for absolute pathname requests and + * search list for relative pathname requests. + * + * MAXDIRS should be at least as large as the number of arguments that + * inetd allows (currently 20). + */ +#define MAXDIRS 20 +static struct dirlist { + const char *name; + int len; +} dirs[MAXDIRS+1]; +static int suppress_naks; +static int logging; +static int ipchroot; +static int create_new = 0; +static char *newfile_format = "%Y%m%d"; +static int increase_name = 0; +static mode_t mask = S_IWGRP|S_IWOTH; + +static const char *errtomsg(int); +static void nak(int); +static void oack(void); + +static void timer(int); +static void justquit(int); + +int +main(int argc, char *argv[]) +{ + struct tftphdr *tp; + socklen_t fromlen, len; + int n; + int ch, on; + struct sockaddr_storage me; + char *chroot_dir = NULL; + struct passwd *nobody; + const char *chuser = "nobody"; + + tzset(); /* syslog in localtime */ + + openlog("tftpd", LOG_PID | LOG_NDELAY, LOG_FTP); + while ((ch = getopt(argc, argv, "cCF:lns:u:U:wW")) != -1) { + switch (ch) { + case 'c': + ipchroot = 1; + break; + case 'C': + ipchroot = 2; + break; + case 'F': + newfile_format = optarg; + break; + case 'l': + logging = 1; + break; + case 'n': + suppress_naks = 1; + break; + case 's': + chroot_dir = optarg; + break; + case 'u': + chuser = optarg; + break; + case 'U': + mask = strtol(optarg, NULL, 0); + break; + case 'w': + create_new = 1; + break; + case 'W': + create_new = 1; + increase_name = 1; + break; + default: + syslog(LOG_WARNING, "ignoring unknown option -%c", ch); + } + } + if (optind < argc) { + struct dirlist *dirp; + + /* Get list of directory prefixes. Skip relative pathnames. */ + for (dirp = dirs; optind < argc && dirp < &dirs[MAXDIRS]; + optind++) { + if (argv[optind][0] == '/') { + dirp->name = argv[optind]; + dirp->len = strlen(dirp->name); + dirp++; + } + } + } + else if (chroot_dir) { + dirs->name = "/"; + dirs->len = 1; + } + if (ipchroot > 0 && chroot_dir == NULL) { + syslog(LOG_ERR, "-c requires -s"); + exit(1); + } + + umask(mask); + + on = 1; + if (ioctl(0, FIONBIO, &on) < 0) { + syslog(LOG_ERR, "ioctl(FIONBIO): %m"); + exit(1); + } + fromlen = sizeof (from); + n = recvfrom(0, buf, sizeof (buf), 0, + (struct sockaddr *)&from, &fromlen); + if (n < 0) { + syslog(LOG_ERR, "recvfrom: %m"); + exit(1); + } + /* + * Now that we have read the message out of the UDP + * socket, we fork and exit. Thus, inetd will go back + * to listening to the tftp port, and the next request + * to come in will start up a new instance of tftpd. + * + * We do this so that inetd can run tftpd in "wait" mode. + * The problem with tftpd running in "nowait" mode is that + * inetd may get one or more successful "selects" on the + * tftp port before we do our receive, so more than one + * instance of tftpd may be started up. Worse, if tftpd + * break before doing the above "recvfrom", inetd would + * spawn endless instances, clogging the system. + */ + { + int i, pid; + + for (i = 1; i < 20; i++) { + pid = fork(); + if (pid < 0) { + sleep(i); + /* + * flush out to most recently sent request. + * + * This may drop some request, but those + * will be resent by the clients when + * they timeout. The positive effect of + * this flush is to (try to) prevent more + * than one tftpd being started up to service + * a single request from a single client. + */ + fromlen = sizeof from; + i = recvfrom(0, buf, sizeof (buf), 0, + (struct sockaddr *)&from, &fromlen); + if (i > 0) { + n = i; + } + } else { + break; + } + } + if (pid < 0) { + syslog(LOG_ERR, "fork: %m"); + exit(1); + } else if (pid != 0) { + exit(0); + } + } + + /* + * Since we exit here, we should do that only after the above + * recvfrom to keep inetd from constantly forking should there + * be a problem. See the above comment about system clogging. + */ + if (chroot_dir) { + if (ipchroot > 0) { + char *tempchroot; + struct stat sb; + int statret; + struct sockaddr_storage ss; + char hbuf[NI_MAXHOST]; + + memcpy(&ss, &from, from.ss_len); + unmappedaddr((struct sockaddr_in6 *)&ss); + getnameinfo((struct sockaddr *)&ss, ss.ss_len, + hbuf, sizeof(hbuf), NULL, 0, + NI_NUMERICHOST); + asprintf(&tempchroot, "%s/%s", chroot_dir, hbuf); + if (ipchroot == 2) + statret = stat(tempchroot, &sb); + if (ipchroot == 1 || + (statret == 0 && (sb.st_mode & S_IFDIR))) + chroot_dir = tempchroot; + } + /* Must get this before chroot because /etc might go away */ + if ((nobody = getpwnam(chuser)) == NULL) { + syslog(LOG_ERR, "%s: no such user", chuser); + exit(1); + } + if (chroot(chroot_dir)) { + syslog(LOG_ERR, "chroot: %s: %m", chroot_dir); + exit(1); + } + chdir("/"); + setgroups(1, &nobody->pw_gid); + setuid(nobody->pw_uid); + } + + len = sizeof(me); + if (getsockname(0, (struct sockaddr *)&me, &len) == 0) { + switch (me.ss_family) { + case AF_INET: + ((struct sockaddr_in *)&me)->sin_port = 0; + break; + case AF_INET6: + ((struct sockaddr_in6 *)&me)->sin6_port = 0; + break; + default: + /* unsupported */ + break; + } + } else { + memset(&me, 0, sizeof(me)); + me.ss_family = from.ss_family; + me.ss_len = from.ss_len; + } + alarm(0); + close(0); + close(1); + peer = socket(from.ss_family, SOCK_DGRAM, 0); + if (peer < 0) { + syslog(LOG_ERR, "socket: %m"); + exit(1); + } + if (bind(peer, (struct sockaddr *)&me, me.ss_len) < 0) { + syslog(LOG_ERR, "bind: %m"); + exit(1); + } + if (connect(peer, (struct sockaddr *)&from, from.ss_len) < 0) { + syslog(LOG_ERR, "connect: %m"); + exit(1); + } + tp = (struct tftphdr *)buf; + tp->th_opcode = ntohs(tp->th_opcode); + if (tp->th_opcode == RRQ || tp->th_opcode == WRQ) + tftp(tp, n); + exit(1); +} + +static void +reduce_path(char *fn) +{ + char *slash, *ptr; + + /* Reduce all "/+./" to "/" (just in case we've got "/./../" later */ + while ((slash = strstr(fn, "/./")) != NULL) { + for (ptr = slash; ptr > fn && ptr[-1] == '/'; ptr--) + ; + slash += 2; + while (*slash) + *++ptr = *++slash; + } + + /* Now reduce all "/something/+../" to "/" */ + while ((slash = strstr(fn, "/../")) != NULL) { + if (slash == fn) + break; + for (ptr = slash; ptr > fn && ptr[-1] == '/'; ptr--) + ; + for (ptr--; ptr >= fn; ptr--) + if (*ptr == '/') + break; + if (ptr < fn) + break; + slash += 3; + while (*slash) + *++ptr = *++slash; + } +} + +struct formats; +int validate_access(char **, int); +void xmitfile(struct formats *); +void recvfile(struct formats *); + +struct formats { + const char *f_mode; + int (*f_validate)(char **, int); + void (*f_send)(struct formats *); + void (*f_recv)(struct formats *); + int f_convert; +} formats[] = { + { "netascii", validate_access, xmitfile, recvfile, 1 }, + { "octet", validate_access, xmitfile, recvfile, 0 }, +#ifdef notdef + { "mail", validate_user, sendmail, recvmail, 1 }, +#endif + { 0, NULL, NULL, NULL, 0 } +}; + +struct options { + const char *o_type; + char *o_request; + int o_reply; /* turn into union if need be */ +} options[] = { + { "tsize", NULL, 0 }, /* OPT_TSIZE */ + { "timeout", NULL, 0 }, /* OPT_TIMEOUT */ + { NULL, NULL, 0 } +}; + +enum opt_enum { + OPT_TSIZE = 0, + OPT_TIMEOUT, +}; + +/* + * Handle initial connection protocol. + */ +void +tftp(struct tftphdr *tp, int size) +{ + char *cp; + int i, first = 1, has_options = 0, ecode; + struct formats *pf; + char *filename, *mode, *option, *ccp; + char fnbuf[PATH_MAX]; + + cp = tp->th_stuff; +again: + while (cp < buf + size) { + if (*cp == '\0') + break; + cp++; + } + if (*cp != '\0') { + nak(EBADOP); + exit(1); + } + i = cp - tp->th_stuff; + if (i >= sizeof(fnbuf)) { + nak(EBADOP); + exit(1); + } + memcpy(fnbuf, tp->th_stuff, i); + fnbuf[i] = '\0'; + reduce_path(fnbuf); + filename = fnbuf; + if (first) { + mode = ++cp; + first = 0; + goto again; + } + for (cp = mode; *cp; cp++) + if (isupper(*cp)) + *cp = tolower(*cp); + for (pf = formats; pf->f_mode; pf++) + if (strcmp(pf->f_mode, mode) == 0) + break; + if (pf->f_mode == 0) { + nak(EBADOP); + exit(1); + } + while (++cp < buf + size) { + for (i = 2, ccp = cp; i > 0; ccp++) { + if (ccp >= buf + size) { + /* + * Don't reject the request, just stop trying + * to parse the option and get on with it. + * Some Apple Open Firmware versions have + * trailing garbage on the end of otherwise + * valid requests. + */ + goto option_fail; + } else if (*ccp == '\0') + i--; + } + for (option = cp; *cp; cp++) + if (isupper(*cp)) + *cp = tolower(*cp); + for (i = 0; options[i].o_type != NULL; i++) + if (strcmp(option, options[i].o_type) == 0) { + options[i].o_request = ++cp; + has_options = 1; + } + cp = ccp-1; + } + +option_fail: + if (options[OPT_TIMEOUT].o_request) { + int to = atoi(options[OPT_TIMEOUT].o_request); + if (to < 1 || to > 255) { + nak(EBADOP); + exit(1); + } + else if (to <= max_rexmtval) + options[OPT_TIMEOUT].o_reply = rexmtval = to; + else + options[OPT_TIMEOUT].o_request = NULL; + } + + ecode = (*pf->f_validate)(&filename, tp->th_opcode); + if (has_options && ecode == 0) + oack(); + if (logging) { + char hbuf[NI_MAXHOST]; + + getnameinfo((struct sockaddr *)&from, from.ss_len, + hbuf, sizeof(hbuf), NULL, 0, 0); + syslog(LOG_INFO, "%s: %s request for %s: %s", hbuf, + tp->th_opcode == WRQ ? "write" : "read", + filename, errtomsg(ecode)); + } + if (ecode) { + /* + * Avoid storms of naks to a RRQ broadcast for a relative + * bootfile pathname from a diskless Sun. + */ + if (suppress_naks && *filename != '/' && ecode == ENOTFOUND) + exit(0); + nak(ecode); + exit(1); + } + if (tp->th_opcode == WRQ) + (*pf->f_recv)(pf); + else + (*pf->f_send)(pf); + exit(0); +} + + +FILE *file; + +/* + * Find the next value for YYYYMMDD.nn when the file to be written should + * be unique. Due to the limitations of nn, we will fail if nn reaches 100. + * Besides, that is four updates per hour on a file, which is kind of + * execessive anyway. + */ +static int +find_next_name(char *filename, int *fd) +{ + int i; + time_t tval; + size_t len; + struct tm lt; + char yyyymmdd[MAXPATHLEN]; + char newname[MAXPATHLEN]; + struct stat sb; + int ret; + + /* Create the YYYYMMDD part of the filename */ + time(&tval); + lt = *localtime(&tval); + len = strftime(yyyymmdd, sizeof(yyyymmdd), newfile_format, <); + if (len == 0) { + syslog(LOG_WARNING, + "Filename suffix too long (%d characters maximum)", + MAXPATHLEN); + return (EACCESS); + } + + /* Make sure the new filename is not too long */ + if (strlen(filename) > MAXPATHLEN - len - 5) { + syslog(LOG_WARNING, + "Filename too long (%d characters, %d maximum)", + strlen(filename), MAXPATHLEN - len - 5); + return (EACCESS); + } + + /* Find the first file which doesn't exist */ + for (i = 0; i < 100; i++) { + sprintf(newname, "%s.%s.%02d", filename, yyyymmdd, i); + *fd = open(newname, + O_WRONLY | O_CREAT | O_EXCL, + S_IRUSR | S_IWUSR | S_IRGRP | + S_IWGRP | S_IROTH | S_IWOTH); + if (*fd > 0) + return 0; + } + + return (EEXIST); +} + +/* + * Validate file access. Since we + * have no uid or gid, for now require + * file to exist and be publicly + * readable/writable. + * If we were invoked with arguments + * from inetd then the file must also be + * in one of the given directory prefixes. + * Note also, full path name must be + * given as we have no login directory. + */ +int +validate_access(char **filep, int mode) +{ + struct stat stbuf; + int fd; + int error; + struct dirlist *dirp; + static char pathname[MAXPATHLEN]; + char *filename = *filep; + + /* + * Prevent tricksters from getting around the directory restrictions + */ + if (strstr(filename, "/../")) + return (EACCESS); + + if (*filename == '/') { + /* + * Allow the request if it's in one of the approved locations. + * Special case: check the null prefix ("/") by looking + * for length = 1 and relying on the arg. processing that + * it's a /. + */ + for (dirp = dirs; dirp->name != NULL; dirp++) { + if (dirp->len == 1 || + (!strncmp(filename, dirp->name, dirp->len) && + filename[dirp->len] == '/')) + break; + } + /* If directory list is empty, allow access to any file */ + if (dirp->name == NULL && dirp != dirs) + return (EACCESS); + if (stat(filename, &stbuf) < 0) + return (errno == ENOENT ? ENOTFOUND : EACCESS); + if ((stbuf.st_mode & S_IFMT) != S_IFREG) + return (ENOTFOUND); + if (mode == RRQ) { + if ((stbuf.st_mode & S_IROTH) == 0) + return (EACCESS); + } else { + if ((stbuf.st_mode & S_IWOTH) == 0) + return (EACCESS); + } + } else { + int err; + + /* + * Relative file name: search the approved locations for it. + * Don't allow write requests that avoid directory + * restrictions. + */ + + if (!strncmp(filename, "../", 3)) + return (EACCESS); + + /* + * If the file exists in one of the directories and isn't + * readable, continue looking. However, change the error code + * to give an indication that the file exists. + */ + err = ENOTFOUND; + for (dirp = dirs; dirp->name != NULL; dirp++) { + snprintf(pathname, sizeof(pathname), "%s/%s", + dirp->name, filename); + if (stat(pathname, &stbuf) == 0 && + (stbuf.st_mode & S_IFMT) == S_IFREG) { + if ((stbuf.st_mode & S_IROTH) != 0) { + break; + } + err = EACCESS; + } + } + if (dirp->name != NULL) + *filep = filename = pathname; + else if (mode == RRQ) + return (err); + } + if (options[OPT_TSIZE].o_request) { + if (mode == RRQ) + options[OPT_TSIZE].o_reply = stbuf.st_size; + else + /* XXX Allows writes of all sizes. */ + options[OPT_TSIZE].o_reply = + atoi(options[OPT_TSIZE].o_request); + } + if (mode == RRQ) + fd = open(filename, O_RDONLY); + else { + if (create_new) { + if (increase_name) { + error = find_next_name(filename, &fd); + if (error > 0) + return (error + 100); + } else + fd = open(filename, + O_WRONLY | O_TRUNC | O_CREAT, + S_IRUSR | S_IWUSR | S_IRGRP | + S_IWGRP | S_IROTH | S_IWOTH ); + } else + fd = open(filename, O_WRONLY | O_TRUNC); + } + if (fd < 0) + return (errno + 100); + file = fdopen(fd, (mode == RRQ)? "r":"w"); + if (file == NULL) { + close(fd); + return (errno + 100); + } + return (0); +} + +int timeouts; +jmp_buf timeoutbuf; + +void +timer(int sig __unused) +{ + if (++timeouts > MAX_TIMEOUTS) + exit(1); + longjmp(timeoutbuf, 1); +} + +/* + * Send the requested file. + */ +void +xmitfile(struct formats *pf) +{ + struct tftphdr *dp; + struct tftphdr *ap; /* ack packet */ + int size, n; + volatile unsigned short block; + + signal(SIGALRM, timer); + dp = r_init(); + ap = (struct tftphdr *)ackbuf; + block = 1; + do { + size = readit(file, &dp, pf->f_convert); + if (size < 0) { + nak(errno + 100); + goto abort; + } + dp->th_opcode = htons((u_short)DATA); + dp->th_block = htons((u_short)block); + timeouts = 0; + (void)setjmp(timeoutbuf); + +send_data: + { + int i, t = 1; + for (i = 0; ; i++){ + if (send(peer, dp, size + 4, 0) != size + 4) { + sleep(t); + t = (t < 32) ? t<< 1 : t; + if (i >= 12) { + syslog(LOG_ERR, "write: %m"); + goto abort; + } + } + break; + } + } + read_ahead(file, pf->f_convert); + for ( ; ; ) { + alarm(rexmtval); /* read the ack */ + n = recv(peer, ackbuf, sizeof (ackbuf), 0); + alarm(0); + if (n < 0) { + syslog(LOG_ERR, "read: %m"); + goto abort; + } + ap->th_opcode = ntohs((u_short)ap->th_opcode); + ap->th_block = ntohs((u_short)ap->th_block); + + if (ap->th_opcode == ERROR) + goto abort; + + if (ap->th_opcode == ACK) { + if (ap->th_block == block) + break; + /* Re-synchronize with the other side */ + (void) synchnet(peer); + if (ap->th_block == (block -1)) + goto send_data; + } + + } + block++; + } while (size == SEGSIZE); +abort: + (void) fclose(file); +} + +void +justquit(int sig __unused) +{ + exit(0); +} + + +/* + * Receive a file. + */ +void +recvfile(struct formats *pf) +{ + struct tftphdr *dp; + struct tftphdr *ap; /* ack buffer */ + int n, size; + volatile unsigned short block; + + signal(SIGALRM, timer); + dp = w_init(); + ap = (struct tftphdr *)ackbuf; + block = 0; + do { + timeouts = 0; + ap->th_opcode = htons((u_short)ACK); + ap->th_block = htons((u_short)block); + block++; + (void) setjmp(timeoutbuf); +send_ack: + if (send(peer, ackbuf, 4, 0) != 4) { + syslog(LOG_ERR, "write: %m"); + goto abort; + } + write_behind(file, pf->f_convert); + for ( ; ; ) { + alarm(rexmtval); + n = recv(peer, dp, PKTSIZE, 0); + alarm(0); + if (n < 0) { /* really? */ + syslog(LOG_ERR, "read: %m"); + goto abort; + } + dp->th_opcode = ntohs((u_short)dp->th_opcode); + dp->th_block = ntohs((u_short)dp->th_block); + if (dp->th_opcode == ERROR) + goto abort; + if (dp->th_opcode == DATA) { + if (dp->th_block == block) { + break; /* normal */ + } + /* Re-synchronize with the other side */ + (void) synchnet(peer); + if (dp->th_block == (block-1)) + goto send_ack; /* rexmit */ + } + } + /* size = write(file, dp->th_data, n - 4); */ + size = writeit(file, &dp, n - 4, pf->f_convert); + if (size != (n-4)) { /* ahem */ + if (size < 0) nak(errno + 100); + else nak(ENOSPACE); + goto abort; + } + } while (size == SEGSIZE); + write_behind(file, pf->f_convert); + (void) fclose(file); /* close data file */ + + ap->th_opcode = htons((u_short)ACK); /* send the "final" ack */ + ap->th_block = htons((u_short)(block)); + (void) send(peer, ackbuf, 4, 0); + + signal(SIGALRM, justquit); /* just quit on timeout */ + alarm(rexmtval); + n = recv(peer, buf, sizeof (buf), 0); /* normally times out and quits */ + alarm(0); + if (n >= 4 && /* if read some data */ + dp->th_opcode == DATA && /* and got a data block */ + block == dp->th_block) { /* then my last ack was lost */ + (void) send(peer, ackbuf, 4, 0); /* resend final ack */ + } +abort: + return; +} + +struct errmsg { + int e_code; + const char *e_msg; +} errmsgs[] = { + { EUNDEF, "Undefined error code" }, + { ENOTFOUND, "File not found" }, + { EACCESS, "Access violation" }, + { ENOSPACE, "Disk full or allocation exceeded" }, + { EBADOP, "Illegal TFTP operation" }, + { EBADID, "Unknown transfer ID" }, + { EEXISTS, "File already exists" }, + { ENOUSER, "No such user" }, + { EOPTNEG, "Option negotiation" }, + { -1, 0 } +}; + +static const char * +errtomsg(int error) +{ + static char ebuf[20]; + struct errmsg *pe; + if (error == 0) + return "success"; + for (pe = errmsgs; pe->e_code >= 0; pe++) + if (pe->e_code == error) + return pe->e_msg; + snprintf(ebuf, sizeof(buf), "error %d", error); + return ebuf; +} + +/* + * Send a nak packet (error message). + * Error code passed in is one of the + * standard TFTP codes, or a UNIX errno + * offset by 100. + */ +static void +nak(int error) +{ + struct tftphdr *tp; + int length; + struct errmsg *pe; + + tp = (struct tftphdr *)buf; + tp->th_opcode = htons((u_short)ERROR); + tp->th_code = htons((u_short)error); + for (pe = errmsgs; pe->e_code >= 0; pe++) + if (pe->e_code == error) + break; + if (pe->e_code < 0) { + pe->e_msg = strerror(error - 100); + tp->th_code = EUNDEF; /* set 'undef' errorcode */ + } + strcpy(tp->th_msg, pe->e_msg); + length = strlen(pe->e_msg); + tp->th_msg[length] = '\0'; + length += 5; + if (send(peer, buf, length, 0) != length) + syslog(LOG_ERR, "nak: %m"); +} + +/* translate IPv4 mapped IPv6 address to IPv4 address */ +static void +unmappedaddr(struct sockaddr_in6 *sin6) +{ + struct sockaddr_in *sin4; + u_int32_t addr; + int port; + + if (sin6->sin6_family != AF_INET6 || + !IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) + return; + sin4 = (struct sockaddr_in *)sin6; + addr = *(u_int32_t *)&sin6->sin6_addr.s6_addr[12]; + port = sin6->sin6_port; + memset(sin4, 0, sizeof(struct sockaddr_in)); + sin4->sin_addr.s_addr = addr; + sin4->sin_port = port; + sin4->sin_family = AF_INET; + sin4->sin_len = sizeof(struct sockaddr_in); +} + +/* + * Send an oack packet (option acknowledgement). + */ +static void +oack(void) +{ + struct tftphdr *tp, *ap; + int size, i, n; + char *bp; + + tp = (struct tftphdr *)buf; + bp = buf + 2; + size = sizeof(buf) - 2; + tp->th_opcode = htons((u_short)OACK); + for (i = 0; options[i].o_type != NULL; i++) { + if (options[i].o_request) { + n = snprintf(bp, size, "%s%c%d", options[i].o_type, + 0, options[i].o_reply); + bp += n+1; + size -= n+1; + if (size < 0) { + syslog(LOG_ERR, "oack: buffer overflow"); + exit(1); + } + } + } + size = bp - buf; + ap = (struct tftphdr *)ackbuf; + signal(SIGALRM, timer); + timeouts = 0; + + (void)setjmp(timeoutbuf); + if (send(peer, buf, size, 0) != size) { + syslog(LOG_INFO, "oack: %m"); + exit(1); + } + + for (;;) { + alarm(rexmtval); + n = recv(peer, ackbuf, sizeof (ackbuf), 0); + alarm(0); + if (n < 0) { + syslog(LOG_ERR, "recv: %m"); + exit(1); + } + ap->th_opcode = ntohs((u_short)ap->th_opcode); + ap->th_block = ntohs((u_short)ap->th_block); + if (ap->th_opcode == ERROR) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Thu Oct 16 10:58:00 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 400D31065687; Thu, 16 Oct 2008 10:58:00 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2F36A8FC1A; Thu, 16 Oct 2008 10:58:00 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9GAw0ui059957; Thu, 16 Oct 2008 10:58:00 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9GAw0ua059956; Thu, 16 Oct 2008 10:58:00 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810161058.m9GAw0ua059956@svn.freebsd.org> From: Alexander Leidinger Date: Thu, 16 Oct 2008 10:58:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183951 - user/netchild/obsolete/src/libexec/tftpd X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Oct 2008 10:58:00 -0000 Author: netchild Date: Thu Oct 16 10:57:59 2008 New Revision: 183951 URL: http://svn.freebsd.org/changeset/base/183951 Log: The correct spelling is EACCES, not EACCESS. Obsolete as it seems there's a new tftpd comming soon. Modified: user/netchild/obsolete/src/libexec/tftpd/tftpd.c Modified: user/netchild/obsolete/src/libexec/tftpd/tftpd.c ============================================================================== --- user/netchild/obsolete/src/libexec/tftpd/tftpd.c Thu Oct 16 10:56:25 2008 (r183950) +++ user/netchild/obsolete/src/libexec/tftpd/tftpd.c Thu Oct 16 10:57:59 2008 (r183951) @@ -597,7 +597,7 @@ validate_access(char **filep, int mode) * Prevent tricksters from getting around the directory restrictions */ if (strstr(filename, "/../")) - return (EACCESS); + return (EACCES); if (*filename == '/') { /* @@ -614,17 +614,17 @@ validate_access(char **filep, int mode) } /* If directory list is empty, allow access to any file */ if (dirp->name == NULL && dirp != dirs) - return (EACCESS); + return (EACCES); if (stat(filename, &stbuf) < 0) - return (errno == ENOENT ? ENOTFOUND : EACCESS); + return (errno == ENOENT ? ENOTFOUND : EACCES); if ((stbuf.st_mode & S_IFMT) != S_IFREG) return (ENOTFOUND); if (mode == RRQ) { if ((stbuf.st_mode & S_IROTH) == 0) - return (EACCESS); + return (EACCES); } else { if ((stbuf.st_mode & S_IWOTH) == 0) - return (EACCESS); + return (EACCES); } } else { int err; @@ -636,7 +636,7 @@ validate_access(char **filep, int mode) */ if (!strncmp(filename, "../", 3)) - return (EACCESS); + return (EACCES); /* * If the file exists in one of the directories and isn't @@ -652,7 +652,7 @@ validate_access(char **filep, int mode) if ((stbuf.st_mode & S_IROTH) != 0) { break; } - err = EACCESS; + err = EACCES; } } if (dirp->name != NULL) @@ -867,7 +867,7 @@ struct errmsg { } errmsgs[] = { { EUNDEF, "Undefined error code" }, { ENOTFOUND, "File not found" }, - { EACCESS, "Access violation" }, + { EACCES, "Access violation" }, { ENOSPACE, "Disk full or allocation exceeded" }, { EBADOP, "Illegal TFTP operation" }, { EBADID, "Unknown transfer ID" }, From owner-svn-src-user@FreeBSD.ORG Thu Oct 16 10:58:52 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A74A8106569C; Thu, 16 Oct 2008 10:58:52 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 96B1A8FC1C; Thu, 16 Oct 2008 10:58:52 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9GAwq4u060023; Thu, 16 Oct 2008 10:58:52 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9GAwqdf060022; Thu, 16 Oct 2008 10:58:52 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810161058.m9GAwqdf060022@svn.freebsd.org> From: Alexander Leidinger Date: Thu, 16 Oct 2008 10:58:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183952 - user/netchild/obsolete/src/usr.sbin/ntp X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Oct 2008 10:58:52 -0000 Author: netchild Date: Thu Oct 16 10:58:52 2008 New Revision: 183952 URL: http://svn.freebsd.org/changeset/base/183952 Log: I use such a device in the past, but now it's not connected to any PC anymore. Maybe useful later, but most likely not. Modified: user/netchild/obsolete/src/usr.sbin/ntp/config.h Modified: user/netchild/obsolete/src/usr.sbin/ntp/config.h ============================================================================== --- user/netchild/obsolete/src/usr.sbin/ntp/config.h Thu Oct 16 10:57:59 2008 (r183951) +++ user/netchild/obsolete/src/usr.sbin/ntp/config.h Thu Oct 16 10:58:52 2008 (r183952) @@ -105,7 +105,7 @@ #define CLOCK_PARSE 1 /* Conrad parallel port radio clock */ -/* #undef CLOCK_PCF */ +#define CLOCK_PCF /* PCL 720 clock support */ /* #undef CLOCK_PPS720 */ From owner-svn-src-user@FreeBSD.ORG Thu Oct 16 11:02:05 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E8F0106568C; Thu, 16 Oct 2008 11:02:05 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8C4E78FC1A; Thu, 16 Oct 2008 11:02:05 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9GB25uq060132; Thu, 16 Oct 2008 11:02:05 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9GB25eR060125; Thu, 16 Oct 2008 11:02:05 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810161102.m9GB25eR060125@svn.freebsd.org> From: Alexander Leidinger Date: Thu, 16 Oct 2008 11:02:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183953 - in user/netchild/obsolete/src/sbin: dump restore X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Oct 2008 11:02:05 -0000 Author: netchild Date: Thu Oct 16 11:02:05 2008 New Revision: 183953 URL: http://svn.freebsd.org/changeset/base/183953 Log: There was a timeframe when the signal handling in FreeBSD was not like it was supposed to be. Unfortunately this bug was triggered on a production machine. To get daily backups I used those changes. They are not needed in current or any supported stable version of FreeBSD, but maybe it helps someone at some place at some time out of some trouble. Modified: user/netchild/obsolete/src/sbin/dump/dumprmt.c user/netchild/obsolete/src/sbin/dump/itime.c user/netchild/obsolete/src/sbin/dump/optr.c user/netchild/obsolete/src/sbin/dump/tape.c user/netchild/obsolete/src/sbin/restore/dirs.c user/netchild/obsolete/src/sbin/restore/symtab.c user/netchild/obsolete/src/sbin/restore/tape.c Modified: user/netchild/obsolete/src/sbin/dump/dumprmt.c ============================================================================== --- user/netchild/obsolete/src/sbin/dump/dumprmt.c Thu Oct 16 10:58:52 2008 (r183952) +++ user/netchild/obsolete/src/sbin/dump/dumprmt.c Thu Oct 16 11:02:05 2008 (r183953) @@ -110,7 +110,10 @@ rmtconnaborted(int sig __unused) int i; char buf[2048]; - if ((i = read(errfd, buf, sizeof(buf) - 1)) > 0) { + do { + i = read(errfd, buf, sizeof(buf)); + } while ((i == -1) && (errno == EINTR)); + if (i - 1 > 0) { buf[i] = '\0'; msg("on %s: %s%s", rmtpeer, buf, buf[i - 1] == '\n' ? "" : "\n"); @@ -229,7 +232,9 @@ rmtread(char *buf, int count) /* rmtcall() properly sets errno for us on errors. */ return (n); for (i = 0; i < n; i += cc) { - cc = read(rmtape, buf+i, n - i); + do { + cc = read(rmtape, buf+i, n - i); + } while ((cc == -1) && (errno == EINTR)); if (cc <= 0) rmtconnaborted(0); } @@ -347,8 +352,12 @@ int rmtgetb(void) { char c; + int ret_val; - if (read(rmtape, &c, 1) != 1) + do { + ret_val = read(rmtape, &c, 1); + } while ((ret_val == -1) && (errno == EINTR)); + if (ret_val != 1) rmtconnaborted(0); return (c); } Modified: user/netchild/obsolete/src/sbin/dump/itime.c ============================================================================== --- user/netchild/obsolete/src/sbin/dump/itime.c Thu Oct 16 10:58:52 2008 (r183952) +++ user/netchild/obsolete/src/sbin/dump/itime.c Thu Oct 16 11:02:05 2008 (r183953) @@ -71,7 +71,10 @@ initdumptimes(void) { FILE *df; - if ((df = fopen(dumpdates, "r")) == NULL) { + do { + df = fopen(dumpdates, "r"); + } while ((df == NULL) && (errno == EINTR)); + if (df == NULL) { if (errno != ENOENT) { msg("WARNING: cannot read %s: %s\n", dumpdates, strerror(errno)); @@ -81,13 +84,19 @@ initdumptimes(void) * Dumpdates does not exist, make an empty one. */ msg("WARNING: no file `%s', making an empty one\n", dumpdates); - if ((df = fopen(dumpdates, "w")) == NULL) { + do { + df = fopen(dumpdates, "w"); + } while ((df == NULL) && (errno == EINTR)); + if (df == NULL) { msg("WARNING: cannot create %s: %s\n", dumpdates, strerror(errno)); return; } (void) fclose(df); - if ((df = fopen(dumpdates, "r")) == NULL) { + do { + df = fopen(dumpdates, "r"); + } while ((df == NULL) && (errno == EINTR)); + if (df == NULL) { quit("cannot read %s even after creating it: %s\n", dumpdates, strerror(errno)); /* NOTREACHED */ @@ -167,7 +176,10 @@ putdumptime(void) if(uflag == 0) return; - if ((df = fopen(dumpdates, "r+")) == NULL) + do { + df = fopen(dumpdates, "r+"); + } while ((df == NULL) && (errno == EINTR)); + if (df == NULL) quit("cannot rewrite %s: %s\n", dumpdates, strerror(errno)); fd = fileno(df); (void) flock(fd, LOCK_EX); Modified: user/netchild/obsolete/src/sbin/dump/optr.c ============================================================================== --- user/netchild/obsolete/src/sbin/dump/optr.c Thu Oct 16 10:58:52 2008 (r183952) +++ user/netchild/obsolete/src/sbin/dump/optr.c Thu Oct 16 11:02:05 2008 (r183953) @@ -80,7 +80,10 @@ query(const char *question) int back, errcount; FILE *mytty; - if ((mytty = fopen(_PATH_TTY, "r")) == NULL) + do { + mytty = fopen(_PATH_TTY, "r"); + } while ((mytty == NULL) && (errno == EINTR)); + if (mytty == NULL) quit("fopen on %s fails: %s\n", _PATH_TTY, strerror(errno)); attnmessage = question; timeout = 0; Modified: user/netchild/obsolete/src/sbin/dump/tape.c ============================================================================== --- user/netchild/obsolete/src/sbin/dump/tape.c Thu Oct 16 10:58:52 2008 (r183952) +++ user/netchild/obsolete/src/sbin/dump/tape.c Thu Oct 16 11:02:05 2008 (r183953) @@ -327,7 +327,7 @@ trewind(void) quit("or use no size estimate at all.\n"); } } - (void) close(slaves[f].fd); + while ((close(slaves[f].fd) < 0) && (errno == EINTR)) /* nop */; } while (wait((int *)NULL) >= 0) /* wait for any signals from slaves */ /* void */; @@ -356,10 +356,10 @@ trewind(void) (void)close(tapefd); return; } - (void) close(tapefd); + while ((close(tapefd) < 0) && (errno == EINTR)) /* nop */; while ((f = open(tape, 0)) < 0) sleep (10); - (void) close(f); + while ((close(f) < 0) && (errno == EINTR)) /* nop */; } void @@ -720,7 +720,8 @@ enslave(void) slaves[i].sent = 0; if (slaves[i].pid == 0) { /* Slave starts up here */ for (j = 0; j <= i; j++) - (void) close(slaves[j].fd); + while ((close(slaves[j].fd) < 0) + && (errno == EINTR)) /* nop */; signal(SIGINT, SIG_IGN); /* Master handles this */ doslave(cmd[0], i); Exit(X_FINOK); @@ -763,8 +764,11 @@ doslave(int cmd, int slave_number) /* * Need our own seek pointer. */ - (void) close(diskfd); - if ((diskfd = open(disk, O_RDONLY)) < 0) + while ((close(diskfd) < 0) && (errno == EINTR)) /* nop */; + do { + diskfd = open(disk, O_RDONLY); + } while ((diskfd < 0) && (errno == EINTR)); + if (diskfd < 0) quit("slave couldn't reopen disk: %s\n", strerror(errno)); /* @@ -874,7 +878,13 @@ atomic(ssize_t (*func)(), int fd, char * { int got, need = count; - while ((got = (*func)(fd, buf, need)) > 0 && (need -= got) > 0) - buf += got; + do { + do { + got = (*func)(fd, buf, need); + } while ((got == -1) && (errno == EINTR)); + + if ((got > 0) && ((need -= got) > 0)) + buf += got; + } while (got > 0 && need > 0); return (got < 0 ? got : count - need); } Modified: user/netchild/obsolete/src/sbin/restore/dirs.c ============================================================================== --- user/netchild/obsolete/src/sbin/restore/dirs.c Thu Oct 16 10:58:52 2008 (r183952) +++ user/netchild/obsolete/src/sbin/restore/dirs.c Thu Oct 16 11:02:05 2008 (r183953) @@ -143,11 +143,19 @@ extractdirs(int genmode) if (command != 'r' && command != 'R') { (void *) strcat(dirfile, "-XXXXXX"); fd = mkstemp(dirfile); - } else - fd = open(dirfile, O_RDWR|O_CREAT|O_EXCL, 0666); - if (fd == -1 || (df = fdopen(fd, "w")) == NULL) { + } else { + do { + fd = open(dirfile, O_RDWR|O_CREAT|O_EXCL, 0666); + } while ((fd == -1) && (errno == EINTR)); + } + if (fd != -1) { + do { + df = fdopen(fd, "w"); + } while ((df == NULL) && (errno == EINTR)); + } + if (fd == -1 || df == NULL) { if (fd != -1) - close(fd); + while ((close(fd) == -1) && (errno == EINTR)) /* nop */; warn("%s: cannot create directory database", dirfile); done(1); } @@ -156,11 +164,20 @@ extractdirs(int genmode) if (command != 'r' && command != 'R') { (void *) strcat(modefile, "-XXXXXX"); fd = mkstemp(modefile); - } else - fd = open(modefile, O_RDWR|O_CREAT|O_EXCL, 0666); - if (fd == -1 || (mf = fdopen(fd, "w")) == NULL) { + } else { + do { + fd = open(modefile, O_RDWR|O_CREAT|O_EXCL, 0666); + } while ((fd == -1) && (errno == EINTR)); + } + if (fd != -1) { + do { + mf = fdopen(fd, "w"); + } while ((mf == NULL) && (errno == EINTR)); + } + if (fd == -1 || mf == NULL) { if (fd != -1) - close(fd); + while ((close(fd) == -1) && (errno == EINTR)) + /* nop */; warn("%s: cannot create modefile", modefile); done(1); } @@ -442,7 +459,10 @@ rst_seekdir(RST_DIR *dirp, long loc, lon (void) lseek(dirp->dd_fd, base + (loc & ~(DIRBLKSIZ - 1)), SEEK_SET); dirp->dd_loc = loc & (DIRBLKSIZ - 1); if (dirp->dd_loc != 0) - dirp->dd_size = read(dirp->dd_fd, dirp->dd_buf, DIRBLKSIZ); + do { + dirp->dd_size = read(dirp->dd_fd, dirp->dd_buf, + DIRBLKSIZ); + } while ((dirp->dd_size == -1) && (errno == EINTR)); } /* @@ -455,8 +475,10 @@ rst_readdir(RST_DIR *dirp) for (;;) { if (dirp->dd_loc == 0) { - dirp->dd_size = read(dirp->dd_fd, dirp->dd_buf, - DIRBLKSIZ); + do { + dirp->dd_size = read(dirp->dd_fd, dirp->dd_buf, + DIRBLKSIZ); + } while ((dirp->dd_size == -1) && (errno == EINTR)); if (dirp->dd_size <= 0) { dprintf(stderr, "error reading directory\n"); return (NULL); @@ -513,7 +535,7 @@ rst_closedir(void *arg) RST_DIR *dirp; dirp = arg; - (void)close(dirp->dd_fd); + while ((close(dirp->dd_fd) == -1) && (errno == EINTR)) /* nop */; free(dirp); return; } @@ -537,10 +559,13 @@ opendirfile(const char *name) RST_DIR *dirp; int fd; - if ((fd = open(name, O_RDONLY)) == -1) + do { + fd = open(name, O_RDONLY); + } while ((fd == -1) && (errno == EINTR)); + if (fd == -1) return (NULL); if ((dirp = malloc(sizeof(RST_DIR))) == NULL) { - (void)close(fd); + while ((close(fd) == -1) && (errno == EINTR)) /* nop */; return (NULL); } dirp->dd_fd = fd; @@ -572,7 +597,9 @@ setdirmodes(int flags) fprintf(stderr, "directory mode, owner, and times not set\n"); return; } - mf = fopen(modefile, "r"); + do { + mf = fopen(modefile, "r"); + } while ((mf == NULL) && (errno == EINTR)); if (mf == NULL) { fprintf(stderr, "fopen: %s\n", strerror(errno)); fprintf(stderr, "cannot open mode file %s\n", modefile); @@ -676,7 +703,10 @@ genliteraldir(char *name, ino_t ino) itp = inotablookup(ino); if (itp == NULL) panic("Cannot find directory inode %d named %s\n", ino, name); - if ((ofile = open(name, O_WRONLY | O_CREAT | O_TRUNC, 0666)) < 0) { + do { + ofile = open(name, O_WRONLY | O_CREAT | O_TRUNC, 0666); + } while ((ofile == -1) && (errno == EINTR)); + if (ofile < 0) { fprintf(stderr, "%s: ", name); (void) fflush(stderr); fprintf(stderr, "cannot create file: %s\n", strerror(errno)); @@ -685,8 +715,12 @@ genliteraldir(char *name, ino_t ino) rst_seekdir(dirp, itp->t_seekpt, itp->t_seekpt); dp = dup(dirp->dd_fd); for (i = itp->t_size; i > 0; i -= BUFSIZ) { + int ret_val = 0; size = i < BUFSIZ ? i : BUFSIZ; - if (read(dp, buf, (int) size) == -1) { + do { + ret_val = read(dp, buf, (int) size); + } while ((ret_val == -1) && (errno == EINTR)); + if (ret_val == -1) { fprintf(stderr, "write error extracting inode %d, name %s\n", curfile.ino, curfile.name); @@ -701,8 +735,8 @@ genliteraldir(char *name, ino_t ino) done(1); } } - (void) close(dp); - (void) close(ofile); + while((close(dp) == -1) && (errno == EINTR)) /* nop */; + while((close(ofile) == -1) && (errno == EINTR)) /* nop */; return (GOOD); } Modified: user/netchild/obsolete/src/sbin/restore/symtab.c ============================================================================== --- user/netchild/obsolete/src/sbin/restore/symtab.c Thu Oct 16 10:58:52 2008 (r183952) +++ user/netchild/obsolete/src/sbin/restore/symtab.c Thu Oct 16 11:02:05 2008 (r183953) @@ -446,7 +446,10 @@ dumpsymtable(char *filename, long checkp vprintf(stdout, "Check pointing the restore\n"); if (Nflag) return; - if ((fd = fopen(filename, "w")) == NULL) { + do { + fd = fopen(filename, "w"); + } while ((fd == NULL) && (errno == EINTR)); + if (fd == NULL) { fprintf(stderr, "fopen: %s\n", strerror(errno)); panic("cannot create save file %s for symbol table\n", filename); @@ -529,7 +532,7 @@ initsymtable(char *filename) struct symtableheader hdr; struct stat stbuf; long i; - int fd; + int fd, ret_val; vprintf(stdout, "Initialize symbol table.\n"); if (filename == NULL) { @@ -542,7 +545,10 @@ initsymtable(char *filename) ep->e_flags |= NEW; return; } - if ((fd = open(filename, O_RDONLY, 0)) < 0) { + do { + fd = open(filename, O_RDONLY, 0); + } while ((fd == -1) && (errno == EINTR)); + if (fd < 0) { fprintf(stderr, "open: %s\n", strerror(errno)); panic("cannot open symbol table file %s\n", filename); } @@ -554,8 +560,17 @@ initsymtable(char *filename) base = calloc(sizeof(char), (unsigned)tblsize); if (base == NULL) panic("cannot allocate space for symbol table\n"); - if (read(fd, base, (int)tblsize) < 0 || - read(fd, (char *)&hdr, sizeof(struct symtableheader)) < 0) { + do { + ret_val = read(fd, base, (int)tblsize); + } while ((ret_val == -1) && (errno == EINTR)); + if (ret_val == -1) { + fprintf(stderr, "read: %s\n", strerror(errno)); + panic("cannot read symbol table file %s\n", filename); + } + do { + ret_val = read(fd, (char *)&hdr, sizeof(struct symtableheader)); + } while ((ret_val == -1) && (errno == EINTR)); + if (ret_val == -1) { fprintf(stderr, "read: %s\n", strerror(errno)); panic("cannot read symbol table file %s\n", filename); } Modified: user/netchild/obsolete/src/sbin/restore/tape.c ============================================================================== --- user/netchild/obsolete/src/sbin/restore/tape.c Thu Oct 16 10:58:52 2008 (r183952) +++ user/netchild/obsolete/src/sbin/restore/tape.c Thu Oct 16 11:02:05 2008 (r183953) @@ -151,11 +151,15 @@ setinput(char *source, int ispipecommand * Since input is coming from a pipe we must establish * our own connection to the terminal. */ - terminal = fopen(_PATH_TTY, "r"); + do { + terminal = fopen(_PATH_TTY, "r"); + } while ((terminal == NULL) && (errno == EINTR)); if (terminal == NULL) { (void)fprintf(stderr, "cannot open %s: %s\n", _PATH_TTY, strerror(errno)); - terminal = fopen(_PATH_DEVNULL, "r"); + do { + terminal = fopen(_PATH_DEVNULL, "r"); + } while ((terminal == NULL) && (errno == EINTR)); if (terminal == NULL) { (void)fprintf(stderr, "cannot open %s: %s\n", _PATH_DEVNULL, strerror(errno)); @@ -218,8 +222,11 @@ setup(void) #endif if (pipein) mt = 0; - else - mt = open(magtape, O_RDONLY, 0); + else { + do { + mt = open(magtape, O_RDONLY, 0); + } while ((mt == -1) && (errno == EINTR)); + } if (mt < 0) { fprintf(stderr, "%s: %s\n", magtape, strerror(errno)); done(1); @@ -415,7 +422,9 @@ getpipecmdhdr: mt = rmtopen(magtape, 0); else #endif - mt = open(magtape, O_RDONLY, 0); + do { + mt = open(magtape, O_RDONLY, 0); + } while ((mt == -1) && (errno == EINTR)); if (mt == -1) { fprintf(stderr, "Cannot open %s\n", magtape); @@ -698,9 +707,11 @@ extractfile(char *name) return (GOOD); } if (uflag) - (void) unlink(name); - if ((ofile = open(name, O_WRONLY | O_CREAT | O_TRUNC, - 0600)) < 0) { + (void)unlink(name); + do { + ofile = open(name, O_WRONLY | O_CREAT | O_TRUNC, 0600); + } while ((ofile <0) && (errno == EINTR)); + if (ofile < 0) { fprintf(stderr, "%s: cannot create file: %s\n", name, strerror(errno)); skipfile(); @@ -715,7 +726,7 @@ extractfile(char *name) (void) futimes(ofile, ctimep); (void) futimes(ofile, mtimep); (void) fchflags(ofile, flags); - (void) close(ofile); + while((close(ofile) == -1) && (errno == EINTR)) /* nop */; return (GOOD); } /* NOTREACHED */ @@ -1199,7 +1210,9 @@ getmore: i = rmtread(&tapebuf[rd], cnt); else #endif - i = read(mt, &tapebuf[rd], cnt); + do { + i = read(mt, &tapebuf[rd], cnt); + } while ((i == -1) && (errno == EINTR)); /* * Check for mid-tape short read error. * If found, skip rest of buffer and start with the next. @@ -1310,7 +1323,9 @@ findtapeblksize(void) i = rmtread(tapebuf, ntrec * TP_BSIZE); else #endif - i = read(mt, tapebuf, ntrec * TP_BSIZE); + do { + i = read(mt, tapebuf, ntrec * TP_BSIZE); + } while ((i == -1) && (errno == EINTR)); if (i <= 0) { fprintf(stderr, "tape read error: %s\n", strerror(errno)); @@ -1341,7 +1356,7 @@ closemt(void) rmtclose(); else #endif - (void) close(mt); + while((close(mt) == -1) && (errno == EINTR)) /* nop */; } /* From owner-svn-src-user@FreeBSD.ORG Thu Oct 16 14:51:15 2008 Return-Path: Delivered-To: svn-src-user@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8DBDE106568B; Thu, 16 Oct 2008 14:51:15 +0000 (UTC) (envelope-from philip@paeps.cx) Received: from gateway.nixsys.be (ns1.nixsys.be [IPv6:2001:6f8:32f::2]) by mx1.freebsd.org (Postfix) with ESMTP id 301528FC19; Thu, 16 Oct 2008 14:51:15 +0000 (UTC) (envelope-from philip@paeps.cx) Received: from detritus.paeps.cx (detritus.paeps.cx [IPv6:2001:6f8:1408::4]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "detritus.paeps.cx", Issuer "NixSys CA" (verified OK)) by gateway.nixsys.be (Postfix) with ESMTPS id B0E7C40C8; Thu, 16 Oct 2008 16:51:13 +0200 (CEST) Received: from carrot.paeps.cx (carrot [IPv6:2001:6f8:1408::2]) by detritus.paeps.cx (Postfix) with ESMTP id 1A79D2065; Thu, 16 Oct 2008 16:51:12 +0200 (CEST) Received: from carrot.paeps.cx (philip@localhost [127.0.0.1]) by carrot.paeps.cx (8.14.3/8.14.3) with ESMTP id m9GEpBFg091623; Thu, 16 Oct 2008 16:51:11 +0200 (CEST) (envelope-from philip@carrot.paeps.cx) Received: (from philip@localhost) by carrot.paeps.cx (8.14.3/8.14.3/Submit) id m9GEpBpc091622; Thu, 16 Oct 2008 16:51:11 +0200 (CEST) (envelope-from philip) Date: Thu, 16 Oct 2008 16:51:11 +0200 From: Philip Paeps To: Alexander Leidinger Message-ID: <20081016145111.GF82862@carrot.paeps.cx> Mail-Followup-To: Alexander Leidinger , src-committers@freebsd.org, svn-src-user@freebsd.org References: <200810161058.m9GAw0ua059956@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <200810161058.m9GAw0ua059956@svn.freebsd.org> X-PGP-Fingerprint: 356B AE02 4763 F739 2FA2 E438 2649 E628 C5D3 4D05 X-Date: Today is Prickle-Prickle, the 70th day of Bureaucracy in the YOLD 3174 X-Date-in-France: Quintidi 25 =?utf-8?Q?Vend=C3=A9miair?= =?utf-8?Q?e?= CCXVII, jour du boeuf X-Date-in-Rome: ante diem XVII Kalendas Novembres MMDCCLXI ab Urbe Condida X-Phase-of-Moon: The Moon is Waning Gibbous (96% of Full) X-Message-Flag: Get a proper mailclient! Organization: Happily Disorganized User-Agent: Mutt/1.5.18 (2008-05-17) Cc: src-committers@FreeBSD.org, svn-src-user@FreeBSD.org Subject: Re: svn commit: r183951 - user/netchild/obsolete/src/libexec/tftpd X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Oct 2008 14:51:15 -0000 On 2008-10-16 10:58:00 (+0000), Alexander Leidinger wrote: > Author: netchild > Date: Thu Oct 16 10:57:59 2008 > New Revision: 183951 > URL: http://svn.freebsd.org/changeset/base/183951 > > Log: > The correct spelling is EACCES, not EACCESS. > > Obsolete as it seems there's a new tftpd comming soon. Mmm - I think this is a good candidate for committing to head too? I'm not aware of anyone currently maintaining tftpd and if it's broken it should be fixed. No? - Philip -- Philip Paeps Please don't Cc me, I am philip@freebsd.org subscribed to the list. For Magrat, stepping into a man's bedroom was like an explorer stepping on to that part of the map marked Here Be Dragons. -- (Terry Pratchett, Lords and Ladies) From owner-svn-src-user@FreeBSD.ORG Thu Oct 16 15:36:24 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DA7CE10656A0; Thu, 16 Oct 2008 15:36:24 +0000 (UTC) (envelope-from netchild@freebsd.org) Received: from redbull.bpaserver.net (redbullneu.bpaserver.net [213.198.78.217]) by mx1.freebsd.org (Postfix) with ESMTP id 8A6E08FC12; Thu, 16 Oct 2008 15:36:24 +0000 (UTC) (envelope-from netchild@freebsd.org) Received: from outgoing.leidinger.net (pD9E2EF8D.dip.t-dialin.net [217.226.239.141]) by redbull.bpaserver.net (Postfix) with ESMTP id C0CC02E0AD; Thu, 16 Oct 2008 17:17:59 +0200 (CEST) Received: from webmail.leidinger.net (webmail.leidinger.net [192.168.1.102]) by outgoing.leidinger.net (Postfix) with ESMTP id 345EC27FB4; Thu, 16 Oct 2008 17:17:32 +0200 (CEST) Received: (from www@localhost) by webmail.leidinger.net (8.14.2/8.13.8/Submit) id m9GFHVqH003919; Thu, 16 Oct 2008 17:17:31 +0200 (CEST) (envelope-from netchild@FreeBSD.org) Received: from pslux.cec.eu.int (pslux.cec.eu.int [158.169.9.14]) by webmail.leidinger.net (Horde Framework) with HTTP; Thu, 16 Oct 2008 17:17:31 +0200 Message-ID: <20081016171731.382232tjyvil2mgw@webmail.leidinger.net> X-Priority: 3 (Normal) Date: Thu, 16 Oct 2008 17:17:31 +0200 From: Alexander Leidinger To: Philip Paeps , edwin@FreeBSD.org References: <200810161058.m9GAw0ua059956@svn.freebsd.org> <20081016145111.GF82862@carrot.paeps.cx> In-Reply-To: <20081016145111.GF82862@carrot.paeps.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable User-Agent: Internet Messaging Program (IMP) H3 (4.3) / FreeBSD-8.0 X-BPAnet-MailScanner-Information: Please contact the ISP for more information X-MailScanner-ID: C0CC02E0AD.B00AA X-BPAnet-MailScanner: Found to be clean X-BPAnet-MailScanner-SpamCheck: not spam, ORDB-RBL, SpamAssassin (not cached, score=-13.327, required 6, BAYES_00 -15.00, MIME_QP_LONG_LINE 1.40, RDNS_DYNAMIC 0.10, SARE_FROM_SPAM_WORD3 0.10, TW_SV 0.08) X-BPAnet-MailScanner-From: netchild@freebsd.org X-Spam-Status: No X-Mailman-Approved-At: Thu, 16 Oct 2008 16:15:47 +0000 Cc: src-committers@FreeBSD.org, svn-src-user@FreeBSD.org Subject: Re: svn commit: r183951 - user/netchild/obsolete/src/libexec/tftpd X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Oct 2008 15:36:25 -0000 Quoting Philip Paeps (from Thu, 16 Oct 2008 =20 16:51:11 +0200): > On 2008-10-16 10:58:00 (+0000), Alexander Leidinger =20 > wrote: >> Author: netchild >> Date: Thu Oct 16 10:57:59 2008 >> New Revision: 183951 >> URL: http://svn.freebsd.org/changeset/base/183951 >> >> Log: >> The correct spelling is EACCES, not EACCESS. >> >> Obsolete as it seems there's a new tftpd comming soon. > > Mmm - I think this is a good candidate for committing to head too? I'm no= t > aware of anyone currently maintaining tftpd and if it's broken it should b= e > fixed. No? I'm open for a MTC (merge to current). Yell loud enough and I do it. Have a look in the user repository, there's a new tftpd with more =20 features and less bugs available =20 (http://svn.freebsd.org/viewvc/base/user/edwin/tftpd/). To me it looks =20 like it is under testing. I may be wrong, but if Edwin is running =20 around in Strasbourg, you may have a direct talk with him. Bye, Alexander (not far from Strasbourg, but waiting for the birth of the first =20 child, which is scheduled for "this week"-ish). --=20 http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID =3D B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID =3D 72077137 You know you've been spending too much time on the computer when your friend misdates a check, and you suggest adding a "++" to fix it. From owner-svn-src-user@FreeBSD.ORG Fri Oct 17 03:17:11 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1283A106569B; Fri, 17 Oct 2008 03:17:11 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DCECC8FC0C; Fri, 17 Oct 2008 03:17:10 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9H3HAu4077126; Fri, 17 Oct 2008 03:17:10 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9H3HAXu077125; Fri, 17 Oct 2008 03:17:10 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810170317.m9H3HAXu077125@svn.freebsd.org> From: Edwin Groothuis Date: Fri, 17 Oct 2008 03:17:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183964 - user/edwin/releasenotes X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Oct 2008 03:17:11 -0000 Author: edwin Date: Fri Oct 17 03:17:10 2008 New Revision: 183964 URL: http://svn.freebsd.org/changeset/base/183964 Log: Add empty directory for a collection of release notes. Added: user/edwin/releasenotes/ From owner-svn-src-user@FreeBSD.ORG Fri Oct 17 03:59:26 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41E851065686; Fri, 17 Oct 2008 03:59:26 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3028E8FC0A; Fri, 17 Oct 2008 03:59:26 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9H3xQOu077924; Fri, 17 Oct 2008 03:59:26 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9H3xPks077916; Fri, 17 Oct 2008 03:59:25 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200810170359.m9H3xPks077916@svn.freebsd.org> From: Kip Macy Date: Fri, 17 Oct 2008 03:59:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183965 - in user/kmacy/HEAD_ECMP/sys: conf i386/conf net netinet X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Oct 2008 03:59:26 -0000 Author: kmacy Date: Fri Oct 17 03:59:25 2008 New Revision: 183965 URL: http://svn.freebsd.org/changeset/base/183965 Log: Add experimental flow tracking support to provide stateful ECMP Added: user/kmacy/HEAD_ECMP/sys/i386/conf/ECMP_TEST user/kmacy/HEAD_ECMP/sys/net/flowtable.c (contents, props changed) Modified: user/kmacy/HEAD_ECMP/sys/conf/files user/kmacy/HEAD_ECMP/sys/net/radix_mpath.c user/kmacy/HEAD_ECMP/sys/net/radix_mpath.h user/kmacy/HEAD_ECMP/sys/net/route.c user/kmacy/HEAD_ECMP/sys/net/route.h user/kmacy/HEAD_ECMP/sys/netinet/ip_input.c Modified: user/kmacy/HEAD_ECMP/sys/conf/files ============================================================================== --- user/kmacy/HEAD_ECMP/sys/conf/files Fri Oct 17 03:17:10 2008 (r183964) +++ user/kmacy/HEAD_ECMP/sys/conf/files Fri Oct 17 03:59:25 2008 (r183965) @@ -1824,6 +1824,7 @@ net/if_stf.c optional stf net/if_tun.c optional tun net/if_tap.c optional tap net/if_vlan.c optional vlan +net/flowtable.c optional inet net/mppcc.c optional netgraph_mppc_compression net/mppcd.c optional netgraph_mppc_compression net/netisr.c standard Added: user/kmacy/HEAD_ECMP/sys/i386/conf/ECMP_TEST ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/kmacy/HEAD_ECMP/sys/i386/conf/ECMP_TEST Fri Oct 17 03:59:25 2008 (r183965) @@ -0,0 +1,241 @@ +# +# GENERIC -- Generic kernel configuration file for FreeBSD/i386 +# +# For more information on this file, please read the handbook section on +# Kernel Configuration Files: +# +# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# +# $FreeBSD: user/kmacy/HEAD_ECMP/sys/i386/conf/GENERIC 183735 2008-10-09 21:25:01Z n_hibma $ + +cpu I486_CPU +cpu I586_CPU +cpu I686_CPU +ident GENERIC + +# To statically compile in device wiring instead of /boot/device.hints +#hints "GENERIC.hints" # Default places to look for devices. + +makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols + +options SCHED_ULE # ULE scheduler +options PREEMPTION # Enable kernel thread preemption +options INET # InterNETworking +options INET6 # IPv6 communications protocols +options SCTP # Stream Control Transmission Protocol +options FFS # Berkeley Fast Filesystem +options SOFTUPDATES # Enable FFS soft updates support +options UFS_ACL # Support for access control lists +options UFS_DIRHASH # Improve performance on big directories +options UFS_GJOURNAL # Enable gjournal-based UFS journaling +options MD_ROOT # MD is a potential root device +options NFSCLIENT # Network Filesystem Client +options NFSSERVER # Network Filesystem Server +options NFSLOCKD # Network Lock Manager +options NFS_ROOT # NFS usable as /, requires NFSCLIENT +options MSDOSFS # MSDOS Filesystem +options CD9660 # ISO 9660 Filesystem +options PROCFS # Process filesystem (requires PSEUDOFS) +options PSEUDOFS # Pseudo-filesystem framework +options GEOM_PART_GPT # GUID Partition Tables. +options GEOM_LABEL # Provides labelization +options COMPAT_43TTY # BSD 4.3 TTY compat [KEEP THIS!] +options COMPAT_FREEBSD4 # Compatible with FreeBSD4 +options COMPAT_FREEBSD5 # Compatible with FreeBSD5 +options COMPAT_FREEBSD6 # Compatible with FreeBSD6 +options COMPAT_FREEBSD7 # Compatible with FreeBSD7 +options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI +options KTRACE # ktrace(1) support +options STACK # stack(9) support +options SYSVSHM # SYSV-style shared memory +options SYSVMSG # SYSV-style message queues +options SYSVSEM # SYSV-style semaphores +options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions +options KBD_INSTALL_CDEV # install a CDEV entry in /dev +options STOP_NMI # Stop CPUS using NMI instead of IPI +options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) +options AUDIT # Security event auditing + +# Debugging for use in -current +options KDB # Enable kernel debugger support. +options DDB # Support DDB. +options GDB # Support remote GDB. +options INVARIANTS # Enable calls of extra sanity checking +options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS +options WITNESS # Enable checks to detect deadlocks and cycles +options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed + +# To make an SMP kernel, the next two lines are needed +options SMP # Symmetric MultiProcessor Kernel +device apic # I/O APIC + +# CPU frequency control +device cpufreq + +# Bus support. +device acpi +device eisa +device pci + +# Floppy drives +device fdc + +# ATA and ATAPI devices +device ata +device atadisk # ATA disk drives +device ataraid # ATA RAID drives +device atapicd # ATAPI CDROM drives +device atapifd # ATAPI floppy drives +device atapist # ATAPI tape drives +options ATA_STATIC_ID # Static device numbering + +# SCSI Controllers +device ahb # EISA AHA1742 family +device ahc # AHA2940 and onboard AIC7xxx devices +options AHC_REG_PRETTY_PRINT # Print register bitfields in debug + # output. Adds ~128k to driver. +device ahd # AHA39320/29320 and onboard AIC79xx devices +options AHD_REG_PRETTY_PRINT # Print register bitfields in debug + # output. Adds ~215k to driver. +device amd # AMD 53C974 (Tekram DC-390(T)) +device hptiop # Highpoint RocketRaid 3xxx series +device isp # Qlogic family +#device ispfw # Firmware for QLogic HBAs- normally a module +device mpt # LSI-Logic MPT-Fusion +#device ncr # NCR/Symbios Logic +device sym # NCR/Symbios Logic (newer chipsets + those of `ncr') + +# SCSI peripherals +device scbus # SCSI bus (required for SCSI) +device ch # SCSI media changers +device da # Direct Access (disks) +device sa # Sequential Access (tape etc) +device cd # CD +device pass # Passthrough device (direct SCSI access) +device ses # SCSI Environmental Services (and SAF-TE) + +# atkbdc0 controls both the keyboard and the PS/2 mouse +device atkbdc # AT keyboard controller +device atkbd # AT keyboard +device psm # PS/2 mouse + +device kbdmux # keyboard multiplexer + +device vga # VGA video card driver + +device splash # Splash screen and screen saver support + +# syscons is the default console driver, resembling an SCO console +device sc + +device agp # support several AGP chipsets + +# Power management support (see NOTES for more options) +#device apm +# Add suspend/resume support for the i8254. +device pmtimer + +# PCCARD (PCMCIA) support +# PCMCIA and cardbus bridge support +device cbb # cardbus (yenta) bridge +device pccard # PC Card (16-bit) bus +device cardbus # CardBus (32-bit) bus + +# Serial (COM) ports +device uart # Generic UART driver + +# If you've got a "dumb" serial or parallel PCI card that is +# supported by the puc(4) glue driver, uncomment the following +# line to enable it (connects to sio, uart and/or ppc drivers): +#device puc + +# PCI Ethernet NICs. +device em # Intel PRO/1000 Gigabit Ethernet Family +device igb # Intel PRO/1000 PCIE Server Gigabit Family +device ixgb # Intel PRO/10GbE Ethernet Card +device le # AMD Am7900 LANCE and Am79C9xx PCnet + + +# PCI Ethernet NICs that use the common MII bus controller code. +# NOTE: Be sure to keep the 'device miibus' line in order to use these NICs! +device miibus # MII bus support +device ae # Attansic/Atheros L2 FastEthernet +device age # Attansic/Atheros L1 Gigabit Ethernet +device bce # Broadcom BCM5706/BCM5708 Gigabit Ethernet +device bfe # Broadcom BCM440x 10/100 Ethernet +device bge # Broadcom BCM570xx Gigabit Ethernet +device et # Agere ET1310 10/100/Gigabit Ethernet +device fxp # Intel EtherExpress PRO/100B (82557, 82558) +device jme # JMicron JMC250 Gigabit/JMC260 Fast Ethernet +device lge # Level 1 LXT1001 gigabit Ethernet +device msk # Marvell/SysKonnect Yukon II Gigabit Ethernet + +# Pseudo devices. +device loop # Network loopback +device random # Entropy device +device ether # Ethernet support +device tun # Packet tunnel. +device pty # BSD-style compatibility pseudo ttys +device md # Memory "disks" +device gif # IPv6 and IPv4 tunneling +device faith # IPv6-to-IPv4 relaying (translation) +device firmware # firmware assist module + +# The `bpf' device enables the Berkeley Packet Filter. +# Be aware of the administrative consequences of enabling this! +# Note that 'bpf' is required for DHCP. +device bpf # Berkeley packet filter + +# USB support +device uhci # UHCI PCI->USB interface +device ohci # OHCI PCI->USB interface +device ehci # EHCI PCI->USB interface (USB 2.0) +device usb # USB Bus (required) +#device udbp # USB Double Bulk Pipe devices +device ugen # Generic +device uhid # "Human Interface Devices" +device ukbd # Keyboard +device ulpt # Printer +device umass # Disks/Mass storage - Requires scbus and da +device ums # Mouse +device urio # Diamond Rio 500 MP3 player +device uscanner # Scanners +# USB Serial devices +device ucom # Generic com ttys +device u3g # USB-based 3G modems (Option, Huawei, Sierra) +device uark # Technologies ARK3116 based serial adapters +device ubsa # Belkin F5U103 and compatible serial adapters +device uftdi # For FTDI usb serial adapters +device uipaq # Some WinCE based devices +device uplcom # Prolific PL-2303 serial adapters +device uslcom # SI Labs CP2101/CP2102 serial adapters +device uvisor # Visor and Palm devices +device uvscom # USB serial support for DDI pocket's PHS +# USB Ethernet, requires miibus +device aue # ADMtek USB Ethernet +device axe # ASIX Electronics USB Ethernet +device cdce # Generic USB over Ethernet +device cue # CATC USB Ethernet +device kue # Kawasaki LSI USB Ethernet +device rue # RealTek RTL8150 USB Ethernet +device udav # Davicom DM9601E USB + +# FireWire support +device firewire # FireWire bus code +device sbp # SCSI over FireWire (Requires scbus and da) +device fwe # Ethernet over FireWire (non-standard!) +device fwip # IP over FireWire (RFC 2734,3146) +device dcons # Dumb console driver +device dcons_crom # Configuration ROM for dcons + +options RADIX_MPATH Added: user/kmacy/HEAD_ECMP/sys/net/flowtable.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/kmacy/HEAD_ECMP/sys/net/flowtable.c Fri Oct 17 03:59:25 2008 (r183965) @@ -0,0 +1,604 @@ +#include "opt_mpath.h" + +#include +#include +#include +#include +#include +#include + + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#define calloc(count, size) malloc((count)*(size), M_DEVBUF, M_WAITOK|M_ZERO) + + +/* + * Taken from http://burtleburtle.net/bob/c/lookup3.c + */ + +#define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k)))) + +/* +------------------------------------------------------------------------------- +mix -- mix 3 32-bit values reversibly. + +This is reversible, so any information in (a,b,c) before mix() is +still in (a,b,c) after mix(). + +If four pairs of (a,b,c) inputs are run through mix(), or through +mix() in reverse, there are at least 32 bits of the output that +are sometimes the same for one pair and different for another pair. +This was tested for: +* pairs that differed by one bit, by two bits, in any combination + of top bits of (a,b,c), or in any combination of bottom bits of + (a,b,c). +* "differ" is defined as +, -, ^, or ~^. For + and -, I transformed + the output delta to a Gray code (a^(a>>1)) so a string of 1's (as + is commonly produced by subtraction) look like a single 1-bit + difference. +* the base values were pseudorandom, all zero but one bit set, or + all zero plus a counter that starts at zero. + +Some k values for my "a-=c; a^=rot(c,k); c+=b;" arrangement that +satisfy this are + 4 6 8 16 19 4 + 9 15 3 18 27 15 + 14 9 3 7 17 3 +Well, "9 15 3 18 27 15" didn't quite get 32 bits diffing +for "differ" defined as + with a one-bit base and a two-bit delta. I +used http://burtleburtle.net/bob/hash/avalanche.html to choose +the operations, constants, and arrangements of the variables. + +This does not achieve avalanche. There are input bits of (a,b,c) +that fail to affect some output bits of (a,b,c), especially of a. The +most thoroughly mixed value is c, but it doesn't really even achieve +avalanche in c. + +This allows some parallelism. Read-after-writes are good at doubling +the number of bits affected, so the goal of mixing pulls in the opposite +direction as the goal of parallelism. I did what I could. Rotates +seem to cost as much as shifts on every machine I could lay my hands +on, and rotates are much kinder to the top and bottom bits, so I used +rotates. +------------------------------------------------------------------------------- +*/ +#define mix(a,b,c) \ +{ \ + a -= c; a ^= rot(c, 4); c += b; \ + b -= a; b ^= rot(a, 6); a += c; \ + c -= b; c ^= rot(b, 8); b += a; \ + a -= c; a ^= rot(c,16); c += b; \ + b -= a; b ^= rot(a,19); a += c; \ + c -= b; c ^= rot(b, 4); b += a; \ +} + +/* +------------------------------------------------------------------------------- +final -- final mixing of 3 32-bit values (a,b,c) into c + +Pairs of (a,b,c) values differing in only a few bits will usually +produce values of c that look totally different. This was tested for +* pairs that differed by one bit, by two bits, in any combination + of top bits of (a,b,c), or in any combination of bottom bits of + (a,b,c). +* "differ" is defined as +, -, ^, or ~^. For + and -, I transformed + the output delta to a Gray code (a^(a>>1)) so a string of 1's (as + is commonly produced by subtraction) look like a single 1-bit + difference. +* the base values were pseudorandom, all zero but one bit set, or + all zero plus a counter that starts at zero. + +These constants passed: + 14 11 25 16 4 14 24 + 12 14 25 16 4 14 24 +and these came close: + 4 8 15 26 3 22 24 + 10 8 15 26 3 22 24 + 11 8 15 26 3 22 24 +------------------------------------------------------------------------------- +*/ +#define final(a,b,c) \ +{ \ + c ^= b; c -= rot(b,14); \ + a ^= c; a -= rot(c,11); \ + b ^= a; b -= rot(a,25); \ + c ^= b; c -= rot(b,16); \ + a ^= c; a -= rot(c,4); \ + b ^= a; b -= rot(a,14); \ + c ^= b; c -= rot(b,24); \ +} + +/* +-------------------------------------------------------------------- + This works on all machines. To be useful, it requires + -- that the key be an array of uint32_t's, and + -- that the length be the number of uint32_t's in the key + + The function hashword() is identical to hashlittle() on little-endian + machines, and identical to hashbig() on big-endian machines, + except that the length has to be measured in uint32_ts rather than in + bytes. hashlittle() is more complicated than hashword() only because + hashlittle() has to dance around fitting the key bytes into registers. +-------------------------------------------------------------------- +*/ +static uint32_t hashword( +const uint32_t *k, /* the key, an array of uint32_t values */ +size_t length, /* the length of the key, in uint32_ts */ +uint32_t initval) /* the previous hash, or an arbitrary value */ +{ + uint32_t a,b,c; + + /* Set up the internal state */ + a = b = c = 0xdeadbeef + (((uint32_t)length)<<2) + initval; + + /*------------------------------------------------- handle most of the key */ + while (length > 3) + { + a += k[0]; + b += k[1]; + c += k[2]; + mix(a,b,c); + length -= 3; + k += 3; + } + + /*------------------------------------------- handle the last 3 uint32_t's */ + switch(length) /* all the case statements fall through */ + { + case 3 : c+=k[2]; + case 2 : b+=k[1]; + case 1 : a+=k[0]; + final(a,b,c); + case 0: /* case 0: nothing left to add */ + break; + } + /*------------------------------------------------------ report the result */ + return c; +} + + +struct ip_tuple { + in_addr_t ip_saddr; /* source address */ + in_addr_t ip_daddr; /* destination address */ + uint16_t ip_sport; /* source port */ + uint16_t ip_dport; /* destination port */ +}; + +union ip_flow { + struct ip_tuple ipf_ipt; + uint32_t ipf_key[3]; +}; + +struct flentry_v4 { + uint32_t fl_fhash; /* hash flowing forward */ + uint32_t fl_ticks; /* last time this flow was accessed */ + uint16_t fl_flags; /* flow flags */ + uint8_t fl_pad; + uint8_t fl_proto; /* protocol */ + union ip_flow fl_flow; + struct rtentry *fl_rt; /* rtentry for flow */ + uint32_t fl_refcnt; + uint32_t fl_hash_next; /* needed for GC */ + uint32_t fl_hash_prev; +}; + +#define TICKS_PER_MINUTE (60*hz) +#define TICKS_PER_HOUR (60*TICKS_PER_MINUTE) +#define TICKS_PER_DAY (24*TICKS_PER_HOUR) + + +#define SYN_IDLE (5*TICKS_PER_MINUTE) +#define UDP_IDLE (5*TICKS_PER_MINUTE) +#define FIN_WAIT_IDLE (10*TICKS_PER_MINUTE) +#define TCP_IDLE TICKS_PER_DAY + + +static struct flentry_v4 *ipv4_flow_table; +static int ipv4_flow_table_size; +static bitstr_t *ipv4_flow_bitstring; +static int ipv4_flow_allocated; +struct mtx *ipv4_flow_locks; +static int ipv4_flow_lock_count; +extern uint32_t hashjitter; +static uint32_t ipv4_flow_route_lookup_fail; +static uint32_t ipv4_flow_collisions; +struct callout ipv4_flow_callout; +static int ipv4_flow_max_count; + + +#define FL_ENTRY_INDEX(hash)((hash) % ipv4_flow_table_size) +#define FL_ENTRY(hash) (&ipv4_flow_table[FL_ENTRY_INDEX((hash))]) +#define FL_ENTRY_LOCK(hash) mtx_lock(&ipv4_flow_locks[(hash)&(ipv4_flow_lock_count - 1)]) +#define FL_ENTRY_UNLOCK(hash) mtx_lock(&ipv4_flow_locks[(hash)&(ipv4_flow_lock_count - 1)]) + +#define FL_STALE (1<<8) + +static uint32_t +ipv4_flow_lookup_hash_internal(struct mbuf *m, struct route *ro, + uint32_t *key, uint16_t *flags, uint8_t *protop) +{ + uint16_t sport = 0, dport = 0; + struct ip *ip = mtod(m, struct ip *); + uint8_t proto = ip->ip_p; + int iphlen = ip->ip_hl << 2; + struct sockaddr_in *sin; + struct tcphdr *th; + struct udphdr *uh; + struct sctphdr *sh; + + key[0] = ip->ip_src.s_addr; + key[1] = ip->ip_dst.s_addr; + + sin = (struct sockaddr_in *)&ro->ro_dst; + sin->sin_family = AF_INET; + sin->sin_len = sizeof(*sin); + sin->sin_addr = ip->ip_dst; + + switch (proto) { + case IPPROTO_TCP: + th = (struct tcphdr *)((caddr_t)ip + iphlen); + sport = th->th_sport; + dport = th->th_dport; + *flags = th->th_flags; + if (*flags & TH_RST) + *flags |= FL_STALE; + break; + case IPPROTO_UDP: + uh = (struct udphdr *)((caddr_t)ip + iphlen); + sport = uh->uh_sport; + dport = uh->uh_dport; + break; + case IPPROTO_SCTP: + sh = (struct sctphdr *)((caddr_t)ip + iphlen); + sport = sh->src_port; + dport = sh->dest_port; + break; + default: + /* no port - hence not a protocol we care about */ + break;; + + } + ((uint16_t *)key)[4] = sport; + ((uint16_t *)key)[5] = dport; + + *protop = proto; + return (hashword(key, 3, hashjitter + proto)); +} + +uint32_t +ipv4_flow_lookup_hash(struct mbuf *m) +{ + struct route ro; + uint32_t key[3]; + uint16_t flags; + uint8_t proto; + + bzero(&ro, sizeof(ro)); + return (ipv4_flow_lookup_hash_internal(m, &ro, key, &flags, &proto)); +} + +static void +ipv4_flow_insert(uint32_t hash, uint32_t *key, uint8_t proto, + struct rtentry *rt, uint16_t flags) +{ + struct flentry_v4 *fle, *fle2; + uint32_t *hashkey; + + fle = FL_ENTRY(hash); + hashkey = fle->fl_flow.ipf_key; + + hashkey[0] = key[0]; + hashkey[1] = key[1]; + hashkey[2] = key[2]; + + bit_set(ipv4_flow_bitstring, FL_ENTRY_INDEX(hash)); + if (rt->rt_flow_head == 0) { + rt->rt_flow_head = hash; + fle->fl_hash_next = fle->fl_hash_prev = 0; + } else { + fle->fl_hash_next = rt->rt_flow_head; + fle2 = FL_ENTRY(rt->rt_flow_head); + rt->rt_flow_head = hash; + fle2->fl_hash_prev = hash; + } + fle->fl_proto = proto; + fle->fl_rt = rt; + fle->fl_fhash = hash; + fle->fl_ticks = ticks; + rt->rt_refcnt++; + ipv4_flow_allocated++; +} + +uint32_t +ipv4_flow_alloc(struct mbuf *m, struct route *ro) +{ + uint32_t key[3], hash, *hashkey; + struct flentry_v4 *fle; + uint16_t flags = 0; + uint8_t proto; + + /* + * Only handle IPv4 for now + * + */ + hash = ipv4_flow_lookup_hash_internal(m, ro, key, &flags, &proto); + + /* + * Ports are zero - thus not a protocol for which + * we need to keep state + */ + if (key[3] == 0) + return (hash); + + FL_ENTRY_LOCK(hash); + fle = FL_ENTRY(hash); + + hashkey = fle->fl_flow.ipf_key; + + if (fle->fl_fhash == 0) { + FL_ENTRY_UNLOCK(hash); + rtalloc_mpath_fib(ro, hash, M_GETFIB(m)); + if (ro->ro_rt) { + FL_ENTRY_LOCK(hash); + ipv4_flow_insert(hash, key, proto, ro->ro_rt, flags); + RT_UNLOCK(ro->ro_rt); + } else + ipv4_flow_route_lookup_fail++; + } else if (fle->fl_fhash == hash + && key[0] == hashkey[0] + && key[1] == hashkey[1] + && key[2] == hashkey[2] + && proto == fle->fl_proto) { + fle->fl_ticks = ticks; + fle->fl_flags |= flags; + fle->fl_refcnt++; + ro->ro_rt = fle->fl_rt; + } else + ipv4_flow_collisions++; + + FL_ENTRY_UNLOCK(hash); + + return (hash); +} + +/* + * Internal helper routine + * hash - the hash of the entry to free + * stale - indicates to only free the entry if it is marked stale + */ + +static uint32_t +ipv4_flow_free_internal(uint32_t hash, int staleonly) +{ + struct flentry_v4 *fle, *fleprev, *flenext; + uint32_t hash_next; + + fle = FL_ENTRY(hash); + hash_next = fle->fl_hash_next; + + if (staleonly && ((fle->fl_flags & FL_STALE) == 0)) + return (hash_next); + + if (fle->fl_hash_next) { + flenext = FL_ENTRY(fle->fl_hash_next); + flenext->fl_hash_prev = fle->fl_hash_prev; + } + if (fle->fl_hash_prev) { + fleprev = FL_ENTRY(fle->fl_hash_prev); + fleprev->fl_hash_next = fle->fl_hash_next; + } + fle->fl_hash_next = fle->fl_hash_prev = 0; + + if (fle->fl_refcnt == 0) { + fle->fl_rt->rt_refcnt--; + ipv4_flow_allocated--; + bit_clear(ipv4_flow_bitstring, FL_ENTRY_INDEX(hash)); + bzero(fle, sizeof(struct flentry_v4)); + } else if (!staleonly) + fle->fl_flags |= FL_STALE; + + return (hash_next); +} + +/* + * drops the refcount on the flow after alloc was called and + * checks if the flow has become stale since alloc was called + * + */ +void +ipv4_flow_free(uint32_t hash) +{ + struct flentry_v4 *fle; + struct rtentry *rt; + int stale; + + fle = FL_ENTRY(hash); + KASSERT(fle->fl_refcnt > 0, + ("route referenced with flow refcount set to zero")); + + stale = ((fle->fl_flags & FL_STALE) && + (fle->fl_refcnt == 1)); + + rt = fle->fl_rt; + if (stale) + RT_LOCK(rt); + + FL_ENTRY_LOCK(hash); + fle->fl_refcnt--; + + if (stale) { + ipv4_flow_free_internal(hash, 0); + RTFREE_LOCKED(rt); + } + FL_ENTRY_UNLOCK(hash); +} + +/* + * + * Frees all flows that are linked to this rtentry + * + */ +void +ipv4_flow_free_all(struct rtentry *rt) +{ + uint32_t hash_next = rt->rt_flow_head; + + RT_LOCK_ASSERT(rt); + while (hash_next) + hash_next = ipv4_flow_free_internal(hash_next, 0); +} + +/* + * Frees all flows tied to this rt that + * have been marked stale + * + */ +static int +ipv4_flow_free_stale(struct radix_node *rn, void *unused) +{ + struct rtentry *rt = (struct rtentry *)rn; + uint32_t hash_next; + + if (rt->rt_flow_head == 0) + return (0); + + RT_LOCK(rt); + hash_next = rt->rt_flow_head; + while (hash_next) + hash_next = ipv4_flow_free_internal(hash_next, 1); + RT_UNLOCK(rt); + + return (0); +} + +struct radix_node_head *ipv4_flow_rnh_list[100]; +static void +ipv4_flow_check_stale(struct flentry_v4 *fle, + struct radix_node_head **rnh_list, int *rnh_count) +{ + int count = *rnh_count; + uint32_t idle_ticks; + struct radix_node_head *rnh; + struct rtentry *rt; + int i, stale = 0, found = 0; + + if (ticks > fle->fl_ticks) + idle_ticks = ticks - fle->fl_ticks; + else + idle_ticks = (INT_MAX - fle->fl_ticks) + ticks ; + + if ((fle->fl_flags & FL_STALE) || + ((fle->fl_flags & (TH_SYN|TH_ACK|TH_FIN)) == 0 + && (idle_ticks > UDP_IDLE)) || + ((fle->fl_flags & TH_FIN) + && (idle_ticks > FIN_WAIT_IDLE)) || + ((fle->fl_flags & (TH_SYN|TH_ACK)) == TH_SYN + && (idle_ticks > SYN_IDLE)) || + ((fle->fl_flags & (TH_SYN|TH_ACK)) == (TH_SYN|TH_ACK) + && (idle_ticks > TCP_IDLE))) + stale = 1; + + if (stale == 0) + return; + + fle->fl_flags |= FL_STALE; + rt = fle->fl_rt; + rnh = V_rt_tables[rt->rt_fibnum][rt_key(rt)->sa_family]; + + for (i = 0; i < count; i++) + if (rnh_list[i] == rnh) { + found = 1; + break; + } + if (found == 0) { + rnh_list[count] = rnh; + count++; + *rnh_count = count; + } +} + + +static __inline int +bit_fns(bitstr_t *name, int nbits, int lastbit) +{ + int lastbit_start = lastbit & ~0x7; + bitstr_t *bitstr_start = &name[lastbit_start]; + int value = 0; + + while (value <= lastbit && value != 1) + bit_ffs(bitstr_start, nbits, &value); + + return (value); +} + + +static int ipv4_flow_last_index; +static void +ipv4_flow_timeout(void *arg) +{ + int i, idx, rnh_count = 0; + struct radix_node_head *rnh; + + /* + * scan 1/4th of the table once a second + */ + for (i = 0; i < (ipv4_flow_allocated >> 2); i++) { + idx = bit_fns(ipv4_flow_bitstring, ipv4_flow_table_size, + ipv4_flow_last_index); + if (idx == -1) { + ipv4_flow_last_index = 0; + break; + } + + FL_ENTRY_LOCK(idx); + ipv4_flow_check_stale(FL_ENTRY(idx), ipv4_flow_rnh_list, &rnh_count); + FL_ENTRY_UNLOCK(idx); + } + for (i = 0; i < rnh_count; i++) { + rnh = ipv4_flow_rnh_list[i]; + RADIX_NODE_HEAD_LOCK(rnh); + rnh->rnh_walktree(rnh, ipv4_flow_free_stale, NULL); + RADIX_NODE_HEAD_UNLOCK(rnh); + } + + callout_reset(&ipv4_flow_callout, hz, ipv4_flow_timeout, NULL); +} + +static void +flowtable_init(void *unused) +{ + int i, nentry; + + nentry = ipv4_flow_max_count; + /* + * round mp_ncpus up to the next power of 2 and double + * to determine the number of locks + */ + ipv4_flow_lock_count = (1 << fls(mp_ncpus)) << 1; + + ipv4_flow_table_size = nentry; + ipv4_flow_table = malloc(nentry*sizeof(struct flentry_v4), + M_RTABLE, M_WAITOK | M_ZERO); + ipv4_flow_bitstring = bit_alloc(nentry); + ipv4_flow_locks = malloc(ipv4_flow_lock_count*sizeof(struct mtx), + M_RTABLE, M_WAITOK | M_ZERO); + for (i = 0; i < ipv4_flow_lock_count; i++) + mtx_init(&ipv4_flow_locks[i], "ipv4_flow", NULL, MTX_DEF); + +} +SYSINIT(flowtable, SI_SUB_INIT_IF, SI_ORDER_ANY, flowtable_init, NULL); Modified: user/kmacy/HEAD_ECMP/sys/net/radix_mpath.c ============================================================================== --- user/kmacy/HEAD_ECMP/sys/net/radix_mpath.c Fri Oct 17 03:17:10 2008 (r183964) +++ user/kmacy/HEAD_ECMP/sys/net/radix_mpath.c Fri Oct 17 03:59:25 2008 (r183965) @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); /* * give some jitter to hash, to avoid synchronization between routers */ -static u_int32_t hashjitter; +uint32_t hashjitter; int rn_mpath_capable(struct radix_node_head *rnh) @@ -298,7 +298,7 @@ rtalloc_mpath_fib(struct route *ro, u_in return; } - rtfree(ro->ro_rt); + RTFREE(ro->ro_rt); ro->ro_rt = (struct rtentry *)rn; RT_LOCK(ro->ro_rt); RT_ADDREF(ro->ro_rt); Modified: user/kmacy/HEAD_ECMP/sys/net/radix_mpath.h ============================================================================== --- user/kmacy/HEAD_ECMP/sys/net/radix_mpath.h Fri Oct 17 03:17:10 2008 (r183964) +++ user/kmacy/HEAD_ECMP/sys/net/radix_mpath.h Fri Oct 17 03:59:25 2008 (r183965) @@ -58,6 +58,11 @@ int rt_mpath_deldup(struct rtentry *, st int rn4_mpath_inithead(void **, int); int rn6_mpath_inithead(void **, int); +uint32_t ipv4_flow_alloc(struct mbuf *m, struct route *ro); +void ipv4_flow_free(uint32_t hash); + +uint32_t ipv4_flow_lookup_hash(struct mbuf *m); +void ipv4_flow_free_all(struct rtentry *rt); #endif #endif /* _NET_RADIX_MPATH_H_ */ Modified: user/kmacy/HEAD_ECMP/sys/net/route.c ============================================================================== --- user/kmacy/HEAD_ECMP/sys/net/route.c Fri Oct 17 03:17:10 2008 (r183964) +++ user/kmacy/HEAD_ECMP/sys/net/route.c Fri Oct 17 03:59:25 2008 (r183965) @@ -808,8 +808,10 @@ rtexpunge(struct rtentry *rt) ("unexpected flags 0x%x", rn->rn_flags)); KASSERT(rt == RNTORT(rn), ("lookup mismatch, rt %p rn %p", rt, rn)); - rt->rt_flags &= ~RTF_UP; +#ifdef RADIX_MPATH + ipv4_flow_free_all(rt); +#endif /* * Now search what's left of the subtree for any cloned @@ -948,6 +950,9 @@ rtrequest1_fib(int req, struct rt_addrin RT_LOCK(rt); RT_ADDREF(rt); rt->rt_flags &= ~RTF_UP; +#ifdef RADIX_MPATH + ipv4_flow_free_all(rt); +#endif goto deldone; /* done with the RTM_DELETE command */ } @@ -966,7 +971,9 @@ normal_rtdel: RT_LOCK(rt); RT_ADDREF(rt); rt->rt_flags &= ~RTF_UP; - +#ifdef RADIX_MPATH + ipv4_flow_free_all(rt); +#endif /* * Now search what's left of the subtree for any cloned * routes which might have been formed from this node. Modified: user/kmacy/HEAD_ECMP/sys/net/route.h ============================================================================== --- user/kmacy/HEAD_ECMP/sys/net/route.h Fri Oct 17 03:17:10 2008 (r183964) +++ user/kmacy/HEAD_ECMP/sys/net/route.h Fri Oct 17 03:59:25 2008 (r183965) @@ -148,6 +148,9 @@ struct rtentry { #ifdef _KERNEL /* XXX ugly, user apps use this definition but don't have a mtx def */ struct mtx rt_mtx; /* mutex for routing entry */ +#ifdef RADIX_MPATH + uint32_t rt_flow_head; +#endif #endif }; Modified: user/kmacy/HEAD_ECMP/sys/netinet/ip_input.c ============================================================================== --- user/kmacy/HEAD_ECMP/sys/netinet/ip_input.c Fri Oct 17 03:17:10 2008 (r183964) +++ user/kmacy/HEAD_ECMP/sys/netinet/ip_input.c Fri Oct 17 03:59:25 2008 (r183965) @@ -1286,7 +1286,7 @@ ip_forward(struct mbuf *m, int srcrt) struct mbuf *mcopy; struct in_addr dest; struct route ro; - int error, type = 0, code = 0, mtu = 0; + int error, type = 0, code = 0, mtu = 0, cached = 0; if (m->m_flags & (M_BCAST|M_MCAST) || in_canforward(ip->ip_dst) == 0) { V_ipstat.ips_cantforward++; @@ -1305,7 +1305,24 @@ ip_forward(struct mbuf *m, int srcrt) } #endif + bzero(&ro, sizeof(ro)); +#ifdef RADIX_MPATH + hash = ipv4_flow_alloc(m, &ro); + + if (ro.ro_rt == NULL) + rtalloc_mpath_fib(&ro, hash, M_GETFIB(m)); + else + cached = 1; + + if (ro->ro_rt != NULL) + ia = ifatoia(ro.ro_rt->rt_ifa); +#else + /* + * I love how we go to all the trouble to look up the + * route and then throw it away KMM + */ ia = ip_rtaddr(ip->ip_dst, M_GETFIB(m)); +#endif if (!srcrt && ia == NULL) { icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_HOST, 0, 0); return; @@ -1365,7 +1382,6 @@ ip_forward(struct mbuf *m, int srcrt) struct sockaddr_in *sin; struct rtentry *rt; - bzero(&ro, sizeof(ro)); sin = (struct sockaddr_in *)&ro.ro_dst; sin->sin_family = AF_INET; sin->sin_len = sizeof(*sin); @@ -1390,7 +1406,7 @@ ip_forward(struct mbuf *m, int srcrt) code = ICMP_REDIRECT_HOST; } } - if (rt) + if (rt && (cached == 0)) RTFREE(rt); } @@ -1398,13 +1414,15 @@ ip_forward(struct mbuf *m, int srcrt) * Try to cache the route MTU from ip_output so we can consider it for * the ICMP_UNREACH_NEEDFRAG "Next-Hop MTU" field described in RFC1191. */ - bzero(&ro, sizeof(ro)); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Fri Oct 17 07:01:28 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E0FB8106568A; Fri, 17 Oct 2008 07:01:28 +0000 (UTC) (envelope-from edwin@mavetju.org) Received: from k7.mavetju.org (ppp121-44-139-168.lns10.syd7.internode.on.net [121.44.139.168]) by mx1.freebsd.org (Postfix) with ESMTP id 9C7FC8FC16; Fri, 17 Oct 2008 07:01:27 +0000 (UTC) (envelope-from edwin@mavetju.org) Received: by k7.mavetju.org (Postfix, from userid 1001) id 2D3AE4503D; Fri, 17 Oct 2008 18:00:44 +1100 (EST) Date: Fri, 17 Oct 2008 18:00:44 +1100 From: Edwin Groothuis To: Alexander Leidinger Message-ID: <20081017070044.GC71466@mavetju.org> References: <200810161058.m9GAw0ua059956@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200810161058.m9GAw0ua059956@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r183951 - user/netchild/obsolete/src/libexec/tftpd X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Oct 2008 07:01:29 -0000 On Thu, Oct 16, 2008 at 10:58:00AM +0000, Alexander Leidinger wrote: > The correct spelling is EACCES, not EACCESS. [...] > - { EACCESS, "Access violation" }, > + { EACCES, "Access violation" }, I am not sure what you mean with this... What is exactly wrong with the last S in EACCESS ? Edwin -- Edwin Groothuis Website: http://www.mavetju.org/ edwin@mavetju.org Weblog: http://www.mavetju.org/weblog/ From owner-svn-src-user@FreeBSD.ORG Fri Oct 17 07:39:28 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A871106568D; Fri, 17 Oct 2008 07:39:28 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EE3E08FC08; Fri, 17 Oct 2008 07:39:27 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9H7dRqf081715; Fri, 17 Oct 2008 07:39:27 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9H7dR2b081714; Fri, 17 Oct 2008 07:39:27 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810170739.m9H7dR2b081714@svn.freebsd.org> From: Alexander Leidinger Date: Fri, 17 Oct 2008 07:39:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183968 - user/netchild/misc/src/sys/netsmb X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Oct 2008 07:39:28 -0000 Author: netchild Date: Fri Oct 17 07:39:27 2008 New Revision: 183968 URL: http://svn.freebsd.org/changeset/base/183968 Log: Fix typo in panic string. Noticed by: wilko Modified: user/netchild/misc/src/sys/netsmb/smb_conn.c Modified: user/netchild/misc/src/sys/netsmb/smb_conn.c ============================================================================== --- user/netchild/misc/src/sys/netsmb/smb_conn.c Fri Oct 17 07:04:29 2008 (r183967) +++ user/netchild/misc/src/sys/netsmb/smb_conn.c Fri Oct 17 07:39:27 2008 (r183968) @@ -350,7 +350,7 @@ smb_co_lock(struct smb_connobj *cp, int if (smb_co_lockstatus(cp, td) == LK_EXCLUSIVE && (flags & LK_CANRECURSE) == 0) { SMBERROR("recursive lock for object %d\n", cp->co_level); - panic("rescursive lock for object %p", cp); + panic("recursive lock for object %p", cp); return 0; } return lockmgr(&cp->co_lock, flags, &cp->co_interlock); From owner-svn-src-user@FreeBSD.ORG Fri Oct 17 09:27:37 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 718481065688; Fri, 17 Oct 2008 09:27:37 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 61B408FC27; Fri, 17 Oct 2008 09:27:37 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9H9Rbwa083834; Fri, 17 Oct 2008 09:27:37 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9H9Rb6d083833; Fri, 17 Oct 2008 09:27:37 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810170927.m9H9Rb6d083833@svn.freebsd.org> From: Alexander Leidinger Date: Fri, 17 Oct 2008 09:27:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183971 - user/netchild/obsolete/src/libexec/tftpd X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Oct 2008 09:27:37 -0000 Author: netchild Date: Fri Oct 17 09:27:37 2008 New Revision: 183971 URL: http://svn.freebsd.org/changeset/base/183971 Log: s/EACCESS/EACCES/ for the 2 missed ones too. Modified: user/netchild/obsolete/src/libexec/tftpd/tftpd.c Modified: user/netchild/obsolete/src/libexec/tftpd/tftpd.c ============================================================================== --- user/netchild/obsolete/src/libexec/tftpd/tftpd.c Fri Oct 17 08:58:33 2008 (r183970) +++ user/netchild/obsolete/src/libexec/tftpd/tftpd.c Fri Oct 17 09:27:37 2008 (r183971) @@ -547,7 +547,7 @@ find_next_name(char *filename, int *fd) syslog(LOG_WARNING, "Filename suffix too long (%d characters maximum)", MAXPATHLEN); - return (EACCESS); + return (EACCES); } /* Make sure the new filename is not too long */ @@ -555,7 +555,7 @@ find_next_name(char *filename, int *fd) syslog(LOG_WARNING, "Filename too long (%d characters, %d maximum)", strlen(filename), MAXPATHLEN - len - 5); - return (EACCESS); + return (EACCES); } /* Find the first file which doesn't exist */ From owner-svn-src-user@FreeBSD.ORG Fri Oct 17 10:24:28 2008 Return-Path: Delivered-To: svn-src-user@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F40131065689; Fri, 17 Oct 2008 10:24:27 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id B2F228FC0C; Fri, 17 Oct 2008 10:24:27 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id D9F9B6D434; Fri, 17 Oct 2008 10:08:53 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id BA220844A8; Fri, 17 Oct 2008 12:08:53 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Alexander Leidinger References: <200810161058.m9GAw0ua059956@svn.freebsd.org> <20081017070044.GC71466@mavetju.org> <20081017112433.24936er2myfi9pwc@webmail.leidinger.net> Date: Fri, 17 Oct 2008 12:08:53 +0200 In-Reply-To: <20081017112433.24936er2myfi9pwc@webmail.leidinger.net> (Alexander Leidinger's message of "Fri, 17 Oct 2008 11:24:33 +0200") Message-ID: <86hc7b5ya2.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: Edwin Groothuis , src-committers@FreeBSD.org, svn-src-user@FreeBSD.org Subject: Re: svn commit: r183951 - user/netchild/obsolete/src/libexec/tftpd X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Oct 2008 10:24:28 -0000 Alexander Leidinger writes: > Edwin Groothuis writes: > > Alexander Leidinger writes: > > > The correct spelling is EACCES, not EACCESS. > > I am not sure what you mean with this... What is exactly wrong with > > the last S in EACCESS ? > "man errno" does not list EACCESS, it only lists EACCES. % grep ACC /usr/include/arpa/tftp.h=20 #define EACCESS 2 /* access violation */ "oops" DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-user@FreeBSD.ORG Fri Oct 17 11:08:12 2008 Return-Path: Delivered-To: svn-src-user@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E0381065689; Fri, 17 Oct 2008 11:08:12 +0000 (UTC) (envelope-from edwin@mavetju.org) Received: from k7.mavetju.org (ppp121-44-165-91.lns10.syd6.internode.on.net [121.44.165.91]) by mx1.freebsd.org (Postfix) with ESMTP id 137D68FC1C; Fri, 17 Oct 2008 11:08:11 +0000 (UTC) (envelope-from edwin@mavetju.org) Received: by k7.mavetju.org (Postfix, from userid 1001) id 9E1FB4503D; Fri, 17 Oct 2008 21:51:38 +1100 (EST) Date: Fri, 17 Oct 2008 21:51:38 +1100 From: Edwin Groothuis To: Alexander Leidinger Message-ID: <20081017105138.GR71453@mavetju.org> References: <200810161058.m9GAw0ua059956@svn.freebsd.org> <20081017070044.GC71466@mavetju.org> <20081017112433.24936er2myfi9pwc@webmail.leidinger.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20081017112433.24936er2myfi9pwc@webmail.leidinger.net> User-Agent: Mutt/1.4.2.3i Cc: src-committers@FreeBSD.org, svn-src-user@FreeBSD.org Subject: Re: svn commit: r183951 - user/netchild/obsolete/src/libexec/tftpd X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Oct 2008 11:08:12 -0000 On Fri, Oct 17, 2008 at 11:24:33AM +0200, Alexander Leidinger wrote: > Quoting Edwin Groothuis (from Fri, 17 Oct 2008 > 18:00:44 +1100): > > >On Thu, Oct 16, 2008 at 10:58:00AM +0000, Alexander Leidinger wrote: > >> The correct spelling is EACCES, not EACCESS. > >[...] > >>- { EACCESS, "Access violation" }, > >>+ { EACCES, "Access violation" }, > > > >I am not sure what you mean with this... What is exactly wrong with > >the last S in EACCESS ? > > "man errno" does not list EACCESS, it only lists EACCES. True, but this is a TFTP error, not a system call return value. See also the Appendix "Error Codes" of RFC1350. Edwin -- Edwin Groothuis Website: http://www.mavetju.org/ edwin@mavetju.org Weblog: http://www.mavetju.org/weblog/ From owner-svn-src-user@FreeBSD.ORG Fri Oct 17 09:25:07 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B972F106568A; Fri, 17 Oct 2008 09:25:07 +0000 (UTC) (envelope-from netchild@freebsd.org) Received: from redbull.bpaserver.net (redbullneu.bpaserver.net [213.198.78.217]) by mx1.freebsd.org (Postfix) with ESMTP id 6B8388FC2B; Fri, 17 Oct 2008 09:25:07 +0000 (UTC) (envelope-from netchild@freebsd.org) Received: from outgoing.leidinger.net (pD9E2F457.dip.t-dialin.net [217.226.244.87]) by redbull.bpaserver.net (Postfix) with ESMTP id AE05C316D5; Fri, 17 Oct 2008 11:25:02 +0200 (CEST) Received: from webmail.leidinger.net (webmail.leidinger.net [192.168.1.102]) by outgoing.leidinger.net (Postfix) with ESMTP id F06DC33509; Fri, 17 Oct 2008 11:24:34 +0200 (CEST) Received: (from www@localhost) by webmail.leidinger.net (8.14.2/8.13.8/Submit) id m9H9OX41099485; Fri, 17 Oct 2008 11:24:33 +0200 (CEST) (envelope-from netchild@FreeBSD.org) Received: from pslux.cec.eu.int (pslux.cec.eu.int [158.169.9.14]) by webmail.leidinger.net (Horde Framework) with HTTP; Fri, 17 Oct 2008 11:24:33 +0200 Message-ID: <20081017112433.24936er2myfi9pwc@webmail.leidinger.net> X-Priority: 3 (Normal) Date: Fri, 17 Oct 2008 11:24:33 +0200 From: Alexander Leidinger To: Edwin Groothuis References: <200810161058.m9GAw0ua059956@svn.freebsd.org> <20081017070044.GC71466@mavetju.org> In-Reply-To: <20081017070044.GC71466@mavetju.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Internet Messaging Program (IMP) H3 (4.3) / FreeBSD-8.0 X-BPAnet-MailScanner-Information: Please contact the ISP for more information X-MailScanner-ID: AE05C316D5.45D25 X-BPAnet-MailScanner: Found to be clean X-BPAnet-MailScanner-SpamCheck: not spam, ORDB-RBL, SpamAssassin (not cached, score=-14.723, required 6, BAYES_00 -15.00, RDNS_DYNAMIC 0.10, SARE_FROM_SPAM_WORD3 0.10, TW_SV 0.08) X-BPAnet-MailScanner-From: netchild@freebsd.org X-Spam-Status: No X-Mailman-Approved-At: Fri, 17 Oct 2008 11:22:31 +0000 Cc: src-committers@FreeBSD.org, svn-src-user@FreeBSD.org Subject: Re: svn commit: r183951 - user/netchild/obsolete/src/libexec/tftpd X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Oct 2008 09:25:07 -0000 Quoting Edwin Groothuis (from Fri, 17 Oct 2008 18:00:44 +1100): > On Thu, Oct 16, 2008 at 10:58:00AM +0000, Alexander Leidinger wrote: >> The correct spelling is EACCES, not EACCESS. > [...] >> - { EACCESS, "Access violation" }, >> + { EACCES, "Access violation" }, > > I am not sure what you mean with this... What is exactly wrong with > the last S in EACCESS ? "man errno" does not list EACCESS, it only lists EACCES. Bye, Alexander. -- http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID = B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID = 72077137 It's not an optical illusion, it just looks like one. -- Phil White From owner-svn-src-user@FreeBSD.ORG Fri Oct 17 11:32:50 2008 Return-Path: Delivered-To: svn-src-user@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2CA87106568F; Fri, 17 Oct 2008 11:32:50 +0000 (UTC) (envelope-from rink@rink.nu) Received: from mx1.rink.nu (gloom.rink.nu [213.34.49.2]) by mx1.freebsd.org (Postfix) with ESMTP id DDF698FC21; Fri, 17 Oct 2008 11:32:49 +0000 (UTC) (envelope-from rink@rink.nu) Received: from localhost (localhost [127.0.0.1]) by mx1.rink.nu (Postfix) with ESMTP id 3E24A6D450; Fri, 17 Oct 2008 13:14:55 +0200 (CEST) X-Virus-Scanned: amavisd-new at rink.nu Received: from mx1.rink.nu ([213.34.49.2]) by localhost (gloom.rink.nu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id z8k-f76ew2Go; Fri, 17 Oct 2008 13:14:51 +0200 (CEST) Received: by mx1.rink.nu (Postfix, from userid 1000) id 1EADB6D41E; Fri, 17 Oct 2008 13:14:51 +0200 (CEST) Date: Fri, 17 Oct 2008 13:14:51 +0200 From: Rink Springer To: Edwin Groothuis Message-ID: <20081017111451.GA67097@rink.nu> References: <200810161058.m9GAw0ua059956@svn.freebsd.org> <20081017070044.GC71466@mavetju.org> <20081017112433.24936er2myfi9pwc@webmail.leidinger.net> <20081017105138.GR71453@mavetju.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20081017105138.GR71453@mavetju.org> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: src-committers@FreeBSD.org, Alexander Leidinger , svn-src-user@FreeBSD.org Subject: Re: svn commit: r183951 - user/netchild/obsolete/src/libexec/tftpd X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Oct 2008 11:32:50 -0000 On Fri, Oct 17, 2008 at 09:51:38PM +1100, Edwin Groothuis wrote: > On Fri, Oct 17, 2008 at 11:24:33AM +0200, Alexander Leidinger wrote: > > Quoting Edwin Groothuis (from Fri, 17 Oct 2008 > > 18:00:44 +1100): > > > > >On Thu, Oct 16, 2008 at 10:58:00AM +0000, Alexander Leidinger wrote: > > >> The correct spelling is EACCES, not EACCESS. > > >[...] > > >>- { EACCESS, "Access violation" }, > > >>+ { EACCES, "Access violation" }, > > > > > >I am not sure what you mean with this... What is exactly wrong with > > >the last S in EACCESS ? > > > > "man errno" does not list EACCESS, it only lists EACCES. > > True, but this is a TFTP error, not a system call return value. > See also the Appendix "Error Codes" of RFC1350. Wouldn't using definitions like 'TFTP_Exxx' make more sense, to prevent possible confusion as these are TFTP-specific error values? -- Rink P.W. Springer - http://rink.nu "Anyway boys, this is America. Just because you get more votes doesn't mean you win." - Fox Mulder From owner-svn-src-user@FreeBSD.ORG Fri Oct 17 12:04:59 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BD7EB1065678; Fri, 17 Oct 2008 12:04:59 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 922EC8FC1B; Fri, 17 Oct 2008 12:04:59 +0000 (UTC) (envelope-from netchild@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9HC4xLf087737; Fri, 17 Oct 2008 12:04:59 GMT (envelope-from netchild@svn.freebsd.org) Received: (from netchild@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9HC4xtH087736; Fri, 17 Oct 2008 12:04:59 GMT (envelope-from netchild@svn.freebsd.org) Message-Id: <200810171204.m9HC4xtH087736@svn.freebsd.org> From: Alexander Leidinger Date: Fri, 17 Oct 2008 12:04:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183972 - user/netchild/obsolete/src/libexec X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Oct 2008 12:04:59 -0000 Author: netchild Date: Fri Oct 17 12:04:59 2008 New Revision: 183972 URL: http://svn.freebsd.org/changeset/base/183972 Log: Edwin explained that those are RFC 1350 (tftp) error values. My fix is wrong, the real fix is to use better symbolic names which are not so close to symbolic names of errno values. Whoever invented those symbolic names in tftpd earns a WTF?-Award for them (specially as the RFC does not list symbolic names for the error values). Deleted: user/netchild/obsolete/src/libexec/ From owner-svn-src-user@FreeBSD.ORG Fri Oct 17 11:57:37 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00AD91065691; Fri, 17 Oct 2008 11:57:37 +0000 (UTC) (envelope-from netchild@freebsd.org) Received: from redbull.bpaserver.net (redbullneu.bpaserver.net [213.198.78.217]) by mx1.freebsd.org (Postfix) with ESMTP id 9FF298FC12; Fri, 17 Oct 2008 11:57:36 +0000 (UTC) (envelope-from netchild@freebsd.org) Received: from outgoing.leidinger.net (pD9E2F457.dip.t-dialin.net [217.226.244.87]) by redbull.bpaserver.net (Postfix) with ESMTP id C5EC1316D8; Fri, 17 Oct 2008 13:57:29 +0200 (CEST) Received: from webmail.leidinger.net (webmail.leidinger.net [192.168.1.102]) by outgoing.leidinger.net (Postfix) with ESMTP id 732CD359B4; Fri, 17 Oct 2008 13:57:02 +0200 (CEST) Received: (from www@localhost) by webmail.leidinger.net (8.14.2/8.13.8/Submit) id m9HBuxZe026065; Fri, 17 Oct 2008 13:56:59 +0200 (CEST) (envelope-from netchild@FreeBSD.org) Received: from pslux.cec.eu.int (pslux.cec.eu.int [158.169.9.14]) by webmail.leidinger.net (Horde Framework) with HTTP; Fri, 17 Oct 2008 13:56:59 +0200 Message-ID: <20081017135659.41525zeb0tv4avgo@webmail.leidinger.net> X-Priority: 3 (Normal) Date: Fri, 17 Oct 2008 13:56:59 +0200 From: Alexander Leidinger To: Rink Springer References: <200810161058.m9GAw0ua059956@svn.freebsd.org> <20081017070044.GC71466@mavetju.org> <20081017112433.24936er2myfi9pwc@webmail.leidinger.net> <20081017105138.GR71453@mavetju.org> <20081017111451.GA67097@rink.nu> In-Reply-To: <20081017111451.GA67097@rink.nu> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable User-Agent: Internet Messaging Program (IMP) H3 (4.3) / FreeBSD-8.0 X-BPAnet-MailScanner-Information: Please contact the ISP for more information X-MailScanner-ID: C5EC1316D8.D7158 X-BPAnet-MailScanner: Found to be clean X-BPAnet-MailScanner-SpamCheck: not spam, ORDB-RBL, SpamAssassin (not cached, score=-14.723, required 6, BAYES_00 -15.00, RDNS_DYNAMIC 0.10, SARE_FROM_SPAM_WORD3 0.10, TW_SV 0.08) X-BPAnet-MailScanner-From: netchild@freebsd.org X-Spam-Status: No X-Mailman-Approved-At: Fri, 17 Oct 2008 12:25:09 +0000 Cc: Edwin Groothuis , src-committers@FreeBSD.org, svn-src-user@FreeBSD.org Subject: Re: svn commit: r183951 - user/netchild/obsolete/src/libexec/tftpd X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Oct 2008 11:57:37 -0000 Quoting Rink Springer (from Fri, 17 Oct 2008 =20 13:14:51 +0200): > On Fri, Oct 17, 2008 at 09:51:38PM +1100, Edwin Groothuis wrote: >> On Fri, Oct 17, 2008 at 11:24:33AM +0200, Alexander Leidinger wrote: >> > Quoting Edwin Groothuis (from Fri, 17 Oct 2008 >> > 18:00:44 +1100): >> > >> > >On Thu, Oct 16, 2008 at 10:58:00AM +0000, Alexander Leidinger wrote: >> > >> The correct spelling is EACCES, not EACCESS. >> > >[...] >> > >>-=09{ EACCESS,=09"Access violation" }, >> > >>+=09{ EACCES,=09"Access violation" }, >> > > >> > >I am not sure what you mean with this... What is exactly wrong with >> > >the last S in EACCESS ? >> > >> > "man errno" does not list EACCESS, it only lists EACCES. >> >> True, but this is a TFTP error, not a system call return value. >> See also the Appendix "Error Codes" of RFC1350. > > Wouldn't using definitions like 'TFTP_Exxx' make more sense, to prevent > possible confusion as these are TFTP-specific error values? Boy, this is not only confusing, it's also dangerous. There's more =20 than only the EACCESS very near to named errno values. I fully agree =20 with Rink, specially as the RFC only specifies error values, not =20 symbolic names. Bye, Alexander. --=20 http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID =3D B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID =3D 72077137 Create problems for which only you have the answer. From owner-svn-src-user@FreeBSD.ORG Fri Oct 17 22:19:09 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 594B1106568D; Fri, 17 Oct 2008 22:19:09 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 475858FC23; Fri, 17 Oct 2008 22:19:09 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9HMJ9sF099261; Fri, 17 Oct 2008 22:19:09 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9HMJ9i2099255; Fri, 17 Oct 2008 22:19:09 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810172219.m9HMJ9i2099255@svn.freebsd.org> From: Edwin Groothuis Date: Fri, 17 Oct 2008 22:19:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183992 - user/edwin/tftpd/libexec/tftpd X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Oct 2008 22:19:09 -0000 Author: edwin Date: Fri Oct 17 22:19:08 2008 New Revision: 183992 URL: http://svn.freebsd.org/changeset/base/183992 Log: Add OP_ prefixes to packet types as defined in arpa/tftp.h. Add TFTP_ prefixes to error codes as defined in arpa/tftp.h. This all to avoid confusion (which is a good thing!) Submitted by: netchild@, rink@ and others Modified: user/edwin/tftpd/libexec/tftpd/tftp-io.c user/edwin/tftpd/libexec/tftpd/tftp-options.c user/edwin/tftpd/libexec/tftpd/tftp-transfer.c user/edwin/tftpd/libexec/tftpd/tftp-utils.c user/edwin/tftpd/libexec/tftpd/tftp-utils.h user/edwin/tftpd/libexec/tftpd/tftpd.c Modified: user/edwin/tftpd/libexec/tftpd/tftp-io.c ============================================================================== --- user/edwin/tftpd/libexec/tftpd/tftp-io.c Fri Oct 17 22:18:35 2008 (r183991) +++ user/edwin/tftpd/libexec/tftpd/tftp-io.c Fri Oct 17 22:19:08 2008 (r183992) @@ -57,16 +57,16 @@ struct errmsg { int e_code; const char *e_msg; } errmsgs[] = { - { EUNDEF, "Undefined error code" }, - { ENOTFOUND, "File not found" }, - { EACCESS, "Access violation" }, - { ENOSPACE, "Disk full or allocation exceeded" }, - { EBADOP, "Illegal TFTP operation" }, - { EBADID, "Unknown transfer ID" }, - { EEXISTS, "File already exists" }, - { ENOUSER, "No such user" }, - { EOPTNEG, "Option negotiation" }, - { -1, NULL } + { TFTP_EUNDEF, "Undefined error code" }, + { TFTP_ENOTFOUND, "File not found" }, + { TFTP_EACCESS, "Access violation" }, + { TFTP_ENOSPACE, "Disk full or allocation exceeded" }, + { TFTP_EBADOP, "Illegal TFTP operation" }, + { TFTP_EBADID, "Unknown transfer ID" }, + { TFTP_EEXISTS, "File already exists" }, + { TFTP_ENOUSER, "No such user" }, + { TFTP_EOPTNEG, "Option negotiation" }, + { -1, NULL } }; #define DROPPACKET(s) \ @@ -148,14 +148,14 @@ send_error(int peer, int error) DROPPACKET("send_error"); tp = (struct tftphdr *)buf; - tp->th_opcode = htons((u_short)ERROR); + tp->th_opcode = htons((u_short)OP_ERROR); tp->th_code = htons((u_short)error); for (pe = errmsgs; pe->e_code >= 0; pe++) if (pe->e_code == error) break; if (pe->e_code < 0) { pe->e_msg = strerror(error - 100); - tp->th_code = EUNDEF; /* set 'undef' errorcode */ + tp->th_code = TFTP_EUNDEF; /* set 'undef' errorcode */ } strcpy(tp->th_msg, pe->e_msg); length = strlen(pe->e_msg); @@ -190,7 +190,7 @@ send_wrq(int peer, char *filename, char DROPPACKETn("send_wrq", 1); tp = (struct tftphdr *)buf; - tp->th_opcode = htons((u_short)WRQ); + tp->th_opcode = htons((u_short)OP_WRQ); size = 2; bp = tp->th_stuff; @@ -238,7 +238,7 @@ send_rrq(int peer, char *filename, char DROPPACKETn("send_rrq", 1); tp = (struct tftphdr *)buf; - tp->th_opcode = htons((u_short)RRQ); + tp->th_opcode = htons((u_short)OP_RRQ); size = 2; bp = tp->th_stuff; @@ -291,7 +291,7 @@ send_oack(int peer) tp = (struct tftphdr *)buf; bp = buf + 2; size = sizeof(buf) - 2; - tp->th_opcode = htons((u_short)OACK); + tp->th_opcode = htons((u_short)OP_OACK); for (i = 0; options[i].o_type != NULL; i++) { if (options[i].o_reply != NULL) { n = snprintf(bp, size, "%s%c%s", options[i].o_type, @@ -334,7 +334,7 @@ send_ack(int fp, uint16_t block) tp = (struct tftphdr *)buf; bp = buf + 2; size = sizeof(buf) - 2; - tp->th_opcode = htons((u_short)ACK); + tp->th_opcode = htons((u_short)OP_ACK); tp->th_block = htons((u_short)block); size = 4; @@ -365,7 +365,7 @@ send_data(int peer, uint16_t block, char pkt = (struct tftphdr *)buf; - pkt->th_opcode = htons((u_short)DATA); + pkt->th_opcode = htons((u_short)OP_DATA); pkt->th_block = htons((u_short)block); memcpy(pkt->th_data, data, size); @@ -449,11 +449,10 @@ receive_packet(int peer, char *data, int } pkt->th_opcode = ntohs((u_short)pkt->th_opcode); - if (pkt->th_opcode == DATA || - pkt->th_opcode == ACK) + if (pkt->th_opcode == OP_DATA || pkt->th_opcode == OP_ACK) pkt->th_block = ntohs((u_short)pkt->th_block); - if (pkt->th_opcode == DATA && n > pktsize) { + if (pkt->th_opcode == OP_DATA && n > pktsize) { tftp_log(LOG_ERR, "receive_packet: packet too big"); return (RP_TOOBIG); } @@ -465,7 +464,7 @@ receive_packet(int peer, char *data, int return (RP_WRONGSOURCE); } - if (pkt->th_opcode == ERROR) { + if (pkt->th_opcode == OP_ERROR) { tftp_log(LOG_ERR, "Got ERROR packet: %s", pkt->th_msg); return (RP_ERROR); } Modified: user/edwin/tftpd/libexec/tftpd/tftp-options.c ============================================================================== --- user/edwin/tftpd/libexec/tftpd/tftp-options.c Fri Oct 17 22:18:35 2008 (r183991) +++ user/edwin/tftpd/libexec/tftpd/tftp-options.c Fri Oct 17 22:19:08 2008 (r183992) @@ -75,7 +75,7 @@ int options_extra_enabled = 1; * return rubbish. * - The handler returns if there is a serious problem with the * values submitted in the option. - * - Sending the EBADOP packets is done by the handler. + * - Sending the TFTP_EBADOP packets is done by the handler. */ int @@ -85,7 +85,7 @@ option_tsize(int peer, struct tftphdr *t if (options[OPT_TSIZE].o_request == NULL) return (0); - if (mode == RRQ) + if (mode == OP_RRQ) asprintf(&options[OPT_TSIZE].o_reply, "%ju", stbuf->st_size); else @@ -108,7 +108,7 @@ option_timeout(int peer) "Received bad value for timeout. " "Should be between %d and %d, received %s", TIMEOUT_MIN, TIMEOUT_MAX); - send_error(peer, EBADOP); + send_error(peer, TFTP_EBADOP); if (acting_as_client) return (1); exit(1); @@ -141,7 +141,7 @@ option_rollover(int peer) "ignoring request", options[OPT_ROLLOVER].o_request); if (acting_as_client) { - send_error(peer, EBADOP); + send_error(peer, TFTP_EBADOP); return (1); } return (0); @@ -181,7 +181,7 @@ option_blksize(int peer) tftp_log(LOG_ERR, "Invalid blocksize (%d bytes), aborting", size); - send_error(peer, EBADOP); + send_error(peer, TFTP_EBADOP); return (1); } else { tftp_log(LOG_WARNING, @@ -197,7 +197,7 @@ option_blksize(int peer) "Invalid blocksize (%d bytes), " "net.inet.udp.maxdgram sysctl limits it to " "%d bytes.\n", size, *maxdgram); - send_error(peer, EBADOP); + send_error(peer, TFTP_EBADOP); return (1); } else { tftp_log(LOG_WARNING, Modified: user/edwin/tftpd/libexec/tftpd/tftp-transfer.c ============================================================================== --- user/edwin/tftpd/libexec/tftpd/tftp-transfer.c Fri Oct 17 22:18:35 2008 (r183991) +++ user/edwin/tftpd/libexec/tftpd/tftp-transfer.c Fri Oct 17 22:19:08 2008 (r183992) @@ -109,7 +109,7 @@ tftp_send(int peer, uint16_t *block, str rp_strerror(n_ack)); goto abort; } - if (rp->th_opcode == ACK) { + if (rp->th_opcode == OP_ACK) { ts->blocks++; if (rp->th_block == *block) { ts->amount += size; @@ -131,7 +131,7 @@ tftp_send(int peer, uint16_t *block, str if (options[OPT_ROLLOVER].o_request == NULL) { tftp_log(LOG_ERR, "Block rollover but not allowed."); - send_error(peer, EBADOP); + send_error(peer, TFTP_EBADOP); gettimeofday(&(ts->tstop), NULL); return; } @@ -198,7 +198,7 @@ tftp_receive(int peer, uint16_t *block, if (options[OPT_ROLLOVER].o_request == NULL) { tftp_log(LOG_ERR, "Block rollover but not allowed."); - send_error(peer, EBADOP); + send_error(peer, TFTP_EBADOP); gettimeofday(&(ts->tstop), NULL); return; } @@ -235,7 +235,7 @@ tftp_receive(int peer, uint16_t *block, rp_strerror(n_data)); goto abort; } - if (rp->th_opcode == DATA) { + if (rp->th_opcode == OP_DATA) { ts->blocks++; if (rp->th_block == *block) @@ -270,7 +270,7 @@ tftp_receive(int peer, uint16_t *block, if (writesize < 0) send_error(peer, errno + 100); else - send_error(peer, ENOSPACE); + send_error(peer, TFTP_ENOSPACE); goto abort; } } @@ -308,7 +308,7 @@ send_ack: if (n_data <= 0) break; if (n_data > 0 && - rp->th_opcode == DATA && /* and got a data block */ + rp->th_opcode == OP_DATA && /* and got a data block */ *block == rp->th_block) /* then my last ack was lost */ send_ack(peer, *block); /* resend final ack */ } Modified: user/edwin/tftpd/libexec/tftpd/tftp-utils.c ============================================================================== --- user/edwin/tftpd/libexec/tftpd/tftp-utils.c Fri Oct 17 22:18:35 2008 (r183991) +++ user/edwin/tftpd/libexec/tftpd/tftp-utils.c Fri Oct 17 22:19:08 2008 (r183992) @@ -112,7 +112,7 @@ get_field(int peer, char *buffer, ssize_ } if (*cp != '\0') { tftp_log(LOG_ERR, "Bad option - no trailing \\0 found"); - send_error(peer, EBADOP); + send_error(peer, TFTP_EBADOP); exit(1); } return (cp - buffer + 1); @@ -161,12 +161,12 @@ tftp_log(int priority, const char *messa * Packet types */ struct packettypes packettypes[] = { - { RRQ, "RRQ" }, - { WRQ, "WRQ" }, - { DATA, "DATA" }, - { ACK, "ACK" }, - { ERROR, "ERROR" }, - { OACK, "OACK" }, + { OP_RRQ, "RRQ" }, + { OP_WRQ, "WRQ" }, + { OP_DATA, "DATA" }, + { OP_ACK, "ACK" }, + { OP_ERROR, "ERROR" }, + { OP_OACK, "OACK" }, { 0, NULL }, }; Modified: user/edwin/tftpd/libexec/tftpd/tftp-utils.h ============================================================================== --- user/edwin/tftpd/libexec/tftpd/tftp-utils.h Fri Oct 17 22:18:35 2008 (r183991) +++ user/edwin/tftpd/libexec/tftpd/tftp-utils.h Fri Oct 17 22:19:08 2008 (r183992) @@ -122,3 +122,22 @@ struct tftp_stats { void stats_init(struct tftp_stats *ts); void printstats(const char *direction, int verbose, struct tftp_stats *ts); + +/* FreeBSD TFTP Specific Error codes (defined in arpa/tftp.h) */ +#define TFTP_EUNDEF EUNDEF +#define TFTP_ENOTFOUND ENOTFOUND +#define TFTP_EACCESS EACCESS +#define TFTP_ENOSPACE ENOSPACE +#define TFTP_EBADOP EBADOP +#define TFTP_EBADID EBADID +#define TFTP_EEXISTS EEXISTS +#define TFTP_ENOUSER ENOUSER +#define TFTP_EOPTNEG EOPTNEG + +/* FreeBSD TFTP Specific Error codes (defined in arpa/tftp.h) */ +#define OP_RRQ RRQ +#define OP_WRQ WRQ +#define OP_DATA DATA +#define OP_ACK ACK +#define OP_ERROR ERROR +#define OP_OACK OACK Modified: user/edwin/tftpd/libexec/tftpd/tftpd.c ============================================================================== --- user/edwin/tftpd/libexec/tftpd/tftpd.c Fri Oct 17 22:18:35 2008 (r183991) +++ user/edwin/tftpd/libexec/tftpd/tftpd.c Fri Oct 17 22:19:08 2008 (r183992) @@ -406,7 +406,7 @@ main(int argc, char *argv[]) tp = (struct tftphdr *)recvbuffer; tp->th_opcode = ntohs(tp->th_opcode); - if (tp->th_opcode == RRQ) { + if (tp->th_opcode == OP_RRQ) { if (allow_ro) tftp_rrq(peer, tp->th_stuff, n - 1); else { @@ -415,7 +415,7 @@ main(int argc, char *argv[]) exit(1); } } - if (tp->th_opcode == WRQ) { + if (tp->th_opcode == OP_WRQ) { if (allow_wo) tftp_wrq(peer, tp->th_stuff, n - 1); else { @@ -472,7 +472,7 @@ parse_header(int peer, char *recvbuffer, i = get_field(peer, recvbuffer, size); if (i >= PATH_MAX) { tftp_log(LOG_ERR, "Bad option - filename too long"); - send_error(peer, EBADOP); + send_error(peer, TFTP_EBADOP); exit(1); } *filename = recvbuffer; @@ -493,7 +493,7 @@ parse_header(int peer, char *recvbuffer, if (pf->f_mode == NULL) { tftp_log(LOG_ERR, "Bad option - Unknown transfer mode (%s)", *mode); - send_error(peer, EBADOP); + send_error(peer, TFTP_EBADOP); exit(1); } tftp_log(LOG_INFO, "Mode: '%s'", *mode); @@ -526,7 +526,7 @@ tftp_wrq(int peer, char *recvbuffer, ssi tftp_log(LOG_INFO, "Options found but not enabled"); } - ecode = validate_access(peer, &filename, WRQ); + ecode = validate_access(peer, &filename, OP_WRQ); if (ecode == 0) { if (has_options) send_oack(peer); @@ -567,7 +567,7 @@ tftp_rrq(int peer, char *recvbuffer, ssi tftp_log(LOG_INFO, "Options found but not enabled"); } - ecode = validate_access(peer, &filename, RRQ); + ecode = validate_access(peer, &filename, OP_RRQ); if (ecode == 0) { if (has_options) { int n; @@ -583,7 +583,7 @@ tftp_rrq(int peer, char *recvbuffer, ssi rp_strerror(n)); return; } - if (rp->th_opcode != ACK) { + if (rp->th_opcode != OP_ACK) { if (debug&DEBUG_SIMPLE) tftp_log(LOG_DEBUG, "Expected ACK, got %s on OACK", @@ -602,7 +602,8 @@ tftp_rrq(int peer, char *recvbuffer, ssi * Avoid storms of naks to a RRQ broadcast for a relative * bootfile pathname from a diskless Sun. */ - if (suppress_naks && *filename != '/' && ecode == ENOTFOUND) + if (suppress_naks && *filename != '/' && + ecode == TFTP_ENOTFOUND) exit(0); tftp_log(LOG_ERR, "Prevent NAK storm"); send_error(peer, ecode); @@ -635,7 +636,7 @@ find_next_name(char *filename, int *fd) syslog(LOG_WARNING, "Filename suffix too long (%d characters maximum)", MAXPATHLEN); - return (EACCESS); + return (TFTP_EACCESS); } /* Make sure the new filename is not too long */ @@ -643,7 +644,7 @@ find_next_name(char *filename, int *fd) syslog(LOG_WARNING, "Filename too long (%zd characters, %zd maximum)", strlen(filename), MAXPATHLEN - len - 5); - return (EACCESS); + return (TFTP_EACCESS); } /* Find the first file which doesn't exist */ @@ -657,7 +658,7 @@ find_next_name(char *filename, int *fd) return 0; } - return (EEXIST); + return (TFTP_EEXISTS); } /* @@ -685,7 +686,7 @@ validate_access(int peer, char **filep, * Prevent tricksters from getting around the directory restrictions */ if (strstr(filename, "/../")) - return (EACCESS); + return (TFTP_EACCESS); if (*filename == '/') { /* @@ -702,17 +703,17 @@ validate_access(int peer, char **filep, } /* If directory list is empty, allow access to any file */ if (dirp->name == NULL && dirp != dirs) - return (EACCESS); + return (TFTP_EACCESS); if (stat(filename, &stbuf) < 0) - return (errno == ENOENT ? ENOTFOUND : EACCESS); + return (errno == ENOENT ? TFTP_ENOTFOUND : TFTP_EACCESS); if ((stbuf.st_mode & S_IFMT) != S_IFREG) - return (ENOTFOUND); - if (mode == RRQ) { + return (TFTP_ENOTFOUND); + if (mode == OP_RRQ) { if ((stbuf.st_mode & S_IROTH) == 0) - return (EACCESS); + return (TFTP_EACCESS); } else { if ((stbuf.st_mode & S_IWOTH) == 0) - return (EACCESS); + return (TFTP_EACCESS); } } else { int err; @@ -724,14 +725,14 @@ validate_access(int peer, char **filep, */ if (!strncmp(filename, "../", 3)) - return (EACCESS); + return (TFTP_EACCESS); /* * If the file exists in one of the directories and isn't * readable, continue looking. However, change the error code * to give an indication that the file exists. */ - err = ENOTFOUND; + err = TFTP_ENOTFOUND; for (dirp = dirs; dirp->name != NULL; dirp++) { snprintf(pathname, sizeof(pathname), "%s/%s", dirp->name, filename); @@ -740,12 +741,12 @@ validate_access(int peer, char **filep, if ((stbuf.st_mode & S_IROTH) != 0) { break; } - err = EACCESS; + err = TFTP_EACCESS; } } if (dirp->name != NULL) *filep = filename = pathname; - else if (mode == RRQ) + else if (mode == OP_RRQ) return (err); } @@ -755,7 +756,7 @@ validate_access(int peer, char **filep, */ option_tsize(peer, NULL, mode, &stbuf); - if (mode == RRQ) + if (mode == OP_RRQ) fd = open(filename, O_RDONLY); else { if (create_new) { @@ -773,7 +774,7 @@ validate_access(int peer, char **filep, } if (fd < 0) return (errno + 100); - file = fdopen(fd, (mode == RRQ)? "r":"w"); + file = fdopen(fd, (mode == OP_RRQ)? "r":"w"); if (file == NULL) { close(fd); return (errno + 100); From owner-svn-src-user@FreeBSD.ORG Fri Oct 17 22:26:38 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8DFE61065688; Fri, 17 Oct 2008 22:26:38 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7D22D8FC18; Fri, 17 Oct 2008 22:26:38 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9HMQcUJ099421; Fri, 17 Oct 2008 22:26:38 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9HMQcpI099420; Fri, 17 Oct 2008 22:26:38 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810172226.m9HMQcpI099420@svn.freebsd.org> From: Edwin Groothuis Date: Fri, 17 Oct 2008 22:26:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183993 - user/edwin/tftpd/usr.bin/tftp X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Oct 2008 22:26:38 -0000 Author: edwin Date: Fri Oct 17 22:26:38 2008 New Revision: 183993 URL: http://svn.freebsd.org/changeset/base/183993 Log: Add OP_ prefixes to packet types as defined in arpa/tftp.h. Add TFTP_ prefixes to error codes as defined in arpa/tftp.h. This all to avoid confusion (which is a good thing!) Submitted by: netchild@, rink@ and others Modified: user/edwin/tftpd/usr.bin/tftp/tftp.c Modified: user/edwin/tftpd/usr.bin/tftp/tftp.c ============================================================================== --- user/edwin/tftpd/usr.bin/tftp/tftp.c Fri Oct 17 22:19:08 2008 (r183992) +++ user/edwin/tftpd/usr.bin/tftp/tftp.c Fri Oct 17 22:26:38 2008 (r183993) @@ -134,7 +134,7 @@ xmitfile(int peer, char *port, int fd, c printf("Transfer timed out.\n"); return; } - if (rp->th_opcode == ERROR) { + if (rp->th_opcode == OP_ERROR) { printf("Got ERROR, aborted\n"); return; } @@ -143,10 +143,10 @@ xmitfile(int peer, char *port, int fd, c * If the first packet is an OACK instead of an ACK packet, * handle it different. */ - if (rp->th_opcode == OACK) { + if (rp->th_opcode == OP_OACK) { if (!options_rfc_enabled) { printf("Got OACK while options are not enabled!\n"); - send_error(peer, EBADOP); + send_error(peer, TFTP_EBADOP); return; } @@ -230,7 +230,7 @@ recvfile(int peer, char *port, int fd, c break; } - if (rp->th_opcode == ERROR) { + if (rp->th_opcode == OP_ERROR) { tftp_log(LOG_ERR, "Error code %d: %s", rp->th_code, rp->th_msg); return; } @@ -246,10 +246,10 @@ recvfile(int peer, char *port, int fd, c * If the first packet is an OACK packet instead of an DATA packet, * handle it different. */ - if (rp->th_opcode == OACK) { + if (rp->th_opcode == OP_OACK) { if (!options_rfc_enabled) { printf("Got OACK while options are not enabled!\n"); - send_error(peer, EBADOP); + send_error(peer, TFTP_EBADOP); return; } From owner-svn-src-user@FreeBSD.ORG Fri Oct 17 22:32:26 2008 Return-Path: Delivered-To: svn-src-user@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9F8481065686; Fri, 17 Oct 2008 22:32:26 +0000 (UTC) (envelope-from edwin@mavetju.org) Received: from k7.mavetju.org (ppp121-44-136-21.lns10.syd7.internode.on.net [121.44.136.21]) by mx1.freebsd.org (Postfix) with ESMTP id 317368FC15; Fri, 17 Oct 2008 22:32:24 +0000 (UTC) (envelope-from edwin@mavetju.org) Received: by k7.mavetju.org (Postfix, from userid 1001) id 16A604503D; Sat, 18 Oct 2008 09:31:37 +1100 (EST) Date: Sat, 18 Oct 2008 09:31:37 +1100 From: Edwin Groothuis To: Alexander Leidinger Message-ID: <20081017223137.GD71466@mavetju.org> References: <200810161058.m9GAw0ua059956@svn.freebsd.org> <20081017070044.GC71466@mavetju.org> <20081017112433.24936er2myfi9pwc@webmail.leidinger.net> <20081017105138.GR71453@mavetju.org> <20081017111451.GA67097@rink.nu> <20081017135659.41525zeb0tv4avgo@webmail.leidinger.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20081017135659.41525zeb0tv4avgo@webmail.leidinger.net> User-Agent: Mutt/1.4.2.3i Cc: Rink Springer , src-committers@FreeBSD.org, svn-src-user@FreeBSD.org Subject: Re: svn commit: r183951 - user/netchild/obsolete/src/libexec/tftpd X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Oct 2008 22:32:26 -0000 On Fri, Oct 17, 2008 at 01:56:59PM +0200, Alexander Leidinger wrote: > Quoting Rink Springer (from Fri, 17 Oct 2008 > 13:14:51 +0200): > > >On Fri, Oct 17, 2008 at 09:51:38PM +1100, Edwin Groothuis wrote: > >>On Fri, Oct 17, 2008 at 11:24:33AM +0200, Alexander Leidinger wrote: > >>> Quoting Edwin Groothuis (from Fri, 17 Oct 2008 > >>> 18:00:44 +1100): > >>> > >>> >On Thu, Oct 16, 2008 at 10:58:00AM +0000, Alexander Leidinger wrote: > >>> >> The correct spelling is EACCES, not EACCESS. > >>> >[...] > >>> >>- { EACCESS, "Access violation" }, > >>> >>+ { EACCES, "Access violation" }, > >>> > > >>> >I am not sure what you mean with this... What is exactly wrong with > >>> >the last S in EACCESS ? > >>> > >>> "man errno" does not list EACCESS, it only lists EACCES. > >> > >>True, but this is a TFTP error, not a system call return value. > >>See also the Appendix "Error Codes" of RFC1350. > > > >Wouldn't using definitions like 'TFTP_Exxx' make more sense, to prevent > >possible confusion as these are TFTP-specific error values? > > Boy, this is not only confusing, it's also dangerous. There's more > than only the EACCESS very near to named errno values. I fully agree > with Rink, specially as the RFC only specifies error values, not > symbolic names. I've updated my code in r183992 and r183993, also for the opcodes. Edwin -- Edwin Groothuis Website: http://www.mavetju.org/ edwin@mavetju.org Weblog: http://www.mavetju.org/weblog/ From owner-svn-src-user@FreeBSD.ORG Fri Oct 17 22:52:21 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89FE610656A3; Fri, 17 Oct 2008 22:52:21 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6012C8FC20; Fri, 17 Oct 2008 22:52:21 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9HMqLvP099895; Fri, 17 Oct 2008 22:52:21 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9HMqLxO099894; Fri, 17 Oct 2008 22:52:21 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810172252.m9HMqLxO099894@svn.freebsd.org> From: Edwin Groothuis Date: Fri, 17 Oct 2008 22:52:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183994 - in user/edwin/releasenotes/head: . release X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Oct 2008 22:52:21 -0000 Author: edwin Date: Fri Oct 17 22:52:21 2008 New Revision: 183994 URL: http://svn.freebsd.org/changeset/base/183994 Log: Prepare for contributed software registration experiment. Added: user/edwin/releasenotes/head/ user/edwin/releasenotes/head/release/ - copied from r183993, head/release/ From owner-svn-src-user@FreeBSD.ORG Fri Oct 17 22:53:12 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13416106568F; Fri, 17 Oct 2008 22:53:12 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DD76C8FC29; Fri, 17 Oct 2008 22:53:11 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9HMrBJB099947; Fri, 17 Oct 2008 22:53:11 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9HMrBcW099946; Fri, 17 Oct 2008 22:53:11 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810172253.m9HMrBcW099946@svn.freebsd.org> From: Edwin Groothuis Date: Fri, 17 Oct 2008 22:53:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183995 - in user/edwin/releasenotes/stable-6: . release X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Oct 2008 22:53:12 -0000 Author: edwin Date: Fri Oct 17 22:53:11 2008 New Revision: 183995 URL: http://svn.freebsd.org/changeset/base/183995 Log: Prepare for contributed software registration experiment. Added: user/edwin/releasenotes/stable-6/ user/edwin/releasenotes/stable-6/release/ - copied from r183994, stable/6/release/ From owner-svn-src-user@FreeBSD.ORG Fri Oct 17 22:53:26 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4C5CA106568C; Fri, 17 Oct 2008 22:53:26 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 227858FC34; Fri, 17 Oct 2008 22:53:26 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9HMrQck099993; Fri, 17 Oct 2008 22:53:26 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9HMrQSf099992; Fri, 17 Oct 2008 22:53:26 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810172253.m9HMrQSf099992@svn.freebsd.org> From: Edwin Groothuis Date: Fri, 17 Oct 2008 22:53:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183996 - in user/edwin/releasenotes/stable-7: . release X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Oct 2008 22:53:26 -0000 Author: edwin Date: Fri Oct 17 22:53:25 2008 New Revision: 183996 URL: http://svn.freebsd.org/changeset/base/183996 Log: Prepare for contributed software registration experiment. Added: user/edwin/releasenotes/stable-7/ user/edwin/releasenotes/stable-7/release/ (props changed) - copied from r183995, stable/7/release/ From owner-svn-src-user@FreeBSD.ORG Fri Oct 17 22:54:42 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 49ED3106568B; Fri, 17 Oct 2008 22:54:42 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1FDC68FC22; Fri, 17 Oct 2008 22:54:42 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9HMsgip000155; Fri, 17 Oct 2008 22:54:42 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9HMsg9X000154; Fri, 17 Oct 2008 22:54:42 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810172254.m9HMsg9X000154@svn.freebsd.org> From: Edwin Groothuis Date: Fri, 17 Oct 2008 22:54:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183997 - in user/edwin/releasenotes/releng-6.0: . release X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Oct 2008 22:54:42 -0000 Author: edwin Date: Fri Oct 17 22:54:41 2008 New Revision: 183997 URL: http://svn.freebsd.org/changeset/base/183997 Log: Prepare for contributed software registration experiment. Added: user/edwin/releasenotes/releng-6.0/ user/edwin/releasenotes/releng-6.0/release/ - copied from r183996, releng/6.0/release/ From owner-svn-src-user@FreeBSD.ORG Fri Oct 17 22:54:53 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED4421065687; Fri, 17 Oct 2008 22:54:53 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C31B28FC13; Fri, 17 Oct 2008 22:54:53 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9HMsrvi000199; Fri, 17 Oct 2008 22:54:53 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9HMsrGD000198; Fri, 17 Oct 2008 22:54:53 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810172254.m9HMsrGD000198@svn.freebsd.org> From: Edwin Groothuis Date: Fri, 17 Oct 2008 22:54:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183998 - in user/edwin/releasenotes/releng-6.1: . release X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Oct 2008 22:54:54 -0000 Author: edwin Date: Fri Oct 17 22:54:53 2008 New Revision: 183998 URL: http://svn.freebsd.org/changeset/base/183998 Log: Prepare for contributed software registration experiment. Added: user/edwin/releasenotes/releng-6.1/ user/edwin/releasenotes/releng-6.1/release/ - copied from r183997, releng/6.1/release/ From owner-svn-src-user@FreeBSD.ORG Fri Oct 17 22:55:12 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 152C21065686; Fri, 17 Oct 2008 22:55:12 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DF5AA8FC1A; Fri, 17 Oct 2008 22:55:11 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9HMtB6V000260; Fri, 17 Oct 2008 22:55:11 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9HMtBfs000259; Fri, 17 Oct 2008 22:55:11 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810172255.m9HMtBfs000259@svn.freebsd.org> From: Edwin Groothuis Date: Fri, 17 Oct 2008 22:55:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183999 - in user/edwin/releasenotes/releng-6.2: . release X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Oct 2008 22:55:12 -0000 Author: edwin Date: Fri Oct 17 22:55:11 2008 New Revision: 183999 URL: http://svn.freebsd.org/changeset/base/183999 Log: Prepare for contributed software registration experiment. Added: user/edwin/releasenotes/releng-6.2/ user/edwin/releasenotes/releng-6.2/release/ - copied from r183998, releng/6.2/release/ From owner-svn-src-user@FreeBSD.ORG Fri Oct 17 22:55:24 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9808D1065693; Fri, 17 Oct 2008 22:55:24 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6DCED8FC20; Fri, 17 Oct 2008 22:55:24 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9HMtOmn000302; Fri, 17 Oct 2008 22:55:24 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9HMtOrf000301; Fri, 17 Oct 2008 22:55:24 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810172255.m9HMtOrf000301@svn.freebsd.org> From: Edwin Groothuis Date: Fri, 17 Oct 2008 22:55:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184000 - in user/edwin/releasenotes/releng-6.3: . release X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Oct 2008 22:55:24 -0000 Author: edwin Date: Fri Oct 17 22:55:24 2008 New Revision: 184000 URL: http://svn.freebsd.org/changeset/base/184000 Log: Prepare for contributed software registration experiment. Added: user/edwin/releasenotes/releng-6.3/ user/edwin/releasenotes/releng-6.3/release/ - copied from r183999, releng/6.3/release/ From owner-svn-src-user@FreeBSD.ORG Fri Oct 17 22:55:36 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ECA921065692; Fri, 17 Oct 2008 22:55:36 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C2EB58FC0A; Fri, 17 Oct 2008 22:55:36 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9HMtauK000344; Fri, 17 Oct 2008 22:55:36 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9HMtadQ000343; Fri, 17 Oct 2008 22:55:36 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810172255.m9HMtadQ000343@svn.freebsd.org> From: Edwin Groothuis Date: Fri, 17 Oct 2008 22:55:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184001 - in user/edwin/releasenotes/releng-6.4: . release X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Oct 2008 22:55:37 -0000 Author: edwin Date: Fri Oct 17 22:55:36 2008 New Revision: 184001 URL: http://svn.freebsd.org/changeset/base/184001 Log: Prepare for contributed software registration experiment. Added: user/edwin/releasenotes/releng-6.4/ user/edwin/releasenotes/releng-6.4/release/ - copied from r184000, releng/6.4/release/ From owner-svn-src-user@FreeBSD.ORG Fri Oct 17 22:55:48 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 62D91106568C; Fri, 17 Oct 2008 22:55:48 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 391158FC16; Fri, 17 Oct 2008 22:55:48 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9HMtmM7000386; Fri, 17 Oct 2008 22:55:48 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9HMtmba000385; Fri, 17 Oct 2008 22:55:48 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810172255.m9HMtmba000385@svn.freebsd.org> From: Edwin Groothuis Date: Fri, 17 Oct 2008 22:55:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184002 - in user/edwin/releasenotes/releng-7.0: . release X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Oct 2008 22:55:48 -0000 Author: edwin Date: Fri Oct 17 22:55:47 2008 New Revision: 184002 URL: http://svn.freebsd.org/changeset/base/184002 Log: Prepare for contributed software registration experiment. Added: user/edwin/releasenotes/releng-7.0/ user/edwin/releasenotes/releng-7.0/release/ - copied from r184001, releng/7.0/release/ From owner-svn-src-user@FreeBSD.ORG Fri Oct 17 23:26:45 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AFE81106568A; Fri, 17 Oct 2008 23:26:45 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9B9C68FC16; Fri, 17 Oct 2008 23:26:45 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9HNQjtR001046; Fri, 17 Oct 2008 23:26:45 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9HNQjEe001031; Fri, 17 Oct 2008 23:26:45 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810172326.m9HNQjEe001031@svn.freebsd.org> From: Edwin Groothuis Date: Fri, 17 Oct 2008 23:26:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184005 - in user/edwin/releasenotes: . head/release/doc/en_US.ISO8859-1/relnotes head/release/doc/share/sgml releng-6.0/release/doc/share/sgml releng-6.1/release/doc/share/sgml releng-... X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Oct 2008 23:26:45 -0000 Author: edwin Date: Fri Oct 17 23:26:44 2008 New Revision: 184005 URL: http://svn.freebsd.org/changeset/base/184005 Log: This is an experiment. Contributed software, like the timezone database, is always imported, often a merge-from-vendor is done and most of the times it is MFCd into the latest branch and the branch before that. Updating the release note documentation is a thing which is sometimes done, sometimes done by a third person and sometimes not done at all. By creating a datafile to store the information about the software, its versions, its import dates, its MFV dates and its MFC dates, I hope that it will be easier for commiters (lazy bums as they are!) and re@ to make sure that the information about these updates is tracked and easy to be used to generate release notes. First steps: Create a copy of the release directories for the 6.x and higher releases and branches, adjust the article.sgml files 7.x and higher releases and branches. Create the right catalog for the contributed software entity. Create the configuration file and the beginning of a script to convert the configuration into a piece of information which can be used by the releasenote processing software. Added: user/edwin/releasenotes/contrib-xmltoent.pl user/edwin/releasenotes/contrib.xml Modified: user/edwin/releasenotes/head/release/doc/en_US.ISO8859-1/relnotes/Makefile user/edwin/releasenotes/head/release/doc/en_US.ISO8859-1/relnotes/article.sgml user/edwin/releasenotes/head/release/doc/share/sgml/catalog user/edwin/releasenotes/releng-6.0/release/doc/share/sgml/catalog user/edwin/releasenotes/releng-6.1/release/doc/share/sgml/catalog user/edwin/releasenotes/releng-6.2/release/doc/share/sgml/catalog user/edwin/releasenotes/releng-6.3/release/doc/share/sgml/catalog user/edwin/releasenotes/releng-6.4/release/doc/share/sgml/catalog user/edwin/releasenotes/releng-7.0/release/doc/en_US.ISO8859-1/relnotes/article.sgml user/edwin/releasenotes/releng-7.0/release/doc/share/sgml/catalog user/edwin/releasenotes/stable-6/release/doc/share/sgml/catalog user/edwin/releasenotes/stable-7/release/doc/en_US.ISO8859-1/relnotes/article.sgml user/edwin/releasenotes/stable-7/release/doc/share/sgml/catalog Added: user/edwin/releasenotes/contrib-xmltoent.pl ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/releasenotes/contrib-xmltoent.pl Fri Oct 17 23:26:44 2008 (r184005) @@ -0,0 +1,176 @@ +#!/usr/bin/perl -w + +use XML::Parser; +use Data::Dumper; +use strict; + +my @tree = (); +my @values = (); +my $treeindex = -1; + +my %branches = (); +my %softwares = (); +my $software = ""; +my $mfcbranch = ""; +my $swversion = ""; + +my %releaseent = (); + +sub xml_start { + my $expat = shift; + my $element = shift; + + $tree[++$treeindex] = $element; + while (defined (my $attribute = shift)) { + $values[$treeindex]{$attribute} = shift; + } + + if ($element eq "software") { + $software = $values[$treeindex]{name}; + } + if ($element eq "version") { + $softwares{$software}{versions}{$values[$treeindex]{version}} = {}; + $swversion = $values[$treeindex]{version}; + } + if ($element eq "mfc") { + $mfcbranch = $values[$treeindex]{branch}; + } + +} + +sub xml_end { + my $expat = shift; + my $element = shift; + + $values[$treeindex] = (); + $treeindex--; +} + +sub xml_char { + my $expat = shift; + my $value = shift; + + if ($tree[0] eq "freebsd") { + return if ($treeindex == 0); + + if ($tree[1] eq "branches") { + return if ($treeindex == 1); + + if ($tree[2] eq "branch") { + $branches{$values[$treeindex]{name}} = $value; + return; + } + + return; + } + + if ($tree[1] eq "softwares") { + return if ($treeindex == 1); + + if ($tree[2] eq "software") { + return if ($treeindex == 2); + + if ($tree[3] eq "desc") { + $softwares{$software}{desc} = "" + if (!defined $softwares{$software}{desc}); + $softwares{$software}{desc} .= $value; + return; + } + + if ($tree[3] eq "versions") { + return if ($treeindex == 3); + + if ($tree[4] eq "version") { + return if ($treeindex == 4); + + if ($tree[5] eq "import") { + $softwares{$software}{versions}{$swversion}{import} = $value; + return; + } + if ($tree[5] eq "mfv") { + $softwares{$software}{versions}{$swversion}{mfv} = $value; + return; + } + if ($tree[5] eq "desc") { + $softwares{$software}{versions}{$swversion}{desc} = "" + if (!defined $softwares{$software}{versions}{$swversion}{desc}); + $softwares{$software}{versions}{$swversion}{desc} .= $value; + return; + } + if ($tree[5] eq "mfc") { + $softwares{$software}{versions}{$swversion}{mfc}{$mfcbranch} = $value; + return; + } + + } + } + } + } + } + +} + +my $p = new XML::Parser( + Handlers => { + Start => \&xml_start, + End => \&xml_end, + Char => \&xml_char, + }); +$p->parsefile("../../../../../contrib.xml"); + +{ + my %r = ( + "release.current" => 1, + "release.next" => 1, + "release.prev" => 1, + "release.branch" => 1, + ); + open(FIN, "../../share/sgml/release.ent"); + my @lines = ; + close(FIN); + chomp(@lines); + + foreach my $line (@lines) { + if ($line =~ //) { + next if (!defined $r{$1}); + $releaseent{$1} = $2; + } + } +} + +#print Dumper(%branches); +#print Dumper(%releaseent); +#print Dumper(%softwares); + +# +# If we are in -current, then release.current doesn't exist yet. +# In that case copy all MFVs into MFC{release.branch}. The date +# of the new MFC is the date of the release.prev. +# +# release.current is then assigned with release.branch. +# +# the creation date of branches{release.current} will be +# branches{release.prev} +# +if (!defined $branches{$releaseent{"release.current"}}) { + foreach my $sw (keys(%softwares)) { + foreach my $vs (keys(%{$softwares{$sw}{versions}})) { + next if (!defined $softwares{$sw}{versions}{$vs}{mfv}); + $softwares{$sw}{versions}{$vs}{mfc}{$releaseent{"release.branch"}} = $softwares{$sw}{versions}{$vs}{mfv}; + } + } + + $releaseent{"release.current"} = $releaseent{"release.branch"}; + $branches{$releaseent{"release.current"}} = + $branches{$releaseent{"release.prev"}} + +} + +# +# Find all MFVs which are done in the time that +# + + +print Dumper(%branches); +print Dumper(%releaseent); +#print Dumper(%softwares); Added: user/edwin/releasenotes/contrib.xml ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/releasenotes/contrib.xml Fri Oct 17 23:26:44 2008 (r184005) @@ -0,0 +1,278 @@ + + + 2007-10-11 + 2007-12-22 + 2005-07-11 + 2005-10-09 + 2006-04-30 + 2006-11-14 + 2007-10-24 + 2008-10-02 + + + + + less has been updated from + %v1% to %v2%. + ]]> + + + + 2007-11-26 + 2007-11-26 + 2007-12-05 + 2007-12-05 + + + 2007-11-17 + 2007-11-17 + + + 2007-10-13 + 2007-10-13 + 2007-10-18 + 2007-10-16 + + + 2007-10-09 + 2007-10-09 + 2007-10-12 + + + 2007-06-21 + 2007-06-21 + 2007-07-03 + + + 2007-06-04 + 2007-06-04 + + + 2006-08-21 + 2006-08-21 + 2006-08-30 + + + 2004-04-17 + 2004-04-17 + + + 2002-01-08 + 2002-01-08 + + + 2000-07-14 + 2000-07-14 + + + 2000-05-22 + + + + + + The timezone database has been updated from + the %v1% release to the + %v2% release. + ]]> + + + + 2008-10-14 + 2008-10-14 + 2008-10-14 + 2008-10-14 + 2008-10-14 + + + 2008-10-14 + 2008-10-14 + 2008-10-14 + 2008-10-14 + 2008-10-14 + + + 2008-09-16 + 2008-09-16 + 2008-09-16 + 2008-09-16 + + + 2008-08-08 + 2008-08-08 + 2008-08-08 + 2008-08-15 + + + 2008-08-08 + 2008-08-08 + 2008-08-08 + 2008-08-15 + + + 2008-08-08 + 2008-08-08 + 2008-08-08 + 2008-08-15 + + + 2008-03-25 + 2008-08-08 + 2008-03-25 + 2008-03-25 + + + 2008-03-09 + 2008-03-09 + 2008-03-09 + 2008-03-09 + + + 2008-01-01 + 2008-01-01 + 2008-01-06 + 2008-01-06 + 2008-01-06 + + + 2007-12-04 + 2007-12-04 + + + 2007-11-04 + 2007-11-04 + + + 2007-10-09 + 2007-10-09 + 2007-10-18 + + + 2007-08-24 + 2007-08-24 + 2007-09-02 + + + 2007-05-21 + 2007-05-21 + + + 2006-05-11 + 2006-05-21 + 2006-10-16 + + + 2006-05-11 + + 2005-05-11 + + + 2005-12-27 + 2005-12-27 + 2005-12-27 + + + 2005-12-22 + 2005-12-22 + 2005-12-22 + + + 2005-08-26 + 2005-08-29 + 2005-12-22 + + + 2005-08-26 + 2005-08-27 + 2005-12-22 + + + 2004-12-03 + 2004-12-03 + 2004-12-02 + + + 2004-10-18 + 2004-10-18 + + + 2003-10-14 + 2003-10-15 + + + 2003-04-28 + 2003-04-29 + + + 2002-10-16 + 2002-10-16 + + + 2002-04-04 + 2002-04-05 + + + 2001-11-10 + 2001-11-10 + + + 2001-04-06 + 2001-04-07 + + + 2000-10-25 + 2000-10-26 + + + 2000-03-29 + 2000-08-11 + + + 2000-03-29 + 2000-03-30 + + + 1999-02-02 + 1999-02-03 + + + 1999-01-21 + 1999-01-22 + + + 1997-10-25 + 1997-10-26 + + + 1996-12-02 + + + 1996-12-02 + + + + 1996-11-19 + + + + 1996-07-17 + + + + 1996-03-02 + 1996-03-03 + + + 1995-08-04 + + + + 1994-09-13 + + + + + + Modified: user/edwin/releasenotes/head/release/doc/en_US.ISO8859-1/relnotes/Makefile ============================================================================== --- user/edwin/releasenotes/head/release/doc/en_US.ISO8859-1/relnotes/Makefile Fri Oct 17 23:23:50 2008 (r184004) +++ user/edwin/releasenotes/head/release/doc/en_US.ISO8859-1/relnotes/Makefile Fri Oct 17 23:26:44 2008 (r184005) @@ -18,6 +18,12 @@ JADEFLAGS+= -V %generate-article-toc% # SGML content SRCS+= article.sgml +# Contributed software +SRCS+= contrib.ent + +contrib.ent: ${RELN_ROOT}/../../../contrib.xml + ${PERL} -w ${RELN_ROOT}/../../../contrib-xmltoent.pl + URL_RELPREFIX?= ../../../.. .include "${RELN_ROOT}/share/mk/doc.relnotes.mk" Modified: user/edwin/releasenotes/head/release/doc/en_US.ISO8859-1/relnotes/article.sgml ============================================================================== --- user/edwin/releasenotes/head/release/doc/en_US.ISO8859-1/relnotes/article.sgml Fri Oct 17 23:23:50 2008 (r184004) +++ user/edwin/releasenotes/head/release/doc/en_US.ISO8859-1/relnotes/article.sgml Fri Oct 17 23:26:44 2008 (r184005) @@ -5,6 +5,9 @@ %release; + +%contrib; + @@ -420,6 +423,12 @@ Contributed Software + &contrib.softwares; + + + + + Expected Contributed Software AMD has been updated from 6.0.10 to 6.1.5. Modified: user/edwin/releasenotes/head/release/doc/share/sgml/catalog ============================================================================== --- user/edwin/releasenotes/head/release/doc/share/sgml/catalog Fri Oct 17 23:23:50 2008 (r184004) +++ user/edwin/releasenotes/head/release/doc/share/sgml/catalog Fri Oct 17 23:26:44 2008 (r184005) @@ -6,10 +6,11 @@ PUBLIC "-//FreeBSD//ENTITIES Release Specification//EN" "release.ent" +PUBLIC "-//FreeBSD//ENTITIES Release Contrib Set//EN" + "../../en_US.ISO8859-1/relnotes/contrib.ent" + PUBLIC "-//FreeBSD//DOCUMENT Release Notes DocBook Language Neutral Stylesheet//EN" "release.dsl" PUBLIC "-//FreeBSD//DOCUMENT Release Notes DocBook Stylesheet//EN" "../../en_US.ISO8859-1/share/sgml/release.dsl" - - Modified: user/edwin/releasenotes/releng-6.0/release/doc/share/sgml/catalog ============================================================================== --- user/edwin/releasenotes/releng-6.0/release/doc/share/sgml/catalog Fri Oct 17 23:23:50 2008 (r184004) +++ user/edwin/releasenotes/releng-6.0/release/doc/share/sgml/catalog Fri Oct 17 23:26:44 2008 (r184005) @@ -6,6 +6,9 @@ PUBLIC "-//FreeBSD//ENTITIES Release Specification//EN" "release.ent" +PUBLIC "-//FreeBSD//ENTITIES Release Contrib Set//EN" + "../../en_US.ISO8859-1/relnotes/contrib.ent" + PUBLIC "-//FreeBSD//DOCUMENT Release Notes DocBook Language Neutral Stylesheet//EN" "release.dsl" Modified: user/edwin/releasenotes/releng-6.1/release/doc/share/sgml/catalog ============================================================================== --- user/edwin/releasenotes/releng-6.1/release/doc/share/sgml/catalog Fri Oct 17 23:23:50 2008 (r184004) +++ user/edwin/releasenotes/releng-6.1/release/doc/share/sgml/catalog Fri Oct 17 23:26:44 2008 (r184005) @@ -6,6 +6,9 @@ PUBLIC "-//FreeBSD//ENTITIES Release Specification//EN" "release.ent" +PUBLIC "-//FreeBSD//ENTITIES Release Contrib Set//EN" + "../../en_US.ISO8859-1/relnotes/contrib.ent" + PUBLIC "-//FreeBSD//DOCUMENT Release Notes DocBook Language Neutral Stylesheet//EN" "release.dsl" Modified: user/edwin/releasenotes/releng-6.2/release/doc/share/sgml/catalog ============================================================================== --- user/edwin/releasenotes/releng-6.2/release/doc/share/sgml/catalog Fri Oct 17 23:23:50 2008 (r184004) +++ user/edwin/releasenotes/releng-6.2/release/doc/share/sgml/catalog Fri Oct 17 23:26:44 2008 (r184005) @@ -6,6 +6,9 @@ PUBLIC "-//FreeBSD//ENTITIES Release Specification//EN" "release.ent" +PUBLIC "-//FreeBSD//ENTITIES Release Contrib Set//EN" + "../../en_US.ISO8859-1/relnotes/contrib.ent" + PUBLIC "-//FreeBSD//DOCUMENT Release Notes DocBook Language Neutral Stylesheet//EN" "release.dsl" Modified: user/edwin/releasenotes/releng-6.3/release/doc/share/sgml/catalog ============================================================================== --- user/edwin/releasenotes/releng-6.3/release/doc/share/sgml/catalog Fri Oct 17 23:23:50 2008 (r184004) +++ user/edwin/releasenotes/releng-6.3/release/doc/share/sgml/catalog Fri Oct 17 23:26:44 2008 (r184005) @@ -6,6 +6,9 @@ PUBLIC "-//FreeBSD//ENTITIES Release Specification//EN" "release.ent" +PUBLIC "-//FreeBSD//ENTITIES Release Contrib Set//EN" + "../../en_US.ISO8859-1/relnotes/contrib.ent" + PUBLIC "-//FreeBSD//DOCUMENT Release Notes DocBook Language Neutral Stylesheet//EN" "release.dsl" Modified: user/edwin/releasenotes/releng-6.4/release/doc/share/sgml/catalog ============================================================================== --- user/edwin/releasenotes/releng-6.4/release/doc/share/sgml/catalog Fri Oct 17 23:23:50 2008 (r184004) +++ user/edwin/releasenotes/releng-6.4/release/doc/share/sgml/catalog Fri Oct 17 23:26:44 2008 (r184005) @@ -6,6 +6,9 @@ PUBLIC "-//FreeBSD//ENTITIES Release Specification//EN" "release.ent" +PUBLIC "-//FreeBSD//ENTITIES Release Contrib Set//EN" + "../../en_US.ISO8859-1/relnotes/contrib.ent" + PUBLIC "-//FreeBSD//DOCUMENT Release Notes DocBook Language Neutral Stylesheet//EN" "release.dsl" Modified: user/edwin/releasenotes/releng-7.0/release/doc/en_US.ISO8859-1/relnotes/article.sgml ============================================================================== --- user/edwin/releasenotes/releng-7.0/release/doc/en_US.ISO8859-1/relnotes/article.sgml Fri Oct 17 23:23:50 2008 (r184004) +++ user/edwin/releasenotes/releng-7.0/release/doc/en_US.ISO8859-1/relnotes/article.sgml Fri Oct 17 23:26:44 2008 (r184005) @@ -5,6 +5,9 @@ %release; + +%contrib; + @@ -1455,6 +1458,12 @@ mdconfig_md1="-t vnode -f /var/foo.img"< Contributed Software + &contrib.softwares; + + + + + Expected Contributed Software Intel ACPI-CA has been updated to 20070320. Modified: user/edwin/releasenotes/releng-7.0/release/doc/share/sgml/catalog ============================================================================== --- user/edwin/releasenotes/releng-7.0/release/doc/share/sgml/catalog Fri Oct 17 23:23:50 2008 (r184004) +++ user/edwin/releasenotes/releng-7.0/release/doc/share/sgml/catalog Fri Oct 17 23:26:44 2008 (r184005) @@ -6,6 +6,9 @@ PUBLIC "-//FreeBSD//ENTITIES Release Specification//EN" "release.ent" +PUBLIC "-//FreeBSD//ENTITIES Release Contrib Set//EN" + "../../en_US.ISO8859-1/relnotes/contrib.ent" + PUBLIC "-//FreeBSD//DOCUMENT Release Notes DocBook Language Neutral Stylesheet//EN" "release.dsl" Modified: user/edwin/releasenotes/stable-6/release/doc/share/sgml/catalog ============================================================================== --- user/edwin/releasenotes/stable-6/release/doc/share/sgml/catalog Fri Oct 17 23:23:50 2008 (r184004) +++ user/edwin/releasenotes/stable-6/release/doc/share/sgml/catalog Fri Oct 17 23:26:44 2008 (r184005) @@ -6,6 +6,9 @@ PUBLIC "-//FreeBSD//ENTITIES Release Specification//EN" "release.ent" +PUBLIC "-//FreeBSD//ENTITIES Release Contrib Set//EN" + "../../en_US.ISO8859-1/relnotes/contrib.ent" + PUBLIC "-//FreeBSD//DOCUMENT Release Notes DocBook Language Neutral Stylesheet//EN" "release.dsl" Modified: user/edwin/releasenotes/stable-7/release/doc/en_US.ISO8859-1/relnotes/article.sgml ============================================================================== --- user/edwin/releasenotes/stable-7/release/doc/en_US.ISO8859-1/relnotes/article.sgml Fri Oct 17 23:23:50 2008 (r184004) +++ user/edwin/releasenotes/stable-7/release/doc/en_US.ISO8859-1/relnotes/article.sgml Fri Oct 17 23:26:44 2008 (r184005) @@ -5,6 +5,9 @@ %release; + +%contrib; + @@ -261,6 +264,12 @@ Contributed Software + &contrib.softwares; + + + + + Expected Contributed Software AMD has been updated from 6.0.10 to 6.1.5. Modified: user/edwin/releasenotes/stable-7/release/doc/share/sgml/catalog ============================================================================== --- user/edwin/releasenotes/stable-7/release/doc/share/sgml/catalog Fri Oct 17 23:23:50 2008 (r184004) +++ user/edwin/releasenotes/stable-7/release/doc/share/sgml/catalog Fri Oct 17 23:26:44 2008 (r184005) @@ -6,6 +6,9 @@ PUBLIC "-//FreeBSD//ENTITIES Release Specification//EN" "release.ent" +PUBLIC "-//FreeBSD//ENTITIES Release Contrib Set//EN" + "../../en_US.ISO8859-1/relnotes/contrib.ent" + PUBLIC "-//FreeBSD//DOCUMENT Release Notes DocBook Language Neutral Stylesheet//EN" "release.dsl" From owner-svn-src-user@FreeBSD.ORG Fri Oct 17 23:28:01 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4822E1065686; Fri, 17 Oct 2008 23:28:01 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 37AAA8FC0C; Fri, 17 Oct 2008 23:28:01 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9HNS120001102; Fri, 17 Oct 2008 23:28:01 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9HNS17J001101; Fri, 17 Oct 2008 23:28:01 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200810172328.m9HNS17J001101@svn.freebsd.org> From: Edwin Groothuis Date: Fri, 17 Oct 2008 23:28:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184006 - user/edwin/releasenotes X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Oct 2008 23:28:01 -0000 Author: edwin Date: Fri Oct 17 23:28:00 2008 New Revision: 184006 URL: http://svn.freebsd.org/changeset/base/184006 Log: quickly test/build all trees Added: user/edwin/releasenotes/Makefile Added: user/edwin/releasenotes/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/edwin/releasenotes/Makefile Fri Oct 17 23:28:00 2008 (r184006) @@ -0,0 +1,21 @@ +# $FreeBSD$ + +DIRS=head +STABLE=7 6 +RELENG=7.0 6.4 6.3 6.2 6.1 6.0 + +build: +.for d in ${DIRS} ${STABLE:S/^/stable-/} ${RELENG:S/^/releng-/} + cd ${d}/release/doc/en_US.ISO8859-1/relnotes/; \ + make +.endfor + +html: + > links.html +.for d in ${DIRS} ${STABLE:S/^/stable-/} ${RELENG:S/^/releng-/} + A=$$(find ${d} -name article.html | egrep '(relnotes/article|i386)'); \ + echo "${d}
      " >> links.html +.endfor + +edit: + vi */release/doc/en_US*/relnotes/common/new.sgml */*/*/*/relnotes/article.sgml From owner-svn-src-user@FreeBSD.ORG Sat Oct 18 16:02:49 2008 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A4DE1065687; Sat, 18 Oct 2008 16:02:49 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 00E9E8FC1B; Sat, 18 Oct 2008 16:02:49 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9IG2m47020830; Sat, 18 Oct 2008 16:02:48 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9IG2moT020829; Sat, 18 Oct 2008 16:02:48 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <200810181602.m9IG2moT020829@svn.freebsd.org> From: Ulf Lilleengen Date: Sat, 18 Oct 2008 16:02:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184032 - user/lulf X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Oct 2008 16:02:49 -0000 Author: lulf Date: Sat Oct 18 16:02:48 2008 New Revision: 184032 URL: http://svn.freebsd.org/changeset/base/184032 Log: - Add my usr directory. Added: user/lulf/