From syuu at FreeBSD.org Fri May 4 19:56:33 2012 From: syuu at FreeBSD.org (syuu@FreeBSD.org) Date: Fri May 4 19:57:03 2012 Subject: socsvn commit: r235332 - soc2012/syuu Message-ID: <20120504195632.9E076106567D@hub.freebsd.org> Author: syuu Date: Fri May 4 19:56:32 2012 New Revision: 235332 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=235332 Log: create dir for bhyve bios support project Added: soc2012/syuu/ From syuu at FreeBSD.org Fri May 4 19:56:54 2012 From: syuu at FreeBSD.org (syuu@FreeBSD.org) Date: Fri May 4 19:57:03 2012 Subject: socsvn commit: r235333 - soc2012/syuu/bhyve-bios Message-ID: <20120504195653.1EA011065670@hub.freebsd.org> Author: syuu Date: Fri May 4 19:56:52 2012 New Revision: 235333 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=235333 Log: initial import from bhyve branch. Added: soc2012/syuu/bhyve-bios/ (props changed) - copied from r235332, mirror/FreeBSD/projects/bhyve/ From vbotton at FreeBSD.org Tue May 8 15:52:27 2012 From: vbotton at FreeBSD.org (vbotton@FreeBSD.org) Date: Tue May 8 15:52:56 2012 Subject: socsvn commit: r235441 - in soc2012/vbotton: . ntfs Message-ID: <20120508155226.6CBF31065802@hub.freebsd.org> Author: vbotton Date: Tue May 8 15:52:25 2012 New Revision: 235441 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=235441 Log: add vbotton subdirectory Added: soc2012/vbotton/ soc2012/vbotton/ntfs/ From jhagewood at FreeBSD.org Tue May 8 19:20:28 2012 From: jhagewood at FreeBSD.org (jhagewood@FreeBSD.org) Date: Tue May 8 19:21:06 2012 Subject: socsvn commit: r235445 - soc2012/jhagewood Message-ID: <20120508192027.5ABE0106564A@hub.freebsd.org> Author: jhagewood Date: Tue May 8 19:20:26 2012 New Revision: 235445 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=235445 Log: Added: soc2012/jhagewood/ From gpf at FreeBSD.org Thu May 10 12:06:59 2012 From: gpf at FreeBSD.org (gpf@FreeBSD.org) Date: Thu May 10 12:07:15 2012 Subject: socsvn commit: r235531 - soc2012/gpf Message-ID: <20120510120658.36C75106566B@hub.freebsd.org> Author: gpf Date: Thu May 10 12:06:57 2012 New Revision: 235531 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=235531 Log: dir for my gsoc work Added: soc2012/gpf/ From gpf at FreeBSD.org Thu May 10 12:08:39 2012 From: gpf at FreeBSD.org (gpf@FreeBSD.org) Date: Thu May 10 12:08:44 2012 Subject: socsvn commit: r235532 - soc2012/gpf/head Message-ID: <20120510120838.24A0A1065670@hub.freebsd.org> Author: gpf Date: Thu May 10 12:08:37 2012 New Revision: 235532 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=235532 Log: dir for branch of head Added: soc2012/gpf/head/ From gpf at FreeBSD.org Thu May 10 12:14:30 2012 From: gpf at FreeBSD.org (gpf@FreeBSD.org) Date: Thu May 10 12:14:36 2012 Subject: socsvn commit: r235533 - soc2012/gpf/pefs_head Message-ID: <20120510121429.656E7106564A@hub.freebsd.org> Author: gpf Date: Thu May 10 12:14:29 2012 New Revision: 235533 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=235533 Log: dir for project head branch Added: soc2012/gpf/pefs_head/ From gpf at FreeBSD.org Thu May 10 12:15:20 2012 From: gpf at FreeBSD.org (gpf@FreeBSD.org) Date: Thu May 10 12:15:25 2012 Subject: socsvn commit: r235534 - soc2012/gpf/pefs_head/head Message-ID: <20120510121519.3DA4D106566B@hub.freebsd.org> Author: gpf Date: Thu May 10 12:15:18 2012 New Revision: 235534 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=235534 Log: branch head Added: soc2012/gpf/pefs_head/head/ (props changed) - copied from r235533, mirror/FreeBSD/head/ From gpf at FreeBSD.org Thu May 10 12:57:31 2012 From: gpf at FreeBSD.org (gpf@FreeBSD.org) Date: Thu May 10 12:57:37 2012 Subject: socsvn commit: r235535 - soc2012/gpf/head Message-ID: <20120510125730.A9CAB1065674@hub.freebsd.org> Author: gpf Date: Thu May 10 12:57:30 2012 New Revision: 235535 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=235535 Log: remove obsolete dir Deleted: soc2012/gpf/head/ From tzabal at FreeBSD.org Thu May 10 15:44:50 2012 From: tzabal at FreeBSD.org (tzabal@FreeBSD.org) Date: Thu May 10 15:44:56 2012 Subject: socsvn commit: r235544 - soc2012/tzabal Message-ID: <20120510154449.7A9D3106564A@hub.freebsd.org> Author: tzabal Date: Thu May 10 15:44:48 2012 New Revision: 235544 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=235544 Log: Added: soc2012/tzabal/ From aleek at FreeBSD.org Fri May 11 16:20:45 2012 From: aleek at FreeBSD.org (aleek@FreeBSD.org) Date: Fri May 11 16:20:51 2012 Subject: socsvn commit: r235589 - soc2012/aleek Message-ID: <20120511162044.197AD106566C@hub.freebsd.org> Author: aleek Date: Fri May 11 16:20:43 2012 New Revision: 235589 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=235589 Log: adding soc2012/aleek directory Added: soc2012/aleek/ From aleek at FreeBSD.org Fri May 11 16:22:19 2012 From: aleek at FreeBSD.org (aleek@FreeBSD.org) Date: Fri May 11 16:22:25 2012 Subject: socsvn commit: r235590 - soc2012/aleek/beaglexm-armv6 Message-ID: <20120511162218.1E9FF1065670@hub.freebsd.org> Author: aleek Date: Fri May 11 16:22:17 2012 New Revision: 235590 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=235590 Log: Copying projects/armv6 branch to soc2012/aleek repo Added: soc2012/aleek/beaglexm-armv6/ (props changed) - copied from r235589, mirror/FreeBSD/projects/armv6/ From gavin at FreeBSD.org Sat May 12 20:15:35 2012 From: gavin at FreeBSD.org (gavin@FreeBSD.org) Date: Sat May 12 20:15:41 2012 Subject: socsvn commit: r235674 - svnadmin/tools Message-ID: <20120512201532.E3882106566C@hub.freebsd.org> Author: gavin Date: Sat May 12 20:15:32 2012 New Revision: 235674 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=235674 Log: Use the student's username in the example branch copy Modified: svnadmin/tools/add-user.sh Modified: svnadmin/tools/add-user.sh ============================================================================== --- svnadmin/tools/add-user.sh Sat May 12 19:59:37 2012 (r235673) +++ svnadmin/tools/add-user.sh Sat May 12 20:15:32 2012 (r235674) @@ -80,7 +80,7 @@ directory. For example: svn cp https://socsvn.freebsd.org/socsvn/mirror/FreeBSD/head \ - https://socsvn.freebsd.org/socsvn/soc2012/brooks/myproject-head + https://socsvn.freebsd.org/socsvn/soc2012/${name}/myproject-head You would then use subversion's merge operation to keep your branch up to date. From gpf at FreeBSD.org Sun May 13 14:23:50 2012 From: gpf at FreeBSD.org (gpf@FreeBSD.org) Date: Sun May 13 14:23:56 2012 Subject: socsvn commit: r235718 - soc2012/gpf Message-ID: <20120513142348.0AAB61065670@hub.freebsd.org> Author: gpf Date: Sun May 13 14:23:46 2012 New Revision: 235718 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=235718 Log: adding milestones file Added: soc2012/gpf/milestones Added: soc2012/gpf/milestones ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/gpf/milestones Sun May 13 14:23:46 2012 (r235718) @@ -0,0 +1,9 @@ +- Extend sbin/pefs so that it creates checksum file with dummy tags/tweaks which is then read during pefs_mount. pf_nodes are properly marked upon creation. + +- Extend sbin/pefs so that it accepts secret key from userland and that proper tags/tweaks are created for checksum file. At this point test with one HMAC algorithm. + +- Integrity checks in Vnode Operations. + +- Implement authentication checks for checksum files during mount. + +- Extension of securelevel and perhaps rtld. From gpf at FreeBSD.org Sun May 13 14:39:44 2012 From: gpf at FreeBSD.org (gpf@FreeBSD.org) Date: Sun May 13 14:39:51 2012 Subject: socsvn commit: r235719 - in soc2012/gpf/pefs_kmod: . lib lib/libpam lib/libpam/modules lib/libpam/modules/pam_pefs sbin sbin/pefs sys sys/crypto sys/crypto/hmac sys/crypto/rijndael sys/crypto/sha2 ... Message-ID: <20120513143941.B5913106566B@hub.freebsd.org> Author: gpf Date: Sun May 13 14:39:41 2012 New Revision: 235719 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=235719 Log: merging pefs.kmod to my branch Added: soc2012/gpf/pefs_kmod/ soc2012/gpf/pefs_kmod/Makefile soc2012/gpf/pefs_kmod/README soc2012/gpf/pefs_kmod/lib/ soc2012/gpf/pefs_kmod/lib/libpam/ soc2012/gpf/pefs_kmod/lib/libpam/modules/ soc2012/gpf/pefs_kmod/lib/libpam/modules/Makefile.inc soc2012/gpf/pefs_kmod/lib/libpam/modules/pam_pefs/ soc2012/gpf/pefs_kmod/lib/libpam/modules/pam_pefs/Makefile soc2012/gpf/pefs_kmod/lib/libpam/modules/pam_pefs/pam_pefs.8 soc2012/gpf/pefs_kmod/lib/libpam/modules/pam_pefs/pam_pefs.c soc2012/gpf/pefs_kmod/sbin/ soc2012/gpf/pefs_kmod/sbin/pefs/ soc2012/gpf/pefs_kmod/sbin/pefs/Makefile soc2012/gpf/pefs_kmod/sbin/pefs/pefs.8 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_key.c soc2012/gpf/pefs_kmod/sbin/pefs/pefs_keychain.c soc2012/gpf/pefs_kmod/sbin/pefs/pefs_keychain.h soc2012/gpf/pefs_kmod/sbin/pefs/pefs_subr.c soc2012/gpf/pefs_kmod/sys/ soc2012/gpf/pefs_kmod/sys/crypto/ soc2012/gpf/pefs_kmod/sys/crypto/hmac/ soc2012/gpf/pefs_kmod/sys/crypto/hmac/hmac_sha512.c soc2012/gpf/pefs_kmod/sys/crypto/hmac/hmac_sha512.h soc2012/gpf/pefs_kmod/sys/crypto/rijndael/ soc2012/gpf/pefs_kmod/sys/crypto/rijndael/rijndael-alg-fst.c soc2012/gpf/pefs_kmod/sys/crypto/rijndael/rijndael-api-fst.c soc2012/gpf/pefs_kmod/sys/crypto/rijndael/rijndael-api-fst.h soc2012/gpf/pefs_kmod/sys/crypto/rijndael/rijndael-api.c soc2012/gpf/pefs_kmod/sys/crypto/rijndael/rijndael.h soc2012/gpf/pefs_kmod/sys/crypto/rijndael/rijndael_local.h soc2012/gpf/pefs_kmod/sys/crypto/sha2/ soc2012/gpf/pefs_kmod/sys/crypto/sha2/sha2.c soc2012/gpf/pefs_kmod/sys/crypto/sha2/sha2.h soc2012/gpf/pefs_kmod/sys/fs/ soc2012/gpf/pefs_kmod/sys/fs/pefs/ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_aesni.c soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_aesni.h soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_crypto.c soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_crypto.h soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_dircache.c soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_dircache.h soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_subr.c soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vfsops.c soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_xbase64.c soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_xts.c soc2012/gpf/pefs_kmod/sys/fs/pefs/vmac.c soc2012/gpf/pefs_kmod/sys/fs/pefs/vmac.h soc2012/gpf/pefs_kmod/sys/geom/ soc2012/gpf/pefs_kmod/sys/geom/eli/ soc2012/gpf/pefs_kmod/sys/geom/eli/pkcs5v2.c soc2012/gpf/pefs_kmod/sys/geom/eli/pkcs5v2.h soc2012/gpf/pefs_kmod/sys/modules/ soc2012/gpf/pefs_kmod/sys/modules/pefs/ soc2012/gpf/pefs_kmod/sys/modules/pefs/Makefile Added: soc2012/gpf/pefs_kmod/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/gpf/pefs_kmod/Makefile Sun May 13 14:39:41 2012 (r235719) @@ -0,0 +1,7 @@ +SUBDIR= sys/modules/pefs \ + sbin/pefs + +# Should be built from sources tree +SUBDIR+= lib/libpam/modules/pam_pefs + +.include Added: soc2012/gpf/pefs_kmod/README ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/gpf/pefs_kmod/README Sun May 13 14:39:41 2012 (r235719) @@ -0,0 +1,32 @@ +PEFS is a kernel level stacked cryptographic filesystem for FreeBSD. + +The following is a list of its most important features: + +* Kernel level file system, no user level daemons needed. Transparently runs + on top of existing file systems. + +* Random per file tweak value used for encryption, which guaranties different + cipher texts for the same encrypted files. + +* Saves metadata only in encrypted file name, but not in file itself. + +* Supports arbitrary number of keys per file system, default directory key, + mixing files encrypted with different keys in same directory. + +* Allows defining key chains, can be used to add/delete several keys by + specifying only master key. + +* Uses modern cryptographic algorithms: AES and Camellia in XTS mode, + PKCS#5v2 and HKDF for key generation. + +FreeBSD wiki page: http://wiki.freebsd.org/PEFS +blog: http://glebkurtsou.blogspot.com/search/label/pefs + + +Installation instructions: + +# git clone git://github.com/glk/pefs.git pefs +# cd pefs +# make obj all +# make install +# make clean Added: soc2012/gpf/pefs_kmod/lib/libpam/modules/Makefile.inc ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/gpf/pefs_kmod/lib/libpam/modules/Makefile.inc Sun May 13 14:39:41 2012 (r235719) @@ -0,0 +1,4 @@ +# Include Makefiles from $SRCDIR + +.include + Added: soc2012/gpf/pefs_kmod/lib/libpam/modules/pam_pefs/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/gpf/pefs_kmod/lib/libpam/modules/pam_pefs/Makefile Sun May 13 14:39:41 2012 (r235719) @@ -0,0 +1,24 @@ +# PAM module for pefs +# $FreeBSD$ + +SYS= ${.CURDIR}/../../../../sys +PEFSDIR= ${.CURDIR}/../../../../sbin/pefs + +LIB= pam_pefs +MAN= pam_pefs.8 +SRCS= pam_pefs.c +SRCS+= pefs_key.c pefs_keychain.c pefs_subr.c +SRCS+= hmac_sha512.c pkcs5v2.c sha2.c +SRCS+= rijndael-api.c rijndael-api-fst.c rijndael-alg-fst.c + +CFLAGS+= -I${PEFSDIR} +CFLAGS+= -I${SYS} + +DPADD= ${LIBUTIL} +LDADD= -lutil + +.include + +.PATH: ${PEFSDIR} +.PATH: ${SYS}/geom/eli +.PATH: ${SYS}/crypto/hmac ${SYS}/crypto/sha2 ${SYS}/crypto/rijndael Added: soc2012/gpf/pefs_kmod/lib/libpam/modules/pam_pefs/pam_pefs.8 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/gpf/pefs_kmod/lib/libpam/modules/pam_pefs/pam_pefs.8 Sun May 13 14:39:41 2012 (r235719) @@ -0,0 +1,147 @@ +.\" Copyright (c) 2001 Mark R V Murray +.\" Copyright (c) 2001-2003 Networks Associates Technology, Inc. +.\" Copyright (c) 2009 Gleb Kurtsou +.\" All rights reserved. +.\" +.\" This software was developed for the FreeBSD Project by ThinkSec AS and +.\" NAI Labs, the Security Research Division of Network Associates, Inc. +.\" under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the +.\" DARPA CHATS research program. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. The name of the author may not be used to endorse or promote +.\" products derived from this software without specific prior written +.\" permission. +.\" +.\" 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$ +.\" +.Dd December 1, 2009 +.Dt PAM_PEFS 8 +.Os +.Sh NAME +.Nm pam_pefs +.Nd pefs PAM module +.Sh SYNOPSIS +.Op Ar service-name +.Ar module-type +.Ar control-flag +.Pa pam_pefs +.Op Ar options +.Sh DESCRIPTION +The +pefs +authentication service module for PAM, +.Nm +provides functionality for two PAM categories: +authentication +and session management. +In terms of the +.Ar module-type +parameter, they are the +.Dq Li auth +and +.Dq Li session +features. +.Pp +Module expects pefs file system to be mounted on user home directory +and fails otherwise. +.Ss Pefs Authentication Module +The +pefs +authentication component +provides a function to verify the identity of a user +.Pq Fn pam_sm_authenticate , +by prompting the user for a passphrase and verifying that it exists in +pefs key chain database. +.Pp +The following options may be passed to the authentication module: +.Bl -tag -width ".Cm use_first_pass" +.It Cm use_first_pass +If the authentication module +is not the first in the stack, +and a previous module +obtained the user's password, +that password is used +to authenticate the user. +If this fails, +the authentication module returns failure +without prompting the user for a password. +This option has no effect +if the authentication module +is the first in the stack, +or if no previous modules +obtained the user's password. +.It Cm try_first_pass +This option is similar to the +.Cm use_first_pass +option, +except that if the previously obtained password fails, +the user is prompted for another password. +.It Cm ignore_missing +Accept any passphrase provided by the user. +This option is used not to authenticate user, but to preserve keys that +should be added to pefs file system by session management module. +Option is incompatible with +.Cm try_first_pass +option and should be used with +.Cm use_first_pass +option. +.It Cm delkeys +Remove keys at the end of last session. +Module tracks the number of concurrent sessions, removing all keys from +file system when session count reaches zero. +.El +.Ss Pefs Session Management Module +The +pefs +session management component +provides functions to initiate +.Pq Fn pam_sm_open_session +and terminate +.Pq Fn pam_sm_close_session +sessions. +The +.Fn pam_sm_open_session +function adds key or key chain decrypted during the authentication phase +to the pefs file system mounted on user home directory. +.Sh FILES +.Bl -tag -width ".Pa $HOME/.pefs.conf" -compact +.It Pa $HOME/.pefs.conf +pefs configuration file +.It Pa $HOME/.pefs.db +pefs key chain database file +.El +.Sh SEE ALSO +.Xr pam.conf 5 , +.Xr pam 8 +.Xr pefs 8 +.Sh AUTHORS +The +.Nm +module was written by +.An -nosplit +.An "Gleb Kurtsou" Aq gk@FreeBSD.org . +.Sh BUGS +.Fn pam_sm_close_session +function +doesn't delete keys added during by +.Fn pam_sm_open_session . Added: soc2012/gpf/pefs_kmod/lib/libpam/modules/pam_pefs/pam_pefs.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/gpf/pefs_kmod/lib/libpam/modules/pam_pefs/pam_pefs.c Sun May 13 14:39:41 2012 (r235719) @@ -0,0 +1,526 @@ +/*- + * Copyright (c) 2003 Networks Associates Technology, Inc. + * Copyright (c) 2009 Gleb Kurtsou + * All rights reserved. + * + * This software was developed for the FreeBSD Project by ThinkSec AS and + * NAI Labs, the Security Research Division of Network Associates, Inc. + * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the + * DARPA CHATS research program. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * 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 +#include +#include + +#define PAM_SM_AUTH +#define PAM_SM_SESSION + +#include +#include +#include +#include + +#include + +#include "pefs_ctl.h" +#include "pefs_keychain.h" + +#define PEFS_OPT_IGNORE_MISSING "ignore_missing" +#define PEFS_OPT_DELKEYS "delkeys" + +#define PAM_PEFS_KEYS "pam_pefs_keys" + +#define PEFS_SESSION_DIR "/var/run/pefs" +#define PEFS_SESSION_DIR_MODE 0700 +#define PEFS_SESSION_FILE_MODE 0600 +#define PEFS_SESSION_FILE_FLAGS \ + (O_RDWR | O_NONBLOCK | O_CREAT | O_EXLOCK) + +static int pam_pefs_debug; + +void +pefs_warn(const char *fmt, ...) +{ + static const char *label = "pam_pefs: "; + char buf[BUFSIZ]; + va_list ap; + + if (pam_pefs_debug == 0) + return; + + va_start(ap, fmt); + if (strlen(fmt) + sizeof(label) >= sizeof(buf)) { + vsyslog(LOG_DEBUG, fmt, ap); + } else { + strlcpy(buf, label, sizeof(buf)); + strlcat(buf, fmt, sizeof(buf)); + vsyslog(LOG_DEBUG, buf, ap); + } + va_end(ap); +} + +static int +flopen_retry(const char *filename) +{ + int fd, try; + + for (try = 1; try <= 1024; try *= 2) { + fd = flopen(filename, PEFS_SESSION_FILE_FLAGS, + PEFS_SESSION_FILE_MODE); + if (fd != -1) + return (fd); + else if (errno != EWOULDBLOCK) + return (-1); + // Exponential back-off up to 1 second + usleep(try * 1000000 / 1024); + } + errno = ETIMEDOUT; + return (-1); +} + +static int +pefs_session_count_incr(const char *user, bool incr) +{ + struct stat sb; + struct timespec tp_uptime, tp_now; + ssize_t offset; + int fd, total = 0; + char filename[MAXPATHLEN], buf[16]; + const char *errstr; + + snprintf(filename, sizeof(filename), "%s/%s", PEFS_SESSION_DIR, user); + + if (lstat(PEFS_SESSION_DIR, &sb) == -1) { + if (errno != ENOENT) { + pefs_warn("unable to access session directory %s: %s", + PEFS_SESSION_DIR, strerror(errno)); + return (-1); + } + if (mkdir(PEFS_SESSION_DIR, PEFS_SESSION_DIR_MODE) == -1) { + pefs_warn("unable to create session directory %s: %s", + PEFS_SESSION_DIR, strerror(errno)); + return (-1); + } + } else if (!S_ISDIR(sb.st_mode)) { + pefs_warn("%s is not a directory", PEFS_SESSION_DIR); + return (-1); + } + + if ((fd = flopen_retry(filename)) == -1) { + pefs_warn("unable to create session counter file %s: %s", + filename, strerror(errno)); + return (-1); + } + + if ((offset = pread(fd, buf, sizeof(buf) - 1, 0)) == -1) { + pefs_warn("unable to read from the session counter file %s: %s", + filename, strerror(errno)); + close(fd); + return (-1); + } + buf[offset] = '\0'; + if (offset != 0) { + total = strtonum(buf, 0, INT_MAX, &errstr); + if (errstr != NULL) + pefs_warn("corrupted session counter file: %s: %s", + filename, errstr); + } + + /* + * Determine if this is the first increment of the session file. + * + * It is considered the first increment if the session file has not + * been modified since the last boot time. + */ + if (incr && total > 0) { + if (fstat(fd, &sb) == -1) { + pefs_warn("unable to access session counter file %s: %s", + filename, strerror(errno)); + close(fd); + return (-1); + } + /* + * Check is messy and will fail if wall clock isn't monotonical + * (e.g. because of ntp, DST, leap seconds) + */ + clock_gettime(CLOCK_REALTIME_FAST, &tp_now); + clock_gettime(CLOCK_UPTIME_FAST, &tp_uptime); + if (sb.st_mtime < tp_now.tv_sec - tp_uptime.tv_sec) { + pefs_warn("stale session counter file: %s", + filename); + total = 0; + } + } + + lseek(fd, 0L, SEEK_SET); + ftruncate(fd, 0L); + + total += incr ? 1 : -1; + if (total < 0) { + pefs_warn("corrupted session counter file: %s", + filename); + total = 0; + } else + pefs_warn("%s: session count %d", user, total); + + buf[0] = '\0'; + snprintf(buf, sizeof(buf), "%d", total); + pwrite(fd, buf, strlen(buf), 0); + close(fd); + + return (total); +} + +static int +pam_pefs_checkfs(const char *homedir) +{ + char fsroot[MAXPATHLEN]; + int error; + + error = pefs_getfsroot(homedir, 0, fsroot, sizeof(fsroot)); + if (error != 0) { + pefs_warn("file system is not mounted: %s", homedir); + return (PAM_USER_UNKNOWN); + } if (strcmp(fsroot, homedir) != 0) { + pefs_warn("file system is not mounted on home dir: %s", fsroot); + return (PAM_USER_UNKNOWN); + } + + return (PAM_SUCCESS); +} + +/* + * Perform key lookup in ~/.pefs; + * returns PAM_AUTH_ERR if and only if key wasn't found in database. + */ +static int +pam_pefs_getkeys(struct pefs_keychain_head *kch, + const char *homedir, const char *passphrase, int chainflags) +{ + struct pefs_xkey k; + struct pefs_keyparam kp; + int error; + + pefs_keyparam_create(&kp); + pefs_keyparam_init(&kp, homedir); + + error = pefs_key_generate(&k, passphrase, &kp); + if (error != 0) + return (PAM_SERVICE_ERR); + + error = pefs_keychain_get(kch, homedir, chainflags, &k); + bzero(&k, sizeof(k)); + if (error != 0) + return (error == PEFS_ERR_NOENT ? PAM_AUTH_ERR : + PAM_SERVICE_ERR); + + return (PAM_SUCCESS); +} + +static int +pam_pefs_addkeys(const char *homedir, struct pefs_keychain_head *kch) +{ + struct pefs_keychain *kc; + int fd; + + fd = open(homedir, O_RDONLY); + if (fd == -1) { + pefs_warn("cannot open homedir %s: %s", + homedir, strerror(errno)); + return (PAM_USER_UNKNOWN); + } + + TAILQ_FOREACH(kc, kch, kc_entry) { + if (ioctl(fd, PEFS_ADDKEY, &kc->kc_key) == -1) { + pefs_warn("cannot add key: %s: %s", + homedir, strerror(errno)); + break; + } + } + close(fd); + + return (PAM_SUCCESS); +} + +static int +pam_pefs_delkeys(const char *homedir) +{ + struct pefs_xkey k; + int fd; + + fd = open(homedir, O_RDONLY); + if (fd == -1) { + pefs_warn("cannot open homedir %s: %s", + homedir, strerror(errno)); + return (PAM_USER_UNKNOWN); + } + + bzero(&k, sizeof(k)); + while (1) { + if (ioctl(fd, PEFS_GETKEY, &k) == -1) + break; + + if (ioctl(fd, PEFS_DELKEY, &k) == -1) { + pefs_warn("cannot del key: %s: %s", + homedir, strerror(errno)); + k.pxk_index++; + } + } + close(fd); + + return (PAM_SUCCESS); +} + +static void +pam_pefs_freekeys(pam_handle_t *pamh __unused, void *data, int pam_err __unused) +{ + struct pefs_keychain_head *kch = data; + + pefs_keychain_free(kch); + free(kch); +} + +PAM_EXTERN int +pam_sm_authenticate(pam_handle_t *pamh, int flags __unused, + int argc __unused, const char *argv[] __unused) +{ + struct pefs_keychain_head *kch; + struct passwd *pwd; + const char *passphrase, *user; + const void *item; + int pam_err, canretry, chainflags; + + /* Get user name and home directory */ + pam_err = pam_get_user(pamh, &user, NULL); + if (pam_err != PAM_SUCCESS) + return (pam_err); + pwd = getpwnam(user); + if (pwd == NULL) + return (PAM_USER_UNKNOWN); + if (pwd->pw_dir == NULL) + return (PAM_AUTH_ERR); + + pam_pefs_debug = (openpam_get_option(pamh, PAM_OPT_DEBUG) != NULL); + + chainflags = PEFS_KEYCHAIN_USE; + if (openpam_get_option(pamh, PEFS_OPT_IGNORE_MISSING) != NULL) + chainflags = PEFS_KEYCHAIN_IGNORE_MISSING; + + canretry = (pam_get_item(pamh, PAM_AUTHTOK, &item) == PAM_SUCCESS && + item != NULL && chainflags != PEFS_KEYCHAIN_IGNORE_MISSING); + + pam_err = openpam_borrow_cred(pamh, pwd); + if (pam_err != PAM_SUCCESS) + return (pam_err); + + /* + * Check to see if the passwd db is available, avoids asking for + * password if we cannot even validate it. + */ + pam_err = pam_pefs_checkfs(pwd->pw_dir); + openpam_restore_cred(pamh); + if (pam_err != PAM_SUCCESS) + return (pam_err); + + +retry: + /* Get passphrase */ + pam_err = pam_get_authtok(pamh, PAM_AUTHTOK, + &passphrase, NULL); + if (pam_err != PAM_SUCCESS) + return (pam_err); + + if (*passphrase != '\0') { + kch = calloc(1, sizeof(*kch)); + if (kch == NULL) + return (PAM_SYSTEM_ERR); + + /* Switch to user credentials */ + pam_err = openpam_borrow_cred(pamh, pwd); + if (pam_err != PAM_SUCCESS) + return (pam_err); + + pam_err = pam_pefs_getkeys(kch, pwd->pw_dir, passphrase, + chainflags); + if (pam_err == PAM_SUCCESS) + pam_set_data(pamh, PAM_PEFS_KEYS, kch, + pam_pefs_freekeys); + else + free(kch); + + /* Switch back to arbitrator credentials */ + openpam_restore_cred(pamh); + } else + pam_err = PAM_AUTH_ERR; + + /* + * If we tried an old token and didn't get anything, and + * try_first_pass was specified, try again after prompting the + * user for a new passphrase. + */ + if (pam_err == PAM_AUTH_ERR && canretry != 0 && + openpam_get_option(pamh, "try_first_pass") != NULL) { + pam_set_item(pamh, PAM_AUTHTOK, NULL); + canretry = 0; + goto retry; + } + + return (pam_err); +} + +PAM_EXTERN int +pam_sm_setcred(pam_handle_t *pamh __unused, int flags __unused, + int argc __unused, const char *argv[] __unused) +{ + + return (PAM_SUCCESS); +} + +PAM_EXTERN int +pam_sm_open_session(pam_handle_t *pamh, int flags __unused, + int argc __unused, const char *argv[] __unused) +{ + struct pefs_keychain_head *kch = NULL; + struct passwd *pwd; + const char *user; + int pam_err, opt_delkeys; + + pam_err = pam_get_user(pamh, &user, NULL); + if (pam_err != PAM_SUCCESS) + return (pam_err); + pwd = getpwnam(user); + if (pwd == NULL) + return (PAM_USER_UNKNOWN); + if (pwd->pw_dir == NULL) + return (PAM_SYSTEM_ERR); + + pam_pefs_debug = (openpam_get_option(pamh, PAM_OPT_DEBUG) != NULL); + opt_delkeys = (openpam_get_option(pamh, PEFS_OPT_DELKEYS) != NULL); + + pam_err = pam_get_data(pamh, PAM_PEFS_KEYS, + (const void **)(void *)&kch); + if (pam_err != PAM_SUCCESS || kch == NULL || TAILQ_EMPTY(kch)) { + pam_err = PAM_SUCCESS; + opt_delkeys = 0; + goto out; + } + + /* Switch to user credentials */ + pam_err = openpam_borrow_cred(pamh, pwd); + if (pam_err != PAM_SUCCESS) + goto out; + + pam_err = pam_pefs_checkfs(pwd->pw_dir); + if (pam_err != PAM_SUCCESS) { + openpam_restore_cred(pamh); + pam_err = PAM_SUCCESS; + opt_delkeys = 0; + goto out; + } + + pam_err = pam_pefs_addkeys(pwd->pw_dir, kch); + + /* Switch back to arbitrator credentials */ + openpam_restore_cred(pamh); + +out: + /* Remove keys from memory */ + if (kch != NULL) + pefs_keychain_free(kch); + + /* Increment login count */ + if (pam_err == PAM_SUCCESS && opt_delkeys) + pefs_session_count_incr(user, true); + + return (pam_err); +} + +PAM_EXTERN int +pam_sm_close_session(pam_handle_t *pamh, int flags __unused, + int argc __unused, const char *argv[] __unused) +{ + struct passwd *pwd; + const char *user; + int pam_err, opt_delkeys; + + pam_err = pam_get_user(pamh, &user, NULL); + if (pam_err != PAM_SUCCESS) + return (pam_err); + + pwd = getpwnam(user); + if (pwd == NULL) + return (PAM_USER_UNKNOWN); + if (pwd->pw_dir == NULL) + return (PAM_SYSTEM_ERR); + + pam_pefs_debug = (openpam_get_option(pamh, PAM_OPT_DEBUG) != NULL); + opt_delkeys = (openpam_get_option(pamh, PEFS_OPT_DELKEYS) != NULL); + if (!opt_delkeys) + return PAM_SUCCESS; + + pam_err = openpam_borrow_cred(pamh, pwd); + if (pam_err != PAM_SUCCESS) + return (pam_err); + pam_err = pam_pefs_checkfs(pwd->pw_dir); + openpam_restore_cred(pamh); + if (pam_err != PAM_SUCCESS) + return (PAM_SUCCESS); + + /* Decrease login count and remove keys if at zero */ + pam_err = PAM_SUCCESS; + if (pefs_session_count_incr(user, false) == 0) { + pam_err = openpam_borrow_cred(pamh, pwd); + if (pam_err != PAM_SUCCESS) + return (pam_err); + pam_err = pam_pefs_delkeys(pwd->pw_dir); + openpam_restore_cred(pamh); + } + + return (pam_err); +} + +PAM_MODULE_ENTRY("pam_pefs"); Added: soc2012/gpf/pefs_kmod/sbin/pefs/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/gpf/pefs_kmod/sbin/pefs/Makefile Sun May 13 14:39:41 2012 (r235719) @@ -0,0 +1,24 @@ +# $FreeBSD$ + +SYS= ${.CURDIR}/../../sys +.PATH: ${SYS}/geom/eli +.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+= hmac_sha512.c sha2.c +SRCS+= rijndael-api.c rijndael-api-fst.c rijndael-alg-fst.c +SRCS+= pkcs5v2.c + +MAN= pefs.8 + +CFLAGS+=-I${SYS} +WARNS?= 6 +DEBUG_FLAGS+= -g + +DPADD= ${LIBUTIL} +LDADD= -lutil + +BINDIR?= /sbin + +.include Added: soc2012/gpf/pefs_kmod/sbin/pefs/pefs.8 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs.8 Sun May 13 14:39:41 2012 (r235719) @@ -0,0 +1,441 @@ +.\" Copyright (c) 2005-2008 Pawel Jakub Dawidek +.\" Copyright (c) 2009 Gleb Kurtsou +.\" 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 AUTHORS 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 AUTHORS 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$ +.\" +.Dd December 1, 2009 +.Dt PEFS 8 +.Os +.Sh NAME +.Nm pefs +.Nd configure pefs file systems +.Sh SYNOPSIS +.Nm +.Cm mount +.Op Fl o Ar options +.Op Ar from filesystem +.Nm +.Cm unmount +.Op Fl fv +.Ar filesystem +.Pp +.Nm +.Cm addkey +.Op Fl cCpv +.Op Fl a Ar alg +.Op Fl i Ar iterations +.Op Fl k Ar keyfile +.Ar filesystem +.Nm +.Cm delkey +.Op Fl cCpv +.Op Fl i Ar iterations +.Op Fl k Ar keyfile +.Ar filesystem +.Nm +.Cm flushkeys +.Ar filesystem +.Nm +.Cm getkey +.Op Fl t +.Ar file +.Nm +.Cm setkey +.Op Fl cCpvx +.Op Fl a Ar alg +.Op Fl i Ar iterations +.Op Fl k Ar keyfile +.Ar directory +.Nm +.Cm showkeys +.Op Fl t +.Ar filesystem +.Pp +.Nm +.Cm addchain +.Op Fl fpPvZ +.Op Fl a Ar alg +.Op Fl i Ar iterations +.Op Fl k Ar keyfile +.Op Fl A Ar alg +.Op Fl I Ar iterations +.Op Fl K Ar keyfile +.Ar filesystem +.Nm +.Cm delchain +.Op Fl fFpv +.Op Fl i Ar iterations +.Op Fl k Ar keyfile +.Ar filesystem +.Nm +.Cm randomchain +.Op Fl fv +.Op Fl i Ar iterations +.Op Fl k Ar keyfile +.Ar filesystem +.Nm +.Cm showchains +.Op Fl fp +.Op Fl i Ar iterations +.Op Fl k Ar keyfile +.Ar filesystem +.Pp +.Nm +.Cm showalgs +.Sh DESCRIPTION +The +.Nm +utility is the user interface for configuring stacked cryptographic file system. +.Pp +The following is a list of the most important file system features: +.Bl -bullet -offset indent -compact +.It +Kernel level file system, no user level daemons needed. +Transparently runs on top of existing file systems. +.It +Random per file tweak value used for encryption, which guaranties different +cipher texts for the same encrypted files. +.It +Saves metadata only in encrypted file name, but not in file itself. +.It +Supports arbitrary number of keys per file system, default directory key, +mixing files encrypted with different keys in same directory. +.It +Allows defining key chains, can be used to add/delete several keys by +specifying only master key. +.It +Uses modern cryptographic algorithms: AES and Camellia in XTS mode, +PKCS#5v2 and HKDF for key generation. +.El +.Pp +First argument of +.Nm +utility indicates the command to be performed (see the +.Sx COMMAND OPTIONS +section for information on options): +.Bl -tag -width indent +.It Cm mount +Mount file system. +Encryption keys should be specified separately after mounting the file system. +If no agrumnt specified prints all mounted +.Nm +file systems. +See +.Xr mount 8 +for more information. +.It Cm unmount Ar filesystem +Unmount +.Ar filesystem . +.Fl f +and +.Fl v +options can be specified to force unmount or enable verbose mode respectively. +See +.Xr umount 8 +for more information. +.It Cm addkey Ar filesystem +Add key to the +.Ar filesystem +.It Cm delkey Ar filesystem +Delete key from +.Ar filesystem . +Command doesn't accept +.Fl a Ar alg +argument because the key fingerprint generated from the key doesn't depend on +encryption algorithm. +.It Cm getkey Ar file +Print fingerprint of the key used by +.Ar file . +.It Cm flushkeys Ar filesystem +Delete all keys from +.Ar filesystem . +After the command all opened files would become unavailable. +.It Cm setkey Ar directory +Change default key for the +.Ar directory . +Default key is used as a new key for files and directories created in the +.Ar directory . +Technically just a rename takes place on underlaying file system. +Keys for entries in the +.Ar directory +are not changed and no data is re-encrypted with new key. +.Fl x +option can be used to add a new key to file system if it isn't found. +.It Cm showkeys Ar filesystem +Print fingerprints if all active keys. +.It Cm addchain Ar filesystem +Add a new key chain element. +Element consists of parent and child keys. +Parent key is defined by +.Fl a , Fl i +and +.Fl p +options and child key by equivalent +.Fl A , Fl I +and +.Fl P +options. +Element consisting only of a parent key can be constructed by specifying +.Fl Z +option. +.Fl f +option disables file system type checks making manipulation on key chains +possible without mounting +.Nm +file system. +See +.Sx KEY CHAINS +section for more information. +.It Cm delchain Ar filesystem +Delete key chain element defined by parent key. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From vbotton at FreeBSD.org Mon May 14 14:04:03 2012 From: vbotton at FreeBSD.org (vbotton@FreeBSD.org) Date: Mon May 14 14:04:11 2012 Subject: socsvn commit: r235762 - soc2012/vbotton/ntfs_apple Message-ID: <20120514140402.9FDF01065670@hub.freebsd.org> Author: vbotton Date: Mon May 14 14:04:01 2012 New Revision: 235762 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=235762 Log: Some works towards portability, essentially endianness related functions Added: soc2012/vbotton/ntfs_apple/ soc2012/vbotton/ntfs_apple/ntfs.h soc2012/vbotton/ntfs_apple/ntfs_attr.c soc2012/vbotton/ntfs_apple/ntfs_attr.h soc2012/vbotton/ntfs_apple/ntfs_attr_list.c soc2012/vbotton/ntfs_apple/ntfs_attr_list.h soc2012/vbotton/ntfs_apple/ntfs_bitmap.c soc2012/vbotton/ntfs_apple/ntfs_bitmap.h soc2012/vbotton/ntfs_apple/ntfs_collate.c soc2012/vbotton/ntfs_apple/ntfs_collate.h soc2012/vbotton/ntfs_apple/ntfs_compress.c soc2012/vbotton/ntfs_apple/ntfs_compress.h soc2012/vbotton/ntfs_apple/ntfs_debug.c soc2012/vbotton/ntfs_apple/ntfs_debug.h soc2012/vbotton/ntfs_apple/ntfs_dir.c soc2012/vbotton/ntfs_apple/ntfs_dir.h soc2012/vbotton/ntfs_apple/ntfs_endian.h soc2012/vbotton/ntfs_apple/ntfs_hash.c soc2012/vbotton/ntfs_apple/ntfs_hash.h soc2012/vbotton/ntfs_apple/ntfs_index.c soc2012/vbotton/ntfs_apple/ntfs_index.h soc2012/vbotton/ntfs_apple/ntfs_inode.c soc2012/vbotton/ntfs_apple/ntfs_inode.h soc2012/vbotton/ntfs_apple/ntfs_layout.h soc2012/vbotton/ntfs_apple/ntfs_lcnalloc.c soc2012/vbotton/ntfs_apple/ntfs_lcnalloc.h soc2012/vbotton/ntfs_apple/ntfs_logfile.c soc2012/vbotton/ntfs_apple/ntfs_logfile.h soc2012/vbotton/ntfs_apple/ntfs_mft.c soc2012/vbotton/ntfs_apple/ntfs_mft.h soc2012/vbotton/ntfs_apple/ntfs_mst.c soc2012/vbotton/ntfs_apple/ntfs_mst.h soc2012/vbotton/ntfs_apple/ntfs_page.c soc2012/vbotton/ntfs_apple/ntfs_page.h soc2012/vbotton/ntfs_apple/ntfs_quota.c soc2012/vbotton/ntfs_apple/ntfs_quota.h soc2012/vbotton/ntfs_apple/ntfs_runlist.c soc2012/vbotton/ntfs_apple/ntfs_runlist.h soc2012/vbotton/ntfs_apple/ntfs_secure.c soc2012/vbotton/ntfs_apple/ntfs_secure.h soc2012/vbotton/ntfs_apple/ntfs_sfm.c soc2012/vbotton/ntfs_apple/ntfs_sfm.h soc2012/vbotton/ntfs_apple/ntfs_time.h soc2012/vbotton/ntfs_apple/ntfs_types.h soc2012/vbotton/ntfs_apple/ntfs_unistr.c soc2012/vbotton/ntfs_apple/ntfs_unistr.h soc2012/vbotton/ntfs_apple/ntfs_usnjrnl.c soc2012/vbotton/ntfs_apple/ntfs_usnjrnl.h soc2012/vbotton/ntfs_apple/ntfs_vfsops.c soc2012/vbotton/ntfs_apple/ntfs_vnops.c soc2012/vbotton/ntfs_apple/ntfs_vnops.h soc2012/vbotton/ntfs_apple/ntfs_volume.h Added: soc2012/vbotton/ntfs_apple/ntfs.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/vbotton/ntfs_apple/ntfs.h Mon May 14 14:04:01 2012 (r235762) @@ -0,0 +1,167 @@ +/* + * ntfs.h - Some generic defines for the NTFS kernel driver. + * + * Copyright (c) 2006-2008 Anton Altaparmakov. All Rights Reserved. + * Portions Copyright (c) 2006-2008 Apple Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of Apple Inc. ("Apple") 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 APPLE AND ITS 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 APPLE OR ITS 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. + * + * ALTERNATIVELY, provided that this notice and licensing terms are retained in + * full, this file may be redistributed and/or modified under the terms of the + * GNU General Public License (GPL) Version 2, in which case the provisions of + * that version of the GPL will apply to you instead of the license terms + * above. You can obtain a copy of the GPL Version 2 at + * http://developer.apple.com/opensource/licenses/gpl-2.txt. + */ + +#ifndef _OSX_NTFS_H +#define _OSX_NTFS_H + +#ifdef KERNEL + +#include +#include + +/* The email address of the NTFS developers. */ +__private_extern__ const char ntfs_dev_email[]; +__private_extern__ const char ntfs_please_email[]; + +/* + * Lock group and lock attribute for de-/initialization of locks (defined + * in ntfs_vfsops.c). + */ +__private_extern__ lck_grp_t *ntfs_lock_grp; +__private_extern__ lck_attr_t *ntfs_lock_attr; + +/* + * A tag for allocation and freeing of memory (defined in ntfs_vfsops.c). + */ +__private_extern__ OSMallocTag ntfs_malloc_tag; + +#include "ntfs_volume.h" + +/** + * NTFS_MP - return the NTFS volume given a vfs mount + * @mp: VFS mount + * + * NTFS_MP() returns the NTFS volume associated with the VFS mount @mp. + */ +static inline ntfs_volume *NTFS_MP(mount_t mp) +{ + return (ntfs_volume*)vfs_fsprivate(mp); +} + +__private_extern__ void ntfs_do_postponed_release(ntfs_volume *vol); + +#endif /* KERNEL */ + +#include "ntfs_endian.h" +#include "ntfs_types.h" + +/* Some useful constants to do with NTFS. */ +enum { + NTFS_BLOCK_SIZE = 512, + NTFS_BLOCK_SIZE_SHIFT = 9, + NTFS_MAX_NAME_LEN = 255, + NTFS_MAX_ATTR_NAME_LEN = 255, + NTFS_MAX_SECTOR_SIZE = 4096, /* 4kiB */ + NTFS_MAX_CLUSTER_SIZE = 64 * 1024, /* 64kiB */ + NTFS_ALLOC_BLOCK = 1024, + NTFS_MAX_HARD_LINKS = 65535, /* 2^16 - 1 */ + NTFS_MAX_ATTR_LIST_SIZE = 256 * 1024, /* 256kiB, corresponding to the + VACB_MAPPING_GRANULARITY on + Windows. */ + NTFS_COMPRESSION_UNIT = 4, +}; + +/* + * The maximum attribute size on NTFS is 2^63 - 1 bytes as it is stored in a + * signed 64 bit type (s64). + */ +#define NTFS_MAX_ATTRIBUTE_SIZE 0x7fffffffffffffffULL + +/* + * The maximum number of MFT records allowed on NTFS is 2^32 as described in + * various documentation to be found on the Microsoft web site. This is an + * imposed limit rather than an inherent NTFS format limit. + */ +#define NTFS_MAX_NR_MFT_RECORDS 0x100000000ULL + +// TODO: Constants so ntfs_vfsops.c compiles for now... +enum { + /* One of these must be present, default is ON_ERRORS_CONTINUE. */ + ON_ERRORS_PANIC = 0x01, + ON_ERRORS_REMOUNT_RO = 0x02, + ON_ERRORS_CONTINUE = 0x04, + /* Optional, can be combined with any of the above. */ + ON_ERRORS_RECOVER = 0x10, +}; + +/* + * The NTFS mount options header passed in from user space. + */ +typedef struct { +#ifndef KERNEL + char *fspec; /* Path of device to mount, consumed by mount(2). */ +#endif /* !KERNEL */ + u8 major_ver; /* The major version of the mount options structure. */ + u8 minor_ver; /* The minor version of the mount options structure. */ +} __attribute__((__packed__)) ntfs_mount_options_header; + +/* + * The NTFS mount options passed in from user space. This follows the + * ntfs_mount_options_header aligned to an eight byte boundary. + * + * This is major version 0, minor version 0, which does not have any options, + * i.e. is empty. + */ +typedef struct { + /* Mount options version 0.0 does not have any ntfs options. */ +} __attribute__((__packed__)) ntfs_mount_options_0_0; + +/* + * The currently defined flags for the ntfs mount options structure. + */ +enum { + /* Below flag(s) appeared in mount options version 1.0. */ + NTFS_MNT_OPT_CASE_SENSITIVE = htole32(0x00000001), + /* Below flag(s) appeared in mount options version x.y. */ + // TODO: Add NTFS specific mount options flags here. +}; + +typedef le32 NTFS_MNT_OPTS; + +/* + * The NTFS mount options passed in from user space. This follows the + * ntfs_mount_options_header aligned to an eight byte boundary. + * + * This is major version 1, minor version 0, which has only one option, a + * little endian, 32-bit flags option. + */ +typedef struct { + NTFS_MNT_OPTS flags; + // TODO: Add NTFS specific mount options here. +} __attribute__((__packed__)) ntfs_mount_options_1_0; + +#endif /* !_OSX_NTFS_H */ Added: soc2012/vbotton/ntfs_apple/ntfs_attr.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/vbotton/ntfs_apple/ntfs_attr.c Mon May 14 14:04:01 2012 (r235762) @@ -0,0 +1,9096 @@ +/* + * ntfs_attr.c - NTFS kernel attribute operations. + * + * Copyright (c) 2006-2011 Anton Altaparmakov. All Rights Reserved. + * Portions Copyright (c) 2006-2011 Apple Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of Apple Inc. ("Apple") 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 APPLE AND ITS 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 APPLE OR ITS 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. + * + * ALTERNATIVELY, provided that this notice and licensing terms are retained in + * full, this file may be redistributed and/or modified under the terms of the + * GNU General Public License (GPL) Version 2, in which case the provisions of + * that version of the GPL will apply to you instead of the license terms + * above. You can obtain a copy of the GPL Version 2 at + * http://developer.apple.com/opensource/licenses/gpl-2.txt. + */ + +#include +#include +#include +/*#include */ + +#include + +/*#include +#include */ + +//#include +//#include + +#include "ntfs.h" +#include "ntfs_attr.h" +#include "ntfs_attr_list.h" +#include "ntfs_debug.h" +#include "ntfs_dir.h" +#include "ntfs_endian.h" +#include "ntfs_index.h" +#include "ntfs_inode.h" +#include "ntfs_layout.h" +#include "ntfs_lcnalloc.h" +#include "ntfs_mft.h" +#include "ntfs_page.h" +#include "ntfs_runlist.h" +#include "ntfs_time.h" +#include "ntfs_types.h" +#include "ntfs_unistr.h" + +ntfschar AT_UNNAMED[1] = { 0 }; + +/** + * ntfs_attr_map_runlist - map the whole runlist of an ntfs inode + * @ni: ntfs inode for which to map the whole runlist + * + * Map the whole runlist of the ntfs inode @ni. + * + * Return 0 on success and errno on error. + * + * Note this function requires the runlist not to be mapped yet at all. This + * limitation is ok because we only use this function at mount time to map the + * runlist of some system files thus we are guaranteed that they will not have + * any runlist fragments mapped yet. + * + * Note the runlist can be NULL after this function returns if the attribute + * has zero allocated size, i.e. there simply is no runlist. + */ +errno_t ntfs_attr_map_runlist(ntfs_inode *ni) +{ + VCN vcn, end_vcn; + ntfs_inode *base_ni; + MFT_RECORD *m; + ntfs_attr_search_ctx *ctx; + ATTR_RECORD *a; + errno_t err = 0; + + ntfs_debug("Entering for mft_no 0x%llx, type 0x%x.", + (unsigned long long)ni->mft_no, + (unsigned)le32_to_cpu(ni->type)); + /* If the attribute is resident there is nothing to do. */ + if (!NInoNonResident(ni)) { + ntfs_debug("Done (resident, nothing to do)."); + return 0; + } + lck_rw_lock_exclusive(&ni->rl.lock); + /* Verify that the runlist is not mapped yet. */ + if (ni->rl.alloc && ni->rl.elements) + panic("%s(): ni->rl.alloc && ni->rl.elements\n", __FUNCTION__); + base_ni = ni; + if (NInoAttr(ni)) + base_ni = ni->base_ni; + err = ntfs_mft_record_map(base_ni, &m); + if (err) + goto err; + ctx = ntfs_attr_search_ctx_get(base_ni, m); + if (!ctx) { + err = ENOMEM; + goto unm_err; + } + vcn = 0; + end_vcn = ni->allocated_size >> ni->vol->cluster_size_shift; + do { + err = ntfs_attr_lookup(ni->type, ni->name, ni->name_len, vcn, + NULL, 0, ctx); + if (err) { + if (err == ENOENT) + err = EIO; + break; + } + a = ctx->a; + if (!a->non_resident) { +corrupt_err: + ntfs_error(ni->vol->mp, "Inode 0x%llx contains corrupt " + "attribute extent, run chkdsk.", + (unsigned long long)base_ni->mft_no); + NVolSetErrors(ni->vol); + err = EIO; + break; + } + /* + * If we are in the first attribute extent, verify the cached + * allocated size is correct. + */ + if (!a->lowest_vcn) + if (sle64_to_cpu(a->allocated_size) != + ni->allocated_size) + panic("%s(): sle64_to_cpu(a->allocated_size) " + "!= ni->allocated_size\n", + __FUNCTION__); + /* + * Sanity check the lowest_vcn of the attribute is equal to the + * vcn we looked up and that the highest_vcn of the attribute + * is above the current vcn. + */ + if (sle64_to_cpu(a->lowest_vcn) != vcn || (vcn && + sle64_to_cpu(a->highest_vcn) < vcn)) + goto corrupt_err; + /* Determine the next vcn. */ + vcn = sle64_to_cpu(a->highest_vcn) + 1; + /* + * Finally, map the runlist fragment contained in this + * attribute extent. + */ + err = ntfs_mapping_pairs_decompress(ni->vol, a, &ni->rl); + } while (!err && vcn < end_vcn); +unm_err: + ntfs_attr_search_ctx_put(ctx); + ntfs_mft_record_unmap(base_ni); +err: + lck_rw_unlock_exclusive(&ni->rl.lock); + if (!err) + ntfs_debug("Done."); + else + ntfs_error(ni->vol->mp, "Failed (error %d).", (int)err); + return err; +} + +/** + * ntfs_map_runlist_nolock - map (a part of) a runlist of an ntfs inode + * @ni: ntfs inode for which to map (part of) a runlist + * @vcn: map runlist part containing this vcn + * @ctx: active attribute search context if present or NULL if not + * + * Map the part of a runlist containing the @vcn of the ntfs inode @ni. + * + * If @ctx is specified, it is an active search context of @ni and its base mft + * record. This is needed when ntfs_map_runlist_nolock() encounters unmapped + * runlist fragments and allows their mapping. If you do not have the mft + * record mapped, you can specify @ctx as NULL and ntfs_map_runlist_nolock() + * will perform the necessary mapping and unmapping. + * + * Note, ntfs_map_runlist_nolock() saves the state of @ctx on entry and + * restores it before returning. Thus, @ctx will be left pointing to the same + * attribute on return as on entry. However, the actual pointers in @ctx may + * point to different memory locations on return, so you must remember to reset + * any cached pointers from the @ctx, i.e. after the call to + * ntfs_map_runlist_nolock(), you will probably want to do: + * m = ctx->m; + * a = ctx->a; + * Assuming you cache ctx->a in a variable @a of type ATTR_RECORD * and that + * you cache ctx->m in a variable @m of type MFT_RECORD *. + * + * Return 0 on success and errno on error. There is one special error code + * which is not an error as such. This is ENOENT. It means that @vcn is out + * of bounds of the runlist. + * + * Note the runlist can be NULL after this function returns if @vcn is zero and + * the attribute has zero allocated size, i.e. there simply is no runlist. + * + * WARNING: If @ctx is supplied, regardless of whether success or failure is + * returned, you need to check @ctx->is_error and if 1 the @ctx is no + * longer valid, i.e. you need to either call + * ntfs_attr_search_ctx_reinit() or ntfs_attr_search_ctx_put() on it. + * In that case @ctx->error will give you the error code for why the + * mapping of the old inode failed. + * Also if @ctx is supplied and the current attribute (or the mft + * record it is in) has been modified then the caller must call + * NInoSetMrecNeedsDirtying(ctx->ni); before calling + * ntfs_map_runlist_nolock() or the changes may be lost. + * + * Locking: - The runlist described by @ni must be locked for writing on entry + * and is locked on return. Note the runlist will be modified. + * - If @ctx is NULL, the base mft record of @ni must not be mapped on + * entry and it will be left unmapped on return. + * - If @ctx is not NULL, the base mft record must be mapped on entry + * and it will be left mapped on return. + */ +errno_t ntfs_map_runlist_nolock(ntfs_inode *ni, VCN vcn, + ntfs_attr_search_ctx *ctx) +{ + VCN end_vcn; + ntfs_inode *base_ni; + MFT_RECORD *m; + ATTR_RECORD *a; + errno_t err = 0; + BOOL ctx_is_temporary, ctx_needs_reset; + ntfs_attr_search_ctx old_ctx = { { NULL, }, }; + + ntfs_debug("Entering for mft_no 0x%llx, vcn 0x%llx.", + (unsigned long long)ni->mft_no, + (unsigned long long)vcn); + base_ni = ni; + if (NInoAttr(ni)) + base_ni = ni->base_ni; + if (!ctx) { + ctx_is_temporary = ctx_needs_reset = TRUE; + err = ntfs_mft_record_map(base_ni, &m); + if (err) + goto done; + ctx = ntfs_attr_search_ctx_get(base_ni, m); + if (!ctx) { + err = ENOMEM; + goto err; + } + } else { + VCN allocated_size_vcn; + + if (ctx->is_error) + panic("%s(): ctx->is_error\n", __FUNCTION__); + a = ctx->a; + if (!a->non_resident) + panic("%s(): !a->non_resident\n", __FUNCTION__); + ctx_is_temporary = FALSE; + end_vcn = sle64_to_cpu(a->highest_vcn); + lck_spin_lock(&ni->size_lock); + allocated_size_vcn = ni->allocated_size >> + ni->vol->cluster_size_shift; + lck_spin_unlock(&ni->size_lock); + /* + * If we already have the attribute extent containing @vcn in + * @ctx, no need to look it up again. We slightly cheat in + * that if vcn exceeds the allocated size, we will refuse to + * map the runlist below, so there is definitely no need to get + * the right attribute extent. + */ + if (vcn >= allocated_size_vcn || (a->type == ni->type && + a->name_length == ni->name_len && + !bcmp((u8*)a + le16_to_cpu(a->name_offset), + ni->name, ni->name_len) && + sle64_to_cpu(a->lowest_vcn) <= vcn && + end_vcn >= vcn)) + ctx_needs_reset = FALSE; + else { + /* Save the old search context. */ + old_ctx = *ctx; + /* + * Reinitialize the search context so we can lookup the + * needed attribute extent. + */ + ntfs_attr_search_ctx_reinit(ctx); + ctx_needs_reset = TRUE; + } + } + if (ctx_needs_reset) { + err = ntfs_attr_lookup(ni->type, ni->name, ni->name_len, vcn, + NULL, 0, ctx); + if (err) { + if (err == ENOENT) + err = EIO; + goto err; + } + if (!ctx->a->non_resident) + panic("%s(): !a->non_resident!\n", __FUNCTION__); + } + a = ctx->a; + /* + * Only decompress the mapping pairs if @vcn is inside it. Otherwise + * we get into problems when we try to map an out of bounds vcn because + * we then try to map the already mapped runlist fragment and + * ntfs_mapping_pairs_decompress() fails. + */ + end_vcn = sle64_to_cpu(a->highest_vcn) + 1; + if (vcn && vcn >= end_vcn) { + err = ENOENT; + goto err; + } + err = ntfs_mapping_pairs_decompress(ni->vol, a, &ni->rl); +err: + if (ctx_is_temporary) { + if (ctx) + ntfs_attr_search_ctx_put(ctx); + ntfs_mft_record_unmap(base_ni); + } else if (ctx_needs_reset) { + /* + * If there is no attribute list, restoring the search context + * is acomplished simply by copying the saved context back over + * the caller supplied context. If there is an attribute list, + * things are more complicated as we need to deal with mapping + * of mft records and resulting potential changes in pointers. + */ + if (NInoAttrList(base_ni)) { + /* + * If the currently mapped (extent) inode is not the + * one we had before, we need to unmap it and map the + * old one. + */ + if (ctx->ni != old_ctx.ni) { + /* + * If the currently mapped inode is not the + * base inode, unmap it. + */ + if (ctx->base_ni && ctx->ni != ctx->base_ni) { + ntfs_extent_mft_record_unmap(ctx->ni); + ctx->m = ctx->base_m; + if (!ctx->m) + panic("%s(): !ctx->m\n", + __FUNCTION__); + } + /* + * If the old mapped inode is not the base + * inode, map it. + */ + if (old_ctx.base_ni && old_ctx.ni != + old_ctx.base_ni) { + errno_t err2; +retry_map: + err2 = ntfs_mft_record_map(old_ctx.ni, + &ctx->m); + /* + * Something bad has happened. If out + * of memory retry till it succeeds. + * Any other errors are fatal and we + * return the error code in ctx->m. + * Let the caller deal with it... We + * just need to fudge things so the + * caller can reinit and/or put the + * search context safely. + */ + if (err2) { + if (err2 == ENOMEM) { + (void)thread_block( + THREAD_CONTINUE_NULL); + goto retry_map; + } + ctx->is_error = 1; + ctx->error = err2; + old_ctx.ni = old_ctx.base_ni; + } + } + } + if (ctx->is_error) { + old_ctx.is_error = 1; + old_ctx.error = ctx->error; + } else if (ctx->m != old_ctx.m) { + /* + * Update the changed pointers in the saved + * context. + */ + old_ctx.a = (ATTR_RECORD*)((u8*)ctx->m + + ((u8*)old_ctx.a - + (u8*)old_ctx.m)); + old_ctx.m = ctx->m; + } + } + /* Restore the search context to the saved one. */ + *ctx = old_ctx; + } +done: + ntfs_debug("Done (error %d).", (int)err); + return err; +} + +/** + * ntfs_attr_vcn_to_lcn_nolock - convert a vcn into a lcn given an ntfs inode + * @ni: ntfs inode of the attribute whose runlist to search + * @vcn: vcn to convert + * @write_locked: true if the runlist is locked for writing + * @clusters: optional destination for number of contiguous clusters + * + * Find the virtual cluster number @vcn in the runlist of the ntfs attribute + * described by the ntfs inode @ni and return the corresponding logical cluster + * number (lcn). + * + * If the @vcn is not mapped yet, the attempt is made to map the attribute + * extent containing the @vcn and the vcn to lcn conversion is retried. + * + * If @write_locked is true the caller has locked the runlist for writing and + * if false for reading. + * + * If @clusters is not NULL, on success (i.e. we return >= LCN_HOLE) we return + * the number of contiguous clusters after the returned lcn in *@clusters. + * + * Since lcns must be >= 0, we use negative return codes with special meaning: + * + * Return code Meaning / Description + * ========================================== + * LCN_HOLE Hole / not allocated on disk. + * LCN_ENOENT There is no such vcn in the runlist, i.e. @vcn is out of bounds. + * LCN_ENOMEM Not enough memory to map runlist. + * LCN_EIO Critical error (runlist/file is corrupt, i/o error, etc). + * + * Locking: - The runlist must be locked on entry and is left locked on return. + * - If @write_locked is FALSE, i.e. the runlist is locked for reading, + * the lock may be dropped inside the function so you cannot rely on + * the runlist still being the same when this function returns. + */ +LCN ntfs_attr_vcn_to_lcn_nolock(ntfs_inode *ni, const VCN vcn, + const BOOL write_locked, s64 *clusters) +{ + LCN lcn; + BOOL need_lock_switch = FALSE; + BOOL is_retry = FALSE; + + ntfs_debug("Entering for mft_no 0x%llx, vcn 0x%llx, %s_locked.", + (unsigned long long)ni->mft_no, + (unsigned long long)vcn, + write_locked ? "write" : "read"); + if (!NInoNonResident(ni)) + panic("%s(): !NInoNonResident(ni)\n", __FUNCTION__); + if (vcn < 0) + panic("%s(): vcn < 0\n", __FUNCTION__); +retry_remap: + if (!ni->rl.elements) { + lck_spin_lock(&ni->size_lock); + if (!ni->allocated_size) { + lck_spin_unlock(&ni->size_lock); + lcn = LCN_ENOENT; + goto lcn_enoent; + } + lck_spin_unlock(&ni->size_lock); + if (!is_retry) + goto try_to_map; + lcn = LCN_EIO; + goto lcn_eio; + } + /* Convert vcn to lcn. If that fails map the runlist and retry once. */ + lcn = ntfs_rl_vcn_to_lcn(ni->rl.rl, vcn, clusters); + if (lcn >= LCN_HOLE) { + if (need_lock_switch) + lck_rw_lock_exclusive_to_shared(&ni->rl.lock); + ntfs_debug("Done (lcn 0x%llx, clusters 0x%llx).", + (unsigned long long)lcn, + clusters ? (unsigned long long)*clusters : 0); + return lcn; + } + if (lcn != LCN_RL_NOT_MAPPED) { + if (lcn != LCN_ENOENT) + lcn = LCN_EIO; + } else if (!is_retry) { + errno_t err; + +try_to_map: + if (!write_locked && !need_lock_switch) { + need_lock_switch = TRUE; + /* + * If converting the lock from shared to exclusive + * fails, need to take the lock for writing and retry + * in case the racing process did the mapping for us. + */ + if (!lck_rw_lock_shared_to_exclusive(&ni->rl.lock)) { + lck_rw_lock_exclusive(&ni->rl.lock); + goto retry_remap; + } + } + err = ntfs_map_runlist_nolock(ni, vcn, NULL); + if (!err) { + is_retry = TRUE; + goto retry_remap; + } + switch (err) { + case ENOENT: + lcn = LCN_ENOENT; + break; + case ENOMEM: + lcn = LCN_ENOMEM; + break; + default: + lcn = LCN_EIO; + } + } +lcn_eio: + if (need_lock_switch) + lck_rw_lock_exclusive_to_shared(&ni->rl.lock); + if (lcn == LCN_ENOENT) { +lcn_enoent: + ntfs_debug("Done (LCN_ENOENT)."); + } else + ntfs_error(ni->vol->mp, "Failed (error %lld).", (long long)lcn); + return lcn; +} + +/** + * ntfs_attr_find_vcn_nolock - find a vcn in the runlist of an ntfs inode + * @ni: ntfs inode of the attribute whose runlist to search + * @vcn: vcn to find + * @run: return pointer for the found runlist element + * @ctx: active attribute search context if present or NULL if not + * + * Find the virtual cluster number @vcn in the runlist of the ntfs attribute + * described by the ntfs inode @ni and return the address of the runlist + * element containing the @vcn in *@run. + * + * If the @vcn is not mapped yet, the attempt is made to map the attribute + * extent containing the @vcn and the vcn to lcn conversion is retried. + * + * If @ctx is specified, it is an active search context of @ni and its base mft + * record. This is needed when ntfs_attr_find_vcn_nolock() encounters unmapped + * runlist fragments and allows their mapping. If you do not have the mft + * record mapped, you can specify @ctx as NULL and ntfs_attr_find_vcn_nolock() + * will perform the necessary mapping and unmapping. + * + * Note, ntfs_attr_find_vcn_nolock() saves the state of @ctx on entry and + * restores it before returning. Thus, @ctx will be left pointing to the same + * attribute on return as on entry. However, the actual pointers in @ctx may + * point to different memory locations on return, so you must remember to reset + * any cached pointers from the @ctx, i.e. after the call to + * ntfs_attr_find_vcn_nolock(), you will probably want to do: + * m = ctx->m; + * a = ctx->a; + * Assuming you cache ctx->a in a variable @a of type ATTR_RECORD * and that + * you cache ctx->m in a variable @m of type MFT_RECORD *. + * Note you need to distinguish between the lcn of the returned runlist element + * being >= 0 and LCN_HOLE. In the later case you have to return zeroes on + * read and allocate clusters on write. + * + * Return 0 on success and errno on error. + * + * The possible error return codes are: + * ENOENT - No such vcn in the runlist, i.e. @vcn is out of bounds. + * ENOMEM - Not enough memory to map runlist. + * EIO - Critical error (runlist/file is corrupt, i/o error, etc). + * + * WARNING: If @ctx is supplied, regardless of whether success or failure is + * returned, you need to check @ctx->is_error and if 1 the @ctx is no + * longer valid, i.e. you need to either call + * ntfs_attr_search_ctx_reinit() or ntfs_attr_search_ctx_put() on it. + * In that case @ctx->error will give you the error code for why the + * mapping of the old inode failed. + * Also if @ctx is supplied and the current attribute (or the mft + * record it is in) has been modified then the caller must call + * NInoSetMrecNeedsDirtying(ctx->ni); before calling + * ntfs_map_runlist_nolock() or the changes may be lost. + * + * Locking: - The runlist described by @ni must be locked for writing on entry + * and is locked on return. Note the runlist may be modified when + * needed runlist fragments need to be mapped. + * - If @ctx is NULL, the base mft record of @ni must not be mapped on + * entry and it will be left unmapped on return. + * - If @ctx is not NULL, the base mft record must be mapped on entry + * and it will be left mapped on return. + */ +errno_t ntfs_attr_find_vcn_nolock(ntfs_inode *ni, const VCN vcn, + ntfs_rl_element **run, ntfs_attr_search_ctx *ctx) +{ + ntfs_rl_element *rl; + errno_t err = 0; + BOOL is_retry = FALSE; + + ntfs_debug("Entering for mft_no 0x%llx, vcn 0x%llx, with%s ctx.", + (unsigned long long)ni->mft_no, + (unsigned long long)vcn, ctx ? "" : "out"); + if (!NInoNonResident(ni)) + panic("%s(): !NInoNonResident(ni)\n", __FUNCTION__); + if (vcn < 0) + panic("%s(): vcn < 0\n", __FUNCTION__); +retry_remap: + if (!ni->rl.elements) { + lck_spin_lock(&ni->size_lock); + if (!ni->allocated_size) { + lck_spin_unlock(&ni->size_lock); + return LCN_ENOENT; + } + lck_spin_unlock(&ni->size_lock); + if (!is_retry) + goto try_to_map; + err = EIO; + goto err; + } + rl = ni->rl.rl; + if (vcn >= rl[0].vcn) { + while (rl->length) { + if (vcn < rl[1].vcn) { + if (rl->lcn >= LCN_HOLE) { + ntfs_debug("Done."); + *run = rl; + return 0; + } + break; + } + rl++; + } + if (rl->lcn != LCN_RL_NOT_MAPPED) { + if (rl->lcn == LCN_ENOENT) + err = ENOENT; + else + err = EIO; + } + } + if (!err && !is_retry) { + /* + * If the search context is invalid we cannot map the unmapped + * region. + */ + if (ctx->is_error) + err = ctx->error; + else { +try_to_map: + /* + * The @vcn is in an unmapped region, map the runlist + * and retry. + */ + err = ntfs_map_runlist_nolock(ni, vcn, ctx); + if (!err) { + is_retry = TRUE; + goto retry_remap; + } + } + if (err == EINVAL) + err = EIO; + } else if (!err) + err = EIO; +err: + if (err != ENOENT) + ntfs_error(ni->vol->mp, "Failed (error %d).", err); + return err; +} + +/** + * ntfs_attr_search_ctx_reinit - reinitialize an attribute search context + * @ctx: attribute search context to reinitialize + * + * Reinitialize the attribute search context @ctx, unmapping an associated + * extent mft record if present, and initialize the search context again. + * + * This is used when a search for a new attribute is being started to reset + * the search context to the beginning. + * + * Note: We preserve the content of @ctx->is_mft_locked so that reinitializing + * a search context can also be done when dealing with the mft itself. + */ +void ntfs_attr_search_ctx_reinit(ntfs_attr_search_ctx *ctx) +{ + const BOOL mft_is_locked = ctx->is_mft_locked; + + if (!ctx->base_ni) { + /* No attribute list. */ + ctx->is_first = 1; + ctx->is_iteration = 0; + /* Sanity checks are performed elsewhere. */ + ctx->a = (ATTR_RECORD*)((u8*)ctx->m + + le16_to_cpu(ctx->m->attrs_offset)); + /* + * This needs resetting due to + * ntfs_attr_find_in_attribute_list() which can leave it set + * despite having zeroed ctx->base_ni. + */ + ctx->al_entry = NULL; + return; + } + /* Attribute list. */ + if (ctx->ni != ctx->base_ni) + ntfs_extent_mft_record_unmap(ctx->ni); + ntfs_attr_search_ctx_init(ctx, ctx->base_ni, ctx->base_m); + if (mft_is_locked) + ctx->is_mft_locked = 1; +} + +/** + * ntfs_attr_search_ctx_get - allocate and init a new attribute search context + * @ni: ntfs inode with which to initialize the search context + * @m: mft record with which to initialize the search context + * + * Allocate a new attribute search context, initialize it with @ni and @m, and + * return it. Return NULL if allocation failed. + */ +ntfs_attr_search_ctx *ntfs_attr_search_ctx_get(ntfs_inode *ni, MFT_RECORD *m) +{ + ntfs_attr_search_ctx *ctx; + + ctx = OSMalloc(sizeof(ntfs_attr_search_ctx), ntfs_malloc_tag); + if (ctx) + ntfs_attr_search_ctx_init(ctx, ni, m); + return ctx; +} + +/** + * ntfs_attr_search_ctx_put - release an attribute search context + * @ctx: attribute search context to free + * + * Release the attribute search context @ctx, unmapping an associated extent + * mft record if present. + */ +void ntfs_attr_search_ctx_put(ntfs_attr_search_ctx *ctx) +{ + if (ctx->base_ni && ctx->ni != ctx->base_ni) + ntfs_extent_mft_record_unmap(ctx->ni); + OSFree(ctx, sizeof(ntfs_attr_search_ctx), ntfs_malloc_tag); +} + +/** + * ntfs_attr_find_in_mft_record - find (next) attribute in mft record + * @type: attribute type to find + * @name: attribute name to find (optional, i.e. NULL means do not care) + * @name_len: attribute name length (only needed if @name present) + * @val: attribute value to find (optional, resident attributes only) + * @val_len: attribute value length (only needed if @val present) + * @ctx: search context with mft record and attribute to search from + * + * You should not need to call this function directly. Use ntfs_attr_lookup() + * instead. + * + * ntfs_attr_find_in_mft_record() takes a search context @ctx as parameter and + * searches the mft record specified by @ctx->m, beginning at @ctx->a, for an + * attribute of @type, optionally @name and @val. + * + * If the attribute is found, ntfs_attr_find_in_mft_record() returns 0 and + * @ctx->a is set to point to the found attribute. + * + * If the attribute is not found, ENOENT is returned and @ctx->a is set to + * point to the attribute before which the attribute being searched for would + * need to be inserted if such an action were to be desired. + * + * On actual error, ntfs_attr_find_in_mft_record() returns EIO. In this case + * @ctx->a is undefined and in particular do not rely on it not having changed. + * + * If @ctx->is_first is 1, the search begins with @ctx->a itself. If it is 0, + * the search begins after @ctx->a. + * + * If @ctx->is_iteration is 1 and @type is AT_UNUSED this is not a search but + * an iteration in which case each attribute in the mft record is returned in + * turn with each call to ntfs_attr_find_in_mft_record(). Note all attributes + * are returned including the attribute list attribute, unlike when + * @ctx->is_iteration is 0 when it is not returned unless it is specifically + * looked for. + * + * Similarly to the above, when @ctx->is_iterations is 1 and @type is not + * AT_UNUSED all attributes of type @type are returned one after the other. + * + * If @name is AT_UNNAMED search for an unnamed attribute. If @name is present + * but not AT_UNNAMED search for a named attribute matching @name. Otherwise, + * match both named and unnamed attributes. + * + * Finally, the resident attribute value @val is looked for, if present. If + * @val is not present (NULL), @val_len is ignored. + * + * ntfs_attr_find_in_mft_record() only searches the specified mft record and it + * ignores the presence of an attribute list attribute (unless it is the one + * being searched for, obviously). If you need to take attribute lists into + * consideration, use ntfs_attr_lookup() instead (see below). This also means + * that you cannot use ntfs_attr_find_in_mft_record() to search for extent + * records of non-resident attributes, as extents with lowest_vcn != 0 are + * usually described by the attribute list attribute only. Note that it is + * possible that the first extent is only in the attribute list while the last + * extent is in the base mft record, so do not rely on being able to find the + * first extent in the base mft record. + * + * Warning: Never use @val when looking for attribute types which can be + * non-resident as this most likely will result in a crash! + * + * Note if the volume is mounted case sensitive we treat attribute names as + * being case sensitive and vice versa if the volume is not mounted case + * sensitive we treat attribute names as being case insensitive also. + */ +errno_t ntfs_attr_find_in_mft_record(const ATTR_TYPE type, + const ntfschar *name, const u32 name_len, + const void *val, const u32 val_len, ntfs_attr_search_ctx *ctx) +{ + ATTR_RECORD *a; + ntfs_volume *vol = ctx->ni->vol; + const ntfschar *upcase = vol->upcase; + const u32 upcase_len = vol->upcase_len; + const BOOL case_sensitive = NVolCaseSensitive(vol); + const BOOL is_iteration = ctx->is_iteration; + + /* + * Iterate over attributes in mft record starting at @ctx->a, or the + * attribute following that, if @ctx->is_first is true. + */ + if (ctx->is_first) { + a = ctx->a; + ctx->is_first = 0; + } else + a = (ATTR_RECORD*)((u8*)ctx->a + le32_to_cpu(ctx->a->length)); + for (;; a = (ATTR_RECORD*)((u8*)a + le32_to_cpu(a->length))) { + if ((u8*)a < (u8*)ctx->m || (u8*)a > (u8*)ctx->m + + le32_to_cpu(ctx->m->bytes_allocated)) + break; + ctx->a = a; + if (((!is_iteration || type != AT_UNUSED) && + le32_to_cpu(a->type) > le32_to_cpu(type)) || + a->type == AT_END) + return ENOENT; + if (!a->length) + break; + if (is_iteration) { + if (type == AT_UNUSED || type == a->type) + return 0; + } + if (a->type != type) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From exxo at FreeBSD.org Tue May 15 01:57:33 2012 From: exxo at FreeBSD.org (exxo@FreeBSD.org) Date: Tue May 15 01:57:39 2012 Subject: socsvn commit: r235781 - soc2012/exxo Message-ID: <20120515015730.D4A25106564A@hub.freebsd.org> Author: exxo Date: Tue May 15 01:57:30 2012 New Revision: 235781 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=235781 Log: Fix: Fixed CVS coredump with inet6 support Added: soc2012/exxo/ soc2012/exxo/cvs-inet6.patch Added: soc2012/exxo/cvs-inet6.patch ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/exxo/cvs-inet6.patch Tue May 15 01:57:30 2012 (r235781) @@ -0,0 +1,208 @@ +? src/patch-20110103-01-cvs-client-ipv6-pserver.diff +Index: src/client.c +=================================================================== +RCS file: /home/ncvs/src/contrib/cvs/src/client.c,v +retrieving revision 1.14 +diff -p -u -r1.14 client.c +--- src/client.c 19 Mar 2008 14:49:14 -0000 1.14 ++++ src/client.c 15 May 2012 01:47:06 -0000 +@@ -85,7 +85,7 @@ static Key_schedule sched; + /* This is needed for GSSAPI encryption. */ + static gss_ctx_id_t gcontext; + +-static int connect_to_gserver PROTO((cvsroot_t *, int, struct hostent *)); ++static int connect_to_gserver PROTO((cvsroot_t *, int, const char *)); + + # endif /* HAVE_GSSAPI */ + +@@ -149,7 +149,7 @@ static void handle_notified PROTO((char + static size_t try_read_from_server PROTO ((char *, size_t)); + + static void auth_server PROTO ((cvsroot_t *, struct buffer *, struct buffer *, +- int, int, struct hostent *)); ++ int, int, const char *)); + + /* We need to keep track of the list of directories we've sent to the + server. This list, along with the current CVSROOT, will help us +@@ -3605,6 +3605,28 @@ init_sockaddr (name, hostname, port) + return hostinfo; + } + ++static void ++_inet_ntop(int af, struct sockaddr *sa, char *addr, socklen_t len) ++{ ++ struct sockaddr_in *sin; ++ struct sockaddr_in6 *sin6; ++ ++ addr[0] = '\0'; ++ assert(af == sa->sa_family); ++ switch (af) ++ { ++ case AF_INET6: ++ sin6 = (struct sockaddr_in6 *)sa; ++ inet_ntop(af, &sin6->sin6_addr, addr, len); ++ break; ++ case AF_INET: ++ sin = (struct sockaddr_in *)sa; ++ inet_ntop(af, &sin->sin_addr, addr, len); ++ break; ++ default: ++ break; ++ } ++} + + + /* Generic function to do port number lookup tasks. +@@ -3779,33 +3801,75 @@ connect_to_pserver (root, to_server_p, f + { + int sock; + int port_number; +- struct sockaddr_in client_sai; +- struct hostent *hostinfo; + struct buffer *to_server, *from_server; ++ struct addrinfo hints, *res, *res0, *ress; ++ int err, cause; ++ char ports[7], addr[INET6_ADDRSTRLEN]; + +- sock = socket (AF_INET, SOCK_STREAM, 0); +- if (sock == -1) +- { +- error (1, 0, "cannot create socket: %s", SOCK_STRERROR (SOCK_ERRNO)); +- } + port_number = get_cvs_port_number (root); +- hostinfo = init_sockaddr (&client_sai, root->hostname, port_number); +- if (trace) ++ snprintf(ports, sizeof(ports), "%d", port_number); ++ ++ memset(&hints, 0, sizeof(hints)); ++ hints.ai_flags = AI_CANONNAME; ++ hints.ai_family = PF_UNSPEC; ++ hints.ai_socktype = SOCK_STREAM; ++ err = getaddrinfo(root->hostname, ports, &hints, &res0); ++ if (err) + { +- fprintf (stderr, " -> Connecting to %s(%s):%d\n", +- root->hostname, +- inet_ntoa (client_sai.sin_addr), port_number); ++ error(1, 0, "%s", gai_strerror(err)); ++ } ++ sock = -1; ++ cause = 0; ++ for (res = res0; res; res = res->ai_next) { ++ sock = socket(res->ai_family, res->ai_socktype, ++ res->ai_protocol); ++ if (sock < 0) { ++ cause = 1; ++ err = SOCK_ERRNO; ++ ress = res; ++ continue; ++ } ++ ++ if (trace) ++ { ++ _inet_ntop(res->ai_family, res->ai_addr, addr, sizeof(addr)); ++ fprintf (stderr, " -> Connecting to %s(%s):%d\n", ++ root->hostname, addr, port_number); ++ } ++ ++ if (connect(sock, res->ai_addr, res->ai_addrlen) < 0) { ++ cause = 2; ++ err = SOCK_ERRNO; ++ ress = res; ++ close(sock); ++ sock = -1; ++ continue; ++ } ++ ++ break; /* okay we got one */ ++ } ++ if (sock < 0) { ++ switch (cause) ++ { ++ case 1: ++ freeaddrinfo(res0); ++ error (1, 0, "cannot create socket: %s", SOCK_STRERROR (SOCK_ERRNO)); ++ case 2: ++ _inet_ntop(ress->ai_family, ress->ai_addr, addr, sizeof(addr)); ++ freeaddrinfo(res0); ++ error (1, 0, "connect to %s(%s):%d failed: %s", ++ root->hostname, addr, port_number, ++ SOCK_STRERROR (err)); ++ default: ++ freeaddrinfo(res0); ++ error (1, 0, "%s: unknown error", __func__); ++ } + } +- if (connect (sock, (struct sockaddr *) &client_sai, sizeof (client_sai)) +- < 0) +- error (1, 0, "connect to %s(%s):%d failed: %s", +- root->hostname, +- inet_ntoa (client_sai.sin_addr), +- port_number, SOCK_STRERROR (SOCK_ERRNO)); + + make_bufs_from_fds (sock, sock, 0, &to_server, &from_server, 1); + +- auth_server (root, to_server, from_server, verify_only, do_gssapi, hostinfo); ++ auth_server (root, to_server, from_server, verify_only, do_gssapi, res->ai_canonname); ++ freeaddrinfo(res0); + + if (verify_only) + { +@@ -3839,13 +3903,13 @@ connect_to_pserver (root, to_server_p, f + + + static void +-auth_server (root, lto_server, lfrom_server, verify_only, do_gssapi, hostinfo) ++auth_server (root, lto_server, lfrom_server, verify_only, do_gssapi, hostname) + cvsroot_t *root; + struct buffer *lto_server; + struct buffer *lfrom_server; + int verify_only; + int do_gssapi; +- struct hostent *hostinfo; ++ const char *hostname; + { + char *username = ""; /* the username we use to connect */ + char no_passwd = 0; /* gets set if no password found */ +@@ -3875,7 +3939,7 @@ auth_server (root, lto_server, lfrom_ser + error (1, 0, "gserver currently only enabled for socket connections"); + } + +- if (! connect_to_gserver (root, fd, hostinfo)) ++ if (! connect_to_gserver (root, fd, hostname)) + { + error (1, 0, + "authorization failed: server %s rejected access to %s", +@@ -4076,6 +4140,7 @@ start_tcp_server (root, to_server, from_ + struct sockaddr_in sin; + char *hname; + ++ /* XXX Not IPv6 ready, but MIT Kerberos 4 code thou shall not touch. */ + s = socket (AF_INET, SOCK_STREAM, 0); + if (s < 0) + error (1, 0, "cannot create socket: %s", SOCK_STRERROR (SOCK_ERRNO)); +@@ -4176,10 +4241,10 @@ recv_bytes (sock, buf, need) + */ + #define BUFSIZE 1024 + static int +-connect_to_gserver (root, sock, hostinfo) ++connect_to_gserver (root, sock, hostname) + cvsroot_t *root; + int sock; +- struct hostent *hostinfo; ++ const char *hostname; + { + char *str; + char buf[BUFSIZE]; +@@ -4192,9 +4257,9 @@ connect_to_gserver (root, sock, hostinfo + if (send (sock, str, strlen (str), 0) < 0) + error (1, 0, "cannot send: %s", SOCK_STRERROR (SOCK_ERRNO)); + +- if (strlen (hostinfo->h_name) > BUFSIZE - 5) ++ if (strlen (hostname) > BUFSIZE - 5) + error (1, 0, "Internal error: hostname exceeds length of buffer"); +- sprintf (buf, "cvs@%s", hostinfo->h_name); ++ sprintf (buf, "cvs@%s", hostname); + tok_in.length = strlen (buf); + tok_in.value = buf; + gss_import_name (&stat_min, &tok_in, GSS_C_NT_HOSTBASED_SERVICE, From rudot at FreeBSD.org Tue May 15 22:03:18 2012 From: rudot at FreeBSD.org (rudot@FreeBSD.org) Date: Tue May 15 22:03:24 2012 Subject: socsvn commit: r235809 - soc2012/rudot Message-ID: <20120515220317.4CBA7106564A@hub.freebsd.org> Author: rudot Date: Tue May 15 22:03:17 2012 New Revision: 235809 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=235809 Log: initial import Added: soc2012/rudot/ From gmiller at FreeBSD.org Tue May 15 22:32:06 2012 From: gmiller at FreeBSD.org (gmiller@FreeBSD.org) Date: Tue May 15 22:32:12 2012 Subject: socsvn commit: r235810 - in soc2012/gmiller: . locking-head Message-ID: <20120515223205.456C2106567C@hub.freebsd.org> Author: gmiller Date: Tue May 15 22:32:04 2012 New Revision: 235810 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=235810 Log: GSoC 2012 Locking Profiling and Lock Order Verification project initial branch creation. Submitted by: Greg Miller (gmiller@) Added: soc2012/gmiller/ soc2012/gmiller/locking-head/ From gmiller at FreeBSD.org Tue May 15 22:33:21 2012 From: gmiller at FreeBSD.org (gmiller@FreeBSD.org) Date: Tue May 15 22:33:27 2012 Subject: socsvn commit: r235811 - soc2012/gmiller/locking-head/head Message-ID: <20120515223320.3933E106566C@hub.freebsd.org> Author: gmiller Date: Tue May 15 22:33:19 2012 New Revision: 235811 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=235811 Log: GSoC Lock Profiling and Lock Order Verification project initial code commit to branch. Submitted by: Greg Miller (gmiller@) Added: soc2012/gmiller/locking-head/head/ (props changed) - copied from r235810, mirror/FreeBSD/head/ From gmiller at FreeBSD.org Tue May 15 22:36:08 2012 From: gmiller at FreeBSD.org (gmiller@FreeBSD.org) Date: Tue May 15 22:36:14 2012 Subject: socsvn commit: r235812 - soc2012/gmiller/locking-head Message-ID: <20120515223607.900A4106566B@hub.freebsd.org> Author: gmiller Date: Tue May 15 22:36:07 2012 New Revision: 235812 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=235812 Log: Correcting location. Submitted by: Greg Miller (gmiller@) Deleted: soc2012/gmiller/locking-head/ From gmiller at FreeBSD.org Tue May 15 22:37:16 2012 From: gmiller at FreeBSD.org (gmiller@FreeBSD.org) Date: Tue May 15 22:37:21 2012 Subject: socsvn commit: r235813 - soc2012/gmiller/locking-head Message-ID: <20120515223714.DC6471065672@hub.freebsd.org> Author: gmiller Date: Tue May 15 22:37:14 2012 New Revision: 235813 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=235813 Log: Recreating branch files at the proper location. Submitted by: Greg Miller (gmiller@) Added: soc2012/gmiller/locking-head/ (props changed) - copied from r235812, mirror/FreeBSD/head/ From ae at FreeBSD.org Thu May 17 05:30:35 2012 From: ae at FreeBSD.org (ae@FreeBSD.org) Date: Thu May 17 05:30:41 2012 Subject: socsvn commit: r235858 - soc2012/ae Message-ID: <20120517053034.5863F106564A@hub.freebsd.org> Author: ae Date: Thu May 17 05:30:33 2012 New Revision: 235858 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=235858 Log: Test my account. Added: soc2012/ae/ From scher at FreeBSD.org Thu May 17 21:04:38 2012 From: scher at FreeBSD.org (scher@FreeBSD.org) Date: Thu May 17 21:04:44 2012 Subject: socsvn commit: r235897 - soc2012/scher Message-ID: <20120517210437.6F009106566C@hub.freebsd.org> Author: scher Date: Thu May 17 21:04:37 2012 New Revision: 235897 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=235897 Log: Added: soc2012/scher/ From scher at FreeBSD.org Thu May 17 21:10:28 2012 From: scher at FreeBSD.org (scher@FreeBSD.org) Date: Thu May 17 21:10:34 2012 Subject: socsvn commit: r235898 - soc2012/scher/par_ports Message-ID: <20120517211027.B381C106564A@hub.freebsd.org> Author: scher Date: Thu May 17 21:10:27 2012 New Revision: 235898 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=235898 Log: Added: soc2012/scher/par_ports/ From scher at FreeBSD.org Fri May 18 11:09:37 2012 From: scher at FreeBSD.org (scher@FreeBSD.org) Date: Fri May 18 11:09:43 2012 Subject: socsvn commit: r235936 - soc2012/scher/par_ports/head Message-ID: <20120518110936.4C223106564A@hub.freebsd.org> Author: scher Date: Fri May 18 11:09:36 2012 New Revision: 235936 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=235936 Log: Added: soc2012/scher/par_ports/head/ From oleksandr at FreeBSD.org Fri May 18 13:12:16 2012 From: oleksandr at FreeBSD.org (oleksandr@FreeBSD.org) Date: Fri May 18 13:12:22 2012 Subject: socsvn commit: r235939 - in soc2012/oleksandr: . udf-head Message-ID: <20120518131215.CA4C5106564A@hub.freebsd.org> Author: oleksandr Date: Fri May 18 13:12:15 2012 New Revision: 235939 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=235939 Log: Added: soc2012/oleksandr/ soc2012/oleksandr/udf-head/ (props changed) - copied from r235938, mirror/FreeBSD/head/ From jhagewood at FreeBSD.org Sat May 19 03:38:05 2012 From: jhagewood at FreeBSD.org (jhagewood@FreeBSD.org) Date: Sat May 19 03:38:16 2012 Subject: socsvn commit: r235974 - in soc2012/jhagewood: . diff diff3 gabor_diff mdocml-1.9.9 sdiff Message-ID: <20120519033803.68EB2106566B@hub.freebsd.org> Author: jhagewood Date: Sat May 19 03:38:02 2012 New Revision: 235974 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=235974 Log: First import. Added: soc2012/jhagewood/Milestones soc2012/jhagewood/diff/ soc2012/jhagewood/diff/Makefile soc2012/jhagewood/diff/diff (contents, props changed) soc2012/jhagewood/diff/diff.1 soc2012/jhagewood/diff/diff.1.gz (contents, props changed) soc2012/jhagewood/diff/diff.c soc2012/jhagewood/diff/diff.h soc2012/jhagewood/diff/diffdir.c soc2012/jhagewood/diff/diffreg.c soc2012/jhagewood/diff/pathnames.h soc2012/jhagewood/diff3/ soc2012/jhagewood/diff3/Makefile soc2012/jhagewood/diff3/diff3.1 soc2012/jhagewood/diff3/diff3.ksh soc2012/jhagewood/diff3/diff3.sh soc2012/jhagewood/diff3/diff3prog.c soc2012/jhagewood/gabor_diff/ soc2012/jhagewood/gabor_diff/Makefile soc2012/jhagewood/gabor_diff/diff.1 soc2012/jhagewood/gabor_diff/diff.c soc2012/jhagewood/gabor_diff/diff.h soc2012/jhagewood/gabor_diff/diffdir.c soc2012/jhagewood/gabor_diff/diffreg.c soc2012/jhagewood/gabor_diff/pathnames.h soc2012/jhagewood/mdocml-1.9.9/ soc2012/jhagewood/mdocml-1.9.9/ChangeLog.xsl (contents, props changed) 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 (contents, props changed) 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/sdiff/ soc2012/jhagewood/sdiff/Makefile soc2012/jhagewood/sdiff/common.c soc2012/jhagewood/sdiff/common.h soc2012/jhagewood/sdiff/edit.c soc2012/jhagewood/sdiff/extern.h soc2012/jhagewood/sdiff/sdiff.1 soc2012/jhagewood/sdiff/sdiff.c soc2012/jhagewood/svn-commit.2.tmp soc2012/jhagewood/svn-commit.tmp Added: soc2012/jhagewood/Milestones ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/Milestones Sat May 19 03:38:02 2012 (r235974) @@ -0,0 +1,30 @@ +May 21 - June 17 + + Implement all missing features of mdocml, including legacy features. + Testing of mdocml. + +June 18 - July 1 + + Complete diff + Debugging and testing of diff + +July 2 - July 18 + + Mid-term evaluations. + Complete sdiff + Debugging and testing of sdiff + +July 19 - August 5 + + Complete diff3 + Debugging and testing of diff3 + +August 6 ? August 12 + + Thouroughly test and benchmark all utilities. + +August 13 - August 20 + + "Pencils down" period. + Finish cleaning up code and do any testing that might be left. + Write documentation. Added: soc2012/jhagewood/diff/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/diff/Makefile Sat May 19 03:38:02 2012 (r235974) @@ -0,0 +1,10 @@ +# $FreeBSD$ +# $OpenBSD: Makefile,v 1.2 2003/06/25 02:42:50 deraadt Exp $ + +DEBUG_FLAGS+= -g + +PROG= diff +SRCS= diff.c diffdir.c diffreg.c +CFLAGS+= -std=c99 -Wall -pedantic + +.include Added: soc2012/jhagewood/diff/diff ============================================================================== Binary file. No diff available. Added: soc2012/jhagewood/diff/diff.1 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/diff/diff.1 Sat May 19 03:38:02 2012 (r235974) @@ -0,0 +1,511 @@ +.\" $FreeBSD$ +.\" $OpenBSD: diff.1,v 1.33 2007/05/31 19:20:09 jmc Exp $ +.\" +.\" Copyright (c) 1980, 1990, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. 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. +.\" +.\" @(#)diff.1 8.1 (Berkeley) 6/30/93 +.\" +.Dd Apr 7, 2008 +.Dt DIFF 1 +.Os +.Sh NAME +.Nm diff +.Nd differential file and directory comparator +.Sh SYNOPSIS +.Nm diff +.Op Fl abdilpqTtw +.Op Fl I Ar pattern +.Oo +.Fl c | e | f | +.Fl n | u +.Oc +.Op Fl L Ar label +.Ar file1 file2 +.Nm diff +.Op Fl abdilpqTtw +.Op Fl I Ar pattern +.Op Fl L Ar label +.Fl C Op Ar number +.Ar file1 file2 +.Nm diff +.Op Fl abdilqtw +.Op Fl I Ar pattern +.Fl D Ar string +.Ar file1 file2 +.Nm diff +.Op Fl abdilpqTtw +.Op Fl I Ar pattern +.Op Fl L Ar label +.Fl U Ar number +.Ar file1 file2 +.Nm diff +.Op Fl abdilNPpqrsTtw +.Op Fl I Ar pattern +.Oo +.Fl c | e | f | +.Fl n | u +.Oc +.Bk -words +.Op Fl L Ar label +.Op Fl S Ar name +.Op Fl X Ar file +.Op Fl x Ar pattern +.Ek +.Ar dir1 dir2 +.Nm diff +.Op Fl v +.Sh DESCRIPTION +The +.Nm +utility compares the contents of +.Ar file1 +and +.Ar file2 +and writes to the standard output the list of changes necessary to +convert one file into the other. +No output is produced if the files are identical. +.Pp +Output options (mutually exclusive): +.Bl -tag -width Ds +.It Fl C Op Ar number , Fl Fl context Ns = Ns Op Ar number +Like +.Fl c +but produces a diff with +.Ar number +lines of context. +.It Fl c +Produces a diff with 3 lines of context. +With +.Fl c +the output format is modified slightly: +the output begins with identification of the files involved and +their creation dates and then each change is separated +by a line with fifteen +.Li * Ns 's . +The lines removed from +.Ar file1 +are marked with +.Sq \&-\ \& ; +those added to +.Ar file2 +are marked +.Sq \+\ \& . +Lines which are changed from one file to the other are marked in +both files with +.Sq !\ \& . +Changes which lie within 3 lines of each other are grouped together on +output. +.It Fl D Ar string , Fl Fl ifdef Ns = Ns Ar string +Creates a merged version of +.Ar file1 +and +.Ar file2 +on the standard output, with C preprocessor controls included so that +a compilation of the result without defining +.Ar string +is equivalent to compiling +.Ar file1 , +while defining +.Ar string +will yield +.Ar file2 . +.It Fl e , Fl Fl ed +Produces output in a form suitable as input for the editor utility, +.Xr ed 1 , +which can then be used to convert file1 into file2. +.Pp +Extra commands are added to the output when comparing directories with +.Fl e , +so that the result is a +.Xr sh 1 +script for converting text files which are common to the two directories +from their state in +.Ar dir1 +to their state in +.Ar dir2 . +.It Fl f +Identical output to that of the +.Fl e +flag, but in reverse order. +It cannot be digested by +.Xr ed 1 . +.It Fl n , Fl Fl rcs +Produces a script similar to that of +.Fl e , +but in the opposite order and with a count of changed lines on each +insert or delete command. +This is the form used by +.Xr rcsdiff 1 . +.It Fl q , Fl Fl brief +Just print a line when the files differ. +Does not output a list of changes. +.It Fl U Op Ar number , Fl Fl unified Ns = Ns Op Ar number +Like +.Fl u +but produces a diff with +.Ar number +lines of context. +.It Fl u +Produces a +.Em unified +diff with 3 lines of context. +A unified diff is similar to the context diff produced by the +.Fl c +option. +However, unlike with +.Fl c , +all lines to be changed (added and/or removed) are present in +a single section. +.El +.Pp +Comparison options: +.Bl -tag -width Ds +.It Fl a , Fl Fl text +Treat all files as +.Tn ASCII +text. +Normally +.Nm +will simply print +.Dq Binary files ... differ +if files contain binary characters. +Use of this option forces +.Nm +to produce a diff. +.It Fl b , Fl Fl ignore-space-change +Causes trailing blanks (spaces and tabs) to be ignored, and other +strings of blanks to compare equal. +.It Fl d , Fl Fl minimal +Try very hard to produce a diff as small as possible. +This may consume a lot of processing power and memory when processing +large files with many changes. +.It Fl I Ar pattern , Fl Fl ignore-matching-lines Ns = Ns Ar pattern +Ignores changes, insertions, and deletions whose lines match the +extended regular expression +.Ar pattern . +Multiple +.Fl I +patterns may be specified. +All lines in the change must match some pattern for the change to be +ignored. +See +.Xr re_format 7 +for more information on regular expression patterns. +.It Fl i , Fl Fl ignore-case +Ignores the case of letters. +E.g., +.Dq A +will compare equal to +.Dq a . +.It Fl L Ar label +Print +.Ar label +instead of the first (and second, if this option is specified twice) +file name and time in the context or unified diff header. +.It Fl l , Fl Fl paginate +Long output format; each text file +.Nm diff Ns \'d +is piped through +.Xr pr 1 +to paginate it; +other differences are remembered and summarized +after all text file differences are reported. +.It Fl p , Fl Fl show-c-function +With unified and context diffs, show with each change +the first 40 characters of the last line before the context beginning +with a letter, an underscore or a dollar sign. +For C source code following standard layout conventions, this will +show the prototype of the function the change applies to. +.It Fl T , Fl Fl initial-tab +Print a tab rather than a space before the rest of the line for the +normal, context or unified output formats. +This makes the alignment of tabs in the line consistent. +.It Fl t , Fl Fl expand-tabs +Will expand tabs in output lines. +Normal or +.Fl c +output adds character(s) to the front of each line which may screw up +the indentation of the original source lines and make the output listing +difficult to interpret. +This option will preserve the original source's indentation. +.It Fl w , Fl Fl ignore-all-space +Is similar to +.Fl b +but causes whitespace (blanks and tabs) to be totally ignored. +E.g., +.Dq if (\ \&a == b \&) +will compare equal to +.Dq if(a==b) . +.El +.Pp +Directory comparison options: +.Bl -tag -width Ds +.It Fl N , Fl Fl new-file +If a file is found in only one directory, act as if it was found in the +other directory too but was of zero size. +.It Fl P +If a file is found only in +.Ar dir2 , +act as if it was found in +.Ar dir1 +too but was of zero size. +.It Fl r , Fl Fl recursive +Causes application of +.Nm +recursively to common sub7 directories encountered. +.It Fl S Ar name , Fl starting-file Ns = Ns Ar name +Re-starts a directory +.Nm +in the middle, beginning with file +.Ar name . +.It Fl s , Fl Fl report-identical-files +Causes +.Nm +to report files which are the same, which are otherwise not mentioned. +.It Fl X Ar file , Fl Fl exclude-from Ns = Ns Ar file +Exclude files and subdirectories from comparison whose basenames match +lines in +.Ar file . +Multiple +.Fl X +options may be specified. +.It Fl x Ar pattern , Fl Fl exclude Ns = Ns Ar pattern +Exclude files and subdirectories from comparison whose basenames match +.Ar pattern . +Patterns are matched using shell-style globbing via +.Xr fnmatch 3 . +Multiple +.Fl x +options may be specified. +.It Fl v , Fl Fl version +Print version ino. +.El +.Pp +If both arguments are directories, +.Nm +sorts the contents of the directories by name, and then runs the +regular file +.Nm +algorithm, producing a change list, +on text files which are different. +Binary files which differ, +common subdirectories, and files which appear in only one directory +are described as such. +In directory mode only regular files and directories are compared. +If a non-regular file such as a device special file or +.Tn FIFO +is encountered, a diagnostic message is printed. +.Pp +If only one of +.Ar file1 +and +.Ar file2 +is a directory, +.Nm +is applied to the non-directory file and the file contained in +the directory file with a filename that is the same as the +last component of the non-directory file. +.Pp +If either +.Ar file1 +or +.Ar file2 +is +.Sq Fl , +the standard input is +used in its place. +.Ss Output Style +The default (without +.Fl e , +.Fl c , +or +.Fl n +.\" -C +options) +output contains lines of these forms, where +.Va XX , YY , ZZ , QQ +are line numbers respective of file order. +.Pp +.Bl -tag -width "XX,YYcZZ,QQ" -compact +.It Li XX Ns Ic a Ns Li YY +At (the end of) line +.Va XX +of +.Ar file1 , +append the contents +of line +.Va YY +of +.Ar file2 +to make them equal. +.It Li XX Ns Ic a Ns Li YY,ZZ +Same as above, but append the range of lines, +.Va YY +through +.Va ZZ +of +.Ar file2 +to line +.Va XX +of file1. +.It Li XX Ns Ic d Ns Li YY +At line +.Va XX +delete +the line. +The value +.Va YY +tells to which line the change would bring +.Ar file1 +in line with +.Ar file1 . +.It Li XX,YY Ns Ic d Ns Li ZZ +Delete the range of lines +.Va XX +through +.Va YY +in +.Ar file1 . +.It Li XX Ns Ic c Ns Li YY +Change the line +.Va XX +in +.Ar file1 +to the line +.Va YY +in +.Ar file2 . +.It Li XX,YY Ns Ic c Ns Li ZZ +Replace the range of specified lines with the line +.Va ZZ . +.It Li XX,YY Ns Ic c Ns Li ZZ,QQ +Replace the range +.Va XX , Ns Va YY +from +.Ar file1 +with the range +.Va ZZ , Ns Va QQ +from +.Ar file2 . +.El +.Pp +These lines resemble +.Xr ed 1 +subcommands to convert +.Ar file1 +into +.Ar file2 . +The line numbers before the action letters pertain to +.Ar file1 ; +those after pertain to +.Ar file2 . +Thus, by exchanging +.Ic a +for +.Ic d +and reading the line in reverse order, one can also +determine how to convert +.Ar file2 +into +.Ar file1 . +As in +.Xr ed 1 , +identical +pairs (where num1 = num2) are abbreviated as a single +number. +.Sh ENVIRONMENT +.Bl -tag -width TMPDIR +.It Ev TMPDIR +If the environment variable +.Ev TMPDIR +exists, +.Nm +will use the directory specified by +.Ev TMPDIR +as the temporary directory. +.El +.Sh FILES +.Bl -tag -width /tmp/diff.XXXXXXXX -compact +.It Pa /tmp/diff. Ns Ar XXXXXXXX +Temporary file used when comparing a device or the standard input. +Note that the temporary file is unlinked as soon as it is created +so it will not show up in a directory listing. +.El +.Sh DIAGNOSTICS +The +.Nm +utility exits with one of the following values: +.Pp +.Bl -tag -width Ds -compact -offset indent +.It 0 +No differences were found. +.It 1 +Differences were found. +.It \*(Gt1 +An error occurred. +.El +.Sh SEE ALSO +.Xr cmp 1 , +.Xr comm 1 , +.Xr diff3 1 , +.Xr ed 1 , +.Xr pr 1 , +.Xr sdiff 1 , +.Xr fnmatch 3 , +.Xr re_format 7 +.Sh STANDARDS +The +.Nm +utility is compliant with the +St -p1003.1-2004 +specification. +.Pp +The flags +.Op Fl aDdIiLlNnPpqSsTtUuwXx +are extensions to that specification. +.Sh HISTORY +A +.Nm +command appeared in +.At v6 . +.Sh BUGS +When comparing directories with the +.Fl b , +.Fl w +or +.Fl i +options specified, +.Nm +first compares the files ala +.Xr cmp 1 , +and then decides to run the +.Nm +algorithm if they are not equal. +This may cause a small amount of spurious output if the files +then turn out to be identical because the only differences are +insignificant whitespace or case differences. Added: soc2012/jhagewood/diff/diff.1.gz ============================================================================== Binary file. No diff available. Added: soc2012/jhagewood/diff/diff.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/diff/diff.c Sat May 19 03:38:02 2012 (r235974) @@ -0,0 +1,599 @@ +/*- + * Copyright (c) 2003 Todd C. Miller + * + * 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. + * + * Sponsored in part by the Defense Advanced Research Projects + * Agency (DARPA) and Air Force Research Laboratory, Air Force + * Materiel Command, USAF, under agreement number F39502-99-1-0512. + */ + +#include + +#ifndef lint +#if 0 +__RCSID("$OpenBSD: diff.c,v 1.50 2007/05/29 18:24:56 ray Exp $"); +#else +__FBSDID("$FreeBSD$"); +#endif +#endif /* not lint */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "diff.h" +#include "pathnames.h" + +int aflag, bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag; +int sflag, tflag, Tflag, wflag; +int Bflag, yflag; +int strip_cr, tabsize=8; +char ignore_file_case = 0; +int format, context, status; +char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; +struct stat stb1, stb2; +struct excludes *excludes_list; +regex_t ignore_re; + +int flag_opts = 0; + +#define OPTIONS "0123456789aBbC:cdD:efhI:iL:lnNPpqrS:sTtU:uvwXy:x" + + +/* Options which exceed manageable alphanumeric assignments */ +enum +{ + OPT_IGN_FN_CASE = CHAR_MAX + 1, + OPT_NIGN_FN_CASE, + OPT_STRIPCR, + OPT_NORMAL, + OPT_LEFTC, + OT_SUPCL, + OPT_GTYPE, + OPT_LF, + OPT_LLF, + OPT_TSIZE, + OPT_UNINF, + OPT_FFILE, + OPT_TOFILE, + OPT_HLINES, + OPT_LFILES, + OPT_HELP, +}; + + +static struct option longopts[] = { +/* XXX: UNIMPLEMENTED + { "normal", no_argument, NULL, OPT_NORMAL }, + { "left-column", no_argument, NULL, OPT_LEFTC }, + { "suppress-common-lines", no_argument, NULL, OT_SUPCL }, + { "GTYPE-group-format", required_argument, NULL, OPT_GTYPE }, + { "line-format", required_argument, NULL, OPT_LF }, + { "LTYPE-line-format", required_argument, NULL, OPT_LLF }, + { "unidirectional-new-file", no_argument, NULL, OPT_UNINF }, + { "from-file", required_argument, NULL, OPT_FFILE }, + { "to-file", required_argument, NULL, OPT_TOFILE }, + { "horizon-lines", required_argument, NULL, OPT_HLINES }, + { "speed-large-files", no_argument, NULL, OPT_LFILES }, */ + { "tabsize", optional_argument, NULL, OPT_TSIZE }, + { "strip-trailing-cr", no_argument, NULL, OPT_STRIPCR }, + { "help", no_argument, NULL, OPT_HELP }, + { "ignore-file-name-case", no_argument, NULL, OPT_IGN_FN_CASE }, + { "no-ignore-file-name-case", no_argument, NULL, OPT_NIGN_FN_CASE }, + { "text", no_argument, NULL, 'a' }, +/* XXX: UNIMPLEMENTED */ + { "ignore-blank-lines", no_argument, NULL, 'B' }, + { "ignore-space-change", no_argument, NULL, 'b' }, +/* XXX: -c is incompatible with GNU version */ + { "context", optional_argument, NULL, 'C' }, + { "ifdef", required_argument, NULL, 'D' }, + { "minimal", no_argument, NULL, 'd' }, +/* XXX: UNIMPLEMENTED + { "ignore-tab-expansion", no_argument, NULL, 'E' }, */ + { "ed", no_argument, NULL, 'e' }, +/* XXX: UNIMPLEMENTED + { "show-function-line", required_argument, NULL, 'F' }, */ + { "forward-ed", no_argument, NULL, 'f' }, + { "ignore-matching-lines", required_argument, NULL, 'I' }, + { "ignore-case", no_argument, NULL, 'i' }, + { "label", required_argument, NULL, 'L' }, + { "paginate", no_argument, NULL, 'l' }, + { "new-file", no_argument, NULL, 'N' }, + { "rcs", no_argument, NULL, 'n' }, + { "unidirectional-new-file", no_argument, NULL, 'P' }, + { "show-c-function", no_argument, NULL, 'p' }, + { "brief", no_argument, NULL, 'q' }, + { "recursive", no_argument, NULL, 'r' }, + { "starting-file", required_argument, NULL, 'S' }, + { "report-identical-files", no_argument, NULL, 's' }, + { "initial-tab", no_argument, NULL, 'T' }, + { "expand-tabs", no_argument, NULL, 't' }, +/* XXX: -u is incompatible with GNU version */ + { "unified", optional_argument, NULL, 'U' }, + { "version", no_argument, NULL, 'v' }, +/* XXX: UNIMPLEMENTED + { "width", optional_argument, NULL, 'W' }, */ + { "ignore-all-space", no_argument, NULL, 'w' }, + { "exclude-from", required_argument, NULL, 'X' }, + { "exclude", required_argument, NULL, 'x' }, + { "side-by-side", no_argument, NULL, 'y' }, + { NULL, 0, NULL, '\0'} +}; + +static const char *help_msg[] = { +"-a --text treat files as ASCII text", +"-B --ignore-blank-lines Ignore blank newlines in the comparison", +"-b --ignore-space-change Ignore all changes due to whitespace", +"-C NUM --context=[NUM] Show NUM lines before and after change (default 3)", +"-D --ifdef=NAME", +NULL, +}; +char **help_strs = (char **)help_msg; + +void set_argstr(char **, char **); + + +void usage(void); +void push_excludes(char *); +void push_ignore_pats(char *); +void read_excludes_file(char *); + +int +main(int argc, char **argv) +{ + char *ep, **oargv; + long l; + int ch, lastch, gotstdin, prevoptind, newarg; + int oargc; + + oargv = argv; + oargc = argc; + gotstdin = 0; + + lastch = '\0'; + prevoptind = 1; + newarg = 1; + while ((ch = getopt_long(argc, argv, OPTIONS, longopts, NULL)) != -1) { + switch (ch) { + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + if (newarg) + usage(); /* disallow -[0-9]+ */ + else if (lastch == 'c' || lastch == 'u') + context = 0; + else if (!isdigit(lastch) || context > INT_MAX / 10) + usage(); + context = (context * 10) + (ch - '0'); + break; + case 'a': + aflag = 1; + break; + case 'b': + bflag = 1; + break; + case 'B': + Bflag = 1; + break; + case 'C': + case 'c': + format = D_CONTEXT; + if (optarg != NULL) { + l = strtol(optarg, &ep, 10); + if (*ep != '\0' || l < 0 || l >= INT_MAX) + usage(); + context = (int)l; + } else + context = 3; + break; + case 'D': + format = D_IFDEF; + ifdefname = optarg; + break; + case 'd': + dflag = 1; + break; + case 'e': + format = D_EDIT; + break; + case 'f': + format = D_REVERSE; + break; + case 'h': + /* silently ignore for backwards compatibility */ + break; + case 'I': + push_ignore_pats(optarg); + break; + case 'i': + iflag = 1; + break; + case 'L': + if (label[0] == NULL) + label[0] = optarg; + else if (label[1] == NULL) + label[1] = optarg; + else + usage(); + break; + case 'l': + lflag = 1; + signal(SIGPIPE, SIG_IGN); + break; + case 'N': + Nflag = 1; + break; + case 'n': + format = D_NREVERSE; + break; + case 'P': + Pflag = 1; + break; + case 'p': + pflag = 1; + break; + case 'r': + rflag = 1; + break; + case 'q': + format = D_BRIEF; + break; + case 'S': + start = optarg; + break; + case 's': + sflag = 1; + break; + case 'T': + Tflag = 1; + break; + case 't': + tflag = 1; + break; + case 'U': + case 'u': + format = D_UNIFIED; + if (optarg != NULL) { + l = strtol(optarg, &ep, 10); + if (*ep != '\0' || l < 0 || l >= INT_MAX) + usage(); + context = (int)l; + } else + context = 3; + break; + case 'v': + printf("FreeBSD diff 2.8.7\n"); + exit(0); + case 'w': + wflag = 1; + break; + case 'X': + read_excludes_file(optarg); + break; + case 'x': + push_excludes(optarg); + break; + case 'y': + yflag = 1; + break; + case OPT_TSIZE: + if (optarg != NULL) { + l = strtol(optarg, &ep, 10); + if (*ep != '\0' || l < 1 || l >= INT_MAX) + usage(); + tabsize = (int)l; + } else + tabsize = 8; + break; + case OPT_STRIPCR: + strip_cr=1; + break; + case OPT_IGN_FN_CASE: + ignore_file_case = 1; + break; + case OPT_NIGN_FN_CASE: + ignore_file_case = 0; + break; + case OPT_HELP: + for(;*help_strs;help_strs++) + { + printf("%s\n", *help_strs); + } + exit(2); + break; + default: + usage(); + break; + } + lastch = ch; + newarg = optind != prevoptind; + prevoptind = optind; + } + argc -= optind; + argv += optind; + + if(yflag) { + /* remove y flag from args and call sdiff */ + for(argv=oargv; argv && strcmp(*argv, "-y") != 0; argv++); + while(argv != &oargv[oargc]){ + *argv=*(argv+1); + argv++; + } + oargv[0] = _PATH_SDIFF; + *argv= "\0"; + + execv(_PATH_SDIFF, oargv); + _exit(127); + } + + /* + * Do sanity checks, fill in stb1 and stb2 and call the appropriate + * driver routine. Both drivers use the contents of stb1 and stb2. + */ + if (argc != 2) + usage(); + if (ignore_pats != NULL) { + char buf[BUFSIZ]; + int error; + + if ((error = regcomp(&ignore_re, ignore_pats, + REG_NEWLINE | REG_EXTENDED)) != 0) { + regerror(error, &ignore_re, buf, sizeof(buf)); + if (*ignore_pats != '\0') + errx(2, "%s: %s", ignore_pats, buf); + else + errx(2, "%s", buf); + } + } + if (strcmp(argv[0], "-") == 0) { + fstat(STDIN_FILENO, &stb1); + gotstdin = 1; + } else if (stat(argv[0], &stb1) != 0) + err(2, "%s", argv[0]); + if (strcmp(argv[1], "-") == 0) { + fstat(STDIN_FILENO, &stb2); + gotstdin = 1; + } else if (stat(argv[1], &stb2) != 0) + err(2, "%s", argv[1]); + if (gotstdin && (S_ISDIR(stb1.st_mode) || S_ISDIR(stb2.st_mode))) + errx(2, "can't compare - to a directory"); + set_argstr(oargv, argv); + if (S_ISDIR(stb1.st_mode) && S_ISDIR(stb2.st_mode)) { + if (format == D_IFDEF) + errx(2, "-D option not supported with directories"); + diffdir(argv[0], argv[1]); + } else { + if (S_ISDIR(stb1.st_mode)) { + argv[0] = splice(argv[0], argv[1]); + if (stat(argv[0], &stb1) < 0) + err(2, "%s", argv[0]); + } + if (S_ISDIR(stb2.st_mode)) { + argv[1] = splice(argv[1], argv[0]); + if (stat(argv[1], &stb2) < 0) + err(2, "%s", argv[1]); + } + print_status(diffreg(argv[0], argv[1], 0), argv[0], argv[1], + NULL); + } + exit(status); +} + +void * +emalloc(size_t n) +{ + void *p; + + if (n == 0) + errx(2, NULL); + + if ((p = malloc(n)) == NULL) + errx(2, NULL); + return (p); +} + +void * +erealloc(void *p, size_t n) +{ + void *q; + + if (n == 0) + errx(2, NULL); + if (p == NULL) + q = malloc(n); + else + q = realloc(p, n); + if (q == NULL) + errx(2, NULL); + return (q); +} + +int +easprintf(char **ret, const char *fmt, ...) +{ + int len; + va_list ap; + + va_start(ap, fmt); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From jhagewood at FreeBSD.org Sat May 19 03:40:49 2012 From: jhagewood at FreeBSD.org (jhagewood@FreeBSD.org) Date: Sat May 19 03:40:55 2012 Subject: socsvn commit: r235975 - soc2012/jhagewood Message-ID: <20120519034048.C1CB01065672@hub.freebsd.org> Author: jhagewood Date: Sat May 19 03:40:48 2012 New Revision: 235975 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=235975 Log: Deleted: soc2012/jhagewood/svn-commit.2.tmp From jhagewood at FreeBSD.org Sat May 19 03:41:02 2012 From: jhagewood at FreeBSD.org (jhagewood@FreeBSD.org) Date: Sat May 19 03:41:07 2012 Subject: socsvn commit: r235976 - soc2012/jhagewood Message-ID: <20120519034101.54525106566B@hub.freebsd.org> Author: jhagewood Date: Sat May 19 03:41:01 2012 New Revision: 235976 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=235976 Log: Deleted: soc2012/jhagewood/svn-commit.tmp From scher at FreeBSD.org Mon May 21 10:35:13 2012 From: scher at FreeBSD.org (scher@FreeBSD.org) Date: Mon May 21 10:35:20 2012 Subject: socsvn commit: r236058 - soc2012/scher/par_ports/head/Mk Message-ID: <20120521103510.C787B106564A@hub.freebsd.org> 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 aleek at FreeBSD.org Mon May 21 15:04:34 2012 From: aleek at FreeBSD.org (aleek@FreeBSD.org) Date: Mon May 21 15:04:39 2012 Subject: socsvn commit: r236063 - in soc2012/aleek/beaglexm-armv6: lib/libc lib/libc/arm/gen sys sys/arm/conf Message-ID: <20120521150432.2C1AC106566B@hub.freebsd.org> 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 aleek at FreeBSD.org Mon May 21 15:22:29 2012 From: aleek at FreeBSD.org (aleek@FreeBSD.org) Date: Mon May 21 15:22:35 2012 Subject: socsvn commit: r236064 - in soc2012/aleek/beaglexm-armv6/sys/arm: conf ti/am37xx ti/omap3 Message-ID: <20120521152227.0378E1065674@hub.freebsd.org> 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 emc2 at FreeBSD.org Mon May 21 17:13:57 2012 From: emc2 at FreeBSD.org (emc2@FreeBSD.org) Date: Mon May 21 17:14:13 2012 Subject: socsvn commit: r236068 - soc2012/emc2 Message-ID: <20120521171356.D396B1065672@hub.freebsd.org> 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 emc2 at FreeBSD.org Mon May 21 17:17:49 2012 From: emc2 at FreeBSD.org (emc2@FreeBSD.org) Date: Mon May 21 17:17:56 2012 Subject: socsvn commit: r236069 - soc2012/emc2/head Message-ID: <20120521171748.AEABF106564A@hub.freebsd.org> 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 emc2 at FreeBSD.org Mon May 21 17:20:11 2012 From: emc2 at FreeBSD.org (emc2@FreeBSD.org) Date: Mon May 21 17:20:19 2012 Subject: socsvn commit: r236070 - soc2012/emc2/head Message-ID: <20120521172010.C835E1065741@hub.freebsd.org> 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 emc2 at FreeBSD.org Mon May 21 17:20:54 2012 From: emc2 at FreeBSD.org (emc2@FreeBSD.org) Date: Mon May 21 17:20:59 2012 Subject: socsvn commit: r236071 - soc2012/emc2/head Message-ID: <20120521172052.E35E4106566B@hub.freebsd.org> 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 scher at FreeBSD.org Mon May 21 21:25:32 2012 From: scher at FreeBSD.org (scher@FreeBSD.org) Date: Mon May 21 21:25:39 2012 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... Message-ID: <20120521212530.A6D9E1065670@hub.freebsd.org> 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 rudot at FreeBSD.org Tue May 22 09:38:50 2012 From: rudot at FreeBSD.org (rudot@FreeBSD.org) Date: Tue May 22 09:38:57 2012 Subject: socsvn commit: r236124 - in soc2012/rudot/sys: . kern Message-ID: <20120522093848.3044E106564A@hub.freebsd.org> 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 oleksandr at FreeBSD.org Tue May 22 10:16:21 2012 From: oleksandr at FreeBSD.org (oleksandr@FreeBSD.org) Date: Tue May 22 10:16:28 2012 Subject: socsvn commit: r236127 - soc2012/oleksandr/udf-head/sys/fs/udf2 Message-ID: <20120522101619.EF66B106566B@hub.freebsd.org> 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< 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 rudot at FreeBSD.org Tue May 22 11:53:25 2012 From: rudot at FreeBSD.org (rudot@FreeBSD.org) Date: Tue May 22 11:53:32 2012 Subject: socsvn commit: r236131 - in soc2012/rudot/aux: . config Message-ID: <20120522115322.EFB0F1065674@hub.freebsd.org> 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 rudot at FreeBSD.org Tue May 22 12:31:10 2012 From: rudot at FreeBSD.org (rudot@FreeBSD.org) Date: Tue May 22 12:31:16 2012 Subject: socsvn commit: r236133 - soc2012/rudot/sys/sys Message-ID: <20120522123108.1BA6A106564A@hub.freebsd.org> 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 jhagewood at FreeBSD.org Tue May 22 17:05:10 2012 From: jhagewood at FreeBSD.org (jhagewood@FreeBSD.org) Date: Tue May 22 17:05:16 2012 Subject: socsvn commit: r236144 - soc2012/jhagewood/mdocml-1.9.9 Message-ID: <20120522170509.49ECC106575C@hub.freebsd.org> 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 jhagewood at FreeBSD.org Tue May 22 17:07:44 2012 From: jhagewood at FreeBSD.org (jhagewood@FreeBSD.org) Date: Tue May 22 17:07:51 2012 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 Message-ID: <20120522170742.DB9FA1065674@hub.freebsd.org> 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 gpf at FreeBSD.org Tue May 22 18:20:41 2012 From: gpf at FreeBSD.org (gpf@FreeBSD.org) Date: Tue May 22 18:20:48 2012 Subject: socsvn commit: r236147 - soc2012/gpf/pefs_kmod/sbin/pefs Message-ID: <20120522182039.3200E106564A@hub.freebsd.org> 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 jhagewood at FreeBSD.org Tue May 22 19:19:15 2012 From: jhagewood at FreeBSD.org (jhagewood@FreeBSD.org) Date: Tue May 22 19:19:22 2012 Subject: socsvn commit: r236154 - soc2012/jhagewood/mdocml-1.9.9 Message-ID: <20120522191914.B26F91065673@hub.freebsd.org> 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 jhagewood at FreeBSD.org Tue May 22 19:19:22 2012 From: jhagewood at FreeBSD.org (jhagewood@FreeBSD.org) Date: Tue May 22 19:19:28 2012 Subject: socsvn commit: r236155 - soc2012/jhagewood/mdocml-1.9.9-orig Message-ID: <20120522191921.918091065672@hub.freebsd.org> 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 jhagewood at FreeBSD.org Tue May 22 19:20:28 2012 From: jhagewood at FreeBSD.org (jhagewood@FreeBSD.org) Date: Tue May 22 19:20:33 2012 Subject: socsvn commit: r236156 - soc2012/jhagewood/mdocml_patches/1.9.9_patches Message-ID: <20120522192026.D4BE71065673@hub.freebsd.org> 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 jhagewood at FreeBSD.org Tue May 22 19:20:36 2012 From: jhagewood at FreeBSD.org (jhagewood@FreeBSD.org) Date: Tue May 22 19:20:42 2012 Subject: socsvn commit: r236157 - soc2012/jhagewood/mdocml_patches/old Message-ID: <20120522192035.4692D106566C@hub.freebsd.org> 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 jhagewood at FreeBSD.org Tue May 22 19:23:49 2012 From: jhagewood at FreeBSD.org (jhagewood@FreeBSD.org) Date: Tue May 22 19:23:55 2012 Subject: socsvn commit: r236158 - soc2012/jhagewood/mdocml Message-ID: <20120522192348.2A6DA106566C@hub.freebsd.org> 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 jhagewood at FreeBSD.org Tue May 22 19:24:53 2012 From: jhagewood at FreeBSD.org (jhagewood@FreeBSD.org) Date: Tue May 22 19:25:02 2012 Subject: socsvn commit: r236159 - in soc2012/jhagewood/mdocml: . mdocml-1.12.1 mdocml-1.12.1-orig mdocml_patches Message-ID: <20120522192450.F1E801065670@hub.freebsd.org> 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 jhagewood at FreeBSD.org Tue May 22 19:27:58 2012 From: jhagewood at FreeBSD.org (jhagewood@FreeBSD.org) Date: Tue May 22 19:28:04 2012 Subject: socsvn commit: r236160 - soc2012/jhagewood/mdocml_patches Message-ID: <20120522192757.AF32F106564A@hub.freebsd.org> 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 jhagewood at FreeBSD.org Tue May 22 19:34:56 2012 From: jhagewood at FreeBSD.org (jhagewood@FreeBSD.org) Date: Tue May 22 19:35:02 2012 Subject: socsvn commit: r236161 - soc2012/jhagewood/mdocml/mdocml-1.12.1 Message-ID: <20120522193455.3CDF01065678@hub.freebsd.org> 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 jhagewood at FreeBSD.org Tue May 22 19:35:40 2012 From: jhagewood at FreeBSD.org (jhagewood@FreeBSD.org) Date: Tue May 22 19:35:48 2012 Subject: socsvn commit: r236162 - soc2012/jhagewood/mdocml/mdocml-1.12.1 Message-ID: <20120522193538.25A1F106564A@hub.freebsd.org> 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 vbotton at FreeBSD.org Tue May 22 20:24:16 2012 From: vbotton at FreeBSD.org (vbotton@FreeBSD.org) Date: Tue May 22 20:24:22 2012 Subject: socsvn commit: r236168 - soc2012/vbotton/ntfs_apple Message-ID: <20120522202414.1A8B9106566B@hub.freebsd.org> 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 emc2 at FreeBSD.org Wed May 23 03:56:08 2012 From: emc2 at FreeBSD.org (emc2@FreeBSD.org) Date: Wed May 23 03:56:15 2012 Subject: socsvn commit: r236184 - in soc2012/emc2/head/sys/boot/i386: . efi Message-ID: <20120523035606.9C487106566C@hub.freebsd.org> 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 rudot at FreeBSD.org Wed May 23 10:24:09 2012 From: rudot at FreeBSD.org (rudot@FreeBSD.org) Date: Wed May 23 10:24:16 2012 Subject: socsvn commit: r236191 - in soc2012/rudot: aux sys/kern sys/sys Message-ID: <20120523102407.9D0EE106566C@hub.freebsd.org> 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 rudot at FreeBSD.org Wed May 23 14:01:53 2012 From: rudot at FreeBSD.org (rudot@FreeBSD.org) Date: Wed May 23 14:01:59 2012 Subject: socsvn commit: r236200 - soc2012/rudot/aux/config Message-ID: <20120523140150.DA4F51065670@hub.freebsd.org> 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 rudot at FreeBSD.org Wed May 23 14:06:52 2012 From: rudot at FreeBSD.org (rudot@FreeBSD.org) Date: Wed May 23 14:06:59 2012 Subject: socsvn commit: r236201 - in soc2012/rudot/aux: . config Message-ID: <20120523140649.DC208106564A@hub.freebsd.org> 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 gpf at FreeBSD.org Wed May 23 14:45:42 2012 From: gpf at FreeBSD.org (gpf@FreeBSD.org) Date: Wed May 23 14:45:49 2012 Subject: socsvn commit: r236202 - soc2012/gpf/pefs_kmod/sbin/pefs Message-ID: <20120523144540.67E3B1065670@hub.freebsd.org> 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 gpf at FreeBSD.org Wed May 23 14:50:26 2012 From: gpf at FreeBSD.org (gpf@FreeBSD.org) Date: Wed May 23 14:50:33 2012 Subject: socsvn commit: r236203 - soc2012/gpf/pefs_kmod/sbin/pefs Message-ID: <20120523145024.9C77A106564A@hub.freebsd.org> 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 gpf at FreeBSD.org Wed May 23 14:58:15 2012 From: gpf at FreeBSD.org (gpf@FreeBSD.org) Date: Wed May 23 14:58:21 2012 Subject: socsvn commit: r236204 - soc2012/gpf/pefs_kmod/sbin/pefs Message-ID: <20120523145814.7D9A31065674@hub.freebsd.org> 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 scher at FreeBSD.org Wed May 23 17:03:03 2012 From: scher at FreeBSD.org (scher@FreeBSD.org) Date: Wed May 23 17:03:10 2012 Subject: socsvn commit: r236215 - soc2012/scher/par_ports/head/Mk Message-ID: <20120523170301.84956106564A@hub.freebsd.org> 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 gmiller at FreeBSD.org Wed May 23 17:05:22 2012 From: gmiller at FreeBSD.org (gmiller@FreeBSD.org) Date: Wed May 23 17:05:28 2012 Subject: socsvn commit: r236216 - soc2012/gmiller/locking-head/lib/libthr Message-ID: <20120523170520.179F8106566C@hub.freebsd.org> 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 scher at FreeBSD.org Wed May 23 20:47:09 2012 From: scher at FreeBSD.org (scher@FreeBSD.org) Date: Wed May 23 20:47:15 2012 Subject: socsvn commit: r236228 - soc2012/scher/par_ports/head/Mk Message-ID: <20120523204707.806D5106566C@hub.freebsd.org> 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 gpf at FreeBSD.org Wed May 23 20:59:33 2012 From: gpf at FreeBSD.org (gpf@FreeBSD.org) Date: Wed May 23 20:59:39 2012 Subject: socsvn commit: r236229 - soc2012/gpf/misc Message-ID: <20120523205931.AA7891065672@hub.freebsd.org> 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 gpf at FreeBSD.org Wed May 23 21:04:11 2012 From: gpf at FreeBSD.org (gpf@FreeBSD.org) Date: Wed May 23 21:04:18 2012 Subject: socsvn commit: r236233 - soc2012/gpf/pefs_kmod/sbin/pefs Message-ID: <20120523210409.11BDC1065672@hub.freebsd.org> 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 tzabal at FreeBSD.org Thu May 24 00:24:38 2012 From: tzabal at FreeBSD.org (tzabal@FreeBSD.org) Date: Thu May 24 00:24:44 2012 Subject: socsvn commit: r236241 - soc2012/tzabal/client-side Message-ID: <20120524002436.EDD32106566C@hub.freebsd.org> 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 tzabal at FreeBSD.org Thu May 24 00:45:02 2012 From: tzabal at FreeBSD.org (tzabal@FreeBSD.org) Date: Thu May 24 00:45:08 2012 Subject: socsvn commit: r236242 - soc2012/tzabal/client-side/akcrs-head Message-ID: <20120524004501.5A22E106566B@hub.freebsd.org> 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 gpf at FreeBSD.org Thu May 24 11:49:09 2012 From: gpf at FreeBSD.org (gpf@FreeBSD.org) Date: Thu May 24 11:49:14 2012 Subject: socsvn commit: r236273 - soc2012/gpf/pefs_kmod/sbin/pefs Message-ID: <20120524114906.F05D0106564A@hub.freebsd.org> 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 rudot at FreeBSD.org Thu May 24 12:44:20 2012 From: rudot at FreeBSD.org (rudot@FreeBSD.org) Date: Thu May 24 12:44:27 2012 Subject: socsvn commit: r236282 - soc2012/rudot/sys/kern Message-ID: <20120524124417.D3639106564A@hub.freebsd.org> 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 rudot at FreeBSD.org Thu May 24 14:13:44 2012 From: rudot at FreeBSD.org (rudot@FreeBSD.org) Date: Thu May 24 14:13:50 2012 Subject: socsvn commit: r236291 - soc2012/rudot/aux/config Message-ID: <20120524141342.92657106564A@hub.freebsd.org> 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 gpf at FreeBSD.org Thu May 24 15:52:29 2012 From: gpf at FreeBSD.org (gpf@FreeBSD.org) Date: Thu May 24 15:52:36 2012 Subject: socsvn commit: r236293 - in soc2012/gpf/pefs_kmod: sbin/pefs sys/fs/pefs Message-ID: <20120524155226.EC033106564A@hub.freebsd.org> 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 gpf at FreeBSD.org Thu May 24 15:57:56 2012 From: gpf at FreeBSD.org (gpf@FreeBSD.org) Date: Thu May 24 15:58:03 2012 Subject: socsvn commit: r236294 - soc2012/gpf/misc Message-ID: <20120524155754.079AE106566B@hub.freebsd.org> 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 rudot at FreeBSD.org Thu May 24 16:10:33 2012 From: rudot at FreeBSD.org (rudot@FreeBSD.org) Date: Thu May 24 16:11:01 2012 Subject: socsvn commit: r236297 - soc2012/rudot/head Message-ID: <20120524161032.01793106564A@hub.freebsd.org> 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 rudot at FreeBSD.org Thu May 24 16:22:19 2012 From: rudot at FreeBSD.org (rudot@FreeBSD.org) Date: Thu May 24 16:22:26 2012 Subject: socsvn commit: r236298 - soc2012/rudot/sys/kern Message-ID: <20120524162217.E79951065686@hub.freebsd.org> 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 rudot at FreeBSD.org Thu May 24 16:23:22 2012 From: rudot at FreeBSD.org (rudot@FreeBSD.org) Date: Thu May 24 16:23:28 2012 Subject: socsvn commit: r236299 - soc2012/rudot/head Message-ID: <20120524162321.824441065670@hub.freebsd.org> 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 rudot at FreeBSD.org Thu May 24 16:36:56 2012 From: rudot at FreeBSD.org (rudot@FreeBSD.org) Date: Thu May 24 16:37:02 2012 Subject: socsvn commit: r236300 - in soc2012/rudot: aux sys/kern Message-ID: <20120524163654.B3A17106564A@hub.freebsd.org> 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 scher at FreeBSD.org Thu May 24 18:42:06 2012 From: scher at FreeBSD.org (scher@FreeBSD.org) Date: Thu May 24 18:42:13 2012 Subject: socsvn commit: r236308 - soc2012/scher/par_ports/head/Mk Message-ID: <20120524184204.C5E31106566C@hub.freebsd.org> 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 tzabal at FreeBSD.org Thu May 24 20:21:42 2012 From: tzabal at FreeBSD.org (tzabal@FreeBSD.org) Date: Thu May 24 20:21:51 2012 Subject: socsvn commit: r236316 - in soc2012/tzabal/client-side/akcrs-head/etc: defaults rc.d Message-ID: <20120524202140.8A0F91065672@hub.freebsd.org> 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 tzabal at FreeBSD.org Thu May 24 20:25:07 2012 From: tzabal at FreeBSD.org (tzabal@FreeBSD.org) Date: Thu May 24 20:25:13 2012 Subject: socsvn commit: r236317 - soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport Message-ID: <20120524202505.BFBE410656D5@hub.freebsd.org> 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 gpf at FreeBSD.org Thu May 24 20:28:09 2012 From: gpf at FreeBSD.org (gpf@FreeBSD.org) Date: Thu May 24 20:28:15 2012 Subject: socsvn commit: r236318 - in soc2012/gpf/pefs_kmod: sbin/pefs sys/fs/pefs sys/modules/pefs Message-ID: <20120524202807.3FD87106564A@hub.freebsd.org> 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 tzabal at FreeBSD.org Thu May 24 20:43:38 2012 From: tzabal at FreeBSD.org (tzabal@FreeBSD.org) Date: Thu May 24 20:43:44 2012 Subject: socsvn commit: r236319 - soc2012/tzabal/client-side/akcrs-head/etc/defaults Message-ID: <20120524204336.1B964106566B@hub.freebsd.org> 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 scher at FreeBSD.org Thu May 24 21:55:33 2012 From: scher at FreeBSD.org (scher@FreeBSD.org) Date: Thu May 24 21:55:38 2012 Subject: socsvn commit: r236325 - soc2012/scher/par_ports/head/packages Message-ID: <20120524215531.DB04A106564A@hub.freebsd.org> 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 scher at FreeBSD.org Thu May 24 22:30:30 2012 From: scher at FreeBSD.org (scher@FreeBSD.org) Date: Thu May 24 22:30:36 2012 Subject: socsvn commit: r236334 - in soc2012/scher/par_ports/head/fake_ports/with_deps: . fake1 fake2 Message-ID: <20120524223027.DC7A51065757@hub.freebsd.org> 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 gmiller at FreeBSD.org Thu May 24 22:46:09 2012 From: gmiller at FreeBSD.org (gmiller@FreeBSD.org) Date: Thu May 24 22:46:15 2012 Subject: socsvn commit: r236335 - soc2012/gmiller/locking-head/lib/libthr Message-ID: <20120524224607.1EAC41065672@hub.freebsd.org> 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 gpf at FreeBSD.org Fri May 25 14:19:38 2012 From: gpf at FreeBSD.org (gpf@FreeBSD.org) Date: Fri May 25 14:19:44 2012 Subject: socsvn commit: r236386 - soc2012/gpf/pefs_kmod/sbin/pefs Message-ID: <20120525141936.44D54106564A@hub.freebsd.org> 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 gpf at FreeBSD.org Fri May 25 16:26:09 2012 From: gpf at FreeBSD.org (gpf@FreeBSD.org) Date: Fri May 25 16:26:16 2012 Subject: socsvn commit: r236400 - in soc2012/gpf/pefs_kmod: sbin/pefs sys/fs/pefs sys/modules/pefs Message-ID: <20120525162607.7AB13106566C@hub.freebsd.org> 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 jhagewood at FreeBSD.org Fri May 25 17:29:53 2012 From: jhagewood at FreeBSD.org (jhagewood@FreeBSD.org) Date: Fri May 25 17:29:59 2012 Subject: socsvn commit: r236408 - soc2012/jhagewood/mdocml Message-ID: <20120525172952.6462A1065670@hub.freebsd.org> 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 jhagewood at FreeBSD.org Fri May 25 17:30:24 2012 From: jhagewood at FreeBSD.org (jhagewood@FreeBSD.org) Date: Fri May 25 17:30:30 2012 Subject: socsvn commit: r236409 - soc2012/jhagewood/mdocml Message-ID: <20120525173023.2DC8E106564A@hub.freebsd.org> 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 jhagewood at FreeBSD.org Fri May 25 17:31:48 2012 From: jhagewood at FreeBSD.org (jhagewood@FreeBSD.org) Date: Fri May 25 17:31:55 2012 Subject: socsvn commit: r236410 - in soc2012/jhagewood/mdocml: . mdocml-1.12.1 mdocml-1.12.1-orig mdocml_patches Message-ID: <20120525173145.CF94E1065680@hub.freebsd.org> 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 gmiller at FreeBSD.org Sat May 26 06:16:14 2012 From: gmiller at FreeBSD.org (gmiller@FreeBSD.org) Date: Sat May 26 06:17:33 2012 Subject: socsvn commit: r236445 - in soc2012/gmiller/locking-head: include lib/libthr/thread Message-ID: <20120526061612.B8670106564A@hub.freebsd.org> 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 rudot at FreeBSD.org Sat May 26 17:18:53 2012 From: rudot at FreeBSD.org (rudot@FreeBSD.org) Date: Sat May 26 17:18:59 2012 Subject: socsvn commit: r236507 - in soc2012/rudot: aux sys/kern Message-ID: <20120526171850.EDEB81065674@hub.freebsd.org> 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 tzabal at FreeBSD.org Sat May 26 21:09:43 2012 From: tzabal at FreeBSD.org (tzabal@FreeBSD.org) Date: Sat May 26 21:09:48 2012 Subject: socsvn commit: r236521 - soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport Message-ID: <20120526210941.1B292106566C@hub.freebsd.org> 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 From jhagewood at FreeBSD.org Sun May 27 04:03:06 2012 From: jhagewood at FreeBSD.org (jhagewood@FreeBSD.org) Date: Sun May 27 04:03:13 2012 Subject: socsvn commit: r236539 - soc2012/jhagewood/mdocml Message-ID: <20120527040304.E8582106566B@hub.freebsd.org> Author: jhagewood Date: Sun May 27 04:03:04 2012 New Revision: 236539 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236539 Log: Deleted: soc2012/jhagewood/mdocml/svn-commit.tmp From jhagewood at FreeBSD.org Sun May 27 04:04:56 2012 From: jhagewood at FreeBSD.org (jhagewood@FreeBSD.org) Date: Sun May 27 04:05:02 2012 Subject: socsvn commit: r236540 - soc2012/jhagewood/mdocml Message-ID: <20120527040455.313E6106566B@hub.freebsd.org> Author: jhagewood Date: Sun May 27 04:04:54 2012 New Revision: 236540 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236540 Log: Deleted: soc2012/jhagewood/mdocml/ From jhagewood at FreeBSD.org Sun May 27 04:06:11 2012 From: jhagewood at FreeBSD.org (jhagewood@FreeBSD.org) Date: Sun May 27 04:06:18 2012 Subject: socsvn commit: r236541 - in soc2012/jhagewood: . mdocml-1.12.1 mdocml-1.12.1-orig mdocml_patches Message-ID: <20120527040609.7AE801065686@hub.freebsd.org> Author: jhagewood Date: Sun May 27 04:06:09 2012 New Revision: 236541 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236541 Log: Added: soc2012/jhagewood/hagewood-mdocml.patch soc2012/jhagewood/mdocml-1.12.1/ soc2012/jhagewood/mdocml-1.12.1-orig/ soc2012/jhagewood/mdocml-1.12.1-orig/Makefile soc2012/jhagewood/mdocml-1.12.1-orig/TODO soc2012/jhagewood/mdocml-1.12.1-orig/apropos.1 soc2012/jhagewood/mdocml-1.12.1-orig/apropos.c soc2012/jhagewood/mdocml-1.12.1-orig/apropos_db.c soc2012/jhagewood/mdocml-1.12.1-orig/apropos_db.h soc2012/jhagewood/mdocml-1.12.1-orig/arch.c soc2012/jhagewood/mdocml-1.12.1-orig/arch.in soc2012/jhagewood/mdocml-1.12.1-orig/att.c soc2012/jhagewood/mdocml-1.12.1-orig/att.in soc2012/jhagewood/mdocml-1.12.1-orig/catman.8 soc2012/jhagewood/mdocml-1.12.1-orig/catman.c soc2012/jhagewood/mdocml-1.12.1-orig/cgi.c soc2012/jhagewood/mdocml-1.12.1-orig/chars.c soc2012/jhagewood/mdocml-1.12.1-orig/chars.in soc2012/jhagewood/mdocml-1.12.1-orig/compat_fgetln.c soc2012/jhagewood/mdocml-1.12.1-orig/compat_getsubopt.c soc2012/jhagewood/mdocml-1.12.1-orig/compat_strlcat.c soc2012/jhagewood/mdocml-1.12.1-orig/compat_strlcpy.c soc2012/jhagewood/mdocml-1.12.1-orig/config.h.post soc2012/jhagewood/mdocml-1.12.1-orig/config.h.pre soc2012/jhagewood/mdocml-1.12.1-orig/demandoc.1 soc2012/jhagewood/mdocml-1.12.1-orig/demandoc.c soc2012/jhagewood/mdocml-1.12.1-orig/eqn.7 soc2012/jhagewood/mdocml-1.12.1-orig/eqn.c soc2012/jhagewood/mdocml-1.12.1-orig/eqn_html.c soc2012/jhagewood/mdocml-1.12.1-orig/eqn_term.c soc2012/jhagewood/mdocml-1.12.1-orig/example.style.css soc2012/jhagewood/mdocml-1.12.1-orig/external.png (contents, props changed) soc2012/jhagewood/mdocml-1.12.1-orig/html.c soc2012/jhagewood/mdocml-1.12.1-orig/html.h soc2012/jhagewood/mdocml-1.12.1-orig/index.css soc2012/jhagewood/mdocml-1.12.1-orig/index.sgml soc2012/jhagewood/mdocml-1.12.1-orig/lib.c soc2012/jhagewood/mdocml-1.12.1-orig/lib.in soc2012/jhagewood/mdocml-1.12.1-orig/libman.h soc2012/jhagewood/mdocml-1.12.1-orig/libmandoc.h soc2012/jhagewood/mdocml-1.12.1-orig/libmdoc.h soc2012/jhagewood/mdocml-1.12.1-orig/libroff.h soc2012/jhagewood/mdocml-1.12.1-orig/main.c soc2012/jhagewood/mdocml-1.12.1-orig/main.h soc2012/jhagewood/mdocml-1.12.1-orig/man-cgi.css soc2012/jhagewood/mdocml-1.12.1-orig/man.7 soc2012/jhagewood/mdocml-1.12.1-orig/man.c soc2012/jhagewood/mdocml-1.12.1-orig/man.cgi.7 soc2012/jhagewood/mdocml-1.12.1-orig/man.h soc2012/jhagewood/mdocml-1.12.1-orig/man_hash.c soc2012/jhagewood/mdocml-1.12.1-orig/man_html.c soc2012/jhagewood/mdocml-1.12.1-orig/man_macro.c soc2012/jhagewood/mdocml-1.12.1-orig/man_term.c soc2012/jhagewood/mdocml-1.12.1-orig/man_validate.c soc2012/jhagewood/mdocml-1.12.1-orig/mandoc.1 soc2012/jhagewood/mdocml-1.12.1-orig/mandoc.3 soc2012/jhagewood/mdocml-1.12.1-orig/mandoc.c soc2012/jhagewood/mdocml-1.12.1-orig/mandoc.h soc2012/jhagewood/mdocml-1.12.1-orig/mandoc_char.7 soc2012/jhagewood/mdocml-1.12.1-orig/mandocdb.8 soc2012/jhagewood/mdocml-1.12.1-orig/mandocdb.c soc2012/jhagewood/mdocml-1.12.1-orig/mandocdb.h soc2012/jhagewood/mdocml-1.12.1-orig/manpath.c soc2012/jhagewood/mdocml-1.12.1-orig/manpath.h soc2012/jhagewood/mdocml-1.12.1-orig/mdoc.7 soc2012/jhagewood/mdocml-1.12.1-orig/mdoc.c soc2012/jhagewood/mdocml-1.12.1-orig/mdoc.h soc2012/jhagewood/mdocml-1.12.1-orig/mdoc_argv.c soc2012/jhagewood/mdocml-1.12.1-orig/mdoc_hash.c soc2012/jhagewood/mdocml-1.12.1-orig/mdoc_html.c soc2012/jhagewood/mdocml-1.12.1-orig/mdoc_macro.c soc2012/jhagewood/mdocml-1.12.1-orig/mdoc_man.c soc2012/jhagewood/mdocml-1.12.1-orig/mdoc_term.c soc2012/jhagewood/mdocml-1.12.1-orig/mdoc_validate.c soc2012/jhagewood/mdocml-1.12.1-orig/msec.c soc2012/jhagewood/mdocml-1.12.1-orig/msec.in soc2012/jhagewood/mdocml-1.12.1-orig/out.c soc2012/jhagewood/mdocml-1.12.1-orig/out.h soc2012/jhagewood/mdocml-1.12.1-orig/preconv.1 soc2012/jhagewood/mdocml-1.12.1-orig/preconv.c soc2012/jhagewood/mdocml-1.12.1-orig/predefs.in soc2012/jhagewood/mdocml-1.12.1-orig/read.c soc2012/jhagewood/mdocml-1.12.1-orig/roff.7 soc2012/jhagewood/mdocml-1.12.1-orig/roff.c soc2012/jhagewood/mdocml-1.12.1-orig/st.c soc2012/jhagewood/mdocml-1.12.1-orig/st.in soc2012/jhagewood/mdocml-1.12.1-orig/style.css soc2012/jhagewood/mdocml-1.12.1-orig/tbl.7 soc2012/jhagewood/mdocml-1.12.1-orig/tbl.c soc2012/jhagewood/mdocml-1.12.1-orig/tbl_data.c soc2012/jhagewood/mdocml-1.12.1-orig/tbl_html.c soc2012/jhagewood/mdocml-1.12.1-orig/tbl_layout.c soc2012/jhagewood/mdocml-1.12.1-orig/tbl_opts.c soc2012/jhagewood/mdocml-1.12.1-orig/tbl_term.c soc2012/jhagewood/mdocml-1.12.1-orig/term.c soc2012/jhagewood/mdocml-1.12.1-orig/term.h soc2012/jhagewood/mdocml-1.12.1-orig/term_ascii.c soc2012/jhagewood/mdocml-1.12.1-orig/term_ps.c soc2012/jhagewood/mdocml-1.12.1-orig/test-fgetln.c soc2012/jhagewood/mdocml-1.12.1-orig/test-getsubopt.c soc2012/jhagewood/mdocml-1.12.1-orig/test-mmap.c soc2012/jhagewood/mdocml-1.12.1-orig/test-strlcat.c soc2012/jhagewood/mdocml-1.12.1-orig/test-strlcpy.c soc2012/jhagewood/mdocml-1.12.1-orig/test-strptime.c soc2012/jhagewood/mdocml-1.12.1-orig/tree.c soc2012/jhagewood/mdocml-1.12.1-orig/vol.c soc2012/jhagewood/mdocml-1.12.1-orig/vol.in soc2012/jhagewood/mdocml-1.12.1-orig/whatis.1 soc2012/jhagewood/mdocml-1.12.1/Makefile soc2012/jhagewood/mdocml-1.12.1/TODO soc2012/jhagewood/mdocml-1.12.1/apropos.1 soc2012/jhagewood/mdocml-1.12.1/apropos.c soc2012/jhagewood/mdocml-1.12.1/apropos_db.c soc2012/jhagewood/mdocml-1.12.1/apropos_db.h soc2012/jhagewood/mdocml-1.12.1/arch.c soc2012/jhagewood/mdocml-1.12.1/arch.in soc2012/jhagewood/mdocml-1.12.1/att.c soc2012/jhagewood/mdocml-1.12.1/att.in soc2012/jhagewood/mdocml-1.12.1/catman.8 soc2012/jhagewood/mdocml-1.12.1/catman.c soc2012/jhagewood/mdocml-1.12.1/cgi.c soc2012/jhagewood/mdocml-1.12.1/chars.c soc2012/jhagewood/mdocml-1.12.1/chars.in soc2012/jhagewood/mdocml-1.12.1/compat_fgetln.c soc2012/jhagewood/mdocml-1.12.1/compat_getsubopt.c soc2012/jhagewood/mdocml-1.12.1/compat_strlcat.c soc2012/jhagewood/mdocml-1.12.1/compat_strlcpy.c soc2012/jhagewood/mdocml-1.12.1/config.h.post soc2012/jhagewood/mdocml-1.12.1/config.h.pre soc2012/jhagewood/mdocml-1.12.1/demandoc.1 soc2012/jhagewood/mdocml-1.12.1/demandoc.c soc2012/jhagewood/mdocml-1.12.1/eqn.7 soc2012/jhagewood/mdocml-1.12.1/eqn.c soc2012/jhagewood/mdocml-1.12.1/eqn_html.c soc2012/jhagewood/mdocml-1.12.1/eqn_term.c soc2012/jhagewood/mdocml-1.12.1/example.style.css soc2012/jhagewood/mdocml-1.12.1/external.png (contents, props changed) soc2012/jhagewood/mdocml-1.12.1/html.c soc2012/jhagewood/mdocml-1.12.1/html.h soc2012/jhagewood/mdocml-1.12.1/index.css soc2012/jhagewood/mdocml-1.12.1/index.sgml soc2012/jhagewood/mdocml-1.12.1/lib.c soc2012/jhagewood/mdocml-1.12.1/lib.in soc2012/jhagewood/mdocml-1.12.1/libman.h soc2012/jhagewood/mdocml-1.12.1/libmandoc.h soc2012/jhagewood/mdocml-1.12.1/libmdoc.h soc2012/jhagewood/mdocml-1.12.1/libroff.h soc2012/jhagewood/mdocml-1.12.1/main.c soc2012/jhagewood/mdocml-1.12.1/main.h soc2012/jhagewood/mdocml-1.12.1/man-cgi.css soc2012/jhagewood/mdocml-1.12.1/man.7 soc2012/jhagewood/mdocml-1.12.1/man.c soc2012/jhagewood/mdocml-1.12.1/man.cgi.7 soc2012/jhagewood/mdocml-1.12.1/man.h soc2012/jhagewood/mdocml-1.12.1/man_hash.c soc2012/jhagewood/mdocml-1.12.1/man_html.c soc2012/jhagewood/mdocml-1.12.1/man_macro.c soc2012/jhagewood/mdocml-1.12.1/man_term.c soc2012/jhagewood/mdocml-1.12.1/man_validate.c soc2012/jhagewood/mdocml-1.12.1/mandoc.1 soc2012/jhagewood/mdocml-1.12.1/mandoc.3 soc2012/jhagewood/mdocml-1.12.1/mandoc.c soc2012/jhagewood/mdocml-1.12.1/mandoc.h soc2012/jhagewood/mdocml-1.12.1/mandoc_char.7 soc2012/jhagewood/mdocml-1.12.1/mandocdb.8 soc2012/jhagewood/mdocml-1.12.1/mandocdb.c soc2012/jhagewood/mdocml-1.12.1/mandocdb.h soc2012/jhagewood/mdocml-1.12.1/manpath.c soc2012/jhagewood/mdocml-1.12.1/manpath.h soc2012/jhagewood/mdocml-1.12.1/mdoc.7 soc2012/jhagewood/mdocml-1.12.1/mdoc.c soc2012/jhagewood/mdocml-1.12.1/mdoc.h soc2012/jhagewood/mdocml-1.12.1/mdoc_argv.c soc2012/jhagewood/mdocml-1.12.1/mdoc_hash.c soc2012/jhagewood/mdocml-1.12.1/mdoc_html.c soc2012/jhagewood/mdocml-1.12.1/mdoc_macro.c soc2012/jhagewood/mdocml-1.12.1/mdoc_man.c soc2012/jhagewood/mdocml-1.12.1/mdoc_term.c soc2012/jhagewood/mdocml-1.12.1/mdoc_validate.c soc2012/jhagewood/mdocml-1.12.1/msec.c soc2012/jhagewood/mdocml-1.12.1/msec.in soc2012/jhagewood/mdocml-1.12.1/out.c soc2012/jhagewood/mdocml-1.12.1/out.h soc2012/jhagewood/mdocml-1.12.1/preconv.1 soc2012/jhagewood/mdocml-1.12.1/preconv.c soc2012/jhagewood/mdocml-1.12.1/predefs.in soc2012/jhagewood/mdocml-1.12.1/read.c soc2012/jhagewood/mdocml-1.12.1/roff.7 soc2012/jhagewood/mdocml-1.12.1/roff.c soc2012/jhagewood/mdocml-1.12.1/st.c soc2012/jhagewood/mdocml-1.12.1/st.in soc2012/jhagewood/mdocml-1.12.1/style.css soc2012/jhagewood/mdocml-1.12.1/tbl.7 soc2012/jhagewood/mdocml-1.12.1/tbl.c soc2012/jhagewood/mdocml-1.12.1/tbl_data.c soc2012/jhagewood/mdocml-1.12.1/tbl_html.c soc2012/jhagewood/mdocml-1.12.1/tbl_layout.c soc2012/jhagewood/mdocml-1.12.1/tbl_opts.c soc2012/jhagewood/mdocml-1.12.1/tbl_term.c soc2012/jhagewood/mdocml-1.12.1/term.c soc2012/jhagewood/mdocml-1.12.1/term.h soc2012/jhagewood/mdocml-1.12.1/term_ascii.c soc2012/jhagewood/mdocml-1.12.1/term_ps.c soc2012/jhagewood/mdocml-1.12.1/test-fgetln.c soc2012/jhagewood/mdocml-1.12.1/test-getsubopt.c soc2012/jhagewood/mdocml-1.12.1/test-mmap.c soc2012/jhagewood/mdocml-1.12.1/test-strlcat.c soc2012/jhagewood/mdocml-1.12.1/test-strlcpy.c soc2012/jhagewood/mdocml-1.12.1/test-strptime.c soc2012/jhagewood/mdocml-1.12.1/tree.c soc2012/jhagewood/mdocml-1.12.1/vol.c soc2012/jhagewood/mdocml-1.12.1/vol.in soc2012/jhagewood/mdocml-1.12.1/whatis.1 soc2012/jhagewood/mdocml_patches/ soc2012/jhagewood/mdocml_patches/patch-config.txt soc2012/jhagewood/mdocml_patches/patch-lib.in.txt soc2012/jhagewood/mdocml_patches/patch-mdoc_validate.c soc2012/jhagewood/mdocml_patches/patch-msec.in.txt soc2012/jhagewood/mdocml_test.sh (contents, props changed) soc2012/jhagewood/svn-commit.tmp Added: soc2012/jhagewood/hagewood-mdocml.patch ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/hagewood-mdocml.patch Sun May 27 04:06:09 2012 (r236541) @@ -0,0 +1,215 @@ +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-27 04:00:02.000000000 -0400 +@@ -49,14 +49,17 @@ enum rofft { + ROFF_if, + ROFF_ig, + ROFF_it, ++ ROFF_na, + ROFF_ne, + ROFF_nh, ++ ROFF_ni, + ROFF_nr, + ROFF_ns, + ROFF_ps, + ROFF_rm, + ROFF_so, + ROFF_ta, ++ ROFF_ti, + ROFF_tr, + ROFF_TS, + ROFF_TE, +@@ -225,14 +228,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 }, +@@ -407,6 +413,12 @@ roff_free(struct roff *r) + free(r); + } + ++/* TODO */ ++static enum rofferr ++roff_ad(ROFF_ARGS) ++{ ++ ++} + + struct roff * + roff_alloc(struct mparse *parse) +@@ -1234,6 +1246,20 @@ roff_regunset(struct roff *r, enum regs + r->regs[(int)reg].set = 0; + } + ++/* TODO */ ++static enum rofferr ++roff_na(ROFF_ARGS) ++{ ++ ++} ++ ++/* TODO */ ++static enum rofferr ++roff_it(ROFF_ARGS) ++{ ++ ++} ++ + /* ARGSUSED */ + static enum rofferr + roff_nr(ROFF_ARGS) +@@ -1256,6 +1282,61 @@ roff_nr(ROFF_ARGS) + return(ROFF_IGN); + } + ++/* TODO */ ++static enum rofferr ++roff_ns(ROFF_ARGS) ++{ ++ ++} ++ ++/* TODO */ ++static enum rofferr ++roff_ti(ROFF_ARGS) ++{ ++ ++} ++ ++/* TODO */ ++static enum rofferr ++roff_ta(ROFF_ARGS) ++{ ++ ++} ++ ++/* TODO */ ++static enum rofferr ++roff_hy(ROFF_ARGS) ++{ ++ ++} ++ ++/* TODO */ ++static enum rofferr ++roff_ne(ROFF_ARGS) ++{ ++ ++} ++ ++/* TODO */ ++static enum rofferr ++roff_nh(ROFF_ARGS) ++{ ++ ++} ++ ++/* TODO */ ++static enum rofferr ++roff_ni(ROFF_ARGS) ++{ ++ ++} ++ ++/* TODO */ ++static enum rofferr ++roff_ps(ROFF_ARGS) ++{ ++ ++} + /* ARGSUSED */ + static enum rofferr + roff_rm(ROFF_ARGS) Added: soc2012/jhagewood/mdocml-1.12.1-orig/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/mdocml-1.12.1-orig/Makefile Sun May 27 04:06:09 2012 (r236541) @@ -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-1.12.1-orig/TODO ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/mdocml-1.12.1-orig/TODO Sun May 27 04:06:09 2012 (r236541) @@ -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 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From jhagewood at FreeBSD.org Sun May 27 04:07:35 2012 From: jhagewood at FreeBSD.org (jhagewood@FreeBSD.org) Date: Sun May 27 04:07:41 2012 Subject: socsvn commit: r236542 - soc2012/jhagewood Message-ID: <20120527040734.5768B1065670@hub.freebsd.org> Author: jhagewood Date: Sun May 27 04:07:34 2012 New Revision: 236542 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236542 Log: Deleted: soc2012/jhagewood/ From jhagewood at FreeBSD.org Sun May 27 04:08:00 2012 From: jhagewood at FreeBSD.org (jhagewood@FreeBSD.org) Date: Sun May 27 04:08:06 2012 Subject: socsvn commit: r236543 - soc2012/jhagewood Message-ID: <20120527040759.1EE52106564A@hub.freebsd.org> Author: jhagewood Date: Sun May 27 04:07:58 2012 New Revision: 236543 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236543 Log: Added: soc2012/jhagewood/ From jhagewood at FreeBSD.org Sun May 27 04:09:13 2012 From: jhagewood at FreeBSD.org (jhagewood@FreeBSD.org) Date: Sun May 27 04:09:20 2012 Subject: socsvn commit: r236544 - in soc2012/jhagewood: . diff diff3 gabor_diff mdocml mdocml/mdocml-1.12.1 mdocml/mdocml-1.12.1-orig mdocml/mdocml_patches sdiff Message-ID: <20120527040910.DDE9C106566B@hub.freebsd.org> Author: jhagewood Date: Sun May 27 04:09:10 2012 New Revision: 236544 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236544 Log: Added: soc2012/jhagewood/Milestones soc2012/jhagewood/diff/ soc2012/jhagewood/diff/Makefile soc2012/jhagewood/diff/diff (contents, props changed) soc2012/jhagewood/diff/diff.1 soc2012/jhagewood/diff/diff.1.gz (contents, props changed) soc2012/jhagewood/diff/diff.c soc2012/jhagewood/diff/diff.h soc2012/jhagewood/diff/diffdir.c soc2012/jhagewood/diff/diffreg.c soc2012/jhagewood/diff/pathnames.h soc2012/jhagewood/diff3/ soc2012/jhagewood/diff3/Makefile soc2012/jhagewood/diff3/diff3.1 soc2012/jhagewood/diff3/diff3.ksh soc2012/jhagewood/diff3/diff3.sh soc2012/jhagewood/diff3/diff3prog.c soc2012/jhagewood/gabor_diff/ soc2012/jhagewood/gabor_diff/Makefile soc2012/jhagewood/gabor_diff/diff.1 soc2012/jhagewood/gabor_diff/diff.c soc2012/jhagewood/gabor_diff/diff.h soc2012/jhagewood/gabor_diff/diffdir.c soc2012/jhagewood/gabor_diff/diffreg.c soc2012/jhagewood/gabor_diff/pathnames.h soc2012/jhagewood/mdocml/ 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 soc2012/jhagewood/sdiff/ soc2012/jhagewood/sdiff/Makefile soc2012/jhagewood/sdiff/common.c soc2012/jhagewood/sdiff/common.h soc2012/jhagewood/sdiff/edit.c soc2012/jhagewood/sdiff/extern.h soc2012/jhagewood/sdiff/sdiff.1 soc2012/jhagewood/sdiff/sdiff.c Added: soc2012/jhagewood/Milestones ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/Milestones Sun May 27 04:09:10 2012 (r236544) @@ -0,0 +1,30 @@ +May 21 - June 17 + + Implement all missing features of mdocml, including legacy features. + Testing of mdocml. + +June 18 - July 1 + + Complete diff + Debugging and testing of diff + +July 2 - July 18 + + Mid-term evaluations. + Complete sdiff + Debugging and testing of sdiff + +July 19 - August 5 + + Complete diff3 + Debugging and testing of diff3 + +August 6 ? August 12 + + Thouroughly test and benchmark all utilities. + +August 13 - August 20 + + "Pencils down" period. + Finish cleaning up code and do any testing that might be left. + Write documentation. Added: soc2012/jhagewood/diff/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/diff/Makefile Sun May 27 04:09:10 2012 (r236544) @@ -0,0 +1,10 @@ +# $FreeBSD$ +# $OpenBSD: Makefile,v 1.2 2003/06/25 02:42:50 deraadt Exp $ + +DEBUG_FLAGS+= -g + +PROG= diff +SRCS= diff.c diffdir.c diffreg.c +CFLAGS+= -std=c99 -Wall -pedantic + +.include Added: soc2012/jhagewood/diff/diff ============================================================================== Binary file. No diff available. Added: soc2012/jhagewood/diff/diff.1 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/diff/diff.1 Sun May 27 04:09:10 2012 (r236544) @@ -0,0 +1,511 @@ +.\" $FreeBSD$ +.\" $OpenBSD: diff.1,v 1.33 2007/05/31 19:20:09 jmc Exp $ +.\" +.\" Copyright (c) 1980, 1990, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. 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. +.\" +.\" @(#)diff.1 8.1 (Berkeley) 6/30/93 +.\" +.Dd Apr 7, 2008 +.Dt DIFF 1 +.Os +.Sh NAME +.Nm diff +.Nd differential file and directory comparator +.Sh SYNOPSIS +.Nm diff +.Op Fl abdilpqTtw +.Op Fl I Ar pattern +.Oo +.Fl c | e | f | +.Fl n | u +.Oc +.Op Fl L Ar label +.Ar file1 file2 +.Nm diff +.Op Fl abdilpqTtw +.Op Fl I Ar pattern +.Op Fl L Ar label +.Fl C Op Ar number +.Ar file1 file2 +.Nm diff +.Op Fl abdilqtw +.Op Fl I Ar pattern +.Fl D Ar string +.Ar file1 file2 +.Nm diff +.Op Fl abdilpqTtw +.Op Fl I Ar pattern +.Op Fl L Ar label +.Fl U Ar number +.Ar file1 file2 +.Nm diff +.Op Fl abdilNPpqrsTtw +.Op Fl I Ar pattern +.Oo +.Fl c | e | f | +.Fl n | u +.Oc +.Bk -words +.Op Fl L Ar label +.Op Fl S Ar name +.Op Fl X Ar file +.Op Fl x Ar pattern +.Ek +.Ar dir1 dir2 +.Nm diff +.Op Fl v +.Sh DESCRIPTION +The +.Nm +utility compares the contents of +.Ar file1 +and +.Ar file2 +and writes to the standard output the list of changes necessary to +convert one file into the other. +No output is produced if the files are identical. +.Pp +Output options (mutually exclusive): +.Bl -tag -width Ds +.It Fl C Op Ar number , Fl Fl context Ns = Ns Op Ar number +Like +.Fl c +but produces a diff with +.Ar number +lines of context. +.It Fl c +Produces a diff with 3 lines of context. +With +.Fl c +the output format is modified slightly: +the output begins with identification of the files involved and +their creation dates and then each change is separated +by a line with fifteen +.Li * Ns 's . +The lines removed from +.Ar file1 +are marked with +.Sq \&-\ \& ; +those added to +.Ar file2 +are marked +.Sq \+\ \& . +Lines which are changed from one file to the other are marked in +both files with +.Sq !\ \& . +Changes which lie within 3 lines of each other are grouped together on +output. +.It Fl D Ar string , Fl Fl ifdef Ns = Ns Ar string +Creates a merged version of +.Ar file1 +and +.Ar file2 +on the standard output, with C preprocessor controls included so that +a compilation of the result without defining +.Ar string +is equivalent to compiling +.Ar file1 , +while defining +.Ar string +will yield +.Ar file2 . +.It Fl e , Fl Fl ed +Produces output in a form suitable as input for the editor utility, +.Xr ed 1 , +which can then be used to convert file1 into file2. +.Pp +Extra commands are added to the output when comparing directories with +.Fl e , +so that the result is a +.Xr sh 1 +script for converting text files which are common to the two directories +from their state in +.Ar dir1 +to their state in +.Ar dir2 . +.It Fl f +Identical output to that of the +.Fl e +flag, but in reverse order. +It cannot be digested by +.Xr ed 1 . +.It Fl n , Fl Fl rcs +Produces a script similar to that of +.Fl e , +but in the opposite order and with a count of changed lines on each +insert or delete command. +This is the form used by +.Xr rcsdiff 1 . +.It Fl q , Fl Fl brief +Just print a line when the files differ. +Does not output a list of changes. +.It Fl U Op Ar number , Fl Fl unified Ns = Ns Op Ar number +Like +.Fl u +but produces a diff with +.Ar number +lines of context. +.It Fl u +Produces a +.Em unified +diff with 3 lines of context. +A unified diff is similar to the context diff produced by the +.Fl c +option. +However, unlike with +.Fl c , +all lines to be changed (added and/or removed) are present in +a single section. +.El +.Pp +Comparison options: +.Bl -tag -width Ds +.It Fl a , Fl Fl text +Treat all files as +.Tn ASCII +text. +Normally +.Nm +will simply print +.Dq Binary files ... differ +if files contain binary characters. +Use of this option forces +.Nm +to produce a diff. +.It Fl b , Fl Fl ignore-space-change +Causes trailing blanks (spaces and tabs) to be ignored, and other +strings of blanks to compare equal. +.It Fl d , Fl Fl minimal +Try very hard to produce a diff as small as possible. +This may consume a lot of processing power and memory when processing +large files with many changes. +.It Fl I Ar pattern , Fl Fl ignore-matching-lines Ns = Ns Ar pattern +Ignores changes, insertions, and deletions whose lines match the +extended regular expression +.Ar pattern . +Multiple +.Fl I +patterns may be specified. +All lines in the change must match some pattern for the change to be +ignored. +See +.Xr re_format 7 +for more information on regular expression patterns. +.It Fl i , Fl Fl ignore-case +Ignores the case of letters. +E.g., +.Dq A +will compare equal to +.Dq a . +.It Fl L Ar label +Print +.Ar label +instead of the first (and second, if this option is specified twice) +file name and time in the context or unified diff header. +.It Fl l , Fl Fl paginate +Long output format; each text file +.Nm diff Ns \'d +is piped through +.Xr pr 1 +to paginate it; +other differences are remembered and summarized +after all text file differences are reported. +.It Fl p , Fl Fl show-c-function +With unified and context diffs, show with each change +the first 40 characters of the last line before the context beginning +with a letter, an underscore or a dollar sign. +For C source code following standard layout conventions, this will +show the prototype of the function the change applies to. +.It Fl T , Fl Fl initial-tab +Print a tab rather than a space before the rest of the line for the +normal, context or unified output formats. +This makes the alignment of tabs in the line consistent. +.It Fl t , Fl Fl expand-tabs +Will expand tabs in output lines. +Normal or +.Fl c +output adds character(s) to the front of each line which may screw up +the indentation of the original source lines and make the output listing +difficult to interpret. +This option will preserve the original source's indentation. +.It Fl w , Fl Fl ignore-all-space +Is similar to +.Fl b +but causes whitespace (blanks and tabs) to be totally ignored. +E.g., +.Dq if (\ \&a == b \&) +will compare equal to +.Dq if(a==b) . +.El +.Pp +Directory comparison options: +.Bl -tag -width Ds +.It Fl N , Fl Fl new-file +If a file is found in only one directory, act as if it was found in the +other directory too but was of zero size. +.It Fl P +If a file is found only in +.Ar dir2 , +act as if it was found in +.Ar dir1 +too but was of zero size. +.It Fl r , Fl Fl recursive +Causes application of +.Nm +recursively to common sub7 directories encountered. +.It Fl S Ar name , Fl starting-file Ns = Ns Ar name +Re-starts a directory +.Nm +in the middle, beginning with file +.Ar name . +.It Fl s , Fl Fl report-identical-files +Causes +.Nm +to report files which are the same, which are otherwise not mentioned. +.It Fl X Ar file , Fl Fl exclude-from Ns = Ns Ar file +Exclude files and subdirectories from comparison whose basenames match +lines in +.Ar file . +Multiple +.Fl X +options may be specified. +.It Fl x Ar pattern , Fl Fl exclude Ns = Ns Ar pattern +Exclude files and subdirectories from comparison whose basenames match +.Ar pattern . +Patterns are matched using shell-style globbing via +.Xr fnmatch 3 . +Multiple +.Fl x +options may be specified. +.It Fl v , Fl Fl version +Print version ino. +.El +.Pp +If both arguments are directories, +.Nm +sorts the contents of the directories by name, and then runs the +regular file +.Nm +algorithm, producing a change list, +on text files which are different. +Binary files which differ, +common subdirectories, and files which appear in only one directory +are described as such. +In directory mode only regular files and directories are compared. +If a non-regular file such as a device special file or +.Tn FIFO +is encountered, a diagnostic message is printed. +.Pp +If only one of +.Ar file1 +and +.Ar file2 +is a directory, +.Nm +is applied to the non-directory file and the file contained in +the directory file with a filename that is the same as the +last component of the non-directory file. +.Pp +If either +.Ar file1 +or +.Ar file2 +is +.Sq Fl , +the standard input is +used in its place. +.Ss Output Style +The default (without +.Fl e , +.Fl c , +or +.Fl n +.\" -C +options) +output contains lines of these forms, where +.Va XX , YY , ZZ , QQ +are line numbers respective of file order. +.Pp +.Bl -tag -width "XX,YYcZZ,QQ" -compact +.It Li XX Ns Ic a Ns Li YY +At (the end of) line +.Va XX +of +.Ar file1 , +append the contents +of line +.Va YY +of +.Ar file2 +to make them equal. +.It Li XX Ns Ic a Ns Li YY,ZZ +Same as above, but append the range of lines, +.Va YY +through +.Va ZZ +of +.Ar file2 +to line +.Va XX +of file1. +.It Li XX Ns Ic d Ns Li YY +At line +.Va XX +delete +the line. +The value +.Va YY +tells to which line the change would bring +.Ar file1 +in line with +.Ar file1 . +.It Li XX,YY Ns Ic d Ns Li ZZ +Delete the range of lines +.Va XX +through +.Va YY +in +.Ar file1 . +.It Li XX Ns Ic c Ns Li YY +Change the line +.Va XX +in +.Ar file1 +to the line +.Va YY +in +.Ar file2 . +.It Li XX,YY Ns Ic c Ns Li ZZ +Replace the range of specified lines with the line +.Va ZZ . +.It Li XX,YY Ns Ic c Ns Li ZZ,QQ +Replace the range +.Va XX , Ns Va YY +from +.Ar file1 +with the range +.Va ZZ , Ns Va QQ +from +.Ar file2 . +.El +.Pp +These lines resemble +.Xr ed 1 +subcommands to convert +.Ar file1 +into +.Ar file2 . +The line numbers before the action letters pertain to +.Ar file1 ; +those after pertain to +.Ar file2 . +Thus, by exchanging +.Ic a +for +.Ic d +and reading the line in reverse order, one can also +determine how to convert +.Ar file2 +into +.Ar file1 . +As in +.Xr ed 1 , +identical +pairs (where num1 = num2) are abbreviated as a single +number. +.Sh ENVIRONMENT +.Bl -tag -width TMPDIR +.It Ev TMPDIR +If the environment variable +.Ev TMPDIR +exists, +.Nm +will use the directory specified by +.Ev TMPDIR +as the temporary directory. +.El +.Sh FILES +.Bl -tag -width /tmp/diff.XXXXXXXX -compact +.It Pa /tmp/diff. Ns Ar XXXXXXXX +Temporary file used when comparing a device or the standard input. +Note that the temporary file is unlinked as soon as it is created +so it will not show up in a directory listing. +.El +.Sh DIAGNOSTICS +The +.Nm +utility exits with one of the following values: +.Pp +.Bl -tag -width Ds -compact -offset indent +.It 0 +No differences were found. +.It 1 +Differences were found. +.It \*(Gt1 +An error occurred. +.El +.Sh SEE ALSO +.Xr cmp 1 , +.Xr comm 1 , +.Xr diff3 1 , +.Xr ed 1 , +.Xr pr 1 , +.Xr sdiff 1 , +.Xr fnmatch 3 , +.Xr re_format 7 +.Sh STANDARDS +The +.Nm +utility is compliant with the +St -p1003.1-2004 +specification. +.Pp +The flags +.Op Fl aDdIiLlNnPpqSsTtUuwXx +are extensions to that specification. +.Sh HISTORY +A +.Nm +command appeared in +.At v6 . +.Sh BUGS +When comparing directories with the +.Fl b , +.Fl w +or +.Fl i +options specified, +.Nm +first compares the files ala +.Xr cmp 1 , +and then decides to run the +.Nm +algorithm if they are not equal. +This may cause a small amount of spurious output if the files +then turn out to be identical because the only differences are +insignificant whitespace or case differences. Added: soc2012/jhagewood/diff/diff.1.gz ============================================================================== Binary file. No diff available. Added: soc2012/jhagewood/diff/diff.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/jhagewood/diff/diff.c Sun May 27 04:09:10 2012 (r236544) @@ -0,0 +1,599 @@ +/*- + * Copyright (c) 2003 Todd C. Miller + * + * 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. + * + * Sponsored in part by the Defense Advanced Research Projects + * Agency (DARPA) and Air Force Research Laboratory, Air Force + * Materiel Command, USAF, under agreement number F39502-99-1-0512. + */ + +#include + +#ifndef lint +#if 0 +__RCSID("$OpenBSD: diff.c,v 1.50 2007/05/29 18:24:56 ray Exp $"); +#else +__FBSDID("$FreeBSD$"); +#endif +#endif /* not lint */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "diff.h" +#include "pathnames.h" + +int aflag, bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag; +int sflag, tflag, Tflag, wflag; +int Bflag, yflag; +int strip_cr, tabsize=8; +char ignore_file_case = 0; +int format, context, status; +char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; +struct stat stb1, stb2; +struct excludes *excludes_list; +regex_t ignore_re; + +int flag_opts = 0; + +#define OPTIONS "0123456789aBbC:cdD:efhI:iL:lnNPpqrS:sTtU:uvwXy:x" + + +/* Options which exceed manageable alphanumeric assignments */ +enum +{ + OPT_IGN_FN_CASE = CHAR_MAX + 1, + OPT_NIGN_FN_CASE, + OPT_STRIPCR, + OPT_NORMAL, + OPT_LEFTC, + OT_SUPCL, + OPT_GTYPE, + OPT_LF, + OPT_LLF, + OPT_TSIZE, + OPT_UNINF, + OPT_FFILE, + OPT_TOFILE, + OPT_HLINES, + OPT_LFILES, + OPT_HELP, +}; + + +static struct option longopts[] = { +/* XXX: UNIMPLEMENTED + { "normal", no_argument, NULL, OPT_NORMAL }, + { "left-column", no_argument, NULL, OPT_LEFTC }, + { "suppress-common-lines", no_argument, NULL, OT_SUPCL }, + { "GTYPE-group-format", required_argument, NULL, OPT_GTYPE }, + { "line-format", required_argument, NULL, OPT_LF }, + { "LTYPE-line-format", required_argument, NULL, OPT_LLF }, + { "unidirectional-new-file", no_argument, NULL, OPT_UNINF }, + { "from-file", required_argument, NULL, OPT_FFILE }, + { "to-file", required_argument, NULL, OPT_TOFILE }, + { "horizon-lines", required_argument, NULL, OPT_HLINES }, + { "speed-large-files", no_argument, NULL, OPT_LFILES }, */ + { "tabsize", optional_argument, NULL, OPT_TSIZE }, + { "strip-trailing-cr", no_argument, NULL, OPT_STRIPCR }, + { "help", no_argument, NULL, OPT_HELP }, + { "ignore-file-name-case", no_argument, NULL, OPT_IGN_FN_CASE }, + { "no-ignore-file-name-case", no_argument, NULL, OPT_NIGN_FN_CASE }, + { "text", no_argument, NULL, 'a' }, +/* XXX: UNIMPLEMENTED */ + { "ignore-blank-lines", no_argument, NULL, 'B' }, + { "ignore-space-change", no_argument, NULL, 'b' }, +/* XXX: -c is incompatible with GNU version */ + { "context", optional_argument, NULL, 'C' }, + { "ifdef", required_argument, NULL, 'D' }, + { "minimal", no_argument, NULL, 'd' }, +/* XXX: UNIMPLEMENTED + { "ignore-tab-expansion", no_argument, NULL, 'E' }, */ + { "ed", no_argument, NULL, 'e' }, +/* XXX: UNIMPLEMENTED + { "show-function-line", required_argument, NULL, 'F' }, */ + { "forward-ed", no_argument, NULL, 'f' }, + { "ignore-matching-lines", required_argument, NULL, 'I' }, + { "ignore-case", no_argument, NULL, 'i' }, + { "label", required_argument, NULL, 'L' }, + { "paginate", no_argument, NULL, 'l' }, + { "new-file", no_argument, NULL, 'N' }, + { "rcs", no_argument, NULL, 'n' }, + { "unidirectional-new-file", no_argument, NULL, 'P' }, + { "show-c-function", no_argument, NULL, 'p' }, + { "brief", no_argument, NULL, 'q' }, + { "recursive", no_argument, NULL, 'r' }, + { "starting-file", required_argument, NULL, 'S' }, + { "report-identical-files", no_argument, NULL, 's' }, + { "initial-tab", no_argument, NULL, 'T' }, + { "expand-tabs", no_argument, NULL, 't' }, +/* XXX: -u is incompatible with GNU version */ + { "unified", optional_argument, NULL, 'U' }, + { "version", no_argument, NULL, 'v' }, +/* XXX: UNIMPLEMENTED + { "width", optional_argument, NULL, 'W' }, */ + { "ignore-all-space", no_argument, NULL, 'w' }, + { "exclude-from", required_argument, NULL, 'X' }, + { "exclude", required_argument, NULL, 'x' }, + { "side-by-side", no_argument, NULL, 'y' }, + { NULL, 0, NULL, '\0'} +}; + +static const char *help_msg[] = { +"-a --text treat files as ASCII text", +"-B --ignore-blank-lines Ignore blank newlines in the comparison", +"-b --ignore-space-change Ignore all changes due to whitespace", +"-C NUM --context=[NUM] Show NUM lines before and after change (default 3)", +"-D --ifdef=NAME", +NULL, +}; +char **help_strs = (char **)help_msg; + +void set_argstr(char **, char **); + + +void usage(void); +void push_excludes(char *); +void push_ignore_pats(char *); +void read_excludes_file(char *); + +int +main(int argc, char **argv) +{ + char *ep, **oargv; + long l; + int ch, lastch, gotstdin, prevoptind, newarg; + int oargc; + + oargv = argv; + oargc = argc; + gotstdin = 0; + + lastch = '\0'; + prevoptind = 1; + newarg = 1; + while ((ch = getopt_long(argc, argv, OPTIONS, longopts, NULL)) != -1) { + switch (ch) { + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + if (newarg) + usage(); /* disallow -[0-9]+ */ + else if (lastch == 'c' || lastch == 'u') + context = 0; + else if (!isdigit(lastch) || context > INT_MAX / 10) + usage(); + context = (context * 10) + (ch - '0'); + break; + case 'a': + aflag = 1; + break; + case 'b': + bflag = 1; + break; + case 'B': + Bflag = 1; + break; + case 'C': + case 'c': + format = D_CONTEXT; + if (optarg != NULL) { + l = strtol(optarg, &ep, 10); + if (*ep != '\0' || l < 0 || l >= INT_MAX) + usage(); + context = (int)l; + } else + context = 3; + break; + case 'D': + format = D_IFDEF; + ifdefname = optarg; + break; + case 'd': + dflag = 1; + break; + case 'e': + format = D_EDIT; + break; + case 'f': + format = D_REVERSE; + break; + case 'h': + /* silently ignore for backwards compatibility */ + break; + case 'I': + push_ignore_pats(optarg); + break; + case 'i': + iflag = 1; + break; + case 'L': + if (label[0] == NULL) + label[0] = optarg; + else if (label[1] == NULL) + label[1] = optarg; + else + usage(); + break; + case 'l': + lflag = 1; + signal(SIGPIPE, SIG_IGN); + break; + case 'N': + Nflag = 1; + break; + case 'n': + format = D_NREVERSE; + break; + case 'P': + Pflag = 1; + break; + case 'p': + pflag = 1; + break; + case 'r': + rflag = 1; + break; + case 'q': + format = D_BRIEF; + break; + case 'S': + start = optarg; + break; + case 's': + sflag = 1; + break; + case 'T': + Tflag = 1; + break; + case 't': + tflag = 1; + break; + case 'U': + case 'u': + format = D_UNIFIED; + if (optarg != NULL) { + l = strtol(optarg, &ep, 10); + if (*ep != '\0' || l < 0 || l >= INT_MAX) + usage(); + context = (int)l; + } else + context = 3; + break; + case 'v': + printf("FreeBSD diff 2.8.7\n"); + exit(0); + case 'w': + wflag = 1; + break; + case 'X': + read_excludes_file(optarg); + break; + case 'x': + push_excludes(optarg); + break; + case 'y': + yflag = 1; + break; + case OPT_TSIZE: + if (optarg != NULL) { + l = strtol(optarg, &ep, 10); + if (*ep != '\0' || l < 1 || l >= INT_MAX) + usage(); + tabsize = (int)l; + } else + tabsize = 8; + break; + case OPT_STRIPCR: + strip_cr=1; + break; + case OPT_IGN_FN_CASE: + ignore_file_case = 1; + break; + case OPT_NIGN_FN_CASE: + ignore_file_case = 0; + break; + case OPT_HELP: + for(;*help_strs;help_strs++) + { + printf("%s\n", *help_strs); + } + exit(2); + break; + default: + usage(); + break; + } + lastch = ch; + newarg = optind != prevoptind; + prevoptind = optind; + } + argc -= optind; + argv += optind; + + if(yflag) { + /* remove y flag from args and call sdiff */ + for(argv=oargv; argv && strcmp(*argv, "-y") != 0; argv++); + while(argv != &oargv[oargc]){ + *argv=*(argv+1); + argv++; + } + oargv[0] = _PATH_SDIFF; + *argv= "\0"; + + execv(_PATH_SDIFF, oargv); + _exit(127); + } + + /* + * Do sanity checks, fill in stb1 and stb2 and call the appropriate + * driver routine. Both drivers use the contents of stb1 and stb2. + */ + if (argc != 2) + usage(); + if (ignore_pats != NULL) { + char buf[BUFSIZ]; + int error; + + if ((error = regcomp(&ignore_re, ignore_pats, + REG_NEWLINE | REG_EXTENDED)) != 0) { + regerror(error, &ignore_re, buf, sizeof(buf)); + if (*ignore_pats != '\0') + errx(2, "%s: %s", ignore_pats, buf); + else + errx(2, "%s", buf); + } + } + if (strcmp(argv[0], "-") == 0) { + fstat(STDIN_FILENO, &stb1); + gotstdin = 1; + } else if (stat(argv[0], &stb1) != 0) + err(2, "%s", argv[0]); + if (strcmp(argv[1], "-") == 0) { + fstat(STDIN_FILENO, &stb2); + gotstdin = 1; + } else if (stat(argv[1], &stb2) != 0) + err(2, "%s", argv[1]); + if (gotstdin && (S_ISDIR(stb1.st_mode) || S_ISDIR(stb2.st_mode))) + errx(2, "can't compare - to a directory"); + set_argstr(oargv, argv); + if (S_ISDIR(stb1.st_mode) && S_ISDIR(stb2.st_mode)) { + if (format == D_IFDEF) + errx(2, "-D option not supported with directories"); + diffdir(argv[0], argv[1]); + } else { + if (S_ISDIR(stb1.st_mode)) { + argv[0] = splice(argv[0], argv[1]); + if (stat(argv[0], &stb1) < 0) + err(2, "%s", argv[0]); + } + if (S_ISDIR(stb2.st_mode)) { + argv[1] = splice(argv[1], argv[0]); + if (stat(argv[1], &stb2) < 0) + err(2, "%s", argv[1]); + } + print_status(diffreg(argv[0], argv[1], 0), argv[0], argv[1], + NULL); + } + exit(status); +} + +void * +emalloc(size_t n) +{ + void *p; + + if (n == 0) + errx(2, NULL); + + if ((p = malloc(n)) == NULL) + errx(2, NULL); + return (p); +} + +void * +erealloc(void *p, size_t n) +{ + void *q; + + if (n == 0) + errx(2, NULL); + if (p == NULL) + q = malloc(n); + else + q = realloc(p, n); + if (q == NULL) + errx(2, NULL); + return (q); +} + +int +easprintf(char **ret, const char *fmt, ...) +{ + int len; + va_list ap; + + va_start(ap, fmt); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From scher at FreeBSD.org Mon May 28 10:49:45 2012 From: scher at FreeBSD.org (scher@FreeBSD.org) Date: Mon May 28 12:35:44 2012 Subject: socsvn commit: r236583 - soc2012/scher/par_ports/head/Mk Message-ID: <20120528104943.0490D106564A@hub.freebsd.org> Author: scher Date: Mon May 28 10:49:42 2012 New Revision: 236583 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236583 Log: [new_feature] _parv_${_lock_dir}_LOCK_LOOP - main scripts to lock a directory _parv_CHECK_LOCK - script to check if $${dir} is locked. [doc] Submitted by: Alexander Pronin M bsd.parallel.mk M bsd.port.mk 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 Mon May 28 09:51:10 2012 (r236582) +++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Mon May 28 10:49:42 2012 (r236583) @@ -11,11 +11,15 @@ _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_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} + +# Delay for feedback message if the directory is locked. +# Just not to annoy a user with feedback message on each attempt to lock a directory. +_parv_ON_LOCK_FEEDBACK_TIMEOUT?= 2 # End of Debugging specific tools and variable declarations section ##################################################### ##################################################### @@ -28,8 +32,6 @@ .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} @@ -44,6 +46,8 @@ # Commands _parv_KILL= /bin/kill _parv_KILL_FLAGS= -- +_parv_PKILL= /bin/pkill +_parv_PKILL_FLAGS= -P DO_NADA?= ${TRUE} # End of Commands section @@ -56,6 +60,13 @@ _parv_WAIT_FOR_LOCK_TIME= 5 _parv_WAIT_FOR_UNLOCK_TIME= 15 +# Delay in seconds between attempts to lock a directory in lock loops +_parv_LOCK_ATTEMPT_TIMEOUT=2 + +# exit status of lock script in case the directory is locked +_parv_ON_LOCK_EXIT_STATUS= 2 +_parv_LOCKF_EX_TEMPFAIL= 75 + # 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) @@ -63,13 +74,7 @@ # # 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. +# If the directory is locked this script returns ${_parv_ON_LOCK_EXIT_STATUS}. # # ${${_lock_dir}} == ${PKG_DBDIR} OR ${.CURDIR} # @@ -81,60 +86,145 @@ ${CHMOD} 777 ${${_lock_dir}}/${_parv_LOCK_FILE}; \ pid=$$(${CAT} ${${_lock_dir}}/${_parv_LOCK_FILE}); \ if [ $${pid} ]; then \ - ps -p $${pid} > /dev/null; \ - status=$$(${ECHO_CMD} $$?); \ + ps -p $${pid} > /dev/null && status=$$? || status=$$?; \ 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 PID=$${pid}...; \ - ${_dparv_END_OUTPUT}; \ - ${_parv_KILL} ${_parv_KILL_FLAGS} -${.MAKE.PID}; \ + exit ${_parv_ON_LOCK_EXIT_STATUS}; \ else \ ${_dparv_START_OUTPUT}; \ - ${ECHO_CMD} Dir: ${${_lock_dir}} Stalled lock Detected!; \ - ${ECHO_CMD} Deleting stalled lock. PID=$${pid}; \ - ${ECHO_CMD} Locking: ${${_lock_dir}}; \ + ${ECHO_CMD} "Dir: ${${_lock_dir}} Stalled lock Detected!"; \ + ${ECHO_CMD} "Deleting stalled lock. PID=$${pid}"; \ + ${ECHO_CMD} "Locking: ${${_lock_dir}}"; \ ${_dparv_END_OUTPUT}; \ ${ECHO_CMD} ${.MAKE.PID} > ${${_lock_dir}}/${_parv_LOCK_FILE}; \ fi; \ else \ ${_dparv_START_OUTPUT}; \ - ${ECHO_CMD} Locking: ${${_lock_dir}}; \ + ${ECHO_CMD} "Locking: ${${_lock_dir}}"; \ ${_dparv_END_OUTPUT}; \ ${ECHO_CMD} ${.MAKE.PID} > ${${_lock_dir}}/${_parv_LOCK_FILE}; \ fi +##################################################### + # _parv_PKG_DBDIR_DO_LOCK # _parv_.CURDIR_DO_LOCK +# This scripts handles exit status of lockf(1) call. +# It substitutes exit status 75 of lockf(1) for ${_parv_ON_LOCK_EXIT_STATUS} and pushes it. # _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}; \ - ) + lockf -k -t ${_parv_WAIT_FOR_LOCK_TIME} ${${_lock_dir}}/${_parv_LOCK_FILE} ${SH} -c '${_parv_${_lock_dir}_LOCK_SEQ}' || { \ + status=$$?; \ + if [ $${status} -eq ${_parv_LOCKF_EX_TEMPFAIL} ] || \ + [ $${status} -eq ${_parv_ON_LOCK_EXIT_STATUS} ]; then \ + exit ${_parv_ON_LOCK_EXIT_STATUS}; \ + else \ + ${_dparv_START_OUTPUT}; \ + ${ECHO_CMD} "Unhandled EXIT STATUS = $${status}. Terminating"; \ + ${_dparv_END_OUTPUT}; \ + exit $${status}; \ + fi; \ + } + +##################################################### + +# Loops to lock directory +# _parv_PKG_DBDIR_LOCK_LOOP +# _parv_.CURDIR_LOCK_LOOP +# $${attempts} - Number of attempts to lock a directory. Exetranl variable. +# Default value = 1, if this var is not set. +# Set this variable to -1 for infinity loop. +# e.g. ( attempts=10; ${_parv_.CURDIR_LOCK_LOOP} ) && ..... || .... +# +_parv_${_lock_dir}_LOCK_LOOP= \ + enable_feedback=${_parv_ON_LOCK_FEEDBACK_TIMEOUT}; \ + if [ ! $${attempts} ]; then attempts=1; fi; \ + while [ $${attempts} -ne 0 ]; do \ + attempts=$$(( $${attempts} - 1 )); \ + ( ${_parv_${_lock_dir}_DO_LOCK} ) && status=$$? || status=$$?; \ + if [ $${status} -eq 0 ]; then \ + exit 0; \ + elif [ $${status} -eq ${_parv_ON_LOCK_EXIT_STATUS} ]; then \ + if [ $$(( $${enable_feedback} % ${_parv_ON_LOCK_FEEDBACK_TIMEOUT} )) -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} "Waiting for unlock ........................................................."; \ + ${_dparv_END_OUTPUT}; \ + enable_feedback=0; \ + fi; \ + enable_feedback=$$(( $${enable_feedback} + 1 )); \ + sleep ${_parv_LOCK_ATTEMPT_TIMEOUT}; \ + continue; \ + else \ + exit 1; \ + fi; \ + done; \ + exit ${_parv_ON_LOCK_EXIT_STATUS} + +##################################################### # _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 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}; \ -) +_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} "Dir: ${${_lock_dir}} is unlocked"; \ + ${_dparv_END_OUTPUT}; \ + } || { \ + ${_dparv_START_OUTPUT}; \ + ${ECHO_CMD} "Hard unlock!"; \ + ${RM} -rf ${${_lock_dir}}/${_parv_LOCK_FILE}; \ + ${_dparv_END_OUTPUT}; \ + } + .endfor # _lock_dir in PKG_DBDIR .CURDIR +##################################################### + +# _parv_CHECK_SEQ +# _parv_CHECK_LOCK +# The former variables Implement check for lock utility +# $${dir} - dir to check. External variable for script. Assign this variable +# appropriate value before executing this script e.g. ( dir=/some/dir/to/check; ${_parv_CHECK_LOCK} ) || ... +# Script exits with status ${_parv_ON_LOCK_EXIT_STATUS} if $${dir} is locked +# +_parv_CHECK_SEQ= \ + ${CHMOD} 777 $${dir}/${_parv_LOCK_FILE}; \ + pid=\$$(${CAT} $${dir}/${_parv_LOCK_FILE}); \ + if [ \$${pid} ]; then \ + ps -p \$${pid} > /dev/null && status=\$$? || status=\$$?; \ + if [ \$${status} -eq 0 ]; then \ + ${_dparv_START_OUTPUT}; \ + ${ECHO_CMD} Unable to lock $${dir}; \ + ${ECHO_CMD} Dir: $${dir} is already locked by another working process ...; \ + ${_dparv_START_OUTPUT}; \ + exit ${_parv_ON_LOCK_EXIT_STATUS}; \ + else \ + ${_dparv_START_OUTPUT}; \ + ${ECHO_CMD} Dir: $${dir} Stalled lock Detected!; \ + ${ECHO_CMD} Deleting stalled lock. PID=\$${pid}; \ + ${_dparv_END_OUTPUT}; \ + fi; \ + fi; \ + ${RM} -rf $${dir}/${_parv_LOCK_FILE} + +_parv_CHECK_LOCK= \ + lockf -k -t ${_parv_WAIT_FOR_LOCK_TIME} $${dir}/${_parv_LOCK_FILE} ${SH} -c "${_parv_CHECK_SEQ}" || { \ + status=$$?; \ + if [ $${status} -eq ${_parv_LOCKF_EX_TEMPFAIL} ] || \ + [ $${status} -eq ${_parv_ON_LOCK_EXIT_STATUS} ]; then \ + exit ${_parv_ON_LOCK_EXIT_STATUS}; \ + else \ + ${_dparv_START_OUTPUT}; \ + ${ECHO_CMD} "Unhandled EXIT STATUS = $${status}. Terminating"; \ + ${_dparv_END_OUTPUT}; \ + exit $${status}; \ + fi; \ + } + # End of Locking variables and tools section ##################################################### @@ -142,5 +232,4 @@ @${DO_NADA} do-unlock: - @${DO_NADA} - + @${DO_NADA} \ No newline at end of file Modified: soc2012/scher/par_ports/head/Mk/bsd.port.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.port.mk Mon May 28 09:51:10 2012 (r236582) +++ soc2012/scher/par_ports/head/Mk/bsd.port.mk Mon May 28 10:49:42 2012 (r236583) @@ -1531,7 +1531,7 @@ .BEGIN: . if defined(WANT_PARALLEL_BUILD) . if ${_parv_IS_DEFAULT_TARGET} - @${_parv_.CURDIR_DO_LOCK} + @attempts=-1; ${_parv_.CURDIR_LOCK_LOOP} . endif . endif # You can force skipping these test by defining IGNORE_PATH_CHECKS From scher at FreeBSD.org Mon May 28 12:01:39 2012 From: scher at FreeBSD.org (scher@FreeBSD.org) Date: Mon May 28 12:54:36 2012 Subject: socsvn commit: r236587 - soc2012/scher/par_ports/head/Mk Message-ID: <20120528120136.234951065672@hub.freebsd.org> Author: scher Date: Mon May 28 12:01:35 2012 New Revision: 236587 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236587 Log: [new_feature] ${PKG_DBDIR} locking for port's registration phase. new debugging barrier variable (some king of readln() ) [fixed] WANT_PARALLEL_BUILD variable renamed to _parv_WANT_PARALLEL_BUILD to suit parallel specific variables' names. 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 Mon May 28 10:45:51 2012 (r236586) +++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Mon May 28 12:01:35 2012 (r236587) @@ -17,6 +17,11 @@ _dparv_START_OUTPUT= ${ECHO_CMD} ${_dparv_START_OUTPUT_MESSAGE} _dparv_END_OUTPUT= ${ECHO_CMD} ${_dparv_END_OUTPUT_MESSAGE} +# Use it when you need a barrier +_dparv_DEBUGGING_BREAKPOINT= ${ECHO_CMD} Debugging breakpoint here...; \ + ${ECHO_CMD} Press any key when you are ready to continue; \ + read non_existed_var + # Delay for feedback message if the directory is locked. # Just not to annoy a user with feedback message on each attempt to lock a directory. _parv_ON_LOCK_FEEDBACK_TIMEOUT?= 2 Modified: soc2012/scher/par_ports/head/Mk/bsd.port.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.port.mk Mon May 28 10:45:51 2012 (r236586) +++ soc2012/scher/par_ports/head/Mk/bsd.port.mk Mon May 28 12:01:35 2012 (r236587) @@ -1133,7 +1133,7 @@ # parallel build/install features # -.if defined(WANT_PARALLEL_BUILD) +.if defined(_parv_WANT_PARALLEL_BUILD) .include "${PORTSDIR}/Mk/bsd.parallel.mk" .endif @@ -1527,9 +1527,9 @@ ############### PAR_PORTS SPECIFIC COMMENT LINE ############### # -.if defined(WANT_PARALLEL_BUILD) || !defined(IGNORE_PATH_CHECKS) +.if defined(_parv_WANT_PARALLEL_BUILD) || !defined(IGNORE_PATH_CHECKS) .BEGIN: -. if defined(WANT_PARALLEL_BUILD) +. if defined(_parv_WANT_PARALLEL_BUILD) . if ${_parv_IS_DEFAULT_TARGET} @attempts=-1; ${_parv_.CURDIR_LOCK_LOOP} . endif @@ -1542,9 +1542,9 @@ @${FALSE} . endif . endif -.endif #defined(WANT_PARALLEL_BUILD) || !defined(IGNORE_PATH_CHECKS) +.endif #defined(_parv_WANT_PARALLEL_BUILD) || !defined(IGNORE_PATH_CHECKS) -.if defined(WANT_PARALLEL_BUILD) +.if defined(_parv_WANT_PARALLEL_BUILD) .END: . if ${_parv_IS_DEFAULT_TARGET} @${_parv_.CURDIR_DO_UNLOCK} @@ -5919,6 +5919,17 @@ .if !target(fake-pkg) fake-pkg: .if !defined(NO_PKG_REGISTER) +############### PAR_PORTS SPECIFIC COMMENT LINE ############### +.if defined(_parv_WANT_PARALLEL_BUILD) + @( attempts=-1; ${_parv_PKG_DBDIR_LOCK_LOOP} ) || { \ + status=$$?; \ + ${_dparv_START_OUTPUT}; \ + ${ECHO_CMD} Unable to lock ${PKG_DBDIR}. Exit status $${status}; \ + ${_dparv_END_OUTPUT}; \ + exit 1; \ + } +.endif +############### END OF PAR_PORTS SPECIFIC COMMENT LINE ############### @if [ ! -d ${PKG_DBDIR} ]; then ${RM} -f ${PKG_DBDIR}; ${MKDIR} ${PKG_DBDIR}; fi @${RM} -f /tmp/${PKGNAME}-required-by .if defined(FORCE_PKG_REGISTER) @@ -5964,6 +5975,17 @@ ${CAT} /tmp/${PKGNAME}-required-by >> ${PKG_DBDIR}/${PKGNAME}/+REQUIRED_BY; \ ${RM} -f /tmp/${PKGNAME}-required-by; \ fi +############### PAR_PORTS SPECIFIC COMMENT LINE ############### +.if defined(_parv_WANT_PARALLEL_BUILD) + @( ${_parv_PKG_DBDIR_DO_UNLOCK} ) || { \ + status=$$?; \ + ${_dparv_START_OUTPUT}; \ + ${ECHO_CMD} Unable to unlock ${PKG_DBDIR}. Exit status $${status}; \ + ${_dparv_END_OUTPUT}; \ + exit 1; \ + } +.endif +############### END OF PAR_PORTS SPECIFIC COMMENT LINE ############### .else @${DO_NADA} .endif From vbotton at FreeBSD.org Mon May 28 12:11:57 2012 From: vbotton at FreeBSD.org (vbotton@FreeBSD.org) Date: Mon May 28 12:55:47 2012 Subject: socsvn commit: r236588 - soc2012/vbotton/ntfs_apple Message-ID: <20120528121155.3298A106564A@hub.freebsd.org> Author: vbotton Date: Mon May 28 12:11:54 2012 New Revision: 236588 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236588 Log: Delete useless includes, try to use ino_t instead of ino64_t Modified: soc2012/vbotton/ntfs_apple/ntfs_bitmap.c soc2012/vbotton/ntfs_apple/ntfs_collate.c soc2012/vbotton/ntfs_apple/ntfs_hash.c soc2012/vbotton/ntfs_apple/ntfs_inode.h soc2012/vbotton/ntfs_apple/ntfs_runlist.h soc2012/vbotton/ntfs_apple/ntfs_types.h soc2012/vbotton/ntfs_apple/ntfs_vfsops.c soc2012/vbotton/ntfs_apple/ntfs_vnops.c soc2012/vbotton/ntfs_apple/ntfs_volume.h Modified: soc2012/vbotton/ntfs_apple/ntfs_bitmap.c ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_bitmap.c Mon May 28 12:01:35 2012 (r236587) +++ soc2012/vbotton/ntfs_apple/ntfs_bitmap.c Mon May 28 12:11:54 2012 (r236588) @@ -35,12 +35,9 @@ * http://developer.apple.com/opensource/licenses/gpl-2.txt. */ +#include #include -#include - -#include - #include "ntfs_bitmap.h" #include "ntfs_debug.h" #include "ntfs_inode.h" Modified: soc2012/vbotton/ntfs_apple/ntfs_collate.c ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_collate.c Mon May 28 12:01:35 2012 (r236587) +++ soc2012/vbotton/ntfs_apple/ntfs_collate.c Mon May 28 12:11:54 2012 (r236588) @@ -35,9 +35,6 @@ * http://developer.apple.com/opensource/licenses/gpl-2.txt. */ -#include - -#include #include "ntfs_collate.h" #include "ntfs_debug.h" Modified: soc2012/vbotton/ntfs_apple/ntfs_hash.c ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_hash.c Mon May 28 12:01:35 2012 (r236587) +++ soc2012/vbotton/ntfs_apple/ntfs_hash.c Mon May 28 12:11:54 2012 (r236588) @@ -35,10 +35,10 @@ * http://developer.apple.com/opensource/licenses/gpl-2.txt. */ +#include #include #include -#include #include #include #include @@ -46,10 +46,6 @@ #include #include -#include -#include - -#include #include "ntfs.h" #include "ntfs_debug.h" Modified: soc2012/vbotton/ntfs_apple/ntfs_inode.h ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_inode.h Mon May 28 12:01:35 2012 (r236587) +++ soc2012/vbotton/ntfs_apple/ntfs_inode.h Mon May 28 12:11:54 2012 (r236588) @@ -80,7 +80,7 @@ inodes and is incremented/decremented in the base inode for attribute/raw inode opens/closes, too. */ - struct mutex lock; /* Lock serializing changes to the inode such + struct mtx 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 @@ -91,13 +91,14 @@ this is the size of an mst protected ntfs record. */ u8 block_size_shift; /* Log2 of the above. */ - lck_spin_t size_lock; /* Lock serializing access to inode sizes. */ + struct mtx size_lock; /* Lock serializing access to inode sizes. */ s64 allocated_size; /* Copy from the attribute record. */ s64 data_size; /* Copy from the attribute record. */ s64 initialized_size; /* Copy from the attribute record. */ u32 flags; /* NTFS specific flags describing this inode. See ntfs_inode_flags_shift below. */ - ino64_t mft_no; /* Number of the mft record / inode. */ + /*ino64_t mft_no;*/ + ino_t mft_no; /* Number of the mft record / inode. */ u16 seq_no; /* Sequence number of the inode. */ unsigned link_count; /* Number of hard links to this inode. Note we make this field an integer, i.e. at least @@ -187,7 +188,7 @@ * inodes. */ ntfs_inode *mft_ni; /* Pointer to the ntfs inode of $MFT. */ - buf_t m_buf; /* Buffer containing the mft record of the + struct buf m_buf; /* Buffer containing the mft record of the inode. This should only be touched by the ntfs_*mft_record_(un)map() functions. */ MFT_RECORD *m; /* Address of the buffer data and thus address @@ -400,7 +401,7 @@ static inline u32 NInoTestClear##flag(ntfs_inode *ni) \ { \ ni->flags &= ~((u32)1 << NI_##flag); \ - return (u32)((ni->flags >> NI_##flag) & 1) \ + return (u32)((ni->flags >> NI_##flag) & 1); \ } /* Emit the ntfs inode bitops functions. */ @@ -481,7 +482,8 @@ * possible on all architectures. */ struct _ntfs_attr { - ino64_t mft_no; + //ino64_t mft_no; + ino_t mft_no; ntfschar *name; u32 name_len; ATTR_TYPE type; Modified: soc2012/vbotton/ntfs_apple/ntfs_runlist.h ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_runlist.h Mon May 28 12:01:35 2012 (r236587) +++ soc2012/vbotton/ntfs_apple/ntfs_runlist.h Mon May 28 12:11:54 2012 (r236588) @@ -114,12 +114,14 @@ { rl->rl = NULL; rl->alloc = rl->elements = 0; - lck_rw_init(&rl->lock, ntfs_lock_grp, ntfs_lock_attr); + //lck_rw_init(&rl->lock, ntfs_lock_grp, ntfs_lock_attr); + rw_init(&rl->lock, "runlist lock"); } static inline void ntfs_rl_deinit(ntfs_runlist *rl) { - lck_rw_destroy(&rl->lock, ntfs_lock_grp); + //lck_rw_destroy(&rl->lock, ntfs_lock_grp); + rw_destroy(&rl->lock); } /** Modified: soc2012/vbotton/ntfs_apple/ntfs_types.h ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_types.h Mon May 28 12:01:35 2012 (r236587) +++ soc2012/vbotton/ntfs_apple/ntfs_types.h Mon May 28 12:11:54 2012 (r236588) @@ -108,5 +108,9 @@ /* Our boolean type. */ typedef int BOOL; +#define FALSE 0 +#define TRUE 1 + +typedef int errno_t; #endif /* !_OSX_NTFS_TYPES_H */ Modified: soc2012/vbotton/ntfs_apple/ntfs_vfsops.c ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_vfsops.c Mon May 28 12:01:35 2012 (r236587) +++ soc2012/vbotton/ntfs_apple/ntfs_vfsops.c Mon May 28 12:11:54 2012 (r236588) @@ -35,28 +35,18 @@ * http://developer.apple.com/opensource/licenses/gpl-2.txt. */ +#include #include -#include #include #include #include -#include -#include #include #include #include #include -#include #include #include - -#include -#include -#include - -#include - -#include +#include #include "ntfs.h" #include "ntfs_attr.h" Modified: soc2012/vbotton/ntfs_apple/ntfs_vnops.c ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_vnops.c Mon May 28 12:01:35 2012 (r236587) +++ soc2012/vbotton/ntfs_apple/ntfs_vnops.c Mon May 28 12:11:54 2012 (r236588) @@ -35,6 +35,7 @@ * http://developer.apple.com/opensource/licenses/gpl-2.txt. */ +#include #include #include #include @@ -46,8 +47,6 @@ #include #include -#include - #include "ntfs.h" #include "ntfs_attr.h" Modified: soc2012/vbotton/ntfs_apple/ntfs_volume.h ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_volume.h Mon May 28 12:01:35 2012 (r236587) +++ soc2012/vbotton/ntfs_apple/ntfs_volume.h Mon May 28 12:11:54 2012 (r236588) @@ -172,7 +172,7 @@ initialized. */ le32 default_file_security_id; /* The security_id to use when creating files or 0 if not initialized. */ - lck_spin_t security_id_lock; /* Lock for serializing accesses to the + struct mtx security_id_lock; /* Lock for serializing accesses to the security_id related variables. */ /* * $Extend system directory is located in the root directory with inode From exxo at FreeBSD.org Mon May 28 15:55:50 2012 From: exxo at FreeBSD.org (exxo@FreeBSD.org) Date: Mon May 28 15:55:59 2012 Subject: socsvn commit: r236599 - soc2012/exxo/head Message-ID: <20120528155549.4159310656DD@hub.freebsd.org> Author: exxo Date: Mon May 28 15:55:48 2012 New Revision: 236599 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236599 Log: Clone FreeBSD head Added: soc2012/exxo/head/ (props changed) - copied from r236598, mirror/FreeBSD/head/ From exxo at FreeBSD.org Mon May 28 16:56:40 2012 From: exxo at FreeBSD.org (exxo@FreeBSD.org) Date: Mon May 28 16:56:46 2012 Subject: socsvn commit: r236601 - in soc2012/exxo: . head/contrib/cvs/src patches regress Message-ID: <20120528165638.09495106566B@hub.freebsd.org> Author: exxo Date: Mon May 28 16:56:37 2012 New Revision: 236601 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236601 Log: Modify tree and provide software notes Added: soc2012/exxo/patches/ soc2012/exxo/patches/cvs-inet6.patch soc2012/exxo/regress/ soc2012/exxo/softnotes.txt Modified: soc2012/exxo/ (props changed) soc2012/exxo/head/contrib/cvs/src/client.c Modified: soc2012/exxo/head/contrib/cvs/src/client.c ============================================================================== --- soc2012/exxo/head/contrib/cvs/src/client.c Mon May 28 15:34:55 2012 (r236600) +++ soc2012/exxo/head/contrib/cvs/src/client.c Mon May 28 16:56:37 2012 (r236601) @@ -85,7 +85,7 @@ /* This is needed for GSSAPI encryption. */ static gss_ctx_id_t gcontext; -static int connect_to_gserver PROTO((cvsroot_t *, int, struct hostent *)); +static int connect_to_gserver PROTO((cvsroot_t *, int, const char *)); # endif /* HAVE_GSSAPI */ @@ -149,7 +149,7 @@ static size_t try_read_from_server PROTO ((char *, size_t)); static void auth_server PROTO ((cvsroot_t *, struct buffer *, struct buffer *, - int, int, struct hostent *)); + int, int, const char *)); /* We need to keep track of the list of directories we've sent to the server. This list, along with the current CVSROOT, will help us @@ -3605,6 +3605,28 @@ return hostinfo; } +static void +_inet_ntop(int af, struct sockaddr *sa, char *addr, socklen_t len) +{ + struct sockaddr_in *sin; + struct sockaddr_in6 *sin6; + + addr[0] = '\0'; + assert(af == sa->sa_family); + switch (af) + { + case AF_INET6: + sin6 = (struct sockaddr_in6 *)sa; + inet_ntop(af, &sin6->sin6_addr, addr, len); + break; + case AF_INET: + sin = (struct sockaddr_in *)sa; + inet_ntop(af, &sin->sin_addr, addr, len); + break; + default: + break; + } +} /* Generic function to do port number lookup tasks. @@ -3779,33 +3801,75 @@ { int sock; int port_number; - struct sockaddr_in client_sai; - struct hostent *hostinfo; struct buffer *to_server, *from_server; + struct addrinfo hints, *res, *res0, *ress; + int err, cause; + char ports[7], addr[INET6_ADDRSTRLEN]; - sock = socket (AF_INET, SOCK_STREAM, 0); - if (sock == -1) - { - error (1, 0, "cannot create socket: %s", SOCK_STRERROR (SOCK_ERRNO)); - } port_number = get_cvs_port_number (root); - hostinfo = init_sockaddr (&client_sai, root->hostname, port_number); - if (trace) + snprintf(ports, sizeof(ports), "%d", port_number); + + memset(&hints, 0, sizeof(hints)); + hints.ai_flags = AI_CANONNAME; + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + err = getaddrinfo(root->hostname, ports, &hints, &res0); + if (err) { - fprintf (stderr, " -> Connecting to %s(%s):%d\n", - root->hostname, - inet_ntoa (client_sai.sin_addr), port_number); + error(1, 0, "%s", gai_strerror(err)); + } + sock = -1; + cause = 0; + for (res = res0; res; res = res->ai_next) { + sock = socket(res->ai_family, res->ai_socktype, + res->ai_protocol); + if (sock < 0) { + cause = 1; + err = SOCK_ERRNO; + ress = res; + continue; + } + + if (trace) + { + _inet_ntop(res->ai_family, res->ai_addr, addr, sizeof(addr)); + fprintf (stderr, " -> Connecting to %s(%s):%d\n", + root->hostname, addr, port_number); + } + + if (connect(sock, res->ai_addr, res->ai_addrlen) < 0) { + cause = 2; + err = SOCK_ERRNO; + ress = res; + close(sock); + sock = -1; + continue; + } + + break; /* okay we got one */ + } + if (sock < 0) { + switch (cause) + { + case 1: + freeaddrinfo(res0); + error (1, 0, "cannot create socket: %s", SOCK_STRERROR (SOCK_ERRNO)); + case 2: + _inet_ntop(ress->ai_family, ress->ai_addr, addr, sizeof(addr)); + freeaddrinfo(res0); + error (1, 0, "connect to %s(%s):%d failed: %s", + root->hostname, addr, port_number, + SOCK_STRERROR (err)); + default: + freeaddrinfo(res0); + error (1, 0, "%s: unknown error", __func__); + } } - if (connect (sock, (struct sockaddr *) &client_sai, sizeof (client_sai)) - < 0) - error (1, 0, "connect to %s(%s):%d failed: %s", - root->hostname, - inet_ntoa (client_sai.sin_addr), - port_number, SOCK_STRERROR (SOCK_ERRNO)); make_bufs_from_fds (sock, sock, 0, &to_server, &from_server, 1); - auth_server (root, to_server, from_server, verify_only, do_gssapi, hostinfo); + auth_server (root, to_server, from_server, verify_only, do_gssapi, res->ai_canonname); + freeaddrinfo(res0); if (verify_only) { @@ -3839,13 +3903,13 @@ static void -auth_server (root, lto_server, lfrom_server, verify_only, do_gssapi, hostinfo) +auth_server (root, lto_server, lfrom_server, verify_only, do_gssapi, hostname) cvsroot_t *root; struct buffer *lto_server; struct buffer *lfrom_server; int verify_only; int do_gssapi; - struct hostent *hostinfo; + const char *hostname; { char *username = ""; /* the username we use to connect */ char no_passwd = 0; /* gets set if no password found */ @@ -3875,7 +3939,7 @@ error (1, 0, "gserver currently only enabled for socket connections"); } - if (! connect_to_gserver (root, fd, hostinfo)) + if (! connect_to_gserver (root, fd, hostname)) { error (1, 0, "authorization failed: server %s rejected access to %s", @@ -4076,6 +4140,7 @@ struct sockaddr_in sin; char *hname; + /* XXX Not IPv6 ready, but MIT Kerberos 4 code thou shall not touch. */ s = socket (AF_INET, SOCK_STREAM, 0); if (s < 0) error (1, 0, "cannot create socket: %s", SOCK_STRERROR (SOCK_ERRNO)); @@ -4176,10 +4241,10 @@ */ #define BUFSIZE 1024 static int -connect_to_gserver (root, sock, hostinfo) +connect_to_gserver (root, sock, hostname) cvsroot_t *root; int sock; - struct hostent *hostinfo; + const char *hostname; { char *str; char buf[BUFSIZE]; @@ -4192,9 +4257,9 @@ if (send (sock, str, strlen (str), 0) < 0) error (1, 0, "cannot send: %s", SOCK_STRERROR (SOCK_ERRNO)); - if (strlen (hostinfo->h_name) > BUFSIZE - 5) + if (strlen (hostname) > BUFSIZE - 5) error (1, 0, "Internal error: hostname exceeds length of buffer"); - sprintf (buf, "cvs@%s", hostinfo->h_name); + sprintf (buf, "cvs@%s", hostname); tok_in.length = strlen (buf); tok_in.value = buf; gss_import_name (&stat_min, &tok_in, GSS_C_NT_HOSTBASED_SERVICE, Added: soc2012/exxo/patches/cvs-inet6.patch ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/exxo/patches/cvs-inet6.patch Mon May 28 16:56:37 2012 (r236601) @@ -0,0 +1,207 @@ +Index: src/client.c +=================================================================== +RCS file: /home/ncvs/src/contrib/cvs/src/client.c,v +retrieving revision 1.14 +diff -p -u -r1.14 client.c +--- src/client.c 19 Mar 2008 14:49:14 -0000 1.14 ++++ src/client.c 15 May 2012 01:47:06 -0000 +@@ -85,7 +85,7 @@ static Key_schedule sched; + /* This is needed for GSSAPI encryption. */ + static gss_ctx_id_t gcontext; + +-static int connect_to_gserver PROTO((cvsroot_t *, int, struct hostent *)); ++static int connect_to_gserver PROTO((cvsroot_t *, int, const char *)); + + # endif /* HAVE_GSSAPI */ + +@@ -149,7 +149,7 @@ static void handle_notified PROTO((char + static size_t try_read_from_server PROTO ((char *, size_t)); + + static void auth_server PROTO ((cvsroot_t *, struct buffer *, struct buffer *, +- int, int, struct hostent *)); ++ int, int, const char *)); + + /* We need to keep track of the list of directories we've sent to the + server. This list, along with the current CVSROOT, will help us +@@ -3605,6 +3605,28 @@ init_sockaddr (name, hostname, port) + return hostinfo; + } + ++static void ++_inet_ntop(int af, struct sockaddr *sa, char *addr, socklen_t len) ++{ ++ struct sockaddr_in *sin; ++ struct sockaddr_in6 *sin6; ++ ++ addr[0] = '\0'; ++ assert(af == sa->sa_family); ++ switch (af) ++ { ++ case AF_INET6: ++ sin6 = (struct sockaddr_in6 *)sa; ++ inet_ntop(af, &sin6->sin6_addr, addr, len); ++ break; ++ case AF_INET: ++ sin = (struct sockaddr_in *)sa; ++ inet_ntop(af, &sin->sin_addr, addr, len); ++ break; ++ default: ++ break; ++ } ++} + + + /* Generic function to do port number lookup tasks. +@@ -3779,33 +3801,75 @@ connect_to_pserver (root, to_server_p, f + { + int sock; + int port_number; +- struct sockaddr_in client_sai; +- struct hostent *hostinfo; + struct buffer *to_server, *from_server; ++ struct addrinfo hints, *res, *res0, *ress; ++ int err, cause; ++ char ports[7], addr[INET6_ADDRSTRLEN]; + +- sock = socket (AF_INET, SOCK_STREAM, 0); +- if (sock == -1) +- { +- error (1, 0, "cannot create socket: %s", SOCK_STRERROR (SOCK_ERRNO)); +- } + port_number = get_cvs_port_number (root); +- hostinfo = init_sockaddr (&client_sai, root->hostname, port_number); +- if (trace) ++ snprintf(ports, sizeof(ports), "%d", port_number); ++ ++ memset(&hints, 0, sizeof(hints)); ++ hints.ai_flags = AI_CANONNAME; ++ hints.ai_family = PF_UNSPEC; ++ hints.ai_socktype = SOCK_STREAM; ++ err = getaddrinfo(root->hostname, ports, &hints, &res0); ++ if (err) + { +- fprintf (stderr, " -> Connecting to %s(%s):%d\n", +- root->hostname, +- inet_ntoa (client_sai.sin_addr), port_number); ++ error(1, 0, "%s", gai_strerror(err)); ++ } ++ sock = -1; ++ cause = 0; ++ for (res = res0; res; res = res->ai_next) { ++ sock = socket(res->ai_family, res->ai_socktype, ++ res->ai_protocol); ++ if (sock < 0) { ++ cause = 1; ++ err = SOCK_ERRNO; ++ ress = res; ++ continue; ++ } ++ ++ if (trace) ++ { ++ _inet_ntop(res->ai_family, res->ai_addr, addr, sizeof(addr)); ++ fprintf (stderr, " -> Connecting to %s(%s):%d\n", ++ root->hostname, addr, port_number); ++ } ++ ++ if (connect(sock, res->ai_addr, res->ai_addrlen) < 0) { ++ cause = 2; ++ err = SOCK_ERRNO; ++ ress = res; ++ close(sock); ++ sock = -1; ++ continue; ++ } ++ ++ break; /* okay we got one */ ++ } ++ if (sock < 0) { ++ switch (cause) ++ { ++ case 1: ++ freeaddrinfo(res0); ++ error (1, 0, "cannot create socket: %s", SOCK_STRERROR (SOCK_ERRNO)); ++ case 2: ++ _inet_ntop(ress->ai_family, ress->ai_addr, addr, sizeof(addr)); ++ freeaddrinfo(res0); ++ error (1, 0, "connect to %s(%s):%d failed: %s", ++ root->hostname, addr, port_number, ++ SOCK_STRERROR (err)); ++ default: ++ freeaddrinfo(res0); ++ error (1, 0, "%s: unknown error", __func__); ++ } + } +- if (connect (sock, (struct sockaddr *) &client_sai, sizeof (client_sai)) +- < 0) +- error (1, 0, "connect to %s(%s):%d failed: %s", +- root->hostname, +- inet_ntoa (client_sai.sin_addr), +- port_number, SOCK_STRERROR (SOCK_ERRNO)); + + make_bufs_from_fds (sock, sock, 0, &to_server, &from_server, 1); + +- auth_server (root, to_server, from_server, verify_only, do_gssapi, hostinfo); ++ auth_server (root, to_server, from_server, verify_only, do_gssapi, res->ai_canonname); ++ freeaddrinfo(res0); + + if (verify_only) + { +@@ -3839,13 +3903,13 @@ connect_to_pserver (root, to_server_p, f + + + static void +-auth_server (root, lto_server, lfrom_server, verify_only, do_gssapi, hostinfo) ++auth_server (root, lto_server, lfrom_server, verify_only, do_gssapi, hostname) + cvsroot_t *root; + struct buffer *lto_server; + struct buffer *lfrom_server; + int verify_only; + int do_gssapi; +- struct hostent *hostinfo; ++ const char *hostname; + { + char *username = ""; /* the username we use to connect */ + char no_passwd = 0; /* gets set if no password found */ +@@ -3875,7 +3939,7 @@ auth_server (root, lto_server, lfrom_ser + error (1, 0, "gserver currently only enabled for socket connections"); + } + +- if (! connect_to_gserver (root, fd, hostinfo)) ++ if (! connect_to_gserver (root, fd, hostname)) + { + error (1, 0, + "authorization failed: server %s rejected access to %s", +@@ -4076,6 +4140,7 @@ start_tcp_server (root, to_server, from_ + struct sockaddr_in sin; + char *hname; + ++ /* XXX Not IPv6 ready, but MIT Kerberos 4 code thou shall not touch. */ + s = socket (AF_INET, SOCK_STREAM, 0); + if (s < 0) + error (1, 0, "cannot create socket: %s", SOCK_STRERROR (SOCK_ERRNO)); +@@ -4176,10 +4241,10 @@ recv_bytes (sock, buf, need) + */ + #define BUFSIZE 1024 + static int +-connect_to_gserver (root, sock, hostinfo) ++connect_to_gserver (root, sock, hostname) + cvsroot_t *root; + int sock; +- struct hostent *hostinfo; ++ const char *hostname; + { + char *str; + char buf[BUFSIZE]; +@@ -4192,9 +4257,9 @@ connect_to_gserver (root, sock, hostinfo + if (send (sock, str, strlen (str), 0) < 0) + error (1, 0, "cannot send: %s", SOCK_STRERROR (SOCK_ERRNO)); + +- if (strlen (hostinfo->h_name) > BUFSIZE - 5) ++ if (strlen (hostname) > BUFSIZE - 5) + error (1, 0, "Internal error: hostname exceeds length of buffer"); +- sprintf (buf, "cvs@%s", hostinfo->h_name); ++ sprintf (buf, "cvs@%s", hostname); + tok_in.length = strlen (buf); + tok_in.value = buf; + gss_import_name (&stat_min, &tok_in, GSS_C_NT_HOSTBASED_SERVICE, Added: soc2012/exxo/softnotes.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/exxo/softnotes.txt Mon May 28 16:56:37 2012 (r236601) @@ -0,0 +1,3 @@ +contrib/cvs FIXED (patch updated) +usr.bin/who OK (software dependant, utmpx fixed it) + From gpf at FreeBSD.org Mon May 28 16:57:53 2012 From: gpf at FreeBSD.org (gpf@FreeBSD.org) Date: Mon May 28 16:57:59 2012 Subject: socsvn commit: r236602 - soc2012/gpf/misc Message-ID: <20120528165751.2670C1065670@hub.freebsd.org> Author: gpf Date: Mon May 28 16:57:50 2012 New Revision: 236602 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236602 Log: fix print of file_id Modified: soc2012/gpf/misc/test_checksum.c Modified: soc2012/gpf/misc/test_checksum.c ============================================================================== --- soc2012/gpf/misc/test_checksum.c Mon May 28 16:56:37 2012 (r236601) +++ soc2012/gpf/misc/test_checksum.c Mon May 28 16:57:50 2012 (r236602) @@ -155,7 +155,7 @@ 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); + printf("\tid = %llu!\tnhashes = %d\n", fhp->file_id, fhp->nhashes); TAILQ_FOREACH(csp, &(fhp->checksums), checksum_entries) { printf("\t\tdigest="); for (j = 0; j < hash_len; j++) From gpf at FreeBSD.org Mon May 28 17:02:34 2012 From: gpf at FreeBSD.org (gpf@FreeBSD.org) Date: Mon May 28 17:02:40 2012 Subject: socsvn commit: r236605 - in soc2012/gpf/pefs_kmod: sbin/pefs sys/fs/pefs Message-ID: <20120528170232.1390C106564A@hub.freebsd.org> Author: gpf Date: Mon May 28 17:02:31 2012 New Revision: 236605 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236605 Log: add ioctl() to retrieve ciphertext for specific 4k sector. 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 Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Mon May 28 16:37:42 2012 (r236604) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Mon May 28 17:02:31 2012 (r236605) @@ -69,6 +69,7 @@ #define PEFS_FH_SIZE 16 #define PEFS_BUCKET_SIZE 8 +/* XXXgpf: unions for on disk structs and move to a different header? */ struct checksum_file_header { uint8_t version; uint8_t reserved; @@ -83,6 +84,7 @@ TAILQ_ENTRY(checksum) checksum_entries; }; +/* XXXgpf: [TODO] turns offsets to 64bits uints (or off_t?) */ struct file_header { uint32_t nhashes; uint64_t file_id; @@ -108,13 +110,25 @@ pefs_compute_file_checksums(struct file_header *fhp, const EVP_MD *md, uint8_t hash_len) { - char buf[PEFS_SECTOR_SIZE]; + + struct pefs_xsector_ctext xsct; EVP_MD_CTX mdctx; - int md_len, i, fd, bytes_read; + struct stat sb; + off_t resid; + uint32_t bytes_to_read; + int error, i, fd, md_len; struct checksum *csp; TAILQ_INIT(&(fhp->checksums)); + /* XXXgpf: what happens if file size > 2^64? */ + if (stat(fhp->path, &sb) != 0) { + warn("cannot stat file %s", fhp->path); + return (PEFS_ERR_SYS); + } + + resid = sb.st_size; + fd = open(fhp->path, O_RDONLY); if (fd < 0) { warn("failed to open file: %s", fhp->path); @@ -122,13 +136,31 @@ } fhp->nhashes = 0; - while ((bytes_read = read(fd, buf, sizeof(buf))) > 0) { + xsct.pxsct_offset = 0; + while (resid > 0) { + if (resid > PEFS_SECTOR_SIZE) + bytes_to_read = PEFS_SECTOR_SIZE; + else + bytes_to_read = resid; + + resid-=bytes_to_read; + xsct.pxsct_ctext_len = bytes_to_read; + error = ioctl(fd, PEFS_GETSECTORCTEXT, &xsct); + if (error != 0) { + pefs_warn("error retrieving ciphertext of %s", fhp->path); + close(fd); + return (PEFS_ERR_IO); + } + xsct.pxsct_offset+= xsct.pxsct_ctext_len; + EVP_MD_CTX_init(&mdctx); EVP_DigestInit_ex(&mdctx, md, NULL); - EVP_DigestUpdate(&mdctx, buf, bytes_read); + EVP_DigestUpdate(&mdctx, xsct.pxsct_ctext, xsct.pxsct_ctext_len); - dprintf(("read %d bytes\n", bytes_read)); - //for (i=0; ibuckets[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)); - dprintf(("\tid = %d!\tnhashes = %d\n", (int)fhp->file_id, fhp->nhashes)); + dprintf(("\tid = %llu!\tnhashes = %d\n", fhp->file_id, fhp->nhashes)); TAILQ_FOREACH(csp, &(fhp->checksums), checksum_entries) { dprintf(("\t\tdigest=")); for (j = 0; j < hash_len; j++) @@ -613,7 +645,7 @@ * 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 + * XXXgpf: [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) Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Mon May 28 16:37:42 2012 (r236604) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Mon May 28 17:02:31 2012 (r236605) @@ -108,6 +108,8 @@ { NULL, NULL }, }; + +/* XXXgpf: [TODO] should probably add more at a later point */ const char *supported_digests[] = {"sha256","sha512"}; void @@ -1048,7 +1050,6 @@ /* by default create checksum file under $PWD */ snprintf(csm_path, sizeof(csm_path), "./%s", PEFS_FILE_CHECKSUM); - /* 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': Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h ============================================================================== --- soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h Mon May 28 16:37:42 2012 (r236604) +++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h Mon May 28 17:02:31 2012 (r236605) @@ -61,6 +61,12 @@ char pnm_filename[MAXPATHLEN]; }; +struct pefs_xsector_ctext { + off_t pxsct_offset; + uint32_t pxsct_ctext_len; + char pxsct_ctext[PEFS_SECTOR_SIZE]; +}; + #ifdef _IO #define PEFS_GETKEY _IOWR('p', 0, struct pefs_xkey) #define PEFS_ADDKEY _IOWR('p', 1, struct pefs_xkey) @@ -69,6 +75,7 @@ #define PEFS_FLUSHKEYS _IO('p', 4) #define PEFS_GETNODEKEY _IOWR('p', 5, struct pefs_xkey) #define PEFS_GETNAMEMAC _IOWR('p', 6, struct pefs_namemac) +#define PEFS_GETSECTORCTEXT _IOWR('p', 7, struct pefs_xsector_ctext) #endif #ifdef _KERNEL Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c ============================================================================== --- soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Mon May 28 16:37:42 2012 (r236604) +++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Mon May 28 17:02:31 2012 (r236605) @@ -2357,15 +2357,20 @@ { struct pefs_enccn enccn; struct componentname cn; + struct pefs_chunk pc; + u_quad_t fsize; struct vnode *vp = ap->a_vp; + struct vnode *lvp = PEFS_LOWERVP(vp); struct pefs_xkey *xk = ap->a_data; struct pefs_namemac *namemac = ap->a_data; + struct pefs_xsector_ctext *xsct = 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; + struct uio *puio; char *enc, *buf; size_t enc_len, buf_len; int error = 0, i, r; @@ -2470,28 +2475,73 @@ if (pefs_key_remove_all(pm)) pefs_flushkey(mp, td, PEFS_FLUSHKEY_ALL, NULL); break; + case PEFS_GETSECTORCTEXT: + vn_lock(vp, LK_EXCLUSIVE); + + if (vp->v_type != VREG) { + printf("pefs_ioctl: PEFS_GETSECTORCTEXT vp is not a reg file\n"); + VOP_UNLOCK(vp, 0); + return (EOPNOTSUPP); + } + + error = pefs_getsize(vp, &fsize, cred); + if (error != 0) { + VOP_UNLOCK(vp, 0); + return (error); + } + + if (xsct->pxsct_ctext_len > PEFS_SECTOR_SIZE || xsct->pxsct_ctext_len == 0 + || xsct->pxsct_ctext_len > fsize) { + printf("pefs_ioctl: PEFS_GETSECTORCTEXT invalid len: %d\n", + xsct->pxsct_ctext_len); + VOP_UNLOCK(vp, 0); + return (EINVAL); + } + + if (xsct->pxsct_offset > (fsize - xsct->pxsct_ctext_len)) { + printf("pefs_ioctl: PEFS_GETSECTORCTEXT invalid offset: %llu\n", + xsct->pxsct_offset); + VOP_UNLOCK(vp, 0); + return (EINVAL); + } + + pn = VP_TO_PN(vp); + pefs_chunk_create(&pc, pn, xsct->pxsct_ctext_len); + puio = pefs_chunk_uio(&pc, xsct->pxsct_offset, UIO_READ); + + /* XXXgpf: is this lock really necessary? */ + vn_lock(lvp, LK_EXCLUSIVE); + error = VOP_READ(lvp, puio, IO_UNIT | IO_NODELOCKED, cred); + VOP_UNLOCK(lvp, 0); + + if (error == 0) + memcpy(xsct->pxsct_ctext, pc.pc_base, xsct->pxsct_ctext_len); + + pefs_chunk_free(&pc, pn); + VOP_UNLOCK(vp, 0); + break; case PEFS_GETNAMEMAC: - /* XXXgpf: should I change printf to PEFSDEBUG or something else? */ + vn_lock(vp, LK_EXCLUSIVE); + /* XXXgpf: should I change printf to something else? e.g. PEFSDEBUG */ if (vp->v_type != VDIR) { printf("pefs_ioctl: PEFS_GETNAMEMAC vp is not a directory\n"); - error = EINVAL; - break; + VOP_UNLOCK(vp, 0); + return (EINVAL); } if (strnlen(namemac->pnm_filename, sizeof(namemac->pnm_filename)) != namemac->pnm_namelen) { printf("pefs_ioctl: PEFS_GETNAMEMAC incorrect pnm_namelen %d\n", namemac->pnm_namelen); - error = EINVAL; - break; + VOP_UNLOCK(vp, 0); + return (EINVAL); } if (strchr(namemac->pnm_filename, '/') != NULL) { printf("pefs_ioctl: PEFS_GETNAMEMAC pnm_filename contains '/'\n"); - error = EINVAL; - break; + VOP_UNLOCK(vp, 0); + return (EINVAL); } - vn_lock(vp, LK_EXCLUSIVE); pefs_enccn_init(&enccn); cn.cn_nameiop = LOOKUP; @@ -2522,6 +2572,10 @@ r = pefs_name_pton(enc, enc_len, buf, buf_len); if (r <= 0) error = EINVAL; + /* + * XXXgpf: [TODO] endianess!! Change int64_t to char[8] + * and deal with endianess at user-space + */ else memcpy(&(namemac->pnm_csum), buf, PEFS_NAME_CSUM_SIZE); From exxo at FreeBSD.org Mon May 28 18:03:11 2012 From: exxo at FreeBSD.org (exxo@FreeBSD.org) Date: Mon May 28 18:03:17 2012 Subject: socsvn commit: r236608 - soc2012/exxo Message-ID: <20120528180310.386B9106566B@hub.freebsd.org> Author: exxo Date: Mon May 28 18:03:09 2012 New Revision: 236608 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236608 Log: Delete old patch location Deleted: soc2012/exxo/cvs-inet6.patch From jhagewood at FreeBSD.org Tue May 29 02:35:15 2012 From: jhagewood at FreeBSD.org (jhagewood@FreeBSD.org) Date: Tue May 29 02:35:26 2012 Subject: socsvn commit: r236632 - soc2012/jhagewood/mdocml Message-ID: <20120529023514.48030106566C@hub.freebsd.org> Author: jhagewood Date: Tue May 29 02:35:13 2012 New Revision: 236632 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236632 Log: Deleted: soc2012/jhagewood/mdocml/ From tzabal at FreeBSD.org Tue May 29 02:35:16 2012 From: tzabal at FreeBSD.org (tzabal@FreeBSD.org) Date: Tue May 29 02:35:27 2012 Subject: socsvn commit: r236633 - soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport Message-ID: <20120529023514.A6B471065670@hub.freebsd.org> Author: tzabal Date: Tue May 29 02:35:14 2012 New Revision: 236633 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236633 Log: Updated version of /usr/sbin/crashreport. 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 Tue May 29 02:35:13 2012 (r236632) +++ soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh Tue May 29 02:35:14 2012 (r236633) @@ -2,16 +2,16 @@ . /etc/rc.conf + print_usage() { echo "usage: $(basename $0) [-d dumpdir] [-f file] [-e email]" } -# Constants +# Default dump directory DUMPDIR='/var/crash' -# Script variables _dumpdir="" _file="" _email="" @@ -35,19 +35,11 @@ esac done -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 + # dumpdir of /etc/rc.conf if [ -z "${dumpdir}" ]; then - # Use the default dumpdir _dumpdir=${DUMPDIR} else _dumpdir=${dumpdir} @@ -64,16 +56,14 @@ exit 2 fi -echo "_dumpdir = ${_dumpdir}" ## Find the file that contains the debugging information ## It is either a core.txt.X or a textdump.tar.X +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 @@ -86,7 +76,7 @@ fi # Otherwise, use this (heavier) way else - _file=`ls ${_dumpdir} | grep '[a-z]*\.[a-z]*\.\w*' | \ + _file=`ls ${_dumpdir} | egrep '[a-z]+\.[a-z]+\.[0-9]+' | \ sort -n -t . -k 3 | tail -1` fi fi @@ -96,12 +86,10 @@ 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 of /etc/rc.conf _email="${email}" fi @@ -115,14 +103,24 @@ > /dev/null if [ "$?" -ne "0" ]; then - echo "Email address ${_email} is invalid." + echo "crashreport: Email address ${_email} is invalid." exit 5 fi -echo "_email = ${_email}" -## Send the report -echo 'Sending the report...' +## Bundle the report +report="report.tar" +email_file=`mktemp /tmp/crashreport.XXXXXX` + +echo "${_email}" > ${email_file} +tar -c -f ${report} ${_dumpdir}/${_file} ${email_file} + + +## Send the report to the Central Collector machine +user="reporter" +hostname="akcrs.dyndns.org" +scp -q ${report} ${user}@${hostname}: + -# Everything went smooth +# Everything went smoothly exit 0 \ No newline at end of file From jhagewood at FreeBSD.org Tue May 29 02:36:12 2012 From: jhagewood at FreeBSD.org (jhagewood@FreeBSD.org) Date: Tue May 29 02:40:12 2012 Subject: socsvn commit: r236634 - soc2012/jhagewood/mdocml Message-ID: <20120529023611.298811065670@hub.freebsd.org> Author: jhagewood Date: Tue May 29 02:36:10 2012 New Revision: 236634 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236634 Log: Added: soc2012/jhagewood/mdocml/ From jhagewood at FreeBSD.org Tue May 29 02:37:46 2012 From: jhagewood at FreeBSD.org (jhagewood@FreeBSD.org) Date: Tue May 29 02:40:25 2012 Subject: socsvn commit: r236635 - in soc2012/jhagewood/mdocml: . mdocml-1.12.1 mdocml-1.12.1-orig mdocml_patches Message-ID: <20120529023744.B3BD4106566C@hub.freebsd.org> Author: jhagewood Date: Tue May 29 02:37:44 2012 New Revision: 236635 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236635 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 Tue May 29 02:37:44 2012 (r236635) @@ -0,0 +1,264 @@ +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-29 02:33:26.000000000 -0400 +@@ -49,14 +49,18 @@ enum rofft { + ROFF_if, + ROFF_ig, + ROFF_it, ++ ROFF_na, + ROFF_ne, + ROFF_nh, ++ ROFF_ni, + ROFF_nr, + ROFF_ns, + ROFF_ps, + ROFF_rm, ++ ROFF_rs, + ROFF_so, + ROFF_ta, ++ ROFF_ti, + ROFF_tr, + ROFF_TS, + ROFF_TE, +@@ -182,6 +186,7 @@ static const char *roff_getstrn(const st + const char *, size_t); + static enum rofferr roff_line_ignore(ROFF_ARGS); + static enum rofferr roff_nr(ROFF_ARGS); ++static enum rofferr roff_ns(ROFF_ARGS); + static void roff_openeqn(struct roff *, const char *, + int, int, const char *); + static enum rofft roff_parse(struct roff *, const char *, int *); +@@ -189,6 +194,7 @@ static enum rofferr roff_parsetext(char + static enum rofferr roff_res(struct roff *, + char **, size_t *, int, int); + static enum rofferr roff_rm(ROFF_ARGS); ++static enum rofferr roff_rs(ROFF_ARGS); + static void roff_setstr(struct roff *, + const char *, const char *, int); + static void roff_setstrn(struct roffkv **, const char *, +@@ -225,14 +231,18 @@ 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 }, ++ { "ns", roff_ns, NULL, NULL, 0, NULL }, + { "ps", roff_line_ignore, NULL, NULL, 0, NULL }, + { "rm", roff_rm, NULL, NULL, 0, NULL }, ++ { "rs", roff_line_ignore, 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 }, +@@ -407,6 +417,12 @@ roff_free(struct roff *r) + free(r); + } + ++/* TODO */ ++static enum rofferr ++roff_ad(ROFF_ARGS) ++{ ++ ++} + + struct roff * + roff_alloc(struct mparse *parse) +@@ -1234,6 +1250,20 @@ roff_regunset(struct roff *r, enum regs + r->regs[(int)reg].set = 0; + } + ++/* TODO */ ++static enum rofferr ++roff_na(ROFF_ARGS) ++{ ++ ++} ++ ++/* TODO */ ++static enum rofferr ++roff_it(ROFF_ARGS) ++{ ++ ++} ++ + /* ARGSUSED */ + static enum rofferr + roff_nr(ROFF_ARGS) +@@ -1256,6 +1286,69 @@ roff_nr(ROFF_ARGS) + return(ROFF_IGN); + } + ++/* TODO */ ++static enum rofferr ++roff_ns(ROFF_ARGS) ++{ ++ ++ /* ++ * Turns on flag for "no-space mode". Blank lines are ommited from output ++ * as long as this mode is enabled. ++ */ ++ ++ // nospace_flag = 1; ++ return(ROFF_IGN); ++ ++} ++ ++/* TODO */ ++static enum rofferr ++roff_ti(ROFF_ARGS) ++{ ++ ++} ++ ++/* TODO */ ++static enum rofferr ++roff_ta(ROFF_ARGS) ++{ ++ ++} ++ ++/* TODO */ ++static enum rofferr ++roff_hy(ROFF_ARGS) ++{ ++ ++} ++ ++/* TODO */ ++static enum rofferr ++roff_ne(ROFF_ARGS) ++{ ++ ++} ++ ++/* TODO */ ++static enum rofferr ++roff_nh(ROFF_ARGS) ++{ ++ ++} ++ ++/* TODO */ ++static enum rofferr ++roff_ni(ROFF_ARGS) ++{ ++ ++} ++ ++/* TODO */ ++static enum rofferr ++roff_ps(ROFF_ARGS) ++{ ++ ++} + /* ARGSUSED */ + static enum rofferr + roff_rm(ROFF_ARGS) +@@ -1272,6 +1365,21 @@ roff_rm(ROFF_ARGS) + return(ROFF_IGN); + } + ++/* TODO */ ++static enum rofferr ++roff_ns(ROFF_ARGS) ++{ ++ ++ /* ++ * Turns off flag for "no-space mode". Blank lines will be outputted ++ * if this mode is dissabled. Dissabled by default. ++ */ ++ ++ // nospace_flag = 0; ++ return(ROFF_IGN); ++ ++} ++ + /* ARGSUSED */ + static enum rofferr + roff_TE(ROFF_ARGS) 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 29 02:37:44 2012 (r236635) @@ -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 29 02:37:44 2012 (r236635) @@ -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 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From jhagewood at FreeBSD.org Tue May 29 03:56:05 2012 From: jhagewood at FreeBSD.org (jhagewood@FreeBSD.org) Date: Tue May 29 03:56:12 2012 Subject: socsvn commit: r236636 - soc2012/jhagewood/mdocml Message-ID: <20120529035604.C9FA8106566C@hub.freebsd.org> Author: jhagewood Date: Tue May 29 03:56:04 2012 New Revision: 236636 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236636 Log: Deleted: soc2012/jhagewood/mdocml/ From jhagewood at FreeBSD.org Tue May 29 03:56:18 2012 From: jhagewood at FreeBSD.org (jhagewood@FreeBSD.org) Date: Tue May 29 03:56:25 2012 Subject: socsvn commit: r236637 - soc2012/jhagewood/mdocml Message-ID: <20120529035617.BBBA4106566B@hub.freebsd.org> Author: jhagewood Date: Tue May 29 03:56:17 2012 New Revision: 236637 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236637 Log: Added: soc2012/jhagewood/mdocml/ From jhagewood at FreeBSD.org Tue May 29 03:57:18 2012 From: jhagewood at FreeBSD.org (jhagewood@FreeBSD.org) Date: Tue May 29 03:57:26 2012 Subject: socsvn commit: r236638 - in soc2012/jhagewood/mdocml: . mdocml-1.12.1 mdocml-1.12.1-orig mdocml_patches Message-ID: <20120529035716.A899B106566B@hub.freebsd.org> Author: jhagewood Date: Tue May 29 03:57:16 2012 New Revision: 236638 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236638 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) 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 Tue May 29 03:57:16 2012 (r236638) @@ -0,0 +1,286 @@ +diff -rupN mdocml-1.12.1-orig/lib.in mdocml-1.12.1/lib.in +--- mdocml-1.12.1-orig/lib.in 2012-05-29 03:44:31.000000000 -0400 ++++ mdocml-1.12.1/lib.in 2012-05-29 03:44:32.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-29 03:44:31.000000000 -0400 ++++ mdocml-1.12.1/mdoc_validate.c 2012-05-29 03:44:32.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-29 03:44:31.000000000 -0400 ++++ mdocml-1.12.1/msec.in 2012-05-29 03:44:32.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-29 03:44:31.000000000 -0400 ++++ mdocml-1.12.1/roff.c 2012-05-29 03:55:09.000000000 -0400 +@@ -49,14 +49,18 @@ enum rofft { + ROFF_if, + ROFF_ig, + ROFF_it, ++ ROFF_na, + ROFF_ne, + ROFF_nh, ++ ROFF_ni, + ROFF_nr, + ROFF_ns, + ROFF_ps, + ROFF_rm, ++ ROFF_rs, + ROFF_so, + ROFF_ta, ++ ROFF_ti, + ROFF_tr, + ROFF_TS, + ROFF_TE, +@@ -182,6 +186,7 @@ static const char *roff_getstrn(const st + const char *, size_t); + static enum rofferr roff_line_ignore(ROFF_ARGS); + static enum rofferr roff_nr(ROFF_ARGS); ++static enum rofferr roff_ns(ROFF_ARGS); + static void roff_openeqn(struct roff *, const char *, + int, int, const char *); + static enum rofft roff_parse(struct roff *, const char *, int *); +@@ -189,6 +194,7 @@ static enum rofferr roff_parsetext(char + static enum rofferr roff_res(struct roff *, + char **, size_t *, int, int); + static enum rofferr roff_rm(ROFF_ARGS); ++static enum rofferr roff_rs(ROFF_ARGS); + static void roff_setstr(struct roff *, + const char *, const char *, int); + static void roff_setstrn(struct roffkv **, const char *, +@@ -202,6 +208,8 @@ static enum rofferr roff_EN(ROFF_ARGS); + static enum rofferr roff_T_(ROFF_ARGS); + static enum rofferr roff_userdef(ROFF_ARGS); + ++int nospace_mode = 0; ++ + /* See roffhash_find() */ + + #define ASCII_HI 126 +@@ -225,14 +233,18 @@ 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 }, ++ { "ns", roff_ns, NULL, NULL, 0, NULL }, + { "ps", roff_line_ignore, NULL, NULL, 0, NULL }, + { "rm", roff_rm, NULL, NULL, 0, NULL }, ++ { "rs", roff_rs, 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 }, +@@ -299,6 +311,12 @@ roffhash_find(const char *p, size_t s) + if (NULL == (n = hash[buc])) + return(ROFF_MAX); + for ( ; n; n = n->next) ++ ++ /* ++ * The following if statement is a temporary, completely inelagant way to check ++ * if no-space mode is turned on. ++ */ ++ if (1 == nospace_mode && 0 == strncmp(n->name, "sp", 2)) continue; + if (0 == strncmp(n->name, p, s) && '\0' == n->name[(int)s]) + return((enum rofft)(n - roffs)); + +@@ -407,6 +425,12 @@ roff_free(struct roff *r) + free(r); + } + ++/* TODO */ ++static enum rofferr ++roff_ad(ROFF_ARGS) ++{ ++ ++} + + struct roff * + roff_alloc(struct mparse *parse) +@@ -1234,6 +1258,20 @@ roff_regunset(struct roff *r, enum regs + r->regs[(int)reg].set = 0; + } + ++/* TODO */ ++static enum rofferr ++roff_na(ROFF_ARGS) ++{ ++ ++} ++ ++/* TODO */ ++static enum rofferr ++roff_it(ROFF_ARGS) ++{ ++ ++} ++ + /* ARGSUSED */ + static enum rofferr + roff_nr(ROFF_ARGS) +@@ -1256,6 +1294,69 @@ roff_nr(ROFF_ARGS) + return(ROFF_IGN); + } + ++/* TODO */ ++static enum rofferr ++roff_ns(ROFF_ARGS) ++{ ++ ++ /* ++ * Turns on flag for "no-space mode". Blank lines are ommited from output ++ * as long as this mode is enabled. ++ */ ++ ++ nospace_mode = 1; ++ return(ROFF_IGN); ++ ++} ++ ++/* TODO */ ++static enum rofferr ++roff_ti(ROFF_ARGS) ++{ ++ ++} ++ ++/* TODO */ ++static enum rofferr ++roff_ta(ROFF_ARGS) ++{ ++ ++} ++ ++/* TODO */ ++static enum rofferr ++roff_hy(ROFF_ARGS) ++{ ++ ++} ++ ++/* TODO */ ++static enum rofferr ++roff_ne(ROFF_ARGS) ++{ ++ ++} ++ ++/* TODO */ ++static enum rofferr ++roff_nh(ROFF_ARGS) ++{ ++ ++} ++ ++/* TODO */ ++static enum rofferr ++roff_ni(ROFF_ARGS) ++{ ++ ++} ++ ++/* TODO */ ++static enum rofferr ++roff_ps(ROFF_ARGS) ++{ ++ ++} + /* ARGSUSED */ + static enum rofferr + roff_rm(ROFF_ARGS) +@@ -1272,6 +1373,21 @@ roff_rm(ROFF_ARGS) + return(ROFF_IGN); + } + ++/* TODO */ ++static enum rofferr ++roff_rs(ROFF_ARGS) ++{ ++ ++ /* ++ * Turns off flag for "no-space mode". Blank lines will be outputted ++ * if this mode is dissabled. Dissabled by default. ++ */ ++ ++ nospace_mode = 0; ++ return(ROFF_IGN); ++ ++} ++ + /* ARGSUSED */ + static enum rofferr + roff_TE(ROFF_ARGS) 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 29 03:57:16 2012 (r236638) @@ -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 29 03:57:16 2012 (r236638) @@ -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) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From gmiller at FreeBSD.org Tue May 29 12:16:09 2012 From: gmiller at FreeBSD.org (gmiller@FreeBSD.org) Date: Tue May 29 12:16:15 2012 Subject: socsvn commit: r236654 - in soc2012/gmiller/locking-head: include lib/libthr/thread Message-ID: <20120529121606.E5D001065679@hub.freebsd.org> Author: gmiller Date: Tue May 29 12:16:06 2012 New Revision: 236654 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236654 Log: Add some of the stubs for mutexes and propagate the acquisition point information through the callers to the stubs. Modified: soc2012/gmiller/locking-head/include/pthread.h soc2012/gmiller/locking-head/lib/libthr/thread/Makefile.inc soc2012/gmiller/locking-head/lib/libthr/thread/thr_cond.c soc2012/gmiller/locking-head/lib/libthr/thread/thr_mutex.c soc2012/gmiller/locking-head/lib/libthr/thread/thr_private.h Modified: soc2012/gmiller/locking-head/include/pthread.h ============================================================================== --- soc2012/gmiller/locking-head/include/pthread.h Tue May 29 11:48:53 2012 (r236653) +++ soc2012/gmiller/locking-head/include/pthread.h Tue May 29 12:16:06 2012 (r236654) @@ -198,8 +198,10 @@ const pthread_condattr_t *); int pthread_cond_signal(pthread_cond_t *); int pthread_cond_timedwait(pthread_cond_t *, - pthread_mutex_t *, const struct timespec *); -int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *); + pthread_mutex_t *, const struct timespec * + _PTHREAD_PROFILE_PARMS); +int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t * + _PTHREAD_PROFILE_PARMS); int pthread_create(pthread_t *, const pthread_attr_t *, void *(*) (void *), void *); int pthread_detach(pthread_t); @@ -222,9 +224,9 @@ int pthread_mutex_init(pthread_mutex_t *, const pthread_mutexattr_t *); int pthread_mutex_lock(pthread_mutex_t * _PTHREAD_PROFILE_PARMS); -int pthread_mutex_trylock(pthread_mutex_t *); +int pthread_mutex_trylock(pthread_mutex_t * _PTHREAD_PROFILE_PARMS); int pthread_mutex_timedlock(pthread_mutex_t *, - const struct timespec *); + const struct timespec * _PTHREAD_PROFILE_PARMS); int pthread_mutex_unlock(pthread_mutex_t *); int pthread_once(pthread_once_t *, void (*) (void)); int pthread_rwlock_destroy(pthread_rwlock_t *); @@ -305,10 +307,18 @@ #ifndef pthread_mutex_lock #define pthread_mutex_lock(m) \ pthread_mutex_lock (m, __FILE__, __LINE__) +#define pthread_mutex_trylock(m) \ + pthread_mutex_trylock (m, __FILE__, __LINE__) +#define pthread_mutex_timedlock(m, t) \ + pthread_mutex_timedlock (m, t, __FILE__, __LINE__) #endif #define _pthread_mutex_lock(m) \ _pthread_mutex_lock (m, __FILE__, __LINE__) +#define _pthread_mutex_trylock(m) \ + _pthread_mutex_trylock (m, __FILE__, __LINE__) +#define _pthread_mutex_timedlock(m, t) \ + _pthread_mutex_timedlock (m, t, __FILE__, __LINE__) #endif Modified: soc2012/gmiller/locking-head/lib/libthr/thread/Makefile.inc ============================================================================== --- soc2012/gmiller/locking-head/lib/libthr/thread/Makefile.inc Tue May 29 11:48:53 2012 (r236653) +++ soc2012/gmiller/locking-head/lib/libthr/thread/Makefile.inc Tue May 29 12:16:06 2012 (r236654) @@ -35,6 +35,7 @@ thr_mutexattr.c \ thr_once.c \ thr_printf.c \ + thr_profile.c \ thr_pspinlock.c \ thr_resume_np.c \ thr_rtld.c \ Modified: soc2012/gmiller/locking-head/lib/libthr/thread/thr_cond.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libthr/thread/thr_cond.c Tue May 29 11:48:53 2012 (r236653) +++ soc2012/gmiller/locking-head/lib/libthr/thread/thr_cond.c Tue May 29 12:16:06 2012 (r236654) @@ -39,12 +39,12 @@ /* * Prototypes */ -int __pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex); +int __pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex _PROFILE_PARMS); int __pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, - const struct timespec * abstime); + const struct timespec * abstime _PROFILE_PARMS); static int cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr); static int cond_wait_common(pthread_cond_t *cond, pthread_mutex_t *mutex, - const struct timespec *abstime, int cancel); + const struct timespec *abstime, int cancel _PROFILE_PARMS); static int cond_signal_common(pthread_cond_t *cond); static int cond_broadcast_common(pthread_cond_t *cond); @@ -159,7 +159,7 @@ */ static int cond_wait_kernel(struct pthread_cond *cvp, struct pthread_mutex *mp, - const struct timespec *abstime, int cancel) + const struct timespec *abstime, int cancel _PROFILE_PARMS) { struct pthread *curthread = _get_curthread(); int recurse; @@ -186,9 +186,9 @@ * interesting error codes. */ if (error == 0) { - error2 = _mutex_cv_lock(mp, recurse); + error2 = _mutex_cv_lock(mp, recurse _PROFILE_PASS); } else if (error == EINTR || error == ETIMEDOUT) { - error2 = _mutex_cv_lock(mp, recurse); + error2 = _mutex_cv_lock(mp, recurse _PROFILE_PASS); if (error2 == 0 && cancel) _thr_testcancel(curthread); if (error == EINTR) @@ -211,7 +211,7 @@ static int cond_wait_user(struct pthread_cond *cvp, struct pthread_mutex *mp, - const struct timespec *abstime, int cancel) + const struct timespec *abstime, int cancel _PROFILE_PARMS) { struct pthread *curthread = _get_curthread(); struct sleepqueue *sq; @@ -256,7 +256,7 @@ _sleepq_remove(sq, curthread); _sleepq_unlock(cvp); curthread->mutex_obj = NULL; - _mutex_cv_lock(mp, recurse); + _mutex_cv_lock(mp, recurse _PROFILE_PASS); if (!THR_IN_CRITICAL(curthread)) _pthread_exit(PTHREAD_CANCELED); else /* this should not happen */ @@ -270,13 +270,13 @@ } _sleepq_unlock(cvp); curthread->mutex_obj = NULL; - _mutex_cv_lock(mp, recurse); + _mutex_cv_lock(mp, recurse _PROFILE_PASS); return (error); } static int cond_wait_common(pthread_cond_t *cond, pthread_mutex_t *mutex, - const struct timespec *abstime, int cancel) + const struct timespec *abstime, int cancel _PROFILE_PARMS) { struct pthread *curthread = _get_curthread(); struct pthread_cond *cvp; @@ -294,47 +294,47 @@ (mp->m_lock.m_flags & (UMUTEX_PRIO_PROTECT|UMUTEX_PRIO_INHERIT| USYNC_PROCESS_SHARED)) != 0 || (cvp->__flags & USYNC_PROCESS_SHARED) != 0) - return cond_wait_kernel(cvp, mp, abstime, cancel); + return cond_wait_kernel(cvp, mp, abstime, cancel _PROFILE_PASS); else - return cond_wait_user(cvp, mp, abstime, cancel); + return cond_wait_user(cvp, mp, abstime, cancel _PROFILE_PASS); } int -_pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) +_pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex _PROFILE_PARMS) { - return (cond_wait_common(cond, mutex, NULL, 0)); + return (cond_wait_common(cond, mutex, NULL, 0 _PROFILE_PASS)); } int -__pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) +__pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex _PROFILE_PARMS) { - return (cond_wait_common(cond, mutex, NULL, 1)); + return (cond_wait_common(cond, mutex, NULL, 1 _PROFILE_PASS)); } int _pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, - const struct timespec * abstime) + const struct timespec * abstime _PROFILE_PARMS) { if (abstime == NULL || abstime->tv_sec < 0 || abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000) return (EINVAL); - return (cond_wait_common(cond, mutex, abstime, 0)); + return (cond_wait_common(cond, mutex, abstime, 0 _PROFILE_PASS)); } int __pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, - const struct timespec *abstime) + const struct timespec *abstime _PROFILE_PARMS) { if (abstime == NULL || abstime->tv_sec < 0 || abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000) return (EINVAL); - return (cond_wait_common(cond, mutex, abstime, 1)); + return (cond_wait_common(cond, mutex, abstime, 1 _PROFILE_PASS)); } static int Modified: soc2012/gmiller/locking-head/lib/libthr/thread/thr_mutex.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libthr/thread/thr_mutex.c Tue May 29 11:48:53 2012 (r236653) +++ soc2012/gmiller/locking-head/lib/libthr/thread/thr_mutex.c Tue May 29 12:16:06 2012 (r236654) @@ -71,21 +71,15 @@ */ #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_trylock(pthread_mutex_t *mutex _PROFILE_PARMS); int __pthread_mutex_lock(pthread_mutex_t *mutex _PROFILE_PARMS); int __pthread_mutex_timedlock(pthread_mutex_t *mutex, - const struct timespec *abstime); + const struct timespec *abstime _PROFILE_PARMS); int _pthread_mutex_init_calloc_cb(pthread_mutex_t *mutex, void *(calloc_cb)(size_t, size_t)); int _pthread_mutex_getspinloops_np(pthread_mutex_t *mutex, int *count); @@ -100,7 +94,7 @@ const struct timespec *abstime); static int mutex_unlock_common(struct pthread_mutex *, int); static int mutex_lock_sleep(struct pthread *, pthread_mutex_t, - const struct timespec *); + const struct timespec * _PROFILE_PARMS); __weak_reference(__pthread_mutex_init, pthread_mutex_init); __strong_reference(__pthread_mutex_init, _pthread_mutex_init); @@ -318,7 +312,7 @@ } static int -mutex_trylock_common(pthread_mutex_t *mutex) +mutex_trylock_common(pthread_mutex_t *mutex _PROFILE_PARMS) { struct pthread *curthread = _get_curthread(); struct pthread_mutex *m = *mutex; @@ -331,27 +325,33 @@ ret = _thr_umutex_trylock(&m->m_lock, id); if (__predict_true(ret == 0)) { ENQUEUE_MUTEX(curthread, m); + MUTEX_OBTAIN_SUCCESS(); } else if (m->m_owner == curthread) { ret = mutex_self_trylock(m); - } /* else {} */ + MUTEX_OBTAIN_FAILED(); + } else { + MUTEX_OBTAIN_FAILED(); + } + if (ret && (m->m_flags & PMUTEX_FLAG_PRIVATE)) THR_CRITICAL_LEAVE(curthread); + return (ret); } int -__pthread_mutex_trylock(pthread_mutex_t *mutex) +__pthread_mutex_trylock(pthread_mutex_t *mutex _PROFILE_PARMS) { struct pthread_mutex *m; CHECK_AND_INIT_MUTEX - return (mutex_trylock_common(mutex)); + return (mutex_trylock_common(mutex _PROFILE_PASS)); } static int mutex_lock_sleep(struct pthread *curthread, struct pthread_mutex *m, - const struct timespec *abstime) + const struct timespec *abstime _PROFILE_PARMS) { uint32_t id, owner; int count; @@ -360,9 +360,7 @@ if (m->m_owner == curthread) return mutex_self_lock(m, abstime); -#if 0 - lock_profile_obtain_lock_success(); -#endif + MUTEX_OBTAIN_FAILED(); id = TID(curthread); /* @@ -415,15 +413,17 @@ ret = __thr_umutex_timedlock(&m->m_lock, id, abstime); } done: - if (ret == 0) + if (ret == 0) { ENQUEUE_MUTEX(curthread, m); + MUTEX_OBTAIN_SUCCESS(); + } return (ret); } static inline int mutex_lock_common(struct pthread_mutex *m, - const struct timespec *abstime, int cvattach) + const struct timespec *abstime, int cvattach _PROFILE_PARMS) { struct pthread *curthread = _get_curthread(); int ret; @@ -434,7 +434,7 @@ ENQUEUE_MUTEX(curthread, m); ret = 0; } else { - ret = mutex_lock_sleep(curthread, m, abstime); + ret = mutex_lock_sleep(curthread, m, abstime _PROFILE_PASS); } if (ret && (m->m_flags & PMUTEX_FLAG_PRIVATE) && !cvattach) THR_CRITICAL_LEAVE(curthread); @@ -450,11 +450,11 @@ CHECK_AND_INIT_MUTEX - return (mutex_lock_common(m, NULL, 0)); + return (mutex_lock_common(m, NULL, 0 _PROFILE_PASS)); } int -__pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *abstime) +__pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *abstime _PROFILE_PARMS) { struct pthread_mutex *m; @@ -462,7 +462,7 @@ CHECK_AND_INIT_MUTEX - return (mutex_lock_common(m, abstime, 0)); + return (mutex_lock_common(m, abstime, 0 _PROFILE_PASS)); } int @@ -475,11 +475,11 @@ } int -_mutex_cv_lock(struct pthread_mutex *m, int count) +_mutex_cv_lock(struct pthread_mutex *m, int count _PROFILE_PARMS) { int error; - error = mutex_lock_common(m, NULL, 1); + error = mutex_lock_common(m, NULL, 1 _PROFILE_PASS); if (error == 0) m->m_count = count; return (error); Modified: soc2012/gmiller/locking-head/lib/libthr/thread/thr_private.h ============================================================================== --- soc2012/gmiller/locking-head/lib/libthr/thread/thr_private.h Tue May 29 11:48:53 2012 (r236653) +++ soc2012/gmiller/locking-head/lib/libthr/thread/thr_private.h Tue May 29 12:16:06 2012 (r236654) @@ -722,18 +722,31 @@ extern struct urwlock _thr_list_lock __hidden; extern struct umutex _thr_event_lock __hidden; +#ifdef LOCK_PROFILING +#define _PROFILE_PARMS , const char *file, int line +#define _PROFILE_PASS , file, line +#else +#define _PROFILE_PARMS /* */ +#define _PROFILE_PASS /* */ +#endif + /* * Function prototype definitions. */ __BEGIN_DECLS int _thr_setthreaded(int) __hidden; -int _mutex_cv_lock(struct pthread_mutex *, int count) __hidden; +int _mutex_cv_lock(struct pthread_mutex *, int count _PROFILE_PARMS) \ + __hidden; int _mutex_cv_unlock(struct pthread_mutex *, int *count) __hidden; int _mutex_cv_attach(struct pthread_mutex *, int count) __hidden; int _mutex_cv_detach(struct pthread_mutex *, int *count) __hidden; int _mutex_owned(struct pthread *, const struct pthread_mutex *) __hidden; int _mutex_reinit(pthread_mutex_t *) __hidden; void _mutex_fork(struct pthread *curthread) __hidden; +void _mutex_obtain_failed(struct pthread_mutex *, const char *, int) + __hidden; +void _mutex_obtain_success(struct pthread_mutex *, const char *, int) + __hidden; void _libpthread_init(struct pthread *) __hidden; struct pthread *_thr_alloc(struct pthread *) __hidden; void _thread_exit(const char *, int, const char *) __hidden __dead2; @@ -792,6 +805,18 @@ void _pthread_cancel_enter(int maycancel); void _pthread_cancel_leave(int maycancel); +#ifdef LOCK_PROFILING +#define MUTEX_OBTAIN_SUCCESS() \ + _mutex_obtain_success(m, file, line) +#define MUTEX_OBTAIN_FAILED() \ + _mutex_obtain_failed(m, file, line) +#else +#define MUTEX_OBTAIN_SUCCESS() \ + do { } while (0) +#define MUTEX_OBTAIN_FAILED() \ + do { } while (0) +#endif + /* #include */ #ifdef _SYS_FCNTL_H_ int __sys_fcntl(int, int, ...); From rudot at FreeBSD.org Tue May 29 13:04:39 2012 From: rudot at FreeBSD.org (rudot@FreeBSD.org) Date: Tue May 29 13:04:45 2012 Subject: socsvn commit: r236657 - soc2012/rudot/aux Message-ID: <20120529130438.340121065674@hub.freebsd.org> Author: rudot Date: Tue May 29 13:04:37 2012 New Revision: 236657 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236657 Log: a few helper scripts Added: soc2012/rudot/aux/proc_pcpu.sh (contents, props changed) soc2012/rudot/aux/user_pcpu.sh (contents, props changed) Modified: soc2012/rudot/aux/build_kernel.sh Modified: soc2012/rudot/aux/build_kernel.sh ============================================================================== --- soc2012/rudot/aux/build_kernel.sh Tue May 29 12:52:30 2012 (r236656) +++ soc2012/rudot/aux/build_kernel.sh Tue May 29 13:04:37 2012 (r236657) @@ -6,4 +6,4 @@ fi cd /usr/src -make buildkernel -DNO_MODULES -DNO_CLEAN KERNCONF=RCTL && make installkernel -DNO_MODULES KERNCONF=RCTL +make buildkernel -DNO_MODULES -DNO_CLEAN -DNO_KERNELDEPEND KERNCONF=RCTL && make installkernel -DNO_MODULES KERNCONF=RCTL Added: soc2012/rudot/aux/proc_pcpu.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/aux/proc_pcpu.sh Tue May 29 13:04:37 2012 (r236657) @@ -0,0 +1,8 @@ +if [ -z $1 ]; then + echo "Usage: ${0} pid" + exit +else + PROC=${1} +fi + +rctl -u process:${PROC}: | grep pcpu Added: soc2012/rudot/aux/user_pcpu.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/aux/user_pcpu.sh Tue May 29 13:04:37 2012 (r236657) @@ -0,0 +1,7 @@ +if [ -z $1 ]; then + USER=root +else + USER=${1} +fi + +rctl -u user:${USER}: | grep pcpu From scher at FreeBSD.org Tue May 29 16:05:21 2012 From: scher at FreeBSD.org (scher@FreeBSD.org) Date: Tue May 29 16:05:27 2012 Subject: socsvn commit: r236669 - soc2012/scher/par_ports/head/Mk Message-ID: <20120529160518.E0219106564A@hub.freebsd.org> Author: scher Date: Tue May 29 16:05:18 2012 New Revision: 236669 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236669 Log: [fixed] Trigger name changed to suit variable naming _parv_WANT_PARALLEL_BUILD kill signal changed to USR1 make utility exit with 158 status on lock [new_feature] ${.CURDIR} locking behaviour for dependency build ${PKG_DBDIR} locking phases for XXX-depends and lib-depends targets Blocking Parallel build/install support for port's dependencies in XXX-depends and lib-depends 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 Tue May 29 15:56:30 2012 (r236668) +++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Tue May 29 16:05:18 2012 (r236669) @@ -5,6 +5,11 @@ # # Please view me with 4 column tabs! +# +# _parv_WANT_PARALLEL_BUILD +# _parv_ATTEMPTS_TO_LOCK +# +# _dparv_= @@ -31,7 +36,7 @@ _parv_DEFAULT_TARGETS= all check-sanity fetch checksum extract patch configure build install _parv_IS_DEFAULT_TARGET= 0 -# e.g. make "WANT_PARALLEL_BUILD=" +# e.g. make -D_parv_WANT_PARALLEL_BUILD # All target will be evaluated. It is in default sequence # .if !${.TARGETS} @@ -50,7 +55,7 @@ ##################################################### # Commands _parv_KILL= /bin/kill -_parv_KILL_FLAGS= -- +_parv_KILL_SIGNAL= USR1 _parv_PKILL= /bin/pkill _parv_PKILL_FLAGS= -P @@ -72,6 +77,8 @@ _parv_ON_LOCK_EXIT_STATUS= 2 _parv_LOCKF_EX_TEMPFAIL= 75 +_parv_MAKE_LOCK_EXIT_STATUS= 158 + # 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) Modified: soc2012/scher/par_ports/head/Mk/bsd.port.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.port.mk Tue May 29 15:56:30 2012 (r236668) +++ soc2012/scher/par_ports/head/Mk/bsd.port.mk Tue May 29 16:05:18 2012 (r236669) @@ -1129,8 +1129,8 @@ .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 +# _parv_WANT_PARALLEL_BUILD - assign this variable any value if port want to enable +# parallel build/install features. # .if defined(_parv_WANT_PARALLEL_BUILD) @@ -1531,7 +1531,19 @@ .BEGIN: . if defined(_parv_WANT_PARALLEL_BUILD) . if ${_parv_IS_DEFAULT_TARGET} +. if defined(INSTALLS_DEPENDS) + @( ${_parv_.CURDIR_LOCK_LOOP} ) || { \ + status=$$?; \ + if [ $${status} -eq ${_parv_ON_LOCK_EXIT_STATUS} ]; then \ + ${_parv_KILL} -${_parv_KILL_SIGNAL} ${.MAKE.PID} && \ + ${_parv_PKILL} ${_parv_PKILL_FLAGS} $$$$; \ + else \ + exit $${status}; \ + fi; \ + } +. else @attempts=-1; ${_parv_.CURDIR_LOCK_LOOP} +. endif . endif . endif # You can force skipping these test by defining IGNORE_PATH_CHECKS @@ -5022,6 +5034,11 @@ _DEPEND_ALWAYS= 0 .endif +############### PAR_PORTS SPECIFIC COMMENT LINE ############### +# _INSTALL_DEPENDS script is surrounded by while loop. +# When the port is installed it is necessary to break most inner while loop. +############### END OF PAR_PORTS SPECIFIC COMMENT LINE ############### + _INSTALL_DEPENDS= \ if [ X${USE_PACKAGE_DEPENDS} != "X" ]; then \ subpkgfile=`(cd $$dir; ${MAKE} $$depends_args -V PKGFILE)`; \ @@ -5038,10 +5055,24 @@ ${PKG_ADD} $${subpkgfile}; \ fi; \ else \ - (cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args) ; \ + (cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args) && status=$$? || status=$$?; \ fi; \ else \ - (cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args) ; \ + (cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args; ) && status=$$? || status=$$?; \ + fi; \ + if [ ! ${_parv_WANT_PARALLEL_BUILD} ] && [ $${status} != 0 ]; then \ + exit $${status}; \ + fi; \ + if [ ${_parv_WANT_PARALLEL_BUILD} ]; then \ + if [ $${status} -eq 0 ]; then \ + _parv_next_dep=1; \ + elif [ $${status} -eq ${_parv_MAKE_LOCK_EXIT_STATUS} ]; then \ + ${ECHO_CMD} $${prog} may be installing now.; \ + sleep 2; \ + continue; \ + else \ + exit $${status}; \ + fi; \ fi; \ ${ECHO_MSG} "===> Returning to build of ${PKGNAME}"; @@ -5071,6 +5102,11 @@ target="${DEPENDS_TARGET}"; \ depends_args="${DEPENDS_ARGS}"; \ fi; \ + _parv_next_dep=0; \ + while [ $${_parv_next_dep} -eq 0 ]; do \ + if [ ${_parv_WANT_PARALLEL_BUILD} ]; then \ + ( attempts=-1; ${_parv_PKG_DBDIR_LOCK_LOOP} ); \ + fi; \ if ${EXPR} "$$prog" : \\/ >/dev/null; then \ if [ -e "$$prog" ]; then \ if [ "$$prog" = "${NONEXISTENT}" ]; then \ @@ -5130,6 +5166,22 @@ notfound=1; \ fi; \ fi; \ + if [ ${_parv_WANT_PARALLEL_BUILD} ] && [ $${notfound} -eq 1 ]; then \ + ( ${_parv_CHECK_LOCK} ) || { \ + status=$$?; \ + if [ $${status} -eq ${_parv_ON_LOCK_EXIT_STATUS} ]; then \ + ( ${_parv_PKG_DBDIR_DO_UNLOCK} ); \ + ${ECHO_CMD} $${prog} may be installing now.; \ + sleep 2; \ + continue; \ + else \ + exit $${status}; \ + fi; \ + }; \ + fi; \ + if [ ${_parv_WANT_PARALLEL_BUILD} ]; then \ + ( ${_parv_PKG_DBDIR_DO_UNLOCK} ); \ + fi; \ if [ $$notfound != 0 ]; then \ ${ECHO_MSG} "===> Verifying $$target for $$prog in $$dir"; \ if [ ! -d "$$dir" ]; then \ @@ -5138,6 +5190,9 @@ ${_INSTALL_DEPENDS} \ fi; \ fi; \ + if [ $${notfound} -eq 0 ]; then _parv_next_dep=1; fi; \ + if [ ! ${_parv_WANT_PARALLEL_BUILD} ]; then _parv_next_dep=1; fi; \ + done; \ done .endif .else @@ -5159,6 +5214,11 @@ dir=$${dir%%:*}; \ fi; \ ${ECHO_MSG} -n "===> ${PKGNAME} depends on shared library: $$lib"; \ + _parv_next_dep=0; \ + while [ $${_parv_next_dep} -eq 0 ]; do \ + if [ ${_parv_WANT_PARALLEL_BUILD} ]; then \ + ( attempts=-1; ${_parv_PKG_DBDIR_LOCK_LOOP} ); \ + fi; \ if ${LDCONFIG} ${_LDCONFIG_FLAGS} -r | ${GREP} -vwF -e "${PKGCOMPATDIR}" | ${GREP} -qwE -e "-l$$pattern"; then \ ${ECHO_MSG} " - found"; \ if [ ${_DEPEND_ALWAYS} = 1 ]; then \ @@ -5171,6 +5231,22 @@ ${ECHO_MSG} " - not found"; \ notfound=1; \ fi; \ + if [ ${_parv_WANT_PARALLEL_BUILD} ] && [ $${notfound} -eq 1 ]; then \ + ( ${_parv_CHECK_LOCK} ) || { \ + status=$$?; \ + if [ $${status} -eq ${_parv_ON_LOCK_EXIT_STATUS} ]; then \ + ( ${_parv_PKG_DBDIR_DO_UNLOCK} ); \ + ${ECHO_CMD} $${prog} may be installing now.; \ + sleep 2; \ + continue; \ + else \ + exit $${status}; \ + fi; \ + }; \ + fi; \ + if [ ${_parv_WANT_PARALLEL_BUILD} ]; then \ + ( ${_parv_PKG_DBDIR_DO_UNLOCK} ); \ + fi; \ if [ $$notfound != 0 ]; then \ ${ECHO_MSG} "===> Verifying $$target for $$lib in $$dir"; \ if [ ! -d "$$dir" ]; then \ @@ -5183,6 +5259,9 @@ fi; \ fi; \ fi; \ + if [ $${notfound} -eq 0 ]; then _parv_next_dep=1; fi; \ + if [ ! ${_parv_WANT_PARALLEL_BUILD} ]; then _parv_next_dep=1; fi; \ + done; \ done .endif @@ -5921,13 +6000,7 @@ .if !defined(NO_PKG_REGISTER) ############### PAR_PORTS SPECIFIC COMMENT LINE ############### .if defined(_parv_WANT_PARALLEL_BUILD) - @( attempts=-1; ${_parv_PKG_DBDIR_LOCK_LOOP} ) || { \ - status=$$?; \ - ${_dparv_START_OUTPUT}; \ - ${ECHO_CMD} Unable to lock ${PKG_DBDIR}. Exit status $${status}; \ - ${_dparv_END_OUTPUT}; \ - exit 1; \ - } + @( attempts=-1; ${_parv_PKG_DBDIR_LOCK_LOOP} ) .endif ############### END OF PAR_PORTS SPECIFIC COMMENT LINE ############### @if [ ! -d ${PKG_DBDIR} ]; then ${RM} -f ${PKG_DBDIR}; ${MKDIR} ${PKG_DBDIR}; fi @@ -5977,13 +6050,7 @@ fi ############### PAR_PORTS SPECIFIC COMMENT LINE ############### .if defined(_parv_WANT_PARALLEL_BUILD) - @( ${_parv_PKG_DBDIR_DO_UNLOCK} ) || { \ - status=$$?; \ - ${_dparv_START_OUTPUT}; \ - ${ECHO_CMD} Unable to unlock ${PKG_DBDIR}. Exit status $${status}; \ - ${_dparv_END_OUTPUT}; \ - exit 1; \ - } + @( ${_parv_PKG_DBDIR_DO_UNLOCK} ) .endif ############### END OF PAR_PORTS SPECIFIC COMMENT LINE ############### .else From vbotton at FreeBSD.org Tue May 29 18:26:47 2012 From: vbotton at FreeBSD.org (vbotton@FreeBSD.org) Date: Tue May 29 18:26:55 2012 Subject: socsvn commit: r236675 - soc2012/vbotton/ntfs_apple Message-ID: <20120529182645.779B61065678@hub.freebsd.org> Author: vbotton Date: Tue May 29 18:26:44 2012 New Revision: 236675 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236675 Log: replace some endianness functions Modified: soc2012/vbotton/ntfs_apple/ntfs_attr.c soc2012/vbotton/ntfs_apple/ntfs_attr.h soc2012/vbotton/ntfs_apple/ntfs_inode.h soc2012/vbotton/ntfs_apple/ntfs_time.h soc2012/vbotton/ntfs_apple/ntfs_types.h Modified: soc2012/vbotton/ntfs_apple/ntfs_attr.c ============================================================================== --- soc2012/vbotton/ntfs_apple/ntfs_attr.c Tue May 29 17:53:11 2012 (r236674) +++ soc2012/vbotton/ntfs_apple/ntfs_attr.c Tue May 29 18:26:44 2012 (r236675) @@ -94,7 +94,7 @@ ntfs_debug("Entering for mft_no 0x%llx, type 0x%x.", (unsigned long long)ni->mft_no, - (unsigned)le32_to_cpu(ni->type)); + (unsigned)le32toh(ni->type)); /* If the attribute is resident there is nothing to do. */ if (!NInoNonResident(ni)) { ntfs_debug("Done (resident, nothing to do)."); @@ -140,9 +140,9 @@ * allocated size is correct. */ if (!a->lowest_vcn) - if (sle64_to_cpu(a->allocated_size) != + if (le64toh(a->allocated_size) != ni->allocated_size) - panic("%s(): sle64_to_cpu(a->allocated_size) " + panic("%s(): le64toh(a->allocated_size) " "!= ni->allocated_size\n", __FUNCTION__); /* @@ -150,11 +150,11 @@ * vcn we looked up and that the highest_vcn of the attribute * is above the current vcn. */ - if (sle64_to_cpu(a->lowest_vcn) != vcn || (vcn && - sle64_to_cpu(a->highest_vcn) < vcn)) + if (le64toh(a->lowest_vcn) != vcn || (vcn && + le64toh(a->highest_vcn) < vcn)) goto corrupt_err; /* Determine the next vcn. */ - vcn = sle64_to_cpu(a->highest_vcn) + 1; + vcn = le64toh(a->highest_vcn) + 1; /* * Finally, map the runlist fragment contained in this * attribute extent. @@ -259,7 +259,7 @@ if (!a->non_resident) panic("%s(): !a->non_resident\n", __FUNCTION__); ctx_is_temporary = FALSE; - end_vcn = sle64_to_cpu(a->highest_vcn); + end_vcn = le64toh(a->highest_vcn); lck_spin_lock(&ni->size_lock); allocated_size_vcn = ni->allocated_size >> ni->vol->cluster_size_shift; @@ -273,9 +273,9 @@ */ if (vcn >= allocated_size_vcn || (a->type == ni->type && a->name_length == ni->name_len && - !bcmp((u8*)a + le16_to_cpu(a->name_offset), + !bcmp((u8*)a + le16toh(a->name_offset), ni->name, ni->name_len) && - sle64_to_cpu(a->lowest_vcn) <= vcn && + le64toh(a->lowest_vcn) <= vcn && end_vcn >= vcn)) ctx_needs_reset = FALSE; else { @@ -307,7 +307,7 @@ * we then try to map the already mapped runlist fragment and * ntfs_mapping_pairs_decompress() fails. */ - end_vcn = sle64_to_cpu(a->highest_vcn) + 1; + end_vcn = le64toh(a->highest_vcn) + 1; if (vcn && vcn >= end_vcn) { err = ENOENT; goto err; @@ -366,8 +366,8 @@ */ if (err2) { if (err2 == ENOMEM) { - (void)thread_block( - THREAD_CONTINUE_NULL); + /* (void)thread_block( + THREAD_CONTINUE_NULL);*/ goto retry_map; } ctx->is_error = 1; @@ -676,7 +676,7 @@ ctx->is_iteration = 0; /* Sanity checks are performed elsewhere. */ ctx->a = (ATTR_RECORD*)((u8*)ctx->m + - le16_to_cpu(ctx->m->attrs_offset)); + le16toh(ctx->m->attrs_offset)); /* * This needs resetting due to * ntfs_attr_find_in_attribute_list() which can leave it set @@ -808,14 +808,14 @@ a = ctx->a; ctx->is_first = 0; } else - a = (ATTR_RECORD*)((u8*)ctx->a + le32_to_cpu(ctx->a->length)); - for (;; a = (ATTR_RECORD*)((u8*)a + le32_to_cpu(a->length))) { + a = (ATTR_RECORD*)((u8*)ctx->a + le32toh(ctx->a->length)); + for (;; a = (ATTR_RECORD*)((u8*)a + le32toh(a->length))) { if ((u8*)a < (u8*)ctx->m || (u8*)a > (u8*)ctx->m + - le32_to_cpu(ctx->m->bytes_allocated)) + le32toh(ctx->m->bytes_allocated)) break; ctx->a = a; if (((!is_iteration || type != AT_UNUSED) && - le32_to_cpu(a->type) > le32_to_cpu(type)) || + le32toh(a->type) > le32toh(type)) || a->type == AT_END) return ENOENT; if (!a->length) @@ -839,9 +839,9 @@ unsigned len, ofs; len = a->name_length; - ofs = le16_to_cpu(a->name_offset); + ofs = le16toh(a->name_offset); if (ofs + (len * sizeof(ntfschar)) > - le32_to_cpu(a->length)) + le32toh(a->length)) break; if (!ntfs_are_names_equal(name, name_len, (ntfschar*)((u8*)a + ofs), len, @@ -884,9 +884,9 @@ unsigned len, ofs; int rc; - len = le32_to_cpu(a->value_length); - ofs = le16_to_cpu(a->value_offset); - if (ofs + len > le32_to_cpu(a->length)) + len = le32toh(a->value_length); + ofs = le16toh(a->value_offset); + if (ofs + len > le32toh(a->length)) break; rc = memcmp(val, (u8*)a + ofs, len <= val_len ? len : val_len); @@ -992,7 +992,7 @@ panic("%s(): ctx->is_iteration\n", __FUNCTION__); base_ni = ctx->base_ni; ntfs_debug("Entering for mft_no 0x%llx, type 0x%x.", - (unsigned long long)ni->mft_no, le32_to_cpu(type)); + (unsigned long long)ni->mft_no, le32toh(type)); if (!base_ni) { /* First call happens with the base mft record. */ base_ni = ctx->base_ni = ctx->ni; @@ -1016,7 +1016,7 @@ ctx->is_first = 0; } else al_entry = (ATTR_LIST_ENTRY*)((u8*)ctx->al_entry + - le16_to_cpu(ctx->al_entry->length)); + le16toh(ctx->al_entry->length)); for (;; al_entry = next_al_entry) { /* Out of bounds check. */ if ((u8*)al_entry < base_ni->attr_list || @@ -1029,12 +1029,12 @@ if (!al_entry->length) break; if ((u8*)al_entry + 6 > al_end || (u8*)al_entry + - le16_to_cpu(al_entry->length) > al_end) + le16toh(al_entry->length) > al_end) break; next_al_entry = (ATTR_LIST_ENTRY*)((u8*)al_entry + - le16_to_cpu(al_entry->length)); + le16toh(al_entry->length)); if (al_entry->type != type) { - if (le32_to_cpu(al_entry->type) < le32_to_cpu(type)) + if (le32toh(al_entry->type) < le32toh(type)) continue; goto not_found; } @@ -1089,9 +1089,9 @@ */ if (lowest_vcn && (u8*)next_al_entry >= al_start && (u8*)next_al_entry + 6 < al_end && - (u8*)next_al_entry + le16_to_cpu( + (u8*)next_al_entry + le16toh( next_al_entry->length) <= al_end && - sle64_to_cpu(next_al_entry->lowest_vcn) <= + le64toh(next_al_entry->lowest_vcn) <= lowest_vcn && next_al_entry->type == al_entry->type && next_al_entry->name_length == al_name_len && @@ -1147,7 +1147,7 @@ } } a = ctx->a = (ATTR_RECORD*)((u8*)ctx->m + - le16_to_cpu(ctx->m->attrs_offset)); + le16toh(ctx->m->attrs_offset)); /* * ctx->ni, ctx->m, and ctx->a now point to the mft record * containing the attribute represented by the current @@ -1168,7 +1168,7 @@ */ do_next_attr_loop: if ((u8*)a < (u8*)ctx->m || (u8*)a > (u8*)ctx->m + - le32_to_cpu(ctx->m->bytes_allocated)) + le32toh(ctx->m->bytes_allocated)) break; if (a->type == AT_END) continue; @@ -1184,7 +1184,7 @@ if (al_entry->type != a->type) break; if (!ntfs_are_names_equal((ntfschar*)((u8*)a + - le16_to_cpu(a->name_offset)), a->name_length, + le16toh(a->name_offset)), a->name_length, al_name, al_name_len, case_sensitive, vol->upcase, vol->upcase_len)) break; @@ -1194,15 +1194,15 @@ * have found it! */ if (!val || (!a->non_resident && - le32_to_cpu(a->value_length) == val_len && - !bcmp((u8*)a + le16_to_cpu(a->value_offset), + le32toh(a->value_length) == val_len && + !bcmp((u8*)a + le16toh(a->value_offset), val, val_len))) { ntfs_debug("Done, found."); return 0; } do_next_attr: /* Proceed to the next attribute in the current mft record. */ - a = (ATTR_RECORD*)((u8*)a + le32_to_cpu(a->length)); + a = (ATTR_RECORD*)((u8*)a + le32toh(a->length)); goto do_next_attr_loop; } if (!err) { @@ -1247,7 +1247,7 @@ ntfs_extent_mft_record_unmap(ni); ctx->m = ctx->base_m; ctx->a = (ATTR_RECORD*)((u8*)ctx->m + - le16_to_cpu(ctx->m->attrs_offset)); + le16toh(ctx->m->attrs_offset)); ctx->is_first = 1; ctx->ni = base_ni; /* @@ -1352,7 +1352,7 @@ for (ad = vol->attrdef; (u8*)ad - (u8*)vol->attrdef < vol->attrdef_size && ad->type; ++ad) { /* If we have not found it yet, carry on searching. */ - if (le32_to_cpu(type) > le32_to_cpu(ad->type)) + if (le32toh(type) > le32toh(ad->type)) continue; /* If we have found the attribute, return it. */ if (type == ad->type) @@ -1362,7 +1362,7 @@ } /* Attribute not found. */ ntfs_debug("Attribute type 0x%x not found in $AttrDef.", - le32_to_cpu(type)); + le32toh(type)); return NULL; } @@ -1396,10 +1396,10 @@ if (!ad) return ENOENT; /* Do the bounds check. */ - if ((sle64_to_cpu(ad->min_size) > 0 && - size < sle64_to_cpu(ad->min_size)) || - (sle64_to_cpu(ad->max_size) > 0 && - size > sle64_to_cpu(ad->max_size)) || + if ((le64toh(ad->min_size) > 0 && + size < le64toh(ad->min_size)) || + (le64toh(ad->max_size) > 0 && + size > le64toh(ad->max_size)) || (u64)size > NTFS_MAX_ATTRIBUTE_SIZE) return ERANGE; return 0; @@ -1470,8 +1470,8 @@ { ATTR_RECORD *first_a, *next_a; - first_a = (ATTR_RECORD*)((u8*)m + le16_to_cpu(m->attrs_offset)); - next_a = (ATTR_RECORD*)((u8*)a + le32_to_cpu(a->length)); + first_a = (ATTR_RECORD*)((u8*)m + le16toh(m->attrs_offset)); + next_a = (ATTR_RECORD*)((u8*)a + le32toh(a->length)); return (first_a == a && next_a->type == AT_END); } @@ -1490,10 +1490,10 @@ */ void ntfs_attr_record_delete_internal(MFT_RECORD *m, ATTR_RECORD *a) { - const u32 new_muse = le32_to_cpu(m->bytes_in_use) - - le32_to_cpu(a->length); + const u32 new_muse = le32toh(m->bytes_in_use) - + le32toh(a->length); /* Move attributes following @a into the position of @a. */ - memmove(a, (u8*)a + le32_to_cpu(a->length), + memmove(a, (u8*)a + le32toh(a->length), new_muse - ((u8*)a - (u8*)m)); /* Adjust @m to reflect the change in used space. */ m->bytes_in_use = cpu_to_le32(new_muse); @@ -1545,7 +1545,7 @@ a = ctx->a; ntfs_debug("Entering for attribute type 0x%x located in %s mft " "record 0x%llx. Attribute list attribute is " - "%spresent.", (unsigned)le32_to_cpu(a->type), + "%spresent.", (unsigned)le32toh(a->type), (base_ni == ni) ? "base" : "extent", (unsigned long long)ni->mft_no, NInoAttrList(base_ni) ? "" : "not "); @@ -1577,9 +1577,9 @@ * it is the only attribute in the extent mft record thus we need to * free the extent mft record instead of deleting the attribute record. */ - if (base_ni == ni || (u8*)m + le16_to_cpu(m->attrs_offset) != (u8*)a || + if (base_ni == ni || (u8*)m + le16toh(m->attrs_offset) != (u8*)a || ((ATTR_RECORD*)((u8*)a + - le32_to_cpu(a->length)))->type != AT_END) { + le32toh(a->length)))->type != AT_END) { ntfs_attr_record_delete_internal(m, a); /* * If the attribute was not in the base mft record mark the @@ -1718,13 +1718,13 @@ errno_t ntfs_attr_record_make_space(MFT_RECORD *m, ATTR_RECORD *a, u32 size) { u32 new_muse; - const u32 muse = le32_to_cpu(m->bytes_in_use); + const u32 muse = le32toh(m->bytes_in_use); /* Align to 8 bytes if it is not already done. */ if (size & 7) size = (size + 7) & ~7; new_muse = muse + size; /* Not enough space in this mft record. */ - if (new_muse > le32_to_cpu(m->bytes_allocated)) + if (new_muse > le32toh(m->bytes_allocated)) return ENOSPC; /* Move attributes starting with @a to make space of @size bytes. */ memmove((u8*)a + size, a, muse - ((u8*)a - (u8*)m)); @@ -1761,7 +1761,7 @@ */ errno_t ntfs_attr_record_resize(MFT_RECORD *m, ATTR_RECORD *a, u32 new_size) { - const u32 old_size = le32_to_cpu(a->length); + const u32 old_size = le32toh(a->length); ntfs_debug("Entering for new_size %u.", new_size); /* Align to 8 bytes if it is not already done. */ @@ -1769,10 +1769,10 @@ new_size = (new_size + 7) & ~7; /* If the actual attribute length has changed, move things around. */ if (new_size != old_size) { - const u32 muse = le32_to_cpu(m->bytes_in_use); + const u32 muse = le32toh(m->bytes_in_use); const u32 new_muse = muse - old_size + new_size; /* Not enough space in this mft record. */ - if (new_muse > le32_to_cpu(m->bytes_allocated)) + if (new_muse > le32toh(m->bytes_allocated)) return ENOSPC; /* Move attributes following @a to their new location. */ memmove((u8*)a + new_size, (u8*)a + old_size, @@ -1855,7 +1855,7 @@ "name len 0x%x, first_vcn 0x%llx, last_vcn 0x%llx, " "ctx is %spresent.", (unsigned long long)base_ni->mft_no, - (unsigned)le32_to_cpu(ni->type), ni->name_len, + (unsigned)le32toh(ni->type), ni->name_len, (unsigned long long)first_vcn, (unsigned long long)last_vcn, ctx ? "" : "not "); @@ -1943,9 +1943,9 @@ if (vol->major_ver <= 1) a->compression_unit = NTFS_COMPRESSION_UNIT; restart_compressed_size_add: - if ((first_vcn > sle64_to_cpu(a->highest_vcn) + 1) && + if ((first_vcn > le64toh(a->highest_vcn) + 1) && !(err = ntfs_attr_record_resize(ctx->m, a, - le32_to_cpu(a->length) + + le32toh(a->length) + sizeof(a->compressed_size)))) { /* * Move everything at the offset of the compressed size @@ -1955,7 +1955,7 @@ compressed_size) + sizeof(a->compressed_size), (u8*)a + offsetof(ATTR_RECORD, compressed_size), - le32_to_cpu(a->length) - offsetof( + le32toh(a->length) - offsetof( ATTR_RECORD, compressed_size)); /* * Update the name offset to match the moved data. If @@ -1964,7 +1964,7 @@ * incorrect value. */ if (a->name_length) - a->name_offset = htole16(le16_to_cpu( + a->name_offset = htole16(le16toh( a->name_offset) + sizeof(a->compressed_size)); else @@ -1972,7 +1972,7 @@ ATTR_RECORD, compressed_size) + sizeof(a->compressed_size)); /* Update the mapping pairs offset. */ - mp_ofs = le16_to_cpu(a->mapping_pairs_offset) + + mp_ofs = le16toh(a->mapping_pairs_offset) + sizeof(a->compressed_size); goto sparse_done; } @@ -1995,7 +1995,7 @@ * the needed alignment padding. */ if (((sizeof(ATTR_RECORD) + a->name_length * sizeof(ntfschar) + - 7) & ~7) + 8 <= le32_to_cpu(a->length)) { + 7) & ~7) + 8 <= le32toh(a->length)) { add_compressed_size: /* * Move the name back to the new end of the attribute @@ -2003,7 +2003,7 @@ */ if (a->name_length) memmove((u8*)a + sizeof(ATTR_RECORD), (u8*)a + - le16_to_cpu(a->name_offset), + le16toh(a->name_offset), a->name_length * sizeof(ntfschar)); /* @@ -2123,13 +2123,13 @@ * record. */ err = ntfs_attr_record_resize(ctx->m, a, - le32_to_cpu(m->bytes_allocated) - - le32_to_cpu(m->bytes_in_use) + - le32_to_cpu(a->length)); + le32toh(m->bytes_allocated) - + le32toh(m->bytes_in_use) + + le32toh(a->length)); if (err) panic("%s(): err - resize failed\n", __FUNCTION__); if (((sizeof(ATTR_RECORD) + a->name_length * sizeof(ntfschar) + - 7) & ~7) + 8 > le32_to_cpu(a->length)) + 7) & ~7) + 8 > le32toh(a->length)) panic("%s(): attribute record is still too small\n", __FUNCTION__); goto add_compressed_size; @@ -2153,7 +2153,7 @@ * preserve it or we would lose the data. */ a->compression_unit = 0; - if (first_vcn > sle64_to_cpu(a->highest_vcn) + 1) { + if (first_vcn > le64toh(a->highest_vcn) + 1) { /* * Move everything after the compressed size forward to the * offset of the compressed size thus deleting the compressed @@ -2162,7 +2162,7 @@ memmove((u8*)a + offsetof(ATTR_RECORD, compressed_size), (u8*)a + offsetof(ATTR_RECORD, compressed_size) + sizeof(a->compressed_size), - le32_to_cpu(a->length) - (offsetof(ATTR_RECORD, + le32toh(a->length) - (offsetof(ATTR_RECORD, compressed_size) + sizeof(a->compressed_size))); /* * Update the name offset and the mapping pairs offset to match @@ -2175,10 +2175,10 @@ compressed_size)); else a->name_offset = htole16( - le16_to_cpu(a->name_offset) - + le16toh(a->name_offset) - sizeof(a->compressed_size)); a->mapping_pairs_offset = htole16( - le16_to_cpu(a->mapping_pairs_offset) - + le16toh(a->mapping_pairs_offset) - sizeof(a->compressed_size)); /* * Shrink the attribute record to reflect the removal of the @@ -2186,7 +2186,7 @@ * the attribute smaller thus by definition there there is * enough space to do so. */ - err = ntfs_attr_record_resize(ctx->m, a, le32_to_cpu( + err = ntfs_attr_record_resize(ctx->m, a, le32toh( a->length) - sizeof(a->compressed_size)); if (err) panic("%s(): err\n", __FUNCTION__); @@ -2209,7 +2209,7 @@ */ if (a->name_length) memmove((u8*)a + offsetof(ATTR_RECORD, compressed_size), - (u8*)a + le16_to_cpu(a->name_offset), + (u8*)a + le16toh(a->name_offset), a->name_length * sizeof(ntfschar)); /* * Update the name offset and the mapping pairs offset to match the @@ -2242,7 +2242,7 @@ * attribute extent, look up the attribute extent containing the first * vcn. */ - if (mpa_is_valid && first_vcn > sle64_to_cpu(a->highest_vcn) + 1) { + if (mpa_is_valid && first_vcn > le64toh(a->highest_vcn) + 1) { err = ntfs_attr_lookup(ni->type, ni->name, ni->name_len, first_vcn, NULL, 0, ctx); if (err) { @@ -2370,7 +2370,7 @@ * consumed the old one. */ m->next_attr_instance = htole16( - (le16_to_cpu(m->next_attr_instance) + 1) & 0xffff); + (le16toh(m->next_attr_instance) + 1) & 0xffff); a->value_length = cpu_to_le32(val_len); a->value_offset = htole16(val_ofs); if (type == AT_FILENAME) @@ -2431,7 +2431,7 @@ ntfs_debug("Entering for mft_no 0x%llx, attribute type 0x%x, name_len " "0x%x, val_len 0x%x.", (unsigned long long)ni->mft_no, - (unsigned)le32_to_cpu(type), name_len, val_len); + (unsigned)le32toh(type), name_len, val_len); vol = ni->vol; /* * Calculate the offset into the new attribute at which the attribute @@ -2531,7 +2531,7 @@ ntfs_error(vol->mp, "Failed to add attribute type " "0x%x to mft_no 0x%llx because looking " "up the attribute failed (error %d).", - (unsigned)le32_to_cpu(type), + (unsigned)le32toh(type), (unsigned long long)ni->mft_no, -err); return err; } @@ -2546,7 +2546,7 @@ "0x%x to mft_no 0x%llx because " "allocating a new extent mft record " "failed (error %d).", - (unsigned)le32_to_cpu(type), + (unsigned)le32toh(type), (unsigned long long)ni->mft_no, err); /* * If we added the attribute list attribute above we @@ -2592,7 +2592,7 @@ * consumed the old one. */ m->next_attr_instance = htole16( - (le16_to_cpu(m->next_attr_instance) + 1) & 0xffff); + (le16toh(m->next_attr_instance) + 1) & 0xffff); a->value_length = cpu_to_le32(val_len); a->value_offset = htole16(val_ofs); if (type == AT_FILENAME) @@ -2603,7 +2603,7 @@ name_len << NTFSCHAR_SIZE_SHIFT); /* If a value is specified, copy it into place. */ if (val) { - memcpy((u8*)a + le16_to_cpu(a->value_offset), val, val_len); + memcpy((u8*)a + le16toh(a->value_offset), val, val_len); /* * Ensure the mft record containing the new filename attribute * gets written out. @@ -2884,10 +2884,10 @@ errno_t ntfs_resident_attr_value_resize(MFT_RECORD *m, ATTR_RECORD *a, const u32 new_size) { - const u32 old_size = le32_to_cpu(a->value_length); + const u32 old_size = le32toh(a->value_length); /* Resize the resident part of the attribute record. */ - if (ntfs_attr_record_resize(m, a, le16_to_cpu(a->value_offset) + + if (ntfs_attr_record_resize(m, a, le16toh(a->value_offset) + new_size)) return ENOSPC; /* @@ -2895,7 +2895,7 @@ * the area between the old size and @new_size. */ if (new_size > old_size) - bzero((u8*)a + le16_to_cpu(a->value_offset) + old_size, + bzero((u8*)a + le16toh(a->value_offset) + old_size, new_size - old_size); /* Finally update the length of the attribute value. */ a->value_length = cpu_to_le32(new_size); @@ -3039,11 +3039,11 @@ * If the page is not uptodate bring it uptodate by copying from the * attribute value. */ - attr_size = le32_to_cpu(a->value_length); + attr_size = le32toh(a->value_length); if (attr_size != data_size) panic("%s(): attr_size != data_size\n", __FUNCTION__); if (upl && !upl_valid_page(pl, 0)) { - memcpy(kaddr, (u8*)a + le16_to_cpu(a->value_offset), + memcpy(kaddr, (u8*)a + le16toh(a->value_offset), attr_size); bzero(kaddr + attr_size, PAGE_SIZE - attr_size); } @@ -3062,10 +3062,10 @@ * The attribute record size required cannot be larger than the amount * of space in an mft record. */ - if (arec_size > le32_to_cpu(m->bytes_allocated) - - le16_to_cpu(m->attrs_offset)) - panic("%s(): arec_size > le32_to_cpu(m->bytes_allocated) - " - "le16_to_cpu(m->attrs_offset)\n", + if (arec_size > le32toh(m->bytes_allocated) - + le16toh(m->attrs_offset)) + panic("%s(): arec_size > le32toh(m->bytes_allocated) - " + "le16toh(m->attrs_offset)\n", __FUNCTION__); /* * To make space in the mft record we would like to try to make other @@ -3181,7 +3181,7 @@ } ntfs_error(vol->mp, "Failed to move attribute type 0x%x out " "of base mft_no 0x%llx into an extent mft " - "record (error %d).", le32_to_cpu(type), + "record (error %d).", le32toh(type), base_ni->mft_no, err); goto unm_err; } @@ -3190,7 +3190,7 @@ * The number of free bytes needed in the mft record so the resize can * succeed. */ - bytes_needed = arec_size - le32_to_cpu(a->length); + bytes_needed = arec_size - le32toh(a->length); /* * The MFT reference of the mft record in which the attribute to be * made non-resident is located. @@ -3283,7 +3283,7 @@ * But first find the attribute list entry matching the * attribute record so it can be updated. */ - a_name = (ntfschar*)((u8*)a + le16_to_cpu(a->name_offset)); + a_name = (ntfschar*)((u8*)a + le16toh(a->name_offset)); al_entry = (ATTR_LIST_ENTRY*)base_ni->attr_list; do { /* @@ -3295,7 +3295,7 @@ "found in attribute list " "attribute of base mft record " "0x%llx. Run chkdsk.", - (unsigned)le32_to_cpu(a->type), + (unsigned)le32toh(a->type), (unsigned long long) base_ni->mft_no); NVolSetErrors(vol); @@ -3323,7 +3323,7 @@ "attribute list attribute of " "base mft record 0x%llx. Run " "chkdsk.", - (unsigned)le32_to_cpu(a->type), + (unsigned)le32toh(a->type), (unsigned long long) base_ni->mft_no); NVolSetErrors(vol); @@ -3332,7 +3332,7 @@ } /* Go to the next attribute list entry. */ al_entry = (ATTR_LIST_ENTRY*)((u8*)al_entry + - le16_to_cpu(al_entry->length)); + le16toh(al_entry->length)); } while (1); /* Finally, move the attribute to an extent record. */ err = ntfs_attr_record_move_for_attr_list_attribute(&actx, @@ -3342,7 +3342,7 @@ "0x%x out of base mft record 0x%llx " "and into an extent mft record (error " "%d). Run chkdsk.", - (unsigned)le32_to_cpu(a->type), + (unsigned)le32toh(a->type), (unsigned long long)base_ni->mft_no, err); NVolSetErrors(vol); @@ -3398,8 +3398,8 @@ goto retry_resize; } /* If we now have enough space retry the resize. */ - if (bytes_needed > le32_to_cpu(m->bytes_allocated) - - le32_to_cpu(m->bytes_in_use)) { + if (bytes_needed > le32toh(m->bytes_allocated) - + le32toh(m->bytes_in_use)) { a = ctx.a; goto retry_resize; } @@ -3413,7 +3413,7 @@ /* Move the attribute name if it exists and update the offset. */ if (a->name_length) memmove((u8*)a + name_ofs, - (u8*)a + le16_to_cpu(a->name_offset), + (u8*)a + le16toh(a->name_offset), a->name_length * sizeof(ntfschar)); a->name_offset = htole16(name_ofs); /* Setup the fields specific to non-resident attributes. */ @@ -3582,7 +3582,7 @@ base_ni = al_ctx->ni; ntfs_debug("Entering for mft_no 0x%llx, attribute type 0x%x.", (unsigned long long)base_ni->mft_no, - (unsigned)le32_to_cpu(al_entry->type)); + (unsigned)le32toh(al_entry->type)); /* * Allocate a new extent mft record, attach it to the base ntfs inode * and set up the search context to point to it. @@ -3601,7 +3601,7 @@ "mft record failed (error %d).", err); return err; } - attr_len = le32_to_cpu(al_ctx->a->length); + attr_len = le32toh(al_ctx->a->length); /* Make space for the attribute extent and copy it into place. */ err = ntfs_attr_record_make_space(m, a, attr_len); /* @@ -3633,7 +3633,7 @@ * consumed the old one. */ m->next_attr_instance = htole16( - (le16_to_cpu(m->next_attr_instance) + 1) & 0xffff); + (le16toh(m->next_attr_instance) + 1) & 0xffff); /* * Ensure the changes make it to disk later and unmap the mft record as * we do not need it any more right now. @@ -3706,8 +3706,8 @@ "attribute type 0x%x.", (unsigned long long)base_ni->mft_no, (unsigned long long)ni->mft_no, - (unsigned)le32_to_cpu(a->type)); - attr_len = le32_to_cpu(a->length); + (unsigned)le32toh(a->type)); + attr_len = le32toh(a->length); /* Allocate a temporary buffer to hold the attribute to be moved. */ a_copy = OSMalloc(attr_len, ntfs_malloc_tag); if (!a_copy) { @@ -3726,7 +3726,7 @@ * attribute in the mft record as this would not gain anything thus * report a bug in this case. */ - if (((ATTR_RECORD*)((u8*)m + le16_to_cpu(m->attrs_offset)))->type == + if (((ATTR_RECORD*)((u8*)m + le16toh(m->attrs_offset)))->type == AT_END) panic("%s(): Is only attribute in mft record!\n", __FUNCTION__); /* Ensure the changes make it to disk later. */ @@ -3791,7 +3791,7 @@ * consumed the old one. */ m->next_attr_instance = htole16( - (le16_to_cpu(m->next_attr_instance) + 1) & 0xffff); + (le16toh(m->next_attr_instance) + 1) & 0xffff); /* Ensure the changes make it to disk later. */ NInoSetMrecNeedsDirtying(ni); /* @@ -3806,7 +3806,7 @@ err = ntfs_rl_write(base_ni->vol, base_ni->attr_list, base_ni->attr_list_size, &base_ni->attr_list_rl, ofs, - le16_to_cpu(ctx->al_entry->length)); + le16toh(ctx->al_entry->length)); if (err) { ntfs_error(base_ni->vol->mp, "Failed to update " "on-disk attribute list attribute of " @@ -3819,7 +3819,7 @@ ATTR_LIST_ENTRY *al_entry; al_entry = (ATTR_LIST_ENTRY*)((u8*)a + - le16_to_cpu(a->value_offset) + + le16toh(a->value_offset) + ((u8*)ctx->al_entry - base_ni->attr_list)); al_entry->mft_reference = ctx->al_entry->mft_reference; al_entry->instance = ctx->al_entry->instance; @@ -3927,7 +3927,7 @@ "size 0x%llx, old initialized size 0x%llx, new " "initialized size 0x%llx.", (unsigned long long)ni->mft_no, - (unsigned)le32_to_cpu(ni->type), + (unsigned)le32toh(ni->type), (unsigned long long)ni->data_size, (unsigned long long)ni->initialized_size, (unsigned long long)new_init_size); @@ -3973,12 +3973,12 @@ if (new_init_size >> 32) panic("%s(): new_init_size >> 32\n", __FUNCTION__); - if (new_init_size > le32_to_cpu(a->length) - - le16_to_cpu(a->value_offset)) + if (new_init_size > le32toh(a->length) - + le16toh(a->value_offset)) panic("%s(): new_init_size > " - "le32_to_cpu(" + "le32toh(" "a->length) - " - "le16_to_cpu(" + "le16toh(" "a->value_offset)\n", __FUNCTION__); a->value_length = cpu_to_le32(new_init_size); @@ -4129,14 +4129,14 @@ if (a->non_resident) panic("%s(): a->non_resident\n", __FUNCTION__); /* The total length of the attribute value. */ - attr_len = le32_to_cpu(a->value_length); + attr_len = le32toh(a->value_length); if (size != attr_len) panic("%s(): size != attr_len\n", __FUNCTION__); /* * Do the zeroing in the mft record and update the attribute size in * the mft record. */ - kattr = (u8*)a + le16_to_cpu(a->value_offset); + kattr = (u8*)a + le16toh(a->value_offset); bzero(kattr + attr_len, new_init_size - attr_len); a->value_length = cpu_to_le32((u32)new_init_size); /* Update the sizes in the ntfs inode as well as the ubc size. */ @@ -4175,8 +4175,8 @@ a = ctx->a; if (!a->non_resident) panic("%s(): !a->non_resident\n", __FUNCTION__); - if (size != sle64_to_cpu(a->data_size)) - panic("%s(): size != sle64_to_cpu(a->data_size)\n", + if (size != le64toh(a->data_size)) + panic("%s(): size != le64toh(a->data_size)\n", __FUNCTION__); size = new_init_size; lck_spin_lock(&ni->size_lock); @@ -4537,7 +4537,7 @@ ntfs_debug("Entering for mft_no 0x%llx, type 0x%x, name_len 0x%x.", (unsigned long long)base_ni->mft_no, - (unsigned)le32_to_cpu(ni->type), ni->name_len); + (unsigned)le32toh(ni->type), ni->name_len); return ENOTSUP; #if 0 vol = base_ni->vol; @@ -4564,7 +4564,7 @@ if (a->flags & ATTR_IS_COMPRESSED) panic("%s(): a->flags & ATTR_IS_COMPRESSED)\n", __FUNCTION__); retry_attr_rec_resize: - err = ntfs_attr_record_resize(m, a, le32_to_cpu(a->length) + + err = ntfs_attr_record_resize(m, a, le32toh(a->length) + sizeof(a->compressed_size)); if (!err) { /* @@ -4574,7 +4574,7 @@ memmove((u8*)a + offsetof(ATTR_RECORD, compressed_size) + sizeof(a->compressed_size), (u8*)a + offsetof(ATTR_RECORD, compressed_size), - le32_to_cpu(a->length) - offsetof(ATTR_RECORD, + le32toh(a->length) - offsetof(ATTR_RECORD, compressed_size)); /* * Update the name offset to match the moved data. If there is @@ -4583,7 +4583,7 @@ */ if (a->name_length) a->name_offset = htole16( - le16_to_cpu(a->name_offset) + + le16toh(a->name_offset) + sizeof(a->compressed_size)); else a->name_offset = htole16( @@ -4591,7 +4591,7 @@ compressed_size) + sizeof(a->compressed_size)); /* Update the mapping pairs offset to its new location. */ - mp_ofs = le16_to_cpu(a->mapping_pairs_offset) + + mp_ofs = le16toh(a->mapping_pairs_offset) + sizeof(a->compressed_size); goto set_compressed_size; } @@ -4712,7 +4712,7 @@ if (name_size) memmove((u8*)a + offsetof(ATTR_RECORD, compressed_size) + sizeof(a->compressed_size), (u8*)a + - le16_to_cpu(a->name_offset), name_size); + le16toh(a->name_offset), name_size); a->name_offset = htole16(offsetof(ATTR_RECORD, compressed_size) + sizeof(a->compressed_size)); /* Update the mapping pairs offset to its new location. */ @@ -4763,7 +4763,7 @@ * runlist elements that were stored in the base attribute extent * before we added the compressed size to the attribute record. */ - highest_vcn = sle64_to_cpu(a->highest_vcn); + highest_vcn = le64toh(a->highest_vcn); err = ntfs_get_size_for_mapping_pairs(vol, ni->rl.elements ? ni->rl.rl : NULL, 0, highest_vcn, &mp_size); if (err) { @@ -4773,7 +4773,7 @@ } /* Write the mapping pairs array. */ err = ntfs_mapping_pairs_build(vol, (s8*)a + mp_ofs, - le32_to_cpu(a->length) - mp_ofs, ni->rl.elements ? + le32toh(a->length) - mp_ofs, ni->rl.elements ? ni->rl.rl : NULL, 0, highest_vcn, &stop_vcn); if (err && err != ENOSPC) { ntfs_error(vol->mp, "Failed to rebuild mapping pairs array " @@ -4864,7 +4864,7 @@ * list attribute entry for the created attribute extent. */ al_entry = ctx->al_entry = (ATTR_LIST_ENTRY*)((u8*)ctx->al_entry + - le16_to_cpu(ctx->al_entry->length)); + le16toh(ctx->al_entry->length)); al_entry_len = (offsetof(ATTR_LIST_ENTRY, name) + name_size + 7) & ~7; new_al_size = base_ni->attr_list_size + al_entry_len; /* Out of bounds checks. */ @@ -4945,7 +4945,7 @@ * consumed the old one. */ m->next_attr_instance = htole16( - (le16_to_cpu(m->next_attr_instance) + 1) & 0xffff); + (le16toh(m->next_attr_instance) + 1) & 0xffff); al_entry->lowest_vcn = a->lowest_vcn = cpu_to_sle64(stop_vcn); a->highest_vcn = cpu_to_sle64(highest_vcn); al_entry->mft_reference = MK_LE_MREF(eni->mft_no, eni->seq_no); @@ -4993,7 +4993,7 @@ * attribute record. */ err = ntfs_mapping_pairs_build(vol, (s8*)a + mp_ofs, - le32_to_cpu(a->length) - mp_ofs, rl, stop_vcn, + le32toh(a->length) - mp_ofs, rl, stop_vcn, highest_vcn, &stop_vcn); if (err && err != ENOSPC) { ntfs_error(vol->mp, "Failed to rebuild mapping pairs array " @@ -5091,7 +5091,7 @@ memmove((u8*)a + offsetof(ATTR_RECORD, compressed_size), (u8*)a + offsetof(ATTR_RECORD, compressed_size) + sizeof(a->compressed_size), - le32_to_cpu(a->length) - (offsetof(ATTR_RECORD, + le32toh(a->length) - (offsetof(ATTR_RECORD, compressed_size) + sizeof(a->compressed_size))); /* * Update the name offset and the mapping pairs offset to match @@ -5104,10 +5104,10 @@ compressed_size)); else a->name_offset = htole16( - le16_to_cpu(a->name_offset) - + le16toh(a->name_offset) - sizeof(a->compressed_size)); a->mapping_pairs_offset = htole16( - le16_to_cpu(a->mapping_pairs_offset) - + le16toh(a->mapping_pairs_offset) - sizeof(a->compressed_size)); /* Set the compression unit to 0. */ a->compression_unit = 0; @@ -5125,7 +5125,7 @@ * enough space to do so. */ err = ntfs_attr_record_resize(ctx->m, a, - le32_to_cpu(a->length) - + le32toh(a->length) - sizeof(a->compressed_size)); if (err) panic("%s(): err\n", __FUNCTION__); @@ -5526,7 +5526,7 @@ * attribute record get the attribute record containing it so * we can update the mapping pairs array. */ - if (vcn > sle64_to_cpu(a->highest_vcn)) { + if (vcn > le64toh(a->highest_vcn)) { /* Ensure the modified mft record is written out. */ NInoSetMrecNeedsDirtying(ctx->ni); err = ntfs_attr_lookup(ni->type, ni->name, ni->name_len, @@ -5546,7 +5546,7 @@ * Get the size for the new mapping pairs array for this * attribute extent. */ - lowest_vcn = sle64_to_cpu(a->lowest_vcn); + lowest_vcn = le64toh(a->lowest_vcn); /* * Get the runlist element containing the lowest vcn. * @@ -5564,7 +5564,7 @@ "pairs array (error %d).", err); goto undo_sparse; } - mp_ofs = le16_to_cpu(a->mapping_pairs_offset); + mp_ofs = le16toh(a->mapping_pairs_offset); retry_attr_rec_resize: /* * Extend the attribute record to fit the bigger mapping pairs @@ -5655,9 +5655,9 @@ */ goto retry_attr_rec_resize; } - max_size = (le32_to_cpu(m->bytes_allocated) - - le32_to_cpu(m->bytes_in_use)) & ~7; - max_size += le32_to_cpu(a->length) - mp_ofs; + max_size = (le32toh(m->bytes_allocated) - + le32toh(m->bytes_in_use)) & ~7; + max_size += le32toh(a->length) - mp_ofs; err = ntfs_attr_record_resize(m, a, max_size + mp_ofs); /* * We worked out the exact size we can extend to so the resize @@ -5677,7 +5677,7 @@ * to build the mapping pairs array. */ err = ntfs_mapping_pairs_build(vol, (s8*)a + mp_ofs, - le32_to_cpu(a->length) - mp_ofs, rl2, + le32toh(a->length) - mp_ofs, rl2, lowest_vcn, highest_vcn, &stop_vcn); if (err && err != ENOSPC) { ntfs_error(vol->mp, "Cannot fill hole of mft_no " @@ -5685,7 +5685,7 @@ "building the mapping pairs array " "failed (error %d).", (unsigned long long)ni->mft_no, - (unsigned)le32_to_cpu(ni->type), err); + (unsigned)le32toh(ni->type), err); err = EIO; /* * Need to set @a->highest_vcn to enable correct error @@ -5693,7 +5693,7 @@ */ // TODO: HERE... if (!is_first) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From rudot at FreeBSD.org Tue May 29 20:51:22 2012 From: rudot at FreeBSD.org (rudot@FreeBSD.org) Date: Tue May 29 20:51:28 2012 Subject: socsvn commit: r236685 - in soc2012/rudot: aux sys/kern Message-ID: <20120529205120.A7052106567D@hub.freebsd.org> Author: rudot Date: Tue May 29 20:51:19 2012 New Revision: 236685 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236685 Log: set the pcpu racct resource in the racctd while enumerating all procs. Thus also processes that start sleeping for a longer time have their pcpu resource updated. Added: soc2012/rudot/aux/list_changes.sh (contents, props changed) Modified: soc2012/rudot/sys/kern/kern_racct.c soc2012/rudot/sys/kern/sched_4bsd.c Added: soc2012/rudot/aux/list_changes.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/rudot/aux/list_changes.sh Tue May 29 20:51:19 2012 (r236685) @@ -0,0 +1,40 @@ +usage() +{ + echo "Usage: $0 [-v] [-w]" +} + +VERBOSE= +WRITE= + +while getopts "vw" OPTION +do + case $OPTION in + v) + VERBOSE=1 + ;; + w) + WRITE=1 + ;; + ?) + usage + exit + ;; + esac +done + +FILES=`find ../sys -name "*.[ch]"` + +for file in $FILES +do + tree_file=/usr/src/${file#*/} + if [ -n "$WRITE" ]; then + if ! diff -q $file $tree_file > /dev/null; then + echo "Copying $tree_file to $file" + cp "$tree_file" "$file" + fi + elif [ -z "$VERBOSE" ]; then + diff -q "$file" "$tree_file" + else + diff -u "$file" "$tree_file" + fi +done Modified: soc2012/rudot/sys/kern/kern_racct.c ============================================================================== --- soc2012/rudot/sys/kern/kern_racct.c Tue May 29 19:55:07 2012 (r236684) +++ soc2012/rudot/sys/kern/kern_racct.c Tue May 29 20:51:19 2012 (r236685) @@ -413,8 +413,8 @@ return (error); } -void -racct_set_force(struct proc *p, int resource, uint64_t amount) +static void +racct_set_force_locked(struct proc *p, int resource, uint64_t amount) { int64_t diff; @@ -425,13 +425,19 @@ */ 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); +} + +void +racct_set_force(struct proc *p, int resource, uint64_t amount) +{ + mtx_lock(&racct_lock); + racct_set_force_locked(p, resource, amount); mtx_unlock(&racct_lock); } @@ -696,6 +702,8 @@ struct proc *p; struct timeval wallclock; uint64_t runtime; + fixpt_t pctcpu; + int pct_human; for (;;) { sx_slock(&allproc_lock); @@ -706,10 +714,15 @@ microuptime(&wallclock); timevalsub(&wallclock, &p->p_stats->p_start); + pctcpu = 0; PROC_LOCK(p); PROC_SLOCK(p); - FOREACH_THREAD_IN_PROC(p, td) + FOREACH_THREAD_IN_PROC(p, td) { ruxagg(p, td); + thread_lock(td); + pctcpu += sched_pctcpu(td); + thread_unlock(td); + } runtime = cputick2usec(p->p_rux.rux_runtime); PROC_SUNLOCK(p); #ifdef notyet @@ -720,7 +733,14 @@ runtime = p->p_prev_runtime; #endif p->p_prev_runtime = runtime; + pct_human = (100 * pctcpu) / FSCALE; mtx_lock(&racct_lock); + /* + * I use _force_ here because we always want to have + * the real value in the RACCT_PCTCPU resource + * regardless of the limits set. + */ + racct_set_force_locked(p, RACCT_PCTCPU, pct_human); racct_set_locked(p, RACCT_CPU, runtime); racct_set_locked(p, RACCT_WALLCLOCK, (uint64_t)wallclock.tv_sec * 1000000 + Modified: soc2012/rudot/sys/kern/sched_4bsd.c ============================================================================== --- soc2012/rudot/sys/kern/sched_4bsd.c Tue May 29 19:55:07 2012 (r236684) +++ soc2012/rudot/sys/kern/sched_4bsd.c Tue May 29 20:51:19 2012 (r236685) @@ -694,7 +694,6 @@ struct pcpuidlestat *stat; struct td_sched *ts; #ifdef RACCT - int error; int pct_human; fixpt_t pctcpu; struct thread *tdp; @@ -732,9 +731,8 @@ 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))) { + racct_set_force(td->td_proc, RACCT_PCTCPU, pct_human); + if (pct_human >= racct_get_limit(td->td_proc, RACCT_PCTCPU)) { pause("racct", hz); } #endif From aleek at FreeBSD.org Tue May 29 21:47:59 2012 From: aleek at FreeBSD.org (aleek@FreeBSD.org) Date: Tue May 29 21:48:09 2012 Subject: socsvn commit: r236688 - in soc2012/aleek/beaglexm-armv6: . sys/arm/ti/omap3 Message-ID: <20120529214757.44460106564A@hub.freebsd.org> Author: aleek Date: Tue May 29 21:47:56 2012 New Revision: 236688 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236688 Log: merging omap3 branch to armv6 part 1 Added: soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/files.omap35xx soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap35xx.c soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3_intr.c soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3_prcm_clks.c soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3_scm_padconf.c soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3_timer.c soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3var.h soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/std.omap35xx soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/uart_bus_omap3.c soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/uart_cpu_omap3.c Modified: soc2012/aleek/beaglexm-armv6/ (props changed) Added: soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/files.omap35xx ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/files.omap35xx Tue May 29 21:47:56 2012 (r236688) @@ -0,0 +1,27 @@ +#$FreeBSD$ + +arm/ti/omap.c standard +arm/ti/omap_cpuid.c standard +arm/ti/omap_dma.c standard +arm/ti/omap_prcm.c standard +arm/ti/omap_scm.c standard +arm/ti/omap_gpio.c optional gpio +arm/ti/omap_gptimer.c standard +arm/ti/omap_mmc.c optional mmc +arm/ti/omap_space_asm.S standard +arm/ti/omap_i2c.c optional iic + +arm/ti/omap3/omap35xx.c standard +arm/ti/omap3/omap3_intr.c standard +arm/ti/omap3/omap3_prcm_clks.c standard +arm/ti/omap3/omap3_scm_padconf.c standard +arm/ti/omap3/omap3_timer.c standard + +arm/ti/omap3/uart_cpu_omap3.c optional uart +#arm/ti/omap3/uart_bus_omap3.c optional uart + +dev/uart/uart_dev_ns8250.c optional uart + +# USB Host controller +arm/ti/omap_ehci.c optional ehci usb + Added: soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap35xx.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap35xx.c Tue May 29 21:47:56 2012 (r236688) @@ -0,0 +1,491 @@ +/*- + * Copyright (c) 2011 + * Ben Gray . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#define _ARM32_BUS_DMA_PRIVATE +#include + +#include +#include +#include + +struct omap3_softc *g_omap3_softc = NULL; + + +/* + * Standard priority levels for the system - 0 has the highest priority and 63 + * is the lowest. + * + * Currently these are all set to the same standard value. + */ +static const int omap35xx_irq_prio[96] = +{ + 0, /* MPU emulation(2) */ + 0, /* MPU emulation(2) */ + 0, /* MPU emulation(2) */ + 0, /* MPU emulation(2) */ + 0, /* Sidetone MCBSP2 overflow */ + 0, /* Sidetone MCBSP3 overflow */ + 0, /* MPU subsystem secure state-machine abort (2) */ + 0, /* External source (active low) */ + 0, /* RESERVED */ + 0, /* SMX error for debug */ + 0, /* SMX error for application */ + 0, /* PRCM module IRQ */ + 0, /* System DMA request 0(3) */ + 0, /* System DMA request 1(3) */ + 0, /* System DMA request 2 */ + 0, /* System DMA request 3 */ + 0, /* McBSP module 1 IRQ (3) */ + 0, /* McBSP module 2 IRQ (3) */ + 0, /* SmartReflex? 1 */ + 0, /* SmartReflex? 2 */ + 0, /* General-purpose memory controller module */ + 0, /* 2D/3D graphics module */ + 0, /* McBSP module 3(3) */ + 0, /* McBSP module 4(3) */ + 0, /* Camera interface request 0 */ + 0, /* Display subsystem module(3) */ + 0, /* Mailbox user 0 request */ + 0, /* McBSP module 5 (3) */ + 0, /* IVA2 MMU */ + 0, /* GPIO module 1(3) */ + 0, /* GPIO module 2(3) */ + 0, /* GPIO module 3(3) */ + 0, /* GPIO module 4(3) */ + 0, /* GPIO module 5(3) */ + 0, /* GPIO module 6(3) */ + 0, /* USIM interrupt (HS devices only) (4) */ + 0, /* Watchdog timer module 3 overflow */ + 0, /* General-purpose timer module 1 */ + 0, /* General-purpose timer module 2 */ + 0, /* General-purpose timer module 3 */ + 0, /* General-purpose timer module 4 */ + 0, /* General-purpose timer module 5(3) */ + 0, /* General-purpose timer module 6(3) */ + 0, /* General-purpose timer module 7(3) */ + 0, /* General-purpose timer module 8(3) */ + 0, /* General-purpose timer module 9 */ + 0, /* General-purpose timer module 10 */ + 0, /* General-purpose timer module 11 */ + 0, /* McSPI module 4 */ + 0, /* SHA-1/MD5 crypto-accelerator 2 (HS devices only)(4) */ + 0, /* PKA crypto-accelerator (HS devices only) (4) */ + 0, /* SHA-2/MD5 crypto-accelerator 1 (HS devices only) (4) */ + 0, /* RNG module (HS devices only) (4) */ + 0, /* MG function (3) */ + 0, /* McBSP module 4 transmit(3) */ + 0, /* McBSP module 4 receive(3) */ + 0, /* I2C module 1 */ + 0, /* I2C module 2 */ + 0, /* HDQ / One-wire */ + 0, /* McBSP module 1 transmit(3) */ + 0, /* McBSP module 1 receive(3) */ + 0, /* I2C module 3 */ + 0, /* McBSP module 2 transmit(3) */ + 0, /* McBSP module 2 receive(3) */ + 0, /* PKA crypto-accelerator (HS devices only) (4) */ + 0, /* McSPI module 1 */ + 0, /* McSPI module 2 */ + 0, /* RESERVED */ + 0, /* RESERVED */ + 0, /* RESERVED */ + 0, /* RESERVED */ + 0, /* RESERVED */ + 0, /* UART module 1 */ + 0, /* UART module 2 */ + 0, /* UART module 3 (also infrared)(3) */ + 0, /* Merged interrupt for PBIASlite1 and 2 */ + 0, /* OHCI controller HSUSB MP Host Interrupt */ + 0, /* EHCI controller HSUSB MP Host Interrupt */ + 0, /* HSUSB MP TLL Interrupt */ + 0, /* SHA2/MD5 crypto-accelerator 1 (HS devices only) (4) */ + 0, /* Reserved */ + 0, /* McBSP module 5 transmit(3) */ + 0, /* McBSP module 5 receive(3) */ + 0, /* MMC/SD module 1 */ + 0, /* MS-PRO? module */ + 0, /* Reserved */ + 0, /* MMC/SD module 2 */ + 0, /* MPU ICR */ + 0, /* RESERVED */ + 0, /* McBSP module 3 transmit(3) */ + 0, /* McBSP module 3 receive(3) */ + 0, /* McSPI module 3 */ + 0, /* High-Speed USB OTG controller */ + 0, /* High-Speed USB OTG DMA controller */ + 0, /* MMC/SD module 3 */ + 0, /* General-purpose timer module 12 */ +}; + + +static const struct omap_cpu_dev omap35xx_devs[] = +{ + /** + * OMAP35xx - General Purpose Timers + * This module provides interfaces to the general purpose timers. + */ + { .name = "omap_gptimer", + .unit = 0, + .mem = { { OMAP35XX_GPTIMER1_HWBASE, OMAP35XX_GPTIMER_SIZE }, + { OMAP35XX_GPTIMER2_HWBASE, OMAP35XX_GPTIMER_SIZE }, + { OMAP35XX_GPTIMER3_HWBASE, OMAP35XX_GPTIMER_SIZE }, + { OMAP35XX_GPTIMER4_HWBASE, OMAP35XX_GPTIMER_SIZE }, + { OMAP35XX_GPTIMER5_HWBASE, OMAP35XX_GPTIMER_SIZE }, + { OMAP35XX_GPTIMER6_HWBASE, OMAP35XX_GPTIMER_SIZE }, + { OMAP35XX_GPTIMER7_HWBASE, OMAP35XX_GPTIMER_SIZE }, + { OMAP35XX_GPTIMER8_HWBASE, OMAP35XX_GPTIMER_SIZE }, + { OMAP35XX_GPTIMER9_HWBASE, OMAP35XX_GPTIMER_SIZE }, + { OMAP35XX_GPTIMER10_HWBASE, OMAP35XX_GPTIMER_SIZE }, + { OMAP35XX_GPTIMER11_HWBASE, OMAP35XX_GPTIMER_SIZE }, + { 0, 0 } + }, + .irqs = { OMAP35XX_IRQ_GPT1, + OMAP35XX_IRQ_GPT2, + OMAP35XX_IRQ_GPT3, + OMAP35XX_IRQ_GPT4, + OMAP35XX_IRQ_GPT5, + OMAP35XX_IRQ_GPT6, + OMAP35XX_IRQ_GPT7, + OMAP35XX_IRQ_GPT8, + OMAP35XX_IRQ_GPT9, + OMAP35XX_IRQ_GPT10, + OMAP35XX_IRQ_GPT11, + -1, + }, + }, + + /** + * OMAP35xx - DMA + * This module provides interfaces to the direct memory access controller + */ + { .name = "omap_dma", + .unit = 0, + .mem = { { OMAP35XX_SDMA_HWBASE, OMAP35XX_SDMA_SIZE }, + { 0, 0 } + }, + .irqs = { OMAP35XX_IRQ_SDMA0, + OMAP35XX_IRQ_SDMA1, + OMAP35XX_IRQ_SDMA2, + OMAP35XX_IRQ_SDMA3, + -1, + }, + }, + + /** + * OMAP35xx - I2C + * This module provides interfaces to the I2C controller + * Note: generally this should be the first function sub-device because + * it's used for the TWL power control device. + */ + { .name = "omap_i2c", + .unit = 0, + .mem = { { OMAP35XX_I2C1_HWBASE, OMAP35XX_I2C1_SIZE }, + { 0, 0 } + }, + .irqs = { OMAP35XX_IRQ_I2C1, + -1, + }, + }, + + /** + * OMAP35xx - GPIO + * There are 6 GPIO register sets, with each set representing 32 GPIO + * pins. + */ + { .name = "gpio", + .unit = 0, + .mem = { { OMAP35XX_GPIO1_HWBASE, OMAP35XX_GPIO1_SIZE }, + { OMAP35XX_GPIO2_HWBASE, OMAP35XX_GPIO2_SIZE }, + { OMAP35XX_GPIO3_HWBASE, OMAP35XX_GPIO3_SIZE }, + { OMAP35XX_GPIO4_HWBASE, OMAP35XX_GPIO4_SIZE }, + { OMAP35XX_GPIO5_HWBASE, OMAP35XX_GPIO5_SIZE }, + { OMAP35XX_GPIO6_HWBASE, OMAP35XX_GPIO6_SIZE }, + { 0, 0 } + }, + .irqs = { OMAP35XX_IRQ_GPIO1_MPU, + OMAP35XX_IRQ_GPIO2_MPU, + OMAP35XX_IRQ_GPIO3_MPU, + OMAP35XX_IRQ_GPIO4_MPU, + OMAP35XX_IRQ_GPIO5_MPU, + OMAP35XX_IRQ_GPIO6_MPU, + -1, + }, + }, + + /** + * OMAP35xx - MMC/SDIO + * There are a total of 3 MMC modules on OMAP3 + */ + { .name = "omap_mmc", + .unit = 0, + .mem = { { OMAP35XX_MMCHS1_HWBASE, OMAP35XX_MMCHS_SIZE }, + { 0, 0 } + }, + .irqs = { OMAP35XX_IRQ_MMC1, + -1, + }, + }, + + /** + * OMAP35xx - USB EHCI + * The OMAP EHCI driver expects three different register sets, one for + * the actual EHCI registers and the other two control the interface. + */ + { .name = "ehci", + .unit = 0, + .mem = { { OMAP35XX_USB_EHCI_HWBASE, OMAP35XX_USB_EHCI_SIZE }, + { OMAP35XX_USB_UHH_HWBASE, OMAP35XX_USB_UHH_SIZE }, + { OMAP35XX_USB_TLL_HWBASE, OMAP35XX_USB_TLL_SIZE }, + { 0, 0 } + }, + .irqs = { OMAP35XX_IRQ_EHCI, + -1, + }, + }, + + { 0, 0, { { 0, 0 } }, { -1 } } +}; + + + +/** + * omap_sdram_size - called from machdep to get the total memory size + * + * Since this function is called very early in the boot, there is none of the + * bus handling code setup. However the boot device map will be setup, so + * we can directly access registers already mapped. + * + * This is a bit ugly, but since we need this information early on and the + * only way to get it (appart from hardcoding it or via kernel args) is to read + * from the EMIF_SRAM registers. + * + * RETURNS: + * The size of memory in bytes. + */ +unsigned int +omap_sdram_size(void) +{ + uint32_t size; + uint32_t sdrc_mcfg_0, sdrc_mcfg_1; + + sdrc_mcfg_0 = *((volatile uint32_t *)(OMAP35XX_SDRC_MCFG(0))); + sdrc_mcfg_1 = *((volatile uint32_t *)(OMAP35XX_SDRC_MCFG(1))); + + /* The size is given in bits 17:8 in 2MB chunk sizes */ + size = ((sdrc_mcfg_0 >> 8) & 0x3FF) * (2 * 1024 * 1024); + size += ((sdrc_mcfg_1 >> 8) & 0x3FF) * (2 * 1024 * 1024); + +printf("[BRG] omap_sdram_size : size = %u\n", size); + + return (size); +} + + + + +/** + * omap35xx_add_child - add a child item to the root omap device + * @dev: the parent device + * @order: defines roughly the order with which to add the child to the parent + * @name: the name to give to the child item + * @unit: the unit number for the device + * @addr: the base address of the register set for device + * @size: the number of a bytes in register set + * @irq: the IRQ number(s) for the device + * + * Adds a child to the omap base device. + * + */ +static void +omap35xx_add_child(device_t dev, int prio, const char *name, int unit, + const struct omap_mem_range mem[], const int irqs[]) +{ + device_t kid; + struct omap_ivar *ivar; + unsigned int i; + + /* Start by adding the actual child to the parent (us) */ + kid = device_add_child_ordered(dev, prio, name, unit); + if (kid == NULL) { + printf("Can't add child %s%d ordered\n", name, unit); + return; + } + + /* Allocate some memory for the omap_ivar structure */ + ivar = malloc(sizeof(*ivar), M_DEVBUF, M_NOWAIT | M_ZERO); + if (ivar == NULL) { + device_delete_child(dev, kid); + printf("Can't add alloc ivar\n"); + return; + } + + /* Assign the ivars to the child item and populate with the device resources */ + device_set_ivars(kid, ivar); + + /* Assign the IRQ(s) in the resource list */ + resource_list_init(&ivar->resources); + if (irqs) { + for (i = 0; *irqs != -1; i++, irqs++) { + bus_set_resource(kid, SYS_RES_IRQ, i, *irqs, 1); + } + } + + /* Assign the memory region to the resource list */ + if (mem) { + for (i = 0; mem->base != 0; i++, mem++) { + bus_set_resource(kid, SYS_RES_MEMORY, i, mem->base, mem->size); + } + } +} + + +/** + * omap35xx_cpu_add_builtin_children - adds the SoC child components + * @dev: this device, the one we are adding to + * + * Adds child devices from the omap35xx_devs list. + * + */ +static void +omap35xx_cpu_add_builtin_children(device_t dev) +{ + int i; + const struct omap_cpu_dev *walker; + + /* Setup all the clock devices - this is not the tick timers, rather it's + * the individual functional and interface clocks for the SoC modules. + */ + omap3_clk_init(dev, 1); + + /* Setup the system control module driver, which basically is just the + * padconf (pinmux) for the OMAP35xx devices. + */ + omap3_padconf_init(dev, 1); + + /* Add the rest of the children from the array above */ + for (i = 5, walker = omap35xx_devs; walker->name; i++, walker++) { + omap35xx_add_child(dev, i, walker->name, walker->unit, + walker->mem, walker->irqs); + } +} + + +/** + * omap35xx_identify - adds the SoC child components + * @dev: this device, the one we are adding to + * + * Adds a child to the omap3 base device. + * + */ +static void +omap35xx_identify(driver_t *drv, device_t parent) +{ + /* Add the resources for this "omap35xx" device */ + omap35xx_add_child(parent, 0, "omap35xx", 0, NULL, NULL); + + /* Add the other SOC components */ + omap35xx_cpu_add_builtin_children(parent); +} + +/** + * omap35xx_probe - called when the device is probed + * @dev: the new device + * + * All we do in this routine is set the description of this device + * + */ +static int +omap35xx_probe(device_t dev) +{ + device_set_desc(dev, "TI OMAP35XX"); + return (0); +} + +/** + * omap35xx_attach - called when the device is attached + * @dev: the new device + * + * All we do in this routine is set the description of this device + * + */ +static int +omap35xx_attach(device_t dev) +{ + struct omap_softc *omapsc = device_get_softc(device_get_parent(dev)); + struct omap3_softc *sc = device_get_softc(dev); + + sc->sc_iotag = omapsc->sc_iotag; + sc->sc_dev = dev; + + + /* Map in the interrupt controller register set */ + if (bus_space_map(sc->sc_iotag, OMAP35XX_INTCPS_HWBASE, + OMAP35XX_INTCPS_SIZE, 0, &sc->sc_intcps_ioh)) { + panic("%s: Cannot map registers", device_get_name(dev)); + } + + + /* Save the device structure globally for the IRQ handling */ + g_omap3_softc = sc; + + /* TODO: Revisit - Install an interrupt post filter */ + arm_post_filter = omap3_post_filter_intr; + + /* Setup the OMAP3 interrupt controller */ + omap3_setup_intr_controller(g_omap3_softc, omap35xx_irq_prio); + + return (0); +} + + + +static device_method_t omap35xx_methods[] = { + DEVMETHOD(device_probe, omap35xx_probe), + DEVMETHOD(device_attach, omap35xx_attach), + DEVMETHOD(device_identify, omap35xx_identify), + {0, 0}, +}; + +static driver_t omap35xx_driver = { + "omap35xx", + omap35xx_methods, + sizeof(struct omap3_softc), +}; + +static devclass_t omap35xx_devclass; + +DRIVER_MODULE(omap35xx, omap, omap35xx_driver, omap35xx_devclass, 0, 0); Added: soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3_intr.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3_intr.c Tue May 29 21:47:56 2012 (r236688) @@ -0,0 +1,233 @@ +/*- + * Copyright (c) 2011 + * Ben Gray . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include +#include + + + +/* + * There are a number of ways that interrupt handling is implemented in + * the various ARM platforms, the PXA has the neatest way, it creates another + * device driver that handles everything. However IMO this is rather heavy- + * weight for playing with IRQs which should be quite fast ... so I've + * gone for something similar to the IXP425, which just directly plays with + * registers. This assumes that the interrupt control registers are already + * mapped in virtual memory at a fixed virtual address ... simplies. + * + * The intcps (OMAP3 interrupt controller) has some nice registers, were + * you write a bit to clear or set the mask register ... I think in theory + * that means that you don't need to disable interrupts while doing this, + * because it is an atomic operation. + * + * TODO: check this. + * + */ + + + +#define INTCPS_SYSCONFIG 0x10 +#define INTCPS_SYSSTATUS 0x14 +#define INTCPS_SIR_IRQ 0x40 +#define INTCPS_SIR_FIQ 0x44 +#define INTCPS_CONTROL 0x48 +#define INTCPS_PROTECTION 0x4C +#define INTCPS_IDLE 0x50 +#define INTCPS_IRQ_PRIORITY 0x60 +#define INTCPS_FIQ_PRIORITY 0x64 +#define INTCPS_THRESHOLD 0x68 +#define INTCPS_ITR(n) (0x80 + (0x20 * (n))) +#define INTCPS_MIR(n) (0x84 + (0x20 * (n))) +#define INTCPS_MIR_CLEAR(n) (0x88 + (0x20 * (n))) +#define INTCPS_MIR_SET(n) (0x8C + (0x20 * (n))) +#define INTCPS_ISR_SET(n) (0x90 + (0x20 * (n))) +#define INTCPS_ISR_CLEAR(n) (0x94 + (0x20 * (n))) +#define INTCPS_PENDING_IRQ(n) (0x98 + (0x20 * (n))) +#define INTCPS_PENDING_FIQ(n) (0x9C + (0x20 * (n))) +#define INTCPS_ILR(m) (0x100 + (0x4 * (m))) + + + + +/** + * omap3_post_filter_intr - called after the IRQ has been filtered + * @arg: the IRQ number + * + * Called after the interrupt handler has done it's stuff, can be used to + * clean up interrupts that haven't been handled properly. + * + * + * RETURNS: + * nothing + */ +void +omap3_post_filter_intr(void *arg) +{ + /* uintptr_t irq = (uintptr_t) arg; */ + + /* data synchronization barrier */ + cpu_drain_writebuf(); +} + + + + + +/** + * arm_mask_irq - masks an IRQ (disables it) + * @nb: the number of the IRQ to mask (disable) + * + * Disables the interrupt at the HW level. + * + * + * RETURNS: + * nothing + */ +void +arm_mask_irq(uintptr_t nb) +{ + bus_space_write_4(g_omap3_softc->sc_iotag, g_omap3_softc->sc_intcps_ioh, + INTCPS_MIR_SET(nb >> 5), 1UL << (nb & 0x1F)); +} + + +/** + * arm_unmask_irq - unmasks an IRQ (enables it) + * @nb: the number of the IRQ to unmask (enable) + * + * Enables the interrupt at the HW level. + * + * + * RETURNS: + * nothing + */ +void +arm_unmask_irq(uintptr_t nb) +{ + // printf("[BRG] unmasking IRQ %d (off %d, bit %d)\n", nb, (nb >> 5), (nb & 0x1F)); + + bus_space_write_4(g_omap3_softc->sc_iotag, g_omap3_softc->sc_intcps_ioh, + INTCPS_MIR_CLEAR(nb >> 5), 1UL << (nb & 0x1F)); +} + + + +/** + * arm_get_next_irq - gets the next tripped interrupt + * @last_irq: the number of the last IRQ processed + * + * Enables the interrupt at the HW level. + * + * + * RETURNS: + * nothing + */ +int +arm_get_next_irq(int last_irq) +{ + uint32_t active_irq; + + /* clean-up the last IRQ */ + if (last_irq != -1) { + + /* clear the interrupt status flag */ + bus_space_write_4(g_omap3_softc->sc_iotag, g_omap3_softc->sc_intcps_ioh, + INTCPS_ISR_CLEAR(last_irq >> 5), + 1UL << (last_irq & 0x1F)); + + /* tell the interrupt logic we've dealt with the interrupt */ + bus_space_write_4(g_omap3_softc->sc_iotag, g_omap3_softc->sc_intcps_ioh, + INTCPS_CONTROL, 1); + } + + /* Get the next active interrupt */ + active_irq = bus_space_read_4(g_omap3_softc->sc_iotag, + g_omap3_softc->sc_intcps_ioh, INTCPS_SIR_IRQ); + + /* Check for spurious interrupt */ + if ((active_irq & 0xffffff80) == 0xffffff80) { + device_printf(g_omap3_softc->sc_dev, "Spurious interrupt detected " + "(0x%08x)\n", active_irq); + return -1; + } + + /* Just get the active IRQ part */ + active_irq &= 0x7F; + + /* Return the new IRQ if it is different from the previous */ + if (active_irq != last_irq) + return active_irq; + else + return -1; +} + + +/** + * omap3_setup_intr_controller - configures and enables the OMAP3 interrupt + * controller (INTCPS) + * + * + * + * RETURNS: + * nothing + */ +int +omap3_setup_intr_controller(struct omap3_softc *sc, const const int *irqs) +{ + uint32_t syscfg; + uint32_t i; + + if (sc != g_omap3_softc) + panic("Invalid omap3 soft context\n"); + + + /* Reset the interrupt controller */ + bus_space_write_4(g_omap3_softc->sc_iotag, g_omap3_softc->sc_intcps_ioh, + INTCPS_SYSCONFIG, 0x2); + + /* Loop a number of times to check if the INTCPS has come out of reset */ + for (i = 0; i < 10000; i++) { + syscfg = bus_space_read_4(g_omap3_softc->sc_iotag, + g_omap3_softc->sc_intcps_ioh, INTCPS_SYSCONFIG); + if (syscfg & 0x1UL) + break; + } + + + + return 0; +} + Added: soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3_prcm_clks.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/omap3/omap3_prcm_clks.c Tue May 29 21:47:56 2012 (r236688) @@ -0,0 +1,1196 @@ +/*- + * Copyright (c) 2011 + * Ben Gray . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + + + +/* + * This file defines the clock configuration for the OMAP3xxx series of + * devices. + * + * How This is Suppose to Work + * =========================== + * - There is a top level omap_prcm module that defines all OMAP SoC drivers + * should use to enable/disable the system clocks regardless of the version + * of OMAP device they are running on. This top level PRCM module is just + * a thin shim to chip specific functions that perform the donkey work of + * configuring the clock - this file is the 'donkey' for OMAP35xx devices. + * + * - The key bit in this file is the omap_clk_devmap array, it's + * used by the omap_prcm driver to determine what clocks are valid and which + * functions to call to manipulate them. + * + * - In essence you just need to define some callbacks for each of the + * clocks and then you're done. + * + * - The other thing worth noting is that when the omap_prcm device + * is registered you typically pass in some memory ranges which are the + * SYS_MEMORY resources. These resources are in turn allocated using + * bus_allocate_resources(...) and the resource handles are passed to all + * individual clock callback handlers. + * + * + * + * + */ + + +void +omap3_clk_init(device_t dev, int prio); + +static int +omap3_clk_generic_activate(const struct omap_clock_dev *clkdev, + struct resource* mem_res[]); + +static int +omap3_clk_generic_deactivate(const struct omap_clock_dev *clkdev, + struct resource* mem_res[]); + +static int +omap3_clk_generic_accessible(const struct omap_clock_dev *clkdev, + struct resource* mem_res[]); + +static int +omap3_clk_generic_set_source(const struct omap_clock_dev *clkdev, clk_src_t clksrc, + struct resource* mem_res[]); + +static int +omap3_clk_generic_get_source_freq(const struct omap_clock_dev *clkdev, + unsigned int *freq, + struct resource* mem_res[]); + + +static int +omap3_clk_gptimer_get_source_freq(const struct omap_clock_dev *clkdev, + unsigned int *freq, + struct resource* mem_res[]); +static int +omap3_clk_gptimer_set_source(const struct omap_clock_dev *clkdev, + clk_src_t clksrc, struct resource* mem_res[]); + + + +static int +omap3_clk_alwayson_null_func(const struct omap_clock_dev *clkdev, + struct resource* mem_res[]); + + + +static int +omap3_clk_get_sysclk_freq(const struct omap_clock_dev *clkdev, + unsigned int *freq, struct resource* mem_res[]); + +static int +omap3_clk_get_arm_fclk_freq(const struct omap_clock_dev *clkdev, + unsigned int *freq, struct resource* mem_res[]); + + + +static int +omap3_clk_hsusbhost_activate(const struct omap_clock_dev *clkdev, + struct resource* mem_res[]); + +static int +omap3_clk_hsusbhost_deactivate(const struct omap_clock_dev *clkdev, + struct resource* mem_res[]); + + + + +#define FREQ_96MHZ 96000000 +#define FREQ_64MHZ 64000000 +#define FREQ_48MHZ 48000000 +#define FREQ_32KHZ 32000 + + + +/** + * Only one memory regions is needed for OMAP35xx clock control (unlike OMAP4) + * + * CM Instance - 0x4800 4000 : 0x4800 5500 + * PRM Instance - 0x4830 6000 : 0x4830 8000 + * + */ +#define CM_INSTANCE_MEM_REGION 0 +#define PRM_INSTANCE_MEM_REGION 1 + +#define IVA2_CM_OFFSET 0x0000 +#define OCP_SYSTEM_CM_OFFSET 0x0800 +#define MPU_CM_OFFSET 0x0900 +#define CORE_CM_OFFSET 0x0A00 +#define SGX_CM_OFFSET 0x0B00 +#define WKUP_CM_OFFSET 0x0C00 +#define CLOCK_CTRL_CM_OFFSET 0x0D00 +#define DSS_CM_OFFSET 0x0E00 +#define CAM_CM_OFFSET 0x0F00 +#define PER_CM_OFFSET 0x1000 +#define EMU_CM_OFFSET 0x1100 +#define GLOBAL_CM_OFFSET 0x1200 +#define NEON_CM_OFFSET 0x1300 +#define USBHOST_CM_OFFSET 0x1400 + +#define IVA2_PRM_OFFSET 0x0000 +#define OCP_SYSTEM_PRM_OFFSET 0x0800 +#define MPU_PRM_OFFSET 0x0900 +#define CORE_PRM_OFFSET 0x0A00 +#define SGX_PRM_OFFSET 0x0B00 +#define WKUP_PRM_OFFSET 0x0C00 +#define CLOCK_CTRL_PRM_OFFSET 0x0D00 +#define DSS_PRM_OFFSET 0x0E00 +#define CAM_PRM_OFFSET 0x0F00 +#define PER_PRM_OFFSET 0x1000 +#define EMU_PRM_OFFSET 0x1100 +#define GLOBAL_PRM_OFFSET 0x1200 +#define NEON_PRM_OFFSET 0x1300 +#define USBHOST_PRM_OFFSET 0x1400 + + + + + + +/** + * omap_clk_devmap - Array of clock devices available on OMAP3xxx devices + * + * This map only defines which clocks are valid and the callback functions + * for clock activate, deactivate, etc. It is used by the top level omap_prcm + * driver. + * + * The actual details of the clocks (config registers, bit fields, sources, + * etc) are in the private g_omap3_clk_details array below. + * + */ + +#define OMAP3_GENERIC_CLOCK_DEV(i) \ + { .id = (i), \ + .clk_activate = omap3_clk_generic_activate, \ + .clk_deactivate = omap3_clk_generic_deactivate, \ + .clk_set_source = omap3_clk_generic_set_source, \ + .clk_accessible = omap3_clk_generic_accessible, \ + .clk_get_source_freq = omap3_clk_generic_get_source_freq \ + } + +#define OMAP3_GPTIMER_CLOCK_DEV(i) \ + { .id = (i), \ + .clk_activate = omap3_clk_generic_activate, \ + .clk_deactivate = omap3_clk_generic_deactivate, \ + .clk_set_source = omap3_clk_gptimer_set_source, \ + .clk_accessible = omap3_clk_generic_accessible, \ + .clk_get_source_freq = omap3_clk_gptimer_get_source_freq \ + } + +#define OMAP3_ALWAYSON_CLOCK_DEV(i) \ + { .id = (i), \ + .clk_activate = omap3_clk_alwayson_null_func, \ + .clk_deactivate = omap3_clk_alwayson_null_func, \ + .clk_set_source = NULL, \ + .clk_accessible = omap3_clk_alwayson_null_func, \ + .clk_get_source_freq = NULL \ + } + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From scher at FreeBSD.org Tue May 29 22:33:27 2012 From: scher at FreeBSD.org (scher@FreeBSD.org) Date: Tue May 29 22:33:33 2012 Subject: socsvn commit: r236691 - in soc2012/scher/par_ports/head: Mk lock Message-ID: <20120529223324.E31DC106566C@hub.freebsd.org> Author: scher Date: Tue May 29 22:33:24 2012 New Revision: 236691 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236691 Log: [fixed] bsd.parallel.mk - new locking behaviour bsd.port.mk - few changes just to match new locking behaviour [new_feature] bsd.port.mk - create ${LOCK_DIR} if it is missed bsd.parallel.mk - check-lock target All ports lock files are moved to seperate directory. bsd.parallel.mk: ${PORTSDIR}/lock - is used to keep ports lock files ${_parv_LOCK_DIR_LOCK_FILE} - port's lock file name - is set to ${PKGNAME} Reason: Former changes make possible to implement sufficient conflicts checking redisign. It was impossible to find port's dir in pots tree using package name RE in ${CONFLICTS} variable. Now it is possible just to explore ${LOCK_DIR}. Submitted by: Alexander Pronin Added: soc2012/scher/par_ports/head/lock/ 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 Tue May 29 21:59:09 2012 (r236690) +++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Tue May 29 22:33:24 2012 (r236691) @@ -65,7 +65,9 @@ ##################################################### # Locking variables and tools #PKG_DBDIR?= /var/db/pkg -_parv_LOCK_FILE= .lock +LOCK_DIR= ${PORTSDIR}/lock +_parv_PKG_DBDIR_LOCK_FILE= .lock +_parv_LOCK_DIR_LOCK_FILE= ${PKGNAME} _parv_WAIT_FOR_LOCK_TIME= 5 _parv_WAIT_FOR_UNLOCK_TIME= 15 @@ -88,13 +90,15 @@ # # If the directory is locked this script returns ${_parv_ON_LOCK_EXIT_STATUS}. # -# ${${_lock_dir}} == ${PKG_DBDIR} OR ${.CURDIR} +# ${${_lock_dir}} == ${PKG_DBDIR} OR ${LOCK_DIR} # -.for _lock_dir in PKG_DBDIR .CURDIR +.for _lock_dir in PKG_DBDIR LOCK_DIR # _parv_PKG_DBDIR_LOCK_SEQ -# _parv_.CURDIR_LOCK_SEQ +# _parv_LOCK_DIR_LOCK_SEQ # -_parv_${_lock_dir}_LOCK_SEQ= \ +_parv_LOCK_FILE:= ${_parv_${_lock_dir}_LOCK_FILE} + +_parv_${_lock_dir}_LOCK_SEQ:= \ ${CHMOD} 777 ${${_lock_dir}}/${_parv_LOCK_FILE}; \ pid=$$(${CAT} ${${_lock_dir}}/${_parv_LOCK_FILE}); \ if [ $${pid} ]; then \ @@ -105,13 +109,13 @@ ${_dparv_START_OUTPUT}; \ ${ECHO_CMD} "Dir: ${${_lock_dir}} Stalled lock Detected!"; \ ${ECHO_CMD} "Deleting stalled lock. PID=$${pid}"; \ - ${ECHO_CMD} "Locking: ${${_lock_dir}}"; \ + ${ECHO_CMD} "Locking: ${${_lock_dir}}/${_parv_LOCK_FILE}"; \ ${_dparv_END_OUTPUT}; \ ${ECHO_CMD} ${.MAKE.PID} > ${${_lock_dir}}/${_parv_LOCK_FILE}; \ fi; \ else \ ${_dparv_START_OUTPUT}; \ - ${ECHO_CMD} "Locking: ${${_lock_dir}}"; \ + ${ECHO_CMD} "Locking: ${${_lock_dir}}/${_parv_LOCK_FILE}"; \ ${_dparv_END_OUTPUT}; \ ${ECHO_CMD} ${.MAKE.PID} > ${${_lock_dir}}/${_parv_LOCK_FILE}; \ fi @@ -119,11 +123,11 @@ ##################################################### # _parv_PKG_DBDIR_DO_LOCK -# _parv_.CURDIR_DO_LOCK +# _parv_LOCK_DIR_DO_LOCK # This scripts handles exit status of lockf(1) call. # It substitutes exit status 75 of lockf(1) for ${_parv_ON_LOCK_EXIT_STATUS} and pushes it. # -_parv_${_lock_dir}_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}' || { \ status=$$?; \ if [ $${status} -eq ${_parv_LOCKF_EX_TEMPFAIL} ] || \ @@ -141,11 +145,11 @@ # Loops to lock directory # _parv_PKG_DBDIR_LOCK_LOOP -# _parv_.CURDIR_LOCK_LOOP +# _parv_LOCK_DIR_LOCK_LOOP # $${attempts} - Number of attempts to lock a directory. Exetranl variable. # Default value = 1, if this var is not set. # Set this variable to -1 for infinity loop. -# e.g. ( attempts=10; ${_parv_.CURDIR_LOCK_LOOP} ) && ..... || .... +# e.g. ( attempts=10; ${_parv_LOCK_DIR_LOCK_LOOP} ) && ..... || .... # _parv_${_lock_dir}_LOCK_LOOP= \ enable_feedback=${_parv_ON_LOCK_FEEDBACK_TIMEOUT}; \ @@ -158,7 +162,7 @@ elif [ $${status} -eq ${_parv_ON_LOCK_EXIT_STATUS} ]; then \ if [ $$(( $${enable_feedback} % ${_parv_ON_LOCK_FEEDBACK_TIMEOUT} )) -eq 0 ]; then \ ${_dparv_START_OUTPUT}; \ - ${ECHO_CMD} "Unable to lock ${${_lock_dir}}"; \ + ${ECHO_CMD} "Unable to lock ${${_lock_dir}}/${_parv_LOCK_FILE}"; \ ${ECHO_CMD} "Dir: ${${_lock_dir}} is already locked by another working process ..."; \ ${ECHO_CMD} "Waiting for unlock ........................................................."; \ ${_dparv_END_OUTPUT}; \ @@ -176,13 +180,13 @@ ##################################################### # _parv_PKG_DBDIR_DO_UNLOCK -# _parv_.CURDIR_DO_UNLOCK +# _parv_LOCK_DIR_DO_UNLOCK # -_parv_${_lock_dir}_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} "Dir: ${${_lock_dir}} is unlocked"; \ + ${ECHO_CMD} "Dir: ${${_lock_dir}}/${_parv_LOCK_FILE} is unlocked"; \ ${_dparv_END_OUTPUT}; \ } || { \ ${_dparv_START_OUTPUT}; \ @@ -193,38 +197,38 @@ .endfor # _lock_dir in PKG_DBDIR .CURDIR - +.undef _parv_LOCK_FILE ##################################################### # _parv_CHECK_SEQ # _parv_CHECK_LOCK # The former variables Implement check for lock utility -# $${dir} - dir to check. External variable for script. Assign this variable -# appropriate value before executing this script e.g. ( dir=/some/dir/to/check; ${_parv_CHECK_LOCK} ) || ... -# Script exits with status ${_parv_ON_LOCK_EXIT_STATUS} if $${dir} is locked -# +# $${pkg_name} - port to check. External variable for script. Supports shell RE. Assign this variable +# appropriate value before executing this script e.g. ( pkg_name=apache-[1234]; ${_parv_CHECK_LOCK} ) || ... +# Script exits with status ${_parv_ON_LOCK_EXIT_STATUS} if $${pkg_name} is locked +# _parv_CHECK_SEQ= \ - ${CHMOD} 777 $${dir}/${_parv_LOCK_FILE}; \ - pid=\$$(${CAT} $${dir}/${_parv_LOCK_FILE}); \ + ${CHMOD} 777 ${LOCK_DIR}/$${pkg_name}; \ + pid=\$$(${CAT} ${LOCK_DIR}/$${pkg_name}); \ if [ \$${pid} ]; then \ ps -p \$${pid} > /dev/null && status=\$$? || status=\$$?; \ if [ \$${status} -eq 0 ]; then \ ${_dparv_START_OUTPUT}; \ - ${ECHO_CMD} Unable to lock $${dir}; \ - ${ECHO_CMD} Dir: $${dir} is already locked by another working process ...; \ + ${ECHO_CMD} Unable to lock ${LOCK_DIR}/$${pkg_name}; \ + ${ECHO_CMD} Dir: ${LOCK_DIR} is already locked by another working process ...; \ ${_dparv_START_OUTPUT}; \ exit ${_parv_ON_LOCK_EXIT_STATUS}; \ else \ ${_dparv_START_OUTPUT}; \ - ${ECHO_CMD} Dir: $${dir} Stalled lock Detected!; \ + ${ECHO_CMD} Dir: ${LOCK_DIR}/$${pkg_name} Stalled lock Detected!; \ ${ECHO_CMD} Deleting stalled lock. PID=\$${pid}; \ ${_dparv_END_OUTPUT}; \ fi; \ fi; \ - ${RM} -rf $${dir}/${_parv_LOCK_FILE} + ${RM} -rf ${LOCK_DIR}/$${pkg_name} _parv_CHECK_LOCK= \ - lockf -k -t ${_parv_WAIT_FOR_LOCK_TIME} $${dir}/${_parv_LOCK_FILE} ${SH} -c "${_parv_CHECK_SEQ}" || { \ + lockf -k -t ${_parv_WAIT_FOR_LOCK_TIME} ${LOCK_DIR}/$${pkg_name} ${SH} -c "${_parv_CHECK_SEQ}" || { \ status=$$?; \ if [ $${status} -eq ${_parv_LOCKF_EX_TEMPFAIL} ] || \ [ $${status} -eq ${_parv_ON_LOCK_EXIT_STATUS} ]; then \ @@ -237,9 +241,21 @@ fi; \ } +_parv_ON_LOCK_EXIT_SEQ= \ + status=$$?; \ + if [ $${status} -eq ${_parv_ON_LOCK_EXIT_STATUS} ]; then \ + ${_parv_KILL} -${_parv_KILL_SIGNAL} ${.MAKE.PID} && \ + ${_parv_PKILL} ${_parv_PKILL_FLAGS} $$$$; \ + else \ + exit $${status}; \ + fi + # End of Locking variables and tools section ##################################################### +check-lock: + @( pkg_name=${PKGNAME}; ${_parv_CHECK_LOCK} ) || { ${_parv_ON_LOCK_EXIT_SEQ}; } + do-lock: @${DO_NADA} Modified: soc2012/scher/par_ports/head/Mk/bsd.port.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.port.mk Tue May 29 21:59:09 2012 (r236690) +++ soc2012/scher/par_ports/head/Mk/bsd.port.mk Tue May 29 22:33:24 2012 (r236691) @@ -1530,19 +1530,17 @@ .if defined(_parv_WANT_PARALLEL_BUILD) || !defined(IGNORE_PATH_CHECKS) .BEGIN: . if defined(_parv_WANT_PARALLEL_BUILD) + @if [ ! -d ${LOCK_DIR} ]; then \ + ${_dparv_START_OUTPUT}; \ + ${ECHO_CMD} "Creating lock dir"; \ + ${_dparv_END_OUTPUT}; \ + ${MKDIR} ${LOCK_DIR}; \ + fi . if ${_parv_IS_DEFAULT_TARGET} . if defined(INSTALLS_DEPENDS) - @( ${_parv_.CURDIR_LOCK_LOOP} ) || { \ - status=$$?; \ - if [ $${status} -eq ${_parv_ON_LOCK_EXIT_STATUS} ]; then \ - ${_parv_KILL} -${_parv_KILL_SIGNAL} ${.MAKE.PID} && \ - ${_parv_PKILL} ${_parv_PKILL_FLAGS} $$$$; \ - else \ - exit $${status}; \ - fi; \ - } + @( ${_parv_LOCK_DIR_LOCK_LOOP} ) || { ${_parv_ON_LOCK_EXIT_SEQ}; } . else - @attempts=-1; ${_parv_.CURDIR_LOCK_LOOP} + @attempts=-1; ${_parv_LOCK_DIR_LOCK_LOOP} . endif . endif . endif @@ -1559,7 +1557,7 @@ .if defined(_parv_WANT_PARALLEL_BUILD) .END: . if ${_parv_IS_DEFAULT_TARGET} - @${_parv_.CURDIR_DO_UNLOCK} + @${_parv_LOCK_DIR_DO_UNLOCK} . endif .endif ############### END OF PAR_PORTS SPECIFIC COMMENT LINE ############### @@ -5167,9 +5165,9 @@ fi; \ fi; \ if [ ${_parv_WANT_PARALLEL_BUILD} ] && [ $${notfound} -eq 1 ]; then \ - ( ${_parv_CHECK_LOCK} ) || { \ + ( cd $${dir}; ${MAKE} check-lock ) || { \ status=$$?; \ - if [ $${status} -eq ${_parv_ON_LOCK_EXIT_STATUS} ]; then \ + if [ $${status} -eq ${_parv_MAKE_LOCK_EXIT_STATUS} ]; then \ ( ${_parv_PKG_DBDIR_DO_UNLOCK} ); \ ${ECHO_CMD} $${prog} may be installing now.; \ sleep 2; \ @@ -5232,9 +5230,9 @@ notfound=1; \ fi; \ if [ ${_parv_WANT_PARALLEL_BUILD} ] && [ $${notfound} -eq 1 ]; then \ - ( ${_parv_CHECK_LOCK} ) || { \ + ( cd $${dir}; ${MAKE} check-lock ) || { \ status=$$?; \ - if [ $${status} -eq ${_parv_ON_LOCK_EXIT_STATUS} ]; then \ + if [ $${status} -eq ${_parv_MAKE_LOCK_EXIT_STATUS} ]; then \ ( ${_parv_PKG_DBDIR_DO_UNLOCK} ); \ ${ECHO_CMD} $${prog} may be installing now.; \ sleep 2; \ From gpf at FreeBSD.org Wed May 30 12:26:32 2012 From: gpf at FreeBSD.org (gpf@FreeBSD.org) Date: Wed May 30 12:26:38 2012 Subject: socsvn commit: r236735 - in soc2012/gpf/pefs_kmod: sbin/pefs sys/fs/pefs Message-ID: <20120530122630.59184106564A@hub.freebsd.org> Author: gpf Date: Wed May 30 12:26:29 2012 New Revision: 236735 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236735 Log: -update XXX markers -axe the pefs_addchecklist command and all associated code -some code refactoring -fix endianess bug with exported name checksum value from kernel by ioctl() 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 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 Wed May 30 11:48:57 2012 (r236734) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Wed May 30 12:26:29 2012 (r236735) @@ -52,7 +52,7 @@ #include "pefs_ctl.h" -//#define PEFS_INTEGRITY_DEBUG +#define PEFS_INTEGRITY_DEBUG #if defined (PEFS_INTEGRITY_DEBUG) #define dprintf(a) printf a #else @@ -84,7 +84,7 @@ TAILQ_ENTRY(checksum) checksum_entries; }; -/* XXXgpf: [TODO] turns offsets to 64bits uints (or off_t?) */ +/* XXXgpf: [TODO] turns offsets to uint64_t? */ struct file_header { uint32_t nhashes; uint64_t file_id; @@ -359,8 +359,9 @@ pefs_get_file_id(struct file_header *fhp) { char parent_dir[MAXPATHLEN]; - struct pefs_namemac namemac; + struct pefs_xnamecsum xncs; char *pch; + uint64_t temp; int error, fd; /* feed parent directory to ioctl() */ @@ -380,13 +381,16 @@ pch = strrchr(fhp->path, '/'); pch++; - strlcpy(namemac.pnm_filename, pch, sizeof(namemac.pnm_filename)); - namemac.pnm_namelen = strnlen(namemac.pnm_filename, sizeof(namemac.pnm_filename)); + strlcpy(xncs.pxnc_filename, pch, sizeof(xncs.pxnc_filename)); + xncs.pxnc_namelen = strnlen(xncs.pxnc_filename, sizeof(xncs.pxnc_filename)); - error = ioctl(fd, PEFS_GETNAMEMAC, &namemac); + error = ioctl(fd, PEFS_GETNAMECSUM, &xncs); - if (error == 0) - fhp->file_id = namemac.pnm_csum; + if (error == 0) { + /* XXXgpf: Is this correct? */ + memcpy(&temp, xncs.pxnc_csum, sizeof(xncs.pxnc_csum)); + fhp->file_id = be64toh(temp); + } else pefs_warn("failed to fetch file id from kernel"); @@ -645,7 +649,8 @@ * All data member writes are done separately so as to avoid alignment problems. * Writes are always in little endian byte order. * - * XXXgpf: [TODO] more comments about internal structure of file. + * XXXgpf: [TODO] more comments about internal structure of file. This should probably + * be done after design crystalizes (cuckoo hashing? embed? etc). */ static int pefs_write_checksum_file(int fdout, struct checksum_file_header *cfhp, struct hash_table *chtp) @@ -749,7 +754,9 @@ } /* - * XXXgpf: [TODO] proper comment header, I am sleepy Z_Z + * An in memory database is created from entries in fpin. This database is later written + * to file ".pefs.checksum" which is created under csm_path. algo is used as a cryptographic + * hash function that produces checksums for 4k blocks of each file. */ int pefs_create_checksum_file(FILE *fpin, char *fsroot, char *csm_path, const char *algo) @@ -794,159 +801,3 @@ 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; - - error = 0; - - 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) - goto out; - - error = pefs_get_enc_path(fhp, fsroot, fromfsroot); - if (error != 0) - goto out; - - error = pefs_write_to_checklist(fdout, fhp); - if (error != 0) - goto out; - - free(fhp); - } - -out: - if (fhp != NULL) - free(fhp); - - return (error); -} Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Wed May 30 11:48:57 2012 (r236734) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Wed May 30 12:26:29 2012 (r236735) @@ -76,7 +76,6 @@ 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, @@ -104,7 +103,6 @@ { "showchains", pefs_showchains }, { "showalgs", pefs_showalgs }, { "addchecksum", pefs_addchecksum}, - { "addchecklist", pefs_addchecklist}, { NULL, NULL }, }; @@ -146,16 +144,6 @@ 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) { @@ -1115,102 +1103,6 @@ return (error); } -/* - * 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 - * - * $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) { @@ -1237,7 +1129,6 @@ " pefs showchains [-fp] [-i iterations] [-k keyfile] filesystem\n" " pefs showalgs\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 Wed May 30 11:48:57 2012 (r236734) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.h Wed May 30 12:26:29 2012 (r236735) @@ -95,7 +95,6 @@ const struct pefs_xkey *xk_parent); uintmax_t pefs_keyid_as_int(char *keyid); 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); 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 30 11:48:57 2012 (r236734) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_subr.c Wed May 30 12:26:29 2012 (r236735) @@ -74,33 +74,3 @@ 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); -} Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h ============================================================================== --- soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h Wed May 30 11:48:57 2012 (r236734) +++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h Wed May 30 12:26:29 2012 (r236735) @@ -48,17 +48,11 @@ 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 { - uint64_t pnm_csum; - uint32_t pnm_namelen; +struct pefs_xnamecsum { + uint32_t pxnc_namelen; + char pxnc_csum[PEFS_NAME_CSUM_SIZE]; /* XXXgpf: should probably be MAXNAMLEN */ - char pnm_filename[MAXPATHLEN]; + char pxnc_filename[MAXPATHLEN]; }; struct pefs_xsector_ctext { @@ -74,7 +68,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_GETNAMEMAC _IOWR('p', 6, struct pefs_namemac) +#define PEFS_GETNAMECSUM _IOWR('p', 6, struct pefs_xnamecsum) #define PEFS_GETSECTORCTEXT _IOWR('p', 7, struct pefs_xsector_ctext) #endif Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c ============================================================================== --- soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Wed May 30 11:48:57 2012 (r236734) +++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Wed May 30 12:26:29 2012 (r236735) @@ -2362,7 +2362,7 @@ struct vnode *vp = ap->a_vp; struct vnode *lvp = PEFS_LOWERVP(vp); struct pefs_xkey *xk = ap->a_data; - struct pefs_namemac *namemac = ap->a_data; + struct pefs_xnamecsum *xncs = ap->a_data; struct pefs_xsector_ctext *xsct = ap->a_data; struct ucred *cred = ap->a_cred; struct thread *td = ap->a_td; @@ -2520,7 +2520,7 @@ pefs_chunk_free(&pc, pn); VOP_UNLOCK(vp, 0); break; - case PEFS_GETNAMEMAC: + case PEFS_GETNAMECSUM: vn_lock(vp, LK_EXCLUSIVE); /* XXXgpf: should I change printf to something else? e.g. PEFSDEBUG */ if (vp->v_type != VDIR) { @@ -2529,14 +2529,14 @@ return (EINVAL); } - if (strnlen(namemac->pnm_filename, sizeof(namemac->pnm_filename)) != - namemac->pnm_namelen) { - printf("pefs_ioctl: PEFS_GETNAMEMAC incorrect pnm_namelen %d\n", namemac->pnm_namelen); + if (strnlen(xncs->pxnc_filename, sizeof(xncs->pxnc_filename)) != + xncs->pxnc_namelen) { + printf("pefs_ioctl: PEFS_GETNAMEMAC incorrect pnm_namelen %d\n", xncs->pxnc_namelen); VOP_UNLOCK(vp, 0); return (EINVAL); } - if (strchr(namemac->pnm_filename, '/') != NULL) { + if (strchr(xncs->pxnc_filename, '/') != NULL) { printf("pefs_ioctl: PEFS_GETNAMEMAC pnm_filename contains '/'\n"); VOP_UNLOCK(vp, 0); return (EINVAL); @@ -2549,9 +2549,10 @@ cn.cn_cred = cred; cn.cn_lkflags = 0; cn.cn_flags = 0; - cn.cn_nameptr = namemac->pnm_filename; - cn.cn_namelen = namemac->pnm_namelen; + cn.cn_nameptr = xncs->pxnc_filename; + cn.cn_namelen = xncs->pxnc_namelen; + /* XXXgpf: does this lookup rely solely on present cache data? */ error = pefs_enccn_lookup(&enccn, vp, &cn); VOP_UNLOCK(vp, 0); @@ -2572,12 +2573,8 @@ r = pefs_name_pton(enc, enc_len, buf, buf_len); if (r <= 0) error = EINVAL; - /* - * XXXgpf: [TODO] endianess!! Change int64_t to char[8] - * and deal with endianess at user-space - */ else - memcpy(&(namemac->pnm_csum), buf, PEFS_NAME_CSUM_SIZE); + memcpy(xncs->pxnc_csum, buf, sizeof(xncs->pxnc_csum)); pefs_enccn_free(&enccn); free(buf, M_TEMP); From scher at FreeBSD.org Wed May 30 19:05:00 2012 From: scher at FreeBSD.org (scher@FreeBSD.org) Date: Wed May 30 19:05:12 2012 Subject: socsvn commit: r236758 - soc2012/scher/par_ports/head/Mk Message-ID: <20120530190458.9DC3C1065672@hub.freebsd.org> Author: scher Date: Wed May 30 19:04:58 2012 New Revision: 236758 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236758 Log: [bugfix] ":=" Type of MAkefile variable expansion leads to wrong results of "$$(...)" command. [new_feature] seal breakpoint targets for debbuging purpose Submitted by: Alexander Pronin 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 30 18:05:48 2012 (r236757) +++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Wed May 30 19:04:58 2012 (r236758) @@ -27,6 +27,11 @@ ${ECHO_CMD} Press any key when you are ready to continue; \ read non_existed_var +seal: + @echo " <<<<<< ===== WE ARE HERE ===== >>>>>>" +breakpoint: + @${_dparv_DEBUGGING_BREAKPOINT} + # Delay for feedback message if the directory is locked. # Just not to annoy a user with feedback message on e