From owner-svn-soc-all@FreeBSD.ORG Mon May 21 10:35:12 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id C787B106564A for ; Mon, 21 May 2012 10:35:10 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 21 May 2012 10:35:10 +0000 Date: Mon, 21 May 2012 10:35:10 +0000 From: scher@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120521103510.C787B106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r236058 - soc2012/scher/par_ports/head/Mk X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 May 2012 10:35:13 -0000 Author: scher Date: Mon May 21 10:35:10 2012 New Revision: 236058 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236058 Log: initial commit. Add Mk/* Added: soc2012/scher/par_ports/head/Mk/ soc2012/scher/par_ports/head/Mk/bsd.apache.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.autotools.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.cmake.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.commands.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.cran.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.database.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.destdir.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.drupal.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.efl.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.emacs.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.fpc.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.gcc.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.gecko.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.gnome.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.gnustep.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.gstreamer.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.java.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.kde.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.kde4.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.ldap.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.licenses.db.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.licenses.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.linux-apps.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.linux-rpm.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.local.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.lua.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.mail.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.ncurses.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.ocaml.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.octave.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.openssl.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.perl.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.php.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.pkgng.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.port.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.port.options.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.port.post.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.port.pre.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.port.subdir.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.python.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.qt.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.ruby.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.scons.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.sdl.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.sites.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.tcl.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.wx.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.xfce.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.xorg.mk (contents, props changed) soc2012/scher/par_ports/head/Mk/bsd.zenoss.mk (contents, props changed) Added: soc2012/scher/par_ports/head/Mk/bsd.apache.mk ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/scher/par_ports/head/Mk/bsd.apache.mk Mon May 21 10:35:10 2012 (r236058) @@ -0,0 +1,546 @@ +#-*- mode: makefile; tab-width: 4; -*- +# ex:ts=4 +# +# $FreeBSD: ports/Mk/bsd.apache.mk,v 1.35 2012/01/11 20:09:27 ohauer Exp $ +# +# bsd.apache.mk - Apache related macros. +# Author: Clement Laforet +# Author: Olli Hauer +# +# Please view me with 4 column tabs! + +# ========================================================================= +# Parameter APACHE_PORT (user controlled): +# +# The parameter APACHE_PORT can be used in /etc/make.conf to +# overwrite the default apache port. +# +# This parameter should never be used in the Makefile of a port! +# +# Example entry in /etc/make.conf: +# APACHE_PORT= www/apache22 +# +# To get a list of "possible" valid values execute the command: +# $> egrep 'apache[12]' ports/www/Makefile | awk '{print "www/" $3}' +# +# ========================================================================= +# +# This script will be included if one of the following parameter +# is defined in the Makefile of the port +# +# USE_APACHE - Set apache and apxs as build and run dependency +# USE_APACHE_BUILD - Set apache and apxs as build dependency +# USE_APACHE_RUN - Set apache and apxs as run dependency +# +# The following example is representative of all three possible +# parameters to use. +# +# Examples: +# USE_APACHE= 22 # specify exact version +# USE_APACHE= 20+ # specify [min] version, no [max] version +# USE_APACHE= 20-22 # specify [min]-[max] range +# USE_APACHE= -22 # specify [max] version, no [min] version +# +# Note: +# - If "+" is specified and no apache is installed, then +# ${DEFAULT_APACHE_VERSION} will be used. +# +# - Valid version numbers are specified in the variable +# APACHE_SUPPORTED_VERSION below +# +# - The following values for USE_APACHE are reserverd and only valid +# in apache-server ports! +# USE_APACHE= common20, and common22 +# +# +# The following variables can be used (ro) in ports Makefile +# ========================================================================= +# - APACHE_VERSION +# - APACHEETCDIR +# - APACHEINCLUDEDIR +# - APACHEMODDIR +# - DEFAULT_APACHE_VERSION +# +# +# Parameters for building third party apache modules: +# ========================================================================= +# - AP_FAST_BUILD # automatic module build +# +# - AP_GENPLIST # automatic PLIST generation plus add +# # the module disabled into httpd.conf +# # (only if no pkg-plist exist) +# +# - MODULENAME # default: ${PORTNAME} +# - SHORTMODNAME # default: ${MODULENAME:S/mod_//} +# - SRC_FILE # default: ${MODULENAME}.c +# +# + +.if !defined(Apache_Pre_Include) + +Apache_Pre_Include= bsd.apache.mk + +DEFAULT_APACHE_VERSION= 22 +APACHE_SUPPORTED_VERSION= 22 20 # preferred version first + +# Print warnings +_ERROR_MSG= : Error from bsd.apache.mk. + +# Important Note: +# Keep apache version in ascending order! +# The "+" sign is only valid as last sign, not between +# two versions or in combination with range! +.if defined(USE_APACHE) && !empty(USE_APACHE) +. if ${USE_APACHE:Mcommon*} != "" +AP_PORT_IS_SERVER= YES +. elif ${USE_APACHE:C/\-//:S/^20//:S/^22//:C/\+$//} == "" +AP_PORT_IS_MODULE= YES +. if ${USE_APACHE:C/\-//:S/^20//:S/^22//} == "+" +AP_PLUS= yes +. endif +. else +IGNORE= ${_ERROR_MSG} Illegal use of USE_APACHE ( ${USE_APACHE} ) +. endif +# Catch unknown apache versions and silly USE_APACHE constructs +. if empty(AP_PORT_IS_SERVER) && empty(AP_PORT_IS_MODULE) +IGNORE= ${_ERROR_MSG} Illegal use of USE_APACHE ( ${USE_APACHE} ) +. endif +# Catch USE_APACHE [min]-[max]+ +. if defined(AP_PLUS) && ${USE_APACHE:C/[.+0-9]//g} == "-" +IGNORE= ${_ERROR_MSG} Illegal use of USE_APACHE ( ${USE_APACHE} ) +. endif +.elif defined(USE_APACHE) +IGNORE= ${_ERROR_MSG} Illegal use of USE_APACHE ( no version specified ) +.endif # defined(USE_APACHE) + +# =============================================================== +.if defined(AP_PORT_IS_SERVER) +# For slave ports: +.if defined(SLAVE_DESIGNED_FOR) && ${PORTVERSION} != ${SLAVE_DESIGNED_FOR} +IGNORE= Sorry, ${SLAVENAME} and ${PORTNAME} versions are out of sync ${PORTVERSION} != ${SLAVE_DESIGNED_FOR} +.endif + +.if defined(SLAVE_PORT_MODULES) +DEFAULT_MODULES_CATEGORIES+= SLAVE_PORT +ALL_MODULES_CATEGORIES+= SLAVE_PORT +.endif + +# Module selection +.for category in ${DEFAULT_MODULES_CATEGORIES} +DEFAULT_MODULES+= ${${category}_MODULES} +WITH_${category}_MODULES= YES +.endfor + +.for category in ${ALL_MODULES_CATEGORIES} +AVAILABLE_MODULES+= ${${category}_MODULES} +.endfor + +# Setting "@comment " as default. +.for module in ${AVAILABLE_MODULES} +${module}_PLIST_SUB= "@comment " +.endfor + +# Configure +# dirty hacks to make sure all modules are disabled before we select them +.if ${USE_APACHE} == common13 +CONFIGURE_ARGS+= --disable-module="all" +.elif ${USE_APACHE} == common20 +CONFIGURE_ARGS+= --disable-access --disable-auth \ + --disable-charset-lite --disable-include \ + --disable-log-config --disable-env --disable-setenvif \ + --disable-mime --disable-status --disable-autoindex \ + --disable-asis --disable-cgid --disable-cgi \ + --disable-negotiation --disable-dir --disable-imap \ + --disable-actions --disable-userdir --disable-alias +.elif ${USE_APACHE} == common22 +CONFIGURE_ARGS+= --disable-authn-file --disable-authn-default \ + --disable-authz-host --disable-authz-groupfile \ + --disable-authz-user --disable-authz-default \ + --disable-auth-basic --disable-charset-lite \ + --disable-include --disable-log-config --disable-env \ + --disable-setenvif --disable-mime --disable-status \ + --disable-autoindex --disable-asis --disable-cgid \ + --disable-cgi --disable-negotiation --disable-dir \ + --disable-imagemap --disable-actions --disable-userdir \ + --disable-alias --disable-filter --disable-substitute \ + --disable-proxy --disable-proxy-connect \ + --disable-proxy-ftp --disable-proxy-http \ + --disable-proxy-ajp --disable-proxy-balancer \ + --disable-proxy-scgi --disable-reqtimeout +.endif + +.if defined(OPTIONS) && !(make(make-options-list)) +.for module in ${AVAILABLE_MODULES} +. if defined(WITH_${module:U}) +_APACHE_MODULES+= ${module} +. endif +. if defined(WITHOUT_${module:U}) +WITHOUT_MODULES+= ${module} +. endif +.endfor +.elif defined(WITH_MODULES) +_APACHE_MODULES+= ${WITH_MODULES} +.else +.for category in ${ALL_MODULES_CATEGORIES} +. if defined (WITHOUT_${category}_MODULES) || defined (WITH_CUSTOM_${category}) +. if defined(WITH_${category}_MODULES}) +. undef WITH_${category}_MODULES +. endif +. if defined (WITH_CUSTOM_${category}) +_APACHE_MODULES+= ${WITH_CUSTOM_${category}} +. endif +. elif defined(WITH_${category}_MODULES) +_APACHE_MODULES+= ${${category}_MODULES} +. endif +.endfor +.if defined(WITH_EXTRA_MODULES) +_APACHE_MODULES+= ${WITH_EXTRA_MODULES} +.endif +.endif + +.if !defined(WITH_STATIC_APACHE) +. if ${USE_APACHE:Mcommon2*} != "" +# FYI +#DYNAMIC_MODULES= so +CONFIGURE_ARGS+= --enable-so +. endif +.else +. if ${USE_APACHE:Mcommon2*} != "" +CONFIGURE_ARGS+= --disable-so +. endif +WITH_ALL_STATIC_MODULES= YES +.endif + +.if defined(WITH_SUEXEC) || defined(WITH_SUEXEC_MODULES) +. if ${USE_APACHE} == common13 +SUEXEC_CONFARGS= suexec +CONFIGURE_ARGS+= --enable-suexec +. elif ${USE_APACHE:Mcommon2*} != "" +_APACHE_MODULES+= ${SUEXEC_MODULES} +SUEXEC_CONFARGS= with-suexec +. endif + +# From now we're defaulting to apache 2.* +SUEXEC_DOCROOT?= ${PREFIX}/www/data +SUEXEC_USERDIR?= public_html +SUEXEC_SAFEPATH?= ${PREFIX}/bin:${LOCALBASE}/bin:/usr/bin:/bin +SUEXEC_LOGFILE?= /var/log/httpd-suexec.log +SUEXEC_UIDMIN?= 1000 +SUEXEC_GIDMIN?= 1000 +SUEXEC_CALLER?= ${WWWOWN} +CONFIGURE_ARGS+= --${SUEXEC_CONFARGS}-caller=${SUEXEC_CALLER} \ + --${SUEXEC_CONFARGS}-uidmin=${SUEXEC_UIDMIN} \ + --${SUEXEC_CONFARGS}-gidmin=${SUEXEC_GIDMIN} \ + --${SUEXEC_CONFARGS}-userdir="${SUEXEC_USERDIR}" \ + --${SUEXEC_CONFARGS}-docroot="${SUEXEC_DOCROOT}" \ + --${SUEXEC_CONFARGS}-safepath="${SUEXEC_SAFEPATH}" \ + --${SUEXEC_CONFARGS}-logfile="${SUEXEC_LOGFILE}" +. if ${USE_APACHE:Mcommon2*} != "" +CONFIGURE_ARGS+= --${SUEXEC_CONFARGS}-bin="${PREFIX}/sbin/suexec" +. endif + +. if defined(WITH_SUEXEC_UMASK) +CONFIGURE_ARGS+= --${SUEXEC_CONFARGS}-umask=${SUEXEC_UMASK} +. endif +.endif + +.if !defined(WITHOUT_MODULES) +APACHE_MODULES= ${_APACHE_MODULES} +.else +APACHE_MODULES!= \ + for module in ${_APACHE_MODULES}; do \ + ${ECHO_CMD} ${WITHOUT_MODULES} | ${GREP} -wq $${module} 2> /dev/null || \ + ${ECHO_CMD} $${module}; \ + done +.endif + +.if defined(WITH_STATIC_MODULES) +. if ${USE_APACHE} == common13 +STATIC_MODULE_CONFARG= --enable-module=$${module} +DSO_MODULE_CONFARG= --enable-module=$${module} --enable-shared=$${module} +. else +STATIC_MODULE_CONFARG= --enable-$${module} +DSO_MODULE_CONFARG= --enable-$${module}=shared +. endif +_CONFIGURE_ARGS!= \ + for module in ${APACHE_MODULES} ; do \ + ${ECHO_CMD} ${WITH_STATIC_MODULES} | \ + ${GREP} -wq $${module} 2> /dev/null ; \ + if [ "$${?}" = "0" ] ; then \ + ${ECHO_CMD} "${STATIC_MODULE_CONFARG}"; \ + else \ + ${ECHO_CMD} "${DSO_MODULE_CONFARG}"; \ + fi; done +CONFIGURE_ARGS+= ${_CONFIGURE_ARGS} +.elif defined(WITH_STATIC_APACHE) || defined(WITH_ALL_STATIC_MODULES) +WITH_STATIC_MODULES= ${APACHE_MODULES} +. if ${USE_APACHE} == common13 +. for module in ${APACHE_MODULES} +CONFIGURE_ARGS+= --enable-module=${module} +. endfor +. else +CONFIGURE_ARGS+= --enable-modules="${APACHE_MODULES}" +. endif +.else +. if ${USE_APACHE} == common13 +. for module in ${APACHE_MODULES} +CONFIGURE_ARGS+= --enable-module=${module} --enable-shared=${module} +. endfor +. else +CONFIGURE_ARGS+= --enable-mods-shared="${APACHE_MODULES}" +. endif +.endif + +.if defined(WITH_STATIC_MODULES) +_SHARED_MODULES!= \ + for module in ${APACHE_MODULES} ; do \ + ${ECHO_CMD} ${WITH_STATIC_MODULES} | ${GREP} -wq $${module} 2> /dev/null || \ + ${ECHO_CMD} $${module}; \ + done +SHARED_MODULES= ${_SHARED_MODULES} +.elif !defined(WITH_ALL_STATIC_MODULES) +SHARED_MODULES= ${APACHE_MODULES} +.endif + +.for module in ${SHARED_MODULES} +${module}_PLIST_SUB= "" +.endfor + +.for module in ${AVAILABLE_MODULES} +PLIST_SUB+= MOD_${module:U}=${${module}_PLIST_SUB} +.endfor +#### End of AP_PORT_IS_SERVER #### + +# =============================================================== +.elif defined(AP_PORT_IS_MODULE) || defined(USE_APACHE_RUN) || defined(USE_APACHE_BUILD) +APXS?= ${LOCALBASE}/sbin/apxs +HTTPD?= ${LOCALBASE}/sbin/httpd + +MODULENAME?= ${PORTNAME} +SHORTMODNAME?= ${MODULENAME:S/mod_//} +SRC_FILE?= ${MODULENAME}.c + +.if exists(${HTTPD}) +_APACHE_VERSION!= ${HTTPD} -V | ${SED} -ne 's/^Server version: Apache\/\([0-9]\)\.\([0-9]*\).*/\1\2/p' +. if ${_APACHE_VERSION} > 13 +APACHE_MPM!= ${APXS} -q MPM_NAME +. endif +.elif defined(APACHE_PORT) +_APACHE_VERSION!= ${ECHO_CMD} ${APACHE_PORT} | ${SED} -ne 's,.*/apache\([0-9]*\).*,\1,p' +.endif + +.if defined(USE_APACHE) +_USE_APACHE:= ${USE_APACHE} +.elif defined(USE_APACHE_BUILD) +_USE_APACHE:= ${USE_APACHE_BUILD} +.elif defined(USE_APACHE_RUN) +_USE_APACHE:= ${USE_APACHE_RUN} +.endif + +_APACHE_VERSION_CHECK:= ${_USE_APACHE:C/^([1-9][0-9])$/\1-\1/} +_APACHE_VERSION_MINIMUM_TMP:= ${_APACHE_VERSION_CHECK:C/([1-9][0-9])[-+].*/\1/} +_APACHE_VERSION_MINIMUM:= ${_APACHE_VERSION_MINIMUM_TMP:M[1-9][0-9]} +_APACHE_VERSION_MAXIMUM_TMP:= ${_APACHE_VERSION_CHECK:C/.*-([1-9][0-9])/\1/} +_APACHE_VERSION_MAXIMUM:= ${_APACHE_VERSION_MAXIMUM_TMP:M[1-9][0-9]} + +.if defined(_APACHE_VERSION) +# Validate Apache version whether it meets USE_APACHE version restriction. +. if !empty(_APACHE_VERSION_MINIMUM) && (${_APACHE_VERSION} < ${_APACHE_VERSION_MINIMUM}) +_APACHE_VERSION_NONSUPPORTED= ${_APACHE_VERSION_MINIMUM} at least +. elif !empty(_APACHE_VERSION_MAXIMUM) && (${_APACHE_VERSION} > ${_APACHE_VERSION_MAXIMUM}) +_APACHE_VERSION_NONSUPPORTED= ${_APACHE_VERSION_MAXIMUM} at most +. endif + +. if defined(_APACHE_VERSION_NONSUPPORTED) && !defined(AP_IGNORE_VERSION_CHECK) +IGNORE= ${_ERROR_MSG} apache${_APACHE_VERSION} is installed (or APACHE_PORT is defined) and port requires apache${_APACHE_VERSION_NONSUPPORTED} +. endif +.else # defined(_APACHE_VERSION) +. for ver in ${APACHE_SUPPORTED_VERSION} +__VER= ${ver} +. if !defined(_APACHE_VERSION) && \ + !(!empty(_APACHE_VERSION_MINIMUM) && ( ${__VER} < ${_APACHE_VERSION_MINIMUM} )) && \ + !(!empty(_APACHE_VERSION_MAXIMUM) && ( ${__VER} > ${_APACHE_VERSION_MAXIMUM} )) +_APACHE_VERSION= ${ver} +. endif +. endfor +.endif # defined(_APACHE_VERSION) + +APACHE_VERSION:= ${_APACHE_VERSION} + +.if exists(${APXS}) +APXS_PREFIX!= ${APXS} -q prefix 2> /dev/null || echo NULL +. if ${APXS_PREFIX} == NULL +IGNORE= : Your apache does not support DSO modules +. endif +. if defined(AP_GENPLIST) && ${APXS_PREFIX} != ${PREFIX} +IGNORE?= PREFIX must be equal to APXS_PREFIX. +. endif +.endif + +.if ${APACHE_VERSION} == 20 +AP_BUILDEXT= la +APACHEMODDIR= libexec/apache2 +APACHEINCLUDEDIR=include/apache2 +APACHEETCDIR= etc/apache2 +APACHE_PORT?= www/apache${APACHE_VERSION} +.elif ${APACHE_VERSION} >= 22 +AP_BUILDEXT= la +APACHEMODDIR= libexec/apache${APACHE_VERSION} +APACHEINCLUDEDIR=include/apache${APACHE_VERSION} +APACHEETCDIR= etc/apache${APACHE_VERSION} +APACHE_PORT?= www/apache${APACHE_VERSION} +.else +AP_BUILDEXT= so +APACHEMODDIR= libexec/apache +APACHEINCLUDEDIR=include/apache +APACHEETCDIR= etc/apache +APACHE_PORT?= www/apache13 +.endif + +PLIST_SUB+= APACHEMODDIR="${APACHEMODDIR}" \ + APACHEINCLUDEDIR="${APACHEINCLUDEDIR}" \ + APACHEETCDIR="${APACHEETCDIR}" + +APACHE_PKGNAMEPREFIX= ap${APACHE_VERSION}- +.if defined(AP_FAST_BUILD) +PKGNAMEPREFIX?= ${APACHE_PKGNAMEPREFIX} +.endif + +.if defined(USE_APACHE) || defined(USE_APACHE_BUILD) +BUILD_DEPENDS+= ${APXS}:${PORTSDIR}/${APACHE_PORT} +.endif + +.if defined(USE_APACHE) || defined(USE_APACHE_RUN) +RUN_DEPENDS+= ${APXS}:${PORTSDIR}/${APACHE_PORT} +.endif + +PLIST_SUB+= AP_NAME="${SHORTMODNAME}" +PLIST_SUB+= AP_MODULE="${MODULENAME}.so" + +.if defined(AP_GENPLIST) +PLIST?= ${WRKDIR}/ap-plist +.endif + +.if defined(AP_INC) +AP_EXTRAS+= -I ${AP_INC} +.endif +.if defined(AP_LIB) +AP_EXTRAS+= -L ${AP_LIB} +.endif + +.endif # End of AP_PORT_IS_SERVER / AP_PORT_IS_MOULE +.endif # End of !Apache_Pre_Include + +# =============================================================== +.if defined(_POSTMKINCLUDED) && !defined(Apache_Post_Include) +Apache_Post_Include= bsd.apache.mk + +.if defined(USE_APACHE_RUN) && !empty(USE_APACHE_RUN) +. if ${USE_APACHE_RUN:C/\-//:S/^20//:S/^22//:C/\+$//} != "" +IGNORE= ${_ERROR_MSG} Illegal use of USE_APACHE_RUN ( ${USE_APACHE_RUN} ) +. endif +.elif defined(USE_APACHE_RUN) +IGNORE= ${_ERROR_MSG} Illegal use of USE_APACHE_RUN ( no valid version specified ) +.endif + +.if defined(USE_APACHE_BUILD) && !empty(USE_APACHE_BUILD) +. if ${USE_APACHE_BUILD:C/\-//:S/^20//:S/^22//:C/\+$//} != "" +IGNORE= ${_ERROR_MSG} Illegal use of USE_APACHE_BUILD ( ${USE_APACHE_BUILD} ) +. endif +.elif defined(USE_APACHE_BUILD) +IGNORE= ${_ERROR_MSG} Illegal use of USE_APACHE_BUILD ( no valid version specified ) +.endif + +# Check if USE_APACHE(_BUILD|_RUN) are mixed together +.if defined(USE_APACHE) && ( defined(USE_APACHE_BUILD) || defined(USE_APACHE_RUN) ) +IGNORE= ${_ERROR_MSG} specify only one of: USE_APACHE USE_APACHE_BUILD USE_APACHE_RUN +.elif defined(USE_APACHE_BUILD) && defined(USE_APACHE_RUN) +IGNORE= ${_ERROR_MSG} use USE_APACHE instead of USE_APACHE_BUILD and USE_APACHE_RUN together +.endif + +.if defined(AP_PORT_IS_SERVER) +.if !target(print-closest-mirrors) +print-closest-mirrors: + @${ECHO_MSG} -n "Fetching list of nearest mirror: " >&2 + @MIRRORS=`${FETCH_CMD} -T 30 -qo - http://www.apache.org/dyn/closer.cgi/httpd/ 2> /dev/null\ + | ${GREP} /httpd/ | ${SED} 's/.*href="\(.*\)">&2; if [ "x$$MIRRORS" != "x" ]; then \ + ${ECHO_MSG} -n "MASTER_SITE_APACHE_HTTPD?= ";\ + ${ECHO_MSG} $$MIRRORS; else \ + ${ECHO_MSG} "No mirrors found!">&2 ; fi +.endif + +.if !target(show-categories) +show-categories: +.for category in ${ALL_MODULES_CATEGORIES} + @${ECHO_MSG} "${category} contains these modules:" + @${ECHO_MSG} " ${${category}_MODULES}" +.endfor +.endif + +.if !target(show-modules) +show-modules: + @for module in ${AVAILABLE_MODULES} ; do \ + ${ECHO_MSG} -n "$${module}: "; \ + if ${ECHO_CMD} ${APACHE_MODULES} | ${GREP} -wq $${module} 2> /dev/null ; \ + then \ + ${ECHO_CMD} -n "enabled "; \ + if ${ECHO_CMD} ${WITH_STATIC_MODULES} | ${GREP} -wq $${module} 2> /dev/null ; then \ + ${ECHO_CMD} "(static)" ; \ + else \ + ${ECHO_CMD} "(shared)" ;\ + fi;\ + else \ + ${ECHO_CMD} disabled ;\ + fi;\ + done +.endif + +.if !target(make-options-list) +make-options-list: + @${ECHO_CMD} OPTIONS+= \\; + @for module in ${AVAILABLE_MODULES} ; do \ + if ${ECHO_CMD} ${APACHE_MODULES} | ${GREP} -wq $${module} 2> /dev/null ; \ + then \ + ${PRINTF} "\t `${ECHO_CMD} $${module} | ${TR} '[:lower:]' '[:upper:]'` \"Enable mod_$${module}\" ON \\"; \ + ${ECHO_CMD}; \ + else \ + ${PRINTF} "\t `${ECHO_CMD} $${module} | ${TR} '[:lower:]' '[:upper:]'` \"Enable mod_$${module}\" OFF \\";\ + ${ECHO_CMD}; \ + fi;\ + done; \ + ${ECHO_CMD}; +.endif + +.elif defined(AP_PORT_IS_MODULE) + +.if defined(AP_FAST_BUILD) +.if !target(ap-gen-plist) +ap-gen-plist: +.if defined(AP_GENPLIST) +. if !exists(${PLIST}) + @${ECHO} "===> Generating apache plist" +# apache22/20 + @${ECHO} "@unexec ${SED} -i '' -E '/LoadModule[[:blank:]]+%%AP_NAME%%_module/d' %D/%%APACHEETCDIR%%/httpd.conf" >> ${PLIST} + @${ECHO} "%%APACHEMODDIR%%/%%AP_MODULE%%" >> ${PLIST} + @${ECHO} "@exec %D/sbin/apxs -e -A -n %%AP_NAME%% %D/%F" >> ${PLIST} + @${ECHO} "@unexec echo \"Don't forget to remove all ${MODULENAME}-related directives in your httpd.conf\"">> ${PLIST} +. endif +.else + @${DO_NADA} +.endif +.endif + +.if !target(do-build) +do-build: ap-gen-plist + @cd ${WRKSRC} && ${APXS} -c ${AP_EXTRAS} -o ${MODULENAME}.${AP_BUILDEXT} ${SRC_FILE} +.endif + +.if !target(do-install) +do-install: + @${APXS} -i -A -n ${SHORTMODNAME} ${WRKSRC}/${MODULENAME}.${AP_BUILDEXT} +.endif +.endif +.endif +.endif # defined(_POSTMKINCLUDED) && !defined(Apache_Post_Include) Added: soc2012/scher/par_ports/head/Mk/bsd.autotools.mk ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/scher/par_ports/head/Mk/bsd.autotools.mk Mon May 21 10:35:10 2012 (r236058) @@ -0,0 +1,418 @@ +#-*- mode: makefile; tab-width: 4; -*- +# ex:ts=4 +# +# $FreeBSD: ports/Mk/bsd.autotools.mk,v 1.41 2012/05/11 20:38:01 ade Exp $ +# +# Please view me with 4 column tabs! +# +# IMPORTANT NOTE: +# Before making any changes to this file, contact portmgr to arrange +# for an experimental ports run. +# Untested commits will almost certainly break the tree, incur the +# wrath of countless folks, and be unceremoniously backed out by +# the maintainer and/or portmgr. + +Autotools_Include_MAINTAINER= autotools@FreeBSD.org + +#--------------------------------------------------------------------------- +# USE_AUTOTOOLS= tool[:env] ... +# +# 'tool' can currently be one of the following: +# autoconf, autoheader +# autoconf213, autoheader213 (legacy version) +# automake, aclocal +# automake14, aclocal14 (legacy version) +# libtool, libtoolize, libltdl +# +# ':env' is used to specify that the environmental variables are needed +# but the relevant tool should NOT be run as part of the +# 'run-autotools' target +# +# In addition, these variables can be set in the port Makefile to be +# passed to the relevant tools: +# +# AUTOMAKE_ARGS=... +# - Extra arguments passed to automake during configure step +# +# ACLOCAL_ARGS=... +# - Arguments passed to aclocal during configure step +# +# AUTOCONF_ARGS=... +# - Extra arguments passed to autoconf during configure step +# +# AUTOHEADER_ARGS=... +# - Extra arguments passed to autoheader during configure step +# +# LIBTOOLFLAGS= +# - Arguments passed to libtool during configure step +# +# LIBTOOLFILES= +# - A list of files to patch during libtool pre-configuration +# +# AUTOTOOLSFILES= +# - A list of files to further patch with derived information +# post-patching to reduce churn during component updates +# +#--------------------------------------------------------------------------- + +#--------------------------------------------------------------------------- +# NO USER-SERVICABLE PARTS BEYOND THIS POINT. REALLY. WE MEAN IT. +#--------------------------------------------------------------------------- + +# Known autotools components +_AUTOTOOLS_ALL= autoconf autoheader autoconf213 autoheader213 \ + automake aclocal automake14 aclocal14 \ + libtool libtoolize libltdl + +# Incompatible autotools mixing +_AUTOTOOLS_IGN_autoconf= autoconf213 autoheader213 +_AUTOTOOLS_IGN_autoheader= autoconf213 autoheader213 +_AUTOTOOLS_IGN_autoconf213= autoconf autoheader +_AUTOTOOLS_IGN_autoheader213= autoconf autoheader +_AUTOTOOLS_IGN_automake= automake14 aclocal14 +_AUTOTOOLS_IGN_aclocal= automake14 aclocal14 +_AUTOTOOLS_IGN_automake14= automake aclocal +_AUTOTOOLS_IGN_aclocal14= automake aclocal + +#--------------------------------------------------------------------------- +# Primary magic to break out the USE_AUTOTOOLS stanza into something +# more useful, along with substantial error checking to prevent +# foot-shooting +#--------------------------------------------------------------------------- + +# Break out the stanza +# +_AUTOTOOLS_IMPL= +.for stanza in ${USE_AUTOTOOLS} +_AUTOTOOLS_IMPL+= ${stanza:C/^([^:]+).*/\1/} +_AUTOTOOL_${stanza:C/^([^:]+).*/\1/}= ${stanza:C/^[^:]+:([^:]+)/\1/} +.endfor + +# Verify each component, normalize +# +_AUTOTOOLS_NOCOMP= +.for component in ${_AUTOTOOLS_IMPL} +. if ${_AUTOTOOLS_ALL:M${component}}=="" +_AUTOTOOLS_NOCOMP+= ${component} +. endif +. if ${_AUTOTOOL_${component}}==${component} +_AUTOTOOL_${component}= yes +. elsif ${_AUTOTOOL_${component}}!="env" && ${_AUTOTOOL_${component}}!="yes" +_AUTOTOOLS_BADCOMP+= ${component}:${_AUTOTOOL_${component}} +. endif +.endfor +.if !empty(_AUTOTOOLS_NOCOMP) +IGNORE+= Unknown autotool: ${_AUTOTOOLS_NOCOMP:O:u} +.endif + +# Check for anything other than 'yes' or 'env' +# +_AUTOTOOLS_BADCOMP= +.for component in ${_AUTOTOOLS_IMPL} +. if ${_AUTOTOOL_${component}}!="env" && ${_AUTOTOOL_${component}}!="yes" +_AUTOTOOLS_BADCOMP+= ${component}:${_AUTOTOOL_${component}} +. endif +.endfor +.if !empty(_AUTOTOOLS_BADCOMP) +IGNORE+= Bad autotool stanza: ${_AUTOTOOLS_BADCOMP:O:u} +.endif + +# Check for incompatible mixes of components +# +_AUTOTOOLS_IGN= +.for component in ${_AUTOTOOLS_IMPL} +. for ignore in ${_AUTOTOOLS_IGN_${component}} +. if defined(_AUTOTOOL_${ignore}) +_AUTOTOOLS_IGN+= ${component} +. endif +. endfor +.endfor +.if !empty(_AUTOTOOLS_IGN) +IGNORE+= Incompatible autotools: ${_AUTOTOOLS_IGN:O:u} +.endif + +#--------------------------------------------------------------------------- +# automake and aclocal +#--------------------------------------------------------------------------- + +.if defined(_AUTOTOOL_aclocal) && ${_AUTOTOOL_aclocal} == "yes" +_AUTOTOOL_automake?= env +_AUTOTOOL_rule_aclocal= yes +GNU_CONFIGURE= yes +.endif + +.if defined(_AUTOTOOL_automake) +AUTOMAKE_VERSION= 1.12 +AUTOMAKE_APIVER= 1.12 +AUTOMAKE_PORT= devel/automake + +. if ${_AUTOTOOL_automake} == "yes" +_AUTOTOOL_rule_automake= yes +GNU_CONFIGURE?= yes +. endif +.endif + +.if defined(_AUTOTOOL_aclocal14) && ${_AUTOTOOL_aclocal14} == "yes" +_AUTOTOOL_automake14?= env +_AUTOTOOL_rule_aclocal14= yes +GNU_CONFIGURE?= yes +.endif + +.if defined(_AUTOTOOL_automake14) +AUTOMAKE_VERSION= 1.4 +AUTOMAKE_APIVER= 1.4.6 +AUTOMAKE_PORT= devel/automake14 +AUTOMAKE_ARGS+= -i # backwards compatibility shim + +. if ${_AUTOTOOL_automake14} == "yes" +_AUTOTOOL_rule_automake= yes +GNU_CONFIGURE?= yes +. endif +.endif + +.if defined(AUTOMAKE_VERSION) +AUTOMAKE= ${LOCALBASE}/bin/automake-${AUTOMAKE_VERSION} +AUTOMAKE_DIR= ${LOCALBASE}/share/automake-${AUTOMAKE_VERSION} +ACLOCAL= ${LOCALBASE}/bin/aclocal-${AUTOMAKE_VERSION} +ACLOCAL_DIR= ${LOCALBASE}/share/aclocal-${AUTOMAKE_VERSION} + +. if defined(_AUTOTOOL_aclocal) || defined(_AUTOTOOL_aclocal14) +ACLOCAL_ARGS?= --acdir=${ACLOCAL_DIR} +. endif + +AUTOMAKE_VARS= AUTOMAKE=${AUTOMAKE} \ + AUTOMAKE_DIR=${AUTOMAKE_DIR} \ + AUTOMAKE_VERSION=${AUTOMAKE_VERSION} \ + AUTOMAKE_APIVER=${AUTOMAKE_APIVER} \ + ACLOCAL=${ACLOCAL} \ + ACLOCAL_DIR=${ACLOCAL_DIR} + +AUTOMAKE_DEPENDS= ${AUTOMAKE}:${PORTSDIR}/${AUTOMAKE_PORT} +BUILD_DEPENDS+= ${AUTOMAKE_DEPENDS} +.endif + +#--------------------------------------------------------------------------- +# autoconf and autoheader +#--------------------------------------------------------------------------- + +.if defined(_AUTOTOOL_autoheader) && ${_AUTOTOOL_autoheader} == "yes" +_AUTOTOOL_autoconf= yes +_AUTOTOOL_rule_autoheader= yes +GNU_CONFIGURE?= yes +.endif + +.if defined(_AUTOTOOL_autoconf) +AUTOCONF_VERSION= 2.69 +AUTOCONF_PORT= devel/autoconf + +. if ${_AUTOTOOL_autoconf} == "yes" +_AUTOTOOL_rule_autoconf= yes +GNU_CONFIGURE?= yes +. endif +.endif + +.if defined(_AUTOTOOL_autoheader213) && ${_AUTOTOOL_autoheader213} == "yes" +_AUTOTOOL_autoconf213= yes +_AUTOTOOL_rule_autoheader= yes +GNU_CONFIGURE?= yes +.endif + +.if defined(_AUTOTOOL_autoconf213) +AUTOCONF_VERSION= 2.13 +AUTOCONF_PORT= devel/autoconf213 +AUTOM4TE= ${FALSE} # doesn't exist here + +. if ${_AUTOTOOL_autoconf213} == "yes" +_AUTOTOOL_rule_autoconf= yes +GNU_CONFIGURE?= yes +. endif +.endif + +.if defined(AUTOCONF_VERSION) +AUTOCONF= ${LOCALBASE}/bin/autoconf-${AUTOCONF_VERSION} +AUTOCONF_DIR= ${LOCALBASE}/share/autoconf-${AUTOCONF_VERSION} +AUTOHEADER= ${LOCALBASE}/bin/autoheader-${AUTOCONF_VERSION} +AUTOIFNAMES= ${LOCALBASE}/bin/ifnames-${AUTOCONF_VERSION} +AUTOM4TE?= ${LOCALBASE}/bin/autom4te-${AUTOCONF_VERSION} +AUTORECONF= ${LOCALBASE}/bin/autoreconf-${AUTOCONF_VERSION} +AUTOSCAN= ${LOCALBASE}/bin/autoscan-${AUTOCONF_VERSION} +AUTOUPDATE= ${LOCALBASE}/bin/autoupdate-${AUTOCONF_VERSION} + +AUTOCONF_VARS= AUTOCONF=${AUTOCONF} \ + AUTOCONF_DIR=${AUTOCONF_DIR} \ + AUTOHEADER=${AUTOHEADER} \ + AUTOIFNAMES=${AUTOIFNAMES} \ + AUTOM4TE=${AUTOM4TE} \ + AUTORECONF=${AUTORECONF} \ + AUTOSCAN=${AUTOSCAN} \ + AUTOUPDATE=${AUTOUPDATE} \ + AUTOCONF_VERSION=${AUTOCONF_VERSION} + +AUTOCONF_DEPENDS= ${AUTOCONF}:${PORTSDIR}/${AUTOCONF_PORT} +BUILD_DEPENDS+= ${AUTOCONF_DEPENDS} +.endif + +#--------------------------------------------------------------------------- +# libltdl +#--------------------------------------------------------------------------- + +.if defined(_AUTOTOOL_libltdl) +LIB_DEPENDS+= ltdl.7:${PORTSDIR}/devel/libltdl +.endif + +#--------------------------------------------------------------------------- +# libtool/libtoolize +#--------------------------------------------------------------------------- + +.if defined(_AUTOTOOL_libtool) || defined(_AUTOTOOL_libtoolize) +LIBTOOL_VERSION= 2.4 +LIBTOOL_PORT= devel/libtool + +. if defined(_AUTOTOOL_libtool) && ${_AUTOTOOL_libtool} == "yes" +_AUTOTOOL_rule_libtool= yes +GNU_CONFIGURE?= yes +. endif +. if defined(_AUTOTOOL_libtoolize) && ${_AUTOTOOL_libtoolize} == "yes" +_AUTOTOOL_rule_libtoolize= yes +GNU_CONFIGURE?= yes +. endif + +.endif + +.if defined(LIBTOOL_VERSION) +LIBTOOL= ${LOCALBASE}/bin/libtool +LIBTOOLIZE= ${LOCALBASE}/bin/libtoolize +LIBTOOL_LIBEXECDIR= ${LOCALBASE}/libexec/libtool +LIBTOOL_SHAREDIR= ${LOCALBASE}/share/libtool +LIBTOOL_M4= ${LOCALBASE}/share/aclocal/libtool.m4 +LTMAIN= ${LOCALBASE}/share/libtool/config/ltmain.sh + +LIBTOOL_VARS= LIBTOOL=${LIBTOOL} \ + LIBTOOLIZE=${LIBTOOLIZE} \ + LIBTOOL_LIBEXECDIR=${LIBTOOL_LIBEXECDIR} \ + LIBTOOL_SHAREDIR=${LIBTOOL_SHAREDIR} \ + LIBTOOL_M4=${LIBTOOL_M4} \ + LTMAIN=${LTMAIN} + +LIBTOOLFLAGS?= # default to empty + +. if defined(_AUTOTOOL_rule_autoconf) || defined(_AUTOTOOL_rule_autoconf213) +LIBTOOLFILES?= aclocal.m4 +. elif defined(_AUTOTOOL_rule_libtool) +LIBTOOLFILES?= ${CONFIGURE_SCRIPT} +. endif + +LIBTOOL_DEPENDS= libtool>=2.4:${PORTSDIR}/${LIBTOOL_PORT} +BUILD_DEPENDS+= ${LIBTOOL_DEPENDS} +.endif + +#--------------------------------------------------------------------------- +# Add to the environment +#--------------------------------------------------------------------------- + +AUTOTOOLS_VARS= ${AUTOMAKE_VARS} ${AUTOCONF_VARS} ${LIBTOOL_VARS} + +.if defined(AUTOTOOLS_VARS) && !empty(AUTOTOOLS_VARS) +. for var in AUTOTOOLS CONFIGURE MAKE SCRIPTS +${var:U}_ENV+= ${AUTOTOOLS_VARS} +. endfor +.endif + +#--------------------------------------------------------------------------- +# Make targets +#--------------------------------------------------------------------------- + +.if !target(run-autotools) +.ORDER: run-autotools run-autotools-aclocal \ + patch-autotools-libtool run-autotools-autoheader \ + run-autotools-libtoolize run-autotools-autoconf \ + run-autotools-automake + +run-autotools:: run-autotools-aclocal \ + patch-autotools-libtool run-autotools-autoheader \ + run-autotools-libtoolize run-autotools-autoconf \ + run-autotools-automake +.endif + +.if !target(run-autotools-aclocal) +run-autotools-aclocal: +. if defined(_AUTOTOOL_rule_aclocal) + @(cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${ACLOCAL} \ + ${ACLOCAL_ARGS}) +. else + @${DO_NADA} +. endif +.endif + +.if !target(run-autotools-automake) +run-autotools-automake: +. if defined(_AUTOTOOL_rule_automake) + @(cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${AUTOMAKE} \ + ${AUTOMAKE_ARGS}) +. else + @${DO_NADA} +. endif +.endif + +.if !target(run-autotools-autoconf) +run-autotools-autoconf: +. if defined(_AUTOTOOL_rule_autoconf) + @(cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${AUTOCONF} \ + ${AUTOCONF_ARGS}) +. else + @${DO_NADA} +. endif +.endif + +.if !target(run-autotools-autoheader) +run-autotools-autoheader: +. if defined(_AUTOTOOL_rule_autoheader) + @(cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${AUTOHEADER} \ + ${AUTOHEADER_ARGS}) +. else + @${DO_NADA} +. endif +.endif + +.if !target(run-autotools-libtoolize) +run-autotools-libtoolize: +. if defined(_AUTOTOOL_rule_libtoolize) + @(cd ${CONFIGURE_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${LIBTOOLIZE} \ + ${LIBTOOLIZE_ARGS}) +. else + @${DO_NADA} +. endif +.endif + +.if !target(patch-autotools-libtool) +patch-autotools-libtool:: +. if defined(_AUTOTOOL_rule_libtool) + @for file in ${LIBTOOLFILES}; do \ + ${REINPLACE_CMD} -e \ + "/^ltmain=/!s|\$$ac_aux_dir/ltmain.sh|${LIBTOOLFLAGS} ${LTMAIN}|g; \ + /^LIBTOOL=/s|\$$(top_builddir)/libtool|${LIBTOOL}|g" \ + ${PATCH_WRKSRC}/$$file; \ + done; +. else + @${DO_NADA} +. endif +.endif + +#--------------------------------------------------------------------------- +# Reduce patch churn by auto-substituting data from AUTOTOOLS_VARS +# into the correct places. Code shamelessly stolen from PLIST_SUB. + +AUTOTOOLSFILES?= # default to empty +AUTOTOOLS_VARS?= # empty if not already set + +.if !target(configure-autotools) +configure-autotools:: +. if ${AUTOTOOLS_VARS}!="" && ${AUTOTOOLSFILES} != "" + @for file in ${AUTOTOOLSFILES}; do \ + ${REINPLACE_CMD} ${AUTOTOOLS_VARS:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \ + ${WRKSRC}/$${file} ; \ + done +. else + @${DO_NADA} +. endif +.endif Added: soc2012/scher/par_ports/head/Mk/bsd.cmake.mk ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/scher/par_ports/head/Mk/bsd.cmake.mk Mon May 21 10:35:10 2012 (r236058) @@ -0,0 +1,103 @@ +#-*- mode: Makefile; tab-width: 4; -*- +# ex:ts=4 +# +# USE_CMAKE - If set, this port uses cmake. +# +# CMAKE_ENV - Environment passed to cmake. +# Default: ${CONFIGURE_ENV} +# CMAKE_ARGS - Arguments passed to cmake +# Default: see below +# CMAKE_BUILD_TYPE - Type of build (cmake predefined build types). +# Projects may have their own build profiles. +# CMake supports the following types: Debug, +# Release, RelWithDebInfo and MinSizeRel. +# Debug and Release profiles respect system +# CFLAGS, RelWithDebInfo and MinSizeRel will set +# CFLAGS to "-O2 -g" and "-Os -DNDEBUG". +# Default: Release, if WITH_DEBUG is not set, +# Debug otherwise +# CMAKE_VERBOSE - Verbose build +# Default: not set +# CMAKE_OUTSOURCE - Instruct to perform an out-of-source build +# Default: not set +# CMAKE_SOURCE_PATH - Path to sourcedir for cmake +# Default: ${WRKSRC} +# CMAKE_INSTALL_PREFIX - prefix for cmake to use for installation. +# Default: ${PREFIX} +# *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Mon May 21 15:04:34 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 2C1AC106566B for ; Mon, 21 May 2012 15:04:32 +0000 (UTC) (envelope-from aleek@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 21 May 2012 15:04:32 +0000 Date: Mon, 21 May 2012 15:04:32 +0000 From: aleek@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120521150432.2C1AC106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r236063 - in soc2012/aleek/beaglexm-armv6: lib/libc lib/libc/arm/gen sys sys/arm/conf X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 May 2012 15:04:34 -0000 Author: aleek Date: Mon May 21 15:04:31 2012 New Revision: 236063 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236063 Log: testing - come merges from armv6 tree and 2 config files for bb-xm Added: soc2012/aleek/beaglexm-armv6/sys/arm/conf/EA3250.hints - copied unchanged from r235800, mirror/FreeBSD/projects/armv6/sys/arm/conf/EA3250.hints Modified: soc2012/aleek/beaglexm-armv6/lib/libc/ (props changed) soc2012/aleek/beaglexm-armv6/lib/libc/arm/gen/__aeabi_read_tp.S soc2012/aleek/beaglexm-armv6/lib/libc/arm/gen/_set_tp.c soc2012/aleek/beaglexm-armv6/sys/ (props changed) Modified: soc2012/aleek/beaglexm-armv6/lib/libc/arm/gen/__aeabi_read_tp.S ============================================================================== --- soc2012/aleek/beaglexm-armv6/lib/libc/arm/gen/__aeabi_read_tp.S Mon May 21 14:47:34 2012 (r236062) +++ soc2012/aleek/beaglexm-armv6/lib/libc/arm/gen/__aeabi_read_tp.S Mon May 21 15:04:31 2012 (r236063) @@ -31,8 +31,12 @@ #include ENTRY(__aeabi_read_tp) +#ifdef ARM_TP_ADDRESS ldr r0, .Larm_tp_address ldr r0, [r0] +#else + mrc p15, 0, r0, c13, c0, 3 +#endif RET .Larm_tp_address: Modified: soc2012/aleek/beaglexm-armv6/lib/libc/arm/gen/_set_tp.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/lib/libc/arm/gen/_set_tp.c Mon May 21 14:47:34 2012 (r236062) +++ soc2012/aleek/beaglexm-armv6/lib/libc/arm/gen/_set_tp.c Mon May 21 15:04:31 2012 (r236063) @@ -35,5 +35,9 @@ _set_tp(void *tp) { +#ifdef ARM_TP_ADDRESS *((struct tcb **)ARM_TP_ADDRESS) = tp; +#else + sysarch(ARM_SET_TP, tp); +#endif } Copied: soc2012/aleek/beaglexm-armv6/sys/arm/conf/EA3250.hints (from r235800, mirror/FreeBSD/projects/armv6/sys/arm/conf/EA3250.hints) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/aleek/beaglexm-armv6/sys/arm/conf/EA3250.hints Mon May 21 15:04:31 2012 (r236063, copy of r235800, mirror/FreeBSD/projects/armv6/sys/arm/conf/EA3250.hints) @@ -0,0 +1,2 @@ +hint.ssd1289.0.at="spibus0" +hint.ssd1289.0.cs=26 From owner-svn-soc-all@FreeBSD.ORG Mon May 21 15:22:29 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 0378E1065674 for ; Mon, 21 May 2012 15:22:27 +0000 (UTC) (envelope-from aleek@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 21 May 2012 15:22:27 +0000 Date: Mon, 21 May 2012 15:22:27 +0000 From: aleek@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120521152227.0378E1065674@hub.freebsd.org> Cc: Subject: socsvn commit: r236064 - in soc2012/aleek/beaglexm-armv6/sys/arm: conf ti/am37xx ti/omap3 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 May 2012 15:22:29 -0000 Author: aleek Date: Mon May 21 15:22:26 2012 New Revision: 236064 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236064 Log: added config files for bb-xm Added: soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37xx/ soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/std.omap37xx Added: soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM Mon May 21 15:22:26 2012 (r236064) @@ -0,0 +1,116 @@ +# BEAGLEBOARD -- Custom configuration for the BeagleBoard ARM development +# platform, check out www.beaglebaord.org +# +# 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$ + +ident BEAGLEBAORD-XM + +# This probably wants to move somewhere else. Maybe we can create a basic +# OMAP3530 config, then make a BEAGLEBOARD config that includes the basic one, +# adds the start addresses and custom devices plus pulls in this hints file. + +#hints "BEAGLEBOARD.hints" + +include "../ti/omap3/std.omap35xx" + +#To statically compile in device wiring instead of /boot/device.hints +makeoptions MODULES_OVERRIDE="" +makeoptions WITHOUT_MODULES="ahc" + +makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols +makeoptions WERROR= +options HZ=100 + +options SCHED_4BSD #4BSD scheduler +options INET #InterNETworking +#options INET6 #IPv6 communications protocols +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 NFSCLIENT #Network Filesystem Client +#options NFSSERVER #Network Filesystem Server +#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 COMPAT_43 #Compatible with BSD 4.3 [KEEP THIS!] +options SCSI_DELAY=5000 #Delay (in ms) before probing SCSI +options KTRACE #ktrace(1) 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 PREEMPTION + +# MMC/SD/SDIO Card slot support +#device mmc # mmc/sd bus +#device mmcsd # mmc/sd flash cards + +# I2C support +#device iicbus +#device iic + +device loop +#device ether +#device mii +device smc +device smcphy +device uart +device uart_ns8250 + +device pty + +device gpio + +# Debugging for use in -current +options VERBOSE_SYSINIT #Enable verbose sysinit messages +options KDB +options DDB #Enable the kernel debugger +#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 +#options DIAGNOSTIC +options BREAK_TO_DEBUGGER + +device md + +# The following enables MFS as root, this seems similar to an initramfs or initrd +# as used in Linux. +# options MD_ROOT +# options MD_ROOT_SIZE=7560 + +device random # Entropy device + +# USB support +#device usb +#device ohci +#device ehci +#device umass +#device scbus # SCSI bus (required for SCSI) +#device da # Direct Access (disks) + +# USB Ethernet support, requires miibus +#device miibus +#device axe # ASIX Electronics USB Ethernet + + Added: soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/std.omap37xx ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/std.omap37xx Mon May 21 15:22:26 2012 (r236064) @@ -0,0 +1,21 @@ +# Cortex-A8 Omap3 generic configuration +#$FreeBSD$ +files "../omap/omap3/files.omap37xx" +include "../omap/std.ti" +#cpu CPU_CORTEXA8_OMAP3 +makeoption ARM_LITTLE_ENDIAN + +# +# Physical memory starts at 0x80000000. We assume images are loaded at +# 0x80200000, e.g. from u-boot with 'fatload mmc 0 0x80200000 kernel.bin' +# +# +options PHYSADDR=0x80000000 +options KERNPHYSADDR=0x80200000 +makeoptions KERNPHYSADDR=0x80200000 +options KERNVIRTADDR=0xc0200000 # Used in ldscript.arm +makeoptions KERNVIRTADDR=0xc0200000 + +options STARTUP_PAGETABLE_ADDR=0x80000000 + +options SOC_OMAP3 From owner-svn-soc-all@FreeBSD.ORG Mon May 21 17:13:57 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id D396B1065672 for ; Mon, 21 May 2012 17:13:56 +0000 (UTC) (envelope-from emc2@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 21 May 2012 17:13:56 +0000 Date: Mon, 21 May 2012 17:13:56 +0000 From: emc2@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120521171356.D396B1065672@hub.freebsd.org> Cc: Subject: socsvn commit: r236068 - soc2012/emc2 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 May 2012 17:13:57 -0000 Author: emc2 Date: Mon May 21 17:13:56 2012 New Revision: 236068 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236068 Log: Create repository Added: soc2012/emc2/ From owner-svn-soc-all@FreeBSD.ORG Mon May 21 17:17:49 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id AEABF106564A for ; Mon, 21 May 2012 17:17:48 +0000 (UTC) (envelope-from emc2@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 21 May 2012 17:17:48 +0000 Date: Mon, 21 May 2012 17:17:48 +0000 From: emc2@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120521171748.AEABF106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r236069 - soc2012/emc2/head X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 May 2012 17:17:49 -0000 Author: emc2 Date: Mon May 21 17:17:48 2012 New Revision: 236069 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236069 Log: Create head Added: soc2012/emc2/head/ From owner-svn-soc-all@FreeBSD.ORG Mon May 21 17:20:11 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id C835E1065741 for ; Mon, 21 May 2012 17:20:10 +0000 (UTC) (envelope-from emc2@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 21 May 2012 17:20:10 +0000 Date: Mon, 21 May 2012 17:20:10 +0000 From: emc2@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120521172010.C835E1065741@hub.freebsd.org> Cc: Subject: socsvn commit: r236070 - soc2012/emc2/head X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 May 2012 17:20:11 -0000 Author: emc2 Date: Mon May 21 17:20:09 2012 New Revision: 236070 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236070 Log: Oops Deleted: soc2012/emc2/head/ From owner-svn-soc-all@FreeBSD.ORG Mon May 21 17:20:53 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id E35E4106566B for ; Mon, 21 May 2012 17:20:52 +0000 (UTC) (envelope-from emc2@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 21 May 2012 17:20:52 +0000 Date: Mon, 21 May 2012 17:20:52 +0000 From: emc2@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120521172052.E35E4106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r236071 - soc2012/emc2/head X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 May 2012 17:20:54 -0000 Author: emc2 Date: Mon May 21 17:20:52 2012 New Revision: 236071 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236071 Log: Branched FreeBSD head for development Added: soc2012/emc2/head/ (props changed) - copied from r236070, mirror/FreeBSD/head/ From owner-svn-soc-all@FreeBSD.ORG Mon May 21 21:25:32 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id A6D9E1065670 for ; Mon, 21 May 2012 21:25:30 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 21 May 2012 21:25:30 +0000 Date: Mon, 21 May 2012 21:25:30 +0000 From: scher@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120521212530.A6D9E1065670@hub.freebsd.org> Cc: Subject: socsvn commit: r236083 - in soc2012/scher/par_ports/head: . Mk Templates Templates/Licenses Tools Tools/scripts Tools/scripts/mkptools Tools/scripts/modules Tools/scripts/pkg-stash Tools/scripts/re... X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 May 2012 21:25:32 -0000 Author: scher Date: Mon May 21 21:25:29 2012 New Revision: 236083 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236083 Log: Development environment setup. Tools/* and Templates/* are added. General fake port added. Added: soc2012/scher/par_ports/head/README.txt soc2012/scher/par_ports/head/Templates/ soc2012/scher/par_ports/head/Templates/BSD.local.dist (contents, props changed) soc2012/scher/par_ports/head/Templates/Licenses/ soc2012/scher/par_ports/head/Templates/Licenses/AL2 (contents, props changed) soc2012/scher/par_ports/head/Templates/Licenses/ART10 (contents, props changed) soc2012/scher/par_ports/head/Templates/Licenses/ART20 (contents, props changed) soc2012/scher/par_ports/head/Templates/Licenses/GPLv1 (contents, props changed) soc2012/scher/par_ports/head/Templates/Licenses/GPLv2 (contents, props changed) soc2012/scher/par_ports/head/Templates/Licenses/GPLv3 (contents, props changed) soc2012/scher/par_ports/head/Templates/Licenses/LGPL20 (contents, props changed) soc2012/scher/par_ports/head/Templates/Licenses/LGPL21 (contents, props changed) soc2012/scher/par_ports/head/Templates/Licenses/LGPL3 (contents, props changed) soc2012/scher/par_ports/head/Templates/Licenses/LPPL10 (contents, props changed) soc2012/scher/par_ports/head/Templates/Licenses/MPL (contents, props changed) soc2012/scher/par_ports/head/Templates/Licenses/OFL (contents, props changed) soc2012/scher/par_ports/head/Templates/Licenses/PHP301 (contents, props changed) soc2012/scher/par_ports/head/Templates/Licenses/ZPL21 (contents, props changed) soc2012/scher/par_ports/head/Templates/README.category (contents, props changed) soc2012/scher/par_ports/head/Templates/README.port (contents, props changed) soc2012/scher/par_ports/head/Templates/README.top (contents, props changed) soc2012/scher/par_ports/head/Templates/config.guess (contents, props changed) soc2012/scher/par_ports/head/Templates/config.sub (contents, props changed) soc2012/scher/par_ports/head/Tools/ soc2012/scher/par_ports/head/Tools/make_index (contents, props changed) soc2012/scher/par_ports/head/Tools/make_readmes (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/ soc2012/scher/par_ports/head/Tools/scripts/MOVEDlint.awk (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/README (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/README.patchtool (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/README.portsearch (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/addport (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/ardiff (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/bad-pkgdescrs.sh (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/bump_revision.pl (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/check-latest-link (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/checkcats.py (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/checknewver.sh (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/checksize.sh (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/checksum.sh (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/chkdepschain.py (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/chkorigin.sh (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/chkversion.pl (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/close-pr (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/consistency-check (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/distclean.sh (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/distinfochecker (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/domakedescribe (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/doportlint (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/explicit_lib_depends.sh (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/getpr (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/gnomedepends.py (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/mark_safe.pl (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/mkptools/ soc2012/scher/par_ports/head/Tools/scripts/mkptools/mkpbuild (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/mkptools/mkpclean (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/mkptools/mkpextr (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/mkptools/mkpinstall (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/mkptools/mkpmerge (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/mkptools/mkppackage (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/mkptools/mkpskel (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/modules/ soc2012/scher/par_ports/head/Tools/scripts/modules/Makefile (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/modules/buildmodules.pl (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/modules/modules.head (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/modules/update.sh (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/neededlibs.sh (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/notconnected (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/p5-deps.pl (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/parse-kdump.tcl (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/patchtool.py (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/pkg-stash/ soc2012/scher/par_ports/head/Tools/scripts/pkg-stash/pkg-list.sh (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/pkg-stash/pkg-stash.pl (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/plist (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/portsearch (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/portsvar.sh (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/prdone (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/prpatch (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/release/ soc2012/scher/par_ports/head/Tools/scripts/release/Makefile (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/release/README (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/release/checkdeps.pl (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/release/config (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/release/doit.sh (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/release/oneshot.pl (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/release/scrubindex.pl (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/release/setup.sh (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/resolveportsfromlibs.sh (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/rmport (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/security-check.awk (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/splitpatch.pl (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/sunshar/ soc2012/scher/par_ports/head/Tools/scripts/sunshar.rb (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/sunshar/Makefile (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/sunshar/sunshar.1 (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/tindex (contents, props changed) soc2012/scher/par_ports/head/Tools/scripts/update-patches (contents, props changed) soc2012/scher/par_ports/head/db/ soc2012/scher/par_ports/head/db/pkg/ (props changed) soc2012/scher/par_ports/head/db/ports/ (props changed) soc2012/scher/par_ports/head/dev_env.mk soc2012/scher/par_ports/head/distfiles/ soc2012/scher/par_ports/head/distfiles/fake-1.0.tar.gz (contents, props changed) soc2012/scher/par_ports/head/fake_ports/ soc2012/scher/par_ports/head/fake_ports/fake/ soc2012/scher/par_ports/head/fake_ports/fake/Makefile soc2012/scher/par_ports/head/fake_ports/fake/pkg-descr soc2012/scher/par_ports/head/packages/ soc2012/scher/par_ports/head/tmp/ (props changed) Modified: soc2012/scher/par_ports/head/ (props changed) soc2012/scher/par_ports/head/Mk/bsd.port.mk Modified: soc2012/scher/par_ports/head/Mk/bsd.port.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.port.mk Mon May 21 19:58:40 2012 (r236082) +++ soc2012/scher/par_ports/head/Mk/bsd.port.mk Mon May 21 21:25:29 2012 (r236083) @@ -2886,6 +2886,11 @@ x11 x11-clocks x11-drivers x11-fm x11-fonts x11-servers x11-themes \ x11-toolkits x11-wm xfce zope +############### PAR_PORTS SPECIFIC COMMENT LINE ############### +############### THIS ENTRY IS FOR DEBUGGING PURPOSE ############### +VALID_CATEGORIES+=fake_ports +############### ENDF OF PAR_PORTS SPECIFIC COMMENT LINE ############### + check-categories: .for cat in ${CATEGORIES} . if empty(VALID_CATEGORIES:M${cat}) @@ -2938,12 +2943,12 @@ HAS_CONFIGURE= yes SET_LATE_CONFIGURE_ARGS= \ - _LATE_CONFIGURE_ARGS="" ; \ + _LATE_CONFIGURE_ARGS="" ; \ if [ ! -z "`./${CONFIGURE_SCRIPT} --help 2>&1 | ${GREP} -- '--mandir'`" ]; then \ - _LATE_CONFIGURE_ARGS="$${_LATE_CONFIGURE_ARGS} --mandir=${MANPREFIX}/man" ; \ + _LATE_CONFIGURE_ARGS="$${_LATE_CONFIGURE_ARGS} --mandir=${MANPREFIX}/man" ; \ fi ; \ if [ ! -z "`./${CONFIGURE_SCRIPT} --help 2>&1 | ${GREP} -- '--infodir'`" ]; then \ - _LATE_CONFIGURE_ARGS="$${_LATE_CONFIGURE_ARGS} --infodir=${PREFIX}/${INFO_PATH}/${INFO_SUBDIR}" ; \ + _LATE_CONFIGURE_ARGS="$${_LATE_CONFIGURE_ARGS} --infodir=${PREFIX}/${INFO_PATH}/${INFO_SUBDIR}" ; \ fi ; \ if [ -z "`./${CONFIGURE_SCRIPT} --version 2>&1 | ${EGREP} -i '(autoconf.*2\.13|Unrecognized option)'`" ]; then \ _LATE_CONFIGURE_ARGS="$${_LATE_CONFIGURE_ARGS} --build=${CONFIGURE_TARGET}" ; \ @@ -3488,7 +3493,7 @@ SORTED_MASTER_SITES_CMD_TMP="${SORTED_MASTER_SITES_DEFAULT_CMD}" ; \ fi; \ for site in `eval $$SORTED_MASTER_SITES_CMD_TMP ${_RANDOMIZE_SITES}`; do \ - ${ECHO_MSG} "=> Attempting to fetch $${site}$${file}"; \ + ${ECHO_MSG} "=> Attempting to fetch $${site}$${file}"; \ CKSIZE=`alg=SIZE; ${DISTINFO_DATA}`; \ case $${file} in \ */*) ${MKDIR} $${file%/*}; \ @@ -3502,7 +3507,7 @@ ${ECHO_MSG} "=> Couldn't fetch it - please try to retrieve this";\ ${ECHO_MSG} "=> port manually into ${_DISTDIR} and try again."; \ exit 1; \ - fi; \ + fi; \ done .if defined(PATCHFILES) @cd ${_DISTDIR};\ @@ -3540,7 +3545,7 @@ SORTED_PATCH_SITES_CMD_TMP="${SORTED_PATCH_SITES_DEFAULT_CMD}" ; \ fi; \ for site in `eval $$SORTED_PATCH_SITES_CMD_TMP`; do \ - ${ECHO_MSG} "=> Attempting to fetch $${site}$${file}"; \ + ${ECHO_MSG} "=> Attempting to fetch $${site}$${file}"; \ CKSIZE=`alg=SIZE; ${DISTINFO_DATA}`; \ case $${file} in \ */*) ${MKDIR} $${file%/*}; \ @@ -3587,17 +3592,20 @@ .if ${USE_DOS2UNIX:U}=="YES" @${ECHO_MSG} "===> Converting DOS text files to UNIX text files" @${FIND} -E ${WRKSRC} -type f -iregex '${DOS2UNIX_REGEX}' -print0 | \ - ${XARGS} -0 ${REINPLACE_CMD} -i '' -e 's/ $$//' + ${XARGS} -0 ${REINPLACE_CMD} -i '' -e 's/ +$$//' .else @${ECHO_MSG} "===> Converting DOS text file to UNIX text file: ${f}" .if ${USE_DOS2UNIX:M*/*} .for f in ${USE_DOS2UNIX} - @${REINPLACE_CMD} -i '' -e 's/ $$//' ${WRKSRC}/${f} + @${REINPLACE_CMD} -i '' -e 's/ +$$//' ${WRKSRC}/${f} .endfor .else .for f in ${USE_DOS2UNIX} @${FIND} ${WRKSRC} -type f -name '${f}' -print0 | \ - ${XARGS} -0 ${REINPLACE_CMD} -i '' -e 's/ $$//' + ${XARGS} -0 ${REINPLACE_CMD} -i '' -e 's/ +$$//' .endfor .endif .endif @@ -3709,22 +3717,22 @@ for _D in $${CONFIG_GUESS_DIRS}; do \ ${CP} -f ${TEMPLATES}/config.guess $${_D}/config.guess; \ ${CHMOD} a+rx $${_D}/config.guess; \ - ${CP} -f ${TEMPLATES}/config.sub $${_D}/config.sub; \ + ${CP} -f ${TEMPLATES}/config.sub $${_D}/config.sub; \ ${CHMOD} a+rx $${_D}/config.sub; \ done .endif .if defined(HAS_CONFIGURE) @(cd ${CONFIGURE_WRKSRC} && \ - ${SET_LATE_CONFIGURE_ARGS} \ + ${SET_LATE_CONFIGURE_ARGS} \ if ! ${SETENV} CC="${CC}" CPP="${CPP}" CXX="${CXX}" \ - CFLAGS="${CFLAGS}" CPPFLAGS="${CPPFLAGS}" CXXFLAGS="${CXXFLAGS}" \ - LDFLAGS="${LDFLAGS}" \ - INSTALL="/usr/bin/install -c ${_BINOWNGRP}" \ - INSTALL_DATA="${INSTALL_DATA}" \ - INSTALL_LIB="${INSTALL_LIB}" \ - INSTALL_PROGRAM="${INSTALL_PROGRAM}" \ - INSTALL_SCRIPT="${INSTALL_SCRIPT}" \ - ${CONFIGURE_ENV} ./${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}; then \ + CFLAGS="${CFLAGS}" CPPFLAGS="${CPPFLAGS}" CXXFLAGS="${CXXFLAGS}" \ + LDFLAGS="${LDFLAGS}" \ + INSTALL="/usr/bin/install -c ${_BINOWNGRP}" \ + INSTALL_DATA="${INSTALL_DATA}" \ + INSTALL_LIB="${INSTALL_LIB}" \ + INSTALL_PROGRAM="${INSTALL_PROGRAM}" \ + INSTALL_SCRIPT="${INSTALL_SCRIPT}" \ + ${CONFIGURE_ENV} ./${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS}; then \ ${ECHO_MSG} "===> Script \"${CONFIGURE_SCRIPT}\" failed unexpectedly."; \ (${ECHO_CMD} ${CONFIGURE_FAIL_MESSAGE}) | ${FMT} 75 79 ; \ ${FALSE}; \ @@ -4246,7 +4254,7 @@ ${WRKDIR}/.PLIST.flattened ${WRKDIR}/.PLIST.objdump ${WRKDIR}/.PLIST.setuid ${WRKDIR}/.PLIST.writable; \ then \ www_site=$$(cd ${.CURDIR} && ${MAKE} www-site); \ - if [ ! -z "$${www_site}" ]; then \ + if [ ! -z "$${www_site}" ]; then \ ${ECHO_MSG}; \ ${ECHO_MSG} " For more information, and contact details about the security"; \ ${ECHO_MSG} " status of this software, see the following webpage: "; \ @@ -4917,10 +4925,10 @@ if [ "$${OK:=true}" = "retry" ] && [ ${FETCH_REGET} -gt 0 ]; then \ ${ECHO_MSG} "===> Refetch for ${FETCH_REGET} more times files: $$refetchlist"; \ if ( cd ${.CURDIR} && \ - ${MAKE} ${.MAKEFLAGS} FORCE_FETCH="$$refetchlist" FETCH_REGET="`${EXPR} ${FETCH_REGET} - 1`" fetch); then \ + ${MAKE} ${.MAKEFLAGS} FORCE_FETCH="$$refetchlist" FETCH_REGET="`${EXPR} ${FETCH_REGET} - 1`" fetch); then \ if ( cd ${.CURDIR} && \ - ${MAKE} ${.MAKEFLAGS} FETCH_REGET="`${EXPR} ${FETCH_REGET} - 1`" checksum ); then \ - OK="true"; \ + ${MAKE} ${.MAKEFLAGS} FETCH_REGET="`${EXPR} ${FETCH_REGET} - 1`" checksum ); then \ + OK="true"; \ fi; \ fi; \ fi; \ Added: soc2012/scher/par_ports/head/README.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/scher/par_ports/head/README.txt Mon May 21 21:25:29 2012 (r236083) @@ -0,0 +1,16 @@ +Execute the following command line in the project's root directory: +make -f dev_env.mk list_env_info +It will change nothing, but list some necessary environment variables + +The following files/directories are ignored: +db/pkg/* +db/ports/* +tmp/* +${WRKDIR} + +All new lines of code will bew surrounded by the following comment lines: + +############### PAR_PORTS SPECIFIC COMMENT LINE ############### +############### THIS ENTRY IS FOR DEBUGGING PURPOSE ############### +some code here +############### ENDF OF PAR_PORTS SPECIFIC COMMENT LINE ############### \ No newline at end of file Added: soc2012/scher/par_ports/head/Templates/BSD.local.dist ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/scher/par_ports/head/Templates/BSD.local.dist Mon May 21 21:25:29 2012 (r236083) @@ -0,0 +1,956 @@ +# $FreeBSD: ports/Templates/BSD.local.dist,v 1.3 2010/11/12 20:57:14 pav Exp $ +# +# Please see the file src/etc/mtree/README before making changes to this file. +# + +/set type=dir uname=root gname=wheel mode=0755 +. + bin + .. + etc + devd + .. + man.d + .. + pam.d + .. + rc.d + .. + .. + include + X11 + .. + .. + info + .. + lib + X11 + app-defaults + .. + fonts + local + .. + .. + .. + .. + libdata + ldconfig + .. + ldconfig32 + .. + pkgconfig + .. + .. + libexec + .. + man +/set uname=man + cat1 + .. + cat2 + .. + cat3 + .. + cat4 + .. + cat5 + .. + cat6 + .. + cat7 + .. + cat8 + .. + cat9 + .. + catl + .. + catn + .. + de.ISO8859-1 uname=root + cat1 + .. + cat2 + .. + cat3 + .. + cat4 + .. + cat5 + .. + cat6 + .. + cat7 + .. + cat8 + .. + cat9 + .. + catl + .. + catn + .. +/set uname=root + man1 + .. + man2 + .. + man3 + .. + man4 + .. + man5 + .. + man6 + .. + man7 + .. + man8 + .. + man9 + .. + manl + .. + mann + .. + .. + en.ISO8859-1 +/set uname=man + cat1 + .. + cat1aout + .. + cat2 + .. + cat3 + .. + cat4 + i386 + .. + .. + cat5 + .. + cat6 + .. + cat7 + .. + cat8 + i386 + .. + .. + cat9 + i386 + .. + .. + catn + .. + .. + ja uname=root + cat1 + .. + cat2 + .. + cat3 + .. + cat4 + .. + cat5 + .. + cat6 + .. + cat7 + .. + cat8 + .. + cat9 + .. + catl + .. + catn + .. +/set uname=root + man1 + .. + man2 + .. + man3 + .. + man4 + .. + man5 + .. + man6 + .. + man7 + .. + man8 + .. + man9 + .. + manl + .. + mann + .. + .. + man1 + .. + man2 + .. + man3 + .. + man4 + .. + man5 + .. + man6 + .. + man7 + .. + man8 + .. + man9 + .. + manl + .. + mann + .. + ru.KOI8-R +/set uname=man + cat1 + .. + cat2 + .. + cat3 + .. + cat4 + .. + cat5 + .. + cat6 + .. + cat7 + .. + cat8 + .. + cat9 + .. + catl + .. + catn + .. +/set uname=root + man1 + .. + man2 + .. + man3 + .. + man4 + .. + man5 + .. + man6 + .. + man7 + .. + man8 + .. + man9 + .. + manl + .. + mann + .. + .. + .. + sbin + .. + share + aclocal + .. + dict + .. + doc + ja + .. + .. + emacs + site-lisp + .. + .. + examples + .. + java + classes + .. + .. + locale + af + LC_MESSAGES + .. + .. + am + LC_MESSAGES + .. + .. + ar + LC_MESSAGES + .. + .. + az + LC_MESSAGES + .. + .. + be + LC_MESSAGES + .. + .. + bg + LC_MESSAGES + .. + .. + bn + LC_MESSAGES + .. + .. + br + LC_MESSAGES + .. + .. + bs + LC_MESSAGES + .. + .. + ca + LC_MESSAGES + .. + .. + cs + LC_MESSAGES + .. + .. + cy + LC_MESSAGES + .. + .. + da + LC_MESSAGES + .. + .. + de + LC_MESSAGES + .. + .. + de_AT + LC_MESSAGES + .. + .. + dk + LC_MESSAGES + .. + .. + ee + LC_MESSAGES + .. + .. + el + LC_MESSAGES + .. + .. + en + LC_MESSAGES + .. + .. + en_AU + LC_MESSAGES + .. + .. + en_CA + LC_MESSAGES + .. + .. + en_GB + LC_MESSAGES + .. + .. + eo + LC_MESSAGES + .. + .. + es + LC_MESSAGES + .. + .. + es_ES + LC_MESSAGES + .. + .. + es_MX + LC_MESSAGES + .. + .. + et + LC_MESSAGES + .. + .. + eu + LC_MESSAGES + .. + .. + fa + LC_MESSAGES + .. + .. + fa_IR + LC_MESSAGES + .. + .. + fi + LC_MESSAGES + .. + .. + fr + LC_MESSAGES + .. + .. + fr_FR + LC_MESSAGES + .. + .. + ga + LC_MESSAGES + .. + .. + gl + LC_MESSAGES + .. + .. + gu + LC_MESSAGES + .. + .. + he + LC_MESSAGES + .. + .. + hi + LC_MESSAGES + .. + .. + hr + LC_MESSAGES + .. + .. + hu + LC_MESSAGES + .. + .. + id + LC_MESSAGES + .. + .. + is + LC_MESSAGES + .. + .. + it + LC_MESSAGES + .. + .. + ja + LC_MESSAGES + .. + .. + ka + LC_MESSAGES + .. + .. + kn + LC_MESSAGES + .. + .. + ko + LC_MESSAGES + .. + .. + li + LC_MESSAGES + .. + .. + lt + LC_MESSAGES + .. + .. + lv + LC_MESSAGES + .. + .. + mk + LC_MESSAGES + .. + .. + ml + LC_MESSAGES + .. + .. + mn + LC_MESSAGES + .. + .. + ms + LC_MESSAGES + .. + .. + mt + LC_MESSAGES + .. + .. + nb + LC_MESSAGES + .. + .. + ne + LC_MESSAGES + .. + .. + nl + LC_MESSAGES + .. + .. + nn + LC_MESSAGES + .. + .. + no + LC_MESSAGES + .. + .. + or + LC_MESSAGES + .. + .. + pa + LC_MESSAGES + .. + .. + pl + LC_MESSAGES + .. + .. + pt + LC_MESSAGES + .. + .. + pt_BR + LC_MESSAGES + .. + .. + pt_PT + LC_MESSAGES + .. + .. + ro + LC_MESSAGES + .. + .. + ru + LC_MESSAGES + .. + .. + sk + LC_MESSAGES + .. + .. + sl + LC_MESSAGES + .. + .. + sq + LC_MESSAGES + .. + .. + sr + LC_MESSAGES + .. + .. + sr@Latn + LC_MESSAGES + .. + .. + sv + LC_MESSAGES + .. + .. + ta + LC_MESSAGES + .. + .. + tg + LC_MESSAGES + .. + .. + th + LC_MESSAGES + .. + .. + tk + LC_MESSAGES + .. + .. + tr + LC_MESSAGES + .. + .. + uk + LC_MESSAGES + .. + .. + uz + LC_MESSAGES + .. + .. + vi + LC_MESSAGES + .. + .. + wa + LC_MESSAGES + .. + .. + zh + LC_MESSAGES + .. + .. + zh_CN + LC_MESSAGES + .. + .. + zh_CN.GB2312 + LC_MESSAGES + .. + .. + zh_TW + LC_MESSAGES + .. + .. + zh_TW.Big5 + LC_MESSAGES + .. + .. + .. + misc + .. + nls + C + .. + af_ZA.ISO8859-1 + .. + af_ZA.ISO8859-15 + .. + af_ZA.UTF-8 + .. + am_ET.UTF-8 + .. + be_BY.CP1131 + .. + be_BY.CP1251 + .. + be_BY.ISO8859-5 + .. + be_BY.UTF-8 + .. + bg_BG.CP1251 + .. + bg_BG.UTF-8 + .. + ca_ES.ISO8859-1 + .. + ca_ES.ISO8859-15 + .. + ca_ES.UTF-8 + .. + cs_CZ.ISO8859-2 + .. + cs_CZ.UTF-8 + .. + da_DK.ISO8859-1 + .. + da_DK.ISO8859-15 + .. + da_DK.UTF-8 + .. + de_AT.ISO8859-1 + .. + de_AT.ISO8859-15 + .. + de_AT.UTF-8 + .. + de_CH.ISO8859-1 + .. + de_CH.ISO8859-15 + .. + de_CH.UTF-8 + .. + de_DE.ISO8859-1 + .. + de_DE.ISO8859-15 + .. + de_DE.UTF-8 + .. + el_GR.ISO8859-7 + .. + el_GR.UTF-8 + .. + en_AU.ISO8859-1 + .. + en_AU.ISO8859-15 + .. + en_AU.US-ASCII + .. + en_AU.UTF-8 + .. + en_CA.ISO8859-1 + .. + en_CA.ISO8859-15 + .. + en_CA.US-ASCII + .. + en_CA.UTF-8 + .. + en_GB.ISO8859-1 + .. + en_GB.ISO8859-15 + .. + en_GB.US-ASCII + .. + en_GB.UTF-8 + .. + en_IE.UTF-8 + .. + en_NZ.ISO8859-1 + .. + en_NZ.ISO8859-15 + .. + en_NZ.US-ASCII + .. + en_NZ.UTF-8 + .. + en_US.ISO8859-1 + .. + en_US.ISO8859-15 + .. + en_US.UTF-8 + .. + es_ES.ISO8859-1 + .. + es_ES.ISO8859-15 + .. + es_ES.UTF-8 + .. + et_EE.ISO8859-15 + .. + et_EE.UTF-8 + .. + fi_FI.ISO8859-1 + .. + fi_FI.ISO8859-15 + .. + fi_FI.UTF-8 + .. + fr_BE.ISO8859-1 + .. + fr_BE.ISO8859-15 + .. + fr_BE.UTF-8 + .. + fr_CA.ISO8859-1 + .. + fr_CA.ISO8859-15 + .. + fr_CA.UTF-8 + .. + fr_CH.ISO8859-1 + .. + fr_CH.ISO8859-15 + .. + fr_CH.UTF-8 + .. + fr_FR.ISO8859-1 + .. + fr_FR.ISO8859-15 + .. + fr_FR.UTF-8 + .. + he_IL.UTF-8 + .. + hi_IN.ISCII-DEV + .. + hr_HR.ISO8859-2 + .. + hr_HR.UTF-8 + .. + hu_HU.ISO8859-2 + .. + hu_HU.UTF-8 + .. + hy_AM.ARMSCII-8 + .. + hy_AM.UTF-8 + .. + is_IS.ISO8859-1 + .. + is_IS.ISO8859-15 + .. + is_IS.UTF-8 + .. + it_CH.ISO8859-1 + .. + it_CH.ISO8859-15 + .. + it_CH.UTF-8 + .. + it_IT.ISO8859-1 + .. + it_IT.ISO8859-15 + .. + it_IT.UTF-8 + .. + ja_JP.SJIS + .. + ja_JP.UTF-8 + .. + ja_JP.eucJP + .. + kk_KZ.PT154 + .. + kk_KZ.UTF-8 + .. + ko_KR.CP949 + .. + ko_KR.UTF-8 + .. + ko_KR.eucKR + .. + la_LN.ISO8859-1 + .. + la_LN.ISO8859-15 + .. + la_LN.ISO8859-2 + .. + la_LN.ISO8859-4 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Tue May 22 09:38:50 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 3044E106564A for ; Tue, 22 May 2012 09:38:48 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 22 May 2012 09:38:48 +0000 Date: Tue, 22 May 2012 09:38:48 +0000 From: rudot@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120522093848.3044E106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r236124 - in soc2012/rudot/sys: . kern X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 May 2012 09:38:50 -0000 Author: rudot Date: Tue May 22 09:38:47 2012 New Revision: 236124 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236124 Log: Initial version of the kern_rctl.c file Added: soc2012/rudot/sys/ soc2012/rudot/sys/kern/ soc2012/rudot/sys/kern/kern_rctl.c Added: soc2012/rudot/sys/kern/kern_rctl.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/sys/kern/kern_rctl.c Tue May 22 09:38:47 2012 (r236124) @@ -0,0 +1,1822 @@ +/*- + * Copyright (c) 2010 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Edward Tomasz Napierala under sponsorship + * from the FreeBSD Foundation. + * + * 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: src/sys/kern/kern_rctl.c,v 1.14 2012/04/17 14:31:02 trasz Exp $ + */ + +#include +__FBSDID("$FreeBSD: src/sys/kern/kern_rctl.c,v 1.14 2012/04/17 14:31:02 trasz Exp $"); + +#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 + +#ifdef RCTL +#ifndef RACCT +#error "The RCTL option requires the RACCT option" +#endif + +FEATURE(rctl, "Resource Limits"); + +#define HRF_DEFAULT 0 +#define HRF_DONT_INHERIT 1 +#define HRF_DONT_ACCUMULATE 2 + +/* Default buffer size for rctl_get_rules(2). */ +#define RCTL_DEFAULT_BUFSIZE 4096 +#define RCTL_MAX_INBUFLEN 4096 +#define RCTL_LOG_BUFSIZE 128 + +/* + * 'rctl_rule_link' connects a rule with every racct it's related to. + * For example, rule 'user:X:openfiles:deny=N/process' is linked + * with uidinfo for user X, and to each process of that user. + */ +struct rctl_rule_link { + LIST_ENTRY(rctl_rule_link) rrl_next; + struct rctl_rule *rrl_rule; + int rrl_exceeded; +}; + +struct dict { + const char *d_name; + int d_value; +}; + +static struct dict subjectnames[] = { + { "process", RCTL_SUBJECT_TYPE_PROCESS }, + { "user", RCTL_SUBJECT_TYPE_USER }, + { "loginclass", RCTL_SUBJECT_TYPE_LOGINCLASS }, + { "jail", RCTL_SUBJECT_TYPE_JAIL }, + { NULL, -1 }}; + +static struct dict resourcenames[] = { + { "cputime", RACCT_CPU }, + { "datasize", RACCT_DATA }, + { "stacksize", RACCT_STACK }, + { "coredumpsize", RACCT_CORE }, + { "memoryuse", RACCT_RSS }, + { "memorylocked", RACCT_MEMLOCK }, + { "maxproc", RACCT_NPROC }, + { "openfiles", RACCT_NOFILE }, + { "vmemoryuse", RACCT_VMEM }, + { "pseudoterminals", RACCT_NPTS }, + { "swapuse", RACCT_SWAP }, + { "nthr", RACCT_NTHR }, + { "msgqqueued", RACCT_MSGQQUEUED }, + { "msgqsize", RACCT_MSGQSIZE }, + { "nmsgq", RACCT_NMSGQ }, + { "nsem", RACCT_NSEM }, + { "nsemop", RACCT_NSEMOP }, + { "nshm", RACCT_NSHM }, + { "shmsize", RACCT_SHMSIZE }, + { "wallclock", RACCT_WALLCLOCK }, + { NULL, -1 }}; + +static struct dict actionnames[] = { + { "sighup", RCTL_ACTION_SIGHUP }, + { "sigint", RCTL_ACTION_SIGINT }, + { "sigquit", RCTL_ACTION_SIGQUIT }, + { "sigill", RCTL_ACTION_SIGILL }, + { "sigtrap", RCTL_ACTION_SIGTRAP }, + { "sigabrt", RCTL_ACTION_SIGABRT }, + { "sigemt", RCTL_ACTION_SIGEMT }, + { "sigfpe", RCTL_ACTION_SIGFPE }, + { "sigkill", RCTL_ACTION_SIGKILL }, + { "sigbus", RCTL_ACTION_SIGBUS }, + { "sigsegv", RCTL_ACTION_SIGSEGV }, + { "sigsys", RCTL_ACTION_SIGSYS }, + { "sigpipe", RCTL_ACTION_SIGPIPE }, + { "sigalrm", RCTL_ACTION_SIGALRM }, + { "sigterm", RCTL_ACTION_SIGTERM }, + { "sigurg", RCTL_ACTION_SIGURG }, + { "sigstop", RCTL_ACTION_SIGSTOP }, + { "sigtstp", RCTL_ACTION_SIGTSTP }, + { "sigchld", RCTL_ACTION_SIGCHLD }, + { "sigttin", RCTL_ACTION_SIGTTIN }, + { "sigttou", RCTL_ACTION_SIGTTOU }, + { "sigio", RCTL_ACTION_SIGIO }, + { "sigxcpu", RCTL_ACTION_SIGXCPU }, + { "sigxfsz", RCTL_ACTION_SIGXFSZ }, + { "sigvtalrm", RCTL_ACTION_SIGVTALRM }, + { "sigprof", RCTL_ACTION_SIGPROF }, + { "sigwinch", RCTL_ACTION_SIGWINCH }, + { "siginfo", RCTL_ACTION_SIGINFO }, + { "sigusr1", RCTL_ACTION_SIGUSR1 }, + { "sigusr2", RCTL_ACTION_SIGUSR2 }, + { "sigthr", RCTL_ACTION_SIGTHR }, + { "deny", RCTL_ACTION_DENY }, + { "log", RCTL_ACTION_LOG }, + { "devctl", RCTL_ACTION_DEVCTL }, + { NULL, -1 }}; + +static void rctl_init(void); +SYSINIT(rctl, SI_SUB_RACCT, SI_ORDER_FIRST, rctl_init, NULL); + +static uma_zone_t rctl_rule_link_zone; +static uma_zone_t rctl_rule_zone; +static struct rwlock rctl_lock; +RW_SYSINIT(rctl_lock, &rctl_lock, "RCTL lock"); + +static int rctl_rule_fully_specified(const struct rctl_rule *rule); +static void rctl_rule_to_sbuf(struct sbuf *sb, const struct rctl_rule *rule); + +static MALLOC_DEFINE(M_RCTL, "rctl", "Resource Limits"); + +static const char * +rctl_subject_type_name(int subject) +{ + int i; + + for (i = 0; subjectnames[i].d_name != NULL; i++) { + if (subjectnames[i].d_value == subject) + return (subjectnames[i].d_name); + } + + panic("rctl_subject_type_name: unknown subject type %d", subject); +} + +static const char * +rctl_action_name(int action) +{ + int i; + + for (i = 0; actionnames[i].d_name != NULL; i++) { + if (actionnames[i].d_value == action) + return (actionnames[i].d_name); + } + + panic("rctl_action_name: unknown action %d", action); +} + +const char * +rctl_resource_name(int resource) +{ + int i; + + for (i = 0; resourcenames[i].d_name != NULL; i++) { + if (resourcenames[i].d_value == resource) + return (resourcenames[i].d_name); + } + + panic("rctl_resource_name: unknown resource %d", resource); +} + +/* + * Return the amount of resource that can be allocated by 'p' before + * hitting 'rule'. + */ +static int64_t +rctl_available_resource(const struct proc *p, const struct rctl_rule *rule) +{ + int resource; + int64_t available = INT64_MAX; + struct ucred *cred = p->p_ucred; + + rw_assert(&rctl_lock, RA_LOCKED); + + resource = rule->rr_resource; + switch (rule->rr_per) { + case RCTL_SUBJECT_TYPE_PROCESS: + available = rule->rr_amount - + p->p_racct->r_resources[resource]; + break; + case RCTL_SUBJECT_TYPE_USER: + available = rule->rr_amount - + cred->cr_ruidinfo->ui_racct->r_resources[resource]; + break; + case RCTL_SUBJECT_TYPE_LOGINCLASS: + available = rule->rr_amount - + cred->cr_loginclass->lc_racct->r_resources[resource]; + break; + case RCTL_SUBJECT_TYPE_JAIL: + available = rule->rr_amount - + cred->cr_prison->pr_prison_racct->prr_racct-> + r_resources[resource]; + break; + default: + panic("rctl_compute_available: unknown per %d", + rule->rr_per); + } + + return (available); +} + +/* + * Return non-zero if allocating 'amount' by proc 'p' would exceed + * resource limit specified by 'rule'. + */ +static int +rctl_would_exceed(const struct proc *p, const struct rctl_rule *rule, + int64_t amount) +{ + int64_t available; + + rw_assert(&rctl_lock, RA_LOCKED); + + available = rctl_available_resource(p, rule); + if (available >= amount) + return (0); + + return (1); +} + +/* + * Check whether the proc 'p' can allocate 'amount' of 'resource' in addition + * to what it keeps allocated now. Returns non-zero if the allocation should + * be denied, 0 otherwise. + */ +int +rctl_enforce(struct proc *p, int resource, uint64_t amount) +{ + struct rctl_rule *rule; + struct rctl_rule_link *link; + struct sbuf sb; + int should_deny = 0; + char *buf; + static int curtime = 0; + static struct timeval lasttime; + + rw_rlock(&rctl_lock); + + /* + * There may be more than one matching rule; go through all of them. + * Denial should be done last, after logging and sending signals. + */ + LIST_FOREACH(link, &p->p_racct->r_rule_links, rrl_next) { + rule = link->rrl_rule; + if (rule->rr_resource != resource) + continue; + if (!rctl_would_exceed(p, rule, amount)) { + link->rrl_exceeded = 0; + continue; + } + + switch (rule->rr_action) { + case RCTL_ACTION_DENY: + should_deny = 1; + continue; + case RCTL_ACTION_LOG: + /* + * If rrl_exceeded != 0, it means we've already + * logged a warning for this process. + */ + if (link->rrl_exceeded != 0) + continue; + + /* + * If the process state is not fully initialized yet, + * we can't access most of the required fields, e.g. + * p->p_comm. This happens when called from fork1(). + * Ignore this rule for now; it will be processed just + * after fork, when called from racct_proc_fork_done(). + */ + if (p->p_state != PRS_NORMAL) + continue; + + if (!ppsratecheck(&lasttime, &curtime, 10)) + continue; + + buf = malloc(RCTL_LOG_BUFSIZE, M_RCTL, M_NOWAIT); + if (buf == NULL) { + printf("rctl_enforce: out of memory\n"); + continue; + } + sbuf_new(&sb, buf, RCTL_LOG_BUFSIZE, SBUF_FIXEDLEN); + rctl_rule_to_sbuf(&sb, rule); + sbuf_finish(&sb); + printf("rctl: rule \"%s\" matched by pid %d " + "(%s), uid %d, jail %s\n", sbuf_data(&sb), + p->p_pid, p->p_comm, p->p_ucred->cr_uid, + p->p_ucred->cr_prison->pr_prison_racct->prr_name); + sbuf_delete(&sb); + free(buf, M_RCTL); + link->rrl_exceeded = 1; + continue; + case RCTL_ACTION_DEVCTL: + if (link->rrl_exceeded != 0) + continue; + + if (p->p_state != PRS_NORMAL) + continue; + + buf = malloc(RCTL_LOG_BUFSIZE, M_RCTL, M_NOWAIT); + if (buf == NULL) { + printf("rctl_enforce: out of memory\n"); + continue; + } + sbuf_new(&sb, buf, RCTL_LOG_BUFSIZE, SBUF_FIXEDLEN); + sbuf_printf(&sb, "rule="); + rctl_rule_to_sbuf(&sb, rule); + sbuf_printf(&sb, " pid=%d ruid=%d jail=%s", + p->p_pid, p->p_ucred->cr_ruid, + p->p_ucred->cr_prison->pr_prison_racct->prr_name); + sbuf_finish(&sb); + devctl_notify_f("RCTL", "rule", "matched", + sbuf_data(&sb), M_NOWAIT); + sbuf_delete(&sb); + free(buf, M_RCTL); + link->rrl_exceeded = 1; + continue; + default: + if (link->rrl_exceeded != 0) + continue; + + if (p->p_state != PRS_NORMAL) + continue; + + KASSERT(rule->rr_action > 0 && + rule->rr_action <= RCTL_ACTION_SIGNAL_MAX, + ("rctl_enforce: unknown action %d", + rule->rr_action)); + + /* + * We're using the fact that RCTL_ACTION_SIG* values + * are equal to their counterparts from sys/signal.h. + */ + kern_psignal(p, rule->rr_action); + link->rrl_exceeded = 1; + continue; + } + } + + rw_runlock(&rctl_lock); + + if (should_deny) { + /* + * Return fake error code; the caller should change it + * into one proper for the situation - EFSIZ, ENOMEM etc. + */ + return (EDOOFUS); + } + + return (0); +} + +uint64_t +rctl_get_limit(struct proc *p, int resource) +{ + struct rctl_rule *rule; + struct rctl_rule_link *link; + uint64_t amount = UINT64_MAX; + + rw_rlock(&rctl_lock); + + /* + * There may be more than one matching rule; go through all of them. + * Denial should be done last, after logging and sending signals. + */ + LIST_FOREACH(link, &p->p_racct->r_rule_links, rrl_next) { + rule = link->rrl_rule; + if (rule->rr_resource != resource) + continue; + if (rule->rr_action != RCTL_ACTION_DENY) + continue; + if (rule->rr_amount < amount) + amount = rule->rr_amount; + } + + rw_runlock(&rctl_lock); + + return (amount); +} + +uint64_t +rctl_get_available(struct proc *p, int resource) +{ + struct rctl_rule *rule; + struct rctl_rule_link *link; + int64_t available, minavailable, allocated; + + minavailable = INT64_MAX; + + rw_rlock(&rctl_lock); + + /* + * There may be more than one matching rule; go through all of them. + * Denial should be done last, after logging and sending signals. + */ + LIST_FOREACH(link, &p->p_racct->r_rule_links, rrl_next) { + rule = link->rrl_rule; + if (rule->rr_resource != resource) + continue; + if (rule->rr_action != RCTL_ACTION_DENY) + continue; + available = rctl_available_resource(p, rule); + if (available < minavailable) + minavailable = available; + } + + rw_runlock(&rctl_lock); + + /* + * XXX: Think about this _hard_. + */ + allocated = p->p_racct->r_resources[resource]; + if (minavailable < INT64_MAX - allocated) + minavailable += allocated; + if (minavailable < 0) + minavailable = 0; + return (minavailable); +} + +static int +rctl_rule_matches(const struct rctl_rule *rule, const struct rctl_rule *filter) +{ + + if (filter->rr_subject_type != RCTL_SUBJECT_TYPE_UNDEFINED) { + if (rule->rr_subject_type != filter->rr_subject_type) + return (0); + + switch (filter->rr_subject_type) { + case RCTL_SUBJECT_TYPE_PROCESS: + if (filter->rr_subject.rs_proc != NULL && + rule->rr_subject.rs_proc != + filter->rr_subject.rs_proc) + return (0); + break; + case RCTL_SUBJECT_TYPE_USER: + if (filter->rr_subject.rs_uip != NULL && + rule->rr_subject.rs_uip != + filter->rr_subject.rs_uip) + return (0); + break; + case RCTL_SUBJECT_TYPE_LOGINCLASS: + if (filter->rr_subject.rs_loginclass != NULL && + rule->rr_subject.rs_loginclass != + filter->rr_subject.rs_loginclass) + return (0); + break; + case RCTL_SUBJECT_TYPE_JAIL: + if (filter->rr_subject.rs_prison_racct != NULL && + rule->rr_subject.rs_prison_racct != + filter->rr_subject.rs_prison_racct) + return (0); + break; + default: + panic("rctl_rule_matches: unknown subject type %d", + filter->rr_subject_type); + } + } + + if (filter->rr_resource != RACCT_UNDEFINED) { + if (rule->rr_resource != filter->rr_resource) + return (0); + } + + if (filter->rr_action != RCTL_ACTION_UNDEFINED) { + if (rule->rr_action != filter->rr_action) + return (0); + } + + if (filter->rr_amount != RCTL_AMOUNT_UNDEFINED) { + if (rule->rr_amount != filter->rr_amount) + return (0); + } + + if (filter->rr_per != RCTL_SUBJECT_TYPE_UNDEFINED) { + if (rule->rr_per != filter->rr_per) + return (0); + } + + return (1); +} + +static int +str2value(const char *str, int *value, struct dict *table) +{ + int i; + + if (value == NULL) + return (EINVAL); + + for (i = 0; table[i].d_name != NULL; i++) { + if (strcasecmp(table[i].d_name, str) == 0) { + *value = table[i].d_value; + return (0); + } + } + + return (EINVAL); +} + +static int +str2id(const char *str, id_t *value) +{ + char *end; + + if (str == NULL) + return (EINVAL); + + *value = strtoul(str, &end, 10); + if ((size_t)(end - str) != strlen(str)) + return (EINVAL); + + return (0); +} + +static int +str2int64(const char *str, int64_t *value) +{ + char *end; + + if (str == NULL) + return (EINVAL); + + *value = strtoul(str, &end, 10); + if ((size_t)(end - str) != strlen(str)) + return (EINVAL); + + return (0); +} + +/* + * Connect the rule to the racct, increasing refcount for the rule. + */ +static void +rctl_racct_add_rule(struct racct *racct, struct rctl_rule *rule) +{ + struct rctl_rule_link *link; + + KASSERT(rctl_rule_fully_specified(rule), ("rule not fully specified")); + + rctl_rule_acquire(rule); + link = uma_zalloc(rctl_rule_link_zone, M_WAITOK); + link->rrl_rule = rule; + link->rrl_exceeded = 0; + + rw_wlock(&rctl_lock); + LIST_INSERT_HEAD(&racct->r_rule_links, link, rrl_next); + rw_wunlock(&rctl_lock); +} + +static int +rctl_racct_add_rule_locked(struct racct *racct, struct rctl_rule *rule) +{ + struct rctl_rule_link *link; + + KASSERT(rctl_rule_fully_specified(rule), ("rule not fully specified")); + rw_assert(&rctl_lock, RA_WLOCKED); + + link = uma_zalloc(rctl_rule_link_zone, M_NOWAIT); + if (link == NULL) + return (ENOMEM); + rctl_rule_acquire(rule); + link->rrl_rule = rule; + link->rrl_exceeded = 0; + + LIST_INSERT_HEAD(&racct->r_rule_links, link, rrl_next); + return (0); +} + +/* + * Remove limits for a rules matching the filter and release + * the refcounts for the rules, possibly freeing them. Returns + * the number of limit structures removed. + */ +static int +rctl_racct_remove_rules(struct racct *racct, + const struct rctl_rule *filter) +{ + int removed = 0; + struct rctl_rule_link *link, *linktmp; + + rw_assert(&rctl_lock, RA_WLOCKED); + + LIST_FOREACH_SAFE(link, &racct->r_rule_links, rrl_next, linktmp) { + if (!rctl_rule_matches(link->rrl_rule, filter)) + continue; + + LIST_REMOVE(link, rrl_next); + rctl_rule_release(link->rrl_rule); + uma_zfree(rctl_rule_link_zone, link); + removed++; + } + return (removed); +} + +static void +rctl_rule_acquire_subject(struct rctl_rule *rule) +{ + + switch (rule->rr_subject_type) { + case RCTL_SUBJECT_TYPE_UNDEFINED: + case RCTL_SUBJECT_TYPE_PROCESS: + break; + case RCTL_SUBJECT_TYPE_JAIL: + if (rule->rr_subject.rs_prison_racct != NULL) + prison_racct_hold(rule->rr_subject.rs_prison_racct); + break; + case RCTL_SUBJECT_TYPE_USER: + if (rule->rr_subject.rs_uip != NULL) + uihold(rule->rr_subject.rs_uip); + break; + case RCTL_SUBJECT_TYPE_LOGINCLASS: + if (rule->rr_subject.rs_loginclass != NULL) + loginclass_hold(rule->rr_subject.rs_loginclass); + break; + default: + panic("rctl_rule_acquire_subject: unknown subject type %d", + rule->rr_subject_type); + } +} + +static void +rctl_rule_release_subject(struct rctl_rule *rule) +{ + + switch (rule->rr_subject_type) { + case RCTL_SUBJECT_TYPE_UNDEFINED: + case RCTL_SUBJECT_TYPE_PROCESS: + break; + case RCTL_SUBJECT_TYPE_JAIL: + if (rule->rr_subject.rs_prison_racct != NULL) + prison_racct_free(rule->rr_subject.rs_prison_racct); + break; + case RCTL_SUBJECT_TYPE_USER: + if (rule->rr_subject.rs_uip != NULL) + uifree(rule->rr_subject.rs_uip); + break; + case RCTL_SUBJECT_TYPE_LOGINCLASS: + if (rule->rr_subject.rs_loginclass != NULL) + loginclass_free(rule->rr_subject.rs_loginclass); + break; + default: + panic("rctl_rule_release_subject: unknown subject type %d", + rule->rr_subject_type); + } +} + +struct rctl_rule * +rctl_rule_alloc(int flags) +{ + struct rctl_rule *rule; + + rule = uma_zalloc(rctl_rule_zone, flags); + if (rule == NULL) + return (NULL); + rule->rr_subject_type = RCTL_SUBJECT_TYPE_UNDEFINED; + rule->rr_subject.rs_proc = NULL; + rule->rr_subject.rs_uip = NULL; + rule->rr_subject.rs_loginclass = NULL; + rule->rr_subject.rs_prison_racct = NULL; + rule->rr_per = RCTL_SUBJECT_TYPE_UNDEFINED; + rule->rr_resource = RACCT_UNDEFINED; + rule->rr_action = RCTL_ACTION_UNDEFINED; + rule->rr_amount = RCTL_AMOUNT_UNDEFINED; + refcount_init(&rule->rr_refcount, 1); + + return (rule); +} + +struct rctl_rule * +rctl_rule_duplicate(const struct rctl_rule *rule, int flags) +{ + struct rctl_rule *copy; + + copy = uma_zalloc(rctl_rule_zone, flags); + if (copy == NULL) + return (NULL); + copy->rr_subject_type = rule->rr_subject_type; + copy->rr_subject.rs_proc = rule->rr_subject.rs_proc; + copy->rr_subject.rs_uip = rule->rr_subject.rs_uip; + copy->rr_subject.rs_loginclass = rule->rr_subject.rs_loginclass; + copy->rr_subject.rs_prison_racct = rule->rr_subject.rs_prison_racct; + copy->rr_per = rule->rr_per; + copy->rr_resource = rule->rr_resource; + copy->rr_action = rule->rr_action; + copy->rr_amount = rule->rr_amount; + refcount_init(©->rr_refcount, 1); + rctl_rule_acquire_subject(copy); + + return (copy); +} + +void +rctl_rule_acquire(struct rctl_rule *rule) +{ + + KASSERT(rule->rr_refcount > 0, ("rule->rr_refcount <= 0")); + + refcount_acquire(&rule->rr_refcount); +} + +static void +rctl_rule_free(void *context, int pending) +{ + struct rctl_rule *rule; + + rule = (struct rctl_rule *)context; + + KASSERT(rule->rr_refcount == 0, ("rule->rr_refcount != 0")); + + /* + * We don't need locking here; rule is guaranteed to be inaccessible. + */ + + rctl_rule_release_subject(rule); + uma_zfree(rctl_rule_zone, rule); +} + +void +rctl_rule_release(struct rctl_rule *rule) +{ + + KASSERT(rule->rr_refcount > 0, ("rule->rr_refcount <= 0")); + + if (refcount_release(&rule->rr_refcount)) { + /* + * rctl_rule_release() is often called when iterating + * over all the uidinfo structures in the system, + * holding uihashtbl_lock. Since rctl_rule_free() + * might end up calling uifree(), this would lead + * to lock recursion. Use taskqueue to avoid this. + */ + TASK_INIT(&rule->rr_task, 0, rctl_rule_free, rule); + taskqueue_enqueue(taskqueue_thread, &rule->rr_task); + } +} + +static int +rctl_rule_fully_specified(const struct rctl_rule *rule) +{ + + switch (rule->rr_subject_type) { + case RCTL_SUBJECT_TYPE_UNDEFINED: + return (0); + case RCTL_SUBJECT_TYPE_PROCESS: + if (rule->rr_subject.rs_proc == NULL) + return (0); + break; + case RCTL_SUBJECT_TYPE_USER: + if (rule->rr_subject.rs_uip == NULL) + return (0); + break; + case RCTL_SUBJECT_TYPE_LOGINCLASS: + if (rule->rr_subject.rs_loginclass == NULL) + return (0); + break; + case RCTL_SUBJECT_TYPE_JAIL: + if (rule->rr_subject.rs_prison_racct == NULL) + return (0); + break; + default: + panic("rctl_rule_fully_specified: unknown subject type %d", + rule->rr_subject_type); + } + if (rule->rr_resource == RACCT_UNDEFINED) + return (0); + if (rule->rr_action == RCTL_ACTION_UNDEFINED) + return (0); + if (rule->rr_amount == RCTL_AMOUNT_UNDEFINED) + return (0); + if (rule->rr_per == RCTL_SUBJECT_TYPE_UNDEFINED) + return (0); + + return (1); +} + +static int +rctl_string_to_rule(char *rulestr, struct rctl_rule **rulep) +{ + int error = 0; + char *subjectstr, *subject_idstr, *resourcestr, *actionstr, + *amountstr, *perstr; + struct rctl_rule *rule; + id_t id; + + rule = rctl_rule_alloc(M_WAITOK); + + subjectstr = strsep(&rulestr, ":"); + subject_idstr = strsep(&rulestr, ":"); + resourcestr = strsep(&rulestr, ":"); + actionstr = strsep(&rulestr, "=/"); + amountstr = strsep(&rulestr, "/"); + perstr = rulestr; + + if (subjectstr == NULL || subjectstr[0] == '\0') + rule->rr_subject_type = RCTL_SUBJECT_TYPE_UNDEFINED; + else { + error = str2value(subjectstr, &rule->rr_subject_type, subjectnames); + if (error != 0) + goto out; + } + + if (subject_idstr == NULL || subject_idstr[0] == '\0') { + rule->rr_subject.rs_proc = NULL; + rule->rr_subject.rs_uip = NULL; + rule->rr_subject.rs_loginclass = NULL; + rule->rr_subject.rs_prison_racct = NULL; + } else { + switch (rule->rr_subject_type) { + case RCTL_SUBJECT_TYPE_UNDEFINED: + error = EINVAL; + goto out; + case RCTL_SUBJECT_TYPE_PROCESS: + error = str2id(subject_idstr, &id); + if (error != 0) + goto out; + sx_assert(&allproc_lock, SA_LOCKED); + rule->rr_subject.rs_proc = pfind(id); + if (rule->rr_subject.rs_proc == NULL) { + error = ESRCH; + goto out; + } + PROC_UNLOCK(rule->rr_subject.rs_proc); + break; + case RCTL_SUBJECT_TYPE_USER: + error = str2id(subject_idstr, &id); + if (error != 0) + goto out; + rule->rr_subject.rs_uip = uifind(id); + break; + case RCTL_SUBJECT_TYPE_LOGINCLASS: + rule->rr_subject.rs_loginclass = + loginclass_find(subject_idstr); + if (rule->rr_subject.rs_loginclass == NULL) { + error = ENAMETOOLONG; + goto out; + } + break; + case RCTL_SUBJECT_TYPE_JAIL: + rule->rr_subject.rs_prison_racct = + prison_racct_find(subject_idstr); + if (rule->rr_subject.rs_prison_racct == NULL) { + error = ENAMETOOLONG; + goto out; + } + break; + default: + panic("rctl_string_to_rule: unknown subject type %d", + rule->rr_subject_type); + } + } + + if (resourcestr == NULL || resourcestr[0] == '\0') + rule->rr_resource = RACCT_UNDEFINED; + else { + error = str2value(resourcestr, &rule->rr_resource, + resourcenames); + if (error != 0) + goto out; + } + + if (actionstr == NULL || actionstr[0] == '\0') + rule->rr_action = RCTL_ACTION_UNDEFINED; + else { + error = str2value(actionstr, &rule->rr_action, actionnames); + if (error != 0) + goto out; + } + + if (amountstr == NULL || amountstr[0] == '\0') + rule->rr_amount = RCTL_AMOUNT_UNDEFINED; + else { + error = str2int64(amountstr, &rule->rr_amount); + if (error != 0) + goto out; + if (RACCT_IS_IN_MILLIONS(rule->rr_resource)) + rule->rr_amount *= 1000000; + } + + if (perstr == NULL || perstr[0] == '\0') + rule->rr_per = RCTL_SUBJECT_TYPE_UNDEFINED; + else { + error = str2value(perstr, &rule->rr_per, subjectnames); + if (error != 0) + goto out; + } + +out: + if (error == 0) + *rulep = rule; + else + rctl_rule_release(rule); + + return (error); +} + +/* + * Link a rule with all the subjects it applies to. + */ +int +rctl_rule_add(struct rctl_rule *rule) +{ + struct proc *p; + struct ucred *cred; + struct uidinfo *uip; + struct prison *pr; + struct prison_racct *prr; + struct loginclass *lc; + struct rctl_rule *rule2; + int match; + + KASSERT(rctl_rule_fully_specified(rule), ("rule not fully specified")); + + /* + * Some rules just don't make sense. Note that the one below + * cannot be rewritten using RACCT_IS_DENIABLE(); the RACCT_PCTCPU, + * for example, is not deniable in the racct sense, but the + * limit is enforced in a different way, so "deny" rules for %CPU + * do make sense. + */ + if (rule->rr_action == RCTL_ACTION_DENY && + (rule->rr_resource == RACCT_CPU || + rule->rr_resource == RACCT_WALLCLOCK)) + return (EOPNOTSUPP); + + if (rule->rr_per == RCTL_SUBJECT_TYPE_PROCESS && + RACCT_IS_SLOPPY(rule->rr_resource)) + return (EOPNOTSUPP); + + /* + * Make sure there are no duplicated rules. Also, for the "deny" + * rules, remove ones differing only by "amount". + */ + if (rule->rr_action == RCTL_ACTION_DENY) { + rule2 = rctl_rule_duplicate(rule, M_WAITOK); + rule2->rr_amount = RCTL_AMOUNT_UNDEFINED; + rctl_rule_remove(rule2); + rctl_rule_release(rule2); + } else + rctl_rule_remove(rule); + + switch (rule->rr_subject_type) { + case RCTL_SUBJECT_TYPE_PROCESS: + p = rule->rr_subject.rs_proc; + KASSERT(p != NULL, ("rctl_rule_add: NULL proc")); + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Tue May 22 10:16:21 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id EF66B106566B for ; Tue, 22 May 2012 10:16:19 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 22 May 2012 10:16:18 +0000 Date: Tue, 22 May 2012 10:16:18 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120522101619.EF66B106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r236127 - soc2012/oleksandr/udf-head/sys/fs/udf2 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 May 2012 10:16:21 -0000 Author: oleksandr Date: Tue May 22 10:16:18 2012 New Revision: 236127 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236127 Log: Initial import NetBSD UDF implementation Added: soc2012/oleksandr/udf-head/sys/fs/udf2/ soc2012/oleksandr/udf-head/sys/fs/udf2/Makefile soc2012/oleksandr/udf-head/sys/fs/udf2/ecma167-udf.h soc2012/oleksandr/udf-head/sys/fs/udf2/files.udf soc2012/oleksandr/udf-head/sys/fs/udf2/udf.h soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_bswap.h soc2012/oleksandr/udf-head/sys/fs/udf2/udf_mount.h soc2012/oleksandr/udf-head/sys/fs/udf2/udf_osta.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_osta.h soc2012/oleksandr/udf-head/sys/fs/udf2/udf_readwrite.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_strat_bootstrap.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_strat_direct.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_strat_rmw.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_strat_sequential.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.h soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vnops.c Added: soc2012/oleksandr/udf-head/sys/fs/udf2/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/Makefile Tue May 22 10:16:18 2012 (r236127) @@ -0,0 +1,7 @@ +# $NetBSD: Makefile,v 1.1 2006/02/02 15:19:15 reinoud Exp $ + +INCSDIR= /usr/include/fs/udf + +INCS= ecma167-udf.h udf_mount.h + +.include Added: soc2012/oleksandr/udf-head/sys/fs/udf2/ecma167-udf.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/ecma167-udf.h Tue May 22 10:16:18 2012 (r236127) @@ -0,0 +1,835 @@ +/* $NetBSD: ecma167-udf.h,v 1.14 2011/07/07 17:45:38 reinoud Exp $ */ + +/*- + * Copyright (c) 2003, 2004, 2005, 2006, 2008, 2009 + * Reinoud Zandijk * + * Copyright (c) 2001, 2002 Scott Long + * 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. + * + * + * Extended and adapted for UDFv2.50+ bij Reinoud Zandijk based on the + * original by Scott Long. + * + * 20030508 Made some small typo and explanatory comments + * 20030510 Added UDF 2.01 structures + * 20030519 Added/correct comments on multi-partitioned logical volume space + * 20050616 Added pseudo overwrite + * 20050624 Added the missing extended attribute types and `magic values'. + * 20051106 Reworked some implementation use parts + * + */ + + +#ifndef _FS_UDF_ECMA167_UDF_H_ +#define _FS_UDF_ECMA167_UDF_H_ + + +/* + * in case of an older gcc versions, define the __packed as explicit + * attribute + */ + +/* + * You may specify the `aligned' and `transparent_union' attributes either in + * a `typedef' declaration or just past the closing curly brace of a complete + * enum, struct or union type _definition_ and the `packed' attribute only + * past the closing brace of a definition. You may also specify attributes + * between the enum, struct or union tag and the name of the type rather than + * after the closing brace. +*/ + +#ifndef __packed +#define __packed __attribute__((packed)) +#endif + + +/* ecma167-udf.h */ + +/* Volume recognition sequence ECMA 167 rev. 3 16.1 */ +struct vrs_desc { + uint8_t struct_type; + uint8_t identifier[5]; + uint8_t version; + uint8_t data[2041]; +} __packed; + + +#define VRS_NSR02 "NSR02" +#define VRS_NSR03 "NSR03" +#define VRS_BEA01 "BEA01" +#define VRS_TEA01 "TEA01" +#define VRS_CD001 "CD001" +#define VRS_CDW02 "CDW02" + + +/* Structure/definitions/constants a la ECMA 167 rev. 3 */ + + +#define MAX_TAGID_VOLUMES 9 +/* Tag identifiers */ +enum { + TAGID_SPARING_TABLE = 0, + TAGID_PRI_VOL = 1, + TAGID_ANCHOR = 2, + TAGID_VOL = 3, + TAGID_IMP_VOL = 4, + TAGID_PARTITION = 5, + TAGID_LOGVOL = 6, + TAGID_UNALLOC_SPACE = 7, + TAGID_TERM = 8, + TAGID_LOGVOL_INTEGRITY= 9, + TAGID_FSD = 256, + TAGID_FID = 257, + TAGID_ALLOCEXTENT = 258, + TAGID_INDIRECTENTRY = 259, + TAGID_ICB_TERM = 260, + TAGID_FENTRY = 261, + TAGID_EXTATTR_HDR = 262, + TAGID_UNALL_SP_ENTRY = 263, + TAGID_SPACE_BITMAP = 264, + TAGID_PART_INTEGRITY = 265, + TAGID_EXTFENTRY = 266, + TAGID_MAX = 266 +}; + + +enum { + UDF_DOMAIN_FLAG_HARD_WRITE_PROTECT = 1, + UDF_DOMAIN_FLAG_SOFT_WRITE_PROTECT = 2 +}; + + +enum { + UDF_ACCESSTYPE_NOT_SPECIFIED = 0, /* unknown */ + UDF_ACCESSTYPE_PSEUDO_OVERWITE = 0, /* pseudo overwritable, e.g. BD-R's LOW */ + UDF_ACCESSTYPE_READ_ONLY = 1, /* really only readable */ + UDF_ACCESSTYPE_WRITE_ONCE = 2, /* write once and you're done */ + UDF_ACCESSTYPE_REWRITEABLE = 3, /* may need extra work to rewrite */ + UDF_ACCESSTYPE_OVERWRITABLE = 4 /* no limits on rewriting; e.g. harddisc*/ +}; + + +/* Descriptor tag [3/7.2] */ +struct desc_tag { + uint16_t id; + uint16_t descriptor_ver; + uint8_t cksum; + uint8_t reserved; + uint16_t serial_num; + uint16_t desc_crc; + uint16_t desc_crc_len; + uint32_t tag_loc; +} __packed; +#define UDF_DESC_TAG_LENGTH 16 + + +/* Recorded Address [4/7.1] */ +struct lb_addr { /* within partition space */ + uint32_t lb_num; + uint16_t part_num; +} __packed; + + +/* Extent Descriptor [3/7.1] */ +struct extent_ad { + uint32_t len; + uint32_t loc; +} __packed; + + +/* Short Allocation Descriptor [4/14.14.1] */ +struct short_ad { + uint32_t len; + uint32_t lb_num; +} __packed; + + +/* Long Allocation Descriptor [4/14.14.2] */ +struct UDF_ADImp_use { + uint16_t flags; + uint32_t unique_id; +} __packed; +#define UDF_ADIMP_FLAGS_EXTENT_ERASED 1 + + +struct long_ad { + uint32_t len; + struct lb_addr loc; /* within a logical volume mapped partition space !! */ + union { + uint8_t bytes[6]; + struct UDF_ADImp_use im_used; + } impl; +} __packed; +#define longad_uniqueid impl.im_used.unique_id + + +/* Extended Allocation Descriptor [4/14.14.3] ; identifies an extent of allocation descriptors ; also in UDF ? */ +struct ext_ad { + uint32_t ex_len; + uint32_t rec_len; + uint32_t inf_len; + struct lb_addr ex_loc; + uint8_t reserved[2]; +} __packed; + + +/* ICB : Information Control Block; positioning */ +union icb { + struct short_ad s_ad; + struct long_ad l_ad; + struct ext_ad e_ad; +}; + + +/* short/long/ext extent have flags encoded in length */ +#define UDF_EXT_ALLOCATED (0<<30) +#define UDF_EXT_FREED (1<<30) +#define UDF_EXT_ALLOCATED_BUT_NOT_USED (1<<30) +#define UDF_EXT_FREE (2<<30) +#define UDF_EXT_REDIRECT (3<<30) +#define UDF_EXT_FLAGS(len) ((len) & (3<<30)) +#define UDF_EXT_LEN(len) ((len) & ((1<<30)-1)) +#define UDF_EXT_MAXLEN ((1<<30)-1) + + +/* Character set spec [1/7.2.1] */ +struct charspec { + uint8_t type; + uint8_t inf[63]; +} __packed; + + +struct pathcomp { + uint8_t type; + uint8_t l_ci; + uint16_t comp_filever; + uint8_t ident[256]; +} __packed; +#define UDF_PATH_COMP_SIZE 4 +#define UDF_PATH_COMP_RESERVED 0 +#define UDF_PATH_COMP_ROOT 1 +#define UDF_PATH_COMP_MOUNTROOT 2 +#define UDF_PATH_COMP_PARENTDIR 3 +#define UDF_PATH_COMP_CURDIR 4 +#define UDF_PATH_COMP_NAME 5 + + +/* Timestamp [1/7.3] */ +struct timestamp { + uint16_t type_tz; + uint16_t year; + uint8_t month; + uint8_t day; + uint8_t hour; + uint8_t minute; + uint8_t second; + uint8_t centisec; + uint8_t hund_usec; + uint8_t usec; +} __packed; +#define UDF_TIMESTAMP_SIZE 12 + + +/* Entity Identifier [1/7.4] */ +#define UDF_REGID_ID_SIZE 23 +struct regid { + uint8_t flags; + uint8_t id[UDF_REGID_ID_SIZE]; + uint8_t id_suffix[8]; +} __packed; + + +/* ICB Tag [4/14.6] */ +struct icb_tag { + uint32_t prev_num_dirs; + uint16_t strat_type; + uint8_t strat_param[2]; + uint16_t max_num_entries; + uint8_t reserved; + uint8_t file_type; + struct lb_addr parent_icb; + uint16_t flags; +} __packed; +#define UDF_ICB_TAG_FLAGS_ALLOC_MASK 0x03 +#define UDF_ICB_SHORT_ALLOC 0x00 +#define UDF_ICB_LONG_ALLOC 0x01 +#define UDF_ICB_EXT_ALLOC 0x02 +#define UDF_ICB_INTERN_ALLOC 0x03 + +#define UDF_ICB_TAG_FLAGS_DIRORDERED (1<< 3) +#define UDF_ICB_TAG_FLAGS_NONRELOC (1<< 4) +#define UDF_ICB_TAG_FLAGS_CONTIGUES (1<< 9) +#define UDF_ICB_TAG_FLAGS_MULTIPLEVERS (1<<12) + +#define UDF_ICB_TAG_FLAGS_SETUID (1<< 6) +#define UDF_ICB_TAG_FLAGS_SETGID (1<< 7) +#define UDF_ICB_TAG_FLAGS_STICKY (1<< 8) + +#define UDF_ICB_FILETYPE_UNKNOWN 0 +#define UDF_ICB_FILETYPE_UNALLOCSPACE 1 +#define UDF_ICB_FILETYPE_PARTINTEGRITY 2 +#define UDF_ICB_FILETYPE_INDIRECTENTRY 3 +#define UDF_ICB_FILETYPE_DIRECTORY 4 +#define UDF_ICB_FILETYPE_RANDOMACCESS 5 +#define UDF_ICB_FILETYPE_BLOCKDEVICE 6 +#define UDF_ICB_FILETYPE_CHARDEVICE 7 +#define UDF_ICB_FILETYPE_EXTATTRREC 8 +#define UDF_ICB_FILETYPE_FIFO 9 +#define UDF_ICB_FILETYPE_SOCKET 10 +#define UDF_ICB_FILETYPE_TERM 11 +#define UDF_ICB_FILETYPE_SYMLINK 12 +#define UDF_ICB_FILETYPE_STREAMDIR 13 +#define UDF_ICB_FILETYPE_VAT 248 +#define UDF_ICB_FILETYPE_REALTIME 249 +#define UDF_ICB_FILETYPE_META_MAIN 250 +#define UDF_ICB_FILETYPE_META_MIRROR 251 +#define UDF_ICB_FILETYPE_META_BITMAP 252 + + +/* Anchor Volume Descriptor Pointer [3/10.2] */ +struct anchor_vdp { + struct desc_tag tag; + struct extent_ad main_vds_ex; /* to main volume descriptor set ; 16 sectors min */ + struct extent_ad reserve_vds_ex; /* copy of main volume descriptor set ; 16 sectors min */ +} __packed; + + +/* Volume Descriptor Pointer [3/10.3] */ +struct vol_desc_ptr { + struct desc_tag tag; /* use for extending the volume descriptor space */ + uint32_t vds_number; + struct extent_ad next_vds_ex; /* points to the next block for volume descriptor space */ +} __packed; + + +/* Primary Volume Descriptor [3/10.1] */ +struct pri_vol_desc { + struct desc_tag tag; + uint32_t seq_num; /* MAX prevail */ + uint32_t pvd_num; /* assigned by author; 0 is special as in it may only occur once */ + char vol_id[32]; /* KEY ; main identifier of this disc */ + uint16_t vds_num; /* volume descriptor number; i.e. what volume number is it */ + uint16_t max_vol_seq; /* maximum volume descriptor number known */ + uint16_t ichg_lvl; + uint16_t max_ichg_lvl; + uint32_t charset_list; + uint32_t max_charset_list; + char volset_id[128]; /* KEY ; if part of a multi-disc set or a band of volumes */ + struct charspec desc_charset; /* KEY according to ECMA 167 */ + struct charspec explanatory_charset; + struct extent_ad vol_abstract; + struct extent_ad vol_copyright; + struct regid app_id; + struct timestamp time; + struct regid imp_id; + uint8_t imp_use[64]; + uint32_t prev_vds_loc; /* location of predecessor _lov ? */ + uint16_t flags; /* bit 0 : if set indicates volume set name is meaningful */ + uint8_t reserved[22]; +} __packed; + + +/* UDF specific implementation use part of the implementation use volume descriptor */ +struct udf_lv_info { + struct charspec lvi_charset; + char logvol_id[128]; + + char lvinfo1[36]; + char lvinfo2[36]; + char lvinfo3[36]; + + struct regid impl_id; + uint8_t impl_use[128]; +} __packed; + + +/* Implementation use Volume Descriptor */ +struct impvol_desc { + struct desc_tag tag; + uint32_t seq_num; + struct regid impl_id; + union { + struct udf_lv_info lv_info; + char impl_use[460]; + } _impl_use; +} __packed; + + +/* Logical Volume Descriptor [3/10.6] */ +struct logvol_desc { + struct desc_tag tag; + uint32_t seq_num; /* MAX prevail */ + struct charspec desc_charset; /* KEY */ + char logvol_id[128]; /* KEY */ + uint32_t lb_size; + struct regid domain_id; + union { + struct long_ad fsd_loc; /* to fileset descriptor SEQUENCE */ + uint8_t logvol_content_use[16]; + } _lvd_use; + uint32_t mt_l; /* Partition map length */ + uint32_t n_pm; /* Number of partition maps */ + struct regid imp_id; + uint8_t imp_use[128]; + struct extent_ad integrity_seq_loc; + uint8_t maps[1]; +} __packed; +#define lv_fsd_loc _lvd_use.fsd_loc + +#define UDF_INTEGRITY_OPEN 0 +#define UDF_INTEGRITY_CLOSED 1 + + +#define UDF_PMAP_SIZE 64 + +/* Type 1 Partition Map [3/10.7.2] */ +struct part_map_1 { + uint8_t type; + uint8_t len; + uint16_t vol_seq_num; + uint16_t part_num; +} __packed; + + +/* Type 2 Partition Map [3/10.7.3] */ +struct part_map_2 { + uint8_t type; + uint8_t len; + uint8_t reserved[2]; + struct regid part_id; + uint16_t vol_seq_num; + uint16_t part_num; + uint8_t reserved2[24]; +} __packed; + + +/* Virtual Partition Map [UDF 2.01/2.2.8] */ +struct part_map_virt { + uint8_t type; + uint8_t len; + uint8_t reserved[2]; + struct regid id; + uint16_t vol_seq_num; + uint16_t part_num; + uint8_t reserved1[24]; +} __packed; + + +/* Sparable Partition Map [UDF 2.01/2.2.9] */ +struct part_map_spare { + uint8_t type; + uint8_t len; + uint8_t reserved[2]; + struct regid id; + uint16_t vol_seq_num; + uint16_t part_num; + uint16_t packet_len; + uint8_t n_st; /* Number of redundant sparing tables range 1-4 */ + uint8_t reserved1; + uint32_t st_size; /* size of EACH sparing table */ + uint32_t st_loc[1]; /* locations of sparing tables */ +} __packed; + + +/* Metadata Partition Map [UDF 2.50/2.2.10] */ +struct part_map_meta { + uint8_t type; + uint8_t len; + uint8_t reserved[2]; + struct regid id; + uint16_t vol_seq_num; + uint16_t part_num; + uint32_t meta_file_lbn; /* logical block number for file entry within part_num */ + uint32_t meta_mirror_file_lbn; + uint32_t meta_bitmap_file_lbn; + uint32_t alloc_unit_size; /* allocation unit size in blocks */ + uint16_t alignment_unit_size; /* alignment necessary in blocks */ + uint8_t flags; + uint8_t reserved1[5]; +} __packed; +#define METADATA_DUPLICATED 1 + + +union udf_pmap { + uint8_t data[UDF_PMAP_SIZE]; + struct part_map_1 pm1; + struct part_map_2 pm2; + struct part_map_virt pmv; + struct part_map_spare pms; + struct part_map_meta pmm; +}; + + +/* Sparing Map Entry [UDF 2.01/2.2.11] */ +struct spare_map_entry { + uint32_t org; /* partition relative address */ + uint32_t map; /* absolute disc address (!) can be in partition, but doesn't have to be */ +} __packed; + + +/* Sparing Table [UDF 2.01/2.2.11] */ +struct udf_sparing_table { + struct desc_tag tag; + struct regid id; + uint16_t rt_l; /* Relocation Table len */ + uint8_t reserved[2]; + uint32_t seq_num; + struct spare_map_entry entries[1]; +} __packed; + + +#define UDF_NO_PREV_VAT 0xffffffff +/* UDF 1.50 VAT suffix [UDF 2.2.10 (UDF 1.50 spec)] */ +struct udf_oldvat_tail { + struct regid id; /* "*UDF Virtual Alloc Tbl" */ + uint32_t prev_vat; +} __packed; + + +/* VAT table [UDF 2.0.1/2.2.10] */ +struct udf_vat { + uint16_t header_len; + uint16_t impl_use_len; + char logvol_id[128]; /* newer version of the LVD one */ + uint32_t prev_vat; + uint32_t num_files; + uint32_t num_directories; + uint16_t min_udf_readver; + uint16_t min_udf_writever; + uint16_t max_udf_writever; + uint16_t reserved; + uint8_t data[1]; /* impl.use followed by VAT entries (uint32_t) */ +} __packed; + + +/* Space bitmap descriptor as found in the partition header descriptor */ +struct space_bitmap_desc { + struct desc_tag tag; /* TagId 264 */ + uint32_t num_bits; /* number of bits */ + uint32_t num_bytes; /* bytes that contain it */ + uint8_t data[1]; +} __packed; + + +/* Unalloc space entry as found in the partition header descriptor */ +struct space_entry_desc { + struct desc_tag tag; /* TagId 263 */ + struct icb_tag icbtag; /* type 1 */ + uint32_t l_ad; /* in bytes */ + uint8_t entry[1]; +} __packed; + + +/* Partition header descriptor; in the contents_use of part_desc */ +struct part_hdr_desc { + struct short_ad unalloc_space_table; + struct short_ad unalloc_space_bitmap; + struct short_ad part_integrity_table; /* has to be ZERO for UDF */ + struct short_ad freed_space_table; + struct short_ad freed_space_bitmap; + uint8_t reserved[88]; +} __packed; + + +/* Partition Descriptor [3/10.5] */ +struct part_desc { + struct desc_tag tag; + uint32_t seq_num; /* MAX prevailing */ + uint16_t flags; /* bit 0 : if set the space is allocated */ + uint16_t part_num; /* KEY */ + struct regid contents; + union { + struct part_hdr_desc part_hdr; + uint8_t contents_use[128]; + } _impl_use; + uint32_t access_type; /* R/W, WORM etc. */ + uint32_t start_loc; /* start of partition with given length */ + uint32_t part_len; + struct regid imp_id; + uint8_t imp_use[128]; + uint8_t reserved[156]; +} __packed; +#define pd_part_hdr _impl_use.part_hdr +#define UDF_PART_FLAG_ALLOCATED 1 + + +/* Unallocated Space Descriptor (UDF 2.01/2.2.5) */ +struct unalloc_sp_desc { + struct desc_tag tag; + uint32_t seq_num; /* MAX prevailing */ + uint32_t alloc_desc_num; + struct extent_ad alloc_desc[1]; +} __packed; + + +/* Logical Volume Integrity Descriptor [3/30.10] */ +struct logvolhdr { + uint64_t next_unique_id; + /* rest reserved */ +} __packed; + + +struct udf_logvol_info { + struct regid impl_id; + uint32_t num_files; + uint32_t num_directories; + uint16_t min_udf_readver; + uint16_t min_udf_writever; + uint16_t max_udf_writever; +} __packed; + + +struct logvol_int_desc { + struct desc_tag tag; + struct timestamp time; + uint32_t integrity_type; + struct extent_ad next_extent; + union { + struct logvolhdr logvolhdr; + int8_t reserved[32]; + } _impl_use; + uint32_t num_part; + uint32_t l_iu; + uint32_t tables[1]; /* Freespace table, Sizetable, Implementation use */ +} __packed; +#define lvint_next_unique_id _impl_use.logvolhdr.next_unique_id + + +/* File Set Descriptor [4/14.1] */ +struct fileset_desc { + struct desc_tag tag; + struct timestamp time; + uint16_t ichg_lvl; + uint16_t max_ichg_lvl; + uint32_t charset_list; + uint32_t max_charset_list; + uint32_t fileset_num; /* key! */ + uint32_t fileset_desc_num; + struct charspec logvol_id_charset; + char logvol_id[128]; /* for recovery */ + struct charspec fileset_charset; + char fileset_id[32]; /* Mountpoint !! */ + char copyright_file_id[32]; + char abstract_file_id[32]; + struct long_ad rootdir_icb; /* to rootdir; icb->virtual ? */ + struct regid domain_id; + struct long_ad next_ex; /* to the next fileset_desc extent */ + struct long_ad streamdir_icb; /* streamdir; needed? */ + uint8_t reserved[32]; +} __packed; + + +/* File Identifier Descriptor [4/14.4] */ +struct fileid_desc { + struct desc_tag tag; + uint16_t file_version_num; + uint8_t file_char; + uint8_t l_fi; /* Length of file identifier area */ + struct long_ad icb; + uint16_t l_iu; /* Length of implementation use area */ + uint8_t data[0]; +} __packed; +#define UDF_FID_SIZE 38 +#define UDF_FILE_CHAR_VIS (1 << 0) /* Invisible */ +#define UDF_FILE_CHAR_DIR (1 << 1) /* Directory */ +#define UDF_FILE_CHAR_DEL (1 << 2) /* Deleted */ +#define UDF_FILE_CHAR_PAR (1 << 3) /* Parent Directory */ +#define UDF_FILE_CHAR_META (1 << 4) /* Stream metadata */ + + +/* Extended attributes [4/14.10.1] */ +struct extattrhdr_desc { + struct desc_tag tag; + uint32_t impl_attr_loc; /* offsets within this descriptor */ + uint32_t appl_attr_loc; /* ditto */ +} __packed; +#define UDF_IMPL_ATTR_LOC_NOT_PRESENT 0xffffffff +#define UDF_APPL_ATTR_LOC_NOT_PRESENT 0xffffffff + + +/* Extended attribute entry [4/48.10.2] */ +struct extattr_entry { + uint32_t type; + uint8_t subtype; + uint8_t reserved[3]; + uint32_t a_l; +} __packed; + + +/* Extended attribute entry; type 2048 [4/48.10.8] */ +struct impl_extattr_entry { + struct extattr_entry hdr; + uint32_t iu_l; + struct regid imp_id; + uint8_t data[1]; +} __packed; + + +/* Extended attribute entry; type 65 536 [4/48.10.9] */ +struct appl_extattr_entry { + struct extattr_entry hdr; + uint32_t au_l; + struct regid appl_id; + uint8_t data[1]; +} __packed; + + +/* File Times attribute entry; type 5 or type 6 [4/48.10.5], [4/48.10.6] */ +struct filetimes_extattr_entry { + struct extattr_entry hdr; + uint32_t d_l; /* length of times[] data following */ + uint32_t existence; /* bitmask */ + struct timestamp times[1]; /* in order of ascending bits */ +} __packed; +#define UDF_FILETIMES_ATTR_NO 5 +#define UDF_FILETIMES_FILE_CREATION 1 +#define UDF_FILETIMES_FILE_DELETION 4 +#define UDF_FILETIMES_FILE_EFFECTIVE 8 +#define UDF_FILETIMES_FILE_BACKUPED 16 +#define UDF_FILETIMES_ATTR_SIZE(no) (20 + (no)*sizeof(struct timestamp)) + + +/* Device Specification Extended Attribute [4/4.10.7] */ +struct device_extattr_entry { + struct extattr_entry hdr; + uint32_t iu_l; /* length of implementation use */ + uint32_t major; + uint32_t minor; + uint8_t data[1]; /* UDF: if nonzero length, contain developer ID regid */ +} __packed; +#define UDF_DEVICESPEC_ATTR_NO 12 + + +/* VAT LV extension Extended Attribute [UDF 3.3.4.5.1.3] 1.50 errata */ +struct vatlvext_extattr_entry { + uint64_t unique_id_chk; /* needs to be copy of ICB's */ + uint32_t num_files; + uint32_t num_directories; + char logvol_id[128]; /* replaces logvol name */ +} __packed; + + +/* File Entry [4/14.9] */ +struct file_entry { + struct desc_tag tag; + struct icb_tag icbtag; + uint32_t uid; + uint32_t gid; + uint32_t perm; + uint16_t link_cnt; + uint8_t rec_format; + uint8_t rec_disp_attr; + uint32_t rec_len; + uint64_t inf_len; + uint64_t logblks_rec; + struct timestamp atime; + struct timestamp mtime; + struct timestamp attrtime; + uint32_t ckpoint; + struct long_ad ex_attr_icb; + struct regid imp_id; + uint64_t unique_id; + uint32_t l_ea; /* Length of extended attribute area */ + uint32_t l_ad; /* Length of allocation descriptors */ + uint8_t data[1]; +} __packed; +#define UDF_FENTRY_SIZE 176 +#define UDF_FENTRY_PERM_USER_MASK 0x07 +#define UDF_FENTRY_PERM_GRP_MASK 0xE0 +#define UDF_FENTRY_PERM_OWNER_MASK 0x1C00 + + +/* Extended File Entry [4/48.17] */ +struct extfile_entry { + struct desc_tag tag; + struct icb_tag icbtag; + uint32_t uid; + uint32_t gid; + uint32_t perm; + uint16_t link_cnt; + uint8_t rec_format; + uint8_t rec_disp_attr; + uint32_t rec_len; + uint64_t inf_len; + uint64_t obj_size; + uint64_t logblks_rec; + struct timestamp atime; + struct timestamp mtime; + struct timestamp ctime; + struct timestamp attrtime; + uint32_t ckpoint; + uint32_t reserved1; + struct long_ad ex_attr_icb; + struct long_ad streamdir_icb; + struct regid imp_id; + uint64_t unique_id; + uint32_t l_ea; /* Length of extended attribute area */ + uint32_t l_ad; /* Length of allocation descriptors */ + uint8_t data[1]; +} __packed; +#define UDF_EXTFENTRY_SIZE 216 + + +/* Indirect entry [ecma 48.7] */ +struct indirect_entry { + struct desc_tag tag; + struct icb_tag icbtag; + struct long_ad indirect_icb; +} __packed; + + +/* Allocation extent descriptor [ecma 48.5] */ +struct alloc_ext_entry { + struct desc_tag tag; + uint32_t prev_entry; + uint32_t l_ad; + uint8_t data[1]; +} __packed; + + +union dscrptr { + struct desc_tag tag; + struct anchor_vdp avdp; + struct vol_desc_ptr vdp; + struct pri_vol_desc pvd; + struct logvol_desc lvd; + struct unalloc_sp_desc usd; + struct logvol_int_desc lvid; + struct impvol_desc ivd; + struct part_desc pd; + struct fileset_desc fsd; + struct fileid_desc fid; + struct file_entry fe; + struct extfile_entry efe; + struct extattrhdr_desc eahd; + struct indirect_entry inde; + struct alloc_ext_entry aee; + struct udf_sparing_table spt; + struct space_bitmap_desc sbd; + struct space_entry_desc sed; +}; + + +#endif /* !_FS_UDF_ECMA167_UDF_H_ */ + Added: soc2012/oleksandr/udf-head/sys/fs/udf2/files.udf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/files.udf Tue May 22 10:16:18 2012 (r236127) @@ -0,0 +1,15 @@ +# $NetBSD: files.udf,v 1.4 2010/03/02 16:43:48 pooka Exp $ + +deffs UDF + +file fs/udf/udf_osta.c udf +file fs/udf/udf_vfsops.c udf +file fs/udf/udf_vnops.c udf +file fs/udf/udf_subr.c udf +file fs/udf/udf_readwrite.c udf +file fs/udf/udf_strat_bootstrap.c udf +file fs/udf/udf_strat_sequential.c udf +file fs/udf/udf_strat_direct.c udf +file fs/udf/udf_strat_rmw.c udf +file fs/udf/udf_allocation.c udf + Added: soc2012/oleksandr/udf-head/sys/fs/udf2/udf.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf.h Tue May 22 10:16:18 2012 (r236127) @@ -0,0 +1,426 @@ +/* $NetBSD: udf.h,v 1.44 2011/09/27 01:13:16 christos Exp $ */ + +/* + * Copyright (c) 2006, 2008 Reinoud Zandijk + * 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 ``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 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 _FS_UDF_UDF_H_ +#define _FS_UDF_UDF_H_ + +#include +#include +#include +#include + +#include "udf_osta.h" +#include "ecma167-udf.h" +#include +#include +#include +#include +#include + +/* debug section */ +extern int udf_verbose; + +/* undefine UDF_COMPLETE_DELETE to need `purge'; but purge is not implemented */ +#define UDF_COMPLETE_DELETE + +/* debug categories */ +#define UDF_DEBUG_VOLUMES 0x0000001 +#define UDF_DEBUG_LOCKING 0x0000002 +#define UDF_DEBUG_NODE 0x0000004 +#define UDF_DEBUG_LOOKUP 0x0000008 +#define UDF_DEBUG_READDIR 0x0000010 +#define UDF_DEBUG_FIDS 0x0000020 +#define UDF_DEBUG_DESCRIPTOR 0x0000040 +#define UDF_DEBUG_TRANSLATE 0x0000080 +#define UDF_DEBUG_STRATEGY 0x0000100 +#define UDF_DEBUG_READ 0x0000200 +#define UDF_DEBUG_WRITE 0x0000400 +#define UDF_DEBUG_CALL 0x0000800 +#define UDF_DEBUG_ATTR 0x0001000 +#define UDF_DEBUG_EXTATTR 0x0002000 +#define UDF_DEBUG_ALLOC 0x0004000 +#define UDF_DEBUG_ADWLK 0x0008000 +#define UDF_DEBUG_DIRHASH 0x0010000 +#define UDF_DEBUG_NOTIMPL 0x0020000 +#define UDF_DEBUG_SHEDULE 0x0040000 +#define UDF_DEBUG_ECCLINE 0x0080000 +#define UDF_DEBUG_SYNC 0x0100000 +#define UDF_DEBUG_PARANOIA 0x0200000 +#define UDF_DEBUG_PARANOIDADWLK 0x0400000 +#define UDF_DEBUG_NODEDUMP 0x0800000 +#define UDF_DEBUG_RESERVE 0x1000000 + +/* initial value of udf_verbose */ +#define UDF_DEBUGGING 0 + +#ifdef DEBUG +#define DPRINTF(name, arg) { \ + if (udf_verbose & UDF_DEBUG_##name) {\ + printf arg;\ + };\ + } +#define DPRINTFIF(name, cond, arg) { \ + if (udf_verbose & UDF_DEBUG_##name) { \ + if (cond) printf arg;\ + };\ + } +#else +#define DPRINTF(name, arg) {} +#define DPRINTFIF(name, cond, arg) {} +#endif + + +/* constants to identify what kind of identifier we are dealing with */ +#define UDF_REGID_DOMAIN 1 +#define UDF_REGID_UDF 2 +#define UDF_REGID_IMPLEMENTATION 3 +#define UDF_REGID_APPLICATION 4 +#define UDF_REGID_NAME 99 + + +/* DON'T change these: they identify 13thmonkey's UDF implementation */ +#define APP_NAME "*NetBSD UDF" +#define APP_VERSION_MAIN 0 +#define APP_VERSION_SUB 5 +#define IMPL_NAME "*NetBSD kernel UDF" + + +/* Configuration values */ +#define UDF_INODE_HASHBITS 10 +#define UDF_INODE_HASHSIZE (1< Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 02B64106564A for ; Tue, 22 May 2012 10:20:24 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 22 May 2012 10:20:24 +0000 Date: Tue, 22 May 2012 10:20:24 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120522102024.02B64106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r236128 - soc2012/oleksandr/udf-head/sys/modules/udf2 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 May 2012 10:20:26 -0000 Author: oleksandr Date: Tue May 22 10:20:23 2012 New Revision: 236128 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236128 Log: Create module for udf2 Added: soc2012/oleksandr/udf-head/sys/modules/udf2/ soc2012/oleksandr/udf-head/sys/modules/udf2/Makefile Added: soc2012/oleksandr/udf-head/sys/modules/udf2/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/oleksandr/udf-head/sys/modules/udf2/Makefile Tue May 22 10:20:23 2012 (r236128) @@ -0,0 +1,11 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../fs/udf2 + +KMOD= udf2 + +SRCS= udf_vfsops.c udf_vnops.c udf_osta.c +SRCS+= vnode_if.h +EXPORT_SYMS= udf_iconv + +.include From owner-svn-soc-all@FreeBSD.ORG Tue May 22 11:53:25 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id EFB0F1065674 for ; Tue, 22 May 2012 11:53:22 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 22 May 2012 11:53:22 +0000 Date: Tue, 22 May 2012 11:53:22 +0000 From: rudot@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120522115322.EFB0F1065674@hub.freebsd.org> Cc: Subject: socsvn commit: r236131 - in soc2012/rudot/aux: . config X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 May 2012 11:53:25 -0000 Author: rudot Date: Tue May 22 11:53:22 2012 New Revision: 236131 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236131 Log: some small scripts,programs,config files... that will be helpful for me during the development. Added: soc2012/rudot/aux/ soc2012/rudot/aux/add.sh (contents, props changed) soc2012/rudot/aux/config/ soc2012/rudot/aux/config/RCTL soc2012/rudot/aux/dummy_process.c soc2012/rudot/aux/gdb_connect.sh (contents, props changed) soc2012/rudot/aux/notes.txt Added: soc2012/rudot/aux/add.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/aux/add.sh Tue May 22 11:53:22 2012 (r236131) @@ -0,0 +1,8 @@ +if [ ! $# == 1 ]; then + echo "Usage: $0 pid" + exit +fi + +PID=$1 + +rctl -a process:${PID}:cpup:limit=50 Added: soc2012/rudot/aux/config/RCTL ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/aux/config/RCTL Tue May 22 11:53:22 2012 (r236131) @@ -0,0 +1,343 @@ +cpu I486_CPU +cpu I586_CPU +cpu I686_CPU +ident GENERIC + +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 NFSCL # New Network Filesystem Client +options NFSD # New Network Filesystem Server +options NFSLOCKD # Network Lock Manager +options NFS_ROOT # NFS usable as /, requires NFSCL +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_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 PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed. +options KBD_INSTALL_CDEV # install a CDEV entry in /dev +options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) +options AUDIT # Security event auditing +options MAC # TrustedBSD MAC Framework +#options KDTRACE_HOOKS # Kernel DTrace hooks +options INCLUDE_CONFIG_FILE # Include this file in kernel +options KDB # Kernel debugger related code +options KDB_TRACE # Print a stack trace for a panic +options DDB +options GDB + +# RCTL +options RACCT +options RCTL + +# 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 controllers +device ahci # AHCI-compatible SATA controllers +device ata # Legacy ATA/SATA controllers +options ATA_CAM # Handle legacy controllers with CAM +options ATA_STATIC_ID # Static device numbering +device mvs # Marvell 88SX50XX/88SX60XX/88SX70XX/SoC SATA +device siis # SiliconImage SiI3124/SiI3132/SiI3531 SATA + +# 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 esp # AMD Am53C974 (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') +device trm # Tekram DC395U/UW/F DC315U adapters + +device adv # Advansys SCSI adapters +device adw # Advansys wide SCSI adapters +device aha # Adaptec 154x SCSI adapters +device aic # Adaptec 15[012]x SCSI adapters, AIC-6[23]60. +device bt # Buslogic/Mylex MultiMaster SCSI adapters + +device ncv # NCR 53C500 +device nsp # Workbit Ninja SCSI-3 +device stg # TMC 18C30/18C50 +device isci # Intel C600 SAS controller + +# ATA/SCSI peripherals +device scbus # SCSI bus (required for ATA/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 ATA/SCSI access) +device ses # Enclosure Services (SES and SAF-TE) +device ctl # CAM Target Layer + +# RAID controllers interfaced to the SCSI subsystem +device amr # AMI MegaRAID +device arcmsr # Areca SATA II RAID +device asr # DPT SmartRAID V, VI and Adaptec SCSI RAID +device ciss # Compaq Smart RAID 5* +device dpt # DPT Smartcache III, IV - See NOTES for options +device hptmv # Highpoint RocketRAID 182x +device hptrr # Highpoint RocketRAID 17xx, 22xx, 23xx, 25xx +device iir # Intel Integrated RAID +device ips # IBM (Adaptec) ServeRAID +device mly # Mylex AcceleRAID/eXtremeRAID +device twa # 3ware 9000 series PATA/SATA RAID +device tws # LSI 3ware 9750 SATA+SAS 6Gb/s RAID controller + +# RAID controllers +device aac # Adaptec FSA RAID +device aacp # SCSI passthrough for aac (requires CAM) +device ida # Compaq Smart RAID +device mfi # LSI MegaRAID SAS +device mlx # Mylex DAC960 family +device pst # Promise Supertrak SX6000 +device twe # 3ware ATA RAID + +# 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 +options VESA # Add support for VESA BIOS Extensions (VBE) + +device splash # Splash screen and screen saver support + +# syscons is the default console driver, resembling an SCO console +device sc +options SC_PIXEL_MODE # add support for the raster text mode + +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 + +# Parallel port +device ppc +device ppbus # Parallel port bus (required) +device lpt # Printer +device plip # TCP/IP over parallel +device ppi # Parallel port interface device +#device vpo # Requires scbus and da + +device puc # Multi I/O cards and multi-channel UARTs + +# PCI Ethernet NICs. +device bxe # Broadcom BCM57710/BCM57711/BCM57711E 10Gb Ethernet +device de # DEC/Intel DC21x4x (``Tulip'') +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 +device ti # Alteon Networks Tigon I/II gigabit Ethernet +device txp # 3Com 3cR990 (``Typhoon'') +device vx # 3Com 3c590, 3c595 (``Vortex'') + +# 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 alc # Atheros AR8131/AR8132 Ethernet +device ale # Atheros AR8121/AR8113/AR8114 Ethernet +device bce # Broadcom BCM5706/BCM5708 Gigabit Ethernet +device bfe # Broadcom BCM440x 10/100 Ethernet +device bge # Broadcom BCM570xx Gigabit Ethernet +device cas # Sun Cassini/Cassini+ and NS DP83065 Saturn +device dc # DEC/Intel 21143 and various workalikes +device et # Agere ET1310 10/100/Gigabit Ethernet +device fxp # Intel EtherExpress PRO/100B (82557, 82558) +device gem # Sun GEM/Sun ERI/Apple GMAC +device hme # Sun HME (Happy Meal Ethernet) +device jme # JMicron JMC250 Gigabit/JMC260 Fast Ethernet +device lge # Level 1 LXT1001 gigabit Ethernet +device msk # Marvell/SysKonnect Yukon II Gigabit Ethernet +device nfe # nVidia nForce MCP on-board Ethernet +device nge # NatSemi DP83820 gigabit Ethernet +#device nve # nVidia nForce MCP on-board Ethernet Networking +device pcn # AMD Am79C97x PCI 10/100 (precedence over 'le') +device re # RealTek 8139C+/8169/8169S/8110S +device rl # RealTek 8129/8139 +device sf # Adaptec AIC-6915 (``Starfire'') +device sge # Silicon Integrated Systems SiS190/191 +device sis # Silicon Integrated Systems SiS 900/SiS 7016 +device sk # SysKonnect SK-984x & SK-982x gigabit Ethernet +device ste # Sundance ST201 (D-Link DFE-550TX) +device stge # Sundance/Tamarack TC9021 gigabit Ethernet +device tl # Texas Instruments ThunderLAN +device tx # SMC EtherPower II (83c170 ``EPIC'') +device vge # VIA VT612x gigabit Ethernet +device vr # VIA Rhine, Rhine II +device vte # DM&P Vortex86 RDC R6040 Fast Ethernet +device wb # Winbond W89C840F +device xl # 3Com 3c90x (``Boomerang'', ``Cyclone'') + +# ISA Ethernet NICs. pccard NICs included. +device cs # Crystal Semiconductor CS89x0 NIC +# 'device ed' requires 'device miibus' +device ed # NE[12]000, SMC Ultra, 3c503, DS8390 cards +device ex # Intel EtherExpress Pro/10 and Pro/10+ +device ep # Etherlink III based cards +device fe # Fujitsu MB8696x based cards +device ie # EtherExpress 8/16, 3C507, StarLAN 10 etc. +device sn # SMC's 9000 series of Ethernet chips +device xe # Xircom pccard Ethernet + +# Wireless NIC cards +device wlan # 802.11 support +options IEEE80211_DEBUG # enable debug msgs +options IEEE80211_AMPDU_AGE # age frames in AMPDU reorder q's +options IEEE80211_SUPPORT_MESH # enable 802.11s draft support +device wlan_wep # 802.11 WEP support +device wlan_ccmp # 802.11 CCMP support +device wlan_tkip # 802.11 TKIP support +device wlan_amrr # AMRR transmit rate control algorithm +device an # Aironet 4500/4800 802.11 wireless NICs. +device ath # Atheros NIC's +device ath_pci # Atheros pci/cardbus glue +device ath_hal # pci/cardbus chip support +options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors +device ath_rate_sample # SampleRate tx rate control for ath +#device bwi # Broadcom BCM430x/BCM431x wireless NICs. +#device bwn # Broadcom BCM43xx wireless NICs. +device ipw # Intel 2100 wireless NICs. +device iwi # Intel 2200BG/2225BG/2915ABG wireless NICs. +device iwn # Intel 4965/1000/5000/6000 wireless NICs. +device malo # Marvell Libertas wireless NICs. +device mwl # Marvell 88W8363 802.11n wireless NICs. +device ral # Ralink Technology RT2500 wireless NICs. +device wi # WaveLAN/Intersil/Symbol 802.11 wireless NICs. +#device wl # Older non 802.11 Wavelan wireless NIC. +device wpi # Intel 3945ABG wireless NICs. + +# Pseudo devices. +device loop # Network loopback +device random # Entropy device +device ether # Ethernet support +device vlan # 802.1Q VLAN 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 +options USB_DEBUG # enable debug msgs +device uhci # UHCI PCI->USB interface +device ohci # OHCI PCI->USB interface +device ehci # EHCI PCI->USB interface (USB 2.0) +device xhci # XHCI PCI->USB interface (USB 3.0) +device usb # USB Bus (required) +#device udbp # USB Double Bulk Pipe devices (needs netgraph) +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 +# USB Serial devices +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 +# USB Wireless +device rum # Ralink Technology RT2501USB wireless NICs +device run # Ralink Technology RT2700/RT2800/RT3000 NICs. +device uath # Atheros AR5523 wireless NICs +device upgt # Conexant/Intersil PrismGT wireless NICs. +device ural # Ralink Technology RT2500USB wireless NICs +device urtw # Realtek RTL8187B/L wireless NICs +device zyd # ZyDAS zd1211/zd1211b wireless NICs + +# FireWire support +device firewire # FireWire bus code +# sbp(4) works for some systems but causes boot failure on others +#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 + +# Sound support +device sound # Generic sound driver (required) +device snd_es137x # Ensoniq AudioPCI ES137x +device snd_hda # Intel High Definition Audio +device snd_ich # Intel, NVidia and other ICH AC'97 Audio +device snd_uaudio # USB Audio +device snd_via8233 # VIA VT8233x Audio Added: soc2012/rudot/aux/dummy_process.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/aux/dummy_process.c Tue May 22 11:53:22 2012 (r236131) @@ -0,0 +1,14 @@ +#include +#include +#include + +int +main(int argc, char** argv) +{ + pid_t myPid = getpid(); + printf("%d\n", myPid); + + pause(); + + return (0); +} Added: soc2012/rudot/aux/gdb_connect.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/aux/gdb_connect.sh Tue May 22 11:53:22 2012 (r236131) @@ -0,0 +1 @@ +kgdb -r /dev/cuau0 ./kernel.debug Added: soc2012/rudot/aux/notes.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/aux/notes.txt Tue May 22 11:53:22 2012 (r236131) @@ -0,0 +1,7 @@ +rctl -a process:PID:cpup:limit=50 + +sys_rctl_add_rule -> rctl_string_to_rule +line: 907 " error = str2value(resourcestr, &rule->rr_resource," + " resourcenames);" + +error has value 22 From owner-svn-soc-all@FreeBSD.ORG Tue May 22 12:31:10 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 1BA6A106564A for ; Tue, 22 May 2012 12:31:08 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 22 May 2012 12:31:08 +0000 Date: Tue, 22 May 2012 12:31:08 +0000 From: rudot@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120522123108.1BA6A106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r236133 - soc2012/rudot/sys/sys X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 May 2012 12:31:10 -0000 Author: rudot Date: Tue May 22 12:31:07 2012 New Revision: 236133 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236133 Log: initial version of the racct.h file Added: soc2012/rudot/sys/sys/ soc2012/rudot/sys/sys/racct.h Added: soc2012/rudot/sys/sys/racct.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/sys/sys/racct.h Tue May 22 12:31:07 2012 (r236133) @@ -0,0 +1,147 @@ +/*- + * Copyright (c) 2010 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Edward Tomasz Napierala under sponsorship + * from the FreeBSD Foundation. + * + * 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: src/sys/sys/racct.h,v 1.6 2012/03/06 11:05:50 trasz Exp $ + */ + +/* + * Resource accounting. + */ + +#ifndef _RACCT_H_ +#define _RACCT_H_ + +#include +#include +#include + +struct proc; +struct rctl_rule_link; +struct ucred; + +/* + * Resources. + */ +#define RACCT_UNDEFINED -1 +#define RACCT_CPU 0 +#define RACCT_DATA 1 +#define RACCT_STACK 2 +#define RACCT_CORE 3 +#define RACCT_RSS 4 +#define RACCT_MEMLOCK 5 +#define RACCT_NPROC 6 +#define RACCT_NOFILE 7 +#define RACCT_VMEM 8 +#define RACCT_NPTS 9 +#define RACCT_SWAP 10 +#define RACCT_NTHR 11 +#define RACCT_MSGQQUEUED 12 +#define RACCT_MSGQSIZE 13 +#define RACCT_NMSGQ 14 +#define RACCT_NSEM 15 +#define RACCT_NSEMOP 16 +#define RACCT_NSHM 17 +#define RACCT_SHMSIZE 18 +#define RACCT_WALLCLOCK 19 +#define RACCT_MAX RACCT_WALLCLOCK + +/* + * Resource properties. + */ +#define RACCT_IN_MILLIONS 0x01 +#define RACCT_RECLAIMABLE 0x02 +#define RACCT_INHERITABLE 0x04 +#define RACCT_DENIABLE 0x08 +#define RACCT_SLOPPY 0x10 + +extern int racct_types[]; + +/* + * Amount stored in c_resources[] is 10**6 times bigger than what's + * visible to the userland. It gets fixed up when retrieving resource + * usage or adding rules. + */ +#define RACCT_IS_IN_MILLIONS(X) (racct_types[X] & RACCT_IN_MILLIONS) + +/* + * Resource usage can drop, as opposed to only grow. + */ +#define RACCT_IS_RECLAIMABLE(X) (racct_types[X] & RACCT_RECLAIMABLE) + +/* + * Children inherit resource usage. + */ +#define RACCT_IS_INHERITABLE(X) (racct_types[X] & RACCT_INHERITABLE) + +/* + * racct_{add,set}(9) can actually return an error and not update resource + * usage counters. Note that even when resource is not deniable, allocating + * resource might cause signals to be sent by RCTL code. + */ +#define RACCT_IS_DENIABLE(X) (racct_types[X] & RACCT_DENIABLE) + +/* + * Per-process resource usage information makes no sense, but per-credential + * one does. This kind of resources are usually allocated for process, but + * freed using credentials. + */ +#define RACCT_IS_SLOPPY(X) (racct_types[X] & RACCT_SLOPPY) + +/* + * The 'racct' structure defines resource consumption for a particular + * subject, such as process or jail. + * + * This structure must be filled with zeroes initially. + */ +struct racct { + int64_t r_resources[RACCT_MAX + 1]; + LIST_HEAD(, rctl_rule_link) r_rule_links; +}; + +int racct_add(struct proc *p, int resource, uint64_t amount); +void racct_add_cred(struct ucred *cred, int resource, uint64_t amount); +void racct_add_force(struct proc *p, int resource, uint64_t amount); +int racct_set(struct proc *p, int resource, uint64_t amount); +void racct_set_force(struct proc *p, int resource, uint64_t amount); +void racct_sub(struct proc *p, int resource, uint64_t amount); +void racct_sub_cred(struct ucred *cred, int resource, uint64_t amount); +uint64_t racct_get_limit(struct proc *p, int resource); +uint64_t racct_get_available(struct proc *p, int resource); + +void racct_create(struct racct **racctp); +void racct_destroy(struct racct **racctp); + +int racct_proc_fork(struct proc *parent, struct proc *child); +void racct_proc_fork_done(struct proc *child); +void racct_proc_exit(struct proc *p); + +void racct_proc_ucred_changed(struct proc *p, struct ucred *oldcred, + struct ucred *newcred); +void racct_move(struct racct *dest, struct racct *src); + +#endif /* !_RACCT_H_ */ From owner-svn-soc-all@FreeBSD.ORG Tue May 22 17:05:10 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 49ECC106575C for ; Tue, 22 May 2012 17:05:09 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 22 May 2012 17:05:09 +0000 Date: Tue, 22 May 2012 17:05:09 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120522170509.49ECC106575C@hub.freebsd.org> Cc: Subject: socsvn commit: r236144 - soc2012/jhagewood/mdocml-1.9.9 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 May 2012 17:05:10 -0000 Author: jhagewood Date: Tue May 22 17:05:08 2012 New Revision: 236144 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236144 Log: Deleted: soc2012/jhagewood/mdocml-1.9.9/ From owner-svn-soc-all@FreeBSD.ORG Tue May 22 17:07:43 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id DB9FA1065674 for ; Tue, 22 May 2012 17:07:42 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 22 May 2012 17:07:42 +0000 Date: Tue, 22 May 2012 17:07:42 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120522170742.DB9FA1065674@hub.freebsd.org> Cc: Subject: socsvn commit: r236145 - in soc2012/jhagewood: mdocml-1.9.9 mdocml-1.9.9-orig mdocml_patches mdocml_patches/1.9.9_patches mdocml_patches/old X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 May 2012 17:07:44 -0000 Author: jhagewood Date: Tue May 22 17:07:42 2012 New Revision: 236145 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236145 Log: Added: soc2012/jhagewood/mdocml-1.9.9/ soc2012/jhagewood/mdocml-1.9.9-orig/ soc2012/jhagewood/mdocml-1.9.9-orig/ChangeLog.xsl soc2012/jhagewood/mdocml-1.9.9-orig/Makefile soc2012/jhagewood/mdocml-1.9.9-orig/arch.c soc2012/jhagewood/mdocml-1.9.9-orig/arch.in soc2012/jhagewood/mdocml-1.9.9-orig/att.c soc2012/jhagewood/mdocml-1.9.9-orig/att.in soc2012/jhagewood/mdocml-1.9.9-orig/chars.c soc2012/jhagewood/mdocml-1.9.9-orig/chars.h soc2012/jhagewood/mdocml-1.9.9-orig/chars.in soc2012/jhagewood/mdocml-1.9.9-orig/compat.c soc2012/jhagewood/mdocml-1.9.9-orig/example.style.css soc2012/jhagewood/mdocml-1.9.9-orig/external.png (contents, props changed) soc2012/jhagewood/mdocml-1.9.9-orig/html.c soc2012/jhagewood/mdocml-1.9.9-orig/html.h soc2012/jhagewood/mdocml-1.9.9-orig/index.css soc2012/jhagewood/mdocml-1.9.9-orig/index.sgml soc2012/jhagewood/mdocml-1.9.9-orig/lib.c soc2012/jhagewood/mdocml-1.9.9-orig/lib.in soc2012/jhagewood/mdocml-1.9.9-orig/libman.h soc2012/jhagewood/mdocml-1.9.9-orig/libmandoc.h soc2012/jhagewood/mdocml-1.9.9-orig/libmdoc.h soc2012/jhagewood/mdocml-1.9.9-orig/main.c soc2012/jhagewood/mdocml-1.9.9-orig/main.h soc2012/jhagewood/mdocml-1.9.9-orig/man.3 soc2012/jhagewood/mdocml-1.9.9-orig/man.3.sgml soc2012/jhagewood/mdocml-1.9.9-orig/man.7 soc2012/jhagewood/mdocml-1.9.9-orig/man.7.sgml soc2012/jhagewood/mdocml-1.9.9-orig/man.c soc2012/jhagewood/mdocml-1.9.9-orig/man.h soc2012/jhagewood/mdocml-1.9.9-orig/man_action.c soc2012/jhagewood/mdocml-1.9.9-orig/man_argv.c soc2012/jhagewood/mdocml-1.9.9-orig/man_hash.c soc2012/jhagewood/mdocml-1.9.9-orig/man_html.c soc2012/jhagewood/mdocml-1.9.9-orig/man_macro.c soc2012/jhagewood/mdocml-1.9.9-orig/man_term.c soc2012/jhagewood/mdocml-1.9.9-orig/man_validate.c soc2012/jhagewood/mdocml-1.9.9-orig/mandoc.1 soc2012/jhagewood/mdocml-1.9.9-orig/mandoc.1.sgml soc2012/jhagewood/mdocml-1.9.9-orig/mandoc.c soc2012/jhagewood/mdocml-1.9.9-orig/mandoc_char.7 soc2012/jhagewood/mdocml-1.9.9-orig/mandoc_char.7.sgml soc2012/jhagewood/mdocml-1.9.9-orig/manuals.7 soc2012/jhagewood/mdocml-1.9.9-orig/manuals.7.sgml soc2012/jhagewood/mdocml-1.9.9-orig/mdoc.3 soc2012/jhagewood/mdocml-1.9.9-orig/mdoc.3.sgml soc2012/jhagewood/mdocml-1.9.9-orig/mdoc.7 soc2012/jhagewood/mdocml-1.9.9-orig/mdoc.7.sgml soc2012/jhagewood/mdocml-1.9.9-orig/mdoc.c soc2012/jhagewood/mdocml-1.9.9-orig/mdoc.h soc2012/jhagewood/mdocml-1.9.9-orig/mdoc_action.c soc2012/jhagewood/mdocml-1.9.9-orig/mdoc_argv.c soc2012/jhagewood/mdocml-1.9.9-orig/mdoc_hash.c soc2012/jhagewood/mdocml-1.9.9-orig/mdoc_html.c soc2012/jhagewood/mdocml-1.9.9-orig/mdoc_macro.c soc2012/jhagewood/mdocml-1.9.9-orig/mdoc_strings.c soc2012/jhagewood/mdocml-1.9.9-orig/mdoc_term.c soc2012/jhagewood/mdocml-1.9.9-orig/mdoc_validate.c soc2012/jhagewood/mdocml-1.9.9-orig/msec.c soc2012/jhagewood/mdocml-1.9.9-orig/msec.in soc2012/jhagewood/mdocml-1.9.9-orig/out.c soc2012/jhagewood/mdocml-1.9.9-orig/out.h soc2012/jhagewood/mdocml-1.9.9-orig/st.c soc2012/jhagewood/mdocml-1.9.9-orig/st.in soc2012/jhagewood/mdocml-1.9.9-orig/style.css soc2012/jhagewood/mdocml-1.9.9-orig/term.c soc2012/jhagewood/mdocml-1.9.9-orig/term.h soc2012/jhagewood/mdocml-1.9.9-orig/tree.c soc2012/jhagewood/mdocml-1.9.9-orig/vol.c soc2012/jhagewood/mdocml-1.9.9-orig/vol.in soc2012/jhagewood/mdocml-1.9.9/ChangeLog.xsl soc2012/jhagewood/mdocml-1.9.9/Makefile soc2012/jhagewood/mdocml-1.9.9/arch.c soc2012/jhagewood/mdocml-1.9.9/arch.in soc2012/jhagewood/mdocml-1.9.9/att.c soc2012/jhagewood/mdocml-1.9.9/att.in soc2012/jhagewood/mdocml-1.9.9/chars.c soc2012/jhagewood/mdocml-1.9.9/chars.h soc2012/jhagewood/mdocml-1.9.9/chars.in soc2012/jhagewood/mdocml-1.9.9/compat.c soc2012/jhagewood/mdocml-1.9.9/example.style.css soc2012/jhagewood/mdocml-1.9.9/external.png (contents, props changed) soc2012/jhagewood/mdocml-1.9.9/html.c soc2012/jhagewood/mdocml-1.9.9/html.h soc2012/jhagewood/mdocml-1.9.9/index.css soc2012/jhagewood/mdocml-1.9.9/index.sgml soc2012/jhagewood/mdocml-1.9.9/lib.c soc2012/jhagewood/mdocml-1.9.9/lib.in soc2012/jhagewood/mdocml-1.9.9/libman.h soc2012/jhagewood/mdocml-1.9.9/libmandoc.h soc2012/jhagewood/mdocml-1.9.9/libmdoc.h soc2012/jhagewood/mdocml-1.9.9/main.c soc2012/jhagewood/mdocml-1.9.9/main.h soc2012/jhagewood/mdocml-1.9.9/man.3 soc2012/jhagewood/mdocml-1.9.9/man.3.sgml soc2012/jhagewood/mdocml-1.9.9/man.7 soc2012/jhagewood/mdocml-1.9.9/man.7.sgml soc2012/jhagewood/mdocml-1.9.9/man.c soc2012/jhagewood/mdocml-1.9.9/man.h soc2012/jhagewood/mdocml-1.9.9/man_action.c soc2012/jhagewood/mdocml-1.9.9/man_argv.c soc2012/jhagewood/mdocml-1.9.9/man_hash.c soc2012/jhagewood/mdocml-1.9.9/man_html.c soc2012/jhagewood/mdocml-1.9.9/man_macro.c soc2012/jhagewood/mdocml-1.9.9/man_term.c soc2012/jhagewood/mdocml-1.9.9/man_validate.c soc2012/jhagewood/mdocml-1.9.9/mandoc.1 soc2012/jhagewood/mdocml-1.9.9/mandoc.1.sgml soc2012/jhagewood/mdocml-1.9.9/mandoc.c soc2012/jhagewood/mdocml-1.9.9/mandoc_char.7 soc2012/jhagewood/mdocml-1.9.9/mandoc_char.7.sgml soc2012/jhagewood/mdocml-1.9.9/manuals.7 soc2012/jhagewood/mdocml-1.9.9/manuals.7.sgml soc2012/jhagewood/mdocml-1.9.9/mdoc.3 soc2012/jhagewood/mdocml-1.9.9/mdoc.3.sgml soc2012/jhagewood/mdocml-1.9.9/mdoc.7 soc2012/jhagewood/mdocml-1.9.9/mdoc.7.sgml soc2012/jhagewood/mdocml-1.9.9/mdoc.c soc2012/jhagewood/mdocml-1.9.9/mdoc.h soc2012/jhagewood/mdocml-1.9.9/mdoc_action.c soc2012/jhagewood/mdocml-1.9.9/mdoc_argv.c soc2012/jhagewood/mdocml-1.9.9/mdoc_hash.c soc2012/jhagewood/mdocml-1.9.9/mdoc_html.c soc2012/jhagewood/mdocml-1.9.9/mdoc_macro.c soc2012/jhagewood/mdocml-1.9.9/mdoc_strings.c soc2012/jhagewood/mdocml-1.9.9/mdoc_term.c soc2012/jhagewood/mdocml-1.9.9/mdoc_validate.c soc2012/jhagewood/mdocml-1.9.9/msec.c soc2012/jhagewood/mdocml-1.9.9/msec.in soc2012/jhagewood/mdocml-1.9.9/out.c soc2012/jhagewood/mdocml-1.9.9/out.h soc2012/jhagewood/mdocml-1.9.9/st.c soc2012/jhagewood/mdocml-1.9.9/st.in soc2012/jhagewood/mdocml-1.9.9/style.css soc2012/jhagewood/mdocml-1.9.9/term.c soc2012/jhagewood/mdocml-1.9.9/term.h soc2012/jhagewood/mdocml-1.9.9/tree.c soc2012/jhagewood/mdocml-1.9.9/vol.c soc2012/jhagewood/mdocml-1.9.9/vol.in soc2012/jhagewood/mdocml_patches/ soc2012/jhagewood/mdocml_patches/1.9.9_patches/ soc2012/jhagewood/mdocml_patches/1.9.9_patches/patch-config.txt soc2012/jhagewood/mdocml_patches/1.9.9_patches/patch-lib.in.txt soc2012/jhagewood/mdocml_patches/1.9.9_patches/patch-msec.in.txt soc2012/jhagewood/mdocml_patches/old/ soc2012/jhagewood/mdocml_patches/old/patch-config.txt soc2012/jhagewood/mdocml_patches/old/patch-lib.in.txt soc2012/jhagewood/mdocml_patches/old/patch-mdoc_validate.c soc2012/jhagewood/mdocml_patches/old/patch-msec.in.txt Added: soc2012/jhagewood/mdocml-1.9.9-orig/ChangeLog.xsl ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/mdocml-1.9.9-orig/ChangeLog.xsl Tue May 22 17:07:42 2012 (r236145) @@ -0,0 +1,43 @@ + + + + + + + mdocml - CVS-ChangeLog + + + + +
+ Files modified by + +
+
+ + Note: + + +
    + +
  • + + + — Rev: + + , Status: + + + , Tag: + + + +
  • +
    +
+
+
+ + +
+
Added: soc2012/jhagewood/mdocml-1.9.9-orig/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/mdocml-1.9.9-orig/Makefile Tue May 22 17:07:42 2012 (r236145) @@ -0,0 +1,244 @@ +.SUFFIXES: .html .xml .sgml .1 .3 .7 .md5 .tar.gz .1.txt .3.txt .7.txt .1.sgml .3.sgml .7.sgml + +BINDIR = $(PREFIX)/bin +INCLUDEDIR = $(PREFIX)/include +LIBDIR = $(PREFIX)/lib +MANDIR = $(PREFIX)/man +INSTALL_PROGRAM = install -m 0755 +INSTALL_DATA = install -m 0444 +INSTALL_LIB = install -m 0644 +INSTALL_MAN = $(INSTALL_DATA) + +VERSION = 1.9.9 +VDATE = 21 October 2009 + +VFLAGS = -DVERSION=\"$(VERSION)\" +CFLAGS += -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings -g +CFLAGS += $(VFLAGS) +LINTFLAGS += $(VFLAGS) + +MANDOCFLAGS = -Wall -fstrict +MANDOCHTML = -Thtml -ostyle=style.css,man=%N.%S.html,includes=%I.html + +MDOCLNS = mdoc_macro.ln mdoc.ln mdoc_hash.ln mdoc_strings.ln \ + mdoc_argv.ln mdoc_validate.ln mdoc_action.ln \ + lib.ln att.ln arch.ln vol.ln msec.ln st.ln \ + mandoc.ln +MDOCOBJS = mdoc_macro.o mdoc.o mdoc_hash.o mdoc_strings.o \ + mdoc_argv.o mdoc_validate.o mdoc_action.o lib.o att.o \ + arch.o vol.o msec.o st.o mandoc.o +MDOCSRCS = mdoc_macro.c mdoc.c mdoc_hash.c mdoc_strings.c \ + mdoc_argv.c mdoc_validate.c mdoc_action.c lib.c att.c \ + arch.c vol.c msec.c st.c mandoc.c + +MANLNS = man_macro.ln man.ln man_hash.ln man_validate.ln \ + man_action.ln mandoc.ln man_argv.ln +MANOBJS = man_macro.o man.o man_hash.o man_validate.o \ + man_action.o mandoc.o man_argv.o +MANSRCS = man_macro.c man.c man_hash.c man_validate.c \ + man_action.c mandoc.c man_argv.c + +MAINLNS = main.ln mdoc_term.ln chars.ln term.ln tree.ln \ + compat.ln man_term.ln html.ln mdoc_html.ln \ + man_html.ln out.ln +MAINOBJS = main.o mdoc_term.o chars.o term.o tree.o compat.o \ + man_term.o html.o mdoc_html.o man_html.o out.o +MAINSRCS = main.c mdoc_term.c chars.c term.c tree.c compat.c \ + man_term.c html.c mdoc_html.c man_html.c out.c + +LLNS = llib-llibmdoc.ln llib-llibman.ln llib-lmandoc.ln +LNS = $(MAINLNS) $(MDOCLNS) $(MANLNS) +LIBS = libmdoc.a libman.a +OBJS = $(MDOCOBJS) $(MAINOBJS) $(MANOBJS) +SRCS = $(MDOCSRCS) $(MAINSRCS) $(MANSRCS) +DATAS = arch.in att.in lib.in msec.in st.in \ + vol.in chars.in +HEADS = mdoc.h libmdoc.h man.h libman.h term.h \ + libmandoc.h html.h chars.h out.h main.h +GSGMLS = mandoc.1.sgml mdoc.3.sgml mdoc.7.sgml manuals.7.sgml \ + mandoc_char.7.sgml man.7.sgml man.3.sgml +SGMLS = index.sgml $(GSGMLS) +XSLS = ChangeLog.xsl +HTMLS = index.html mandoc.1.html mdoc.3.html ChangeLog.html \ + man.3.html mdoc.7.html man.7.html mandoc_char.7.html \ + manuals.7.html +TEXTS = mandoc.1.txt mdoc.3.txt man.3.txt mdoc.7.txt man.7.txt \ + mandoc_char.7.txt manuals.7.txt ChangeLog.txt +EXAMPLES = example.style.css +XMLS = ChangeLog.xml +STATICS = index.css style.css external.png +MD5S = mdocml-$(VERSION).md5 +TARGZS = mdocml-$(VERSION).tar.gz +MANS = mandoc.1 mdoc.3 mdoc.7 manuals.7 mandoc_char.7 \ + man.7 man.3 +BINS = mandoc +CLEAN = $(BINS) $(LNS) $(LLNS) $(LIBS) $(OBJS) $(HTMLS) \ + $(TARGZS) tags $(MD5S) $(XMLS) $(TEXTS) $(GSGMLS) +INSTALL = $(SRCS) $(HEADS) Makefile $(MANS) $(SGMLS) $(STATICS) \ + $(DATAS) $(XSLS) $(EXAMPLES) + +all: $(BINS) + +lint: $(LLNS) + +clean: + rm -f $(CLEAN) + +cleanlint: + rm -f $(LNS) $(LLNS) + +dist: mdocml-$(VERSION).tar.gz + +www: all $(HTMLS) $(TEXTS) $(MD5S) $(TARGZS) + +installwww: www + install -m 0444 $(HTMLS) $(TEXTS) $(STATICS) $(PREFIX)/ + install -m 0444 mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/ + install -m 0444 mdocml-$(VERSION).md5 $(PREFIX)/snapshots/ + install -m 0444 mdocml-$(VERSION).tar.gz $(PREFIX)/snapshots/mdocml.tar.gz + install -m 0444 mdocml-$(VERSION).md5 $(PREFIX)/snapshots/mdocml.md5 + +install: + mkdir -p $(BINDIR) + mkdir -p $(MANDIR)/man1 + mkdir -p $(MANDIR)/man7 + $(INSTALL_PROGRAM) mandoc $(BINDIR) + $(INSTALL_MAN) mandoc.1 $(MANDIR)/man1 + $(INSTALL_MAN) mdoc.7 $(MANDIR)/man7 + +uninstall: + rm -f $(BINDIR)/mandoc + rm -f $(MANDIR)/man1/mandoc.1 + rm -f $(MANDIR)/man7/mdoc.7 + +man_macro.ln: man_macro.c libman.h +man_macro.o: man_macro.c libman.h + +lib.ln: lib.c lib.in libmdoc.h +lib.o: lib.c lib.in libmdoc.h + +att.ln: att.c att.in libmdoc.h +att.o: att.c att.in libmdoc.h + +arch.ln: arch.c arch.in libmdoc.h +arch.o: arch.c arch.in libmdoc.h + +vol.ln: vol.c vol.in libmdoc.h +vol.o: vol.c vol.in libmdoc.h + +chars.ln: chars.c chars.in chars.h +chars.o: chars.c chars.in chars.h + +msec.ln: msec.c msec.in libmdoc.h +msec.o: msec.c msec.in libmdoc.h + +st.ln: st.c st.in libmdoc.h +st.o: st.c st.in libmdoc.h + +mdoc_macro.ln: mdoc_macro.c libmdoc.h +mdoc_macro.o: mdoc_macro.c libmdoc.h + +mdoc_term.ln: mdoc_term.c term.h mdoc.h +mdoc_term.o: mdoc_term.c term.h mdoc.h + +mdoc_strings.ln: mdoc_strings.c libmdoc.h +mdoc_strings.o: mdoc_strings.c libmdoc.h + +man_hash.ln: man_hash.c libman.h +man_hash.o: man_hash.c libman.h + +mdoc_hash.ln: mdoc_hash.c libmdoc.h +mdoc_hash.o: mdoc_hash.c libmdoc.h + +mdoc.ln: mdoc.c libmdoc.h +mdoc.o: mdoc.c libmdoc.h + +man.ln: man.c libman.h +man.o: man.c libman.h + +main.ln: main.c mdoc.h +main.o: main.c mdoc.h + +compat.ln: compat.c +compat.o: compat.c + +term.ln: term.c term.h man.h mdoc.h chars.h +term.o: term.c term.h man.h mdoc.h chars.h + +html.ln: html.c html.h chars.h +html.o: html.c html.h chars.h + +mdoc_html.ln: mdoc_html.c html.h mdoc.h +mdoc_html.o: mdoc_html.c html.h mdoc.h + +man_html.ln: man_html.c html.h man.h out.h +man_html.o: man_html.c html.h man.h out.h + +out.ln: out.c out.h +out.o: out.c out.h + +tree.ln: tree.c man.h mdoc.h +tree.o: tree.c man.h mdoc.h + +mdoc_argv.ln: mdoc_argv.c libmdoc.h +mdoc_argv.o: mdoc_argv.c libmdoc.h + +man_argv.ln: man_argv.c libman.h +man_argv.o: man_argv.c libman.h + +man_validate.ln: man_validate.c libman.h +man_validate.o: man_validate.c libman.h + +mdoc_validate.ln: mdoc_validate.c libmdoc.h +mdoc_validate.o: mdoc_validate.c libmdoc.h + +mdoc_action.ln: mdoc_action.c libmdoc.h +mdoc_action.o: mdoc_action.c libmdoc.h + +libmdoc.h: mdoc.h + +ChangeLog.xml: + cvs2cl --xml --xml-encoding iso-8859-15 -t --noxmlns -f $@ + +ChangeLog.txt: + cvs2cl -t -f $@ + +ChangeLog.html: ChangeLog.xml ChangeLog.xsl + xsltproc -o $@ ChangeLog.xsl ChangeLog.xml + +mdocml-$(VERSION).tar.gz: $(INSTALL) + mkdir -p .dist/mdocml/mdocml-$(VERSION)/ + cp -f $(INSTALL) .dist/mdocml/mdocml-$(VERSION)/ + ( cd .dist/mdocml/ && tar zcf ../../$@ mdocml-$(VERSION)/ ) + rm -rf .dist/ + +llib-llibmdoc.ln: $(MDOCLNS) + $(LINT) -Clibmdoc $(MDOCLNS) + +llib-llibman.ln: $(MANLNS) + $(LINT) -Clibman $(MANLNS) + +llib-lmandoc.ln: $(MAINLNS) llib-llibmdoc.ln + $(LINT) -Cmandoc $(MAINLNS) llib-llibmdoc.ln + +libmdoc.a: $(MDOCOBJS) + $(AR) rs $@ $(MDOCOBJS) + +libman.a: $(MANOBJS) + $(AR) rs $@ $(MANOBJS) + +mandoc: $(MAINOBJS) libmdoc.a libman.a + $(CC) $(CFLAGS) -o $@ $(MAINOBJS) libmdoc.a libman.a + +.sgml.html: + #validate $< + sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< > $@ + +.1.1.txt .3.3.txt .7.7.txt: + ./mandoc $(MANDOCFLAGS) $< | col -b > $@ + +.1.1.sgml .3.3.sgml .7.7.sgml: + ./mandoc $(MANDOCFLAGS) $(MANDOCHTML) $< > $@ + +.tar.gz.md5: + md5 $< > $@ Added: soc2012/jhagewood/mdocml-1.9.9-orig/arch.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/mdocml-1.9.9-orig/arch.c Tue May 22 17:07:42 2012 (r236145) @@ -0,0 +1,32 @@ +/* $Id: arch.c,v 1.4 2009/06/10 20:18:43 kristaps Exp $ */ +/* + * Copyright (c) 2009 Kristaps Dzonsons + * + * Permission to use, copy, modify, and 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 THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR 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. + */ +#include +#include + +#include "libmdoc.h" + +#define LINE(x, y) \ + if (0 == strcmp(p, x)) return(y); + +const char * +mdoc_a2arch(const char *p) +{ + +#include "arch.in" + + return(NULL); +} Added: soc2012/jhagewood/mdocml-1.9.9-orig/arch.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/mdocml-1.9.9-orig/arch.in Tue May 22 17:07:42 2012 (r236145) @@ -0,0 +1,52 @@ +/* $Id: arch.in,v 1.5 2009/06/10 20:18:43 kristaps Exp $ */ +/* + * Copyright (c) 2009 Kristaps Dzonsons + * + * Permission to use, copy, modify, and 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 THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR 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. + */ + +/* + * This file defines the architecture token of the .Dt prologue macro. + * All architectures that your system supports (or the manuals of your + * system) should be included here. The right-hand-side is the + * formatted output. + * + * Be sure to escape strings. + */ + +LINE("alpha", "Alpha") +LINE("amd64", "AMD64") +LINE("amiga", "Amiga") +LINE("arc", "ARC") +LINE("arm", "ARM") +LINE("armish", "ARMISH") +LINE("aviion", "AViiON") +LINE("hp300", "HP300") +LINE("hppa", "HPPA") +LINE("hppa64", "HPPA64") +LINE("i386", "i386") +LINE("landisk", "LANDISK") +LINE("luna88k", "Luna88k") +LINE("mac68k", "Mac68k") +LINE("macppc", "MacPPC") +LINE("mvme68k", "MVME68k") +LINE("mvme88k", "MVME88k") +LINE("mvmeppc", "MVMEPPC") +LINE("pmax", "PMAX") +LINE("sgi", "SGI") +LINE("socppc", "SOCPPC") +LINE("sparc", "SPARC") +LINE("sparc64", "SPARC64") +LINE("sun3", "Sun3") +LINE("vax", "VAX") +LINE("zaurus", "Zaurus") Added: soc2012/jhagewood/mdocml-1.9.9-orig/att.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/mdocml-1.9.9-orig/att.c Tue May 22 17:07:42 2012 (r236145) @@ -0,0 +1,32 @@ +/* $Id: att.c,v 1.4 2009/06/10 20:18:43 kristaps Exp $ */ +/* + * Copyright (c) 2009 Kristaps Dzonsons + * + * Permission to use, copy, modify, and 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 THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR 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. + */ +#include +#include + +#include "libmdoc.h" + +#define LINE(x, y) \ + if (0 == strcmp(p, x)) return(y); + +const char * +mdoc_a2att(const char *p) +{ + +#include "att.in" + + return(NULL); +} Added: soc2012/jhagewood/mdocml-1.9.9-orig/att.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/mdocml-1.9.9-orig/att.in Tue May 22 17:07:42 2012 (r236145) @@ -0,0 +1,37 @@ +/* $Id: att.in,v 1.5 2009/06/10 20:18:43 kristaps Exp $ */ +/* + * Copyright (c) 2009 Kristaps Dzonsons + * + * Permission to use, copy, modify, and 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 THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR 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. + */ + +/* + * This file defines the AT&T versions of the .At macro. This probably + * isn't going to change. The right-hand side is the formatted string. + * + * Be sure to escape strings. + */ + +LINE("v1", "Version 1 AT&T UNIX") +LINE("v2", "Version 2 AT&T UNIX") +LINE("v3", "Version 3 AT&T UNIX") +LINE("v4", "Version 4 AT&T UNIX") +LINE("v5", "Version 5 AT&T UNIX") +LINE("v6", "Version 6 AT&T UNIX") +LINE("v7", "Version 7 AT&T UNIX") +LINE("32v", "Version 32V AT&T UNIX") +LINE("V", "AT&T System V UNIX") +LINE("V.1", "AT&T System V.1 UNIX") +LINE("V.2", "AT&T System V.2 UNIX") +LINE("V.3", "AT&T System V.3 UNIX") +LINE("V.4", "AT&T System V.4 UNIX") Added: soc2012/jhagewood/mdocml-1.9.9-orig/chars.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/mdocml-1.9.9-orig/chars.c Tue May 22 17:07:42 2012 (r236145) @@ -0,0 +1,204 @@ +/* $Id: chars.c,v 1.9 2009/09/23 11:02:21 kristaps Exp $ */ +/* + * Copyright (c) 2009 Kristaps Dzonsons + * + * Permission to use, copy, modify, and 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 THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR 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. + */ +#include +#include +#include +#include + +#include "chars.h" + +#define PRINT_HI 126 +#define PRINT_LO 32 + +struct ln { + struct ln *next; + const char *code; + const char *ascii; + const char *html; + size_t codesz; + size_t asciisz; + size_t htmlsz; + int type; +#define CHARS_CHAR (1 << 0) +#define CHARS_STRING (1 << 1) +#define CHARS_BOTH (0x03) +}; + +#define LINES_MAX 351 + +#define CHAR(w, x, y, z, a, b) \ + { NULL, (w), (y), (a), (x), (z), (b), CHARS_CHAR }, +#define STRING(w, x, y, z, a, b) \ + { NULL, (w), (y), (a), (x), (z), (b), CHARS_STRING }, +#define BOTH(w, x, y, z, a, b) \ + { NULL, (w), (y), (a), (x), (z), (b), CHARS_BOTH }, + +static struct ln lines[LINES_MAX] = { +#include "chars.in" +}; + +struct tbl { + enum chars type; + struct ln **htab; +}; + +static inline int match(const struct ln *, + const char *, size_t, int); +static const char *find(struct tbl *, const char *, + size_t, size_t *, int); + + +void +chars_free(void *arg) +{ + struct tbl *tab; + + tab = (struct tbl *)arg; + + free(tab->htab); + free(tab); +} + + +void * +chars_init(enum chars type) +{ + struct tbl *tab; + struct ln **htab; + struct ln *pp; + int i, hash; + + /* + * Constructs a very basic chaining hashtable. The hash routine + * is simply the integral value of the first character. + * Subsequent entries are chained in the order they're processed + * (they're in-line re-ordered during lookup). + */ + + if (NULL == (tab = malloc(sizeof(struct tbl)))) + err(1, "malloc"); + tab->type = type; + + htab = calloc(PRINT_HI - PRINT_LO + 1, sizeof(struct ln **)); + if (NULL == htab) + err(1, "malloc"); + + for (i = 0; i < LINES_MAX; i++) { + hash = (int)lines[i].code[0] - PRINT_LO; + + if (NULL == (pp = htab[hash])) { + htab[hash] = &lines[i]; + continue; + } + + for ( ; pp->next; pp = pp->next) + /* Scan ahead. */ ; + pp->next = &lines[i]; + } + + tab->htab = htab; + return(tab); +} + + +const char * +chars_a2ascii(void *arg, const char *p, size_t sz, size_t *rsz) +{ + + return(find((struct tbl *)arg, p, sz, rsz, CHARS_CHAR)); +} + + +const char * +chars_a2res(void *arg, const char *p, size_t sz, size_t *rsz) +{ + + return(find((struct tbl *)arg, p, sz, rsz, CHARS_STRING)); +} + + +static const char * +find(struct tbl *tab, const char *p, size_t sz, size_t *rsz, int type) +{ + struct ln *pp, *prev; + struct ln **htab; + int hash; + + assert(p); + assert(sz > 0); + + if (p[0] < PRINT_LO || p[0] > PRINT_HI) + return(NULL); + + /* + * Lookup the symbol in the symbol hash. See ascii2htab for the + * hashtable specs. This dynamically re-orders the hash chain + * to optimise for repeat hits. + */ + + hash = (int)p[0] - PRINT_LO; + htab = tab->htab; + + if (NULL == (pp = htab[hash])) + return(NULL); + + if (NULL == pp->next) { + if ( ! match(pp, p, sz, type)) + return(NULL); + + if (CHARS_HTML == tab->type) { + *rsz = pp->htmlsz; + return(pp->html); + } + *rsz = pp->asciisz; + return(pp->ascii); + } + + for (prev = NULL; pp; pp = pp->next) { + if ( ! match(pp, p, sz, type)) { + prev = pp; + continue; + } + + if (prev) { + prev->next = pp->next; + pp->next = htab[hash]; + htab[hash] = pp; + } + + if (CHARS_HTML == tab->type) { + *rsz = pp->htmlsz; + return(pp->html); + } + *rsz = pp->asciisz; + return(pp->ascii); + } + + return(NULL); +} + + +static inline int +match(const struct ln *ln, const char *p, size_t sz, int type) +{ + + if ( ! (ln->type & type)) + return(0); + if (ln->codesz != sz) + return(0); + return(0 == strncmp(ln->code, p, sz)); +} Added: soc2012/jhagewood/mdocml-1.9.9-orig/chars.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/mdocml-1.9.9-orig/chars.h Tue May 22 17:07:42 2012 (r236145) @@ -0,0 +1,34 @@ +/* $Id: chars.h,v 1.1 2009/09/17 07:41:28 kristaps Exp $ */ +/* + * Copyright (c) 2008, 2009 Kristaps Dzonsons + * + * Permission to use, copy, modify, and 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 THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR 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. + */ +#ifndef CHARS_H +#define CHARS_H + +__BEGIN_DECLS + +enum chars { + CHARS_ASCII, + CHARS_HTML +}; + +void *chars_init(enum chars); +const char *chars_a2ascii(void *, const char *, size_t, size_t *); +const char *chars_a2res(void *, const char *, size_t, size_t *); +void chars_free(void *); + +__END_DECLS + +#endif /*!CHARS_H*/ Added: soc2012/jhagewood/mdocml-1.9.9-orig/chars.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/mdocml-1.9.9-orig/chars.in Tue May 22 17:07:42 2012 (r236145) @@ -0,0 +1,418 @@ +/* $Id: chars.in,v 1.18 2009/09/24 11:55:28 kristaps Exp $ */ +/* + * Copyright (c) 2009 Kristaps Dzonsons + * + * Permission to use, copy, modify, and 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 THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR 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. + */ + +/* + * The ASCII translation tables. STRING corresponds to predefined + * strings (cf. mdoc_samples.7 and tmac/mdoc/doc-nroff). CHAR + * corresponds to special characters (cf. groff_char.7). BOTH contains + * sequences that are equivalent in both STRING and CHAR. + * + * Either way, the left-hand side corresponds to the input sequence (\x, + * \(xx, \*(xx and so on) whose length is listed second element. The + * right-hand side is what's produced by the front-end, with the fourth + * element being its length. + * + * XXX - C-escape strings! + * XXX - update LINES_MAX if adding more! + */ + +/* Spacing. */ +CHAR("c", 1, "", 0, "", 0) +CHAR("0", 1, " ", 1, " ", 7) +CHAR(" ", 1, " ", 1, " ", 7) +CHAR("~", 1, " ", 1, " ", 6) +CHAR("%", 1, "", 0, "", 0) +CHAR("&", 1, "", 0, "", 0) +CHAR("^", 1, "", 0, "", 0) +CHAR("|", 1, "", 0, "", 0) + +/* Accents. */ +CHAR("a\"", 2, "\"", 1, "̋", 6) +CHAR("a-", 2, "-", 1, "¯", 6) +CHAR("a.", 2, ".", 1, "˙", 6) +CHAR("a^", 2, "^", 1, "̂", 6) +CHAR("\'", 1, "\'", 1, "́", 6) +BOTH("aa", 2, "\'", 1, "́", 6) +BOTH("ga", 2, "`", 1, "̀", 6) +CHAR("`", 1, "`", 1, "̀", 6) +CHAR("ab", 2, "`", 1, "̆", 6) +CHAR("ac", 2, ",", 1, "̧", 6) +CHAR("ad", 2, "\"", 1, "̈", 6) +CHAR("ah", 2, "v", 1, "ˇ", 6) +CHAR("ao", 2, "o", 1, "˚", 6) +CHAR("a~", 2, "~", 1, "̃", 6) +CHAR("ho", 2, ",", 1, "̨", 6) +CHAR("ha", 2, "^", 1, "^", 1) +CHAR("ti", 2, "~", 1, "~", 1) + +/* Quotes. */ +CHAR("Bq", 2, ",,", 2, "„", 7) +CHAR("bq", 2, ",", 1, "‚", 7) +BOTH("lq", 2, "``", 2, "“", 7) +BOTH("rq", 2, "\'\'", 2, "”", 7) +CHAR("oq", 2, "`", 1, "‘", 7) +CHAR("cq", 2, "\'", 1, "’", 7) +CHAR("aq", 2, "\'", 1, "\'", 1) +CHAR("dq", 2, "\"", 1, "\"", 1) +CHAR("Fo", 2, "<<", 2, "«", 6) +CHAR("Fc", 2, ">>", 2, "»", 6) +CHAR("fo", 2, "<", 1, "‹", 7) +CHAR("fc", 2, ">", 1, "›", 7) + +/* Brackets. */ +CHAR("lB", 2, "[", 1, "[", 1) +CHAR("rB", 2, "]", 1, "]", 1) +CHAR("lC", 2, "{", 1, "{", 1) +CHAR("rC", 2, "}", 1, "}", 1) +CHAR("la", 2, "<", 1, "⟨", 8) +CHAR("ra", 2, ">", 1, "⟩", 8) +CHAR("bv", 2, "|", 1, "⎪", 7) +CHAR("braceex", 7, "|", 1, "⎪", 7) +CHAR("bracketlefttp", 13, "|", 1, "⎡", 7) +CHAR("bracketleftbp", 13, "|", 1, "⎣", 7) +CHAR("bracketleftex", 13, "|", 1, "⎢", 7) +CHAR("bracketrighttp", 14, "|", 1, "⎤", 7) +CHAR("bracketrightbp", 14, "|", 1, "⎦", 7) +CHAR("bracketrightex", 14, "|", 1, "⎥", 7) +CHAR("lt", 2, ",-", 2, "⎧", 7) +CHAR("bracelefttp", 11, ",-", 2, "⎧", 7) +CHAR("lk", 2, "{", 1, "⎨", 7) +CHAR("braceleftmid", 12, "{", 1, "⎨", 7) +CHAR("lb", 2, ",-", 2, "⎩", 7) +CHAR("braceleftbp", 11, "`-", 2, "⎩", 7) +CHAR("braceleftex", 11, "|", 1, "⎪", 7) +CHAR("rt", 2, "-.", 2, "⎫", 7) +CHAR("bracerighttp", 12, "-.", 2, "⎫", 7) +CHAR("rk", 2, "}", 1, "⎬", 7) +CHAR("bracerightmid", 13, "}", 1, "⎬", 7) +CHAR("rb", 2, "-\'", 2, "⎭", 7) +CHAR("bracerightbp", 12, "-\'", 2, "⎭", 7) +CHAR("bracerightex", 12, "|", 1, "⎪", 7) +CHAR("parenlefttp", 11, "/", 1, "⎛", 7) +CHAR("parenleftbp", 11, "\\", 1, "⎝", 7) +CHAR("parenleftex", 11, "|", 1, "⎜", 7) +CHAR("parenrighttp", 12, "\\", 1, "⎞", 7) +CHAR("parenrightbp", 12, "/", 1, "⎠", 7) +CHAR("parenrightex", 12, "|", 1, "⎟", 7) + +/* Greek characters. */ +CHAR("*A", 2, "A", 1, "Α", 6) +CHAR("*B", 2, "B", 1, "Β", 6) +CHAR("*G", 2, "|", 1, "Γ", 6) +CHAR("*D", 2, "/\\", 2, "Δ", 6) +CHAR("*E", 2, "E", 1, "Ε", 6) +CHAR("*Z", 2, "Z", 1, "Ζ", 6) +CHAR("*Y", 2, "H", 1, "Η", 6) +CHAR("*H", 2, "O", 1, "Θ", 6) +CHAR("*I", 2, "I", 1, "Ι", 6) +CHAR("*K", 2, "K", 1, "Κ", 6) +CHAR("*L", 2, "/\\", 2, "Λ", 6) +CHAR("*M", 2, "M", 1, "Μ", 6) +CHAR("*N", 2, "N", 1, "Ν", 6) +CHAR("*C", 2, "H", 1, "Ξ", 6) +CHAR("*O", 2, "O", 1, "Ο", 6) +CHAR("*P", 2, "TT", 2, "Π", 6) +CHAR("*R", 2, "P", 1, "Ρ", 6) +CHAR("*S", 2, ">", 1, "Σ", 6) +CHAR("*T", 2, "T", 1, "Τ", 6) +CHAR("*U", 2, "Y", 1, "Υ", 6) +CHAR("*F", 2, "O_", 1, "Φ", 6) +CHAR("*X", 2, "X", 1, "Χ", 6) +CHAR("*Q", 2, "Y", 1, "Ψ", 6) +CHAR("*W", 2, "O", 1, "Ω", 6) +CHAR("*a", 2, "a", 1, "α", 6) +CHAR("*b", 2, "B", 1, "β", 6) +CHAR("*g", 2, "y", 1, "γ", 6) +CHAR("*d", 2, "d", 1, "δ", 6) +CHAR("*e", 2, "e", 1, "ε", 6) +CHAR("*z", 2, "C", 1, "ζ", 6) +CHAR("*y", 2, "n", 1, "η", 6) +CHAR("*h", 2, "0", 1, "θ", 6) +CHAR("*i", 2, "i", 1, "ι", 6) +CHAR("*k", 2, "k", 1, "κ", 6) +CHAR("*l", 2, "\\", 1, "λ", 6) +CHAR("*m", 2, "u", 1, "μ", 6) +CHAR("*n", 2, "v", 1, "ν", 6) +CHAR("*c", 2, "E", 1, "ξ", 6) +CHAR("*o", 2, "o", 1, "ο", 6) +CHAR("*p", 2, "n", 1, "π", 6) +CHAR("*r", 2, "p", 1, "ρ", 6) +CHAR("*s", 2, "o", 1, "σ", 6) +CHAR("*t", 2, "t", 1, "τ", 6) +CHAR("*u", 2, "u", 1, "υ", 6) +CHAR("*f", 2, "o", 1, "ϕ", 6) +CHAR("*x", 2, "x", 1, "χ", 6) +CHAR("*q", 2, "u", 1, "ψ", 6) +CHAR("*w", 2, "w", 1, "ω", 6) +CHAR("+h", 2, "0", 1, "ϑ", 6) +CHAR("+f", 2, "o", 1, "φ", 6) +CHAR("+p", 2, "w", 1, "ϖ", 6) +CHAR("+e", 2, "e", 1, "ϵ", 7) +CHAR("ts", 2, "s", 1, "ς", 6) + +/* Accented letters. */ +CHAR(",C", 2, "C", 1, "Ç", 6) +CHAR(",c", 2, "c", 1, "ç", 6) +CHAR("/L", 2, "L", 1, "Ł", 6) +CHAR("/O", 2, "O", 1, "Ø", 6) +CHAR("/l", 2, "l", 1, "ł", 6) +CHAR("/o", 2, "o", 1, "ø", 6) +CHAR("oA", 2, "A", 1, "Å", 6) +CHAR("oa", 2, "a", 1, "å", 6) +CHAR(":A", 2, "A", 1, "Ä", 6) +CHAR(":E", 2, "E", 1, "Ë", 6) +CHAR(":I", 2, "I", 1, "Ï", 6) +CHAR(":O", 2, "O", 1, "Ö", 6) +CHAR(":U", 2, "U", 1, "Ü", 6) +CHAR(":a", 2, "a", 1, "ä", 6) +CHAR(":e", 2, "e", 1, "ë", 6) +CHAR(":i", 2, "i", 1, "ï", 6) +CHAR(":o", 2, "o", 1, "õ", 6) +CHAR(":u", 2, "u", 1, "ü", 6) +CHAR(":y", 2, "y", 1, "ÿ", 6) +CHAR("\'A", 2, "A", 1, "Á", 6) +CHAR("\'E", 2, "E", 1, "É", 6) +CHAR("\'I", 2, "I", 1, "Í", 6) +CHAR("\'O", 2, "O", 1, "Ó", 6) +CHAR("\'U", 2, "U", 1, "Ú", 6) +CHAR("\'a", 2, "a", 1, "á", 6) +CHAR("\'e", 2, "e", 1, "é", 6) +CHAR("\'i", 2, "i", 1, "í", 6) +CHAR("\'o", 2, "o", 1, "ó", 6) +CHAR("\'u", 2, "u", 1, "ú", 6) +CHAR("^A", 2, "A", 1, "Â", 6) +CHAR("^E", 2, "E", 1, "Ê", 6) +CHAR("^I", 2, "I", 1, "Î", 6) +CHAR("^O", 2, "O", 1, "Ô", 6) +CHAR("^U", 2, "U", 1, "Û", 6) +CHAR("^a", 2, "a", 1, "â", 6) +CHAR("^e", 2, "e", 1, "ê", 6) +CHAR("^i", 2, "i", 1, "î", 6) +CHAR("^o", 2, "o", 1, "ô", 6) +CHAR("^u", 2, "u", 1, "û", 6) +CHAR("`A", 2, "A", 1, "À", 6) +CHAR("`E", 2, "E", 1, "È", 6) +CHAR("`I", 2, "I", 1, "Ì", 6) +CHAR("`O", 2, "O", 1, "Ò", 6) +CHAR("`U", 2, "U", 1, "Ù", 6) +CHAR("`a", 2, "a", 1, "à", 6) +CHAR("`e", 2, "e", 1, "è", 6) +CHAR("`i", 2, "i", 1, "ì", 6) +CHAR("`o", 2, "o", 1, "ò", 6) +CHAR("`u", 2, "u", 1, "ù", 6) +CHAR("~A", 2, "A", 1, "Ã", 6) +CHAR("~N", 2, "N", 1, "Ñ", 6) +CHAR("~O", 2, "O", 1, "Õ", 6) +CHAR("~a", 2, "a", 1, "ã", 6) +CHAR("~n", 2, "n", 1, "ñ", 6) +CHAR("~o", 2, "o", 1, "õ", 6) + +/* Arrows and lines. */ +CHAR("<-", 2, "<-", 2, "←", 7) +CHAR("->", 2, "->", 2, "→", 7) +CHAR("<>", 2, "<>", 2, "↔", 7) +CHAR("da", 2, "v", 1, "↓", 7) +BOTH("ua", 2, "^", 1, "↑", 7) +BOTH("va", 2, "^v", 2, "↕", 7) +CHAR("lA", 2, "<=", 2, "⇐", 7) +CHAR("rA", 2, "=>", 2, "⇒", 7) +CHAR("hA", 2, "<=>", 3, "⇔", 7) +CHAR("dA", 2, "v", 1, "⇓", 7) +CHAR("uA", 2, "^", 1, "⇑", 7) +CHAR("vA", 2, "^=v", 3, "⇕", 7) + +/* Logic. */ +CHAR("AN", 2, "^", 1, "∧", 7) +CHAR("OR", 2, "v", 1, "∨", 7) +CHAR("no", 2, "~", 1, "¬", 6) +CHAR("tno", 3, "~", 1, "¬", 6) +CHAR("te", 2, "3", 1, "∃", 7) +CHAR("fa", 2, "V", 1, "∀", 7) +CHAR("st", 2, "-)", 2, "∋", 7) +CHAR("tf", 2, ".:.", 3, "∴", 7) +CHAR("3d", 2, ".:.", 3, "∴", 7) +CHAR("or", 2, "|", 1, "|", 1) + +/* Mathematicals. */ +CHAR("pl", 2, "+", 1, "+", 5) +CHAR("mi", 2, "-", 1, "−", 7) +CHAR("-", 1, "-", 1, "-", 1) +CHAR("-+", 2, "-+", 2, "∓", 7) +CHAR("+-", 2, "+-", 2, "±", 6) +CHAR("t+-", 3, "+-", 2, "±", 6) +CHAR("pc", 2, ".", 1, "·", 6) +CHAR("md", 2, ".", 1, "⋅", 7) +CHAR("mu", 2, "x", 1, "×", 6) +CHAR("tmu", 3, "x", 1, "×", 6) +CHAR("c*", 2, "x", 1, "⊗", 7) +CHAR("c+", 2, "+", 1, "⊕", 7) +CHAR("di", 2, "-:-", 3, "÷", 6) +CHAR("tdi", 3, "-:-", 3, "÷", 6) +CHAR("f/", 2, "/", 1, "⁄", 7) +CHAR("**", 2, "*", 1, "∗", 7) +BOTH("<=", 2, "<=", 2, "≤", 7) +BOTH(">=", 2, ">=", 2, "≥", 7) +CHAR("<<", 2, "<<", 2, "≪", 7) +CHAR(">>", 2, ">>", 2, "≫", 7) +CHAR("eq", 2, "=", 1, "=", 5) +CHAR("!=", 2, "!=", 2, "≠", 7) +CHAR("==", 2, "==", 2, "≡", 7) +CHAR("ne", 2, "!==", 3, "≢", 7) +CHAR("=~", 2, "=~", 2, "≅", 7) +CHAR("-~", 2, "-~", 2, "≃", 7) +CHAR("ap", 2, "~", 1, "∼", 7) +CHAR("~~", 2, "~~", 2, "≈", 7) +CHAR("~=", 2, "~=", 2, "≌", 7) +CHAR("pt", 2, "oc", 2, "∝", 7) +CHAR("es", 2, "{}", 2, "∅", 7) +CHAR("mo", 2, "E", 1, "∈", 7) +CHAR("nm", 2, "!E", 2, "∉", 7) +CHAR("sb", 2, "(=", 2, "⊂", 7) +CHAR("nb", 2, "(!=", 3, "⊄", 7) +CHAR("sp", 2, "=)", 2, "⊃", 7) +CHAR("nc", 2, "!=)", 3, "⊅", 7) +CHAR("ib", 2, "(=", 2, "⊆", 7) +CHAR("ip", 2, "=)", 2, "⊇", 7) +CHAR("ca", 2, "(^)", 3, "∩", 7) +CHAR("cu", 2, "U", 1, "∪", 7) +CHAR("/_", 2, "/_", 2, "∠", 7) +CHAR("pp", 2, "_|_", 3, "⊥", 7) +CHAR("is", 2, "I", 1, "∫", 7) +CHAR("integral", 8, "I", 1, "∫", 7) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Tue May 22 18:20:41 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 3200E106564A for ; Tue, 22 May 2012 18:20:39 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 22 May 2012 18:20:39 +0000 Date: Tue, 22 May 2012 18:20:39 +0000 From: gpf@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120522182039.3200E106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r236147 - soc2012/gpf/pefs_kmod/sbin/pefs X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 May 2012 18:20:41 -0000 Author: gpf Date: Tue May 22 18:20:38 2012 New Revision: 236147 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236147 Log: Create in memory database filled with file headers & checksums. Next step is to write database to .pefs.checksum. Note: Temporarily, inode numbers are used as file identifiers and size of hash table equals to number of elements. Added: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Modified: soc2012/gpf/pefs_kmod/sbin/pefs/Makefile soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.h Modified: soc2012/gpf/pefs_kmod/sbin/pefs/Makefile ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/Makefile Tue May 22 17:11:18 2012 (r236146) +++ soc2012/gpf/pefs_kmod/sbin/pefs/Makefile Tue May 22 18:20:38 2012 (r236147) @@ -5,7 +5,7 @@ .PATH: ${SYS}/crypto/hmac ${SYS}/crypto/rijndael ${SYS}/crypto/sha2 PROG= pefs -SRCS= pefs_ctl.c pefs_key.c pefs_keychain.c pefs_subr.c +SRCS= pefs_ctl.c pefs_key.c pefs_keychain.c pefs_subr.c pefs_checksum.c SRCS+= hmac_sha512.c sha2.c SRCS+= rijndael-api.c rijndael-api-fst.c rijndael-alg-fst.c SRCS+= pkcs5v2.c @@ -17,7 +17,7 @@ DEBUG_FLAGS+= -g DPADD= ${LIBUTIL} -LDADD= -lutil +LDADD= -lutil -lcrypto BINDIR?= /sbin Added: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Tue May 22 18:20:38 2012 (r236147) @@ -0,0 +1,443 @@ +/*- + * Copyright (c) 2012 Efstratios Karatzas + * 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 +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include "pefs_ctl.h" + +#define PEFS_INTEGRITY_DEBUG +#if defined (PEFS_INTEGRITY_DEBUG) +#define dprintf(a) printf a +#else +#define dprintf(a) (void)0 +#endif + +LIST_HEAD(file_header_head, file_header); +TAILQ_HEAD(checksum_head, checksum); + +struct checksum { + unsigned char *hash; + TAILQ_ENTRY(checksum) checksum_entries; +}; + +struct file_header { + uint32_t nhashes; + uint64_t file_id; + char path[MAXPATHLEN]; + LIST_ENTRY(file_header) bucket_entries; + struct checksum_head checksums; +}; + +struct bucket { + struct file_header_head file_headers; + uint32_t nelements; +}; + +struct hash_table { + struct bucket *buckets; + uint32_t size; +}; + +/* + * XXXgpf: dbg info: + * man page example(sha256) 318b20b83a6730b928c46163a2a1cefee4466132731c95c39613acb547ccb715 + * "Test Message\n" + "Hello World\n" + */ +static int +pefs_compute_file_checksums(struct file_header *fhp, const EVP_MD *md, + uint8_t hash_len) +{ + char buf[PEFS_SECTOR_SIZE]; + EVP_MD_CTX mdctx; + int md_len, i, fd, bytes_read; + struct checksum *csp; + + TAILQ_INIT(&(fhp->checksums)); + + fd = open(fhp->path, O_RDONLY); + if (fd < 0) { + warn("failed to open file: %s", fhp->path); + return (PEFS_ERR_IO); + } + + fhp->nhashes = 0; + while ((bytes_read = read(fd, buf, sizeof(buf))) > 0) { + EVP_MD_CTX_init(&mdctx); + EVP_DigestInit_ex(&mdctx, md, NULL); + EVP_DigestUpdate(&mdctx, buf, bytes_read); + + dprintf(("read %d bytes\n", bytes_read)); + for (i=0; ihash = malloc(hash_len); + if (csp->hash == NULL) { + pefs_warn("memory allocation error"); + close(fd); + return (PEFS_ERR_SYS); + } + + EVP_DigestFinal_ex(&mdctx, csp->hash, &md_len); + + dprintf(("Digest is: ")); + for (i = 0; i < md_len; i++) dprintf(("%02x", csp->hash[i])); + dprintf(("\n")); + + EVP_MD_CTX_cleanup(&mdctx); + + TAILQ_INSERT_TAIL(&(fhp->checksums), csp, checksum_entries); + fhp->nhashes++; + } + + close(fd); + return (0); +} + +static int +pefs_count_file_entries(FILE *fpin, uint32_t *nelementsp) +{ + char buf[MAXPATHLEN + 1]; + uint32_t nfiles; + + nfiles = 0; + + while (fgets(buf, sizeof(buf), fpin) != NULL) { + nfiles++; + } + + if (feof(fpin) == 0) { + warn("error reading input"); + return (PEFS_ERR_IO); + } + + fseek(fpin, 0, SEEK_SET); + *nelementsp = nfiles; + + return (0); +} + +static int +pefs_allocate_hash_table(struct hash_table *checksum_hash_tablep, uint32_t nelements) +{ + uint32_t i; + + /* + * XXXgpf: needs optimization + */ + checksum_hash_tablep->size = nelements; + checksum_hash_tablep->buckets = malloc (nelements * sizeof(struct bucket)); + + if (checksum_hash_tablep->buckets == NULL) { + pefs_warn("memory allocation error"); + return (PEFS_ERR_SYS); + } + + for (i = 0; i < checksum_hash_tablep->size; i++) { + checksum_hash_tablep->buckets[i].nelements = 0; + LIST_INIT(&(checksum_hash_tablep->buckets[i].file_headers)); + } + + return (0); +} + +static int +pefs_add_to_bucket(struct bucket *bucketp, struct file_header *fhp) +{ + struct file_header *elementp; + uint32_t i; + + i = 1; + + if (bucketp->nelements == 0) + LIST_INSERT_HEAD(&(bucketp->file_headers), fhp, bucket_entries); + else + LIST_FOREACH(elementp, &(bucketp->file_headers), bucket_entries) { + if (elementp->file_id == fhp->file_id) { + warn("file identifier collision detected between files: %s & %s", + fhp->path, elementp->path); + return (PEFS_ERR_EXIST); + } + + if (fhp->file_id < elementp->file_id) { + LIST_INSERT_BEFORE(elementp, fhp, bucket_entries); + break; + } + else if (i++ == bucketp->nelements) { + LIST_INSERT_AFTER(elementp, fhp, bucket_entries); + break; + } + } + + bucketp->nelements++; + return (0); +} + +static struct bucket * +pefs_find_bucket(struct hash_table *checksum_hash_tablep, struct file_header *fhp) +{ + uint32_t nbucket; + + nbucket = fhp->file_id % checksum_hash_tablep->size; + dprintf(("goto bucket %d\n", nbucket)); + return (&(checksum_hash_tablep->buckets[nbucket])); +} + +static int +pefs_add_to_hash_table(struct hash_table *checksum_hash_tablep, + struct file_header *fhp) +{ + return (pefs_add_to_bucket(pefs_find_bucket(checksum_hash_tablep, fhp), fhp)); +} + +/* for debugging purposes */ +static void +pefs_print_hash_table(struct hash_table *checksum_hash_tablep, uint8_t hash_len) +{ + struct file_header *fhp; + struct checksum *csp; + uint32_t i,j; + + dprintf(("\n+++Printing Hash Table+++\n\n")); + for (i = 0; i < checksum_hash_tablep->size; i++) { + dprintf(("\nbucket %d with elements: %u\n", i, checksum_hash_tablep->buckets[i].nelements)); + LIST_FOREACH(fhp, &(checksum_hash_tablep->buckets[i].file_headers), bucket_entries) { + dprintf(("\tpath=%s!\t id = %d!\tnhashes = %d\n", fhp->path, (int)fhp->file_id, fhp->nhashes)); + TAILQ_FOREACH(csp, &(fhp->checksums), checksum_entries) { + dprintf(("\t\tdigest=")); + for (j = 0; j < hash_len; j++) + dprintf(("%02x", csp->hash[j])); + dprintf(("\n")); + } + } + } +} + +static int +pefs_get_file_id(struct file_header *fhp) +{ + struct stat sb; + + if (stat(fhp->path, &sb) != 0) { + warn("cannot stat file %s", fhp->path); + return (PEFS_ERR_SYS); + } + /* + * XXXgpf: This is only temporary since retrieving the file's inode number + * is way simpler than retrieving the checksum value from encrypted filename. + * I'm thinking of an ioctl(), we'll see. + */ + fhp->file_id = sb.st_ino; + return (0); +} + +static int +pefs_file_semantic_checks(struct file_header *fhp, struct statfs *fsp) +{ + struct stat sb; + struct statfs this_fs; + + if (stat(fhp->path, &sb) != 0) { + warn("cannot stat file %s", fhp->path); + return (PEFS_ERR_SYS); + } + + if (statfs(fhp->path, &this_fs) == -1) { + pefs_warn("statfs failed: %s: %s", fhp->path, strerror(errno)); + return (PEFS_ERR_SYS); + } + + if (S_ISREG(sb.st_mode) == 0) { + pefs_warn("filename: %s is not a regular file", fhp->path); + return (PEFS_ERR_INVALID); + } + + if ((fsp->f_fsid.val[0] != this_fs.f_fsid.val[0]) || + (fsp->f_fsid.val[1] != this_fs.f_fsid.val[1])) { + pefs_warn("filename: %s does not reside in filesystem %s", + fhp->path, fsp->f_mntonname); + return (PEFS_ERR_INVALID); + } + return (0); +} + +static struct file_header * +pefs_next_file(FILE *fpin, int *error) +{ + char buf[MAXPATHLEN + 1]; + struct file_header *fhp; + + if (fgets(buf, sizeof(buf), fpin) == NULL) { + if (feof(fpin)) + *error = 0; + else { + *error = PEFS_ERR_IO; + warn("error reading input"); + } + return (NULL); + } + + if (buf[strnlen(buf, sizeof(buf)) - 1] == '\n') + buf[strnlen(buf, sizeof(buf)) - 1] = '\0'; + dprintf(("\nnext buf=%s!\n", buf)); + + fhp = malloc(sizeof(struct file_header)); + if (fhp == NULL) { + warn("memory allocation error"); + *error = PEFS_ERR_SYS; + return (NULL); + } + + strlcpy(fhp->path, buf, sizeof(fhp->path)); + + return (fhp); +} + +/* + * This function creates the in memory database that will be later written to + * the checksum file. + * A) The total sum of entries is gathered so that a hash table is allocated. + * B) For each file entry: + * B1) semantic checks: residing in pefs filesystem & regular file type checks. + * B2) the file_id is retrieved. + * B3) list of checksums is computed for the file's 4k blocks. + * B4) file entry is added to hash table. (separate chaining is used) + */ +static int +pefs_create_in_memory_db(FILE *fpin, char *fsroot, const EVP_MD *md, uint8_t hash_len, + struct hash_table *checksum_hash_tablep) +{ + struct statfs fs; + struct file_header *fhp; + int error; + uint32_t nfiles; + + if (statfs(fsroot, &fs) == -1) { + pefs_warn("statfs failed: %s: %s", fsroot, strerror(errno)); + return (PEFS_ERR_SYS); + } + + error = pefs_count_file_entries(fpin, &nfiles); + if (error != 0) + return (error); + + error = pefs_allocate_hash_table(checksum_hash_tablep, nfiles); + if (error != 0) + return (error); + + while((fhp = pefs_next_file(fpin, &error)) != NULL) { + error = pefs_file_semantic_checks(fhp, &fs); + if (error != 0) + return error; + + error = pefs_get_file_id(fhp); + if (error != 0) + return error; + + error = pefs_compute_file_checksums(fhp, md, hash_len); + if (error != 0) + return error; + + error = pefs_add_to_hash_table(checksum_hash_tablep, fhp); + if (error != 0) + return error; + } + + /* error during pefs_next_file() */ + if (error != 0) + return error; + + pefs_print_hash_table(checksum_hash_tablep, hash_len); + + return (0); +} + +int +pefs_create_checksum_file(FILE *fpin, char *fsroot, const char *algo) +{ + char checksum_path[MAXPATHLEN]; + struct hash_table checksum_hash_table; + const EVP_MD *md; + int error, fdout; + uint8_t hash_len; + + OpenSSL_add_all_digests(); + md = EVP_get_digestbyname(algo); + + if(md == NULL) { + pefs_warn("Unknown message digest %s\n", algo); + return (PEFS_ERR_INVALID); + } + hash_len = EVP_MD_size(md); + + snprintf(checksum_path, sizeof(checksum_path), "%s/%s", fsroot, PEFS_FILE_CHECKSUM); + fdout = open(checksum_path, O_WRONLY | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); + if (fdout == -1) { + warn("cannot open %s", checksum_path); + return (PEFS_ERR_IO); + } + + error = pefs_create_in_memory_db(fpin, fsroot, md, hash_len, + &checksum_hash_table); + if (error != 0) + goto out; + + /* XXXgpf: [TODO] write the in memory db to .pefs.checksum */ + /* error = pefs_write_checksum_file(&checksum_hash_table, fdout, ...); */ + +out: + close(fdout); + if (error != 0) + unlink(checksum_path); + /* XXXgpf: [TODO] free dynamic memory */ + + return (error); +} Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Tue May 22 17:11:18 2012 (r236146) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Tue May 22 18:20:38 2012 (r236147) @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -74,6 +75,7 @@ static int pefs_getkey(int argc, char *argv[]); static int pefs_showchains(int argc, char *argv[]); static int pefs_showalgs(int argc, char *argv[]); +static int pefs_addchecksum(int argc, char *argv[]); typedef int (*command_func_t)(int argc, char **argv); typedef int (*keyop_func_t)(struct pefs_keychain_head *kch, int fd, @@ -100,9 +102,12 @@ { "delchain", pefs_delchain }, { "showchains", pefs_showchains }, { "showalgs", pefs_showalgs }, + { "addchecksum", pefs_addchecksum}, { NULL, NULL }, }; +const char *supported_digests[] = {"sha256","sha512"}; + void pefs_warn(const char *fmt, ...) { @@ -991,6 +996,59 @@ return (0); } +static int +pefs_addchecksum(int argc, char *argv[]) +{ + char fsroot[MAXPATHLEN]; + FILE *fpin; + int error, i, j; + const char *algo; + + fpin = NULL; + /* by default use sha256 */ + algo = supported_digests[0]; + + while ((i = getopt(argc, argv, "a:f:")) != -1) + switch(i) { + case 'a': + for (j=0; j < PEFS_SUPPORTED_DIGESTS; j++) + if (strcmp(supported_digests[j], optarg) == 0) { + algo = supported_digests[j]; + break; + } + + if (j == PEFS_SUPPORTED_DIGESTS) { + pefs_warn("invalid digestname: %s", optarg); + return (PEFS_ERR_INVALID); + } + break; + case 'f': + fpin = fopen(optarg, "r"); + if (fpin == NULL) { + warn("cannot open inputfile: %s", optarg); + return (PEFS_ERR_INVALID); + } + break; + default: + pefs_usage(); + } + argc -= optind; + argv += optind; + + if (fpin == NULL) { + pefs_warn("please supply an input file [-f]"); + return (PEFS_ERR_USAGE); + } + + initfsroot(argc, argv, 0, fsroot, sizeof(fsroot)); + + error = pefs_create_checksum_file(fpin, fsroot, algo); + + fclose(fpin); + + return (error); +} + static void pefs_usage_alg(void) { @@ -1016,6 +1074,7 @@ " pefs randomchain [-fv] [-n min] [-N max] filesystem\n" " pefs showchains [-fp] [-i iterations] [-k keyfile] filesystem\n" " pefs showalgs\n" +" pefs addchecksum [-a algo] [-f inputfile] filesystem\n" ); exit(PEFS_ERR_USAGE); } Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.h ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.h Tue May 22 17:11:18 2012 (r236146) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.h Tue May 22 18:20:38 2012 (r236147) @@ -28,6 +28,8 @@ #include +struct EVP_MD; + #define PEFS_FSTYPE "pefs" #define PEFS_KLD PEFS_FSTYPE @@ -36,8 +38,11 @@ #define PEFS_KDF_ITERATIONS 50000 +#define PEFS_BLOCKSIZE 4096 + #define PEFS_FILE_KEYCHAIN ".pefs.db" #define PEFS_FILE_KEYCONF ".pefs.conf" +#define PEFS_FILE_CHECKSUM ".pefs.checksum" #define PEFS_KEYCONF_ALG_IND 0 #define PEFS_KEYCONF_ITERATIONS_IND 1 @@ -47,6 +52,8 @@ #define PEFS_KEYENC_MAC_SIZE (PEFS_KEY_SIZE / 2) +#define PEFS_SUPPORTED_DIGESTS 2 + #define PEFS_ERR_GENERIC 1 #define PEFS_ERR_USAGE 2 #define PEFS_ERR_IO 3 @@ -85,6 +92,7 @@ int pefs_key_decrypt(struct pefs_xkeyenc *xe, const struct pefs_xkey *xk_parent); uintmax_t pefs_keyid_as_int(char *keyid); +int pefs_create_checksum_file(FILE *fpin, char *fsroot, const char *algo); const char * pefs_alg_name(struct pefs_xkey *xk); void pefs_alg_list(FILE *stream); From owner-svn-soc-all@FreeBSD.ORG Tue May 22 19:19:15 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id B26F91065673 for ; Tue, 22 May 2012 19:19:14 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 22 May 2012 19:19:14 +0000 Date: Tue, 22 May 2012 19:19:14 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120522191914.B26F91065673@hub.freebsd.org> Cc: Subject: socsvn commit: r236154 - soc2012/jhagewood/mdocml-1.9.9 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 May 2012 19:19:15 -0000 Author: jhagewood Date: Tue May 22 19:19:14 2012 New Revision: 236154 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236154 Log: Deleted: soc2012/jhagewood/mdocml-1.9.9/ From owner-svn-soc-all@FreeBSD.ORG Tue May 22 19:19:22 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 918091065672 for ; Tue, 22 May 2012 19:19:21 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 22 May 2012 19:19:21 +0000 Date: Tue, 22 May 2012 19:19:21 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120522191921.918091065672@hub.freebsd.org> Cc: Subject: socsvn commit: r236155 - soc2012/jhagewood/mdocml-1.9.9-orig X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 May 2012 19:19:22 -0000 Author: jhagewood Date: Tue May 22 19:19:21 2012 New Revision: 236155 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236155 Log: Deleted: soc2012/jhagewood/mdocml-1.9.9-orig/ From owner-svn-soc-all@FreeBSD.ORG Tue May 22 19:20:27 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id D4BE71065673 for ; Tue, 22 May 2012 19:20:26 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 22 May 2012 19:20:26 +0000 Date: Tue, 22 May 2012 19:20:26 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120522192026.D4BE71065673@hub.freebsd.org> Cc: Subject: socsvn commit: r236156 - soc2012/jhagewood/mdocml_patches/1.9.9_patches X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 May 2012 19:20:28 -0000 Author: jhagewood Date: Tue May 22 19:20:26 2012 New Revision: 236156 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236156 Log: Deleted: soc2012/jhagewood/mdocml_patches/1.9.9_patches/ From owner-svn-soc-all@FreeBSD.ORG Tue May 22 19:20:36 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 4692D106566C for ; Tue, 22 May 2012 19:20:35 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 22 May 2012 19:20:35 +0000 Date: Tue, 22 May 2012 19:20:35 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120522192035.4692D106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r236157 - soc2012/jhagewood/mdocml_patches/old X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 May 2012 19:20:36 -0000 Author: jhagewood Date: Tue May 22 19:20:35 2012 New Revision: 236157 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236157 Log: Deleted: soc2012/jhagewood/mdocml_patches/old/ From owner-svn-soc-all@FreeBSD.ORG Tue May 22 19:23:49 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 2A6DA106566C for ; Tue, 22 May 2012 19:23:48 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 22 May 2012 19:23:48 +0000 Date: Tue, 22 May 2012 19:23:48 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120522192348.2A6DA106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r236158 - soc2012/jhagewood/mdocml X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 May 2012 19:23:49 -0000 Author: jhagewood Date: Tue May 22 19:23:47 2012 New Revision: 236158 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236158 Log: Added: soc2012/jhagewood/mdocml/ From owner-svn-soc-all@FreeBSD.ORG Tue May 22 19:24:53 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id F1E801065670 for ; Tue, 22 May 2012 19:24:50 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 22 May 2012 19:24:50 +0000 Date: Tue, 22 May 2012 19:24:50 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120522192450.F1E801065670@hub.freebsd.org> Cc: Subject: socsvn commit: r236159 - in soc2012/jhagewood/mdocml: . mdocml-1.12.1 mdocml-1.12.1-orig mdocml_patches X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 May 2012 19:24:53 -0000 Author: jhagewood Date: Tue May 22 19:24:50 2012 New Revision: 236159 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236159 Log: Added: soc2012/jhagewood/mdocml/mdocml-1.12.1/ soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/ soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/Makefile soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/TODO soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/apropos.1 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/apropos.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/apropos_db.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/apropos_db.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/arch.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/arch.in soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/att.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/att.in soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/catman.8 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/catman.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/cgi.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/chars.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/chars.in soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/compat_fgetln.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/compat_getsubopt.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/compat_strlcat.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/compat_strlcpy.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/config.h.post soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/config.h.pre soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/demandoc.1 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/demandoc.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/eqn.7 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/eqn.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/eqn_html.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/eqn_term.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/example.style.css soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/external.png (contents, props changed) soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/html.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/html.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/index.css soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/index.sgml soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/lib.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/lib.in soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/libman.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/libmandoc.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/libmdoc.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/libroff.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/main.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/main.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/man-cgi.css soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/man.7 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/man.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/man.cgi.7 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/man.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/man_hash.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/man_html.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/man_macro.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/man_validate.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mandoc.1 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mandoc.3 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mandoc.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mandoc.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mandoc_char.7 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mandocdb.8 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mandocdb.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mandocdb.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/manpath.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/manpath.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mdoc.7 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mdoc.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mdoc.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_argv.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_hash.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_html.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_macro.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_man.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_term.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_validate.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/msec.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/msec.in soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/out.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/out.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/preconv.1 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/preconv.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/predefs.in soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/read.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/roff.7 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/roff.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/st.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/st.in soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/style.css soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/tbl.7 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/tbl.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/tbl_data.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/tbl_html.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/tbl_layout.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/tbl_opts.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/tbl_term.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/term.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/term.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/term_ascii.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/term_ps.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/test-fgetln.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/test-getsubopt.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/test-mmap.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/test-strlcat.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/test-strlcpy.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/test-strptime.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/tree.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/vol.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/vol.in soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/whatis.1 soc2012/jhagewood/mdocml/mdocml-1.12.1/Makefile soc2012/jhagewood/mdocml/mdocml-1.12.1/TODO soc2012/jhagewood/mdocml/mdocml-1.12.1/apropos.1 soc2012/jhagewood/mdocml/mdocml-1.12.1/apropos.c soc2012/jhagewood/mdocml/mdocml-1.12.1/apropos_db.c soc2012/jhagewood/mdocml/mdocml-1.12.1/apropos_db.h soc2012/jhagewood/mdocml/mdocml-1.12.1/arch.c soc2012/jhagewood/mdocml/mdocml-1.12.1/arch.in soc2012/jhagewood/mdocml/mdocml-1.12.1/att.c soc2012/jhagewood/mdocml/mdocml-1.12.1/att.in soc2012/jhagewood/mdocml/mdocml-1.12.1/catman.8 soc2012/jhagewood/mdocml/mdocml-1.12.1/catman.c soc2012/jhagewood/mdocml/mdocml-1.12.1/cgi.c soc2012/jhagewood/mdocml/mdocml-1.12.1/chars.c soc2012/jhagewood/mdocml/mdocml-1.12.1/chars.in soc2012/jhagewood/mdocml/mdocml-1.12.1/compat_fgetln.c soc2012/jhagewood/mdocml/mdocml-1.12.1/compat_getsubopt.c soc2012/jhagewood/mdocml/mdocml-1.12.1/compat_strlcat.c soc2012/jhagewood/mdocml/mdocml-1.12.1/compat_strlcpy.c soc2012/jhagewood/mdocml/mdocml-1.12.1/config.h.post soc2012/jhagewood/mdocml/mdocml-1.12.1/config.h.pre soc2012/jhagewood/mdocml/mdocml-1.12.1/demandoc.1 soc2012/jhagewood/mdocml/mdocml-1.12.1/demandoc.c soc2012/jhagewood/mdocml/mdocml-1.12.1/eqn.7 soc2012/jhagewood/mdocml/mdocml-1.12.1/eqn.c soc2012/jhagewood/mdocml/mdocml-1.12.1/eqn_html.c soc2012/jhagewood/mdocml/mdocml-1.12.1/eqn_term.c soc2012/jhagewood/mdocml/mdocml-1.12.1/example.style.css soc2012/jhagewood/mdocml/mdocml-1.12.1/external.png (contents, props changed) soc2012/jhagewood/mdocml/mdocml-1.12.1/html.c soc2012/jhagewood/mdocml/mdocml-1.12.1/html.h soc2012/jhagewood/mdocml/mdocml-1.12.1/index.css soc2012/jhagewood/mdocml/mdocml-1.12.1/index.sgml soc2012/jhagewood/mdocml/mdocml-1.12.1/lib.c soc2012/jhagewood/mdocml/mdocml-1.12.1/lib.in soc2012/jhagewood/mdocml/mdocml-1.12.1/libman.h soc2012/jhagewood/mdocml/mdocml-1.12.1/libmandoc.h soc2012/jhagewood/mdocml/mdocml-1.12.1/libmdoc.h soc2012/jhagewood/mdocml/mdocml-1.12.1/libroff.h soc2012/jhagewood/mdocml/mdocml-1.12.1/main.c soc2012/jhagewood/mdocml/mdocml-1.12.1/main.h soc2012/jhagewood/mdocml/mdocml-1.12.1/man-cgi.css soc2012/jhagewood/mdocml/mdocml-1.12.1/man.7 soc2012/jhagewood/mdocml/mdocml-1.12.1/man.c soc2012/jhagewood/mdocml/mdocml-1.12.1/man.cgi.7 soc2012/jhagewood/mdocml/mdocml-1.12.1/man.h soc2012/jhagewood/mdocml/mdocml-1.12.1/man_hash.c soc2012/jhagewood/mdocml/mdocml-1.12.1/man_html.c soc2012/jhagewood/mdocml/mdocml-1.12.1/man_macro.c soc2012/jhagewood/mdocml/mdocml-1.12.1/man_term.c soc2012/jhagewood/mdocml/mdocml-1.12.1/man_validate.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mandoc.1 soc2012/jhagewood/mdocml/mdocml-1.12.1/mandoc.3 soc2012/jhagewood/mdocml/mdocml-1.12.1/mandoc.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mandoc.h soc2012/jhagewood/mdocml/mdocml-1.12.1/mandoc_char.7 soc2012/jhagewood/mdocml/mdocml-1.12.1/mandocdb.8 soc2012/jhagewood/mdocml/mdocml-1.12.1/mandocdb.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mandocdb.h soc2012/jhagewood/mdocml/mdocml-1.12.1/manpath.c soc2012/jhagewood/mdocml/mdocml-1.12.1/manpath.h soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc.7 soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc.h soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_argv.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_hash.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_html.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_macro.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_man.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_term.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_validate.c soc2012/jhagewood/mdocml/mdocml-1.12.1/msec.c soc2012/jhagewood/mdocml/mdocml-1.12.1/msec.in soc2012/jhagewood/mdocml/mdocml-1.12.1/out.c soc2012/jhagewood/mdocml/mdocml-1.12.1/out.h soc2012/jhagewood/mdocml/mdocml-1.12.1/preconv.1 soc2012/jhagewood/mdocml/mdocml-1.12.1/preconv.c soc2012/jhagewood/mdocml/mdocml-1.12.1/predefs.in soc2012/jhagewood/mdocml/mdocml-1.12.1/read.c soc2012/jhagewood/mdocml/mdocml-1.12.1/roff.7 soc2012/jhagewood/mdocml/mdocml-1.12.1/roff.c soc2012/jhagewood/mdocml/mdocml-1.12.1/st.c soc2012/jhagewood/mdocml/mdocml-1.12.1/st.in soc2012/jhagewood/mdocml/mdocml-1.12.1/style.css soc2012/jhagewood/mdocml/mdocml-1.12.1/tbl.7 soc2012/jhagewood/mdocml/mdocml-1.12.1/tbl.c soc2012/jhagewood/mdocml/mdocml-1.12.1/tbl_data.c soc2012/jhagewood/mdocml/mdocml-1.12.1/tbl_html.c soc2012/jhagewood/mdocml/mdocml-1.12.1/tbl_layout.c soc2012/jhagewood/mdocml/mdocml-1.12.1/tbl_opts.c soc2012/jhagewood/mdocml/mdocml-1.12.1/tbl_term.c soc2012/jhagewood/mdocml/mdocml-1.12.1/term.c soc2012/jhagewood/mdocml/mdocml-1.12.1/term.h soc2012/jhagewood/mdocml/mdocml-1.12.1/term_ascii.c soc2012/jhagewood/mdocml/mdocml-1.12.1/term_ps.c soc2012/jhagewood/mdocml/mdocml-1.12.1/test-fgetln.c soc2012/jhagewood/mdocml/mdocml-1.12.1/test-getsubopt.c soc2012/jhagewood/mdocml/mdocml-1.12.1/test-mmap.c soc2012/jhagewood/mdocml/mdocml-1.12.1/test-strlcat.c soc2012/jhagewood/mdocml/mdocml-1.12.1/test-strlcpy.c soc2012/jhagewood/mdocml/mdocml-1.12.1/test-strptime.c soc2012/jhagewood/mdocml/mdocml-1.12.1/tree.c soc2012/jhagewood/mdocml/mdocml-1.12.1/vol.c soc2012/jhagewood/mdocml/mdocml-1.12.1/vol.in soc2012/jhagewood/mdocml/mdocml-1.12.1/whatis.1 soc2012/jhagewood/mdocml/mdocml_patches/ soc2012/jhagewood/mdocml/mdocml_patches/patch-config.txt soc2012/jhagewood/mdocml/mdocml_patches/patch-lib.in.txt soc2012/jhagewood/mdocml/mdocml_patches/patch-mdoc_validate.c soc2012/jhagewood/mdocml/mdocml_patches/patch-msec.in.txt soc2012/jhagewood/mdocml/mdocml_test.sh Added: soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/Makefile Tue May 22 19:24:50 2012 (r236159) @@ -0,0 +1,645 @@ +.PHONY: clean install installwww +.SUFFIXES: .sgml .html .md5 .h .h.html +.SUFFIXES: .1 .3 .7 .8 +.SUFFIXES: .1.txt .3.txt .7.txt .8.txt +.SUFFIXES: .1.pdf .3.pdf .7.pdf .8.pdf +.SUFFIXES: .1.ps .3.ps .7.ps .8.ps +.SUFFIXES: .1.html .3.html .7.html .8.html +.SUFFIXES: .1.xhtml .3.xhtml .7.xhtml .8.xhtml + +# Specify this if you want to hard-code the operating system to appear +# in the lower-left hand corner of -mdoc manuals. +# +# CFLAGS += -DOSNAME="\"OpenBSD 4.5\"" + +VERSION = 1.12.1 +VDATE = 23 March 2012 + +# IFF your system supports multi-byte functions (setlocale(), wcwidth(), +# putwchar()) AND has __STDC_ISO_10646__ (that is, wchar_t is simply a +# UCS-4 value) should you define USE_WCHAR. If you define it and your +# system DOESN'T support this, -Tlocale will produce garbage. +# If you don't define it, -Tlocale is a synonym for -Tacsii. +# +CFLAGS += -DUSE_WCHAR + +# If your system has manpath(1), uncomment this. This is most any +# system that's not OpenBSD or NetBSD. If uncommented, apropos(1), +# mandocdb(8), and man.cgi will popen(3) manpath(1) to get the MANPATH +# variable. +#CFLAGS += -DUSE_MANPATH + +# If your system supports static binaries only, uncomment this. This +# appears only to be BSD UNIX systems (Mac OS X has no support and Linux +# requires -pthreads for static libdb). +STATIC = -static + +CFLAGS += -g -DHAVE_CONFIG_H -DVERSION="\"$(VERSION)\"" +CFLAGS += -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings +PREFIX = /usr/local +WWWPREFIX = /var/www +HTDOCDIR = $(WWWPREFIX)/htdocs +CGIBINDIR = $(WWWPREFIX)/cgi-bin +BINDIR = $(PREFIX)/bin +INCLUDEDIR = $(PREFIX)/include/mandoc +LIBDIR = $(PREFIX)/lib/mandoc +MANDIR = $(PREFIX)/man +EXAMPLEDIR = $(PREFIX)/share/examples/mandoc +INSTALL = install +INSTALL_PROGRAM = $(INSTALL) -m 0755 +INSTALL_DATA = $(INSTALL) -m 0444 +INSTALL_LIB = $(INSTALL) -m 0644 +INSTALL_SOURCE = $(INSTALL) -m 0644 +INSTALL_MAN = $(INSTALL_DATA) + +# Non-BSD systems (Linux, etc.) need -ldb to compile mandocdb and +# apropos. +# However, if you don't have -ldb at all (or it's not native), then +# comment out apropos and mandocdb. +# +#DBLIB = -ldb +DBBIN = apropos mandocdb man.cgi catman whatis +DBLN = llib-lapropos.ln llib-lmandocdb.ln llib-lman.cgi.ln llib-lcatman.ln + +all: mandoc preconv demandoc $(DBBIN) + +SRCS = Makefile \ + TODO \ + apropos.1 \ + apropos.c \ + apropos_db.c \ + apropos_db.h \ + arch.c \ + arch.in \ + att.c \ + att.in \ + catman.8 \ + catman.c \ + cgi.c \ + chars.c \ + chars.in \ + compat_fgetln.c \ + compat_getsubopt.c \ + compat_strlcat.c \ + compat_strlcpy.c \ + config.h.post \ + config.h.pre \ + demandoc.1 \ + demandoc.c \ + eqn.7 \ + eqn.c \ + eqn_html.c \ + eqn_term.c \ + example.style.css \ + external.png \ + html.c \ + html.h \ + index.css \ + index.sgml \ + lib.c \ + lib.in \ + libman.h \ + libmandoc.h \ + libmdoc.h \ + libroff.h \ + main.c \ + main.h \ + man.7 \ + man.c \ + man.cgi.7 \ + man-cgi.css \ + man.h \ + man_hash.c \ + man_html.c \ + man_macro.c \ + man_term.c \ + man_validate.c \ + mandoc.1 \ + mandoc.3 \ + mandoc.c \ + mandoc.h \ + mandoc_char.7 \ + mandocdb.8 \ + mandocdb.c \ + mandocdb.h \ + manpath.c \ + manpath.h \ + mdoc.7 \ + mdoc.c \ + mdoc.h \ + mdoc_argv.c \ + mdoc_hash.c \ + mdoc_html.c \ + mdoc_macro.c \ + mdoc_man.c \ + mdoc_term.c \ + mdoc_validate.c \ + msec.c \ + msec.in \ + out.c \ + out.h \ + preconv.1 \ + preconv.c \ + predefs.in \ + read.c \ + roff.7 \ + roff.c \ + st.c \ + st.in \ + style.css \ + tbl.7 \ + tbl.c \ + tbl_data.c \ + tbl_html.c \ + tbl_layout.c \ + tbl_opts.c \ + tbl_term.c \ + term.c \ + term.h \ + term_ascii.c \ + term_ps.c \ + test-fgetln.c \ + test-getsubopt.c \ + test-mmap.c \ + test-strlcat.c \ + test-strlcpy.c \ + test-strptime.c \ + tree.c \ + vol.c \ + vol.in \ + whatis.1 + +LIBMAN_OBJS = man.o \ + man_hash.o \ + man_macro.o \ + man_validate.o +LIBMAN_LNS = man.ln \ + man_hash.ln \ + man_macro.ln \ + man_validate.ln + +LIBMDOC_OBJS = arch.o \ + att.o \ + lib.o \ + mdoc.o \ + mdoc_argv.o \ + mdoc_hash.o \ + mdoc_macro.o \ + mdoc_validate.o \ + st.o \ + vol.o +LIBMDOC_LNS = arch.ln \ + att.ln \ + lib.ln \ + mdoc.ln \ + mdoc_argv.ln \ + mdoc_hash.ln \ + mdoc_macro.ln \ + mdoc_validate.ln \ + st.ln \ + vol.ln + +LIBROFF_OBJS = eqn.o \ + roff.o \ + tbl.o \ + tbl_data.o \ + tbl_layout.o \ + tbl_opts.o +LIBROFF_LNS = eqn.ln \ + roff.ln \ + tbl.ln \ + tbl_data.ln \ + tbl_layout.ln \ + tbl_opts.ln + +LIBMANDOC_OBJS = $(LIBMAN_OBJS) \ + $(LIBMDOC_OBJS) \ + $(LIBROFF_OBJS) \ + chars.o \ + mandoc.o \ + msec.o \ + read.o +LIBMANDOC_LNS = $(LIBMAN_LNS) \ + $(LIBMDOC_LNS) \ + $(LIBROFF_LNS) \ + chars.ln \ + mandoc.ln \ + msec.ln \ + read.ln + +COMPAT_OBJS = compat_fgetln.o \ + compat_getsubopt.o \ + compat_strlcat.o \ + compat_strlcpy.o +COMPAT_LNS = compat_fgetln.ln \ + compat_getsubopt.ln \ + compat_strlcat.ln \ + compat_strlcpy.ln + +arch.o arch.ln: arch.in +att.o att.ln: att.in +chars.o chars.ln: chars.in +lib.o lib.ln: lib.in +msec.o msec.ln: msec.in +roff.o roff.ln: predefs.in +st.o st.ln: st.in +vol.o vol.ln: vol.in + +$(LIBMAN_OBJS) $(LIBMAN_LNS): libman.h +$(LIBMDOC_OBJS) $(LIBMDOC_LNS): libmdoc.h +$(LIBROFF_OBJS) $(LIBROFF_LNS): libroff.h +$(LIBMANDOC_OBJS) $(LIBMANDOC_LNS): mandoc.h mdoc.h man.h libmandoc.h config.h + +$(COMPAT_OBJS) $(COMPAT_LNS): config.h + +MANDOC_HTML_OBJS = eqn_html.o \ + html.o \ + man_html.o \ + mdoc_html.o \ + tbl_html.o +MANDOC_HTML_LNS = eqn_html.ln \ + html.ln \ + man_html.ln \ + mdoc_html.ln \ + tbl_html.ln + +MANDOC_MAN_OBJS = mdoc_man.o +MANDOC_MAN_LNS = mdoc_man.ln + +MANDOC_TERM_OBJS = eqn_term.o \ + man_term.o \ + mdoc_term.o \ + term.o \ + term_ascii.o \ + term_ps.o \ + tbl_term.o +MANDOC_TERM_LNS = eqn_term.ln \ + man_term.ln \ + mdoc_term.ln \ + term.ln \ + term_ascii.ln \ + term_ps.ln \ + tbl_term.ln + +MANDOC_OBJS = $(MANDOC_HTML_OBJS) \ + $(MANDOC_MAN_OBJS) \ + $(MANDOC_TERM_OBJS) \ + main.o \ + out.o \ + tree.o +MANDOC_LNS = $(MANDOC_HTML_LNS) \ + $(MANDOC_MAN_LNS) \ + $(MANDOC_TERM_LNS) \ + main.ln \ + out.ln \ + tree.ln + +$(MANDOC_HTML_OBJS) $(MANDOC_HTML_LNS): html.h +$(MANDOC_TERM_OBJS) $(MANDOC_TERM_LNS): term.h +$(MANDOC_OBJS) $(MANDOC_LNS): main.h mandoc.h mdoc.h man.h config.h out.h + +MANDOCDB_OBJS = mandocdb.o manpath.o +MANDOCDB_LNS = mandocdb.ln manpath.ln + +$(MANDOCDB_OBJS) $(MANDOCDB_LNS): mandocdb.h mandoc.h mdoc.h man.h config.h manpath.h + +PRECONV_OBJS = preconv.o +PRECONV_LNS = preconv.ln + +$(PRECONV_OBJS) $(PRECONV_LNS): config.h + +APROPOS_OBJS = apropos.o apropos_db.o manpath.o +APROPOS_LNS = apropos.ln apropos_db.ln manpath.ln + +$(APROPOS_OBJS) $(APROPOS_LNS): config.h mandoc.h apropos_db.h manpath.h mandocdb.h + +CGI_OBJS = $(MANDOC_HTML_OBJS) \ + $(MANDOC_MAN_OBJS) \ + $(MANDOC_TERM_OBJS) \ + cgi.o \ + apropos_db.o \ + manpath.o \ + out.o \ + tree.o + +CGI_LNS = $(MANDOC_HTML_LNS) \ + $(MANDOC_MAN_LNS) \ + $(MANDOC_TERM_LNS) \ + cgi.ln \ + apropos_db.ln \ + manpath.ln \ + out.ln \ + tree.ln + +$(CGI_OBJS) $(CGI_LNS): main.h mdoc.h man.h out.h config.h mandoc.h apropos_db.h manpath.h mandocdb.h + +CATMAN_OBJS = catman.o manpath.o +CATMAN_LNS = catman.ln manpath.ln + +$(CATMAN_OBJS) $(CATMAN_LNS): config.h mandoc.h manpath.h mandocdb.h + +DEMANDOC_OBJS = demandoc.o +DEMANDOC_LNS = demandoc.ln + +$(DEMANDOC_OBJS) $(DEMANDOC_LNS): config.h + +INDEX_MANS = apropos.1.html \ + apropos.1.xhtml \ + apropos.1.ps \ + apropos.1.pdf \ + apropos.1.txt \ + catman.8.html \ + catman.8.xhtml \ + catman.8.ps \ + catman.8.pdf \ + catman.8.txt \ + demandoc.1.html \ + demandoc.1.xhtml \ + demandoc.1.ps \ + demandoc.1.pdf \ + demandoc.1.txt \ + mandoc.1.html \ + mandoc.1.xhtml \ + mandoc.1.ps \ + mandoc.1.pdf \ + mandoc.1.txt \ + whatis.1.html \ + whatis.1.xhtml \ + whatis.1.ps \ + whatis.1.pdf \ + whatis.1.txt \ + mandoc.3.html \ + mandoc.3.xhtml \ + mandoc.3.ps \ + mandoc.3.pdf \ + mandoc.3.txt \ + eqn.7.html \ + eqn.7.xhtml \ + eqn.7.ps \ + eqn.7.pdf \ + eqn.7.txt \ + man.7.html \ + man.7.xhtml \ + man.7.ps \ + man.7.pdf \ + man.7.txt \ + man.cgi.7.html \ + man.cgi.7.xhtml \ + man.cgi.7.ps \ + man.cgi.7.pdf \ + man.cgi.7.txt \ + mandoc_char.7.html \ + mandoc_char.7.xhtml \ + mandoc_char.7.ps \ + mandoc_char.7.pdf \ + mandoc_char.7.txt \ + mdoc.7.html \ + mdoc.7.xhtml \ + mdoc.7.ps \ + mdoc.7.pdf \ + mdoc.7.txt \ + preconv.1.html \ + preconv.1.xhtml \ + preconv.1.ps \ + preconv.1.pdf \ + preconv.1.txt \ + roff.7.html \ + roff.7.xhtml \ + roff.7.ps \ + roff.7.pdf \ + roff.7.txt \ + tbl.7.html \ + tbl.7.xhtml \ + tbl.7.ps \ + tbl.7.pdf \ + tbl.7.txt \ + mandocdb.8.html \ + mandocdb.8.xhtml \ + mandocdb.8.ps \ + mandocdb.8.pdf \ + mandocdb.8.txt + +$(INDEX_MANS): mandoc + +INDEX_OBJS = $(INDEX_MANS) \ + man.h.html \ + mandoc.h.html \ + mdoc.h.html \ + mdocml.tar.gz \ + mdocml.md5 + +www: index.html + +lint: llib-lmandoc.ln llib-lpreconv.ln llib-ldemandoc.ln $(DBLN) + +clean: + rm -f libmandoc.a $(LIBMANDOC_OBJS) + rm -f llib-llibmandoc.ln $(LIBMANDOC_LNS) + rm -f mandocdb $(MANDOCDB_OBJS) + rm -f llib-lmandocdb.ln $(MANDOCDB_LNS) + rm -f preconv $(PRECONV_OBJS) + rm -f llib-lpreconv.ln $(PRECONV_LNS) + rm -f apropos whatis $(APROPOS_OBJS) + rm -f llib-lapropos.ln $(APROPOS_LNS) + rm -f man.cgi $(CGI_OBJS) + rm -f llib-lman.cgi.ln $(CGI_LNS) + rm -f catman $(CATMAN_OBJS) + rm -f llib-lcatman.ln $(CATMAN_LNS) + rm -f demandoc $(DEMANDOC_OBJS) + rm -f llib-ldemandoc.ln $(DEMANDOC_LNS) + rm -f mandoc $(MANDOC_OBJS) + rm -f llib-lmandoc.ln $(MANDOC_LNS) + rm -f config.h config.log $(COMPAT_OBJS) $(COMPAT_LNS) + rm -f mdocml.tar.gz mdocml-win32.zip mdocml-win64.zip mdocml-macosx.zip + rm -f index.html $(INDEX_OBJS) + rm -rf test-fgetln.dSYM + rm -rf test-strlcpy.dSYM + rm -rf test-strlcat.dSYM + rm -rf test-strptime.dSYM + rm -rf test-mmap.dSYM + rm -rf test-getsubopt.dSYM + rm -rf apropos.dSYM + rm -rf catman.dSYM + rm -rf mandocdb.dSYM + rm -rf whatis.dSYM + +install: all + mkdir -p $(DESTDIR)$(BINDIR) + mkdir -p $(DESTDIR)$(EXAMPLEDIR) + mkdir -p $(DESTDIR)$(LIBDIR) + mkdir -p $(DESTDIR)$(INCLUDEDIR) + mkdir -p $(DESTDIR)$(MANDIR)/man1 + mkdir -p $(DESTDIR)$(MANDIR)/man3 + mkdir -p $(DESTDIR)$(MANDIR)/man7 + $(INSTALL_PROGRAM) mandoc preconv demandoc $(DESTDIR)$(BINDIR) + $(INSTALL_LIB) libmandoc.a $(DESTDIR)$(LIBDIR) + $(INSTALL_LIB) man.h mdoc.h mandoc.h $(DESTDIR)$(INCLUDEDIR) + $(INSTALL_MAN) mandoc.1 preconv.1 demandoc.1 $(DESTDIR)$(MANDIR)/man1 + $(INSTALL_MAN) mandoc.3 $(DESTDIR)$(MANDIR)/man3 + $(INSTALL_MAN) man.7 mdoc.7 roff.7 eqn.7 tbl.7 mandoc_char.7 $(DESTDIR)$(MANDIR)/man7 + $(INSTALL_DATA) example.style.css $(DESTDIR)$(EXAMPLEDIR) + +installcgi: all + mkdir -p $(DESTDIR)$(CGIBINDIR) + mkdir -p $(DESTDIR)$(HTDOCDIR) + $(INSTALL_PROGRAM) man.cgi $(DESTDIR)$(CGIBINDIR) + $(INSTALL_DATA) example.style.css $(DESTDIR)$(HTDOCDIR)/man.css + $(INSTALL_DATA) man-cgi.css $(DESTDIR)$(HTDOCDIR) + +installwww: www + mkdir -p $(PREFIX)/snapshots + mkdir -p $(PREFIX)/binaries + $(INSTALL_DATA) index.html external.png index.css $(PREFIX) + $(INSTALL_DATA) $(INDEX_MANS) style.css $(PREFIX) + $(INSTALL_DATA) mandoc.h.html man.h.html mdoc.h.html $(PREFIX) + $(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots + $(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots + $(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots/mdocml-$(VERSION).tar.gz + $(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots/mdocml-$(VERSION).md5 + +libmandoc.a: $(COMPAT_OBJS) $(LIBMANDOC_OBJS) + $(AR) rs $@ $(COMPAT_OBJS) $(LIBMANDOC_OBJS) + +llib-llibmandoc.ln: $(COMPAT_LNS) $(LIBMANDOC_LNS) + $(LINT) $(LINTFLAGS) -Clibmandoc $(COMPAT_LNS) $(LIBMANDOC_LNS) + +mandoc: $(MANDOC_OBJS) libmandoc.a + $(CC) $(LDFLAGS) -o $@ $(MANDOC_OBJS) libmandoc.a + +llib-lmandoc.ln: $(MANDOC_LNS) llib-llibmandoc.ln + $(LINT) $(LINTFLAGS) -Cmandoc $(MANDOC_LNS) llib-llibmandoc.ln + +mandocdb: $(MANDOCDB_OBJS) libmandoc.a + $(CC) $(LDFLAGS) -o $@ $(MANDOCDB_OBJS) libmandoc.a $(DBLIB) + +llib-lmandocdb.ln: $(MANDOCDB_LNS) llib-llibmandoc.ln + $(LINT) $(LINTFLAGS) -Cmandocdb $(MANDOCDB_LNS) llib-llibmandoc.ln + +preconv: $(PRECONV_OBJS) + $(CC) $(LDFLAGS) -o $@ $(PRECONV_OBJS) + +llib-lpreconv.ln: $(PRECONV_LNS) llib-llibmandoc.ln + $(LINT) $(LINTFLAGS) -Cpreconv $(PRECONV_LNS) llib-llibmandoc.ln + +whatis: apropos + cp -f apropos whatis + +apropos: $(APROPOS_OBJS) libmandoc.a + $(CC) $(LDFLAGS) -o $@ $(APROPOS_OBJS) libmandoc.a $(DBLIB) + +llib-lapropos.ln: $(APROPOS_LNS) llib-llibmandoc.ln + $(LINT) $(LINTFLAGS) -Capropos $(APROPOS_LNS) llib-llibmandoc.ln + +catman: $(CATMAN_OBJS) libmandoc.a + $(CC) $(LDFLAGS) -o $@ $(CATMAN_OBJS) libmandoc.a $(DBLIB) + +llib-lcatman.ln: $(CATMAN_LNS) llib-llibmandoc.ln + $(LINT) $(LINTFLAGS) -Ccatman $(CATMAN_LNS) llib-llibmandoc.ln + +man.cgi: $(CGI_OBJS) libmandoc.a + $(CC) $(LDFLAGS) $(STATIC) -o $@ $(CGI_OBJS) libmandoc.a $(DBLIB) + +llib-lman.cgi.ln: $(CGI_LNS) llib-llibmandoc.ln + $(LINT) $(LINTFLAGS) -Cman.cgi $(CGI_LNS) llib-llibmandoc.ln + +demandoc: $(DEMANDOC_OBJS) libmandoc.a + $(CC) $(LDFLAGS) -o $@ $(DEMANDOC_OBJS) libmandoc.a + +llib-ldemandoc.ln: $(DEMANDOC_LNS) llib-llibmandoc.ln + $(LINT) $(LINTFLAGS) -Cdemandoc $(DEMANDOC_LNS) llib-llibmandoc.ln + +mdocml.md5: mdocml.tar.gz + md5 mdocml.tar.gz >$@ + +mdocml.tar.gz: $(SRCS) + mkdir -p .dist/mdocml-$(VERSION)/ + $(INSTALL_SOURCE) $(SRCS) .dist/mdocml-$(VERSION) + ( cd .dist/ && tar zcf ../$@ ./ ) + rm -rf .dist/ + +mdocml-win32.zip: $(SRCS) + mkdir -p .win32/mdocml-$(VERSION)/ + $(INSTALL_SOURCE) $(SRCS) .win32 + cp .win32/Makefile .win32/Makefile.old + egrep -v -e DUSE_WCHAR -e ^DBBIN .win32/Makefile.old >.win32/Makefile + ( cd .win32; \ + CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar CFLAGS='-DOSNAME=\"Windows\"' make; \ + make install PREFIX=mdocml-$(VERSION) ; \ + zip -r ../$@ mdocml-$(VERSION) ) + rm -rf .win32 + +mdocml-win64.zip: $(SRCS) + mkdir -p .win64/mdocml-$(VERSION)/ + $(INSTALL_SOURCE) $(SRCS) .win64 + cp .win64/Makefile .win64/Makefile.old + egrep -v -e DUSE_WCHAR -e ^DBBIN .win64/Makefile.old >.win64/Makefile + ( cd .win64; \ + CC=x86_64-w64-mingw32-gcc AR=x86_64-w64-mingw32-ar CFLAGS='-DOSNAME=\"Windows\"' make; \ + make install PREFIX=mdocml-$(VERSION) ; \ + zip -r ../$@ mdocml-$(VERSION) ) + rm -rf .win64 + +mdocml-macosx.zip: $(SRCS) + mkdir -p .macosx/mdocml-$(VERSION)/ + $(INSTALL_SOURCE) $(SRCS) .macosx + ( cd .macosx; \ + CFLAGS="-arch i386 -arch x86_64 -arch ppc" LDFLAGS="-arch i386 -arch x86_64 -arch ppc" make; \ + make install PREFIX=mdocml-$(VERSION) ; \ + zip -r ../$@ mdocml-$(VERSION) ) + rm -rf .macosx + +index.html: $(INDEX_OBJS) + +config.h: config.h.pre config.h.post + rm -f config.log + ( cat config.h.pre; \ + echo; \ + if $(CC) $(CFLAGS) -Werror -o test-fgetln test-fgetln.c >> config.log 2>&1; then \ + echo '#define HAVE_FGETLN'; \ + rm test-fgetln; \ + fi; \ + if $(CC) $(CFLAGS) -Werror -o test-strptime test-strptime.c >> config.log 2>&1; then \ + echo '#define HAVE_STRPTIME'; \ + rm test-strptime; \ + fi; \ + if $(CC) $(CFLAGS) -Werror -o test-getsubopt test-getsubopt.c >> config.log 2>&1; then \ + echo '#define HAVE_GETSUBOPT'; \ + rm test-getsubopt; \ + fi; \ + if $(CC) $(CFLAGS) -Werror -o test-strlcat test-strlcat.c >> config.log 2>&1; then \ + echo '#define HAVE_STRLCAT'; \ + rm test-strlcat; \ + fi; \ + if $(CC) $(CFLAGS) -Werror -o test-mmap test-mmap.c >> config.log 2>&1; then \ + echo '#define HAVE_MMAP'; \ + rm test-mmap; \ + fi; \ + if $(CC) $(CFLAGS) -Werror -o test-strlcpy test-strlcpy.c >> config.log 2>&1; then \ + echo '#define HAVE_STRLCPY'; \ + rm test-strlcpy; \ + fi; \ + echo; \ + cat config.h.post \ + ) > $@ + +.h.h.html: + highlight -I $< >$@ + +.1.1.txt .3.3.txt .7.7.txt .8.8.txt: + ./mandoc -Tascii -Wall,stop $< | col -b >$@ + +.1.1.html .3.3.html .7.7.html .8.8.html: + ./mandoc -Thtml -Wall,stop -Ostyle=style.css,man=%N.%S.html,includes=%I.html $< >$@ + +.1.1.ps .3.3.ps .7.7.ps .8.8.ps: + ./mandoc -Tps -Wall,stop $< >$@ + +.1.1.xhtml .3.3.xhtml .7.7.xhtml .8.8.xhtml: + ./mandoc -Txhtml -Wall,stop -Ostyle=style.css,man=%N.%S.xhtml,includes=%I.html $< >$@ + +.1.1.pdf .3.3.pdf .7.7.pdf .8.8.pdf: + ./mandoc -Tpdf -Wall,stop $< >$@ + +.sgml.html: + validate --warn $< + sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< >$@ Added: soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/TODO ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/TODO Tue May 22 19:24:50 2012 (r236159) @@ -0,0 +1,372 @@ +************************************************************************ +* Official mandoc TODO. +* $Id: TODO,v 1.129 2012/03/04 23:53:37 schwarze Exp $ +************************************************************************ + +************************************************************************ +* parser bugs +************************************************************************ + +- ".\}" on its own line gets translated to bare ".\&" + which forces pset() into man(7) + and then triggers an unknown macro error + reported by naddy@ Sun, 3 Jul 2011 21:52:24 +0200 + +************************************************************************ +* formatter bugs +************************************************************************ + +- tbl(7): Horizontal and vertical lines are formatted badly: + With the box option, there is too much white space at the end of cells. + Horizontal lines from "=" lines are a bit too long. + yuri dot pankov at gmail dot com Thu, 14 Apr 2011 05:45:26 +0400 + +************************************************************************ +* missing features +************************************************************************ + +--- missing roff features ---------------------------------------------- + +- The pod2man preamble wants \h'...' with quoted numerical arguments, + see for example AUTHORS in MooseX::Getopt.3p, p5-MooseX-Getopt. + reported by Andreas Voegele + Tue, 22 Nov 2011 15:34:47 +0100 on ports@ + +- .if n \{ + .br\} + should cause an extra space to be raised. + +- .ad (adjust margins) + .ad l -- adjust left margin only (flush left) + .ad r -- adjust right margin only (flush right) + .ad c -- center text on line + .ad b -- adjust both margins (alias: .ad n) + .na -- temporarily disable adjustment without changing the mode + .ad -- re-enable adjustment without changing the mode + Adjustment mode is ignored while in no-fill mode (.nf). + +- .it (line traps) occur in mysql(1), yasm_arch(7) + generated by DocBook XSL Stylesheets v1.71.1 + reported by brad@ Sat, 15 Jan 2011 15:48:18 -0500 + +- .ns (no-space mode) occurs in xine-config(1) + reported by brad@ Sat, 15 Jan 2011 15:45:23 -0500 + +- xloadimage(1) wants .ti (temporary indent), rep by naddy@ + +- .ta (tab settings) occurs in ircbug(1) and probably gnats(1) + reported by brad@ Sat, 15 Jan 2011 15:50:51 -0500 + +- \c (interrupted text) occurs in chat(8) + +- using undefined strings or macros defines them to be empty + wl@ Mon, 14 Nov 2011 14:37:01 +0000 + +--- missing mdoc features ---------------------------------------------- + +- fix bad block nesting involving multiple identical explicit blocks + see the OpenBSD mdoc_macro.c 1.47 commit message + +- .Bl -column .Xo support is missing + ultimate goal: + restore .Xr and .Dv to + lib/libc/compat-43/sigvec.3 + lib/libc/gen/signal.3 + lib/libc/sys/sigaction.2 + +- edge case: decide how to deal with blk_full bad nesting, e.g. + .Sh .Nm .Bk .Nm .Ek .Sh found by jmc@ in ssh-keygen(1) + from jmc@ Wed, 14 Jul 2010 18:10:32 +0100 + +- \\ is now implemented correctly + * when defining strings and macros using .ds and .de + * when parsing roff(7) and man(7) macro arguments + It does not yet work in mdoc(7) macro arguments + because libmdoc does not yet use mandoc_getarg(). + Also check what happens in plain text, it must be identical to \e. + +- .Bd -filled should not be the same as .Bd -ragged, but align both + the left and right margin. In groff, it is implemented in terms + of .ad b, which we don't have either. Found in cksum(1). + +- implement blank `Bl -column', such as + .Bl -column + .It foo Ta bar + .El + +- explicitly disallow nested `Bl -column', which would clobber internal + flags defined for struct mdoc_macro + +- In .Bl -column .It, the end of the line probably has to be regarded + as an implicit .Ta, if there could be one, see the following mildly + ugly code from login.conf(5): + .Bl -column minpasswordlen program xetcxmotd + .It path Ta path Ta value of Dv _PATH_DEFPATH + .br + Default search path. + reported by Michal Mazurek + via jmc@ Thu, 7 Apr 2011 16:00:53 +0059 + +- inside `.Bl -column' phrases, punctuation is handled like normal + text, e.g. `.Bl -column .It Fl x . Ta ...' should give "-x -." + +- inside `.Bl -column' phrases, TERMP_IGNDELIM handling by `Pf' + is not safe, e.g. `.Bl -column .It Pf a b .' gives "ab." + but should give "ab ." + +- set a meaningful default if no `Bl' list type is assigned + +- have a blank `It' head for `Bl -tag' not puke + +- prohibit `Nm' from having non-text HEAD children + (e.g., NetBSD mDNSShared/dns-sd.1) + (mdoc_html.c and mdoc_term.c `Nm' handlers can be slightly simplified) + +- When there is free text in the SYNOPSIS and that free text contains + the .Nm macro, groff somehow understands to treat the .Nm as an in-line + macro, while mandoc treats it as a block macro and breaks the line. + No idea how the logic for distinguishing in-line and block instances + should be, needs investigation. + uqs@ Thu, 2 Jun 2011 11:03:51 +0200 + uqs@ Thu, 2 Jun 2011 11:33:35 +0200 + +--- missing man features ----------------------------------------------- + +- groff an-ext.tmac macros (.UR, .UE) occur in xine(5) + reported by brad@ Sat, 15 Jan 2011 15:45:23 -0500 + +- -T[x]html doesn't stipulate non-collapsing spaces in literal mode + +--- missing tbl features ----------------------------------------------- + +- implement basic non-parametric .de to support e.g. sox(1) + reported by naddy@ Sat, 16 Oct 2010 23:51:57 +0200 + *** sox(1) still doesn't work, tbl(1) errors need investigation + +- allow standalone `.' to be interpreted as an end-of-layout + delimiter instead of being thrown away as a no-op roff line + reported by Yuri Pankov, Wed 18 May 2011 11:34:59 CEST + +--- missing misc features ---------------------------------------------- + +- clean up escape sequence handling, creating three classes: + (1) fully implemented, or parsed and ignored without loss of content + (2) unimplemented, potentially causing loss of content + or serious mangling of formatting (e.g. \n) -> ERROR + see textproc/mgdiff(1) for nice examples + (3) undefined, just output the character -> perhaps WARNING + +- The \t escape sequence is the same as a literal tab, see for example + the ASCII table in hexdump(1) where + .Bl -column \&000_nu \&001_so \&002_st \&003_et \&004_eo + .It \&000\ nul\t001\ soh\t002\ stx\t003\ etx\t004\ eot\t005\ enq + produces + 000 nul 001 soh 002 stx 003 etx 004 eot 005 enq + and the example in oldrdist(1) + +- look at pages generated from reStructeredText, e.g. devel/mercurial hg(1) + These are a weird mixture of man(7) and custom autogenerated low-level + roff stuff. Figure out to what extent we can cope. + For details, see http://docutils.sourceforge.net/rst.html + noted by stsp@ Sat, 24 Apr 2010 09:17:55 +0200 + reminded by nicm@ Mon, 3 May 2010 09:52:41 +0100 + +- check compatibility with Plan9: + http://swtch.com/usr/local/plan9/tmac/tmac.an + http://swtch.com/plan9port/man/man7/man.html + "Anthony J. Bentley" 28 Dec 2010 21:58:40 -0700 + +************************************************************************ +* formatting issues: ugly output +************************************************************************ + +- a column list with blank `Ta' cells triggers a spurrious + start-with-whitespace printing of a newline + +- double quotes inside double quotes are escaped by doubling them + implement this in mdoc(7), too + so far, we only have it in roff(7) and man(7) + reminded by millert@ Thu, 09 Dec 2010 17:29:52 -0500 + +- perl(1) SYNOPSIS looks bad; reported by deraadt@ + 1) man(7) seems to need SYNOPSIS .Nm blocks, too + +- In .Bl -column, + .It Em AuthenticationKey Length + ought to render "Key Length" with emphasis, too, + see OpenBSD iked.conf(5). + reported again Nicolas Joly via wiz@ Wed, 12 Oct 2011 00:20:00 +0200 + +- empty phrases in .Bl column produce too few blanks + try e.g. .Bl -column It Ta Ta + reported by millert Fri, 02 Apr 2010 16:13:46 -0400 + +- .%T can have trailing punctuation. Currently, it puts the trailing + punctuation into a trailing MDOC_TEXT element inside its own scope. + That element should rather be outside its scope, such that the + punctuation does not get underlines. This is not trivial to + implement because .%T then needs some features of in_line_eoln() - + slurp all arguments into one single text element - and one feature + of in_line() - put trailing punctuation out of scope. + Found in mount_nfs(8) and exports(5), search for "Appendix". + +- in enclosures, mandoc sometimes fancies a bogus end of sentence + reminded by jmc@ Thu, 23 Sep 2010 18:13:39 +0059 + +************************************************************************ +* formatting issues: gratuitous differences +************************************************************************ + +- .Rv (and probably .Ex) print different text if an `Nm' has been named + or not (run a manual without `Nm blah' to see this). I'm not sure + that this exists in the wild, but it's still an error. + +- In .Bl -bullet, the groff bullet is "+\b+\bo\bo", the mandoc bullet + is just "o\bo". + see for example OpenBSD ksh(1) + +- The characters "|" and "\*(Ba" should never be bold, + not even in the middle of a word, e.g. ".Cm b\*(Bac" in + "mknod [-m mode] name b|c major minor" + in OpenBSD ksh(1) + +- A bogus .Pp between two .It must not produce a double blank line, + see between -R and -r in OpenBSD rm(1), before "update" in mount(8), + or in DIAGNOSTICS in init(8), or before "is always true" in ksh(1). + The same happens with .Pp just before .El, see bgpd.conf(5). + Also have `It' complain if `Pp' is invoked at certain times (not + -compact?). + +- .Pp between two .It in .Bl -column should produce one, + not two blank lines, see e.g. login.conf(5). + reported by jmc@ Sun, 17 Apr 2011 14:04:58 +0059 + reported again by sthen@ Wed, 18 Jan 2012 02:09:39 +0000 (UTC) + +- If the *first* line after .It is .Pp, break the line right after + the tag, do not pad with space characters before breaking. + See the description of the a, c, and i commands in sed(1). + +- If the first line after .It is .D1, do not assert a blank line + in between, see for example tmux(1). + reported by nicm@ 13 Jan 2011 00:18:57 +0000 + +- .Nx 1.0a + should be "NetBSD 1.0A", not "NetBSD 1.0a", + see OpenBSD ccdconfig(8). + +- In .Bl -tag, if a tag exceeds the right margin and must be continued + on the next line, it must be indented by -width, not width+1; + see "rule block|pass" in OpenBSD ifconfig(8). + +- When the -width string contains macros, the macros must be rendered + before measuring the width, for example + .Bl -tag -width ".Dv message" + in magic(5), located in src/usr.bin/file, is the same + as -width 7n, not -width 11n. + The same applies to .Bl -column column widths; + reported again by Nicolas Joly Thu, 1 Mar 2012 13:41:26 +0100 via wiz@ 5 Mar + +- The \& zero-width character counts as output. + That is, when it is alone on a line between two .Pp, + we want three blank lines, not two as in mandoc. + +- When .Fn arguments exceed one output line, all but the first + should be indented, see e.g. rpc(3); + reported by jmc@ on discuss@ Fri, 29 Oct 2010 13:48:33 +0100 + reported again by Nicolas Joly via wiz@ Sun, 18 Sep 2011 18:24:40 +0200 + Also, we don't want to break the line within the argument of: + .Fa "chtype tl" + +- .Ns should work when called at the end of an input line, see + the following code in vi(1): + .It Xo + .Op Ar line + .Cm a Ns Op Cm ppend Ns + .Op Cm !\& + .Xc + The input text is appended after the specified line. + +- Header lines of excessive length: + Port OpenBSD man_term.c rev. 1.25 to mdoc_term.c + and document it in mdoc(7) and man(7) COMPATIBILITY + found while talking to Chris Bennett + +- In man(7), the sequence + .HP + one line of regular text + .SH + should not produce two blank lines before the .SH, + see for example named-checkconf(8). + +- In man(7), the sequence + .SH HEADER + + .PP + regular text + should not produce any blank lines between the header and the text, + see for example rsync(1). + Reported by naddy@ Mon, 28 Mar 2011 20:45:42 +0200 + +- In man(7), the sequence + regular text + .IP + .IP "tag" + indented text + should produce one, not four blank lines between the regular text + and the tag, see for example rsync(1). + Likewise, + regular text + .IP + indented text + should produce one, not two blank lines in between, and + regular text + .IP + .RS + .IP tag + indented text + should produce one, not three blank lines. + Reported by naddy@ Mon, 28 Mar 2011 20:45:42 +0200 + +- trailing whitespace must be ignored even when followed by a font escape, + see for example + makes + \fBdig \fR + operate in batch mode + in dig(1). + +************************************************************************ +* error reporting issues +************************************************************************ + +- .TP directly followed by .RS gives an assertion. + +************************************************************************ +* performance issues +************************************************************************ + +Several areas can be cleaned up to make mandoc even faster. These are + +- improve hashing mechanism for macros (quite important: performance) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Tue May 22 19:27:58 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id AF32F106564A for ; Tue, 22 May 2012 19:27:57 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 22 May 2012 19:27:57 +0000 Date: Tue, 22 May 2012 19:27:57 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120522192757.AF32F106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r236160 - soc2012/jhagewood/mdocml_patches X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 May 2012 19:27:58 -0000 Author: jhagewood Date: Tue May 22 19:27:57 2012 New Revision: 236160 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236160 Log: Deleted: soc2012/jhagewood/mdocml_patches/ From owner-svn-soc-all@FreeBSD.ORG Tue May 22 19:34:56 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 3CDF01065678 for ; Tue, 22 May 2012 19:34:55 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 22 May 2012 19:34:55 +0000 Date: Tue, 22 May 2012 19:34:55 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120522193455.3CDF01065678@hub.freebsd.org> Cc: Subject: socsvn commit: r236161 - soc2012/jhagewood/mdocml/mdocml-1.12.1 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 May 2012 19:34:56 -0000 Author: jhagewood Date: Tue May 22 19:34:55 2012 New Revision: 236161 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236161 Log: Deleted: soc2012/jhagewood/mdocml/mdocml-1.12.1/ From owner-svn-soc-all@FreeBSD.ORG Tue May 22 19:35:40 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 25A1F106564A for ; Tue, 22 May 2012 19:35:38 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 22 May 2012 19:35:38 +0000 Date: Tue, 22 May 2012 19:35:38 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120522193538.25A1F106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r236162 - soc2012/jhagewood/mdocml/mdocml-1.12.1 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 May 2012 19:35:40 -0000 Author: jhagewood Date: Tue May 22 19:35:37 2012 New Revision: 236162 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236162 Log: Added: soc2012/jhagewood/mdocml/mdocml-1.12.1/ soc2012/jhagewood/mdocml/mdocml-1.12.1/Makefile soc2012/jhagewood/mdocml/mdocml-1.12.1/TODO soc2012/jhagewood/mdocml/mdocml-1.12.1/apropos.1 soc2012/jhagewood/mdocml/mdocml-1.12.1/apropos.c soc2012/jhagewood/mdocml/mdocml-1.12.1/apropos_db.c soc2012/jhagewood/mdocml/mdocml-1.12.1/apropos_db.h soc2012/jhagewood/mdocml/mdocml-1.12.1/arch.c soc2012/jhagewood/mdocml/mdocml-1.12.1/arch.in soc2012/jhagewood/mdocml/mdocml-1.12.1/att.c soc2012/jhagewood/mdocml/mdocml-1.12.1/att.in soc2012/jhagewood/mdocml/mdocml-1.12.1/catman.8 soc2012/jhagewood/mdocml/mdocml-1.12.1/catman.c soc2012/jhagewood/mdocml/mdocml-1.12.1/cgi.c soc2012/jhagewood/mdocml/mdocml-1.12.1/chars.c soc2012/jhagewood/mdocml/mdocml-1.12.1/chars.in soc2012/jhagewood/mdocml/mdocml-1.12.1/compat_fgetln.c soc2012/jhagewood/mdocml/mdocml-1.12.1/compat_getsubopt.c soc2012/jhagewood/mdocml/mdocml-1.12.1/compat_strlcat.c soc2012/jhagewood/mdocml/mdocml-1.12.1/compat_strlcpy.c soc2012/jhagewood/mdocml/mdocml-1.12.1/config.h.post soc2012/jhagewood/mdocml/mdocml-1.12.1/config.h.pre soc2012/jhagewood/mdocml/mdocml-1.12.1/demandoc.1 soc2012/jhagewood/mdocml/mdocml-1.12.1/demandoc.c soc2012/jhagewood/mdocml/mdocml-1.12.1/eqn.7 soc2012/jhagewood/mdocml/mdocml-1.12.1/eqn.c soc2012/jhagewood/mdocml/mdocml-1.12.1/eqn_html.c soc2012/jhagewood/mdocml/mdocml-1.12.1/eqn_term.c soc2012/jhagewood/mdocml/mdocml-1.12.1/example.style.css soc2012/jhagewood/mdocml/mdocml-1.12.1/external.png (contents, props changed) soc2012/jhagewood/mdocml/mdocml-1.12.1/html.c soc2012/jhagewood/mdocml/mdocml-1.12.1/html.h soc2012/jhagewood/mdocml/mdocml-1.12.1/index.css soc2012/jhagewood/mdocml/mdocml-1.12.1/index.sgml soc2012/jhagewood/mdocml/mdocml-1.12.1/lib.c soc2012/jhagewood/mdocml/mdocml-1.12.1/lib.in soc2012/jhagewood/mdocml/mdocml-1.12.1/libman.h soc2012/jhagewood/mdocml/mdocml-1.12.1/libmandoc.h soc2012/jhagewood/mdocml/mdocml-1.12.1/libmdoc.h soc2012/jhagewood/mdocml/mdocml-1.12.1/libroff.h soc2012/jhagewood/mdocml/mdocml-1.12.1/main.c soc2012/jhagewood/mdocml/mdocml-1.12.1/main.h soc2012/jhagewood/mdocml/mdocml-1.12.1/man-cgi.css soc2012/jhagewood/mdocml/mdocml-1.12.1/man.7 soc2012/jhagewood/mdocml/mdocml-1.12.1/man.c soc2012/jhagewood/mdocml/mdocml-1.12.1/man.cgi.7 soc2012/jhagewood/mdocml/mdocml-1.12.1/man.h soc2012/jhagewood/mdocml/mdocml-1.12.1/man_hash.c soc2012/jhagewood/mdocml/mdocml-1.12.1/man_html.c soc2012/jhagewood/mdocml/mdocml-1.12.1/man_macro.c soc2012/jhagewood/mdocml/mdocml-1.12.1/man_term.c soc2012/jhagewood/mdocml/mdocml-1.12.1/man_validate.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mandoc.1 soc2012/jhagewood/mdocml/mdocml-1.12.1/mandoc.3 soc2012/jhagewood/mdocml/mdocml-1.12.1/mandoc.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mandoc.h soc2012/jhagewood/mdocml/mdocml-1.12.1/mandoc_char.7 soc2012/jhagewood/mdocml/mdocml-1.12.1/mandocdb.8 soc2012/jhagewood/mdocml/mdocml-1.12.1/mandocdb.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mandocdb.h soc2012/jhagewood/mdocml/mdocml-1.12.1/manpath.c soc2012/jhagewood/mdocml/mdocml-1.12.1/manpath.h soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc.7 soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc.h soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_argv.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_hash.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_html.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_macro.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_man.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_term.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_validate.c soc2012/jhagewood/mdocml/mdocml-1.12.1/msec.c soc2012/jhagewood/mdocml/mdocml-1.12.1/msec.in soc2012/jhagewood/mdocml/mdocml-1.12.1/out.c soc2012/jhagewood/mdocml/mdocml-1.12.1/out.h soc2012/jhagewood/mdocml/mdocml-1.12.1/preconv.1 soc2012/jhagewood/mdocml/mdocml-1.12.1/preconv.c soc2012/jhagewood/mdocml/mdocml-1.12.1/predefs.in soc2012/jhagewood/mdocml/mdocml-1.12.1/read.c soc2012/jhagewood/mdocml/mdocml-1.12.1/roff.7 soc2012/jhagewood/mdocml/mdocml-1.12.1/roff.c soc2012/jhagewood/mdocml/mdocml-1.12.1/st.c soc2012/jhagewood/mdocml/mdocml-1.12.1/st.in soc2012/jhagewood/mdocml/mdocml-1.12.1/style.css soc2012/jhagewood/mdocml/mdocml-1.12.1/tbl.7 soc2012/jhagewood/mdocml/mdocml-1.12.1/tbl.c soc2012/jhagewood/mdocml/mdocml-1.12.1/tbl_data.c soc2012/jhagewood/mdocml/mdocml-1.12.1/tbl_html.c soc2012/jhagewood/mdocml/mdocml-1.12.1/tbl_layout.c soc2012/jhagewood/mdocml/mdocml-1.12.1/tbl_opts.c soc2012/jhagewood/mdocml/mdocml-1.12.1/tbl_term.c soc2012/jhagewood/mdocml/mdocml-1.12.1/term.c soc2012/jhagewood/mdocml/mdocml-1.12.1/term.h soc2012/jhagewood/mdocml/mdocml-1.12.1/term_ascii.c soc2012/jhagewood/mdocml/mdocml-1.12.1/term_ps.c soc2012/jhagewood/mdocml/mdocml-1.12.1/test-fgetln.c soc2012/jhagewood/mdocml/mdocml-1.12.1/test-getsubopt.c soc2012/jhagewood/mdocml/mdocml-1.12.1/test-mmap.c soc2012/jhagewood/mdocml/mdocml-1.12.1/test-strlcat.c soc2012/jhagewood/mdocml/mdocml-1.12.1/test-strlcpy.c soc2012/jhagewood/mdocml/mdocml-1.12.1/test-strptime.c soc2012/jhagewood/mdocml/mdocml-1.12.1/tree.c soc2012/jhagewood/mdocml/mdocml-1.12.1/vol.c soc2012/jhagewood/mdocml/mdocml-1.12.1/vol.in soc2012/jhagewood/mdocml/mdocml-1.12.1/whatis.1 Added: soc2012/jhagewood/mdocml/mdocml-1.12.1/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/mdocml/mdocml-1.12.1/Makefile Tue May 22 19:35:37 2012 (r236162) @@ -0,0 +1,645 @@ +.PHONY: clean install installwww +.SUFFIXES: .sgml .html .md5 .h .h.html +.SUFFIXES: .1 .3 .7 .8 +.SUFFIXES: .1.txt .3.txt .7.txt .8.txt +.SUFFIXES: .1.pdf .3.pdf .7.pdf .8.pdf +.SUFFIXES: .1.ps .3.ps .7.ps .8.ps +.SUFFIXES: .1.html .3.html .7.html .8.html +.SUFFIXES: .1.xhtml .3.xhtml .7.xhtml .8.xhtml + +# Specify this if you want to hard-code the operating system to appear +# in the lower-left hand corner of -mdoc manuals. +# +# CFLAGS += -DOSNAME="\"OpenBSD 4.5\"" + +VERSION = 1.12.1 +VDATE = 23 March 2012 + +# IFF your system supports multi-byte functions (setlocale(), wcwidth(), +# putwchar()) AND has __STDC_ISO_10646__ (that is, wchar_t is simply a +# UCS-4 value) should you define USE_WCHAR. If you define it and your +# system DOESN'T support this, -Tlocale will produce garbage. +# If you don't define it, -Tlocale is a synonym for -Tacsii. +# +CFLAGS += -DUSE_WCHAR + +# If your system has manpath(1), uncomment this. This is most any +# system that's not OpenBSD or NetBSD. If uncommented, apropos(1), +# mandocdb(8), and man.cgi will popen(3) manpath(1) to get the MANPATH +# variable. +#CFLAGS += -DUSE_MANPATH + +# If your system supports static binaries only, uncomment this. This +# appears only to be BSD UNIX systems (Mac OS X has no support and Linux +# requires -pthreads for static libdb). +STATIC = -static + +CFLAGS += -g -DHAVE_CONFIG_H -DVERSION="\"$(VERSION)\"" +CFLAGS += -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings +PREFIX = /usr/local +WWWPREFIX = /var/www +HTDOCDIR = $(WWWPREFIX)/htdocs +CGIBINDIR = $(WWWPREFIX)/cgi-bin +BINDIR = $(PREFIX)/bin +INCLUDEDIR = $(PREFIX)/include/mandoc +LIBDIR = $(PREFIX)/lib/mandoc +MANDIR = $(PREFIX)/man +EXAMPLEDIR = $(PREFIX)/share/examples/mandoc +INSTALL = install +INSTALL_PROGRAM = $(INSTALL) -m 0755 +INSTALL_DATA = $(INSTALL) -m 0444 +INSTALL_LIB = $(INSTALL) -m 0644 +INSTALL_SOURCE = $(INSTALL) -m 0644 +INSTALL_MAN = $(INSTALL_DATA) + +# Non-BSD systems (Linux, etc.) need -ldb to compile mandocdb and +# apropos. +# However, if you don't have -ldb at all (or it's not native), then +# comment out apropos and mandocdb. +# +#DBLIB = -ldb +DBBIN = apropos mandocdb man.cgi catman whatis +DBLN = llib-lapropos.ln llib-lmandocdb.ln llib-lman.cgi.ln llib-lcatman.ln + +all: mandoc preconv demandoc $(DBBIN) + +SRCS = Makefile \ + TODO \ + apropos.1 \ + apropos.c \ + apropos_db.c \ + apropos_db.h \ + arch.c \ + arch.in \ + att.c \ + att.in \ + catman.8 \ + catman.c \ + cgi.c \ + chars.c \ + chars.in \ + compat_fgetln.c \ + compat_getsubopt.c \ + compat_strlcat.c \ + compat_strlcpy.c \ + config.h.post \ + config.h.pre \ + demandoc.1 \ + demandoc.c \ + eqn.7 \ + eqn.c \ + eqn_html.c \ + eqn_term.c \ + example.style.css \ + external.png \ + html.c \ + html.h \ + index.css \ + index.sgml \ + lib.c \ + lib.in \ + libman.h \ + libmandoc.h \ + libmdoc.h \ + libroff.h \ + main.c \ + main.h \ + man.7 \ + man.c \ + man.cgi.7 \ + man-cgi.css \ + man.h \ + man_hash.c \ + man_html.c \ + man_macro.c \ + man_term.c \ + man_validate.c \ + mandoc.1 \ + mandoc.3 \ + mandoc.c \ + mandoc.h \ + mandoc_char.7 \ + mandocdb.8 \ + mandocdb.c \ + mandocdb.h \ + manpath.c \ + manpath.h \ + mdoc.7 \ + mdoc.c \ + mdoc.h \ + mdoc_argv.c \ + mdoc_hash.c \ + mdoc_html.c \ + mdoc_macro.c \ + mdoc_man.c \ + mdoc_term.c \ + mdoc_validate.c \ + msec.c \ + msec.in \ + out.c \ + out.h \ + preconv.1 \ + preconv.c \ + predefs.in \ + read.c \ + roff.7 \ + roff.c \ + st.c \ + st.in \ + style.css \ + tbl.7 \ + tbl.c \ + tbl_data.c \ + tbl_html.c \ + tbl_layout.c \ + tbl_opts.c \ + tbl_term.c \ + term.c \ + term.h \ + term_ascii.c \ + term_ps.c \ + test-fgetln.c \ + test-getsubopt.c \ + test-mmap.c \ + test-strlcat.c \ + test-strlcpy.c \ + test-strptime.c \ + tree.c \ + vol.c \ + vol.in \ + whatis.1 + +LIBMAN_OBJS = man.o \ + man_hash.o \ + man_macro.o \ + man_validate.o +LIBMAN_LNS = man.ln \ + man_hash.ln \ + man_macro.ln \ + man_validate.ln + +LIBMDOC_OBJS = arch.o \ + att.o \ + lib.o \ + mdoc.o \ + mdoc_argv.o \ + mdoc_hash.o \ + mdoc_macro.o \ + mdoc_validate.o \ + st.o \ + vol.o +LIBMDOC_LNS = arch.ln \ + att.ln \ + lib.ln \ + mdoc.ln \ + mdoc_argv.ln \ + mdoc_hash.ln \ + mdoc_macro.ln \ + mdoc_validate.ln \ + st.ln \ + vol.ln + +LIBROFF_OBJS = eqn.o \ + roff.o \ + tbl.o \ + tbl_data.o \ + tbl_layout.o \ + tbl_opts.o +LIBROFF_LNS = eqn.ln \ + roff.ln \ + tbl.ln \ + tbl_data.ln \ + tbl_layout.ln \ + tbl_opts.ln + +LIBMANDOC_OBJS = $(LIBMAN_OBJS) \ + $(LIBMDOC_OBJS) \ + $(LIBROFF_OBJS) \ + chars.o \ + mandoc.o \ + msec.o \ + read.o +LIBMANDOC_LNS = $(LIBMAN_LNS) \ + $(LIBMDOC_LNS) \ + $(LIBROFF_LNS) \ + chars.ln \ + mandoc.ln \ + msec.ln \ + read.ln + +COMPAT_OBJS = compat_fgetln.o \ + compat_getsubopt.o \ + compat_strlcat.o \ + compat_strlcpy.o +COMPAT_LNS = compat_fgetln.ln \ + compat_getsubopt.ln \ + compat_strlcat.ln \ + compat_strlcpy.ln + +arch.o arch.ln: arch.in +att.o att.ln: att.in +chars.o chars.ln: chars.in +lib.o lib.ln: lib.in +msec.o msec.ln: msec.in +roff.o roff.ln: predefs.in +st.o st.ln: st.in +vol.o vol.ln: vol.in + +$(LIBMAN_OBJS) $(LIBMAN_LNS): libman.h +$(LIBMDOC_OBJS) $(LIBMDOC_LNS): libmdoc.h +$(LIBROFF_OBJS) $(LIBROFF_LNS): libroff.h +$(LIBMANDOC_OBJS) $(LIBMANDOC_LNS): mandoc.h mdoc.h man.h libmandoc.h config.h + +$(COMPAT_OBJS) $(COMPAT_LNS): config.h + +MANDOC_HTML_OBJS = eqn_html.o \ + html.o \ + man_html.o \ + mdoc_html.o \ + tbl_html.o +MANDOC_HTML_LNS = eqn_html.ln \ + html.ln \ + man_html.ln \ + mdoc_html.ln \ + tbl_html.ln + +MANDOC_MAN_OBJS = mdoc_man.o +MANDOC_MAN_LNS = mdoc_man.ln + +MANDOC_TERM_OBJS = eqn_term.o \ + man_term.o \ + mdoc_term.o \ + term.o \ + term_ascii.o \ + term_ps.o \ + tbl_term.o +MANDOC_TERM_LNS = eqn_term.ln \ + man_term.ln \ + mdoc_term.ln \ + term.ln \ + term_ascii.ln \ + term_ps.ln \ + tbl_term.ln + +MANDOC_OBJS = $(MANDOC_HTML_OBJS) \ + $(MANDOC_MAN_OBJS) \ + $(MANDOC_TERM_OBJS) \ + main.o \ + out.o \ + tree.o +MANDOC_LNS = $(MANDOC_HTML_LNS) \ + $(MANDOC_MAN_LNS) \ + $(MANDOC_TERM_LNS) \ + main.ln \ + out.ln \ + tree.ln + +$(MANDOC_HTML_OBJS) $(MANDOC_HTML_LNS): html.h +$(MANDOC_TERM_OBJS) $(MANDOC_TERM_LNS): term.h +$(MANDOC_OBJS) $(MANDOC_LNS): main.h mandoc.h mdoc.h man.h config.h out.h + +MANDOCDB_OBJS = mandocdb.o manpath.o +MANDOCDB_LNS = mandocdb.ln manpath.ln + +$(MANDOCDB_OBJS) $(MANDOCDB_LNS): mandocdb.h mandoc.h mdoc.h man.h config.h manpath.h + +PRECONV_OBJS = preconv.o +PRECONV_LNS = preconv.ln + +$(PRECONV_OBJS) $(PRECONV_LNS): config.h + +APROPOS_OBJS = apropos.o apropos_db.o manpath.o +APROPOS_LNS = apropos.ln apropos_db.ln manpath.ln + +$(APROPOS_OBJS) $(APROPOS_LNS): config.h mandoc.h apropos_db.h manpath.h mandocdb.h + +CGI_OBJS = $(MANDOC_HTML_OBJS) \ + $(MANDOC_MAN_OBJS) \ + $(MANDOC_TERM_OBJS) \ + cgi.o \ + apropos_db.o \ + manpath.o \ + out.o \ + tree.o + +CGI_LNS = $(MANDOC_HTML_LNS) \ + $(MANDOC_MAN_LNS) \ + $(MANDOC_TERM_LNS) \ + cgi.ln \ + apropos_db.ln \ + manpath.ln \ + out.ln \ + tree.ln + +$(CGI_OBJS) $(CGI_LNS): main.h mdoc.h man.h out.h config.h mandoc.h apropos_db.h manpath.h mandocdb.h + +CATMAN_OBJS = catman.o manpath.o +CATMAN_LNS = catman.ln manpath.ln + +$(CATMAN_OBJS) $(CATMAN_LNS): config.h mandoc.h manpath.h mandocdb.h + +DEMANDOC_OBJS = demandoc.o +DEMANDOC_LNS = demandoc.ln + +$(DEMANDOC_OBJS) $(DEMANDOC_LNS): config.h + +INDEX_MANS = apropos.1.html \ + apropos.1.xhtml \ + apropos.1.ps \ + apropos.1.pdf \ + apropos.1.txt \ + catman.8.html \ + catman.8.xhtml \ + catman.8.ps \ + catman.8.pdf \ + catman.8.txt \ + demandoc.1.html \ + demandoc.1.xhtml \ + demandoc.1.ps \ + demandoc.1.pdf \ + demandoc.1.txt \ + mandoc.1.html \ + mandoc.1.xhtml \ + mandoc.1.ps \ + mandoc.1.pdf \ + mandoc.1.txt \ + whatis.1.html \ + whatis.1.xhtml \ + whatis.1.ps \ + whatis.1.pdf \ + whatis.1.txt \ + mandoc.3.html \ + mandoc.3.xhtml \ + mandoc.3.ps \ + mandoc.3.pdf \ + mandoc.3.txt \ + eqn.7.html \ + eqn.7.xhtml \ + eqn.7.ps \ + eqn.7.pdf \ + eqn.7.txt \ + man.7.html \ + man.7.xhtml \ + man.7.ps \ + man.7.pdf \ + man.7.txt \ + man.cgi.7.html \ + man.cgi.7.xhtml \ + man.cgi.7.ps \ + man.cgi.7.pdf \ + man.cgi.7.txt \ + mandoc_char.7.html \ + mandoc_char.7.xhtml \ + mandoc_char.7.ps \ + mandoc_char.7.pdf \ + mandoc_char.7.txt \ + mdoc.7.html \ + mdoc.7.xhtml \ + mdoc.7.ps \ + mdoc.7.pdf \ + mdoc.7.txt \ + preconv.1.html \ + preconv.1.xhtml \ + preconv.1.ps \ + preconv.1.pdf \ + preconv.1.txt \ + roff.7.html \ + roff.7.xhtml \ + roff.7.ps \ + roff.7.pdf \ + roff.7.txt \ + tbl.7.html \ + tbl.7.xhtml \ + tbl.7.ps \ + tbl.7.pdf \ + tbl.7.txt \ + mandocdb.8.html \ + mandocdb.8.xhtml \ + mandocdb.8.ps \ + mandocdb.8.pdf \ + mandocdb.8.txt + +$(INDEX_MANS): mandoc + +INDEX_OBJS = $(INDEX_MANS) \ + man.h.html \ + mandoc.h.html \ + mdoc.h.html \ + mdocml.tar.gz \ + mdocml.md5 + +www: index.html + +lint: llib-lmandoc.ln llib-lpreconv.ln llib-ldemandoc.ln $(DBLN) + +clean: + rm -f libmandoc.a $(LIBMANDOC_OBJS) + rm -f llib-llibmandoc.ln $(LIBMANDOC_LNS) + rm -f mandocdb $(MANDOCDB_OBJS) + rm -f llib-lmandocdb.ln $(MANDOCDB_LNS) + rm -f preconv $(PRECONV_OBJS) + rm -f llib-lpreconv.ln $(PRECONV_LNS) + rm -f apropos whatis $(APROPOS_OBJS) + rm -f llib-lapropos.ln $(APROPOS_LNS) + rm -f man.cgi $(CGI_OBJS) + rm -f llib-lman.cgi.ln $(CGI_LNS) + rm -f catman $(CATMAN_OBJS) + rm -f llib-lcatman.ln $(CATMAN_LNS) + rm -f demandoc $(DEMANDOC_OBJS) + rm -f llib-ldemandoc.ln $(DEMANDOC_LNS) + rm -f mandoc $(MANDOC_OBJS) + rm -f llib-lmandoc.ln $(MANDOC_LNS) + rm -f config.h config.log $(COMPAT_OBJS) $(COMPAT_LNS) + rm -f mdocml.tar.gz mdocml-win32.zip mdocml-win64.zip mdocml-macosx.zip + rm -f index.html $(INDEX_OBJS) + rm -rf test-fgetln.dSYM + rm -rf test-strlcpy.dSYM + rm -rf test-strlcat.dSYM + rm -rf test-strptime.dSYM + rm -rf test-mmap.dSYM + rm -rf test-getsubopt.dSYM + rm -rf apropos.dSYM + rm -rf catman.dSYM + rm -rf mandocdb.dSYM + rm -rf whatis.dSYM + +install: all + mkdir -p $(DESTDIR)$(BINDIR) + mkdir -p $(DESTDIR)$(EXAMPLEDIR) + mkdir -p $(DESTDIR)$(LIBDIR) + mkdir -p $(DESTDIR)$(INCLUDEDIR) + mkdir -p $(DESTDIR)$(MANDIR)/man1 + mkdir -p $(DESTDIR)$(MANDIR)/man3 + mkdir -p $(DESTDIR)$(MANDIR)/man7 + $(INSTALL_PROGRAM) mandoc preconv demandoc $(DESTDIR)$(BINDIR) + $(INSTALL_LIB) libmandoc.a $(DESTDIR)$(LIBDIR) + $(INSTALL_LIB) man.h mdoc.h mandoc.h $(DESTDIR)$(INCLUDEDIR) + $(INSTALL_MAN) mandoc.1 preconv.1 demandoc.1 $(DESTDIR)$(MANDIR)/man1 + $(INSTALL_MAN) mandoc.3 $(DESTDIR)$(MANDIR)/man3 + $(INSTALL_MAN) man.7 mdoc.7 roff.7 eqn.7 tbl.7 mandoc_char.7 $(DESTDIR)$(MANDIR)/man7 + $(INSTALL_DATA) example.style.css $(DESTDIR)$(EXAMPLEDIR) + +installcgi: all + mkdir -p $(DESTDIR)$(CGIBINDIR) + mkdir -p $(DESTDIR)$(HTDOCDIR) + $(INSTALL_PROGRAM) man.cgi $(DESTDIR)$(CGIBINDIR) + $(INSTALL_DATA) example.style.css $(DESTDIR)$(HTDOCDIR)/man.css + $(INSTALL_DATA) man-cgi.css $(DESTDIR)$(HTDOCDIR) + +installwww: www + mkdir -p $(PREFIX)/snapshots + mkdir -p $(PREFIX)/binaries + $(INSTALL_DATA) index.html external.png index.css $(PREFIX) + $(INSTALL_DATA) $(INDEX_MANS) style.css $(PREFIX) + $(INSTALL_DATA) mandoc.h.html man.h.html mdoc.h.html $(PREFIX) + $(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots + $(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots + $(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots/mdocml-$(VERSION).tar.gz + $(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots/mdocml-$(VERSION).md5 + +libmandoc.a: $(COMPAT_OBJS) $(LIBMANDOC_OBJS) + $(AR) rs $@ $(COMPAT_OBJS) $(LIBMANDOC_OBJS) + +llib-llibmandoc.ln: $(COMPAT_LNS) $(LIBMANDOC_LNS) + $(LINT) $(LINTFLAGS) -Clibmandoc $(COMPAT_LNS) $(LIBMANDOC_LNS) + +mandoc: $(MANDOC_OBJS) libmandoc.a + $(CC) $(LDFLAGS) -o $@ $(MANDOC_OBJS) libmandoc.a + +llib-lmandoc.ln: $(MANDOC_LNS) llib-llibmandoc.ln + $(LINT) $(LINTFLAGS) -Cmandoc $(MANDOC_LNS) llib-llibmandoc.ln + +mandocdb: $(MANDOCDB_OBJS) libmandoc.a + $(CC) $(LDFLAGS) -o $@ $(MANDOCDB_OBJS) libmandoc.a $(DBLIB) + +llib-lmandocdb.ln: $(MANDOCDB_LNS) llib-llibmandoc.ln + $(LINT) $(LINTFLAGS) -Cmandocdb $(MANDOCDB_LNS) llib-llibmandoc.ln + +preconv: $(PRECONV_OBJS) + $(CC) $(LDFLAGS) -o $@ $(PRECONV_OBJS) + +llib-lpreconv.ln: $(PRECONV_LNS) llib-llibmandoc.ln + $(LINT) $(LINTFLAGS) -Cpreconv $(PRECONV_LNS) llib-llibmandoc.ln + +whatis: apropos + cp -f apropos whatis + +apropos: $(APROPOS_OBJS) libmandoc.a + $(CC) $(LDFLAGS) -o $@ $(APROPOS_OBJS) libmandoc.a $(DBLIB) + +llib-lapropos.ln: $(APROPOS_LNS) llib-llibmandoc.ln + $(LINT) $(LINTFLAGS) -Capropos $(APROPOS_LNS) llib-llibmandoc.ln + +catman: $(CATMAN_OBJS) libmandoc.a + $(CC) $(LDFLAGS) -o $@ $(CATMAN_OBJS) libmandoc.a $(DBLIB) + +llib-lcatman.ln: $(CATMAN_LNS) llib-llibmandoc.ln + $(LINT) $(LINTFLAGS) -Ccatman $(CATMAN_LNS) llib-llibmandoc.ln + +man.cgi: $(CGI_OBJS) libmandoc.a + $(CC) $(LDFLAGS) $(STATIC) -o $@ $(CGI_OBJS) libmandoc.a $(DBLIB) + +llib-lman.cgi.ln: $(CGI_LNS) llib-llibmandoc.ln + $(LINT) $(LINTFLAGS) -Cman.cgi $(CGI_LNS) llib-llibmandoc.ln + +demandoc: $(DEMANDOC_OBJS) libmandoc.a + $(CC) $(LDFLAGS) -o $@ $(DEMANDOC_OBJS) libmandoc.a + +llib-ldemandoc.ln: $(DEMANDOC_LNS) llib-llibmandoc.ln + $(LINT) $(LINTFLAGS) -Cdemandoc $(DEMANDOC_LNS) llib-llibmandoc.ln + +mdocml.md5: mdocml.tar.gz + md5 mdocml.tar.gz >$@ + +mdocml.tar.gz: $(SRCS) + mkdir -p .dist/mdocml-$(VERSION)/ + $(INSTALL_SOURCE) $(SRCS) .dist/mdocml-$(VERSION) + ( cd .dist/ && tar zcf ../$@ ./ ) + rm -rf .dist/ + +mdocml-win32.zip: $(SRCS) + mkdir -p .win32/mdocml-$(VERSION)/ + $(INSTALL_SOURCE) $(SRCS) .win32 + cp .win32/Makefile .win32/Makefile.old + egrep -v -e DUSE_WCHAR -e ^DBBIN .win32/Makefile.old >.win32/Makefile + ( cd .win32; \ + CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar CFLAGS='-DOSNAME=\"Windows\"' make; \ + make install PREFIX=mdocml-$(VERSION) ; \ + zip -r ../$@ mdocml-$(VERSION) ) + rm -rf .win32 + +mdocml-win64.zip: $(SRCS) + mkdir -p .win64/mdocml-$(VERSION)/ + $(INSTALL_SOURCE) $(SRCS) .win64 + cp .win64/Makefile .win64/Makefile.old + egrep -v -e DUSE_WCHAR -e ^DBBIN .win64/Makefile.old >.win64/Makefile + ( cd .win64; \ + CC=x86_64-w64-mingw32-gcc AR=x86_64-w64-mingw32-ar CFLAGS='-DOSNAME=\"Windows\"' make; \ + make install PREFIX=mdocml-$(VERSION) ; \ + zip -r ../$@ mdocml-$(VERSION) ) + rm -rf .win64 + +mdocml-macosx.zip: $(SRCS) + mkdir -p .macosx/mdocml-$(VERSION)/ + $(INSTALL_SOURCE) $(SRCS) .macosx + ( cd .macosx; \ + CFLAGS="-arch i386 -arch x86_64 -arch ppc" LDFLAGS="-arch i386 -arch x86_64 -arch ppc" make; \ + make install PREFIX=mdocml-$(VERSION) ; \ + zip -r ../$@ mdocml-$(VERSION) ) + rm -rf .macosx + +index.html: $(INDEX_OBJS) + +config.h: config.h.pre config.h.post + rm -f config.log + ( cat config.h.pre; \ + echo; \ + if $(CC) $(CFLAGS) -Werror -o test-fgetln test-fgetln.c >> config.log 2>&1; then \ + echo '#define HAVE_FGETLN'; \ + rm test-fgetln; \ + fi; \ + if $(CC) $(CFLAGS) -Werror -o test-strptime test-strptime.c >> config.log 2>&1; then \ + echo '#define HAVE_STRPTIME'; \ + rm test-strptime; \ + fi; \ + if $(CC) $(CFLAGS) -Werror -o test-getsubopt test-getsubopt.c >> config.log 2>&1; then \ + echo '#define HAVE_GETSUBOPT'; \ + rm test-getsubopt; \ + fi; \ + if $(CC) $(CFLAGS) -Werror -o test-strlcat test-strlcat.c >> config.log 2>&1; then \ + echo '#define HAVE_STRLCAT'; \ + rm test-strlcat; \ + fi; \ + if $(CC) $(CFLAGS) -Werror -o test-mmap test-mmap.c >> config.log 2>&1; then \ + echo '#define HAVE_MMAP'; \ + rm test-mmap; \ + fi; \ + if $(CC) $(CFLAGS) -Werror -o test-strlcpy test-strlcpy.c >> config.log 2>&1; then \ + echo '#define HAVE_STRLCPY'; \ + rm test-strlcpy; \ + fi; \ + echo; \ + cat config.h.post \ + ) > $@ + +.h.h.html: + highlight -I $< >$@ + +.1.1.txt .3.3.txt .7.7.txt .8.8.txt: + ./mandoc -Tascii -Wall,stop $< | col -b >$@ + +.1.1.html .3.3.html .7.7.html .8.8.html: + ./mandoc -Thtml -Wall,stop -Ostyle=style.css,man=%N.%S.html,includes=%I.html $< >$@ + +.1.1.ps .3.3.ps .7.7.ps .8.8.ps: + ./mandoc -Tps -Wall,stop $< >$@ + +.1.1.xhtml .3.3.xhtml .7.7.xhtml .8.8.xhtml: + ./mandoc -Txhtml -Wall,stop -Ostyle=style.css,man=%N.%S.xhtml,includes=%I.html $< >$@ + +.1.1.pdf .3.3.pdf .7.7.pdf .8.8.pdf: + ./mandoc -Tpdf -Wall,stop $< >$@ + +.sgml.html: + validate --warn $< + sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< >$@ Added: soc2012/jhagewood/mdocml/mdocml-1.12.1/TODO ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/mdocml/mdocml-1.12.1/TODO Tue May 22 19:35:37 2012 (r236162) @@ -0,0 +1,372 @@ +************************************************************************ +* Official mandoc TODO. +* $Id: TODO,v 1.129 2012/03/04 23:53:37 schwarze Exp $ +************************************************************************ + +************************************************************************ +* parser bugs +************************************************************************ + +- ".\}" on its own line gets translated to bare ".\&" + which forces pset() into man(7) + and then triggers an unknown macro error + reported by naddy@ Sun, 3 Jul 2011 21:52:24 +0200 + +************************************************************************ +* formatter bugs +************************************************************************ + +- tbl(7): Horizontal and vertical lines are formatted badly: + With the box option, there is too much white space at the end of cells. + Horizontal lines from "=" lines are a bit too long. + yuri dot pankov at gmail dot com Thu, 14 Apr 2011 05:45:26 +0400 + +************************************************************************ +* missing features +************************************************************************ + +--- missing roff features ---------------------------------------------- + +- The pod2man preamble wants \h'...' with quoted numerical arguments, + see for example AUTHORS in MooseX::Getopt.3p, p5-MooseX-Getopt. + reported by Andreas Voegele + Tue, 22 Nov 2011 15:34:47 +0100 on ports@ + +- .if n \{ + .br\} + should cause an extra space to be raised. + +- .ad (adjust margins) + .ad l -- adjust left margin only (flush left) + .ad r -- adjust right margin only (flush right) + .ad c -- center text on line + .ad b -- adjust both margins (alias: .ad n) + .na -- temporarily disable adjustment without changing the mode + .ad -- re-enable adjustment without changing the mode + Adjustment mode is ignored while in no-fill mode (.nf). + +- .it (line traps) occur in mysql(1), yasm_arch(7) + generated by DocBook XSL Stylesheets v1.71.1 + reported by brad@ Sat, 15 Jan 2011 15:48:18 -0500 + +- .ns (no-space mode) occurs in xine-config(1) + reported by brad@ Sat, 15 Jan 2011 15:45:23 -0500 + +- xloadimage(1) wants .ti (temporary indent), rep by naddy@ + +- .ta (tab settings) occurs in ircbug(1) and probably gnats(1) + reported by brad@ Sat, 15 Jan 2011 15:50:51 -0500 + +- \c (interrupted text) occurs in chat(8) + +- using undefined strings or macros defines them to be empty + wl@ Mon, 14 Nov 2011 14:37:01 +0000 + +--- missing mdoc features ---------------------------------------------- + +- fix bad block nesting involving multiple identical explicit blocks + see the OpenBSD mdoc_macro.c 1.47 commit message + +- .Bl -column .Xo support is missing + ultimate goal: + restore .Xr and .Dv to + lib/libc/compat-43/sigvec.3 + lib/libc/gen/signal.3 + lib/libc/sys/sigaction.2 + +- edge case: decide how to deal with blk_full bad nesting, e.g. + .Sh .Nm .Bk .Nm .Ek .Sh found by jmc@ in ssh-keygen(1) + from jmc@ Wed, 14 Jul 2010 18:10:32 +0100 + +- \\ is now implemented correctly + * when defining strings and macros using .ds and .de + * when parsing roff(7) and man(7) macro arguments + It does not yet work in mdoc(7) macro arguments + because libmdoc does not yet use mandoc_getarg(). + Also check what happens in plain text, it must be identical to \e. + +- .Bd -filled should not be the same as .Bd -ragged, but align both + the left and right margin. In groff, it is implemented in terms + of .ad b, which we don't have either. Found in cksum(1). + +- implement blank `Bl -column', such as + .Bl -column + .It foo Ta bar + .El + +- explicitly disallow nested `Bl -column', which would clobber internal + flags defined for struct mdoc_macro + +- In .Bl -column .It, the end of the line probably has to be regarded + as an implicit .Ta, if there could be one, see the following mildly + ugly code from login.conf(5): + .Bl -column minpasswordlen program xetcxmotd + .It path Ta path Ta value of Dv _PATH_DEFPATH + .br + Default search path. + reported by Michal Mazurek + via jmc@ Thu, 7 Apr 2011 16:00:53 +0059 + +- inside `.Bl -column' phrases, punctuation is handled like normal + text, e.g. `.Bl -column .It Fl x . Ta ...' should give "-x -." + +- inside `.Bl -column' phrases, TERMP_IGNDELIM handling by `Pf' + is not safe, e.g. `.Bl -column .It Pf a b .' gives "ab." + but should give "ab ." + +- set a meaningful default if no `Bl' list type is assigned + +- have a blank `It' head for `Bl -tag' not puke + +- prohibit `Nm' from having non-text HEAD children + (e.g., NetBSD mDNSShared/dns-sd.1) + (mdoc_html.c and mdoc_term.c `Nm' handlers can be slightly simplified) + +- When there is free text in the SYNOPSIS and that free text contains + the .Nm macro, groff somehow understands to treat the .Nm as an in-line + macro, while mandoc treats it as a block macro and breaks the line. + No idea how the logic for distinguishing in-line and block instances + should be, needs investigation. + uqs@ Thu, 2 Jun 2011 11:03:51 +0200 + uqs@ Thu, 2 Jun 2011 11:33:35 +0200 + +--- missing man features ----------------------------------------------- + +- groff an-ext.tmac macros (.UR, .UE) occur in xine(5) + reported by brad@ Sat, 15 Jan 2011 15:45:23 -0500 + +- -T[x]html doesn't stipulate non-collapsing spaces in literal mode + +--- missing tbl features ----------------------------------------------- + +- implement basic non-parametric .de to support e.g. sox(1) + reported by naddy@ Sat, 16 Oct 2010 23:51:57 +0200 + *** sox(1) still doesn't work, tbl(1) errors need investigation + +- allow standalone `.' to be interpreted as an end-of-layout + delimiter instead of being thrown away as a no-op roff line + reported by Yuri Pankov, Wed 18 May 2011 11:34:59 CEST + +--- missing misc features ---------------------------------------------- + +- clean up escape sequence handling, creating three classes: + (1) fully implemented, or parsed and ignored without loss of content + (2) unimplemented, potentially causing loss of content + or serious mangling of formatting (e.g. \n) -> ERROR + see textproc/mgdiff(1) for nice examples + (3) undefined, just output the character -> perhaps WARNING + +- The \t escape sequence is the same as a literal tab, see for example + the ASCII table in hexdump(1) where + .Bl -column \&000_nu \&001_so \&002_st \&003_et \&004_eo + .It \&000\ nul\t001\ soh\t002\ stx\t003\ etx\t004\ eot\t005\ enq + produces + 000 nul 001 soh 002 stx 003 etx 004 eot 005 enq + and the example in oldrdist(1) + +- look at pages generated from reStructeredText, e.g. devel/mercurial hg(1) + These are a weird mixture of man(7) and custom autogenerated low-level + roff stuff. Figure out to what extent we can cope. + For details, see http://docutils.sourceforge.net/rst.html + noted by stsp@ Sat, 24 Apr 2010 09:17:55 +0200 + reminded by nicm@ Mon, 3 May 2010 09:52:41 +0100 + +- check compatibility with Plan9: + http://swtch.com/usr/local/plan9/tmac/tmac.an + http://swtch.com/plan9port/man/man7/man.html + "Anthony J. Bentley" 28 Dec 2010 21:58:40 -0700 + +************************************************************************ +* formatting issues: ugly output +************************************************************************ + +- a column list with blank `Ta' cells triggers a spurrious + start-with-whitespace printing of a newline + +- double quotes inside double quotes are escaped by doubling them + implement this in mdoc(7), too + so far, we only have it in roff(7) and man(7) + reminded by millert@ Thu, 09 Dec 2010 17:29:52 -0500 + +- perl(1) SYNOPSIS looks bad; reported by deraadt@ + 1) man(7) seems to need SYNOPSIS .Nm blocks, too + +- In .Bl -column, + .It Em AuthenticationKey Length + ought to render "Key Length" with emphasis, too, + see OpenBSD iked.conf(5). + reported again Nicolas Joly via wiz@ Wed, 12 Oct 2011 00:20:00 +0200 + +- empty phrases in .Bl column produce too few blanks + try e.g. .Bl -column It Ta Ta + reported by millert Fri, 02 Apr 2010 16:13:46 -0400 + +- .%T can have trailing punctuation. Currently, it puts the trailing + punctuation into a trailing MDOC_TEXT element inside its own scope. + That element should rather be outside its scope, such that the + punctuation does not get underlines. This is not trivial to + implement because .%T then needs some features of in_line_eoln() - + slurp all arguments into one single text element - and one feature + of in_line() - put trailing punctuation out of scope. + Found in mount_nfs(8) and exports(5), search for "Appendix". + +- in enclosures, mandoc sometimes fancies a bogus end of sentence + reminded by jmc@ Thu, 23 Sep 2010 18:13:39 +0059 + +************************************************************************ +* formatting issues: gratuitous differences +************************************************************************ + +- .Rv (and probably .Ex) print different text if an `Nm' has been named + or not (run a manual without `Nm blah' to see this). I'm not sure + that this exists in the wild, but it's still an error. + +- In .Bl -bullet, the groff bullet is "+\b+\bo\bo", the mandoc bullet + is just "o\bo". + see for example OpenBSD ksh(1) + +- The characters "|" and "\*(Ba" should never be bold, + not even in the middle of a word, e.g. ".Cm b\*(Bac" in + "mknod [-m mode] name b|c major minor" + in OpenBSD ksh(1) + +- A bogus .Pp between two .It must not produce a double blank line, + see between -R and -r in OpenBSD rm(1), before "update" in mount(8), + or in DIAGNOSTICS in init(8), or before "is always true" in ksh(1). + The same happens with .Pp just before .El, see bgpd.conf(5). + Also have `It' complain if `Pp' is invoked at certain times (not + -compact?). + +- .Pp between two .It in .Bl -column should produce one, + not two blank lines, see e.g. login.conf(5). + reported by jmc@ Sun, 17 Apr 2011 14:04:58 +0059 + reported again by sthen@ Wed, 18 Jan 2012 02:09:39 +0000 (UTC) + +- If the *first* line after .It is .Pp, break the line right after + the tag, do not pad with space characters before breaking. + See the description of the a, c, and i commands in sed(1). + +- If the first line after .It is .D1, do not assert a blank line + in between, see for example tmux(1). + reported by nicm@ 13 Jan 2011 00:18:57 +0000 + +- .Nx 1.0a + should be "NetBSD 1.0A", not "NetBSD 1.0a", + see OpenBSD ccdconfig(8). + +- In .Bl -tag, if a tag exceeds the right margin and must be continued + on the next line, it must be indented by -width, not width+1; + see "rule block|pass" in OpenBSD ifconfig(8). + +- When the -width string contains macros, the macros must be rendered + before measuring the width, for example + .Bl -tag -width ".Dv message" + in magic(5), located in src/usr.bin/file, is the same + as -width 7n, not -width 11n. + The same applies to .Bl -column column widths; + reported again by Nicolas Joly Thu, 1 Mar 2012 13:41:26 +0100 via wiz@ 5 Mar + +- The \& zero-width character counts as output. + That is, when it is alone on a line between two .Pp, + we want three blank lines, not two as in mandoc. + +- When .Fn arguments exceed one output line, all but the first + should be indented, see e.g. rpc(3); + reported by jmc@ on discuss@ Fri, 29 Oct 2010 13:48:33 +0100 + reported again by Nicolas Joly via wiz@ Sun, 18 Sep 2011 18:24:40 +0200 + Also, we don't want to break the line within the argument of: + .Fa "chtype tl" + +- .Ns should work when called at the end of an input line, see + the following code in vi(1): + .It Xo + .Op Ar line + .Cm a Ns Op Cm ppend Ns + .Op Cm !\& + .Xc + The input text is appended after the specified line. + +- Header lines of excessive length: + Port OpenBSD man_term.c rev. 1.25 to mdoc_term.c + and document it in mdoc(7) and man(7) COMPATIBILITY + found while talking to Chris Bennett + +- In man(7), the sequence + .HP + one line of regular text + .SH + should not produce two blank lines before the .SH, + see for example named-checkconf(8). + +- In man(7), the sequence + .SH HEADER + + .PP + regular text + should not produce any blank lines between the header and the text, + see for example rsync(1). + Reported by naddy@ Mon, 28 Mar 2011 20:45:42 +0200 + +- In man(7), the sequence + regular text + .IP + .IP "tag" + indented text + should produce one, not four blank lines between the regular text + and the tag, see for example rsync(1). + Likewise, + regular text + .IP + indented text + should produce one, not two blank lines in between, and + regular text + .IP + .RS + .IP tag + indented text + should produce one, not three blank lines. + Reported by naddy@ Mon, 28 Mar 2011 20:45:42 +0200 + +- trailing whitespace must be ignored even when followed by a font escape, + see for example + makes + \fBdig \fR + operate in batch mode + in dig(1). + +************************************************************************ +* error reporting issues +************************************************************************ + +- .TP directly followed by .RS gives an assertion. + +************************************************************************ +* performance issues +************************************************************************ + +Several areas can be cleaned up to make mandoc even faster. These are + +- improve hashing mechanism for macros (quite important: performance) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Tue May 22 20:24:16 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 1A8B9106566B for ; Tue, 22 May 2012 20:24:14 +0000 (UTC) (envelope-from vbotton@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 22 May 2012 20:24:14 +0000 Date: Tue, 22 May 2012 20:24:14 +0000 From: vbotton@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120522202414.1A8B9106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r236168 - soc2012/vbotton/ntfs_apple X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 May 2012 20:24:16 -0000 Author: vbotton Date: Tue May 22 20:24:13 2012 New Revision: 236168 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236168 Log: Replace some Mac OS mutex with freebsd ones, delete code related to Finder Deleted: soc2012/vbotton/ntfs_apple/ntfs_sfm.c soc2012/vbotton/ntfs_apple/ntfs_sfm.h Modified: soc2012/vbotton/ntfs_apple/ntfs_attr.h soc2012/vbotton/ntfs_apple/ntfs_attr_list.h soc2012/vbotton/ntfs_apple/ntfs_dir.h soc2012/vbotton/ntfs_apple/ntfs_index.h soc2012/vbotton/ntfs_apple/ntfs_inode.h soc2012/vbotton/ntfs_apple/ntfs_lcnalloc.h soc2012/vbotton/ntfs_apple/ntfs_mft.h soc2012/vbotton/ntfs_apple/ntfs_vnops.h soc2012/vbotton/ntfs_apple/ntfs_volume.h Modified: soc2012/vbotton/ntfs_apple/ntfs_attr.h ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_attr.h Tue May 22 19:53:25 2012 (r236167) +++ soc2012/vbotton/ntfs_apple/ntfs_attr.h Tue May 22 20:24:13 2012 (r236168) @@ -54,7 +54,7 @@ * when looking up attributes to specify that we want the unnamed attribute as * opposed to any attribute or a specific named attribute. */ -__private_extern__ ntfschar AT_UNNAMED[1]; +/*__private_extern__ ntfschar AT_UNNAMED[1]; __private_extern__ errno_t ntfs_attr_map_runlist(ntfs_inode *ni); @@ -66,7 +66,7 @@ __private_extern__ errno_t ntfs_attr_find_vcn_nolock(ntfs_inode *ni, const VCN vcn, ntfs_rl_element **run, - ntfs_attr_search_ctx *ctx); + ntfs_attr_search_ctx *ctx);*/ static inline s64 ntfs_attr_size(const ATTR_RECORD *a) { @@ -162,7 +162,7 @@ ctx->is_first = 1; } -__private_extern__ void ntfs_attr_search_ctx_reinit(ntfs_attr_search_ctx *ctx); +/*__private_extern__ void ntfs_attr_search_ctx_reinit(ntfs_attr_search_ctx *ctx); __private_extern__ ntfs_attr_search_ctx *ntfs_attr_search_ctx_get( ntfs_inode *ni, MFT_RECORD *m); __private_extern__ void ntfs_attr_search_ctx_put(ntfs_attr_search_ctx *ctx); @@ -242,5 +242,5 @@ const s64 ofs, const u32 cnt, u8 *buf); __private_extern__ errno_t ntfs_resident_attr_write(ntfs_inode *ni, u8 *buf, u32 cnt, const s64 ofs); - +*/ #endif /* !_OSX_NTFS_ATTR_H */ Modified: soc2012/vbotton/ntfs_apple/ntfs_attr_list.h ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_attr_list.h Tue May 22 19:53:25 2012 (r236167) +++ soc2012/vbotton/ntfs_apple/ntfs_attr_list.h Tue May 22 20:24:13 2012 (r236168) @@ -47,7 +47,7 @@ #include "ntfs_layout.h" #include "ntfs_types.h" -__private_extern__ errno_t ntfs_attr_list_is_needed(ntfs_inode *ni, +/*__private_extern__ errno_t ntfs_attr_list_is_needed(ntfs_inode *ni, ATTR_LIST_ENTRY *skip_entry, BOOL *attr_list_is_needed); __private_extern__ errno_t ntfs_attr_list_delete(ntfs_inode *ni, @@ -62,7 +62,7 @@ __private_extern__ errno_t ntfs_attr_list_sync_extend(ntfs_inode *base_ni, MFT_RECORD *base_m, unsigned al_ofs, ntfs_attr_search_ctx *ctx); - +*/ /** * ntfs_attr_list_sync - update the attribute list content of an ntfs inode * @ni: base ntfs inode whose attribute list attribugte to update @@ -88,8 +88,8 @@ return ntfs_attr_list_sync_shrink(ni, start_ofs, ctx); } -__private_extern__ void ntfs_attr_list_entries_delete(ntfs_inode *ni, - ATTR_LIST_ENTRY *start_entry, ATTR_LIST_ENTRY *end_entry); +/*__private_extern__ void ntfs_attr_list_entries_delete(ntfs_inode *ni, + ATTR_LIST_ENTRY *start_entry, ATTR_LIST_ENTRY *end_entry);*/ /** * ntfs_attr_list_entry_delete - delete an attribute list entry Modified: soc2012/vbotton/ntfs_apple/ntfs_dir.h ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_dir.h Tue May 22 19:53:25 2012 (r236167) +++ soc2012/vbotton/ntfs_apple/ntfs_dir.h Tue May 22 20:24:13 2012 (r236168) @@ -60,7 +60,7 @@ } ntfs_dir_lookup_name; /* The little endian Unicode string $I30 as a global constant. */ -__private_extern__ ntfschar I30[5]; +/*__private_extern__ ntfschar I30[5]; __private_extern__ errno_t ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const ntfschar *uname, const signed uname_len, @@ -77,7 +77,7 @@ __private_extern__ errno_t ntfs_dir_entry_add(ntfs_inode *dir_ni, const FILENAME_ATTR *fn, const u32 fn_len, const leMFT_REF mref); - +*/ /** * struct _ntfs_dirhint - directory hint structure * Modified: soc2012/vbotton/ntfs_apple/ntfs_index.h ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_index.h Tue May 22 19:53:25 2012 (r236167) +++ soc2012/vbotton/ntfs_apple/ntfs_index.h Tue May 22 20:24:13 2012 (r236168) @@ -242,9 +242,9 @@ * * Allocate an index context and return it. */ -static inline ntfs_index_context *ntfs_index_ctx_alloc(void) +inline ntfs_index_context *ntfs_index_ctx_alloc(void) { - return OSMalloc(sizeof(ntfs_index_context), ntfs_malloc_tag); + return malloc(sizeof(ntfs_index_context), ntfs_malloc_tag); } /** @@ -354,7 +354,7 @@ ntfs_index_ctx_free(ictx); } -__private_extern__ void ntfs_index_ctx_unlock(ntfs_index_context *ictx); +/*__private_extern__ void ntfs_index_ctx_unlock(ntfs_index_context *ictx); __private_extern__ errno_t ntfs_index_ctx_relock(ntfs_index_context *ictx); @@ -377,7 +377,7 @@ __private_extern__ errno_t ntfs_index_entry_add_or_node_split( ntfs_index_context *ictx, const BOOL split_only, u32 entry_size, const void *key, const u32 key_len, - const void *data, const u32 data_len); + const void *data, const u32 data_len);*/ /** * ntfs_index_entry_add - add a key to an index Modified: soc2012/vbotton/ntfs_apple/ntfs_inode.h ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_inode.h Tue May 22 19:53:25 2012 (r236167) +++ soc2012/vbotton/ntfs_apple/ntfs_inode.h Tue May 22 20:24:13 2012 (r236168) @@ -40,19 +40,13 @@ #include #include -//#include #include #include #include #include #include #include -//#include - -//#include - -//#include -//#include +#include /* Forward declarations. */ typedef struct _ntfs_inode ntfs_inode; @@ -65,7 +59,6 @@ #include "ntfs_layout.h" #include "ntfs_runlist.h" -#include "ntfs_sfm.h" #include "ntfs_types.h" #include "ntfs_vnops.h" #include "ntfs_volume.h" @@ -74,20 +67,20 @@ struct _ntfs_inode { ntfs_inode_list_entry hash; /* Hash bucket list this inode is in. */ ntfs_volume *vol; /* Pointer to the ntfs volume of this inode. */ - vnode_t vn; /* Vnode attached to the ntfs inode or NULL if + struct vnode *vn; /* Vnode attached to the ntfs inode or NULL if this is an extent ntfs inode. */ - SInt32 nr_refs; /* This is the number of usecount references on + int32_t nr_refs; /* This is the number of usecount references on the vnode of this inode that are held by ntfs driver internal entities. For extent mft records, this is always zero. */ - SInt32 nr_opens; /* This is the number of VNOP_OPEN() calls that + int32_t nr_opens; /* This is the number of VNOP_OPEN() calls that have happened on the vnode of this inode that have not had a matching VNOP_CLOSE() call yet. Note this applies only to base inodes and is incremented/decremented in the base inode for attribute/raw inode opens/closes, too. */ - lck_rw_t lock; /* Lock serializing changes to the inode such + struct mutex lock; /* Lock serializing changes to the inode such as inode truncation and directory content modification (both take the lock exclusive) and calls like readdir and file read (these @@ -125,7 +118,7 @@ struct timespec backup_time; /* Cache of field in the AFP_AfpInfo stream but in OS X time format. */ - FINDER_INFO finder_info; /* Cached Finder info from the + /*FINDER_INFO finder_info;*/ /* Cached Finder info from the AFP_AfpInfo stream. */ /* * If NInoAttr() is true, the below fields describe the attribute which @@ -242,14 +235,14 @@ per cb. */ }; }; - lck_mtx_t extent_lock; /* Lock for accessing/modifying the below . */ + struct mtx extent_lock; /* Lock for accessing/modifying the below . */ s32 nr_extents; /* For a base mft record, the number of attached extent inodes (0 if none), for extent records and for fake inodes describing an attribute this is -1 if the base inode at @base_ni is valid and 0 otherwise. */ u32 extent_alloc; /* Number of bytes allocated for the extent_nis array. */ - lck_mtx_t attr_nis_lock; /* Lock for accessing/modifying the below. */ + struct mtx attr_nis_lock; /* Lock for accessing/modifying the below. */ s32 nr_attr_nis; /* For a base inode, the number of loaded attribute inodes (0 if none). Ignored for attribut inodes and fake inodes. */ @@ -275,7 +268,7 @@ record. For fake inodes, the real (base) inode to which the attribute belongs. */ - lck_mtx_t *base_attr_nis_lock; /* Pointer to the base + struct mtx *base_attr_nis_lock; /* Pointer to the base inode attr_nis_lock or NULL. */ @@ -388,11 +381,11 @@ } \ static inline void NInoSet##flag(ntfs_inode *ni) \ { \ - (void)OSBitOrAtomic((u32)1 << NI_##flag, (UInt32*)&ni->flags); \ + ni->flags |= ((u32)1 << NI_##flag); \ } \ static inline void NInoClear##flag(ntfs_inode *ni) \ { \ - (void)OSBitAndAtomic(~((u32)1 << NI_##flag), (UInt32*)&ni->flags); \ + ni->flags &= ~((u32)1 << NI_##flag); \ } /* @@ -401,13 +394,13 @@ #define DEFINE_NINO_TEST_AND_SET_BIT_OPS(flag) \ static inline u32 NInoTestSet##flag(ntfs_inode *ni) \ { \ - return ((u32)OSBitOrAtomic((u32)1 << NI_##flag, \ - (UInt32*)&ni->flags) >> NI_##flag) & 1; \ + ni->flags |= ((u32)1 << NI_##flag); \ + return (u32)((ni->flags >> NI_##flag) & 1); \ } \ static inline u32 NInoTestClear##flag(ntfs_inode *ni) \ { \ - return ((u32)OSBitAndAtomic(~((u32)1 << NI_##flag), \ - (UInt32*)&ni->flags) >> NI_##flag) & 1; \ + ni->flags &= ~((u32)1 << NI_##flag); \ + return (u32)((ni->flags >> NI_##flag) & 1) \ } /* Emit the ntfs inode bitops functions. */ @@ -416,8 +409,7 @@ static inline void NInoClearAllocLocked(ntfs_inode *ni) { - (void)OSBitAndAtomic(~(((u32)1 << NI_Locked) | ((u32)1 << NI_Alloc)), - (UInt32*)&ni->flags); + ni->flags &= (~(((u32)1 << NI_Locked) | ((u32)1 << NI_Alloc))); } DEFINE_NINO_BIT_OPS(Deleted) @@ -448,9 +440,9 @@ DEFINE_NINO_BIT_OPS(ValidBackupTime) DEFINE_NINO_BIT_OPS(DirtyBackupTime) DEFINE_NINO_TEST_AND_SET_BIT_OPS(DirtyBackupTime) -DEFINE_NINO_BIT_OPS(ValidFinderInfo) -DEFINE_NINO_BIT_OPS(DirtyFinderInfo) -DEFINE_NINO_TEST_AND_SET_BIT_OPS(DirtyFinderInfo) +//DEFINE_NINO_BIT_OPS(ValidFinderInfo) +//DEFINE_NINO_BIT_OPS(DirtyFinderInfo) +//DEFINE_NINO_TEST_AND_SET_BIT_OPS(DirtyFinderInfo) /* Function to bulk check all the Dirty* flags at once. */ static inline u32 NInoDirty(ntfs_inode *ni) @@ -496,10 +488,10 @@ BOOL raw; }; -__private_extern__ BOOL ntfs_inode_test(ntfs_inode *ni, const ntfs_attr *na); +/*__private_extern__ BOOL ntfs_inode_test(ntfs_inode *ni, const ntfs_attr *na); __private_extern__ errno_t ntfs_inode_init(ntfs_volume *vol, ntfs_inode *ni, - const ntfs_attr *na); + const ntfs_attr *na);*/ /** * ntfs_inode_wait - wait for an ntfs inode @@ -534,7 +526,7 @@ * ntfs_inode_wakeup - wakeup all processes waiting on an ntfs inode * @ni: ntfs inode to wake up */ -static inline void ntfs_inode_wakeup(ntfs_inode *ni) +inline void ntfs_inode_wakeup(ntfs_inode *ni) { wakeup(ni); } @@ -554,7 +546,7 @@ #define ntfs_inode_add_vnode(ni, is_system, parent_vn, cn) \ ntfs_inode_add_vnode_attr(ni, is_system, parent_vn, cn, FALSE/*isstream*/) -__private_extern__ errno_t ntfs_inode_add_vnode_attr(ntfs_inode *ni, +/*__private_extern__ errno_t ntfs_inode_add_vnode_attr(ntfs_inode *ni, const BOOL is_system, vnode_t parent_vn, struct componentname *cn, BOOL isstream); @@ -569,7 +561,7 @@ __private_extern__ errno_t ntfs_attr_inode_get_or_create(ntfs_inode *base_ni, ATTR_TYPE type, ntfschar *name, u32 name_len, const BOOL is_system, const BOOL raw, const int options, - const lck_rw_type_t lock, ntfs_inode **nni); + const lck_rw_type_t lock, ntfs_inode **nni);*/ /** * ntfs_attr_inode_get - obtain an ntfs inode corresponding to an attribute @@ -658,7 +650,7 @@ ni->name_len, FALSE, TRUE, XATTR_REPLACE, lock, nni); } -__private_extern__ errno_t ntfs_index_inode_get(ntfs_inode *base_ni, +/*__private_extern__ errno_t ntfs_index_inode_get(ntfs_inode *base_ni, ntfschar *name, u32 name_len, const BOOL is_system, ntfs_inode **nni); @@ -683,6 +675,6 @@ BOOL have_parent, MFT_REF *mref, const char *name); __private_extern__ errno_t ntfs_inode_is_parent(ntfs_inode *parent_ni, - ntfs_inode *child_ni, BOOL *is_parent, ntfs_inode *forbid_ni); + ntfs_inode *child_ni, BOOL *is_parent, ntfs_inode *forbid_ni);*/ #endif /* !_OSX_NTFS_INODE_H */ Modified: soc2012/vbotton/ntfs_apple/ntfs_lcnalloc.h ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_lcnalloc.h Tue May 22 19:53:25 2012 (r236167) +++ soc2012/vbotton/ntfs_apple/ntfs_lcnalloc.h Tue May 22 20:24:13 2012 (r236168) @@ -55,7 +55,7 @@ LAST_ZONE = 1, /* For sanity checking. */ } NTFS_CLUSTER_ALLOCATION_ZONES; -__private_extern__ errno_t ntfs_cluster_alloc(ntfs_volume *vol, +/*__private_extern__ errno_t ntfs_cluster_alloc(ntfs_volume *vol, const VCN start_vcn, const s64 count, const LCN start_lcn, const NTFS_CLUSTER_ALLOCATION_ZONES zone, const BOOL is_extension, ntfs_runlist *runlist); @@ -65,6 +65,6 @@ s64 *nr_freed); __private_extern__ errno_t ntfs_cluster_free(ntfs_inode *ni, const VCN start_vcn, s64 count, ntfs_attr_search_ctx *ctx, - s64 *nr_freed); + s64 *nr_freed);*/ #endif /* !_OSX_NTFS_LCNALLOC_H */ Modified: soc2012/vbotton/ntfs_apple/ntfs_mft.h ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_mft.h Tue May 22 19:53:25 2012 (r236167) +++ soc2012/vbotton/ntfs_apple/ntfs_mft.h Tue May 22 20:24:13 2012 (r236168) @@ -45,8 +45,8 @@ #include "ntfs_types.h" #include "ntfs_volume.h" -__private_extern__ errno_t ntfs_mft_record_map_ext(ntfs_inode *ni, - MFT_RECORD **m, const BOOL mft_is_locked); +/*__private_extern__ errno_t ntfs_mft_record_map_ext(ntfs_inode *ni, + MFT_RECORD **m, const BOOL mft_is_locked);*/ /** * ntfs_mft_record_map - map and lock an mft record @@ -67,11 +67,11 @@ return ntfs_mft_record_map_ext(ni, m, FALSE); } -__private_extern__ void ntfs_mft_record_unmap(ntfs_inode *ni); +/*__private_extern__ void ntfs_mft_record_unmap(ntfs_inode *ni); __private_extern__ errno_t ntfs_extent_mft_record_map_ext(ntfs_inode *base_ni, MFT_REF mref, ntfs_inode **nni, MFT_RECORD **nm, - const BOOL mft_is_locked); + const BOOL mft_is_locked);*/ /** * ntfs_extent_mft_record_map - load an extent inode and attach it to its base @@ -102,7 +102,7 @@ ntfs_mft_record_unmap(ni); } -__private_extern__ errno_t ntfs_mft_record_sync(ntfs_inode *ni); +/*__private_extern__ errno_t ntfs_mft_record_sync(ntfs_inode *ni); __private_extern__ errno_t ntfs_mft_mirror_sync(ntfs_volume *vol, const s64 rec_no, const MFT_RECORD *m, const BOOL sync); @@ -113,6 +113,6 @@ ATTR_RECORD **new_a); __private_extern__ errno_t ntfs_extent_mft_record_free(ntfs_inode *base_ni, - ntfs_inode *ni, MFT_RECORD *m); + ntfs_inode *ni, MFT_RECORD *m);*/ #endif /* !_OSX_NTFS_MFT_H */ Modified: soc2012/vbotton/ntfs_apple/ntfs_vnops.h ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_vnops.h Tue May 22 19:53:25 2012 (r236167) +++ soc2012/vbotton/ntfs_apple/ntfs_vnops.h Tue May 22 20:24:13 2012 (r236168) @@ -44,10 +44,10 @@ typedef int vnop_t(void *); -__private_extern__ vnop_t **ntfs_vnodeop_p; +/*__private_extern__ vnop_t **ntfs_vnodeop_p; __private_extern__ struct vnodeopv_desc ntfs_vnodeopv_desc; -__private_extern__ int ntfs_cluster_iodone(buf_t cbp, void *arg __unused); +__private_extern__ int ntfs_cluster_iodone(buf_t cbp, void *arg __unused);*/ #endif /* !_OSX_NTFS_VNOPS_H */ Modified: soc2012/vbotton/ntfs_apple/ntfs_volume.h ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_volume.h Tue May 22 19:53:25 2012 (r236167) +++ soc2012/vbotton/ntfs_apple/ntfs_volume.h Tue May 22 20:24:13 2012 (r236168) @@ -119,7 +119,7 @@ ntfs_inode *mftbmp_ni; /* Attribute ntfs inode for $MFT/$BITMAP. */ - lck_rw_t mftbmp_lock; /* Lock for serializing accesses to the + struct rwlock mftbmp_lock; /* Lock for serializing accesses to the mft record bitmap ($MFT/$BITMAP) as well as to @nr_mft_records and @nr_free_mft_records. */ @@ -138,7 +138,7 @@ ntfs_inode *logfile_ni; /* The ntfs inode of $LogFile. */ ntfs_inode *lcnbmp_ni; /* The ntfs inode of $Bitmap. */ - lck_rw_t lcnbmp_lock; /* Lock for serializing accesses to the + struct rwlock lcnbmp_lock; /* Lock for serializing accesses to the cluster bitmap ($Bitmap/$DATA) as well as to @nr_clusters and @nr_free_clusters. */ @@ -152,7 +152,7 @@ u8 major_ver; /* Ntfs major version of volume. */ u8 minor_ver; /* Ntfs minor version of volume. */ - lck_mtx_t rename_lock; /* Lock serializing directory tree + struct mtx rename_lock; /* Lock serializing directory tree reshaping rename operations. */ ntfs_inode *root_ni; /* The ntfs inode of the root @@ -162,7 +162,7 @@ ntfs_inode *secure_sds_ni; /* Attribute inode of $Secure/$SDS. */ ntfs_inode *secure_sdh_ni; /* Index inode of $Secure/$SDH. */ ntfs_inode *secure_sii_ni; /* Index inode of $Secure/$SII. */ - lck_rw_t secure_lock; /* Lock for serializing accesses to the + struct rwlock secure_lock; /* Lock for serializing accesses to the $Secure related inodes. */ le32 next_security_id; /* The security_id to use the next time a new security descriptor is added @@ -196,7 +196,7 @@ ntfs_inode *usnjrnl_j_ni; /* Attribute inode for $UsnJrnl/$J. */ ntfs_inode_list_head inodes; /* List of all loaded ntfs_inodes. */ - lck_mtx_t inodes_lock; /* Lock protecting access to inodes + struct mtx inodes_lock; /* Lock protecting access to inodes list. */ }; From owner-svn-soc-all@FreeBSD.ORG Wed May 23 03:56:08 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 9C487106566C for ; Wed, 23 May 2012 03:56:06 +0000 (UTC) (envelope-from emc2@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 23 May 2012 03:56:06 +0000 Date: Wed, 23 May 2012 03:56:06 +0000 From: emc2@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120523035606.9C487106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r236184 - in soc2012/emc2/head/sys/boot/i386: . efi X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 May 2012 03:56:08 -0000 Author: emc2 Date: Wed May 23 03:56:05 2012 New Revision: 236184 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236184 Log: Added efi directory to build, added in elf64_freebsd.c from libi386, modified the Makefile a bit to facilitate amd64 build. At the present, there are undefined symbols in the amd64 build, at least one of which seems to be defined over in libi386. Added: soc2012/emc2/head/sys/boot/i386/efi/elf64_freebsd.c - copied unchanged from r236072, soc2012/emc2/head/sys/boot/i386/libi386/elf64_freebsd.c Modified: soc2012/emc2/head/sys/boot/i386/Makefile soc2012/emc2/head/sys/boot/i386/efi/Makefile soc2012/emc2/head/sys/boot/i386/efi/exec.c Modified: soc2012/emc2/head/sys/boot/i386/Makefile ============================================================================== --- soc2012/emc2/head/sys/boot/i386/Makefile Wed May 23 02:43:28 2012 (r236183) +++ soc2012/emc2/head/sys/boot/i386/Makefile Wed May 23 03:56:05 2012 (r236184) @@ -3,7 +3,7 @@ .include SUBDIR= mbr pmbr boot0 boot0sio btx boot2 cdboot gptboot kgzldr \ - libi386 libfirewire loader + efi libi386 libfirewire loader # special boot programs, 'self-extracting boot2+loader' SUBDIR+= pxeldr Modified: soc2012/emc2/head/sys/boot/i386/efi/Makefile ============================================================================== --- soc2012/emc2/head/sys/boot/i386/efi/Makefile Wed May 23 02:43:28 2012 (r236183) +++ soc2012/emc2/head/sys/boot/i386/efi/Makefile Wed May 23 03:56:05 2012 (r236184) @@ -10,20 +10,27 @@ INTERNALPROG= # architecture-specific loader code -SRCS= main.c exec.c conf.c vers.c reloc.c start.S elf32_freebsd.c +SRCS= main.c exec.c conf.c vers.c reloc.c start.S SRCS+= i386_copy.c bootinfo.c autoload.c devicename.c efimd.c CFLAGS+= -I${.CURDIR}/../../efi/include CFLAGS+= -I${.CURDIR}/../../efi/include/i386 - -.if ${MK_FORTH} != "no" BOOT_FORTH= yes CFLAGS+= -DBOOT_FORTH CFLAGS+= -I${.CURDIR}/../../ficl CFLAGS+= -I${.CURDIR}/../../ficl/i386 +CFLAGS+= -I. LIBFICL= ${.OBJDIR}/../../ficl/libficl.a -.endif +.if ${MACHINE_CPUARCH} == "amd64" +SRCS+= elf64_freebsd.c +EFIFORMAT= efi-app-x86_64 +.elif ${MACHINE_CPUARCH} == "i386" +SRCS+= elf32_freebsd.c +EFIFORMAT= efi-app-ia32 +.else +.error "MACHINE_CPUARCH is ${MACHINE_CPUARCH} (not amd64 or i386)" +.endif # Include bcache code. HAVE_BCACHE= yes @@ -50,6 +57,7 @@ OBJCOPY?= objcopy OBJDUMP?= objdump + loader.efi: loader.sym if [ `${OBJDUMP} -t ${.ALLSRC} | fgrep '*UND*' | wc -l` != 0 ]; then \ ${OBJDUMP} -t ${.ALLSRC} | fgrep '*UND*'; \ @@ -57,7 +65,7 @@ fi ${OBJCOPY} -j .data -j .dynamic -j .dynstr -j .dynsym -j .hash \ -j .rel.dyn -j .reloc -j .sdata -j .text -j set_Xcommand_set \ - --target=efi-app-ia32 ${.ALLSRC} ${.TARGET} + --target=${EFIFORMAT} ${.ALLSRC} ${.TARGET} LIBEFI= ${.OBJDIR}/../../efi/libefi/libefi.a CFLAGS+= -I${.CURDIR}/../libi386 @@ -66,11 +74,4 @@ DPADD= ${LIBFICL} ${LIBEFI} ${LIBSTAND} LDADD= ${LIBFICL} ${LIBEFI} ${LIBSTAND} -.include - -.if ${MACHINE_CPUARCH} == "amd64" -CFLAGS+= -I. -beforedepend ${OBJS}: machine -machine: - ln -sf ${.CURDIR}/../../../i386/include machine -.endif +.include \ No newline at end of file Copied: soc2012/emc2/head/sys/boot/i386/efi/elf64_freebsd.c (from r236072, soc2012/emc2/head/sys/boot/i386/libi386/elf64_freebsd.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/emc2/head/sys/boot/i386/efi/elf64_freebsd.c Wed May 23 03:56:05 2012 (r236184, copy of r236072, soc2012/emc2/head/sys/boot/i386/libi386/elf64_freebsd.c) @@ -0,0 +1,126 @@ +/*- + * Copyright (c) 1998 Michael Smith + * 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$"); + +#define __ELF_WORD_SIZE 64 +#include +#include +#include +#include +#include +#include +#include + +#include "bootstrap.h" +#include "libi386.h" +#include "btxv86.h" + +static int elf64_exec(struct preloaded_file *amp); +static int elf64_obj_exec(struct preloaded_file *amp); + +struct file_format amd64_elf = { elf64_loadfile, elf64_exec }; +struct file_format amd64_elf_obj = { elf64_obj_loadfile, elf64_obj_exec }; + +#define PG_V 0x001 +#define PG_RW 0x002 +#define PG_U 0x004 +#define PG_PS 0x080 + +typedef u_int64_t p4_entry_t; +typedef u_int64_t p3_entry_t; +typedef u_int64_t p2_entry_t; +extern p4_entry_t PT4[]; +extern p3_entry_t PT3[]; +extern p2_entry_t PT2[]; + +u_int32_t entry_hi; +u_int32_t entry_lo; + +extern void amd64_tramp(); + +/* + * There is an ELF kernel and one or more ELF modules loaded. + * We wish to start executing the kernel image, so make such + * preparations as are required, and do so. + */ +static int +elf64_exec(struct preloaded_file *fp) +{ + struct file_metadata *md; + Elf_Ehdr *ehdr; + vm_offset_t modulep, kernend; + int err; + int i; + + if ((md = file_findmetadata(fp, MODINFOMD_ELFHDR)) == NULL) + return(EFTYPE); + ehdr = (Elf_Ehdr *)&(md->md_data); + + err = bi_load64(fp->f_args, &modulep, &kernend); + if (err != 0) + return(err); + + bzero(PT4, PAGE_SIZE); + bzero(PT3, PAGE_SIZE); + bzero(PT2, PAGE_SIZE); + + /* + * This is kinda brutal, but every single 1GB VM memory segment points to + * the same first 1GB of physical memory. But it is more than adequate. + */ + for (i = 0; i < 512; i++) { + /* Each slot of the level 4 pages points to the same level 3 page */ + PT4[i] = (p4_entry_t)VTOP((uintptr_t)&PT3[0]); + PT4[i] |= PG_V | PG_RW | PG_U; + + /* Each slot of the level 3 pages points to the same level 2 page */ + PT3[i] = (p3_entry_t)VTOP((uintptr_t)&PT2[0]); + PT3[i] |= PG_V | PG_RW | PG_U; + + /* The level 2 page slots are mapped with 2MB pages for 1GB. */ + PT2[i] = i * (2 * 1024 * 1024); + PT2[i] |= PG_V | PG_RW | PG_PS | PG_U; + } + + entry_lo = ehdr->e_entry & 0xffffffff; + entry_hi = (ehdr->e_entry >> 32) & 0xffffffff; +#ifdef DEBUG + printf("Start @ %#llx ...\n", ehdr->e_entry); +#endif + + dev_cleanup(); + __exec((void *)VTOP(amd64_tramp), modulep, kernend); + + panic("exec returned"); +} + +static int +elf64_obj_exec(struct preloaded_file *fp) +{ + return (EFTYPE); +} Modified: soc2012/emc2/head/sys/boot/i386/efi/exec.c ============================================================================== --- soc2012/emc2/head/sys/boot/i386/efi/exec.c Wed May 23 02:43:28 2012 (r236183) +++ soc2012/emc2/head/sys/boot/i386/efi/exec.c Wed May 23 03:56:05 2012 (r236184) @@ -46,6 +46,10 @@ void __exec(caddr_t addr, ...) { + /* XXX Find out why Rui thought this was wrong, fix it. Also, + * make a version for amd64 + */ +#if 0 /* XXX this is wrong */ __asm __volatile("movl %cr0, %eax"); __asm __volatile("andl $0x7fffffff, %eax"); @@ -56,4 +60,5 @@ __asm __volatile("andl $0xfffffffe, %eax"); __asm __volatile("movl %eax, %cr0"); __asm __volatile("jmp %0" :: "r" (addr)); +#endif } From owner-svn-soc-all@FreeBSD.ORG Wed May 23 10:24:09 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 9D0EE106566C for ; Wed, 23 May 2012 10:24:07 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 23 May 2012 10:24:07 +0000 Date: Wed, 23 May 2012 10:24:07 +0000 From: rudot@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120523102407.9D0EE106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r236191 - in soc2012/rudot: aux sys/kern sys/sys X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 May 2012 10:24:09 -0000 Author: rudot Date: Wed May 23 10:24:06 2012 New Revision: 236191 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236191 Log: added pcpu resource to rctl Modified: soc2012/rudot/aux/add.sh soc2012/rudot/aux/notes.txt soc2012/rudot/sys/kern/kern_rctl.c soc2012/rudot/sys/sys/racct.h Modified: soc2012/rudot/aux/add.sh ============================================================================== --- soc2012/rudot/aux/add.sh Wed May 23 09:38:37 2012 (r236190) +++ soc2012/rudot/aux/add.sh Wed May 23 10:24:06 2012 (r236191) @@ -5,4 +5,4 @@ PID=$1 -rctl -a process:${PID}:cpup:limit=50 +rctl -a process:${PID}:pcpu:deny=50 Modified: soc2012/rudot/aux/notes.txt ============================================================================== --- soc2012/rudot/aux/notes.txt Wed May 23 09:38:37 2012 (r236190) +++ soc2012/rudot/aux/notes.txt Wed May 23 10:24:06 2012 (r236191) @@ -1,7 +1 @@ -rctl -a process:PID:cpup:limit=50 - -sys_rctl_add_rule -> rctl_string_to_rule -line: 907 " error = str2value(resourcestr, &rule->rr_resource," - " resourcenames);" - -error has value 22 +rctl -a process:PID:pcpu:deny=50 works Modified: soc2012/rudot/sys/kern/kern_rctl.c ============================================================================== --- soc2012/rudot/sys/kern/kern_rctl.c Wed May 23 09:38:37 2012 (r236190) +++ soc2012/rudot/sys/kern/kern_rctl.c Wed May 23 10:24:06 2012 (r236191) @@ -120,6 +120,7 @@ { "nshm", RACCT_NSHM }, { "shmsize", RACCT_SHMSIZE }, { "wallclock", RACCT_WALLCLOCK }, + { "pcpu", RACCT_PCTCPU }, { NULL, -1 }}; static struct dict actionnames[] = { Modified: soc2012/rudot/sys/sys/racct.h ============================================================================== --- soc2012/rudot/sys/sys/racct.h Wed May 23 09:38:37 2012 (r236190) +++ soc2012/rudot/sys/sys/racct.h Wed May 23 10:24:06 2012 (r236191) @@ -68,7 +68,8 @@ #define RACCT_NSHM 17 #define RACCT_SHMSIZE 18 #define RACCT_WALLCLOCK 19 -#define RACCT_MAX RACCT_WALLCLOCK +#define RACCT_PCTCPU 20 +#define RACCT_MAX RACCT_PCTCPU /* * Resource properties. From owner-svn-soc-all@FreeBSD.ORG Wed May 23 14:01:52 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id DA4F51065670 for ; Wed, 23 May 2012 14:01:50 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 23 May 2012 14:01:50 +0000 Date: Wed, 23 May 2012 14:01:50 +0000 From: rudot@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120523140150.DA4F51065670@hub.freebsd.org> Cc: Subject: socsvn commit: r236200 - soc2012/rudot/aux/config X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 May 2012 14:01:53 -0000 Author: rudot Date: Wed May 23 14:01:50 2012 New Revision: 236200 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236200 Log: I save som config files for the debugging machine Added: soc2012/rudot/aux/config/debug.exports soc2012/rudot/aux/config/debug.rc.conf Added: soc2012/rudot/aux/config/debug.exports ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/aux/config/debug.exports Wed May 23 14:01:50 2012 (r236200) @@ -0,0 +1 @@ +/target/usr -maproot=root target Added: soc2012/rudot/aux/config/debug.rc.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/aux/config/debug.rc.conf Wed May 23 14:01:50 2012 (r236200) @@ -0,0 +1,10 @@ +hostname="debug" +ifconfig_em0="DHCP" +sshd_enable="YES" +sendmail_enable="NONE" +# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable +dumpdev="AUTO" + +rpcbind_enable="YES" +nfs_server_enable="YES" +mountd_flags="-r" From owner-svn-soc-all@FreeBSD.ORG Wed May 23 14:06:51 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id DC208106564A for ; Wed, 23 May 2012 14:06:49 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 23 May 2012 14:06:49 +0000 Date: Wed, 23 May 2012 14:06:49 +0000 From: rudot@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120523140649.DC208106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r236201 - in soc2012/rudot/aux: . config X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 May 2012 14:06:52 -0000 Author: rudot Date: Wed May 23 14:06:49 2012 New Revision: 236201 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236201 Log: I save some config files for the target machine. Added: soc2012/rudot/aux/build_kernel.sh (contents, props changed) soc2012/rudot/aux/config/target.device.hints soc2012/rudot/aux/config/target.fstab soc2012/rudot/aux/config/target.rc.conf soc2012/rudot/aux/config/target.sysctl.conf soc2012/rudot/aux/remove.sh (contents, props changed) Added: soc2012/rudot/aux/build_kernel.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/aux/build_kernel.sh Wed May 23 14:06:49 2012 (r236201) @@ -0,0 +1,5 @@ +# check http://www.mail-archive.com/freebsd-hackers@freebsd.org/msg23424.html + +cd /usr/src +make buildkernel -DNO_MODULES KERNCONF=RCTL +make installkernel -DNO_MODULES KERNCONF=RCTL Added: soc2012/rudot/aux/config/target.device.hints ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/aux/config/target.device.hints Wed May 23 14:06:49 2012 (r236201) @@ -0,0 +1,41 @@ +# $FreeBSD: src/sys/i386/conf/GENERIC.hints,v 1.24 2012/03/06 18:44:52 bz Exp $ +hint.fdc.0.at="isa" +hint.fdc.0.port="0x3F0" +hint.fdc.0.irq="6" +hint.fdc.0.drq="2" +hint.fd.0.at="fdc0" +hint.fd.0.drive="0" +hint.fd.1.at="fdc0" +hint.fd.1.drive="1" +hint.ata.0.at="isa" +hint.ata.0.port="0x1F0" +hint.ata.0.irq="14" +hint.ata.1.at="isa" +hint.ata.1.port="0x170" +hint.ata.1.irq="15" +hint.atkbdc.0.at="isa" +hint.atkbdc.0.port="0x060" +hint.atkbd.0.at="atkbdc" +hint.atkbd.0.irq="1" +hint.psm.0.at="atkbdc" +hint.psm.0.irq="12" +hint.sc.0.at="isa" +hint.sc.0.flags="0x100" +hint.apm.0.disabled="1" +hint.apm.0.flags="0x20" +hint.uart.0.at="isa" +hint.uart.0.port="0x3F8" +hint.uart.0.flags="0x90" +hint.uart.0.irq="4" +hint.uart.1.at="isa" +hint.uart.1.port="0x2F8" +hint.uart.1.irq="3" +hint.ppc.0.at="isa" +hint.ppc.0.irq="7" +hint.atrtc.0.at="isa" +hint.atrtc.0.port="0x70" +hint.atrtc.0.irq="8" +hint.attimer.0.at="isa" +hint.attimer.0.port="0x40" +hint.attimer.0.irq="0" +hint.wbwd.0.at="isa" Added: soc2012/rudot/aux/config/target.fstab ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/aux/config/target.fstab Wed May 23 14:06:49 2012 (r236201) @@ -0,0 +1,4 @@ +# Device Mountpoint FStype Options Dump Pass# +/dev/ada0p2 / ufs rw 1 1 +/dev/ada0p3 none swap sw 0 0 +debug:/target/usr /target/usr nfs rw 0 0 Added: soc2012/rudot/aux/config/target.rc.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/aux/config/target.rc.conf Wed May 23 14:06:49 2012 (r236201) @@ -0,0 +1,9 @@ +hostname="target" +ifconfig_em0="DHCP" +sshd_enable="YES" +sendmail_enable="NONE" +# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable +dumpdev="AUTO" + + +nfs_client_enable="YES" Added: soc2012/rudot/aux/config/target.sysctl.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/aux/config/target.sysctl.conf Wed May 23 14:06:49 2012 (r236201) @@ -0,0 +1,11 @@ +# $FreeBSD: src/etc/sysctl.conf,v 1.8 2003/03/13 18:43:50 mux Exp $ +# +# This file is read when going to multi-user and its contents piped thru +# ``sysctl'' to adjust kernel values. ``man 5 sysctl.conf'' for details. +# + +# Uncomment this to prevent users from seeing information about processes that +# are being run under another UID. +#security.bsd.see_other_uids=0 +debug.kdb.current=ddb +debug.debugger_on_panic=1 Added: soc2012/rudot/aux/remove.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/aux/remove.sh Wed May 23 14:06:49 2012 (r236201) @@ -0,0 +1 @@ +rctl -r ::pcpu: From owner-svn-soc-all@FreeBSD.ORG Wed May 23 14:45:42 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 67E3B1065670 for ; Wed, 23 May 2012 14:45:40 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 23 May 2012 14:45:40 +0000 Date: Wed, 23 May 2012 14:45:40 +0000 From: gpf@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120523144540.67E3B1065670@hub.freebsd.org> Cc: Subject: socsvn commit: r236202 - soc2012/gpf/pefs_kmod/sbin/pefs X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 May 2012 14:45:42 -0000 Author: gpf Date: Wed May 23 14:45:39 2012 New Revision: 236202 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236202 Log: Fix logical error where plaintexts were hashed instead of ciphertexts, leading to same hashes for same messages. Requiring that pefs filesystem is not mounted, so as to get cipher text, creates some problems when it comes to mapping user supplied file list to encrypted filenames. My solution is to provide a 2nd pefs command (pefs addchecklist). This command takes a simple filepath list and provides another one with encrypted filenames so that it can be used directly by original command pefs addchecksum. Another solution, requiring only 1 command, would have been to ask the user to supply a list of inode numbers instead of fullpaths but that seems less user friendly/elegant as well as more time consuming for sbin/pefs. I like this method better. Refer to the 2 big comment headers above pefs_addchecksum() & pefs_addchecklist() in pefs_ctl.c for a man-page like description of the commands + an example. Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.h soc2012/gpf/pefs_kmod/sbin/pefs/pefs_subr.c Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Wed May 23 14:06:49 2012 (r236201) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Wed May 23 14:45:39 2012 (r236202) @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -82,11 +83,6 @@ uint32_t size; }; -/* - * XXXgpf: dbg info: - * man page example(sha256) 318b20b83a6730b928c46163a2a1cefee4466132731c95c39613acb547ccb715 - * "Test Message\n" + "Hello World\n" - */ static int pefs_compute_file_checksums(struct file_header *fhp, const EVP_MD *md, uint8_t hash_len) @@ -111,7 +107,7 @@ EVP_DigestUpdate(&mdctx, buf, bytes_read); dprintf(("read %d bytes\n", bytes_read)); - for (i=0; ifile_id = sb.st_ino; return (0); @@ -295,6 +290,10 @@ return (PEFS_ERR_SYS); } + /* + * XXXgpf: [TODO] deal with other types of files + */ + if (S_ISREG(sb.st_mode) == 0) { pefs_warn("filename: %s is not a regular file", fhp->path); return (PEFS_ERR_INVALID); @@ -327,7 +326,7 @@ if (buf[strnlen(buf, sizeof(buf)) - 1] == '\n') buf[strnlen(buf, sizeof(buf)) - 1] = '\0'; - dprintf(("\nnext buf=%s!\n", buf)); + dprintf(("\nnext file entry=%s!\n", buf)); fhp = malloc(sizeof(struct file_header)); if (fhp == NULL) { @@ -346,10 +345,9 @@ * the checksum file. * A) The total sum of entries is gathered so that a hash table is allocated. * B) For each file entry: - * B1) semantic checks: residing in pefs filesystem & regular file type checks. - * B2) the file_id is retrieved. - * B3) list of checksums is computed for the file's 4k blocks. - * B4) file entry is added to hash table. (separate chaining is used) + * B1) the file_id is retrieved. + * B2) list of checksums is computed for the file's 4k blocks. + * B3) file entry is added to hash table. (separate chaining is used) */ static int pefs_create_in_memory_db(FILE *fpin, char *fsroot, const EVP_MD *md, uint8_t hash_len, @@ -374,9 +372,7 @@ return (error); while((fhp = pefs_next_file(fpin, &error)) != NULL) { - error = pefs_file_semantic_checks(fhp, &fs); - if (error != 0) - return error; + /* XXXgpf: Semantic checks are now performed by addchecklist command */ error = pefs_get_file_id(fhp); if (error != 0) @@ -431,6 +427,7 @@ goto out; /* XXXgpf: [TODO] write the in memory db to .pefs.checksum */ + /* man byteorder(9) */ /* error = pefs_write_checksum_file(&checksum_hash_table, fdout, ...); */ out: @@ -441,3 +438,157 @@ return (error); } + +/* + * Transform a decrypted fullpath residing in fsroot to an + * encrypted fullpath residing in fromfsroot. + */ +static int +pefs_get_enc_path(struct file_header *fhp, char *fsroot, char *fromfsroot) +{ + /* XXXgpf: can there be a problem with paths greater than MAXPATHLEN? */ + char enc_path[MAXPATHLEN]; + char dec_path[MAXPATHLEN]; + char original_path[MAXPATHLEN]; + char buf[MAXPATHLEN]; + struct stat sb; + char *rel_path; + char *pch; + DIR *dirp; + struct dirent *dp; + uint32_t ino; + int found; + + strlcpy(enc_path, fromfsroot, sizeof(enc_path)); + strlcpy(dec_path, fsroot, sizeof(dec_path)); + + strlcpy(original_path, fhp->path, sizeof(original_path)); + rel_path = original_path + strlen(fsroot); + + dprintf(("constructing encrypted path for: %s%s\n", fsroot, rel_path)); + + pch = strtok (rel_path,"/"); + while (pch != NULL) { + dprintf(("enc path = %s\tdec path = %s\n", enc_path, dec_path)); + dprintf(("next element: %s", pch)); + snprintf(buf, sizeof(buf), "%s/%s", dec_path, pch); + strlcpy(dec_path, buf, sizeof(dec_path)); + + /* grab inode from dec_path */ + if (stat(buf, &sb) != 0) { + warn("cannot stat file %s", buf); + return (PEFS_ERR_SYS); + } + ino = sb.st_ino; + dprintf(("\t%d\n", ino)); + + /* try to find inode in dirents of enc_path */ + dirp = opendir(enc_path); + if (dirp == NULL) { + warn("cannot open dir %s", enc_path); + return (PEFS_ERR_SYS); + } + + found = 0; + while (dirp != NULL) { + if ( (dp = readdir(dirp)) != NULL) { + if (dp->d_fileno == ino) { + found = 1; + break; + } + } + else { + closedir(dirp); + break; + } + } + + if (found == 0) { + pefs_warn("inode: %d not found in directory: %s", ino, enc_path); + return (PEFS_ERR_NOENT); + } + + /* append the encrypted filename and continue */ + snprintf(buf, sizeof(buf), "%s/%s", enc_path, dp->d_name); + strlcpy(enc_path, buf, sizeof(enc_path)); + closedir(dirp); + + pch = strtok (NULL, "/"); + } + + dprintf(("\nresulting enc path = %s\n", enc_path)); + if (stat(buf, &sb) != 0) { + warn("cannot stat file %s", enc_path); + return (PEFS_ERR_SYS); + } + + /* + * XXXgpf: [TODO] deal with other types of files + */ + + if (S_ISREG(sb.st_mode) == 0) { + pefs_warn("filename: %s is not a regular file", enc_path); + return (PEFS_ERR_INVALID); + } + + strlcpy(fhp->path, enc_path, sizeof(fhp->path)); + strlcat(fhp->path, "\n", sizeof(fhp->path)); + return (0); +} + +static int +pefs_write_to_checklist(int fdout, struct file_header *fhp) +{ + uint32_t bytes, len; + + len = strnlen(fhp->path, sizeof(fhp->path)); + bytes = write(fdout, fhp->path, len); + if (bytes != len) { + warn("error writing '%s' to checklist file", fhp->path); + return (PEFS_ERR_IO); + } + + return (0); +} + +/* + * This function creates the checklist that will be used by pefs_addchecksum. + * For each file entry: + * 1) semantic checks: residing in pefs filesystem & regular file type checks. + * 2) the encrypted fullpath of the file is retrieved + * 3) entry is written to checklist_file + */ +int +pefs_create_checklist(FILE *fpin, int fdout, char *fsroot, char *fromfsroot) +{ + struct statfs fs; + struct file_header *fhp; + int error; + + if (statfs(fsroot, &fs) == -1) { + pefs_warn("statfs failed: %s: %s", fsroot, strerror(errno)); + return (PEFS_ERR_SYS); + } + + while((fhp = pefs_next_file(fpin, &error)) != NULL) { + error = pefs_file_semantic_checks(fhp, &fs); + if (error != 0) + return error; + + error = pefs_get_enc_path(fhp, fsroot, fromfsroot); + if (error != 0) + return error; + + error = pefs_write_to_checklist(fdout, fhp); + if (error != 0) + return error; + + free(fhp); + } + + /* error during pefs_next_file() */ + if (error != 0) + return error; + + return (0); +} Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Wed May 23 14:06:49 2012 (r236201) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Wed May 23 14:45:39 2012 (r236202) @@ -76,6 +76,7 @@ static int pefs_showchains(int argc, char *argv[]); static int pefs_showalgs(int argc, char *argv[]); static int pefs_addchecksum(int argc, char *argv[]); +static int pefs_addchecklist(int argc, char *argv[]); typedef int (*command_func_t)(int argc, char **argv); typedef int (*keyop_func_t)(struct pefs_keychain_head *kch, int fd, @@ -103,6 +104,7 @@ { "showchains", pefs_showchains }, { "showalgs", pefs_showalgs }, { "addchecksum", pefs_addchecksum}, + { "addchecklist", pefs_addchecklist}, { NULL, NULL }, }; @@ -142,6 +144,16 @@ exit(PEFS_ERR_INVALID); } +static void +initfsroots(int argc, char **argv, int flags, char *fsroot, char *fromfsroot, size_t size) +{ + if (!checkargs_fs(argc, argv)) + pefs_usage(); + + if (pefs_getfsroots(argv[0], flags, fsroot, fromfsroot, size) != 0) + exit(PEFS_ERR_INVALID); +} + static int openx_rdonly(const char *path) { @@ -996,6 +1008,26 @@ return (0); } +/* + * XXXgpf: Instead of a man page entry: + * + * pefs addchecksum [-a algo] [-i inputfile] filesystem + * + * $command creates .pefs.checksum db file in root of filesystem. + * This file will contain all checksums necessary to check integrity + * of files upon access. + * + * algo is the name of the algorithm to be used as a cryptographic + * hash function; supported algorithms: sha256, sha512. + * + * inputfile contains list of files that need integrity checking. + * This should be the outputfile of `pefs addchecklist`. + * + * When $command is run, filesystem should *not* be already + * mounted with pefs so that hashes are calculated for ciphertexts + * and not plain texts. + * + */ static int pefs_addchecksum(int argc, char *argv[]) { @@ -1008,7 +1040,7 @@ /* by default use sha256 */ algo = supported_digests[0]; - while ((i = getopt(argc, argv, "a:f:")) != -1) + while ((i = getopt(argc, argv, "a:i:")) != -1) switch(i) { case 'a': for (j=0; j < PEFS_SUPPORTED_DIGESTS; j++) @@ -1022,7 +1054,7 @@ return (PEFS_ERR_INVALID); } break; - case 'f': + case 'i': fpin = fopen(optarg, "r"); if (fpin == NULL) { warn("cannot open inputfile: %s", optarg); @@ -1036,11 +1068,15 @@ argv += optind; if (fpin == NULL) { - pefs_warn("please supply an input file [-f]"); + pefs_warn("please supply an input file [-i]"); return (PEFS_ERR_USAGE); } - initfsroot(argc, argv, 0, fsroot, sizeof(fsroot)); + /* XXXgpf: [TODO] probably check that fsroot is not mounted */ + if (!checkargs_fs(argc, argv)) + pefs_usage(); + + strlcpy(fsroot, argv[0], sizeof(fsroot)); error = pefs_create_checksum_file(fpin, fsroot, algo); @@ -1049,6 +1085,101 @@ return (error); } +/* + * XXXgpf: Instead of a man page entry + * + * pefs addchecklist [-i inputfile] [-o outputfile] filesystem + * + * $command creates an outputfile that may be supplied to + * `pefs addchecksum`. + * + * inputfile contains list of files that need integrity checking. + * Entries of this file list are just filepaths. Only one entry per line + * is allowed. + * e.g. "/mnt/my_file.txt\n" + * + * outputfile will be created and it will contain the same list of files, + * but encrypted filenames will be used instead. + * + * filesystem should be already mounted and key already supplied, so that + * filenames are decrypted. However, it must *not* be mounted on the same + * directory so that both decrypted and encrypted filenames exist at the + * same time in the system. + * + * A proper way of ensuring integrity checks for a pefs filesystem would be: + * + * pefs mount /usr/home/paul/priv.enc /mnt + * pefs addkey -c /mnt + * ./my_script > filelist.txt + * pefs addchecklist -i filelist.txt pefs_filelist /mnt + * pefs unmount /mnt + * pefs addchecksum -i pefs_filelist /usr/home/paul/p.enc + * pefs mount -o checksum=yes /usr/home/paul/priv.enc /any/path + * + */ +static int +pefs_addchecklist(int argc, char *argv[]) +{ + char fsroot[MAXPATHLEN], fromfsroot[MAXPATHLEN]; + char output_file[MAXPATHLEN]; + FILE *fpin; + int error, fdout, i; + + fpin = NULL; + fdout = -1; + + while ((i = getopt(argc, argv, "i:o:")) != -1) + switch(i) { + case 'i': + fpin = fopen(optarg, "r"); + if (fpin == NULL) { + warn("cannot open inputfile: %s", optarg); + return (PEFS_ERR_INVALID); + } + break; + case 'o': + strlcpy(output_file, optarg, sizeof(output_file)); + fdout = open(output_file, O_WRONLY | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); + if (fdout == -1) { + warn("cannot open %s", optarg); + return (PEFS_ERR_IO); + } + break; + default: + pefs_usage(); + } + argc -= optind; + argv += optind; + + if (fpin == NULL) { + pefs_warn("please supply an input file [-i]"); + return (PEFS_ERR_USAGE); + } + + if (fdout == -1) { + pefs_warn("please supply an output file [-o]"); + return (PEFS_ERR_USAGE); + } + + initfsroots(argc, argv, 0, fsroot, fromfsroot, sizeof(fsroot)); + + if (strcmp(fsroot, fromfsroot) == 0) { + pefs_warn("filesystem: %s must not be mounted upon itself!\n", fromfsroot); + unlink(output_file); + return (PEFS_ERR_USAGE); + } + + error = pefs_create_checklist(fpin, fdout, fsroot, fromfsroot); + + fclose(fpin); + close(fdout); + + if (error != 0) + unlink(output_file); + + return (error); +} + static void pefs_usage_alg(void) { @@ -1074,7 +1205,8 @@ " pefs randomchain [-fv] [-n min] [-N max] filesystem\n" " pefs showchains [-fp] [-i iterations] [-k keyfile] filesystem\n" " pefs showalgs\n" -" pefs addchecksum [-a algo] [-f inputfile] filesystem\n" +" pefs addchecksum [-a algo] [-i inputfile] filesystem\n" +" pefs addchecklist [-i inputfile] [-o outputfile[ filesystem\n" ); exit(PEFS_ERR_USAGE); } Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.h ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.h Wed May 23 14:06:49 2012 (r236201) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.h Wed May 23 14:45:39 2012 (r236202) @@ -84,6 +84,8 @@ void pefs_warn(const char *, ...) __printf0like(1, 2); int pefs_getfsroot(const char *path, int flags, char *fsroot, size_t size); +int pefs_getfsroots(const char *path, int flags, char *fsroot, + char * fromfsroot, size_t size); int pefs_key_generate(struct pefs_xkey *xk, const char *passphrase, struct pefs_keyparam *kp); @@ -93,6 +95,7 @@ const struct pefs_xkey *xk_parent); uintmax_t pefs_keyid_as_int(char *keyid); int pefs_create_checksum_file(FILE *fpin, char *fsroot, const char *algo); +int pefs_create_checklist(FILE *fpin, int fdout, char *fsroot, char *fromfsroot); const char * pefs_alg_name(struct pefs_xkey *xk); void pefs_alg_list(FILE *stream); Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_subr.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_subr.c Wed May 23 14:06:49 2012 (r236201) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_subr.c Wed May 23 14:45:39 2012 (r236202) @@ -73,3 +73,34 @@ return (0); } + +int +pefs_getfsroots(const char *path, int flags, char *fsroot, char * fromfsroot, size_t size) +{ + struct statfs fs; + const char *realfsroot, *realfromfsroot; + + if (statfs(path, &fs) == -1) { + pefs_warn("statfs failed: %s: %s", path, strerror(errno)); + return (PEFS_ERR_SYS); + } + + realfsroot = fs.f_mntonname; + if (strcmp(PEFS_FSTYPE, fs.f_fstypename) != 0) { + if ((flags & PEFS_FS_IGNORE_TYPE) != 0) + realfsroot = path; + else { + pefs_warn("invalid file system type: %s", path); + return (PEFS_ERR_INVALID); + } + } + + realfromfsroot = fs.f_mntfromname; + if (fromfsroot != NULL) + strlcpy(fromfsroot, realfromfsroot, size); + + if (fsroot != NULL) + strlcpy(fsroot, realfsroot, size); + + return (0); +} From owner-svn-soc-all@FreeBSD.ORG Wed May 23 14:50:26 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 9C77A106564A for ; Wed, 23 May 2012 14:50:24 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 23 May 2012 14:50:24 +0000 Date: Wed, 23 May 2012 14:50:24 +0000 From: gpf@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120523145024.9C77A106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r236203 - soc2012/gpf/pefs_kmod/sbin/pefs X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 May 2012 14:50:26 -0000 Author: gpf Date: Wed May 23 14:50:24 2012 New Revision: 236203 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236203 Log: forgot to remove var fsroot which isn't needed now as semantic checks have been moved to addchecklist(). Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Wed May 23 14:45:39 2012 (r236202) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Wed May 23 14:50:24 2012 (r236203) @@ -350,19 +350,13 @@ * B3) file entry is added to hash table. (separate chaining is used) */ static int -pefs_create_in_memory_db(FILE *fpin, char *fsroot, const EVP_MD *md, uint8_t hash_len, +pefs_create_in_memory_db(FILE *fpin, const EVP_MD *md, uint8_t hash_len, struct hash_table *checksum_hash_tablep) { - struct statfs fs; struct file_header *fhp; int error; uint32_t nfiles; - if (statfs(fsroot, &fs) == -1) { - pefs_warn("statfs failed: %s: %s", fsroot, strerror(errno)); - return (PEFS_ERR_SYS); - } - error = pefs_count_file_entries(fpin, &nfiles); if (error != 0) return (error); @@ -421,7 +415,7 @@ return (PEFS_ERR_IO); } - error = pefs_create_in_memory_db(fpin, fsroot, md, hash_len, + error = pefs_create_in_memory_db(fpin, md, hash_len, &checksum_hash_table); if (error != 0) goto out; From owner-svn-soc-all@FreeBSD.ORG Wed May 23 14:58:15 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 7D9A31065674 for ; Wed, 23 May 2012 14:58:14 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 23 May 2012 14:58:14 +0000 Date: Wed, 23 May 2012 14:58:14 +0000 From: gpf@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120523145814.7D9A31065674@hub.freebsd.org> Cc: Subject: socsvn commit: r236204 - soc2012/gpf/pefs_kmod/sbin/pefs X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 May 2012 14:58:15 -0000 Author: gpf Date: Wed May 23 14:58:13 2012 New Revision: 236204 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236204 Log: code refactoring Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Wed May 23 14:50:24 2012 (r236203) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Wed May 23 14:58:13 2012 (r236204) @@ -381,13 +381,9 @@ return error; } - /* error during pefs_next_file() */ - if (error != 0) - return error; - pefs_print_hash_table(checksum_hash_tablep, hash_len); - return (0); + return (error); } int @@ -519,7 +515,6 @@ /* * XXXgpf: [TODO] deal with other types of files */ - if (S_ISREG(sb.st_mode) == 0) { pefs_warn("filename: %s is not a regular file", enc_path); return (PEFS_ERR_INVALID); @@ -527,6 +522,7 @@ strlcpy(fhp->path, enc_path, sizeof(fhp->path)); strlcat(fhp->path, "\n", sizeof(fhp->path)); + return (0); } @@ -559,6 +555,8 @@ struct file_header *fhp; int error; + error = 0; + if (statfs(fsroot, &fs) == -1) { pefs_warn("statfs failed: %s: %s", fsroot, strerror(errno)); return (PEFS_ERR_SYS); @@ -567,22 +565,22 @@ while((fhp = pefs_next_file(fpin, &error)) != NULL) { error = pefs_file_semantic_checks(fhp, &fs); if (error != 0) - return error; + goto out; error = pefs_get_enc_path(fhp, fsroot, fromfsroot); if (error != 0) - return error; + goto out; error = pefs_write_to_checklist(fdout, fhp); if (error != 0) - return error; + goto out; free(fhp); } - /* error during pefs_next_file() */ - if (error != 0) - return error; +out: + if (fhp != NULL) + free(fhp); - return (0); + return (error); } From owner-svn-soc-all@FreeBSD.ORG Wed May 23 17:03:03 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 84956106564A for ; Wed, 23 May 2012 17:03:01 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 23 May 2012 17:03:01 +0000 Date: Wed, 23 May 2012 17:03:01 +0000 From: scher@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120523170301.84956106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r236215 - soc2012/scher/par_ports/head/Mk X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 May 2012 17:03:03 -0000 Author: scher Date: Wed May 23 17:03:01 2012 New Revision: 236215 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236215 Log: [new_feature] directory locking targets Two directory locking targets (do-lock, do-unlock) are implemented in bsd.parallel.mk file. This targets provide atomic locking/unlocking technique to lock/unlock a directory specified by ${_parv_DIR_TO_LOCK} variable. Submitted by: Alexander Pronin Added: soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Added: soc2012/scher/par_ports/head/Mk/bsd.parallel.mk ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Wed May 23 17:03:01 2012 (r236215) @@ -0,0 +1,83 @@ +#-*- mode: Fundamental; tab-width: 4; -*- +# ex:ts=4 +# +# $FreeBSD$ +# +# Please view me with 4 column tabs! + +.include + + +_dparv_= +_parv_= +################# +# Debugging specific tools and variable declarations +_dparv_START_OUTPUT_MESSAGE= "=================_PAR_PORTS_SPECIFIC_OUTPUT_==============" +_dparv_END_OUTPUT_MESSAGE= "==============_END_OF_PAR_PORTS_SPECIFIC_OUTPUT_==============" + +_dparv_START_OUTPUT= ${ECHO_CMD} ${_dparv_START_OUTPUT_MESSAGE} +_dparv_END_OUTPUT= ${ECHO_CMD} ${_dparv_END_OUTPUT_MESSAGE} +################# + + +################# +# Commands +_parv_KILL= /bin/kill +_parv_KILL_FLAGS= -- +################# +# Locking variables and tools +_parv_DIR_TO_LOCK?=${PORTSDIR}/tmp +_parv_LOCK_FILE= ${_parv_DIR_TO_LOCK}/.lock + +_parv_WAIT_FOR_LOCK_TIME= 5 + +# Senquence of commands to lock a directory using ${_parv_LOCK_FILE}. +# During evaluation of the following commands lockf(1) is holding lock on ${_parv_LOCK_FILE} file. +# Hence NO other process is able to evaluate any commands using lockf(1) +# locking on the same ${_parv_LOCK_FILE} file. +# +# Stalled locks cheking enabled. +# +# If the directory is locked then make process will be terminated with 143 exit code. +# +_parv_LOCK_SEQ= \ + pid=$$(${CAT} ${_parv_LOCK_FILE}); \ + if [ $${pid} ]; then \ + pgrep -P $${pid} > /dev/null; \ + status=$$(${ECHO_CMD} $$?); \ + if [ $${status} -eq 0 ]; then \ + ${_dparv_START_OUTPUT}; \ + ${ECHO_CMD} Unable to lock ${_parv_DIR_TO_LOCK}; \ + ${ECHO_CMD} Dir: ${_parv_DIR_TO_LOCK} is already locked by another working process ...; \ + ${_dparv_END_OUTPUT}; \ + ${_parv_KILL} ${_parv_KILL_FLAGS} -${.MAKE.PID}; \ + else \ + ${_dparv_START_OUTPUT}; \ + ${ECHO_CMD} Dir: ${_parv_DIR_TO_LOCK} Stalled lock Detected!; \ + ${ECHO_CMD} Deleting stalled lock; \ + ${ECHO_CMD} Locking: ${_parv_DIR_TO_LOCK}; \ + ${_dparv_END_OUTPUT}; \ + ${ECHO_CMD} ${.MAKE.PID} > ${_parv_LOCK_FILE}; \ + fi; \ + else \ + ${_dparv_START_OUTPUT}; \ + ${ECHO_CMD} Locking: ${_parv_DIR_TO_LOCK}; \ + ${_dparv_END_OUTPUT}; \ + ${ECHO_CMD} ${.MAKE.PID} > ${_parv_LOCK_FILE}; \ + fi; \ +################# + + +do-lock: + @lockf -k -t ${_parv_WAIT_FOR_LOCK_TIME} ${_parv_LOCK_FILE} ${SH} -c '${_parv_LOCK_SEQ}' || ( \ + ${_dparv_START_OUTPUT}; \ + ${ECHO_CMD} "Unable to lock ${_parv_DIR_TO_LOCK}"; \ + ${ECHO_CMD} "Lock file: ${_parv_LOCK_FILE} is alredy locked by another working process ..."; \ + ${_dparv_END_OUTPUT}; \ + ${_parv_KILL} ${_parv_KILL_FLAGS} -${.MAKE.PID}; \ + ); \ + +# In this target there is no timeout, because if it is necessary to unlock dir then +# this process has to wait until all other registered to lockf(1) operation processes do their stuff. +do-unlock: + @lockf -k ${_parv_LOCK_FILE} ${RM} ${_parv_LOCK_FILE} From owner-svn-soc-all@FreeBSD.ORG Wed May 23 17:05:22 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 179F8106566C for ; Wed, 23 May 2012 17:05:20 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 23 May 2012 17:05:20 +0000 Date: Wed, 23 May 2012 17:05:20 +0000 From: gmiller@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120523170520.179F8106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r236216 - soc2012/gmiller/locking-head/lib/libthr X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 May 2012 17:05:22 -0000 Author: gmiller Date: Wed May 23 17:05:19 2012 New Revision: 236216 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236216 Log: Wire lib_profile.a into the build for make, make clean, and make install. Modified: soc2012/gmiller/locking-head/lib/libthr/Makefile Modified: soc2012/gmiller/locking-head/lib/libthr/Makefile ============================================================================== --- soc2012/gmiller/locking-head/lib/libthr/Makefile Wed May 23 17:03:01 2012 (r236215) +++ soc2012/gmiller/locking-head/lib/libthr/Makefile Wed May 23 17:05:19 2012 (r236216) @@ -65,3 +65,35 @@ .endif .include + +.SUFFIXES: .pro + +PRO_FLAGS = -DLOCK_PROFILING + +_LIBS += libthr_profile.a + +.c.pro: + ${CC} ${PRO_FLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} + +.S.pro: + ${CC} ${PRO_FLAGS} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET} + +PROBJS = ${OBJS:.o=.pro} +CLEANFILES += ${PROBJS} thr_profile.a thr_profile_p.a + +libthr_profile.a: ${PROBJS} + @${ECHO} building lock profiling library libthr_profile.a + @rm -f ${.TARGET} +.if !defined(NM) + @${AR} cq ${.TARGET} `lorder ${PROBJS} | tsort -q` ${ARADD} +.else + @${AR} cq ${.TARGET} `NM='${NM}' lorder ${PROBJS} | tsort -q` ${ARADD} +.endif + + ${RANLIB} ${.TARGET} + +all: libthr_profile.a + +realinstall: + ${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + ${_INSTALLFLAGS} libthr_profile.a ${DESTDIR}${LIBDIR} From owner-svn-soc-all@FreeBSD.ORG Wed May 23 20:47:09 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 806D5106566C for ; Wed, 23 May 2012 20:47:07 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 23 May 2012 20:47:07 +0000 Date: Wed, 23 May 2012 20:47:07 +0000 From: scher@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120523204707.806D5106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r236228 - soc2012/scher/par_ports/head/Mk X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 May 2012 20:47:09 -0000 Author: scher Date: Wed May 23 20:47:06 2012 New Revision: 236228 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236228 Log: [new_feature] ${PKG_DBDIR} and ${.CURDIR} specific lock/unlock [fixed] do-lock do-unlock targets are depricated It is possible to lock/unlock ${PKG_DBDIR} and ${.CURDIR} For loop generates directory specific variable: _parv_PKG_DBDIR_DO_LOCK - lockf command to lock ${PKG_DBDIR} _parv_.CURDIR_DO_LOCK - lockf command to lock ${.CURDIR} _parv_PKG_DBDIR_LOCK_SEQ, _parv_.CURDIR_LOCK_SEQ - sequences of commandes passed to ${SH} lockf command argument. e.g. lockf .lock_file ${SH} -c '_parv_PKG_DBDIR_LOCK_SEQ' _parv_PKG_DBDIR_DO_UNLOCK, _parv_.CURDIR_DO_UNLOCK - lockf command to unlock directories. --------------------------------- do-lock, do-unlock targets are depricated. Their shell scriptes were delegated to above mentioned XXX_DO_LOCK and XXX_DO_UNLOCK variables. Reason: It is necessary to provide locking/unlocking from inside other targets. Usage of locking/unlocking features as dependency targets is insufficient. Modified: soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Modified: soc2012/scher/par_ports/head/Mk/bsd.parallel.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Wed May 23 19:25:46 2012 (r236227) +++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Wed May 23 20:47:06 2012 (r236228) @@ -10,26 +10,32 @@ _dparv_= _parv_= -################# +##################################################### # Debugging specific tools and variable declarations _dparv_START_OUTPUT_MESSAGE= "=================_PAR_PORTS_SPECIFIC_OUTPUT_==============" _dparv_END_OUTPUT_MESSAGE= "==============_END_OF_PAR_PORTS_SPECIFIC_OUTPUT_==============" _dparv_START_OUTPUT= ${ECHO_CMD} ${_dparv_START_OUTPUT_MESSAGE} _dparv_END_OUTPUT= ${ECHO_CMD} ${_dparv_END_OUTPUT_MESSAGE} -################# +# End of Debugging specific tools and variable declarations section +##################################################### -################# +##################################################### # Commands _parv_KILL= /bin/kill _parv_KILL_FLAGS= -- -################# + +DO_NADA?= ${TRUE} +# End of Commands section +##################################################### +##################################################### # Locking variables and tools -_parv_DIR_TO_LOCK?=${PORTSDIR}/tmp -_parv_LOCK_FILE= ${_parv_DIR_TO_LOCK}/.lock +PKG_DBDIR?= /var/db/pkg +_parv_LOCK_FILE= .lock _parv_WAIT_FOR_LOCK_TIME= 5 +_parv_WAIT_FOR_UNLOCK_TIME= 15 # Senquence of commands to lock a directory using ${_parv_LOCK_FILE}. # During evaluation of the following commands lockf(1) is holding lock on ${_parv_LOCK_FILE} file. @@ -39,45 +45,82 @@ # Stalled locks cheking enabled. # # If the directory is locked then make process will be terminated with 143 exit code. +# If ${_parv_LOCK_FILE} is locked then make process will be terminated with 143 exit code. +# +# For loop produces two varuables: +# _parv_PKG_DBDIR_LOCK_SEQ +# _parv_.CURDIR_LOCK_SEQ +# as sequencies of commands to provide locking of ${PKG_DBDIR} and ${.CURDIR} accordingly. +# +# ${${_lock_dir}} == ${PKG_DBDIR} OR ${.CURDIR} +# +.for _lock_dir in PKG_DBDIR .CURDIR +# _parv_PKG_DBDIR_LOCK_SEQ +# _parv_.CURDIR_LOCK_SEQ # -_parv_LOCK_SEQ= \ - pid=$$(${CAT} ${_parv_LOCK_FILE}); \ +_parv_${_lock_dir}_LOCK_SEQ= \ + pid=$$(${CAT} ${${_lock_dir}}/${_parv_LOCK_FILE}); \ if [ $${pid} ]; then \ pgrep -P $${pid} > /dev/null; \ status=$$(${ECHO_CMD} $$?); \ if [ $${status} -eq 0 ]; then \ ${_dparv_START_OUTPUT}; \ - ${ECHO_CMD} Unable to lock ${_parv_DIR_TO_LOCK}; \ - ${ECHO_CMD} Dir: ${_parv_DIR_TO_LOCK} is already locked by another working process ...; \ + ${ECHO_CMD} Unable to lock ${${_lock_dir}}; \ + ${ECHO_CMD} Dir: ${${_lock_dir}} is already locked by another working process ...; \ ${_dparv_END_OUTPUT}; \ ${_parv_KILL} ${_parv_KILL_FLAGS} -${.MAKE.PID}; \ else \ ${_dparv_START_OUTPUT}; \ - ${ECHO_CMD} Dir: ${_parv_DIR_TO_LOCK} Stalled lock Detected!; \ + ${ECHO_CMD} Dir: ${${_lock_dir}} Stalled lock Detected!; \ ${ECHO_CMD} Deleting stalled lock; \ - ${ECHO_CMD} Locking: ${_parv_DIR_TO_LOCK}; \ + ${ECHO_CMD} Locking: ${${_lock_dir}}; \ ${_dparv_END_OUTPUT}; \ - ${ECHO_CMD} ${.MAKE.PID} > ${_parv_LOCK_FILE}; \ + ${ECHO_CMD} ${.MAKE.PID} > ${${_lock_dir}}/${_parv_LOCK_FILE}; \ fi; \ else \ ${_dparv_START_OUTPUT}; \ - ${ECHO_CMD} Locking: ${_parv_DIR_TO_LOCK}; \ + ${ECHO_CMD} Locking: ${${_lock_dir}}; \ ${_dparv_END_OUTPUT}; \ - ${ECHO_CMD} ${.MAKE.PID} > ${_parv_LOCK_FILE}; \ - fi; \ -################# + ${ECHO_CMD} ${.MAKE.PID} > ${${_lock_dir}}/${_parv_LOCK_FILE}; \ + fi +# _parv_PKG_DBDIR_DO_LOCK +# _parv_.CURDIR_DO_LOCK +# +_parv_${_lock_dir}_DO_LOCK= \ + lockf -k -t ${_parv_WAIT_FOR_LOCK_TIME} ${${_lock_dir}}/${_parv_LOCK_FILE} ${SH} -c '${_parv_${_lock_dir}_LOCK_SEQ}' || ( \ + ${_dparv_START_OUTPUT}; \ + ${ECHO_CMD} "Unable to lock ${${_lock_dir}}"; \ + ${ECHO_CMD} "Lock file: ${${_lock_dir}}/${_parv_LOCK_FILE} is alredy locked by another working process ..."; \ + ${_dparv_END_OUTPUT}; \ + ${_parv_KILL} ${_parv_KILL_FLAGS} -${.MAKE.PID}; \ + ) -do-lock: - @lockf -k -t ${_parv_WAIT_FOR_LOCK_TIME} ${_parv_LOCK_FILE} ${SH} -c '${_parv_LOCK_SEQ}' || ( \ +# _parv_PKG_DBDIR_DO_UNLOCK +# _parv_.CURDIR_DO_UNLOCK +# +_parv_${_lock_dir}_DO_UNLOCK= ( \ + lockf -k -t ${_parv_WAIT_FOR_UNLOCK_TIME} ${${_lock_dir}}/${_parv_LOCK_FILE} ${RM} ${${_lock_dir}}/${_parv_LOCK_FILE} || \ + ( \ ${_dparv_START_OUTPUT}; \ - ${ECHO_CMD} "Unable to lock ${_parv_DIR_TO_LOCK}"; \ - ${ECHO_CMD} "Lock file: ${_parv_LOCK_FILE} is alredy locked by another working process ..."; \ + ${ECHO_CMD} Unable to unlock ${${_lock_dir}}; \ ${_dparv_END_OUTPUT}; \ ${_parv_KILL} ${_parv_KILL_FLAGS} -${.MAKE.PID}; \ - ); \ + ) \ +) && ( \ + ${_dparv_START_OUTPUT}; \ + ${ECHO_CMD} "Dir: ${${_lock_dir}} is unloked"; \ + ${_dparv_END_OUTPUT}; \ +) + +.endfor # _lock_dir in PKG_DBDIR .CURDIR + +# End of Locking variables and tools section +##################################################### + +do-lock: + @${DO_NADA} -# In this target there is no timeout, because if it is necessary to unlock dir then -# this process has to wait until all other registered to lockf(1) operation processes do their stuff. do-unlock: - @lockf -k ${_parv_LOCK_FILE} ${RM} ${_parv_LOCK_FILE} + @${DO_NADA} + From owner-svn-soc-all@FreeBSD.ORG Wed May 23 20:59:33 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id AA7891065672 for ; Wed, 23 May 2012 20:59:31 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 23 May 2012 20:59:31 +0000 Date: Wed, 23 May 2012 20:59:31 +0000 From: gpf@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120523205931.AA7891065672@hub.freebsd.org> Cc: Subject: socsvn commit: r236229 - soc2012/gpf/misc X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 May 2012 20:59:33 -0000 Author: gpf Date: Wed May 23 20:59:30 2012 New Revision: 236229 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236229 Log: test_checksum.c to test validity of .pefs.checksum file. output from this program's pefs_print_hash_table() should be checked against output from sbin/pefs' pefs_print_hash_table(). They should match of course. Code just passed a test with a 100 files. Added: soc2012/gpf/misc/ soc2012/gpf/misc/test_checksum.c Added: soc2012/gpf/misc/test_checksum.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/gpf/misc/test_checksum.c Wed May 23 20:59:30 2012 (r236229) @@ -0,0 +1,412 @@ +/*- + * Copyright (c) 2012 Efstratios Karatzas + * 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 +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define PEFS_INTEGRITY_DEBUG +#if defined (PEFS_INTEGRITY_DEBUG) +#define dprintf(a) printf a +#else +#define dprintf(a) (void)0 +#endif + +#define NARGS 2 +#define ERROR 1 +#define MAXPATHLEN 1024 +#define PEFS_CHECKSUM_FILE_VERSION 0xDD +#define PEFS_HASH_BYTE_ALIGNMENT 512 + +LIST_HEAD(file_header_head, file_header); +TAILQ_HEAD(checksum_head, checksum); + +struct checksum_file_header { + uint8_t version; + uint8_t reserved; + uint8_t hash_len; + uint8_t hash_algo[8]; + uint8_t offset_to_hash_table; + uint32_t hash_table_size; +}; + +struct checksum { + unsigned char *hash; + TAILQ_ENTRY(checksum) checksum_entries; +}; + +struct file_header { + uint32_t nhashes; + uint64_t file_id; + char path[MAXPATHLEN]; + LIST_ENTRY(file_header) bucket_entries; + uint32_t offset_to_checksums; + struct checksum_head checksums; +}; + +struct bucket { + struct file_header_head file_headers; + uint32_t offset_to_chain; + uint32_t nelements; + uint32_t elements_loaded; +}; + +struct hash_table { + struct bucket *buckets; + uint32_t size; /* how many buckets */ + uint32_t nelements; +}; + + +static int +pefs_allocate_hash_table(struct hash_table *checksum_hash_tablep, uint32_t size) +{ + uint32_t i; + + checksum_hash_tablep->size = size; + checksum_hash_tablep->buckets = malloc (size * sizeof(struct bucket)); + + if (checksum_hash_tablep->buckets == NULL) { + perror("memory allocation error"); + return (ERROR); + } + + for (i = 0; i < checksum_hash_tablep->size; i++) { + checksum_hash_tablep->buckets[i].nelements = 0; + checksum_hash_tablep->buckets[i].elements_loaded = 0; + LIST_INIT(&(checksum_hash_tablep->buckets[i].file_headers)); + } + + return (0); +} + +static void +pefs_add_to_bucket(struct bucket *bucketp, struct file_header *fhp) +{ + struct file_header *elementp; + struct file_header *last; + + if (bucketp->elements_loaded == 0) + LIST_INSERT_HEAD(&(bucketp->file_headers), fhp, bucket_entries); + else { + LIST_FOREACH(elementp, &(bucketp->file_headers), bucket_entries) { + last = elementp; + } + LIST_INSERT_AFTER(last, fhp, bucket_entries); + } + + bucketp->elements_loaded++; +} + +static void +pefs_add_to_file_header(struct file_header *fhp, struct checksum *csp) +{ + TAILQ_INSERT_TAIL(&(fhp->checksums), csp, checksum_entries); +} + +/* for debugging purposes */ +static void +pefs_print_hash_table(struct hash_table *checksum_hash_tablep, uint8_t hash_len) +{ + struct file_header *fhp; + struct checksum *csp; + uint32_t i,j; + + printf("\n+++Printing Hash Table+++\n\n"); + for (i = 0; i < checksum_hash_tablep->size; i++) { + printf("\nbucket %d with elements: %u\n", i, checksum_hash_tablep->buckets[i].nelements); + LIST_FOREACH(fhp, &(checksum_hash_tablep->buckets[i].file_headers), bucket_entries) { + printf("\tid = %d!\tnhashes = %d\n", (int)fhp->file_id, fhp->nhashes); + TAILQ_FOREACH(csp, &(fhp->checksums), checksum_entries) { + printf("\t\tdigest="); + for (j = 0; j < hash_len; j++) + printf("%02x", csp->hash[j]); + printf("\n"); + } + } + } +} + +static int +pefs_read_checksum_file_header(int fdin, struct checksum_file_header *cfhp) +{ + uint32_t bytes, hash_table_size; + + bytes = read(fdin, &(cfhp->version), sizeof(cfhp->version)); + if (bytes != sizeof(cfhp->version)) { + perror("error reading from .pefs.checksum"); + return (ERROR); + } + + bytes = read(fdin, &(cfhp->reserved), sizeof(cfhp->reserved)); + if (bytes != sizeof(cfhp->reserved)) { + perror("error reading from .pefs.checksum"); + return (ERROR); + } + + bytes = read(fdin, &(cfhp->hash_len), sizeof(cfhp->hash_len)); + if (bytes != sizeof(cfhp->hash_len)) { + perror("error reading from .pefs.checksum"); + return (ERROR); + } + + bytes = read(fdin, cfhp->hash_algo, sizeof(cfhp->hash_algo)); + if (bytes != sizeof(cfhp->hash_algo)) { + perror("error reading from .pefs.checksum"); + return (ERROR); + } + + bytes = read(fdin, &(cfhp->offset_to_hash_table), sizeof(cfhp->offset_to_hash_table)); + if (bytes != sizeof(cfhp->offset_to_hash_table)) { + perror("error reading from .pefs.checksum"); + return (ERROR); + } + + bytes = read(fdin, &hash_table_size, sizeof(hash_table_size)); + if (bytes != sizeof(hash_table_size)) { + perror("error reading from .pefs.checksum"); + return (ERROR); + } + cfhp->hash_table_size = le32toh(hash_table_size); + + dprintf(("+++printing checksum file header info+++\n")); + dprintf(("version %X\nhash_len %d\nhash_algo %s\n", cfhp->version, cfhp->hash_len, cfhp->hash_algo)); + dprintf(("offset to hash table %d\nhash table size %d\n", cfhp->offset_to_hash_table, cfhp->hash_table_size)); + + return (0); +} + +static int +pefs_read_bucket(int fdin, struct bucket *bp, uint32_t *buckets_offset) +{ + uint32_t offset_to_chain, nelements; + int bytes; + + //dprintf(("bucket offset = %d\n", *buckets_offset)); + + bytes = pread(fdin, &offset_to_chain, sizeof(offset_to_chain), *buckets_offset); + if (bytes != sizeof(offset_to_chain)) { + perror("error reading from .pefs.checksum"); + return (ERROR); + } + bp->offset_to_chain = le32toh(offset_to_chain); + (*buckets_offset)+= sizeof(offset_to_chain); + + bytes = pread(fdin, &nelements, sizeof(nelements), *buckets_offset); + if (bytes != sizeof(nelements)) { + perror("error reading from .pefs.checksum"); + return (ERROR); + } + bp->nelements = le32toh(nelements); + (*buckets_offset)+= sizeof(nelements); + + //dprintf(("\n++priting bucket info++\n")); + //dprintf(("offset to chain %d\nnelements %d\n", bp->offset_to_chain, bp->nelements)); + + return (0); +} + +static int +pefs_read_file_header(int fdin, struct file_header *fhp, uint32_t *fh_offset) +{ + uint64_t file_id; + uint32_t nhashes, offset_to_checksums; + int bytes; + + bytes = pread(fdin, &nhashes, sizeof(nhashes), *fh_offset); + if (bytes != sizeof(nhashes)) { + perror("error reading from .pefs.checksum"); + return (ERROR); + } + fhp->nhashes = le32toh(nhashes); + (*fh_offset)+= sizeof(nhashes); + + bytes = pread(fdin, &offset_to_checksums, sizeof(offset_to_checksums), *fh_offset); + if (bytes != sizeof(offset_to_checksums)) { + perror("error reading from .pefs.checksum"); + return (ERROR); + } + fhp->offset_to_checksums = le32toh(offset_to_checksums); + (*fh_offset)+= sizeof(offset_to_checksums); + + bytes = pread(fdin, &file_id, sizeof(file_id), *fh_offset); + if (bytes != sizeof(file_id)) { + perror("error reading from .pefs.checksum"); + return (ERROR); + } + fhp->file_id = le64toh(file_id); + (*fh_offset)+= sizeof(file_id); + + //dprintf(("\nfile header offset = %d\n", *fh_offset)); + //dprintf(("\n++priting file header info++\n")); + //dprintf(("nhashes %d\noffset_to_checksums %d\n", fhp->nhashes, fhp->offset_to_checksums)); + //dprintf(("file id %d\n", (int)fhp->file_id)); + + return (0); +} + +static int +pefs_read_hash(int fdin, struct checksum *csp, uint32_t *hashes_offset, uint8_t hash_len) +{ + int bytes; + + bytes = pread(fdin, csp->hash, hash_len, *hashes_offset); + if (bytes != hash_len) { + perror("error reading from .pefs.checksum"); + return (ERROR); + } + (*hashes_offset)+= hash_len; + + //dprintf(("hashes offset = %d\n", *hashes_offset)); + //dprintf(("hash %s\n", csp->hash)); + + return (0); +} + +static int +pefs_read_checksum_file(int fdin, struct checksum_file_header *cfhp, struct hash_table *chtp) +{ + struct bucket *bp; + struct checksum *csp; + struct file_header *fhp; + uint32_t i, j, k, buckets_offset, fh_offset, hashes_offset; + int error; + + error = pefs_read_checksum_file_header(fdin, cfhp); + if (error != 0) + return (error); + + error = pefs_allocate_hash_table(chtp, cfhp->hash_table_size); + if (error != 0) + return (error); + + /* this points to where the buckets start */ + buckets_offset = cfhp->offset_to_hash_table; + + for (i = 0; i < chtp->size; i++) { + bp = &chtp->buckets[i]; + error = pefs_read_bucket(fdin, bp, &buckets_offset); + if (error != 0) + return (error); + + fh_offset = bp->offset_to_chain; + + for (j = 0; j < bp->nelements; j++) { + fhp = malloc(sizeof(struct file_header)); + if (fhp == NULL) { + perror("malloc"); + return (ERROR); + } + + error = pefs_read_file_header(fdin, fhp, &fh_offset); + if (error != 0) + return (ERROR); + + TAILQ_INIT(&(fhp->checksums)); + hashes_offset = fhp->offset_to_checksums; + pefs_add_to_bucket(bp, fhp); + + for (k = 0; k < fhp->nhashes; k++) { + csp = malloc(sizeof(struct checksum)); + if (csp == NULL) { + perror("malloc"); + return (ERROR); + } + csp->hash = malloc(cfhp->hash_len); + if (csp->hash == NULL) { + perror("malloc"); + return (ERROR); + } + + error = pefs_read_hash(fdin, csp, &hashes_offset, cfhp->hash_len); + if (error != 0) + return (error); + + pefs_add_to_file_header(fhp, csp); + } + } + } + + return (0); +} + +static void +usage(char *argv[]) +{ + printf("usage: %s /path/to/.pefs.checksum\n", argv[0]); +} + +/* + * XXXgpf: Purpose of code is to test validity of a .pefs.checksum file. + * Output from this program's pefs_print_hash_table() is checked against + * output from sbin/pefs' pefs_print_hash_table(). They should match. + * + */ +int +main(int argc, char *argv[]) +{ + char checksum_path[MAXPATHLEN]; + struct hash_table checksum_hash_table; + struct checksum_file_header cfh; + int error, fdin; + + if (argc != NARGS) { + usage(argv); + return (ERROR); + } + + strlcpy(checksum_path, argv[1], sizeof(checksum_path)); + fdin = open(checksum_path, O_RDONLY); + if (fdin == -1) { + perror("cannot open checksum file"); + return (ERROR); + } + + error = pefs_read_checksum_file(fdin, &cfh, &checksum_hash_table); + + /* this output should be the same as the one from sbin/pefs */ + pefs_print_hash_table(&checksum_hash_table, cfh.hash_len); + + close(fdin); + + return (error); +} From owner-svn-soc-all@FreeBSD.ORG Wed May 23 21:04:11 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 11BDC1065672 for ; Wed, 23 May 2012 21:04:09 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 23 May 2012 21:04:09 +0000 Date: Wed, 23 May 2012 21:04:09 +0000 From: gpf@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120523210409.11BDC1065672@hub.freebsd.org> Cc: Subject: socsvn commit: r236233 - soc2012/gpf/pefs_kmod/sbin/pefs X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 May 2012 21:04:11 -0000 Author: gpf Date: Wed May 23 21:04:08 2012 New Revision: 236233 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236233 Log: write everything to .pefs.checksum. Seems to be working. Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Wed May 23 20:51:21 2012 (r236232) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Wed May 23 21:04:08 2012 (r236233) @@ -28,6 +28,7 @@ #include __FBSDID("$FreeBSD$"); +#include #include #include #include @@ -50,16 +51,32 @@ #include "pefs_ctl.h" -#define PEFS_INTEGRITY_DEBUG +//#define PEFS_INTEGRITY_DEBUG #if defined (PEFS_INTEGRITY_DEBUG) #define dprintf(a) printf a #else #define dprintf(a) (void)0 #endif +#define PEFS_CHECKSUM_FILE_VERSION 0xDD +#define PEFS_HASH_BYTE_ALIGNMENT 512 + LIST_HEAD(file_header_head, file_header); TAILQ_HEAD(checksum_head, checksum); +#define PEFS_CFH_SIZE 16 +#define PEFS_FH_SIZE 16 +#define PEFS_BUCKET_SIZE 8 + +struct checksum_file_header { + uint8_t version; + uint8_t reserved; + uint8_t hash_len; + uint8_t hash_algo[8]; + uint8_t offset_to_hash_table; + uint32_t hash_table_size; +}; + struct checksum { unsigned char *hash; TAILQ_ENTRY(checksum) checksum_entries; @@ -70,17 +87,20 @@ uint64_t file_id; char path[MAXPATHLEN]; LIST_ENTRY(file_header) bucket_entries; + uint32_t offset_to_checksums; struct checksum_head checksums; }; struct bucket { struct file_header_head file_headers; + uint32_t offset_to_chain; uint32_t nelements; }; struct hash_table { struct bucket *buckets; - uint32_t size; + uint32_t size; /* how many buckets */ + uint32_t nelements; }; static int @@ -170,6 +190,7 @@ * XXXgpf: needs optimization */ checksum_hash_tablep->size = nelements; + checksum_hash_tablep->nelements = nelements; checksum_hash_tablep->buckets = malloc (nelements * sizeof(struct bucket)); if (checksum_hash_tablep->buckets == NULL) { @@ -214,6 +235,7 @@ } bucketp->nelements++; + /* XXXgpf: Turn them into void */ return (0); } @@ -242,16 +264,17 @@ struct checksum *csp; uint32_t i,j; - dprintf(("\n+++Printing Hash Table+++\n\n")); + printf("\n+++Printing Hash Table+++\n\n"); for (i = 0; i < checksum_hash_tablep->size; i++) { - dprintf(("\nbucket %d with elements: %u\n", i, checksum_hash_tablep->buckets[i].nelements)); + printf("\nbucket %d with elements: %u\n", i, checksum_hash_tablep->buckets[i].nelements); LIST_FOREACH(fhp, &(checksum_hash_tablep->buckets[i].file_headers), bucket_entries) { - dprintf(("\tpath=%s!\t id = %d!\tnhashes = %d\n", fhp->path, (int)fhp->file_id, fhp->nhashes)); + //printf(("\tpath=%s!\t id = %d!\tnhashes = %d\n", fhp->path, (int)fhp->file_id, fhp->nhashes)); + printf("\tid = %d!\tnhashes = %d\n", (int)fhp->file_id, fhp->nhashes); TAILQ_FOREACH(csp, &(fhp->checksums), checksum_entries) { - dprintf(("\t\tdigest=")); + printf("\t\tdigest="); for (j = 0; j < hash_len; j++) - dprintf(("%02x", csp->hash[j])); - dprintf(("\n")); + printf("%02x", csp->hash[j]); + printf("\n"); } } } @@ -386,11 +409,206 @@ return (error); } + +static int +pefs_write_checksum_file_header(int fdout, struct checksum_file_header *cfhp) +{ + uint32_t bytes, hash_table_size; + + cfhp->offset_to_hash_table = PEFS_CFH_SIZE; + + bytes = write(fdout, &(cfhp->version), sizeof(cfhp->version)); + if (bytes != sizeof(cfhp->version)) { + warn("error writing to .pefs.checksum"); + return (PEFS_ERR_IO); + } + + bytes = write(fdout, &(cfhp->reserved), sizeof(cfhp->reserved)); + if (bytes != sizeof(cfhp->reserved)) { + warn("error writing to .pefs.checksum"); + return (PEFS_ERR_IO); + } + + bytes = write(fdout, &(cfhp->hash_len), sizeof(cfhp->hash_len)); + if (bytes != sizeof(cfhp->hash_len)) { + warn("error writing to .pefs.checksum"); + return (PEFS_ERR_IO); + } + + bytes = write(fdout, cfhp->hash_algo, sizeof(cfhp->hash_algo)); + if (bytes != sizeof(cfhp->hash_algo)) { + warn("error writing to .pefs.checksum"); + return (PEFS_ERR_IO); + } + + bytes = write(fdout, &(cfhp->offset_to_hash_table), sizeof(cfhp->offset_to_hash_table)); + if (bytes != sizeof(cfhp->offset_to_hash_table)) { + warn("error writing to .pefs.checksum"); + return (PEFS_ERR_IO); + } + + hash_table_size = htole32(cfhp->hash_table_size); + bytes = write(fdout, &hash_table_size, sizeof(hash_table_size)); + if (bytes != sizeof(hash_table_size)) { + warn("error writing to .pefs.checksum"); + return (PEFS_ERR_IO); + } + + return (0); +} + +static int +pefs_write_bucket(int fdout, struct bucket *bp, uint32_t *buckets_offset) +{ + uint32_t offset_to_chain, nelements; + int bytes; + + offset_to_chain = htole32(bp->offset_to_chain); + bytes = pwrite(fdout, &offset_to_chain, sizeof(offset_to_chain), *buckets_offset); + if (bytes != sizeof(offset_to_chain)) { + warn("error writing to .pefs.checksum"); + return (PEFS_ERR_IO); + } + (*buckets_offset)+= sizeof(offset_to_chain); + + nelements = htole32(bp->nelements); + bytes = pwrite(fdout, &nelements, sizeof(nelements), *buckets_offset); + if (bytes != sizeof(nelements)) { + warn("error writing to .pefs.checksum"); + return (PEFS_ERR_IO); + } + (*buckets_offset)+= sizeof(nelements); + + return (0); +} + +/* + * XXXgpf: [TODO] take a look at chained offsets + */ +static int +pefs_write_file_header(int fdout, struct file_header *fhp, uint32_t *fh_offset) +{ + uint64_t file_id; + uint32_t nhashes, offset_to_checksums; + int bytes; + + nhashes = htole32(fhp->nhashes); + bytes = pwrite(fdout, &nhashes, sizeof(nhashes), *fh_offset); + if (bytes != sizeof(nhashes)) { + warn("error writing to .pefs.checksum"); + return (PEFS_ERR_IO); + } + (*fh_offset)+= sizeof(nhashes); + + offset_to_checksums = htole32(fhp->offset_to_checksums); + bytes = pwrite(fdout, &offset_to_checksums, sizeof(offset_to_checksums), *fh_offset); + if (bytes != sizeof(offset_to_checksums)) { + warn("error writing to .pefs.checksum"); + return (PEFS_ERR_IO); + } + (*fh_offset)+= sizeof(offset_to_checksums); + + file_id = htole64(fhp->file_id); + bytes = pwrite(fdout, &file_id, sizeof(file_id), *fh_offset); + if (bytes != sizeof(file_id)) { + warn("error writing to .pefs.checksum"); + return (PEFS_ERR_IO); + } + (*fh_offset)+= sizeof(file_id); + + return (0); +} + +static int +pefs_write_hash(int fdout, struct checksum *csp, uint32_t *hashes_offset, uint8_t hash_len) +{ + int bytes; + + bytes = pwrite(fdout, csp->hash, hash_len, *hashes_offset); + if (bytes != hash_len) { + warn("error writing to .pefs.checksum"); + return (PEFS_ERR_IO); + } + (*hashes_offset)+= hash_len; + + return (0); +} + +/* + * All data member writes are done separately so as to avoid alignment problems. + * Writes are always in little endian byte order. + * + * TODO more comments about internal structure of file + */ +static int +pefs_write_checksum_file(int fdout, struct checksum_file_header *cfhp, struct hash_table *chtp) +{ + struct bucket *bp; + struct checksum *csp; + struct file_header *fhp; + uint32_t i, buckets_offset, fh_offset, hashes_offset; + int error; + + error = pefs_write_checksum_file_header(fdout, cfhp); + if (error != 0) + return (error); + + /* this points to where the buckets start */ + buckets_offset = cfhp->offset_to_hash_table; + + /* this points to where the buckets stop and the file headers start */ + fh_offset = buckets_offset; + fh_offset+= chtp->size * PEFS_BUCKET_SIZE; + + /* this points to where the file headers stop and the checksums start */ + hashes_offset = fh_offset; + hashes_offset+= chtp->nelements * PEFS_FH_SIZE; + if (hashes_offset % PEFS_HASH_BYTE_ALIGNMENT != 0) + hashes_offset+= PEFS_HASH_BYTE_ALIGNMENT - (hashes_offset % PEFS_HASH_BYTE_ALIGNMENT); + + for (i = 0; i < chtp->size; i++) { + bp = &chtp->buckets[i]; + bp->offset_to_chain = fh_offset; + error = pefs_write_bucket(fdout, bp, &buckets_offset); + if (error != 0) + return (error); + + LIST_FOREACH(fhp, &(chtp->buckets[i].file_headers), bucket_entries) { + fhp->offset_to_checksums = hashes_offset; + error = pefs_write_file_header(fdout, fhp, &fh_offset); + if (error != 0) + return (error); + + TAILQ_FOREACH(csp, &(fhp->checksums), checksum_entries) { + error = pefs_write_hash(fdout, csp, &hashes_offset, cfhp->hash_len); + if (error != 0) + return (error); + } + } + } + + return (0); +} + +static void +pefs_init_checksum_file_header(struct checksum_file_header *cfhp, const char *algo, + uint8_t hash_len, struct hash_table *chtp) +{ + cfhp->hash_len = hash_len; + cfhp->hash_table_size = chtp->size; + cfhp->version = PEFS_CHECKSUM_FILE_VERSION; + strlcpy(cfhp->hash_algo, algo, sizeof(cfhp->hash_algo)); +} + +/* + * XXXgpf: [TODO] proper comment header, I am sleepy Z_Z + */ int pefs_create_checksum_file(FILE *fpin, char *fsroot, const char *algo) { char checksum_path[MAXPATHLEN]; struct hash_table checksum_hash_table; + struct checksum_file_header cfh; const EVP_MD *md; int error, fdout; uint8_t hash_len; @@ -416,9 +634,9 @@ if (error != 0) goto out; - /* XXXgpf: [TODO] write the in memory db to .pefs.checksum */ - /* man byteorder(9) */ - /* error = pefs_write_checksum_file(&checksum_hash_table, fdout, ...); */ + pefs_init_checksum_file_header(&cfh, algo, hash_len, &checksum_hash_table); + + error = pefs_write_checksum_file(fdout, &cfh, &checksum_hash_table); out: close(fdout); From owner-svn-soc-all@FreeBSD.ORG Thu May 24 00:24:37 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id EDD32106566C for ; Thu, 24 May 2012 00:24:36 +0000 (UTC) (envelope-from tzabal@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 24 May 2012 00:24:36 +0000 Date: Thu, 24 May 2012 00:24:36 +0000 From: tzabal@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120524002436.EDD32106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r236241 - soc2012/tzabal/client-side X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 May 2012 00:24:38 -0000 Author: tzabal Date: Thu May 24 00:24:35 2012 New Revision: 236241 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236241 Log: Added: soc2012/tzabal/client-side/ From owner-svn-soc-all@FreeBSD.ORG Thu May 24 00:45:02 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 5A22E106566B for ; Thu, 24 May 2012 00:45:01 +0000 (UTC) (envelope-from tzabal@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 24 May 2012 00:45:01 +0000 Date: Thu, 24 May 2012 00:45:01 +0000 From: tzabal@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120524004501.5A22E106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r236242 - soc2012/tzabal/client-side/akcrs-head X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 May 2012 00:45:02 -0000 Author: tzabal Date: Thu May 24 00:45:00 2012 New Revision: 236242 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236242 Log: Branching /base/head for the Client-side part Added: soc2012/tzabal/client-side/akcrs-head/ (props changed) - copied from r236241, mirror/FreeBSD/head/ From owner-svn-soc-all@FreeBSD.ORG Thu May 24 11:49:09 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id F05D0106564A for ; Thu, 24 May 2012 11:49:06 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 24 May 2012 11:49:06 +0000 Date: Thu, 24 May 2012 11:49:06 +0000 From: gpf@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120524114906.F05D0106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r236273 - soc2012/gpf/pefs_kmod/sbin/pefs X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 May 2012 11:49:09 -0000 Author: gpf Date: Thu May 24 11:49:06 2012 New Revision: 236273 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236273 Log: Revert back to requiring a mounted pefs fs for pefs addchecksum. ioctl()s will be used to retrieve filename MAC & ciphertext 4k blocks from kernel. The only problem now is that .pefs.checksum is written into mounted fs, therefore: a) encrypted filename for .pefs.checksum b) encrypted content. A simple solution would be to create .pefs.checksum outside of fs and then require user to copy the file by hand. Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Thu May 24 10:59:48 2012 (r236272) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Thu May 24 11:49:06 2012 (r236273) @@ -235,7 +235,6 @@ } bucketp->nelements++; - /* XXXgpf: Turn them into void */ return (0); } @@ -368,18 +367,26 @@ * the checksum file. * A) The total sum of entries is gathered so that a hash table is allocated. * B) For each file entry: - * B1) the file_id is retrieved. - * B2) list of checksums is computed for the file's 4k blocks. - * B3) file entry is added to hash table. (separate chaining is used) + * B1) semantic checks: file should reside in pefs filesystem & + * file should be regular file + * B2) the file_id is retrieved. + * B3) list of checksums is computed for the file's 4k blocks. + * B4) file entry is added to hash table. (separate chaining is used) */ static int pefs_create_in_memory_db(FILE *fpin, const EVP_MD *md, uint8_t hash_len, - struct hash_table *checksum_hash_tablep) + struct hash_table *checksum_hash_tablep, char *fsroot) { + struct statfs fs; struct file_header *fhp; int error; uint32_t nfiles; + if (statfs(fsroot, &fs) == -1) { + pefs_warn("statfs failed: %s: %s", fsroot, strerror(errno)); + return (PEFS_ERR_SYS); + } + error = pefs_count_file_entries(fpin, &nfiles); if (error != 0) return (error); @@ -389,19 +396,21 @@ return (error); while((fhp = pefs_next_file(fpin, &error)) != NULL) { - /* XXXgpf: Semantic checks are now performed by addchecklist command */ + error = pefs_file_semantic_checks(fhp, &fs); + if (error != 0) + return (error); error = pefs_get_file_id(fhp); if (error != 0) - return error; + return (error); error = pefs_compute_file_checksums(fhp, md, hash_len); if (error != 0) - return error; + return (error); error = pefs_add_to_hash_table(checksum_hash_tablep, fhp); if (error != 0) - return error; + return (error); } pefs_print_hash_table(checksum_hash_tablep, hash_len); @@ -623,6 +632,10 @@ hash_len = EVP_MD_size(md); snprintf(checksum_path, sizeof(checksum_path), "%s/%s", fsroot, PEFS_FILE_CHECKSUM); + /* + * XXXgpf: If pefs fs is mounted when .pefs.checksum is created, then it will obtain an + * encrypted filename. It's not a bug, it's a feature! + */ fdout = open(checksum_path, O_WRONLY | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); if (fdout == -1) { warn("cannot open %s", checksum_path); @@ -630,7 +643,7 @@ } error = pefs_create_in_memory_db(fpin, md, hash_len, - &checksum_hash_table); + &checksum_hash_table, fsroot); if (error != 0) goto out; Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Thu May 24 10:59:48 2012 (r236272) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Thu May 24 11:49:06 2012 (r236273) @@ -1072,11 +1072,7 @@ return (PEFS_ERR_USAGE); } - /* XXXgpf: [TODO] probably check that fsroot is not mounted */ - if (!checkargs_fs(argc, argv)) - pefs_usage(); - - strlcpy(fsroot, argv[0], sizeof(fsroot)); + initfsroot(argc, argv, 0, fsroot, sizeof(fsroot)); error = pefs_create_checksum_file(fpin, fsroot, algo); From owner-svn-soc-all@FreeBSD.ORG Thu May 24 12:44:19 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id D3639106564A for ; Thu, 24 May 2012 12:44:17 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 24 May 2012 12:44:17 +0000 Date: Thu, 24 May 2012 12:44:17 +0000 From: rudot@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120524124417.D3639106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r236282 - soc2012/rudot/sys/kern X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 May 2012 12:44:20 -0000 Author: rudot Date: Thu May 24 12:44:17 2012 New Revision: 236282 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236282 Log: initial version of sched_4bsd.c Added: soc2012/rudot/sys/kern/sched_4bsd.c Added: soc2012/rudot/sys/kern/sched_4bsd.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/sys/kern/sched_4bsd.c Thu May 24 12:44:17 2012 (r236282) @@ -0,0 +1,1690 @@ +/*- + * Copyright (c) 1982, 1986, 1990, 1991, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * 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. + */ + +#include +__FBSDID("$FreeBSD: src/sys/kern/sched_4bsd.c,v 1.161 2012/03/08 19:41:05 jhb Exp $"); + +#include "opt_hwpmc_hooks.h" +#include "opt_sched.h" +#include "opt_kdtrace.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef HWPMC_HOOKS +#include +#endif + +#ifdef KDTRACE_HOOKS +#include +int dtrace_vtime_active; +dtrace_vtime_switch_func_t dtrace_vtime_switch_func; +#endif + +/* + * INVERSE_ESTCPU_WEIGHT is only suitable for statclock() frequencies in + * the range 100-256 Hz (approximately). + */ +#define ESTCPULIM(e) \ + min((e), INVERSE_ESTCPU_WEIGHT * (NICE_WEIGHT * (PRIO_MAX - PRIO_MIN) - \ + RQ_PPQ) + INVERSE_ESTCPU_WEIGHT - 1) +#ifdef SMP +#define INVERSE_ESTCPU_WEIGHT (8 * smp_cpus) +#else +#define INVERSE_ESTCPU_WEIGHT 8 /* 1 / (priorities per estcpu level). */ +#endif +#define NICE_WEIGHT 1 /* Priorities per nice level. */ + +#define TS_NAME_LEN (MAXCOMLEN + sizeof(" td ") + sizeof(__XSTRING(UINT_MAX))) + +/* + * The schedulable entity that runs a context. + * This is an extension to the thread structure and is tailored to + * the requirements of this scheduler + */ +struct td_sched { + fixpt_t ts_pctcpu; /* (j) %cpu during p_swtime. */ + int ts_cpticks; /* (j) Ticks of cpu time. */ + int ts_slptime; /* (j) Seconds !RUNNING. */ + int ts_flags; + struct runq *ts_runq; /* runq the thread is currently on */ +#ifdef KTR + char ts_name[TS_NAME_LEN]; +#endif +}; + +/* flags kept in td_flags */ +#define TDF_DIDRUN TDF_SCHED0 /* thread actually ran. */ +#define TDF_BOUND TDF_SCHED1 /* Bound to one CPU. */ + +/* flags kept in ts_flags */ +#define TSF_AFFINITY 0x0001 /* Has a non-"full" CPU set. */ + +#define SKE_RUNQ_PCPU(ts) \ + ((ts)->ts_runq != 0 && (ts)->ts_runq != &runq) + +#define THREAD_CAN_SCHED(td, cpu) \ + CPU_ISSET((cpu), &(td)->td_cpuset->cs_mask) + +static struct td_sched td_sched0; +struct mtx sched_lock; + +static int sched_tdcnt; /* Total runnable threads in the system. */ +static int sched_quantum; /* Roundrobin scheduling quantum in ticks. */ +#define SCHED_QUANTUM (hz / 10) /* Default sched quantum */ + +static void setup_runqs(void); +static void schedcpu(void); +static void schedcpu_thread(void); +static void sched_priority(struct thread *td, u_char prio); +static void sched_setup(void *dummy); +static void maybe_resched(struct thread *td); +static void updatepri(struct thread *td); +static void resetpriority(struct thread *td); +static void resetpriority_thread(struct thread *td); +#ifdef SMP +static int sched_pickcpu(struct thread *td); +static int forward_wakeup(int cpunum); +static void kick_other_cpu(int pri, int cpuid); +#endif + +static struct kproc_desc sched_kp = { + "schedcpu", + schedcpu_thread, + NULL +}; +SYSINIT(schedcpu, SI_SUB_RUN_SCHEDULER, SI_ORDER_FIRST, kproc_start, + &sched_kp); +SYSINIT(sched_setup, SI_SUB_RUN_QUEUE, SI_ORDER_FIRST, sched_setup, NULL); + +/* + * Global run queue. + */ +static struct runq runq; + +#ifdef SMP +/* + * Per-CPU run queues + */ +static struct runq runq_pcpu[MAXCPU]; +long runq_length[MAXCPU]; + +static cpuset_t idle_cpus_mask; +#endif + +struct pcpuidlestat { + u_int idlecalls; + u_int oldidlecalls; +}; +static DPCPU_DEFINE(struct pcpuidlestat, idlestat); + +static void +setup_runqs(void) +{ +#ifdef SMP + int i; + + for (i = 0; i < MAXCPU; ++i) + runq_init(&runq_pcpu[i]); +#endif + + runq_init(&runq); +} + +static int +sysctl_kern_quantum(SYSCTL_HANDLER_ARGS) +{ + int error, new_val; + + new_val = sched_quantum * tick; + error = sysctl_handle_int(oidp, &new_val, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + if (new_val < tick) + return (EINVAL); + sched_quantum = new_val / tick; + hogticks = 2 * sched_quantum; + return (0); +} + +SYSCTL_NODE(_kern, OID_AUTO, sched, CTLFLAG_RD, 0, "Scheduler"); + +SYSCTL_STRING(_kern_sched, OID_AUTO, name, CTLFLAG_RD, "4BSD", 0, + "Scheduler name"); + +SYSCTL_PROC(_kern_sched, OID_AUTO, quantum, CTLTYPE_INT | CTLFLAG_RW, + 0, sizeof sched_quantum, sysctl_kern_quantum, "I", + "Roundrobin scheduling quantum in microseconds"); + +#ifdef SMP +/* Enable forwarding of wakeups to all other cpus */ +static SYSCTL_NODE(_kern_sched, OID_AUTO, ipiwakeup, CTLFLAG_RD, NULL, + "Kernel SMP"); + +static int runq_fuzz = 1; +SYSCTL_INT(_kern_sched, OID_AUTO, runq_fuzz, CTLFLAG_RW, &runq_fuzz, 0, ""); + +static int forward_wakeup_enabled = 1; +SYSCTL_INT(_kern_sched_ipiwakeup, OID_AUTO, enabled, CTLFLAG_RW, + &forward_wakeup_enabled, 0, + "Forwarding of wakeup to idle CPUs"); + +static int forward_wakeups_requested = 0; +SYSCTL_INT(_kern_sched_ipiwakeup, OID_AUTO, requested, CTLFLAG_RD, + &forward_wakeups_requested, 0, + "Requests for Forwarding of wakeup to idle CPUs"); + +static int forward_wakeups_delivered = 0; +SYSCTL_INT(_kern_sched_ipiwakeup, OID_AUTO, delivered, CTLFLAG_RD, + &forward_wakeups_delivered, 0, + "Completed Forwarding of wakeup to idle CPUs"); + +static int forward_wakeup_use_mask = 1; +SYSCTL_INT(_kern_sched_ipiwakeup, OID_AUTO, usemask, CTLFLAG_RW, + &forward_wakeup_use_mask, 0, + "Use the mask of idle cpus"); + +static int forward_wakeup_use_loop = 0; +SYSCTL_INT(_kern_sched_ipiwakeup, OID_AUTO, useloop, CTLFLAG_RW, + &forward_wakeup_use_loop, 0, + "Use a loop to find idle cpus"); + +#endif +#if 0 +static int sched_followon = 0; +SYSCTL_INT(_kern_sched, OID_AUTO, followon, CTLFLAG_RW, + &sched_followon, 0, + "allow threads to share a quantum"); +#endif + +static __inline void +sched_load_add(void) +{ + + sched_tdcnt++; + KTR_COUNTER0(KTR_SCHED, "load", "global load", sched_tdcnt); +} + +static __inline void +sched_load_rem(void) +{ + + sched_tdcnt--; + KTR_COUNTER0(KTR_SCHED, "load", "global load", sched_tdcnt); +} +/* + * Arrange to reschedule if necessary, taking the priorities and + * schedulers into account. + */ +static void +maybe_resched(struct thread *td) +{ + + THREAD_LOCK_ASSERT(td, MA_OWNED); + if (td->td_priority < curthread->td_priority) + curthread->td_flags |= TDF_NEEDRESCHED; +} + +/* + * This function is called when a thread is about to be put on run queue + * because it has been made runnable or its priority has been adjusted. It + * determines if the new thread should be immediately preempted to. If so, + * it switches to it and eventually returns true. If not, it returns false + * so that the caller may place the thread on an appropriate run queue. + */ +int +maybe_preempt(struct thread *td) +{ +#ifdef PREEMPTION + struct thread *ctd; + int cpri, pri; + + /* + * The new thread should not preempt the current thread if any of the + * following conditions are true: + * + * - The kernel is in the throes of crashing (panicstr). + * - The current thread has a higher (numerically lower) or + * equivalent priority. Note that this prevents curthread from + * trying to preempt to itself. + * - It is too early in the boot for context switches (cold is set). + * - The current thread has an inhibitor set or is in the process of + * exiting. In this case, the current thread is about to switch + * out anyways, so there's no point in preempting. If we did, + * the current thread would not be properly resumed as well, so + * just avoid that whole landmine. + * - If the new thread's priority is not a realtime priority and + * the current thread's priority is not an idle priority and + * FULL_PREEMPTION is disabled. + * + * If all of these conditions are false, but the current thread is in + * a nested critical section, then we have to defer the preemption + * until we exit the critical section. Otherwise, switch immediately + * to the new thread. + */ + ctd = curthread; + THREAD_LOCK_ASSERT(td, MA_OWNED); + KASSERT((td->td_inhibitors == 0), + ("maybe_preempt: trying to run inhibited thread")); + pri = td->td_priority; + cpri = ctd->td_priority; + if (panicstr != NULL || pri >= cpri || cold /* || dumping */ || + TD_IS_INHIBITED(ctd)) + return (0); +#ifndef FULL_PREEMPTION + if (pri > PRI_MAX_ITHD && cpri < PRI_MIN_IDLE) + return (0); +#endif + + if (ctd->td_critnest > 1) { + CTR1(KTR_PROC, "maybe_preempt: in critical section %d", + ctd->td_critnest); + ctd->td_owepreempt = 1; + return (0); + } + /* + * Thread is runnable but not yet put on system run queue. + */ + MPASS(ctd->td_lock == td->td_lock); + MPASS(TD_ON_RUNQ(td)); + TD_SET_RUNNING(td); + CTR3(KTR_PROC, "preempting to thread %p (pid %d, %s)\n", td, + td->td_proc->p_pid, td->td_name); + mi_switch(SW_INVOL | SW_PREEMPT | SWT_PREEMPT, td); + /* + * td's lock pointer may have changed. We have to return with it + * locked. + */ + spinlock_enter(); + thread_unlock(ctd); + thread_lock(td); + spinlock_exit(); + return (1); +#else + return (0); +#endif +} + +/* + * Constants for digital decay and forget: + * 90% of (td_estcpu) usage in 5 * loadav time + * 95% of (ts_pctcpu) usage in 60 seconds (load insensitive) + * Note that, as ps(1) mentions, this can let percentages + * total over 100% (I've seen 137.9% for 3 processes). + * + * Note that schedclock() updates td_estcpu and p_cpticks asynchronously. + * + * We wish to decay away 90% of td_estcpu in (5 * loadavg) seconds. + * That is, the system wants to compute a value of decay such + * that the following for loop: + * for (i = 0; i < (5 * loadavg); i++) + * td_estcpu *= decay; + * will compute + * td_estcpu *= 0.1; + * for all values of loadavg: + * + * Mathematically this loop can be expressed by saying: + * decay ** (5 * loadavg) ~= .1 + * + * The system computes decay as: + * decay = (2 * loadavg) / (2 * loadavg + 1) + * + * We wish to prove that the system's computation of decay + * will always fulfill the equation: + * decay ** (5 * loadavg) ~= .1 + * + * If we compute b as: + * b = 2 * loadavg + * then + * decay = b / (b + 1) + * + * We now need to prove two things: + * 1) Given factor ** (5 * loadavg) ~= .1, prove factor == b/(b+1) + * 2) Given b/(b+1) ** power ~= .1, prove power == (5 * loadavg) + * + * Facts: + * For x close to zero, exp(x) =~ 1 + x, since + * exp(x) = 0! + x**1/1! + x**2/2! + ... . + * therefore exp(-1/b) =~ 1 - (1/b) = (b-1)/b. + * For x close to zero, ln(1+x) =~ x, since + * ln(1+x) = x - x**2/2 + x**3/3 - ... -1 < x < 1 + * therefore ln(b/(b+1)) = ln(1 - 1/(b+1)) =~ -1/(b+1). + * ln(.1) =~ -2.30 + * + * Proof of (1): + * Solve (factor)**(power) =~ .1 given power (5*loadav): + * solving for factor, + * ln(factor) =~ (-2.30/5*loadav), or + * factor =~ exp(-1/((5/2.30)*loadav)) =~ exp(-1/(2*loadav)) = + * exp(-1/b) =~ (b-1)/b =~ b/(b+1). QED + * + * Proof of (2): + * Solve (factor)**(power) =~ .1 given factor == (b/(b+1)): + * solving for power, + * power*ln(b/(b+1)) =~ -2.30, or + * power =~ 2.3 * (b + 1) = 4.6*loadav + 2.3 =~ 5*loadav. QED + * + * Actual power values for the implemented algorithm are as follows: + * loadav: 1 2 3 4 + * power: 5.68 10.32 14.94 19.55 + */ + +/* calculations for digital decay to forget 90% of usage in 5*loadav sec */ +#define loadfactor(loadav) (2 * (loadav)) +#define decay_cpu(loadfac, cpu) (((loadfac) * (cpu)) / ((loadfac) + FSCALE)) + +/* decay 95% of `ts_pctcpu' in 60 seconds; see CCPU_SHIFT before changing */ +static fixpt_t ccpu = 0.95122942450071400909 * FSCALE; /* exp(-1/20) */ +SYSCTL_UINT(_kern, OID_AUTO, ccpu, CTLFLAG_RD, &ccpu, 0, ""); + +/* + * If `ccpu' is not equal to `exp(-1/20)' and you still want to use the + * faster/more-accurate formula, you'll have to estimate CCPU_SHIFT below + * and possibly adjust FSHIFT in "param.h" so that (FSHIFT >= CCPU_SHIFT). + * + * To estimate CCPU_SHIFT for exp(-1/20), the following formula was used: + * 1 - exp(-1/20) ~= 0.0487 ~= 0.0488 == 1 (fixed pt, *11* bits). + * + * If you don't want to bother with the faster/more-accurate formula, you + * can set CCPU_SHIFT to (FSHIFT + 1) which will use a slower/less-accurate + * (more general) method of calculating the %age of CPU used by a process. + */ +#define CCPU_SHIFT 11 + +/* + * Recompute process priorities, every hz ticks. + * MP-safe, called without the Giant mutex. + */ +/* ARGSUSED */ +static void +schedcpu(void) +{ + register fixpt_t loadfac = loadfactor(averunnable.ldavg[0]); + struct thread *td; + struct proc *p; + struct td_sched *ts; + int awake, realstathz; + + realstathz = stathz ? stathz : hz; + sx_slock(&allproc_lock); + FOREACH_PROC_IN_SYSTEM(p) { + PROC_LOCK(p); + if (p->p_state == PRS_NEW) { + PROC_UNLOCK(p); + continue; + } + FOREACH_THREAD_IN_PROC(p, td) { + awake = 0; + thread_lock(td); + ts = td->td_sched; + /* + * Increment sleep time (if sleeping). We + * ignore overflow, as above. + */ + /* + * The td_sched slptimes are not touched in wakeup + * because the thread may not HAVE everything in + * memory? XXX I think this is out of date. + */ + if (TD_ON_RUNQ(td)) { + awake = 1; + td->td_flags &= ~TDF_DIDRUN; + } else if (TD_IS_RUNNING(td)) { + awake = 1; + /* Do not clear TDF_DIDRUN */ + } else if (td->td_flags & TDF_DIDRUN) { + awake = 1; + td->td_flags &= ~TDF_DIDRUN; + } + + /* + * ts_pctcpu is only for ps and ttyinfo(). + */ + ts->ts_pctcpu = (ts->ts_pctcpu * ccpu) >> FSHIFT; + /* + * If the td_sched has been idle the entire second, + * stop recalculating its priority until + * it wakes up. + */ + if (ts->ts_cpticks != 0) { +#if (FSHIFT >= CCPU_SHIFT) + ts->ts_pctcpu += (realstathz == 100) + ? ((fixpt_t) ts->ts_cpticks) << + (FSHIFT - CCPU_SHIFT) : + 100 * (((fixpt_t) ts->ts_cpticks) + << (FSHIFT - CCPU_SHIFT)) / realstathz; +#else + ts->ts_pctcpu += ((FSCALE - ccpu) * + (ts->ts_cpticks * + FSCALE / realstathz)) >> FSHIFT; +#endif + ts->ts_cpticks = 0; + } + /* + * If there are ANY running threads in this process, + * then don't count it as sleeping. + * XXX: this is broken. + */ + if (awake) { + if (ts->ts_slptime > 1) { + /* + * In an ideal world, this should not + * happen, because whoever woke us + * up from the long sleep should have + * unwound the slptime and reset our + * priority before we run at the stale + * priority. Should KASSERT at some + * point when all the cases are fixed. + */ + updatepri(td); + } + ts->ts_slptime = 0; + } else + ts->ts_slptime++; + if (ts->ts_slptime > 1) { + thread_unlock(td); + continue; + } + td->td_estcpu = decay_cpu(loadfac, td->td_estcpu); + resetpriority(td); + resetpriority_thread(td); + thread_unlock(td); + } + PROC_UNLOCK(p); + } + sx_sunlock(&allproc_lock); +} + +/* + * Main loop for a kthread that executes schedcpu once a second. + */ +static void +schedcpu_thread(void) +{ + + for (;;) { + schedcpu(); + pause("-", hz); + } +} + +/* + * Recalculate the priority of a process after it has slept for a while. + * For all load averages >= 1 and max td_estcpu of 255, sleeping for at + * least six times the loadfactor will decay td_estcpu to zero. + */ +static void +updatepri(struct thread *td) +{ + struct td_sched *ts; + fixpt_t loadfac; + unsigned int newcpu; + + ts = td->td_sched; + loadfac = loadfactor(averunnable.ldavg[0]); + if (ts->ts_slptime > 5 * loadfac) + td->td_estcpu = 0; + else { + newcpu = td->td_estcpu; + ts->ts_slptime--; /* was incremented in schedcpu() */ + while (newcpu && --ts->ts_slptime) + newcpu = decay_cpu(loadfac, newcpu); + td->td_estcpu = newcpu; + } +} + +/* + * Compute the priority of a process when running in user mode. + * Arrange to reschedule if the resulting priority is better + * than that of the current process. + */ +static void +resetpriority(struct thread *td) +{ + register unsigned int newpriority; + + if (td->td_pri_class == PRI_TIMESHARE) { + newpriority = PUSER + td->td_estcpu / INVERSE_ESTCPU_WEIGHT + + NICE_WEIGHT * (td->td_proc->p_nice - PRIO_MIN); + newpriority = min(max(newpriority, PRI_MIN_TIMESHARE), + PRI_MAX_TIMESHARE); + sched_user_prio(td, newpriority); + } +} + +/* + * Update the thread's priority when the associated process's user + * priority changes. + */ +static void +resetpriority_thread(struct thread *td) +{ + + /* Only change threads with a time sharing user priority. */ + if (td->td_priority < PRI_MIN_TIMESHARE || + td->td_priority > PRI_MAX_TIMESHARE) + return; + + /* XXX the whole needresched thing is broken, but not silly. */ + maybe_resched(td); + + sched_prio(td, td->td_user_pri); +} + +/* ARGSUSED */ +static void +sched_setup(void *dummy) +{ + setup_runqs(); + + if (sched_quantum == 0) + sched_quantum = SCHED_QUANTUM; + hogticks = 2 * sched_quantum; + + /* Account for thread0. */ + sched_load_add(); +} + +/* External interfaces start here */ + +/* + * Very early in the boot some setup of scheduler-specific + * parts of proc0 and of some scheduler resources needs to be done. + * Called from: + * proc0_init() + */ +void +schedinit(void) +{ + /* + * Set up the scheduler specific parts of proc0. + */ + proc0.p_sched = NULL; /* XXX */ + thread0.td_sched = &td_sched0; + thread0.td_lock = &sched_lock; + mtx_init(&sched_lock, "sched lock", NULL, MTX_SPIN | MTX_RECURSE); +} + +int +sched_runnable(void) +{ +#ifdef SMP + return runq_check(&runq) + runq_check(&runq_pcpu[PCPU_GET(cpuid)]); +#else + return runq_check(&runq); +#endif +} + +int +sched_rr_interval(void) +{ + if (sched_quantum == 0) + sched_quantum = SCHED_QUANTUM; + return (sched_quantum); +} + +/* + * We adjust the priority of the current process. The priority of + * a process gets worse as it accumulates CPU time. The cpu usage + * estimator (td_estcpu) is increased here. resetpriority() will + * compute a different priority each time td_estcpu increases by + * INVERSE_ESTCPU_WEIGHT + * (until MAXPRI is reached). The cpu usage estimator ramps up + * quite quickly when the process is running (linearly), and decays + * away exponentially, at a rate which is proportionally slower when + * the system is busy. The basic principle is that the system will + * 90% forget that the process used a lot of CPU time in 5 * loadav + * seconds. This causes the system to favor processes which haven't + * run much recently, and to round-robin among other processes. + */ +void +sched_clock(struct thread *td) +{ + struct pcpuidlestat *stat; + struct td_sched *ts; + + THREAD_LOCK_ASSERT(td, MA_OWNED); + ts = td->td_sched; + + ts->ts_cpticks++; + td->td_estcpu = ESTCPULIM(td->td_estcpu + 1); + if ((td->td_estcpu % INVERSE_ESTCPU_WEIGHT) == 0) { + resetpriority(td); + resetpriority_thread(td); + } + + /* + * Force a context switch if the current thread has used up a full + * quantum (default quantum is 100ms). + */ + if (!TD_IS_IDLETHREAD(td) && + ticks - PCPU_GET(switchticks) >= sched_quantum) + td->td_flags |= TDF_NEEDRESCHED; + + stat = DPCPU_PTR(idlestat); + stat->oldidlecalls = stat->idlecalls; + stat->idlecalls = 0; +} + +/* + * Charge child's scheduling CPU usage to parent. + */ +void +sched_exit(struct proc *p, struct thread *td) +{ + + KTR_STATE1(KTR_SCHED, "thread", sched_tdname(td), "proc exit", + "prio:%d", td->td_priority); + + PROC_LOCK_ASSERT(p, MA_OWNED); + sched_exit_thread(FIRST_THREAD_IN_PROC(p), td); +} + +void +sched_exit_thread(struct thread *td, struct thread *child) +{ + + KTR_STATE1(KTR_SCHED, "thread", sched_tdname(child), "exit", + "prio:%d", child->td_priority); + thread_lock(td); + td->td_estcpu = ESTCPULIM(td->td_estcpu + child->td_estcpu); + thread_unlock(td); + thread_lock(child); + if ((child->td_flags & TDF_NOLOAD) == 0) + sched_load_rem(); + thread_unlock(child); +} + +void +sched_fork(struct thread *td, struct thread *childtd) +{ + sched_fork_thread(td, childtd); +} + +void +sched_fork_thread(struct thread *td, struct thread *childtd) +{ + struct td_sched *ts; + + childtd->td_estcpu = td->td_estcpu; + childtd->td_lock = &sched_lock; + childtd->td_cpuset = cpuset_ref(td->td_cpuset); + childtd->td_priority = childtd->td_base_pri; + ts = childtd->td_sched; + bzero(ts, sizeof(*ts)); + ts->ts_flags |= (td->td_sched->ts_flags & TSF_AFFINITY); +} + +void +sched_nice(struct proc *p, int nice) +{ + struct thread *td; + + PROC_LOCK_ASSERT(p, MA_OWNED); + p->p_nice = nice; + FOREACH_THREAD_IN_PROC(p, td) { + thread_lock(td); + resetpriority(td); + resetpriority_thread(td); + thread_unlock(td); + } +} + +void +sched_class(struct thread *td, int class) +{ + THREAD_LOCK_ASSERT(td, MA_OWNED); + td->td_pri_class = class; +} + +/* + * Adjust the priority of a thread. + */ +static void +sched_priority(struct thread *td, u_char prio) +{ + + + KTR_POINT3(KTR_SCHED, "thread", sched_tdname(td), "priority change", + "prio:%d", td->td_priority, "new prio:%d", prio, KTR_ATTR_LINKED, + sched_tdname(curthread)); + if (td != curthread && prio > td->td_priority) { + KTR_POINT3(KTR_SCHED, "thread", sched_tdname(curthread), + "lend prio", "prio:%d", td->td_priority, "new prio:%d", + prio, KTR_ATTR_LINKED, sched_tdname(td)); + } + THREAD_LOCK_ASSERT(td, MA_OWNED); + if (td->td_priority == prio) + return; + td->td_priority = prio; + if (TD_ON_RUNQ(td) && td->td_rqindex != (prio / RQ_PPQ)) { + sched_rem(td); + sched_add(td, SRQ_BORING); + } +} + +/* + * Update a thread's priority when it is lent another thread's + * priority. + */ +void +sched_lend_prio(struct thread *td, u_char prio) +{ + + td->td_flags |= TDF_BORROWING; + sched_priority(td, prio); +} + +/* + * Restore a thread's priority when priority propagation is + * over. The prio argument is the minimum priority the thread + * needs to have to satisfy other possible priority lending + * requests. If the thread's regulary priority is less + * important than prio the thread will keep a priority boost + * of prio. + */ +void +sched_unlend_prio(struct thread *td, u_char prio) +{ + u_char base_pri; + + if (td->td_base_pri >= PRI_MIN_TIMESHARE && + td->td_base_pri <= PRI_MAX_TIMESHARE) + base_pri = td->td_user_pri; + else + base_pri = td->td_base_pri; + if (prio >= base_pri) { + td->td_flags &= ~TDF_BORROWING; + sched_prio(td, base_pri); + } else + sched_lend_prio(td, prio); +} + +void +sched_prio(struct thread *td, u_char prio) +{ + u_char oldprio; + + /* First, update the base priority. */ + td->td_base_pri = prio; + + /* + * If the thread is borrowing another thread's priority, don't ever + * lower the priority. + */ + if (td->td_flags & TDF_BORROWING && td->td_priority < prio) + return; + + /* Change the real priority. */ + oldprio = td->td_priority; + sched_priority(td, prio); + + /* + * If the thread is on a turnstile, then let the turnstile update + * its state. + */ + if (TD_ON_LOCK(td) && oldprio != prio) + turnstile_adjust(td, oldprio); +} + +void +sched_user_prio(struct thread *td, u_char prio) +{ + + THREAD_LOCK_ASSERT(td, MA_OWNED); + td->td_base_user_pri = prio; + if (td->td_lend_user_pri <= prio) + return; + td->td_user_pri = prio; +} + +void +sched_lend_user_prio(struct thread *td, u_char prio) +{ + + THREAD_LOCK_ASSERT(td, MA_OWNED); + td->td_lend_user_pri = prio; + td->td_user_pri = min(prio, td->td_base_user_pri); + if (td->td_priority > td->td_user_pri) + sched_prio(td, td->td_user_pri); + else if (td->td_priority != td->td_user_pri) + td->td_flags |= TDF_NEEDRESCHED; +} + +void +sched_sleep(struct thread *td, int pri) +{ + + THREAD_LOCK_ASSERT(td, MA_OWNED); + td->td_slptick = ticks; + td->td_sched->ts_slptime = 0; + if (pri != 0 && PRI_BASE(td->td_pri_class) == PRI_TIMESHARE) + sched_prio(td, pri); + if (TD_IS_SUSPENDED(td) || pri >= PSOCK) + td->td_flags |= TDF_CANSWAP; +} + +void +sched_switch(struct thread *td, struct thread *newtd, int flags) +{ + struct mtx *tmtx; + struct td_sched *ts; + struct proc *p; + + tmtx = NULL; + ts = td->td_sched; + p = td->td_proc; + + THREAD_LOCK_ASSERT(td, MA_OWNED); + + /* + * Switch to the sched lock to fix things up and pick + * a new thread. + * Block the td_lock in order to avoid breaking the critical path. + */ + if (td->td_lock != &sched_lock) { + mtx_lock_spin(&sched_lock); + tmtx = thread_lock_block(td); + } + + if ((td->td_flags & TDF_NOLOAD) == 0) + sched_load_rem(); + + td->td_lastcpu = td->td_oncpu; + if (!(flags & SW_PREEMPT)) + td->td_flags &= ~TDF_NEEDRESCHED; + td->td_owepreempt = 0; + td->td_oncpu = NOCPU; + + /* + * At the last moment, if this thread is still marked RUNNING, + * then put it back on the run queue as it has not been suspended + * or stopped or any thing else similar. We never put the idle + * threads on the run queue, however. + */ + if (td->td_flags & TDF_IDLETD) { + TD_SET_CAN_RUN(td); +#ifdef SMP + CPU_CLR(PCPU_GET(cpuid), &idle_cpus_mask); +#endif + } else { + if (TD_IS_RUNNING(td)) { + /* Put us back on the run queue. */ + sched_add(td, (flags & SW_PREEMPT) ? + SRQ_OURSELF|SRQ_YIELDING|SRQ_PREEMPTED : + SRQ_OURSELF|SRQ_YIELDING); + } + } + if (newtd) { + /* + * The thread we are about to run needs to be counted + * as if it had been added to the run queue and selected. + * It came from: + * * A preemption + * * An upcall + * * A followon + */ + KASSERT((newtd->td_inhibitors == 0), + ("trying to run inhibited thread")); + newtd->td_flags |= TDF_DIDRUN; + TD_SET_RUNNING(newtd); + if ((newtd->td_flags & TDF_NOLOAD) == 0) + sched_load_add(); + } else { + newtd = choosethread(); + MPASS(newtd->td_lock == &sched_lock); + } + + if (td != newtd) { +#ifdef HWPMC_HOOKS + if (PMC_PROC_IS_USING_PMCS(td->td_proc)) + PMC_SWITCH_CONTEXT(td, PMC_FN_CSW_OUT); +#endif + /* I feel sleepy */ + lock_profile_release_lock(&sched_lock.lock_object); +#ifdef KDTRACE_HOOKS + /* + * If DTrace has set the active vtime enum to anything + * other than INACTIVE (0), then it should have set the + * function to call. + */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Thu May 24 14:13:44 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 92657106564A for ; Thu, 24 May 2012 14:13:42 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 24 May 2012 14:13:42 +0000 Date: Thu, 24 May 2012 14:13:42 +0000 From: rudot@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120524141342.92657106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r236291 - soc2012/rudot/aux/config X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 May 2012 14:13:44 -0000 Author: rudot Date: Thu May 24 14:13:42 2012 New Revision: 236291 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236291 Log: switch to 4bsd scheduler Modified: soc2012/rudot/aux/config/RCTL Modified: soc2012/rudot/aux/config/RCTL ============================================================================== --- soc2012/rudot/aux/config/RCTL Thu May 24 13:15:15 2012 (r236290) +++ soc2012/rudot/aux/config/RCTL Thu May 24 14:13:42 2012 (r236291) @@ -5,7 +5,7 @@ makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols -options SCHED_ULE # ULE scheduler +options SCHED_4BSD # 4BSD scheduler options PREEMPTION # Enable kernel thread preemption options INET # InterNETworking options INET6 # IPv6 communications protocols From owner-svn-soc-all@FreeBSD.ORG Thu May 24 15:52:29 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id EC033106564A for ; Thu, 24 May 2012 15:52:26 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 24 May 2012 15:52:26 +0000 Date: Thu, 24 May 2012 15:52:26 +0000 From: gpf@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120524155226.EC033106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r236293 - in soc2012/gpf/pefs_kmod: sbin/pefs sys/fs/pefs X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 May 2012 15:52:29 -0000 Author: gpf Date: Thu May 24 15:52:26 2012 New Revision: 236293 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236293 Log: pefs_get_file_id() now uses an ioctl() call to get filename mac from kernel. Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Thu May 24 14:07:44 2012 (r236292) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Thu May 24 15:52:26 2012 (r236293) @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -263,17 +264,17 @@ struct checksum *csp; uint32_t i,j; - printf("\n+++Printing Hash Table+++\n\n"); + dprintf(("\n+++Printing Hash Table+++\n\n")); for (i = 0; i < checksum_hash_tablep->size; i++) { - printf("\nbucket %d with elements: %u\n", i, checksum_hash_tablep->buckets[i].nelements); + dprintf(("\nbucket %d with elements: %u\n", i, checksum_hash_tablep->buckets[i].nelements)); LIST_FOREACH(fhp, &(checksum_hash_tablep->buckets[i].file_headers), bucket_entries) { //printf(("\tpath=%s!\t id = %d!\tnhashes = %d\n", fhp->path, (int)fhp->file_id, fhp->nhashes)); - printf("\tid = %d!\tnhashes = %d\n", (int)fhp->file_id, fhp->nhashes); + dprintf(("\tid = %d!\tnhashes = %d\n", (int)fhp->file_id, fhp->nhashes)); TAILQ_FOREACH(csp, &(fhp->checksums), checksum_entries) { - printf("\t\tdigest="); + dprintf(("\t\tdigest=")); for (j = 0; j < hash_len; j++) - printf("%02x", csp->hash[j]); - printf("\n"); + dprintf(("%02x", csp->hash[j])); + dprintf(("\n")); } } } @@ -282,6 +283,10 @@ static int pefs_get_file_id(struct file_header *fhp) { + char parent_dir[MAXPATHLEN]; + struct pefs_mac mac; + char *pch; + int error, fd; struct stat sb; if (stat(fhp->path, &sb) != 0) { @@ -289,11 +294,38 @@ return (PEFS_ERR_SYS); } /* - * XXXgpf: [TODO] This is only temporary since retrieving the file's inode number - * is way simpler than retrieving the checksum value from encrypted filename. + * XXXgpf: [TODO] This is only temporary so that we won't have conflict errors + * when adding a file header to a bucket. */ fhp->file_id = sb.st_ino; - return (0); + + /* feed parent directory to ioctl() */ + strlcpy(parent_dir, fhp->path, sizeof(parent_dir)); + pch = strrchr(parent_dir, '/'); + if (pch == NULL) { + pefs_warn("error retrieving parent dir of %s", fhp->path); + return (PEFS_ERR_NOENT); + } + *pch = '\0'; + + fd = open(parent_dir, O_RDONLY); + if (fd < 0) { + warn("unable to open file %s", parent_dir); + return (PEFS_ERR_SYS); + } + + pch = strrchr(fhp->path, '/'); + pch++; + strlcpy(mac.mac_filename, pch, sizeof(mac.mac_filename)); + mac.mac_namelen = strlen(mac.mac_filename); + + printf("giving values to ioctl() %s and dir = %s\n", mac.mac_filename, parent_dir); + error = ioctl(fd, PEFS_GETMAC, &mac); + printf("ioctl error = %d\n", error); + printf("values returned %lld\n\n", mac.mac_csum); + + close(fd); + return (error); } static int @@ -633,8 +665,9 @@ snprintf(checksum_path, sizeof(checksum_path), "%s/%s", fsroot, PEFS_FILE_CHECKSUM); /* - * XXXgpf: If pefs fs is mounted when .pefs.checksum is created, then it will obtain an - * encrypted filename. It's not a bug, it's a feature! + * XXXgpf: [TODO] If pefs fs is mounted when .pefs.checksum is created, then it will obtain an + * encrypted filename & encrypted data. I should make sure that checksum file is not being + * opened inside a mounted pefs filesystem. */ fdout = open(checksum_path, O_WRONLY | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); if (fdout == -1) { Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h ============================================================================== --- soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h Thu May 24 14:07:44 2012 (r236292) +++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h Thu May 24 15:52:26 2012 (r236293) @@ -48,6 +48,12 @@ char pxk_key[PEFS_KEY_SIZE]; }; +struct pefs_mac { + char mac_filename[MAXPATHLEN]; + uint32_t mac_namelen; + uint64_t mac_csum; +}; + #ifdef _IO #define PEFS_GETKEY _IOWR('p', 0, struct pefs_xkey) #define PEFS_ADDKEY _IOWR('p', 1, struct pefs_xkey) @@ -55,6 +61,7 @@ #define PEFS_DELKEY _IOWR('p', 3, struct pefs_xkey) #define PEFS_FLUSHKEYS _IO('p', 4) #define PEFS_GETNODEKEY _IOWR('p', 5, struct pefs_xkey) +#define PEFS_GETMAC _IOWR('p', 6, struct pefs_mac) #endif #ifdef _KERNEL Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c ============================================================================== --- soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Thu May 24 14:07:44 2012 (r236292) +++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Thu May 24 15:52:26 2012 (r236293) @@ -2355,15 +2355,21 @@ static int pefs_ioctl(struct vop_ioctl_args *ap) { + struct pefs_enccn enccn; + struct componentname cn; + char buf[MAXNAMLEN +1]; struct vnode *vp = ap->a_vp; struct pefs_xkey *xk = ap->a_data; + struct pefs_mac *mac = ap->a_data; struct ucred *cred = ap->a_cred; struct thread *td = ap->a_td; struct mount *mp = vp->v_mount; struct pefs_mount *pm = VFS_TO_PEFS(mp); struct pefs_node *pn; struct pefs_key *pk; - int error = 0, i; + char *enc; + size_t enc_len; + int error = 0, i, r; if (mp->mnt_cred->cr_uid != cred->cr_uid) { error = priv_check_cred(cred, PRIV_VFS_ADMIN, 0); @@ -2465,6 +2471,43 @@ if (pefs_key_remove_all(pm)) pefs_flushkey(mp, td, PEFS_FLUSHKEY_ALL, NULL); break; + case PEFS_GETMAC: + pefs_enccn_init(&enccn); + + cn.cn_nameiop = LOOKUP; + cn.cn_thread = td; + cn.cn_cred = cred; + /* XXXgpf: should probably acquire a shared lock if possible */ + cn.cn_lkflags = 0; + cn.cn_flags = 0; + cn.cn_nameptr = mac->mac_filename; + cn.cn_namelen = mac->mac_namelen; + + error = pefs_enccn_lookup(&enccn, vp, &cn); + printf("pefs_enccn_lookup = %d\n", error); + if (error == 0) { + printf("found!\nlen%ld %s", enccn.pec_cn.cn_namelen, enccn.pec_cn.cn_nameptr); + + enc = enccn.pec_cn.cn_nameptr; + enc_len = enccn.pec_cn.cn_namelen; + + if (enc[0] != '.' || enc_len <= 1) { + error = EINVAL; + break; + } + enc++; + enc_len--; + + r = pefs_name_pton(enc, enc_len, buf, sizeof(buf)); + if (r <= 0) + error = EINVAL; + else + memcpy(&(mac->mac_csum), buf, PEFS_NAME_CSUM_SIZE); + + pefs_enccn_free(&enccn); + } + + break; default: error = ENOTTY; break; From owner-svn-soc-all@FreeBSD.ORG Thu May 24 15:57:56 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 079AE106566B for ; Thu, 24 May 2012 15:57:54 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 24 May 2012 15:57:54 +0000 Date: Thu, 24 May 2012 15:57:54 +0000 From: gpf@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120524155754.079AE106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r236294 - soc2012/gpf/misc X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 May 2012 15:57:56 -0000 Author: gpf Date: Thu May 24 15:57:53 2012 New Revision: 236294 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236294 Log: adding a few misc files for safekeeping Added: soc2012/gpf/misc/calc_space.sh (contents, props changed) soc2012/gpf/misc/ph.py soc2012/gpf/misc/server_results.txt soc2012/gpf/misc/vm_results.txt Added: soc2012/gpf/misc/calc_space.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/gpf/misc/calc_space.sh Thu May 24 15:57:53 2012 (r236294) @@ -0,0 +1,82 @@ +#!/bin/sh +# XXXgpf: script to generate a few useful statistics about system files + +#BLOCKSIZE="K" + +count_dir(){ + cd "$1" + #echo `pwd` + + for file in `ls` + do + if [ -d "$file" ] + then + count_dir $file + cd .. + else + check=1 + # only take into account static & dynamic libraries + if [ $libr_flag -eq 1 ] + then + type=`echo $file | awk -F"." '{print $2}'` + if [ "$type" != "a" ] && [ "$type" != "so" ] + then + check=0 + fi + fi + + if [ $check -eq 1 ] + then + size=`du $file | cut -f 1` + if [ "$size" -gt "$max" ] + then + max=$size + fi + #size=`ls -l $file_path | awk -F" " '{print $5}'` + size_sum=`expr $size_sum + $size` + nfiles=`expr $nfiles + 1` + fi + fi + done +} + +compute(){ + size_average=`echo "scale=2;$size_sum/$nfiles" | bc` + avg_hashes_per_file=`echo "scale=2;$size_average/4" | bc` + avg_total_hashes_size_per_file=`echo "scale=2;$avg_hashes_per_file*64" | bc` + + echo "total size sum =" $size_sum "K" + echo "total files =" $nfiles + echo "arithmetic mean file size =" $size_average "K" + echo "max file size =" $max "K" + echo "average hashes per file=" $avg_hashes_per_file + echo "assuming 64byte hashes, that's" $avg_total_hashes_size_per_file "bytes per file" + echo +} + +# system binaries +for dir in `echo $PATH | awk -F":" '{print $1,$2,$3,$4,$5,$6,$7}'` +do + size_sum=0 + nfiles=0 + libr_flag=0 + max=0 + echo "computing for directory" $dir + count_dir $dir + compute +done + +#system libraries +LIBPATH="/lib:/usr/lib:/usr/local/lib" +for dir in `echo $LIBPATH | awk -F":" '{print $1,$2,$3}'` +do + size_sum=0 + nfiles=0 + libr_flag=1 + max=0 + echo "computing for directory" $dir + count_dir $dir + compute +done + +exit 0 Added: soc2012/gpf/misc/ph.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/gpf/misc/ph.py Thu May 24 15:57:53 2012 (r236294) @@ -0,0 +1,56 @@ +#!/usr/bin/env python +# gleb's script to try out hash table stuff + +import random +import gmpy +from gmpy import mpz + +def count_coll(R, p, embed): + s = 0 + c = [ 0 for x in xrange(0, p) ] + for i in xrange(0, len(R)): + r = R[i] + c[r % p] += 1 + m = max(c) + coll = [ c.count(i) for i in xrange(m, 0, -1) ] + slots = p * embed + fast = sum([ coll[-i] * i for i in xrange(1, embed + 1)]) + fast = float(100) * fast / len(R) + unused0 = c.count(0) * embed + unused = sum([ coll[-i] * (embed - i) for i in xrange(1, embed)]) + unusedp = float(100) * (unused0 + unused) / slots + return "Max collisions: %s, slots: %d/%d, unused: %.02f%% %d+%d, embedded %d: %.02f%%, %s" % \ + (m, p, slots, unusedp, unused0, unused, embed, fast, coll) + +def clp2(x): + x = x - 1 + x = x | (x >> 1) + x = x | (x >> 2) + x = x | (x >> 4) + x = x | (x >> 8) + x = x | (x >>16) + return x + 1 + +def generate_ph(n): + # pz = int(gmpy.next_prime(mpz(n*2/5))) + pz = int(gmpy.next_prime(mpz(n*3/5))) + pz1 = int(gmpy.next_prime(mpz(n))) + p2 = int(clp2(n) / 2) + print 'Items: %s' % (n,) + R = [ random.getrandbits(64) for i in xrange(0, n) ] + while len(R) != len(set(R)): + print 'Initial hash collisions, regenerating: %s/%s', len(set(R)), n + R = [ random.getrandbits(64) for i in xrange(0, n) ] + + print 'Prime ', count_coll(R, pz, 4) + print 'Power2', count_coll(R, p2, 4) + print 'Prime ', count_coll(R, pz, 2) + print 'Power2', count_coll(R, p2, 2) + print 'Prime ', count_coll(R, pz1, 1) + print 'Power2', count_coll(R, p2 * 2, 1) + print '' + +generate_ph(1000) +generate_ph(11000) +generate_ph(22000) +generate_ph(140000) Added: soc2012/gpf/misc/server_results.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/gpf/misc/server_results.txt Thu May 24 15:57:53 2012 (r236294) @@ -0,0 +1,80 @@ +computing for directory /sbin +total size sum = 5508 K +total files = 129 +arithmetic mean file size = 42.69 K +max file size = 736 K +average hashes per file= 10.67 +assuming 64byte hashes, that's 682.88 bytes per file + +computing for directory /bin +total size sum = 1488 K +total files = 44 +arithmetic mean file size = 33.81 K +max file size = 324 K +average hashes per file= 8.45 +assuming 64byte hashes, that's 540.80 bytes per file + +computing for directory /usr/sbin +total size sum = 32120 K +total files = 286 +arithmetic mean file size = 112.30 K +max file size = 2144 K +average hashes per file= 28.07 +assuming 64byte hashes, that's 1796.48 bytes per file + +computing for directory /usr/bin +total size sum = 131292 K +total files = 464 +arithmetic mean file size = 282.95 K +max file size = 29152 K +average hashes per file= 70.73 +assuming 64byte hashes, that's 4526.72 bytes per file + +computing for directory /usr/games +total size sum = 0 K +total files = 0 +arithmetic mean file size = 0.00 K +max file size = 0 K +average hashes per file= 0.00 +assuming 64byte hashes, that's 0.00 bytes per file + +computing for directory /usr/local/sbin +total size sum = 2604 K +total files = 41 +arithmetic mean file size = 63.51 K +max file size = 1120 K +average hashes per file= 15.87 +assuming 64byte hashes, that's 1015.68 bytes per file + +computing for directory /usr/local/bin +total size sum = 189868 K +total files = 751 +arithmetic mean file size = 252.82 K +max file size = 4992 K +average hashes per file= 63.20 +assuming 64byte hashes, that's 4044.80 bytes per file + +computing for directory /lib +total size sum = 7560 K +total files = 61 +arithmetic mean file size = 123.93 K +max file size = 1440 K +average hashes per file= 30.98 +assuming 64byte hashes, that's 1982.72 bytes per file + +computing for directory /usr/lib +total size sum = 50004 K +total files = 541 +arithmetic mean file size = 92.42 K +max file size = 2976 K +average hashes per file= 23.10 +assuming 64byte hashes, that's 1478.40 bytes per file + +computing for directory /usr/local/lib +total size sum = 250968 K +total files = 1107 +arithmetic mean file size = 226.71 K +max file size = 30080 K +average hashes per file= 56.67 +assuming 64byte hashes, that's 3626.88 bytes per file + Added: soc2012/gpf/misc/vm_results.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/gpf/misc/vm_results.txt Thu May 24 15:57:53 2012 (r236294) @@ -0,0 +1,80 @@ +computing for directory /sbin +total size sum = 6736 K +total files = 131 +arithmetic mean file size = 51.41 K +max file size = 832 K +average hashes per file= 12.85 +assuming 64byte hashes, that's 822.40 bytes per file + +computing for directory /bin +total size sum = 1552 K +total files = 44 +arithmetic mean file size = 35.27 K +max file size = 336 K +average hashes per file= 8.81 +assuming 64byte hashes, that's 563.84 bytes per file + +computing for directory /usr/sbin +total size sum = 33060 K +total files = 290 +arithmetic mean file size = 114.00 K +max file size = 2176 K +average hashes per file= 28.50 +assuming 64byte hashes, that's 1824.00 bytes per file + +computing for directory /usr/bin +total size sum = 147164 K +total files = 479 +arithmetic mean file size = 307.23 K +max file size = 33664 K +average hashes per file= 76.80 +assuming 64byte hashes, that's 4915.20 bytes per file + +computing for directory /usr/games +total size sum = 224 K +total files = 14 +arithmetic mean file size = 16.00 K +max file size = 52 K +average hashes per file= 4.00 +assuming 64byte hashes, that's 256.00 bytes per file + +computing for directory /usr/local/sbin +total size sum = 2856 K +total files = 30 +arithmetic mean file size = 95.20 K +max file size = 928 K +average hashes per file= 23.80 +assuming 64byte hashes, that's 1523.20 bytes per file + +computing for directory /usr/local/bin +total size sum = 94196 K +total files = 710 +arithmetic mean file size = 132.67 K +max file size = 4992 K +average hashes per file= 33.16 +assuming 64byte hashes, that's 2122.24 bytes per file + +computing for directory /lib +total size sum = 7884 K +total files = 62 +arithmetic mean file size = 127.16 K +max file size = 1472 K +average hashes per file= 31.79 +assuming 64byte hashes, that's 2034.56 bytes per file + +computing for directory /usr/lib +total size sum = 56656 K +total files = 579 +arithmetic mean file size = 97.85 K +max file size = 3232 K +average hashes per file= 24.46 +assuming 64byte hashes, that's 1565.44 bytes per file + +computing for directory /usr/local/lib +total size sum = 260688 K +total files = 1486 +arithmetic mean file size = 175.42 K +max file size = 12640 K +average hashes per file= 43.85 +assuming 64byte hashes, that's 2806.40 bytes per file + From owner-svn-soc-all@FreeBSD.ORG Thu May 24 16:10:33 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 01793106564A for ; Thu, 24 May 2012 16:10:32 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 24 May 2012 16:10:32 +0000 Date: Thu, 24 May 2012 16:10:32 +0000 From: rudot@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120524161032.01793106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r236297 - soc2012/rudot/head X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 May 2012 16:10:33 -0000 Author: rudot Date: Thu May 24 16:10:31 2012 New Revision: 236297 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236297 Log: copy of the FreeBSD head from the mirror Added: soc2012/rudot/head/ (props changed) - copied from r236296, mirror/FreeBSD/head/ From owner-svn-soc-all@FreeBSD.ORG Thu May 24 16:22:18 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id E79951065686 for ; Thu, 24 May 2012 16:22:17 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 24 May 2012 16:22:17 +0000 Date: Thu, 24 May 2012 16:22:17 +0000 From: rudot@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120524162217.E79951065686@hub.freebsd.org> Cc: Subject: socsvn commit: r236298 - soc2012/rudot/sys/kern X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 May 2012 16:22:19 -0000 Author: rudot Date: Thu May 24 16:22:16 2012 New Revision: 236298 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236298 Log: initial version of the kern_racct.c file Added: soc2012/rudot/sys/kern/kern_racct.c Added: soc2012/rudot/sys/kern/kern_racct.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/sys/kern/kern_racct.c Thu May 24 16:22:16 2012 (r236298) @@ -0,0 +1,839 @@ +/*- + * Copyright (c) 2010 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Edward Tomasz Napierala under sponsorship + * from the FreeBSD Foundation. + * + * 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: src/sys/kern/kern_racct.c,v 1.17 2012/04/17 14:31:02 trasz Exp $ + */ + +#include +__FBSDID("$FreeBSD: src/sys/kern/kern_racct.c,v 1.17 2012/04/17 14:31:02 trasz Exp $"); + +#include "opt_kdtrace.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef RCTL +#include +#endif + +#ifdef RACCT + +FEATURE(racct, "Resource Accounting"); + +static struct mtx racct_lock; +MTX_SYSINIT(racct_lock, &racct_lock, "racct lock", MTX_DEF); + +static uma_zone_t racct_zone; + +static void racct_sub_racct(struct racct *dest, const struct racct *src); +static void racct_sub_cred_locked(struct ucred *cred, int resource, + uint64_t amount); +static void racct_add_cred_locked(struct ucred *cred, int resource, + uint64_t amount); + +SDT_PROVIDER_DEFINE(racct); +SDT_PROBE_DEFINE3(racct, kernel, rusage, add, add, "struct proc *", "int", + "uint64_t"); +SDT_PROBE_DEFINE3(racct, kernel, rusage, add_failure, add-failure, + "struct proc *", "int", "uint64_t"); +SDT_PROBE_DEFINE3(racct, kernel, rusage, add_cred, add-cred, "struct ucred *", + "int", "uint64_t"); +SDT_PROBE_DEFINE3(racct, kernel, rusage, add_force, add-force, "struct proc *", + "int", "uint64_t"); +SDT_PROBE_DEFINE3(racct, kernel, rusage, set, set, "struct proc *", "int", + "uint64_t"); +SDT_PROBE_DEFINE3(racct, kernel, rusage, set_failure, set-failure, + "struct proc *", "int", "uint64_t"); +SDT_PROBE_DEFINE3(racct, kernel, rusage, sub, sub, "struct proc *", "int", + "uint64_t"); +SDT_PROBE_DEFINE3(racct, kernel, rusage, sub_cred, sub-cred, "struct ucred *", + "int", "uint64_t"); +SDT_PROBE_DEFINE1(racct, kernel, racct, create, create, "struct racct *"); +SDT_PROBE_DEFINE1(racct, kernel, racct, destroy, destroy, "struct racct *"); +SDT_PROBE_DEFINE2(racct, kernel, racct, join, join, "struct racct *", + "struct racct *"); +SDT_PROBE_DEFINE2(racct, kernel, racct, join_failure, join-failure, + "struct racct *", "struct racct *"); +SDT_PROBE_DEFINE2(racct, kernel, racct, leave, leave, "struct racct *", + "struct racct *"); + +int racct_types[] = { + [RACCT_CPU] = + RACCT_IN_MILLIONS, + [RACCT_DATA] = + RACCT_RECLAIMABLE | RACCT_INHERITABLE | RACCT_DENIABLE, + [RACCT_STACK] = + RACCT_RECLAIMABLE | RACCT_INHERITABLE | RACCT_DENIABLE, + [RACCT_CORE] = + RACCT_DENIABLE, + [RACCT_RSS] = + RACCT_RECLAIMABLE, + [RACCT_MEMLOCK] = + RACCT_RECLAIMABLE | RACCT_DENIABLE, + [RACCT_NPROC] = + RACCT_RECLAIMABLE | RACCT_DENIABLE, + [RACCT_NOFILE] = + RACCT_RECLAIMABLE | RACCT_INHERITABLE | RACCT_DENIABLE, + [RACCT_VMEM] = + RACCT_RECLAIMABLE | RACCT_INHERITABLE | RACCT_DENIABLE, + [RACCT_NPTS] = + RACCT_RECLAIMABLE | RACCT_DENIABLE | RACCT_SLOPPY, + [RACCT_SWAP] = + RACCT_RECLAIMABLE | RACCT_DENIABLE | RACCT_SLOPPY, + [RACCT_NTHR] = + RACCT_RECLAIMABLE | RACCT_DENIABLE, + [RACCT_MSGQQUEUED] = + RACCT_RECLAIMABLE | RACCT_DENIABLE | RACCT_SLOPPY, + [RACCT_MSGQSIZE] = + RACCT_RECLAIMABLE | RACCT_DENIABLE | RACCT_SLOPPY, + [RACCT_NMSGQ] = + RACCT_RECLAIMABLE | RACCT_DENIABLE | RACCT_SLOPPY, + [RACCT_NSEM] = + RACCT_RECLAIMABLE | RACCT_DENIABLE | RACCT_SLOPPY, + [RACCT_NSEMOP] = + RACCT_RECLAIMABLE | RACCT_INHERITABLE | RACCT_DENIABLE, + [RACCT_NSHM] = + RACCT_RECLAIMABLE | RACCT_DENIABLE | RACCT_SLOPPY, + [RACCT_SHMSIZE] = + RACCT_RECLAIMABLE | RACCT_DENIABLE | RACCT_SLOPPY, + [RACCT_WALLCLOCK] = + RACCT_IN_MILLIONS }; + +static void +racct_add_racct(struct racct *dest, const struct racct *src) +{ + int i; + + mtx_assert(&racct_lock, MA_OWNED); + + /* + * Update resource usage in dest. + */ + for (i = 0; i <= RACCT_MAX; i++) { + KASSERT(dest->r_resources[i] >= 0, + ("racct propagation meltdown: dest < 0")); + KASSERT(src->r_resources[i] >= 0, + ("racct propagation meltdown: src < 0")); + dest->r_resources[i] += src->r_resources[i]; + } +} + +static void +racct_sub_racct(struct racct *dest, const struct racct *src) +{ + int i; + + mtx_assert(&racct_lock, MA_OWNED); + + /* + * Update resource usage in dest. + */ + for (i = 0; i <= RACCT_MAX; i++) { + if (!RACCT_IS_SLOPPY(i)) { + KASSERT(dest->r_resources[i] >= 0, + ("racct propagation meltdown: dest < 0")); + KASSERT(src->r_resources[i] >= 0, + ("racct propagation meltdown: src < 0")); + KASSERT(src->r_resources[i] <= dest->r_resources[i], + ("racct propagation meltdown: src > dest")); + } + if (RACCT_IS_RECLAIMABLE(i)) { + dest->r_resources[i] -= src->r_resources[i]; + if (dest->r_resources[i] < 0) { + KASSERT(RACCT_IS_SLOPPY(i), + ("racct_sub_racct: usage < 0")); + dest->r_resources[i] = 0; + } + } + } +} + +void +racct_create(struct racct **racctp) +{ + + SDT_PROBE(racct, kernel, racct, create, racctp, 0, 0, 0, 0); + + KASSERT(*racctp == NULL, ("racct already allocated")); + + *racctp = uma_zalloc(racct_zone, M_WAITOK | M_ZERO); +} + +static void +racct_destroy_locked(struct racct **racctp) +{ + int i; + struct racct *racct; + + SDT_PROBE(racct, kernel, racct, destroy, racctp, 0, 0, 0, 0); + + mtx_assert(&racct_lock, MA_OWNED); + KASSERT(racctp != NULL, ("NULL racctp")); + KASSERT(*racctp != NULL, ("NULL racct")); + + racct = *racctp; + + for (i = 0; i <= RACCT_MAX; i++) { + if (RACCT_IS_SLOPPY(i)) + continue; + if (!RACCT_IS_RECLAIMABLE(i)) + continue; + KASSERT(racct->r_resources[i] == 0, + ("destroying non-empty racct: " + "%ju allocated for resource %d\n", + racct->r_resources[i], i)); + } + uma_zfree(racct_zone, racct); + *racctp = NULL; +} + +void +racct_destroy(struct racct **racct) +{ + + mtx_lock(&racct_lock); + racct_destroy_locked(racct); + mtx_unlock(&racct_lock); +} + +/* + * Increase consumption of 'resource' by 'amount' for 'racct' + * and all its parents. Differently from other cases, 'amount' here + * may be less than zero. + */ +static void +racct_alloc_resource(struct racct *racct, int resource, + uint64_t amount) +{ + + mtx_assert(&racct_lock, MA_OWNED); + KASSERT(racct != NULL, ("NULL racct")); + + racct->r_resources[resource] += amount; + if (racct->r_resources[resource] < 0) { + KASSERT(RACCT_IS_SLOPPY(resource), + ("racct_alloc_resource: usage < 0")); + racct->r_resources[resource] = 0; + } +} + +static int +racct_add_locked(struct proc *p, int resource, uint64_t amount) +{ +#ifdef RCTL + int error; +#endif + + SDT_PROBE(racct, kernel, rusage, add, p, resource, amount, 0, 0); + + /* + * We need proc lock to dereference p->p_ucred. + */ + PROC_LOCK_ASSERT(p, MA_OWNED); + +#ifdef RCTL + error = rctl_enforce(p, resource, amount); + if (error && RACCT_IS_DENIABLE(resource)) { + SDT_PROBE(racct, kernel, rusage, add_failure, p, resource, + amount, 0, 0); + return (error); + } +#endif + racct_alloc_resource(p->p_racct, resource, amount); + racct_add_cred_locked(p->p_ucred, resource, amount); + + return (0); +} + +/* + * Increase allocation of 'resource' by 'amount' for process 'p'. + * Return 0 if it's below limits, or errno, if it's not. + */ +int +racct_add(struct proc *p, int resource, uint64_t amount) +{ + int error; + + mtx_lock(&racct_lock); + error = racct_add_locked(p, resource, amount); + mtx_unlock(&racct_lock); + return (error); +} + +static void +racct_add_cred_locked(struct ucred *cred, int resource, uint64_t amount) +{ + struct prison *pr; + + SDT_PROBE(racct, kernel, rusage, add_cred, cred, resource, amount, + 0, 0); + + racct_alloc_resource(cred->cr_ruidinfo->ui_racct, resource, amount); + for (pr = cred->cr_prison; pr != NULL; pr = pr->pr_parent) + racct_alloc_resource(pr->pr_prison_racct->prr_racct, resource, + amount); + racct_alloc_resource(cred->cr_loginclass->lc_racct, resource, amount); +} + +/* + * Increase allocation of 'resource' by 'amount' for credential 'cred'. + * Doesn't check for limits and never fails. + * + * XXX: Shouldn't this ever return an error? + */ +void +racct_add_cred(struct ucred *cred, int resource, uint64_t amount) +{ + + mtx_lock(&racct_lock); + racct_add_cred_locked(cred, resource, amount); + mtx_unlock(&racct_lock); +} + +/* + * Increase allocation of 'resource' by 'amount' for process 'p'. + * Doesn't check for limits and never fails. + */ +void +racct_add_force(struct proc *p, int resource, uint64_t amount) +{ + + SDT_PROBE(racct, kernel, rusage, add_force, p, resource, amount, 0, 0); + + /* + * We need proc lock to dereference p->p_ucred. + */ + PROC_LOCK_ASSERT(p, MA_OWNED); + + mtx_lock(&racct_lock); + racct_alloc_resource(p->p_racct, resource, amount); + mtx_unlock(&racct_lock); + racct_add_cred(p->p_ucred, resource, amount); +} + +static int +racct_set_locked(struct proc *p, int resource, uint64_t amount) +{ + int64_t diff; +#ifdef RCTL + int error; +#endif + + SDT_PROBE(racct, kernel, rusage, set, p, resource, amount, 0, 0); + + /* + * We need proc lock to dereference p->p_ucred. + */ + PROC_LOCK_ASSERT(p, MA_OWNED); + + diff = amount - p->p_racct->r_resources[resource]; +#ifdef notyet + KASSERT(diff >= 0 || RACCT_IS_RECLAIMABLE(resource), + ("racct_set: usage of non-reclaimable resource %d dropping", + resource)); +#endif +#ifdef RCTL + if (diff > 0) { + error = rctl_enforce(p, resource, diff); + if (error && RACCT_IS_DENIABLE(resource)) { + SDT_PROBE(racct, kernel, rusage, set_failure, p, + resource, amount, 0, 0); + return (error); + } + } +#endif + racct_alloc_resource(p->p_racct, resource, diff); + if (diff > 0) + racct_add_cred_locked(p->p_ucred, resource, diff); + else if (diff < 0) + racct_sub_cred_locked(p->p_ucred, resource, -diff); + + return (0); +} + +/* + * Set allocation of 'resource' to 'amount' for process 'p'. + * Return 0 if it's below limits, or errno, if it's not. + * + * Note that decreasing the allocation always returns 0, + * even if it's above the limit. + */ +int +racct_set(struct proc *p, int resource, uint64_t amount) +{ + int error; + + mtx_lock(&racct_lock); + error = racct_set_locked(p, resource, amount); + mtx_unlock(&racct_lock); + return (error); +} + +void +racct_set_force(struct proc *p, int resource, uint64_t amount) +{ + int64_t diff; + + SDT_PROBE(racct, kernel, rusage, set, p, resource, amount, 0, 0); + + /* + * We need proc lock to dereference p->p_ucred. + */ + PROC_LOCK_ASSERT(p, MA_OWNED); + + mtx_lock(&racct_lock); + diff = amount - p->p_racct->r_resources[resource]; + racct_alloc_resource(p->p_racct, resource, diff); + if (diff > 0) + racct_add_cred_locked(p->p_ucred, resource, diff); + else if (diff < 0) + racct_sub_cred_locked(p->p_ucred, resource, -diff); + mtx_unlock(&racct_lock); +} + +/* + * Returns amount of 'resource' the process 'p' can keep allocated. + * Allocating more than that would be denied, unless the resource + * is marked undeniable. Amount of already allocated resource does + * not matter. + */ +uint64_t +racct_get_limit(struct proc *p, int resource) +{ + +#ifdef RCTL + return (rctl_get_limit(p, resource)); +#else + return (UINT64_MAX); +#endif +} + +/* + * Returns amount of 'resource' the process 'p' can keep allocated. + * Allocating more than that would be denied, unless the resource + * is marked undeniable. Amount of already allocated resource does + * matter. + */ +uint64_t +racct_get_available(struct proc *p, int resource) +{ + +#ifdef RCTL + return (rctl_get_available(p, resource)); +#else + return (UINT64_MAX); +#endif +} + +/* + * Decrease allocation of 'resource' by 'amount' for process 'p'. + */ +void +racct_sub(struct proc *p, int resource, uint64_t amount) +{ + + SDT_PROBE(racct, kernel, rusage, sub, p, resource, amount, 0, 0); + + /* + * We need proc lock to dereference p->p_ucred. + */ + PROC_LOCK_ASSERT(p, MA_OWNED); + KASSERT(RACCT_IS_RECLAIMABLE(resource), + ("racct_sub: called for non-reclaimable resource %d", resource)); + + mtx_lock(&racct_lock); + KASSERT(amount <= p->p_racct->r_resources[resource], + ("racct_sub: freeing %ju of resource %d, which is more " + "than allocated %jd for %s (pid %d)", amount, resource, + (intmax_t)p->p_racct->r_resources[resource], p->p_comm, p->p_pid)); + + racct_alloc_resource(p->p_racct, resource, -amount); + racct_sub_cred_locked(p->p_ucred, resource, amount); + mtx_unlock(&racct_lock); +} + +static void +racct_sub_cred_locked(struct ucred *cred, int resource, uint64_t amount) +{ + struct prison *pr; + + SDT_PROBE(racct, kernel, rusage, sub_cred, cred, resource, amount, + 0, 0); + +#ifdef notyet + KASSERT(RACCT_IS_RECLAIMABLE(resource), + ("racct_sub_cred: called for non-reclaimable resource %d", + resource)); +#endif + + racct_alloc_resource(cred->cr_ruidinfo->ui_racct, resource, -amount); + for (pr = cred->cr_prison; pr != NULL; pr = pr->pr_parent) + racct_alloc_resource(pr->pr_prison_racct->prr_racct, resource, + -amount); + racct_alloc_resource(cred->cr_loginclass->lc_racct, resource, -amount); +} + +/* + * Decrease allocation of 'resource' by 'amount' for credential 'cred'. + */ +void +racct_sub_cred(struct ucred *cred, int resource, uint64_t amount) +{ + + mtx_lock(&racct_lock); + racct_sub_cred_locked(cred, resource, amount); + mtx_unlock(&racct_lock); +} + +/* + * Inherit resource usage information from the parent process. + */ +int +racct_proc_fork(struct proc *parent, struct proc *child) +{ + int i, error = 0; + + /* + * Create racct for the child process. + */ + racct_create(&child->p_racct); + + PROC_LOCK(parent); + PROC_LOCK(child); + mtx_lock(&racct_lock); + +#ifdef RCTL + error = rctl_proc_fork(parent, child); + if (error != 0) + goto out; +#endif + + /* + * Inherit resource usage. + */ + for (i = 0; i <= RACCT_MAX; i++) { + if (parent->p_racct->r_resources[i] == 0 || + !RACCT_IS_INHERITABLE(i)) + continue; + + error = racct_set_locked(child, i, + parent->p_racct->r_resources[i]); + if (error != 0) + goto out; + } + + error = racct_add_locked(child, RACCT_NPROC, 1); + error += racct_add_locked(child, RACCT_NTHR, 1); + +out: + mtx_unlock(&racct_lock); + PROC_UNLOCK(child); + PROC_UNLOCK(parent); + + return (error); +} + +/* + * Called at the end of fork1(), to handle rules that require the process + * to be fully initialized. + */ +void +racct_proc_fork_done(struct proc *child) +{ + +#ifdef RCTL + PROC_LOCK(child); + mtx_lock(&racct_lock); + rctl_enforce(child, RACCT_NPROC, 0); + rctl_enforce(child, RACCT_NTHR, 0); + mtx_unlock(&racct_lock); + PROC_UNLOCK(child); +#endif +} + +void +racct_proc_exit(struct proc *p) +{ + int i; + uint64_t runtime; + + PROC_LOCK(p); + /* + * We don't need to calculate rux, proc_reap() has already done this. + */ + runtime = cputick2usec(p->p_rux.rux_runtime); +#ifdef notyet + KASSERT(runtime >= p->p_prev_runtime, ("runtime < p_prev_runtime")); +#else + if (runtime < p->p_prev_runtime) + runtime = p->p_prev_runtime; +#endif + mtx_lock(&racct_lock); + racct_set_locked(p, RACCT_CPU, runtime); + + for (i = 0; i <= RACCT_MAX; i++) { + if (p->p_racct->r_resources[i] == 0) + continue; + if (!RACCT_IS_RECLAIMABLE(i)) + continue; + racct_set_locked(p, i, 0); + } + + mtx_unlock(&racct_lock); + PROC_UNLOCK(p); + +#ifdef RCTL + rctl_racct_release(p->p_racct); +#endif + racct_destroy(&p->p_racct); +} + +/* + * Called after credentials change, to move resource utilisation + * between raccts. + */ +void +racct_proc_ucred_changed(struct proc *p, struct ucred *oldcred, + struct ucred *newcred) +{ + struct uidinfo *olduip, *newuip; + struct loginclass *oldlc, *newlc; + struct prison *oldpr, *newpr, *pr; + + PROC_LOCK_ASSERT(p, MA_NOTOWNED); + + newuip = newcred->cr_ruidinfo; + olduip = oldcred->cr_ruidinfo; + newlc = newcred->cr_loginclass; + oldlc = oldcred->cr_loginclass; + newpr = newcred->cr_prison; + oldpr = oldcred->cr_prison; + + mtx_lock(&racct_lock); + if (newuip != olduip) { + racct_sub_racct(olduip->ui_racct, p->p_racct); + racct_add_racct(newuip->ui_racct, p->p_racct); + } + if (newlc != oldlc) { + racct_sub_racct(oldlc->lc_racct, p->p_racct); + racct_add_racct(newlc->lc_racct, p->p_racct); + } + if (newpr != oldpr) { + for (pr = oldpr; pr != NULL; pr = pr->pr_parent) + racct_sub_racct(pr->pr_prison_racct->prr_racct, + p->p_racct); + for (pr = newpr; pr != NULL; pr = pr->pr_parent) + racct_add_racct(pr->pr_prison_racct->prr_racct, + p->p_racct); + } + mtx_unlock(&racct_lock); + +#ifdef RCTL + rctl_proc_ucred_changed(p, newcred); +#endif +} + +void +racct_move(struct racct *dest, struct racct *src) +{ + + mtx_lock(&racct_lock); + + racct_add_racct(dest, src); + racct_sub_racct(src, src); + + mtx_unlock(&racct_lock); +} + +static void +racctd(void) +{ + struct thread *td; + struct proc *p; + struct timeval wallclock; + uint64_t runtime; + + for (;;) { + sx_slock(&allproc_lock); + + FOREACH_PROC_IN_SYSTEM(p) { + if (p->p_state != PRS_NORMAL) + continue; + + microuptime(&wallclock); + timevalsub(&wallclock, &p->p_stats->p_start); + PROC_LOCK(p); + PROC_SLOCK(p); + FOREACH_THREAD_IN_PROC(p, td) + ruxagg(p, td); + runtime = cputick2usec(p->p_rux.rux_runtime); + PROC_SUNLOCK(p); +#ifdef notyet + KASSERT(runtime >= p->p_prev_runtime, + ("runtime < p_prev_runtime")); +#else + if (runtime < p->p_prev_runtime) + runtime = p->p_prev_runtime; +#endif + p->p_prev_runtime = runtime; + mtx_lock(&racct_lock); + racct_set_locked(p, RACCT_CPU, runtime); + racct_set_locked(p, RACCT_WALLCLOCK, + (uint64_t)wallclock.tv_sec * 1000000 + + wallclock.tv_usec); + mtx_unlock(&racct_lock); + PROC_UNLOCK(p); + } + sx_sunlock(&allproc_lock); + pause("-", hz); + } +} + +static struct kproc_desc racctd_kp = { + "racctd", + racctd, + NULL +}; +SYSINIT(racctd, SI_SUB_RACCTD, SI_ORDER_FIRST, kproc_start, &racctd_kp); + +static void +racct_init(void) +{ + + racct_zone = uma_zcreate("racct", sizeof(struct racct), + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); + /* + * XXX: Move this somewhere. + */ + prison0.pr_prison_racct = prison_racct_find("0"); +} +SYSINIT(racct, SI_SUB_RACCT, SI_ORDER_FIRST, racct_init, NULL); + +#else /* !RACCT */ + +int +racct_add(struct proc *p, int resource, uint64_t amount) +{ + + return (0); +} + +void +racct_add_cred(struct ucred *cred, int resource, uint64_t amount) +{ +} + +void +racct_add_force(struct proc *p, int resource, uint64_t amount) +{ + + return; +} + +int +racct_set(struct proc *p, int resource, uint64_t amount) +{ + + return (0); +} + +void +racct_set_force(struct proc *p, int resource, uint64_t amount) +{ +} + +void +racct_sub(struct proc *p, int resource, uint64_t amount) +{ +} + +void +racct_sub_cred(struct ucred *cred, int resource, uint64_t amount) +{ +} + +uint64_t +racct_get_limit(struct proc *p, int resource) +{ + + return (UINT64_MAX); +} + +uint64_t +racct_get_available(struct proc *p, int resource) +{ + + return (UINT64_MAX); +} + +void +racct_create(struct racct **racctp) +{ +} + +void +racct_destroy(struct racct **racctp) +{ +} + +int +racct_proc_fork(struct proc *parent, struct proc *child) +{ + + return (0); +} + +void +racct_proc_fork_done(struct proc *child) +{ +} + +void +racct_proc_exit(struct proc *p) +{ +} + +#endif /* !RACCT */ From owner-svn-soc-all@FreeBSD.ORG Thu May 24 16:23:22 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 824441065670 for ; Thu, 24 May 2012 16:23:21 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 24 May 2012 16:23:21 +0000 Date: Thu, 24 May 2012 16:23:21 +0000 From: rudot@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120524162321.824441065670@hub.freebsd.org> Cc: Subject: socsvn commit: r236299 - soc2012/rudot/head X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 May 2012 16:23:22 -0000 Author: rudot Date: Thu May 24 16:23:21 2012 New Revision: 236299 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236299 Log: Deleted: soc2012/rudot/head/ From owner-svn-soc-all@FreeBSD.ORG Thu May 24 16:36:56 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id B3A17106564A for ; Thu, 24 May 2012 16:36:54 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 24 May 2012 16:36:54 +0000 Date: Thu, 24 May 2012 16:36:54 +0000 From: rudot@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120524163654.B3A17106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r236300 - in soc2012/rudot: aux sys/kern X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 May 2012 16:36:56 -0000 Author: rudot Date: Thu May 24 16:36:54 2012 New Revision: 236300 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236300 Log: the 4bsd scheduler sets the RACCT_PCTCPU resource value, it is not finished yet. Modified: soc2012/rudot/aux/notes.txt soc2012/rudot/sys/kern/kern_racct.c soc2012/rudot/sys/kern/sched_4bsd.c Modified: soc2012/rudot/aux/notes.txt ============================================================================== --- soc2012/rudot/aux/notes.txt Thu May 24 16:23:21 2012 (r236299) +++ soc2012/rudot/aux/notes.txt Thu May 24 16:36:54 2012 (r236300) @@ -1 +1,4 @@ rctl -a process:PID:pcpu:deny=50 works + +sched_4bsd sets the RACCT_PCTCPU resource to the td->ts_pctcpu value in the +schedcpu routine. I will move it probably to the sched_clock. Modified: soc2012/rudot/sys/kern/kern_racct.c ============================================================================== --- soc2012/rudot/sys/kern/kern_racct.c Thu May 24 16:23:21 2012 (r236299) +++ soc2012/rudot/sys/kern/kern_racct.c Thu May 24 16:36:54 2012 (r236300) @@ -140,7 +140,8 @@ [RACCT_SHMSIZE] = RACCT_RECLAIMABLE | RACCT_DENIABLE | RACCT_SLOPPY, [RACCT_WALLCLOCK] = - RACCT_IN_MILLIONS }; + RACCT_IN_MILLIONS, + [RACCT_PCTCPU] = RACCT_RECLAIMABLE | RACCT_DENIABLE }; static void racct_add_racct(struct racct *dest, const struct racct *src) Modified: soc2012/rudot/sys/kern/sched_4bsd.c ============================================================================== --- soc2012/rudot/sys/kern/sched_4bsd.c Thu May 24 16:23:21 2012 (r236299) +++ soc2012/rudot/sys/kern/sched_4bsd.c Thu May 24 16:36:54 2012 (r236300) @@ -68,6 +68,10 @@ dtrace_vtime_switch_func_t dtrace_vtime_switch_func; #endif +#ifdef RACCT +#include +#endif + /* * INVERSE_ESTCPU_WEIGHT is only suitable for statclock() frequencies in * the range 100-256 Hz (approximately). @@ -507,6 +511,9 @@ #endif ts->ts_cpticks = 0; } +#ifdef RACCT + racct_set(p, RACCT_PCTCPU, ts->ts_pctcpu); +#endif /* * If there are ANY running threads in this process, * then don't count it as sleeping. @@ -670,6 +677,18 @@ return (sched_quantum); } +#ifdef RACCT +static int +sched_racct_pcpu_deny(struct thread *td) +{ + struct proc *p; + + p = td->td_proc; + + return (0); +} +#endif + /* * We adjust the priority of the current process. The priority of * a process gets worse as it accumulates CPU time. The cpu usage @@ -708,6 +727,12 @@ ticks - PCPU_GET(switchticks) >= sched_quantum) td->td_flags |= TDF_NEEDRESCHED; +#ifdef RACCT + if (!TD_IS_IDLETHREAD(td) && + sched_racct_pcpu_deny(td)) + td->td_flags |= TDF_NEEDRESCHED; +#endif + stat = DPCPU_PTR(idlestat); stat->oldidlecalls = stat->idlecalls; stat->idlecalls = 0; From owner-svn-soc-all@FreeBSD.ORG Thu May 24 18:42:06 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id C5E31106566C for ; Thu, 24 May 2012 18:42:04 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 24 May 2012 18:42:04 +0000 Date: Thu, 24 May 2012 18:42:04 +0000 From: scher@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120524184204.C5E31106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r236308 - soc2012/scher/par_ports/head/Mk X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 May 2012 18:42:06 -0000 Author: scher Date: Thu May 24 18:42:04 2012 New Revision: 236308 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236308 Log: [new_feature] bsd.parallel.mk: default targets evaluation test. bsd.port.mk: includes bsd.parallel.mk. Enables locking/unlocking ${.CURDIR} [fixed] bsd.parallel.mk: Changes of LOCK file mod. ps instead of pgrep. feedBack messages. bsd.parallel.mk: Is included in bsd.port.mk. Hence PKG_DBDIR is unnecessary. include is unnecessary either. "ps" command is more appropriate for PID searching. .lock file mod is changed to 777. To allow open access. More clear feedback messages. ${_parv_IS_DEFAULT_TARGET} - trigers default targets, specified by _parv_DEFAULT_TARGETS. ------------------------------------------------ bsd.port.mk: include of bsd.parallel.mk is triggered by ${WANT_PARALLEL_BUILD} var. Locking/unlocking of port's dir for evaluation of deafault targets. Submitted by: Alexander Pronin Modified: soc2012/scher/par_ports/head/Mk/bsd.parallel.mk soc2012/scher/par_ports/head/Mk/bsd.port.mk Modified: soc2012/scher/par_ports/head/Mk/bsd.parallel.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Thu May 24 17:39:54 2012 (r236307) +++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Thu May 24 18:42:04 2012 (r236308) @@ -5,7 +5,6 @@ # # Please view me with 4 column tabs! -.include _dparv_= @@ -19,8 +18,28 @@ _dparv_END_OUTPUT= ${ECHO_CMD} ${_dparv_END_OUTPUT_MESSAGE} # End of Debugging specific tools and variable declarations section ##################################################### +##################################################### +_parv_DEFAULT_TARGETS= all check-sanity fetch checksum extract patch configure build install +_parv_IS_DEFAULT_TARGET= 0 - +# e.g. make "WANT_PARALLEL_BUILD=" +# All target will be evaluated. It is in default sequence +# +.if !${.TARGETS} +_parv_IS_DEFAULT_TARGET= 1 +.else +_dparv_TARGETS:=${.TARGETS} + +.for _called_target in ${.TARGETS} +_tmp_called_target= ${_called_target} +. for _def_target in ${_parv_DEFAULT_TARGETS} +. if ${_tmp_called_target} == ${_def_target} +_parv_IS_DEFAULT_TARGET= 1 +. endif +. endfor +.endfor +.endif #!{.TARGETS} +##################################################### ##################################################### # Commands _parv_KILL= /bin/kill @@ -31,7 +50,7 @@ ##################################################### ##################################################### # Locking variables and tools -PKG_DBDIR?= /var/db/pkg +#PKG_DBDIR?= /var/db/pkg _parv_LOCK_FILE= .lock _parv_WAIT_FOR_LOCK_TIME= 5 @@ -59,20 +78,21 @@ # _parv_.CURDIR_LOCK_SEQ # _parv_${_lock_dir}_LOCK_SEQ= \ + ${CHMOD} 777 ${${_lock_dir}}/${_parv_LOCK_FILE}; \ pid=$$(${CAT} ${${_lock_dir}}/${_parv_LOCK_FILE}); \ if [ $${pid} ]; then \ - pgrep -P $${pid} > /dev/null; \ + ps -p $${pid} > /dev/null; \ status=$$(${ECHO_CMD} $$?); \ if [ $${status} -eq 0 ]; then \ ${_dparv_START_OUTPUT}; \ ${ECHO_CMD} Unable to lock ${${_lock_dir}}; \ - ${ECHO_CMD} Dir: ${${_lock_dir}} is already locked by another working process ...; \ + ${ECHO_CMD} Dir: ${${_lock_dir}} is already locked by another working process PID=$${pid}...; \ ${_dparv_END_OUTPUT}; \ ${_parv_KILL} ${_parv_KILL_FLAGS} -${.MAKE.PID}; \ else \ ${_dparv_START_OUTPUT}; \ ${ECHO_CMD} Dir: ${${_lock_dir}} Stalled lock Detected!; \ - ${ECHO_CMD} Deleting stalled lock; \ + ${ECHO_CMD} Deleting stalled lock. PID=$${pid}; \ ${ECHO_CMD} Locking: ${${_lock_dir}}; \ ${_dparv_END_OUTPUT}; \ ${ECHO_CMD} ${.MAKE.PID} > ${${_lock_dir}}/${_parv_LOCK_FILE}; \ Modified: soc2012/scher/par_ports/head/Mk/bsd.port.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.port.mk Thu May 24 17:39:54 2012 (r236307) +++ soc2012/scher/par_ports/head/Mk/bsd.port.mk Thu May 24 18:42:04 2012 (r236308) @@ -1128,6 +1128,17 @@ .include "${PORTSDIR}/Mk/bsd.commands.mk" +############### PAR_PORTS SPECIFIC COMMENT LINE ############### +# _parv_WANT_PARALLEL_BUILD - define this variable if port want to enable +# parallel build/install features +# + +.if defined(WANT_PARALLEL_BUILD) +.include "${PORTSDIR}/Mk/bsd.parallel.mk" +.endif + +############### ENDF OF PAR_PORTS SPECIFIC COMMENT LINE ############### + # # DESTDIR section to start a chrooted process if invoked with DESTDIR set # @@ -1514,15 +1525,32 @@ .include "${PORTSDIR}/Mk/bsd.ncurses.mk" .endif -# You can force skipping these test by defining IGNORE_PATH_CHECKS -.if !defined(IGNORE_PATH_CHECKS) -.if (${PREFIX:C,(^.).*,\1,} != "/") +############### PAR_PORTS SPECIFIC COMMENT LINE ############### +# +.if defined(WANT_PARALLEL_BUILD) || !defined(IGNORE_PATH_CHECKS) .BEGIN: +. if defined(WANT_PARALLEL_BUILD) +. if ${_parv_IS_DEFAULT_TARGET} + @${_parv_.CURDIR_DO_LOCK} +. endif +. endif +# You can force skipping these test by defining IGNORE_PATH_CHECKS +. if !defined(IGNORE_PATH_CHECKS) +. if (${PREFIX:C,(^.).*,\1,} != "/") @${ECHO_MSG} "PREFIX must be defined as an absolute path so that when 'make'" @${ECHO_MSG} "is invoked in the work area PREFIX points to the right place." @${FALSE} +. endif +. endif +.endif #defined(WANT_PARALLEL_BUILD) || !defined(IGNORE_PATH_CHECKS) + +.if defined(WANT_PARALLEL_BUILD) +.END: +. if ${_parv_IS_DEFAULT_TARGET} + @${_parv_.CURDIR_DO_UNLOCK} +. endif .endif -.endif +############### END OF PAR_PORTS SPECIFIC COMMENT LINE ############### # Location of mounted CDROM(s) to search for files CD_MOUNTPTS?= /cdrom ${CD_MOUNTPT} From owner-svn-soc-all@FreeBSD.ORG Thu May 24 20:21:42 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 8A0F91065672 for ; Thu, 24 May 2012 20:21:40 +0000 (UTC) (envelope-from tzabal@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 24 May 2012 20:21:40 +0000 Date: Thu, 24 May 2012 20:21:40 +0000 From: tzabal@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120524202140.8A0F91065672@hub.freebsd.org> Cc: Subject: socsvn commit: r236316 - in soc2012/tzabal/client-side/akcrs-head/etc: defaults rc.d X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 May 2012 20:21:42 -0000 Author: tzabal Date: Thu May 24 20:21:39 2012 New Revision: 236316 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236316 Log: Three (3) rc variables added to /etc/defaults/rc.conf. * crashreport_enable * crashreport_program * email The crashreport program added under /usr.sbin/crashreport. It contains the crashreport.sh script and the Makefile. The script crashreport.sh is under construction. The rc.d script savecore has been modified in order to call crashreport after extracting a new core dump. Modified: soc2012/tzabal/client-side/akcrs-head/etc/defaults/rc.conf soc2012/tzabal/client-side/akcrs-head/etc/rc.d/savecore Modified: soc2012/tzabal/client-side/akcrs-head/etc/defaults/rc.conf ============================================================================== --- soc2012/tzabal/client-side/akcrs-head/etc/defaults/rc.conf Thu May 24 19:48:15 2012 (r236315) +++ soc2012/tzabal/client-side/akcrs-head/etc/defaults/rc.conf Thu May 24 20:21:39 2012 (r236316) @@ -604,6 +604,9 @@ savecore_flags="" # Used if dumpdev is enabled above, and present. crashinfo_enable="YES" # Automatically generate crash dump summary. crashinfo_program="/usr/sbin/crashinfo" # Script to generate crash dump summary. +crashreport_enable="NO" # Automatically generate crash dump summary. +crashreport_program="/usr/sbin/crashreport" # Script to send kernel crash report +email="" # System administrator email address. quota_enable="NO" # turn on quotas on startup (or NO). check_quotas="YES" # Check quotas on startup (or NO). quotaon_flags="-a" # Turn quotas on for all file systems (if enabled) Modified: soc2012/tzabal/client-side/akcrs-head/etc/rc.d/savecore ============================================================================== --- soc2012/tzabal/client-side/akcrs-head/etc/rc.d/savecore Thu May 24 19:48:15 2012 (r236315) +++ soc2012/tzabal/client-side/akcrs-head/etc/rc.d/savecore Thu May 24 20:21:39 2012 (r236316) @@ -67,6 +67,9 @@ if checkyesno crashinfo_enable; then ${crashinfo_program} -d ${dumpdir} fi + if checkyesno crashreport_enable; then + ${crashreport_program} -d ${dumpdir} -e ${email} + fi else check_startmsgs && echo 'No core dumps found.' fi From owner-svn-soc-all@FreeBSD.ORG Thu May 24 20:25:07 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id BFBE410656D5 for ; Thu, 24 May 2012 20:25:05 +0000 (UTC) (envelope-from tzabal@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 24 May 2012 20:25:05 +0000 Date: Thu, 24 May 2012 20:25:05 +0000 From: tzabal@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120524202505.BFBE410656D5@hub.freebsd.org> Cc: Subject: socsvn commit: r236317 - soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 May 2012 20:25:07 -0000 Author: tzabal Date: Thu May 24 20:25:05 2012 New Revision: 236317 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236317 Log: Forgot to svn add usr.bin/crashreport in the previous commit. Added: soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/ soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/Makefile soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh (contents, props changed) Added: soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/Makefile Thu May 24 20:25:05 2012 (r236317) @@ -0,0 +1,3 @@ +SCRIPTS= crashreport.sh + +.include Added: soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh Thu May 24 20:25:05 2012 (r236317) @@ -0,0 +1,71 @@ +#!/bin/sh + +print_usage() +{ + echo "usage: $(basename $0) [-d dumpdir] [-f file] [-e email]" +} + +# Default dump directory +DUMPDIR='/var/crash' + +dumpdir= +file= +email= + +while getopts "d:f:e:" opt; do + case "$opt" in + d) + dumpdir=$OPTARG + ;; + f) + file=$OPTARG + ;; + e) + email=$OPTARG + ;; + *) + print_usage + exit 1 + ;; + esac +done + + +if [ -z "${dumpdir}" ]; then + if [ -d "${DUMPDIR}" ]; then + dumpdir=${DUMPDIR} + else + echo "Dump directory does not exist." + exit 1 + fi +fi + + +BOUNDS="${dumpdir}/bounds" +CORETXT="${dumpdir}/core.txt" +TEXTDUMPTAR="${dumpdir}/textdump.tar" +X= + +if [ -z "`ls ${dumpdir}`" ]; then + echo "The dump directory is empty." + exit 2 +fi + + +if [ -z "${file}" ]; then + if [ -f "${BOUNDS}" ]; then + value=`head -n 1 ${BOUNDS}` + X=$((value - 1)) + if [ -f "${CORETXT}.${X}" ]; then + file=`basename "${CORETXT}.${X}"` + elif [ -f "${TEXTDUMPTAR}.${X}" ]; then + file=`basename "${TEXTDUMPTAR}.${X}"` + else + echo "Unable to locate generated debugging information." + exit 3 + fi + else + tmp=`ls | grep '[a-z]*\.[a-z]*\.\w*' | sort -n -t . -k 3 | tail -1` + file=`basename "${tmp}"` + fi +fi From owner-svn-soc-all@FreeBSD.ORG Thu May 24 20:28:09 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 3FD87106564A for ; Thu, 24 May 2012 20:28:07 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 24 May 2012 20:28:07 +0000 Date: Thu, 24 May 2012 20:28:07 +0000 From: gpf@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120524202807.3FD87106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r236318 - in soc2012/gpf/pefs_kmod: sbin/pefs sys/fs/pefs sys/modules/pefs X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 May 2012 20:28:09 -0000 Author: gpf Date: Thu May 24 20:28:06 2012 New Revision: 236318 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236318 Log: adding checks & locks at pefs_ioctl(), plus a couple of minor changes. Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c soc2012/gpf/pefs_kmod/sys/modules/pefs/Makefile Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Thu May 24 20:25:05 2012 (r236317) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Thu May 24 20:28:06 2012 (r236318) @@ -280,25 +280,22 @@ } } +/* + * pefs encrypted filename = XBase64(checksum || E(tweak || filename)) + * We use filename mac (checksum) as file_id. This way, should a filesystem + * be dump/restored, there will be no need to recreate .pefs.checksum because + * filenames remain the same. + * + * file id used is checksum = VMAC(E(tweak || filename)) + */ static int pefs_get_file_id(struct file_header *fhp) { char parent_dir[MAXPATHLEN]; - struct pefs_mac mac; + struct pefs_namemac namemac; char *pch; int error, fd; - struct stat sb; - if (stat(fhp->path, &sb) != 0) { - warn("cannot stat file %s", fhp->path); - return (PEFS_ERR_SYS); - } - /* - * XXXgpf: [TODO] This is only temporary so that we won't have conflict errors - * when adding a file header to a bucket. - */ - fhp->file_id = sb.st_ino; - /* feed parent directory to ioctl() */ strlcpy(parent_dir, fhp->path, sizeof(parent_dir)); pch = strrchr(parent_dir, '/'); @@ -307,7 +304,7 @@ return (PEFS_ERR_NOENT); } *pch = '\0'; - + fd = open(parent_dir, O_RDONLY); if (fd < 0) { warn("unable to open file %s", parent_dir); @@ -316,13 +313,13 @@ pch = strrchr(fhp->path, '/'); pch++; - strlcpy(mac.mac_filename, pch, sizeof(mac.mac_filename)); - mac.mac_namelen = strlen(mac.mac_filename); + strlcpy(namemac.pnm_filename, pch, sizeof(namemac.pnm_filename)); + namemac.pnm_namelen = strnlen(namemac.pnm_filename, sizeof(namemac.pnm_filename)); + + error = ioctl(fd, PEFS_GETNAMEMAC, &namemac); - printf("giving values to ioctl() %s and dir = %s\n", mac.mac_filename, parent_dir); - error = ioctl(fd, PEFS_GETMAC, &mac); - printf("ioctl error = %d\n", error); - printf("values returned %lld\n\n", mac.mac_csum); + if (error == 0) + fhp->file_id = namemac.pnm_csum; close(fd); return (error); @@ -399,7 +396,7 @@ * the checksum file. * A) The total sum of entries is gathered so that a hash table is allocated. * B) For each file entry: - * B1) semantic checks: file should reside in pefs filesystem & + * B1) semantic checks: file should reside in pefs filesystem & * file should be regular file * B2) the file_id is retrieved. * B3) list of checksums is computed for the file's 4k blocks. @@ -666,7 +663,7 @@ snprintf(checksum_path, sizeof(checksum_path), "%s/%s", fsroot, PEFS_FILE_CHECKSUM); /* * XXXgpf: [TODO] If pefs fs is mounted when .pefs.checksum is created, then it will obtain an - * encrypted filename & encrypted data. I should make sure that checksum file is not being + * encrypted filename & encrypted data. I should make sure that checksum file is not being * opened inside a mounted pefs filesystem. */ fdout = open(checksum_path, O_WRONLY | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Thu May 24 20:25:05 2012 (r236317) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Thu May 24 20:28:06 2012 (r236318) @@ -1013,7 +1013,7 @@ * * pefs addchecksum [-a algo] [-i inputfile] filesystem * - * $command creates .pefs.checksum db file in root of filesystem. + * $command creates .pefs.checksum db file for filesystem. * This file will contain all checksums necessary to check integrity * of files upon access. * @@ -1021,11 +1021,11 @@ * hash function; supported algorithms: sha256, sha512. * * inputfile contains list of files that need integrity checking. - * This should be the outputfile of `pefs addchecklist`. * - * When $command is run, filesystem should *not* be already - * mounted with pefs so that hashes are calculated for ciphertexts - * and not plain texts. + * When $command is run, filesystem should be already mounted with + * pefs. + * + * [TODO] reference for where .pefs.checksum file should be created. * */ static int @@ -1082,7 +1082,8 @@ } /* - * XXXgpf: Instead of a man page entry + * XXXgpf: This should get the axe soon. But I'm keeping it here + * a little while longer just in case. * * pefs addchecklist [-i inputfile] [-o outputfile] filesystem * Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h ============================================================================== --- soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h Thu May 24 20:25:05 2012 (r236317) +++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h Thu May 24 20:28:06 2012 (r236318) @@ -48,10 +48,10 @@ char pxk_key[PEFS_KEY_SIZE]; }; -struct pefs_mac { - char mac_filename[MAXPATHLEN]; - uint32_t mac_namelen; - uint64_t mac_csum; +struct pefs_namemac { + uint32_t pnm_namelen; + uint64_t pnm_csum; + char pnm_filename[MAXPATHLEN]; }; #ifdef _IO @@ -61,7 +61,7 @@ #define PEFS_DELKEY _IOWR('p', 3, struct pefs_xkey) #define PEFS_FLUSHKEYS _IO('p', 4) #define PEFS_GETNODEKEY _IOWR('p', 5, struct pefs_xkey) -#define PEFS_GETMAC _IOWR('p', 6, struct pefs_mac) +#define PEFS_GETNAMEMAC _IOWR('p', 6, struct pefs_namemac) #endif #ifdef _KERNEL Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c ============================================================================== --- soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Thu May 24 20:25:05 2012 (r236317) +++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Thu May 24 20:28:06 2012 (r236318) @@ -2357,18 +2357,17 @@ { struct pefs_enccn enccn; struct componentname cn; - char buf[MAXNAMLEN +1]; struct vnode *vp = ap->a_vp; struct pefs_xkey *xk = ap->a_data; - struct pefs_mac *mac = ap->a_data; + struct pefs_namemac *namemac = ap->a_data; struct ucred *cred = ap->a_cred; struct thread *td = ap->a_td; struct mount *mp = vp->v_mount; struct pefs_mount *pm = VFS_TO_PEFS(mp); struct pefs_node *pn; struct pefs_key *pk; - char *enc; - size_t enc_len; + char *enc, *buf; + size_t enc_len, buf_len; int error = 0, i, r; if (mp->mnt_cred->cr_uid != cred->cr_uid) { @@ -2471,23 +2470,32 @@ if (pefs_key_remove_all(pm)) pefs_flushkey(mp, td, PEFS_FLUSHKEY_ALL, NULL); break; - case PEFS_GETMAC: + case PEFS_GETNAMEMAC: + if (vp->v_type != VDIR) + panic("pefs_ioctl: PEFS_GETNAMEMAC vp is not a directory\n"); + + if (strnlen(namemac->pnm_filename, sizeof(namemac->pnm_filename)) != + namemac->pnm_namelen) + panic("pefs_ioctl: PEFS_GETNAMEMAC incorrect pnm_namelen\n"); + + if (strchr(namemac->pnm_filename, '/') != NULL) + panic("pefs_ioctl: PEFS_GETNAMEMAC pnm_filename contains '/'\n"); + + vn_lock(vp, LK_EXCLUSIVE); pefs_enccn_init(&enccn); cn.cn_nameiop = LOOKUP; cn.cn_thread = td; cn.cn_cred = cred; - /* XXXgpf: should probably acquire a shared lock if possible */ cn.cn_lkflags = 0; cn.cn_flags = 0; - cn.cn_nameptr = mac->mac_filename; - cn.cn_namelen = mac->mac_namelen; + cn.cn_nameptr = namemac->pnm_filename; + cn.cn_namelen = namemac->pnm_namelen; error = pefs_enccn_lookup(&enccn, vp, &cn); - printf("pefs_enccn_lookup = %d\n", error); - if (error == 0) { - printf("found!\nlen%ld %s", enccn.pec_cn.cn_namelen, enccn.pec_cn.cn_nameptr); + VOP_UNLOCK(vp, 0); + if (error == 0) { enc = enccn.pec_cn.cn_nameptr; enc_len = enccn.pec_cn.cn_namelen; @@ -2497,16 +2505,18 @@ } enc++; enc_len--; + buf_len = MAXNAMLEN + 1; + buf = malloc(buf_len, M_TEMP, M_WAITOK); - r = pefs_name_pton(enc, enc_len, buf, sizeof(buf)); + r = pefs_name_pton(enc, enc_len, buf, buf_len); if (r <= 0) error = EINVAL; else - memcpy(&(mac->mac_csum), buf, PEFS_NAME_CSUM_SIZE); - + memcpy(&(namemac->pnm_csum), buf, PEFS_NAME_CSUM_SIZE); + pefs_enccn_free(&enccn); + free(buf, M_TEMP); } - break; default: error = ENOTTY; Modified: soc2012/gpf/pefs_kmod/sys/modules/pefs/Makefile ============================================================================== --- soc2012/gpf/pefs_kmod/sys/modules/pefs/Makefile Thu May 24 20:25:05 2012 (r236317) +++ soc2012/gpf/pefs_kmod/sys/modules/pefs/Makefile Thu May 24 20:28:06 2012 (r236318) @@ -17,9 +17,7 @@ #DEBUG_FLAGS+= -DPEFS_DEBUG #DEBUG_FLAGS+= -DPEFS_DEBUG_EXTRA -CFLAGS+= -I${.CURDIR}/../../ - -# Temporally build crypto/hmac into pefs module +CFLAGS+= -I${.CURDIR}/../../# Temporally build crypto/hmac into pefs module .PATH: ${.CURDIR}/../../crypto/hmac SRCS+= hmac_sha512.c From owner-svn-soc-all@FreeBSD.ORG Thu May 24 20:43:38 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 1B964106566B for ; Thu, 24 May 2012 20:43:36 +0000 (UTC) (envelope-from tzabal@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 24 May 2012 20:43:36 +0000 Date: Thu, 24 May 2012 20:43:36 +0000 From: tzabal@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120524204336.1B964106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r236319 - soc2012/tzabal/client-side/akcrs-head/etc/defaults X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 May 2012 20:43:38 -0000 Author: tzabal Date: Thu May 24 20:43:35 2012 New Revision: 236319 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236319 Log: Modify the comment of the rc variable crashreport_enable. Modified: soc2012/tzabal/client-side/akcrs-head/etc/defaults/rc.conf Modified: soc2012/tzabal/client-side/akcrs-head/etc/defaults/rc.conf ============================================================================== --- soc2012/tzabal/client-side/akcrs-head/etc/defaults/rc.conf Thu May 24 20:28:06 2012 (r236318) +++ soc2012/tzabal/client-side/akcrs-head/etc/defaults/rc.conf Thu May 24 20:43:35 2012 (r236319) @@ -604,7 +604,7 @@ savecore_flags="" # Used if dumpdev is enabled above, and present. crashinfo_enable="YES" # Automatically generate crash dump summary. crashinfo_program="/usr/sbin/crashinfo" # Script to generate crash dump summary. -crashreport_enable="NO" # Automatically generate crash dump summary. +crashreport_enable="NO" # Automatically report kernel crashes. crashreport_program="/usr/sbin/crashreport" # Script to send kernel crash report email="" # System administrator email address. quota_enable="NO" # turn on quotas on startup (or NO). From owner-svn-soc-all@FreeBSD.ORG Thu May 24 21:55:32 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id DB04A106564A for ; Thu, 24 May 2012 21:55:31 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 24 May 2012 21:55:31 +0000 Date: Thu, 24 May 2012 21:55:31 +0000 From: scher@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120524215531.DB04A106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r236325 - soc2012/scher/par_ports/head/packages X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 May 2012 21:55:33 -0000 Author: scher Date: Thu May 24 21:55:31 2012 New Revision: 236325 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236325 Log: SVN ignore packages/* Modified: soc2012/scher/par_ports/head/packages/ (props changed) From owner-svn-soc-all@FreeBSD.ORG Thu May 24 22:30:29 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id DC7A51065757 for ; Thu, 24 May 2012 22:30:27 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 24 May 2012 22:30:27 +0000 Date: Thu, 24 May 2012 22:30:27 +0000 From: scher@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120524223027.DC7A51065757@hub.freebsd.org> Cc: Subject: socsvn commit: r236334 - in soc2012/scher/par_ports/head/fake_ports/with_deps: . fake1 fake2 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 May 2012 22:30:30 -0000 Author: scher Date: Thu May 24 22:30:27 2012 New Revision: 236334 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236334 Log: New fake ports With dependecies added for testing puprose Added: soc2012/scher/par_ports/head/fake_ports/with_deps/ soc2012/scher/par_ports/head/fake_ports/with_deps/fake1/ soc2012/scher/par_ports/head/fake_ports/with_deps/fake1/Makefile (contents, props changed) soc2012/scher/par_ports/head/fake_ports/with_deps/fake1/pkg-descr soc2012/scher/par_ports/head/fake_ports/with_deps/fake2/ soc2012/scher/par_ports/head/fake_ports/with_deps/fake2/Makefile (contents, props changed) soc2012/scher/par_ports/head/fake_ports/with_deps/fake2/pkg-descr Added: soc2012/scher/par_ports/head/fake_ports/with_deps/fake1/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/scher/par_ports/head/fake_ports/with_deps/fake1/Makefile Thu May 24 22:30:27 2012 (r236334) @@ -0,0 +1,14 @@ +PORTNAME=fake1 +PORTVERSION=1.0 +DISTFILES=fake-1.0.tar.gz +CATEGORIES=fake_ports + + +WRKSRC= ${WRKDIR}/fake-1.0 + +do-install: + @echo "Port: "fake1" is installing now" + @echo "Press any key to continue:" + @read i + +.include Added: soc2012/scher/par_ports/head/fake_ports/with_deps/fake1/pkg-descr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/scher/par_ports/head/fake_ports/with_deps/fake1/pkg-descr Thu May 24 22:30:27 2012 (r236334) @@ -0,0 +1,2 @@ +This is a description for fake port +That is all so far \ No newline at end of file Added: soc2012/scher/par_ports/head/fake_ports/with_deps/fake2/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/scher/par_ports/head/fake_ports/with_deps/fake2/Makefile Thu May 24 22:30:27 2012 (r236334) @@ -0,0 +1,15 @@ +PORTNAME=fake2 +PORTVERSION=1.0 +DISTFILES=fake-1.0.tar.gz +CATEGORIES=fake_ports + + +WRKSRC= ${WRKDIR}/fake-1.0 +FETCH_DEPENDS= /un/existed/path:/usr/home/scher/project/fake_ports/with_deps/fake1 + +NOCLEANDEPENDS= + +do-install: + @echo "Port: "fake" is installing now" + +.include Added: soc2012/scher/par_ports/head/fake_ports/with_deps/fake2/pkg-descr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/scher/par_ports/head/fake_ports/with_deps/fake2/pkg-descr Thu May 24 22:30:27 2012 (r236334) @@ -0,0 +1,2 @@ +This is a description for fake port +That is all so far \ No newline at end of file From owner-svn-soc-all@FreeBSD.ORG Thu May 24 22:46:09 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 1EAC41065672 for ; Thu, 24 May 2012 22:46:07 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 24 May 2012 22:46:07 +0000 Date: Thu, 24 May 2012 22:46:07 +0000 From: gmiller@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120524224607.1EAC41065672@hub.freebsd.org> Cc: Subject: socsvn commit: r236335 - soc2012/gmiller/locking-head/lib/libthr X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 May 2012 22:46:09 -0000 Author: gmiller Date: Thu May 24 22:46:06 2012 New Revision: 236335 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236335 Log: Remove a blank line from the Makefile for clarity. Modified: soc2012/gmiller/locking-head/lib/libthr/Makefile Modified: soc2012/gmiller/locking-head/lib/libthr/Makefile ============================================================================== --- soc2012/gmiller/locking-head/lib/libthr/Makefile Thu May 24 22:30:27 2012 (r236334) +++ soc2012/gmiller/locking-head/lib/libthr/Makefile Thu May 24 22:46:06 2012 (r236335) @@ -89,7 +89,6 @@ .else @${AR} cq ${.TARGET} `NM='${NM}' lorder ${PROBJS} | tsort -q` ${ARADD} .endif - ${RANLIB} ${.TARGET} all: libthr_profile.a From owner-svn-soc-all@FreeBSD.ORG Fri May 25 14:19:38 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 44D54106564A for ; Fri, 25 May 2012 14:19:36 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 25 May 2012 14:19:36 +0000 Date: Fri, 25 May 2012 14:19:36 +0000 From: gpf@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120525141936.44D54106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r236386 - soc2012/gpf/pefs_kmod/sbin/pefs X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 May 2012 14:19:38 -0000 Author: gpf Date: Fri May 25 14:19:35 2012 New Revision: 236386 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236386 Log: free dynamic memory Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Fri May 25 11:14:08 2012 (r236385) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Fri May 25 14:19:35 2012 (r236386) @@ -139,6 +139,7 @@ csp->hash = malloc(hash_len); if (csp->hash == NULL) { pefs_warn("memory allocation error"); + free(csp); close(fd); return (PEFS_ERR_SYS); } @@ -182,6 +183,14 @@ return (0); } +static void +pefs_init_hash_table(struct hash_table *checksum_hash_tablep) +{ + checksum_hash_tablep->size = 0; + checksum_hash_tablep->nelements = 0; + checksum_hash_tablep->buckets = NULL; +} + static int pefs_allocate_hash_table(struct hash_table *checksum_hash_tablep, uint32_t nelements) { @@ -207,6 +216,32 @@ return (0); } +static void +pefs_free_hash_table(struct hash_table *checksum_hash_tablep) +{ + struct bucket *bp; + struct file_header *fhp, *tfhp; + struct checksum *csp, *tcsp; + uint32_t i; + + if (checksum_hash_tablep->buckets != NULL) { + for (i = 0; i < checksum_hash_tablep->size; i++) { + bp = &checksum_hash_tablep->buckets[i]; + LIST_FOREACH_SAFE(fhp, &(bp->file_headers), bucket_entries, tfhp) { + TAILQ_FOREACH_SAFE(csp, &(fhp->checksums), checksum_entries, tcsp) { + TAILQ_REMOVE(&(fhp->checksums), csp, checksum_entries); + if (csp->hash != NULL) + free(csp->hash); + free(csp); + } + LIST_REMOVE(fhp, bucket_entries); + free(fhp); + } + } + free(checksum_hash_tablep->buckets); + } +} + static int pefs_add_to_bucket(struct bucket *bucketp, struct file_header *fhp) { @@ -665,6 +700,7 @@ * XXXgpf: [TODO] If pefs fs is mounted when .pefs.checksum is created, then it will obtain an * encrypted filename & encrypted data. I should make sure that checksum file is not being * opened inside a mounted pefs filesystem. + * pefs_open_checksum_file() */ fdout = open(checksum_path, O_WRONLY | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); if (fdout == -1) { @@ -672,6 +708,8 @@ return (PEFS_ERR_IO); } + pefs_init_hash_table(&checksum_hash_table); + error = pefs_create_in_memory_db(fpin, md, hash_len, &checksum_hash_table, fsroot); if (error != 0) @@ -682,10 +720,11 @@ error = pefs_write_checksum_file(fdout, &cfh, &checksum_hash_table); out: - close(fdout); + if (fdout >= 0) + close(fdout); if (error != 0) unlink(checksum_path); - /* XXXgpf: [TODO] free dynamic memory */ + pefs_free_hash_table(&checksum_hash_table); return (error); } Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Fri May 25 11:14:08 2012 (r236385) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Fri May 25 14:19:35 2012 (r236386) @@ -1051,18 +1051,23 @@ if (j == PEFS_SUPPORTED_DIGESTS) { pefs_warn("invalid digestname: %s", optarg); - return (PEFS_ERR_INVALID); + error = PEFS_ERR_INVALID; + goto out; } break; case 'i': fpin = fopen(optarg, "r"); if (fpin == NULL) { warn("cannot open inputfile: %s", optarg); - return (PEFS_ERR_INVALID); + error = PEFS_ERR_INVALID; + goto out; } break; default: + if (fpin != NULL) + fclose(fpin); pefs_usage(); + break; } argc -= optind; argv += optind; @@ -1076,7 +1081,9 @@ error = pefs_create_checksum_file(fpin, fsroot, algo); - fclose(fpin); +out: + if (fpin != NULL) + fclose(fpin); return (error); } From owner-svn-soc-all@FreeBSD.ORG Fri May 25 16:26:09 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 7AB13106566C for ; Fri, 25 May 2012 16:26:07 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 25 May 2012 16:26:07 +0000 Date: Fri, 25 May 2012 16:26:07 +0000 From: gpf@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120525162607.7AB13106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r236400 - in soc2012/gpf/pefs_kmod: sbin/pefs sys/fs/pefs sys/modules/pefs X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 May 2012 16:26:09 -0000 Author: gpf Date: Fri May 25 16:26:06 2012 New Revision: 236400 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236400 Log: Require that .pefs.checksum is created outside of target pefs filesystem. Change pefs_ioctl() kernel panics into printfs() and error returns. Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.h soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c soc2012/gpf/pefs_kmod/sys/modules/pefs/Makefile Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Fri May 25 15:16:40 2012 (r236399) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Fri May 25 16:26:06 2012 (r236400) @@ -227,7 +227,7 @@ if (checksum_hash_tablep->buckets != NULL) { for (i = 0; i < checksum_hash_tablep->size; i++) { bp = &checksum_hash_tablep->buckets[i]; - LIST_FOREACH_SAFE(fhp, &(bp->file_headers), bucket_entries, tfhp) { + LIST_FOREACH_SAFE(fhp, &(bp->file_headers), bucket_entries, tfhp) { TAILQ_FOREACH_SAFE(csp, &(fhp->checksums), checksum_entries, tcsp) { TAILQ_REMOVE(&(fhp->checksums), csp, checksum_entries); if (csp->hash != NULL) @@ -355,6 +355,8 @@ if (error == 0) fhp->file_id = namemac.pnm_csum; + else + pefs_warn("failed to fetch file id from kernel"); close(fd); return (error); @@ -674,12 +676,52 @@ } /* + * If .pefs.checksum is created inside pefs mounted fs, then it will obtain an + * encrypted filename & encrypted data, which is unacceptable. User should create + * checksum file outside of filesystem and then copy it by hand. + */ +static int +pefs_open_checksum_file(int *fdp, char *fsroot, char *csm_path) +{ + struct statfs pefs_fs, checksum_fs; + int fd; + + *fdp = -1; + + fd = open(csm_path, O_WRONLY | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); + if (fd == -1) { + warn("cannot open %s", csm_path); + return (PEFS_ERR_IO); + } + + *fdp = fd; + + if (statfs(fsroot, &pefs_fs) == -1) { + pefs_warn("statfs failed: %s: %s", fsroot, strerror(errno)); + return (PEFS_ERR_SYS); + } + + if (statfs(csm_path, &checksum_fs) == -1) { + pefs_warn("statfs failed: %s: %s", csm_path, strerror(errno)); + return (PEFS_ERR_SYS); + } + + if ((pefs_fs.f_fsid.val[0] == checksum_fs.f_fsid.val[0]) && + (pefs_fs.f_fsid.val[1] == checksum_fs.f_fsid.val[1])) { + pefs_warn("%s must be created outside of pefs mounted filesystem %s", + csm_path, pefs_fs.f_mntonname); + return (PEFS_ERR_INVALID); + } + + return (0); +} + +/* * XXXgpf: [TODO] proper comment header, I am sleepy Z_Z */ int -pefs_create_checksum_file(FILE *fpin, char *fsroot, const char *algo) +pefs_create_checksum_file(FILE *fpin, char *fsroot, char *csm_path, const char *algo) { - char checksum_path[MAXPATHLEN]; struct hash_table checksum_hash_table; struct checksum_file_header cfh; const EVP_MD *md; @@ -695,21 +737,12 @@ } hash_len = EVP_MD_size(md); - snprintf(checksum_path, sizeof(checksum_path), "%s/%s", fsroot, PEFS_FILE_CHECKSUM); - /* - * XXXgpf: [TODO] If pefs fs is mounted when .pefs.checksum is created, then it will obtain an - * encrypted filename & encrypted data. I should make sure that checksum file is not being - * opened inside a mounted pefs filesystem. - * pefs_open_checksum_file() - */ - fdout = open(checksum_path, O_WRONLY | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); - if (fdout == -1) { - warn("cannot open %s", checksum_path); - return (PEFS_ERR_IO); - } - pefs_init_hash_table(&checksum_hash_table); + error = pefs_open_checksum_file(&fdout, fsroot, csm_path); + if (error != 0) + goto out; + error = pefs_create_in_memory_db(fpin, md, hash_len, &checksum_hash_table, fsroot); if (error != 0) @@ -720,10 +753,11 @@ error = pefs_write_checksum_file(fdout, &cfh, &checksum_hash_table); out: - if (fdout >= 0) + if (fdout >= 0) { close(fdout); - if (error != 0) - unlink(checksum_path); + if (error != 0) + unlink(csm_path); + } pefs_free_hash_table(&checksum_hash_table); return (error); Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Fri May 25 15:16:40 2012 (r236399) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Fri May 25 16:26:06 2012 (r236400) @@ -1011,27 +1011,33 @@ /* * XXXgpf: Instead of a man page entry: * - * pefs addchecksum [-a algo] [-i inputfile] filesystem + * pefs addchecksum [-a algo] [-i inputfile] [-p path] filesystem * * $command creates .pefs.checksum db file for filesystem. * This file will contain all checksums necessary to check integrity * of files upon access. * * algo is the name of the algorithm to be used as a cryptographic - * hash function; supported algorithms: sha256, sha512. + * hash function; supported algorithms: sha256, sha512. sha256 is + * used by default. * - * inputfile contains list of files that need integrity checking. + * inputfile contains list of files that need integrity checking. An + * inputfile must be supplied. + * + * path defines where .pefs.checksum should be created. By default, + * .pefs.checksum is created under $PWD. path should be a directory, + * outside of target pefs filesystem. * - * When $command is run, filesystem should be already mounted with + * When $command is run, filesystem should be already mounted with * pefs. - * - * [TODO] reference for where .pefs.checksum file should be created. * */ static int pefs_addchecksum(int argc, char *argv[]) { char fsroot[MAXPATHLEN]; + char csm_path[MAXPATHLEN]; + struct stat sb; FILE *fpin; int error, i, j; const char *algo; @@ -1039,8 +1045,11 @@ fpin = NULL; /* by default use sha256 */ algo = supported_digests[0]; + /* by default create checksum file under $PWD */ + snprintf(csm_path, sizeof(csm_path), "./%s", PEFS_FILE_CHECKSUM); - while ((i = getopt(argc, argv, "a:i:")) != -1) + /* XXXgpf: [TODO] add argument for user to specify path for .pefs. checksum */ + while ((i = getopt(argc, argv, "a:i:p:")) != -1) switch(i) { case 'a': for (j=0; j < PEFS_SUPPORTED_DIGESTS; j++) @@ -1063,6 +1072,23 @@ goto out; } break; + case 'p': + if (stat(optarg, &sb) != 0) { + warn("cannot stat file %s", optarg); + error = PEFS_ERR_INVALID; + goto out; + } + + if (S_ISDIR(sb.st_mode) == 0) { + pefs_warn("filename: %s is not a directory", optarg); + error = PEFS_ERR_INVALID; + goto out; + } + + snprintf(csm_path, sizeof(csm_path), "%s/%s", optarg, + PEFS_FILE_CHECKSUM); + + break; default: if (fpin != NULL) fclose(fpin); @@ -1079,7 +1105,7 @@ initfsroot(argc, argv, 0, fsroot, sizeof(fsroot)); - error = pefs_create_checksum_file(fpin, fsroot, algo); + error = pefs_create_checksum_file(fpin, fsroot, csm_path, algo); out: if (fpin != NULL) @@ -1209,8 +1235,8 @@ " pefs randomchain [-fv] [-n min] [-N max] filesystem\n" " pefs showchains [-fp] [-i iterations] [-k keyfile] filesystem\n" " pefs showalgs\n" -" pefs addchecksum [-a algo] [-i inputfile] filesystem\n" -" pefs addchecklist [-i inputfile] [-o outputfile[ filesystem\n" +" pefs addchecksum [-a algo] [-i inputfile] [-p checksumpath] filesystem\n" +" pefs addchecklist [-i inputfile] [-o outputfile] filesystem\n" ); exit(PEFS_ERR_USAGE); } Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.h ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.h Fri May 25 15:16:40 2012 (r236399) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.h Fri May 25 16:26:06 2012 (r236400) @@ -94,7 +94,7 @@ int pefs_key_decrypt(struct pefs_xkeyenc *xe, const struct pefs_xkey *xk_parent); uintmax_t pefs_keyid_as_int(char *keyid); -int pefs_create_checksum_file(FILE *fpin, char *fsroot, const char *algo); +int pefs_create_checksum_file(FILE *fpin, char *fsroot, char *csm_path, const char *algo); int pefs_create_checklist(FILE *fpin, int fdout, char *fsroot, char *fromfsroot); const char * pefs_alg_name(struct pefs_xkey *xk); Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h ============================================================================== --- soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h Fri May 25 15:16:40 2012 (r236399) +++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h Fri May 25 16:26:06 2012 (r236400) @@ -48,9 +48,16 @@ char pxk_key[PEFS_KEY_SIZE]; }; +/* + * XXXgpf: [TODO] gleb says: + Adding 'x' to mark + it as exported to userspace will also be wise. So it's better be + pefs_xnamecsum or pefs_xname_csum. + */ struct pefs_namemac { - uint32_t pnm_namelen; uint64_t pnm_csum; + uint32_t pnm_namelen; + /* XXXgpf: should probably be MAXNAMLEN */ char pnm_filename[MAXPATHLEN]; }; Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c ============================================================================== --- soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Fri May 25 15:16:40 2012 (r236399) +++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Fri May 25 16:26:06 2012 (r236400) @@ -2471,15 +2471,25 @@ pefs_flushkey(mp, td, PEFS_FLUSHKEY_ALL, NULL); break; case PEFS_GETNAMEMAC: - if (vp->v_type != VDIR) - panic("pefs_ioctl: PEFS_GETNAMEMAC vp is not a directory\n"); + /* XXXgpf: should I change printf to PEFSDEBUG or something else? */ + if (vp->v_type != VDIR) { + printf("pefs_ioctl: PEFS_GETNAMEMAC vp is not a directory\n"); + error = EINVAL; + break; + } if (strnlen(namemac->pnm_filename, sizeof(namemac->pnm_filename)) != - namemac->pnm_namelen) - panic("pefs_ioctl: PEFS_GETNAMEMAC incorrect pnm_namelen\n"); + namemac->pnm_namelen) { + printf("pefs_ioctl: PEFS_GETNAMEMAC incorrect pnm_namelen %d\n", namemac->pnm_namelen); + error = EINVAL; + break; + } - if (strchr(namemac->pnm_filename, '/') != NULL) - panic("pefs_ioctl: PEFS_GETNAMEMAC pnm_filename contains '/'\n"); + if (strchr(namemac->pnm_filename, '/') != NULL) { + printf("pefs_ioctl: PEFS_GETNAMEMAC pnm_filename contains '/'\n"); + error = EINVAL; + break; + } vn_lock(vp, LK_EXCLUSIVE); pefs_enccn_init(&enccn); @@ -2500,6 +2510,7 @@ enc_len = enccn.pec_cn.cn_namelen; if (enc[0] != '.' || enc_len <= 1) { + pefs_enccn_free(&enccn); error = EINVAL; break; } Modified: soc2012/gpf/pefs_kmod/sys/modules/pefs/Makefile ============================================================================== --- soc2012/gpf/pefs_kmod/sys/modules/pefs/Makefile Fri May 25 15:16:40 2012 (r236399) +++ soc2012/gpf/pefs_kmod/sys/modules/pefs/Makefile Fri May 25 16:26:06 2012 (r236400) @@ -23,4 +23,3 @@ SRCS+= hmac_sha512.c .include - From owner-svn-soc-all@FreeBSD.ORG Fri May 25 17:29:53 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 6462A1065670 for ; Fri, 25 May 2012 17:29:52 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 25 May 2012 17:29:52 +0000 Date: Fri, 25 May 2012 17:29:52 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120525172952.6462A1065670@hub.freebsd.org> Cc: Subject: socsvn commit: r236408 - soc2012/jhagewood/mdocml X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 May 2012 17:29:53 -0000 Author: jhagewood Date: Fri May 25 17:29:51 2012 New Revision: 236408 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236408 Log: Deleted: soc2012/jhagewood/mdocml/ From owner-svn-soc-all@FreeBSD.ORG Fri May 25 17:30:24 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 2DC8E106564A for ; Fri, 25 May 2012 17:30:23 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 25 May 2012 17:30:23 +0000 Date: Fri, 25 May 2012 17:30:23 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120525173023.2DC8E106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r236409 - soc2012/jhagewood/mdocml X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 May 2012 17:30:24 -0000 Author: jhagewood Date: Fri May 25 17:30:22 2012 New Revision: 236409 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236409 Log: Added: soc2012/jhagewood/mdocml/ From owner-svn-soc-all@FreeBSD.ORG Fri May 25 17:31:47 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id CF94E1065680 for ; Fri, 25 May 2012 17:31:45 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 25 May 2012 17:31:45 +0000 Date: Fri, 25 May 2012 17:31:45 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120525173145.CF94E1065680@hub.freebsd.org> Cc: Subject: socsvn commit: r236410 - in soc2012/jhagewood/mdocml: . mdocml-1.12.1 mdocml-1.12.1-orig mdocml_patches X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 May 2012 17:31:48 -0000 Author: jhagewood Date: Fri May 25 17:31:45 2012 New Revision: 236410 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236410 Log: Added: soc2012/jhagewood/mdocml/hagewood-mdocml.patch soc2012/jhagewood/mdocml/mdocml-1.12.1/ soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/ soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/Makefile soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/TODO soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/apropos.1 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/apropos.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/apropos_db.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/apropos_db.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/arch.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/arch.in soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/att.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/att.in soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/catman.8 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/catman.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/cgi.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/chars.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/chars.in soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/compat_fgetln.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/compat_getsubopt.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/compat_strlcat.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/compat_strlcpy.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/config.h.post soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/config.h.pre soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/demandoc.1 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/demandoc.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/eqn.7 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/eqn.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/eqn_html.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/eqn_term.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/example.style.css soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/external.png (contents, props changed) soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/html.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/html.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/index.css soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/index.sgml soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/lib.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/lib.in soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/libman.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/libmandoc.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/libmdoc.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/libroff.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/main.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/main.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/man-cgi.css soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/man.7 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/man.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/man.cgi.7 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/man.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/man_hash.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/man_html.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/man_macro.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/man_validate.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mandoc.1 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mandoc.3 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mandoc.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mandoc.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mandoc_char.7 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mandocdb.8 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mandocdb.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mandocdb.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/manpath.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/manpath.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mdoc.7 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mdoc.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mdoc.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_argv.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_hash.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_html.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_macro.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_man.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_term.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/mdoc_validate.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/msec.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/msec.in soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/out.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/out.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/preconv.1 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/preconv.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/predefs.in soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/read.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/roff.7 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/roff.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/st.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/st.in soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/style.css soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/tbl.7 soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/tbl.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/tbl_data.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/tbl_html.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/tbl_layout.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/tbl_opts.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/tbl_term.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/term.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/term.h soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/term_ascii.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/term_ps.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/test-fgetln.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/test-getsubopt.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/test-mmap.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/test-strlcat.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/test-strlcpy.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/test-strptime.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/tree.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/vol.c soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/vol.in soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/whatis.1 soc2012/jhagewood/mdocml/mdocml-1.12.1/Makefile soc2012/jhagewood/mdocml/mdocml-1.12.1/TODO soc2012/jhagewood/mdocml/mdocml-1.12.1/apropos.1 soc2012/jhagewood/mdocml/mdocml-1.12.1/apropos.c soc2012/jhagewood/mdocml/mdocml-1.12.1/apropos_db.c soc2012/jhagewood/mdocml/mdocml-1.12.1/apropos_db.h soc2012/jhagewood/mdocml/mdocml-1.12.1/arch.c soc2012/jhagewood/mdocml/mdocml-1.12.1/arch.in soc2012/jhagewood/mdocml/mdocml-1.12.1/att.c soc2012/jhagewood/mdocml/mdocml-1.12.1/att.in soc2012/jhagewood/mdocml/mdocml-1.12.1/catman.8 soc2012/jhagewood/mdocml/mdocml-1.12.1/catman.c soc2012/jhagewood/mdocml/mdocml-1.12.1/cgi.c soc2012/jhagewood/mdocml/mdocml-1.12.1/chars.c soc2012/jhagewood/mdocml/mdocml-1.12.1/chars.in soc2012/jhagewood/mdocml/mdocml-1.12.1/compat_fgetln.c soc2012/jhagewood/mdocml/mdocml-1.12.1/compat_getsubopt.c soc2012/jhagewood/mdocml/mdocml-1.12.1/compat_strlcat.c soc2012/jhagewood/mdocml/mdocml-1.12.1/compat_strlcpy.c soc2012/jhagewood/mdocml/mdocml-1.12.1/config.h.post soc2012/jhagewood/mdocml/mdocml-1.12.1/config.h.pre soc2012/jhagewood/mdocml/mdocml-1.12.1/demandoc.1 soc2012/jhagewood/mdocml/mdocml-1.12.1/demandoc.c soc2012/jhagewood/mdocml/mdocml-1.12.1/eqn.7 soc2012/jhagewood/mdocml/mdocml-1.12.1/eqn.c soc2012/jhagewood/mdocml/mdocml-1.12.1/eqn_html.c soc2012/jhagewood/mdocml/mdocml-1.12.1/eqn_term.c soc2012/jhagewood/mdocml/mdocml-1.12.1/example.style.css soc2012/jhagewood/mdocml/mdocml-1.12.1/external.png (contents, props changed) soc2012/jhagewood/mdocml/mdocml-1.12.1/html.c soc2012/jhagewood/mdocml/mdocml-1.12.1/html.h soc2012/jhagewood/mdocml/mdocml-1.12.1/index.css soc2012/jhagewood/mdocml/mdocml-1.12.1/index.sgml soc2012/jhagewood/mdocml/mdocml-1.12.1/lib.c soc2012/jhagewood/mdocml/mdocml-1.12.1/lib.in soc2012/jhagewood/mdocml/mdocml-1.12.1/libman.h soc2012/jhagewood/mdocml/mdocml-1.12.1/libmandoc.h soc2012/jhagewood/mdocml/mdocml-1.12.1/libmdoc.h soc2012/jhagewood/mdocml/mdocml-1.12.1/libroff.h soc2012/jhagewood/mdocml/mdocml-1.12.1/main.c soc2012/jhagewood/mdocml/mdocml-1.12.1/main.h soc2012/jhagewood/mdocml/mdocml-1.12.1/man-cgi.css soc2012/jhagewood/mdocml/mdocml-1.12.1/man.7 soc2012/jhagewood/mdocml/mdocml-1.12.1/man.c soc2012/jhagewood/mdocml/mdocml-1.12.1/man.cgi.7 soc2012/jhagewood/mdocml/mdocml-1.12.1/man.h soc2012/jhagewood/mdocml/mdocml-1.12.1/man_hash.c soc2012/jhagewood/mdocml/mdocml-1.12.1/man_html.c soc2012/jhagewood/mdocml/mdocml-1.12.1/man_macro.c soc2012/jhagewood/mdocml/mdocml-1.12.1/man_term.c soc2012/jhagewood/mdocml/mdocml-1.12.1/man_validate.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mandoc.1 soc2012/jhagewood/mdocml/mdocml-1.12.1/mandoc.3 soc2012/jhagewood/mdocml/mdocml-1.12.1/mandoc.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mandoc.h soc2012/jhagewood/mdocml/mdocml-1.12.1/mandoc_char.7 soc2012/jhagewood/mdocml/mdocml-1.12.1/mandocdb.8 soc2012/jhagewood/mdocml/mdocml-1.12.1/mandocdb.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mandocdb.h soc2012/jhagewood/mdocml/mdocml-1.12.1/manpath.c soc2012/jhagewood/mdocml/mdocml-1.12.1/manpath.h soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc.7 soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc.h soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_argv.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_hash.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_html.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_macro.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_man.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_term.c soc2012/jhagewood/mdocml/mdocml-1.12.1/mdoc_validate.c soc2012/jhagewood/mdocml/mdocml-1.12.1/msec.c soc2012/jhagewood/mdocml/mdocml-1.12.1/msec.in soc2012/jhagewood/mdocml/mdocml-1.12.1/out.c soc2012/jhagewood/mdocml/mdocml-1.12.1/out.h soc2012/jhagewood/mdocml/mdocml-1.12.1/preconv.1 soc2012/jhagewood/mdocml/mdocml-1.12.1/preconv.c soc2012/jhagewood/mdocml/mdocml-1.12.1/predefs.in soc2012/jhagewood/mdocml/mdocml-1.12.1/read.c soc2012/jhagewood/mdocml/mdocml-1.12.1/roff.7 soc2012/jhagewood/mdocml/mdocml-1.12.1/roff.c soc2012/jhagewood/mdocml/mdocml-1.12.1/st.c soc2012/jhagewood/mdocml/mdocml-1.12.1/st.in soc2012/jhagewood/mdocml/mdocml-1.12.1/style.css soc2012/jhagewood/mdocml/mdocml-1.12.1/tbl.7 soc2012/jhagewood/mdocml/mdocml-1.12.1/tbl.c soc2012/jhagewood/mdocml/mdocml-1.12.1/tbl_data.c soc2012/jhagewood/mdocml/mdocml-1.12.1/tbl_html.c soc2012/jhagewood/mdocml/mdocml-1.12.1/tbl_layout.c soc2012/jhagewood/mdocml/mdocml-1.12.1/tbl_opts.c soc2012/jhagewood/mdocml/mdocml-1.12.1/tbl_term.c soc2012/jhagewood/mdocml/mdocml-1.12.1/term.c soc2012/jhagewood/mdocml/mdocml-1.12.1/term.h soc2012/jhagewood/mdocml/mdocml-1.12.1/term_ascii.c soc2012/jhagewood/mdocml/mdocml-1.12.1/term_ps.c soc2012/jhagewood/mdocml/mdocml-1.12.1/test-fgetln.c soc2012/jhagewood/mdocml/mdocml-1.12.1/test-getsubopt.c soc2012/jhagewood/mdocml/mdocml-1.12.1/test-mmap.c soc2012/jhagewood/mdocml/mdocml-1.12.1/test-strlcat.c soc2012/jhagewood/mdocml/mdocml-1.12.1/test-strlcpy.c soc2012/jhagewood/mdocml/mdocml-1.12.1/test-strptime.c soc2012/jhagewood/mdocml/mdocml-1.12.1/tree.c soc2012/jhagewood/mdocml/mdocml-1.12.1/vol.c soc2012/jhagewood/mdocml/mdocml-1.12.1/vol.in soc2012/jhagewood/mdocml/mdocml-1.12.1/whatis.1 soc2012/jhagewood/mdocml/mdocml_patches/ soc2012/jhagewood/mdocml/mdocml_patches/patch-config.txt soc2012/jhagewood/mdocml/mdocml_patches/patch-lib.in.txt soc2012/jhagewood/mdocml/mdocml_patches/patch-mdoc_validate.c soc2012/jhagewood/mdocml/mdocml_patches/patch-msec.in.txt soc2012/jhagewood/mdocml/mdocml_test.sh (contents, props changed) soc2012/jhagewood/mdocml/svn-commit.tmp Added: soc2012/jhagewood/mdocml/hagewood-mdocml.patch ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/mdocml/hagewood-mdocml.patch Fri May 25 17:31:45 2012 (r236410) @@ -0,0 +1,101 @@ +diff -rupN mdocml-1.12.1-orig/lib.in mdocml-1.12.1/lib.in +--- mdocml-1.12.1-orig/lib.in 2012-05-24 02:19:02.000000000 -0400 ++++ mdocml-1.12.1/lib.in 2012-05-24 02:19:03.000000000 -0400 +@@ -23,10 +23,10 @@ + * Be sure to escape strings. + */ + +-LINE("libarchive", "Reading and Writing Streaming Archives Library (libarchive, \\-larchive)") ++LINE("libarchive", "Streaming Archive Library (libarchive, \\-larchive)") + LINE("libarm", "ARM Architecture Library (libarm, \\-larm)") + LINE("libarm32", "ARM32 Architecture Library (libarm32, \\-larm32)") +-LINE("libbluetooth", "Bluetooth Library (libbluetooth, \\-lbluetooth)") ++LINE("libbluetooth", "Bluetooth User Library (libbluetooth, \\-lbluetooth)") + LINE("libbsm", "Basic Security Module User Library (libbsm, \\-lbsm)") + LINE("libc", "Standard C Library (libc, \\-lc)") + LINE("libc_r", "Reentrant C\\~Library (libc_r, \\-lc_r)") +@@ -41,10 +41,11 @@ LINE("libdevinfo", "Device and Resource + LINE("libdevstat", "Device Statistics Library (libdevstat, \\-ldevstat)") + LINE("libdisk", "Interface to Slice and Partition Labels Library (libdisk, \\-ldisk)") + LINE("libdwarf", "DWARF Access Library (libdwarf, \\-ldwarf)") +-LINE("libedit", "Command Line Editor Library (libedit, \\-ledit)") ++LINE("libedit", "Line Editor and History Library (libedit, \\-ledit)") ++LINE("libefi", "EFI Runtime Services Library (libefi, \\-lefi)") + LINE("libelf", "ELF Access Library (libelf, \\-lelf)") + LINE("libevent", "Event Notification Library (libevent, \\-levent)") +-LINE("libfetch", "File Transfer Library for URLs (libfetch, \\-lfetch)") ++LINE("libfetch", "File Transfer Library (libfetch, \\-lfetch)") + LINE("libform", "Curses Form Library (libform, \\-lform)") + LINE("libgeom", "Userland API Library for kernel GEOM subsystem (libgeom, \\-lgeom)") + LINE("libgpib", "General-Purpose Instrument Bus (GPIB) library (libgpib, \\-lgpib)") +@@ -70,7 +71,7 @@ LINE("libossaudio", "OSS Audio Emulation + LINE("libpam", "Pluggable Authentication Module Library (libpam, \\-lpam)") + LINE("libpcap", "Capture Library (libpcap, \\-lpcap)") + LINE("libpci", "PCI Bus Access Library (libpci, \\-lpci)") +-LINE("libpmc", "Performance Counters Library (libpmc, \\-lpmc)") ++LINE("libpmc", "Performance Monitoring Counters Interface Library (libpmc, \\-lpmc)") + LINE("libposix", "POSIX Compatibility Library (libposix, \\-lposix)") + LINE("libppath", "Property-List Paths Library (libppath, \\-lppath)") + LINE("libprop", "Property Container Object Library (libprop, \\-lprop)") +diff -rupN mdocml-1.12.1-orig/mdoc_validate.c mdocml-1.12.1/mdoc_validate.c +--- mdocml-1.12.1-orig/mdoc_validate.c 2012-05-24 02:19:02.000000000 -0400 ++++ mdocml-1.12.1/mdoc_validate.c 2012-05-24 02:19:03.000000000 -0400 +@@ -2234,6 +2234,8 @@ post_os(POST_ARGS) + mdoc_nmsg(mdoc, n, MANDOCERR_MEM); + return(0); + } ++ if (strncmp(utsname.sysname, "FreeBSD", sizeof("FreeBSD")) == 0) ++ strtok(utsname.release, "-"); + if (strlcat(buf, utsname.release, BUFSIZ) >= BUFSIZ) { + mdoc_nmsg(mdoc, n, MANDOCERR_MEM); + return(0); +diff -rupN mdocml-1.12.1-orig/msec.in mdocml-1.12.1/msec.in +--- mdocml-1.12.1-orig/msec.in 2012-05-24 02:19:02.000000000 -0400 ++++ mdocml-1.12.1/msec.in 2012-05-24 02:19:03.000000000 -0400 +@@ -22,16 +22,16 @@ + * Be sure to escape strings. + */ + +-LINE("1", "General Commands Manual") +-LINE("2", "System Calls Manual") +-LINE("3", "Library Functions Manual") ++LINE("1", "FreeBSD General Commands Manual") ++LINE("2", "FreeBSD System Calls Manual") ++LINE("3", "FreeBSD Library Functions Manual") + LINE("3p", "Perl Library Functions Manual") +-LINE("4", "Kernel Interfaces Manual") +-LINE("5", "File Formats Manual") +-LINE("6", "Games Manual") +-LINE("7", "Miscellaneous Information Manual") +-LINE("8", "System Manager\'s Manual") +-LINE("9", "Kernel Developer\'s Manual") ++LINE("4", "FreeBSD Kernel Interfaces Manual") ++LINE("5", "FreeBSD File Formats Manual") ++LINE("6", "FreeBSD Games Manual") ++LINE("7", "FreeBSD Miscellaneous Information Manual") ++LINE("8", "FreeBSD System Manager\'s Manual") ++LINE("9", "FreeBSD Kernel Developer\'s Manual") + LINE("X11", "X11 Developer\'s Manual") + LINE("X11R6", "X11 Developer\'s Manual") + LINE("unass", "Unassociated") +diff -rupN mdocml-1.12.1-orig/roff.c mdocml-1.12.1/roff.c +--- mdocml-1.12.1-orig/roff.c 2012-05-24 02:19:02.000000000 -0400 ++++ mdocml-1.12.1/roff.c 2012-05-24 17:40:55.000000000 -0400 +@@ -225,14 +225,17 @@ static struct roffmac roffs[ROFF_MAX] = + { "if", roff_cond, roff_cond_text, roff_cond_sub, ROFFMAC_STRUCT, NULL }, + { "ig", roff_block, roff_block_text, roff_block_sub, 0, NULL }, + { "it", roff_line_ignore, NULL, NULL, 0, NULL }, ++ { "na", roff_line_ignore, NULL, NULL, 0, NULL }, + { "ne", roff_line_ignore, NULL, NULL, 0, NULL }, + { "nh", roff_line_ignore, NULL, NULL, 0, NULL }, ++ { "ni", roff_line_ignore, NULL, NULL, 0, NULL }, + { "nr", roff_nr, NULL, NULL, 0, NULL }, + { "ns", roff_line_ignore, NULL, NULL, 0, NULL }, + { "ps", roff_line_ignore, NULL, NULL, 0, NULL }, + { "rm", roff_rm, NULL, NULL, 0, NULL }, + { "so", roff_so, NULL, NULL, 0, NULL }, + { "ta", roff_line_ignore, NULL, NULL, 0, NULL }, ++ { "ti", roff_line_ignore, NULL, NULL, 0, NULL }, + { "tr", roff_tr, NULL, NULL, 0, NULL }, + { "TS", roff_TS, NULL, NULL, 0, NULL }, + { "TE", roff_TE, NULL, NULL, 0, NULL }, Added: soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/Makefile Fri May 25 17:31:45 2012 (r236410) @@ -0,0 +1,645 @@ +.PHONY: clean install installwww +.SUFFIXES: .sgml .html .md5 .h .h.html +.SUFFIXES: .1 .3 .7 .8 +.SUFFIXES: .1.txt .3.txt .7.txt .8.txt +.SUFFIXES: .1.pdf .3.pdf .7.pdf .8.pdf +.SUFFIXES: .1.ps .3.ps .7.ps .8.ps +.SUFFIXES: .1.html .3.html .7.html .8.html +.SUFFIXES: .1.xhtml .3.xhtml .7.xhtml .8.xhtml + +# Specify this if you want to hard-code the operating system to appear +# in the lower-left hand corner of -mdoc manuals. +# +# CFLAGS += -DOSNAME="\"OpenBSD 4.5\"" + +VERSION = 1.12.1 +VDATE = 23 March 2012 + +# IFF your system supports multi-byte functions (setlocale(), wcwidth(), +# putwchar()) AND has __STDC_ISO_10646__ (that is, wchar_t is simply a +# UCS-4 value) should you define USE_WCHAR. If you define it and your +# system DOESN'T support this, -Tlocale will produce garbage. +# If you don't define it, -Tlocale is a synonym for -Tacsii. +# +CFLAGS += -DUSE_WCHAR + +# If your system has manpath(1), uncomment this. This is most any +# system that's not OpenBSD or NetBSD. If uncommented, apropos(1), +# mandocdb(8), and man.cgi will popen(3) manpath(1) to get the MANPATH +# variable. +#CFLAGS += -DUSE_MANPATH + +# If your system supports static binaries only, uncomment this. This +# appears only to be BSD UNIX systems (Mac OS X has no support and Linux +# requires -pthreads for static libdb). +STATIC = -static + +CFLAGS += -g -DHAVE_CONFIG_H -DVERSION="\"$(VERSION)\"" +CFLAGS += -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings +PREFIX = /usr/local +WWWPREFIX = /var/www +HTDOCDIR = $(WWWPREFIX)/htdocs +CGIBINDIR = $(WWWPREFIX)/cgi-bin +BINDIR = $(PREFIX)/bin +INCLUDEDIR = $(PREFIX)/include/mandoc +LIBDIR = $(PREFIX)/lib/mandoc +MANDIR = $(PREFIX)/man +EXAMPLEDIR = $(PREFIX)/share/examples/mandoc +INSTALL = install +INSTALL_PROGRAM = $(INSTALL) -m 0755 +INSTALL_DATA = $(INSTALL) -m 0444 +INSTALL_LIB = $(INSTALL) -m 0644 +INSTALL_SOURCE = $(INSTALL) -m 0644 +INSTALL_MAN = $(INSTALL_DATA) + +# Non-BSD systems (Linux, etc.) need -ldb to compile mandocdb and +# apropos. +# However, if you don't have -ldb at all (or it's not native), then +# comment out apropos and mandocdb. +# +#DBLIB = -ldb +DBBIN = apropos mandocdb man.cgi catman whatis +DBLN = llib-lapropos.ln llib-lmandocdb.ln llib-lman.cgi.ln llib-lcatman.ln + +all: mandoc preconv demandoc $(DBBIN) + +SRCS = Makefile \ + TODO \ + apropos.1 \ + apropos.c \ + apropos_db.c \ + apropos_db.h \ + arch.c \ + arch.in \ + att.c \ + att.in \ + catman.8 \ + catman.c \ + cgi.c \ + chars.c \ + chars.in \ + compat_fgetln.c \ + compat_getsubopt.c \ + compat_strlcat.c \ + compat_strlcpy.c \ + config.h.post \ + config.h.pre \ + demandoc.1 \ + demandoc.c \ + eqn.7 \ + eqn.c \ + eqn_html.c \ + eqn_term.c \ + example.style.css \ + external.png \ + html.c \ + html.h \ + index.css \ + index.sgml \ + lib.c \ + lib.in \ + libman.h \ + libmandoc.h \ + libmdoc.h \ + libroff.h \ + main.c \ + main.h \ + man.7 \ + man.c \ + man.cgi.7 \ + man-cgi.css \ + man.h \ + man_hash.c \ + man_html.c \ + man_macro.c \ + man_term.c \ + man_validate.c \ + mandoc.1 \ + mandoc.3 \ + mandoc.c \ + mandoc.h \ + mandoc_char.7 \ + mandocdb.8 \ + mandocdb.c \ + mandocdb.h \ + manpath.c \ + manpath.h \ + mdoc.7 \ + mdoc.c \ + mdoc.h \ + mdoc_argv.c \ + mdoc_hash.c \ + mdoc_html.c \ + mdoc_macro.c \ + mdoc_man.c \ + mdoc_term.c \ + mdoc_validate.c \ + msec.c \ + msec.in \ + out.c \ + out.h \ + preconv.1 \ + preconv.c \ + predefs.in \ + read.c \ + roff.7 \ + roff.c \ + st.c \ + st.in \ + style.css \ + tbl.7 \ + tbl.c \ + tbl_data.c \ + tbl_html.c \ + tbl_layout.c \ + tbl_opts.c \ + tbl_term.c \ + term.c \ + term.h \ + term_ascii.c \ + term_ps.c \ + test-fgetln.c \ + test-getsubopt.c \ + test-mmap.c \ + test-strlcat.c \ + test-strlcpy.c \ + test-strptime.c \ + tree.c \ + vol.c \ + vol.in \ + whatis.1 + +LIBMAN_OBJS = man.o \ + man_hash.o \ + man_macro.o \ + man_validate.o +LIBMAN_LNS = man.ln \ + man_hash.ln \ + man_macro.ln \ + man_validate.ln + +LIBMDOC_OBJS = arch.o \ + att.o \ + lib.o \ + mdoc.o \ + mdoc_argv.o \ + mdoc_hash.o \ + mdoc_macro.o \ + mdoc_validate.o \ + st.o \ + vol.o +LIBMDOC_LNS = arch.ln \ + att.ln \ + lib.ln \ + mdoc.ln \ + mdoc_argv.ln \ + mdoc_hash.ln \ + mdoc_macro.ln \ + mdoc_validate.ln \ + st.ln \ + vol.ln + +LIBROFF_OBJS = eqn.o \ + roff.o \ + tbl.o \ + tbl_data.o \ + tbl_layout.o \ + tbl_opts.o +LIBROFF_LNS = eqn.ln \ + roff.ln \ + tbl.ln \ + tbl_data.ln \ + tbl_layout.ln \ + tbl_opts.ln + +LIBMANDOC_OBJS = $(LIBMAN_OBJS) \ + $(LIBMDOC_OBJS) \ + $(LIBROFF_OBJS) \ + chars.o \ + mandoc.o \ + msec.o \ + read.o +LIBMANDOC_LNS = $(LIBMAN_LNS) \ + $(LIBMDOC_LNS) \ + $(LIBROFF_LNS) \ + chars.ln \ + mandoc.ln \ + msec.ln \ + read.ln + +COMPAT_OBJS = compat_fgetln.o \ + compat_getsubopt.o \ + compat_strlcat.o \ + compat_strlcpy.o +COMPAT_LNS = compat_fgetln.ln \ + compat_getsubopt.ln \ + compat_strlcat.ln \ + compat_strlcpy.ln + +arch.o arch.ln: arch.in +att.o att.ln: att.in +chars.o chars.ln: chars.in +lib.o lib.ln: lib.in +msec.o msec.ln: msec.in +roff.o roff.ln: predefs.in +st.o st.ln: st.in +vol.o vol.ln: vol.in + +$(LIBMAN_OBJS) $(LIBMAN_LNS): libman.h +$(LIBMDOC_OBJS) $(LIBMDOC_LNS): libmdoc.h +$(LIBROFF_OBJS) $(LIBROFF_LNS): libroff.h +$(LIBMANDOC_OBJS) $(LIBMANDOC_LNS): mandoc.h mdoc.h man.h libmandoc.h config.h + +$(COMPAT_OBJS) $(COMPAT_LNS): config.h + +MANDOC_HTML_OBJS = eqn_html.o \ + html.o \ + man_html.o \ + mdoc_html.o \ + tbl_html.o +MANDOC_HTML_LNS = eqn_html.ln \ + html.ln \ + man_html.ln \ + mdoc_html.ln \ + tbl_html.ln + +MANDOC_MAN_OBJS = mdoc_man.o +MANDOC_MAN_LNS = mdoc_man.ln + +MANDOC_TERM_OBJS = eqn_term.o \ + man_term.o \ + mdoc_term.o \ + term.o \ + term_ascii.o \ + term_ps.o \ + tbl_term.o +MANDOC_TERM_LNS = eqn_term.ln \ + man_term.ln \ + mdoc_term.ln \ + term.ln \ + term_ascii.ln \ + term_ps.ln \ + tbl_term.ln + +MANDOC_OBJS = $(MANDOC_HTML_OBJS) \ + $(MANDOC_MAN_OBJS) \ + $(MANDOC_TERM_OBJS) \ + main.o \ + out.o \ + tree.o +MANDOC_LNS = $(MANDOC_HTML_LNS) \ + $(MANDOC_MAN_LNS) \ + $(MANDOC_TERM_LNS) \ + main.ln \ + out.ln \ + tree.ln + +$(MANDOC_HTML_OBJS) $(MANDOC_HTML_LNS): html.h +$(MANDOC_TERM_OBJS) $(MANDOC_TERM_LNS): term.h +$(MANDOC_OBJS) $(MANDOC_LNS): main.h mandoc.h mdoc.h man.h config.h out.h + +MANDOCDB_OBJS = mandocdb.o manpath.o +MANDOCDB_LNS = mandocdb.ln manpath.ln + +$(MANDOCDB_OBJS) $(MANDOCDB_LNS): mandocdb.h mandoc.h mdoc.h man.h config.h manpath.h + +PRECONV_OBJS = preconv.o +PRECONV_LNS = preconv.ln + +$(PRECONV_OBJS) $(PRECONV_LNS): config.h + +APROPOS_OBJS = apropos.o apropos_db.o manpath.o +APROPOS_LNS = apropos.ln apropos_db.ln manpath.ln + +$(APROPOS_OBJS) $(APROPOS_LNS): config.h mandoc.h apropos_db.h manpath.h mandocdb.h + +CGI_OBJS = $(MANDOC_HTML_OBJS) \ + $(MANDOC_MAN_OBJS) \ + $(MANDOC_TERM_OBJS) \ + cgi.o \ + apropos_db.o \ + manpath.o \ + out.o \ + tree.o + +CGI_LNS = $(MANDOC_HTML_LNS) \ + $(MANDOC_MAN_LNS) \ + $(MANDOC_TERM_LNS) \ + cgi.ln \ + apropos_db.ln \ + manpath.ln \ + out.ln \ + tree.ln + +$(CGI_OBJS) $(CGI_LNS): main.h mdoc.h man.h out.h config.h mandoc.h apropos_db.h manpath.h mandocdb.h + +CATMAN_OBJS = catman.o manpath.o +CATMAN_LNS = catman.ln manpath.ln + +$(CATMAN_OBJS) $(CATMAN_LNS): config.h mandoc.h manpath.h mandocdb.h + +DEMANDOC_OBJS = demandoc.o +DEMANDOC_LNS = demandoc.ln + +$(DEMANDOC_OBJS) $(DEMANDOC_LNS): config.h + +INDEX_MANS = apropos.1.html \ + apropos.1.xhtml \ + apropos.1.ps \ + apropos.1.pdf \ + apropos.1.txt \ + catman.8.html \ + catman.8.xhtml \ + catman.8.ps \ + catman.8.pdf \ + catman.8.txt \ + demandoc.1.html \ + demandoc.1.xhtml \ + demandoc.1.ps \ + demandoc.1.pdf \ + demandoc.1.txt \ + mandoc.1.html \ + mandoc.1.xhtml \ + mandoc.1.ps \ + mandoc.1.pdf \ + mandoc.1.txt \ + whatis.1.html \ + whatis.1.xhtml \ + whatis.1.ps \ + whatis.1.pdf \ + whatis.1.txt \ + mandoc.3.html \ + mandoc.3.xhtml \ + mandoc.3.ps \ + mandoc.3.pdf \ + mandoc.3.txt \ + eqn.7.html \ + eqn.7.xhtml \ + eqn.7.ps \ + eqn.7.pdf \ + eqn.7.txt \ + man.7.html \ + man.7.xhtml \ + man.7.ps \ + man.7.pdf \ + man.7.txt \ + man.cgi.7.html \ + man.cgi.7.xhtml \ + man.cgi.7.ps \ + man.cgi.7.pdf \ + man.cgi.7.txt \ + mandoc_char.7.html \ + mandoc_char.7.xhtml \ + mandoc_char.7.ps \ + mandoc_char.7.pdf \ + mandoc_char.7.txt \ + mdoc.7.html \ + mdoc.7.xhtml \ + mdoc.7.ps \ + mdoc.7.pdf \ + mdoc.7.txt \ + preconv.1.html \ + preconv.1.xhtml \ + preconv.1.ps \ + preconv.1.pdf \ + preconv.1.txt \ + roff.7.html \ + roff.7.xhtml \ + roff.7.ps \ + roff.7.pdf \ + roff.7.txt \ + tbl.7.html \ + tbl.7.xhtml \ + tbl.7.ps \ + tbl.7.pdf \ + tbl.7.txt \ + mandocdb.8.html \ + mandocdb.8.xhtml \ + mandocdb.8.ps \ + mandocdb.8.pdf \ + mandocdb.8.txt + +$(INDEX_MANS): mandoc + +INDEX_OBJS = $(INDEX_MANS) \ + man.h.html \ + mandoc.h.html \ + mdoc.h.html \ + mdocml.tar.gz \ + mdocml.md5 + +www: index.html + +lint: llib-lmandoc.ln llib-lpreconv.ln llib-ldemandoc.ln $(DBLN) + +clean: + rm -f libmandoc.a $(LIBMANDOC_OBJS) + rm -f llib-llibmandoc.ln $(LIBMANDOC_LNS) + rm -f mandocdb $(MANDOCDB_OBJS) + rm -f llib-lmandocdb.ln $(MANDOCDB_LNS) + rm -f preconv $(PRECONV_OBJS) + rm -f llib-lpreconv.ln $(PRECONV_LNS) + rm -f apropos whatis $(APROPOS_OBJS) + rm -f llib-lapropos.ln $(APROPOS_LNS) + rm -f man.cgi $(CGI_OBJS) + rm -f llib-lman.cgi.ln $(CGI_LNS) + rm -f catman $(CATMAN_OBJS) + rm -f llib-lcatman.ln $(CATMAN_LNS) + rm -f demandoc $(DEMANDOC_OBJS) + rm -f llib-ldemandoc.ln $(DEMANDOC_LNS) + rm -f mandoc $(MANDOC_OBJS) + rm -f llib-lmandoc.ln $(MANDOC_LNS) + rm -f config.h config.log $(COMPAT_OBJS) $(COMPAT_LNS) + rm -f mdocml.tar.gz mdocml-win32.zip mdocml-win64.zip mdocml-macosx.zip + rm -f index.html $(INDEX_OBJS) + rm -rf test-fgetln.dSYM + rm -rf test-strlcpy.dSYM + rm -rf test-strlcat.dSYM + rm -rf test-strptime.dSYM + rm -rf test-mmap.dSYM + rm -rf test-getsubopt.dSYM + rm -rf apropos.dSYM + rm -rf catman.dSYM + rm -rf mandocdb.dSYM + rm -rf whatis.dSYM + +install: all + mkdir -p $(DESTDIR)$(BINDIR) + mkdir -p $(DESTDIR)$(EXAMPLEDIR) + mkdir -p $(DESTDIR)$(LIBDIR) + mkdir -p $(DESTDIR)$(INCLUDEDIR) + mkdir -p $(DESTDIR)$(MANDIR)/man1 + mkdir -p $(DESTDIR)$(MANDIR)/man3 + mkdir -p $(DESTDIR)$(MANDIR)/man7 + $(INSTALL_PROGRAM) mandoc preconv demandoc $(DESTDIR)$(BINDIR) + $(INSTALL_LIB) libmandoc.a $(DESTDIR)$(LIBDIR) + $(INSTALL_LIB) man.h mdoc.h mandoc.h $(DESTDIR)$(INCLUDEDIR) + $(INSTALL_MAN) mandoc.1 preconv.1 demandoc.1 $(DESTDIR)$(MANDIR)/man1 + $(INSTALL_MAN) mandoc.3 $(DESTDIR)$(MANDIR)/man3 + $(INSTALL_MAN) man.7 mdoc.7 roff.7 eqn.7 tbl.7 mandoc_char.7 $(DESTDIR)$(MANDIR)/man7 + $(INSTALL_DATA) example.style.css $(DESTDIR)$(EXAMPLEDIR) + +installcgi: all + mkdir -p $(DESTDIR)$(CGIBINDIR) + mkdir -p $(DESTDIR)$(HTDOCDIR) + $(INSTALL_PROGRAM) man.cgi $(DESTDIR)$(CGIBINDIR) + $(INSTALL_DATA) example.style.css $(DESTDIR)$(HTDOCDIR)/man.css + $(INSTALL_DATA) man-cgi.css $(DESTDIR)$(HTDOCDIR) + +installwww: www + mkdir -p $(PREFIX)/snapshots + mkdir -p $(PREFIX)/binaries + $(INSTALL_DATA) index.html external.png index.css $(PREFIX) + $(INSTALL_DATA) $(INDEX_MANS) style.css $(PREFIX) + $(INSTALL_DATA) mandoc.h.html man.h.html mdoc.h.html $(PREFIX) + $(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots + $(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots + $(INSTALL_DATA) mdocml.tar.gz $(PREFIX)/snapshots/mdocml-$(VERSION).tar.gz + $(INSTALL_DATA) mdocml.md5 $(PREFIX)/snapshots/mdocml-$(VERSION).md5 + +libmandoc.a: $(COMPAT_OBJS) $(LIBMANDOC_OBJS) + $(AR) rs $@ $(COMPAT_OBJS) $(LIBMANDOC_OBJS) + +llib-llibmandoc.ln: $(COMPAT_LNS) $(LIBMANDOC_LNS) + $(LINT) $(LINTFLAGS) -Clibmandoc $(COMPAT_LNS) $(LIBMANDOC_LNS) + +mandoc: $(MANDOC_OBJS) libmandoc.a + $(CC) $(LDFLAGS) -o $@ $(MANDOC_OBJS) libmandoc.a + +llib-lmandoc.ln: $(MANDOC_LNS) llib-llibmandoc.ln + $(LINT) $(LINTFLAGS) -Cmandoc $(MANDOC_LNS) llib-llibmandoc.ln + +mandocdb: $(MANDOCDB_OBJS) libmandoc.a + $(CC) $(LDFLAGS) -o $@ $(MANDOCDB_OBJS) libmandoc.a $(DBLIB) + +llib-lmandocdb.ln: $(MANDOCDB_LNS) llib-llibmandoc.ln + $(LINT) $(LINTFLAGS) -Cmandocdb $(MANDOCDB_LNS) llib-llibmandoc.ln + +preconv: $(PRECONV_OBJS) + $(CC) $(LDFLAGS) -o $@ $(PRECONV_OBJS) + +llib-lpreconv.ln: $(PRECONV_LNS) llib-llibmandoc.ln + $(LINT) $(LINTFLAGS) -Cpreconv $(PRECONV_LNS) llib-llibmandoc.ln + +whatis: apropos + cp -f apropos whatis + +apropos: $(APROPOS_OBJS) libmandoc.a + $(CC) $(LDFLAGS) -o $@ $(APROPOS_OBJS) libmandoc.a $(DBLIB) + +llib-lapropos.ln: $(APROPOS_LNS) llib-llibmandoc.ln + $(LINT) $(LINTFLAGS) -Capropos $(APROPOS_LNS) llib-llibmandoc.ln + +catman: $(CATMAN_OBJS) libmandoc.a + $(CC) $(LDFLAGS) -o $@ $(CATMAN_OBJS) libmandoc.a $(DBLIB) + +llib-lcatman.ln: $(CATMAN_LNS) llib-llibmandoc.ln + $(LINT) $(LINTFLAGS) -Ccatman $(CATMAN_LNS) llib-llibmandoc.ln + +man.cgi: $(CGI_OBJS) libmandoc.a + $(CC) $(LDFLAGS) $(STATIC) -o $@ $(CGI_OBJS) libmandoc.a $(DBLIB) + +llib-lman.cgi.ln: $(CGI_LNS) llib-llibmandoc.ln + $(LINT) $(LINTFLAGS) -Cman.cgi $(CGI_LNS) llib-llibmandoc.ln + +demandoc: $(DEMANDOC_OBJS) libmandoc.a + $(CC) $(LDFLAGS) -o $@ $(DEMANDOC_OBJS) libmandoc.a + +llib-ldemandoc.ln: $(DEMANDOC_LNS) llib-llibmandoc.ln + $(LINT) $(LINTFLAGS) -Cdemandoc $(DEMANDOC_LNS) llib-llibmandoc.ln + +mdocml.md5: mdocml.tar.gz + md5 mdocml.tar.gz >$@ + +mdocml.tar.gz: $(SRCS) + mkdir -p .dist/mdocml-$(VERSION)/ + $(INSTALL_SOURCE) $(SRCS) .dist/mdocml-$(VERSION) + ( cd .dist/ && tar zcf ../$@ ./ ) + rm -rf .dist/ + +mdocml-win32.zip: $(SRCS) + mkdir -p .win32/mdocml-$(VERSION)/ + $(INSTALL_SOURCE) $(SRCS) .win32 + cp .win32/Makefile .win32/Makefile.old + egrep -v -e DUSE_WCHAR -e ^DBBIN .win32/Makefile.old >.win32/Makefile + ( cd .win32; \ + CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar CFLAGS='-DOSNAME=\"Windows\"' make; \ + make install PREFIX=mdocml-$(VERSION) ; \ + zip -r ../$@ mdocml-$(VERSION) ) + rm -rf .win32 + +mdocml-win64.zip: $(SRCS) + mkdir -p .win64/mdocml-$(VERSION)/ + $(INSTALL_SOURCE) $(SRCS) .win64 + cp .win64/Makefile .win64/Makefile.old + egrep -v -e DUSE_WCHAR -e ^DBBIN .win64/Makefile.old >.win64/Makefile + ( cd .win64; \ + CC=x86_64-w64-mingw32-gcc AR=x86_64-w64-mingw32-ar CFLAGS='-DOSNAME=\"Windows\"' make; \ + make install PREFIX=mdocml-$(VERSION) ; \ + zip -r ../$@ mdocml-$(VERSION) ) + rm -rf .win64 + +mdocml-macosx.zip: $(SRCS) + mkdir -p .macosx/mdocml-$(VERSION)/ + $(INSTALL_SOURCE) $(SRCS) .macosx + ( cd .macosx; \ + CFLAGS="-arch i386 -arch x86_64 -arch ppc" LDFLAGS="-arch i386 -arch x86_64 -arch ppc" make; \ + make install PREFIX=mdocml-$(VERSION) ; \ + zip -r ../$@ mdocml-$(VERSION) ) + rm -rf .macosx + +index.html: $(INDEX_OBJS) + +config.h: config.h.pre config.h.post + rm -f config.log + ( cat config.h.pre; \ + echo; \ + if $(CC) $(CFLAGS) -Werror -o test-fgetln test-fgetln.c >> config.log 2>&1; then \ + echo '#define HAVE_FGETLN'; \ + rm test-fgetln; \ + fi; \ + if $(CC) $(CFLAGS) -Werror -o test-strptime test-strptime.c >> config.log 2>&1; then \ + echo '#define HAVE_STRPTIME'; \ + rm test-strptime; \ + fi; \ + if $(CC) $(CFLAGS) -Werror -o test-getsubopt test-getsubopt.c >> config.log 2>&1; then \ + echo '#define HAVE_GETSUBOPT'; \ + rm test-getsubopt; \ + fi; \ + if $(CC) $(CFLAGS) -Werror -o test-strlcat test-strlcat.c >> config.log 2>&1; then \ + echo '#define HAVE_STRLCAT'; \ + rm test-strlcat; \ + fi; \ + if $(CC) $(CFLAGS) -Werror -o test-mmap test-mmap.c >> config.log 2>&1; then \ + echo '#define HAVE_MMAP'; \ + rm test-mmap; \ + fi; \ + if $(CC) $(CFLAGS) -Werror -o test-strlcpy test-strlcpy.c >> config.log 2>&1; then \ + echo '#define HAVE_STRLCPY'; \ + rm test-strlcpy; \ + fi; \ + echo; \ + cat config.h.post \ + ) > $@ + +.h.h.html: + highlight -I $< >$@ + +.1.1.txt .3.3.txt .7.7.txt .8.8.txt: + ./mandoc -Tascii -Wall,stop $< | col -b >$@ + +.1.1.html .3.3.html .7.7.html .8.8.html: + ./mandoc -Thtml -Wall,stop -Ostyle=style.css,man=%N.%S.html,includes=%I.html $< >$@ + +.1.1.ps .3.3.ps .7.7.ps .8.8.ps: + ./mandoc -Tps -Wall,stop $< >$@ + +.1.1.xhtml .3.3.xhtml .7.7.xhtml .8.8.xhtml: + ./mandoc -Txhtml -Wall,stop -Ostyle=style.css,man=%N.%S.xhtml,includes=%I.html $< >$@ + +.1.1.pdf .3.3.pdf .7.7.pdf .8.8.pdf: + ./mandoc -Tpdf -Wall,stop $< >$@ + +.sgml.html: + validate --warn $< + sed -e "s!@VERSION@!$(VERSION)!" -e "s!@VDATE@!$(VDATE)!" $< >$@ Added: soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/TODO ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/mdocml/mdocml-1.12.1-orig/TODO Fri May 25 17:31:45 2012 (r236410) @@ -0,0 +1,372 @@ +************************************************************************ +* Official mandoc TODO. +* $Id: TODO,v 1.129 2012/03/04 23:53:37 schwarze Exp $ +************************************************************************ + +************************************************************************ +* parser bugs +************************************************************************ + +- ".\}" on its own line gets translated to bare ".\&" + which forces pset() into man(7) + and then triggers an unknown macro error + reported by naddy@ Sun, 3 Jul 2011 21:52:24 +0200 + +************************************************************************ +* formatter bugs +************************************************************************ + +- tbl(7): Horizontal and vertical lines are formatted badly: + With the box option, there is too much white space at the end of cells. + Horizontal lines from "=" lines are a bit too long. + yuri dot pankov at gmail dot com Thu, 14 Apr 2011 05:45:26 +0400 + +************************************************************************ +* missing features +************************************************************************ + +--- missing roff features ---------------------------------------------- + +- The pod2man preamble wants \h'...' with quoted numerical arguments, + see for example AUTHORS in MooseX::Getopt.3p, p5-MooseX-Getopt. + reported by Andreas Voegele + Tue, 22 Nov 2011 15:34:47 +0100 on ports@ + +- .if n \{ + .br\} + should cause an extra space to be raised. + +- .ad (adjust margins) + .ad l -- adjust left margin only (flush left) + .ad r -- adjust right margin only (flush right) + .ad c -- center text on line + .ad b -- adjust both margins (alias: .ad n) + .na -- temporarily disable adjustment without changing the mode + .ad -- re-enable adjustment without changing the mode + Adjustment mode is ignored while in no-fill mode (.nf). + +- .it (line traps) occur in mysql(1), yasm_arch(7) + generated by DocBook XSL Stylesheets v1.71.1 + reported by brad@ Sat, 15 Jan 2011 15:48:18 -0500 + +- .ns (no-space mode) occurs in xine-config(1) + reported by brad@ Sat, 15 Jan 2011 15:45:23 -0500 + +- xloadimage(1) wants .ti (temporary indent), rep by naddy@ + +- .ta (tab settings) occurs in ircbug(1) and probably gnats(1) + reported by brad@ Sat, 15 Jan 2011 15:50:51 -0500 + +- \c (interrupted text) occurs in chat(8) + +- using undefined strings or macros defines them to be empty + wl@ Mon, 14 Nov 2011 14:37:01 +0000 + +--- missing mdoc features ---------------------------------------------- + +- fix bad block nesting involving multiple identical explicit blocks + see the OpenBSD mdoc_macro.c 1.47 commit message + +- .Bl -column .Xo support is missing + ultimate goal: + restore .Xr and .Dv to + lib/libc/compat-43/sigvec.3 + lib/libc/gen/signal.3 + lib/libc/sys/sigaction.2 + +- edge case: decide how to deal with blk_full bad nesting, e.g. + .Sh .Nm .Bk .Nm .Ek .Sh found by jmc@ in ssh-keygen(1) + from jmc@ Wed, 14 Jul 2010 18:10:32 +0100 + +- \\ is now implemented correctly + * when defining strings and macros using .ds and .de + * when parsing roff(7) and man(7) macro arguments + It does not yet work in mdoc(7) macro arguments + because libmdoc does not yet use mandoc_getarg(). + Also check what happens in plain text, it must be identical to \e. + +- .Bd -filled should not be the same as .Bd -ragged, but align both + the left and right margin. In groff, it is implemented in terms + of .ad b, which we don't have either. Found in cksum(1). + +- implement blank `Bl -column', such as + .Bl -column + .It foo Ta bar + .El + +- explicitly disallow nested `Bl -column', which would clobber internal + flags defined for struct mdoc_macro + +- In .Bl -column .It, the end of the line probably has to be regarded + as an implicit .Ta, if there could be one, see the following mildly + ugly code from login.conf(5): + .Bl -column minpasswordlen program xetcxmotd + .It path Ta path Ta value of Dv _PATH_DEFPATH + .br + Default search path. + reported by Michal Mazurek + via jmc@ Thu, 7 Apr 2011 16:00:53 +0059 + +- inside `.Bl -column' phrases, punctuation is handled like normal + text, e.g. `.Bl -column .It Fl x . Ta ...' should give "-x -." + +- inside `.Bl -column' phrases, TERMP_IGNDELIM handling by `Pf' + is not safe, e.g. `.Bl -column .It Pf a b .' gives "ab." + but should give "ab ." + +- set a meaningful default if no `Bl' list type is assigned + +- have a blank `It' head for `Bl -tag' not puke + +- prohibit `Nm' from having non-text HEAD children + (e.g., NetBSD mDNSShared/dns-sd.1) + (mdoc_html.c and mdoc_term.c `Nm' handlers can be slightly simplified) + +- When there is free text in the SYNOPSIS and that free text contains + the .Nm macro, groff somehow understands to treat the .Nm as an in-line + macro, while mandoc treats it as a block macro and breaks the line. + No idea how the logic for distinguishing in-line and block instances + should be, needs investigation. + uqs@ Thu, 2 Jun 2011 11:03:51 +0200 + uqs@ Thu, 2 Jun 2011 11:33:35 +0200 + +--- missing man features ----------------------------------------------- + +- groff an-ext.tmac macros (.UR, .UE) occur in xine(5) + reported by brad@ Sat, 15 Jan 2011 15:45:23 -0500 + +- -T[x]html doesn't stipulate non-collapsing spaces in literal mode + +--- missing tbl features ----------------------------------------------- + +- implement basic non-parametric .de to support e.g. sox(1) + reported by naddy@ Sat, 16 Oct 2010 23:51:57 +0200 + *** sox(1) still doesn't work, tbl(1) errors need investigation + +- allow standalone `.' to be interpreted as an end-of-layout + delimiter instead of being thrown away as a no-op roff line + reported by Yuri Pankov, Wed 18 May 2011 11:34:59 CEST + +--- missing misc features ---------------------------------------------- + +- clean up escape sequence handling, creating three classes: + (1) fully implemented, or parsed and ignored without loss of content + (2) unimplemented, potentially causing loss of content + or serious mangling of formatting (e.g. \n) -> ERROR + see textproc/mgdiff(1) for nice examples + (3) undefined, just output the character -> perhaps WARNING + +- The \t escape sequence is the same as a literal tab, see for example + the ASCII table in hexdump(1) where + .Bl -column \&000_nu \&001_so \&002_st \&003_et \&004_eo + .It \&000\ nul\t001\ soh\t002\ stx\t003\ etx\t004\ eot\t005\ enq + produces + 000 nul 001 soh 002 stx 003 etx 004 eot 005 enq + and the example in oldrdist(1) + +- look at pages generated from reStructeredText, e.g. devel/mercurial hg(1) + These are a weird mixture of man(7) and custom autogenerated low-level + roff stuff. Figure out to what extent we can cope. + For details, see http://docutils.sourceforge.net/rst.html + noted by stsp@ Sat, 24 Apr 2010 09:17:55 +0200 + reminded by nicm@ Mon, 3 May 2010 09:52:41 +0100 + +- check compatibility with Plan9: + http://swtch.com/usr/local/plan9/tmac/tmac.an + http://swtch.com/plan9port/man/man7/man.html + "Anthony J. Bentley" 28 Dec 2010 21:58:40 -0700 + +************************************************************************ +* formatting issues: ugly output +************************************************************************ + +- a column list with blank `Ta' cells triggers a spurrious + start-with-whitespace printing of a newline + +- double quotes inside double quotes are escaped by doubling them + implement this in mdoc(7), too + so far, we only have it in roff(7) and man(7) + reminded by millert@ Thu, 09 Dec 2010 17:29:52 -0500 + +- perl(1) SYNOPSIS looks bad; reported by deraadt@ + 1) man(7) seems to need SYNOPSIS .Nm blocks, too + +- In .Bl -column, + .It Em AuthenticationKey Length + ought to render "Key Length" with emphasis, too, + see OpenBSD iked.conf(5). + reported again Nicolas Joly via wiz@ Wed, 12 Oct 2011 00:20:00 +0200 + +- empty phrases in .Bl column produce too few blanks + try e.g. .Bl -column It Ta Ta + reported by millert Fri, 02 Apr 2010 16:13:46 -0400 + +- .%T can have trailing punctuation. Currently, it puts the trailing + punctuation into a trailing MDOC_TEXT element inside its own scope. + That element should rather be outside its scope, such that the + punctuation does not get underlines. This is not trivial to + implement because .%T then needs some features of in_line_eoln() - + slurp all arguments into one single text element - and one feature + of in_line() - put trailing punctuation out of scope. + Found in mount_nfs(8) and exports(5), search for "Appendix". + +- in enclosures, mandoc sometimes fancies a bogus end of sentence + reminded by jmc@ Thu, 23 Sep 2010 18:13:39 +0059 + +************************************************************************ +* formatting issues: gratuitous differences +************************************************************************ + +- .Rv (and probably .Ex) print different text if an `Nm' has been named + or not (run a manual without `Nm blah' to see this). I'm not sure + that this exists in the wild, but it's still an error. + +- In .Bl -bullet, the groff bullet is "+\b+\bo\bo", the mandoc bullet + is just "o\bo". + see for example OpenBSD ksh(1) + +- The characters "|" and "\*(Ba" should never be bold, + not even in the middle of a word, e.g. ".Cm b\*(Bac" in + "mknod [-m mode] name b|c major minor" + in OpenBSD ksh(1) + +- A bogus .Pp between two .It must not produce a double blank line, + see between -R and -r in OpenBSD rm(1), before "update" in mount(8), + or in DIAGNOSTICS in init(8), or before "is always true" in ksh(1). + The same happens with .Pp just before .El, see bgpd.conf(5). + Also have `It' complain if `Pp' is invoked at certain times (not + -compact?). + +- .Pp between two .It in .Bl -column should produce one, + not two blank lines, see e.g. login.conf(5). + reported by jmc@ Sun, 17 Apr 2011 14:04:58 +0059 + reported again by sthen@ Wed, 18 Jan 2012 02:09:39 +0000 (UTC) + +- If the *first* line after .It is .Pp, break the line right after *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Sat May 26 06:16:14 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id B8670106564A for ; Sat, 26 May 2012 06:16:12 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sat, 26 May 2012 06:16:12 +0000 Date: Sat, 26 May 2012 06:16:12 +0000 From: gmiller@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120526061612.B8670106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r236445 - in soc2012/gmiller/locking-head: include lib/libthr/thread X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 May 2012 06:16:14 -0000 Author: gmiller Date: Sat May 26 06:16:12 2012 New Revision: 236445 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236445 Log: Macroize pthread_mutex_lock() in order to add the file and line parameters that identify the acquisition point for the lock. Modified: soc2012/gmiller/locking-head/include/pthread.h soc2012/gmiller/locking-head/lib/libthr/thread/thr_mutex.c Modified: soc2012/gmiller/locking-head/include/pthread.h ============================================================================== --- soc2012/gmiller/locking-head/include/pthread.h Sat May 26 05:29:53 2012 (r236444) +++ soc2012/gmiller/locking-head/include/pthread.h Sat May 26 06:16:12 2012 (r236445) @@ -179,6 +179,12 @@ __pthread_cleanup_pop_imp(execute); \ } +#ifdef LOCK_PROFILING +#define _PTHREAD_PROFILE_PARMS , const char *, int +#else +#define _PTHREAD_PROFILE_PARMS /* */ +#endif + int pthread_condattr_destroy(pthread_condattr_t *); int pthread_condattr_getclock(const pthread_condattr_t *, clockid_t *); @@ -215,7 +221,7 @@ int pthread_mutex_destroy(pthread_mutex_t *); int pthread_mutex_init(pthread_mutex_t *, const pthread_mutexattr_t *); -int pthread_mutex_lock(pthread_mutex_t *); +int pthread_mutex_lock(pthread_mutex_t * _PTHREAD_PROFILE_PARMS); int pthread_mutex_trylock(pthread_mutex_t *); int pthread_mutex_timedlock(pthread_mutex_t *, const struct timespec *); @@ -294,4 +300,16 @@ void __pthread_cleanup_pop_imp(int); __END_DECLS +#ifdef LOCK_PROFILING + +#ifndef pthread_mutex_lock +#define pthread_mutex_lock(m) \ + pthread_mutex_lock (m, __FILE__, __LINE__) +#endif + +#define _pthread_mutex_lock(m) \ + _pthread_mutex_lock (m, __FILE__, __LINE__) + +#endif + #endif Modified: soc2012/gmiller/locking-head/lib/libthr/thread/thr_mutex.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libthr/thread/thr_mutex.c Sat May 26 05:29:53 2012 (r236444) +++ soc2012/gmiller/locking-head/lib/libthr/thread/thr_mutex.c Sat May 26 06:16:12 2012 (r236445) @@ -71,13 +71,19 @@ */ #define MUTEX_ADAPTIVE_SPINS 2000 +#ifdef LOCK_PROFILING +#define _PROFILE_PARMS , const char *file, int line +#else +#define _PROFILE_PARMS /* */ +#endif + /* * Prototypes */ int __pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *mutex_attr); int __pthread_mutex_trylock(pthread_mutex_t *mutex); -int __pthread_mutex_lock(pthread_mutex_t *mutex); +int __pthread_mutex_lock(pthread_mutex_t *mutex _PROFILE_PARMS); int __pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *abstime); int _pthread_mutex_init_calloc_cb(pthread_mutex_t *mutex, @@ -354,6 +360,10 @@ if (m->m_owner == curthread) return mutex_self_lock(m, abstime); +#if 0 + lock_profile_obtain_lock_success(); +#endif + id = TID(curthread); /* * For adaptive mutexes, spin for a bit in the expectation @@ -432,7 +442,7 @@ } int -__pthread_mutex_lock(pthread_mutex_t *mutex) +__pthread_mutex_lock(pthread_mutex_t *mutex _PROFILE_PARMS) { struct pthread_mutex *m; From owner-svn-soc-all@FreeBSD.ORG Sat May 26 17:18:53 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id EDEB81065674 for ; Sat, 26 May 2012 17:18:50 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sat, 26 May 2012 17:18:50 +0000 Date: Sat, 26 May 2012 17:18:50 +0000 From: rudot@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120526171850.EDEB81065674@hub.freebsd.org> Cc: Subject: socsvn commit: r236507 - in soc2012/rudot: aux sys/kern X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 May 2012 17:18:53 -0000 Author: rudot Date: Sat May 26 17:18:50 2012 New Revision: 236507 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236507 Log: rctl can add rule specifying per process %cpu limit. The rules do take effect. The scheduler pauses processes that are over limit. This will probably change. Added: soc2012/rudot/aux/enter_kdb.sh (contents, props changed) Modified: soc2012/rudot/aux/add.sh soc2012/rudot/aux/build_kernel.sh soc2012/rudot/aux/dummy_process.c soc2012/rudot/sys/kern/sched_4bsd.c Modified: soc2012/rudot/aux/add.sh ============================================================================== --- soc2012/rudot/aux/add.sh Sat May 26 16:42:47 2012 (r236506) +++ soc2012/rudot/aux/add.sh Sat May 26 17:18:50 2012 (r236507) @@ -1,8 +1,14 @@ -if [ ! $# == 1 ]; then - echo "Usage: $0 pid" +if [ $# == 0 ]; then + echo "Usage: $0 pid [pct]" exit fi PID=$1 -rctl -a process:${PID}:pcpu:deny=50 +if [ -z $2 ]; then + PCT=50 +else + PCT=$2 +fi + +rctl -a process:${PID}:pcpu:deny=${PCT} Modified: soc2012/rudot/aux/build_kernel.sh ============================================================================== --- soc2012/rudot/aux/build_kernel.sh Sat May 26 16:42:47 2012 (r236506) +++ soc2012/rudot/aux/build_kernel.sh Sat May 26 17:18:50 2012 (r236507) @@ -1,5 +1,9 @@ # check http://www.mail-archive.com/freebsd-hackers@freebsd.org/msg23424.html +if [ `hostname` != "target" ]; then + echo "You can run it only on the target machine." + exit +fi + cd /usr/src -make buildkernel -DNO_MODULES KERNCONF=RCTL -make installkernel -DNO_MODULES KERNCONF=RCTL +make buildkernel -DNO_MODULES -DNO_CLEAN KERNCONF=RCTL && make installkernel -DNO_MODULES KERNCONF=RCTL Modified: soc2012/rudot/aux/dummy_process.c ============================================================================== --- soc2012/rudot/aux/dummy_process.c Sat May 26 16:42:47 2012 (r236506) +++ soc2012/rudot/aux/dummy_process.c Sat May 26 17:18:50 2012 (r236507) @@ -8,7 +8,14 @@ pid_t myPid = getpid(); printf("%d\n", myPid); - pause(); + // pause(); + + int i = 75; + for (;;) { + i++; + if (i % 48 == 13) + i++; + } return (0); } Added: soc2012/rudot/aux/enter_kdb.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/aux/enter_kdb.sh Sat May 26 17:18:50 2012 (r236507) @@ -0,0 +1 @@ +sysctl debug.kdb.enter=1 Modified: soc2012/rudot/sys/kern/sched_4bsd.c ============================================================================== --- soc2012/rudot/sys/kern/sched_4bsd.c Sat May 26 16:42:47 2012 (r236506) +++ soc2012/rudot/sys/kern/sched_4bsd.c Sat May 26 17:18:50 2012 (r236507) @@ -511,9 +511,6 @@ #endif ts->ts_cpticks = 0; } -#ifdef RACCT - racct_set(p, RACCT_PCTCPU, ts->ts_pctcpu); -#endif /* * If there are ANY running threads in this process, * then don't count it as sleeping. @@ -677,18 +674,6 @@ return (sched_quantum); } -#ifdef RACCT -static int -sched_racct_pcpu_deny(struct thread *td) -{ - struct proc *p; - - p = td->td_proc; - - return (0); -} -#endif - /* * We adjust the priority of the current process. The priority of * a process gets worse as it accumulates CPU time. The cpu usage @@ -708,6 +693,12 @@ { struct pcpuidlestat *stat; struct td_sched *ts; +#ifdef RACCT + int error; + int pct_human; + fixpt_t pctcpu; + struct thread *tdp; +#endif THREAD_LOCK_ASSERT(td, MA_OWNED); ts = td->td_sched; @@ -727,15 +718,26 @@ ticks - PCPU_GET(switchticks) >= sched_quantum) td->td_flags |= TDF_NEEDRESCHED; -#ifdef RACCT - if (!TD_IS_IDLETHREAD(td) && - sched_racct_pcpu_deny(td)) - td->td_flags |= TDF_NEEDRESCHED; -#endif - stat = DPCPU_PTR(idlestat); stat->oldidlecalls = stat->idlecalls; stat->idlecalls = 0; + +#ifdef RACCT + pctcpu = sched_pctcpu(td); + FOREACH_THREAD_IN_PROC(td->td_proc, tdp) { + if (td == tdp) + continue; + thread_lock(tdp); + pctcpu += sched_pctcpu(tdp); + thread_unlock(tdp); + } + pct_human = (100 * pctcpu) / FSCALE; + error = racct_set(td->td_proc, RACCT_PCTCPU, pct_human); + if ((error != 0) || + (pct_human >= racct_get_limit(td->td_proc, RACCT_PCTCPU))) { + pause("racct", hz); + } +#endif } /* From owner-svn-soc-all@FreeBSD.ORG Sat May 26 21:09:43 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 1B292106566C for ; Sat, 26 May 2012 21:09:41 +0000 (UTC) (envelope-from tzabal@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sat, 26 May 2012 21:09:41 +0000 Date: Sat, 26 May 2012 21:09:41 +0000 From: tzabal@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120526210941.1B292106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r236521 - soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 May 2012 21:09:43 -0000 Author: tzabal Date: Sat May 26 21:09:40 2012 New Revision: 236521 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236521 Log: Updated version of the /usr/sbin/crashreport shell script. At this point, we should be able to locate the debugging information and check the email address either automatically (during boot) or manually. Modified: soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh Modified: soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh ============================================================================== --- soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh Sat May 26 20:13:24 2012 (r236520) +++ soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh Sat May 26 21:09:40 2012 (r236521) @@ -1,27 +1,32 @@ #!/bin/sh +. /etc/rc.conf + print_usage() { echo "usage: $(basename $0) [-d dumpdir] [-f file] [-e email]" } -# Default dump directory + +# Constants DUMPDIR='/var/crash' -dumpdir= -file= -email= +# Script variables +_dumpdir="" +_file="" +_email="" + while getopts "d:f:e:" opt; do case "$opt" in d) - dumpdir=$OPTARG + _dumpdir=$OPTARG ;; f) - file=$OPTARG + _file=$OPTARG ;; e) - email=$OPTARG + _email=$OPTARG ;; *) print_usage @@ -30,42 +35,94 @@ esac done - -if [ -z "${dumpdir}" ]; then - if [ -d "${DUMPDIR}" ]; then - dumpdir=${DUMPDIR} +echo 'We start with:' +echo "_dumpdir = ${_dumpdir}" +echo "_file = ${_file}" +echo "_email = ${_email}" +echo '---------------' +echo 'We end up with:' + +## Find the dump directory +# Check the parameter +if [ -z "${_dumpdir}" ]; then + # Check the dumpdir of /etc/rc.conf + if [ -z "${dumpdir}" ]; then + # Use the default dumpdir + _dumpdir=${DUMPDIR} else - echo "Dump directory does not exist." - exit 1 + _dumpdir=${dumpdir} fi fi +if [ ! -d "${_dumpdir}" ]; then + echo "crashreport: Dump directory ${_dumpdir} does not exist." + exit 1 +fi -BOUNDS="${dumpdir}/bounds" -CORETXT="${dumpdir}/core.txt" -TEXTDUMPTAR="${dumpdir}/textdump.tar" -X= - -if [ -z "`ls ${dumpdir}`" ]; then - echo "The dump directory is empty." +if [ -z "`ls ${_dumpdir}`" ]; then + echo "crashreport: Dump directory ${_dumpdir} is empty." exit 2 fi +echo "_dumpdir = ${_dumpdir}" -if [ -z "${file}" ]; then - if [ -f "${BOUNDS}" ]; then +## Find the file that contains the debugging information +## It is either a core.txt.X or a textdump.tar.X +BOUNDS="${_dumpdir}/bounds" +CORE="${_dumpdir}/core.txt" +TEXTDUMP="${_dumpdir}/textdump.tar" +X="" + +# Check the parameter +if [ -z "${_file}" ]; then + # Find it using the file bounds + if [ -r "${BOUNDS}" ]; then value=`head -n 1 ${BOUNDS}` X=$((value - 1)) - if [ -f "${CORETXT}.${X}" ]; then - file=`basename "${CORETXT}.${X}"` - elif [ -f "${TEXTDUMPTAR}.${X}" ]; then - file=`basename "${TEXTDUMPTAR}.${X}"` + if [ -f "${CORE}.${X}" ]; then + _file=`basename "${CORE}.${X}"` else - echo "Unable to locate generated debugging information." - exit 3 + _file=`basename "${TEXTDUMP}.${X}"` fi + # Otherwise, use this (heavier) way else - tmp=`ls | grep '[a-z]*\.[a-z]*\.\w*' | sort -n -t . -k 3 | tail -1` - file=`basename "${tmp}"` + _file=`ls ${_dumpdir} | grep '[a-z]*\.[a-z]*\.\w*' | \ + sort -n -t . -k 3 | tail -1` fi fi + +if [ ! -f "${_dumpdir}/${_file}" ]; then + echo "crashreport: Unable to locate file with debugging information." + exit 3 +fi + +echo "_file = ${_file}" + +## Find the email that will be used for contact +# Check the parameter +if [ -z "${_email}" ]; then + # The email of /etc/rc.conf + _email="${email}" +fi + +if [ -z "$_email" ]; then + echo 'crashreport: No email address for contact is specified.' + exit 4 +fi + +# Check if the given email address is valid based on its format. +echo ${_email} | egrep '^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$' \ + > /dev/null + +if [ "$?" -ne "0" ]; then + echo "Email address ${_email} is invalid." + exit 5 +fi + +echo "_email = ${_email}" + +## Send the report +echo 'Sending the report...' + +# Everything went smooth +exit 0 \ No newline at end of file