From owner-svn-soc-all@FreeBSD.ORG Sun Jun 24 17:15:52 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id A328C1065678 for ; Sun, 24 Jun 2012 17:15:50 +0000 (UTC) (envelope-from tzabal@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sun, 24 Jun 2012 17:15:50 +0000 Date: Sun, 24 Jun 2012 17:15:50 +0000 From: tzabal@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120624171550.A328C1065678@hub.freebsd.org> Cc: Subject: socsvn commit: r238239 - soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jun 2012 17:15:52 -0000 Author: tzabal Date: Sun Jun 24 17:15:50 2012 New Revision: 238239 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238239 Log: Change the directory that reports arrive in the server from /home/reporter to /var/spool/crashreports 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 Sun Jun 24 16:56:48 2012 (r238238) +++ soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh Sun Jun 24 17:15:50 2012 (r238239) @@ -155,7 +155,8 @@ ## Send the report to the Central Collector machine user="reporter" -hostname="akcrs.dyndns.org" +host="akcrs.dyndns.org" +file="/var/spool/crashreports" # Host public key host_public_key_file=`mktemp /tmp/crashreport.XXXXXX` @@ -194,7 +195,7 @@ -----END RSA PRIVATE KEY-----" > ${user_private_key_file} scp -o GlobalKnownHostsFile="${host_public_key_file}" -o BatchMode=yes \ - -i "${user_private_key_file}" -q "${report}" "${user}@${hostname}:" + -i "${user_private_key_file}" -q "${report}" "${user}@${host}:${file}" if [ $? -ne 0 ]; then error 'An error occurred while sending the report.' From owner-svn-soc-all@FreeBSD.ORG Mon Jun 25 08:16:43 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 97F301065680 for ; Mon, 25 Jun 2012 08:16:41 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 25 Jun 2012 08:16:41 +0000 Date: Mon, 25 Jun 2012 08:16:41 +0000 From: rudot@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120625081641.97F301065680@hub.freebsd.org> Cc: Subject: socsvn commit: r238261 - soc2012/rudot/aux/config X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 08:16:43 -0000 Author: rudot Date: Mon Jun 25 08:16:41 2012 New Revision: 238261 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238261 Log: config saved Modified: soc2012/rudot/aux/config/RCTL Modified: soc2012/rudot/aux/config/RCTL ============================================================================== --- soc2012/rudot/aux/config/RCTL Mon Jun 25 07:56:23 2012 (r238260) +++ soc2012/rudot/aux/config/RCTL Mon Jun 25 08:16:41 2012 (r238261) @@ -53,6 +53,14 @@ options RACCT options RCTL +# KTR +options KTR +options KTR_ENTRIES=131072 + +# WITNESS +options WITNESS +options WITNESS_KDB + # To make an SMP kernel, the next two lines are needed options SMP # Symmetric MultiProcessor Kernel device apic # I/O APIC From owner-svn-soc-all@FreeBSD.ORG Mon Jun 25 08:42:55 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 81D051065675 for ; Mon, 25 Jun 2012 08:42:53 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 25 Jun 2012 08:42:53 +0000 Date: Mon, 25 Jun 2012 08:42:53 +0000 From: rudot@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120625084253.81D051065675@hub.freebsd.org> Cc: Subject: socsvn commit: r238262 - soc2012/rudot/sys/kern X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 08:42:55 -0000 Author: rudot Date: Mon Jun 25 08:42:52 2012 New Revision: 238262 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238262 Log: synchronizing with head Modified: soc2012/rudot/sys/kern/kern_racct.c soc2012/rudot/sys/kern/sched_4bsd.c Modified: soc2012/rudot/sys/kern/kern_racct.c ============================================================================== --- soc2012/rudot/sys/kern/kern_racct.c Mon Jun 25 08:16:41 2012 (r238261) +++ soc2012/rudot/sys/kern/kern_racct.c Mon Jun 25 08:42:52 2012 (r238262) @@ -26,11 +26,11 @@ * 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 $ + * $FreeBSD: src/sys/kern/kern_racct.c,v 1.18 2012/05/22 15:58:27 trasz Exp $ */ #include -__FBSDID("$FreeBSD: src/sys/kern/kern_racct.c,v 1.17 2012/04/17 14:31:02 trasz Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/kern_racct.c,v 1.18 2012/05/22 15:58:27 trasz Exp $"); #include "opt_kdtrace.h" @@ -774,6 +774,9 @@ PROC_UNLOCK(child); PROC_UNLOCK(parent); + if (error != 0) + racct_proc_exit(child); + return (error); } Modified: soc2012/rudot/sys/kern/sched_4bsd.c ============================================================================== --- soc2012/rudot/sys/kern/sched_4bsd.c Mon Jun 25 08:16:41 2012 (r238261) +++ soc2012/rudot/sys/kern/sched_4bsd.c Mon Jun 25 08:42:52 2012 (r238262) @@ -33,7 +33,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/kern/sched_4bsd.c,v 1.161 2012/03/08 19:41:05 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/kern/sched_4bsd.c,v 1.163 2012/05/15 10:58:17 pluknet Exp $"); #include "opt_hwpmc_hooks.h" #include "opt_sched.h" @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include @@ -248,12 +249,31 @@ "allow threads to share a quantum"); #endif +SDT_PROVIDER_DEFINE(sched); + +SDT_PROBE_DEFINE3(sched, , , change_pri, change-pri, "struct thread *", + "struct proc *", "uint8_t"); +SDT_PROBE_DEFINE3(sched, , , dequeue, dequeue, "struct thread *", + "struct proc *", "void *"); +SDT_PROBE_DEFINE4(sched, , , enqueue, enqueue, "struct thread *", + "struct proc *", "void *", "int"); +SDT_PROBE_DEFINE4(sched, , , lend_pri, lend-pri, "struct thread *", + "struct proc *", "uint8_t", "struct thread *"); +SDT_PROBE_DEFINE2(sched, , , load_change, load-change, "int", "int"); +SDT_PROBE_DEFINE2(sched, , , off_cpu, off-cpu, "struct thread *", + "struct proc *"); +SDT_PROBE_DEFINE(sched, , , on_cpu, on-cpu); +SDT_PROBE_DEFINE(sched, , , remain_cpu, remain-cpu); +SDT_PROBE_DEFINE2(sched, , , surrender, surrender, "struct thread *", + "struct proc *"); + static __inline void sched_load_add(void) { sched_tdcnt++; KTR_COUNTER0(KTR_SCHED, "load", "global load", sched_tdcnt); + SDT_PROBE2(sched, , , load_change, NOCPU, sched_tdcnt); } static __inline void @@ -262,6 +282,7 @@ sched_tdcnt--; KTR_COUNTER0(KTR_SCHED, "load", "global load", sched_tdcnt); + SDT_PROBE2(sched, , , load_change, NOCPU, sched_tdcnt); } /* * Arrange to reschedule if necessary, taking the priorities and @@ -799,10 +820,13 @@ 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)); + SDT_PROBE3(sched, , , change_pri, td, td->td_proc, prio); 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)); + SDT_PROBE4(sched, , , lend_pri, td, td->td_proc, prio, + curthread); } THREAD_LOCK_ASSERT(td, MA_OWNED); if (td->td_priority == prio) @@ -991,6 +1015,9 @@ if (PMC_PROC_IS_USING_PMCS(td->td_proc)) PMC_SWITCH_CONTEXT(td, PMC_FN_CSW_OUT); #endif + + SDT_PROBE2(sched, , , off_cpu, td, td->td_proc); + /* I feel sleepy */ lock_profile_release_lock(&sched_lock.lock_object); #ifdef KDTRACE_HOOKS @@ -1022,11 +1049,14 @@ * needed to, or the thread_wait() or wait() will * need to reap it. */ + + SDT_PROBE0(sched, , , on_cpu); #ifdef HWPMC_HOOKS if (PMC_PROC_IS_USING_PMCS(td->td_proc)) PMC_SWITCH_CONTEXT(td, PMC_FN_CSW_IN); #endif - } + } else + SDT_PROBE0(sched, , , remain_cpu); #ifdef SMP if (td->td_flags & TDF_IDLETD) @@ -1227,6 +1257,8 @@ sched_tdname(curthread)); KTR_POINT1(KTR_SCHED, "thread", sched_tdname(curthread), "wokeup", KTR_ATTR_LINKED, sched_tdname(td)); + SDT_PROBE4(sched, , , enqueue, td, td->td_proc, NULL, + flags & SRQ_PREEMPTED); #ifdef RACCT /* @@ -1330,6 +1362,8 @@ sched_tdname(curthread)); KTR_POINT1(KTR_SCHED, "thread", sched_tdname(curthread), "wokeup", KTR_ATTR_LINKED, sched_tdname(td)); + SDT_PROBE4(sched, , , enqueue, td, td->td_proc, NULL, + flags & SRQ_PREEMPTED); /* * Now that the thread is moving to the run-queue, set the lock @@ -1377,6 +1411,7 @@ KTR_STATE2(KTR_SCHED, "thread", sched_tdname(td), "runq rem", "prio:%d", td->td_priority, KTR_ATTR_LINKED, sched_tdname(curthread)); + SDT_PROBE3(sched, , , dequeue, td, td->td_proc, NULL); if ((td->td_flags & TDF_NOLOAD) == 0) sched_load_rem(); @@ -1440,6 +1475,8 @@ void sched_preempt(struct thread *td) { + + SDT_PROBE2(sched, , , surrender, td, td->td_proc); thread_lock(td); if (td->td_critnest > 1) td->td_owepreempt = 1; From owner-svn-soc-all@FreeBSD.ORG Mon Jun 25 14:53:21 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 73B3D1065677 for ; Mon, 25 Jun 2012 14:53:19 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 25 Jun 2012 14:53:19 +0000 Date: Mon, 25 Jun 2012 14:53:19 +0000 From: gpf@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120625145319.73B3D1065677@hub.freebsd.org> Cc: Subject: socsvn commit: r238269 - in soc2012/gpf/pefs_kmod/sys: fs/pefs modules/pefs X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 14:53:21 -0000 Author: gpf Date: Mon Jun 25 14:53:18 2012 New Revision: 238269 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238269 Log: - move checksum code in checksum.c and a few minor changes Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.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/modules/pefs/Makefile Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h ============================================================================== --- soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h Mon Jun 25 12:30:51 2012 (r238268) +++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h Mon Jun 25 14:53:18 2012 (r238269) @@ -118,28 +118,6 @@ char ptk_tweak[PEFS_TWEAK_SIZE]; }; -/* XXXgpf: fill this in */ -#define PEFS_FILE_CHECKSUM ".pefs.checksum" -#define PEFS_CFH_SIZE 16 -#define PEFS_HT_CELL_SIZE 16 - -struct pefs_checksum_index_entry { - uint32_t pcie_nhashes; - uint32_t pcie_offset; - uint64_t pcie_file_id; -}; - -struct pefs_checksum { - uint8_t pcs_version; - uint8_t pcs_reserved; - uint8_t pcs_hash_len; - uint8_t pcs_hash_algo[8]; - uint8_t pcs_offset_to_hash_table; - uint32_t pcs_hash_table_size; - char *pcs_table1, *pcs_table2; - struct vnode *pcs_checksumvp; -}; - #define PN_HASKEY 0x000001 #define PN_WANTRECYCLE 0x000100 #define PN_LOCKBUF_SMALL 0x001000 @@ -155,7 +133,7 @@ void *pn_buf_large; int pn_flags; struct pefs_tkey pn_tkey; - void *pn_checksum_index_entry; + char *pn_checksum_index_entry; }; #define PM_ROOT_CANRECURSE 0x01 @@ -163,6 +141,17 @@ #define PM_ASYNCRECLAIM 0x04 #define PM_CHECKSUM 0x08 +struct pefs_checksum { + uint8_t pcs_version; + uint8_t pcs_reserved; + uint8_t pcs_hash_len; + uint8_t pcs_hash_algo[8]; + uint8_t pcs_offset_to_hash_table; + uint32_t pcs_hash_table_size; + char *pcs_table1, *pcs_table2; + struct vnode *pcs_checksumvp; +}; + struct pefs_mount { struct mount *pm_lowervfs; struct vnode *pm_rootvp; Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_subr.c ============================================================================== --- soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_subr.c Mon Jun 25 12:30:51 2012 (r238268) +++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_subr.c Mon Jun 25 14:53:18 2012 (r238269) @@ -400,6 +400,7 @@ PEFSDEBUG("pefs_node_get: creating node without key: %p\n", pn); pn->pn_vnode = vp; + pn->pn_checksum_index_entry = NULL; vp->v_type = lvp->v_type; vp->v_data = pn; vp->v_vnlock = lvp->v_vnlock; Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vfsops.c ============================================================================== --- soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vfsops.c Mon Jun 25 12:30:51 2012 (r238268) +++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vfsops.c Mon Jun 25 14:53:18 2012 (r238269) @@ -47,6 +47,7 @@ #include #include +#include struct pefs_opt_descr { char *fs; Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c ============================================================================== --- soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Mon Jun 25 12:30:51 2012 (r238268) +++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Mon Jun 25 14:53:18 2012 (r238269) @@ -56,8 +56,6 @@ #include #include #include -#include -#include #include #include #include @@ -66,6 +64,7 @@ #include #include +#include #include #define DIRENT_MINSIZE (sizeof(struct dirent) - (MAXNAMLEN + 1)) @@ -472,101 +471,9 @@ return (0); } -/* - * XXXgpf: [TODO] move most, if not all, of the checksum code to a different .c - */ -static uint32_t -pefs_checksum_hash1(struct pefs_checksum *pc, struct pefs_checksum_index_entry *pcie) -{ - uint32_t nbucket; - - nbucket = pcie->pcie_file_id % pc->pcs_hash_table_size; - printf("hash1: goto bucket %d\n", nbucket); - return (nbucket); -} - -static uint32_t -pefs_checksum_hash2(struct pefs_checksum *pc, struct pefs_checksum_index_entry *pcie) -{ - uint32_t nbucket; - - nbucket = fnv_64_buf(&(pcie->pcie_file_id), sizeof(pcie->pcie_file_id), FNV1_64_INIT) - % pc->pcs_hash_table_size; - printf("hash2: goto bucket %d\n", nbucket); - - return (nbucket); -} - -static void -pefs_checksum_index_lookup(struct pefs_checksum_index_entry *pcie, struct vnode *vp) -{ - struct pefs_checksum_index_entry target_pcie; - struct pefs_mount *pm = VFS_TO_PEFS(vp->v_mount); - struct pefs_checksum *pcs = &(pm->pm_checksum); - struct pefs_node *pn = VP_TO_PN(vp); - char *start, *p; - uint32_t pos; - - pos = pefs_checksum_hash1(pcs, pcie); - start = &(pcs->pcs_table1[pos * PEFS_HT_CELL_SIZE]); - p = start; - - memcpy(&(target_pcie.pcie_nhashes), p, sizeof(target_pcie.pcie_nhashes)); - target_pcie.pcie_nhashes = le32toh(target_pcie.pcie_nhashes); - if (target_pcie.pcie_nhashes != 0) { - p+=sizeof(target_pcie.pcie_nhashes); - - memcpy(&(target_pcie.pcie_offset), p, sizeof(target_pcie.pcie_offset)); - target_pcie.pcie_offset = le32toh(target_pcie.pcie_offset); - p+=sizeof(target_pcie.pcie_offset); - - memcpy(&(target_pcie.pcie_file_id), p, sizeof(target_pcie.pcie_file_id)); - target_pcie.pcie_file_id = le64toh(target_pcie.pcie_file_id); - printf("cell %d:\n", pos); - printf("\thashes = %d\n\toffset = %d\n\tfile id = %llu\n", - target_pcie.pcie_nhashes, target_pcie.pcie_offset, target_pcie.pcie_file_id); - - if (target_pcie.pcie_file_id == pcie->pcie_file_id) { - pn->pn_checksum_index_entry = start; - printf("checksum lookup: found1!\n"); - return; - } - } - - pos = pefs_checksum_hash2(pcs, pcie); - start = &(pcs->pcs_table2[pos * PEFS_HT_CELL_SIZE]); - p = start; - - memcpy(&(target_pcie.pcie_nhashes), p, sizeof(target_pcie.pcie_nhashes)); - target_pcie.pcie_nhashes = le32toh(target_pcie.pcie_nhashes); - if (target_pcie.pcie_nhashes != 0) { - p+=sizeof(target_pcie.pcie_nhashes); - - memcpy(&(target_pcie.pcie_offset), p, sizeof(target_pcie.pcie_offset)); - target_pcie.pcie_offset = le32toh(target_pcie.pcie_offset); - p+=sizeof(target_pcie.pcie_offset); - - memcpy(&(target_pcie.pcie_file_id), p, sizeof(target_pcie.pcie_file_id)); - target_pcie.pcie_file_id = le64toh(target_pcie.pcie_file_id); - printf("cell %d:\n", pos); - printf("\thashes = %d\n\toffset = %d\n\tfile id = %llu\n", - target_pcie.pcie_nhashes, target_pcie.pcie_offset, target_pcie.pcie_file_id); - - if (target_pcie.pcie_file_id == pcie->pcie_file_id) { - pn->pn_checksum_index_entry = start; - printf("checksum lookup: found2!\n"); - return; - } - } - - printf("checksum lookup: not found!\n"); - pn->pn_checksum_index_entry = NULL; -} - static int pefs_lookup(struct vop_cachedlookup_args *ap) { - struct pefs_checksum_index_entry pcie; struct componentname *cnp = ap->a_cnp; struct pefs_mount *pm; struct vnode *vp = NULL; @@ -576,10 +483,8 @@ struct pefs_enccn enccn; struct pefs_node *dpn = VP_TO_PN(dvp); uint64_t flags = cnp->cn_flags; - char *enc_name, *buf; int nokey_lookup, skip_lookup; - int error, r; - size_t enc_name_len, buf_len; + int error; printf("pefs_lookup: op=%lx, name=%.*s\n", cnp->cn_nameiop, (int)cnp->cn_namelen, cnp->cn_nameptr); @@ -654,52 +559,19 @@ else error = pefs_node_get_haskey(dvp->v_mount, lvp, &vp, &enccn.pec_tkey); - if (error != 0) { vput(lvp); } else { pm = VFS_TO_PEFS(vp->v_mount); - if ((pm->pm_flags & PM_CHECKSUM) != 0 && cnp->cn_nameiop == LOOKUP && - (vp->v_type == VREG || vp->v_type == VLNK)) { - printf("gpf: checksum code @ lookup\n"); + if ((pm->pm_flags & PM_CHECKSUM) != 0) { if (nokey_lookup) { printf("cnp name=%.*s\n",(int)cnp->cn_namelen, cnp->cn_nameptr); - enc_name = cnp->cn_nameptr; - enc_name_len = cnp->cn_namelen; + pefs_checksum_lookup(cnp->cn_nameptr, cnp->cn_namelen, cnp, vp); } else { printf("enccnp name=%.*s\n",(int)enccn.pec_cn.cn_namelen, enccn.pec_cn.cn_nameptr); - enc_name = enccn.pec_cn.cn_nameptr; - enc_name_len = enccn.pec_cn.cn_namelen; + pefs_checksum_lookup(enccn.pec_cn.cn_nameptr, enccn.pec_cn.cn_namelen, cnp, vp); } - - /* XXXgpf: What if user wants integrity checking for .pefs.db or .conf? */ - /* XXXgpf: [TODO] move this check to a mini function */ - if (strncmp(enc_name, ".pefs.db", enc_name_len) != 0 && - strncmp(enc_name, ".pefs.conf", enc_name_len) != 0 && - strncmp(enc_name, ".pefs.checksum", enc_name_len) != 0) - { - enc_name++; - enc_name_len--; - buf_len = MAXNAMLEN + 1; - buf = malloc(buf_len, M_TEMP, M_WAITOK); - - r = pefs_name_pton(enc_name, enc_name_len, buf, buf_len); - if (r <= 0) { - /* XXXgpf: I sincerely doubt an error can occur here */ - error = EINVAL; - printf("name_pton error: %d\n", error); - } - else { - memcpy(&(pcie.pcie_file_id), buf, sizeof(pcie.pcie_file_id)); - pcie.pcie_file_id = be64toh(pcie.pcie_file_id); - printf("id to lookup: %llu\n", pcie.pcie_file_id); - pefs_checksum_index_lookup(&pcie, vp); - } - - free(buf, M_TEMP); - } - } *ap->a_vpp = vp; if ((cnp->cn_flags & MAKEENTRY) && Modified: soc2012/gpf/pefs_kmod/sys/modules/pefs/Makefile ============================================================================== --- soc2012/gpf/pefs_kmod/sys/modules/pefs/Makefile Mon Jun 25 12:30:51 2012 (r238268) +++ soc2012/gpf/pefs_kmod/sys/modules/pefs/Makefile Mon Jun 25 14:53:18 2012 (r238269) @@ -6,7 +6,8 @@ SRCS= vnode_if.h \ pefs_subr.c pefs_vfsops.c pefs_vnops.c pefs_xbase64.c pefs_crypto.c \ pefs_dircache.c \ - pefs_xts.c vmac.c + pefs_xts.c vmac.c \ + pefs_checksum.c .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" SRCS+= pefs_aesni.c From owner-svn-soc-all@FreeBSD.ORG Mon Jun 25 15:53:20 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 046A71065673 for ; Mon, 25 Jun 2012 15:53:19 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 25 Jun 2012 15:53:18 +0000 Date: Mon, 25 Jun 2012 15:53:18 +0000 From: gpf@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120625155319.046A71065673@hub.freebsd.org> Cc: Subject: socsvn commit: r238270 - soc2012/gpf/pefs_kmod/sys/fs/pefs X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 15:53:20 -0000 Author: gpf Date: Mon Jun 25 15:53:17 2012 New Revision: 238270 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238270 Log: - adding sys/fs/pefs_checksum.c & .h Added: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_checksum.c soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_checksum.h Added: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_checksum.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_checksum.c Mon Jun 25 15:53:17 2012 (r238270) @@ -0,0 +1,172 @@ +/*- + * 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. + * + * $FreeBSD$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +static uint32_t +pefs_checksum_hash1(struct pefs_checksum *pc, struct pefs_checksum_index_entry *pcie) +{ + uint32_t nbucket; + + nbucket = pcie->pcie_file_id % pc->pcs_hash_table_size; + printf("hash1: goto bucket %d\n", nbucket); + return (nbucket); +} + +static uint32_t +pefs_checksum_hash2(struct pefs_checksum *pc, struct pefs_checksum_index_entry *pcie) +{ + uint32_t nbucket; + + nbucket = fnv_64_buf(&(pcie->pcie_file_id), sizeof(pcie->pcie_file_id), FNV1_64_INIT) + % pc->pcs_hash_table_size; + printf("hash2: goto bucket %d\n", nbucket); + + return (nbucket); +} + +static void +pefs_checksum_index_lookup(struct pefs_checksum_index_entry *pcie, struct vnode *vp) +{ + struct pefs_checksum_index_entry target_pcie; + struct pefs_mount *pm = VFS_TO_PEFS(vp->v_mount); + struct pefs_checksum *pcs = &(pm->pm_checksum); + struct pefs_node *pn = VP_TO_PN(vp); + char *start, *p; + uint32_t pos; + + pos = pefs_checksum_hash1(pcs, pcie); + start = &(pcs->pcs_table1[pos * PEFS_HT_CELL_SIZE]); + p = start; + + memcpy(&(target_pcie.pcie_nhashes), p, sizeof(target_pcie.pcie_nhashes)); + target_pcie.pcie_nhashes = le32toh(target_pcie.pcie_nhashes); + if (target_pcie.pcie_nhashes != 0) { + p+=sizeof(target_pcie.pcie_nhashes); + + memcpy(&(target_pcie.pcie_offset), p, sizeof(target_pcie.pcie_offset)); + target_pcie.pcie_offset = le32toh(target_pcie.pcie_offset); + p+=sizeof(target_pcie.pcie_offset); + + memcpy(&(target_pcie.pcie_file_id), p, sizeof(target_pcie.pcie_file_id)); + target_pcie.pcie_file_id = le64toh(target_pcie.pcie_file_id); + printf("cell %d:\n", pos); + printf("\thashes = %d\n\toffset = %d\n\tfile id = %llu\n", + target_pcie.pcie_nhashes, target_pcie.pcie_offset, target_pcie.pcie_file_id); + + if (target_pcie.pcie_file_id == pcie->pcie_file_id) { + pn->pn_checksum_index_entry = start; + printf("checksum lookup: found1!\n"); + return; + } + } + + pos = pefs_checksum_hash2(pcs, pcie); + start = &(pcs->pcs_table2[pos * PEFS_HT_CELL_SIZE]); + p = start; + + memcpy(&(target_pcie.pcie_nhashes), p, sizeof(target_pcie.pcie_nhashes)); + target_pcie.pcie_nhashes = le32toh(target_pcie.pcie_nhashes); + if (target_pcie.pcie_nhashes != 0) { + p+=sizeof(target_pcie.pcie_nhashes); + + memcpy(&(target_pcie.pcie_offset), p, sizeof(target_pcie.pcie_offset)); + target_pcie.pcie_offset = le32toh(target_pcie.pcie_offset); + p+=sizeof(target_pcie.pcie_offset); + + memcpy(&(target_pcie.pcie_file_id), p, sizeof(target_pcie.pcie_file_id)); + target_pcie.pcie_file_id = le64toh(target_pcie.pcie_file_id); + printf("cell %d:\n", pos); + printf("\thashes = %d\n\toffset = %d\n\tfile id = %llu\n", + target_pcie.pcie_nhashes, target_pcie.pcie_offset, target_pcie.pcie_file_id); + + if (target_pcie.pcie_file_id == pcie->pcie_file_id) { + pn->pn_checksum_index_entry = start; + printf("checksum lookup: found2!\n"); + return; + } + } + + pn->pn_checksum_index_entry = NULL; + printf("checksum lookup: not found!\n"); +} + +void +pefs_checksum_lookup(char *enc_name, size_t enc_name_len, struct componentname *cnp, struct vnode *vp) +{ + struct pefs_checksum_index_entry pcie; + char *buf; + size_t buf_len; + int error, r; + + printf("gpf: checksum code @ lookup\n"); + if (cnp->cn_nameiop != LOOKUP || (vp->v_type != VREG && vp->v_type != VLNK)) + return; + + /* XXXgpf: What if user wants integrity checking for .pefs.db or .conf? */ + /* XXXgpf: [TODO] move this check to a mini function */ + if (strncmp(enc_name, ".pefs.db", enc_name_len) == 0 || + strncmp(enc_name, ".pefs.conf", enc_name_len) == 0 || + strncmp(enc_name, ".pefs.checksum", enc_name_len) == 0) + return; + + enc_name++; + enc_name_len--; + buf_len = MAXNAMLEN + 1; + buf = malloc(buf_len, M_TEMP, M_WAITOK); + + r = pefs_name_pton(enc_name, enc_name_len, buf, buf_len); + if (r <= 0) { + /* XXXgpf: I sincerely doubt an error can occur here */ + error = EINVAL; + printf("name_pton error: %d\n", error); + } + else { + memcpy(&(pcie.pcie_file_id), buf, sizeof(pcie.pcie_file_id)); + pcie.pcie_file_id = be64toh(pcie.pcie_file_id); + printf("id to lookup: %llu\n", pcie.pcie_file_id); + pefs_checksum_index_lookup(&pcie, vp); + } + + free(buf, M_TEMP); +} Added: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_checksum.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_checksum.h Mon Jun 25 15:53:17 2012 (r238270) @@ -0,0 +1,39 @@ +/*- + * 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. + * + * $FreeBSD$ + */ + +#define PEFS_FILE_CHECKSUM ".pefs.checksum" +#define PEFS_CFH_SIZE 16 /* file header of .pefs.checksum file */ +#define PEFS_HT_CELL_SIZE 16 /* hash table cell(bucket) size */ + +struct pefs_checksum_index_entry { + uint32_t pcie_nhashes; + uint32_t pcie_offset; + uint64_t pcie_file_id; +}; + +void pefs_checksum_lookup(char *enc_name, size_t enc_name_len, struct componentname *cnp, struct vnode *vp); From owner-svn-soc-all@FreeBSD.ORG Mon Jun 25 16:52:25 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 8C22D106566C for ; Mon, 25 Jun 2012 16:52:23 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 25 Jun 2012 16:52:23 +0000 Date: Mon, 25 Jun 2012 16:52:23 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120625165223.8C22D106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r238271 - in soc2012/jhagewood: diff diff/diff diff3 mdocml X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 16:52:25 -0000 Author: jhagewood Date: Mon Jun 25 16:52:22 2012 New Revision: 238271 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238271 Log: Modified: soc2012/jhagewood/diff/diff/diffreg.c soc2012/jhagewood/diff/hagewood-diff.patch soc2012/jhagewood/diff3/hagewood-diff3.patch soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch Modified: soc2012/jhagewood/diff/diff/diffreg.c ============================================================================== --- soc2012/jhagewood/diff/diff/diffreg.c Mon Jun 25 15:53:17 2012 (r238270) +++ soc2012/jhagewood/diff/diff/diffreg.c Mon Jun 25 16:52:22 2012 (r238271) @@ -1176,7 +1176,7 @@ if (format == D_NORMAL || format == D_IFDEF) { fetch(ixold, a, b, f1, '<', 1); if (a <= b && c <= d && format == D_NORMAL) - printf("---"); + printf("---\n"); } i = fetch(ixnew, c, d, f2, format == D_NORMAL ? '>' : '\0', 0); if (i != 0 && format == D_EDIT) { @@ -1345,7 +1345,7 @@ } static int -textfile(FILE *f) +istextfile(FILE *f) { char buf[BUFSIZ]; int i, cnt; @@ -1354,8 +1354,9 @@ return (1); rewind(f); cnt = fread(buf, 1, sizeof(buf), f); - if (!isprint(buf[0]) && !isspace(buf[1])) - return (0); + for (i = 0; i < cnt || i <= 30; i++) + if (!isprint(buf[i]) && !isspace(buf[i])) + return (1); return (1); } Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Mon Jun 25 15:53:17 2012 (r238270) +++ soc2012/jhagewood/diff/hagewood-diff.patch Mon Jun 25 16:52:22 2012 (r238271) @@ -1,6 +1,6 @@ diff -rupN jhagewood/diff/diff-orig/diff.c jhagewood/diff/diff/diff.c ---- jhagewood/diff/diff-orig/diff.c 2012-06-17 23:07:38.000000000 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-22 17:14:38.000000000 -0400 +--- jhagewood/diff/diff-orig/diff.c 2012-06-25 16:05:53.000000000 -0400 ++++ jhagewood/diff/diff/diff.c 2012-06-25 16:05:53.000000000 -0400 @@ -1,4 +1,4 @@ -/*- +/* @@ -56,7 +56,7 @@ /* Options which exceed manageable alphanumeric assignments */ -@@ -69,75 +67,77 @@ enum +@@ -69,75 +67,77 @@ enum OPT_STRIPCR, OPT_NORMAL, OPT_LEFTC, @@ -402,7 +402,7 @@ break; } } -@@ -585,6 +606,7 @@ print_status(int val, char *path1, char +@@ -585,6 +606,7 @@ print_status(int val, char *path1, char void usage(void) { @@ -410,9 +410,24 @@ (void)fprintf(stderr, "usage: diff [-abdilpqTtw] [-I pattern] [-c | -e | -f | -n | -u]\n" " [-L label] file1 file2\n" +diff -rupN jhagewood/diff/diff-orig/diff.h jhagewood/diff/diff/diff.h +--- jhagewood/diff/diff-orig/diff.h 2012-06-25 16:05:53.000000000 -0400 ++++ jhagewood/diff/diff/diff.h 2012-06-25 16:05:53.000000000 -0400 +@@ -75,9 +75,9 @@ struct excludes { + struct excludes *next; + }; + +-extern int aflag, bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag, ++extern int aflag, bflag, cflag, dflag, Eflag, iflag, lflag, Nflag, Pflag, pflag, rflag, + sflag, tflag, Tflag, wflag; +-extern int Bflag, strip_cr, tabsize; ++extern int Bflag, strip_cr, suppress_cl, tabsize; + extern int format, context, status; + extern char ignore_file_case; + extern char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; diff -rupN jhagewood/diff/diff-orig/diffdir.c jhagewood/diff/diff/diffdir.c ---- jhagewood/diff/diff-orig/diffdir.c 2012-06-17 23:07:38.000000000 -0400 -+++ jhagewood/diff/diff/diffdir.c 2012-06-20 01:43:28.000000000 -0400 +--- jhagewood/diff/diff-orig/diffdir.c 2012-06-25 16:05:53.000000000 -0400 ++++ jhagewood/diff/diff/diffdir.c 2012-06-25 16:05:53.000000000 -0400 @@ -20,14 +20,13 @@ #include @@ -520,24 +535,9 @@ strlcpy(path1 + plen1, dp->d_name, MAXPATHLEN - plen1); if (stat(path1, &stb1) != 0) { -diff -rupN jhagewood/diff/diff-orig/diff.h jhagewood/diff/diff/diff.h ---- jhagewood/diff/diff-orig/diff.h 2012-06-17 23:07:38.000000000 -0400 -+++ jhagewood/diff/diff/diff.h 2012-06-22 14:44:50.000000000 -0400 -@@ -75,9 +75,9 @@ struct excludes { - struct excludes *next; - }; - --extern int aflag, bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag, -+extern int aflag, bflag, cflag, dflag, Eflag, iflag, lflag, Nflag, Pflag, pflag, rflag, - sflag, tflag, Tflag, wflag; --extern int Bflag, strip_cr, tabsize; -+extern int Bflag, strip_cr, suppress_cl, tabsize; - extern int format, context, status; - extern char ignore_file_case; - extern char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c ---- jhagewood/diff/diff-orig/diffreg.c 2012-06-17 23:07:38.000000000 -0400 -+++ jhagewood/diff/diff/diffreg.c 2012-06-22 17:05:42.000000000 -0400 +--- jhagewood/diff/diff-orig/diffreg.c 2012-06-25 16:05:53.000000000 -0400 ++++ jhagewood/diff/diff/diffreg.c 2012-06-25 16:48:21.000000000 -0400 @@ -62,15 +62,13 @@ * @(#)diffreg.c 8.1 (Berkeley) 6/6/93 */ @@ -601,7 +601,7 @@ anychange = 0; lastline = 0; -@@ -353,7 +357,6 @@ diffreg(char *ofile1, char *ofile2, int +@@ -353,7 +357,6 @@ diffreg(char *ofile1, char *ofile2, int status |= 2; goto closem; } @@ -609,7 +609,7 @@ switch (files_differ(f1, f2, flags)) { case 0: goto closem; -@@ -365,7 +368,7 @@ diffreg(char *ofile1, char *ofile2, int +@@ -365,7 +368,7 @@ diffreg(char *ofile1, char *ofile2, int goto closem; } @@ -945,7 +945,7 @@ fetch(ixold, a, b, f1, '<', 1); if (a <= b && c <= d && format == D_NORMAL) - puts("---"); -+ printf("---"); ++ printf("---\n"); } i = fetch(ixnew, c, d, f2, format == D_NORMAL ? '>' : '\0', 0); if (i != 0 && format == D_EDIT) { @@ -1042,12 +1042,12 @@ sum = 1; space = 0; -@@ -1306,19 +1345,17 @@ readhash(FILE *f) +@@ -1306,19 +1345,18 @@ readhash(FILE *f) } static int -asciifile(FILE *f) -+textfile(FILE *f) ++istextfile(FILE *f) { - char buf[BUFSIZ]; - int i, cnt; @@ -1060,14 +1060,14 @@ rewind(f); cnt = fread(buf, 1, sizeof(buf), f); - for (i = 0; i < cnt; i++) -- if (!isprint(buf[i]) && !isspace(buf[i])) ++ for (i = 0; i < cnt || i <= 30; i++) + if (!isprint(buf[i]) && !isspace(buf[i])) - return (0); -+ if (!isprint(buf[0]) && !isspace(buf[1])) -+ return (0); ++ return (1); return (1); } -@@ -1327,10 +1364,10 @@ asciifile(FILE *f) +@@ -1327,10 +1365,10 @@ asciifile(FILE *f) static char * match_function(const long *f, int pos, FILE *file) { @@ -1082,7 +1082,7 @@ lastline = pos; while (pos > last) { -@@ -1342,7 +1379,6 @@ match_function(const long *f, int pos, F +@@ -1342,7 +1380,6 @@ match_function(const long *f, int pos, F if (nc > 0) { buf[nc] = '\0'; buf[strcspn(buf, "\n")] = '\0'; @@ -1090,7 +1090,7 @@ if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') { if (begins_with(buf, "private:")) { if (!state) -@@ -1373,9 +1409,9 @@ static void +@@ -1373,9 +1410,9 @@ static void dump_context_vec(FILE *f1, FILE *f2) { struct context_vec *cvp = context_vec_start; @@ -1103,7 +1103,7 @@ if (context_vec_start > context_vec_ptr) return; -@@ -1390,8 +1426,8 @@ dump_context_vec(FILE *f1, FILE *f2) +@@ -1390,8 +1427,8 @@ dump_context_vec(FILE *f1, FILE *f2) if (pflag) { f = match_function(ixold, lowa-1, f1); if (f != NULL) { @@ -1114,7 +1114,7 @@ } } printf("\n*** "); -@@ -1478,9 +1514,9 @@ static void +@@ -1478,9 +1515,9 @@ static void dump_unified_vec(FILE *f1, FILE *f2) { struct context_vec *cvp = context_vec_start; @@ -1127,7 +1127,7 @@ if (context_vec_start > context_vec_ptr) return; -@@ -1491,19 +1527,19 @@ dump_unified_vec(FILE *f1, FILE *f2) +@@ -1491,19 +1528,19 @@ dump_unified_vec(FILE *f1, FILE *f2) lowc = MAX(1, cvp->c - context); upd = MIN(len[1], context_vec_ptr->d + context); @@ -1153,7 +1153,7 @@ /* * Output changes in "unified" diff format--the old and new lines -@@ -1551,16 +1587,43 @@ dump_unified_vec(FILE *f1, FILE *f2) +@@ -1551,16 +1588,43 @@ dump_unified_vec(FILE *f1, FILE *f2) static void print_header(const char *file1, const char *file2) { Modified: soc2012/jhagewood/diff3/hagewood-diff3.patch ============================================================================== --- soc2012/jhagewood/diff3/hagewood-diff3.patch Mon Jun 25 15:53:17 2012 (r238270) +++ soc2012/jhagewood/diff3/hagewood-diff3.patch Mon Jun 25 16:52:22 2012 (r238271) @@ -1,6 +1,17 @@ +diff -rupN jhagewood/diff3/diff3-orig/Makefile jhagewood/diff3/diff3/Makefile +--- jhagewood/diff3/diff3-orig/Makefile 2012-06-25 16:05:53.000000000 -0400 ++++ jhagewood/diff3/diff3/Makefile 2012-06-25 16:05:53.000000000 -0400 +@@ -6,6 +6,6 @@ BINDIR= /usr/libexec + + beforeinstall: + install ${INSTALL_COPY}c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ +- ${.CURDIR}/diff3.ksh ${DESTDIR}/usr/bin/diff3 ++ ${.CURDIR}/diff3.sh ${DESTDIR}/usr/bin/diff3 + + .include diff -rupN jhagewood/diff3/diff3-orig/diff3prog.c jhagewood/diff3/diff3/diff3prog.c ---- jhagewood/diff3/diff3-orig/diff3prog.c 2012-06-17 23:07:38.000000000 -0400 -+++ jhagewood/diff3/diff3/diff3prog.c 2012-06-17 23:07:38.000000000 -0400 +--- jhagewood/diff3/diff3-orig/diff3prog.c 2012-06-25 16:05:53.000000000 -0400 ++++ jhagewood/diff3/diff3/diff3prog.c 2012-06-25 16:05:53.000000000 -0400 @@ -64,19 +64,23 @@ * @(#)diff3.c 8.1 (Berkeley) 6/6/93 */ @@ -455,14 +466,3 @@ + fprintf(stderr, "usage: diff3 %s file1 file2 file3\n", OPTIONS); exit(EXIT_FAILURE); } -diff -rupN jhagewood/diff3/diff3-orig/Makefile jhagewood/diff3/diff3/Makefile ---- jhagewood/diff3/diff3-orig/Makefile 2012-06-17 23:07:38.000000000 -0400 -+++ jhagewood/diff3/diff3/Makefile 2012-06-17 23:07:38.000000000 -0400 -@@ -6,6 +6,6 @@ BINDIR= /usr/libexec - - beforeinstall: - install ${INSTALL_COPY}c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ -- ${.CURDIR}/diff3.ksh ${DESTDIR}/usr/bin/diff3 -+ ${.CURDIR}/diff3.sh ${DESTDIR}/usr/bin/diff3 - - .include Modified: soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch ============================================================================== --- soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch Mon Jun 25 15:53:17 2012 (r238270) +++ soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch Mon Jun 25 16:52:22 2012 (r238271) @@ -1,6 +1,6 @@ diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man.h jhagewood/mdocml/mdocml-1.12.1/man.h ---- jhagewood/mdocml/mdocml-1.12.1-orig/man.h 2012-06-17 23:07:40.000000000 -0400 -+++ jhagewood/mdocml/mdocml-1.12.1/man.h 2012-06-17 23:07:42.000000000 -0400 +--- jhagewood/mdocml/mdocml-1.12.1-orig/man.h 2012-06-25 16:05:56.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man.h 2012-06-25 16:05:59.000000000 -0400 @@ -43,6 +43,8 @@ enum mant { MAN_sp, MAN_nf, @@ -12,7 +12,7 @@ MAN_DT, diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man.h.orig jhagewood/mdocml/mdocml-1.12.1/man.h.orig --- jhagewood/mdocml/mdocml-1.12.1-orig/man.h.orig 1969-12-31 19:00:00.000000000 -0500 -+++ jhagewood/mdocml/mdocml-1.12.1/man.h.orig 2012-06-17 23:07:42.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man.h.orig 2012-06-25 16:05:59.000000000 -0400 @@ -0,0 +1,113 @@ +/* $Id: man.h,v 1.60 2012/01/03 15:16:24 kristaps Exp $ */ +/* @@ -128,8 +128,8 @@ + +#endif /*!MAN_H*/ diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c jhagewood/mdocml/mdocml-1.12.1/man_term.c ---- jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c 2012-06-17 23:07:40.000000000 -0400 -+++ jhagewood/mdocml/mdocml-1.12.1/man_term.c 2012-06-17 23:07:42.000000000 -0400 +--- jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c 2012-06-25 16:05:56.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man_term.c 2012-06-25 16:05:59.000000000 -0400 @@ -82,6 +82,8 @@ static int pre_alternate(DECL_ARGS); static int pre_ft(DECL_ARGS); static int pre_ign(DECL_ARGS); @@ -173,7 +173,7 @@ static int diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c.orig jhagewood/mdocml/mdocml-1.12.1/man_term.c.orig --- jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c.orig 1969-12-31 19:00:00.000000000 -0500 -+++ jhagewood/mdocml/mdocml-1.12.1/man_term.c.orig 2012-06-17 23:07:42.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man_term.c.orig 2012-06-25 16:05:59.000000000 -0400 @@ -0,0 +1,1117 @@ +/* $Id: man_term.c,v 1.127 2012/01/03 15:16:24 kristaps Exp $ */ +/* From owner-svn-soc-all@FreeBSD.ORG Mon Jun 25 17:10:38 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 83CA21065672 for ; Mon, 25 Jun 2012 17:10:36 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 25 Jun 2012 17:10:36 +0000 Date: Mon, 25 Jun 2012 17:10:36 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120625171036.83CA21065672@hub.freebsd.org> Cc: Subject: socsvn commit: r238273 - in soc2012/jhagewood/diff: . diff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 17:10:38 -0000 Author: jhagewood Date: Mon Jun 25 17:10:34 2012 New Revision: 238273 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238273 Log: Modified: soc2012/jhagewood/diff/diff/diffreg.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/diff/diffreg.c ============================================================================== --- soc2012/jhagewood/diff/diff/diffreg.c Mon Jun 25 16:52:27 2012 (r238272) +++ soc2012/jhagewood/diff/diff/diffreg.c Mon Jun 25 17:10:34 2012 (r238273) @@ -1344,19 +1344,20 @@ return (sum == 0 ? 1 : sum); } +/* + * Checks to see if a file appears to be a text file. + */ static int istextfile(FILE *f) { char buf[BUFSIZ]; - int i, cnt; if (aflag || f == NULL) return (1); rewind(f); - cnt = fread(buf, 1, sizeof(buf), f); - for (i = 0; i < cnt || i <= 30; i++) - if (!isprint(buf[i]) && !isspace(buf[i])) - return (1); + fread(buf, 1, sizeof(buf), f); + if(buf[0] == 0x7F && buf[1] == 0x45) + return (0); return (1); } Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Mon Jun 25 16:52:27 2012 (r238272) +++ soc2012/jhagewood/diff/hagewood-diff.patch Mon Jun 25 17:10:34 2012 (r238273) @@ -537,7 +537,7 @@ if (stat(path1, &stb1) != 0) { diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c --- jhagewood/diff/diff-orig/diffreg.c 2012-06-25 16:05:53.000000000 -0400 -+++ jhagewood/diff/diff/diffreg.c 2012-06-25 16:48:21.000000000 -0400 ++++ jhagewood/diff/diff/diffreg.c 2012-06-25 17:08:40.000000000 -0400 @@ -62,15 +62,13 @@ * @(#)diffreg.c 8.1 (Berkeley) 6/6/93 */ @@ -1042,9 +1042,13 @@ sum = 1; space = 0; -@@ -1306,19 +1345,18 @@ readhash(FILE *f) +@@ -1305,19 +1344,19 @@ readhash(FILE *f) + return (sum == 0 ? 1 : sum); } ++/* ++ * Checks to see if a file appears to be a text file. ++ */ static int -asciifile(FILE *f) +istextfile(FILE *f) @@ -1052,22 +1056,20 @@ - char buf[BUFSIZ]; - int i, cnt; + char buf[BUFSIZ]; -+ int i, cnt; if (aflag || f == NULL) return (1); - rewind(f); - cnt = fread(buf, 1, sizeof(buf), f); +- cnt = fread(buf, 1, sizeof(buf), f); - for (i = 0; i < cnt; i++) -+ for (i = 0; i < cnt || i <= 30; i++) - if (!isprint(buf[i]) && !isspace(buf[i])) -- return (0); -+ return (1); +- if (!isprint(buf[i]) && !isspace(buf[i])) ++ fread(buf, 1, sizeof(buf), f); ++ if(buf[0] == 0x7F && buf[1] == 0x45) + return (0); return (1); } - -@@ -1327,10 +1365,10 @@ asciifile(FILE *f) +@@ -1327,10 +1366,10 @@ asciifile(FILE *f) static char * match_function(const long *f, int pos, FILE *file) { @@ -1082,7 +1084,7 @@ lastline = pos; while (pos > last) { -@@ -1342,7 +1380,6 @@ match_function(const long *f, int pos, F +@@ -1342,7 +1381,6 @@ match_function(const long *f, int pos, F if (nc > 0) { buf[nc] = '\0'; buf[strcspn(buf, "\n")] = '\0'; @@ -1090,7 +1092,7 @@ if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') { if (begins_with(buf, "private:")) { if (!state) -@@ -1373,9 +1410,9 @@ static void +@@ -1373,9 +1411,9 @@ static void dump_context_vec(FILE *f1, FILE *f2) { struct context_vec *cvp = context_vec_start; @@ -1103,7 +1105,7 @@ if (context_vec_start > context_vec_ptr) return; -@@ -1390,8 +1427,8 @@ dump_context_vec(FILE *f1, FILE *f2) +@@ -1390,8 +1428,8 @@ dump_context_vec(FILE *f1, FILE *f2) if (pflag) { f = match_function(ixold, lowa-1, f1); if (f != NULL) { @@ -1114,7 +1116,7 @@ } } printf("\n*** "); -@@ -1478,9 +1515,9 @@ static void +@@ -1478,9 +1516,9 @@ static void dump_unified_vec(FILE *f1, FILE *f2) { struct context_vec *cvp = context_vec_start; @@ -1127,7 +1129,7 @@ if (context_vec_start > context_vec_ptr) return; -@@ -1491,19 +1528,19 @@ dump_unified_vec(FILE *f1, FILE *f2) +@@ -1491,19 +1529,19 @@ dump_unified_vec(FILE *f1, FILE *f2) lowc = MAX(1, cvp->c - context); upd = MIN(len[1], context_vec_ptr->d + context); @@ -1153,7 +1155,7 @@ /* * Output changes in "unified" diff format--the old and new lines -@@ -1551,16 +1588,43 @@ dump_unified_vec(FILE *f1, FILE *f2) +@@ -1551,16 +1589,43 @@ dump_unified_vec(FILE *f1, FILE *f2) static void print_header(const char *file1, const char *file2) { From owner-svn-soc-all@FreeBSD.ORG Mon Jun 25 17:39:26 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 01382106566B for ; Mon, 25 Jun 2012 17:39:24 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 25 Jun 2012 17:39:23 +0000 Date: Mon, 25 Jun 2012 17:39:23 +0000 From: scher@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120625173924.01382106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238274 - soc2012/scher/par_ports/head/Mk X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 17:39:26 -0000 Author: scher Date: Mon Jun 25 17:39:23 2012 New Revision: 238274 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238274 Log: [bugfix] Enabled backward compatibility for non-parallel builds. Allows user unput while building ONE dependency in background [fixed] changes in config-recursive target to check only straight deps 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 Jun 25 17:10:34 2012 (r238273) +++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Mon Jun 25 17:39:23 2012 (r238274) @@ -369,7 +369,7 @@ @${ECHO_MSG} "===> Setting user-specified options for ${PKGNAME} and dependencies"; config-recursive: - @for dir in $$(${MAKE} all-depends-list); do \ + @for dir in $$(${MAKE} run-depends-list build-depends-list | uniq); do \ while true; do \ ( cd $$dir; ${MAKE} locking-config-recursive ) || { \ status=$$?; \ Modified: soc2012/scher/par_ports/head/Mk/bsd.port.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.port.mk Mon Jun 25 17:10:34 2012 (r238273) +++ soc2012/scher/par_ports/head/Mk/bsd.port.mk Mon Jun 25 17:39:23 2012 (r238274) @@ -5088,12 +5088,10 @@ ${PKG_ADD} $${subpkgfile}; \ fi; \ else \ - log_file="/tmp/ports_logs/dep-$${dir\#\#*/}-parent-${PORTNAME}.log"; \ - (cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args 2>> $${log_file} >> $${log_file} ) & spawned=$$!; \ + (cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args ) & spawned=$$!; \ fi; \ else \ - log_file="/tmp/ports_logs/dep-$${dir\#\#*/}-parent-$${PORTNAME}.log"; \ - (cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args 2>> $${log_file} >> $${log_file} ) & spawned=$$!; \ + (cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args) & spawned=$$!; \ fi; \ ############### PAR_PORTS SPECIFIC COMMENT LINE ############### @@ -5166,7 +5164,9 @@ done; \ if { [ $${builds_num} -eq ${_parv_PARALLEL_BUILDS_NUMBER} ] || \ ( [ $${builds_num} -gt 0 ] && [ $${\#depends} -eq 0 ] ); }; then \ - echo "---- dependency output ----- : CAN'T SPAWN MORE DEPS! SLEEP... "; \ + if [ ${_parv_WANT_PARALLEL_BUILD} ]; then \ + echo "---- dependency output ----- : CAN'T SPAWN MORE DEPS! SLEEP... "; \ + fi; \ sleep ${CHECK_ACTIVE_TIMEOUT}; \ fi; \ done; \ @@ -5191,7 +5191,6 @@ ############### END OF PAR_PORTS SPECIFIC COMMENT LINE ############### _TERMINATE_PROCESS_TREE= \ - ${_dparv_START_OUTPUT}; \ ${ECHO_CMD} Terminating process tree strating from ${.MAKE.PID}; \ pids_to_kill=${.MAKE.PID}; \ /bin/kill -STOP ${.MAKE.PID} 2> /dev/null || ${DO_NADA}; \ @@ -5211,7 +5210,6 @@ if [ $${\#ppids} -eq 0 ]; then break; fi; \ done; \ ${ECHO_CMD} PIDs to kill: $${pids_to_kill}; \ - ${_dparv_START_OUTPUT}; \ /bin/kill -KILL $${pids_to_kill} 2> /dev/null || ${DO_NADA} ############### PAR_PORTS SPECIFIC COMMENT LINE ############### From owner-svn-soc-all@FreeBSD.ORG Mon Jun 25 18:44:59 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id DF16B106566C for ; Mon, 25 Jun 2012 18:44:56 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 25 Jun 2012 18:44:56 +0000 Date: Mon, 25 Jun 2012 18:44:56 +0000 From: scher@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120625184456.DF16B106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r238278 - soc2012/scher/par_ports/head/Mk X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 18:44:59 -0000 Author: scher Date: Mon Jun 25 18:44:56 2012 New Revision: 238278 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238278 Log: [fixed] Non-parallel dependency builds are run as fg processes Modified: 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 Jun 25 17:50:11 2012 (r238277) +++ soc2012/scher/par_ports/head/Mk/bsd.port.mk Mon Jun 25 18:44:56 2012 (r238278) @@ -5088,10 +5088,20 @@ ${PKG_ADD} $${subpkgfile}; \ fi; \ else \ - (cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args ) & spawned=$$!; \ + if [ ${_parv_WANT_PARALLEL_BUILD} ]; then \ + (cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args ) & spawned=$$!; \ + else \ + (cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args); \ + spawned="yes"; \ + fi; \ fi; \ else \ - (cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args) & spawned=$$!; \ + if [ ${_parv_WANT_PARALLEL_BUILD} ]; then \ + (cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args ) & spawned=$$!; \ + else \ + (cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args); \ + spawned="yes"; \ + fi; \ fi; \ ############### PAR_PORTS SPECIFIC COMMENT LINE ############### @@ -5110,6 +5120,7 @@ # ############### END OF PAR_PORTS SPECIFIC COMMENT LINE ############### +.if defined(_parv_WANT_PARALLEL_BUILD) _PROCESS_ACTIVE_BUILDS= \ echo "---- dependency output ----- : --- ENTER _PROCESS_ACTIVE_BUILDS SECTION "; \ while true; do \ @@ -5171,6 +5182,9 @@ fi; \ done; \ echo "---- dependency output ----- : --- LEAVE _PROCESS_ACTIVE_BUILDS SECTION " +.else +_PROCESS_ACTIVE_BUILDS= ${DO_NADA} +.endif ############### PAR_PORTS SPECIFIC COMMENT LINE ############### # From owner-svn-soc-all@FreeBSD.ORG Mon Jun 25 19:42:10 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id D13BA1065674 for ; Mon, 25 Jun 2012 19:42:08 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 25 Jun 2012 19:42:08 +0000 Date: Mon, 25 Jun 2012 19:42:08 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120625194208.D13BA1065674@hub.freebsd.org> Cc: Subject: socsvn commit: r238280 - in soc2012/jhagewood/diff: . diff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 19:42:11 -0000 Author: jhagewood Date: Mon Jun 25 19:42:08 2012 New Revision: 238280 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238280 Log: Modified: soc2012/jhagewood/diff/diff/diffreg.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/diff/diffreg.c ============================================================================== --- soc2012/jhagewood/diff/diff/diffreg.c Mon Jun 25 18:54:02 2012 (r238279) +++ soc2012/jhagewood/diff/diff/diffreg.c Mon Jun 25 19:42:08 2012 (r238280) @@ -1355,8 +1355,15 @@ if (aflag || f == NULL) return (1); rewind(f); + /* + * Checks the first 4 bytes of a file to see if it's ELF format. + * If so, return 0. + */ fread(buf, 1, sizeof(buf), f); - if(buf[0] == 0x7F && buf[1] == 0x45) + if(buf[0] == 0x7F && + buf[1] == 0x45 && + buf[2] == 0x4C && + buf[3] == 0x46); return (0); return (1); } Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Mon Jun 25 18:54:02 2012 (r238279) +++ soc2012/jhagewood/diff/hagewood-diff.patch Mon Jun 25 19:42:08 2012 (r238280) @@ -537,7 +537,7 @@ if (stat(path1, &stb1) != 0) { diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c --- jhagewood/diff/diff-orig/diffreg.c 2012-06-25 16:05:53.000000000 -0400 -+++ jhagewood/diff/diff/diffreg.c 2012-06-25 17:08:40.000000000 -0400 ++++ jhagewood/diff/diff/diffreg.c 2012-06-25 19:42:00.000000000 -0400 @@ -62,15 +62,13 @@ * @(#)diffreg.c 8.1 (Berkeley) 6/6/93 */ @@ -1042,7 +1042,7 @@ sum = 1; space = 0; -@@ -1305,19 +1344,19 @@ readhash(FILE *f) +@@ -1305,19 +1344,26 @@ readhash(FILE *f) return (sum == 0 ? 1 : sum); } @@ -1064,12 +1064,19 @@ - cnt = fread(buf, 1, sizeof(buf), f); - for (i = 0; i < cnt; i++) - if (!isprint(buf[i]) && !isspace(buf[i])) ++ /* ++ * Checks the first 4 bytes of a file to see if it's ELF format. ++ * If so, return 0. ++ */ + fread(buf, 1, sizeof(buf), f); -+ if(buf[0] == 0x7F && buf[1] == 0x45) ++ if(buf[0] == 0x7F && ++ buf[1] == 0x45 && ++ buf[2] == 0x4C && ++ buf[3] == 0x46); return (0); return (1); } -@@ -1327,10 +1366,10 @@ asciifile(FILE *f) +@@ -1327,10 +1373,10 @@ asciifile(FILE *f) static char * match_function(const long *f, int pos, FILE *file) { @@ -1084,7 +1091,7 @@ lastline = pos; while (pos > last) { -@@ -1342,7 +1381,6 @@ match_function(const long *f, int pos, F +@@ -1342,7 +1388,6 @@ match_function(const long *f, int pos, F if (nc > 0) { buf[nc] = '\0'; buf[strcspn(buf, "\n")] = '\0'; @@ -1092,7 +1099,7 @@ if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') { if (begins_with(buf, "private:")) { if (!state) -@@ -1373,9 +1411,9 @@ static void +@@ -1373,9 +1418,9 @@ static void dump_context_vec(FILE *f1, FILE *f2) { struct context_vec *cvp = context_vec_start; @@ -1105,7 +1112,7 @@ if (context_vec_start > context_vec_ptr) return; -@@ -1390,8 +1428,8 @@ dump_context_vec(FILE *f1, FILE *f2) +@@ -1390,8 +1435,8 @@ dump_context_vec(FILE *f1, FILE *f2) if (pflag) { f = match_function(ixold, lowa-1, f1); if (f != NULL) { @@ -1116,7 +1123,7 @@ } } printf("\n*** "); -@@ -1478,9 +1516,9 @@ static void +@@ -1478,9 +1523,9 @@ static void dump_unified_vec(FILE *f1, FILE *f2) { struct context_vec *cvp = context_vec_start; @@ -1129,7 +1136,7 @@ if (context_vec_start > context_vec_ptr) return; -@@ -1491,19 +1529,19 @@ dump_unified_vec(FILE *f1, FILE *f2) +@@ -1491,19 +1536,19 @@ dump_unified_vec(FILE *f1, FILE *f2) lowc = MAX(1, cvp->c - context); upd = MIN(len[1], context_vec_ptr->d + context); @@ -1155,7 +1162,7 @@ /* * Output changes in "unified" diff format--the old and new lines -@@ -1551,16 +1589,43 @@ dump_unified_vec(FILE *f1, FILE *f2) +@@ -1551,16 +1596,43 @@ dump_unified_vec(FILE *f1, FILE *f2) static void print_header(const char *file1, const char *file2) { From owner-svn-soc-all@FreeBSD.ORG Mon Jun 25 20:48:54 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 70997106566B for ; Mon, 25 Jun 2012 20:48:52 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 25 Jun 2012 20:48:52 +0000 Date: Mon, 25 Jun 2012 20:48:52 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120625204852.70997106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238284 - in soc2012/jhagewood/diff: . diff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 20:48:54 -0000 Author: jhagewood Date: Mon Jun 25 20:48:51 2012 New Revision: 238284 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238284 Log: Modified: soc2012/jhagewood/diff/TODO soc2012/jhagewood/diff/diff/diffreg.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/TODO ============================================================================== --- soc2012/jhagewood/diff/TODO Mon Jun 25 19:59:08 2012 (r238283) +++ soc2012/jhagewood/diff/TODO Mon Jun 25 20:48:51 2012 (r238284) @@ -17,7 +17,7 @@ --speed-large-file INCOMPLETE --ignore-tab-expansion IN PROGRESS Functionality implemented in check(), needs debugging. (Same problem as --ignore-blank-lines?) --width INCOMPLETE -Fix non-ascii character diffs COMPLETE Changed name of asciifile() to istextfile() and functionality. +Fix non-ascii character diffs COMPLETE Changed name of asciifile() to istextfile() and checks to see if file is ELF format. Notes: @@ -25,9 +25,8 @@ - When using text files with non-ascii characters, diff will interpret them as binary files and output "Files [file1] and [file2] differ." Very important compatibility problem with GNU diff, which will diff files that aren't strictly ascii. - Error is associated with asciifile() in diffreg.c - - FIX: Changed name of asciifile() to istextfile() (more appropriate), and instead of checking if every character in a file is printable, only check - the first character. - IMO, This is a sufficient test to check if a file is binary or a text-file. + - FIX: Changed name of asciifile() to istextfile() (more appropriate), and instead of checking if every character is ASCII, it checks the first 4 bytes + of the file to see if it is ELF format. If so, the file is considered a text file. - With some files, modification times displayed in the timestamp for file1 are different than the time outputted by GNU diff. - The -ignore-*-* options need some work. Modified: soc2012/jhagewood/diff/diff/diffreg.c ============================================================================== --- soc2012/jhagewood/diff/diff/diffreg.c Mon Jun 25 19:59:08 2012 (r238283) +++ soc2012/jhagewood/diff/diff/diffreg.c Mon Jun 25 20:48:51 2012 (r238284) @@ -1344,26 +1344,18 @@ return (sum == 0 ? 1 : sum); } -/* - * Checks to see if a file appears to be a text file. - */ static int istextfile(FILE *f) { char buf[BUFSIZ]; + int i, cnt; if (aflag || f == NULL) return (1); rewind(f); - /* - * Checks the first 4 bytes of a file to see if it's ELF format. - * If so, return 0. - */ fread(buf, 1, sizeof(buf), f); - if(buf[0] == 0x7F && - buf[1] == 0x45 && - buf[2] == 0x4C && - buf[3] == 0x46); + if(buf[0] == 0x7F && buf[1] == 0x45 && + buf[2] == 0x4C && buf[3] == 0x46) return (0); return (1); } Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Mon Jun 25 19:59:08 2012 (r238283) +++ soc2012/jhagewood/diff/hagewood-diff.patch Mon Jun 25 20:48:51 2012 (r238284) @@ -537,7 +537,7 @@ if (stat(path1, &stb1) != 0) { diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c --- jhagewood/diff/diff-orig/diffreg.c 2012-06-25 16:05:53.000000000 -0400 -+++ jhagewood/diff/diff/diffreg.c 2012-06-25 19:42:00.000000000 -0400 ++++ jhagewood/diff/diff/diffreg.c 2012-06-25 19:58:16.000000000 -0400 @@ -62,15 +62,13 @@ * @(#)diffreg.c 8.1 (Berkeley) 6/6/93 */ @@ -1042,13 +1042,9 @@ sum = 1; space = 0; -@@ -1305,19 +1344,26 @@ readhash(FILE *f) - return (sum == 0 ? 1 : sum); +@@ -1306,18 +1345,17 @@ readhash(FILE *f) } -+/* -+ * Checks to see if a file appears to be a text file. -+ */ static int -asciifile(FILE *f) +istextfile(FILE *f) @@ -1056,6 +1052,7 @@ - char buf[BUFSIZ]; - int i, cnt; + char buf[BUFSIZ]; ++ int i, cnt; if (aflag || f == NULL) return (1); @@ -1064,19 +1061,13 @@ - cnt = fread(buf, 1, sizeof(buf), f); - for (i = 0; i < cnt; i++) - if (!isprint(buf[i]) && !isspace(buf[i])) -+ /* -+ * Checks the first 4 bytes of a file to see if it's ELF format. -+ * If so, return 0. -+ */ + fread(buf, 1, sizeof(buf), f); -+ if(buf[0] == 0x7F && -+ buf[1] == 0x45 && -+ buf[2] == 0x4C && -+ buf[3] == 0x46); ++ if(buf[0] == 0x7F && buf[1] == 0x45 && ++ buf[2] == 0x4C && buf[3] == 0x46) return (0); return (1); } -@@ -1327,10 +1373,10 @@ asciifile(FILE *f) +@@ -1327,10 +1365,10 @@ asciifile(FILE *f) static char * match_function(const long *f, int pos, FILE *file) { @@ -1091,7 +1082,7 @@ lastline = pos; while (pos > last) { -@@ -1342,7 +1388,6 @@ match_function(const long *f, int pos, F +@@ -1342,7 +1380,6 @@ match_function(const long *f, int pos, F if (nc > 0) { buf[nc] = '\0'; buf[strcspn(buf, "\n")] = '\0'; @@ -1099,7 +1090,7 @@ if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') { if (begins_with(buf, "private:")) { if (!state) -@@ -1373,9 +1418,9 @@ static void +@@ -1373,9 +1410,9 @@ static void dump_context_vec(FILE *f1, FILE *f2) { struct context_vec *cvp = context_vec_start; @@ -1112,7 +1103,7 @@ if (context_vec_start > context_vec_ptr) return; -@@ -1390,8 +1435,8 @@ dump_context_vec(FILE *f1, FILE *f2) +@@ -1390,8 +1427,8 @@ dump_context_vec(FILE *f1, FILE *f2) if (pflag) { f = match_function(ixold, lowa-1, f1); if (f != NULL) { @@ -1123,7 +1114,7 @@ } } printf("\n*** "); -@@ -1478,9 +1523,9 @@ static void +@@ -1478,9 +1515,9 @@ static void dump_unified_vec(FILE *f1, FILE *f2) { struct context_vec *cvp = context_vec_start; @@ -1136,7 +1127,7 @@ if (context_vec_start > context_vec_ptr) return; -@@ -1491,19 +1536,19 @@ dump_unified_vec(FILE *f1, FILE *f2) +@@ -1491,19 +1528,19 @@ dump_unified_vec(FILE *f1, FILE *f2) lowc = MAX(1, cvp->c - context); upd = MIN(len[1], context_vec_ptr->d + context); @@ -1162,7 +1153,7 @@ /* * Output changes in "unified" diff format--the old and new lines -@@ -1551,16 +1596,43 @@ dump_unified_vec(FILE *f1, FILE *f2) +@@ -1551,16 +1588,43 @@ dump_unified_vec(FILE *f1, FILE *f2) static void print_header(const char *file1, const char *file2) { From owner-svn-soc-all@FreeBSD.ORG Mon Jun 25 21:14:10 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 801B7106566C for ; Mon, 25 Jun 2012 21:14:08 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 25 Jun 2012 21:14:08 +0000 Date: Mon, 25 Jun 2012 21:14:08 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120625211408.801B7106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r238286 - in soc2012/jhagewood/diff: . diff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 21:14:10 -0000 Author: jhagewood Date: Mon Jun 25 21:14:08 2012 New Revision: 238286 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238286 Log: Modified: soc2012/jhagewood/diff/diff/diffreg.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/diff/diffreg.c ============================================================================== --- soc2012/jhagewood/diff/diff/diffreg.c Mon Jun 25 20:56:32 2012 (r238285) +++ soc2012/jhagewood/diff/diff/diffreg.c Mon Jun 25 21:14:08 2012 (r238286) @@ -1344,6 +1344,9 @@ return (sum == 0 ? 1 : sum); } +/* + * Checks if an open file is a text file. + */ static int istextfile(FILE *f) { @@ -1353,6 +1356,9 @@ if (aflag || f == NULL) return (1); rewind(f); + /* If the first 4 bytes of the file are the same as the first 4 bytes of + * an ELF file header, return 0. + */ fread(buf, 1, sizeof(buf), f); if(buf[0] == 0x7F && buf[1] == 0x45 && buf[2] == 0x4C && buf[3] == 0x46) Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Mon Jun 25 20:56:32 2012 (r238285) +++ soc2012/jhagewood/diff/hagewood-diff.patch Mon Jun 25 21:14:08 2012 (r238286) @@ -537,7 +537,7 @@ if (stat(path1, &stb1) != 0) { diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c --- jhagewood/diff/diff-orig/diffreg.c 2012-06-25 16:05:53.000000000 -0400 -+++ jhagewood/diff/diff/diffreg.c 2012-06-25 19:58:16.000000000 -0400 ++++ jhagewood/diff/diff/diffreg.c 2012-06-25 21:14:04.000000000 -0400 @@ -62,15 +62,13 @@ * @(#)diffreg.c 8.1 (Berkeley) 6/6/93 */ @@ -1042,9 +1042,13 @@ sum = 1; space = 0; -@@ -1306,18 +1345,17 @@ readhash(FILE *f) +@@ -1305,19 +1344,24 @@ readhash(FILE *f) + return (sum == 0 ? 1 : sum); } ++/* ++ * Checks if an open file is a text file. ++ */ static int -asciifile(FILE *f) +istextfile(FILE *f) @@ -1061,13 +1065,16 @@ - cnt = fread(buf, 1, sizeof(buf), f); - for (i = 0; i < cnt; i++) - if (!isprint(buf[i]) && !isspace(buf[i])) ++ /* If the first 4 bytes of the file are the same as the first 4 bytes of ++ * an ELF file header, return 0. ++ */ + fread(buf, 1, sizeof(buf), f); + if(buf[0] == 0x7F && buf[1] == 0x45 && + buf[2] == 0x4C && buf[3] == 0x46) return (0); return (1); } -@@ -1327,10 +1365,10 @@ asciifile(FILE *f) +@@ -1327,10 +1371,10 @@ asciifile(FILE *f) static char * match_function(const long *f, int pos, FILE *file) { @@ -1082,7 +1089,7 @@ lastline = pos; while (pos > last) { -@@ -1342,7 +1380,6 @@ match_function(const long *f, int pos, F +@@ -1342,7 +1386,6 @@ match_function(const long *f, int pos, F if (nc > 0) { buf[nc] = '\0'; buf[strcspn(buf, "\n")] = '\0'; @@ -1090,7 +1097,7 @@ if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') { if (begins_with(buf, "private:")) { if (!state) -@@ -1373,9 +1410,9 @@ static void +@@ -1373,9 +1416,9 @@ static void dump_context_vec(FILE *f1, FILE *f2) { struct context_vec *cvp = context_vec_start; @@ -1103,7 +1110,7 @@ if (context_vec_start > context_vec_ptr) return; -@@ -1390,8 +1427,8 @@ dump_context_vec(FILE *f1, FILE *f2) +@@ -1390,8 +1433,8 @@ dump_context_vec(FILE *f1, FILE *f2) if (pflag) { f = match_function(ixold, lowa-1, f1); if (f != NULL) { @@ -1114,7 +1121,7 @@ } } printf("\n*** "); -@@ -1478,9 +1515,9 @@ static void +@@ -1478,9 +1521,9 @@ static void dump_unified_vec(FILE *f1, FILE *f2) { struct context_vec *cvp = context_vec_start; @@ -1127,7 +1134,7 @@ if (context_vec_start > context_vec_ptr) return; -@@ -1491,19 +1528,19 @@ dump_unified_vec(FILE *f1, FILE *f2) +@@ -1491,19 +1534,19 @@ dump_unified_vec(FILE *f1, FILE *f2) lowc = MAX(1, cvp->c - context); upd = MIN(len[1], context_vec_ptr->d + context); @@ -1153,7 +1160,7 @@ /* * Output changes in "unified" diff format--the old and new lines -@@ -1551,16 +1588,43 @@ dump_unified_vec(FILE *f1, FILE *f2) +@@ -1551,16 +1594,43 @@ dump_unified_vec(FILE *f1, FILE *f2) static void print_header(const char *file1, const char *file2) { From owner-svn-soc-all@FreeBSD.ORG Mon Jun 25 21:33:18 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id E30DD106564A for ; Mon, 25 Jun 2012 21:33:17 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 25 Jun 2012 21:33:17 +0000 Date: Mon, 25 Jun 2012 21:33:17 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120625213317.E30DD106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238287 - soc2012/jhagewood/diff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 21:33:19 -0000 Author: jhagewood Date: Mon Jun 25 21:33:17 2012 New Revision: 238287 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238287 Log: Modified: soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Mon Jun 25 21:14:08 2012 (r238286) +++ soc2012/jhagewood/diff/hagewood-diff.patch Mon Jun 25 21:33:17 2012 (r238287) @@ -536,8 +536,8 @@ strlcpy(path1 + plen1, dp->d_name, MAXPATHLEN - plen1); if (stat(path1, &stb1) != 0) { diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c ---- jhagewood/diff/diff-orig/diffreg.c 2012-06-25 16:05:53.000000000 -0400 -+++ jhagewood/diff/diff/diffreg.c 2012-06-25 21:14:04.000000000 -0400 +--- jhagewood/diff/diff-orig/diffreg.c 2012-06-25 21:19:12.000000000 -0400 ++++ jhagewood/diff/diff/diffreg.c 2012-06-25 21:33:12.000000000 -0400 @@ -62,15 +62,13 @@ * @(#)diffreg.c 8.1 (Berkeley) 6/6/93 */ From owner-svn-soc-all@FreeBSD.ORG Mon Jun 25 21:52:50 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 02ED7106566C for ; Mon, 25 Jun 2012 21:52:48 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 25 Jun 2012 21:52:47 +0000 Date: Mon, 25 Jun 2012 21:52:47 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120625215248.02ED7106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r238288 - in soc2012/jhagewood/diff: . diff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 21:52:50 -0000 Author: jhagewood Date: Mon Jun 25 21:52:47 2012 New Revision: 238288 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238288 Log: Modified: soc2012/jhagewood/diff/diff/diff.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/diff/diff.c ============================================================================== --- soc2012/jhagewood/diff/diff/diff.c Mon Jun 25 21:33:17 2012 (r238287) +++ soc2012/jhagewood/diff/diff/diff.c Mon Jun 25 21:52:47 2012 (r238288) @@ -312,7 +312,7 @@ format = D_NORMAL; break; case OPT_SUPCL: - suppress_cl = 1; + /* Do nothing, passes option to sdiff. */ break; case OPT_TSIZE: if (optarg != NULL) { Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Mon Jun 25 21:33:17 2012 (r238287) +++ soc2012/jhagewood/diff/hagewood-diff.patch Mon Jun 25 21:52:47 2012 (r238288) @@ -1,6 +1,6 @@ diff -rupN jhagewood/diff/diff-orig/diff.c jhagewood/diff/diff/diff.c --- jhagewood/diff/diff-orig/diff.c 2012-06-25 16:05:53.000000000 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-25 16:05:53.000000000 -0400 ++++ jhagewood/diff/diff/diff.c 2012-06-25 21:52:27.000000000 -0400 @@ -1,4 +1,4 @@ -/*- +/* @@ -229,7 +229,7 @@ + format = D_NORMAL; + break; + case OPT_SUPCL: -+ suppress_cl = 1; ++ /* Do nothing, passes option to sdiff. */ + break; case OPT_TSIZE: - if (optarg != NULL) { From owner-svn-soc-all@FreeBSD.ORG Mon Jun 25 21:53:45 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 20E7A106566B for ; Mon, 25 Jun 2012 21:53:44 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 25 Jun 2012 21:53:44 +0000 Date: Mon, 25 Jun 2012 21:53:44 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120625215344.20E7A106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238289 - soc2012/jhagewood/diff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 21:53:45 -0000 Author: jhagewood Date: Mon Jun 25 21:53:43 2012 New Revision: 238289 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238289 Log: Modified: soc2012/jhagewood/diff/TODO Modified: soc2012/jhagewood/diff/TODO ============================================================================== --- soc2012/jhagewood/diff/TODO Mon Jun 25 21:52:47 2012 (r238288) +++ soc2012/jhagewood/diff/TODO Mon Jun 25 21:53:43 2012 (r238289) @@ -7,7 +7,7 @@ --show-function-line INCOMPLETE --unidirectional-new-file INCOMPLETE --normal COMPLETE Sets format to D_NORMAL in getopt_long(). ---suppress-common-lines IN PROGRESS +--suppress-common-lines COMPLETE Because side-by-side mode is executed by sdiff, option is simply passed to sdiff. --GTYPE-group-format INCOMPLETE --line-format IN PROGRESS Added new-line-format, old-line-format, and unchanged-line-format for compatibility --LTYPE-line-format INCOMPLETE From owner-svn-soc-all@FreeBSD.ORG Mon Jun 25 22:18:58 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 811B8106566C for ; Mon, 25 Jun 2012 22:18:56 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 25 Jun 2012 22:18:56 +0000 Date: Mon, 25 Jun 2012 22:18:56 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120625221856.811B8106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r238293 - in soc2012/jhagewood/diff: . diff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 22:18:58 -0000 Author: jhagewood Date: Mon Jun 25 22:18:55 2012 New Revision: 238293 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238293 Log: Modified: soc2012/jhagewood/diff/TODO soc2012/jhagewood/diff/diff/diff.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/TODO ============================================================================== --- soc2012/jhagewood/diff/TODO Mon Jun 25 21:56:36 2012 (r238292) +++ soc2012/jhagewood/diff/TODO Mon Jun 25 22:18:55 2012 (r238293) @@ -3,7 +3,7 @@ --unified GNU compatibility COMPLETE Fixed timestamp. --context GNU compatibility COMPLETE Fixed timestamp, will test more. --ignore-blank-lines IN PROGRESS Was already implemented in check(), but has weird outputs. ---left-column INCOMPLETE +--left-column COMPLETE Because side-by-side mode is executed by sdiff, option is simply passed to sdiff. --show-function-line INCOMPLETE --unidirectional-new-file INCOMPLETE --normal COMPLETE Sets format to D_NORMAL in getopt_long(). Modified: soc2012/jhagewood/diff/diff/diff.c ============================================================================== --- soc2012/jhagewood/diff/diff/diff.c Mon Jun 25 21:56:36 2012 (r238292) +++ soc2012/jhagewood/diff/diff/diff.c Mon Jun 25 22:18:55 2012 (r238293) @@ -110,7 +110,7 @@ { "ignore-tab-expansion", no_argument, NULL, 'E' }, { "initial-tab", no_argument, NULL, 'T' }, { "label", required_argument, NULL, 'L' }, - /*{ "left-column", no_argument, NULL, OPT_LEFTC },*/ + { "left-column", no_argument, NULL, OPT_LEFTC }, { "line-format", required_argument, NULL, OPT_LF }, /*{ "LTYPE-line-format", required_argument, NULL, OPT_LLF },*/ { "minimal", no_argument, NULL, 'd' }, @@ -311,6 +311,9 @@ case OPT_NORMAL: format = D_NORMAL; break; + case OPT_LEFTC: + /* Do nothing, passes option to sdiff. */ + break; case OPT_SUPCL: /* Do nothing, passes option to sdiff. */ break; Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Mon Jun 25 21:56:36 2012 (r238292) +++ soc2012/jhagewood/diff/hagewood-diff.patch Mon Jun 25 22:18:55 2012 (r238293) @@ -1,6 +1,6 @@ diff -rupN jhagewood/diff/diff-orig/diff.c jhagewood/diff/diff/diff.c --- jhagewood/diff/diff-orig/diff.c 2012-06-25 16:05:53.000000000 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-25 21:52:27.000000000 -0400 ++++ jhagewood/diff/diff/diff.c 2012-06-25 22:18:49.000000000 -0400 @@ -1,4 +1,4 @@ -/*- +/* @@ -135,7 +135,7 @@ + { "initial-tab", no_argument, NULL, 'T' }, { "label", required_argument, NULL, 'L' }, - { "paginate", no_argument, NULL, 'l' }, -+ /*{ "left-column", no_argument, NULL, OPT_LEFTC },*/ ++ { "left-column", no_argument, NULL, OPT_LEFTC }, + { "line-format", required_argument, NULL, OPT_LF }, + /*{ "LTYPE-line-format", required_argument, NULL, OPT_LLF },*/ + { "minimal", no_argument, NULL, 'd' }, @@ -213,7 +213,7 @@ case 'e': format = D_EDIT; break; -@@ -296,15 +300,29 @@ main(int argc, char **argv) +@@ -296,15 +300,32 @@ main(int argc, char **argv) case 'y': yflag = 1; break; @@ -228,6 +228,9 @@ + case OPT_NORMAL: + format = D_NORMAL; + break; ++ case OPT_LEFTC: ++ /* Do nothing, passes option to sdiff. */ ++ break; + case OPT_SUPCL: + /* Do nothing, passes option to sdiff. */ + break; @@ -251,7 +254,7 @@ case OPT_STRIPCR: strip_cr=1; break; -@@ -332,16 +350,15 @@ main(int argc, char **argv) +@@ -332,16 +353,15 @@ main(int argc, char **argv) argc -= optind; argv += optind; @@ -271,7 +274,7 @@ execv(_PATH_SDIFF, oargv); _exit(127); } -@@ -380,7 +397,10 @@ main(int argc, char **argv) +@@ -380,7 +400,10 @@ main(int argc, char **argv) set_argstr(oargv, argv); if (S_ISDIR(stb1.st_mode) && S_ISDIR(stb2.st_mode)) { if (format == D_IFDEF) @@ -283,7 +286,7 @@ diffdir(argv[0], argv[1]); } else { if (S_ISDIR(stb1.st_mode)) { -@@ -402,11 +422,10 @@ main(int argc, char **argv) +@@ -402,11 +425,10 @@ main(int argc, char **argv) void * emalloc(size_t n) { @@ -296,7 +299,7 @@ if ((p = malloc(n)) == NULL) errx(2, NULL); return (p); -@@ -415,7 +434,7 @@ emalloc(size_t n) +@@ -415,7 +437,7 @@ emalloc(size_t n) void * erealloc(void *p, size_t n) { @@ -305,7 +308,7 @@ if (n == 0) errx(2, NULL); -@@ -431,13 +450,12 @@ erealloc(void *p, size_t n) +@@ -431,13 +453,12 @@ erealloc(void *p, size_t n) int easprintf(char **ret, const char *fmt, ...) { @@ -321,7 +324,7 @@ if (len < 0 || *ret == NULL) errx(2, NULL); return (len); -@@ -446,11 +464,12 @@ easprintf(char **ret, const char *fmt, . +@@ -446,11 +467,12 @@ easprintf(char **ret, const char *fmt, . char * estrdup(const char *str) { @@ -336,7 +339,7 @@ strlcpy(cp, str, len); return (cp); } -@@ -531,6 +550,7 @@ push_ignore_pats(char *pattern) +@@ -531,6 +553,7 @@ push_ignore_pats(char *pattern) void print_only(const char *path, size_t dirlen, const char *entry) { @@ -344,7 +347,7 @@ if (dirlen > 1) dirlen--; printf("Only in %.*s: %s\n", (int)dirlen, path, entry); -@@ -539,45 +559,46 @@ print_only(const char *path, size_t dirl +@@ -539,45 +562,46 @@ print_only(const char *path, size_t dirl void print_status(int val, char *path1, char *path2, char *entry) { @@ -402,7 +405,7 @@ break; } } -@@ -585,6 +606,7 @@ print_status(int val, char *path1, char +@@ -585,6 +609,7 @@ print_status(int val, char *path1, char void usage(void) { From owner-svn-soc-all@FreeBSD.ORG Mon Jun 25 22:22:14 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id B2054106566C for ; Mon, 25 Jun 2012 22:22:12 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 25 Jun 2012 22:22:12 +0000 Date: Mon, 25 Jun 2012 22:22:12 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120625222212.B2054106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r238294 - soc2012/jhagewood/diff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 22:22:15 -0000 Author: jhagewood Date: Mon Jun 25 22:22:12 2012 New Revision: 238294 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238294 Log: Modified: soc2012/jhagewood/diff/TODO Modified: soc2012/jhagewood/diff/TODO ============================================================================== --- soc2012/jhagewood/diff/TODO Mon Jun 25 22:18:55 2012 (r238293) +++ soc2012/jhagewood/diff/TODO Mon Jun 25 22:22:12 2012 (r238294) @@ -13,7 +13,7 @@ --LTYPE-line-format INCOMPLETE --from-file INCOMPLETE --to-file INCOMPLETE ---horizontal-lines INCOMPLETE +--horizon-lines INCOMPLETE --speed-large-file INCOMPLETE --ignore-tab-expansion IN PROGRESS Functionality implemented in check(), needs debugging. (Same problem as --ignore-blank-lines?) --width INCOMPLETE From owner-svn-soc-all@FreeBSD.ORG Mon Jun 25 22:46:53 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 52E6A1065670 for ; Mon, 25 Jun 2012 22:46:51 +0000 (UTC) (envelope-from syuu@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 25 Jun 2012 22:46:51 +0000 Date: Mon, 25 Jun 2012 22:46:51 +0000 From: syuu@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120625224651.52E6A1065670@hub.freebsd.org> Cc: Subject: socsvn commit: r238295 - soc2012/syuu/bhyve-bios/sys/amd64/vmm/intel X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 22:46:53 -0000 Author: syuu Date: Mon Jun 25 22:46:50 2012 New Revision: 238295 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238295 Log: if in unrestricted guest mode, unset EFER/LMA flag on entry_ctls Modified: soc2012/syuu/bhyve-bios/sys/amd64/vmm/intel/vmx.c Modified: soc2012/syuu/bhyve-bios/sys/amd64/vmm/intel/vmx.c ============================================================================== --- soc2012/syuu/bhyve-bios/sys/amd64/vmm/intel/vmx.c Mon Jun 25 22:22:12 2012 (r238294) +++ soc2012/syuu/bhyve-bios/sys/amd64/vmm/intel/vmx.c Mon Jun 25 22:46:50 2012 (r238295) @@ -1189,6 +1189,9 @@ vmexit->exitcode = VM_EXITCODE_PAGING; vmexit->u.paging.cr3 = vmcs_guest_cr3(); break; + case EXIT_REASON_VMCALL: + vmexit->exitcode = VM_EXITCODE_VMCALL; + break; default: break; } @@ -1652,10 +1655,22 @@ break; case VM_CAP_UNRESTRICTED_GUEST: if (cap_unrestricted_guest) { + uint64_t ctls; + retval = 0; baseval = procbased_ctls2; flag = PROCBASED2_UNRESTRICTED_GUEST; reg = VMCS_SEC_PROC_BASED_CTLS; + error = vmcs_getreg(vmcs, + VMCS_IDENT(VMCS_ENTRY_CTLS), &ctls); + if (error == 0) { + ctls &= ~(VM_ENTRY_LOAD_EFER | VM_ENTRY_GUEST_LMA); + vmcs_setreg(vmcs, + VMCS_IDENT(VMCS_ENTRY_CTLS), ctls); + }else{ + printf("%s vmcs_getreg returns %d\n", + __func__, error); + } } break; default: From owner-svn-soc-all@FreeBSD.ORG Mon Jun 25 23:05:04 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id AFCC11065675 for ; Mon, 25 Jun 2012 23:05:03 +0000 (UTC) (envelope-from syuu@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 25 Jun 2012 23:05:03 +0000 Date: Mon, 25 Jun 2012 23:05:03 +0000 From: syuu@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120625230503.AFCC11065675@hub.freebsd.org> Cc: Subject: socsvn commit: r238303 - soc2012/syuu/bhyve-bios/usr.sbin/bhyvebiosload X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 23:05:04 -0000 Author: syuu Date: Mon Jun 25 23:05:03 2012 New Revision: 238303 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238303 Log: remove unnecessary codes, set entry point to 0x0 temporarily Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyvebiosload/bhyvebiosload.c Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyvebiosload/bhyvebiosload.c ============================================================================== --- soc2012/syuu/bhyve-bios/usr.sbin/bhyvebiosload/bhyvebiosload.c Mon Jun 25 22:39:37 2012 (r238302) +++ soc2012/syuu/bhyve-bios/usr.sbin/bhyvebiosload/bhyvebiosload.c Mon Jun 25 23:05:03 2012 (r238303) @@ -91,45 +91,9 @@ static uint64_t lowmem, highmem; static struct vmctx *ctx; -static uint64_t gdtbase, cr3, rsp; - static void cb_exit(void *arg, int v); /* - * Console i/o callbacks - */ - -#if 0 -static void -cb_putc(void *arg, int ch) -{ - char c = ch; - - write(1, &c, 1); -} - -static int -cb_getc(void *arg) -{ - char c; - - if (read(0, &c, 1) == 1) - return (c); - return (-1); -} - -static int -cb_poll(void *arg) -{ - int n; - - if (ioctl(0, FIONREAD, &n) >= 0) - return (n > 0); - return (0); -} -#endif - -/* * Host filesystem i/o callbacks */ @@ -200,16 +164,6 @@ return (0); } -#if 0 -static int -cb_isdir(void *arg, void *h) -{ - struct cb_file *cf = h; - - return (cf->cf_isdir); -} -#endif - static int cb_read(void *arg, void *h, void *buf, size_t size, size_t *resid) { @@ -225,78 +179,6 @@ return (0); } -#if 0 -static int -cb_readdir(void *arg, void *h, uint32_t *fileno_return, uint8_t *type_return, - size_t *namelen_return, char *name) -{ - struct cb_file *cf = h; - struct dirent *dp; - - if (!cf->cf_isdir) - return (EINVAL); - - dp = readdir(cf->cf_u.dir); - if (!dp) - return (ENOENT); - - /* - * Note: d_namlen is in the range 0..255 and therefore less - * than PATH_MAX so we don't need to test before copying. - */ - *fileno_return = dp->d_fileno; - *type_return = dp->d_type; - *namelen_return = dp->d_namlen; - memcpy(name, dp->d_name, dp->d_namlen); - name[dp->d_namlen] = 0; - - return (0); -} - -static int -cb_seek(void *arg, void *h, uint64_t offset, int whence) -{ - struct cb_file *cf = h; - - if (cf->cf_isdir) - return (EINVAL); - if (lseek(cf->cf_u.fd, offset, whence) < 0) - return (errno); - return (0); -} - -static int -cb_stat(void *arg, void *h, int *mode, int *uid, int *gid, uint64_t *size) -{ - struct cb_file *cf = h; - - *mode = cf->cf_stat.st_mode; - *uid = cf->cf_stat.st_uid; - *gid = cf->cf_stat.st_gid; - *size = cf->cf_stat.st_size; - return (0); -} - -/* - * Disk image i/o callbacks - */ - -static int -cb_diskread(void *arg, int unit, uint64_t from, void *to, size_t size, - size_t *resid) -{ - ssize_t n; - - if (unit != 0 || disk_fd == -1) - return (EIO); - n = pread(disk_fd, to, size, from); - if (n < 0) - return (errno); - *resid = size - n; - return (0); -} -#endif - /* * Guest virtual machine i/o callbacks */ @@ -315,135 +197,12 @@ return (0); } -#if 0 -static int -cb_copyout(void *arg, uint64_t from, void *to, size_t size) -{ - - from &= 0x7fffffff; - if (from > lowmem) - return (EFAULT); - if (from + size > lowmem) - size = lowmem - from; - - memcpy(to, &membase[from], size); - - return (0); -} - -static void -cb_setreg(void *arg, int r, uint64_t v) -{ - int error; - enum vm_reg_name vmreg; - - vmreg = VM_REG_LAST; - - switch (r) { - case 4: - vmreg = VM_REG_GUEST_RSP; - rsp = v; - break; - default: - break; - } - - if (vmreg == VM_REG_LAST) { - printf("test_setreg(%d): not implemented\n", r); - cb_exit(NULL, USERBOOT_EXIT_QUIT); - } - - error = vm_set_register(ctx, BSP, vmreg, v); - if (error) { - perror("vm_set_register"); - cb_exit(NULL, USERBOOT_EXIT_QUIT); - } -} - -static void -cb_setmsr(void *arg, int r, uint64_t v) -{ - int error; - enum vm_reg_name vmreg; - - vmreg = VM_REG_LAST; - - switch (r) { - case MSR_EFER: - vmreg = VM_REG_GUEST_EFER; - break; - default: - break; - } - - if (vmreg == VM_REG_LAST) { - printf("test_setmsr(%d): not implemented\n", r); - cb_exit(NULL, USERBOOT_EXIT_QUIT); - } - - error = vm_set_register(ctx, BSP, vmreg, v); - if (error) { - perror("vm_set_msr"); - cb_exit(NULL, USERBOOT_EXIT_QUIT); - } -} - -static void -cb_setcr(void *arg, int r, uint64_t v) -{ - int error; - enum vm_reg_name vmreg; - - vmreg = VM_REG_LAST; - - switch (r) { - case 0: - vmreg = VM_REG_GUEST_CR0; - break; - case 3: - vmreg = VM_REG_GUEST_CR3; - cr3 = v; - break; - case 4: - vmreg = VM_REG_GUEST_CR4; - break; - default: - break; - } - - if (vmreg == VM_REG_LAST) { - printf("test_setcr(%d): not implemented\n", r); - cb_exit(NULL, USERBOOT_EXIT_QUIT); - } - - error = vm_set_register(ctx, BSP, vmreg, v); - if (error) { - perror("vm_set_cr"); - cb_exit(NULL, USERBOOT_EXIT_QUIT); - } -} -#endif - -static void -cb_setgdt(void *arg, uint64_t base, size_t size) -{ - int error; - - error = vm_set_desc(ctx, BSP, VM_REG_GUEST_GDTR, base, size - 1, 0); - if (error != 0) { - perror("vm_set_desc(gdt)"); - cb_exit(NULL, USERBOOT_EXIT_QUIT); - } - - gdtbase = base; -} - static void cb_exec(void *arg, uint64_t rip) { int error; - error = vm_setup_bios_registers(ctx, BSP, rip, cr3, gdtbase, rsp); + error = vm_setup_bios_registers(ctx, BSP); if (error) { perror("vm_setup_freebsd_registers"); cb_exit(NULL, USERBOOT_EXIT_QUIT); @@ -452,19 +211,6 @@ cb_exit(NULL, 0); } -#if 0 -/* - * Misc - */ - -static void -cb_delay(void *arg, int usec) -{ - - usleep(usec); -} -#endif - static void cb_exit(void *arg, int v) { @@ -473,44 +219,6 @@ exit(v); } -#if 0 -static void -cb_getmem(void *arg, uint64_t *ret_lowmem, uint64_t *ret_highmem) -{ - - *ret_lowmem = lowmem; - *ret_highmem = highmem; -} - -static struct loader_callbacks_v1 cb = { - .getc = cb_getc, - .putc = cb_putc, - .poll = cb_poll, - - .open = cb_open, - .close = cb_close, - .isdir = cb_isdir, - .read = cb_read, - .readdir = cb_readdir, - .seek = cb_seek, - .stat = cb_stat, - - .diskread = cb_diskread, - - .copyin = cb_copyin, - .copyout = cb_copyout, - .setreg = cb_setreg, - .setmsr = cb_setmsr, - .setcr = cb_setcr, - .setgdt = cb_setgdt, - .exec = cb_exec, - - .delay = cb_delay, - .exit = cb_exit, - .getmem = cb_getmem, -}; -#endif - static void usage(void) { @@ -530,7 +238,6 @@ struct cb_file *cf; char *buf; size_t res; - uint64_t gdtr[3]; progname = argv[0]; @@ -616,11 +323,11 @@ fprintf(stderr, "cb_read\n"); return (1); } +#if 0 + cb_copyin(NULL, buf, 0xFFFFFFF0, 3); +#endif cb_copyin(NULL, buf, 0x0, 3); cb_close(NULL, cf); - vm_setup_bios_gdt(gdtr); - cb_copyin(NULL, gdtr, 0x5000, sizeof(gdtr)); - cb_setgdt(NULL, 0x5000, sizeof(gdtr)); - cb_exec(NULL, 0x0); + cb_exec(NULL, 0); return (0); } From owner-svn-soc-all@FreeBSD.ORG Mon Jun 25 23:08:37 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 990D41065672 for ; Mon, 25 Jun 2012 23:08:35 +0000 (UTC) (envelope-from syuu@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 25 Jun 2012 23:08:35 +0000 Date: Mon, 25 Jun 2012 23:08:35 +0000 From: syuu@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120625230835.990D41065672@hub.freebsd.org> Cc: Subject: socsvn commit: r238304 - soc2012/syuu/bhyve-bios/lib/libvmmapi X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 23:08:37 -0000 Author: syuu Date: Mon Jun 25 23:08:35 2012 New Revision: 238304 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238304 Log: remove unnecessary codes, set entry point to 0x0 temporarily, set up registers as initial value of PC startup(referencing Intel SDM vol.3 section 9.1) Modified: soc2012/syuu/bhyve-bios/lib/libvmmapi/vmmapi.h soc2012/syuu/bhyve-bios/lib/libvmmapi/vmmapi_bios.c Modified: soc2012/syuu/bhyve-bios/lib/libvmmapi/vmmapi.h ============================================================================== --- soc2012/syuu/bhyve-bios/lib/libvmmapi/vmmapi.h Mon Jun 25 23:05:03 2012 (r238303) +++ soc2012/syuu/bhyve-bios/lib/libvmmapi/vmmapi.h Mon Jun 25 23:08:35 2012 (r238304) @@ -101,8 +101,5 @@ /* * BIOS boot specific APIs */ -int vm_setup_bios_registers(struct vmctx *ctx, int vcpu, - uint64_t rip, uint64_t cr3, uint64_t gdtbase, - uint64_t rsp); -void vm_setup_bios_gdt(uint64_t *gdtr); +int vm_setup_bios_registers(struct vmctx *ctx, int vcpu); #endif /* _VMMAPI_H_ */ Modified: soc2012/syuu/bhyve-bios/lib/libvmmapi/vmmapi_bios.c ============================================================================== --- soc2012/syuu/bhyve-bios/lib/libvmmapi/vmmapi_bios.c Mon Jun 25 23:05:03 2012 (r238303) +++ soc2012/syuu/bhyve-bios/lib/libvmmapi/vmmapi_bios.c Mon Jun 25 23:08:35 2012 (r238304) @@ -37,145 +37,189 @@ #include "vmmapi.h" -#ifndef CR4_VMXE -#define CR4_VMXE (1UL << 13) -#endif - -#define DESC_UNUSABLE 0x00010000 - -#define GUEST_NULL_SEL 0 -#define GUEST_CODE_SEL 1 -#define GUEST_DATA_SEL 2 -#define GUEST_GDTR_LIMIT (3 * 8 - 1) - -void -vm_setup_bios_gdt(uint64_t *gdtr) -{ - gdtr[GUEST_NULL_SEL] = 0; - gdtr[GUEST_CODE_SEL] = 0x0020980000000000; - gdtr[GUEST_DATA_SEL] = 0x0000900000000000; -} - /* * Setup the 'vcpu' register set such that it will begin execution at * 'rip' in long mode. */ int -vm_setup_bios_registers(struct vmctx *vmctx, int vcpu, - uint64_t rip, uint64_t cr3, uint64_t gdtbase, - uint64_t rsp) +vm_setup_bios_registers(struct vmctx *vmctx, int vcpu) { int error; - uint64_t cr0, cr4, efer, rflags, desc_base; + uint64_t rip, cr0, cr3, cr4, efer, rflags, rax, rbx, rcx, rdx; + uint64_t rsi, rdi, rbp, rsp, desc_base; uint32_t desc_access, desc_limit; + uint16_t gsel; - cr0 = CR0_NE; +#if 0 + rip = 0xfff0; +#endif + rip = 0x0; + if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_RIP, rip)) != 0) + goto done; + + rflags = 0x2; + if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_RFLAGS, rflags)) != 0) + goto done; + + cr0 = 0x60000010; if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_CR0, cr0)) != 0) goto done; + cr3 = 0; + if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_CR3, cr3)) != 0) + goto done; + cr4 = 0; if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_CR4, cr4)) != 0) goto done; - efer = 0; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_EFER, efer))) +#if 0 + desc_base = 0xffff0000; +#endif + desc_base = 0x0; + desc_limit = 0xffff; + /* PRESENT | DESC_TYPE_CODEDATA | SEG_TYPE_DATA_RW_ACCESSED */ + desc_access = 0x00000093; + error = vm_set_desc(vmctx, vcpu, VM_REG_GUEST_CS, + desc_base, desc_limit, desc_access); + if (error) goto done; - rflags = 0x2; - error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_RFLAGS, rflags); - if (error) +#if 0 + gsel = 0xf000; +#endif + gsel = 0x0; + if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_CS, gsel)) != 0) goto done; - desc_base = 0; - desc_limit = 0; - desc_access = 0x0000209B; - error = vm_set_desc(vmctx, vcpu, VM_REG_GUEST_CS, + desc_base = 0x0; + desc_limit = 0xffff; + /* PRESENT | DESC_TYPE_CODEDATA | SEG_TYPE_DATA_RW_ACCESSED */ + desc_access = 0x00000093; + error = vm_set_desc(vmctx, vcpu, VM_REG_GUEST_SS, desc_base, desc_limit, desc_access); if (error) goto done; - desc_access = 0x00000093; + gsel = 0x0; + if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_SS, gsel)) != 0) + goto done; + + /* same as SS */ error = vm_set_desc(vmctx, vcpu, VM_REG_GUEST_DS, desc_base, desc_limit, desc_access); if (error) goto done; + /* same as SS */ + if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_DS, gsel)) != 0) + goto done; + + /* same as SS */ error = vm_set_desc(vmctx, vcpu, VM_REG_GUEST_ES, desc_base, desc_limit, desc_access); if (error) goto done; + /* same as SS */ + if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_ES, gsel)) != 0) + goto done; + + /* same as SS */ error = vm_set_desc(vmctx, vcpu, VM_REG_GUEST_FS, desc_base, desc_limit, desc_access); if (error) goto done; + /* same as SS */ + if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_FS, gsel)) != 0) + goto done; + + /* same as SS */ error = vm_set_desc(vmctx, vcpu, VM_REG_GUEST_GS, desc_base, desc_limit, desc_access); if (error) goto done; - error = vm_set_desc(vmctx, vcpu, VM_REG_GUEST_SS, - desc_base, desc_limit, desc_access); - if (error) + /* same as SS */ + if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_GS, gsel)) != 0) goto done; - /* - * XXX TR is pointing to null selector even though we set the - * TSS segment to be usable with a base address and limit of 0. - */ - desc_access = 0x0000008b; - error = vm_set_desc(vmctx, vcpu, VM_REG_GUEST_TR, 0, 0, desc_access); - if (error) + rdx = 0xf00; + if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_RDX, rdx)) != 0) goto done; - error = vm_set_desc(vmctx, vcpu, VM_REG_GUEST_LDTR, 0, 0, - DESC_UNUSABLE); - if (error) + rax = 0x0; + if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_RAX, rax)) != 0) goto done; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_CS, 0)) != 0) + rbx = 0x0; + if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_RBX, rbx)) != 0) goto done; - - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_DS, 0)) != 0) + + rcx = 0x0; + if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_RCX, rcx)) != 0) goto done; - - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_ES, 0)) != 0) + + rsi = 0; + if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_RSI, rsi)) != 0) goto done; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_FS, 0)) != 0) + rdi = 0; + if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_RDI, rdi)) != 0) goto done; - - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_GS, 0)) != 0) + + rbp = 0; + if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_RBP, rbp)) != 0) goto done; - - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_SS, 0)) != 0) + + rsp = 0; + if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_RSP, rsp)) != 0) goto done; - /* XXX TR is pointing to the null selector */ - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_TR, 0)) != 0) + desc_base = 0x0; + desc_limit = 0xffff; + /* PRESENT | DESC_TYPE_CODEDATA | SEG_TYPE_DATA_RW */ + desc_access = 0x00000092; + error = vm_set_desc(vmctx, vcpu, VM_REG_GUEST_GDTR, + desc_base, desc_limit, desc_access); + if (error != 0) goto done; - /* LDTR is pointing to the null selector */ - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_LDTR, 0)) != 0) + /* same as GDTR */ + error = vm_set_desc(vmctx, vcpu, VM_REG_GUEST_IDTR, + desc_base, desc_limit, desc_access); + if (error != 0) goto done; - /* entry point */ - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_RIP, rip)) != 0) + desc_base = 0x0; + desc_limit = 0xffff; + /* PRESENT | SEG_TYPE_16BIT_BUSY_TSS */ + desc_access = 0x00000083; + error = vm_set_desc(vmctx, vcpu, VM_REG_GUEST_TR, + desc_base, desc_limit, desc_access); + if (error) goto done; - /* page table base */ - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_CR3, 0)) != 0) + gsel = 0x0; + if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_TR, gsel)) != 0) goto done; - desc_base = gdtbase; - desc_limit = GUEST_GDTR_LIMIT; - error = vm_set_desc(vmctx, vcpu, VM_REG_GUEST_GDTR, - desc_base, desc_limit, 0); - if (error != 0) + desc_base = 0x0; + desc_limit = 0xffff; + /* PRESENT | SEG_TYPE_LDT */ + desc_access = 0x00000082; + error = vm_set_desc(vmctx, vcpu, VM_REG_GUEST_LDTR, + desc_base, desc_limit, desc_access); + if (error) goto done; - if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_RSP, rsp)) != 0) + /* same as TR */ + if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_LDTR, gsel)) != 0) + goto done; + + efer = 0x9; + if ((error = vm_set_register(vmctx, vcpu, VM_REG_GUEST_EFER, efer)) != 0) goto done; error = 0; From owner-svn-soc-all@FreeBSD.ORG Mon Jun 25 23:09:27 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 2EB4E106566C for ; Mon, 25 Jun 2012 23:09:25 +0000 (UTC) (envelope-from syuu@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Mon, 25 Jun 2012 23:09:25 +0000 Date: Mon, 25 Jun 2012 23:09:25 +0000 From: syuu@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120625230925.2EB4E106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r238305 - soc2012/syuu/bhyve-bios/sys/amd64/include X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 23:09:27 -0000 Author: syuu Date: Mon Jun 25 23:09:24 2012 New Revision: 238305 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238305 Log: add VMCALL handler Modified: soc2012/syuu/bhyve-bios/sys/amd64/include/vmm.h Modified: soc2012/syuu/bhyve-bios/sys/amd64/include/vmm.h ============================================================================== --- soc2012/syuu/bhyve-bios/sys/amd64/include/vmm.h Mon Jun 25 23:08:35 2012 (r238304) +++ soc2012/syuu/bhyve-bios/sys/amd64/include/vmm.h Mon Jun 25 23:09:24 2012 (r238305) @@ -228,6 +228,7 @@ VM_EXITCODE_MTRAP, VM_EXITCODE_PAUSE, VM_EXITCODE_PAGING, + VM_EXITCODE_VMCALL, VM_EXITCODE_MAX }; From owner-svn-soc-all@FreeBSD.ORG Tue Jun 26 00:39:54 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 224DA106568E for ; Tue, 26 Jun 2012 00:39:52 +0000 (UTC) (envelope-from exxo@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 26 Jun 2012 00:39:51 +0000 Date: Tue, 26 Jun 2012 00:39:51 +0000 From: exxo@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120626003952.224DA106568E@hub.freebsd.org> Cc: Subject: socsvn commit: r238311 - in soc2012/exxo/openssl-1.0.1c: . apps crypto/bio crypto/err X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 00:39:54 -0000 Author: exxo Date: Tue Jun 26 00:39:50 2012 New Revision: 238311 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238311 Log: BIO API fully migrated except the connection state machine. s_client and s_server fixed. Modified: soc2012/exxo/openssl-1.0.1c/Configure soc2012/exxo/openssl-1.0.1c/Makefile soc2012/exxo/openssl-1.0.1c/Makefile.bak soc2012/exxo/openssl-1.0.1c/apps/s_apps.h soc2012/exxo/openssl-1.0.1c/apps/s_client.c soc2012/exxo/openssl-1.0.1c/apps/s_server.c soc2012/exxo/openssl-1.0.1c/apps/s_socket.c soc2012/exxo/openssl-1.0.1c/crypto/bio/b_sock.c soc2012/exxo/openssl-1.0.1c/crypto/bio/bio.h soc2012/exxo/openssl-1.0.1c/crypto/bio/bio_err.c soc2012/exxo/openssl-1.0.1c/crypto/bio/bss_dgram.c soc2012/exxo/openssl-1.0.1c/crypto/err/err.c soc2012/exxo/openssl-1.0.1c/crypto/err/err.h Modified: soc2012/exxo/openssl-1.0.1c/Configure ============================================================================== --- soc2012/exxo/openssl-1.0.1c/Configure Mon Jun 25 23:40:58 2012 (r238310) +++ soc2012/exxo/openssl-1.0.1c/Configure Tue Jun 26 00:39:50 2012 (r238311) @@ -168,8 +168,8 @@ "purify", "purify gcc:-g -DPURIFY -Wall::(unknown)::-lsocket -lnsl::::", "debug", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -ggdb -g2 -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror::(unknown)::-lefence::::", "debug-ben", "gcc:$gcc_devteam_warn -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DDEBUG_SAFESTACK -O2 -pipe::(unknown):::::", -"debug-ben-openbsd","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::", -"debug-ben-openbsd-debug","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::", +"debug-ben-openbsd","gcc:-DHAVE_SIN_LEN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::", +"debug-ben-openbsd-debug","gcc:-DHAVE_SIN_LEN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::", "debug-ben-debug", "gcc44:$gcc_devteam_warn -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -g3 -O2 -pipe::(unknown)::::::", "debug-ben-macos", "cc:$gcc_devteam_warn -arch i386 -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -DL_ENDIAN -g3 -pipe::(unknown)::-Wl,-search_paths_first::::", "debug-ben-macos-gcc46", "gcc-mp-4.6:$gcc_devteam_warn -Wconversion -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -DL_ENDIAN -g3 -pipe::(unknown)::::::", @@ -407,21 +407,21 @@ "android-armv7","gcc:-march=armv7-a -mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${armv4_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", #### *BSD [do see comment about ${BSDthreads} above!] -"BSD-generic32","gcc:-DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", -"BSD-x86", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", -"BSD-x86-elf", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", -"debug-BSD-x86-elf", "gcc:-DL_ENDIAN -DTERMIOS -O3 -Wall -g::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", -"BSD-sparcv8", "gcc:-DB_ENDIAN -DTERMIOS -O3 -mv8 -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${sparcv8_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +"BSD-generic32","gcc:-DHAVE_SIN_LEN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +"BSD-x86", "gcc:-DHAVE_SIN_LEN -DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +"BSD-x86-elf", "gcc:-DHAVE_SIN_LEN -DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +"debug-BSD-x86-elf", "gcc:-DHAVE_SIN_LEN -DL_ENDIAN -DTERMIOS -O3 -Wall -g::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +"BSD-sparcv8", "gcc:-DHAVE_SIN_LEN -DB_ENDIAN -DTERMIOS -O3 -mv8 -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${sparcv8_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", -"BSD-generic64","gcc:-DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +"BSD-generic64","gcc:-DHAVE_SIN_LEN -DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", # -DMD32_REG_T=int doesn't actually belong in sparc64 target, it # simply *happens* to work around a compiler bug in gcc 3.3.3, # triggered by RIPEMD160 code. -"BSD-sparc64", "gcc:-DB_ENDIAN -DTERMIOS -O3 -DMD32_REG_T=int -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC2 BF_PTR:${sparcv9_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", -"BSD-ia64", "gcc:-DL_ENDIAN -DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_INT:${ia64_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", -"BSD-x86_64", "gcc:-DL_ENDIAN -DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +"BSD-sparc64", "gcc:-DHAVE_SIN_LEN -DB_ENDIAN -DTERMIOS -O3 -DMD32_REG_T=int -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC2 BF_PTR:${sparcv9_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +"BSD-ia64", "gcc:-DHAVE_SIN_LEN -DL_ENDIAN -DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_INT:${ia64_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +"BSD-x86_64", "gcc:-DHAVE_SIN_LEN -DL_ENDIAN -DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", -"bsdi-elf-gcc", "gcc:-DPERL5 -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall::(unknown)::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +"bsdi-elf-gcc", "gcc:-DHAVE_SIN_LEN -DPERL5 -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall::(unknown)::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", "nextstep", "cc:-O -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::", "nextstep3.3", "cc:-O3 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::", @@ -574,13 +574,13 @@ ##"ultrix","cc:-O2 -DNOPROTO -DNOCONST -DL_ENDIAN::(unknown):::::::", ##### MacOS X (a.k.a. Rhapsody or Darwin) setup -"rhapsody-ppc-cc","cc:-O3 -DB_ENDIAN::(unknown):MACOSX_RHAPSODY::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}::", -"darwin-ppc-cc","cc:-arch ppc -O3 -DB_ENDIAN -Wa,-force_cpusubtype_ALL::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", -"darwin64-ppc-cc","cc:-arch ppc64 -O3 -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc64_asm}:osx64:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", -"darwin-i386-cc","cc:-arch i386 -O3 -fomit-frame-pointer -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:".eval{my $asm=$x86_asm;$asm=~s/cast\-586\.o//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", -"debug-darwin-i386-cc","cc:-arch i386 -g3 -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:${x86_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", -"darwin64-x86_64-cc","cc:-arch x86_64 -O3 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", -"debug-darwin-ppc-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DB_ENDIAN -g -Wall -O::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", +"rhapsody-ppc-cc","cc:-O3 -DHAVE_SIN_LEN -DB_ENDIAN::(unknown):MACOSX_RHAPSODY::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}::", +"darwin-ppc-cc","cc:-arch ppc -O3 -DHAVE_SIN_LEN -DB_ENDIAN -Wa,-force_cpusubtype_ALL::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", +"darwin64-ppc-cc","cc:-arch ppc64 -O3 -DHAVE_SIN_LEN -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc64_asm}:osx64:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", +"darwin-i386-cc","cc:-arch i386 -O3 -fomit-frame-pointer -DHAVE_SIN_LEN -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:".eval{my $asm=$x86_asm;$asm=~s/cast\-586\.o//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", +"debug-darwin-i386-cc","cc:-arch i386 -g3 -DHAVE_SIN_LEN -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:${x86_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", +"darwin64-x86_64-cc","cc:-arch x86_64 -O3 -DHAVE_SIN_LEN -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", +"debug-darwin-ppc-cc","cc:-DHAVE_SIN_LEN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DB_ENDIAN -g -Wall -O::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", # iPhoneOS/iOS "iphoneos-cross","llvm-gcc:-O3 -isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -fomit-frame-pointer -fno-common::-D_REENTRANT:iOS:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", Modified: soc2012/exxo/openssl-1.0.1c/Makefile ============================================================================== --- soc2012/exxo/openssl-1.0.1c/Makefile Mon Jun 25 23:40:58 2012 (r238310) +++ soc2012/exxo/openssl-1.0.1c/Makefile Tue Jun 26 00:39:50 2012 (r238311) @@ -13,8 +13,8 @@ SHLIB_MINOR=0.0 SHLIB_EXT=.so.$(SHLIB_MAJOR).$(SHLIB_MINOR) PLATFORM=BSD-x86-elf -OPTIONS=-g -Wa,--noexecstack 386 no-ec_nistp_64_gcc_128 no-gmp no-jpake no-krb5 no-md2 no-rc5 no-rfc3779 no-sctp no-shared no-sse2 no-store no-zlib no-zlib-dynamic static-engine -CONFIGURE_ARGS=BSD-x86-elf -g -Wa,--noexecstack 386 +OPTIONS=-Wa,--noexecstack 386 no-ec_nistp_64_gcc_128 no-gmp no-jpake no-krb5 no-md2 no-rc5 no-rfc3779 no-sctp no-shared no-sse2 no-store no-zlib no-zlib-dynamic static-engine +CONFIGURE_ARGS=BSD-x86-elf -Wa,--noexecstack 386 SHLIB_TARGET=bsd-shared # HERE indicates where this Makefile lives. This can be used to indicate @@ -60,7 +60,7 @@ # PKCS1_CHECK - pkcs1 tests. CC= gcc -CFLAG= -DOPENSSL_THREADS -pthread -D_THREAD_SAFE -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -g -Wa,--noexecstack -DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DGHASH_ASM +CFLAG= -DOPENSSL_THREADS -pthread -D_THREAD_SAFE -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -Wa,--noexecstack -DHAVE_SIN_LEN -DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DGHASH_ASM DEPFLAG= -DOPENSSL_NO_EC_NISTP_64_GCC_128 -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SCTP -DOPENSSL_NO_STORE PEX_LIBS= EX_LIBS= Modified: soc2012/exxo/openssl-1.0.1c/Makefile.bak ============================================================================== --- soc2012/exxo/openssl-1.0.1c/Makefile.bak Mon Jun 25 23:40:58 2012 (r238310) +++ soc2012/exxo/openssl-1.0.1c/Makefile.bak Tue Jun 26 00:39:50 2012 (r238311) @@ -13,8 +13,8 @@ SHLIB_MINOR=0.0 SHLIB_EXT=.so.$(SHLIB_MAJOR).$(SHLIB_MINOR) PLATFORM=BSD-x86-elf -OPTIONS=-g -Wa,--noexecstack 386 no-ec_nistp_64_gcc_128 no-gmp no-jpake no-krb5 no-md2 no-rc5 no-rfc3779 no-sctp no-shared no-sse2 no-store no-zlib no-zlib-dynamic static-engine -CONFIGURE_ARGS=BSD-x86-elf -g -Wa,--noexecstack 386 +OPTIONS=-Wa,--noexecstack 386 no-ec_nistp_64_gcc_128 no-gmp no-jpake no-krb5 no-md2 no-rc5 no-rfc3779 no-sctp no-shared no-sse2 no-store no-zlib no-zlib-dynamic static-engine +CONFIGURE_ARGS=BSD-x86-elf -Wa,--noexecstack 386 SHLIB_TARGET=bsd-shared # HERE indicates where this Makefile lives. This can be used to indicate @@ -60,7 +60,7 @@ # PKCS1_CHECK - pkcs1 tests. CC= gcc -CFLAG= -DOPENSSL_THREADS -pthread -D_THREAD_SAFE -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -g -Wa,--noexecstack -DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DGHASH_ASM +CFLAG= -DOPENSSL_THREADS -pthread -D_THREAD_SAFE -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -Wa,--noexecstack -DHAVE_SIN_LEN -DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DGHASH_ASM DEPFLAG= -DOPENSSL_NO_EC_NISTP_64_GCC_128 -DOPENSSL_NO_GMP -DOPENSSL_NO_JPAKE -DOPENSSL_NO_MD2 -DOPENSSL_NO_RC5 -DOPENSSL_NO_RFC3779 -DOPENSSL_NO_SCTP -DOPENSSL_NO_STORE PEX_LIBS= EX_LIBS= Modified: soc2012/exxo/openssl-1.0.1c/apps/s_apps.h ============================================================================== --- soc2012/exxo/openssl-1.0.1c/apps/s_apps.h Mon Jun 25 23:40:58 2012 (r238310) +++ soc2012/exxo/openssl-1.0.1c/apps/s_apps.h Tue Jun 26 00:39:50 2012 (r238311) @@ -148,7 +148,7 @@ #define PORT_STR "4433" #define PROTOCOL "tcp" -int do_server(int port, int type, int *ret, int (*cb) (char *hostname, int s, unsigned char *context), unsigned char *context); +int do_server(char *port, int type, int *ret, int (*cb) (char *hostname, int s, unsigned char *context), unsigned char *context, int family); #ifdef HEADER_X509_H int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx); #endif @@ -156,10 +156,8 @@ int set_cert_stuff(SSL_CTX *ctx, char *cert_file, char *key_file); int set_cert_key_stuff(SSL_CTX *ctx, X509 *cert, EVP_PKEY *key); #endif -int init_client(int *sock, char *server, int port, int type); +int init_client(int *sock, char *server, char *port, int type, int family); int should_retry(int i); -int extract_port(char *str, short *port_ptr); -int extract_host_port(char *str,char **host_ptr,unsigned char *ip,short *p); long MS_CALLBACK bio_dump_callback(BIO *bio, int cmd, const char *argp, int argi, long argl, long ret); Modified: soc2012/exxo/openssl-1.0.1c/apps/s_client.c ============================================================================== --- soc2012/exxo/openssl-1.0.1c/apps/s_client.c Mon Jun 25 23:40:58 2012 (r238310) +++ soc2012/exxo/openssl-1.0.1c/apps/s_client.c Tue Jun 26 00:39:50 2012 (r238311) @@ -287,6 +287,10 @@ BIO_printf(bio_err,"\n"); BIO_printf(bio_err," -host host - use -connect instead\n"); BIO_printf(bio_err," -port port - use -connect instead\n"); + BIO_printf(bio_err," -4 - use IPv4 only\n"); +#if OPENSSL_USE_IPV6 + BIO_printf(bio_err," -6 - use IPv6 only\n"); +#endif BIO_printf(bio_err," -connect host:port - who to connect to (default is %s:%s)\n",SSL_HOST_NAME,PORT_STR); BIO_printf(bio_err," -verify arg - turn on peer certificate verification\n"); @@ -563,7 +567,8 @@ int cbuf_len,cbuf_off; int sbuf_len,sbuf_off; fd_set readfds,writefds; - short port=PORT; + char *port=PORT_STR; + int family; int full_log=1; char *host=SSL_HOST_NAME; char *cert_file=NULL,*key_file=NULL; @@ -652,6 +657,12 @@ c_nbio=0; #endif +#if OPENSSL_USE_IPV6 + family = PF_INET6; +#else + family = PF_INET; +#endif + argc--; argv++; while (argc >= 1) @@ -664,13 +675,19 @@ else if (strcmp(*argv,"-port") == 0) { if (--argc < 1) goto bad; - port=atoi(*(++argv)); - if (port == 0) goto bad; + port= *(++argv); } + else if (strcmp(*argv,"-4") == 0) + family = PF_INET; +#if OPENSSL_USE_IPV6 + else if (strcmp(*argv,"-6") == 0) + family = PF_INET6; +#endif else if (strcmp(*argv,"-connect") == 0) { if (--argc < 1) goto bad; - if (!extract_host_port(*(++argv),&host,NULL,&port)) + /* TODO + if (!extract_host_port(*(++argv),&host,NULL,&port)) */ goto bad; } else if (strcmp(*argv,"-verify") == 0) @@ -1252,10 +1269,9 @@ re_start: - if (init_client(&s,host,port,socket_type) == 0) + if (init_client(&s,host,port,socket_type,family) == 0) { - BIO_printf(bio_err,"connect:errno=%d\n",get_last_socket_error()); - SHUTDOWN(s); + ERR_print_errors(bio_err); goto end; } BIO_printf(bio_c_out,"CONNECTED(%08X)\n",s); Modified: soc2012/exxo/openssl-1.0.1c/apps/s_server.c ============================================================================== --- soc2012/exxo/openssl-1.0.1c/apps/s_server.c Mon Jun 25 23:40:58 2012 (r238310) +++ soc2012/exxo/openssl-1.0.1c/apps/s_server.c Tue Jun 26 00:39:50 2012 (r238311) @@ -460,6 +460,10 @@ BIO_printf(bio_err,"usage: s_server [args ...]\n"); BIO_printf(bio_err,"\n"); BIO_printf(bio_err," -accept arg - port to accept on (default is %d)\n",PORT); + BIO_printf(bio_err," -4 - use IPv4 only\n"); +#if OPENSSL_USE_IPV6 + BIO_printf(bio_err," -6 - use IPv6 only\n"); +#endif BIO_printf(bio_err," -context arg - set session ID context\n"); BIO_printf(bio_err," -verify arg - turn on peer certificate verification\n"); BIO_printf(bio_err," -Verify arg - turn on peer certificate verification, must have a cert.\n"); @@ -929,7 +933,8 @@ { X509_VERIFY_PARAM *vpm = NULL; int badarg = 0; - short port=PORT; + char *port = PORT_STR; + int family; char *CApath=NULL,*CAfile=NULL; unsigned char *context = NULL; char *dhfile = NULL; @@ -991,6 +996,12 @@ #endif s_nbio_test=0; +#if OPENSSL_USE_IPV6 + family = PF_INET6; +#else + family = PF_INET; +#endif + argc--; argv++; @@ -1000,9 +1011,14 @@ (strcmp(*argv,"-accept") == 0)) { if (--argc < 1) goto bad; - if (!extract_port(*(++argv),&port)) - goto bad; + port= *(++argv); } + else if (strcmp(*argv,"-4") == 0) + family = PF_INET; +#if OPENSSL_USE_IPV6 + else if (strcmp(*argv,"-6") == 0) + family = PF_INET6; +#endif else if (strcmp(*argv,"-verify") == 0) { s_server_verify=SSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE; @@ -1874,9 +1890,11 @@ BIO_printf(bio_s_out,"ACCEPT\n"); (void)BIO_flush(bio_s_out); if (www) - do_server(port,socket_type,&accept_socket,www_body, context); + ret = do_server(port,socket_type,&accept_socket,www_body, context, family); else - do_server(port,socket_type,&accept_socket,sv_body, context); + ret = do_server(port,socket_type,&accept_socket,sv_body, context, family); + if (ret == 0) + ERR_print_errors(bio_err); print_stats(bio_s_out,ctx); ret=0; end: Modified: soc2012/exxo/openssl-1.0.1c/apps/s_socket.c ============================================================================== --- soc2012/exxo/openssl-1.0.1c/apps/s_socket.c Mon Jun 25 23:40:58 2012 (r238310) +++ soc2012/exxo/openssl-1.0.1c/apps/s_socket.c Tue Jun 26 00:39:50 2012 (r238311) @@ -97,16 +97,15 @@ #include "netdb.h" #endif -static struct hostent *GetHostByName(char *name); +#if 0 #if defined(OPENSSL_SYS_WINDOWS) || (defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK)) static void ssl_sock_cleanup(void); #endif static int ssl_sock_init(void); -static int init_client_ip(int *sock,unsigned char ip[4], int port, int type); -static int init_server(int *sock, int port, int type); -static int init_server_long(int *sock, int port,char *ip, int type); static int do_accept(int acc_sock, int *sock, char **host); -static int host_ip(char *str, unsigned char ip[4]); +#endif +static int init_server(int *sock, char *port, int type, int family); +static int init_server_long(int *sock, char *port,char *ip, int type, int family); #ifdef OPENSSL_SYS_WIN16 #define SOCKET_PROTOCOL 0 /* more microsoft stupidity */ @@ -114,6 +113,8 @@ #define SOCKET_PROTOCOL IPPROTO_TCP #endif +#if 0 + #if defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK) static int wsa_init_done=0; #endif @@ -234,64 +235,68 @@ return(1); } -int init_client(int *sock, char *host, int port, int type) - { - unsigned char ip[4]; - - memset(ip, '\0', sizeof ip); - if (!host_ip(host,&(ip[0]))) - return 0; - return init_client_ip(sock,ip,port,type); - } +#endif -static int init_client_ip(int *sock, unsigned char ip[4], int port, int type) +int init_client(int *sock, char *host, char *port, int type, int family) { - unsigned long addr; - struct sockaddr_in them; - int s,i; - - if (!ssl_sock_init()) return(0); - - memset((char *)&them,0,sizeof(them)); - them.sin_family=AF_INET; - them.sin_port=htons((unsigned short)port); - addr=(unsigned long) - ((unsigned long)ip[0]<<24L)| - ((unsigned long)ip[1]<<16L)| - ((unsigned long)ip[2]<< 8L)| - ((unsigned long)ip[3]); - them.sin_addr.s_addr=htonl(addr); - - if (type == SOCK_STREAM) - s=socket(AF_INET,SOCK_STREAM,SOCKET_PROTOCOL); - else /* ( type == SOCK_DGRAM) */ - s=socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP); - - if (s == INVALID_SOCKET) { perror("socket"); return(0); } + char addr[128]; /* Should be enough */ + union sa_storage them; + int themlen; + int s=INVALID_SOCKET; + int ret=0; + int i=0; + if (BIO_sock_init() != 1) return(0); + if (host == NULL) + host="*"; +#if OPENSSL_USE_IPV6 + if (family == PF_INET6) + BIO_snprintf(addr, sizeof(addr), "[%s]:%s", host, port); + else +#endif + BIO_snprintf(addr, sizeof(addr), "%s:%s", host, port); + s=socket(family,type,SOCKET_PROTOCOL); + if (s == INVALID_SOCKET) goto err; + if (BIO_get_host_addr(addr, &them, &themlen, 0) != 1) goto err; #if defined(SO_KEEPALIVE) && !defined(OPENSSL_SYS_MPE) if (type == SOCK_STREAM) - { - i=0; + { i=setsockopt(s,SOL_SOCKET,SO_KEEPALIVE,(char *)&i,sizeof(i)); - if (i < 0) { perror("keepalive"); return(0); } + if (i < 0) + { + SYSerr(SYS_F_SETSOCKOPT,get_last_socket_error()); + goto err; + } } #endif - - if (connect(s,(struct sockaddr *)&them,sizeof(them)) == -1) - { closesocket(s); perror("connect"); return(0); } + if (connect(s,(struct sockaddr *)&them,themlen) == -1) + { + SYSerr(SYS_F_CONNECT,get_last_socket_error()); + goto err; + } *sock=s; - return(1); + ret=1; +err: + if ((ret == 0) && (s != INVALID_SOCKET)) + { + SHUTDOWN(s); + } + return (ret); } -int do_server(int port, int type, int *ret, int (*cb)(char *hostname, int s, unsigned char *context), unsigned char *context) +int do_server(char *port, int type, int *ret, int (*cb)(char *hostname, int s, unsigned char *context), unsigned char *context, int family) { int sock; char *name = NULL; int accept_socket = 0; int i; - if (!init_server(&accept_socket,port,type)) return(0); + if (!init_server(&accept_socket,port,type,family)) + return(0); + +#ifdef SIGINT + signal(SIGINT,(void (*)(int))BIO_sock_cleanup); +#endif if (ret != NULL) { @@ -302,7 +307,8 @@ { if (type==SOCK_STREAM) { - if (do_accept(accept_socket,&sock,&name) == 0) + sock = BIO_accept(accept_socket, &name); + if (sock == INVALID_SOCKET) { SHUTDOWN(accept_socket); return(0); @@ -322,33 +328,33 @@ } } -static int init_server_long(int *sock, int port, char *ip, int type) +static int init_server_long(int *sock, char *port, char *ip, int type, int family) { + char addr[128]; /* Should be enough */ + union sa_storage server; + int servlen; + int s=INVALID_SOCKET; int ret=0; - struct sockaddr_in server; - int s= -1; - if (!ssl_sock_init()) return(0); - - memset((char *)&server,0,sizeof(server)); - server.sin_family=AF_INET; - server.sin_port=htons((unsigned short)port); + if (BIO_sock_init() != 1) return(0); if (ip == NULL) - server.sin_addr.s_addr=INADDR_ANY; + ip="*"; +#if OPENSSL_USE_IPV6 + if (family == PF_INET6) + BIO_snprintf(addr, sizeof(addr), "[%s]:%s", ip, port); else -/* Added for T3E, address-of fails on bit field (beckman@acl.lanl.gov) */ -#ifndef BIT_FIELD_LIMITS - memcpy(&server.sin_addr.s_addr,ip,4); -#else - memcpy(&server.sin_addr,ip,4); #endif - - if (type == SOCK_STREAM) - s=socket(AF_INET,SOCK_STREAM,SOCKET_PROTOCOL); - else /* type == SOCK_DGRAM */ - s=socket(AF_INET, SOCK_DGRAM,IPPROTO_UDP); - - if (s == INVALID_SOCKET) goto err; + BIO_snprintf(addr, sizeof(addr), "%s:%s", ip, port); + if (type == SOCK_STREAM) + { + s = BIO_get_accept_socket(addr, BIO_BIND_REUSEADDR); + if (s == INVALID_SOCKET) goto err; + } + else /* type == SOCK_DGRAM */ + { + s=socket(family, SOCK_DGRAM,IPPROTO_UDP); + if (s == INVALID_SOCKET) goto err; + if (BIO_get_host_addr(addr, &server, &servlen, 1) != 1) goto err; #if defined SOL_SOCKET && defined SO_REUSEADDR { int j = 1; @@ -356,30 +362,28 @@ (void *) &j, sizeof j); } #endif - if (bind(s,(struct sockaddr *)&server,sizeof(server)) == -1) - { -#ifndef OPENSSL_SYS_WINDOWS - perror("bind"); -#endif - goto err; + if (bind(s,(struct sockaddr *)&server,servlen) == -1) + { + SYSerr(SYS_F_BIND,get_last_socket_error()); + goto err; + } } - /* Make it 128 for linux */ - if (type==SOCK_STREAM && listen(s,128) == -1) goto err; *sock=s; ret=1; err: - if ((ret == 0) && (s != -1)) + if ((ret == 0) && (s != INVALID_SOCKET)) { SHUTDOWN(s); } - return(ret); + return (ret); } -static int init_server(int *sock, int port, int type) +static int init_server(int *sock, char *port, int type, int family) { - return(init_server_long(sock, port, NULL, type)); + return(init_server_long(sock, port, NULL, type, family)); } +#if 0 static int do_accept(int acc_sock, int *sock, char **host) { int ret; @@ -470,150 +474,6 @@ *sock=ret; return(1); } - -int extract_host_port(char *str, char **host_ptr, unsigned char *ip, - short *port_ptr) - { - char *h,*p; - - h=str; - p=strchr(str,':'); - if (p == NULL) - { - BIO_printf(bio_err,"no port defined\n"); - return(0); - } - *(p++)='\0'; - - if ((ip != NULL) && !host_ip(str,ip)) - goto err; - if (host_ptr != NULL) *host_ptr=h; - - if (!extract_port(p,port_ptr)) - goto err; - return(1); -err: - return(0); - } - -static int host_ip(char *str, unsigned char ip[4]) - { - unsigned int in[4]; - int i; - - if (sscanf(str,"%u.%u.%u.%u",&(in[0]),&(in[1]),&(in[2]),&(in[3])) == 4) - { - for (i=0; i<4; i++) - if (in[i] > 255) - { - BIO_printf(bio_err,"invalid IP address\n"); - goto err; - } - ip[0]=in[0]; - ip[1]=in[1]; - ip[2]=in[2]; - ip[3]=in[3]; - } - else - { /* do a gethostbyname */ - struct hostent *he; - - if (!ssl_sock_init()) return(0); - - he=GetHostByName(str); - if (he == NULL) - { - BIO_printf(bio_err,"gethostbyname failure\n"); - goto err; - } - /* cast to short because of win16 winsock definition */ - if ((short)he->h_addrtype != AF_INET) - { - BIO_printf(bio_err,"gethostbyname addr is not AF_INET\n"); - return(0); - } - ip[0]=he->h_addr_list[0][0]; - ip[1]=he->h_addr_list[0][1]; - ip[2]=he->h_addr_list[0][2]; - ip[3]=he->h_addr_list[0][3]; - } - return(1); -err: - return(0); - } - -int extract_port(char *str, short *port_ptr) - { - int i; - struct servent *s; - - i=atoi(str); - if (i != 0) - *port_ptr=(unsigned short)i; - else - { - s=getservbyname(str,"tcp"); - if (s == NULL) - { - BIO_printf(bio_err,"getservbyname failure for %s\n",str); - return(0); - } - *port_ptr=ntohs((unsigned short)s->s_port); - } - return(1); - } - -#define GHBN_NUM 4 -static struct ghbn_cache_st - { - char name[128]; - struct hostent ent; - unsigned long order; - } ghbn_cache[GHBN_NUM]; - -static unsigned long ghbn_hits=0L; -static unsigned long ghbn_miss=0L; - -static struct hostent *GetHostByName(char *name) - { - struct hostent *ret; - int i,lowi=0; - unsigned long low= (unsigned long)-1; - - for (i=0; i ghbn_cache[i].order) - { - low=ghbn_cache[i].order; - lowi=i; - } - if (ghbn_cache[i].order > 0) - { - if (strncmp(name,ghbn_cache[i].name,128) == 0) - break; - } - } - if (i == GHBN_NUM) /* no hit*/ - { - ghbn_miss++; - ret=gethostbyname(name); - if (ret == NULL) return(NULL); - /* else add to cache */ - if(strlen(name) < sizeof ghbn_cache[0].name) - { - strcpy(ghbn_cache[lowi].name,name); - memcpy((char *)&(ghbn_cache[lowi].ent),ret,sizeof(struct hostent)); - ghbn_cache[lowi].order=ghbn_miss+ghbn_hits; - } - return(ret); - } - else - { - ghbn_hits++; - ret= &(ghbn_cache[i].ent); - ghbn_cache[i].order=ghbn_miss+ghbn_hits; - return(ret); - } - } +#endif #endif Modified: soc2012/exxo/openssl-1.0.1c/crypto/bio/b_sock.c ============================================================================== --- soc2012/exxo/openssl-1.0.1c/crypto/bio/b_sock.c Mon Jun 25 23:40:58 2012 (r238310) +++ soc2012/exxo/openssl-1.0.1c/crypto/bio/b_sock.c Tue Jun 26 00:39:50 2012 (r238311) @@ -59,7 +59,6 @@ #include #include #include -#include #define USE_SOCKETS #include "cryptlib.h" #include @@ -85,10 +84,6 @@ #define MAX_LISTEN 32 #endif -#ifdef OPENSSL_USE_IPV6 -extern const struct in6_addr in6addr_any; -#endif - #if defined(OPENSSL_SYS_WINDOWS) || (defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK)) static int wsa_init_done=0; #endif @@ -118,12 +113,22 @@ #endif static int get_ip(const char *str,unsigned char *ip); +static int parse_ip(char *str, char **host, char **port, int *is_inet6); +static int fill_addr(union sa_storage *sa, char *host, char *port, int is_inet6, int is_local); #if 0 static void ghbn_free(struct hostent *a); static struct hostent *ghbn_dup(struct hostent *a); #endif int BIO_get_host_ip(const char *str, unsigned char *ip) { + int err; + + err = BIO_get_host_ip6(str, ip, BIO_RESOLV_INETONLY); + return (err > 0); /* don't generate another error code here */ + } + +int BIO_get_host_ip6(const char *str, unsigned char *ip, unsigned char mode) + { int i; int err = 1; int locked = 0; @@ -133,10 +138,15 @@ int addrlen = 4; int gai_err; + if ((mode & BIO_RESOLV_INETONLY) && (mode & BIO_RESOLV_INET6ONLY)) + { + BIOerr(BIO_F_BIO_GET_HOST_IP6,BIO_R_INVALID_ARGUMENT); + return 0; + } i=get_ip(str,ip); /* Search for an IPv4 address in in standard dot notation */ if (i < 0) { - BIOerr(BIO_F_BIO_GET_HOST_IP,BIO_R_INVALID_IP_ADDRESS); + BIOerr(BIO_F_BIO_GET_HOST_IP6,BIO_R_INVALID_IP_ADDRESS); goto err; } @@ -147,14 +157,27 @@ /* If the string actually contained an IP address, we need not do anything more */ - if (i > 0) return(1); + if (i > 0) return(4); memset(&hint,0,sizeof(hint)); #if OPENSSL_USE_IPV6 - hint.ai_family=AF_INET6; + if ((mode & BIO_RESOLV_INETONLY)) + hint.ai_family=AF_INET; + else if ((mode & BIO_RESOLV_INET6ONLY)) + hint.ai_family=AF_INET6; + else + hint.ai_family=AF_UNSPEC; #else + if ((mode & BIO_RESOLV_INET6ONLY)) + { + /* Non sense, openssl is not configured to support inet6 */ + BIOerr(BIO_F_BIO_GET_HOST_IP6,BIO_R_INET6_UNSUPPORTED); + goto err; + } hint.ai_family=AF_INET; #endif + if ((mode & BIO_RESOLV_LOCAL)) + hint.ai_flags = AI_PASSIVE; gai_err = BIO_getaddrinfo(str, NULL, &hint, &res); if (gai_err == 0) { @@ -163,21 +186,26 @@ } else if (gai_err < 0) /* Not supported fallback in gethostbyname */ { - ERR_get_error(); /* suppress the error generated by BIO_getaddrinfo */ + if ((mode & BIO_RESOLV_INET6ONLY)) + { + /* Do not expect that BIO_gethostbyname succeeds with inet6 only */ + BIOerr(BIO_F_BIO_GET_HOST_IP6,BIO_R_INET6_UNSUPPORTED); + goto err; + } /* do a gethostbyname */ CRYPTO_w_lock(CRYPTO_LOCK_GETHOSTBYNAME); locked = 1; he=BIO_gethostbyname(str); if (he == NULL) { - BIOerr(BIO_F_BIO_GET_HOST_IP,BIO_R_BAD_HOSTNAME_LOOKUP); + BIOerr(BIO_F_BIO_GET_HOST_IP6,BIO_R_BAD_HOSTNAME_LOOKUP); goto err; } /* cast to short because of win16 winsock definition */ if ((short)he->h_addrtype != AF_INET) { - BIOerr(BIO_F_BIO_GET_HOST_IP,BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET); + BIOerr(BIO_F_BIO_GET_HOST_IP6,BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET); goto err; } addr = he->h_addr; @@ -187,13 +215,13 @@ { if (res->ai_family == AF_INET) { - assert(res->ai_addrlen == sizeof(struct sockaddr_in)); + OPENSSL_assert(res->ai_addrlen == sizeof(struct sockaddr_in)); addr = (char *) &((struct sockaddr_in *) res->ai_addr)->sin_addr.s_addr; addrlen = 4; } else if (res->ai_family == AF_INET6) { - assert(res->ai_addrlen == sizeof(struct sockaddr_in6)); + OPENSSL_assert(res->ai_addrlen == sizeof(struct sockaddr_in6)); addr = (char *) &((struct sockaddr_in6 *) res->ai_addr)->sin6_addr.s6_addr; addrlen = 16; } @@ -215,7 +243,7 @@ return 0; } else - return 1; + return addrlen; } int BIO_get_port(const char *str, unsigned short *port_ptr) @@ -562,7 +590,37 @@ if ((p_freeaddrinfo.p=DSO_global_lookup("freeaddrinfo"))!=NULL) (*p_freeaddrinfo.f)(ai); + else +#endif + BIOerr(BIO_F_BIO_FREEADDRINFO,BIO_R_UNSUPPORTED_METHOD); + } + +int BIO_getnameinfo(const struct sockaddr *sa, size_t salen, + char *host, size_t hostlen, char *serv, size_t servlen, int flags) + { +#ifdef EAI_FAMILY + static union { void *p; + int (WSAAPI *f)(const struct sockaddr *,size_t/*socklen_t*/, + char *,size_t,char *,size_t,int); + } p_getnameinfo = {NULL}; + /* 2nd argument to getnameinfo is specified to + * be socklen_t. Unfortunately there is a number + * of environments where socklen_t is not defined. + * As it's passed by value, it's safe to pass it + * as size_t... */ + + if ((p_getnameinfo.p=DSO_global_lookup("getnameinfo"))!=NULL) + { + if (((*p_getnameinfo.f)(sa,salen,host,hostlen,serv,servlen,flags))!=0) + { + BIOerr(BIO_F_BIO_GETNAMEINFO,BIO_R_BAD_ADDR_RLOOKUP); + return (0); + } + return (1); + } #endif + BIOerr(BIO_F_BIO_GETNAMEINFO,BIO_R_UNSUPPORTED_METHOD); + return (-1); } int BIO_sock_init(void) @@ -762,7 +820,7 @@ return (1); } -static int fill_addr(union sa_storage *sa, char *host, char *port, int is_inet6) +static int fill_addr(union sa_storage *sa, char *host, char *port, int is_inet6, int is_local) { unsigned short p; int sa_len = 0; @@ -772,68 +830,85 @@ unsigned char h[4]; #endif + is_local = (is_local ? BIO_RESOLV_LOCAL : 0); if (!BIO_get_port(port,&p)) return (0); memset((char *)sa,0,sizeof(*sa)); memset(h, 0, sizeof(h)); if (is_inet6) /* deal with inet6 format (ie: [host]:port) */ { #ifdef OPENSSL_USE_IPV6 - assert(sizeof(*sa) >= sizeof(struct sockaddr_in6)); + OPENSSL_assert(sizeof(*sa) >= sizeof(struct sockaddr_in6)); sa->sa_in6.sin6_family = AF_INET6; sa->sa_in6.sin6_port = htons(p); sa_len = sizeof(sa->sa_in6); #ifdef SIN6_LEN /* BSD 4.4 */ sa->sa_in6.sin6_len = sa_len; #endif - if (h == NULL) + if (host == NULL) sa->sa_in6.sin6_addr = in6addr_any; else { - if (!BIO_get_host_ip(host, h)) return (0); + if (!BIO_get_host_ip6(host, h, BIO_RESOLV_INET6ONLY|is_local)) return (0); +#ifndef BIT_FIELD_LIMITS /* Added for T3E, address-of fails on bit field (beckman@acl.lanl.gov) */ memcpy(&sa->sa_in6.sin6_addr.s6_addr, h, sizeof(h)); +#else + memcpy(&sa->sa_in6.sin6_addr, h, sizeof(h)); +#endif } #else /* inet6 format used without OPENSSL configured properly, thus invalid */ - BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET,BIO_R_INVALID_IP_ADDRESS); return (0); #endif } else /* we must resolve an inet4 address */ { - assert(sizeof(*sa) >= sizeof(struct sockaddr_in)); + OPENSSL_assert(sizeof(*sa) >= sizeof(struct sockaddr_in)); sa->sa_in.sin_family=AF_INET; sa->sa_in.sin_port=htons(p); sa_len = sizeof(sa->sa_in); -#if 1 - /* TODO add a definition at compile time */ +#if HAVE_SIN_LEN /* BSD 4.4 */ sa->sa_in.sin_len = sa_len; #endif - if (h == NULL) + if (host == NULL) sa->sa_in.sin_addr.s_addr=INADDR_ANY; else { - /* - * TODO force inet4 listening even with OPENSSL_USE_IPV6 - * - * CONF_LOCAL(h) - * CONF_INETONLY(h) - */ - if (!BIO_get_host_ip(host, h)) return (0); + if (!BIO_get_host_ip6(host, h, BIO_RESOLV_INETONLY|is_local)) return (0); +#ifndef BIT_FIELD_LIMITS memcpy(&sa->sa_in.sin_addr.s_addr, h, 4); /* always 4 here especially when using inet6 */ +#else + memcpy(&sa->sa_in.sin_addr, h, 4); +#endif } } return (sa_len); } +int BIO_get_host_addr(char *host, union sa_storage *sa, int *sa_len, int local_query) + { + char *h, *p; + int is_inet6 = 0; + + if (parse_ip(host, &h, &p, &is_inet6) != 1) + { + BIOerr(BIO_F_BIO_GET_HOST_ADDR,BIO_R_INVALID_IP_ADDRESS); + return (0); + } + *sa_len = fill_addr(sa, h, p, is_inet6, local_query); + if (*sa_len == 0) + return (0); /* Errors have been already generated */ + return (1); + } + int BIO_get_accept_socket(char *host, int bind_mode) { union sa_storage server,client; int s=INVALID_SOCKET,cs,addrlen; char *str=NULL; - char *h,*p; int err_num; - int is_inet6 = 0; int ret = 0; + char *h, *p; + int is_inet6 = 0; if (BIO_sock_init() != 1) return(INVALID_SOCKET); if ((str=BUF_strdup(host)) == NULL) return(INVALID_SOCKET); @@ -842,7 +917,8 @@ BIOerr(BIO_F_BIO_GET_ACCEPT_SOCKET,BIO_R_INVALID_IP_ADDRESS); goto err; } - if ((addrlen = fill_addr(&server, h, p, is_inet6)) == 0) goto err; /* Errors have been already generated */ + if ((addrlen = fill_addr(&server, h, p, is_inet6, 1)) == 0) + goto err; again: s=socket(server.sa.sa_family,SOCK_STREAM,SOCKET_PROTOCOL); if (s == INVALID_SOCKET) @@ -939,6 +1015,9 @@ unsigned long l; unsigned short port; char *p; + int err; + char h[NI_MAXHOST],s[NI_MAXSERV]; + size_t nl; struct { /* @@ -963,13 +1042,7 @@ * */ union { size_t s; int i; } len; - union { - struct sockaddr sa; - struct sockaddr_in sa_in; -#if OPENSSL_USE_IPV6 - struct sockaddr_in6 sa_in6; -#endif - } from; + union sa_storage from; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Tue Jun 26 01:27:02 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 92E3A106566C for ; Tue, 26 Jun 2012 01:27:00 +0000 (UTC) (envelope-from exxo@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 26 Jun 2012 01:27:00 +0000 Date: Tue, 26 Jun 2012 01:27:00 +0000 From: exxo@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120626012700.92E3A106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r238313 - soc2012/exxo/patches X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 01:27:02 -0000 Author: exxo Date: Tue Jun 26 01:26:59 2012 New Revision: 238313 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238313 Log: Adding openssl current patch Added: soc2012/exxo/patches/openssl-1.0.1c.patch Added: soc2012/exxo/patches/openssl-1.0.1c.patch ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/exxo/patches/openssl-1.0.1c.patch Tue Jun 26 01:26:59 2012 (r238313) @@ -0,0 +1,1601 @@ +diff -rpu -X diff-exclude openssl-1.0.1c/Configure gsoc/openssl-1.0.1c/Configure +--- openssl-1.0.1c/Configure 2012-03-14 23:20:40.000000000 +0100 ++++ gsoc/openssl-1.0.1c/Configure 2012-06-26 02:18:50.000000000 +0200 +@@ -168,8 +168,8 @@ my %table=( + "purify", "purify gcc:-g -DPURIFY -Wall::(unknown)::-lsocket -lnsl::::", + "debug", "gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DOPENSSL_NO_ASM -ggdb -g2 -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror::(unknown)::-lefence::::", + "debug-ben", "gcc:$gcc_devteam_warn -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DDEBUG_SAFESTACK -O2 -pipe::(unknown):::::", +-"debug-ben-openbsd","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::", +-"debug-ben-openbsd-debug","gcc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::", ++"debug-ben-openbsd","gcc:-DHAVE_SIN_LEN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::", ++"debug-ben-openbsd-debug","gcc:-DHAVE_SIN_LEN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -DOPENSSL_OPENBSD_DEV_CRYPTO -DOPENSSL_NO_ASM -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe::(unknown)::::", + "debug-ben-debug", "gcc44:$gcc_devteam_warn -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -g3 -O2 -pipe::(unknown)::::::", + "debug-ben-macos", "cc:$gcc_devteam_warn -arch i386 -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -DL_ENDIAN -g3 -pipe::(unknown)::-Wl,-search_paths_first::::", + "debug-ben-macos-gcc46", "gcc-mp-4.6:$gcc_devteam_warn -Wconversion -DBN_DEBUG -DCONF_DEBUG -DDEBUG_SAFESTACK -DDEBUG_UNUSED -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -O3 -DL_ENDIAN -g3 -pipe::(unknown)::::::", +@@ -407,21 +407,21 @@ my %table=( + "android-armv7","gcc:-march=armv7-a -mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${armv4_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", + + #### *BSD [do see comment about ${BSDthreads} above!] +-"BSD-generic32","gcc:-DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +-"BSD-x86", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +-"BSD-x86-elf", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +-"debug-BSD-x86-elf", "gcc:-DL_ENDIAN -DTERMIOS -O3 -Wall -g::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +-"BSD-sparcv8", "gcc:-DB_ENDIAN -DTERMIOS -O3 -mv8 -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${sparcv8_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"BSD-generic32","gcc:-DHAVE_SIN_LEN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"BSD-x86", "gcc:-DHAVE_SIN_LEN -DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"BSD-x86-elf", "gcc:-DHAVE_SIN_LEN -DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"debug-BSD-x86-elf", "gcc:-DHAVE_SIN_LEN -DL_ENDIAN -DTERMIOS -O3 -Wall -g::${BSDthreads}:::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"BSD-sparcv8", "gcc:-DHAVE_SIN_LEN -DB_ENDIAN -DTERMIOS -O3 -mv8 -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${sparcv8_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", + +-"BSD-generic64","gcc:-DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"BSD-generic64","gcc:-DHAVE_SIN_LEN -DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", + # -DMD32_REG_T=int doesn't actually belong in sparc64 target, it + # simply *happens* to work around a compiler bug in gcc 3.3.3, + # triggered by RIPEMD160 code. +-"BSD-sparc64", "gcc:-DB_ENDIAN -DTERMIOS -O3 -DMD32_REG_T=int -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC2 BF_PTR:${sparcv9_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +-"BSD-ia64", "gcc:-DL_ENDIAN -DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_INT:${ia64_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +-"BSD-x86_64", "gcc:-DL_ENDIAN -DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"BSD-sparc64", "gcc:-DHAVE_SIN_LEN -DB_ENDIAN -DTERMIOS -O3 -DMD32_REG_T=int -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC2 BF_PTR:${sparcv9_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"BSD-ia64", "gcc:-DHAVE_SIN_LEN -DL_ENDIAN -DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_INT:${ia64_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"BSD-x86_64", "gcc:-DHAVE_SIN_LEN -DL_ENDIAN -DTERMIOS -O3 -Wall::${BSDthreads}:::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", + +-"bsdi-elf-gcc", "gcc:-DPERL5 -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall::(unknown)::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"bsdi-elf-gcc", "gcc:-DHAVE_SIN_LEN -DPERL5 -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall::(unknown)::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", + + "nextstep", "cc:-O -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::", + "nextstep3.3", "cc:-O3 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::", +@@ -574,13 +574,13 @@ my %table=( + ##"ultrix","cc:-O2 -DNOPROTO -DNOCONST -DL_ENDIAN::(unknown):::::::", + + ##### MacOS X (a.k.a. Rhapsody or Darwin) setup +-"rhapsody-ppc-cc","cc:-O3 -DB_ENDIAN::(unknown):MACOSX_RHAPSODY::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}::", +-"darwin-ppc-cc","cc:-arch ppc -O3 -DB_ENDIAN -Wa,-force_cpusubtype_ALL::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", +-"darwin64-ppc-cc","cc:-arch ppc64 -O3 -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc64_asm}:osx64:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", +-"darwin-i386-cc","cc:-arch i386 -O3 -fomit-frame-pointer -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:".eval{my $asm=$x86_asm;$asm=~s/cast\-586\.o//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", +-"debug-darwin-i386-cc","cc:-arch i386 -g3 -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:${x86_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", +-"darwin64-x86_64-cc","cc:-arch x86_64 -O3 -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", +-"debug-darwin-ppc-cc","cc:-DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DB_ENDIAN -g -Wall -O::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", ++"rhapsody-ppc-cc","cc:-O3 -DHAVE_SIN_LEN -DB_ENDIAN::(unknown):MACOSX_RHAPSODY::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}::", ++"darwin-ppc-cc","cc:-arch ppc -O3 -DHAVE_SIN_LEN -DB_ENDIAN -Wa,-force_cpusubtype_ALL::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", ++"darwin64-ppc-cc","cc:-arch ppc64 -O3 -DHAVE_SIN_LEN -DB_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc64_asm}:osx64:dlfcn:darwin-shared:-fPIC -fno-common:-arch ppc64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", ++"darwin-i386-cc","cc:-arch i386 -O3 -fomit-frame-pointer -DHAVE_SIN_LEN -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:".eval{my $asm=$x86_asm;$asm=~s/cast\-586\.o//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", ++"debug-darwin-i386-cc","cc:-arch i386 -g3 -DHAVE_SIN_LEN -DL_ENDIAN::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:BN_LLONG RC4_INT RC4_CHUNK DES_UNROLL BF_PTR:${x86_asm}:macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch i386 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", ++"darwin64-x86_64-cc","cc:-arch x86_64 -O3 -DHAVE_SIN_LEN -DL_ENDIAN -Wall::-D_REENTRANT:MACOSX:-Wl,-search_paths_first%:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL:".eval{my $asm=$x86_64_asm;$asm=~s/rc4\-[^:]+//;$asm}.":macosx:dlfcn:darwin-shared:-fPIC -fno-common:-arch x86_64 -dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", ++"debug-darwin-ppc-cc","cc:-DHAVE_SIN_LEN -DBN_DEBUG -DREF_CHECK -DCONF_DEBUG -DCRYPTO_MDEBUG -DB_ENDIAN -g -Wall -O::-D_REENTRANT:MACOSX::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${ppc32_asm}:osx32:dlfcn:darwin-shared:-fPIC:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", + # iPhoneOS/iOS + "iphoneos-cross","llvm-gcc:-O3 -isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -fomit-frame-pointer -fno-common::-D_REENTRANT:iOS:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib", + +diff -rpu -X diff-exclude openssl-1.0.1c/apps/s_apps.h gsoc/openssl-1.0.1c/apps/s_apps.h +--- openssl-1.0.1c/apps/s_apps.h 2009-09-04 19:42:04.000000000 +0200 ++++ gsoc/openssl-1.0.1c/apps/s_apps.h 2012-06-26 01:10:06.000000000 +0200 +@@ -148,7 +148,7 @@ typedef fd_mask fd_set; + #define PORT_STR "4433" + #define PROTOCOL "tcp" + +-int do_server(int port, int type, int *ret, int (*cb) (char *hostname, int s, unsigned char *context), unsigned char *context); ++int do_server(char *port, int type, int *ret, int (*cb) (char *hostname, int s, unsigned char *context), unsigned char *context, int family); + #ifdef HEADER_X509_H + int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx); + #endif +@@ -156,10 +156,8 @@ int MS_CALLBACK verify_callback(int ok, + int set_cert_stuff(SSL_CTX *ctx, char *cert_file, char *key_file); + int set_cert_key_stuff(SSL_CTX *ctx, X509 *cert, EVP_PKEY *key); + #endif +-int init_client(int *sock, char *server, int port, int type); ++int init_client(int *sock, char *server, char *port, int type, int family); + int should_retry(int i); +-int extract_port(char *str, short *port_ptr); +-int extract_host_port(char *str,char **host_ptr,unsigned char *ip,short *p); + + long MS_CALLBACK bio_dump_callback(BIO *bio, int cmd, const char *argp, + int argi, long argl, long ret); +diff -rpu -X diff-exclude openssl-1.0.1c/apps/s_client.c gsoc/openssl-1.0.1c/apps/s_client.c +--- openssl-1.0.1c/apps/s_client.c 2012-03-18 19:16:05.000000000 +0100 ++++ gsoc/openssl-1.0.1c/apps/s_client.c 2012-06-26 02:24:47.000000000 +0200 +@@ -287,6 +287,10 @@ static void sc_usage(void) + BIO_printf(bio_err,"\n"); + BIO_printf(bio_err," -host host - use -connect instead\n"); + BIO_printf(bio_err," -port port - use -connect instead\n"); ++ BIO_printf(bio_err," -4 - use IPv4 only\n"); ++#if OPENSSL_USE_IPV6 ++ BIO_printf(bio_err," -6 - use IPv6 only\n"); ++#endif + BIO_printf(bio_err," -connect host:port - who to connect to (default is %s:%s)\n",SSL_HOST_NAME,PORT_STR); + + BIO_printf(bio_err," -verify arg - turn on peer certificate verification\n"); +@@ -563,7 +567,8 @@ int MAIN(int argc, char **argv) + int cbuf_len,cbuf_off; + int sbuf_len,sbuf_off; + fd_set readfds,writefds; +- short port=PORT; ++ char *port=PORT_STR; ++ int family; + int full_log=1; + char *host=SSL_HOST_NAME; + char *cert_file=NULL,*key_file=NULL; +@@ -652,6 +657,12 @@ int MAIN(int argc, char **argv) + c_nbio=0; + #endif + ++#if OPENSSL_USE_IPV6 ++ family = PF_INET6; ++#else ++ family = PF_INET; ++#endif ++ + argc--; + argv++; + while (argc >= 1) +@@ -664,13 +675,19 @@ int MAIN(int argc, char **argv) + else if (strcmp(*argv,"-port") == 0) + { + if (--argc < 1) goto bad; +- port=atoi(*(++argv)); +- if (port == 0) goto bad; ++ port= *(++argv); + } ++ else if (strcmp(*argv,"-4") == 0) ++ family = PF_INET; ++#if OPENSSL_USE_IPV6 ++ else if (strcmp(*argv,"-6") == 0) ++ family = PF_INET6; ++#endif + else if (strcmp(*argv,"-connect") == 0) + { + if (--argc < 1) goto bad; +- if (!extract_host_port(*(++argv),&host,NULL,&port)) ++ /* TODO ++ if (!extract_host_port(*(++argv),&host,NULL,&port)) */ + goto bad; + } + else if (strcmp(*argv,"-verify") == 0) +@@ -1252,10 +1269,9 @@ bad: + + re_start: + +- if (init_client(&s,host,port,socket_type) == 0) ++ if (init_client(&s,host,port,socket_type,family) == 0) + { +- BIO_printf(bio_err,"connect:errno=%d\n",get_last_socket_error()); +- SHUTDOWN(s); ++ ERR_print_errors(bio_err); + goto end; + } + BIO_printf(bio_c_out,"CONNECTED(%08X)\n",s); +diff -rpu -X diff-exclude openssl-1.0.1c/apps/s_server.c gsoc/openssl-1.0.1c/apps/s_server.c +--- openssl-1.0.1c/apps/s_server.c 2012-03-18 19:16:05.000000000 +0100 ++++ gsoc/openssl-1.0.1c/apps/s_server.c 2012-06-26 01:24:25.000000000 +0200 +@@ -460,6 +460,10 @@ static void sv_usage(void) + BIO_printf(bio_err,"usage: s_server [args ...]\n"); + BIO_printf(bio_err,"\n"); + BIO_printf(bio_err," -accept arg - port to accept on (default is %d)\n",PORT); ++ BIO_printf(bio_err," -4 - use IPv4 only\n"); ++#if OPENSSL_USE_IPV6 ++ BIO_printf(bio_err," -6 - use IPv6 only\n"); ++#endif + BIO_printf(bio_err," -context arg - set session ID context\n"); + BIO_printf(bio_err," -verify arg - turn on peer certificate verification\n"); + BIO_printf(bio_err," -Verify arg - turn on peer certificate verification, must have a cert.\n"); +@@ -929,7 +933,8 @@ int MAIN(int argc, char *argv[]) + { + X509_VERIFY_PARAM *vpm = NULL; + int badarg = 0; +- short port=PORT; ++ char *port = PORT_STR; ++ int family; + char *CApath=NULL,*CAfile=NULL; + unsigned char *context = NULL; + char *dhfile = NULL; +@@ -991,6 +996,12 @@ int MAIN(int argc, char *argv[]) + #endif + s_nbio_test=0; + ++#if OPENSSL_USE_IPV6 ++ family = PF_INET6; ++#else ++ family = PF_INET; ++#endif ++ + argc--; + argv++; + +@@ -1000,9 +1011,14 @@ int MAIN(int argc, char *argv[]) + (strcmp(*argv,"-accept") == 0)) + { + if (--argc < 1) goto bad; +- if (!extract_port(*(++argv),&port)) +- goto bad; ++ port= *(++argv); + } ++ else if (strcmp(*argv,"-4") == 0) ++ family = PF_INET; ++#if OPENSSL_USE_IPV6 ++ else if (strcmp(*argv,"-6") == 0) ++ family = PF_INET6; ++#endif + else if (strcmp(*argv,"-verify") == 0) + { + s_server_verify=SSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE; +@@ -1874,9 +1890,11 @@ bad: + BIO_printf(bio_s_out,"ACCEPT\n"); + (void)BIO_flush(bio_s_out); + if (www) +- do_server(port,socket_type,&accept_socket,www_body, context); ++ ret = do_server(port,socket_type,&accept_socket,www_body, context, family); + else +- do_server(port,socket_type,&accept_socket,sv_body, context); ++ ret = do_server(port,socket_type,&accept_socket,sv_body, context, family); ++ if (ret == 0) ++ ERR_print_errors(bio_err); + print_stats(bio_s_out,ctx); + ret=0; + end: +diff -rpu -X diff-exclude openssl-1.0.1c/apps/s_socket.c gsoc/openssl-1.0.1c/apps/s_socket.c +--- openssl-1.0.1c/apps/s_socket.c 2011-12-02 15:39:40.000000000 +0100 ++++ gsoc/openssl-1.0.1c/apps/s_socket.c 2012-06-26 02:04:07.000000000 +0200 +@@ -97,16 +97,15 @@ typedef unsigned int u_int; + #include "netdb.h" + #endif + +-static struct hostent *GetHostByName(char *name); ++#if 0 + #if defined(OPENSSL_SYS_WINDOWS) || (defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK)) + static void ssl_sock_cleanup(void); + #endif + static int ssl_sock_init(void); +-static int init_client_ip(int *sock,unsigned char ip[4], int port, int type); +-static int init_server(int *sock, int port, int type); +-static int init_server_long(int *sock, int port,char *ip, int type); + static int do_accept(int acc_sock, int *sock, char **host); +-static int host_ip(char *str, unsigned char ip[4]); ++#endif ++static int init_server(int *sock, char *port, int type, int family); ++static int init_server_long(int *sock, char *port,char *ip, int type, int family); + + #ifdef OPENSSL_SYS_WIN16 + #define SOCKET_PROTOCOL 0 /* more microsoft stupidity */ +@@ -114,6 +113,8 @@ static int host_ip(char *str, unsigned c + #define SOCKET_PROTOCOL IPPROTO_TCP + #endif + ++#if 0 ++ + #if defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK) + static int wsa_init_done=0; + #endif +@@ -234,64 +235,68 @@ static int ssl_sock_init(void) + return(1); + } + +-int init_client(int *sock, char *host, int port, int type) +- { +- unsigned char ip[4]; +- +- memset(ip, '\0', sizeof ip); +- if (!host_ip(host,&(ip[0]))) +- return 0; +- return init_client_ip(sock,ip,port,type); +- } ++#endif + +-static int init_client_ip(int *sock, unsigned char ip[4], int port, int type) ++int init_client(int *sock, char *host, char *port, int type, int family) + { +- unsigned long addr; +- struct sockaddr_in them; +- int s,i; +- +- if (!ssl_sock_init()) return(0); +- +- memset((char *)&them,0,sizeof(them)); +- them.sin_family=AF_INET; +- them.sin_port=htons((unsigned short)port); +- addr=(unsigned long) +- ((unsigned long)ip[0]<<24L)| +- ((unsigned long)ip[1]<<16L)| +- ((unsigned long)ip[2]<< 8L)| +- ((unsigned long)ip[3]); +- them.sin_addr.s_addr=htonl(addr); +- +- if (type == SOCK_STREAM) +- s=socket(AF_INET,SOCK_STREAM,SOCKET_PROTOCOL); +- else /* ( type == SOCK_DGRAM) */ +- s=socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP); +- +- if (s == INVALID_SOCKET) { perror("socket"); return(0); } ++ char addr[128]; /* Should be enough */ ++ union sa_storage them; ++ int themlen; ++ int s=INVALID_SOCKET; ++ int ret=0; ++ int i=0; + ++ if (BIO_sock_init() != 1) return(0); ++ if (host == NULL) ++ host="*"; ++#if OPENSSL_USE_IPV6 ++ if (family == PF_INET6) ++ BIO_snprintf(addr, sizeof(addr), "[%s]:%s", host, port); ++ else ++#endif ++ BIO_snprintf(addr, sizeof(addr), "%s:%s", host, port); ++ s=socket(family,type,SOCKET_PROTOCOL); ++ if (s == INVALID_SOCKET) goto err; ++ if (BIO_get_host_addr(addr, &them, &themlen, 0) != 1) goto err; + #if defined(SO_KEEPALIVE) && !defined(OPENSSL_SYS_MPE) + if (type == SOCK_STREAM) +- { +- i=0; ++ { + i=setsockopt(s,SOL_SOCKET,SO_KEEPALIVE,(char *)&i,sizeof(i)); +- if (i < 0) { perror("keepalive"); return(0); } ++ if (i < 0) ++ { ++ SYSerr(SYS_F_SETSOCKOPT,get_last_socket_error()); ++ goto err; ++ } + } + #endif +- +- if (connect(s,(struct sockaddr *)&them,sizeof(them)) == -1) +- { closesocket(s); perror("connect"); return(0); } ++ if (connect(s,(struct sockaddr *)&them,themlen) == -1) ++ { ++ SYSerr(SYS_F_CONNECT,get_last_socket_error()); ++ goto err; ++ } + *sock=s; +- return(1); ++ ret=1; ++err: ++ if ((ret == 0) && (s != INVALID_SOCKET)) ++ { ++ SHUTDOWN(s); ++ } ++ return (ret); + } + +-int do_server(int port, int type, int *ret, int (*cb)(char *hostname, int s, unsigned char *context), unsigned char *context) ++int do_server(char *port, int type, int *ret, int (*cb)(char *hostname, int s, unsigned char *context), unsigned char *context, int family) + { + int sock; + char *name = NULL; + int accept_socket = 0; + int i; + +- if (!init_server(&accept_socket,port,type)) return(0); ++ if (!init_server(&accept_socket,port,type,family)) ++ return(0); ++ ++#ifdef SIGINT ++ signal(SIGINT,(void (*)(int))BIO_sock_cleanup); ++#endif + + if (ret != NULL) + { +@@ -302,7 +307,8 @@ int do_server(int port, int type, int *r + { + if (type==SOCK_STREAM) + { +- if (do_accept(accept_socket,&sock,&name) == 0) ++ sock = BIO_accept(accept_socket, &name); ++ if (sock == INVALID_SOCKET) + { + SHUTDOWN(accept_socket); + return(0); +@@ -322,33 +328,33 @@ int do_server(int port, int type, int *r + } + } + +-static int init_server_long(int *sock, int port, char *ip, int type) ++static int init_server_long(int *sock, char *port, char *ip, int type, int family) + { ++ char addr[128]; /* Should be enough */ ++ union sa_storage server; ++ int servlen; ++ int s=INVALID_SOCKET; + int ret=0; +- struct sockaddr_in server; +- int s= -1; + +- if (!ssl_sock_init()) return(0); +- +- memset((char *)&server,0,sizeof(server)); +- server.sin_family=AF_INET; +- server.sin_port=htons((unsigned short)port); ++ if (BIO_sock_init() != 1) return(0); + if (ip == NULL) +- server.sin_addr.s_addr=INADDR_ANY; ++ ip="*"; ++#if OPENSSL_USE_IPV6 ++ if (family == PF_INET6) ++ BIO_snprintf(addr, sizeof(addr), "[%s]:%s", ip, port); + else +-/* Added for T3E, address-of fails on bit field (beckman@acl.lanl.gov) */ +-#ifndef BIT_FIELD_LIMITS +- memcpy(&server.sin_addr.s_addr,ip,4); +-#else +- memcpy(&server.sin_addr,ip,4); + #endif +- +- if (type == SOCK_STREAM) +- s=socket(AF_INET,SOCK_STREAM,SOCKET_PROTOCOL); +- else /* type == SOCK_DGRAM */ +- s=socket(AF_INET, SOCK_DGRAM,IPPROTO_UDP); +- +- if (s == INVALID_SOCKET) goto err; ++ BIO_snprintf(addr, sizeof(addr), "%s:%s", ip, port); ++ if (type == SOCK_STREAM) ++ { ++ s = BIO_get_accept_socket(addr, BIO_BIND_REUSEADDR); ++ if (s == INVALID_SOCKET) goto err; ++ } ++ else /* type == SOCK_DGRAM */ ++ { ++ s=socket(family, SOCK_DGRAM,IPPROTO_UDP); ++ if (s == INVALID_SOCKET) goto err; ++ if (BIO_get_host_addr(addr, &server, &servlen, 1) != 1) goto err; + #if defined SOL_SOCKET && defined SO_REUSEADDR + { + int j = 1; +@@ -356,30 +362,28 @@ static int init_server_long(int *sock, i + (void *) &j, sizeof j); + } + #endif +- if (bind(s,(struct sockaddr *)&server,sizeof(server)) == -1) +- { +-#ifndef OPENSSL_SYS_WINDOWS +- perror("bind"); +-#endif +- goto err; ++ if (bind(s,(struct sockaddr *)&server,servlen) == -1) ++ { ++ SYSerr(SYS_F_BIND,get_last_socket_error()); ++ goto err; ++ } + } +- /* Make it 128 for linux */ +- if (type==SOCK_STREAM && listen(s,128) == -1) goto err; + *sock=s; + ret=1; + err: +- if ((ret == 0) && (s != -1)) ++ if ((ret == 0) && (s != INVALID_SOCKET)) + { + SHUTDOWN(s); + } +- return(ret); ++ return (ret); + } + +-static int init_server(int *sock, int port, int type) ++static int init_server(int *sock, char *port, int type, int family) + { +- return(init_server_long(sock, port, NULL, type)); ++ return(init_server_long(sock, port, NULL, type, family)); + } + ++#if 0 + static int do_accept(int acc_sock, int *sock, char **host) + { + int ret; +@@ -470,150 +474,6 @@ end: + *sock=ret; + return(1); + } +- +-int extract_host_port(char *str, char **host_ptr, unsigned char *ip, +- short *port_ptr) +- { +- char *h,*p; +- +- h=str; +- p=strchr(str,':'); +- if (p == NULL) +- { +- BIO_printf(bio_err,"no port defined\n"); +- return(0); +- } +- *(p++)='\0'; +- +- if ((ip != NULL) && !host_ip(str,ip)) +- goto err; +- if (host_ptr != NULL) *host_ptr=h; +- +- if (!extract_port(p,port_ptr)) +- goto err; +- return(1); +-err: +- return(0); +- } +- +-static int host_ip(char *str, unsigned char ip[4]) +- { +- unsigned int in[4]; +- int i; +- +- if (sscanf(str,"%u.%u.%u.%u",&(in[0]),&(in[1]),&(in[2]),&(in[3])) == 4) +- { +- for (i=0; i<4; i++) +- if (in[i] > 255) +- { +- BIO_printf(bio_err,"invalid IP address\n"); +- goto err; +- } +- ip[0]=in[0]; +- ip[1]=in[1]; +- ip[2]=in[2]; +- ip[3]=in[3]; +- } +- else +- { /* do a gethostbyname */ +- struct hostent *he; +- +- if (!ssl_sock_init()) return(0); +- +- he=GetHostByName(str); +- if (he == NULL) +- { +- BIO_printf(bio_err,"gethostbyname failure\n"); +- goto err; +- } +- /* cast to short because of win16 winsock definition */ +- if ((short)he->h_addrtype != AF_INET) +- { +- BIO_printf(bio_err,"gethostbyname addr is not AF_INET\n"); +- return(0); +- } +- ip[0]=he->h_addr_list[0][0]; +- ip[1]=he->h_addr_list[0][1]; +- ip[2]=he->h_addr_list[0][2]; +- ip[3]=he->h_addr_list[0][3]; +- } +- return(1); +-err: +- return(0); +- } +- +-int extract_port(char *str, short *port_ptr) +- { +- int i; +- struct servent *s; +- +- i=atoi(str); +- if (i != 0) +- *port_ptr=(unsigned short)i; +- else +- { +- s=getservbyname(str,"tcp"); +- if (s == NULL) +- { +- BIO_printf(bio_err,"getservbyname failure for %s\n",str); +- return(0); +- } +- *port_ptr=ntohs((unsigned short)s->s_port); +- } +- return(1); +- } +- +-#define GHBN_NUM 4 +-static struct ghbn_cache_st +- { +- char name[128]; +- struct hostent ent; +- unsigned long order; +- } ghbn_cache[GHBN_NUM]; +- +-static unsigned long ghbn_hits=0L; +-static unsigned long ghbn_miss=0L; +- +-static struct hostent *GetHostByName(char *name) +- { +- struct hostent *ret; +- int i,lowi=0; +- unsigned long low= (unsigned long)-1; +- +- for (i=0; i ghbn_cache[i].order) +- { +- low=ghbn_cache[i].order; +- lowi=i; +- } +- if (ghbn_cache[i].order > 0) +- { +- if (strncmp(name,ghbn_cache[i].name,128) == 0) +- break; +- } +- } +- if (i == GHBN_NUM) /* no hit*/ +- { +- ghbn_miss++; +- ret=gethostbyname(name); +- if (ret == NULL) return(NULL); +- /* else add to cache */ +- if(strlen(name) < sizeof ghbn_cache[0].name) +- { +- strcpy(ghbn_cache[lowi].name,name); +- memcpy((char *)&(ghbn_cache[lowi].ent),ret,sizeof(struct hostent)); +- ghbn_cache[lowi].order=ghbn_miss+ghbn_hits; +- } +- return(ret); +- } +- else +- { +- ghbn_hits++; +- ret= &(ghbn_cache[i].ent); +- ghbn_cache[i].order=ghbn_miss+ghbn_hits; +- return(ret); +- } +- } ++#endif + + #endif +diff -rpu -X diff-exclude openssl-1.0.1c/crypto/bio/b_sock.c gsoc/openssl-1.0.1c/crypto/bio/b_sock.c +--- openssl-1.0.1c/crypto/bio/b_sock.c 2012-04-16 19:43:14.000000000 +0200 ++++ gsoc/openssl-1.0.1c/crypto/bio/b_sock.c 2012-06-26 02:08:30.000000000 +0200 +@@ -113,21 +113,40 @@ static struct ghbn_cache_st + #endif + + static int get_ip(const char *str,unsigned char *ip); ++static int parse_ip(char *str, char **host, char **port, int *is_inet6); ++static int fill_addr(union sa_storage *sa, char *host, char *port, int is_inet6, int is_local); + #if 0 + static void ghbn_free(struct hostent *a); + static struct hostent *ghbn_dup(struct hostent *a); + #endif + int BIO_get_host_ip(const char *str, unsigned char *ip) + { ++ int err; ++ ++ err = BIO_get_host_ip6(str, ip, BIO_RESOLV_INETONLY); ++ return (err > 0); /* don't generate another error code here */ ++ } ++ ++int BIO_get_host_ip6(const char *str, unsigned char *ip, unsigned char mode) ++ { + int i; + int err = 1; + int locked = 0; + struct hostent *he; ++ struct addrinfo hint, *res = NULL; ++ char *addr = NULL; ++ int addrlen = 4; ++ int gai_err; + +- i=get_ip(str,ip); ++ if ((mode & BIO_RESOLV_INETONLY) && (mode & BIO_RESOLV_INET6ONLY)) ++ { ++ BIOerr(BIO_F_BIO_GET_HOST_IP6,BIO_R_INVALID_ARGUMENT); ++ return 0; ++ } ++ i=get_ip(str,ip); /* Search for an IPv4 address in in standard dot notation */ + if (i < 0) + { +- BIOerr(BIO_F_BIO_GET_HOST_IP,BIO_R_INVALID_IP_ADDRESS); ++ BIOerr(BIO_F_BIO_GET_HOST_IP6,BIO_R_INVALID_IP_ADDRESS); + goto err; + } + +@@ -138,38 +157,93 @@ int BIO_get_host_ip(const char *str, uns + + /* If the string actually contained an IP address, we need not do + anything more */ +- if (i > 0) return(1); ++ if (i > 0) return(4); + +- /* do a gethostbyname */ +- CRYPTO_w_lock(CRYPTO_LOCK_GETHOSTBYNAME); +- locked = 1; +- he=BIO_gethostbyname(str); +- if (he == NULL) ++ memset(&hint,0,sizeof(hint)); ++#if OPENSSL_USE_IPV6 ++ if ((mode & BIO_RESOLV_INETONLY)) ++ hint.ai_family=AF_INET; ++ else if ((mode & BIO_RESOLV_INET6ONLY)) ++ hint.ai_family=AF_INET6; ++ else ++ hint.ai_family=AF_UNSPEC; ++#else ++ if ((mode & BIO_RESOLV_INET6ONLY)) + { +- BIOerr(BIO_F_BIO_GET_HOST_IP,BIO_R_BAD_HOSTNAME_LOOKUP); ++ /* Non sense, openssl is not configured to support inet6 */ ++ BIOerr(BIO_F_BIO_GET_HOST_IP6,BIO_R_INET6_UNSUPPORTED); + goto err; + } +- +- /* cast to short because of win16 winsock definition */ +- if ((short)he->h_addrtype != AF_INET) ++ hint.ai_family=AF_INET; ++#endif ++ if ((mode & BIO_RESOLV_LOCAL)) ++ hint.ai_flags = AI_PASSIVE; ++ gai_err = BIO_getaddrinfo(str, NULL, &hint, &res); ++ if (gai_err == 0) + { +- BIOerr(BIO_F_BIO_GET_HOST_IP,BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET); ++ res=NULL; + goto err; + } +- for (i=0; i<4; i++) +- ip[i]=he->h_addr_list[0][i]; ++ else if (gai_err < 0) /* Not supported fallback in gethostbyname */ ++ { ++ if ((mode & BIO_RESOLV_INET6ONLY)) ++ { ++ /* Do not expect that BIO_gethostbyname succeeds with inet6 only */ ++ BIOerr(BIO_F_BIO_GET_HOST_IP6,BIO_R_INET6_UNSUPPORTED); ++ goto err; ++ } ++ /* do a gethostbyname */ ++ CRYPTO_w_lock(CRYPTO_LOCK_GETHOSTBYNAME); ++ locked = 1; ++ he=BIO_gethostbyname(str); ++ if (he == NULL) ++ { ++ BIOerr(BIO_F_BIO_GET_HOST_IP6,BIO_R_BAD_HOSTNAME_LOOKUP); ++ goto err; ++ } ++ ++ /* cast to short because of win16 winsock definition */ ++ if ((short)he->h_addrtype != AF_INET) ++ { ++ BIOerr(BIO_F_BIO_GET_HOST_IP6,BIO_R_GETHOSTBYNAME_ADDR_IS_NOT_AF_INET); ++ goto err; ++ } ++ addr = he->h_addr; ++ addrlen = he->h_length; ++ } ++ else ++ { ++ if (res->ai_family == AF_INET) ++ { ++ OPENSSL_assert(res->ai_addrlen == sizeof(struct sockaddr_in)); ++ addr = (char *) &((struct sockaddr_in *) res->ai_addr)->sin_addr.s_addr; ++ addrlen = 4; ++ } ++ else if (res->ai_family == AF_INET6) ++ { ++ OPENSSL_assert(res->ai_addrlen == sizeof(struct sockaddr_in6)); ++ addr = (char *) &((struct sockaddr_in6 *) res->ai_addr)->sin6_addr.s6_addr; ++ addrlen = 16; ++ } ++ else ++ goto err; ++ } ++ for (i=0; i < addrlen; i++) ++ ip[i]=addr[i]; /* Store the address in network byte order */ + err = 0; + + err: + if (locked) + CRYPTO_w_unlock(CRYPTO_LOCK_GETHOSTBYNAME); ++ if (res) ++ BIO_freeaddrinfo(res); + if (err) + { + ERR_add_error_data(2,"host=",str); + return 0; + } + else +- return 1; ++ return addrlen; + } + + int BIO_get_port(const char *str, unsigned short *port_ptr) +@@ -467,9 +541,90 @@ end: + #endif + } + ++int BIO_getaddrinfo(const char *hostname, const char *servname, ++ const struct addrinfo *hints, struct addrinfo **res) ++ { ++#ifdef EAI_FAMILY ++ int err; ++ const char *reason; ++ static union { void *p; ++ int (WSAAPI *f)(const char *,const char *, ++ const struct addrinfo *, ++ struct addrinfo **); ++ } p_getaddrinfo = {NULL}; ++ static union { void *p; ++ const char * (WSAAPI *f)(int); ++ } p_gai_strerror = {NULL}; ++ ++ if ((p_getaddrinfo.p=DSO_global_lookup("getaddrinfo"))!=NULL) ++ { ++ if ((err = (*p_getaddrinfo.f)(hostname,servname,hints,res))) ++ { ++ BIOerr(BIO_F_BIO_GETADDRINFO,BIO_R_BAD_HOSTNAME_LOOKUP); ++ if ((p_gai_strerror.p=DSO_global_lookup("gai_strerror"))!=NULL) ++ { ++#ifdef OPENSSL_SYS_WINDOWS /* gai_strerror is not thread-safe under Microsoft Windows */ ++ CRYPTO_w_lock(CRYPTO_LOCK_GAI_STRERROR); ++ reason = (*p_gai_strerror.f)(err); ++ CRYPTO_w_unlock(CRYPTO_LOCK_GAI_STRERROR); ++#else ++ reason = (*p_gai_strerror.f)(err); ++#endif ++ ERR_add_error_data(1, reason); ++ } ++ return (0); ++ } ++ return (1); ++ } ++#endif ++ BIOerr(BIO_F_BIO_GETADDRINFO,BIO_R_UNSUPPORTED_METHOD); ++ return (-1); ++ } ++ ++void BIO_freeaddrinfo(struct addrinfo *ai) ++ { ++#ifdef EAI_FAMILY ++ static union { void *p; ++ void (WSAAPI *f)(struct addrinfo *); ++ } p_freeaddrinfo = {NULL}; + +-int BIO_sock_init(void) ++ if ((p_freeaddrinfo.p=DSO_global_lookup("freeaddrinfo"))!=NULL) ++ (*p_freeaddrinfo.f)(ai); ++ else ++#endif ++ BIOerr(BIO_F_BIO_FREEADDRINFO,BIO_R_UNSUPPORTED_METHOD); ++ } ++ ++int BIO_getnameinfo(const struct sockaddr *sa, size_t salen, ++ char *host, size_t hostlen, char *serv, size_t servlen, int flags) + { ++#ifdef EAI_FAMILY ++ static union { void *p; ++ int (WSAAPI *f)(const struct sockaddr *,size_t/*socklen_t*/, ++ char *,size_t,char *,size_t,int); ++ } p_getnameinfo = {NULL}; ++ /* 2nd argument to getnameinfo is specified to ++ * be socklen_t. Unfortunately there is a number ++ * of environments where socklen_t is not defined. ++ * As it's passed by value, it's safe to pass it ++ * as size_t... */ ++ ++ if ((p_getnameinfo.p=DSO_global_lookup("getnameinfo"))!=NULL) ++ { ++ if (((*p_getnameinfo.f)(sa,salen,host,hostlen,serv,servlen,flags))!=0) ++ { ++ BIOerr(BIO_F_BIO_GETNAMEINFO,BIO_R_BAD_ADDR_RLOOKUP); ++ return (0); ++ } ++ return (1); ++ } ++#endif ++ BIOerr(BIO_F_BIO_GETNAMEINFO,BIO_R_UNSUPPORTED_METHOD); ++ return (-1); ++ } ++ ++int BIO_sock_init(void) ++ { + #ifdef OPENSSL_SYS_WINDOWS + static struct WSAData wsa_state; + +@@ -619,121 +774,151 @@ static int get_ip(const char *str, unsig + return(1); + } + +-int BIO_get_accept_socket(char *host, int bind_mode) ++static int parse_ip(char *str, char **host, char **port, int *is_inet6) + { +- int ret=0; +- union { +- struct sockaddr sa; +- struct sockaddr_in sa_in; +-#if OPENSSL_USE_IPV6 +- struct sockaddr_in6 sa_in6; +-#endif +- } server,client; +- int s=INVALID_SOCKET,cs,addrlen; +- unsigned char ip[4]; +- unsigned short port; +- char *str=NULL,*e; +- char *h,*p; +- unsigned long l; +- int err_num; +- +- if (BIO_sock_init() != 1) return(INVALID_SOCKET); +- +- if ((str=BUF_strdup(host)) == NULL) return(INVALID_SOCKET); +- +- h=p=NULL; +- h=str; +- for (e=str; *e; e++) +- { +- if (*e == ':') ++ char *tmp; ++ char *h = *host = NULL; ++ char *p = *port = NULL; ++ ++ *is_inet6 = 0; ++ if (*str == '\0') ++ return (0); ++ if (*str == '[' && (tmp = strchr(str + 1, ']'))) ++ { ++ h = str + 1; ++ *tmp++ = '\0'; ++ if (*tmp == ':') ++ p = tmp + 1; ++ else if (*tmp != '\0') ++ return (0); ++ *is_inet6 = 1; ++ } ++ else ++ { ++ if ((tmp = strchr(str, ':'))) + { +- p=e; ++ h = str; ++ *tmp++ = '\0'; ++ p = tmp; + } +- else if (*e == '/') ++ else if ((tmp = strchr(str, '/'))) + { +- *e='\0'; +- break; ++ if (*(tmp + 1) != '\0') ++ return (0); ++ p = str; ++ *tmp = '\0'; + } +- } +- if (p) *p++='\0'; /* points at last ':', '::port' is special [see below] */ +- else p=h,h=NULL; +- +-#ifdef EAI_FAMILY +- do { +- static union { void *p; +- int (WSAAPI *f)(const char *,const char *, +- const struct addrinfo *, +- struct addrinfo **); +- } p_getaddrinfo = {NULL}; +- static union { void *p; +- void (WSAAPI *f)(struct addrinfo *); +- } p_freeaddrinfo = {NULL}; +- struct addrinfo *res,hint; ++ else ++ h = str; ++ } ++ if (h && (*h == '\0' || !strcmp(h, "*"))) ++ h = NULL; ++ if (p && (*p == '\0' || !strcmp(p, "*"))) ++ p = NULL; ++ *host = h; ++ *port = p; ++ return (1); ++ } + +- if (p_getaddrinfo.p==NULL) +- { +- if ((p_getaddrinfo.p=DSO_global_lookup("getaddrinfo"))==NULL || +- (p_freeaddrinfo.p=DSO_global_lookup("freeaddrinfo"))==NULL) +- p_getaddrinfo.p=(void*)-1; +- } +- if (p_getaddrinfo.p==(void *)-1) break; ++static int fill_addr(union sa_storage *sa, char *host, char *port, int is_inet6, int is_local) ++ { ++ unsigned short p; ++ int sa_len = 0; ++#ifdef OPENSSL_USE_IPV6 ++ unsigned char h[16]; ++#else ++ unsigned char h[4]; ++#endif + +- /* '::port' enforces IPv6 wildcard listener. Some OSes, +- * e.g. Solaris, default to IPv6 without any hint. Also +- * note that commonly IPv6 wildchard socket can service +- * IPv4 connections just as well... */ +- memset(&hint,0,sizeof(hint)); +- hint.ai_flags = AI_PASSIVE; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Tue Jun 26 04:50:29 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 85380106564A for ; Tue, 26 Jun 2012 04:50:27 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 26 Jun 2012 04:50:27 +0000 Date: Tue, 26 Jun 2012 04:50:27 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120626045027.85380106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238317 - in soc2012/jhagewood/diff: . diff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 04:50:29 -0000 Author: jhagewood Date: Tue Jun 26 04:50:26 2012 New Revision: 238317 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238317 Log: Modified: soc2012/jhagewood/diff/TODO soc2012/jhagewood/diff/diff/diff.c soc2012/jhagewood/diff/diff/diff.h soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/TODO ============================================================================== --- soc2012/jhagewood/diff/TODO Tue Jun 26 03:05:42 2012 (r238316) +++ soc2012/jhagewood/diff/TODO Tue Jun 26 04:50:26 2012 (r238317) @@ -11,8 +11,8 @@ --GTYPE-group-format INCOMPLETE --line-format IN PROGRESS Added new-line-format, old-line-format, and unchanged-line-format for compatibility --LTYPE-line-format INCOMPLETE ---from-file INCOMPLETE ---to-file INCOMPLETE +--from-file COMPLETE Calls exec1() twice with optarg as file input. NEEDS TESTING. +--to-file COMPLETE Calls exec1() twice with optarg as file input. NEEDS TESTING. --horizon-lines INCOMPLETE --speed-large-file INCOMPLETE --ignore-tab-expansion IN PROGRESS Functionality implemented in check(), needs debugging. (Same problem as --ignore-blank-lines?) Modified: soc2012/jhagewood/diff/diff/diff.c ============================================================================== --- soc2012/jhagewood/diff/diff/diff.c Tue Jun 26 03:05:42 2012 (r238316) +++ soc2012/jhagewood/diff/diff/diff.c Tue Jun 26 04:50:26 2012 (r238317) @@ -44,7 +44,7 @@ #include "pathnames.h" int aflag, bflag, cflag, dflag, Eflag, iflag, lflag, Nflag, Pflag, pflag, rflag; -int sflag, tflag, Tflag, wflag; +int sflag, tflag, Tflag, wflag, Toflag, Fromflag; int Bflag, yflag; int strip_cr, suppress_cl, tabsize = 8; char ignore_file_case = 0; @@ -95,7 +95,7 @@ { "exclude", required_argument, NULL, 'x' }, { "exclude-from", required_argument, NULL, 'X' }, { "expand-tabs", no_argument, NULL, 't' }, - /*{ "from-file", required_argument, NULL, OPT_FFILE },*/ + { "from-file", required_argument, NULL, OPT_FFILE }, { "forward-ed", no_argument, NULL, 'f' }, /*{ "GTYPE-group-format", required_argument, NULL, OPT_GTYPE },*/ { "help", no_argument, NULL, OPT_HELP }, @@ -132,7 +132,7 @@ { "suppress-common-lines", no_argument, NULL, OPT_SUPCL }, { "tabsize", optional_argument, NULL, OPT_TSIZE }, { "text", no_argument, NULL, 'a' }, - /*{ "to-file", required_argument, NULL, OPT_TOFILE },*/ + { "to-file", required_argument, NULL, OPT_TOFILE }, { "unchanged-line-format", required_argument, NULL, OPT_UNCHGD_LF}, { "unidirectional-new-file", no_argument, NULL, 'P' }, { "unified", optional_argument, NULL, 'U' }, @@ -162,7 +162,7 @@ int main(int argc, char **argv) { - char *ep, **oargv; + char *ep, **oargv, *args, *cmpfile1, *cmpfile2; long l; int ch, lastch, gotstdin, prevoptind, newarg; int oargc; @@ -170,6 +170,7 @@ oargv = argv; oargc = argc; gotstdin = 0; + args = "-"; lastch = '\0'; prevoptind = 1; @@ -300,6 +301,12 @@ case 'y': yflag = 1; break; + case OPT_FFILE: + Toflag = 1; + break; + case OPT_TOFILE + Fromflag: + break; case OPT_NEW_LF: case OPT_OLD_LF: case OPT_UNCHGD_LF: @@ -349,10 +356,35 @@ lastch = ch; newarg = optind != prevoptind; prevoptind = optind; + + if (ch != OPT_FFILE && ch != OPT_TOFILE) { + strcat(args, ch); + } } argc -= optind; argv += optind; + if (Toflag || Fromflag) { + if (Toflag && Fromflag) { + (void)fprintf(stderr, "--from-file and --to-file both specified."); + exit(2); + } + if (Toflag) { + if (exec1(_PATH_DIFF, args, argv[argc-2], optarg) || + exec1(_PATH_DIFF, args, argv[argc-1], optarg) { + (void)fprintf(stderr, "--to-file error."); + exit(2); + } + exit(127); + } + if (Fromflag) { + if (exec1(_PATH_DIFF, args, optarg, argv[argc-2]) || + exec1(_PATH_DIFF, args, optarg, argv[argc-1]) { + (void)fprintf(stderr, "--from-file error."); + } + exit(127); + } + } if (yflag) { /* remove y flag from args and call sdiff */ for (argv = oargv; argv && strcmp(*argv, "-y") != 0; argv++); Modified: soc2012/jhagewood/diff/diff/diff.h ============================================================================== --- soc2012/jhagewood/diff/diff/diff.h Tue Jun 26 03:05:42 2012 (r238316) +++ soc2012/jhagewood/diff/diff/diff.h Tue Jun 26 04:50:26 2012 (r238317) @@ -75,8 +75,8 @@ struct excludes *next; }; -extern int aflag, bflag, cflag, dflag, Eflag, iflag, lflag, Nflag, Pflag, pflag, rflag, - sflag, tflag, Tflag, wflag; +extern int aflag, bflag, cflag, dflag, Eflag, Fromflag, iflag, lflag, Nflag, Pflag, pflag, rflag, + sflag, tflag, Tflag, Toflag, wflag; extern int Bflag, strip_cr, suppress_cl, tabsize; extern int format, context, status; extern char ignore_file_case; Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Tue Jun 26 03:05:42 2012 (r238316) +++ soc2012/jhagewood/diff/hagewood-diff.patch Tue Jun 26 04:50:26 2012 (r238317) @@ -1,6 +1,6 @@ diff -rupN jhagewood/diff/diff-orig/diff.c jhagewood/diff/diff/diff.c --- jhagewood/diff/diff-orig/diff.c 2012-06-25 16:05:53.000000000 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-25 22:18:49.000000000 -0400 ++++ jhagewood/diff/diff/diff.c 2012-06-26 04:49:46.000000000 -0400 @@ -1,4 +1,4 @@ -/*- +/* @@ -39,7 +39,7 @@ -int format, context, status; -char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; +int aflag, bflag, cflag, dflag, Eflag, iflag, lflag, Nflag, Pflag, pflag, rflag; -+int sflag, tflag, Tflag, wflag; ++int sflag, tflag, Tflag, wflag, Toflag, Fromflag; +int Bflag, yflag; +int strip_cr, suppress_cl, tabsize = 8; +char ignore_file_case = 0; @@ -118,7 +118,7 @@ + { "exclude", required_argument, NULL, 'x' }, + { "exclude-from", required_argument, NULL, 'X' }, + { "expand-tabs", no_argument, NULL, 't' }, -+ /*{ "from-file", required_argument, NULL, OPT_FFILE },*/ ++ { "from-file", required_argument, NULL, OPT_FFILE }, { "forward-ed", no_argument, NULL, 'f' }, + /*{ "GTYPE-group-format", required_argument, NULL, OPT_GTYPE },*/ + { "help", no_argument, NULL, OPT_HELP }, @@ -165,7 +165,7 @@ + { "suppress-common-lines", no_argument, NULL, OPT_SUPCL }, + { "tabsize", optional_argument, NULL, OPT_TSIZE }, + { "text", no_argument, NULL, 'a' }, -+ /*{ "to-file", required_argument, NULL, OPT_TOFILE },*/ ++ { "to-file", required_argument, NULL, OPT_TOFILE }, + { "unchanged-line-format", required_argument, NULL, OPT_UNCHGD_LF}, + { "unidirectional-new-file", no_argument, NULL, 'P' }, { "unified", optional_argument, NULL, 'U' }, @@ -180,7 +180,7 @@ { NULL, 0, NULL, '\0'} }; -@@ -162,10 +162,10 @@ void read_excludes_file(char *); +@@ -162,14 +162,15 @@ void read_excludes_file(char *); int main(int argc, char **argv) { @@ -188,14 +188,19 @@ - long l; - int ch, lastch, gotstdin, prevoptind, newarg; - int oargc; -+ char *ep, **oargv; ++ char *ep, **oargv, *args, *cmpfile1, *cmpfile2; + long l; + int ch, lastch, gotstdin, prevoptind, newarg; + int oargc; oargv = argv; oargc = argc; -@@ -197,6 +197,7 @@ main(int argc, char **argv) + gotstdin = 0; ++ args = "-"; + + lastch = '\0'; + prevoptind = 1; +@@ -197,6 +198,7 @@ main(int argc, char **argv) break; case 'C': case 'c': @@ -203,7 +208,7 @@ format = D_CONTEXT; if (optarg != NULL) { l = strtol(optarg, &ep, 10); -@@ -213,6 +214,9 @@ main(int argc, char **argv) +@@ -213,6 +215,9 @@ main(int argc, char **argv) case 'd': dflag = 1; break; @@ -213,10 +218,16 @@ case 'e': format = D_EDIT; break; -@@ -296,15 +300,32 @@ main(int argc, char **argv) +@@ -296,15 +301,38 @@ main(int argc, char **argv) case 'y': yflag = 1; break; ++ case OPT_FFILE: ++ Toflag = 1; ++ break; ++ case OPT_TOFILE ++ Fromflag: ++ break; + case OPT_NEW_LF: + case OPT_OLD_LF: + case OPT_UNCHGD_LF: @@ -254,11 +265,40 @@ case OPT_STRIPCR: strip_cr=1; break; -@@ -332,16 +353,15 @@ main(int argc, char **argv) +@@ -328,20 +356,44 @@ main(int argc, char **argv) + lastch = ch; + newarg = optind != prevoptind; + prevoptind = optind; ++ ++ if (ch != OPT_FFILE && ch != OPT_TOFILE) { ++ strcat(args, ch); ++ } + } argc -= optind; argv += optind; - if(yflag) { ++ if (Toflag || Fromflag) { ++ if (Toflag && Fromflag) { ++ (void)fprintf(stderr, "--from-file and --to-file both specified."); ++ exit(2); ++ } ++ if (Toflag) { ++ if (exec1(_PATH_DIFF, args, argv[argc-2], optarg) || ++ exec1(_PATH_DIFF, args, argv[argc-1], optarg) { ++ (void)fprintf(stderr, "--to-file error."); ++ exit(2); ++ } ++ exit(127); ++ } ++ if (Fromflag) { ++ if (exec1(_PATH_DIFF, args, optarg, argv[argc-2]) || ++ exec1(_PATH_DIFF, args, optarg, argv[argc-1]) { ++ (void)fprintf(stderr, "--from-file error."); ++ } ++ exit(127); ++ } ++ } + if (yflag) { /* remove y flag from args and call sdiff */ - for(argv=oargv; argv && strcmp(*argv, "-y") != 0; argv++); @@ -274,7 +314,7 @@ execv(_PATH_SDIFF, oargv); _exit(127); } -@@ -380,7 +400,10 @@ main(int argc, char **argv) +@@ -380,7 +432,10 @@ main(int argc, char **argv) set_argstr(oargv, argv); if (S_ISDIR(stb1.st_mode) && S_ISDIR(stb2.st_mode)) { if (format == D_IFDEF) @@ -286,7 +326,7 @@ diffdir(argv[0], argv[1]); } else { if (S_ISDIR(stb1.st_mode)) { -@@ -402,11 +425,10 @@ main(int argc, char **argv) +@@ -402,11 +457,10 @@ main(int argc, char **argv) void * emalloc(size_t n) { @@ -299,7 +339,7 @@ if ((p = malloc(n)) == NULL) errx(2, NULL); return (p); -@@ -415,7 +437,7 @@ emalloc(size_t n) +@@ -415,7 +469,7 @@ emalloc(size_t n) void * erealloc(void *p, size_t n) { @@ -308,7 +348,7 @@ if (n == 0) errx(2, NULL); -@@ -431,13 +453,12 @@ erealloc(void *p, size_t n) +@@ -431,13 +485,12 @@ erealloc(void *p, size_t n) int easprintf(char **ret, const char *fmt, ...) { @@ -324,7 +364,7 @@ if (len < 0 || *ret == NULL) errx(2, NULL); return (len); -@@ -446,11 +467,12 @@ easprintf(char **ret, const char *fmt, . +@@ -446,11 +499,12 @@ easprintf(char **ret, const char *fmt, . char * estrdup(const char *str) { @@ -339,7 +379,7 @@ strlcpy(cp, str, len); return (cp); } -@@ -531,6 +553,7 @@ push_ignore_pats(char *pattern) +@@ -531,6 +585,7 @@ push_ignore_pats(char *pattern) void print_only(const char *path, size_t dirlen, const char *entry) { @@ -347,7 +387,7 @@ if (dirlen > 1) dirlen--; printf("Only in %.*s: %s\n", (int)dirlen, path, entry); -@@ -539,45 +562,46 @@ print_only(const char *path, size_t dirl +@@ -539,45 +594,46 @@ print_only(const char *path, size_t dirl void print_status(int val, char *path1, char *path2, char *entry) { @@ -405,7 +445,7 @@ break; } } -@@ -585,6 +609,7 @@ print_status(int val, char *path1, char +@@ -585,6 +641,7 @@ print_status(int val, char *path1, char void usage(void) { @@ -415,15 +455,16 @@ " [-L label] file1 file2\n" diff -rupN jhagewood/diff/diff-orig/diff.h jhagewood/diff/diff/diff.h --- jhagewood/diff/diff-orig/diff.h 2012-06-25 16:05:53.000000000 -0400 -+++ jhagewood/diff/diff/diff.h 2012-06-25 16:05:53.000000000 -0400 ++++ jhagewood/diff/diff/diff.h 2012-06-26 04:19:55.000000000 -0400 @@ -75,9 +75,9 @@ struct excludes { struct excludes *next; }; -extern int aflag, bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag, -+extern int aflag, bflag, cflag, dflag, Eflag, iflag, lflag, Nflag, Pflag, pflag, rflag, - sflag, tflag, Tflag, wflag; +- sflag, tflag, Tflag, wflag; -extern int Bflag, strip_cr, tabsize; ++extern int aflag, bflag, cflag, dflag, Eflag, Fromflag, iflag, lflag, Nflag, Pflag, pflag, rflag, ++ sflag, tflag, Tflag, Toflag, wflag; +extern int Bflag, strip_cr, suppress_cl, tabsize; extern int format, context, status; extern char ignore_file_case; From owner-svn-soc-all@FreeBSD.ORG Tue Jun 26 04:51:45 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 39EDE106566B for ; Tue, 26 Jun 2012 04:51:43 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 26 Jun 2012 04:51:43 +0000 Date: Tue, 26 Jun 2012 04:51:43 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120626045143.39EDE106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238318 - in soc2012/jhagewood/diff: . diff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 04:51:45 -0000 Author: jhagewood Date: Tue Jun 26 04:51:42 2012 New Revision: 238318 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238318 Log: Modified: soc2012/jhagewood/diff/diff/diff.c soc2012/jhagewood/diff/diff/pathnames.h soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/diff/diff.c ============================================================================== --- soc2012/jhagewood/diff/diff/diff.c Tue Jun 26 04:50:26 2012 (r238317) +++ soc2012/jhagewood/diff/diff/diff.c Tue Jun 26 04:51:42 2012 (r238318) @@ -357,13 +357,14 @@ newarg = optind != prevoptind; prevoptind = optind; + /* For use when executing to-file and from-file options. */ if (ch != OPT_FFILE && ch != OPT_TOFILE) { strcat(args, ch); } } argc -= optind; argv += optind; - + if (Toflag || Fromflag) { if (Toflag && Fromflag) { (void)fprintf(stderr, "--from-file and --to-file both specified."); Modified: soc2012/jhagewood/diff/diff/pathnames.h ============================================================================== --- soc2012/jhagewood/diff/diff/pathnames.h Tue Jun 26 04:50:26 2012 (r238317) +++ soc2012/jhagewood/diff/diff/pathnames.h Tue Jun 26 04:51:42 2012 (r238318) @@ -23,4 +23,5 @@ #include #define _PATH_PR "/usr/bin/pr" +#define _PATH_DIFF "/usr/bin/diff" #define _PATH_SDIFF "/usr/bin/sdiff" Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Tue Jun 26 04:50:26 2012 (r238317) +++ soc2012/jhagewood/diff/hagewood-diff.patch Tue Jun 26 04:51:42 2012 (r238318) @@ -1,6 +1,6 @@ diff -rupN jhagewood/diff/diff-orig/diff.c jhagewood/diff/diff/diff.c --- jhagewood/diff/diff-orig/diff.c 2012-06-25 16:05:53.000000000 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-26 04:49:46.000000000 -0400 ++++ jhagewood/diff/diff/diff.c 2012-06-26 04:51:13.000000000 -0400 @@ -1,4 +1,4 @@ -/*- +/* @@ -265,19 +265,21 @@ case OPT_STRIPCR: strip_cr=1; break; -@@ -328,20 +356,44 @@ main(int argc, char **argv) +@@ -328,20 +356,45 @@ main(int argc, char **argv) lastch = ch; newarg = optind != prevoptind; prevoptind = optind; + ++ /* For use when executing to-file and from-file options. */ + if (ch != OPT_FFILE && ch != OPT_TOFILE) { + strcat(args, ch); + } } argc -= optind; argv += optind; - +- - if(yflag) { ++ + if (Toflag || Fromflag) { + if (Toflag && Fromflag) { + (void)fprintf(stderr, "--from-file and --to-file both specified."); @@ -314,7 +316,7 @@ execv(_PATH_SDIFF, oargv); _exit(127); } -@@ -380,7 +432,10 @@ main(int argc, char **argv) +@@ -380,7 +433,10 @@ main(int argc, char **argv) set_argstr(oargv, argv); if (S_ISDIR(stb1.st_mode) && S_ISDIR(stb2.st_mode)) { if (format == D_IFDEF) @@ -326,7 +328,7 @@ diffdir(argv[0], argv[1]); } else { if (S_ISDIR(stb1.st_mode)) { -@@ -402,11 +457,10 @@ main(int argc, char **argv) +@@ -402,11 +458,10 @@ main(int argc, char **argv) void * emalloc(size_t n) { @@ -339,7 +341,7 @@ if ((p = malloc(n)) == NULL) errx(2, NULL); return (p); -@@ -415,7 +469,7 @@ emalloc(size_t n) +@@ -415,7 +470,7 @@ emalloc(size_t n) void * erealloc(void *p, size_t n) { @@ -348,7 +350,7 @@ if (n == 0) errx(2, NULL); -@@ -431,13 +485,12 @@ erealloc(void *p, size_t n) +@@ -431,13 +486,12 @@ erealloc(void *p, size_t n) int easprintf(char **ret, const char *fmt, ...) { @@ -364,7 +366,7 @@ if (len < 0 || *ret == NULL) errx(2, NULL); return (len); -@@ -446,11 +499,12 @@ easprintf(char **ret, const char *fmt, . +@@ -446,11 +500,12 @@ easprintf(char **ret, const char *fmt, . char * estrdup(const char *str) { @@ -379,7 +381,7 @@ strlcpy(cp, str, len); return (cp); } -@@ -531,6 +585,7 @@ push_ignore_pats(char *pattern) +@@ -531,6 +586,7 @@ push_ignore_pats(char *pattern) void print_only(const char *path, size_t dirlen, const char *entry) { @@ -387,7 +389,7 @@ if (dirlen > 1) dirlen--; printf("Only in %.*s: %s\n", (int)dirlen, path, entry); -@@ -539,45 +594,46 @@ print_only(const char *path, size_t dirl +@@ -539,45 +595,46 @@ print_only(const char *path, size_t dirl void print_status(int val, char *path1, char *path2, char *entry) { @@ -445,7 +447,7 @@ break; } } -@@ -585,6 +641,7 @@ print_status(int val, char *path1, char +@@ -585,6 +642,7 @@ print_status(int val, char *path1, char void usage(void) { @@ -1254,3 +1256,12 @@ + printf("%s %s\t%s\n", format == D_CONTEXT ? "---" : "+++", + file2, buf2); } +diff -rupN jhagewood/diff/diff-orig/pathnames.h jhagewood/diff/diff/pathnames.h +--- jhagewood/diff/diff-orig/pathnames.h 2012-06-25 16:05:53.000000000 -0400 ++++ jhagewood/diff/diff/pathnames.h 2012-06-26 04:51:36.000000000 -0400 +@@ -23,4 +23,5 @@ + #include + + #define _PATH_PR "/usr/bin/pr" ++#define _PATH_DIFF "/usr/bin/diff" + #define _PATH_SDIFF "/usr/bin/sdiff" From owner-svn-soc-all@FreeBSD.ORG Tue Jun 26 04:52:50 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 4CA61106564A for ; Tue, 26 Jun 2012 04:52:48 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 26 Jun 2012 04:52:48 +0000 Date: Tue, 26 Jun 2012 04:52:48 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120626045248.4CA61106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238319 - in soc2012/jhagewood/diff: . diff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 04:52:50 -0000 Author: jhagewood Date: Tue Jun 26 04:52:48 2012 New Revision: 238319 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238319 Log: Modified: soc2012/jhagewood/diff/diff/diff.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/diff/diff.c ============================================================================== --- soc2012/jhagewood/diff/diff/diff.c Tue Jun 26 04:51:42 2012 (r238318) +++ soc2012/jhagewood/diff/diff/diff.c Tue Jun 26 04:52:48 2012 (r238319) @@ -382,6 +382,7 @@ if (exec1(_PATH_DIFF, args, optarg, argv[argc-2]) || exec1(_PATH_DIFF, args, optarg, argv[argc-1]) { (void)fprintf(stderr, "--from-file error."); + exit(2); } exit(127); } Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Tue Jun 26 04:51:42 2012 (r238318) +++ soc2012/jhagewood/diff/hagewood-diff.patch Tue Jun 26 04:52:48 2012 (r238319) @@ -1,6 +1,6 @@ diff -rupN jhagewood/diff/diff-orig/diff.c jhagewood/diff/diff/diff.c --- jhagewood/diff/diff-orig/diff.c 2012-06-25 16:05:53.000000000 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-26 04:51:13.000000000 -0400 ++++ jhagewood/diff/diff/diff.c 2012-06-26 04:52:40.000000000 -0400 @@ -1,4 +1,4 @@ -/*- +/* @@ -265,7 +265,7 @@ case OPT_STRIPCR: strip_cr=1; break; -@@ -328,20 +356,45 @@ main(int argc, char **argv) +@@ -328,20 +356,46 @@ main(int argc, char **argv) lastch = ch; newarg = optind != prevoptind; prevoptind = optind; @@ -297,6 +297,7 @@ + if (exec1(_PATH_DIFF, args, optarg, argv[argc-2]) || + exec1(_PATH_DIFF, args, optarg, argv[argc-1]) { + (void)fprintf(stderr, "--from-file error."); ++ exit(2); + } + exit(127); + } @@ -316,7 +317,7 @@ execv(_PATH_SDIFF, oargv); _exit(127); } -@@ -380,7 +433,10 @@ main(int argc, char **argv) +@@ -380,7 +434,10 @@ main(int argc, char **argv) set_argstr(oargv, argv); if (S_ISDIR(stb1.st_mode) && S_ISDIR(stb2.st_mode)) { if (format == D_IFDEF) @@ -328,7 +329,7 @@ diffdir(argv[0], argv[1]); } else { if (S_ISDIR(stb1.st_mode)) { -@@ -402,11 +458,10 @@ main(int argc, char **argv) +@@ -402,11 +459,10 @@ main(int argc, char **argv) void * emalloc(size_t n) { @@ -341,7 +342,7 @@ if ((p = malloc(n)) == NULL) errx(2, NULL); return (p); -@@ -415,7 +470,7 @@ emalloc(size_t n) +@@ -415,7 +471,7 @@ emalloc(size_t n) void * erealloc(void *p, size_t n) { @@ -350,7 +351,7 @@ if (n == 0) errx(2, NULL); -@@ -431,13 +486,12 @@ erealloc(void *p, size_t n) +@@ -431,13 +487,12 @@ erealloc(void *p, size_t n) int easprintf(char **ret, const char *fmt, ...) { @@ -366,7 +367,7 @@ if (len < 0 || *ret == NULL) errx(2, NULL); return (len); -@@ -446,11 +500,12 @@ easprintf(char **ret, const char *fmt, . +@@ -446,11 +501,12 @@ easprintf(char **ret, const char *fmt, . char * estrdup(const char *str) { @@ -381,7 +382,7 @@ strlcpy(cp, str, len); return (cp); } -@@ -531,6 +586,7 @@ push_ignore_pats(char *pattern) +@@ -531,6 +587,7 @@ push_ignore_pats(char *pattern) void print_only(const char *path, size_t dirlen, const char *entry) { @@ -389,7 +390,7 @@ if (dirlen > 1) dirlen--; printf("Only in %.*s: %s\n", (int)dirlen, path, entry); -@@ -539,45 +595,46 @@ print_only(const char *path, size_t dirl +@@ -539,45 +596,46 @@ print_only(const char *path, size_t dirl void print_status(int val, char *path1, char *path2, char *entry) { @@ -447,7 +448,7 @@ break; } } -@@ -585,6 +642,7 @@ print_status(int val, char *path1, char +@@ -585,6 +643,7 @@ print_status(int val, char *path1, char void usage(void) { From owner-svn-soc-all@FreeBSD.ORG Tue Jun 26 07:09:31 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id C3A89106564A for ; Tue, 26 Jun 2012 07:09:29 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 26 Jun 2012 07:09:29 +0000 Date: Tue, 26 Jun 2012 07:09:29 +0000 From: scher@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120626070929.C3A89106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238322 - soc2012/scher/par_ports/head/Mk X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 07:09:32 -0000 Author: scher Date: Tue Jun 26 07:09:29 2012 New Revision: 238322 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238322 Log: [fixed] ${_TERMINATE_PROCESS_TREE} and ${_PROCESS_ACTIVE_BUILDS} scripts are moved to bsd.parallel.mk since they are not used by non parallel builds. ${_TERMINATE_PROCESS_TREE} listens either to EXIT signal. 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 Jun 26 06:02:43 2012 (r238321) +++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Tue Jun 26 07:09:29 2012 (r238322) @@ -363,12 +363,127 @@ # End of Locking variables and tools section ##################################################### -locking-config-recursive: locking-config-message lock-port-dbdir config-conditional config-recursive unlock-port-dbdir +# +# _PROCESS_ACTIVE_BUILDS - this script contains all magic, related to +# processing of background dependecy builds. +# +# $${builds_num} - current number of spawned background dependecy +# builds. If $${builds_num} < ${_parv_PARALLEL_BUILDS_NUMBER} +# then another background dependency build will be +# spawned, if there is any dependency to be spawned. +# Otherwise "sleep ${CHECK_ACTIVE_TIMEOUT}" will be called. +# $${active_builds} - a list of "pid:path:dir[:target]" or "pid:lib:dir[:target]" +# tuples of all currently being processed ports, +# spawned by this make process. +# +_PROCESS_ACTIVE_BUILDS= \ + echo "---- dependency output ----- : --- ENTER _PROCESS_ACTIVE_BUILDS SECTION "; \ + while true; do \ + builds_num=$$( ${ECHO_CMD} $${active_builds} | wc -w ); \ + if [ $${builds_num} -lt ${_parv_PARALLEL_BUILDS_NUMBER} ] && [ $${\#depends} -ne 0 ]; then \ + echo "---- dependency output ----- : WE CAN START ANOTHER PAR BUILD "; \ + break; \ + fi; \ + if [ $${builds_num} -eq 0 ] && [ $${\#depends} -eq 0 ]; then \ + ${ECHO_MSG} "===> Returning to build of ${PKGNAME}"; \ + break; \ + fi; \ + for build in $$( ${ECHO_CMD} "$${active_builds}" ); do \ + pid=$${build%%:*}; \ + dep=$${build\#*:}; \ + ps -p $${pid} > /dev/null || { \ + wait $${pid} && status=$$? || status=$$?; \ + if [ $${status} -eq 0 ]; then \ + echo "---- dependency output ----- : SOME DEP IS INSTALLED ($${dep}) "; \ + echo "---- dependency output ----- : ACTIVE BUILDS WAS _$${active_builds}_ "; \ + active_builds="$${active_builds%%$${build}*} $${active_builds\#\#*$${build}}"; \ + active_builds=$$( echo "$${active_builds}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ + builds_num=$$(( $${builds_num} - 1 )); \ + echo "---- dependency output ----- : ACTIVE BUILDS NOW _$${active_builds}_ "; \ + if [ ${.TARGET} = "lib-depends" ]; then \ + lib=$${dep%%:*}; \ + pattern="`${ECHO_CMD} $$lib | ${SED} -E -e 's/\./\\\\./g' -e 's/(\\\\)?\+/\\\\+/g'`"; \ + if ! ${LDCONFIG} ${_LDCONFIG_FLAGS} -r | ${GREP} -vwF -e "${PKGCOMPATDIR}" | ${GREP} -qwE -e "-l$$pattern"; then \ + ${ECHO_MSG} "Error: shared library \"$$lib\" does not exist"; \ + ${FALSE}; \ + fi; \ + fi; \ + elif [ $${status} -eq ${_parv_MAKE_LOCK_EXIT_STATUS} ]; then \ + echo "---- dependency output ----- : SOME DEP IS LOCKED ($${dep}) "; \ + echo "---- dependency output ----- : ACTIVE BUILDS WAS _$${active_builds}_ "; \ + active_builds="$${active_builds%%$${build}*} $${active_builds\#\#*$${build}}"; \ + active_builds=$$( echo "$${active_builds}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ + builds_num=$$(( $${builds_num} - 1 )); \ + echo "---- dependency output ----- : ACTIVE BUILDS NOW _$${active_builds}_ "; \ + echo "---- dependency output ----- : ADD IT BACK DO DEPENDS LIST "; \ + echo "---- dependency output ----- : DEPENDS WAS _$${depends}_ "; \ + depends="$${depends} $${dep}"; \ + depends=$$( echo "$${depends}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ + echo "---- dependency output ----- : DEPENDS NOW _$${depends}_ "; \ + else \ + ${ECHO_CMD} "Errors occured while building a dependency (PID - $${pid}): $${dep}"; \ + ${ECHO_CMD} "Checkout it's log"; \ + ${ECHO_CMD} "Terminating..."; \ + ${_TERMINATE_PROCESS_TREE}; \ + fi; \ + }; \ + done; \ + if { [ $${builds_num} -eq ${_parv_PARALLEL_BUILDS_NUMBER} ] || \ + ( [ $${builds_num} -gt 0 ] && [ $${\#depends} -eq 0 ] ); }; then \ + if [ ${_parv_WANT_PARALLEL_BUILD} ]; then \ + echo "---- dependency output ----- : CAN'T SPAWN MORE DEPS! SLEEP... "; \ + fi; \ + sleep ${CHECK_ACTIVE_TIMEOUT}; \ + fi; \ + done; \ + echo "---- dependency output ----- : --- LEAVE _PROCESS_ACTIVE_BUILDS SECTION " + +# +# _TERMINATE_PROCESS_TREE - this script contains all magic, related to +# terminating of the whole process tree, starting +# from ${.MAKE.PID}. +# This script implements Breadth-first traversal of +# the process tree. It prevents processes of the +# current level from evaluation of any commands using +# STOP signal. Then it determines children of +# processes of the current level of process tree +# and stops them and so forth... +# It is necessary to stop processes to avoid new +# untracked pids. Finally, this script kills $${pids_to_kill} +# +# $${pids_to_kill} - all pids of the process tree, starting from ${.MAKE.PID} +# +_TERMINATE_PROCESS_TREE= \ + [ $$? -eq 0 ] && exit 0; \ + ${ECHO_CMD} Terminating process tree strating from ${.MAKE.PID}; \ + pids_to_kill=${.MAKE.PID}; \ + /bin/kill -STOP ${.MAKE.PID} 2> /dev/null || ${DO_NADA}; \ + ppids=$$( ps -xao pid,ppid | awk "{ if (\$$2==${.MAKE.PID}) {print \$$1} }" ); \ + pids_to_kill="$${pids_to_kill} $${ppids}"; \ + /bin/kill -STOP "$${ppids%%$$$$*} $${ppids\#\#*$$$$}" 2> /dev/null || ${DO_NADA}; \ + while true; do \ + tmp_ppids=$$(${ECHO_CMD} $${ppids}); \ + ppids=""; \ + for ppid in $${tmp_ppids}; do \ + children=$$( ps -xao pid,ppid | awk "{ if (\$$2==$${ppid}) {print \$$1} }" ); \ + if [ $${\#children} -eq 0 ]; then continue; fi; \ + pids_to_kill="$${pids_to_kill} $${children}"; \ + ppids="$${ppids} $${children}"; \ + /bin/kill -STOP $${children} 2> /dev/null || ${DO_NADA}; \ + done; \ + if [ $${\#ppids} -eq 0 ]; then break; fi; \ + done; \ + ${ECHO_CMD} PIDs to kill: $${pids_to_kill}; \ + /bin/kill -KILL $${pids_to_kill} 2> /dev/null || ${DO_NADA} + +##################################################### + +locking-config-recursive: locking-config-message lock-port-dbdir config-recursive unlock-port-dbdir locking-config-message: @${ECHO_MSG} "===> Setting user-specified options for ${PKGNAME} and dependencies"; -config-recursive: +config-recursive: config-conditional @for dir in $$(${MAKE} run-depends-list build-depends-list | uniq); do \ while true; do \ ( cd $$dir; ${MAKE} locking-config-recursive ) || { \ Modified: soc2012/scher/par_ports/head/Mk/bsd.port.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.port.mk Tue Jun 26 06:02:43 2012 (r238321) +++ soc2012/scher/par_ports/head/Mk/bsd.port.mk Tue Jun 26 07:09:29 2012 (r238322) @@ -1133,12 +1133,6 @@ # It does not matter what value is assigned. # Example: _parv_WANT_PARALLEL_BUILD=yes # -# CHECK_ACTIVE_TIMEOUT -# - timeout in seconds before next check of active builds in case -# if port is prohibit to spawn another background process. -# Consider that this variable is also used in non-parallel build. -# Default: 2 -# ############### ENDF OF PAR_PORTS SPECIFIC COMMENT LINE ############### # # End of the list of all variables that need to be defined in a port. @@ -1160,16 +1154,11 @@ ############### PAR_PORTS SPECIFIC COMMENT LINE ############### -CHECK_ACTIVE_TIMEOUT?= 2 - .if defined(_parv_WANT_PARALLEL_BUILD) .include "${PORTSDIR}/Mk/bsd.parallel.mk" .endif -# non-parallel build -.if !defined(_parv_WANT_PARALLEL_BUILD) -_parv_PARALLEL_BUILDS_NUMBER= 1 -.endif +_PROCESS_ACTIVE_BUILDS?= ${DO_NADA} .if !target(lock-port-dbdir) lock-port-dbdir: @@ -4359,7 +4348,7 @@ check-categories check-makevars check-desktop-entries \ check-depends check-active-build-conflicts identify-install-conflicts check-deprecated \ check-vulnerable check-license check-config buildanyway-message \ - options-message locking-config-recursive + options-message locking-config-recursive seal _PKG_DEP= check-sanity locking-config-recursive _PKG_SEQ= pkg-depends @@ -5104,128 +5093,6 @@ fi; \ fi; \ -############### PAR_PORTS SPECIFIC COMMENT LINE ############### -# -# _PROCESS_ACTIVE_BUILDS - this script contains all magic, related to -# processing of background dependecy builds. -# -# $${builds_num} - current number of spawned background dependecy -# builds. If $${builds_num} < ${_parv_PARALLEL_BUILDS_NUMBER} -# then another background dependency build will be -# spawned, if there is any dependency to be spawned. -# Otherwise "sleep ${CHECK_ACTIVE_TIMEOUT}" will be called. -# $${active_builds} - a list of "pid:path:dir[:target]" or "pid:lib:dir[:target]" -# tuples of all currently being processed ports, -# spawned by this make process. -# -############### END OF PAR_PORTS SPECIFIC COMMENT LINE ############### - -.if defined(_parv_WANT_PARALLEL_BUILD) -_PROCESS_ACTIVE_BUILDS= \ - echo "---- dependency output ----- : --- ENTER _PROCESS_ACTIVE_BUILDS SECTION "; \ - while true; do \ - builds_num=$$( ${ECHO_CMD} $${active_builds} | wc -w ); \ - if [ $${builds_num} -lt ${_parv_PARALLEL_BUILDS_NUMBER} ] && [ $${\#depends} -ne 0 ]; then \ - echo "---- dependency output ----- : WE CAN START ANOTHER PAR BUILD "; \ - break; \ - fi; \ - if [ $${builds_num} -eq 0 ] && [ $${\#depends} -eq 0 ]; then \ - ${ECHO_MSG} "===> Returning to build of ${PKGNAME}"; \ - break; \ - fi; \ - for build in $$( ${ECHO_CMD} "$${active_builds}" ); do \ - pid=$${build%%:*}; \ - dep=$${build\#*:}; \ - ps -p $${pid} > /dev/null || { \ - wait $${pid} && status=$$? || status=$$?; \ - if [ $${status} -eq 0 ]; then \ - echo "---- dependency output ----- : SOME DEP IS INSTALLED ($${dep}) "; \ - echo "---- dependency output ----- : ACTIVE BUILDS WAS _$${active_builds}_ "; \ - active_builds="$${active_builds%%$${build}*} $${active_builds\#\#*$${build}}"; \ - active_builds=$$( echo "$${active_builds}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ - builds_num=$$(( $${builds_num} - 1 )); \ - echo "---- dependency output ----- : ACTIVE BUILDS NOW _$${active_builds}_ "; \ - if [ ${.TARGET} = "lib-depends" ]; then \ - lib=$${dep%%:*}; \ - pattern="`${ECHO_CMD} $$lib | ${SED} -E -e 's/\./\\\\./g' -e 's/(\\\\)?\+/\\\\+/g'`"; \ - if ! ${LDCONFIG} ${_LDCONFIG_FLAGS} -r | ${GREP} -vwF -e "${PKGCOMPATDIR}" | ${GREP} -qwE -e "-l$$pattern"; then \ - ${ECHO_MSG} "Error: shared library \"$$lib\" does not exist"; \ - ${FALSE}; \ - fi; \ - fi; \ - elif [ $${status} -eq ${_parv_MAKE_LOCK_EXIT_STATUS} ]; then \ - echo "---- dependency output ----- : SOME DEP IS LOCKED ($${dep}) "; \ - echo "---- dependency output ----- : ACTIVE BUILDS WAS _$${active_builds}_ "; \ - active_builds="$${active_builds%%$${build}*} $${active_builds\#\#*$${build}}"; \ - active_builds=$$( echo "$${active_builds}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ - builds_num=$$(( $${builds_num} - 1 )); \ - echo "---- dependency output ----- : ACTIVE BUILDS NOW _$${active_builds}_ "; \ - echo "---- dependency output ----- : ADD IT BACK DO DEPENDS LIST "; \ - echo "---- dependency output ----- : DEPENDS WAS _$${depends}_ "; \ - depends="$${depends} $${dep}"; \ - depends=$$( echo "$${depends}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ - echo "---- dependency output ----- : DEPENDS NOW _$${depends}_ "; \ - else \ - ${ECHO_CMD} "Errors occured while building a dependency (PID - $${pid}): $${dep}"; \ - ${ECHO_CMD} "Checkout it's log"; \ - ${ECHO_CMD} "Terminating..."; \ - ${_TERMINATE_PROCESS_TREE}; \ - fi; \ - }; \ - done; \ - if { [ $${builds_num} -eq ${_parv_PARALLEL_BUILDS_NUMBER} ] || \ - ( [ $${builds_num} -gt 0 ] && [ $${\#depends} -eq 0 ] ); }; then \ - if [ ${_parv_WANT_PARALLEL_BUILD} ]; then \ - echo "---- dependency output ----- : CAN'T SPAWN MORE DEPS! SLEEP... "; \ - fi; \ - sleep ${CHECK_ACTIVE_TIMEOUT}; \ - fi; \ - done; \ - echo "---- dependency output ----- : --- LEAVE _PROCESS_ACTIVE_BUILDS SECTION " -.else -_PROCESS_ACTIVE_BUILDS= ${DO_NADA} -.endif - -############### PAR_PORTS SPECIFIC COMMENT LINE ############### -# -# _TERMINATE_PROCESS_TREE - this script contains all magic, related to -# terminating of the whole process tree, starting -# from ${.MAKE.PID}. -# This script implements Breadth-first traversal of -# the process tree. It prevents processes of the -# current level from evaluation of any commands using -# STOP signal. Then it determines children of -# processes of the current level of process tree -# and stops them and so forth... -# It is necessary to stop processes to avoid new -# untracked pids. Finally, this script kills $${pids_to_kill} -# -# $${pids_to_kill} - all pids of the process tree, starting from ${.MAKE.PID} -# -############### END OF PAR_PORTS SPECIFIC COMMENT LINE ############### - -_TERMINATE_PROCESS_TREE= \ - ${ECHO_CMD} Terminating process tree strating from ${.MAKE.PID}; \ - pids_to_kill=${.MAKE.PID}; \ - /bin/kill -STOP ${.MAKE.PID} 2> /dev/null || ${DO_NADA}; \ - ppids=$$( ps -xao pid,ppid | awk "{ if (\$$2==${.MAKE.PID}) {print \$$1} }" ); \ - pids_to_kill="$${pids_to_kill} $${ppids}"; \ - /bin/kill -STOP "$${ppids%%$$$$*} $${ppids\#\#*$$$$}" 2> /dev/null || ${DO_NADA}; \ - while true; do \ - tmp_ppids=$$(${ECHO_CMD} $${ppids}); \ - ppids=""; \ - for ppid in $${tmp_ppids}; do \ - children=$$( ps -xao pid,ppid | awk "{ if (\$$2==$${ppid}) {print \$$1} }" ); \ - if [ $${\#children} -eq 0 ]; then continue; fi; \ - pids_to_kill="$${pids_to_kill} $${children}"; \ - ppids="$${ppids} $${children}"; \ - /bin/kill -STOP $${children} 2> /dev/null || ${DO_NADA}; \ - done; \ - if [ $${\#ppids} -eq 0 ]; then break; fi; \ - done; \ - ${ECHO_CMD} PIDs to kill: $${pids_to_kill}; \ - /bin/kill -KILL $${pids_to_kill} 2> /dev/null || ${DO_NADA} - ############### PAR_PORTS SPECIFIC COMMENT LINE ############### # # $${notfound} codes : 0 - dep found @@ -5239,7 +5106,7 @@ .if defined(${deptype}_DEPENDS) .if !defined(NO_DEPENDS) @if [ ! ${INSTALLS_DEPENDS} ]; then \ - trap '${_TERMINATE_PROCESS_TREE}' INT TERM; \ + trap '${_TERMINATE_PROCESS_TREE}' EXIT INT TERM; \ fi; \ depends=`${ECHO_CMD} "${${deptype}_DEPENDS}"`; \ depends=$$( echo "$${depends}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ @@ -5319,7 +5186,7 @@ pkg_info=`${PKG_INFO} -E "$$inverse_dep" || ${TRUE}`; \ if [ "$$pkg_info" != "" ]; then \ ${ECHO_MSG} "===> Found $$pkg_info, but you need to upgrade to $$prog."; \ - ${_TERMINATE_PROCESS_TREE}; \ + exit 1; \ fi; \ fi; \ elif ${WHICH} "$$prog" > /dev/null 2>&1 ; then \ @@ -5391,7 +5258,7 @@ lib-depends: .if defined(LIB_DEPENDS) && !defined(NO_DEPENDS) @if [ ! ${INSTALLS_DEPENDS} ]; then \ - trap '${_TERMINATE_PROCESS_TREE}' INT TERM; \ + trap '${_TERMINATE_PROCESS_TREE}' EXIT INT TERM; \ fi; \ depends=`${ECHO_CMD} "${LIB_DEPENDS}"`; \ depends=$$( echo "$${depends}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ @@ -5451,6 +5318,11 @@ ${ECHO_MSG} " => No directory for $$lib. Skipping.."; \ else \ ${_INSTALL_DEPENDS} \ + if [ !${_parv_WANT_PARALLEL_BUILD} ]; then \ + if ! ${LDCONFIG} ${_LDCONFIG_FLAGS} -r | ${GREP} -vwF -e "${PKGCOMPATDIR}" | ${GREP} -qwE -e "-l$$pattern"; then \ + ${ECHO_MSG} "Error: shared library \"$$lib\" does not exist"; \ + ${FALSE}; \ + fi; \ if [ $${spawned} ]; then \ echo "---- dependency output ----- : SPAWNED PID $${spawned}"; \ active_builds="$${active_builds} $${spawned}:$${i}"; \ From owner-svn-soc-all@FreeBSD.ORG Tue Jun 26 09:31:26 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 7E80C1065670 for ; Tue, 26 Jun 2012 09:31:24 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 26 Jun 2012 09:31:24 +0000 Date: Tue, 26 Jun 2012 09:31:24 +0000 From: scher@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120626093124.7E80C1065670@hub.freebsd.org> Cc: Subject: socsvn commit: r238324 - soc2012/scher/par_ports/head/Mk X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 09:31:26 -0000 Author: scher Date: Tue Jun 26 09:31:23 2012 New Revision: 238324 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238324 Log: [fixed] default value for ${CHECK_ACTIVE_TIMEOUT} 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 Tue Jun 26 07:56:15 2012 (r238323) +++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Tue Jun 26 09:31:23 2012 (r238324) @@ -152,6 +152,8 @@ _parv_LOCK_ATTEMPT_TIMEOUT?= 2 _parv_ON_LOCK_FEEDBACK_TIMEOUT?= 2 +CHECK_ACTIVE_TIMEOUT?= 2 + _parv_ON_LOCK_EXIT_STATUS= 2 _parv_LOCKF_EX_TEMPFAIL= 75 From owner-svn-soc-all@FreeBSD.ORG Tue Jun 26 12:45:14 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 4CBAA106564A for ; Tue, 26 Jun 2012 12:45:13 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 26 Jun 2012 12:45:13 +0000 Date: Tue, 26 Jun 2012 12:45:13 +0000 From: scher@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120626124513.4CBAA106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238332 - soc2012/scher/par_ports/head/Mk X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 12:45:14 -0000 Author: scher Date: Tue Jun 26 12:45:12 2012 New Revision: 238332 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238332 Log: [fixed] new execution flow for options checking. tmp file is used, to store already checked ports, to skip them later 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 Tue Jun 26 11:13:58 2012 (r238331) +++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Tue Jun 26 12:45:12 2012 (r238332) @@ -480,25 +480,35 @@ ##################################################### +##################################################### +# Parallel targets section +# TODO: outline intergation with bsd.port.mk +# locking-config-recursive: locking-config-message lock-port-dbdir config-recursive unlock-port-dbdir locking-config-message: @${ECHO_MSG} "===> Setting user-specified options for ${PKGNAME} and dependencies"; +# TODO: doc is needed +_parv_CHECKED_CONFIG_F_PREFIX= already-checked-config + config-recursive: config-conditional - @for dir in $$(${MAKE} run-depends-list build-depends-list | uniq); do \ - while true; do \ - ( cd $$dir; ${MAKE} locking-config-recursive ) || { \ - status=$$?; \ - if [ $${status} -eq ${_parv_MAKE_LOCK_EXIT_STATUS} ]; then \ - sleep ${_parv_LOCK_ATTEMPT_TIMEOUT}; \ - continue; \ - else \ - exit 1; \ - fi; \ - }; \ - break; \ - done; \ + @if [ ! ${DEP_CHECK_CONFIG} ]; then \ + already_checked_file=/tmp/${_parv_CHECKED_CONFIG_F_PREFIX}.${.MAKE.PID}; \ + trap '${RM} -rf $${already_checked_file};' EXIT TERM INT; \ + ${ECHO_CMD} ${.CURDIR} > $${already_checked_file}; \ + else \ + already_checked_file=${DEP_CHECK_CONFIG}; \ + fi; \ + for dir in $$(${MAKE} run-depends-list build-depends-list | uniq); do \ + if [ ! $$(grep $${dir}$$ $${already_checked_file}) ]; then \ + ${ECHO_CMD} configure options for $${dir}; \ + ( cd $${dir}; \ + ${MAKE} "DEP_CHECK_CONFIG=$${already_checked_file}" config-recursive ); \ + ${ECHO_CMD} $${dir} >> $${already_checked_file}; \ + else \ + ${ECHO_CMD} $${dir} has been configed; \ + fi; \ done check-lock: @@ -550,4 +560,7 @@ do-unlock: @${DO_NADA} +# End of Parallel targets section +##################################################### + .endif # !defined(_POSTMKINCLUDED) && !defined(Parallel_Pre_Include) From owner-svn-soc-all@FreeBSD.ORG Tue Jun 26 12:51:57 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id EF5F91065672 for ; Tue, 26 Jun 2012 12:51:54 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 26 Jun 2012 12:51:54 +0000 Date: Tue, 26 Jun 2012 12:51:54 +0000 From: scher@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120626125154.EF5F91065672@hub.freebsd.org> Cc: Subject: socsvn commit: r238333 - soc2012/scher/par_ports/head/Mk X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 12:51:57 -0000 Author: scher Date: Tue Jun 26 12:51:54 2012 New Revision: 238333 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238333 Log: [fixed] new execution flow for options checking. (without debugging output) 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 Tue Jun 26 12:45:12 2012 (r238332) +++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Tue Jun 26 12:51:54 2012 (r238333) @@ -506,8 +506,6 @@ ( cd $${dir}; \ ${MAKE} "DEP_CHECK_CONFIG=$${already_checked_file}" config-recursive ); \ ${ECHO_CMD} $${dir} >> $${already_checked_file}; \ - else \ - ${ECHO_CMD} $${dir} has been configed; \ fi; \ done From owner-svn-soc-all@FreeBSD.ORG Tue Jun 26 13:07:46 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id DB4DD1065672 for ; Tue, 26 Jun 2012 13:07:43 +0000 (UTC) (envelope-from aleek@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 26 Jun 2012 13:07:43 +0000 Date: Tue, 26 Jun 2012 13:07:43 +0000 From: aleek@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120626130743.DB4DD1065672@hub.freebsd.org> Cc: Subject: socsvn commit: r238334 - in soc2012/aleek/beaglexm-armv6: sys/arm/conf usr.bin/make X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 13:07:46 -0000 Author: aleek Date: Tue Jun 26 13:07:43 2012 New Revision: 238334 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238334 Log: patched file usr.bin/make/Makefile and added MFS root for beagleboard kernel Modified: soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM soc2012/aleek/beaglexm-armv6/usr.bin/make/Makefile Modified: soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM Tue Jun 26 12:51:54 2012 (r238333) +++ soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM Tue Jun 26 13:07:43 2012 (r238334) @@ -81,7 +81,8 @@ #device mmcsd # mmc/sd flash cards # Boot device is 2nd slice on MMC/SD card -options ROOTDEVNAME=\"ufs:mmcsd0s2\" +#options ROOTDEVNAME=\"ufs:mmcsd0s2\" + # Console and misc device uart @@ -126,3 +127,7 @@ options FDT_DTB_STATIC makeoptions FDT_DTS_FILE=beagleboardxm.dts +options MD_ROOT +options MD_ROOT_SIZE=8192 +makeoptions MFS_IMAGE=/home/alek/beaglexm-armv6/arm.ramfs +options ROOTDEVNAME=\"ufs:md0\" Modified: soc2012/aleek/beaglexm-armv6/usr.bin/make/Makefile ============================================================================== --- soc2012/aleek/beaglexm-armv6/usr.bin/make/Makefile Tue Jun 26 12:51:54 2012 (r238333) +++ soc2012/aleek/beaglexm-armv6/usr.bin/make/Makefile Tue Jun 26 13:07:43 2012 (r238334) @@ -10,7 +10,8 @@ lst.c main.c make.c parse.c proc.c shell.c str.c suff.c targ.c \ util.c var.c -.if ${MK_SHARED_TOOLCHAIN} == "no" +#.if ${MK_SHARED_TOOLCHAIN} == "no" +.if !defined(MK_SHARED_TOOLCHAIN) || ${MK_SHARED_TOOLCHAIN} == "no" NO_SHARED?= YES .endif From owner-svn-soc-all@FreeBSD.ORG Tue Jun 26 13:35:22 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 34A041065672 for ; Tue, 26 Jun 2012 13:35:20 +0000 (UTC) (envelope-from aleek@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 26 Jun 2012 13:35:20 +0000 Date: Tue, 26 Jun 2012 13:35:20 +0000 From: aleek@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120626133520.34A041065672@hub.freebsd.org> Cc: Subject: socsvn commit: r238335 - in soc2012/aleek/beaglexm-armv6: . lib/libc lib/libc/arm sys sys/boot sys/boot/arm/uboot sys/boot/fdt sys/boot/uboot/common sys/boot/uboot/lib sys/modules sys/modules/cpsw X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 13:35:22 -0000 Author: aleek Date: Tue Jun 26 13:35:19 2012 New Revision: 238335 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238335 Log: merge with armv6 branch Added: soc2012/aleek/beaglexm-armv6/sys/modules/cpsw/ - copied from r238334, mirror/FreeBSD/projects/armv6/sys/modules/cpsw/ Modified: soc2012/aleek/beaglexm-armv6/ (props changed) soc2012/aleek/beaglexm-armv6/lib/libc/ (props changed) soc2012/aleek/beaglexm-armv6/lib/libc/arm/Symbol.map soc2012/aleek/beaglexm-armv6/sys/ (props changed) soc2012/aleek/beaglexm-armv6/sys/boot/ (props changed) soc2012/aleek/beaglexm-armv6/sys/boot/arm/uboot/Makefile soc2012/aleek/beaglexm-armv6/sys/boot/arm/uboot/ldscript.arm soc2012/aleek/beaglexm-armv6/sys/boot/fdt/fdt_loader_cmd.c soc2012/aleek/beaglexm-armv6/sys/boot/uboot/common/metadata.c soc2012/aleek/beaglexm-armv6/sys/boot/uboot/lib/copy.c soc2012/aleek/beaglexm-armv6/sys/boot/uboot/lib/devicename.c soc2012/aleek/beaglexm-armv6/sys/boot/uboot/lib/disk.c soc2012/aleek/beaglexm-armv6/sys/boot/uboot/lib/elf_freebsd.c soc2012/aleek/beaglexm-armv6/sys/boot/uboot/lib/libuboot.h soc2012/aleek/beaglexm-armv6/sys/modules/Makefile Modified: soc2012/aleek/beaglexm-armv6/lib/libc/arm/Symbol.map ============================================================================== --- soc2012/aleek/beaglexm-armv6/lib/libc/arm/Symbol.map Tue Jun 26 13:07:43 2012 (r238334) +++ soc2012/aleek/beaglexm-armv6/lib/libc/arm/Symbol.map Tue Jun 26 13:35:19 2012 (r238335) @@ -33,6 +33,10 @@ sbrk; }; +FBSD_1.3 { + __flt_rounds; +}; + FBSDprivate_1.0 { /* PSEUDO syscalls */ __sys_getlogin; @@ -70,7 +74,6 @@ __divdf3; __floatsisf; __floatsidf; - __flt_rounds; __fixsfsi; __fixdfsi; __fixunssfsi; Modified: soc2012/aleek/beaglexm-armv6/sys/boot/arm/uboot/Makefile ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/boot/arm/uboot/Makefile Tue Jun 26 13:07:43 2012 (r238334) +++ soc2012/aleek/beaglexm-armv6/sys/boot/arm/uboot/Makefile Tue Jun 26 13:35:19 2012 (r238335) @@ -7,6 +7,9 @@ BINDIR?= /boot INSTALLFLAGS= -b WARNS?= 1 +# Address at which ubldr will be loaded. +# This varies for different boards and SOCs. +UBLDR_LOADADDR?= 0x1000000 # Architecture-specific loader code SRCS= start.S conf.c vers.c @@ -77,7 +80,9 @@ CFLAGS+= -ffreestanding -LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.${MACHINE_CPUARCH} +LDFLAGS= -nostdlib -static +LDFLAGS+= -T ldscript.generated +LDFLAGS+= -T ${.CURDIR}/ldscript.${MACHINE_CPUARCH} # Pull in common loader code .PATH: ${.CURDIR}/../../uboot/common @@ -102,6 +107,18 @@ cat ${.ALLSRC} | \ awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} +${PROG}: ldscript.generated ${.CURDIR}/ldscript.${MACHINE_CPUARCH} + +ldscript.generated:: + rm -f ldscript.generated.tmp + echo "UBLDR_LOADADDR = ${UBLDR_LOADADDR};" >ldscript.generated.tmp + if diff ldscript.generated ldscript.generated.tmp > /dev/null; then \ + true; \ + else \ + rm -f ldscript.generated; \ + mv ldscript.generated.tmp ldscript.generated; \ + fi + .PATH: ${.CURDIR}/../../forth FILES= loader.help Modified: soc2012/aleek/beaglexm-armv6/sys/boot/arm/uboot/ldscript.arm ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/boot/arm/uboot/ldscript.arm Tue Jun 26 13:07:43 2012 (r238334) +++ soc2012/aleek/beaglexm-armv6/sys/boot/arm/uboot/ldscript.arm Tue Jun 26 13:35:19 2012 (r238335) @@ -5,7 +5,7 @@ SECTIONS { /* Read-only sections, merged into text segment: */ - . = 0x1000000 + SIZEOF_HEADERS; + . = UBLDR_LOADADDR + SIZEOF_HEADERS; .interp : { *(.interp) } .hash : { *(.hash) } .dynsym : { *(.dynsym) } Modified: soc2012/aleek/beaglexm-armv6/sys/boot/fdt/fdt_loader_cmd.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/boot/fdt/fdt_loader_cmd.c Tue Jun 26 13:07:43 2012 (r238334) +++ soc2012/aleek/beaglexm-armv6/sys/boot/fdt/fdt_loader_cmd.c Tue Jun 26 13:35:19 2012 (r238335) @@ -57,11 +57,17 @@ #define STR(number) #number #define STRINGIFY(number) STR(number) -#define COPYOUT(s,d,l) archsw.arch_copyout((vm_offset_t)(s), d, l) +#define COPYOUT(s,d,l) archsw.arch_copyout(s, d, l) +#define COPYIN(s,d,l) archsw.arch_copyin(s, d, l) #define FDT_STATIC_DTB_SYMBOL "fdt_static_dtb" +/* Local copy of FDT */ static struct fdt_header *fdtp = NULL; +/* Size of FDT blob */ +static size_t fdtp_size = 0; +/* Location of FDT in kernel or module */ +static vm_offset_t fdtp_va = 0; static int fdt_cmd_nyi(int argc, char *argv[]); @@ -98,21 +104,19 @@ static char cwd[FDT_CWD_LEN] = "/"; static vm_offset_t -fdt_find_static_dtb(void) +fdt_find_static_dtb() { + Elf_Dyn dyn; Elf_Sym sym; - vm_offset_t dyntab, esym; + vm_offset_t dyntab, esym, strtab, symtab, fdt_start; uint64_t offs; struct preloaded_file *kfp; struct file_metadata *md; - Elf_Sym *symtab; - Elf_Dyn *dyn; - char *strtab, *strp; - int i, sym_count; - - symtab = NULL; - dyntab = esym = 0; - strtab = strp = NULL; + char *strp; + int sym_count; + + symtab = strtab = dyntab = esym = 0; + strp = NULL; offs = __elfN(relocation_offset); @@ -123,28 +127,29 @@ md = file_findmetadata(kfp, MODINFOMD_ESYM); if (md == NULL) return (0); - COPYOUT(md->md_data, &esym, sizeof(esym)); + bcopy(md->md_data, &esym, sizeof(esym)); + // esym is already offset md = file_findmetadata(kfp, MODINFOMD_DYNAMIC); if (md == NULL) return (0); - COPYOUT(md->md_data, &dyntab, sizeof(dyntab)); - + bcopy(md->md_data, &dyntab, sizeof(dyntab)); dyntab += offs; /* Locate STRTAB and DYNTAB */ - for (dyn = (Elf_Dyn *)dyntab; dyn->d_tag != DT_NULL; dyn++) { - if (dyn->d_tag == DT_STRTAB) { - strtab = (char *)(uintptr_t)(dyn->d_un.d_ptr + offs); - continue; - } else if (dyn->d_tag == DT_SYMTAB) { - symtab = (Elf_Sym *)(uintptr_t) - (dyn->d_un.d_ptr + offs); - continue; + for (;;) { + COPYOUT(dyntab, &dyn, sizeof(dyn)); + if (dyn.d_tag == DT_STRTAB) { + strtab = (vm_offset_t)(dyn.d_un.d_ptr) + offs; + } else if (dyn.d_tag == DT_SYMTAB) { + symtab = (vm_offset_t)(dyn.d_un.d_ptr) + offs; + } else if (dyn.d_tag == DT_NULL) { + break; } + dyntab += sizeof(dyn); } - if (symtab == NULL || strtab == NULL) { + if (symtab == 0 || strtab == 0) { /* * No symtab? No strtab? That should not happen here, * and should have been verified during __elfN(loadimage). @@ -153,7 +158,7 @@ return (0); } - sym_count = (int)((Elf_Sym *)esym - symtab) / sizeof(Elf_Sym); + sym_count = (int)(esym - symtab) / sizeof(Elf_Sym); /* * The most efficent way to find a symbol would be to calculate a @@ -165,26 +170,27 @@ * we are eliminating symbols type of which is not STT_NOTYPE, or(and) * those which binding attribute is not STB_GLOBAL. */ - for (i = 0; i < sym_count; i++) { - COPYOUT(symtab + i, &sym, sizeof(sym)); + fdt_start = 0; + while (sym_count > 0 && fdt_start == 0) { + COPYOUT(symtab, &sym, sizeof(sym)); + symtab += sizeof(sym); + --sym_count; if (ELF_ST_BIND(sym.st_info) != STB_GLOBAL || ELF_ST_TYPE(sym.st_info) != STT_NOTYPE) continue; - - strp = strdupout((vm_offset_t)(strtab + sym.st_name)); - if (strcmp(strp, FDT_STATIC_DTB_SYMBOL) == 0) { - /* Found a match ! */ - free(strp); - return ((vm_offset_t)(sym.st_value + offs)); - } + strp = strdupout(strtab + sym.st_name); + if (strcmp(strp, FDT_STATIC_DTB_SYMBOL) == 0) + fdt_start = (vm_offset_t)sym.st_value + offs; free(strp); } - return (0); + printf("fdt_start: 0x%08jX\n", (intmax_t)fdt_start); + return (fdt_start); } static int fdt_setup_fdtp() { + struct fdt_header header; struct preloaded_file *bfp; int err; @@ -193,15 +199,26 @@ */ bfp = file_findfile(NULL, "dtb"); if (bfp == NULL) { - if ((fdtp = (struct fdt_header *)fdt_find_static_dtb()) == 0) { + if ((fdtp_va = fdt_find_static_dtb()) == 0) { command_errmsg = "no device tree blob found!"; + printf("%s\n", command_errmsg); return (CMD_ERROR); } } else { /* Dynamic blob has precedence over static. */ - fdtp = (struct fdt_header *)bfp->f_addr; + fdtp_va = bfp->f_addr; } + COPYOUT(fdtp_va, &header, sizeof(header)); + fdtp_size = fdt_totalsize(&header); + fdtp = malloc(fdtp_size); + if (fdtp == NULL) { + command_errmsg = "can't allocate memory for device tree copy"; + printf("%s\n", command_errmsg); + return (CMD_ERROR); + } + COPYOUT(fdtp_va, fdtp, fdtp_size); + /* * Validate the blob. */ @@ -317,6 +334,8 @@ /* We want to modify every subnode of /cpus */ o = fdt_path_offset(fdtp, "/cpus"); + if (o < 0) + return; /* maxo should contain offset of node next to /cpus */ depth = 0; @@ -545,7 +564,7 @@ /* * Locate the blob, fix it up and return its location. */ -void * +vm_offset_t fdt_fixup(void) { const char *env; @@ -561,7 +580,7 @@ err = fdt_setup_fdtp(); if (err) { sprintf(command_errbuf, "No valid device tree blob found!"); - return (NULL); + return (0); } /* Create /chosen node (if not exists) */ @@ -616,7 +635,9 @@ fdt_setprop(fdtp, chosen, "fixup-applied", NULL, 0); success: - return (fdtp); + /* Overwrite the FDT with the fixed version. */ + COPYIN(fdtp, fdtp_va, fdtp_size); + return (fdtp_va); } int @@ -634,7 +655,7 @@ /* * Check if uboot env vars were parsed already. If not, do it now. */ - if (fdt_fixup() == NULL) + if (fdt_fixup() == 0) return (CMD_ERROR); /* @@ -1151,6 +1172,8 @@ else sprintf(command_errbuf, "Could not add/modify property!\n"); + } else { + COPYIN(fdtp, fdtp_va, fdtp_size); } return (rv); } @@ -1371,6 +1394,8 @@ if (rv) { sprintf(command_errbuf, "could not delete node"); return (CMD_ERROR); + } else { + COPYIN(fdtp, fdtp_va, fdtp_size); } return (CMD_OK); } @@ -1401,6 +1426,8 @@ sprintf(command_errbuf, "Could not add node!\n"); return (CMD_ERROR); + } else { + COPYIN(fdtp, fdtp_va, fdtp_size); } return (CMD_OK); } Modified: soc2012/aleek/beaglexm-armv6/sys/boot/uboot/common/metadata.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/boot/uboot/common/metadata.c Tue Jun 26 13:07:43 2012 (r238334) +++ soc2012/aleek/beaglexm-armv6/sys/boot/uboot/common/metadata.c Tue Jun 26 13:35:19 2012 (r238335) @@ -42,7 +42,7 @@ #include "glue.h" #if defined(LOADER_FDT_SUPPORT) -extern int fdt_fixup(void); +extern vm_offset_t fdt_fixup(void); #endif /* @@ -72,6 +72,7 @@ md_getboothowto(char *kargs) { char *cp; + char *p; int howto; int active; int i; @@ -132,10 +133,12 @@ if (getenv(howto_names[i].ev) != NULL) howto |= howto_names[i].mask; } - if (!strcmp(getenv("console"), "comconsole")) - howto |= RB_SERIAL; - if (!strcmp(getenv("console"), "nullconsole")) - howto |= RB_MUTE; + if ((p = getenv("console"))) { + if (!strcmp(p, "comconsole")) + howto |= RB_SERIAL; + if (!strcmp(p, "nullconsole")) + howto |= RB_MUTE; + } return(howto); } @@ -334,7 +337,7 @@ #if defined(LOADER_FDT_SUPPORT) /* Handle device tree blob */ dtbp = fdt_fixup(); - if (dtbp != (vm_offset_t)NULL) + if (dtbp != 0) file_addmetadata(kfp, MODINFOMD_DTBP, sizeof dtbp, &dtbp); else pager_output("WARNING! Trying to fire up the kernel, but no " Modified: soc2012/aleek/beaglexm-armv6/sys/boot/uboot/lib/copy.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/boot/uboot/lib/copy.c Tue Jun 26 13:07:43 2012 (r238334) +++ soc2012/aleek/beaglexm-armv6/sys/boot/uboot/lib/copy.c Tue Jun 26 13:35:19 2012 (r238335) @@ -29,32 +29,64 @@ __FBSDID("$FreeBSD$"); #include +#include + +#include "api_public.h" +#include "glue.h" /* * MD primitives supporting placement of module data - * - * XXX should check load address/size against memory top. */ +void * +uboot_vm_translate(vm_offset_t o) { + struct sys_info *si; + static uintptr_t start = 0; + static size_t size = 0; + int i; + + if (size == 0) { + if ((si = ub_get_sys_info()) == NULL) + panic("could not retrieve system info"); + + /* Find start/size of largest DRAM block. */ + for (i = 0; i < si->mr_no; i++) { + if (si->mr[i].flags == MR_ATTR_DRAM + && si->mr[i].size > size) { + start = si->mr[i].start; + size = si->mr[i].size; + } + } + + if (size <= 0) + panic("No suitable DRAM?\n"); + /* + printf("Loading into memory region 0x%08X-0x%08X (%d MiB)\n", + start, start + size, size / 1024 / 1024); + */ + } + if (o > size) + panic("Address 0x%08jX bigger than size 0x%08X\n", + (intmax_t)o, size); + return (void *)(start + o); +} + ssize_t uboot_copyin(const void *src, vm_offset_t dest, const size_t len) { - - bcopy(src, (void *)dest, len); + bcopy(src, uboot_vm_translate(dest), len); return (len); } ssize_t uboot_copyout(const vm_offset_t src, void *dest, const size_t len) { - - bcopy((void *)src, dest, len); + bcopy(uboot_vm_translate(src), dest, len); return (len); } ssize_t uboot_readin(const int fd, vm_offset_t dest, const size_t len) { - - return (read(fd, (void *) dest, len)); + return (read(fd, uboot_vm_translate(dest), len)); } Modified: soc2012/aleek/beaglexm-armv6/sys/boot/uboot/lib/devicename.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/boot/uboot/lib/devicename.c Tue Jun 26 13:07:43 2012 (r238334) +++ soc2012/aleek/beaglexm-armv6/sys/boot/uboot/lib/devicename.c Tue Jun 26 13:35:19 2012 (r238335) @@ -131,6 +131,10 @@ *(cp + 1) != ':') { pnum = strtol(cp + 1, &cp, 10); ptype = PTYPE_GPT; + } else if (*cp == 's' && *(cp + 1) && + *(cp + 1) != ':') { + pnum = strtol(cp + 1, &cp, 10); + ptype = PTYPE_MBR; } else { pnum = *cp - 'a'; ptype = PTYPE_BSDLABEL; @@ -218,6 +222,9 @@ else if (dev->d_kind.disk.ptype == PTYPE_GPT) cp += sprintf(cp, "p%i", dev->d_kind.disk.pnum); + else if (dev->d_kind.disk.ptype == PTYPE_MBR) + cp += sprintf(cp, "s%i", + dev->d_kind.disk.pnum); } strcat(cp, ":"); Modified: soc2012/aleek/beaglexm-armv6/sys/boot/uboot/lib/disk.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/boot/uboot/lib/disk.c Tue Jun 26 13:07:43 2012 (r238334) +++ soc2012/aleek/beaglexm-armv6/sys/boot/uboot/lib/disk.c Tue Jun 26 13:35:19 2012 (r238335) @@ -398,6 +398,94 @@ } static int +stor_open_mbr(struct open_dev *od, struct uboot_devdesc *dev) +{ + char *buf = NULL; + struct dos_partition *dp; + int err, i, part; + + od->od_nparts = 0; + od->od_partitions = NULL; + + /* Block size must be at least 512 bytes. */ + if (od->od_bsize < 512) + return (ENXIO); + + /* Read MBR */ + buf = malloc(od->od_bsize); + if (!buf) { + stor_printf("could not allocate memory for MBR\n"); + return (ENOMEM); + } + err = stor_readdev(dev, 0, 1, buf); + if (err) { + stor_printf("MBR read error=%d\n", err); + err = EIO; + goto out; + } + + /* Check the slice table magic. */ + if (le16toh(*((uint16_t *)(buf + DOSMAGICOFFSET))) != DOSMAGIC) { + err = ENXIO; + goto out; + } + + /* Save information about partitions. */ + dp = (struct dos_partition *)(buf + DOSPARTOFF); + od->od_partitions = calloc(NDOSPART, sizeof(struct gpt_part)); + if (!od->od_partitions) { + stor_printf("could not allocate memory for MBR partitions\n"); + err = ENOMEM; + goto out; + } + + part = 0; + for (i = 0; i < NDOSPART; i++) { + u_int32_t start = le32dec(&dp[i].dp_start); + u_int32_t size = le32dec(&dp[i].dp_size); + uuid_t *u = NULL; + + /* Map MBR partition types to GPT partition types. */ + switch (dp[i].dp_typ) { + case DOSPTYP_386BSD: + u = &freebsd_ufs; + break; + /* XXX Other types XXX */ + } + + if (u) { + od->od_partitions[part].gp_type = *u; + od->od_partitions[part].gp_index = i + 1; + od->od_partitions[part].gp_start = start; + od->od_partitions[part].gp_end = start + size; + part += 1; + } + } + od->od_nparts = part; + + if (od->od_nparts == 0) { + err = EINVAL; + goto out; + } + + dev->d_disk.ptype = PTYPE_MBR; + + /* XXX Be smarter here? XXX */ + if (dev->d_disk.pnum == 0) + dev->d_disk.pnum = od->od_partitions[0].gp_index; + + for (i = 0; i < od->od_nparts; i++) + if (od->od_partitions[i].gp_index == dev->d_disk.pnum) + od->od_bstart = od->od_partitions[i].gp_start; + +out: + if (err && od->od_partitions) + free(od->od_partitions); + free(buf); + return (err); +} + +static int stor_open_bsdlabel(struct open_dev *od, struct uboot_devdesc *dev) { char *buf; @@ -443,7 +531,7 @@ lbasize_t real_size; int err, handle; - debugf("reading size=%d @ 0x%08x\n", size, (uint32_t)buf); + debugf("reading blk=%d size=%d @ 0x%08x\n", (int)blk, size, (uint32_t)buf); handle = stor_info[dev->d_unit]; err = ub_dev_read(handle, buf, size, blk, &real_size); @@ -495,7 +583,10 @@ od->od_bsize = di->di_stor.block_size; od->od_bstart = 0; - if ((err = stor_open_gpt(od, dev)) != 0) + err = stor_open_gpt(od, dev); + if (err != 0) + err = stor_open_mbr(od, dev); + if (err != 0) err = stor_open_bsdlabel(od, dev); if (err != 0) @@ -517,6 +608,8 @@ od = (struct open_dev *)dev->d_disk.data; if (dev->d_disk.ptype == PTYPE_GPT && od->od_nparts != 0) free(od->od_partitions); + if (dev->d_disk.ptype == PTYPE_MBR && od->od_nparts != 0) + free(od->od_partitions); free(od); dev->d_disk.data = NULL; Modified: soc2012/aleek/beaglexm-armv6/sys/boot/uboot/lib/elf_freebsd.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/boot/uboot/lib/elf_freebsd.c Tue Jun 26 13:07:43 2012 (r238334) +++ soc2012/aleek/beaglexm-armv6/sys/boot/uboot/lib/elf_freebsd.c Tue Jun 26 13:35:19 2012 (r238335) @@ -38,6 +38,7 @@ #include #include "bootstrap.h" +#include "libuboot.h" extern vm_offset_t md_load(char *, vm_offset_t *); @@ -69,6 +70,7 @@ vm_offset_t mdp; Elf_Ehdr *e; int error; + void (*entry)(void *); if ((fmp = file_findmetadata(fp, MODINFOMD_ELFHDR)) == NULL) return (EFTYPE); @@ -78,11 +80,12 @@ if ((error = md_load(fp->f_args, &mdp)) != 0) return (error); - printf("Kernel entry at 0x%x ...\n", e->e_entry); + entry = uboot_vm_translate(e->e_entry); + printf("Kernel entry at 0x%x...\n", (unsigned)entry); dev_cleanup(); - (*(void (*)())e->e_entry)((void *)mdp); + (*entry)((void *)mdp); panic("exec returned"); } Modified: soc2012/aleek/beaglexm-armv6/sys/boot/uboot/lib/libuboot.h ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/boot/uboot/lib/libuboot.h Tue Jun 26 13:07:43 2012 (r238334) +++ soc2012/aleek/beaglexm-armv6/sys/boot/uboot/lib/libuboot.h Tue Jun 26 13:35:19 2012 (r238335) @@ -45,6 +45,7 @@ #define PTYPE_BSDLABEL 1 #define PTYPE_GPT 2 +#define PTYPE_MBR 3 /* * Default network packet alignment in memory @@ -59,6 +60,7 @@ extern struct netif_driver uboot_net; extern struct devsw uboot_storage; +void *uboot_vm_translate(vm_offset_t); ssize_t uboot_copyin(const void *src, vm_offset_t dest, const size_t len); ssize_t uboot_copyout(const vm_offset_t src, void *dest, const size_t len); ssize_t uboot_readin(const int fd, vm_offset_t dest, const size_t len); Modified: soc2012/aleek/beaglexm-armv6/sys/modules/Makefile ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/modules/Makefile Tue Jun 26 13:07:43 2012 (r238334) +++ soc2012/aleek/beaglexm-armv6/sys/modules/Makefile Tue Jun 26 13:35:19 2012 (r238335) @@ -71,6 +71,7 @@ ${_coff} \ ${_coretemp} \ ${_cp} \ + ${_cpsw} \ ${_cpuctl} \ ${_cpufreq} \ ${_crypto} \ @@ -721,6 +722,7 @@ .if ${MACHINE_CPUARCH} == "arm" _cfi= cfi +_cpsw= cpsw .endif .if ${MACHINE_CPUARCH} == "ia64" From owner-svn-soc-all@FreeBSD.ORG Tue Jun 26 15:05:21 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id F1800106566B for ; Tue, 26 Jun 2012 15:05:18 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 26 Jun 2012 15:05:18 +0000 Date: Tue, 26 Jun 2012 15:05:18 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120626150518.F1800106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238337 - soc2012/oleksandr/udf-head/sys/fs/udf2 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 15:05:21 -0000 Author: oleksandr Date: Tue Jun 26 15:05:18 2012 New Revision: 238337 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238337 Log: fix double translation number of blocks in udf_strategy and replace field of some structures Modified: 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_readwrite.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 Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf.h ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf.h Tue Jun 26 14:51:35 2012 (r238336) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf.h Tue Jun 26 15:05:18 2012 (r238337) @@ -259,10 +259,6 @@ uint32_t sector_size; struct udf_args mount_args; int flags; - uid_t anon_uid; - gid_t anon_gid; - uid_t nobody_uid; - gid_t nobody_gid; /* iconv */ void *iconv_d2l; /* disk to local */ Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c Tue Jun 26 14:51:35 2012 (r238336) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_allocation.c Tue Jun 26 15:05:18 2012 (r238337) @@ -565,8 +565,11 @@ ext_offset = 0; UDF_UNLOCK_NODE(ump->metadata_node, 0); - if (flags != UDF_EXT_ALLOCATED) + if (flags != UDF_EXT_ALLOCATED) { + DPRINTF(TRANSLATE, ("Metadata partion translation " + "failed: not allocated\n")); return EINVAL; + } /* * vpart and lb_num are updated, translate again since we @@ -623,7 +626,7 @@ uint16_t vpart_num; if (!udf_node) - return ENOENT; + return (ENOENT); KASSERT(num_lb > 0,("num_lb > 0")); @@ -646,7 +649,7 @@ *lsector = UDF_TRANS_INTERN; *maxblks = 1; UDF_UNLOCK_NODE(udf_node, 0); - return 0; + return (0); } /* find first overlapping extent */ @@ -654,7 +657,16 @@ slot = 0; for (;;) { udf_get_adslot(udf_node, slot, &s_ad, &eof); + DPRINTF(ADWLK, ("slot %d, eof = %d, flags = %d, len = %d, " + "lb_num = %d, part = %d\n", slot, eof, + UDF_EXT_FLAGS(le32toh(s_ad.len)), + UDF_EXT_LEN(le32toh(s_ad.len)), + le32toh(s_ad.loc.lb_num), + le16toh(s_ad.loc.part_num))); if (eof) { + DPRINTF(TRANSLATE, + ("Translate file extent " + "failed: can't seek location\n")); UDF_UNLOCK_NODE(udf_node, 0); return EINVAL; } @@ -680,6 +692,8 @@ vpart_num = le16toh(s_ad.loc.part_num); ext_offset = block * lb_size - foffset; + + /* process extent, don't forget to advance on ext_offset! */ lb_num += (ext_offset + lb_size -1) / lb_size; ext_remain = (len - ext_offset + lb_size -1) / lb_size; @@ -707,6 +721,8 @@ *maxblks = MIN(ext_remain, translen); break; default: + DPRINTF(TRANSLATE, ("Translate file extend " + "failed: bad flags %x\n", flags)); UDF_UNLOCK_NODE(udf_node, 0); return EINVAL; } @@ -721,7 +737,6 @@ * Translate an extent (in logical_blocks) into logical block numbers; used * for read and write operations. DOESNT't check extents. */ -#if 0 int udf_translate_file_extent(struct udf_node *udf_node, uint32_t from, uint32_t num_lb, @@ -744,7 +759,7 @@ if (!udf_node) return ENOENT; - KASSERT(num_lb > 0); + KASSERT(num_lb > 0, "num_lb > 0"); UDF_LOCK_NODE(udf_node, 0); @@ -890,6 +905,7 @@ return 0; } +#if 0 /* --------------------------------------------------------------------- */ static int Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_readwrite.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_readwrite.c Tue Jun 26 14:51:35 2012 (r238336) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_readwrite.c Tue Jun 26 15:05:18 2012 (r238337) @@ -335,9 +335,10 @@ /* off_t lblkno, rblkno; */ uint32_t sector_size, blks; /* buf_offset; */ struct vnode *devvp = ump->devvp; + uint32_t logical_secsize = 2048; sector_size = ump->sector_size; - blks = btodb(sector_size); + blks = btodb(logical_secsize); while (sectors > 0 && error == 0) { if ((error = bread(devvp, start*blks, sector_size, NOCRED, Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c Tue Jun 26 14:51:35 2012 (r238336) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c Tue Jun 26 15:05:18 2012 (r238337) @@ -198,7 +198,7 @@ di->disc_flags = MMC_DFLAGS_UNRESTRICTED; /* TODO problem with last_possible_lba on resizable VND; request */ - di->last_possible_lba = psize; + di->last_possible_lba = psize/sector_size; di->sector_size = sector_size; di->num_sessions = 1; @@ -1191,10 +1191,10 @@ udf_read_vds_extent(struct udf_mount *ump, uint32_t loc, uint32_t len) { union dscrptr *dscr; - int error; uint32_t sector_size, dscr_size; + int error; - sector_size = ump->sector_size; + sector_size = ump->discinfo.sector_size; /* loc is sectornr, len is in bytes */ error = EIO; @@ -1222,6 +1222,7 @@ /* dscr is assigned into ump */ error = udf_process_vds_descriptor(ump, dscr); if (error) + free(dscr, M_UDFTEMP); break; /* assert((dscr_size % sector_size) == 0); */ Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.h ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.h Tue Jun 26 14:51:35 2012 (r238336) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.h Tue Jun 26 15:05:18 2012 (r238337) @@ -100,8 +100,8 @@ // uint16_t vpart_num, uint64_t *lmapping, uint64_t *pmapping); int udf_bmap_translate(struct udf_node *udf_node, uint32_t block, uint64_t *lsector, uint32_t *maxblks); -//int udf_translate_file_extent(struct udf_node *node, -// uint32_t from, uint32_t num_lb, uint64_t *map); +int udf_translate_file_extent(struct udf_node *node, + uint32_t from, uint32_t num_lb, uint64_t *map); void udf_get_adslot(struct udf_node *udf_node, int slot, struct long_ad *icb, int *eof); int udf_append_adslot(struct udf_node *udf_node, int *slot, struct long_ad *icb); Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Tue Jun 26 14:51:35 2012 (r238336) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Tue Jun 26 15:05:18 2012 (r238337) @@ -194,6 +194,7 @@ td = curthread; opts = mp->mnt_optnew; DPRINTF(CALL, ("udf_mount called\n")); + /* * Unconditionally mount as read-only. */ @@ -201,20 +202,22 @@ mp->mnt_flag |= MNT_RDONLY; MNT_IUNLOCK(mp); - /* No root filesystem support */ + /* No root filesystem support. Probably not a big deal, since the + * bootloader doesn't understand UDF + */ if (mp->mnt_flag & MNT_ROOTFS) return (ENOTSUP); - /* handle request for updating mount parameters */ - /* TODO can't update my mountpoint yet */ - if (mp->mnt_flag & MNT_UPDATE) - return (0); - fspec = NULL; error = vfs_getopt(opts, "from", (void **)&fspec, &len); if (!error && fspec[len - 1] != '\0') return (EINVAL); + /* handle request for updating mount parameters */ + /* TODO can't update my mountpoint yet */ + if (mp->mnt_flag & MNT_UPDATE) + return (0); + /* Check that the mount device exists */ if (fspec == NULL) return (EINVAL); @@ -225,6 +228,7 @@ return (error); NDFREE(&nd, NDF_ONLY_PNBUF); devvp = nd.ni_vp; + if (vn_isdisk(devvp, &error) == 0) { vput(devvp); return (error); @@ -465,10 +469,10 @@ ump->flags = *udf_flags; /* read in disk info from options */ - ump->anon_uid = 0; - ump->anon_gid = 0; - ump->nobody_uid = -1; - ump->nobody_gid = -1; + ump->mount_args.anon_uid = 0; + ump->mount_args.anon_gid = 0; + ump->mount_args.nobody_uid = -1; + ump->mount_args.nobody_gid = -1; #if 0 optdata = NULL; error = vfs_getopt(opts, "first_trackblank", &optdata, &len); Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vnops.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vnops.c Tue Jun 26 14:51:35 2012 (r238336) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vnops.c Tue Jun 26 15:05:18 2012 (r238337) @@ -419,21 +419,24 @@ struct vnode *vp = ap->a_vp; /* our node */ struct udf_node *udf_node = VTOI(vp); uint64_t lsector; - int error; uint32_t maxblks; + int error; if (ap->a_bop != NULL) - *ap->a_bop = udf_node->ump->bo; + *ap->a_bop = &udf_node->ump->devvp->v_bufobj; if (ap->a_bnp == NULL) - return 0; + return (0); + + if (ap->a_runb) + *ap->a_runb = 0; /* get logical block and run */ error = udf_bmap_translate(udf_node, ap->a_bn, &lsector, &maxblks); if (error) return error; - /* convert to dev blocks */ + /* Translate logical to phisascal sector number*/ if (lsector == UDF_TRANS_INTERN) return EOPNOTSUPP; else if (lsector == UDF_TRANS_ZERO) @@ -443,17 +446,20 @@ /* set runlength of maximum block size */ if (ap->a_runp) - *ap->a_runp = 0; + *ap->a_runp = 0; if (ap->a_runb) *ap->a_runb = 0; /* return success */ - return 0; + return (0); } static int -udf_strategy(struct vop_strategy_args *ap) +udf_strategy(struct vop_strategy_args /* { + struct vnode *a_vp; + struct buf *a_bp; + } */ *ap) { struct vnode *vp = ap->a_vp; struct buf *bp = ap->a_bp; @@ -464,44 +470,64 @@ uint32_t lb_size, from, sectors; uint32_t maxblks; + DPRINTF(STRATEGY, ("udf_strategy called\n")); + + /* check if we ought to be here */ if (vp->v_type == VBLK || vp->v_type == VCHR) panic("udf_strategy: spec"); + /* only filebuffers ought to be read/write by this, no descriptors */ + /* assert(bp->b_blkno >= 0);*/ + /* get sector size */ lb_size = udf_node->ump->sector_size; + + /* calculate sector to start from */ from = bp->b_blkno; + + /* calculate length to fetch/store in sectors */ sectors = bp->b_bcount / lb_size; + /* assert(bp->b_count > 0); */ - /* get logical block and run */ - error = udf_bmap_translate(udf_node, bp->b_lblkno, &lsector, &maxblks); - if (error) { - bp->b_error = error; - bufdone(bp); - return error; - } + /* NEVER assume later that this buffer is already translated */ + /* bp->b_lblkno = bp->b_blkno; */ - if (bp->b_iocmd & BIO_READ) { - if (lsector == UDF_TRANS_ZERO) { - memset(bp->b_data, 0, lb_size); - if ((bp->b_flags & B_ASYNC) == 0) - bufwait(bp); - } else if (lsector == UDF_TRANS_INTERN) { - error = udf_read_internal(udf_node, (uint8_t *) bp->b_data); - if (error) - bp->b_error = error; + /* check assertions: we OUGHT to always get multiples of this */ + /* assert(sectors * lb_size == bp->b_bcount); */ + + if (bp->b_blkno == bp->b_lblkno) { + /* get logical block and run */ + error = udf_bmap_translate(udf_node, bp->b_lblkno, &lsector, &maxblks); + if (error) { + bp->b_error = error; bufdone(bp); - if ((bp->b_flags & B_ASYNC) == 0) - bufwait(bp); + return (error); + } + if (bp->b_iocmd & BIO_READ) { + if (lsector == UDF_TRANS_ZERO) { + /* copy sezo sector */ + memset(bp->b_data, 0, lb_size); + if ((bp->b_flags & B_ASYNC) == 0) + bufwait(bp); + /* pre-check if its an internal */ + } else if (lsector == UDF_TRANS_INTERN) { + error = udf_read_internal(udf_node, (uint8_t *) bp->b_data); + if (error) + bp->b_error = error; + bufdone(bp); + if ((bp->b_flags & B_ASYNC) == 0) + bufwait(bp); + } else { + /* bmap gives sector numbers. bio works with device blocks */ + bp->b_blkno = lsector * (udf_node->ump->sector_size/DEV_BSIZE); + } } else { - bp->b_blkno = lsector * (udf_node->ump->sector_size/DEV_BSIZE); - bp->b_iooffset = dbtob(bp->b_blkno); - BO_STRATEGY(bo, bp); + return (ENOTSUP); } - } else { - return ENOTSUP; } - - return bp->b_error; + bp->b_iooffset = dbtob(bp->b_blkno); + BO_STRATEGY(bo, bp); + return (bp->b_error); } @@ -537,6 +563,8 @@ udf_node = VTOI(vp); ump = udf_node->ump; + DPRINTF(READDIR, ("udf_readdir_called\n")); + /* This operation only makes sense on directory nodes. */ if (vp->v_type != VDIR) return ENOTDIR; @@ -551,6 +579,7 @@ } dirent = malloc(sizeof(struct dirent), M_UDFTEMP, M_WAITOK | M_ZERO); + if (ap->a_ncookies != NULL) { /* is this the max number possible? */ ncookies = uio->uio_resid / 8; @@ -571,6 +600,7 @@ * stream */ if (uio->uio_offset == 0) { + DPRINTF(READDIR, ("\t'.' inserted\n")); memset(dirent, 0, sizeof(struct dirent)); dirent->d_fileno = udf_get_node_id(&udf_node->loc); dirent->d_type = DT_DIR; @@ -678,8 +708,12 @@ } bail: + /* tell the calling layer whether we need to be called again */ *ap->a_eofflag = (uio->uio_offset >= file_size); + if (error < 0) + error = 0; + if (ap->a_ncookies != NULL) { if (error) { free(cookies, M_UDFTEMP); @@ -690,7 +724,7 @@ } free(dirent, M_UDFTEMP); - return error; + return (error); } /* --------------------------------------------------------------------- */ @@ -919,9 +953,9 @@ /* do the uid/gid translation game */ if (uid == (uid_t) -1) - uid = ump->anon_uid; + uid = ump->mount_args.anon_uid; if (gid == (gid_t) -1) - gid = ump->anon_gid; + gid = ump->mount_args.anon_gid; /* * BUG-ALERT: UDF doesn't count '.' as an entry, so we'll have to add From owner-svn-soc-all@FreeBSD.ORG Tue Jun 26 15:11:10 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 6903D1065674 for ; Tue, 26 Jun 2012 15:11:08 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 26 Jun 2012 15:11:08 +0000 Date: Tue, 26 Jun 2012 15:11:08 +0000 From: gpf@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120626151108.6903D1065674@hub.freebsd.org> Cc: Subject: socsvn commit: r238338 - soc2012/gpf/pefs_kmod/sys/fs/pefs X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 15:11:10 -0000 Author: gpf Date: Tue Jun 26 15:11:08 2012 New Revision: 238338 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238338 Log: - lookup vnodes in checksum index tables during pefs_node_get_lookupkey (VFS_VGET, VFS_FHTOVP). I did not test with FHTOVP, NFS tests have a low priority for the moment. - make use of negative hint for these lookups Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_checksum.c 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 Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h ============================================================================== --- soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h Tue Jun 26 15:05:18 2012 (r238337) +++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs.h Tue Jun 26 15:11:08 2012 (r238338) @@ -122,6 +122,7 @@ #define PN_WANTRECYCLE 0x000100 #define PN_LOCKBUF_SMALL 0x001000 #define PN_LOCKBUF_LARGE 0x002000 +#define PN_NO_CHECKSUM 0x000010 struct pefs_node { LIST_ENTRY(pefs_node) pn_listentry; Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_checksum.c ============================================================================== --- soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_checksum.c Tue Jun 26 15:05:18 2012 (r238337) +++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_checksum.c Tue Jun 26 15:11:08 2012 (r238338) @@ -65,7 +65,7 @@ return (nbucket); } -static void +static int pefs_checksum_index_lookup(struct pefs_checksum_index_entry *pcie, struct vnode *vp) { struct pefs_checksum_index_entry target_pcie; @@ -97,7 +97,7 @@ if (target_pcie.pcie_file_id == pcie->pcie_file_id) { pn->pn_checksum_index_entry = start; printf("checksum lookup: found1!\n"); - return; + return (0); } } @@ -123,32 +123,35 @@ if (target_pcie.pcie_file_id == pcie->pcie_file_id) { pn->pn_checksum_index_entry = start; printf("checksum lookup: found2!\n"); - return; + return (0); } } pn->pn_checksum_index_entry = NULL; printf("checksum lookup: not found!\n"); + return (ENOENT); } void pefs_checksum_lookup(char *enc_name, size_t enc_name_len, struct componentname *cnp, struct vnode *vp) { struct pefs_checksum_index_entry pcie; + struct pefs_node *pn = VP_TO_PN(vp); char *buf; size_t buf_len; int error, r; printf("gpf: checksum code @ lookup\n"); - if (cnp->cn_nameiop != LOOKUP || (vp->v_type != VREG && vp->v_type != VLNK)) - return; + if ((cnp != NULL && cnp->cn_nameiop != LOOKUP) || (vp->v_type != VREG && vp->v_type != VLNK) + || ((pn->pn_flags & PN_NO_CHECKSUM) != 0)) + goto not_found; /* XXXgpf: What if user wants integrity checking for .pefs.db or .conf? */ /* XXXgpf: [TODO] move this check to a mini function */ if (strncmp(enc_name, ".pefs.db", enc_name_len) == 0 || strncmp(enc_name, ".pefs.conf", enc_name_len) == 0 || strncmp(enc_name, ".pefs.checksum", enc_name_len) == 0) - return; + goto not_found; enc_name++; enc_name_len--; @@ -165,8 +168,16 @@ memcpy(&(pcie.pcie_file_id), buf, sizeof(pcie.pcie_file_id)); pcie.pcie_file_id = be64toh(pcie.pcie_file_id); printf("id to lookup: %llu\n", pcie.pcie_file_id); - pefs_checksum_index_lookup(&pcie, vp); + error = pefs_checksum_index_lookup(&pcie, vp); + if (error != 0) { + free(buf, M_TEMP); + goto not_found; + } } free(buf, M_TEMP); + return; + +not_found: + pn->pn_flags|= PN_NO_CHECKSUM; } Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_subr.c ============================================================================== --- soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_subr.c Tue Jun 26 15:05:18 2012 (r238337) +++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_subr.c Tue Jun 26 15:11:08 2012 (r238338) @@ -52,6 +52,7 @@ #include #include +#include #include typedef int pefs_node_init_fn(struct mount *mp, struct pefs_node *pn, @@ -455,8 +456,24 @@ pefs_node_get_lookupkey(struct mount *mp, struct vnode *lvp, struct vnode **vpp, struct ucred *cred) { + struct pefs_mount *pm = VFS_TO_PEFS(mp); + char *encname; + int encname_len, error; + MPASS(cred != NULL); - return (pefs_node_get(mp, lvp, vpp, pefs_node_init_lookupkey, cred)); + error = pefs_node_get(mp, lvp, vpp, pefs_node_init_lookupkey, cred); + if ((error == 0) && (pm->pm_flags & PM_CHECKSUM) != 0) { + encname_len = MAXNAMLEN + 1; + encname = malloc(encname_len, M_TEMP, M_WAITOK); + + error = pefs_node_lookup_name(lvp, NULL, cred, encname, &encname_len); + if (error == 0) { + printf("lookupkey encname=%.*s\n",(int)encname_len, encname); + pefs_checksum_lookup(encname, encname_len, NULL, *vpp); + } + free(encname, M_TEMP); + } + return (error); } static __inline void Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vfsops.c ============================================================================== --- soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vfsops.c Tue Jun 26 15:05:18 2012 (r238337) +++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vfsops.c Tue Jun 26 15:11:08 2012 (r238338) @@ -617,6 +617,7 @@ pefs_vget(struct mount *mp, ino_t ino, int flags, struct vnode **vpp) { int error; + error = VFS_VGET(VFS_TO_PEFS(mp)->pm_lowervfs, ino, flags, vpp); if (error != 0) return (error); Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c ============================================================================== --- soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Tue Jun 26 15:05:18 2012 (r238337) +++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vnops.c Tue Jun 26 15:11:08 2012 (r238338) @@ -486,6 +486,7 @@ int nokey_lookup, skip_lookup; int error; + /* XXXgpf: [TODO] PEFSDEBUGs instead of printfs */ printf("pefs_lookup: op=%lx, name=%.*s\n", cnp->cn_nameiop, (int)cnp->cn_namelen, cnp->cn_nameptr); From owner-svn-soc-all@FreeBSD.ORG Tue Jun 26 17:05:12 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id A158C1065675 for ; Tue, 26 Jun 2012 17:05:11 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 26 Jun 2012 17:05:11 +0000 Date: Tue, 26 Jun 2012 17:05:11 +0000 From: gmiller@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120626170511.A158C1065675@hub.freebsd.org> Cc: Subject: socsvn commit: r238342 - in soc2012/gmiller/locking-head: . lib/libwitness X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 17:05:12 -0000 Author: gmiller Date: Tue Jun 26 17:05:11 2012 New Revision: 238342 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238342 Log: r238091@FreeBSD-dev: root | 2012-06-19 04:15:46 -0500 Add a wrapper for pthread_mutex_lock() to test the wrapper implementation approach. Modified: soc2012/gmiller/locking-head/ (props changed) soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Modified: soc2012/gmiller/locking-head/lib/libwitness/wrappers.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Tue Jun 26 16:45:18 2012 (r238341) +++ soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Tue Jun 26 17:05:11 2012 (r238342) @@ -1 +1,10 @@ +#include + +int _pthread_mutex_lock(pthread_mutex_t *mutex); + +int +pthread_mutex_lock(pthread_mutex_t *mutex) +{ + return _pthread_mutex_lock(mutex); +} From owner-svn-soc-all@FreeBSD.ORG Tue Jun 26 17:10:16 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 48FD8106566B for ; Tue, 26 Jun 2012 17:10:14 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 26 Jun 2012 17:10:14 +0000 Date: Tue, 26 Jun 2012 17:10:14 +0000 From: gmiller@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120626171014.48FD8106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238343 - in soc2012/gmiller/locking-head: . lib/libwitness X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 17:10:16 -0000 Author: gmiller Date: Tue Jun 26 17:10:14 2012 New Revision: 238343 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238343 Log: r238275@FreeBSD-dev: root | 2012-06-19 17:30:54 -0500 Begin adding libwitness code. Added: soc2012/gmiller/locking-head/lib/libwitness/graph.c soc2012/gmiller/locking-head/lib/libwitness/graph.h soc2012/gmiller/locking-head/lib/libwitness/lists.c Modified: soc2012/gmiller/locking-head/ (props changed) soc2012/gmiller/locking-head/lib/libwitness/Makefile Modified: soc2012/gmiller/locking-head/lib/libwitness/Makefile ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/Makefile Tue Jun 26 17:05:11 2012 (r238342) +++ soc2012/gmiller/locking-head/lib/libwitness/Makefile Tue Jun 26 17:10:14 2012 (r238343) @@ -4,7 +4,7 @@ LIB= witness SHLIB_MAJOR= 1 -SRCS= wrappers.c +SRCS= wrappers.c graph.c lists.c DPADD= ${LIBTHR} LDADD= -lthr Added: soc2012/gmiller/locking-head/lib/libwitness/graph.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/gmiller/locking-head/lib/libwitness/graph.c Tue Jun 26 17:10:14 2012 (r238343) @@ -0,0 +1,9 @@ + +#include "graph.h" + +int +insert_edge(struct graph_node *from, struct graph_node *to) +{ + from = from; to = to; + return 0; +} Added: soc2012/gmiller/locking-head/lib/libwitness/graph.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/gmiller/locking-head/lib/libwitness/graph.h Tue Jun 26 17:10:14 2012 (r238343) @@ -0,0 +1,5 @@ + +struct graph_node { +}; + +int insert_edge(struct graph_node *from, struct graph_node *to); Added: soc2012/gmiller/locking-head/lib/libwitness/lists.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/gmiller/locking-head/lib/libwitness/lists.c Tue Jun 26 17:10:14 2012 (r238343) @@ -0,0 +1,25 @@ + +SLIST_HEAD(lock_lists_head, lock_lists_next) lock_lists_head = + SLIST_HEAD_INITIALIZER(lock_lists_head); + +static struct lock_list * +get_lock_list() +{ + return NULL; +} + +void +add_lock(void *lock) +{ + struct lock_list *lock_list; + + lock_list = get_lock_list(); +} + +void +remove_lock(void *lock) +{ + struct lock_list *lock_list; + + lock_list = get_lock_list(); +} From owner-svn-soc-all@FreeBSD.ORG Tue Jun 26 17:10:31 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 387B0106564A for ; Tue, 26 Jun 2012 17:10:29 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 26 Jun 2012 17:10:29 +0000 Date: Tue, 26 Jun 2012 17:10:29 +0000 From: gmiller@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120626171029.387B0106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238344 - in soc2012/gmiller/locking-head: . lib/libwitness X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 17:10:31 -0000 Author: gmiller Date: Tue Jun 26 17:10:28 2012 New Revision: 238344 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238344 Log: r238276@FreeBSD-dev: root | 2012-06-19 19:15:03 -0500 * Fix compile issues with lists.c * Add lists.h * Add license boilerplate Added: soc2012/gmiller/locking-head/lib/libwitness/lists.h Modified: soc2012/gmiller/locking-head/ (props changed) soc2012/gmiller/locking-head/lib/libwitness/graph.c soc2012/gmiller/locking-head/lib/libwitness/graph.h soc2012/gmiller/locking-head/lib/libwitness/lists.c soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Modified: soc2012/gmiller/locking-head/lib/libwitness/graph.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/graph.c Tue Jun 26 17:10:14 2012 (r238343) +++ soc2012/gmiller/locking-head/lib/libwitness/graph.c Tue Jun 26 17:10:28 2012 (r238344) @@ -1,3 +1,29 @@ +/*- + * Copyright (c) 2012 Greg Miller .. + * 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 "graph.h" Modified: soc2012/gmiller/locking-head/lib/libwitness/graph.h ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/graph.h Tue Jun 26 17:10:14 2012 (r238343) +++ soc2012/gmiller/locking-head/lib/libwitness/graph.h Tue Jun 26 17:10:28 2012 (r238344) @@ -1,3 +1,29 @@ +/*- + * Copyright (c) 2012 Greg Miller .. + * 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. + * + */ struct graph_node { }; Modified: soc2012/gmiller/locking-head/lib/libwitness/lists.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/lists.c Tue Jun 26 17:10:14 2012 (r238343) +++ soc2012/gmiller/locking-head/lib/libwitness/lists.c Tue Jun 26 17:10:28 2012 (r238344) @@ -1,9 +1,41 @@ +/*- + * Copyright (c) 2012 Greg Miller .. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include + +#include + +#include "lists.h" SLIST_HEAD(lock_lists_head, lock_lists_next) lock_lists_head = SLIST_HEAD_INITIALIZER(lock_lists_head); static struct lock_list * -get_lock_list() +get_lock_list(void) { return NULL; } @@ -13,6 +45,8 @@ { struct lock_list *lock_list; + lock = lock; + lock_list = get_lock_list(); } @@ -21,5 +55,7 @@ { struct lock_list *lock_list; + lock = lock; + lock_list = get_lock_list(); } Added: soc2012/gmiller/locking-head/lib/libwitness/lists.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/gmiller/locking-head/lib/libwitness/lists.h Tue Jun 26 17:10:28 2012 (r238344) @@ -0,0 +1,32 @@ +/*- + * Copyright (c) 2012 Greg Miller .. + * 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. + * + */ + +struct lock_list { +}; + +void add_lock(void *lock); +void remove_lock(void *lock); Modified: soc2012/gmiller/locking-head/lib/libwitness/wrappers.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Tue Jun 26 17:10:14 2012 (r238343) +++ soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Tue Jun 26 17:10:28 2012 (r238344) @@ -1,3 +1,29 @@ +/*- + * Copyright (c) 2012 Greg Miller .. + * 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 From owner-svn-soc-all@FreeBSD.ORG Tue Jun 26 17:23:00 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 553F3106564A for ; Tue, 26 Jun 2012 17:22:58 +0000 (UTC) (envelope-from aleek@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 26 Jun 2012 17:22:58 +0000 Date: Tue, 26 Jun 2012 17:22:58 +0000 From: aleek@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120626172258.553F3106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238345 - in soc2012/aleek/beaglexm-armv6/sys/arm: conf ti/am37x X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 17:23:01 -0000 Author: aleek Date: Tue Jun 26 17:22:57 2012 New Revision: 238345 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238345 Log: added root filesystem in mfs. Board is booting to prompt now Modified: soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer_tc.c Modified: soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM Tue Jun 26 17:10:28 2012 (r238344) +++ soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM Tue Jun 26 17:22:57 2012 (r238345) @@ -57,8 +57,8 @@ 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 WITNESS #Enable checks to detect deadlocks and cycles +#options WITNESS_SKIPSPIN #Don't run witness on spinlocks for speed #options DIAGNOSTIC #options DEBUG Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer_tc.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer_tc.c Tue Jun 26 17:10:28 2012 (r238344) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer_tc.c Tue Jun 26 17:22:57 2012 (r238345) @@ -467,7 +467,6 @@ sc->callback_data = data; /* Activate the interrupt */ - printf( "bus_setup_intr(): %s:%d\n", __func__, __LINE__ ); if (bus_setup_intr(sc->sc_dev, sc->irq_res, INTR_TYPE_MISC | INTR_MPSAFE, NULL, omap3_gptimer_intr, (void*)sc, &sc->irq_h)) { @@ -585,7 +584,6 @@ /* Attempt to activate the interrupt for the tick */ - printf( "bus_setup_intr(): %s:%d\n", __func__, __LINE__ ); if (bus_setup_intr(sc->sc_dev, sc->irq_res, INTR_TYPE_CLK, filter, NULL, NULL, &sc->irq_h)) { device_printf(sc->sc_dev, "Error: failed to activate interrupt\n"); @@ -665,13 +663,13 @@ int32_t counts; //uint32_t first, last; - if (g_omap3_gptimer_sc_tc == NULL) { + //if (g_omap3_gptimer_sc_tc == NULL) { for (; usec > 0; usec--) for (counts = 200; counts > 0; counts--) /* Prevent gcc from optimizing out the loop */ cpufunc_nullop(); return; - } + //} } static void @@ -819,7 +817,7 @@ omap3_gptimer_tc.tc_frequency = timer_freq; /* Setup the time counter */ - //tc_init(&omap3_gptimer_tc); + tc_init(&omap3_gptimer_tc); /* Calibrate the delay loop */ omap3_calibrate_delay_loop(&omap3_gptimer_tc); From owner-svn-soc-all@FreeBSD.ORG Tue Jun 26 18:54:55 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id E66491065670 for ; Tue, 26 Jun 2012 18:54:54 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 26 Jun 2012 18:54:54 +0000 Date: Tue, 26 Jun 2012 18:54:54 +0000 From: gmiller@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120626185454.E66491065670@hub.freebsd.org> Cc: Subject: socsvn commit: r238346 - in soc2012/gmiller/locking-head: . lib/libthr/thread X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 18:54:56 -0000 Author: gmiller Date: Tue Jun 26 18:54:54 2012 New Revision: 238346 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238346 Log: r238353@FreeBSD-dev: root | 2012-06-19 19:41:14 -0500 Alphabetize includes. Modified: soc2012/gmiller/locking-head/ (props changed) soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c Modified: soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c Tue Jun 26 17:22:57 2012 (r238345) +++ soc2012/gmiller/locking-head/lib/libthr/thread/thr_profile.c Tue Jun 26 18:54:54 2012 (r238346) @@ -27,11 +27,11 @@ #ifdef LOCK_PROFILING -#include -#include #include -#include #include +#include +#include +#include #include "thr_private.h" From owner-svn-soc-all@FreeBSD.ORG Tue Jun 26 18:55:07 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 46F23106566B for ; Tue, 26 Jun 2012 18:55:06 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 26 Jun 2012 18:55:06 +0000 Date: Tue, 26 Jun 2012 18:55:06 +0000 From: gmiller@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120626185506.46F23106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238347 - in soc2012/gmiller/locking-head: . lib/libwitness X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 18:55:07 -0000 Author: gmiller Date: Tue Jun 26 18:55:06 2012 New Revision: 238347 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238347 Log: r238354@FreeBSD-dev: root | 2012-06-19 20:48:01 -0500 Move per-thread lock list heads to TLS. Modified: soc2012/gmiller/locking-head/ (props changed) soc2012/gmiller/locking-head/lib/libwitness/lists.c soc2012/gmiller/locking-head/lib/libwitness/lists.h Modified: soc2012/gmiller/locking-head/lib/libwitness/lists.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/lists.c Tue Jun 26 18:54:54 2012 (r238346) +++ soc2012/gmiller/locking-head/lib/libwitness/lists.c Tue Jun 26 18:55:06 2012 (r238347) @@ -31,31 +31,31 @@ #include "lists.h" -SLIST_HEAD(lock_lists_head, lock_lists_next) lock_lists_head = - SLIST_HEAD_INITIALIZER(lock_lists_head); - -static struct lock_list * -get_lock_list(void) -{ - return NULL; -} +_Thread_local SLIST_HEAD(lock_head, lock_entry) lock_head = + SLIST_HEAD_INITIALIZER(lock_head); void add_lock(void *lock) { - struct lock_list *lock_list; + struct lock_entry *entry; - lock = lock; + entry = malloc(sizeof(*entry)); + entry->lock = lock; - lock_list = get_lock_list(); + SLIST_INSERT_HEAD(&lock_head, entry, lock_next); } void remove_lock(void *lock) { - struct lock_list *lock_list; - - lock = lock; + struct lock_entry *entry; + struct lock_entry *temp; - lock_list = get_lock_list(); + SLIST_FOREACH_SAFE(entry, &lock_head, lock_next, temp) { + if (entry->lock == lock) { + SLIST_REMOVE(&lock_head, entry, lock_entry, lock_next); + free(entry); + break; + } + } } Modified: soc2012/gmiller/locking-head/lib/libwitness/lists.h ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/lists.h Tue Jun 26 18:54:54 2012 (r238346) +++ soc2012/gmiller/locking-head/lib/libwitness/lists.h Tue Jun 26 18:55:06 2012 (r238347) @@ -25,7 +25,9 @@ * */ -struct lock_list { +struct lock_entry { + SLIST_ENTRY(lock_entry) lock_next; + void *lock; }; void add_lock(void *lock); From owner-svn-soc-all@FreeBSD.ORG Tue Jun 26 20:25:14 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 0D33C1065673 for ; Tue, 26 Jun 2012 20:25:12 +0000 (UTC) (envelope-from tzabal@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Tue, 26 Jun 2012 20:25:12 +0000 Date: Tue, 26 Jun 2012 20:25:12 +0000 From: tzabal@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120626202513.0D33C1065673@hub.freebsd.org> Cc: Subject: socsvn commit: r238350 - soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashinfo X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jun 2012 20:25:14 -0000 Author: tzabal Date: Tue Jun 26 20:25:11 2012 New Revision: 238350 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238350 Log: Modify usr.sbin/crashinfo to print the uname information in multiple lines rather than in a single one for easier scripting facilities Modified: soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashinfo/crashinfo.sh Modified: soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashinfo/crashinfo.sh ============================================================================== --- soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashinfo/crashinfo.sh Tue Jun 26 19:07:05 2012 (r238349) +++ soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashinfo/crashinfo.sh Tue Jun 26 20:25:11 2012 (r238350) @@ -163,7 +163,11 @@ echo date echo -echo "$ostype $HOSTNAME $osrelease $version $machine" +echo "$HOSTNAME" +echo "$ostype" +echo "$osrelease" +echo "$version" +echo "$machine" echo sed -ne '/^ Panic String: /{s//panic: /;p;}' $INFO echo From owner-svn-soc-all@FreeBSD.ORG Wed Jun 27 01:09:24 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 40943106564A for ; Wed, 27 Jun 2012 01:09:22 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 27 Jun 2012 01:09:22 +0000 Date: Wed, 27 Jun 2012 01:09:22 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120627010922.40943106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238363 - in soc2012/jhagewood/diff: . diff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jun 2012 01:09:24 -0000 Author: jhagewood Date: Wed Jun 27 01:09:22 2012 New Revision: 238363 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238363 Log: Modified: soc2012/jhagewood/diff/diff/diff.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/diff/diff.c ============================================================================== --- soc2012/jhagewood/diff/diff/diff.c Wed Jun 27 00:50:25 2012 (r238362) +++ soc2012/jhagewood/diff/diff/diff.c Wed Jun 27 01:09:22 2012 (r238363) @@ -304,8 +304,8 @@ case OPT_FFILE: Toflag = 1; break; - case OPT_TOFILE - Fromflag: + case OPT_TOFILE: + Fromflag = 1; break; case OPT_NEW_LF: case OPT_OLD_LF: @@ -367,21 +367,21 @@ if (Toflag || Fromflag) { if (Toflag && Fromflag) { - (void)fprintf(stderr, "--from-file and --to-file both specified."); + (void)fprintf(stderr, "--from-file and --to-file both specified.\n"); exit(2); } if (Toflag) { - if (exec1(_PATH_DIFF, args, argv[argc-2], optarg) || - exec1(_PATH_DIFF, args, argv[argc-1], optarg) { - (void)fprintf(stderr, "--to-file error."); + if (execl(_PATH_DIFF, args, argv[argc-2], optarg) || + execl(_PATH_DIFF, args, argv[argc-1], optarg)) { + (void)fprintf(stderr, "--to-file error.\n"); exit(2); } exit(127); } if (Fromflag) { - if (exec1(_PATH_DIFF, args, optarg, argv[argc-2]) || - exec1(_PATH_DIFF, args, optarg, argv[argc-1]) { - (void)fprintf(stderr, "--from-file error."); + if (execl(_PATH_DIFF, args, optarg, argv[argc-2]) || + execl(_PATH_DIFF, args, optarg, argv[argc-1])) { + (void)fprintf(stderr, "--from-file error.\n"); exit(2); } exit(127); Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Wed Jun 27 00:50:25 2012 (r238362) +++ soc2012/jhagewood/diff/hagewood-diff.patch Wed Jun 27 01:09:22 2012 (r238363) @@ -1,6 +1,6 @@ diff -rupN jhagewood/diff/diff-orig/diff.c jhagewood/diff/diff/diff.c --- jhagewood/diff/diff-orig/diff.c 2012-06-25 16:05:53.000000000 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-26 04:52:40.000000000 -0400 ++++ jhagewood/diff/diff/diff.c 2012-06-27 01:08:55.000000000 -0400 @@ -1,4 +1,4 @@ -/*- +/* @@ -225,8 +225,8 @@ + case OPT_FFILE: + Toflag = 1; + break; -+ case OPT_TOFILE -+ Fromflag: ++ case OPT_TOFILE: ++ Fromflag = 1; + break; + case OPT_NEW_LF: + case OPT_OLD_LF: @@ -282,21 +282,21 @@ + + if (Toflag || Fromflag) { + if (Toflag && Fromflag) { -+ (void)fprintf(stderr, "--from-file and --to-file both specified."); ++ (void)fprintf(stderr, "--from-file and --to-file both specified.\n"); + exit(2); + } + if (Toflag) { -+ if (exec1(_PATH_DIFF, args, argv[argc-2], optarg) || -+ exec1(_PATH_DIFF, args, argv[argc-1], optarg) { -+ (void)fprintf(stderr, "--to-file error."); ++ if (execl(_PATH_DIFF, args, argv[argc-2], optarg) || ++ execl(_PATH_DIFF, args, argv[argc-1], optarg)) { ++ (void)fprintf(stderr, "--to-file error.\n"); + exit(2); + } + exit(127); + } + if (Fromflag) { -+ if (exec1(_PATH_DIFF, args, optarg, argv[argc-2]) || -+ exec1(_PATH_DIFF, args, optarg, argv[argc-1]) { -+ (void)fprintf(stderr, "--from-file error."); ++ if (execl(_PATH_DIFF, args, optarg, argv[argc-2]) || ++ execl(_PATH_DIFF, args, optarg, argv[argc-1])) { ++ (void)fprintf(stderr, "--from-file error.\n"); + exit(2); + } + exit(127); From owner-svn-soc-all@FreeBSD.ORG Wed Jun 27 03:16:39 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id DDE021065670 for ; Wed, 27 Jun 2012 03:16:36 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 27 Jun 2012 03:16:36 +0000 Date: Wed, 27 Jun 2012 03:16:36 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120627031636.DDE021065670@hub.freebsd.org> Cc: Subject: socsvn commit: r238366 - in soc2012/jhagewood/diff: . diff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jun 2012 03:16:39 -0000 Author: jhagewood Date: Wed Jun 27 03:16:36 2012 New Revision: 238366 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238366 Log: Modified: soc2012/jhagewood/diff/diff/diff.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/diff/diff.c ============================================================================== --- soc2012/jhagewood/diff/diff/diff.c Wed Jun 27 01:44:48 2012 (r238365) +++ soc2012/jhagewood/diff/diff/diff.c Wed Jun 27 03:16:36 2012 (r238366) @@ -162,7 +162,7 @@ int main(int argc, char **argv) { - char *ep, **oargv, *args, *cmpfile1, *cmpfile2; + char *ep, **oargv, *file1, *file2, *file3; long l; int ch, lastch, gotstdin, prevoptind, newarg; int oargc; @@ -170,7 +170,6 @@ oargv = argv; oargc = argc; gotstdin = 0; - args = "-"; lastch = '\0'; prevoptind = 1; @@ -303,8 +302,14 @@ break; case OPT_FFILE: Toflag = 1; + file1 = argv[argc-2]; + file2 = argv[argc-1]; + file3 = optarg; break; case OPT_TOFILE: + file1 = argv[argc-2]; + file2 = argv[argc-1]; + file3 = optarg; Fromflag = 1; break; case OPT_NEW_LF: @@ -357,33 +362,24 @@ newarg = optind != prevoptind; prevoptind = optind; - /* For use when executing to-file and from-file options. */ - if (ch != OPT_FFILE && ch != OPT_TOFILE) { - strcat(args, ch); - } } argc -= optind; argv += optind; + /* XXX to do- pass arguements */ if (Toflag || Fromflag) { if (Toflag && Fromflag) { (void)fprintf(stderr, "--from-file and --to-file both specified.\n"); exit(2); } if (Toflag) { - if (execl(_PATH_DIFF, args, argv[argc-2], optarg) || - execl(_PATH_DIFF, args, argv[argc-1], optarg)) { - (void)fprintf(stderr, "--to-file error.\n"); - exit(2); - } + execl(_PATH_DIFF, _PATH_DIFF, file1, file3); + execl(_PATH_DIFF, _PATH_DIFF, file2, file3); exit(127); } if (Fromflag) { - if (execl(_PATH_DIFF, args, optarg, argv[argc-2]) || - execl(_PATH_DIFF, args, optarg, argv[argc-1])) { - (void)fprintf(stderr, "--from-file error.\n"); - exit(2); - } + execl(_PATH_DIFF, _PATH_DIFF, file3, file1); + execl(_PATH_DIFF, _PATH_DIFF, file3, file2); exit(127); } } Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Wed Jun 27 01:44:48 2012 (r238365) +++ soc2012/jhagewood/diff/hagewood-diff.patch Wed Jun 27 03:16:36 2012 (r238366) @@ -1,6 +1,6 @@ diff -rupN jhagewood/diff/diff-orig/diff.c jhagewood/diff/diff/diff.c --- jhagewood/diff/diff-orig/diff.c 2012-06-25 16:05:53.000000000 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-27 01:08:55.000000000 -0400 ++++ jhagewood/diff/diff/diff.c 2012-06-27 03:16:17.000000000 -0400 @@ -1,4 +1,4 @@ -/*- +/* @@ -180,7 +180,7 @@ { NULL, 0, NULL, '\0'} }; -@@ -162,14 +162,15 @@ void read_excludes_file(char *); +@@ -162,10 +162,10 @@ void read_excludes_file(char *); int main(int argc, char **argv) { @@ -188,19 +188,14 @@ - long l; - int ch, lastch, gotstdin, prevoptind, newarg; - int oargc; -+ char *ep, **oargv, *args, *cmpfile1, *cmpfile2; ++ char *ep, **oargv, *file1, *file2, *file3; + long l; + int ch, lastch, gotstdin, prevoptind, newarg; + int oargc; oargv = argv; oargc = argc; - gotstdin = 0; -+ args = "-"; - - lastch = '\0'; - prevoptind = 1; -@@ -197,6 +198,7 @@ main(int argc, char **argv) +@@ -197,6 +197,7 @@ main(int argc, char **argv) break; case 'C': case 'c': @@ -208,7 +203,7 @@ format = D_CONTEXT; if (optarg != NULL) { l = strtol(optarg, &ep, 10); -@@ -213,6 +215,9 @@ main(int argc, char **argv) +@@ -213,6 +214,9 @@ main(int argc, char **argv) case 'd': dflag = 1; break; @@ -218,14 +213,20 @@ case 'e': format = D_EDIT; break; -@@ -296,15 +301,38 @@ main(int argc, char **argv) +@@ -296,15 +300,44 @@ main(int argc, char **argv) case 'y': yflag = 1; break; + case OPT_FFILE: + Toflag = 1; ++ file1 = argv[argc-2]; ++ file2 = argv[argc-1]; ++ file3 = optarg; + break; + case OPT_TOFILE: ++ file1 = argv[argc-2]; ++ file2 = argv[argc-1]; ++ file3 = optarg; + Fromflag = 1; + break; + case OPT_NEW_LF: @@ -265,40 +266,31 @@ case OPT_STRIPCR: strip_cr=1; break; -@@ -328,20 +356,46 @@ main(int argc, char **argv) +@@ -328,20 +361,37 @@ main(int argc, char **argv) lastch = ch; newarg = optind != prevoptind; prevoptind = optind; + -+ /* For use when executing to-file and from-file options. */ -+ if (ch != OPT_FFILE && ch != OPT_TOFILE) { -+ strcat(args, ch); -+ } } argc -= optind; argv += optind; - - if(yflag) { + ++ /* XXX to do- pass arguements */ + if (Toflag || Fromflag) { + if (Toflag && Fromflag) { + (void)fprintf(stderr, "--from-file and --to-file both specified.\n"); + exit(2); + } + if (Toflag) { -+ if (execl(_PATH_DIFF, args, argv[argc-2], optarg) || -+ execl(_PATH_DIFF, args, argv[argc-1], optarg)) { -+ (void)fprintf(stderr, "--to-file error.\n"); -+ exit(2); -+ } ++ execl(_PATH_DIFF, _PATH_DIFF, file1, file3); ++ execl(_PATH_DIFF, _PATH_DIFF, file2, file3); + exit(127); + } + if (Fromflag) { -+ if (execl(_PATH_DIFF, args, optarg, argv[argc-2]) || -+ execl(_PATH_DIFF, args, optarg, argv[argc-1])) { -+ (void)fprintf(stderr, "--from-file error.\n"); -+ exit(2); -+ } ++ execl(_PATH_DIFF, _PATH_DIFF, file3, file1); ++ execl(_PATH_DIFF, _PATH_DIFF, file3, file2); + exit(127); + } + } @@ -317,7 +309,7 @@ execv(_PATH_SDIFF, oargv); _exit(127); } -@@ -380,7 +434,10 @@ main(int argc, char **argv) +@@ -380,7 +430,10 @@ main(int argc, char **argv) set_argstr(oargv, argv); if (S_ISDIR(stb1.st_mode) && S_ISDIR(stb2.st_mode)) { if (format == D_IFDEF) @@ -329,7 +321,7 @@ diffdir(argv[0], argv[1]); } else { if (S_ISDIR(stb1.st_mode)) { -@@ -402,11 +459,10 @@ main(int argc, char **argv) +@@ -402,11 +455,10 @@ main(int argc, char **argv) void * emalloc(size_t n) { @@ -342,7 +334,7 @@ if ((p = malloc(n)) == NULL) errx(2, NULL); return (p); -@@ -415,7 +471,7 @@ emalloc(size_t n) +@@ -415,7 +467,7 @@ emalloc(size_t n) void * erealloc(void *p, size_t n) { @@ -351,7 +343,7 @@ if (n == 0) errx(2, NULL); -@@ -431,13 +487,12 @@ erealloc(void *p, size_t n) +@@ -431,13 +483,12 @@ erealloc(void *p, size_t n) int easprintf(char **ret, const char *fmt, ...) { @@ -367,7 +359,7 @@ if (len < 0 || *ret == NULL) errx(2, NULL); return (len); -@@ -446,11 +501,12 @@ easprintf(char **ret, const char *fmt, . +@@ -446,11 +497,12 @@ easprintf(char **ret, const char *fmt, . char * estrdup(const char *str) { @@ -382,7 +374,7 @@ strlcpy(cp, str, len); return (cp); } -@@ -531,6 +587,7 @@ push_ignore_pats(char *pattern) +@@ -531,6 +583,7 @@ push_ignore_pats(char *pattern) void print_only(const char *path, size_t dirlen, const char *entry) { @@ -390,7 +382,7 @@ if (dirlen > 1) dirlen--; printf("Only in %.*s: %s\n", (int)dirlen, path, entry); -@@ -539,45 +596,46 @@ print_only(const char *path, size_t dirl +@@ -539,45 +592,46 @@ print_only(const char *path, size_t dirl void print_status(int val, char *path1, char *path2, char *entry) { @@ -448,7 +440,7 @@ break; } } -@@ -585,6 +643,7 @@ print_status(int val, char *path1, char +@@ -585,6 +639,7 @@ print_status(int val, char *path1, char void usage(void) { From owner-svn-soc-all@FreeBSD.ORG Wed Jun 27 03:40:22 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 6545B106564A for ; Wed, 27 Jun 2012 03:40:20 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 27 Jun 2012 03:40:20 +0000 Date: Wed, 27 Jun 2012 03:40:20 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120627034020.6545B106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238367 - in soc2012/jhagewood/diff: . diff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jun 2012 03:40:22 -0000 Author: jhagewood Date: Wed Jun 27 03:40:19 2012 New Revision: 238367 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238367 Log: Modified: soc2012/jhagewood/diff/diff/diff.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/diff/diff.c ============================================================================== --- soc2012/jhagewood/diff/diff/diff.c Wed Jun 27 03:16:36 2012 (r238366) +++ soc2012/jhagewood/diff/diff/diff.c Wed Jun 27 03:40:19 2012 (r238367) @@ -166,7 +166,8 @@ long l; int ch, lastch, gotstdin, prevoptind, newarg; int oargc; - + pid_t childpid; + oargv = argv; oargc = argc; gotstdin = 0; @@ -366,22 +367,37 @@ argc -= optind; argv += optind; - /* XXX to do- pass arguements */ + /* + * Execute --to-file or --from-file by forking and executing diff + * with new input files. + * XXX to do- pass arguements + */ if (Toflag || Fromflag) { if (Toflag && Fromflag) { (void)fprintf(stderr, "--from-file and --to-file both specified.\n"); exit(2); } - if (Toflag) { - execl(_PATH_DIFF, _PATH_DIFF, file1, file3); - execl(_PATH_DIFF, _PATH_DIFF, file2, file3); + childpid = fork(); + switch(childpid) + if (childpid == 0) { + if (Toflag) + execl(_PATH_DIFF, _PATH_DIFF, file1, file3); + if (Fromflag) + execl(_PATH_DIFF, _PATH_DIFF, file3, file1); exit(127); } - if (Fromflag) { - execl(_PATH_DIFF, _PATH_DIFF, file3, file1); - execl(_PATH_DIFF, _PATH_DIFF, file3, file2); - exit(127); - } + if (childpid > 0) { + childpid = fork(); + if (childpid == 0) { + if (Toflag) + execl(_PATH_DIFF, _PATH_DIFF, file2, file3); + if (Fromflag) + execl(_PATH_DIFF, _PATH_DIFF, file3, file2); + exit(127); + } + if (childpid > 0) + exit(0); + } } if (yflag) { /* remove y flag from args and call sdiff */ Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Wed Jun 27 03:16:36 2012 (r238366) +++ soc2012/jhagewood/diff/hagewood-diff.patch Wed Jun 27 03:40:19 2012 (r238367) @@ -1,6 +1,6 @@ diff -rupN jhagewood/diff/diff-orig/diff.c jhagewood/diff/diff/diff.c --- jhagewood/diff/diff-orig/diff.c 2012-06-25 16:05:53.000000000 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-27 03:16:17.000000000 -0400 ++++ jhagewood/diff/diff/diff.c 2012-06-27 03:39:50.000000000 -0400 @@ -1,4 +1,4 @@ -/*- +/* @@ -180,7 +180,7 @@ { NULL, 0, NULL, '\0'} }; -@@ -162,10 +162,10 @@ void read_excludes_file(char *); +@@ -162,11 +162,12 @@ void read_excludes_file(char *); int main(int argc, char **argv) { @@ -188,14 +188,17 @@ - long l; - int ch, lastch, gotstdin, prevoptind, newarg; - int oargc; +- + char *ep, **oargv, *file1, *file2, *file3; + long l; + int ch, lastch, gotstdin, prevoptind, newarg; + int oargc; - ++ pid_t childpid; ++ oargv = argv; oargc = argc; -@@ -197,6 +197,7 @@ main(int argc, char **argv) + gotstdin = 0; +@@ -197,6 +198,7 @@ main(int argc, char **argv) break; case 'C': case 'c': @@ -203,7 +206,7 @@ format = D_CONTEXT; if (optarg != NULL) { l = strtol(optarg, &ep, 10); -@@ -213,6 +214,9 @@ main(int argc, char **argv) +@@ -213,6 +215,9 @@ main(int argc, char **argv) case 'd': dflag = 1; break; @@ -213,7 +216,7 @@ case 'e': format = D_EDIT; break; -@@ -296,15 +300,44 @@ main(int argc, char **argv) +@@ -296,15 +301,44 @@ main(int argc, char **argv) case 'y': yflag = 1; break; @@ -266,7 +269,7 @@ case OPT_STRIPCR: strip_cr=1; break; -@@ -328,20 +361,37 @@ main(int argc, char **argv) +@@ -328,20 +362,52 @@ main(int argc, char **argv) lastch = ch; newarg = optind != prevoptind; prevoptind = optind; @@ -277,22 +280,37 @@ - - if(yflag) { + -+ /* XXX to do- pass arguements */ ++ /* ++ * Execute --to-file or --from-file by forking and executing diff ++ * with new input files. ++ * XXX to do- pass arguements ++ */ + if (Toflag || Fromflag) { + if (Toflag && Fromflag) { + (void)fprintf(stderr, "--from-file and --to-file both specified.\n"); + exit(2); + } -+ if (Toflag) { -+ execl(_PATH_DIFF, _PATH_DIFF, file1, file3); -+ execl(_PATH_DIFF, _PATH_DIFF, file2, file3); ++ childpid = fork(); ++ switch(childpid) ++ if (childpid == 0) { ++ if (Toflag) ++ execl(_PATH_DIFF, _PATH_DIFF, file1, file3); ++ if (Fromflag) ++ execl(_PATH_DIFF, _PATH_DIFF, file3, file1); + exit(127); + } -+ if (Fromflag) { -+ execl(_PATH_DIFF, _PATH_DIFF, file3, file1); -+ execl(_PATH_DIFF, _PATH_DIFF, file3, file2); -+ exit(127); -+ } ++ if (childpid > 0) { ++ childpid = fork(); ++ if (childpid == 0) { ++ if (Toflag) ++ execl(_PATH_DIFF, _PATH_DIFF, file2, file3); ++ if (Fromflag) ++ execl(_PATH_DIFF, _PATH_DIFF, file3, file2); ++ exit(127); ++ } ++ if (childpid > 0) ++ exit(0); ++ } + } + if (yflag) { /* remove y flag from args and call sdiff */ @@ -309,7 +327,7 @@ execv(_PATH_SDIFF, oargv); _exit(127); } -@@ -380,7 +430,10 @@ main(int argc, char **argv) +@@ -380,7 +446,10 @@ main(int argc, char **argv) set_argstr(oargv, argv); if (S_ISDIR(stb1.st_mode) && S_ISDIR(stb2.st_mode)) { if (format == D_IFDEF) @@ -321,7 +339,7 @@ diffdir(argv[0], argv[1]); } else { if (S_ISDIR(stb1.st_mode)) { -@@ -402,11 +455,10 @@ main(int argc, char **argv) +@@ -402,11 +471,10 @@ main(int argc, char **argv) void * emalloc(size_t n) { @@ -334,7 +352,7 @@ if ((p = malloc(n)) == NULL) errx(2, NULL); return (p); -@@ -415,7 +467,7 @@ emalloc(size_t n) +@@ -415,7 +483,7 @@ emalloc(size_t n) void * erealloc(void *p, size_t n) { @@ -343,7 +361,7 @@ if (n == 0) errx(2, NULL); -@@ -431,13 +483,12 @@ erealloc(void *p, size_t n) +@@ -431,13 +499,12 @@ erealloc(void *p, size_t n) int easprintf(char **ret, const char *fmt, ...) { @@ -359,7 +377,7 @@ if (len < 0 || *ret == NULL) errx(2, NULL); return (len); -@@ -446,11 +497,12 @@ easprintf(char **ret, const char *fmt, . +@@ -446,11 +513,12 @@ easprintf(char **ret, const char *fmt, . char * estrdup(const char *str) { @@ -374,7 +392,7 @@ strlcpy(cp, str, len); return (cp); } -@@ -531,6 +583,7 @@ push_ignore_pats(char *pattern) +@@ -531,6 +599,7 @@ push_ignore_pats(char *pattern) void print_only(const char *path, size_t dirlen, const char *entry) { @@ -382,7 +400,7 @@ if (dirlen > 1) dirlen--; printf("Only in %.*s: %s\n", (int)dirlen, path, entry); -@@ -539,45 +592,46 @@ print_only(const char *path, size_t dirl +@@ -539,45 +608,46 @@ print_only(const char *path, size_t dirl void print_status(int val, char *path1, char *path2, char *entry) { @@ -440,7 +458,7 @@ break; } } -@@ -585,6 +639,7 @@ print_status(int val, char *path1, char +@@ -585,6 +655,7 @@ print_status(int val, char *path1, char void usage(void) { From owner-svn-soc-all@FreeBSD.ORG Wed Jun 27 04:19:34 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 7E655106564A for ; Wed, 27 Jun 2012 04:19:32 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 27 Jun 2012 04:19:32 +0000 Date: Wed, 27 Jun 2012 04:19:32 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120627041932.7E655106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238371 - in soc2012/jhagewood/diff: . diff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jun 2012 04:19:34 -0000 Author: jhagewood Date: Wed Jun 27 04:19:31 2012 New Revision: 238371 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238371 Log: Modified: soc2012/jhagewood/diff/diff/diff.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/diff/diff.c ============================================================================== --- soc2012/jhagewood/diff/diff/diff.c Wed Jun 27 03:45:25 2012 (r238370) +++ soc2012/jhagewood/diff/diff/diff.c Wed Jun 27 04:19:31 2012 (r238371) @@ -165,8 +165,8 @@ char *ep, **oargv, *file1, *file2, *file3; long l; int ch, lastch, gotstdin, prevoptind, newarg; - int oargc; - pid_t childpid; + int oargc, childstat; + pid_t childpid, done; oargv = argv; oargc = argc; @@ -308,10 +308,10 @@ file3 = optarg; break; case OPT_TOFILE: + Fromflag = 1; file1 = argv[argc-2]; file2 = argv[argc-1]; file3 = optarg; - Fromflag = 1; break; case OPT_NEW_LF: case OPT_OLD_LF: @@ -378,7 +378,6 @@ exit(2); } childpid = fork(); - switch(childpid) if (childpid == 0) { if (Toflag) execl(_PATH_DIFF, _PATH_DIFF, file1, file3); @@ -387,16 +386,16 @@ exit(127); } if (childpid > 0) { - childpid = fork(); - if (childpid == 0) { - if (Toflag) - execl(_PATH_DIFF, _PATH_DIFF, file2, file3); - if (Fromflag) - execl(_PATH_DIFF, _PATH_DIFF, file3, file2); - exit(127); + while (true) { + done = wait(&childstat); + if (done == 0) { + if (Toflag) + execl(_PATH_DIFF, _PATH_DIFF, file2, file3); + if (Fromflag) + execl(_PATH_DIFF, _PATH_DIFF, file3, file2); + exit(127); + } } - if (childpid > 0) - exit(0); } } if (yflag) { Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Wed Jun 27 03:45:25 2012 (r238370) +++ soc2012/jhagewood/diff/hagewood-diff.patch Wed Jun 27 04:19:31 2012 (r238371) @@ -1,6 +1,6 @@ diff -rupN jhagewood/diff/diff-orig/diff.c jhagewood/diff/diff/diff.c --- jhagewood/diff/diff-orig/diff.c 2012-06-25 16:05:53.000000000 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-27 03:39:50.000000000 -0400 ++++ jhagewood/diff/diff/diff.c 2012-06-27 04:19:16.000000000 -0400 @@ -1,4 +1,4 @@ -/*- +/* @@ -192,8 +192,8 @@ + char *ep, **oargv, *file1, *file2, *file3; + long l; + int ch, lastch, gotstdin, prevoptind, newarg; -+ int oargc; -+ pid_t childpid; ++ int oargc, childstat; ++ pid_t childpid, done; + oargv = argv; oargc = argc; @@ -227,10 +227,10 @@ + file3 = optarg; + break; + case OPT_TOFILE: ++ Fromflag = 1; + file1 = argv[argc-2]; + file2 = argv[argc-1]; + file3 = optarg; -+ Fromflag = 1; + break; + case OPT_NEW_LF: + case OPT_OLD_LF: @@ -269,7 +269,7 @@ case OPT_STRIPCR: strip_cr=1; break; -@@ -328,20 +362,52 @@ main(int argc, char **argv) +@@ -328,20 +362,51 @@ main(int argc, char **argv) lastch = ch; newarg = optind != prevoptind; prevoptind = optind; @@ -291,7 +291,6 @@ + exit(2); + } + childpid = fork(); -+ switch(childpid) + if (childpid == 0) { + if (Toflag) + execl(_PATH_DIFF, _PATH_DIFF, file1, file3); @@ -300,16 +299,16 @@ + exit(127); + } + if (childpid > 0) { -+ childpid = fork(); -+ if (childpid == 0) { -+ if (Toflag) -+ execl(_PATH_DIFF, _PATH_DIFF, file2, file3); -+ if (Fromflag) -+ execl(_PATH_DIFF, _PATH_DIFF, file3, file2); -+ exit(127); ++ while (true) { ++ done = wait(&childstat); ++ if (done == 0) { ++ if (Toflag) ++ execl(_PATH_DIFF, _PATH_DIFF, file2, file3); ++ if (Fromflag) ++ execl(_PATH_DIFF, _PATH_DIFF, file3, file2); ++ exit(127); ++ } + } -+ if (childpid > 0) -+ exit(0); + } + } + if (yflag) { @@ -327,7 +326,7 @@ execv(_PATH_SDIFF, oargv); _exit(127); } -@@ -380,7 +446,10 @@ main(int argc, char **argv) +@@ -380,7 +445,10 @@ main(int argc, char **argv) set_argstr(oargv, argv); if (S_ISDIR(stb1.st_mode) && S_ISDIR(stb2.st_mode)) { if (format == D_IFDEF) @@ -339,7 +338,7 @@ diffdir(argv[0], argv[1]); } else { if (S_ISDIR(stb1.st_mode)) { -@@ -402,11 +471,10 @@ main(int argc, char **argv) +@@ -402,11 +470,10 @@ main(int argc, char **argv) void * emalloc(size_t n) { @@ -352,7 +351,7 @@ if ((p = malloc(n)) == NULL) errx(2, NULL); return (p); -@@ -415,7 +483,7 @@ emalloc(size_t n) +@@ -415,7 +482,7 @@ emalloc(size_t n) void * erealloc(void *p, size_t n) { @@ -361,7 +360,7 @@ if (n == 0) errx(2, NULL); -@@ -431,13 +499,12 @@ erealloc(void *p, size_t n) +@@ -431,13 +498,12 @@ erealloc(void *p, size_t n) int easprintf(char **ret, const char *fmt, ...) { @@ -377,7 +376,7 @@ if (len < 0 || *ret == NULL) errx(2, NULL); return (len); -@@ -446,11 +513,12 @@ easprintf(char **ret, const char *fmt, . +@@ -446,11 +512,12 @@ easprintf(char **ret, const char *fmt, . char * estrdup(const char *str) { @@ -392,7 +391,7 @@ strlcpy(cp, str, len); return (cp); } -@@ -531,6 +599,7 @@ push_ignore_pats(char *pattern) +@@ -531,6 +598,7 @@ push_ignore_pats(char *pattern) void print_only(const char *path, size_t dirlen, const char *entry) { @@ -400,7 +399,7 @@ if (dirlen > 1) dirlen--; printf("Only in %.*s: %s\n", (int)dirlen, path, entry); -@@ -539,45 +608,46 @@ print_only(const char *path, size_t dirl +@@ -539,45 +607,46 @@ print_only(const char *path, size_t dirl void print_status(int val, char *path1, char *path2, char *entry) { @@ -458,7 +457,7 @@ break; } } -@@ -585,6 +655,7 @@ print_status(int val, char *path1, char +@@ -585,6 +654,7 @@ print_status(int val, char *path1, char void usage(void) { From owner-svn-soc-all@FreeBSD.ORG Wed Jun 27 04:21:31 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 48ECE106566B for ; Wed, 27 Jun 2012 04:21:29 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 27 Jun 2012 04:21:29 +0000 Date: Wed, 27 Jun 2012 04:21:29 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120627042129.48ECE106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238372 - in soc2012/jhagewood/diff: . diff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jun 2012 04:21:31 -0000 Author: jhagewood Date: Wed Jun 27 04:21:29 2012 New Revision: 238372 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238372 Log: Modified: soc2012/jhagewood/diff/diff/diff.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/diff/diff.c ============================================================================== --- soc2012/jhagewood/diff/diff/diff.c Wed Jun 27 04:19:31 2012 (r238371) +++ soc2012/jhagewood/diff/diff/diff.c Wed Jun 27 04:21:29 2012 (r238372) @@ -386,7 +386,7 @@ exit(127); } if (childpid > 0) { - while (true) { + while (1) { done = wait(&childstat); if (done == 0) { if (Toflag) Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Wed Jun 27 04:19:31 2012 (r238371) +++ soc2012/jhagewood/diff/hagewood-diff.patch Wed Jun 27 04:21:29 2012 (r238372) @@ -1,6 +1,6 @@ diff -rupN jhagewood/diff/diff-orig/diff.c jhagewood/diff/diff/diff.c --- jhagewood/diff/diff-orig/diff.c 2012-06-25 16:05:53.000000000 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-27 04:19:16.000000000 -0400 ++++ jhagewood/diff/diff/diff.c 2012-06-27 04:20:28.000000000 -0400 @@ -1,4 +1,4 @@ -/*- +/* @@ -299,7 +299,7 @@ + exit(127); + } + if (childpid > 0) { -+ while (true) { ++ while (1) { + done = wait(&childstat); + if (done == 0) { + if (Toflag) From owner-svn-soc-all@FreeBSD.ORG Wed Jun 27 12:39:21 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 14AD81065687 for ; Wed, 27 Jun 2012 12:39:19 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 27 Jun 2012 12:39:19 +0000 Date: Wed, 27 Jun 2012 12:39:19 +0000 From: scher@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120627123919.14AD81065687@hub.freebsd.org> Cc: Subject: socsvn commit: r238393 - soc2012/scher/par_ports/head/Mk X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jun 2012 12:39:21 -0000 Author: scher Date: Wed Jun 27 12:39:17 2012 New Revision: 238393 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238393 Log: [new_feature] license checking for port's dependencies If any dependencies need to ask for comfirmation then port's build stops, and user is listed all ports that will ask for licences checking. Then a user will have to eval "make patch" for the above mentioned ports. Only if no dependencies require license confirmation parallel ports build will be allowed. 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 Wed Jun 27 11:59:57 2012 (r238392) +++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Wed Jun 27 12:39:17 2012 (r238393) @@ -484,6 +484,34 @@ # Parallel targets section # TODO: outline intergation with bsd.port.mk # +check-license-depends: check-license-message + @license_to_ask=""; \ + dirs_to_process=""; \ + for dir in $$(${ALL-DEPENDS-LIST}); do \ + license_status=$$(cd $${dir}; ${MAKE} -V _LICENSE_STATUS); \ + if [ "$${license_status}" = "ask" ]; then \ + license_to_ask="$${license_to_ask} $$(cd $${dir}; ${MAKE} -V PKGNAME)"; \ + dirs_to_process="$${dirs_to_process} $${dir}"; \ + fi; \ + done; \ + if [ $${license_to_ask} ]; then \ + ${ECHO_CMD} "The following ports will ask for license conformation:"; \ + for port in $${license_to_ask}; do \ + ${ECHO_CMD} " $${port}"; \ + done; \ + ${ECHO_CMD} "Unable to process in parallel way."; \ + ${ECHO_CMD} "Call:"; \ + ${ECHO_CMD} " make -D_parv_WANT_NON_PARALLEL_BUILD patch"; \ + ${ECHO_CMD} "in the following directories:"; \ + for dir in $${dirs_to_process}; do \ + ${ECHO_CMD} " $${dir}"; \ + done; \ + exit 1; \ + fi + +check-license-message: + @${ECHO_MSG} "===> Checking out licenses for ${PKGNAME} dependencies"; + locking-config-recursive: locking-config-message lock-port-dbdir config-recursive unlock-port-dbdir locking-config-message: Modified: soc2012/scher/par_ports/head/Mk/bsd.port.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.port.mk Wed Jun 27 11:59:57 2012 (r238392) +++ soc2012/scher/par_ports/head/Mk/bsd.port.mk Wed Jun 27 12:39:17 2012 (r238393) @@ -1154,6 +1154,11 @@ ############### PAR_PORTS SPECIFIC COMMENT LINE ############### +# TODO: doc needed +.if defined(_parv_WANT_NON_PARALLEL_BUILD) +.undef _parv_WANT_PARALLEL_BUILD +.endif + .if defined(_parv_WANT_PARALLEL_BUILD) .include "${PORTSDIR}/Mk/bsd.parallel.mk" .endif @@ -1195,6 +1200,11 @@ @${DO_NADA} .endif +.if !target(check-license-depends) +check-license-depends: + @${DO_NADA} +.endif + ############### ENDF OF PAR_PORTS SPECIFIC COMMENT LINE ############### # @@ -4348,7 +4358,7 @@ check-categories check-makevars check-desktop-entries \ check-depends check-active-build-conflicts identify-install-conflicts check-deprecated \ check-vulnerable check-license check-config buildanyway-message \ - options-message locking-config-recursive seal + options-message locking-config-recursive check-license-depends _PKG_DEP= check-sanity locking-config-recursive _PKG_SEQ= pkg-depends From owner-svn-soc-all@FreeBSD.ORG Wed Jun 27 14:54:36 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 09F831065679 for ; Wed, 27 Jun 2012 14:54:34 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 27 Jun 2012 14:54:34 +0000 Date: Wed, 27 Jun 2012 14:54:34 +0000 From: gpf@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120627145434.09F831065679@hub.freebsd.org> Cc: Subject: socsvn commit: r238397 - in soc2012/gpf/pefs_kmod: sbin/pefs sys/fs/pefs X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jun 2012 14:54:36 -0000 Author: gpf Date: Wed Jun 27 14:54:33 2012 New Revision: 238397 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238397 Log: /sbin/pefs verify: Verify integrity of .pefs.checksum file. - read .pefs.checksum's file header into memory - create the in memory checksum db from .pefs.checksum file (index hash tables & checksums - traverse the entire mounted pefs fs and for the moment, just print file names 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_vfsops.c Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Wed Jun 27 12:30:56 2012 (r238396) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Wed Jun 27 14:54:33 2012 (r238397) @@ -64,6 +64,10 @@ #define dprintf(a) (void)0 #endif +#define PEFS_EXTEND 1 +#define PEFS_NOEXTEND 2 +#define PEFS_REALLOC 3 + #define PEFS_CHECKSUM_FILE_VERSION 0xDD #define PEFS_HASH_BYTE_ALIGNMENT 512 #define PEFS_EXTRA_TABLE_SIZE 15 @@ -105,11 +109,11 @@ struct file_header { uint32_t nhashes; uint64_t file_id; + uint32_t offset_to_checksums; char path[MAXPATHLEN + 1]; char dirpath[MAXPATHLEN + 1]; char filename[MAXNAMLEN + 1]; char *target_path; - uint32_t offset_to_checksums; int fd, pfd; struct checksum_head checksums; TAILQ_ENTRY(file_header) file_header_entries; @@ -325,11 +329,11 @@ } static int -pefs_allocate_hash_table(struct cuckoo_hash_table *chtp, uint32_t nelements, char reallocate) +pefs_allocate_hash_table(struct cuckoo_hash_table *chtp, uint32_t nelements, int flags) { uint32_t i; - if (reallocate == 0) { + if (flags == PEFS_EXTEND) { /* * spending 15% more space for each table lowers the chance to fall into an * infinite loop during cuckoo insertion to about 1.5%. @@ -341,7 +345,12 @@ return (PEFS_ERR_GENERIC); } } - else { + else if (flags == PEFS_NOEXTEND) { + chtp->size = nelements; + chtp->nelements = nelements; + } + /* reallocate the hash tables in case of infinite loop during cuckoo insert */ + else if (flags == PEFS_REALLOC) { chtp->size = pefs_next_prime(chtp->size + 1); if (chtp->size < chtp->nelements) { pefs_warn("numeric overflow while computing new hash table size"); @@ -517,7 +526,7 @@ /* for debugging purposes */ static void -pefs_print_hash_table(struct cuckoo_hash_table *chtp, uint8_t hash_len) +pefs_print_hash_tables(struct cuckoo_hash_table *chtp, uint8_t hash_len) { struct file_header *fhp; struct checksum *csp; @@ -530,7 +539,8 @@ if (fhp != NULL) { //dprintf(("\tpath=%s\tid = %llu\tnhashes = %d\n", fhp->path, fhp->file_id, fhp->nhashes)); dprintf(("\tid = %llu\tnhashes = %d\n", fhp->file_id, fhp->nhashes)); - dprintf(("\tpath = %s\n", fhp->path)); + if (fhp->path[0] == '/') + dprintf(("\tpath = %s\n", fhp->path)); TAILQ_FOREACH(csp, &(fhp->checksums), checksum_entries) { dprintf(("\t\tdigest=")); for (j = 0; j < hash_len; j++) @@ -547,7 +557,8 @@ if (fhp != NULL) { //dprintf(("\tpath=%s\tid = %llu\tnhashes = %d\n", fhp->path, fhp->file_id, fhp->nhashes)); dprintf(("\tid = %llu\tnhashes = %d\n", fhp->file_id, fhp->nhashes)); - dprintf(("\tpath = %s\n", fhp->path)); + if (fhp->path[0] == '/') + dprintf(("\tpath = %s\n", fhp->path)); TAILQ_FOREACH(csp, &(fhp->checksums), checksum_entries) { dprintf(("\t\tdigest=")); for (j = 0; j < hash_len; j++) @@ -991,7 +1002,7 @@ pefs_rb_print(&hlc_head); pefs_rb_warn(&hlc_head); - error = pefs_allocate_hash_table(chtp, nfiles, 0); + error = pefs_allocate_hash_table(chtp, nfiles, PEFS_EXTEND); if (error != 0) return (error); @@ -1008,13 +1019,13 @@ */ else if (error != 0) { dprintf(("fell into an infinite loop!\n")); - error = pefs_allocate_hash_table(chtp, nfiles, 1); + error = pefs_allocate_hash_table(chtp, nfiles, PEFS_REALLOC); if (error != 0) return (error); goto cuckoo_insert; } } - pefs_print_hash_table(chtp, hash_len); + pefs_print_hash_tables(chtp, hash_len); pefs_symlink_warn(chtp, &fh_head); return (error); @@ -1325,4 +1336,328 @@ return (error); } +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)) { + warn("error reading from .pefs.checksum"); + return (PEFS_ERR_IO); + } + + bytes = read(fdin, &(cfhp->reserved), sizeof(cfhp->reserved)); + if (bytes != sizeof(cfhp->reserved)) { + warn("error reading from .pefs.checksum"); + return (PEFS_ERR_IO); + } + + bytes = read(fdin, &(cfhp->hash_len), sizeof(cfhp->hash_len)); + if (bytes != sizeof(cfhp->hash_len)) { + warn("error reading from .pefs.checksum"); + return (PEFS_ERR_IO); + } + + bytes = read(fdin, cfhp->hash_algo, sizeof(cfhp->hash_algo)); + if (bytes != sizeof(cfhp->hash_algo)) { + warn("error reading from .pefs.checksum"); + return (PEFS_ERR_IO); + } + + bytes = read(fdin, &(cfhp->offset_to_hash_table), sizeof(cfhp->offset_to_hash_table)); + if (bytes != sizeof(cfhp->offset_to_hash_table)) { + warn("error reading from .pefs.checksum"); + return (PEFS_ERR_IO); + } + + bytes = read(fdin, &hash_table_size, sizeof(hash_table_size)); + if (bytes != sizeof(hash_table_size)) { + warn("error reading from .pefs.checksum"); + return (PEFS_ERR_IO); + } + 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_file_header(int fdin, struct file_header *fhp, uint32_t *buckets_offset) +{ + uint64_t file_id; + uint32_t nhashes, offset_to_checksums; + int bytes; + + bytes = pread(fdin, &nhashes, sizeof(nhashes), *buckets_offset); + if (bytes != sizeof(nhashes)) { + warn("error reading from .pefs.checksum"); + return (PEFS_ERR_IO); + } + fhp->nhashes = le32toh(nhashes); + (*buckets_offset)+= sizeof(nhashes); + + bytes = pread(fdin, &offset_to_checksums, sizeof(offset_to_checksums), *buckets_offset); + if (bytes != sizeof(offset_to_checksums)) { + warn("error reading from .pefs.checksum"); + return (PEFS_ERR_IO); + } + fhp->offset_to_checksums = le32toh(offset_to_checksums); + (*buckets_offset)+= sizeof(offset_to_checksums); + + bytes = pread(fdin, &file_id, sizeof(file_id), *buckets_offset); + if (bytes != sizeof(file_id)) { + warn("error reading from .pefs.checksum"); + return (PEFS_ERR_IO); + } + fhp->file_id = le64toh(file_id); + (*buckets_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 %u\n", fhp->nhashes, fhp->offset_to_checksums)); + //dprintf(("file id %llu\n", fhp->file_id)); + + return (0); +} + +static int +pefs_read_bucket(int fdin, struct bucket *bp, uint32_t *buckets_offset) +{ + struct file_header *fhp; + int error; + + //dprintf(("bucket offset = %d\n", *buckets_offset)); + fhp = malloc(sizeof(struct file_header)); + if (fhp == NULL) { + pefs_warn("memory allocation error"); + return (PEFS_ERR_SYS); + } + + error = pefs_read_file_header(fdin, fhp, buckets_offset); + if (error != 0) + return (error); + + if (fhp->nhashes == 0) { + free(fhp); + fhp = NULL; + } + bp->fhp = fhp; + + //dprintf(("\n++priting bucket info++\n")); + + 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) { + warn("error reading from .pefs.checksum"); + return (PEFS_ERR_IO); + } + (*hashes_offset)+= hash_len; + + //dprintf(("hashes offset = %d\n", *hashes_offset)); + //dprintf(("hash %s\n", csp->hash)); + + return (0); +} + +static void +pefs_add_to_file_header(struct file_header *fhp, struct checksum *csp) +{ + TAILQ_INSERT_TAIL(&(fhp->checksums), csp, checksum_entries); +} + +static int +pefs_read_checksum_file(int fdin, struct checksum_file_header *cfhp, struct cuckoo_hash_table *chtp) +{ + struct bucket *bp; + struct checksum *csp; + struct file_header *fhp; + uint32_t i, k, buckets_offset, hashes_offset; + int error; + + /* this points to where the buckets start */ + buckets_offset = cfhp->offset_to_hash_table; + + for (i = 0; i < chtp->size; i++) { + bp = &chtp->buckets1[i]; + error = pefs_read_bucket(fdin, bp, &buckets_offset); + if (error != 0) + return (error); + + fhp = bp->fhp; + if (fhp != NULL) { + TAILQ_INIT(&(fhp->checksums)); + hashes_offset = fhp->offset_to_checksums; + + for (k = 0; k < fhp->nhashes; k++) { + csp = malloc(sizeof(struct checksum)); + if (csp == NULL) { + pefs_warn("memory allocation error"); + return (PEFS_ERR_SYS); + } + csp->hash = malloc(cfhp->hash_len); + if (csp->hash == NULL) { + pefs_warn("memory allocation error"); + return (PEFS_ERR_SYS); + } + + error = pefs_read_hash(fdin, csp, &hashes_offset, cfhp->hash_len); + if (error != 0) + return (error); + + pefs_add_to_file_header(fhp, csp); + } + } + } + + for (i = 0; i < chtp->size; i++) { + bp = &chtp->buckets2[i]; + error = pefs_read_bucket(fdin, bp, &buckets_offset); + if (error != 0) + return (error); + + fhp = bp->fhp; + if (fhp != NULL) { + TAILQ_INIT(&(fhp->checksums)); + hashes_offset = fhp->offset_to_checksums; + + for (k = 0; k < fhp->nhashes; k++) { + csp = malloc(sizeof(struct checksum)); + if (csp == NULL) { + pefs_warn("memory allocation error"); + return (PEFS_ERR_SYS); + } + csp->hash = malloc(cfhp->hash_len); + if (csp->hash == NULL) { + pefs_warn("memory allocation error"); + return (PEFS_ERR_SYS); + } + + 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 int +pefs_traverse_fs(struct cuckoo_hash_table *cht, const EVP_MD *md, uint8_t hash_len, DIR *dirp, char *path) +{ + char tmpath[MAXPATHLEN]; + DIR *dirtmp; + struct dirent *sdp; + int error; + + while (dirp) { + sdp = readdir(dirp); + if (sdp != NULL) { + if (strcmp(sdp->d_name, "..") != 0 && strcmp(sdp->d_name, ".") != 0) { + dprintf(("dirent: %s\n", sdp->d_name)); + snprintf(tmpath, sizeof(tmpath), "%s/%s", path, sdp->d_name); + switch (sdp->d_type) { + case DT_DIR: + dirtmp = opendir(tmpath); + if (dirtmp == NULL) { + pefs_warn("failed to open dir: %s", tmpath); + closedir(dirp); + return (PEFS_ERR_SYS); + } + error = pefs_traverse_fs(cht, md, hash_len, dirtmp, tmpath); + if (error != 0) { + closedir(dirp); + return (PEFS_ERR_SYS); + } + break; + /* + * XXXgpf: Look up the file and verify its checksums. + * Total number of checksums should be the same and checksums should match. + * Also, take notice of hardlinks & symlink warnings. + * After the traversal is done, we must have found all of our entries in the + * checksum file. + */ + case DT_REG: + dprintf(("reg file\n")); + break; + case DT_LNK: + dprintf(("smlnk file\n")); + break; + default: + break; + } + } + } + else { + closedir(dirp); + return (0); + } + } + + pefs_warn("invalid dirp argument for dir: %s", path); + return (PEFS_ERR_SYS); +} + +/* + * XXXgpf: [TODO] comments + */ +int +pefs_verify_checksum(int fdin, char *fsroot) +{ + struct checksum_file_header cfh; + struct cuckoo_hash_table cht; + const EVP_MD *md; + DIR *dirp; + int error; + uint8_t hash_len; + + error = pefs_read_checksum_file_header(fdin, &cfh); + if (error != 0) + return (error); + + OpenSSL_add_all_digests(); + md = EVP_get_digestbyname(cfh.hash_algo); + + if(md == NULL) { + pefs_warn("Unknown message digest %s", cfh.hash_algo); + return (PEFS_ERR_INVALID); + } + hash_len = EVP_MD_size(md); + + error = pefs_allocate_hash_table(&cht, cfh.hash_table_size, PEFS_NOEXTEND); + if (error != 0) + return (error); + + error = pefs_read_checksum_file(fdin, &cfh, &cht); + if (error != 0) + return (error); + + pefs_print_hash_tables(&cht, hash_len); + + dirp = opendir(fsroot); + if (dirp == NULL) { + pefs_warn("failed to open dir %s", fsroot); + return (PEFS_ERR_SYS); + } + error = pefs_traverse_fs(&cht, md, hash_len, dirp, fsroot); + if (error != 0) + return (error); + + /* XXXgpf: [TODO] free mem in the end and when error occurs */ + return (0); +} + RB_GENERATE(hardlink_head, hardlink_counter, hardlink_entries, pefs_rb_cmp); Modified: soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c ============================================================================== --- soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Wed Jun 27 12:30:56 2012 (r238396) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.c Wed Jun 27 14:54:33 2012 (r238397) @@ -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_verify(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}, + { "verify", pefs_verify}, { NULL, NULL }, }; @@ -1082,7 +1084,6 @@ if (fpin != NULL) fclose(fpin); pefs_usage(); - break; } argc -= optind; argv += optind; @@ -1098,6 +1099,58 @@ return (error); } +/* + * XXXgpf: Instead of a man page entry: + * + * pefs verify checksumpath filesystem + * + * $command ... + * + * XXX [TODO] comments + * + */ +static int +pefs_verify(int argc, char *argv[]) +{ + char fsroot[MAXPATHLEN]; + int error, fdin, i; + + while ((i = getopt(argc, argv, "a:i:p:")) != -1) + switch(i) { + /* XXXgpf: Should I add an option to tell if it's a mounted or unmounted fs ? */ + default: + pefs_usage(); + } + argc -= optind; + argv += optind; + + if (argc != 2) { + if (argc < 2) + warnx("too few arguments"); + else + warnx("too many arguments"); + pefs_usage(); + } + + fdin = open(argv[0], O_RDONLY); + if (fdin == -1) { + warn("cannot open %s file: %s", PEFS_FILE_CHECKSUM, argv[0]); + return (PEFS_ERR_INVALID); + } + argc -=1; + argv +=1; + + /* XXXgpf: For now, assume that verify works only with a mounted pefs fs */ + initfsroot(argc, argv, 0, fsroot, sizeof(fsroot)); + + error = pefs_verify_checksum(fdin, fsroot); + if (error == 0) + printf("everything's ok!\n"); + + close(fdin); + return (error); +} + static void pefs_usage_alg(void) { @@ -1124,6 +1177,7 @@ " pefs showchains [-fp] [-i iterations] [-k keyfile] filesystem\n" " pefs showalgs\n" " pefs addchecksum [-a algo] [-i inputfile] [-p checksumpath] filesystem\n" +" pefs verify [checksumpath 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 Jun 27 12:30:56 2012 (r238396) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_ctl.h Wed Jun 27 14:54:33 2012 (r238397) @@ -95,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, char *csm_path, const char *algo); +int pefs_verify_checksum(int fdin, char *fsroot); const char * pefs_alg_name(struct pefs_xkey *xk); void pefs_alg_list(FILE *stream); Modified: soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vfsops.c ============================================================================== --- soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vfsops.c Wed Jun 27 12:30:56 2012 (r238396) +++ soc2012/gpf/pefs_kmod/sys/fs/pefs/pefs_vfsops.c Wed Jun 27 14:54:33 2012 (r238397) @@ -617,7 +617,6 @@ pefs_vget(struct mount *mp, ino_t ino, int flags, struct vnode **vpp) { int error; - error = VFS_VGET(VFS_TO_PEFS(mp)->pm_lowervfs, ino, flags, vpp); if (error != 0) return (error); From owner-svn-soc-all@FreeBSD.ORG Wed Jun 27 15:04:03 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id B3C5A1065670 for ; Wed, 27 Jun 2012 15:04:01 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 27 Jun 2012 15:04:01 +0000 Date: Wed, 27 Jun 2012 15:04:01 +0000 From: scher@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120627150401.B3C5A1065670@hub.freebsd.org> Cc: Subject: socsvn commit: r238398 - soc2012/scher/par_ports/head/Mk X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jun 2012 15:04:03 -0000 Author: scher Date: Wed Jun 27 15:04:01 2012 New Revision: 238398 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238398 Log: [bugfix] Fixes the following issue: ===> Applying FreeBSD patches for python27-2.7.3_2 Syntax error: "elif" unexpected (expecting "fi") *** Error code 2 Modified: 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 Wed Jun 27 14:54:33 2012 (r238397) +++ soc2012/scher/par_ports/head/Mk/bsd.port.mk Wed Jun 27 15:04:01 2012 (r238398) @@ -5328,10 +5328,11 @@ ${ECHO_MSG} " => No directory for $$lib. Skipping.."; \ else \ ${_INSTALL_DEPENDS} \ - if [ !${_parv_WANT_PARALLEL_BUILD} ]; then \ + if ! [ ${_parv_WANT_PARALLEL_BUILD} ]; then \ if ! ${LDCONFIG} ${_LDCONFIG_FLAGS} -r | ${GREP} -vwF -e "${PKGCOMPATDIR}" | ${GREP} -qwE -e "-l$$pattern"; then \ - ${ECHO_MSG} "Error: shared library \"$$lib\" does not exist"; \ - ${FALSE}; \ + ${ECHO_MSG} "Error: shared library \"$$lib\" does not exist"; \ + ${FALSE}; \ + fi; \ fi; \ if [ $${spawned} ]; then \ echo "---- dependency output ----- : SPAWNED PID $${spawned}"; \ From owner-svn-soc-all@FreeBSD.ORG Wed Jun 27 17:09:50 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 23A7D1065670 for ; Wed, 27 Jun 2012 17:09:49 +0000 (UTC) (envelope-from tzabal@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 27 Jun 2012 17:09:49 +0000 Date: Wed, 27 Jun 2012 17:09:49 +0000 From: tzabal@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120627170949.23A7D1065670@hub.freebsd.org> Cc: Subject: socsvn commit: r238407 - soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jun 2012 17:09:50 -0000 Author: tzabal Date: Wed Jun 27 17:09:48 2012 New Revision: 238407 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238407 Log: Testing code for crashreport: extract needed debugging information from a core.txt.X file and generate the report in XML format. 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 Wed Jun 27 16:46:02 2012 (r238406) +++ soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh Wed Jun 27 17:09:48 2012 (r238407) @@ -13,7 +13,7 @@ print_usage() { - echo "usage: ${PROG} [-d dumpdir] [-f file] [-e email]" + echo "usage: ${PROG} [-d dumpdir] [-f filename] [-e email]" } error() @@ -52,7 +52,7 @@ ;; *) print_usage - exit 2 + exit 1 ;; esac done @@ -70,12 +70,12 @@ if [ ! -d "${_dumpdir}" ]; then error "Dump directory ${_dumpdir} does not exist." - exit 3 + exit 1 fi if [ -z "`ls ${_dumpdir}`" ]; then error "Dump directory ${_dumpdir} is empty." - exit 4 + exit 1 fi @@ -111,7 +111,7 @@ if [ ! -f "${_dumpdir}/${_file}" ]; then error 'Unable to locate file with debugging information.' - exit 5 + exit 1 fi @@ -122,7 +122,7 @@ _email="${crashreport_email}" else error 'No email address for contact is specified.' - exit 6 + exit 1 fi fi @@ -132,25 +132,243 @@ if [ $? -ne 0 ]; then error "Email address ${_email} is invalid." - exit 7 + exit 1 fi +## Form the report +data=`mktemp /tmp/crashreport.XXXXXX` + +echo "" > ${data} +echo "" >> ${data} +echo "
" >> ${data} +echo "" >> ${data} + +output=`file "${_dumpdir}/${_file}"` +if [ "${output}" == "${_dumpdir}/${_file}: ASCII English text" ]; then + type='vmcore' +elif [ "${output}" == "${_dumpdir}/${_file}: POSIX tar archive" ]; then + type='textdump' +else + error 'Unknown type of debugging information.' + exit 1 +fi + +echo "${type}" >> ${data} +echo "" >> ${data} +echo "" >> ${data} +echo "${_email}" >> ${data} +echo "" >> ${data} +echo "
" >> ${data} + +echo "" >> ${data} +tmp_file=`mktemp /tmp/crashreport.XXXXXX` + +if [ "${type}" == 'vmcore' ]; then + # Date (date) + echo "" >> ${data} + echo "" >> ${data} + echo "date" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + result=`sed -n '3p' "${_dumpdir}/${_file}"` + echo "${result}" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + + # Hostname (hostname) + echo "" >> ${data} + echo "" >> ${data} + echo "hostname" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + result=`sed -n '5p' "${_dumpdir}/${_file}"` + echo "${result}" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + + # Operating System (ostype) + echo "" >> ${data} + echo "" >> ${data} + echo "ostype" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + result=`sed -n '6p' "${_dumpdir}/${_file}"` + echo "${result}" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + + # Operating System Release (osrelease) + echo "" >> ${data} + echo "" >> ${data} + echo "osrelease" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + result=`sed -n '7p' "${_dumpdir}/${_file}"` + echo "${result}" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + + # Version (version) + echo "" >> ${data} + echo "" >> ${data} + echo "version" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + result=`sed -n '8p' "${_dumpdir}/${_file}"` + echo "${result}" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + + # Architecture (machine) + echo "" >> ${data} + echo "" >> ${data} + echo "machine" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + result=`sed -n '9p' "${_dumpdir}/${_file}"` + echo "${result}" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + + # Panic Message (panic) + echo "" >> ${data} + echo "" >> ${data} + echo "panic" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + result=`cat "${_dumpdir}/${_file}" | sed -n '11p' | \ + sed -E 's/^panic: (.+)$/\1/'` + echo "${result}" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + + # Backtrace (bt from kgdb) + echo "" >> ${data} + echo "" >> ${data} + echo "backtrace" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + # Get only the lines about the backtrace, then remove + # the kgdb prompt, and finally remove the empty lines + cat "${_dumpdir}/${_file}" | \ + sed -n '/^(kgdb)/,/^(kgdb) $/p' | \ + sed -E 's/^\(kgdb\) (.*)$/\1/' | \ + sed '/^ *$/d' > "${tmp_file}" + numline='' + while read line; do + echo "${line}" | egrep '^#[0-9] ' > /dev/null + if [ $? -eq 0 ]; then + if [ -z "${numline}" ]; then + numline="${line}" + else + echo ${numline} >> ${data} + numline="${line}" + fi + else + numline="${numline}${line}" + fi + done < ${tmp_file} + echo ${numline} >> ${data} + echo "" >> ${data} + echo "" >> ${data} + + # ps -axl + echo "" >> ${data} + echo "" >> ${data} + echo "ps -axl" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + cat "${_dumpdir}/${_file}" | \ + sed -E -n '/^ps -axl$/,/-{20,}/p' > ${tmp_file} + lines=`wc -l < ${tmp_file}` + start=3 + end=$((lines-2)) + cat ${tmp_file} | sed -E -n "${start},${end}p" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + + # vmstat -s + echo "" >> ${data} + echo "" >> ${data} + echo "vmstat -s" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + cat "${_dumpdir}/${_file}" | \ + sed -E -n '/^vmstat -s$/,/-{20,}/p' > ${tmp_file} + lines=`wc -l < ${tmp_file}` + start=3 + end=$((lines-2)) + cat ${tmp_file} | sed -E -n "${start},${end}p" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + + # vmstat -m + echo "" >> ${data} + echo "" >> ${data} + echo "vmstat -m" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + cat "${_dumpdir}/${_file}" | \ + sed -E -n '/^vmstat -m$/,/-{20,}/p' > ${tmp_file} + lines=`wc -l < ${tmp_file}` + start=3 + end=$((lines-2)) + cat ${tmp_file} | sed -E -n "${start},${end}p" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + + # vmstat -z + + # vmstat -i + + # pstat -T + + # pstat -s + + # iostat + + # ipcs -a + + # ipcs -T + + # nfsstat + + # netstat -s + + # netstat -m + + # netstat -id + + # netstat -anr + + # netstat -anA + + # netstat -aL + + # fstat + + # dmesg + + # kernel config + + # ddb capture buffer + + echo "" >> ${data} + echo "
" >> ${data} + + ## Bundle the report -uniname=`mktemp /tmp/crashreport.XXXXXX` -report="${uniname##*/}.tar.gz" -email_file=`mktemp /tmp/crashreport.XXXXXX` -echo "${_email}" > ${email_file} +report="${data##*/}.tar.gz" -tar -czf ${report} -C "${_dumpdir}" "${_file}" -C ${email_file%/*} \ - ${email_file##*/} +tar -czf ${report} -C ${data%/*} ${data##*/} if [ $? -ne 0 ]; then error 'An error occurred while bundling the report.' - exit 8 + exit 1 fi -rm -f "${uniname}" "${email_file}" +rm -f "${data}" "${tmp_file}" ## Send the report to the Central Collector machine @@ -199,7 +417,7 @@ if [ $? -ne 0 ]; then error 'An error occurred while sending the report.' - exit 9 + exit 1 fi rm -f ${host_public_key_file} ${user_private_key_file} From owner-svn-soc-all@FreeBSD.ORG Wed Jun 27 17:17:13 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id B7C8C106566B for ; Wed, 27 Jun 2012 17:17:11 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 27 Jun 2012 17:17:11 +0000 Date: Wed, 27 Jun 2012 17:17:11 +0000 From: scher@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120627171711.B7C8C106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238408 - soc2012/scher/par_ports/head/Mk X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jun 2012 17:17:13 -0000 Author: scher Date: Wed Jun 27 17:17:11 2012 New Revision: 238408 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238408 Log: [fixed] Parallel intergation in bsd.port.mk is shifted to "include section" just befor .BEGIN target Modified: 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 Wed Jun 27 17:09:48 2012 (r238407) +++ soc2012/scher/par_ports/head/Mk/bsd.port.mk Wed Jun 27 17:17:11 2012 (r238408) @@ -1152,61 +1152,6 @@ .include "${PORTSDIR}/Mk/bsd.commands.mk" -############### PAR_PORTS SPECIFIC COMMENT LINE ############### - -# TODO: doc needed -.if defined(_parv_WANT_NON_PARALLEL_BUILD) -.undef _parv_WANT_PARALLEL_BUILD -.endif - -.if defined(_parv_WANT_PARALLEL_BUILD) -.include "${PORTSDIR}/Mk/bsd.parallel.mk" -.endif - -_PROCESS_ACTIVE_BUILDS?= ${DO_NADA} - -.if !target(lock-port-dbdir) -lock-port-dbdir: - @${DO_NADA} -.endif - -.if !target(lock-pkg-dbdir) -lock-pkg-dbdir: - @${DO_NADA} -.endif - -.if !target(unlock-port-dbdir) -unlock-port-dbdir: - @${DO_NADA} -.endif - -.if !target(unlock-pkg-dbdir) -unlock-pkg-dbdir: - @${DO_NADA} -.endif - -.if !target(check-active-build-conflicts) -check-active-build-conflicts: - @${DO_NADA} -.endif - -.if !target(locking-config-recursive) -locking-config-recursive: - @${DO_NADA} -.endif - -.if !target(locking-config-message) -locking-config-message: - @${DO_NADA} -.endif - -.if !target(check-license-depends) -check-license-depends: - @${DO_NADA} -.endif - -############### ENDF OF PAR_PORTS SPECIFIC COMMENT LINE ############### - # # DESTDIR section to start a chrooted process if invoked with DESTDIR set # @@ -1554,6 +1499,61 @@ .include "${PORTSDIR}/Mk/bsd.ncurses.mk" .endif +############### PAR_PORTS SPECIFIC COMMENT LINE ############### + +# TODO: doc needed +.if defined(_parv_WANT_NON_PARALLEL_BUILD) +.undef _parv_WANT_PARALLEL_BUILD +.endif + +.if defined(_parv_WANT_PARALLEL_BUILD) +.include "${PORTSDIR}/Mk/bsd.parallel.mk" +.endif + +_PROCESS_ACTIVE_BUILDS?= ${DO_NADA} + +.if !target(lock-port-dbdir) +lock-port-dbdir: + @${DO_NADA} +.endif + +.if !target(lock-pkg-dbdir) +lock-pkg-dbdir: + @${DO_NADA} +.endif + +.if !target(unlock-port-dbdir) +unlock-port-dbdir: + @${DO_NADA} +.endif + +.if !target(unlock-pkg-dbdir) +unlock-pkg-dbdir: + @${DO_NADA} +.endif + +.if !target(check-active-build-conflicts) +check-active-build-conflicts: + @${DO_NADA} +.endif + +.if !target(locking-config-recursive) +locking-config-recursive: + @${DO_NADA} +.endif + +.if !target(locking-config-message) +locking-config-message: + @${DO_NADA} +.endif + +.if !target(check-license-depends) +check-license-depends: + @${DO_NADA} +.endif + +############### ENDF OF PAR_PORTS SPECIFIC COMMENT LINE ############### + ############### PAR_PORTS SPECIFIC COMMENT LINE ############### # .if defined(_parv_WANT_PARALLEL_BUILD) || !defined(IGNORE_PATH_CHECKS) From owner-svn-soc-all@FreeBSD.ORG Wed Jun 27 17:27:39 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 0F66C106564A for ; Wed, 27 Jun 2012 17:27:37 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 27 Jun 2012 17:27:37 +0000 Date: Wed, 27 Jun 2012 17:27:37 +0000 From: scher@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120627172737.0F66C106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238409 - soc2012/scher/par_ports/head/Mk X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jun 2012 17:27:39 -0000 Author: scher Date: Wed Jun 27 17:27:36 2012 New Revision: 238409 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238409 Log: [new_feature] options checking is implement only once per "make" call in port's directory [new_feature] options checking is implemented only by parent port, not by dependency ports(it is superfluously) [new_feature] license checking is implemented only by parent port, not by dependency ports 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 Jun 27 17:17:11 2012 (r238408) +++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Wed Jun 27 17:27:36 2012 (r238409) @@ -484,6 +484,7 @@ # Parallel targets section # TODO: outline intergation with bsd.port.mk # +.if !defined(INSTALLS_DEPENDS) check-license-depends: check-license-message @license_to_ask=""; \ dirs_to_process=""; \ @@ -508,11 +509,14 @@ done; \ exit 1; \ fi +.endif check-license-message: @${ECHO_MSG} "===> Checking out licenses for ${PKGNAME} dependencies"; +.if !defined(CONFIG_DONE_${UNIQUENAME:U}) && !defined(INSTALLS_DEPENDS) locking-config-recursive: locking-config-message lock-port-dbdir config-recursive unlock-port-dbdir +.endif locking-config-message: @${ECHO_MSG} "===> Setting user-specified options for ${PKGNAME} and dependencies"; From owner-svn-soc-all@FreeBSD.ORG Wed Jun 27 19:02:35 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id BC1871065672 for ; Wed, 27 Jun 2012 19:02:33 +0000 (UTC) (envelope-from gpf@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 27 Jun 2012 19:02:33 +0000 Date: Wed, 27 Jun 2012 19:02:33 +0000 From: gpf@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120627190233.BC1871065672@hub.freebsd.org> Cc: Subject: socsvn commit: r238413 - soc2012/gpf/pefs_kmod/sbin/pefs X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jun 2012 19:02:36 -0000 Author: gpf Date: Wed Jun 27 19:02:33 2012 New Revision: 238413 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238413 Log: pefs verify for each slnk/reg file: - look it up in index tables and compare total number of checksums as well as checksum values. - generate warning for hardlinks and symlinks just like addchecksum command does. - make sure that all files in .pefs.checksum are found in pefs filesystem for the moment, verify works with a mounted pefs fs. will probably expand and make it work with an unmouted filesystem. 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 Jun 27 18:44:36 2012 (r238412) +++ soc2012/gpf/pefs_kmod/sbin/pefs/pefs_checksum.c Wed Jun 27 19:02:33 2012 (r238413) @@ -107,15 +107,19 @@ /* XXXgpf: [TODO] turns offsets to uint64_t? */ struct file_header { - uint32_t nhashes; - uint64_t file_id; - uint32_t offset_to_checksums; - char path[MAXPATHLEN + 1]; - char dirpath[MAXPATHLEN + 1]; - char filename[MAXNAMLEN + 1]; - char *target_path; - int fd, pfd; - struct checksum_head checksums; + /* on disk information */ + uint32_t nhashes; /* the number of hashes for the file */ + uint64_t file_id; /* id is MAC tweak from filename (first 64 bits) */ + uint32_t offset_to_checksums; /* in file offset to start of checksums */ + + /* in memory information */ + char path[MAXPATHLEN + 1]; /* fullpath for this file */ + char dirpath[MAXPATHLEN + 1]; /* fullpath for this file's parent dir */ + char filename[MAXNAMLEN + 1]; /* filename */ + char *target_path; /*fullpath to this symlink's immediate next target */ + int fd, pfd; /* file descriptors for the file and its parent dir */ + int found; /* mark that this entry was found during "verify" action */ + struct checksum_head checksums; /* this file's checksums */ TAILQ_ENTRY(file_header) file_header_entries; TAILQ_ENTRY(file_header) fh_hardlink_entries; }; @@ -889,7 +893,7 @@ } /* Keep all hardlink file headers in a rb tree */ - if (sb.st_nlink > 1) + if (sb.st_nlink > 1 && hlc_headp != NULL) return (pefs_rb_insert(hlc_headp, fhp, &sb)); return (0); @@ -995,7 +999,7 @@ pefs_close_file(fhp); } - /* checking I/O error with pefs_next_file()*/ + /* checking I/O error from pefs_next_file() */ if (error != 0) return (error); @@ -1476,6 +1480,9 @@ TAILQ_INSERT_TAIL(&(fhp->checksums), csp, checksum_entries); } +/* + * XXXgpf: [TODO] comments + */ static int pefs_read_checksum_file(int fdin, struct checksum_file_header *cfhp, struct cuckoo_hash_table *chtp) { @@ -1498,6 +1505,7 @@ if (fhp != NULL) { TAILQ_INIT(&(fhp->checksums)); hashes_offset = fhp->offset_to_checksums; + fhp->found = 0; for (k = 0; k < fhp->nhashes; k++) { csp = malloc(sizeof(struct checksum)); @@ -1530,6 +1538,7 @@ if (fhp != NULL) { TAILQ_INIT(&(fhp->checksums)); hashes_offset = fhp->offset_to_checksums; + fhp->found = 0; for (k = 0; k < fhp->nhashes; k++) { csp = malloc(sizeof(struct checksum)); @@ -1556,49 +1565,159 @@ } static int -pefs_traverse_fs(struct cuckoo_hash_table *cht, const EVP_MD *md, uint8_t hash_len, DIR *dirp, char *path) +pefs_compare_checksums(struct file_header *fhp, struct file_header *indexfhp, uint8_t hash_len) +{ + struct checksum *csp1, *csp2; + uint32_t i; + int error; + + dprintf(("comparing hashes for file with fid: %llu\t%llu\n", fhp->file_id, indexfhp->file_id)); + + if (fhp->nhashes != indexfhp->nhashes) { + pefs_warn("number of hashes differ between on disk file and stored values for file %s: %u vs %u", + fhp->path, fhp->nhashes, indexfhp->nhashes); + return (1); + } + + csp1 = TAILQ_FIRST(&fhp->checksums); + csp2 = TAILQ_FIRST(&indexfhp->checksums); + i = 1; + while (csp1 != NULL && csp2 != NULL) { + error = memcmp(csp1->hash, csp2->hash, hash_len); + if (error != 0) { + pefs_warn("checksum no: %u differs between on disk file and stored values for file %s", + i, fhp->path); + return (1); + } + csp1 = TAILQ_NEXT(csp1, checksum_entries); + csp2 = TAILQ_NEXT(csp2, checksum_entries); + i++; + } + + return (0); +} + +/* + * XXXgpf: [TODO] comments + */ +static int +pefs_traverse_fs(struct cuckoo_hash_table *chtp, const EVP_MD *md, uint8_t hash_len, DIR *dirp, + char *path, struct statfs *fsp, struct hardlink_head *hlc_headp, struct file_header_head *fh_headp) { char tmpath[MAXPATHLEN]; + struct stat sb; DIR *dirtmp; struct dirent *sdp; + struct file_header *fhp, *indexfhp; int error; while (dirp) { sdp = readdir(dirp); if (sdp != NULL) { - if (strcmp(sdp->d_name, "..") != 0 && strcmp(sdp->d_name, ".") != 0) { - dprintf(("dirent: %s\n", sdp->d_name)); - snprintf(tmpath, sizeof(tmpath), "%s/%s", path, sdp->d_name); - switch (sdp->d_type) { - case DT_DIR: - dirtmp = opendir(tmpath); - if (dirtmp == NULL) { - pefs_warn("failed to open dir: %s", tmpath); - closedir(dirp); - return (PEFS_ERR_SYS); - } - error = pefs_traverse_fs(cht, md, hash_len, dirtmp, tmpath); - if (error != 0) { - closedir(dirp); - return (PEFS_ERR_SYS); - } + if (strcmp(sdp->d_name, "..") == 0 || strcmp(sdp->d_name, ".") == 0 || + strcmp(sdp->d_name, ".pefs.db") == 0 || strcmp(sdp->d_name, ".pefs.conf") == 0 || + strcmp(sdp->d_name, ".pefs.checksum") == 0) + continue; + + //dprintf(("dirent: %s\n", sdp->d_name)); + snprintf(tmpath, sizeof(tmpath), "%s/%s", path, sdp->d_name); + switch (sdp->d_type) { + case DT_DIR: + dirtmp = opendir(tmpath); + if (dirtmp == NULL) { + pefs_warn("failed to open dir: %s", tmpath); + closedir(dirp); + return (PEFS_ERR_SYS); + } + error = pefs_traverse_fs(chtp, md, hash_len, dirtmp, tmpath, fsp, hlc_headp, fh_headp); + if (error != 0) { + closedir(dirp); + return (PEFS_ERR_SYS); + } + break; + /* + * Look up the file and verify its checksums. + * Total number of checksums should be the same and checksums should match. + * Also, take notice of hardlinks & symlink warnings. + * After the traversal is done, we must have found all of our entries in the + * checksum file. + */ + /* FALLTHROUGH */ + case DT_REG: + case DT_LNK: + fhp = malloc(sizeof(struct file_header)); + if (fhp == NULL) { + warn("memory allocation error"); + closedir(dirp); + return (PEFS_ERR_SYS); + } + strlcpy(fhp->path, tmpath, sizeof(fhp->path)); + error = pefs_open_semantic_checks(fhp, fsp, NULL); + if (error != 0) { + closedir(dirp); + free(fhp); + return (error); + } + + error = pefs_get_file_id(fhp); + if (error != 0) { + pefs_close_file(fhp); + free(fhp); + return (error); + } + + indexfhp = pefs_cuckoo_lookup(chtp, fhp); + if (indexfhp == NULL) { + pefs_close_file(fhp); + free(fhp); break; + } + indexfhp->found = 1; + + error = pefs_compute_file_checksums(fhp, md, hash_len); + if (error != 0) { + pefs_close_file(fhp); + free(fhp); + return (error); + } + + error = lstat(fhp->path, &sb); + if (error != 0) { + warn("cannot stat file %s", fhp->path); + pefs_close_file(fhp); + free(fhp); + return (PEFS_ERR_SYS); + } + + error = pefs_rb_insert(hlc_headp, fhp, &sb); + if (error != 0) { + pefs_close_file(fhp); + free(fhp); + return (error); + } + /* - * XXXgpf: Look up the file and verify its checksums. - * Total number of checksums should be the same and checksums should match. - * Also, take notice of hardlinks & symlink warnings. - * After the traversal is done, we must have found all of our entries in the - * checksum file. + * XXXgpf: there's a chance of a false positive here. + * When creating .pefs.checksum we only check if there's a file id + * collision between files that need integrity checking, not against + * the entire filesystem. So there's a possibility we will have a + * false positive in case there are 2 files with the same file id + * now that we traverse the entire fs. + * + * So should exit and treat a checksum comparison as an error? */ - case DT_REG: - dprintf(("reg file\n")); - break; - case DT_LNK: - dprintf(("smlnk file\n")); - break; - default: - break; - } + error = pefs_compare_checksums(fhp, indexfhp, hash_len); + //if (error != 0) { + //pefs_close_file(fhp); + //free(fhp); + //break; + //} + + TAILQ_INSERT_TAIL(fh_headp, fhp, file_header_entries); + pefs_close_file(fhp); + break; + default: + break; } } else { @@ -1611,19 +1730,50 @@ return (PEFS_ERR_SYS); } +static void +pefs_found_all_entries(struct cuckoo_hash_table *chtp) +{ + struct file_header *fhp; + uint32_t i; + + for (i = 0; i < chtp->size; i++) { + fhp = chtp->buckets1[i].fhp; + if (fhp != NULL) + if (fhp->found != 1) + pefs_warn("file with file id %llu was not found in filesystem but exists in checksum file", + fhp->file_id); + } + + for (i = 0; i < chtp->size; i++) { + fhp = chtp->buckets2[i].fhp; + if (fhp != NULL) + if (fhp->found != 1) + pefs_warn("file with file id %llu was not found in filesystem but exists in checksum file", + fhp->file_id); + } +} + /* * XXXgpf: [TODO] comments */ int pefs_verify_checksum(int fdin, char *fsroot) { + struct statfs fs; struct checksum_file_header cfh; struct cuckoo_hash_table cht; + struct file_header_head fh_head; + struct hardlink_head hlc_head; const EVP_MD *md; DIR *dirp; int error; uint8_t hash_len; + if (statfs(fsroot, &fs) == -1) { + pefs_warn("statfs failed: %s: %s", fsroot, strerror(errno)); + return (PEFS_ERR_SYS); + } + error = pefs_read_checksum_file_header(fdin, &cfh); if (error != 0) return (error); @@ -1645,17 +1795,26 @@ if (error != 0) return (error); - pefs_print_hash_tables(&cht, hash_len); + //pefs_print_hash_tables(&cht, hash_len); dirp = opendir(fsroot); if (dirp == NULL) { pefs_warn("failed to open dir %s", fsroot); return (PEFS_ERR_SYS); } - error = pefs_traverse_fs(&cht, md, hash_len, dirp, fsroot); + + RB_INIT(&hlc_head); + TAILQ_INIT(&fh_head); + + error = pefs_traverse_fs(&cht, md, hash_len, dirp, fsroot, &fs, &hlc_head, &fh_head); if (error != 0) return (error); + //pefs_rb_print(&hlc_head); + pefs_rb_warn(&hlc_head); + pefs_symlink_warn(&cht, &fh_head); + pefs_found_all_entries(&cht); + /* XXXgpf: [TODO] free mem in the end and when error occurs */ return (0); } From owner-svn-soc-all@FreeBSD.ORG Wed Jun 27 21:02:02 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id C18E5106564A for ; Wed, 27 Jun 2012 21:02:00 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 27 Jun 2012 21:02:00 +0000 Date: Wed, 27 Jun 2012 21:02:00 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120627210200.C18E5106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238418 - in soc2012/jhagewood: diff diff/diff diff3 mdocml X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Jun 2012 21:02:03 -0000 Author: jhagewood Date: Wed Jun 27 21:02:00 2012 New Revision: 238418 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238418 Log: Modified: soc2012/jhagewood/diff/TODO soc2012/jhagewood/diff/diff-test.sh soc2012/jhagewood/diff/diff/diff.c soc2012/jhagewood/diff/diff/diffreg.c soc2012/jhagewood/diff/hagewood-diff.patch soc2012/jhagewood/diff3/hagewood-diff3.patch soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch Modified: soc2012/jhagewood/diff/TODO ============================================================================== --- soc2012/jhagewood/diff/TODO Wed Jun 27 20:34:29 2012 (r238417) +++ soc2012/jhagewood/diff/TODO Wed Jun 27 21:02:00 2012 (r238418) @@ -8,17 +8,17 @@ --unidirectional-new-file INCOMPLETE --normal COMPLETE Sets format to D_NORMAL in getopt_long(). --suppress-common-lines COMPLETE Because side-by-side mode is executed by sdiff, option is simply passed to sdiff. ---GTYPE-group-format INCOMPLETE +--GTYPE-group-format IN PROGRESS Added options for various GTYPEs. --line-format IN PROGRESS Added new-line-format, old-line-format, and unchanged-line-format for compatibility --LTYPE-line-format INCOMPLETE ---from-file COMPLETE Calls exec1() twice with optarg as file input. NEEDS TESTING. ---to-file COMPLETE Calls exec1() twice with optarg as file input. NEEDS TESTING. +--from-file COMPLETE Calls exec1() twice with optarg as file input. BUG. +--to-file COMPLETE Calls exec1() twice with optarg as file input. BUG. --horizon-lines INCOMPLETE --speed-large-file INCOMPLETE --ignore-tab-expansion IN PROGRESS Functionality implemented in check(), needs debugging. (Same problem as --ignore-blank-lines?) --width INCOMPLETE -Fix non-ascii character diffs COMPLETE Changed name of asciifile() to istextfile() and checks to see if file is ELF format. - +Fix non-ascii character diffs COMPLETE Changed name of asciifile() to istextfile() and detects if file is binary. +Test script COMPLETE Notes: @@ -30,4 +30,34 @@ - With some files, modification times displayed in the timestamp for file1 are different than the time outputted by GNU diff. - The -ignore-*-* options need some work. +- line formats: + + %l Only includes contents of a line, excluding trailing new line. + %L Only includes contents of a line, including trailing new line. + %% Stand for '%' + %c'C' Where C is a character. + %c'\O' where O is a string of 1, 2, or 3 octal digits, stands for the character with octal code O. + Fn Where n is: + -'e' + -'f' + -'l' + -'m' + -'n' + -'E, F, L, M, N' + +- group formats: + %< Stands for the lines from the first file, including trailing new lines. + %> Stands for the lines from the second file, including trailing new lines. + %= Stands for lines common to both files, including trailing new lines. + %% Stands for '%' + %c'C' Where C is a character. + %c'\O' where O is a string of 1, 2, or 3 octal digits, stands for the character with octal code O. + Fn Where n is: + -'e' + -'f' + -'l' + -'m' + -'n' + -'E, F, L, M, N' + Modified: soc2012/jhagewood/diff/diff-test.sh ============================================================================== --- soc2012/jhagewood/diff/diff-test.sh Wed Jun 27 20:34:29 2012 (r238417) +++ soc2012/jhagewood/diff/diff-test.sh Wed Jun 27 21:02:00 2012 (r238418) @@ -9,83 +9,87 @@ mkdir ./test_outputs/gnu mkdir ./test_outputs/bsd -# -# Run GNU diff with various options, direct output to a file. -# - -# Default diff -diff 1.txt 2.txt >> ./test_outputs/gnu/diff.txt - -# --unified output -diff -u 1.txt 2.txt >> ./test_outputs/gnu/unified.txt -diff --unified 1.txt 2.txt >> ./test_outputs/gnu/unified.txt - -# --context output -diff -c 1.txt 2.txt >> ./test_outputs/gnu/context.txt -diff --context 1.txt 2.txt >> ./test_outputs/gnu/context.txt - -# --normal format output -diff --normal 1.txt 2.txt >> ./test_outputs/gnu/normal.txt -diff -c --normal 1.txt 2.txt >> ./test_outputs/gnu/normal.txt -diff -u --normal 1.txt 2.txt >> ./test_outputs/gnu/normal.txt - -# --brief -diff -b 1.txt 2.txt >> ./test_outputs/gnu/brief.txt -diff --brief 1.txt 2.txt >> ./test_outputs/gnu/brief.txt - -# --ed -diff -ed 1.txt 2.txt >> ./test_outputs/gnu/ed.txt -diff -e 1.txt 2.txt >> ./test_outputs/gnu/ed.txt - -# --expand-tabs -diff --expand-tabs 1.txt 2.txt >> ./test_outputs/gnu/expand-tabs.txt -diff -t 1.txt 2.txt >> ./test_outputs/gnu/expand-tabs.txt - -# --forward-ed -diff --forward-ed 1.txt 2.txt >> ./test_outputs/gnu/forward-ed.txt -diff -f 1.txt 2.txt >> ./test_outputs/gnu/forward-ed.txt - -# --help -diff --help 1.txt 2.txt >> ./test_outputs/gnu/help.txt - -# -# Run BSD diff with various options, direct output to a file. -# +function run { -# Default diff -./diff 1.txt 2.txt >> ./test_outputs/bsd/diff.txt + # Default diff + $1 1.txt 2.txt >> $2/diff.txt -# --unified output -./diff -u 1.txt 2.txt >> ./test_outputs/bsd/unified.txt -./diff --unified 1.txt 2.txt >> ./test_outputs/bsd/unified.txt - -# --context output -./diff -c 1.txt 2.txt >> ./test_outputs/bsd/context.txt -./diff --context 1.txt 2.txt >> ./test_outputs/bsd/context.txt - -# --normal format output -./diff --normal 1.txt 2.txt >> ./test_outputs/bsd/normal.txt -./diff -c --normal 1.txt 2.txt >> ./test_outputs/bsd/normal.txt -./diff -u --normal 1.txt 2.txt >> ./test_outputs/bsd/normal.txt - -# --brief -./diff -b 1.txt 2.txt >> ./test_outputs/bsd/brief.txt -./diff --brief 1.txt 2.txt >> ./test_outputs/bsd/brief.txt - -# --ed -./diff -ed 1.txt 2.txt >> ./test_outputs/bsd/ed.txt -./diff -e 1.txt 2.txt >> ./test_outputs/bsd/ed.txt - -# --expand-tabs -./diff --expand-tabs 1.txt 2.txt >> ./test_outputs/bsd/expand-tabs.txt -./diff -t 1.txt 2.txt >> ./test_outputs/bsd/expand-tabs.txt - -# --forward-ed -./diff --forward-ed 1.txt 2.txt >> ./test_outputs/bsd/foward-ed.txt -./diff -f 1.txt 2.txt >> ./test_outputs/bsd/forward-ed.txt + # --unified output + $1 -u 1.txt 2.txt >> $2/unified.txt + $1 --unified 1.txt 2.txt >> $2/unified.txt + $1 --unified="3" 1.txt 2.txt >> $2/unified.txt + + # --context output + $1 -c 1.txt 2.txt >> $2/context.txt + $1 --context 1.txt 2.txt >> $2/context.txt + $1 --context="3" 1.txt 2.txt >> $2/context.txt + + # --normal format output + $1 --normal 1.txt 2.txt >> $2/normal.txt + $1 -c --normal 1.txt 2.txt >> $2/normal.txt + $1 -u --normal 1.txt 2.txt >> $2/normal.txt + + # --brief + $1 -b 1.txt 2.txt >> $2/brief.txt + $1 --brief 1.txt 2.txt >> $2/brief.txt + + # --ed + $1 -ed 1.txt 2.txt >> $2/ed.txt + $1 -e 1.txt 2.txt >> $2/ed.txt + + # --expand-tabs + $1 --expand-tabs 1.txt 2.txt >> $2/expand-tabs.txt + $1 -t 1.txt 2.txt >> $2/expand-tabs.txt + + # --forward-ed + $1 --forward-ed 1.txt 2.txt >> $2/forward-ed.txt + $1 -f 1.txt 2.txt >> $2/forward-ed.txt + + # --to-file + $1 --tofile="3.txt" 1.txt 2.txt >> $2/tofile.txt + + # --from-file + $1 --from-file="3.txt" 1.txt 2.txt >> $2/fromfile.txt + + # --text + $1 --text 1.txt 2.txt >> $2/text.txt + $1 -a 1.txt 2.txt >> $2/text.txt + + # --strip-trailing-cr + $1 --strip-trailing-cr 1.txt 2.txt >> $2 stripcr.txt + + # --rcs + $1 --rcs 1.txt 2.txt >> $2/rcs.txt + $1 -n 1.txt 2.txt >> $2/rcs.txt + + # --width + $1 --width="10" 1.txt 2.txt >> $2/width.txt + $1 -W "10" 1.txt 2.txt >> $2/width.txt + + # --side-by-side + $1 --side-by-side 1.txt 2.txt >> $2/sbs.txt + $1 -y 1.txt 2.txt >> $2/sbs.txt + + # --left-column + $1 -y --left-column 1.txt 2.txt >> $2/lc.txt + $1 --side-by-side --left-column 1.txt 2.txt >> $2/lc.txt + + # --line-format + $1 --line-format="%l %% %c'T'" 1.txt 2.txt >> $2/lf.txt + + # + + # --help + $1 --help 1.txt 2.txt >> $2/help.txt +} + +$PATH = './test_outputs/gnu' +$DIFF_PATH = '/usr/bin/diff' +run $DIFF_PATH $PATH +$PATH = './test_outputs/bsd' +$DIFF_PATH = './diff' +run $DIFF_PATH $PATH -# --help -diff --help 1.txt 2.txt >> ./test_outputs/bsd/help.txt # # Get the diff between the GNU and BSD outputs. # Modified: soc2012/jhagewood/diff/diff/diff.c ============================================================================== --- soc2012/jhagewood/diff/diff/diff.c Wed Jun 27 20:34:29 2012 (r238417) +++ soc2012/jhagewood/diff/diff/diff.c Wed Jun 27 21:02:00 2012 (r238418) @@ -68,7 +68,10 @@ OPT_NORMAL, OPT_LEFTC, OPT_SUPCL, - OPT_GTYPE, + OPT_CHGD_GF, + OPT_NEW_GF, + OPT_OLD_GF, + OPT_UNCHGD_GF, OPT_LF, OPT_LLF, OPT_TSIZE, @@ -90,6 +93,7 @@ */ { "brief", no_argument, NULL, 'q' }, + { "changed-group-format", required_Argument, NULL, OPT_CHGD_GF}, { "context", optional_argument, NULL, 'C' }, { "ed", no_argument, NULL, 'e' }, { "exclude", required_argument, NULL, 'x' }, @@ -97,7 +101,6 @@ { "expand-tabs", no_argument, NULL, 't' }, { "from-file", required_argument, NULL, OPT_FFILE }, { "forward-ed", no_argument, NULL, 'f' }, - /*{ "GTYPE-group-format", required_argument, NULL, OPT_GTYPE },*/ { "help", no_argument, NULL, OPT_HELP }, /*{ "horizon-lines", required_argument, NULL, OPT_HLINES },*/ { "ifdef", required_argument, NULL, 'D' }, @@ -112,13 +115,14 @@ { "label", required_argument, NULL, 'L' }, { "left-column", no_argument, NULL, OPT_LEFTC }, { "line-format", required_argument, NULL, OPT_LF }, - /*{ "LTYPE-line-format", required_argument, NULL, OPT_LLF },*/ { "minimal", no_argument, NULL, 'd' }, { "new-file", no_argument, NULL, 'N' }, { "new-line-format", required_argument, NULL, OPT_NEW_LF}, + { "new-group-format", required_argument, NULL, OPT_NEW_GF}, { "no-ignore-file-name-case", no_argument, NULL, OPT_NIGN_FN_CASE }, { "normal", no_argument, NULL, OPT_NORMAL }, { "old-line-format", required_argument, NULL, OPT_OLD_LF}, + { "old-group-format", required_argument, NULL OPT_OLD_GF}, { "paginate", no_argument, NULL, 'l' }, { "recursive", no_argument, NULL, 'r' }, { "report-identical-files", no_argument, NULL, 's' }, @@ -133,6 +137,7 @@ { "tabsize", optional_argument, NULL, OPT_TSIZE }, { "text", no_argument, NULL, 'a' }, { "to-file", required_argument, NULL, OPT_TOFILE }, + { "unchanged-group-format", required_argument, NULL, OPT_UNCHGD_GF}, { "unchanged-line-format", required_argument, NULL, OPT_UNCHGD_LF}, { "unidirectional-new-file", no_argument, NULL, 'P' }, { "unified", optional_argument, NULL, 'U' }, @@ -162,7 +167,7 @@ int main(int argc, char **argv) { - char *ep, **oargv, *file1, *file2, *file3; + char *ep, **oargv, *args, *file1, *file2, *file3; long l; int ch, lastch, gotstdin, prevoptind, newarg; int oargc, childstat; @@ -313,6 +318,14 @@ file2 = argv[argc-1]; file3 = optarg; break; + case OPT_CHGD_GF: + case OPT_NEW_GF: + case OPT_OLD_GF: + case OPT_UNCHGD_GF: + /* XXX To do: Coplete --GTYPE-group-format. */ + format = D_IFDEF; + ifdefname = optarg; + break; case OPT_NEW_LF: case OPT_OLD_LF: case OPT_UNCHGD_LF: @@ -377,12 +390,18 @@ (void)fprintf(stderr, "--from-file and --to-file both specified.\n"); exit(2); } + while ((ch = getopt(argc, argv, OPTIONS)) != -1) + strcat(args, ch); childpid = fork(); + if (childpid < 0) { + (void)fprintf(stderr, "Error forking process.\n"); + exit(2); + } if (childpid == 0) { if (Toflag) - execl(_PATH_DIFF, _PATH_DIFF, file1, file3); + execl(_PATH_DIFF, _PATH_DIFF, args, file1, file3); if (Fromflag) - execl(_PATH_DIFF, _PATH_DIFF, file3, file1); + execl(_PATH_DIFF, _PATH_DIFF, args, file3, file1); exit(127); } if (childpid > 0) { Modified: soc2012/jhagewood/diff/diff/diffreg.c ============================================================================== --- soc2012/jhagewood/diff/diff/diffreg.c Wed Jun 27 20:34:29 2012 (r238417) +++ soc2012/jhagewood/diff/diff/diffreg.c Wed Jun 27 21:02:00 2012 (r238418) @@ -1356,12 +1356,8 @@ if (aflag || f == NULL) return (1); rewind(f); - /* If the first 4 bytes of the file are the same as the first 4 bytes of - * an ELF file header, return 0. - */ - fread(buf, 1, sizeof(buf), f); - if(buf[0] == 0x7F && buf[1] == 0x45 && - buf[2] == 0x4C && buf[3] == 0x46) + for (i = 0; i <= strlen(buf) || i <= 32; i++) + if (memchr(buf, '\0', strlen(buf)) != NULL) return (0); return (1); } Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Wed Jun 27 20:34:29 2012 (r238417) +++ soc2012/jhagewood/diff/hagewood-diff.patch Wed Jun 27 21:02:00 2012 (r238418) @@ -1,6 +1,6 @@ diff -rupN jhagewood/diff/diff-orig/diff.c jhagewood/diff/diff/diff.c ---- jhagewood/diff/diff-orig/diff.c 2012-06-25 16:05:53.000000000 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-27 04:20:28.000000000 -0400 +--- jhagewood/diff/diff-orig/diff.c 2012-06-25 12:05:52.000000000 -0400 ++++ jhagewood/diff/diff/diff.c 2012-06-27 16:35:04.000000000 -0400 @@ -1,4 +1,4 @@ -/*- +/* @@ -56,13 +56,17 @@ /* Options which exceed manageable alphanumeric assignments */ -@@ -69,75 +67,77 @@ enum +@@ -69,75 +67,82 @@ enum OPT_STRIPCR, OPT_NORMAL, OPT_LEFTC, - OT_SUPCL, +- OPT_GTYPE, + OPT_SUPCL, - OPT_GTYPE, ++ OPT_CHGD_GF, ++ OPT_NEW_GF, ++ OPT_OLD_GF, ++ OPT_UNCHGD_GF, OPT_LF, OPT_LLF, OPT_TSIZE, @@ -107,6 +111,7 @@ + */ + + { "brief", no_argument, NULL, 'q' }, ++ { "changed-group-format", required_Argument, NULL, OPT_CHGD_GF}, { "context", optional_argument, NULL, 'C' }, - { "ifdef", required_argument, NULL, 'D' }, - { "minimal", no_argument, NULL, 'd' }, @@ -120,7 +125,6 @@ + { "expand-tabs", no_argument, NULL, 't' }, + { "from-file", required_argument, NULL, OPT_FFILE }, { "forward-ed", no_argument, NULL, 'f' }, -+ /*{ "GTYPE-group-format", required_argument, NULL, OPT_GTYPE },*/ + { "help", no_argument, NULL, OPT_HELP }, + /*{ "horizon-lines", required_argument, NULL, OPT_HLINES },*/ + { "ifdef", required_argument, NULL, 'D' }, @@ -137,7 +141,6 @@ - { "paginate", no_argument, NULL, 'l' }, + { "left-column", no_argument, NULL, OPT_LEFTC }, + { "line-format", required_argument, NULL, OPT_LF }, -+ /*{ "LTYPE-line-format", required_argument, NULL, OPT_LLF },*/ + { "minimal", no_argument, NULL, 'd' }, { "new-file", no_argument, NULL, 'N' }, - { "rcs", no_argument, NULL, 'n' }, @@ -145,9 +148,11 @@ - { "show-c-function", no_argument, NULL, 'p' }, - { "brief", no_argument, NULL, 'q' }, + { "new-line-format", required_argument, NULL, OPT_NEW_LF}, ++ { "new-group-format", required_argument, NULL, OPT_NEW_GF}, + { "no-ignore-file-name-case", no_argument, NULL, OPT_NIGN_FN_CASE }, + { "normal", no_argument, NULL, OPT_NORMAL }, + { "old-line-format", required_argument, NULL, OPT_OLD_LF}, ++ { "old-group-format", required_argument, NULL OPT_OLD_GF}, + { "paginate", no_argument, NULL, 'l' }, { "recursive", no_argument, NULL, 'r' }, - { "starting-file", required_argument, NULL, 'S' }, @@ -166,6 +171,7 @@ + { "tabsize", optional_argument, NULL, OPT_TSIZE }, + { "text", no_argument, NULL, 'a' }, + { "to-file", required_argument, NULL, OPT_TOFILE }, ++ { "unchanged-group-format", required_argument, NULL, OPT_UNCHGD_GF}, + { "unchanged-line-format", required_argument, NULL, OPT_UNCHGD_LF}, + { "unidirectional-new-file", no_argument, NULL, 'P' }, { "unified", optional_argument, NULL, 'U' }, @@ -180,7 +186,7 @@ { NULL, 0, NULL, '\0'} }; -@@ -162,11 +162,12 @@ void read_excludes_file(char *); +@@ -162,11 +167,12 @@ void read_excludes_file(char *); int main(int argc, char **argv) { @@ -189,7 +195,7 @@ - int ch, lastch, gotstdin, prevoptind, newarg; - int oargc; - -+ char *ep, **oargv, *file1, *file2, *file3; ++ char *ep, **oargv, *args, *file1, *file2, *file3; + long l; + int ch, lastch, gotstdin, prevoptind, newarg; + int oargc, childstat; @@ -198,7 +204,7 @@ oargv = argv; oargc = argc; gotstdin = 0; -@@ -197,6 +198,7 @@ main(int argc, char **argv) +@@ -197,6 +203,7 @@ main(int argc, char **argv) break; case 'C': case 'c': @@ -206,7 +212,7 @@ format = D_CONTEXT; if (optarg != NULL) { l = strtol(optarg, &ep, 10); -@@ -213,6 +215,9 @@ main(int argc, char **argv) +@@ -213,6 +220,9 @@ main(int argc, char **argv) case 'd': dflag = 1; break; @@ -216,7 +222,7 @@ case 'e': format = D_EDIT; break; -@@ -296,15 +301,44 @@ main(int argc, char **argv) +@@ -296,15 +306,52 @@ main(int argc, char **argv) case 'y': yflag = 1; break; @@ -232,6 +238,14 @@ + file2 = argv[argc-1]; + file3 = optarg; + break; ++ case OPT_CHGD_GF: ++ case OPT_NEW_GF: ++ case OPT_OLD_GF: ++ case OPT_UNCHGD_GF: ++ /* XXX To do: Coplete --GTYPE-group-format. */ ++ format = D_IFDEF; ++ ifdefname = optarg; ++ break; + case OPT_NEW_LF: + case OPT_OLD_LF: + case OPT_UNCHGD_LF: @@ -269,7 +283,7 @@ case OPT_STRIPCR: strip_cr=1; break; -@@ -328,20 +362,51 @@ main(int argc, char **argv) +@@ -328,20 +375,57 @@ main(int argc, char **argv) lastch = ch; newarg = optind != prevoptind; prevoptind = optind; @@ -290,12 +304,18 @@ + (void)fprintf(stderr, "--from-file and --to-file both specified.\n"); + exit(2); + } ++ while ((ch = getopt(argc, argv, OPTIONS)) != -1) ++ strcat(args, ch); + childpid = fork(); ++ if (childpid < 0) { ++ (void)fprintf(stderr, "Error forking process.\n"); ++ exit(2); ++ } + if (childpid == 0) { + if (Toflag) -+ execl(_PATH_DIFF, _PATH_DIFF, file1, file3); ++ execl(_PATH_DIFF, _PATH_DIFF, args, file1, file3); + if (Fromflag) -+ execl(_PATH_DIFF, _PATH_DIFF, file3, file1); ++ execl(_PATH_DIFF, _PATH_DIFF, args, file3, file1); + exit(127); + } + if (childpid > 0) { @@ -326,7 +346,7 @@ execv(_PATH_SDIFF, oargv); _exit(127); } -@@ -380,7 +445,10 @@ main(int argc, char **argv) +@@ -380,7 +464,10 @@ main(int argc, char **argv) set_argstr(oargv, argv); if (S_ISDIR(stb1.st_mode) && S_ISDIR(stb2.st_mode)) { if (format == D_IFDEF) @@ -338,7 +358,7 @@ diffdir(argv[0], argv[1]); } else { if (S_ISDIR(stb1.st_mode)) { -@@ -402,11 +470,10 @@ main(int argc, char **argv) +@@ -402,11 +489,10 @@ main(int argc, char **argv) void * emalloc(size_t n) { @@ -351,7 +371,7 @@ if ((p = malloc(n)) == NULL) errx(2, NULL); return (p); -@@ -415,7 +482,7 @@ emalloc(size_t n) +@@ -415,7 +501,7 @@ emalloc(size_t n) void * erealloc(void *p, size_t n) { @@ -360,7 +380,7 @@ if (n == 0) errx(2, NULL); -@@ -431,13 +498,12 @@ erealloc(void *p, size_t n) +@@ -431,13 +517,12 @@ erealloc(void *p, size_t n) int easprintf(char **ret, const char *fmt, ...) { @@ -376,7 +396,7 @@ if (len < 0 || *ret == NULL) errx(2, NULL); return (len); -@@ -446,11 +512,12 @@ easprintf(char **ret, const char *fmt, . +@@ -446,11 +531,12 @@ easprintf(char **ret, const char *fmt, . char * estrdup(const char *str) { @@ -391,7 +411,7 @@ strlcpy(cp, str, len); return (cp); } -@@ -531,6 +598,7 @@ push_ignore_pats(char *pattern) +@@ -531,6 +617,7 @@ push_ignore_pats(char *pattern) void print_only(const char *path, size_t dirlen, const char *entry) { @@ -399,7 +419,7 @@ if (dirlen > 1) dirlen--; printf("Only in %.*s: %s\n", (int)dirlen, path, entry); -@@ -539,45 +607,46 @@ print_only(const char *path, size_t dirl +@@ -539,45 +626,46 @@ print_only(const char *path, size_t dirl void print_status(int val, char *path1, char *path2, char *entry) { @@ -457,7 +477,7 @@ break; } } -@@ -585,6 +654,7 @@ print_status(int val, char *path1, char +@@ -585,6 +673,7 @@ print_status(int val, char *path1, char void usage(void) { @@ -465,25 +485,9 @@ (void)fprintf(stderr, "usage: diff [-abdilpqTtw] [-I pattern] [-c | -e | -f | -n | -u]\n" " [-L label] file1 file2\n" -diff -rupN jhagewood/diff/diff-orig/diff.h jhagewood/diff/diff/diff.h ---- jhagewood/diff/diff-orig/diff.h 2012-06-25 16:05:53.000000000 -0400 -+++ jhagewood/diff/diff/diff.h 2012-06-26 04:19:55.000000000 -0400 -@@ -75,9 +75,9 @@ struct excludes { - struct excludes *next; - }; - --extern int aflag, bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag, -- sflag, tflag, Tflag, wflag; --extern int Bflag, strip_cr, tabsize; -+extern int aflag, bflag, cflag, dflag, Eflag, Fromflag, iflag, lflag, Nflag, Pflag, pflag, rflag, -+ sflag, tflag, Tflag, Toflag, wflag; -+extern int Bflag, strip_cr, suppress_cl, tabsize; - extern int format, context, status; - extern char ignore_file_case; - extern char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; diff -rupN jhagewood/diff/diff-orig/diffdir.c jhagewood/diff/diff/diffdir.c ---- jhagewood/diff/diff-orig/diffdir.c 2012-06-25 16:05:53.000000000 -0400 -+++ jhagewood/diff/diff/diffdir.c 2012-06-25 16:05:53.000000000 -0400 +--- jhagewood/diff/diff-orig/diffdir.c 2012-06-25 12:05:52.000000000 -0400 ++++ jhagewood/diff/diff/diffdir.c 2012-06-25 12:05:52.000000000 -0400 @@ -20,14 +20,13 @@ #include @@ -591,9 +595,25 @@ strlcpy(path1 + plen1, dp->d_name, MAXPATHLEN - plen1); if (stat(path1, &stb1) != 0) { +diff -rupN jhagewood/diff/diff-orig/diff.h jhagewood/diff/diff/diff.h +--- jhagewood/diff/diff-orig/diff.h 2012-06-25 12:05:52.000000000 -0400 ++++ jhagewood/diff/diff/diff.h 2012-06-26 00:19:54.000000000 -0400 +@@ -75,9 +75,9 @@ struct excludes { + struct excludes *next; + }; + +-extern int aflag, bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag, +- sflag, tflag, Tflag, wflag; +-extern int Bflag, strip_cr, tabsize; ++extern int aflag, bflag, cflag, dflag, Eflag, Fromflag, iflag, lflag, Nflag, Pflag, pflag, rflag, ++ sflag, tflag, Tflag, Toflag, wflag; ++extern int Bflag, strip_cr, suppress_cl, tabsize; + extern int format, context, status; + extern char ignore_file_case; + extern char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c ---- jhagewood/diff/diff-orig/diffreg.c 2012-06-25 21:19:12.000000000 -0400 -+++ jhagewood/diff/diff/diffreg.c 2012-06-25 21:33:12.000000000 -0400 +--- jhagewood/diff/diff-orig/diffreg.c 2012-06-25 17:19:12.000000000 -0400 ++++ jhagewood/diff/diff/diffreg.c 2012-06-27 14:31:58.000000000 -0400 @@ -62,15 +62,13 @@ * @(#)diffreg.c 8.1 (Berkeley) 6/6/93 */ @@ -657,7 +677,7 @@ anychange = 0; lastline = 0; -@@ -353,7 +357,6 @@ diffreg(char *ofile1, char *ofile2, int +@@ -353,7 +357,6 @@ diffreg(char *ofile1, char *ofile2, int status |= 2; goto closem; } @@ -665,7 +685,7 @@ switch (files_differ(f1, f2, flags)) { case 0: goto closem; -@@ -365,7 +368,7 @@ diffreg(char *ofile1, char *ofile2, int +@@ -365,7 +368,7 @@ diffreg(char *ofile1, char *ofile2, int goto closem; } @@ -1098,7 +1118,7 @@ sum = 1; space = 0; -@@ -1305,19 +1344,24 @@ readhash(FILE *f) +@@ -1305,19 +1344,20 @@ readhash(FILE *f) return (sum == 0 ? 1 : sum); } @@ -1121,16 +1141,12 @@ - cnt = fread(buf, 1, sizeof(buf), f); - for (i = 0; i < cnt; i++) - if (!isprint(buf[i]) && !isspace(buf[i])) -+ /* If the first 4 bytes of the file are the same as the first 4 bytes of -+ * an ELF file header, return 0. -+ */ -+ fread(buf, 1, sizeof(buf), f); -+ if(buf[0] == 0x7F && buf[1] == 0x45 && -+ buf[2] == 0x4C && buf[3] == 0x46) ++ for (i = 0; i <= strlen(buf) || i <= 32; i++) ++ if (memchr(buf, '\0', strlen(buf)) != NULL) return (0); return (1); } -@@ -1327,10 +1371,10 @@ asciifile(FILE *f) +@@ -1327,10 +1367,10 @@ asciifile(FILE *f) static char * match_function(const long *f, int pos, FILE *file) { @@ -1145,7 +1161,7 @@ lastline = pos; while (pos > last) { -@@ -1342,7 +1386,6 @@ match_function(const long *f, int pos, F +@@ -1342,7 +1382,6 @@ match_function(const long *f, int pos, F if (nc > 0) { buf[nc] = '\0'; buf[strcspn(buf, "\n")] = '\0'; @@ -1153,7 +1169,7 @@ if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') { if (begins_with(buf, "private:")) { if (!state) -@@ -1373,9 +1416,9 @@ static void +@@ -1373,9 +1412,9 @@ static void dump_context_vec(FILE *f1, FILE *f2) { struct context_vec *cvp = context_vec_start; @@ -1166,7 +1182,7 @@ if (context_vec_start > context_vec_ptr) return; -@@ -1390,8 +1433,8 @@ dump_context_vec(FILE *f1, FILE *f2) +@@ -1390,8 +1429,8 @@ dump_context_vec(FILE *f1, FILE *f2) if (pflag) { f = match_function(ixold, lowa-1, f1); if (f != NULL) { @@ -1177,7 +1193,7 @@ } } printf("\n*** "); -@@ -1478,9 +1521,9 @@ static void +@@ -1478,9 +1517,9 @@ static void dump_unified_vec(FILE *f1, FILE *f2) { struct context_vec *cvp = context_vec_start; @@ -1190,7 +1206,7 @@ if (context_vec_start > context_vec_ptr) return; -@@ -1491,19 +1534,19 @@ dump_unified_vec(FILE *f1, FILE *f2) +@@ -1491,19 +1530,19 @@ dump_unified_vec(FILE *f1, FILE *f2) lowc = MAX(1, cvp->c - context); upd = MIN(len[1], context_vec_ptr->d + context); @@ -1216,7 +1232,7 @@ /* * Output changes in "unified" diff format--the old and new lines -@@ -1551,16 +1594,43 @@ dump_unified_vec(FILE *f1, FILE *f2) +@@ -1551,16 +1590,43 @@ dump_unified_vec(FILE *f1, FILE *f2) static void print_header(const char *file1, const char *file2) { @@ -1267,8 +1283,8 @@ + file2, buf2); } diff -rupN jhagewood/diff/diff-orig/pathnames.h jhagewood/diff/diff/pathnames.h ---- jhagewood/diff/diff-orig/pathnames.h 2012-06-25 16:05:53.000000000 -0400 -+++ jhagewood/diff/diff/pathnames.h 2012-06-26 04:51:36.000000000 -0400 +--- jhagewood/diff/diff-orig/pathnames.h 2012-06-25 12:05:52.000000000 -0400 ++++ jhagewood/diff/diff/pathnames.h 2012-06-26 00:51:36.000000000 -0400 @@ -23,4 +23,5 @@ #include Modified: soc2012/jhagewood/diff3/hagewood-diff3.patch ============================================================================== --- soc2012/jhagewood/diff3/hagewood-diff3.patch Wed Jun 27 20:34:29 2012 (r238417) +++ soc2012/jhagewood/diff3/hagewood-diff3.patch Wed Jun 27 21:02:00 2012 (r238418) @@ -1,17 +1,6 @@ -diff -rupN jhagewood/diff3/diff3-orig/Makefile jhagewood/diff3/diff3/Makefile ---- jhagewood/diff3/diff3-orig/Makefile 2012-06-25 16:05:53.000000000 -0400 -+++ jhagewood/diff3/diff3/Makefile 2012-06-25 16:05:53.000000000 -0400 -@@ -6,6 +6,6 @@ BINDIR= /usr/libexec - - beforeinstall: - install ${INSTALL_COPY}c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ -- ${.CURDIR}/diff3.ksh ${DESTDIR}/usr/bin/diff3 -+ ${.CURDIR}/diff3.sh ${DESTDIR}/usr/bin/diff3 - - .include diff -rupN jhagewood/diff3/diff3-orig/diff3prog.c jhagewood/diff3/diff3/diff3prog.c ---- jhagewood/diff3/diff3-orig/diff3prog.c 2012-06-25 16:05:53.000000000 -0400 -+++ jhagewood/diff3/diff3/diff3prog.c 2012-06-25 16:05:53.000000000 -0400 +--- jhagewood/diff3/diff3-orig/diff3prog.c 2012-06-25 12:05:52.000000000 -0400 ++++ jhagewood/diff3/diff3/diff3prog.c 2012-06-25 12:05:52.000000000 -0400 @@ -64,19 +64,23 @@ * @(#)diff3.c 8.1 (Berkeley) 6/6/93 */ @@ -466,3 +455,14 @@ + fprintf(stderr, "usage: diff3 %s file1 file2 file3\n", OPTIONS); exit(EXIT_FAILURE); } +diff -rupN jhagewood/diff3/diff3-orig/Makefile jhagewood/diff3/diff3/Makefile +--- jhagewood/diff3/diff3-orig/Makefile 2012-06-25 12:05:52.000000000 -0400 ++++ jhagewood/diff3/diff3/Makefile 2012-06-25 12:05:52.000000000 -0400 +@@ -6,6 +6,6 @@ BINDIR= /usr/libexec + + beforeinstall: + install ${INSTALL_COPY}c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ +- ${.CURDIR}/diff3.ksh ${DESTDIR}/usr/bin/diff3 ++ ${.CURDIR}/diff3.sh ${DESTDIR}/usr/bin/diff3 + + .include Modified: soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch ============================================================================== --- soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch Wed Jun 27 20:34:29 2012 (r238417) +++ soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch Wed Jun 27 21:02:00 2012 (r238418) @@ -1,6 +1,6 @@ diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man.h jhagewood/mdocml/mdocml-1.12.1/man.h ---- jhagewood/mdocml/mdocml-1.12.1-orig/man.h 2012-06-25 16:05:56.000000000 -0400 -+++ jhagewood/mdocml/mdocml-1.12.1/man.h 2012-06-25 16:05:59.000000000 -0400 +--- jhagewood/mdocml/mdocml-1.12.1-orig/man.h 2012-06-25 12:05:56.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man.h 2012-06-25 12:05:58.000000000 -0400 @@ -43,6 +43,8 @@ enum mant { MAN_sp, MAN_nf, @@ -12,7 +12,7 @@ MAN_DT, diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man.h.orig jhagewood/mdocml/mdocml-1.12.1/man.h.orig --- jhagewood/mdocml/mdocml-1.12.1-orig/man.h.orig 1969-12-31 19:00:00.000000000 -0500 -+++ jhagewood/mdocml/mdocml-1.12.1/man.h.orig 2012-06-25 16:05:59.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man.h.orig 2012-06-25 12:05:58.000000000 -0400 @@ -0,0 +1,113 @@ +/* $Id: man.h,v 1.60 2012/01/03 15:16:24 kristaps Exp $ */ +/* @@ -128,8 +128,8 @@ + +#endif /*!MAN_H*/ diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c jhagewood/mdocml/mdocml-1.12.1/man_term.c ---- jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c 2012-06-25 16:05:56.000000000 -0400 -+++ jhagewood/mdocml/mdocml-1.12.1/man_term.c 2012-06-25 16:05:59.000000000 -0400 +--- jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c 2012-06-25 12:05:56.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man_term.c 2012-06-25 12:05:58.000000000 -0400 @@ -82,6 +82,8 @@ static int pre_alternate(DECL_ARGS); static int pre_ft(DECL_ARGS); static int pre_ign(DECL_ARGS); @@ -173,7 +173,7 @@ static int diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c.orig jhagewood/mdocml/mdocml-1.12.1/man_term.c.orig --- jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c.orig 1969-12-31 19:00:00.000000000 -0500 -+++ jhagewood/mdocml/mdocml-1.12.1/man_term.c.orig 2012-06-25 16:05:59.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man_term.c.orig 2012-06-25 12:05:58.000000000 -0400 @@ -0,0 +1,1117 @@ +/* $Id: man_term.c,v 1.127 2012/01/03 15:16:24 kristaps Exp $ */ +/* From owner-svn-soc-all@FreeBSD.ORG Thu Jun 28 02:39:36 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 5F7E9106566B for ; Thu, 28 Jun 2012 02:39:34 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 28 Jun 2012 02:39:34 +0000 Date: Thu, 28 Jun 2012 02:39:34 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120628023934.5F7E9106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238437 - in soc2012/jhagewood: diff diff3 mdocml X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 02:39:36 -0000 Author: jhagewood Date: Thu Jun 28 02:39:33 2012 New Revision: 238437 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238437 Log: Modified: soc2012/jhagewood/diff/TODO soc2012/jhagewood/diff/diff-test.sh soc2012/jhagewood/diff/hagewood-diff.patch soc2012/jhagewood/diff3/hagewood-diff3.patch soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch Modified: soc2012/jhagewood/diff/TODO ============================================================================== --- soc2012/jhagewood/diff/TODO Thu Jun 28 01:04:59 2012 (r238436) +++ soc2012/jhagewood/diff/TODO Thu Jun 28 02:39:33 2012 (r238437) @@ -17,6 +17,7 @@ --speed-large-file INCOMPLETE --ignore-tab-expansion IN PROGRESS Functionality implemented in check(), needs debugging. (Same problem as --ignore-blank-lines?) --width INCOMPLETE +--help IN PROGRESS Needs descriptions for the rest of the options and formatting. Fix non-ascii character diffs COMPLETE Changed name of asciifile() to istextfile() and detects if file is binary. Test script COMPLETE Modified: soc2012/jhagewood/diff/diff-test.sh ============================================================================== --- soc2012/jhagewood/diff/diff-test.sh Thu Jun 28 01:04:59 2012 (r238436) +++ soc2012/jhagewood/diff/diff-test.sh Thu Jun 28 02:39:33 2012 (r238437) @@ -9,7 +9,7 @@ mkdir ./test_outputs/gnu mkdir ./test_outputs/bsd -function run { +run () { # Default diff $1 1.txt 2.txt >> $2/diff.txt @@ -46,10 +46,12 @@ $1 -f 1.txt 2.txt >> $2/forward-ed.txt # --to-file - $1 --tofile="3.txt" 1.txt 2.txt >> $2/tofile.txt + # XXX Currently hangs on BSD diff. + #$1 --to-file="3.txt" 1.txt 2.txt >> $2/tofile.txt # --from-file - $1 --from-file="3.txt" 1.txt 2.txt >> $2/fromfile.txt + # XXX Currently hangs on BSD diff. + #$1 --from-file="3.txt" 1.txt 2.txt >> $2/fromfile.txt # --text $1 --text 1.txt 2.txt >> $2/text.txt @@ -77,18 +79,16 @@ # --line-format $1 --line-format="%l %% %c'T'" 1.txt 2.txt >> $2/lf.txt - # - # --help $1 --help 1.txt 2.txt >> $2/help.txt } -$PATH = './test_outputs/gnu' -$DIFF_PATH = '/usr/bin/diff' -run $DIFF_PATH $PATH -$PATH = './test_outputs/bsd' -$DIFF_PATH = './diff' -run $DIFF_PATH $PATH +DIR_PATH="./test_outputs/gnu" +DIFF_PATH="/usr/bin/diff" +run "$DIFF_PATH" "$DIR_PATH" +DIR_PATH="./test_outputs/bsd" +DIFF_PATH="./diff" +run "$DIFF_PATH" "$DIR_PATH" # # Get the diff between the GNU and BSD outputs. Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Thu Jun 28 01:04:59 2012 (r238436) +++ soc2012/jhagewood/diff/hagewood-diff.patch Thu Jun 28 02:39:33 2012 (r238437) @@ -1,6 +1,6 @@ diff -rupN jhagewood/diff/diff-orig/diff.c jhagewood/diff/diff/diff.c ---- jhagewood/diff/diff-orig/diff.c 2012-06-25 12:05:52.000000000 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-27 16:35:04.000000000 -0400 +--- jhagewood/diff/diff-orig/diff.c 2012-06-28 02:16:56.000000000 -0400 ++++ jhagewood/diff/diff/diff.c 2012-06-28 02:16:56.000000000 -0400 @@ -1,4 +1,4 @@ -/*- +/* @@ -56,7 +56,7 @@ /* Options which exceed manageable alphanumeric assignments */ -@@ -69,75 +67,82 @@ enum +@@ -69,75 +67,82 @@ enum OPT_STRIPCR, OPT_NORMAL, OPT_LEFTC, @@ -477,7 +477,7 @@ break; } } -@@ -585,6 +673,7 @@ print_status(int val, char *path1, char +@@ -585,6 +673,7 @@ print_status(int val, char *path1, char void usage(void) { @@ -485,9 +485,25 @@ (void)fprintf(stderr, "usage: diff [-abdilpqTtw] [-I pattern] [-c | -e | -f | -n | -u]\n" " [-L label] file1 file2\n" +diff -rupN jhagewood/diff/diff-orig/diff.h jhagewood/diff/diff/diff.h +--- jhagewood/diff/diff-orig/diff.h 2012-06-28 02:16:56.000000000 -0400 ++++ jhagewood/diff/diff/diff.h 2012-06-28 02:16:56.000000000 -0400 +@@ -75,9 +75,9 @@ struct excludes { + struct excludes *next; + }; + +-extern int aflag, bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag, +- sflag, tflag, Tflag, wflag; +-extern int Bflag, strip_cr, tabsize; ++extern int aflag, bflag, cflag, dflag, Eflag, Fromflag, iflag, lflag, Nflag, Pflag, pflag, rflag, ++ sflag, tflag, Tflag, Toflag, wflag; ++extern int Bflag, strip_cr, suppress_cl, tabsize; + extern int format, context, status; + extern char ignore_file_case; + extern char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; diff -rupN jhagewood/diff/diff-orig/diffdir.c jhagewood/diff/diff/diffdir.c ---- jhagewood/diff/diff-orig/diffdir.c 2012-06-25 12:05:52.000000000 -0400 -+++ jhagewood/diff/diff/diffdir.c 2012-06-25 12:05:52.000000000 -0400 +--- jhagewood/diff/diff-orig/diffdir.c 2012-06-28 02:16:56.000000000 -0400 ++++ jhagewood/diff/diff/diffdir.c 2012-06-28 02:16:56.000000000 -0400 @@ -20,14 +20,13 @@ #include @@ -595,25 +611,9 @@ strlcpy(path1 + plen1, dp->d_name, MAXPATHLEN - plen1); if (stat(path1, &stb1) != 0) { -diff -rupN jhagewood/diff/diff-orig/diff.h jhagewood/diff/diff/diff.h ---- jhagewood/diff/diff-orig/diff.h 2012-06-25 12:05:52.000000000 -0400 -+++ jhagewood/diff/diff/diff.h 2012-06-26 00:19:54.000000000 -0400 -@@ -75,9 +75,9 @@ struct excludes { - struct excludes *next; - }; - --extern int aflag, bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag, -- sflag, tflag, Tflag, wflag; --extern int Bflag, strip_cr, tabsize; -+extern int aflag, bflag, cflag, dflag, Eflag, Fromflag, iflag, lflag, Nflag, Pflag, pflag, rflag, -+ sflag, tflag, Tflag, Toflag, wflag; -+extern int Bflag, strip_cr, suppress_cl, tabsize; - extern int format, context, status; - extern char ignore_file_case; - extern char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c ---- jhagewood/diff/diff-orig/diffreg.c 2012-06-25 17:19:12.000000000 -0400 -+++ jhagewood/diff/diff/diffreg.c 2012-06-27 14:31:58.000000000 -0400 +--- jhagewood/diff/diff-orig/diffreg.c 2012-06-28 02:16:56.000000000 -0400 ++++ jhagewood/diff/diff/diffreg.c 2012-06-28 02:16:56.000000000 -0400 @@ -62,15 +62,13 @@ * @(#)diffreg.c 8.1 (Berkeley) 6/6/93 */ @@ -677,7 +677,7 @@ anychange = 0; lastline = 0; -@@ -353,7 +357,6 @@ diffreg(char *ofile1, char *ofile2, int +@@ -353,7 +357,6 @@ diffreg(char *ofile1, char *ofile2, int status |= 2; goto closem; } @@ -685,7 +685,7 @@ switch (files_differ(f1, f2, flags)) { case 0: goto closem; -@@ -365,7 +368,7 @@ diffreg(char *ofile1, char *ofile2, int +@@ -365,7 +368,7 @@ diffreg(char *ofile1, char *ofile2, int goto closem; } @@ -1283,8 +1283,8 @@ + file2, buf2); } diff -rupN jhagewood/diff/diff-orig/pathnames.h jhagewood/diff/diff/pathnames.h ---- jhagewood/diff/diff-orig/pathnames.h 2012-06-25 12:05:52.000000000 -0400 -+++ jhagewood/diff/diff/pathnames.h 2012-06-26 00:51:36.000000000 -0400 +--- jhagewood/diff/diff-orig/pathnames.h 2012-06-28 02:16:56.000000000 -0400 ++++ jhagewood/diff/diff/pathnames.h 2012-06-28 02:16:56.000000000 -0400 @@ -23,4 +23,5 @@ #include Modified: soc2012/jhagewood/diff3/hagewood-diff3.patch ============================================================================== --- soc2012/jhagewood/diff3/hagewood-diff3.patch Thu Jun 28 01:04:59 2012 (r238436) +++ soc2012/jhagewood/diff3/hagewood-diff3.patch Thu Jun 28 02:39:33 2012 (r238437) @@ -1,6 +1,17 @@ +diff -rupN jhagewood/diff3/diff3-orig/Makefile jhagewood/diff3/diff3/Makefile +--- jhagewood/diff3/diff3-orig/Makefile 2012-06-28 02:16:56.000000000 -0400 ++++ jhagewood/diff3/diff3/Makefile 2012-06-28 02:16:57.000000000 -0400 +@@ -6,6 +6,6 @@ BINDIR= /usr/libexec + + beforeinstall: + install ${INSTALL_COPY}c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ +- ${.CURDIR}/diff3.ksh ${DESTDIR}/usr/bin/diff3 ++ ${.CURDIR}/diff3.sh ${DESTDIR}/usr/bin/diff3 + + .include diff -rupN jhagewood/diff3/diff3-orig/diff3prog.c jhagewood/diff3/diff3/diff3prog.c ---- jhagewood/diff3/diff3-orig/diff3prog.c 2012-06-25 12:05:52.000000000 -0400 -+++ jhagewood/diff3/diff3/diff3prog.c 2012-06-25 12:05:52.000000000 -0400 +--- jhagewood/diff3/diff3-orig/diff3prog.c 2012-06-28 02:16:56.000000000 -0400 ++++ jhagewood/diff3/diff3/diff3prog.c 2012-06-28 02:16:57.000000000 -0400 @@ -64,19 +64,23 @@ * @(#)diff3.c 8.1 (Berkeley) 6/6/93 */ @@ -455,14 +466,3 @@ + fprintf(stderr, "usage: diff3 %s file1 file2 file3\n", OPTIONS); exit(EXIT_FAILURE); } -diff -rupN jhagewood/diff3/diff3-orig/Makefile jhagewood/diff3/diff3/Makefile ---- jhagewood/diff3/diff3-orig/Makefile 2012-06-25 12:05:52.000000000 -0400 -+++ jhagewood/diff3/diff3/Makefile 2012-06-25 12:05:52.000000000 -0400 -@@ -6,6 +6,6 @@ BINDIR= /usr/libexec - - beforeinstall: - install ${INSTALL_COPY}c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ -- ${.CURDIR}/diff3.ksh ${DESTDIR}/usr/bin/diff3 -+ ${.CURDIR}/diff3.sh ${DESTDIR}/usr/bin/diff3 - - .include Modified: soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch ============================================================================== --- soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch Thu Jun 28 01:04:59 2012 (r238436) +++ soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch Thu Jun 28 02:39:33 2012 (r238437) @@ -1,6 +1,6 @@ diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man.h jhagewood/mdocml/mdocml-1.12.1/man.h ---- jhagewood/mdocml/mdocml-1.12.1-orig/man.h 2012-06-25 12:05:56.000000000 -0400 -+++ jhagewood/mdocml/mdocml-1.12.1/man.h 2012-06-25 12:05:58.000000000 -0400 +--- jhagewood/mdocml/mdocml-1.12.1-orig/man.h 2012-06-28 02:16:57.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man.h 2012-06-28 02:16:58.000000000 -0400 @@ -43,6 +43,8 @@ enum mant { MAN_sp, MAN_nf, @@ -12,7 +12,7 @@ MAN_DT, diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man.h.orig jhagewood/mdocml/mdocml-1.12.1/man.h.orig --- jhagewood/mdocml/mdocml-1.12.1-orig/man.h.orig 1969-12-31 19:00:00.000000000 -0500 -+++ jhagewood/mdocml/mdocml-1.12.1/man.h.orig 2012-06-25 12:05:58.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man.h.orig 2012-06-28 02:16:58.000000000 -0400 @@ -0,0 +1,113 @@ +/* $Id: man.h,v 1.60 2012/01/03 15:16:24 kristaps Exp $ */ +/* @@ -128,8 +128,8 @@ + +#endif /*!MAN_H*/ diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c jhagewood/mdocml/mdocml-1.12.1/man_term.c ---- jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c 2012-06-25 12:05:56.000000000 -0400 -+++ jhagewood/mdocml/mdocml-1.12.1/man_term.c 2012-06-25 12:05:58.000000000 -0400 +--- jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c 2012-06-28 02:16:57.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man_term.c 2012-06-28 02:16:58.000000000 -0400 @@ -82,6 +82,8 @@ static int pre_alternate(DECL_ARGS); static int pre_ft(DECL_ARGS); static int pre_ign(DECL_ARGS); @@ -173,7 +173,7 @@ static int diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c.orig jhagewood/mdocml/mdocml-1.12.1/man_term.c.orig --- jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c.orig 1969-12-31 19:00:00.000000000 -0500 -+++ jhagewood/mdocml/mdocml-1.12.1/man_term.c.orig 2012-06-25 12:05:58.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man_term.c.orig 2012-06-28 02:16:58.000000000 -0400 @@ -0,0 +1,1117 @@ +/* $Id: man_term.c,v 1.127 2012/01/03 15:16:24 kristaps Exp $ */ +/* From owner-svn-soc-all@FreeBSD.ORG Thu Jun 28 02:48:00 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 9AA98106566B for ; Thu, 28 Jun 2012 02:47:58 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 28 Jun 2012 02:47:58 +0000 Date: Thu, 28 Jun 2012 02:47:58 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120628024758.9AA98106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238438 - soc2012/jhagewood/diff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 02:48:00 -0000 Author: jhagewood Date: Thu Jun 28 02:47:58 2012 New Revision: 238438 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238438 Log: Modified: soc2012/jhagewood/diff/TODO soc2012/jhagewood/diff/diff-test.sh Modified: soc2012/jhagewood/diff/TODO ============================================================================== --- soc2012/jhagewood/diff/TODO Thu Jun 28 02:39:33 2012 (r238437) +++ soc2012/jhagewood/diff/TODO Thu Jun 28 02:47:58 2012 (r238438) @@ -30,6 +30,7 @@ of the file to see if it is ELF format. If so, the file is considered a text file. - With some files, modification times displayed in the timestamp for file1 are different than the time outputted by GNU diff. - The -ignore-*-* options need some work. +- BSD diff can only use one long option as an argument. - line formats: Modified: soc2012/jhagewood/diff/diff-test.sh ============================================================================== --- soc2012/jhagewood/diff/diff-test.sh Thu Jun 28 02:39:33 2012 (r238437) +++ soc2012/jhagewood/diff/diff-test.sh Thu Jun 28 02:47:58 2012 (r238438) @@ -75,6 +75,11 @@ # --left-column $1 -y --left-column 1.txt 2.txt >> $2/lc.txt $1 --side-by-side --left-column 1.txt 2.txt >> $2/lc.txt + + # --suppress-common-lines + $1 -y --suppress-common-lines 1.txt 2.txt >> $2/scl.txt + $1 --side-by-side --suppress-common-lines 1.txt 2.txt >> $2/scl.txt + # --line-format $1 --line-format="%l %% %c'T'" 1.txt 2.txt >> $2/lf.txt From owner-svn-soc-all@FreeBSD.ORG Thu Jun 28 02:53:22 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id C89DA10657A7 for ; Thu, 28 Jun 2012 02:53:19 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 28 Jun 2012 02:53:19 +0000 Date: Thu, 28 Jun 2012 02:53:19 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120628025319.C89DA10657A7@hub.freebsd.org> Cc: Subject: socsvn commit: r238439 - in soc2012/jhagewood/diff: . diff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 02:53:22 -0000 Author: jhagewood Date: Thu Jun 28 02:53:19 2012 New Revision: 238439 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238439 Log: Modified: soc2012/jhagewood/diff/diff-test.sh soc2012/jhagewood/diff/diff/diff.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/diff-test.sh ============================================================================== --- soc2012/jhagewood/diff/diff-test.sh Thu Jun 28 02:47:58 2012 (r238438) +++ soc2012/jhagewood/diff/diff-test.sh Thu Jun 28 02:53:19 2012 (r238439) @@ -80,7 +80,6 @@ $1 -y --suppress-common-lines 1.txt 2.txt >> $2/scl.txt $1 --side-by-side --suppress-common-lines 1.txt 2.txt >> $2/scl.txt - # --line-format $1 --line-format="%l %% %c'T'" 1.txt 2.txt >> $2/lf.txt Modified: soc2012/jhagewood/diff/diff/diff.c ============================================================================== --- soc2012/jhagewood/diff/diff/diff.c Thu Jun 28 02:47:58 2012 (r238438) +++ soc2012/jhagewood/diff/diff/diff.c Thu Jun 28 02:53:19 2012 (r238439) @@ -93,7 +93,7 @@ */ { "brief", no_argument, NULL, 'q' }, - { "changed-group-format", required_Argument, NULL, OPT_CHGD_GF}, + { "changed-group-format", required_argument, NULL, OPT_CHGD_GF}, { "context", optional_argument, NULL, 'C' }, { "ed", no_argument, NULL, 'e' }, { "exclude", required_argument, NULL, 'x' }, @@ -122,7 +122,7 @@ { "no-ignore-file-name-case", no_argument, NULL, OPT_NIGN_FN_CASE }, { "normal", no_argument, NULL, OPT_NORMAL }, { "old-line-format", required_argument, NULL, OPT_OLD_LF}, - { "old-group-format", required_argument, NULL OPT_OLD_GF}, + { "old-group-format", required_argument, NULL, OPT_OLD_GF}, { "paginate", no_argument, NULL, 'l' }, { "recursive", no_argument, NULL, 'r' }, { "report-identical-files", no_argument, NULL, 's' }, @@ -419,7 +419,8 @@ } if (yflag) { /* remove y flag from args and call sdiff */ - for (argv = oargv; argv && strcmp(*argv, "-y") != 0; argv++); + for (argv = oargv; argv && strcmp(*argv, "-y") != 0 && + strcmp(*argv, "--side-by-side") != 0; argv++); while(argv != &oargv[oargc]){ *argv= *(argv+1); argv++; Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Thu Jun 28 02:47:58 2012 (r238438) +++ soc2012/jhagewood/diff/hagewood-diff.patch Thu Jun 28 02:53:19 2012 (r238439) @@ -1,6 +1,6 @@ diff -rupN jhagewood/diff/diff-orig/diff.c jhagewood/diff/diff/diff.c --- jhagewood/diff/diff-orig/diff.c 2012-06-28 02:16:56.000000000 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-28 02:16:56.000000000 -0400 ++++ jhagewood/diff/diff/diff.c 2012-06-28 02:52:20.000000000 -0400 @@ -1,4 +1,4 @@ -/*- +/* @@ -111,7 +111,7 @@ + */ + + { "brief", no_argument, NULL, 'q' }, -+ { "changed-group-format", required_Argument, NULL, OPT_CHGD_GF}, ++ { "changed-group-format", required_argument, NULL, OPT_CHGD_GF}, { "context", optional_argument, NULL, 'C' }, - { "ifdef", required_argument, NULL, 'D' }, - { "minimal", no_argument, NULL, 'd' }, @@ -152,7 +152,7 @@ + { "no-ignore-file-name-case", no_argument, NULL, OPT_NIGN_FN_CASE }, + { "normal", no_argument, NULL, OPT_NORMAL }, + { "old-line-format", required_argument, NULL, OPT_OLD_LF}, -+ { "old-group-format", required_argument, NULL OPT_OLD_GF}, ++ { "old-group-format", required_argument, NULL, OPT_OLD_GF}, + { "paginate", no_argument, NULL, 'l' }, { "recursive", no_argument, NULL, 'r' }, - { "starting-file", required_argument, NULL, 'S' }, @@ -283,7 +283,7 @@ case OPT_STRIPCR: strip_cr=1; break; -@@ -328,20 +375,57 @@ main(int argc, char **argv) +@@ -328,20 +375,58 @@ main(int argc, char **argv) lastch = ch; newarg = optind != prevoptind; prevoptind = optind; @@ -334,7 +334,8 @@ + if (yflag) { /* remove y flag from args and call sdiff */ - for(argv=oargv; argv && strcmp(*argv, "-y") != 0; argv++); -+ for (argv = oargv; argv && strcmp(*argv, "-y") != 0; argv++); ++ for (argv = oargv; argv && strcmp(*argv, "-y") != 0 && ++ strcmp(*argv, "--side-by-side") != 0; argv++); while(argv != &oargv[oargc]){ - *argv=*(argv+1); + *argv= *(argv+1); @@ -346,7 +347,7 @@ execv(_PATH_SDIFF, oargv); _exit(127); } -@@ -380,7 +464,10 @@ main(int argc, char **argv) +@@ -380,7 +465,10 @@ main(int argc, char **argv) set_argstr(oargv, argv); if (S_ISDIR(stb1.st_mode) && S_ISDIR(stb2.st_mode)) { if (format == D_IFDEF) @@ -358,7 +359,7 @@ diffdir(argv[0], argv[1]); } else { if (S_ISDIR(stb1.st_mode)) { -@@ -402,11 +489,10 @@ main(int argc, char **argv) +@@ -402,11 +490,10 @@ main(int argc, char **argv) void * emalloc(size_t n) { @@ -371,7 +372,7 @@ if ((p = malloc(n)) == NULL) errx(2, NULL); return (p); -@@ -415,7 +501,7 @@ emalloc(size_t n) +@@ -415,7 +502,7 @@ emalloc(size_t n) void * erealloc(void *p, size_t n) { @@ -380,7 +381,7 @@ if (n == 0) errx(2, NULL); -@@ -431,13 +517,12 @@ erealloc(void *p, size_t n) +@@ -431,13 +518,12 @@ erealloc(void *p, size_t n) int easprintf(char **ret, const char *fmt, ...) { @@ -396,7 +397,7 @@ if (len < 0 || *ret == NULL) errx(2, NULL); return (len); -@@ -446,11 +531,12 @@ easprintf(char **ret, const char *fmt, . +@@ -446,11 +532,12 @@ easprintf(char **ret, const char *fmt, . char * estrdup(const char *str) { @@ -411,7 +412,7 @@ strlcpy(cp, str, len); return (cp); } -@@ -531,6 +617,7 @@ push_ignore_pats(char *pattern) +@@ -531,6 +618,7 @@ push_ignore_pats(char *pattern) void print_only(const char *path, size_t dirlen, const char *entry) { @@ -419,7 +420,7 @@ if (dirlen > 1) dirlen--; printf("Only in %.*s: %s\n", (int)dirlen, path, entry); -@@ -539,45 +626,46 @@ print_only(const char *path, size_t dirl +@@ -539,45 +627,46 @@ print_only(const char *path, size_t dirl void print_status(int val, char *path1, char *path2, char *entry) { @@ -477,7 +478,7 @@ break; } } -@@ -585,6 +673,7 @@ print_status(int val, char *path1, char +@@ -585,6 +674,7 @@ print_status(int val, char *path1, char void usage(void) { From owner-svn-soc-all@FreeBSD.ORG Thu Jun 28 02:59:17 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 6D91C106564A for ; Thu, 28 Jun 2012 02:59:15 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 28 Jun 2012 02:59:15 +0000 Date: Thu, 28 Jun 2012 02:59:15 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120628025915.6D91C106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238440 - soc2012/jhagewood/diff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 02:59:17 -0000 Author: jhagewood Date: Thu Jun 28 02:59:14 2012 New Revision: 238440 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238440 Log: Modified: soc2012/jhagewood/diff/TODO Modified: soc2012/jhagewood/diff/TODO ============================================================================== --- soc2012/jhagewood/diff/TODO Thu Jun 28 02:53:19 2012 (r238439) +++ soc2012/jhagewood/diff/TODO Thu Jun 28 02:59:14 2012 (r238440) @@ -30,7 +30,8 @@ of the file to see if it is ELF format. If so, the file is considered a text file. - With some files, modification times displayed in the timestamp for file1 are different than the time outputted by GNU diff. - The -ignore-*-* options need some work. -- BSD diff can only use one long option as an argument. +- BUG: BSD diff seg faults when another longopt is used with '--side-by-side'. FIX: When passing args to sdiff for side-by-side mode, only the + short option '-y' was excluded. Added '--side-by-side' as an exception also. - line formats: From owner-svn-soc-all@FreeBSD.ORG Thu Jun 28 09:26:39 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 85324106564A for ; Thu, 28 Jun 2012 09:26:37 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 28 Jun 2012 09:26:37 +0000 Date: Thu, 28 Jun 2012 09:26:37 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120628092637.85324106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238459 - soc2012/oleksandr/udf-head/sys/fs/udf2 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 09:26:39 -0000 Author: oleksandr Date: Thu Jun 28 09:26:36 2012 New Revision: 238459 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238459 Log: change location of determine type operation in udf_strategy, fix value of di->last_posssible_lba, clean temporary blks in udf_read_phys_sectors and change style of return operation Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_readwrite.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vnops.c Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_readwrite.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_readwrite.c Thu Jun 28 08:25:19 2012 (r238458) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_readwrite.c Thu Jun 28 09:26:36 2012 (r238459) @@ -335,10 +335,9 @@ /* off_t lblkno, rblkno; */ uint32_t sector_size, blks; /* buf_offset; */ struct vnode *devvp = ump->devvp; - uint32_t logical_secsize = 2048; sector_size = ump->sector_size; - blks = btodb(logical_secsize); + blks = btodb(sector_size); while (sectors > 0 && error == 0) { if ((error = bread(devvp, start*blks, sector_size, NOCRED, Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c Thu Jun 28 08:25:19 2012 (r238458) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c Thu Jun 28 09:26:36 2012 (r238459) @@ -198,7 +198,7 @@ di->disc_flags = MMC_DFLAGS_UNRESTRICTED; /* TODO problem with last_possible_lba on resizable VND; request */ - di->last_possible_lba = psize/sector_size; + di->last_possible_lba = psize/sector_size - 1; di->sector_size = sector_size; di->num_sessions = 1; @@ -751,14 +751,14 @@ } if ((size == 0) || (lb_size == 0)) - return 0; + return (0); if (lb_size == 1) - return size; + return (size); /* round up in sectors */ num_lb = (size + lb_size -1) / lb_size; - return num_lb * lb_size; + return (num_lb * lb_size); } @@ -1117,7 +1117,7 @@ if (le16toh(part->part_num) == raw_phys_part) break; } - return phys_part; + return (phys_part); } /* --------------------------------------------------------------------- */ @@ -1166,7 +1166,7 @@ if (phys_part == UDF_PARTITIONS) { free(dscr, M_UDFTEMP); - return EINVAL; + return (EINVAL); } UDF_UPDATE_DSCR(ump->partitions[phys_part], &dscr->pd); @@ -1181,7 +1181,7 @@ free(dscr, M_UDFTEMP); } - return 0; + return (0); } #undef UDF_UPDATE_DSCR @@ -1203,17 +1203,17 @@ if (error) { if (!dscr) free(dscr, M_UDFTEMP); - return error; + return (error); } /* blank block is a terminator */ if (dscr == NULL) - return 0; + return (0); /* TERM descriptor is a terminator */ if (le16toh(dscr->tag.id) == TAGID_TERM) { free(dscr, M_UDFTEMP); - return 0; + return (0); } /* process all others */ @@ -1230,7 +1230,7 @@ loc += dscr_size / sector_size; } - return error; + return (error); } @@ -1274,7 +1274,7 @@ error = udf_read_vds_extent(ump, reserve_loc, reserve_len); } - return error; + return (error); } /* --------------------------------------------------------------------- */ @@ -1983,19 +1983,19 @@ uint8_t *pmap_pos; if (ump == NULL) - return ENOENT; + return (ENOENT); /* we need at least an anchor (trivial, but for safety) */ if (ump->anchors[0] == NULL) - return EINVAL; + return (EINVAL); /* we need at least one primary and one logical volume descriptor */ if ((ump->primary_vol == NULL) || (ump->logical_vol) == NULL) - return EINVAL; + return (EINVAL); /* we need at least one partition descriptor */ if (ump->partitions[0] == NULL) - return EINVAL; + return (EINVAL); /* Check that character set is correct? @@ -2008,20 +2008,20 @@ /* check logical volume sector size verses device sector size */ if (le32toh(ump->logical_vol->lb_size) != ump->sector_size) { printf("UDF mount: format violation, lb_size != sector size\n"); - return EINVAL; + return (EINVAL); } /* check domain name */ domain_name = ump->logical_vol->domain_id.id; if (strncmp(domain_name, "*OSTA UDF Compliant", 20)) { printf("mount_udf: disc not OSTA UDF Compliant, aborting\n"); - return EINVAL; + return (EINVAL); } /* retrieve logical volume integrity sequence */ error = udf_retrieve_lvint(ump); if (error != 0) - return EINVAL; // previously it always returned this on error. + return (EINVAL); // previously it always returned this on error. /* * We need at least one logvol integrity descriptor recorded. Note @@ -2029,7 +2029,7 @@ * will close/update the integrity. */ if (ump->logvol_integrity == NULL) - return EINVAL; + return (EINVAL); /* process derived structures */ n_pm = le32toh(ump->logical_vol->n_pm); /* num partmaps */ @@ -2051,7 +2051,7 @@ if (n_pm > UDF_PMAPS) { printf("UDF mount: too many mappings\n"); - return EINVAL; + return (EINVAL); } /* count types and set partition numbers */ @@ -2106,7 +2106,7 @@ } break; default: - return EINVAL; + return (EINVAL); } /* @@ -2120,9 +2120,9 @@ raw_phys_part, phys_part, pmap_type)); if (phys_part == UDF_PARTITIONS) - return EINVAL; + return (EINVAL); if (pmap_type == UDF_VTOP_TYPE_UNKNOWN) - return EINVAL; + return (EINVAL); ump->vtop [log_part] = phys_part; ump->vtop_tp[log_part] = pmap_type; @@ -2134,14 +2134,14 @@ /* test some basic UDF assertions/requirements */ if ((n_virt > 1) || (n_spar > 1) || (n_meta > 1)) - return EINVAL; + return (EINVAL); if (n_virt) { if ((n_phys == 0) || n_spar || n_meta) - return EINVAL; + return (EINVAL); } if (n_spar + n_phys == 0) - return EINVAL; + return (EINVAL); /* select allocation type for each logical partition */ for (log_part = 0; log_part < n_pm; log_part++) { Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Thu Jun 28 08:25:19 2012 (r238458) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Thu Jun 28 09:26:36 2012 (r238459) @@ -567,14 +567,14 @@ */ } /* double check if we're not mounting a pervious session RW */ -//#if 0 + if (args->sessionnr != 0) { printf("UDF mount: updating a previous session " "not yet allowed\n"); error = EROFS; goto fail; } -//#endif + } #if 0 Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vnops.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vnops.c Thu Jun 28 08:25:19 2012 (r238458) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vnops.c Thu Jun 28 09:26:36 2012 (r238459) @@ -502,31 +502,31 @@ bp->b_error = error; bufdone(bp); return (error); - } - if (bp->b_iocmd & BIO_READ) { - if (lsector == UDF_TRANS_ZERO) { - /* copy sezo sector */ - memset(bp->b_data, 0, lb_size); - if ((bp->b_flags & B_ASYNC) == 0) - bufwait(bp); - /* pre-check if its an internal */ - } else if (lsector == UDF_TRANS_INTERN) { - error = udf_read_internal(udf_node, (uint8_t *) bp->b_data); - if (error) - bp->b_error = error; - bufdone(bp); - if ((bp->b_flags & B_ASYNC) == 0) - bufwait(bp); - } else { - /* bmap gives sector numbers. bio works with device blocks */ - bp->b_blkno = lsector * (udf_node->ump->sector_size/DEV_BSIZE); - } + } + } + if (bp->b_iocmd & BIO_READ) { + if (lsector == UDF_TRANS_ZERO) { + /* copy sezo sector */ + memset(bp->b_data, 0, lb_size); + if ((bp->b_flags & B_ASYNC) == 0) + bufwait(bp); + /* pre-check if its an internal */ + } else if (lsector == UDF_TRANS_INTERN) { + error = udf_read_internal(udf_node, (uint8_t *) bp->b_data); + if (error) + bp->b_error = error; + bufdone(bp); + if ((bp->b_flags & B_ASYNC) == 0) + bufwait(bp); } else { - return (ENOTSUP); + /* bmap gives sector numbers. bio works with device blocks */ + bp->b_blkno = lsector * (udf_node->ump->sector_size/DEV_BSIZE); + bp->b_iooffset = dbtob(bp->b_blkno); + BO_STRATEGY(bo, bp); } + } else { + return (ENOTSUP); } - bp->b_iooffset = dbtob(bp->b_blkno); - BO_STRATEGY(bo, bp); return (bp->b_error); } From owner-svn-soc-all@FreeBSD.ORG Thu Jun 28 10:28:05 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 23536106564A for ; Thu, 28 Jun 2012 10:28:03 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 28 Jun 2012 10:28:03 +0000 Date: Thu, 28 Jun 2012 10:28:03 +0000 From: scher@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120628102803.23536106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238461 - soc2012/scher/par_ports/head/Mk X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 10:28:05 -0000 Author: scher Date: Thu Jun 28 10:28:02 2012 New Revision: 238461 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238461 Log: [new_feature] Declarations of _parv_PORTS_LOGS_DIR and _parv_PORT_LOG_FILE vars [fixed/new_feature] _parv_CHECK_DIRS_SANITY - script to check existence of some directories. Reason: few lines of code in 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 Thu Jun 28 09:18:11 2012 (r238460) +++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Thu Jun 28 10:28:02 2012 (r238461) @@ -129,11 +129,10 @@ .endfor .endif #!{.TARGETS} +.if !defined(_parv_DEFAULT_PAR_BUILDS_NUM) _parv_DEFAULT_PAR_BUILDS_NUM!= ${SYSCTL} -n kern.smp.cpus -############### THIS ENTRY IS FOR DEBUGGING PURPOSE ############### -############### Custom number of parallel builds for debugging -_parv_DEFAULT_PAR_BUILDS_NUM= 3 -############### END OF PAR_PORTS SPECIFIC COMMENT LINE ############### +.endif + .if !defined(_parv_PARALLEL_BUILDS_NUMBER) || ${_parv_PARALLEL_BUILDS_NUMBER} > ${_parv_DEFAULT_PAR_BUILDS_NUM} _parv_PARALLEL_BUILDS_NUMBER= ${_parv_DEFAULT_PAR_BUILDS_NUM} .endif @@ -141,10 +140,14 @@ ##################################################### # Locking variables and tools -LOCK_DIR= /var/db/portlocks +# TODO: docs is needed +_parv_PORTS_LOGS_DIR?= /tmp/portslogs +LOCK_DIR?= /var/db/portslocks _parv_PKG_DBDIR_LOCK_FILE= .lock _parv_PORT_DBDIR_LOCK_FILE= .lock _parv_LOCK_DIR_LOCK_FILE= ${PKGNAME} +# TODO: docs is needed +_parv_PORT_LOG_FILE= ${PKGNAME} _parv_WAIT_FOR_LOCK_TIME?= 5 _parv_WAIT_FOR_UNLOCK_TIME?= 15 @@ -159,6 +162,20 @@ _parv_MAKE_LOCK_EXIT_STATUS= 158 +_parv_CHECK_DIRS_SANITY= \ + if [ ! -d ${LOCK_DIR} ]; then \ + ${_dparv_START_OUTPUT}; \ + ${ECHO_CMD} "Creating ports locks dir"; \ + ${_dparv_END_OUTPUT}; \ + ${MKDIR} ${LOCK_DIR}; \ + fi; \ + if [ ! -d ${_parv_PORTS_LOGS_DIR} ]; then \ + ${_dparv_START_OUTPUT}; \ + ${ECHO_CMD} "Creating ports logs dir"; \ + ${_dparv_END_OUTPUT}; \ + ${MKDIR} ${_parv_PORTS_LOGS_DIR}; \ + fi + .for _lock_dir in PKG_DBDIR PORT_DBDIR LOCK_DIR # ${${_lock_dir}} == ${PKG_DBDIR} OR ${LOCK_DIR} @@ -484,6 +501,8 @@ # Parallel targets section # TODO: outline intergation with bsd.port.mk # + +#TODO doc is needed .if !defined(INSTALLS_DEPENDS) check-license-depends: check-license-message @license_to_ask=""; \ @@ -514,6 +533,7 @@ check-license-message: @${ECHO_MSG} "===> Checking out licenses for ${PKGNAME} dependencies"; +#TODO doc is needed .if !defined(CONFIG_DONE_${UNIQUENAME:U}) && !defined(INSTALLS_DEPENDS) locking-config-recursive: locking-config-message lock-port-dbdir config-recursive unlock-port-dbdir .endif @@ -522,6 +542,7 @@ @${ECHO_MSG} "===> Setting user-specified options for ${PKGNAME} and dependencies"; # TODO: doc is needed +# TODO: shift to the beginning _parv_CHECKED_CONFIG_F_PREFIX= already-checked-config config-recursive: config-conditional Modified: soc2012/scher/par_ports/head/Mk/bsd.port.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.port.mk Thu Jun 28 09:18:11 2012 (r238460) +++ soc2012/scher/par_ports/head/Mk/bsd.port.mk Thu Jun 28 10:28:02 2012 (r238461) @@ -1559,12 +1559,7 @@ .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 + @${_parv_CHECK_DIRS_SANITY} . if ${_parv_IS_DEFAULT_TARGET} . if defined(INSTALLS_DEPENDS) @( ${_parv_LOCK_DIR_LOCK_LOOP} ) || { ${_parv_ON_LOCK_EXIT_SEQ}; } From owner-svn-soc-all@FreeBSD.ORG Thu Jun 28 11:07:39 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id DF9B11065675 for ; Thu, 28 Jun 2012 11:07:36 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 28 Jun 2012 11:07:36 +0000 Date: Thu, 28 Jun 2012 11:07:36 +0000 From: scher@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120628110736.DF9B11065675@hub.freebsd.org> Cc: Subject: socsvn commit: r238466 - soc2012/scher/par_ports/head/Mk X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 11:07:39 -0000 Author: scher Date: Thu Jun 28 11:07:36 2012 New Revision: 238466 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238466 Log: [user_feedback][new_feature] stdout and stderr streams of port's deps are redirected to special log files. [user_feedback] more clear output in ${_PROCESS_ACTIVE_BUILDS}(not final version) 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 Jun 28 10:40:57 2012 (r238465) +++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Thu Jun 28 11:07:36 2012 (r238466) @@ -147,7 +147,7 @@ _parv_PORT_DBDIR_LOCK_FILE= .lock _parv_LOCK_DIR_LOCK_FILE= ${PKGNAME} # TODO: docs is needed -_parv_PORT_LOG_FILE= ${PKGNAME} +_parv_PORT_LOG_FILE= $$(cd $$dir; ${MAKE} -V PKGNAME)-spawned-by-pid${.MAKE.PID}.log _parv_WAIT_FOR_LOCK_TIME?= 5 _parv_WAIT_FOR_UNLOCK_TIME?= 15 @@ -449,8 +449,11 @@ done; \ if { [ $${builds_num} -eq ${_parv_PARALLEL_BUILDS_NUMBER} ] || \ ( [ $${builds_num} -gt 0 ] && [ $${\#depends} -eq 0 ] ); }; then \ - if [ ${_parv_WANT_PARALLEL_BUILD} ]; then \ - echo "---- dependency output ----- : CAN'T SPAWN MORE DEPS! SLEEP... "; \ + echo "---- dependency output ----- : CAN'T SPAWN MORE DEPS! SLEEP... "; \ + if [ $${builds_num} -eq ${_parv_PARALLEL_BUILDS_NUMBER} ]; then \ + echo ${_parv_PARALLEL_BUILDS_NUMBER} is maximum number of parallel build; \ + else \ + echo No dependencies to spawn. All remaining dependencies are building; \ fi; \ sleep ${CHECK_ACTIVE_TIMEOUT}; \ fi; \ Modified: soc2012/scher/par_ports/head/Mk/bsd.port.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.port.mk Thu Jun 28 10:40:57 2012 (r238465) +++ soc2012/scher/par_ports/head/Mk/bsd.port.mk Thu Jun 28 11:07:36 2012 (r238466) @@ -5083,7 +5083,11 @@ fi; \ else \ if [ ${_parv_WANT_PARALLEL_BUILD} ]; then \ - (cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args ) & spawned=$$!; \ + log_file=${_parv_PORTS_LOGS_DIR}/${_parv_PORT_LOG_FILE}; \ + ( \ + cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args \ + > $${log_file} 2> $${log_file} \ + ) & spawned=$$!; \ else \ (cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args); \ spawned="yes"; \ @@ -5091,7 +5095,11 @@ fi; \ else \ if [ ${_parv_WANT_PARALLEL_BUILD} ]; then \ - (cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args ) & spawned=$$!; \ + log_file=${_parv_PORTS_LOGS_DIR}/${_parv_PORT_LOG_FILE}; \ + ( \ + cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args \ + > $${log_file} 2> $${log_file} \ + ) & spawned=$$!; \ else \ (cd $$dir; ${MAKE} -DINSTALLS_DEPENDS $$target $$depends_args); \ spawned="yes"; \ From owner-svn-soc-all@FreeBSD.ORG Thu Jun 28 12:04:20 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 827D4106567B for ; Thu, 28 Jun 2012 12:04:18 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 28 Jun 2012 12:04:18 +0000 Date: Thu, 28 Jun 2012 12:04:18 +0000 From: gmiller@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120628120418.827D4106567B@hub.freebsd.org> Cc: Subject: socsvn commit: r238470 - in soc2012/gmiller/locking-head: . lib/libwitness X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 12:04:20 -0000 Author: gmiller Date: Thu Jun 28 12:04:18 2012 New Revision: 238470 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238470 Log: r238358@FreeBSD-dev: root | 2012-06-19 22:26:14 -0500 * Add pthread_mutex_unlock() wrapper * Add calls to add_lock() and remove_lock() in the wrappers * Add temporary debugging code to make sure the wrapped functions are tracking the locks held by the current thread correctly. Modified: soc2012/gmiller/locking-head/ (props changed) soc2012/gmiller/locking-head/lib/libwitness/lists.c soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Modified: soc2012/gmiller/locking-head/lib/libwitness/lists.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/lists.c Thu Jun 28 11:58:10 2012 (r238469) +++ soc2012/gmiller/locking-head/lib/libwitness/lists.c Thu Jun 28 12:04:18 2012 (r238470) @@ -27,6 +27,7 @@ #include +#include #include #include "lists.h" @@ -34,6 +35,19 @@ _Thread_local SLIST_HEAD(lock_head, lock_entry) lock_head = SLIST_HEAD_INITIALIZER(lock_head); +// XXX: temporary debugging code +static void +dump_locks(void) { + struct lock_entry *entry; + int count = 1; + + SLIST_FOREACH(entry, &lock_head, lock_next) { + printf("[%d] %p\n", count++, entry->lock); + } + + puts(""); +} + void add_lock(void *lock) { @@ -43,6 +57,9 @@ entry->lock = lock; SLIST_INSERT_HEAD(&lock_head, entry, lock_next); + + printf("inserted lock %p\n", lock); + dump_locks(); } void @@ -58,4 +75,7 @@ break; } } + + printf("removed lock %p\n", lock); + dump_locks(); } Modified: soc2012/gmiller/locking-head/lib/libwitness/wrappers.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Thu Jun 28 11:58:10 2012 (r238469) +++ soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Thu Jun 28 12:04:18 2012 (r238470) @@ -25,12 +25,38 @@ * */ +#include + #include +#include + +#include "lists.h" int _pthread_mutex_lock(pthread_mutex_t *mutex); +int _pthread_mutex_unlock(pthread_mutex_t *mutex); int pthread_mutex_lock(pthread_mutex_t *mutex) { - return _pthread_mutex_lock(mutex); + int ret; + + puts("pthread_mutex_lock()"); + + ret = _pthread_mutex_lock(mutex); + add_lock(mutex); + + return ret; +} + +int +pthread_mutex_unlock(pthread_mutex_t *mutex) +{ + int ret; + + puts("pthread_mutex_unlock()"); + + ret = _pthread_mutex_unlock(mutex); + remove_lock(mutex); + + return ret; } From owner-svn-soc-all@FreeBSD.ORG Thu Jun 28 13:42:36 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 1A426106564A for ; Thu, 28 Jun 2012 13:42:34 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 28 Jun 2012 13:42:34 +0000 Date: Thu, 28 Jun 2012 13:42:34 +0000 From: scher@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120628134234.1A426106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238471 - soc2012/scher/par_ports/head/Mk X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 13:42:36 -0000 Author: scher Date: Thu Jun 28 13:42:33 2012 New Revision: 238471 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238471 Log: [user_feedback][new_feature] ${_parv_ON_LOCK_FEEDBACK_TIMEOUT} is intergated into ${_PROCESS_ACTIVE_BUILDS}. User is able to configure frequency of feedbacks. Redesign of user feedback in ${_PROCESS_ACTIVE_BUILDS} script. 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 Thu Jun 28 12:04:18 2012 (r238470) +++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Thu Jun 28 13:42:33 2012 (r238471) @@ -14,7 +14,7 @@ # matter what value is assigned. # Example: _parv_WANT_PARALLEL_BUILD=yes # -# CHECK_ACTIVE_TIMEOUT - timeout in seconds before next check of active +# _parv_CHECK_ACTIVE_TIMEOUT - timeout in seconds before next check of active # builds in case if port is prohibit to spawn # another background process. Consider that this # variable is also used in non-parallel build. @@ -153,9 +153,10 @@ _parv_WAIT_FOR_UNLOCK_TIME?= 15 _parv_LOCK_ATTEMPT_TIMEOUT?= 2 +# TODO: change docs _parv_ON_LOCK_FEEDBACK_TIMEOUT?= 2 -CHECK_ACTIVE_TIMEOUT?= 2 +_parv_CHECK_ACTIVE_TIMEOUT?= 2 _parv_ON_LOCK_EXIT_STATUS= 2 _parv_LOCKF_EX_TEMPFAIL= 75 @@ -390,17 +391,16 @@ # builds. If $${builds_num} < ${_parv_PARALLEL_BUILDS_NUMBER} # then another background dependency build will be # spawned, if there is any dependency to be spawned. -# Otherwise "sleep ${CHECK_ACTIVE_TIMEOUT}" will be called. +# Otherwise "sleep ${_parv_CHECK_ACTIVE_TIMEOUT}" will be called. # $${active_builds} - a list of "pid:path:dir[:target]" or "pid:lib:dir[:target]" # tuples of all currently being processed ports, # spawned by this make process. # _PROCESS_ACTIVE_BUILDS= \ - echo "---- dependency output ----- : --- ENTER _PROCESS_ACTIVE_BUILDS SECTION "; \ + enable_feedback=${_parv_ON_LOCK_FEEDBACK_TIMEOUT}; \ while true; do \ builds_num=$$( ${ECHO_CMD} $${active_builds} | wc -w ); \ if [ $${builds_num} -lt ${_parv_PARALLEL_BUILDS_NUMBER} ] && [ $${\#depends} -ne 0 ]; then \ - echo "---- dependency output ----- : WE CAN START ANOTHER PAR BUILD "; \ break; \ fi; \ if [ $${builds_num} -eq 0 ] && [ $${\#depends} -eq 0 ]; then \ @@ -413,12 +413,9 @@ ps -p $${pid} > /dev/null || { \ wait $${pid} && status=$$? || status=$$?; \ if [ $${status} -eq 0 ]; then \ - echo "---- dependency output ----- : SOME DEP IS INSTALLED ($${dep}) "; \ - echo "---- dependency output ----- : ACTIVE BUILDS WAS _$${active_builds}_ "; \ active_builds="$${active_builds%%$${build}*} $${active_builds\#\#*$${build}}"; \ active_builds=$$( echo "$${active_builds}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ builds_num=$$(( $${builds_num} - 1 )); \ - echo "---- dependency output ----- : ACTIVE BUILDS NOW _$${active_builds}_ "; \ if [ ${.TARGET} = "lib-depends" ]; then \ lib=$${dep%%:*}; \ pattern="`${ECHO_CMD} $$lib | ${SED} -E -e 's/\./\\\\./g' -e 's/(\\\\)?\+/\\\\+/g'`"; \ @@ -427,38 +424,43 @@ ${FALSE}; \ fi; \ fi; \ + ${ECHO_CMD} "=====> $$(cd $${build\#\#*:}; ${MAKE} -V PKGNAME) is installed"; \ elif [ $${status} -eq ${_parv_MAKE_LOCK_EXIT_STATUS} ]; then \ - echo "---- dependency output ----- : SOME DEP IS LOCKED ($${dep}) "; \ - echo "---- dependency output ----- : ACTIVE BUILDS WAS _$${active_builds}_ "; \ + ${ECHO_CMD} "===> $$(cd $${build\#\#*:}; ${MAKE} -V PKGNAME) is locked. Unable to start build."; \ active_builds="$${active_builds%%$${build}*} $${active_builds\#\#*$${build}}"; \ active_builds=$$( echo "$${active_builds}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ builds_num=$$(( $${builds_num} - 1 )); \ - echo "---- dependency output ----- : ACTIVE BUILDS NOW _$${active_builds}_ "; \ - echo "---- dependency output ----- : ADD IT BACK DO DEPENDS LIST "; \ - echo "---- dependency output ----- : DEPENDS WAS _$${depends}_ "; \ depends="$${depends} $${dep}"; \ depends=$$( echo "$${depends}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ - echo "---- dependency output ----- : DEPENDS NOW _$${depends}_ "; \ else \ - ${ECHO_CMD} "Errors occured while building a dependency (PID - $${pid}): $${dep}"; \ - ${ECHO_CMD} "Checkout it's log"; \ + ${ECHO_CMD} "Errors occured while building a dependency port $$(cd $${build\#\#*:}; ${MAKE} -V PKGNAME)"; \ + ${ECHO_CMD} "Checkout its log"; \ + ${ECHO_CMD} " $$(dir=$${build\#\#*:}; ${ECHO_CMD} ${_parv_PORTS_LOGS_DIR}/${_parv_PORT_LOG_FILE})"; \ ${ECHO_CMD} "Terminating..."; \ - ${_TERMINATE_PROCESS_TREE}; \ + exit 1; \ fi; \ }; \ done; \ if { [ $${builds_num} -eq ${_parv_PARALLEL_BUILDS_NUMBER} ] || \ ( [ $${builds_num} -gt 0 ] && [ $${\#depends} -eq 0 ] ); }; then \ - echo "---- dependency output ----- : CAN'T SPAWN MORE DEPS! SLEEP... "; \ - if [ $${builds_num} -eq ${_parv_PARALLEL_BUILDS_NUMBER} ]; then \ - echo ${_parv_PARALLEL_BUILDS_NUMBER} is maximum number of parallel build; \ - else \ - echo No dependencies to spawn. All remaining dependencies are building; \ + if [ $$(( $${enable_feedback} % ${_parv_ON_LOCK_FEEDBACK_TIMEOUT} )) -eq 0 ]; then \ + ${ECHO_CMD} "===> Unable to start more dependency builds."; \ + if [ $${builds_num} -eq ${_parv_PARALLEL_BUILDS_NUMBER} ]; then \ + ${ECHO_CMD} " ${_parv_PARALLEL_BUILDS_NUMBER} is maximum number of parallel builds."; \ + else \ + ${ECHO_CMD} " No dependencies to spawn. All remaining dependencies are building now."; \ + fi; \ + ${ECHO_CMD} " Currently building dependency ports are"; \ + for build in $$( ${ECHO_CMD} "$${active_builds}" ); do \ + dir=$${build\#\#*:}; \ + ${ECHO_CMD} " $$(cd $${dir}; ${MAKE} -V PKGNAME)"; \ + done; \ + enable_feedback=0; \ fi; \ - sleep ${CHECK_ACTIVE_TIMEOUT}; \ + enable_feedback=$$(( $${enable_feedback} + 1 )); \ + sleep ${_parv_CHECK_ACTIVE_TIMEOUT}; \ fi; \ - done; \ - echo "---- dependency output ----- : --- LEAVE _PROCESS_ACTIVE_BUILDS SECTION " + done # # _TERMINATE_PROCESS_TREE - this script contains all magic, related to From owner-svn-soc-all@FreeBSD.ORG Thu Jun 28 15:31:44 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id B4450106564A for ; Thu, 28 Jun 2012 15:31:42 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 28 Jun 2012 15:31:42 +0000 Date: Thu, 28 Jun 2012 15:31:42 +0000 From: scher@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120628153142.B4450106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238480 - soc2012/scher/par_ports/head/Mk X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 15:31:44 -0000 Author: scher Date: Thu Jun 28 15:31:42 2012 New Revision: 238480 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238480 Log: [user_feedback] redesign of user feedback in XXX-depends targets 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 Jun 28 14:26:55 2012 (r238479) +++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Thu Jun 28 15:31:42 2012 (r238480) @@ -396,6 +396,13 @@ # tuples of all currently being processed ports, # spawned by this make process. # +_parv_PRINT_ACTIVE_BUILDS= \ + ${ECHO_CMD} " Currently building dependency ports are"; \ + for build in $$( ${ECHO_CMD} "$${active_builds}" ); do \ + dir=$${build\#\#*:}; \ + ${ECHO_CMD} " $$(cd $${dir}; ${MAKE} -V PKGNAME)"; \ + done + _PROCESS_ACTIVE_BUILDS= \ enable_feedback=${_parv_ON_LOCK_FEEDBACK_TIMEOUT}; \ while true; do \ @@ -450,11 +457,7 @@ else \ ${ECHO_CMD} " No dependencies to spawn. All remaining dependencies are building now."; \ fi; \ - ${ECHO_CMD} " Currently building dependency ports are"; \ - for build in $$( ${ECHO_CMD} "$${active_builds}" ); do \ - dir=$${build\#\#*:}; \ - ${ECHO_CMD} " $$(cd $${dir}; ${MAKE} -V PKGNAME)"; \ - done; \ + ${_parv_PRINT_ACTIVE_BUILDS}; \ enable_feedback=0; \ fi; \ enable_feedback=$$(( $${enable_feedback} + 1 )); \ Modified: soc2012/scher/par_ports/head/Mk/bsd.port.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.port.mk Thu Jun 28 14:26:55 2012 (r238479) +++ soc2012/scher/par_ports/head/Mk/bsd.port.mk Thu Jun 28 15:31:42 2012 (r238480) @@ -1511,6 +1511,7 @@ .endif _PROCESS_ACTIVE_BUILDS?= ${DO_NADA} +_parv_PRINT_ACTIVE_BUILDS?= ${DO_NADA} .if !target(lock-port-dbdir) lock-port-dbdir: @@ -5124,14 +5125,8 @@ depends=`${ECHO_CMD} "${${deptype}_DEPENDS}"`; \ depends=$$( echo "$${depends}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ active_builds=""; \ - echo "---- dependency output ----- : ----------START BUILDING DEPS---------- "; \ - echo "---- dependency output ----- : ALL DEPS - $${depends}"; \ while [ $${#depends} -ne 0 ]; do \ i=$${depends%% *}; \ - echo "---- dependency output ----- : ----- NEW STEP -----" ; \ - echo "---- dependency output ----- DEPS TO BUILD _$${depends}_" ; \ - echo "---- dependency output ----- ACTIVE BUILDS _$${active_builds}_" ; \ - echo "---- dependency output ----- CURRENT DEP $${i}" ; \ prog=$${i%%:*}; \ if [ -z "$$prog" ]; then \ ${ECHO_MSG} "Error: there is an empty port dependency in ${deptype}_DEPENDS."; \ @@ -5219,8 +5214,7 @@ ( cd $${dir}; ${MAKE} check-lock ) || { \ status=$$?; \ if [ $${status} -eq ${_parv_MAKE_LOCK_EXIT_STATUS} ]; then \ - echo "---- dependency output ----- : LOCKED $${i}" ; \ - ${ECHO_CMD} $${prog} may be installing now.; \ + ${ECHO_CMD} "===> $${prog} may be installing now"; \ notfound=${_parv_ON_LOCK_EXIT_STATUS}; \ else \ exit $${status}; \ @@ -5237,30 +5231,23 @@ else \ ${_INSTALL_DEPENDS} \ if [ $${spawned} ]; then \ - echo "---- dependency output ----- : SPAWNED PID $${spawned}"; \ active_builds="$${active_builds} $${spawned}:$${i}"; \ depends="$${depends%%$${i}*} $${depends##*$${i}}"; \ depends=$$( echo "$${depends}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ spawned=""; \ - echo "---- dependency output ----- : ADD TO ACTIVE BUILDS _$${active_builds}_" ; \ - echo "---- dependency output ----- : AFTER TRANSFER TO ACTIVE BUILDS _$${depends}_" ; \ + ${_parv_PRINT_ACTIVE_BUILDS}; \ fi; \ fi; \ elif [ $${notfound} -eq 0 ]; then \ depends="$${depends%%$${i}*} $${depends##*$${i}}"; \ depends=$$( echo "$${depends}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ - echo "---- dependency output ----- : AFTER FROM DEPS DELETE _$${depends}_" ; \ elif [ $${notfound} -eq ${_parv_ON_LOCK_EXIT_STATUS} ]; then \ if [ $$( ${ECHO_CMD} $${depends} | wc -w ) -gt 1 ]; then \ depends="$${depends#* } $${depends%% *}"; \ depends=$$( echo "$${depends}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ - echo "---- dependency output ----- : AFTER ROUND CHANGE $${depends}" ; \ fi; \ fi; \ ${_PROCESS_ACTIVE_BUILDS}; \ - echo "---- dependency output ----- : ----- END OF STEP -----" ; \ - echo "---- dependency output ----- DEPS TO BUILD _$${depends}_" ; \ - echo "---- dependency output ----- ACTIVE BUILDS _$${active_builds}_" ; \ done .endif .else @@ -5276,14 +5263,8 @@ depends=`${ECHO_CMD} "${LIB_DEPENDS}"`; \ depends=$$( echo "$${depends}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ active_builds=""; \ - echo "---- dependency output ----- : ----------START BUILDING LIB DEPS---------- "; \ - echo "---- dependency output ----- : ALL DEPS - $${depends}"; \ while [ $${#depends} -ne 0 ]; do \ i=$${depends%% *}; \ - echo "---- dependency output ----- : ----- NEW STEP -----" ; \ - echo "---- dependency output ----- DEPS TO BUILD _$${depends}_" ; \ - echo "---- dependency output ----- ACTIVE BUILDS _$${active_builds}_" ; \ - echo "---- dependency output ----- CURRENT DEP $${i}" ; \ lib=$${i%%:*}; \ pattern="`${ECHO_CMD} $$lib | ${SED} -E -e 's/\./\\\\./g' -e 's/(\\\\)?\+/\\\\+/g'`"\ dir=$${i#*:}; \ @@ -5314,8 +5295,7 @@ ( cd $${dir}; ${MAKE} check-lock ) || { \ status=$$?; \ if [ $${status} -eq ${_parv_MAKE_LOCK_EXIT_STATUS} ]; then \ - echo "---- dependency output ----- : LOCKED $${i}" ; \ - ${ECHO_CMD} $${lib} may be installing now.; \ + ${ECHO_CMD} "===> $${lib} may be installing now"; \ notfound=${_parv_ON_LOCK_EXIT_STATUS}; \ else \ exit $${status}; \ @@ -5338,30 +5318,23 @@ fi; \ fi; \ if [ $${spawned} ]; then \ - echo "---- dependency output ----- : SPAWNED PID $${spawned}"; \ active_builds="$${active_builds} $${spawned}:$${i}"; \ depends="$${depends%%$${i}*} $${depends##*$${i}}"; \ depends=$$( echo "$${depends}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ spawned=""; \ - echo "---- dependency output ----- : ADD TO ACTIVE BUILDS _$${active_builds}_" ; \ - echo "---- dependency output ----- : AFTER TRANSFER TO ACTIVE BUILDS _$${depends}_" ; \ + ${_parv_PRINT_ACTIVE_BUILDS}; \ fi; \ fi; \ elif [ $${notfound} -eq 0 ]; then \ depends="$${depends%%$${i}*} $${depends##*$${i}}"; \ depends=$$( echo "$${depends}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ - echo "---- dependency output ----- : AFTER FROM DEPS DELETE _$${depends}_" ; \ elif [ $${notfound} -eq ${_parv_ON_LOCK_EXIT_STATUS} ]; then \ if [ $$( ${ECHO_CMD} $${depends} | wc -w ) -gt 1 ]; then \ depends="$${depends#* } $${depends%% *}"; \ depends=$$( echo "$${depends}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ - echo "---- dependency output ----- : AFTER ROUND CHANGE $${depends}" ; \ fi; \ fi; \ ${_PROCESS_ACTIVE_BUILDS}; \ - echo "---- dependency output ----- : ----- END OF STEP -----" ; \ - echo "---- dependency output ----- DEPS TO BUILD _$${depends}_" ; \ - echo "---- dependency output ----- ACTIVE BUILDS _$${active_builds}_" ; \ done .endif From owner-svn-soc-all@FreeBSD.ORG Thu Jun 28 16:57:05 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 991941065676 for ; Thu, 28 Jun 2012 16:57:03 +0000 (UTC) (envelope-from tzabal@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 28 Jun 2012 16:57:03 +0000 Date: Thu, 28 Jun 2012 16:57:03 +0000 From: tzabal@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120628165703.991941065676@hub.freebsd.org> Cc: Subject: socsvn commit: r238482 - in soc2012/tzabal: client-side/akcrs-head/usr.sbin/crashreport server-side/akcrs-release/9.0.0/etc/rc.d server-side/akcrs-release/9.0.0/usr.sbin/crashreportd X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 16:57:05 -0000 Author: tzabal Date: Thu Jun 28 16:57:02 2012 New Revision: 238482 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238482 Log: crashreport can form a XML report for minidumps and full memory dumps (vmcore) - textdump is remaining. Updated code for not writing same parts of code for every command that we need to execute. Added: soc2012/tzabal/server-side/akcrs-release/9.0.0/usr.sbin/crashreportd/crashreportd.py (contents, props changed) Deleted: soc2012/tzabal/server-side/akcrs-release/9.0.0/usr.sbin/crashreportd/crashreportd.php Modified: soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh soc2012/tzabal/server-side/akcrs-release/9.0.0/etc/rc.d/crashreportd soc2012/tzabal/server-side/akcrs-release/9.0.0/usr.sbin/crashreportd/Makefile Modified: soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh ============================================================================== --- soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh Thu Jun 28 15:38:14 2012 (r238481) +++ soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh Thu Jun 28 16:57:02 2012 (r238482) @@ -138,98 +138,52 @@ ## Form the report data=`mktemp /tmp/crashreport.XXXXXX` +tmp_file=`mktemp /tmp/crashreport.XXXXXX` +orig_IFS="${IFS}" +IFS=";" +commands1="date/3;hostname/5;ostype/6;osrelease/7;version/8;machine/9" +commands2="ps -axl;vmstat -s;vmstat -m;vmstat -z;vmstat -i;pstat -T;pstat -s;\ +iostat;ipcs -a;ipcs -T;nfsstat;netstat -s;netstat -m;netstat -id;netstat -anr;\ +netstat -anA;netstat -aL;fstat;dmesg;kernel config;ddb capture buffer" +start=3 echo "" > ${data} echo "" >> ${data} echo "
" >> ${data} -echo "" >> ${data} +echo "" >> ${data} output=`file "${_dumpdir}/${_file}"` -if [ "${output}" == "${_dumpdir}/${_file}: ASCII English text" ]; then - type='vmcore' -elif [ "${output}" == "${_dumpdir}/${_file}: POSIX tar archive" ]; then +if echo "${output}" | grep 'POSIX tar archive' > /dev/null; then type='textdump' +elif echo "${output}" | grep 'text' > /dev/null; then + type='vmcore' else error 'Unknown type of debugging information.' exit 1 fi - echo "${type}" >> ${data} echo "" >> ${data} + echo "" >> ${data} echo "${_email}" >> ${data} echo "" >> ${data} -echo "
" >> ${data} +echo "" >> ${data} echo "" >> ${data} -tmp_file=`mktemp /tmp/crashreport.XXXXXX` if [ "${type}" == 'vmcore' ]; then - # Date (date) - echo "" >> ${data} - echo "" >> ${data} - echo "date" >> ${data} - echo "" >> ${data} - echo "" >> ${data} - result=`sed -n '3p' "${_dumpdir}/${_file}"` - echo "${result}" >> ${data} - echo "" >> ${data} - echo "" >> ${data} - - # Hostname (hostname) - echo "" >> ${data} - echo "" >> ${data} - echo "hostname" >> ${data} - echo "" >> ${data} - echo "" >> ${data} - result=`sed -n '5p' "${_dumpdir}/${_file}"` - echo "${result}" >> ${data} - echo "" >> ${data} - echo "" >> ${data} - - # Operating System (ostype) - echo "" >> ${data} - echo "" >> ${data} - echo "ostype" >> ${data} - echo "" >> ${data} - echo "" >> ${data} - result=`sed -n '6p' "${_dumpdir}/${_file}"` - echo "${result}" >> ${data} - echo "" >> ${data} - echo "" >> ${data} - - # Operating System Release (osrelease) - echo "" >> ${data} - echo "" >> ${data} - echo "osrelease" >> ${data} - echo "" >> ${data} - echo "" >> ${data} - result=`sed -n '7p' "${_dumpdir}/${_file}"` - echo "${result}" >> ${data} - echo "" >> ${data} - echo "" >> ${data} - - # Version (version) - echo "" >> ${data} - echo "" >> ${data} - echo "version" >> ${data} - echo "" >> ${data} - echo "" >> ${data} - result=`sed -n '8p' "${_dumpdir}/${_file}"` - echo "${result}" >> ${data} - echo "" >> ${data} - echo "" >> ${data} - - # Architecture (machine) - echo "" >> ${data} - echo "" >> ${data} - echo "machine" >> ${data} - echo "" >> ${data} - echo "" >> ${data} - result=`sed -n '9p' "${_dumpdir}/${_file}"` - echo "${result}" >> ${data} - echo "" >> ${data} - echo "" >> ${data} + # For: date, hostname, ostype, osrelease, version, machine + for cmd in $commands1; do + echo "" >> ${data} + echo "" >> ${data} + echo "${cmd%/*}" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + result=`sed -n "${cmd##*/}p" "${_dumpdir}/${_file}"` + echo "${result}" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + done # Panic Message (panic) echo "" >> ${data} @@ -273,89 +227,30 @@ echo "" >> ${data} echo "" >> ${data} - # ps -axl - echo "" >> ${data} - echo "" >> ${data} - echo "ps -axl" >> ${data} - echo "" >> ${data} - echo "" >> ${data} - cat "${_dumpdir}/${_file}" | \ - sed -E -n '/^ps -axl$/,/-{20,}/p' > ${tmp_file} - lines=`wc -l < ${tmp_file}` - start=3 - end=$((lines-2)) - cat ${tmp_file} | sed -E -n "${start},${end}p" >> ${data} - echo "" >> ${data} - echo "" >> ${data} - - # vmstat -s - echo "" >> ${data} - echo "" >> ${data} - echo "vmstat -s" >> ${data} - echo "" >> ${data} - echo "" >> ${data} - cat "${_dumpdir}/${_file}" | \ - sed -E -n '/^vmstat -s$/,/-{20,}/p' > ${tmp_file} - lines=`wc -l < ${tmp_file}` - start=3 - end=$((lines-2)) - cat ${tmp_file} | sed -E -n "${start},${end}p" >> ${data} - echo "" >> ${data} - echo "" >> ${data} - - # vmstat -m - echo "" >> ${data} - echo "" >> ${data} - echo "vmstat -m" >> ${data} - echo "" >> ${data} - echo "" >> ${data} - cat "${_dumpdir}/${_file}" | \ - sed -E -n '/^vmstat -m$/,/-{20,}/p' > ${tmp_file} - lines=`wc -l < ${tmp_file}` - start=3 - end=$((lines-2)) - cat ${tmp_file} | sed -E -n "${start},${end}p" >> ${data} - echo "" >> ${data} - echo "" >> ${data} - - # vmstat -z - - # vmstat -i - - # pstat -T - - # pstat -s - - # iostat - - # ipcs -a - - # ipcs -T - - # nfsstat - - # netstat -s - - # netstat -m - - # netstat -id - - # netstat -anr - - # netstat -anA - - # netstat -aL - - # fstat - - # dmesg - - # kernel config + # From ps -axl until END + for cmd in $commands2; do + echo "" >> ${data} + echo "" >> ${data} + echo "${cmd}" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + cat "${_dumpdir}/${_file}" | \ + sed -E -n "/^${cmd}$/,/-{20,}/p" > ${tmp_file} + lines=`wc -l < ${tmp_file}` + end=$((lines-2)) + cat ${tmp_file} | sed -E -n "${start},${end}p" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + done +else + # Code for textdump.... + +fi - # ddb capture buffer +IFS="${orig_IFS}" - echo "" >> ${data} - echo "
" >> ${data} +echo "" >> ${data} +echo "" >> ${data} ## Bundle the report Modified: soc2012/tzabal/server-side/akcrs-release/9.0.0/etc/rc.d/crashreportd ============================================================================== --- soc2012/tzabal/server-side/akcrs-release/9.0.0/etc/rc.d/crashreportd Thu Jun 28 15:38:14 2012 (r238481) +++ soc2012/tzabal/server-side/akcrs-release/9.0.0/etc/rc.d/crashreportd Thu Jun 28 16:57:02 2012 (r238482) @@ -9,7 +9,7 @@ name="crashreportd" rcvar="crashreportd_enable" command="/usr/sbin/${name}" -command_interpreter="/usr/local/bin/php" +command_interpreter="/usr/local/bin/python" command_args="0<&- 1>/dev/null 2>&1 &" pidfile="/var/run/${name}.pid" Modified: soc2012/tzabal/server-side/akcrs-release/9.0.0/usr.sbin/crashreportd/Makefile ============================================================================== --- soc2012/tzabal/server-side/akcrs-release/9.0.0/usr.sbin/crashreportd/Makefile Thu Jun 28 15:38:14 2012 (r238481) +++ soc2012/tzabal/server-side/akcrs-release/9.0.0/usr.sbin/crashreportd/Makefile Thu Jun 28 16:57:02 2012 (r238482) @@ -1,3 +1,3 @@ -SCRIPTS= crashreportd.php +SCRIPTS= crashreportd.py .include Added: soc2012/tzabal/server-side/akcrs-release/9.0.0/usr.sbin/crashreportd/crashreportd.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ soc2012/tzabal/server-side/akcrs-release/9.0.0/usr.sbin/crashreportd/crashreportd.py Thu Jun 28 16:57:02 2012 (r238482) @@ -0,0 +1,47 @@ +#!/usr/bin/python + +import os +import time +import tarfile + +# Check if the given filename matches the pattern of a valid crash report +# Return 1 in failure and 0 in success +def check_filename(filename): + matchObj = re.match('^crashreport\.[A-Za-z0-9]{6}\.tar\.gz$', filename) + + if not matchObj: + return 1 + + return 0 + + +def extract_file(filename): + try: + report = crashreports_dir + "/" + filename + tarfileObj = tarfile.open(report) + except ReadError: + return 1 + + return 0 + + +def check_report(filename): + check_filename(filename) + + return 0; + +# Obtain the Process ID +pid = os.getpid() + +# Create the pid file and write the Process ID inside +#pid_file = '/var/run/crashreportd.pid' +pid_file = '/home/tzabal/crashreportd.pid' +f = open(pid_file, 'w') +f.write(str(pid)) +f.close() + +# The infinite loop of the daemon +crashreports_dir = '/home/tzabal/crashreports' +dirlist = os.listdir(crashreports_dir) +for filename in dirlist: + check_report(filename) From owner-svn-soc-all@FreeBSD.ORG Thu Jun 28 17:03:35 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 078491065672 for ; Thu, 28 Jun 2012 17:03:33 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 28 Jun 2012 17:03:33 +0000 Date: Thu, 28 Jun 2012 17:03:33 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120628170333.078491065672@hub.freebsd.org> Cc: Subject: socsvn commit: r238486 - in soc2012/jhagewood/diff: . diff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 17:03:35 -0000 Author: jhagewood Date: Thu Jun 28 17:03:32 2012 New Revision: 238486 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238486 Log: Modified: soc2012/jhagewood/diff/diff/diff.c soc2012/jhagewood/diff/diff/diff.h soc2012/jhagewood/diff/diff/diffreg.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/diff/diff.c ============================================================================== --- soc2012/jhagewood/diff/diff/diff.c Thu Jun 28 16:54:10 2012 (r238485) +++ soc2012/jhagewood/diff/diff/diff.c Thu Jun 28 17:03:32 2012 (r238486) @@ -49,7 +49,7 @@ int strip_cr, suppress_cl, tabsize = 8; char ignore_file_case = 0; int format, context, status; -char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; +char *start, *ifdefname, *diffargs, *label[2], *ignore_pats, *line_format, *group_format; struct stat stb1, stb2; struct excludes *excludes_list; regex_t ignore_re; @@ -323,16 +323,16 @@ case OPT_OLD_GF: case OPT_UNCHGD_GF: /* XXX To do: Coplete --GTYPE-group-format. */ - format = D_IFDEF; - ifdefname = optarg; + format = D_GF; + group_format = optarg; break; case OPT_NEW_LF: case OPT_OLD_LF: case OPT_UNCHGD_LF: case OPT_LF: /* XXX To do: Complete --line-format. */ - format = D_IFDEF; - ifdefname = optarg; + format = D_LF; + line_format = optarg; break; case OPT_NORMAL: format = D_NORMAL; Modified: soc2012/jhagewood/diff/diff/diff.h ============================================================================== --- soc2012/jhagewood/diff/diff/diff.h Thu Jun 28 16:54:10 2012 (r238485) +++ soc2012/jhagewood/diff/diff/diff.h Thu Jun 28 17:03:32 2012 (r238486) @@ -48,6 +48,8 @@ #define D_NREVERSE 5 /* Reverse ed script with numbered lines and no trailing . */ #define D_BRIEF 6 /* Say if the files differ */ +#define D_GF 7 /* Group format */ +#define D_LF 8 /* Line format */ /* * Output flags Modified: soc2012/jhagewood/diff/diff/diffreg.c ============================================================================== --- soc2012/jhagewood/diff/diff/diffreg.c Thu Jun 28 16:54:10 2012 (r238485) +++ soc2012/jhagewood/diff/diff/diffreg.c Thu Jun 28 17:03:32 2012 (r238486) @@ -1046,7 +1046,7 @@ err(1, "preadline"); if (nr > 0 && line[nr-1] == '\n') nr--; - line[nr] = '\0'; + line[nr] = '\3'; return (line); } @@ -1356,9 +1356,9 @@ if (aflag || f == NULL) return (1); rewind(f); - for (i = 0; i <= strlen(buf) || i <= 32; i++) - if (memchr(buf, '\0', strlen(buf)) != NULL) - return (0); + fread(buf, 1, BUFSIZ, f); + if (memchr(buf, '\0', BUFSIZ) != NULL) + return (0); return (1); } Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Thu Jun 28 16:54:10 2012 (r238485) +++ soc2012/jhagewood/diff/hagewood-diff.patch Thu Jun 28 17:03:32 2012 (r238486) @@ -1,6 +1,6 @@ diff -rupN jhagewood/diff/diff-orig/diff.c jhagewood/diff/diff/diff.c --- jhagewood/diff/diff-orig/diff.c 2012-06-28 02:16:56.000000000 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-28 02:52:20.000000000 -0400 ++++ jhagewood/diff/diff/diff.c 2012-06-28 14:21:49.000000000 -0400 @@ -1,4 +1,4 @@ -/*- +/* @@ -44,7 +44,7 @@ +int strip_cr, suppress_cl, tabsize = 8; +char ignore_file_case = 0; +int format, context, status; -+char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; ++char *start, *ifdefname, *diffargs, *label[2], *ignore_pats, *line_format, *group_format; struct stat stb1, stb2; struct excludes *excludes_list; regex_t ignore_re; @@ -243,16 +243,16 @@ + case OPT_OLD_GF: + case OPT_UNCHGD_GF: + /* XXX To do: Coplete --GTYPE-group-format. */ -+ format = D_IFDEF; -+ ifdefname = optarg; ++ format = D_GF; ++ group_format = optarg; + break; + case OPT_NEW_LF: + case OPT_OLD_LF: + case OPT_UNCHGD_LF: + case OPT_LF: + /* XXX To do: Complete --line-format. */ -+ format = D_IFDEF; -+ ifdefname = optarg; ++ format = D_LF; ++ line_format = optarg; + break; + case OPT_NORMAL: + format = D_NORMAL; @@ -488,8 +488,17 @@ " [-L label] file1 file2\n" diff -rupN jhagewood/diff/diff-orig/diff.h jhagewood/diff/diff/diff.h --- jhagewood/diff/diff-orig/diff.h 2012-06-28 02:16:56.000000000 -0400 -+++ jhagewood/diff/diff/diff.h 2012-06-28 02:16:56.000000000 -0400 -@@ -75,9 +75,9 @@ struct excludes { ++++ jhagewood/diff/diff/diff.h 2012-06-28 14:03:06.000000000 -0400 +@@ -48,6 +48,8 @@ + #define D_NREVERSE 5 /* Reverse ed script with numbered + lines and no trailing . */ + #define D_BRIEF 6 /* Say if the files differ */ ++#define D_GF 7 /* Group format */ ++#define D_LF 8 /* Line format */ + + /* + * Output flags +@@ -75,9 +77,9 @@ struct excludes { struct excludes *next; }; @@ -614,7 +623,7 @@ if (stat(path1, &stb1) != 0) { diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c --- jhagewood/diff/diff-orig/diffreg.c 2012-06-28 02:16:56.000000000 -0400 -+++ jhagewood/diff/diff/diffreg.c 2012-06-28 02:16:56.000000000 -0400 ++++ jhagewood/diff/diff/diffreg.c 2012-06-28 17:03:06.000000000 -0400 @@ -62,15 +62,13 @@ * @(#)diffreg.c 8.1 (Berkeley) 6/6/93 */ @@ -966,7 +975,7 @@ if (a < b) printf("%d,%d", a, b - a + 1); else if (a == b) -@@ -999,8 +1038,8 @@ uni_range(int a, int b) +@@ -999,22 +1038,22 @@ uni_range(int a, int b) static char * preadline(int fd, size_t len, off_t off) { @@ -977,7 +986,14 @@ line = emalloc(len + 1); if ((nr = pread(fd, line, len, off)) < 0) -@@ -1014,7 +1053,7 @@ preadline(int fd, size_t len, off_t off) + err(1, "preadline"); + if (nr > 0 && line[nr-1] == '\n') + nr--; +- line[nr] = '\0'; ++ line[nr] = '\3'; + return (line); + } + static int ignoreline(char *line) { @@ -1119,7 +1135,7 @@ sum = 1; space = 0; -@@ -1305,19 +1344,20 @@ readhash(FILE *f) +@@ -1305,20 +1344,21 @@ readhash(FILE *f) return (sum == 0 ? 1 : sum); } @@ -1142,11 +1158,13 @@ - cnt = fread(buf, 1, sizeof(buf), f); - for (i = 0; i < cnt; i++) - if (!isprint(buf[i]) && !isspace(buf[i])) -+ for (i = 0; i <= strlen(buf) || i <= 32; i++) -+ if (memchr(buf, '\0', strlen(buf)) != NULL) - return (0); +- return (0); ++ fread(buf, 1, BUFSIZ, f); ++ if (memchr(buf, '\0', BUFSIZ) != NULL) ++ return (0); return (1); } + @@ -1327,10 +1367,10 @@ asciifile(FILE *f) static char * match_function(const long *f, int pos, FILE *file) From owner-svn-soc-all@FreeBSD.ORG Thu Jun 28 18:16:42 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 0438D106564A for ; Thu, 28 Jun 2012 18:16:40 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 28 Jun 2012 18:16:40 +0000 Date: Thu, 28 Jun 2012 18:16:40 +0000 From: scher@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120628181640.0438D106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238488 - soc2012/scher/par_ports/head/Mk X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 18:16:42 -0000 Author: scher Date: Thu Jun 28 18:16:39 2012 New Revision: 238488 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238488 Log: [new_feature] Port does not goes into infinity non-sleeping loop if all deps are currently locked 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 Jun 28 17:15:16 2012 (r238487) +++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Thu Jun 28 18:16:39 2012 (r238488) @@ -465,6 +465,27 @@ fi; \ done +# TODO: docs needed +_parv_CHECK_ALL_DEPS_LOCKED= \ + if ! [ $${\#depends} -eq 0 ]; then \ + enable_feedback=${_parv_ON_LOCK_FEEDBACK_TIMEOUT}; \ + while true; do \ + for dep in $${depends}; do \ + dir=$${dep\#*:}; \ + { (cd $${dir}; ${MAKE} check-lock > /dev/null 2> /dev/null & wait $$! ) \ + && break 2 || continue; }; \ + done; \ + if [ $$(( $${enable_feedback} % ${_parv_ON_LOCK_FEEDBACK_TIMEOUT} )) -eq 0 ]; then \ + ${ECHO_CMD} "===> All dependencies are currently locked"; \ + ${ECHO_CMD} " Nothing to do"; \ + ${ECHO_CMD} " Waiting ..."; \ + enable_feedback=0; \ + fi; \ + enable_feedback=$$(( $${enable_feedback} + 1 )); \ + sleep ${_parv_CHECK_ACTIVE_TIMEOUT}; \ + done; \ + fi + # # _TERMINATE_PROCESS_TREE - this script contains all magic, related to # terminating of the whole process tree, starting Modified: soc2012/scher/par_ports/head/Mk/bsd.port.mk ============================================================================== --- soc2012/scher/par_ports/head/Mk/bsd.port.mk Thu Jun 28 17:15:16 2012 (r238487) +++ soc2012/scher/par_ports/head/Mk/bsd.port.mk Thu Jun 28 18:16:39 2012 (r238488) @@ -1512,6 +1512,7 @@ _PROCESS_ACTIVE_BUILDS?= ${DO_NADA} _parv_PRINT_ACTIVE_BUILDS?= ${DO_NADA} +_parv_CHECK_ALL_DEPS_LOCKED?= ${DO_NADA} .if !target(lock-port-dbdir) lock-port-dbdir: @@ -5247,6 +5248,7 @@ depends=$$( echo "$${depends}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ fi; \ fi; \ + ( ${_parv_CHECK_ALL_DEPS_LOCKED} ); \ ${_PROCESS_ACTIVE_BUILDS}; \ done .endif @@ -5334,6 +5336,7 @@ depends=$$( echo "$${depends}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ fi; \ fi; \ + ( ${_parv_CHECK_ALL_DEPS_LOCKED} ); \ ${_PROCESS_ACTIVE_BUILDS}; \ done .endif From owner-svn-soc-all@FreeBSD.ORG Thu Jun 28 19:06:18 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 82D7B1065673 for ; Thu, 28 Jun 2012 19:06:16 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 28 Jun 2012 19:06:16 +0000 Date: Thu, 28 Jun 2012 19:06:16 +0000 From: scher@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120628190616.82D7B1065673@hub.freebsd.org> Cc: Subject: socsvn commit: r238493 - soc2012/scher/par_ports/head/Mk X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 19:06:18 -0000 Author: scher Date: Thu Jun 28 19:06:16 2012 New Revision: 238493 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238493 Log: [bugfix] XXX_DEPENDS patterns are "path:dir[:target]" but ${_parv_PRINT_ACTIVE_BUILDS} ${_PROCESS_ACTIVE_BUILDS} ${_parv_CHECK_ALL_DEPS_LOCKED} did not consider "[:target] part. Now this scripts consider this part of pattern. 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 Thu Jun 28 18:52:40 2012 (r238492) +++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Thu Jun 28 19:06:16 2012 (r238493) @@ -399,7 +399,10 @@ _parv_PRINT_ACTIVE_BUILDS= \ ${ECHO_CMD} " Currently building dependency ports are"; \ for build in $$( ${ECHO_CMD} "$${active_builds}" ); do \ - dir=$${build\#\#*:}; \ + dep=$${build\#*:}; \ + dir=$${dep\#*:}; \ + target=$${dep\#\#*:}; \ + [ $$dir != $$target ] && dir=$${dir%%:*}; \ ${ECHO_CMD} " $$(cd $${dir}; ${MAKE} -V PKGNAME)"; \ done @@ -418,6 +421,9 @@ pid=$${build%%:*}; \ dep=$${build\#*:}; \ ps -p $${pid} > /dev/null || { \ + dir=$${dep\#*:}; \ + target=$${dep\#\#*:}; \ + [ $$dir != $$target ] && dir=$${dir%%:*}; \ wait $${pid} && status=$$? || status=$$?; \ if [ $${status} -eq 0 ]; then \ active_builds="$${active_builds%%$${build}*} $${active_builds\#\#*$${build}}"; \ @@ -431,18 +437,18 @@ ${FALSE}; \ fi; \ fi; \ - ${ECHO_CMD} "=====> $$(cd $${build\#\#*:}; ${MAKE} -V PKGNAME) is installed"; \ + ${ECHO_CMD} "=====> $$(cd $${dir}; ${MAKE} -V PKGNAME) is installed"; \ elif [ $${status} -eq ${_parv_MAKE_LOCK_EXIT_STATUS} ]; then \ - ${ECHO_CMD} "===> $$(cd $${build\#\#*:}; ${MAKE} -V PKGNAME) is locked. Unable to start build."; \ + ${ECHO_CMD} "===> $$(cd $${dir}; ${MAKE} -V PKGNAME) is locked. Unable to start build."; \ active_builds="$${active_builds%%$${build}*} $${active_builds\#\#*$${build}}"; \ active_builds=$$( echo "$${active_builds}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ builds_num=$$(( $${builds_num} - 1 )); \ depends="$${depends} $${dep}"; \ depends=$$( echo "$${depends}" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$$//' ); \ else \ - ${ECHO_CMD} "Errors occured while building a dependency port $$(cd $${build\#\#*:}; ${MAKE} -V PKGNAME)"; \ + ${ECHO_CMD} "Errors occured while building a dependency port $$(cd $${dir}; ${MAKE} -V PKGNAME"; \ ${ECHO_CMD} "Checkout its log"; \ - ${ECHO_CMD} " $$(dir=$${build\#\#*:}; ${ECHO_CMD} ${_parv_PORTS_LOGS_DIR}/${_parv_PORT_LOG_FILE})"; \ + ${ECHO_CMD} " ${_parv_PORTS_LOGS_DIR}/${_parv_PORT_LOG_FILE})"; \ ${ECHO_CMD} "Terminating..."; \ exit 1; \ fi; \ @@ -472,6 +478,8 @@ while true; do \ for dep in $${depends}; do \ dir=$${dep\#*:}; \ + target=$${dep\#\#*:}; \ + [ $$dir != $$target ] && dir=$${dir%%:*}; \ { (cd $${dir}; ${MAKE} check-lock > /dev/null 2> /dev/null & wait $$! ) \ && break 2 || continue; }; \ done; \ From owner-svn-soc-all@FreeBSD.ORG Thu Jun 28 19:57:57 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 480D8106564A for ; Thu, 28 Jun 2012 19:57:56 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 28 Jun 2012 19:57:56 +0000 Date: Thu, 28 Jun 2012 19:57:56 +0000 From: scher@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120628195756.480D8106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238494 - soc2012/scher/par_ports/head/Mk X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 19:57:57 -0000 Author: scher Date: Thu Jun 28 19:57:55 2012 New Revision: 238494 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238494 Log: [user_feedback] minor changes in make targets 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 Thu Jun 28 19:06:16 2012 (r238493) +++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Thu Jun 28 19:57:55 2012 (r238494) @@ -552,16 +552,16 @@ fi; \ done; \ if [ $${license_to_ask} ]; then \ - ${ECHO_CMD} "The following ports will ask for license conformation:"; \ + ${ECHO_CMD} " The following ports will ask for license conformation:"; \ for port in $${license_to_ask}; do \ - ${ECHO_CMD} " $${port}"; \ + ${ECHO_CMD} " $${port}"; \ done; \ - ${ECHO_CMD} "Unable to process in parallel way."; \ - ${ECHO_CMD} "Call:"; \ - ${ECHO_CMD} " make -D_parv_WANT_NON_PARALLEL_BUILD patch"; \ - ${ECHO_CMD} "in the following directories:"; \ + ${ECHO_CMD} " Unable to process in parallel way."; \ + ${ECHO_CMD} " Call:"; \ + ${ECHO_CMD} " make -D_parv_WANT_NON_PARALLEL_BUILD patch"; \ + ${ECHO_CMD} " in the following directories:"; \ for dir in $${dirs_to_process}; do \ - ${ECHO_CMD} " $${dir}"; \ + ${ECHO_CMD} " $${dir}"; \ done; \ exit 1; \ fi @@ -582,6 +582,7 @@ # TODO: shift to the beginning _parv_CHECKED_CONFIG_F_PREFIX= already-checked-config +# TODO: doc is needed config-recursive: config-conditional @if [ ! ${DEP_CHECK_CONFIG} ]; then \ already_checked_file=/tmp/${_parv_CHECKED_CONFIG_F_PREFIX}.${.MAKE.PID}; \ @@ -592,7 +593,7 @@ fi; \ for dir in $$(${MAKE} run-depends-list build-depends-list | uniq); do \ if [ ! $$(grep $${dir}$$ $${already_checked_file}) ]; then \ - ${ECHO_CMD} configure options for $${dir}; \ + ${ECHO_CMD} " configure options for $${dir}"; \ ( cd $${dir}; \ ${MAKE} "DEP_CHECK_CONFIG=$${already_checked_file}" config-recursive ); \ ${ECHO_CMD} $${dir} >> $${already_checked_file}; \ @@ -617,15 +618,13 @@ }; \ done; \ if [ -n "$${conflicts_with}" ]; then \ - ${_dparv_START_OUTPUT}; \ ${ECHO_MSG}; \ - ${ECHO_MSG} "===> ${PKGNAME} conflicts with currently installing package(s): "; \ + ${ECHO_MSG} "===> ${PKGNAME} conflicts with currently installing package(s): "; \ for entry in $${conflicts_with}; do \ - ${ECHO_MSG} " $${entry}"; \ + ${ECHO_MSG} " $${entry}"; \ done; \ ${ECHO_MSG}; \ - ${ECHO_MSG} " Please remove them first with pkg_delete(1)."; \ - ${_dparv_END_OUTPUT}; \ + ${ECHO_MSG} " Please remove them first with pkg_delete(1)."; \ exit 1; \ fi .endif From owner-svn-soc-all@FreeBSD.ORG Thu Jun 28 20:00:14 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 92E4D106567F for ; Thu, 28 Jun 2012 20:00:11 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 28 Jun 2012 20:00:11 +0000 Date: Thu, 28 Jun 2012 20:00:11 +0000 From: gmiller@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120628200013.92E4D106567F@hub.freebsd.org> Cc: Subject: socsvn commit: r238501 - in soc2012/gmiller/locking-head: . lib/libwitness X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 20:00:14 -0000 Author: gmiller Date: Thu Jun 28 20:00:11 2012 New Revision: 238501 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238501 Log: r238482@FreeBSD-dev: root | 2012-06-20 00:01:09 -0500 Cut back on debug output a bit and adjust indentation style. Modified: soc2012/gmiller/locking-head/ (props changed) soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Modified: soc2012/gmiller/locking-head/lib/libwitness/wrappers.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Thu Jun 28 19:55:46 2012 (r238500) +++ soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Thu Jun 28 20:00:11 2012 (r238501) @@ -38,25 +38,21 @@ int pthread_mutex_lock(pthread_mutex_t *mutex) { - int ret; + int ret; - puts("pthread_mutex_lock()"); + ret = _pthread_mutex_lock(mutex); + add_lock(mutex); - ret = _pthread_mutex_lock(mutex); - add_lock(mutex); - - return ret; + return ret; } int pthread_mutex_unlock(pthread_mutex_t *mutex) { - int ret; - - puts("pthread_mutex_unlock()"); + int ret; - ret = _pthread_mutex_unlock(mutex); - remove_lock(mutex); + ret = _pthread_mutex_unlock(mutex); + remove_lock(mutex); - return ret; + return ret; } From owner-svn-soc-all@FreeBSD.ORG Thu Jun 28 20:01:27 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id D55471065675 for ; Thu, 28 Jun 2012 20:01:25 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 28 Jun 2012 20:01:25 +0000 Date: Thu, 28 Jun 2012 20:01:25 +0000 From: gmiller@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120628200125.D55471065675@hub.freebsd.org> Cc: Subject: socsvn commit: r238502 - in soc2012/gmiller/locking-head: . lib/libwitness X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 20:01:28 -0000 Author: gmiller Date: Thu Jun 28 20:01:25 2012 New Revision: 238502 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238502 Log: r238483@FreeBSD-dev: root | 2012-06-20 00:39:33 -0500 Merge headers into witness.h and add a witness mutex to protect graph data structure. Added: soc2012/gmiller/locking-head/lib/libwitness/witness.h - copied, changed from r238347, soc2012/gmiller/locking-head/lib/libwitness/lists.h Deleted: soc2012/gmiller/locking-head/lib/libwitness/graph.h soc2012/gmiller/locking-head/lib/libwitness/lists.h Modified: soc2012/gmiller/locking-head/ (props changed) soc2012/gmiller/locking-head/lib/libwitness/graph.c soc2012/gmiller/locking-head/lib/libwitness/lists.c soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Modified: soc2012/gmiller/locking-head/lib/libwitness/graph.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/graph.c Thu Jun 28 20:00:11 2012 (r238501) +++ soc2012/gmiller/locking-head/lib/libwitness/graph.c Thu Jun 28 20:01:25 2012 (r238502) @@ -25,7 +25,9 @@ * */ -#include "graph.h" +#include "witness.h" + +struct graph_node *root = NULL; int insert_edge(struct graph_node *from, struct graph_node *to) Modified: soc2012/gmiller/locking-head/lib/libwitness/lists.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/lists.c Thu Jun 28 20:00:11 2012 (r238501) +++ soc2012/gmiller/locking-head/lib/libwitness/lists.c Thu Jun 28 20:01:25 2012 (r238502) @@ -25,12 +25,7 @@ * */ -#include - -#include -#include - -#include "lists.h" +#include "witness.h" _Thread_local SLIST_HEAD(lock_head, lock_entry) lock_head = SLIST_HEAD_INITIALIZER(lock_head); Copied and modified: soc2012/gmiller/locking-head/lib/libwitness/witness.h (from r238347, soc2012/gmiller/locking-head/lib/libwitness/lists.h) ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/lists.h Tue Jun 26 18:55:06 2012 (r238347, copy source) +++ soc2012/gmiller/locking-head/lib/libwitness/witness.h Thu Jun 28 20:01:25 2012 (r238502) @@ -25,10 +25,23 @@ * */ +#include + +#include +#include +#include + struct lock_entry { SLIST_ENTRY(lock_entry) lock_next; void *lock; }; +struct graph_node { +}; + +extern pthread_mutex_t witness_mtx; + void add_lock(void *lock); void remove_lock(void *lock); + +int insert_edge(struct graph_node *from, struct graph_node *to); Modified: soc2012/gmiller/locking-head/lib/libwitness/wrappers.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Thu Jun 28 20:00:11 2012 (r238501) +++ soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Thu Jun 28 20:01:25 2012 (r238502) @@ -25,23 +25,22 @@ * */ -#include - -#include -#include - -#include "lists.h" +#include "witness.h" int _pthread_mutex_lock(pthread_mutex_t *mutex); int _pthread_mutex_unlock(pthread_mutex_t *mutex); +pthread_mutex_t witness_mtx = PTHREAD_MUTEX_INITIALIZER; + int pthread_mutex_lock(pthread_mutex_t *mutex) { int ret; ret = _pthread_mutex_lock(mutex); - add_lock(mutex); + if (mutex != &witness_mtx) { + add_lock(mutex); + } return ret; } @@ -52,7 +51,9 @@ int ret; ret = _pthread_mutex_unlock(mutex); - remove_lock(mutex); + if (mutex != &witness_mtx) { + remove_lock(mutex); + } return ret; } From owner-svn-soc-all@FreeBSD.ORG Thu Jun 28 20:01:37 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 99D331065767 for ; Thu, 28 Jun 2012 20:01:36 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 28 Jun 2012 20:01:36 +0000 Date: Thu, 28 Jun 2012 20:01:36 +0000 From: gmiller@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120628200136.99D331065767@hub.freebsd.org> Cc: Subject: socsvn commit: r238503 - in soc2012/gmiller/locking-head: . lib/libwitness X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 20:01:37 -0000 Author: gmiller Date: Thu Jun 28 20:01:36 2012 New Revision: 238503 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238503 Log: r238484@FreeBSD-dev: root | 2012-06-20 04:24:28 -0500 Style fix for return values. Modified: soc2012/gmiller/locking-head/ (props changed) soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Modified: soc2012/gmiller/locking-head/lib/libwitness/wrappers.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Thu Jun 28 20:01:25 2012 (r238502) +++ soc2012/gmiller/locking-head/lib/libwitness/wrappers.c Thu Jun 28 20:01:36 2012 (r238503) @@ -42,7 +42,7 @@ add_lock(mutex); } - return ret; + return (ret); } int @@ -55,5 +55,5 @@ remove_lock(mutex); } - return ret; + return (ret); } From owner-svn-soc-all@FreeBSD.ORG Thu Jun 28 20:01:50 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 1A23C10657C8 for ; Thu, 28 Jun 2012 20:01:48 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 28 Jun 2012 20:01:48 +0000 Date: Thu, 28 Jun 2012 20:01:48 +0000 From: gmiller@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120628200148.1A23C10657C8@hub.freebsd.org> Cc: Subject: socsvn commit: r238504 - in soc2012/gmiller/locking-head: . lib/libwitness X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 20:01:50 -0000 Author: gmiller Date: Thu Jun 28 20:01:47 2012 New Revision: 238504 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238504 Log: r238485@FreeBSD-dev: root | 2012-06-20 04:25:19 -0500 Implement graph node lookup and graph traversal. Modified: soc2012/gmiller/locking-head/ (props changed) soc2012/gmiller/locking-head/lib/libwitness/graph.c soc2012/gmiller/locking-head/lib/libwitness/witness.h Modified: soc2012/gmiller/locking-head/lib/libwitness/graph.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/graph.c Thu Jun 28 20:01:36 2012 (r238503) +++ soc2012/gmiller/locking-head/lib/libwitness/graph.c Thu Jun 28 20:01:47 2012 (r238504) @@ -29,9 +29,56 @@ struct graph_node *root = NULL; +static struct graph_node * +scan_graph(struct graph_node *graph, void *lock) +{ + struct graph_node *ret; + struct graph_node *child; + + if (graph->lock == lock) { + return (graph); + } + + child = graph->child; + while (child != NULL) { + ret = scan_graph(child, lock); + if (ret != NULL) { + return (ret); + } + + child = child->sibling; + } + + return (NULL); +} + +static struct graph_node * +get_node(void *lock) +{ + if (root != NULL) { + return (scan_graph(root, lock)); + } + + return (NULL); +} + int insert_edge(struct graph_node *from, struct graph_node *to) { - from = from; to = to; - return 0; +#if 1 + // suppress warning + get_node(from->lock); +#endif + if (from == to) { + return (0); + } + + if (scan_graph(to, from->lock) != NULL) { + return (-1); + } + + /* XXX */ + + return (0); } + Modified: soc2012/gmiller/locking-head/lib/libwitness/witness.h ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/witness.h Thu Jun 28 20:01:36 2012 (r238503) +++ soc2012/gmiller/locking-head/lib/libwitness/witness.h Thu Jun 28 20:01:47 2012 (r238504) @@ -37,6 +37,9 @@ }; struct graph_node { + void *lock; + struct graph_node *child; + struct graph_node *sibling; }; extern pthread_mutex_t witness_mtx; From owner-svn-soc-all@FreeBSD.ORG Thu Jun 28 20:02:01 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 7AAE41065674 for ; Thu, 28 Jun 2012 20:01:59 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 28 Jun 2012 20:01:59 +0000 Date: Thu, 28 Jun 2012 20:01:59 +0000 From: gmiller@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120628200159.7AAE41065674@hub.freebsd.org> Cc: Subject: socsvn commit: r238505 - in soc2012/gmiller/locking-head: . lib/libwitness X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 20:02:01 -0000 Author: gmiller Date: Thu Jun 28 20:01:59 2012 New Revision: 238505 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238505 Log: r238486@FreeBSD-dev: root | 2012-06-20 04:45:15 -0500 Maintain a lock order graph and add checks (but no error messages or recording of the LoR data yet). Modified: soc2012/gmiller/locking-head/ (props changed) soc2012/gmiller/locking-head/lib/libwitness/graph.c soc2012/gmiller/locking-head/lib/libwitness/lists.c soc2012/gmiller/locking-head/lib/libwitness/witness.h Modified: soc2012/gmiller/locking-head/lib/libwitness/graph.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/graph.c Thu Jun 28 20:01:47 2012 (r238504) +++ soc2012/gmiller/locking-head/lib/libwitness/graph.c Thu Jun 28 20:01:59 2012 (r238505) @@ -52,23 +52,10 @@ return (NULL); } -static struct graph_node * -get_node(void *lock) -{ - if (root != NULL) { - return (scan_graph(root, lock)); - } - - return (NULL); -} - -int +/* XXX: produces suboptimal graph, fix this before the end of the project */ +static int insert_edge(struct graph_node *from, struct graph_node *to) { -#if 1 - // suppress warning - get_node(from->lock); -#endif if (from == to) { return (0); } @@ -77,8 +64,30 @@ return (-1); } - /* XXX */ + to->sibling = from->child; + from->child = to; return (0); } +static struct graph_node * +lookup_node(void *lock) +{ + struct graph_node *node; + + node = scan_graph(root, lock); + if (node == NULL) { + node = malloc(sizeof(struct graph_node)); + node->lock = lock; + node->child = NULL; + node->sibling = NULL; + } + + return (node); +} + +int +insert_lock(void *new_lock, void *previous) +{ + return (insert_edge(lookup_node(previous), lookup_node(new_lock))); +} Modified: soc2012/gmiller/locking-head/lib/libwitness/lists.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/lists.c Thu Jun 28 20:01:47 2012 (r238504) +++ soc2012/gmiller/locking-head/lib/libwitness/lists.c Thu Jun 28 20:01:59 2012 (r238505) @@ -47,12 +47,19 @@ add_lock(void *lock) { struct lock_entry *entry; + struct lock_entry *next; + + next = SLIST_FIRST(&lock_head); entry = malloc(sizeof(*entry)); entry->lock = lock; SLIST_INSERT_HEAD(&lock_head, entry, lock_next); + if (insert_lock(entry, next) < 0) { + /* XXX: LoR */ + } + printf("inserted lock %p\n", lock); dump_locks(); } Modified: soc2012/gmiller/locking-head/lib/libwitness/witness.h ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/witness.h Thu Jun 28 20:01:47 2012 (r238504) +++ soc2012/gmiller/locking-head/lib/libwitness/witness.h Thu Jun 28 20:01:59 2012 (r238505) @@ -47,4 +47,4 @@ void add_lock(void *lock); void remove_lock(void *lock); -int insert_edge(struct graph_node *from, struct graph_node *to); +int insert_lock(void *new_lock, void *previous); From owner-svn-soc-all@FreeBSD.ORG Thu Jun 28 21:27:56 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 2C6621065674 for ; Thu, 28 Jun 2012 21:27:55 +0000 (UTC) (envelope-from tzabal@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 28 Jun 2012 21:27:55 +0000 Date: Thu, 28 Jun 2012 21:27:55 +0000 From: tzabal@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120628212755.2C6621065674@hub.freebsd.org> Cc: Subject: socsvn commit: r238508 - soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 21:27:56 -0000 Author: tzabal Date: Thu Jun 28 21:27:54 2012 New Revision: 238508 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238508 Log: Code for forming an XML report in the case of a textdump. 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 Thu Jun 28 20:48:24 2012 (r238507) +++ soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh Thu Jun 28 21:27:54 2012 (r238508) @@ -227,7 +227,7 @@ echo "" >> ${data} echo "" >> ${data} - # From ps -axl until END + # From ps -axl until end for cmd in $commands2; do echo "" >> ${data} echo "" >> ${data} @@ -243,8 +243,89 @@ echo "" >> ${data} done else - # Code for textdump.... + # A temporary directory for the contents of the textdump + tmp_dir=`mktemp -d /tmp/crashreport.XXXXXX` + tar -xvf "${_dumpdir}/${_file}" -C "${tmp_dir}" + # A valid textdump can contain up to 5 files with the following names: + # ddb.txt, config.txt, msgbuf.txt, panic.txt and version.txt + + if [ -f "${tmp_dir}/ddb.txt" ]; then + flag='false' + while read line; do + echo "${line}" | egrep '^.+> [a-z ]+$' > /dev/null + if [ $? -eq 0 ]; then + if [ ${flag} == false ]; then + flag='true' + echo "" >> ${data} + echo "" >> ${data} + echo "${line}" | \ + sed -E 's/^.+> ([a-z ]+)$/\1/' >> ${data} + echo "" >> ${data} + echo "" >> ${data} + else + echo "" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + echo "${line}" | \ + sed -E 's/^.+> ([a-z ]+)$/\1/' >> ${data} + echo "" >> ${data} + echo "" >> ${data} + fi + else + echo "${line}" >> ${data} + fi + done < ${orig_file} + echo "" >> ${data} + echo "" >> ${data} + fi + + if [ -f "${tmp_dir}/config.txt" ]; then + echo "" >> ${data} + echo "" >> ${data} + echo "kernel config" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + cat "${tmp_dir}/config.txt" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + fi + + if [ -f "${tmp_dir}/msgbuf.txt" ]; then + echo "" >> ${data} + echo "" >> ${data} + echo "dmesg" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + cat "${tmp_dir}/msgbuf.txt" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + fi + + if [ -f "${tmp_dir}/panic.txt" ]; then + echo "" >> ${data} + echo "" >> ${data} + echo "panic" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + cat "${tmp_dir}/panic.txt" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + fi + + if [ -f "${tmp_dir}/version.txt" ]; then + echo "" >> ${data} + echo "" >> ${data} + echo "version" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + cat "${tmp_dir}/version.txt" >> ${data} + echo "" >> ${data} + echo "" >> ${data} + fi + + rm -r "${tmp_dir}" fi IFS="${orig_IFS}" @@ -255,6 +336,8 @@ ## Bundle the report report="${data##*/}.tar.gz" +mv "${data}" "${data}.xml" +data="${data}.xml" tar -czf ${report} -C ${data%/*} ${data##*/} From owner-svn-soc-all@FreeBSD.ORG Thu Jun 28 21:38:56 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id CF233106566B for ; Thu, 28 Jun 2012 21:38:53 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 28 Jun 2012 21:38:53 +0000 Date: Thu, 28 Jun 2012 21:38:53 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120628213853.CF233106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238509 - in soc2012/jhagewood/diff: . diff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 21:38:56 -0000 Author: jhagewood Date: Thu Jun 28 21:38:53 2012 New Revision: 238509 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238509 Log: Modified: soc2012/jhagewood/diff/diff/diffreg.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/diff/diffreg.c ============================================================================== --- soc2012/jhagewood/diff/diff/diffreg.c Thu Jun 28 21:27:54 2012 (r238508) +++ soc2012/jhagewood/diff/diff/diffreg.c Thu Jun 28 21:38:53 2012 (r238509) @@ -1351,14 +1351,16 @@ istextfile(FILE *f) { char buf[BUFSIZ]; - int i, cnt; + int cnt; if (aflag || f == NULL) return (1); rewind(f); fread(buf, 1, BUFSIZ, f); - if (memchr(buf, '\0', BUFSIZ) != NULL) + if (cnt = memchr(buf, '\0', BUFSIZ) != NULL) { + printf("%d\n", cnt); return (0); + } return (1); } Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Thu Jun 28 21:27:54 2012 (r238508) +++ soc2012/jhagewood/diff/hagewood-diff.patch Thu Jun 28 21:38:53 2012 (r238509) @@ -623,7 +623,7 @@ if (stat(path1, &stb1) != 0) { diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c --- jhagewood/diff/diff-orig/diffreg.c 2012-06-28 02:16:56.000000000 -0400 -+++ jhagewood/diff/diff/diffreg.c 2012-06-28 17:03:06.000000000 -0400 ++++ jhagewood/diff/diff/diffreg.c 2012-06-28 17:22:00.000000000 -0400 @@ -62,15 +62,13 @@ * @(#)diffreg.c 8.1 (Berkeley) 6/6/93 */ @@ -1135,7 +1135,7 @@ sum = 1; space = 0; -@@ -1305,20 +1344,21 @@ readhash(FILE *f) +@@ -1305,20 +1344,23 @@ readhash(FILE *f) return (sum == 0 ? 1 : sum); } @@ -1149,7 +1149,7 @@ - char buf[BUFSIZ]; - int i, cnt; + char buf[BUFSIZ]; -+ int i, cnt; ++ int cnt; if (aflag || f == NULL) return (1); @@ -1160,12 +1160,14 @@ - if (!isprint(buf[i]) && !isspace(buf[i])) - return (0); + fread(buf, 1, BUFSIZ, f); -+ if (memchr(buf, '\0', BUFSIZ) != NULL) ++ if (cnt = memchr(buf, '\0', BUFSIZ) != NULL) { ++ printf("%d\n", cnt); + return (0); ++ } return (1); } -@@ -1327,10 +1367,10 @@ asciifile(FILE *f) +@@ -1327,10 +1369,10 @@ asciifile(FILE *f) static char * match_function(const long *f, int pos, FILE *file) { @@ -1180,7 +1182,7 @@ lastline = pos; while (pos > last) { -@@ -1342,7 +1382,6 @@ match_function(const long *f, int pos, F +@@ -1342,7 +1384,6 @@ match_function(const long *f, int pos, F if (nc > 0) { buf[nc] = '\0'; buf[strcspn(buf, "\n")] = '\0'; @@ -1188,7 +1190,7 @@ if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') { if (begins_with(buf, "private:")) { if (!state) -@@ -1373,9 +1412,9 @@ static void +@@ -1373,9 +1414,9 @@ static void dump_context_vec(FILE *f1, FILE *f2) { struct context_vec *cvp = context_vec_start; @@ -1201,7 +1203,7 @@ if (context_vec_start > context_vec_ptr) return; -@@ -1390,8 +1429,8 @@ dump_context_vec(FILE *f1, FILE *f2) +@@ -1390,8 +1431,8 @@ dump_context_vec(FILE *f1, FILE *f2) if (pflag) { f = match_function(ixold, lowa-1, f1); if (f != NULL) { @@ -1212,7 +1214,7 @@ } } printf("\n*** "); -@@ -1478,9 +1517,9 @@ static void +@@ -1478,9 +1519,9 @@ static void dump_unified_vec(FILE *f1, FILE *f2) { struct context_vec *cvp = context_vec_start; @@ -1225,7 +1227,7 @@ if (context_vec_start > context_vec_ptr) return; -@@ -1491,19 +1530,19 @@ dump_unified_vec(FILE *f1, FILE *f2) +@@ -1491,19 +1532,19 @@ dump_unified_vec(FILE *f1, FILE *f2) lowc = MAX(1, cvp->c - context); upd = MIN(len[1], context_vec_ptr->d + context); @@ -1251,7 +1253,7 @@ /* * Output changes in "unified" diff format--the old and new lines -@@ -1551,16 +1590,43 @@ dump_unified_vec(FILE *f1, FILE *f2) +@@ -1551,16 +1592,43 @@ dump_unified_vec(FILE *f1, FILE *f2) static void print_header(const char *file1, const char *file2) { From owner-svn-soc-all@FreeBSD.ORG Thu Jun 28 22:22:54 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 1473B106566B for ; Thu, 28 Jun 2012 22:22:52 +0000 (UTC) (envelope-from scher@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 28 Jun 2012 22:22:52 +0000 Date: Thu, 28 Jun 2012 22:22:52 +0000 From: scher@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120628222252.1473B106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238512 - soc2012/scher/par_ports/head/Mk X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2012 22:22:54 -0000 Author: scher Date: Thu Jun 28 22:22:51 2012 New Revision: 238512 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238512 Log: [new_feature] ${_parv_CHECK_SEQ} considers parent process's lock file [user_feedback] feedback changes in ${_parv_CHECK_SEQ} ${_parv_CHECK_LOCK} ${_TERMINATE_PROCESS_TREE} scripts 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 Thu Jun 28 21:24:56 2012 (r238511) +++ soc2012/scher/par_ports/head/Mk/bsd.parallel.mk Thu Jun 28 22:22:51 2012 (r238512) @@ -343,17 +343,27 @@ if [ \$${pid} ]; then \ ps -p \$${pid} > /dev/null && status=\$$? || status=\$$?; \ if [ \$${status} -eq 0 ]; then \ - ${_dparv_START_OUTPUT}; \ - ${ECHO_CMD} Unable to lock ${LOCK_DIR}/$${pkg_name}; \ - ${ECHO_CMD} Dir: ${LOCK_DIR} is already locked by another working process ...; \ - ${_dparv_START_OUTPUT}; \ + cur_pid=${.MAKE.PID}; \ + while true; do \ + ppid=\$$( ps -o ppid -p \$${cur_pid} | ${AWK} "NR==2" ); \ + if [ \$${ppid} -eq \$${pid} ]; then \ + ${ECHO_CMD} '===> $${pkg_name} is locked by parent make process'; \ + ${ECHO_CMD} ' We are allowed to work here'; \ + exit 0; \ + elif [ \$${ppid} -eq 0 ]; then \ + break; \ + else \ + cur_pid=\$${ppid}; \ + fi; \ + done; \ + ${ECHO_CMD} '===> $${pkg_name} is already locked by another working process'; \ exit ${_parv_ON_LOCK_EXIT_STATUS}; \ else \ - ${_dparv_START_OUTPUT}; \ - ${ECHO_CMD} Dir: ${LOCK_DIR}/$${pkg_name} Stalled lock Detected!; \ - ${ECHO_CMD} Deleting stalled lock. PID=\$${pid}; \ - ${_dparv_END_OUTPUT}; \ + ${ECHO_CMD} '===> Stalled lock Detected for $${pkg_name}'; \ + ${ECHO_CMD} ' Deleting stalled lock'; \ fi; \ + else \ + ${ECHO_CMD} '===> $${pkg_name} is not locked'; \ fi; \ ${RM} -rf ${LOCK_DIR}/$${pkg_name} @@ -364,9 +374,8 @@ [ $${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}; \ + ${ECHO_CMD}; \ + ${ECHO_CMD} "Unhandled EXIT STATUS = $${status}. Terminating..."; \ exit 1; \ fi; \ } @@ -511,7 +520,8 @@ # _TERMINATE_PROCESS_TREE= \ [ $$? -eq 0 ] && exit 0; \ - ${ECHO_CMD} Terminating process tree strating from ${.MAKE.PID}; \ + ${ECHO_CMD}; \ + ${ECHO_CMD} Terminating process tree strating from ${PKGNAME} build process \( PID ${.MAKE.PID} \); \ pids_to_kill=${.MAKE.PID}; \ /bin/kill -STOP ${.MAKE.PID} 2> /dev/null || ${DO_NADA}; \ ppids=$$( ps -xao pid,ppid | awk "{ if (\$$2==${.MAKE.PID}) {print \$$1} }" ); \ @@ -529,7 +539,7 @@ done; \ if [ $${\#ppids} -eq 0 ]; then break; fi; \ done; \ - ${ECHO_CMD} PIDs to kill: $${pids_to_kill}; \ + ${ECHO_CMD} Processes with the following PIDs will be killed: $${pids_to_kill}; \ /bin/kill -KILL $${pids_to_kill} 2> /dev/null || ${DO_NADA} ##################################################### From owner-svn-soc-all@FreeBSD.ORG Fri Jun 29 02:27:00 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id CC28C1065670 for ; Fri, 29 Jun 2012 02:26:58 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 29 Jun 2012 02:26:58 +0000 Date: Fri, 29 Jun 2012 02:26:58 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120629022658.CC28C1065670@hub.freebsd.org> Cc: Subject: socsvn commit: r238518 - in soc2012/jhagewood: diff diff/diff diff3 mdocml X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 02:27:01 -0000 Author: jhagewood Date: Fri Jun 29 02:26:58 2012 New Revision: 238518 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238518 Log: Modified: soc2012/jhagewood/diff/diff/diff.c soc2012/jhagewood/diff/hagewood-diff.patch soc2012/jhagewood/diff3/hagewood-diff3.patch soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch Modified: soc2012/jhagewood/diff/diff/diff.c ============================================================================== --- soc2012/jhagewood/diff/diff/diff.c Fri Jun 29 01:55:20 2012 (r238517) +++ soc2012/jhagewood/diff/diff/diff.c Fri Jun 29 02:26:58 2012 (r238518) @@ -147,11 +147,32 @@ }; 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", +"\t-a --text treat files as ASCII text", +"\t-B --ignore-blank-lines Ignore blank newlines in the comparison", +"\t-b --ignore-space-change Ignore all changes due to whitespace", +"\t-C -c NUM --context=NUM Show NUM lines before and after change (default 3)", +"\t-D --ifdef=NAME Output merged file with `#ifdef NAME' diffs", +"\t-E --ignore-tab-expansion Ignore tab expansion in the comparison", +"\t-e --ed Output an ed script", +"\t-F --show-function-line=RE Show the most recent line matching RE", +"\t-f --forward-ed Output a forward ed script", +"\t-I --ignore-matching-lines=RE Ignore changes whose lines all match RE", +"\t-i --ignore-case Ignore case differences in file contents", +"\t-L --label=NAME Label file header", +"\t-l --paginate Paginates output through pr", +"\t-N --new-file Treat new files as empty", +"\t-n --rcs Output an RCS format diff", +"\t-P --unidirectional-new-file Treat absent-first files as empty", +"\t-p --show-c-function Show which C function each change is in", +"\t-q --brief report only when files differ", +"\t-r --recursive Recursively compare any sub-directories found", +"\t-S --starting-file=FILE Start with FILE when comparing directories", +"\t-s --report-identical-files Report when two files are the same", +"\t-T --initial-tab Make tabs line up by prepending a tab", +"\t-t --expand-tabs Expand tabs to spaces in output", +"\t-U -u NUM --unified=NUM Show NUM lines of unified context", +"\t-v --version Show diff version", +"\t-w --width=NUM Output at most NUM (default 130) print columns" NULL, }; char **help_strs = (char **)help_msg; Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Fri Jun 29 01:55:20 2012 (r238517) +++ soc2012/jhagewood/diff/hagewood-diff.patch Fri Jun 29 02:26:58 2012 (r238518) @@ -1,6 +1,6 @@ diff -rupN jhagewood/diff/diff-orig/diff.c jhagewood/diff/diff/diff.c ---- jhagewood/diff/diff-orig/diff.c 2012-06-28 02:16:56.000000000 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-28 14:21:49.000000000 -0400 +--- jhagewood/diff/diff-orig/diff.c 2012-06-28 18:13:23.287983517 -0400 ++++ jhagewood/diff/diff/diff.c 2012-06-28 22:26:40.173964963 -0400 @@ -1,4 +1,4 @@ -/*- +/* @@ -56,7 +56,7 @@ /* Options which exceed manageable alphanumeric assignments */ -@@ -69,75 +67,82 @@ enum +@@ -69,84 +67,112 @@ enum OPT_STRIPCR, OPT_NORMAL, OPT_LEFTC, @@ -186,7 +186,42 @@ { NULL, 0, NULL, '\0'} }; -@@ -162,11 +167,12 @@ void read_excludes_file(char *); + 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", ++"\t-a --text treat files as ASCII text", ++"\t-B --ignore-blank-lines Ignore blank newlines in the comparison", ++"\t-b --ignore-space-change Ignore all changes due to whitespace", ++"\t-C -c NUM --context=NUM Show NUM lines before and after change (default 3)", ++"\t-D --ifdef=NAME Output merged file with `#ifdef NAME' diffs", ++"\t-E --ignore-tab-expansion Ignore tab expansion in the comparison", ++"\t-e --ed Output an ed script", ++"\t-F --show-function-line=RE Show the most recent line matching RE", ++"\t-f --forward-ed Output a forward ed script", ++"\t-I --ignore-matching-lines=RE Ignore changes whose lines all match RE", ++"\t-i --ignore-case Ignore case differences in file contents", ++"\t-L --label=NAME Label file header", ++"\t-l --paginate Paginates output through pr", ++"\t-N --new-file Treat new files as empty", ++"\t-n --rcs Output an RCS format diff", ++"\t-P --unidirectional-new-file Treat absent-first files as empty", ++"\t-p --show-c-function Show which C function each change is in", ++"\t-q --brief report only when files differ", ++"\t-r --recursive Recursively compare any sub-directories found", ++"\t-S --starting-file=FILE Start with FILE when comparing directories", ++"\t-s --report-identical-files Report when two files are the same", ++"\t-T --initial-tab Make tabs line up by prepending a tab", ++"\t-t --expand-tabs Expand tabs to spaces in output", ++"\t-U -u NUM --unified=NUM Show NUM lines of unified context", ++"\t-v --version Show diff version", ++"\t-w --width=NUM Output at most NUM (default 130) print columns" + NULL, + }; + char **help_strs = (char **)help_msg; +@@ -162,11 +188,12 @@ void read_excludes_file(char *); int main(int argc, char **argv) { @@ -204,7 +239,7 @@ oargv = argv; oargc = argc; gotstdin = 0; -@@ -197,6 +203,7 @@ main(int argc, char **argv) +@@ -197,6 +224,7 @@ main(int argc, char **argv) break; case 'C': case 'c': @@ -212,7 +247,7 @@ format = D_CONTEXT; if (optarg != NULL) { l = strtol(optarg, &ep, 10); -@@ -213,6 +220,9 @@ main(int argc, char **argv) +@@ -213,6 +241,9 @@ main(int argc, char **argv) case 'd': dflag = 1; break; @@ -222,7 +257,7 @@ case 'e': format = D_EDIT; break; -@@ -296,15 +306,52 @@ main(int argc, char **argv) +@@ -296,15 +327,52 @@ main(int argc, char **argv) case 'y': yflag = 1; break; @@ -283,7 +318,7 @@ case OPT_STRIPCR: strip_cr=1; break; -@@ -328,20 +375,58 @@ main(int argc, char **argv) +@@ -328,20 +396,58 @@ main(int argc, char **argv) lastch = ch; newarg = optind != prevoptind; prevoptind = optind; @@ -347,7 +382,7 @@ execv(_PATH_SDIFF, oargv); _exit(127); } -@@ -380,7 +465,10 @@ main(int argc, char **argv) +@@ -380,7 +486,10 @@ main(int argc, char **argv) set_argstr(oargv, argv); if (S_ISDIR(stb1.st_mode) && S_ISDIR(stb2.st_mode)) { if (format == D_IFDEF) @@ -359,7 +394,7 @@ diffdir(argv[0], argv[1]); } else { if (S_ISDIR(stb1.st_mode)) { -@@ -402,11 +490,10 @@ main(int argc, char **argv) +@@ -402,11 +511,10 @@ main(int argc, char **argv) void * emalloc(size_t n) { @@ -372,7 +407,7 @@ if ((p = malloc(n)) == NULL) errx(2, NULL); return (p); -@@ -415,7 +502,7 @@ emalloc(size_t n) +@@ -415,7 +523,7 @@ emalloc(size_t n) void * erealloc(void *p, size_t n) { @@ -381,7 +416,7 @@ if (n == 0) errx(2, NULL); -@@ -431,13 +518,12 @@ erealloc(void *p, size_t n) +@@ -431,13 +539,12 @@ erealloc(void *p, size_t n) int easprintf(char **ret, const char *fmt, ...) { @@ -397,7 +432,7 @@ if (len < 0 || *ret == NULL) errx(2, NULL); return (len); -@@ -446,11 +532,12 @@ easprintf(char **ret, const char *fmt, . +@@ -446,11 +553,12 @@ easprintf(char **ret, const char *fmt, . char * estrdup(const char *str) { @@ -412,7 +447,7 @@ strlcpy(cp, str, len); return (cp); } -@@ -531,6 +618,7 @@ push_ignore_pats(char *pattern) +@@ -531,6 +639,7 @@ push_ignore_pats(char *pattern) void print_only(const char *path, size_t dirlen, const char *entry) { @@ -420,7 +455,7 @@ if (dirlen > 1) dirlen--; printf("Only in %.*s: %s\n", (int)dirlen, path, entry); -@@ -539,45 +627,46 @@ print_only(const char *path, size_t dirl +@@ -539,45 +648,46 @@ print_only(const char *path, size_t dirl void print_status(int val, char *path1, char *path2, char *entry) { @@ -478,7 +513,7 @@ break; } } -@@ -585,6 +674,7 @@ print_status(int val, char *path1, char +@@ -585,6 +695,7 @@ print_status(int val, char *path1, char void usage(void) { @@ -486,34 +521,9 @@ (void)fprintf(stderr, "usage: diff [-abdilpqTtw] [-I pattern] [-c | -e | -f | -n | -u]\n" " [-L label] file1 file2\n" -diff -rupN jhagewood/diff/diff-orig/diff.h jhagewood/diff/diff/diff.h ---- jhagewood/diff/diff-orig/diff.h 2012-06-28 02:16:56.000000000 -0400 -+++ jhagewood/diff/diff/diff.h 2012-06-28 14:03:06.000000000 -0400 -@@ -48,6 +48,8 @@ - #define D_NREVERSE 5 /* Reverse ed script with numbered - lines and no trailing . */ - #define D_BRIEF 6 /* Say if the files differ */ -+#define D_GF 7 /* Group format */ -+#define D_LF 8 /* Line format */ - - /* - * Output flags -@@ -75,9 +77,9 @@ struct excludes { - struct excludes *next; - }; - --extern int aflag, bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag, -- sflag, tflag, Tflag, wflag; --extern int Bflag, strip_cr, tabsize; -+extern int aflag, bflag, cflag, dflag, Eflag, Fromflag, iflag, lflag, Nflag, Pflag, pflag, rflag, -+ sflag, tflag, Tflag, Toflag, wflag; -+extern int Bflag, strip_cr, suppress_cl, tabsize; - extern int format, context, status; - extern char ignore_file_case; - extern char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; diff -rupN jhagewood/diff/diff-orig/diffdir.c jhagewood/diff/diff/diffdir.c ---- jhagewood/diff/diff-orig/diffdir.c 2012-06-28 02:16:56.000000000 -0400 -+++ jhagewood/diff/diff/diffdir.c 2012-06-28 02:16:56.000000000 -0400 +--- jhagewood/diff/diff-orig/diffdir.c 2012-06-28 18:13:23.287983517 -0400 ++++ jhagewood/diff/diff/diffdir.c 2012-06-28 18:13:23.375983516 -0400 @@ -20,14 +20,13 @@ #include @@ -621,9 +631,34 @@ strlcpy(path1 + plen1, dp->d_name, MAXPATHLEN - plen1); if (stat(path1, &stb1) != 0) { +diff -rupN jhagewood/diff/diff-orig/diff.h jhagewood/diff/diff/diff.h +--- jhagewood/diff/diff-orig/diff.h 2012-06-28 18:13:23.288983517 -0400 ++++ jhagewood/diff/diff/diff.h 2012-06-28 18:13:23.376983516 -0400 +@@ -48,6 +48,8 @@ + #define D_NREVERSE 5 /* Reverse ed script with numbered + lines and no trailing . */ + #define D_BRIEF 6 /* Say if the files differ */ ++#define D_GF 7 /* Group format */ ++#define D_LF 8 /* Line format */ + + /* + * Output flags +@@ -75,9 +77,9 @@ struct excludes { + struct excludes *next; + }; + +-extern int aflag, bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag, +- sflag, tflag, Tflag, wflag; +-extern int Bflag, strip_cr, tabsize; ++extern int aflag, bflag, cflag, dflag, Eflag, Fromflag, iflag, lflag, Nflag, Pflag, pflag, rflag, ++ sflag, tflag, Tflag, Toflag, wflag; ++extern int Bflag, strip_cr, suppress_cl, tabsize; + extern int format, context, status; + extern char ignore_file_case; + extern char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c ---- jhagewood/diff/diff-orig/diffreg.c 2012-06-28 02:16:56.000000000 -0400 -+++ jhagewood/diff/diff/diffreg.c 2012-06-28 17:22:00.000000000 -0400 +--- jhagewood/diff/diff-orig/diffreg.c 2012-06-28 18:13:23.286983517 -0400 ++++ jhagewood/diff/diff/diffreg.c 2012-06-28 18:13:23.374983516 -0400 @@ -62,15 +62,13 @@ * @(#)diffreg.c 8.1 (Berkeley) 6/6/93 */ @@ -687,7 +722,7 @@ anychange = 0; lastline = 0; -@@ -353,7 +357,6 @@ diffreg(char *ofile1, char *ofile2, int +@@ -353,7 +357,6 @@ diffreg(char *ofile1, char *ofile2, int status |= 2; goto closem; } @@ -695,7 +730,7 @@ switch (files_differ(f1, f2, flags)) { case 0: goto closem; -@@ -365,7 +368,7 @@ diffreg(char *ofile1, char *ofile2, int +@@ -365,7 +368,7 @@ diffreg(char *ofile1, char *ofile2, int goto closem; } @@ -1304,8 +1339,8 @@ + file2, buf2); } diff -rupN jhagewood/diff/diff-orig/pathnames.h jhagewood/diff/diff/pathnames.h ---- jhagewood/diff/diff-orig/pathnames.h 2012-06-28 02:16:56.000000000 -0400 -+++ jhagewood/diff/diff/pathnames.h 2012-06-28 02:16:56.000000000 -0400 +--- jhagewood/diff/diff-orig/pathnames.h 2012-06-28 18:13:23.281983517 -0400 ++++ jhagewood/diff/diff/pathnames.h 2012-06-28 18:13:23.374983516 -0400 @@ -23,4 +23,5 @@ #include Modified: soc2012/jhagewood/diff3/hagewood-diff3.patch ============================================================================== --- soc2012/jhagewood/diff3/hagewood-diff3.patch Fri Jun 29 01:55:20 2012 (r238517) +++ soc2012/jhagewood/diff3/hagewood-diff3.patch Fri Jun 29 02:26:58 2012 (r238518) @@ -1,17 +1,6 @@ -diff -rupN jhagewood/diff3/diff3-orig/Makefile jhagewood/diff3/diff3/Makefile ---- jhagewood/diff3/diff3-orig/Makefile 2012-06-28 02:16:56.000000000 -0400 -+++ jhagewood/diff3/diff3/Makefile 2012-06-28 02:16:57.000000000 -0400 -@@ -6,6 +6,6 @@ BINDIR= /usr/libexec - - beforeinstall: - install ${INSTALL_COPY}c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ -- ${.CURDIR}/diff3.ksh ${DESTDIR}/usr/bin/diff3 -+ ${.CURDIR}/diff3.sh ${DESTDIR}/usr/bin/diff3 - - .include diff -rupN jhagewood/diff3/diff3-orig/diff3prog.c jhagewood/diff3/diff3/diff3prog.c ---- jhagewood/diff3/diff3-orig/diff3prog.c 2012-06-28 02:16:56.000000000 -0400 -+++ jhagewood/diff3/diff3/diff3prog.c 2012-06-28 02:16:57.000000000 -0400 +--- jhagewood/diff3/diff3-orig/diff3prog.c 2012-06-28 18:13:23.389983516 -0400 ++++ jhagewood/diff3/diff3/diff3prog.c 2012-06-28 18:13:23.422983515 -0400 @@ -64,19 +64,23 @@ * @(#)diff3.c 8.1 (Berkeley) 6/6/93 */ @@ -466,3 +455,14 @@ + fprintf(stderr, "usage: diff3 %s file1 file2 file3\n", OPTIONS); exit(EXIT_FAILURE); } +diff -rupN jhagewood/diff3/diff3-orig/Makefile jhagewood/diff3/diff3/Makefile +--- jhagewood/diff3/diff3-orig/Makefile 2012-06-28 18:13:23.390983516 -0400 ++++ jhagewood/diff3/diff3/Makefile 2012-06-28 18:13:23.423983515 -0400 +@@ -6,6 +6,6 @@ BINDIR= /usr/libexec + + beforeinstall: + install ${INSTALL_COPY}c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ +- ${.CURDIR}/diff3.ksh ${DESTDIR}/usr/bin/diff3 ++ ${.CURDIR}/diff3.sh ${DESTDIR}/usr/bin/diff3 + + .include Modified: soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch ============================================================================== --- soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch Fri Jun 29 01:55:20 2012 (r238517) +++ soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch Fri Jun 29 02:26:58 2012 (r238518) @@ -1,6 +1,6 @@ diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man.h jhagewood/mdocml/mdocml-1.12.1/man.h ---- jhagewood/mdocml/mdocml-1.12.1-orig/man.h 2012-06-28 02:16:57.000000000 -0400 -+++ jhagewood/mdocml/mdocml-1.12.1/man.h 2012-06-28 02:16:58.000000000 -0400 +--- jhagewood/mdocml/mdocml-1.12.1-orig/man.h 2012-06-28 18:13:23.821983512 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man.h 2012-06-28 18:13:24.149983509 -0400 @@ -43,6 +43,8 @@ enum mant { MAN_sp, MAN_nf, @@ -12,7 +12,7 @@ MAN_DT, diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man.h.orig jhagewood/mdocml/mdocml-1.12.1/man.h.orig --- jhagewood/mdocml/mdocml-1.12.1-orig/man.h.orig 1969-12-31 19:00:00.000000000 -0500 -+++ jhagewood/mdocml/mdocml-1.12.1/man.h.orig 2012-06-28 02:16:58.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man.h.orig 2012-06-28 18:13:24.137983510 -0400 @@ -0,0 +1,113 @@ +/* $Id: man.h,v 1.60 2012/01/03 15:16:24 kristaps Exp $ */ +/* @@ -128,8 +128,8 @@ + +#endif /*!MAN_H*/ diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c jhagewood/mdocml/mdocml-1.12.1/man_term.c ---- jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c 2012-06-28 02:16:57.000000000 -0400 -+++ jhagewood/mdocml/mdocml-1.12.1/man_term.c 2012-06-28 02:16:58.000000000 -0400 +--- jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c 2012-06-28 18:13:23.808983512 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man_term.c 2012-06-28 18:13:24.131983510 -0400 @@ -82,6 +82,8 @@ static int pre_alternate(DECL_ARGS); static int pre_ft(DECL_ARGS); static int pre_ign(DECL_ARGS); @@ -173,7 +173,7 @@ static int diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c.orig jhagewood/mdocml/mdocml-1.12.1/man_term.c.orig --- jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c.orig 1969-12-31 19:00:00.000000000 -0500 -+++ jhagewood/mdocml/mdocml-1.12.1/man_term.c.orig 2012-06-28 02:16:58.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man_term.c.orig 2012-06-28 18:13:24.146983510 -0400 @@ -0,0 +1,1117 @@ +/* $Id: man_term.c,v 1.127 2012/01/03 15:16:24 kristaps Exp $ */ +/* From owner-svn-soc-all@FreeBSD.ORG Fri Jun 29 02:31:04 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 89B39106566B for ; Fri, 29 Jun 2012 02:31:03 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 29 Jun 2012 02:31:03 +0000 Date: Fri, 29 Jun 2012 02:31:03 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120629023103.89B39106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238519 - in soc2012/jhagewood/diff: . diff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 02:31:04 -0000 Author: jhagewood Date: Fri Jun 29 02:31:03 2012 New Revision: 238519 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238519 Log: Modified: soc2012/jhagewood/diff/diff/diff.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/diff/diff.c ============================================================================== --- soc2012/jhagewood/diff/diff/diff.c Fri Jun 29 02:26:58 2012 (r238518) +++ soc2012/jhagewood/diff/diff/diff.c Fri Jun 29 02:31:03 2012 (r238519) @@ -172,7 +172,12 @@ "\t-t --expand-tabs Expand tabs to spaces in output", "\t-U -u NUM --unified=NUM Show NUM lines of unified context", "\t-v --version Show diff version", -"\t-w --width=NUM Output at most NUM (default 130) print columns" +"\t-w --width=NUM Output at most NUM (default 130) print columns", +"\t-X --exclude-from=FILE Start with FILE when comparing directories", +"\t-x --exclude=PAT Exclude files that match PAT", +"\t-y --side-by-side Output difference in two columns", +"\t--GTYPE-group-format=GFMT Format GTYPE input groups with GFMT", +"\t--LTYPE-line-format=LFMT Format LTYPE input lines with LFMT", NULL, }; char **help_strs = (char **)help_msg; Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Fri Jun 29 02:26:58 2012 (r238518) +++ soc2012/jhagewood/diff/hagewood-diff.patch Fri Jun 29 02:31:03 2012 (r238519) @@ -1,6 +1,6 @@ diff -rupN jhagewood/diff/diff-orig/diff.c jhagewood/diff/diff/diff.c --- jhagewood/diff/diff-orig/diff.c 2012-06-28 18:13:23.287983517 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-28 22:26:40.173964963 -0400 ++++ jhagewood/diff/diff/diff.c 2012-06-28 22:30:55.077962845 -0400 @@ -1,4 +1,4 @@ -/*- +/* @@ -56,7 +56,7 @@ /* Options which exceed manageable alphanumeric assignments */ -@@ -69,84 +67,112 @@ enum +@@ -69,84 +67,117 @@ enum OPT_STRIPCR, OPT_NORMAL, OPT_LEFTC, @@ -217,11 +217,16 @@ +"\t-t --expand-tabs Expand tabs to spaces in output", +"\t-U -u NUM --unified=NUM Show NUM lines of unified context", +"\t-v --version Show diff version", -+"\t-w --width=NUM Output at most NUM (default 130) print columns" ++"\t-w --width=NUM Output at most NUM (default 130) print columns", ++"\t-X --exclude-from=FILE Start with FILE when comparing directories", ++"\t-x --exclude=PAT Exclude files that match PAT", ++"\t-y --side-by-side Output difference in two columns", ++"\t--GTYPE-group-format=GFMT Format GTYPE input groups with GFMT", ++"\t--LTYPE-line-format=LFMT Format LTYPE input lines with LFMT", NULL, }; char **help_strs = (char **)help_msg; -@@ -162,11 +188,12 @@ void read_excludes_file(char *); +@@ -162,11 +193,12 @@ void read_excludes_file(char *); int main(int argc, char **argv) { @@ -239,7 +244,7 @@ oargv = argv; oargc = argc; gotstdin = 0; -@@ -197,6 +224,7 @@ main(int argc, char **argv) +@@ -197,6 +229,7 @@ main(int argc, char **argv) break; case 'C': case 'c': @@ -247,7 +252,7 @@ format = D_CONTEXT; if (optarg != NULL) { l = strtol(optarg, &ep, 10); -@@ -213,6 +241,9 @@ main(int argc, char **argv) +@@ -213,6 +246,9 @@ main(int argc, char **argv) case 'd': dflag = 1; break; @@ -257,7 +262,7 @@ case 'e': format = D_EDIT; break; -@@ -296,15 +327,52 @@ main(int argc, char **argv) +@@ -296,15 +332,52 @@ main(int argc, char **argv) case 'y': yflag = 1; break; @@ -318,7 +323,7 @@ case OPT_STRIPCR: strip_cr=1; break; -@@ -328,20 +396,58 @@ main(int argc, char **argv) +@@ -328,20 +401,58 @@ main(int argc, char **argv) lastch = ch; newarg = optind != prevoptind; prevoptind = optind; @@ -382,7 +387,7 @@ execv(_PATH_SDIFF, oargv); _exit(127); } -@@ -380,7 +486,10 @@ main(int argc, char **argv) +@@ -380,7 +491,10 @@ main(int argc, char **argv) set_argstr(oargv, argv); if (S_ISDIR(stb1.st_mode) && S_ISDIR(stb2.st_mode)) { if (format == D_IFDEF) @@ -394,7 +399,7 @@ diffdir(argv[0], argv[1]); } else { if (S_ISDIR(stb1.st_mode)) { -@@ -402,11 +511,10 @@ main(int argc, char **argv) +@@ -402,11 +516,10 @@ main(int argc, char **argv) void * emalloc(size_t n) { @@ -407,7 +412,7 @@ if ((p = malloc(n)) == NULL) errx(2, NULL); return (p); -@@ -415,7 +523,7 @@ emalloc(size_t n) +@@ -415,7 +528,7 @@ emalloc(size_t n) void * erealloc(void *p, size_t n) { @@ -416,7 +421,7 @@ if (n == 0) errx(2, NULL); -@@ -431,13 +539,12 @@ erealloc(void *p, size_t n) +@@ -431,13 +544,12 @@ erealloc(void *p, size_t n) int easprintf(char **ret, const char *fmt, ...) { @@ -432,7 +437,7 @@ if (len < 0 || *ret == NULL) errx(2, NULL); return (len); -@@ -446,11 +553,12 @@ easprintf(char **ret, const char *fmt, . +@@ -446,11 +558,12 @@ easprintf(char **ret, const char *fmt, . char * estrdup(const char *str) { @@ -447,7 +452,7 @@ strlcpy(cp, str, len); return (cp); } -@@ -531,6 +639,7 @@ push_ignore_pats(char *pattern) +@@ -531,6 +644,7 @@ push_ignore_pats(char *pattern) void print_only(const char *path, size_t dirlen, const char *entry) { @@ -455,7 +460,7 @@ if (dirlen > 1) dirlen--; printf("Only in %.*s: %s\n", (int)dirlen, path, entry); -@@ -539,45 +648,46 @@ print_only(const char *path, size_t dirl +@@ -539,45 +653,46 @@ print_only(const char *path, size_t dirl void print_status(int val, char *path1, char *path2, char *entry) { @@ -513,7 +518,7 @@ break; } } -@@ -585,6 +695,7 @@ print_status(int val, char *path1, char +@@ -585,6 +700,7 @@ print_status(int val, char *path1, char void usage(void) { From owner-svn-soc-all@FreeBSD.ORG Fri Jun 29 02:40:11 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id A6CDE106566B for ; Fri, 29 Jun 2012 02:40:09 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 29 Jun 2012 02:40:09 +0000 Date: Fri, 29 Jun 2012 02:40:09 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120629024009.A6CDE106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238520 - in soc2012/jhagewood/diff: . diff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 02:40:11 -0000 Author: jhagewood Date: Fri Jun 29 02:40:09 2012 New Revision: 238520 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238520 Log: Modified: soc2012/jhagewood/diff/diff/diff.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/diff/diff.c ============================================================================== --- soc2012/jhagewood/diff/diff/diff.c Fri Jun 29 02:31:03 2012 (r238519) +++ soc2012/jhagewood/diff/diff/diff.c Fri Jun 29 02:40:09 2012 (r238520) @@ -178,6 +178,17 @@ "\t-y --side-by-side Output difference in two columns", "\t--GTYPE-group-format=GFMT Format GTYPE input groups with GFMT", "\t--LTYPE-line-format=LFMT Format LTYPE input lines with LFMT", +"\t--from-file=FILE Compare FILE to all operands", +"\t--to-file=FILE Compare all operands to FILE", +"\t--ignore-file-name-case Ignore file name case", +"\t--left-column Output the only the left column of common lines", +"\t--line-format=LFMT Format all input lines with LFMT", +"\t--no-ignore-file-name-case Do not ignore file name case", +"\t--normal Output a normal diff (default output)", +"\t--strip-trailing-cr Strip trailing carriage return", +"\t--suppress-common-lines Do not output common lines", +"\t--tabsize=NUM Tab stops every NUM (default 8) print columns", +"\t--help Output this help message", NULL, }; char **help_strs = (char **)help_msg; Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Fri Jun 29 02:31:03 2012 (r238519) +++ soc2012/jhagewood/diff/hagewood-diff.patch Fri Jun 29 02:40:09 2012 (r238520) @@ -1,6 +1,6 @@ diff -rupN jhagewood/diff/diff-orig/diff.c jhagewood/diff/diff/diff.c --- jhagewood/diff/diff-orig/diff.c 2012-06-28 18:13:23.287983517 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-28 22:30:55.077962845 -0400 ++++ jhagewood/diff/diff/diff.c 2012-06-28 22:39:58.023958340 -0400 @@ -1,4 +1,4 @@ -/*- +/* @@ -56,7 +56,7 @@ /* Options which exceed manageable alphanumeric assignments */ -@@ -69,84 +67,117 @@ enum +@@ -69,84 +67,128 @@ enum OPT_STRIPCR, OPT_NORMAL, OPT_LEFTC, @@ -223,10 +223,21 @@ +"\t-y --side-by-side Output difference in two columns", +"\t--GTYPE-group-format=GFMT Format GTYPE input groups with GFMT", +"\t--LTYPE-line-format=LFMT Format LTYPE input lines with LFMT", ++"\t--from-file=FILE Compare FILE to all operands", ++"\t--to-file=FILE Compare all operands to FILE", ++"\t--ignore-file-name-case Ignore file name case", ++"\t--left-column Output the only the left column of common lines", ++"\t--line-format=LFMT Format all input lines with LFMT", ++"\t--no-ignore-file-name-case Do not ignore file name case", ++"\t--normal Output a normal diff (default output)", ++"\t--strip-trailing-cr Strip trailing carriage return", ++"\t--suppress-common-lines Do not output common lines", ++"\t--tabsize=NUM Tab stops every NUM (default 8) print columns", ++"\t--help Output this help message", NULL, }; char **help_strs = (char **)help_msg; -@@ -162,11 +193,12 @@ void read_excludes_file(char *); +@@ -162,11 +204,12 @@ void read_excludes_file(char *); int main(int argc, char **argv) { @@ -244,7 +255,7 @@ oargv = argv; oargc = argc; gotstdin = 0; -@@ -197,6 +229,7 @@ main(int argc, char **argv) +@@ -197,6 +240,7 @@ main(int argc, char **argv) break; case 'C': case 'c': @@ -252,7 +263,7 @@ format = D_CONTEXT; if (optarg != NULL) { l = strtol(optarg, &ep, 10); -@@ -213,6 +246,9 @@ main(int argc, char **argv) +@@ -213,6 +257,9 @@ main(int argc, char **argv) case 'd': dflag = 1; break; @@ -262,7 +273,7 @@ case 'e': format = D_EDIT; break; -@@ -296,15 +332,52 @@ main(int argc, char **argv) +@@ -296,15 +343,52 @@ main(int argc, char **argv) case 'y': yflag = 1; break; @@ -323,7 +334,7 @@ case OPT_STRIPCR: strip_cr=1; break; -@@ -328,20 +401,58 @@ main(int argc, char **argv) +@@ -328,20 +412,58 @@ main(int argc, char **argv) lastch = ch; newarg = optind != prevoptind; prevoptind = optind; @@ -387,7 +398,7 @@ execv(_PATH_SDIFF, oargv); _exit(127); } -@@ -380,7 +491,10 @@ main(int argc, char **argv) +@@ -380,7 +502,10 @@ main(int argc, char **argv) set_argstr(oargv, argv); if (S_ISDIR(stb1.st_mode) && S_ISDIR(stb2.st_mode)) { if (format == D_IFDEF) @@ -399,7 +410,7 @@ diffdir(argv[0], argv[1]); } else { if (S_ISDIR(stb1.st_mode)) { -@@ -402,11 +516,10 @@ main(int argc, char **argv) +@@ -402,11 +527,10 @@ main(int argc, char **argv) void * emalloc(size_t n) { @@ -412,7 +423,7 @@ if ((p = malloc(n)) == NULL) errx(2, NULL); return (p); -@@ -415,7 +528,7 @@ emalloc(size_t n) +@@ -415,7 +539,7 @@ emalloc(size_t n) void * erealloc(void *p, size_t n) { @@ -421,7 +432,7 @@ if (n == 0) errx(2, NULL); -@@ -431,13 +544,12 @@ erealloc(void *p, size_t n) +@@ -431,13 +555,12 @@ erealloc(void *p, size_t n) int easprintf(char **ret, const char *fmt, ...) { @@ -437,7 +448,7 @@ if (len < 0 || *ret == NULL) errx(2, NULL); return (len); -@@ -446,11 +558,12 @@ easprintf(char **ret, const char *fmt, . +@@ -446,11 +569,12 @@ easprintf(char **ret, const char *fmt, . char * estrdup(const char *str) { @@ -452,7 +463,7 @@ strlcpy(cp, str, len); return (cp); } -@@ -531,6 +644,7 @@ push_ignore_pats(char *pattern) +@@ -531,6 +655,7 @@ push_ignore_pats(char *pattern) void print_only(const char *path, size_t dirlen, const char *entry) { @@ -460,7 +471,7 @@ if (dirlen > 1) dirlen--; printf("Only in %.*s: %s\n", (int)dirlen, path, entry); -@@ -539,45 +653,46 @@ print_only(const char *path, size_t dirl +@@ -539,45 +664,46 @@ print_only(const char *path, size_t dirl void print_status(int val, char *path1, char *path2, char *entry) { @@ -518,7 +529,7 @@ break; } } -@@ -585,6 +700,7 @@ print_status(int val, char *path1, char +@@ -585,6 +711,7 @@ print_status(int val, char *path1, char void usage(void) { From owner-svn-soc-all@FreeBSD.ORG Fri Jun 29 18:48:07 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id A7BD1106564A for ; Fri, 29 Jun 2012 18:48:06 +0000 (UTC) (envelope-from gmiller@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 29 Jun 2012 18:48:06 +0000 Date: Fri, 29 Jun 2012 18:48:06 +0000 From: gmiller@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120629184806.A7BD1106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238595 - in soc2012/gmiller/locking-head: . lib/libwitness X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 18:48:07 -0000 Author: gmiller Date: Fri Jun 29 18:48:03 2012 New Revision: 238595 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238595 Log: r238577@FreeBSD-dev: root | 2012-06-20 08:44:55 -0500 Fix NULL-pointer issues in graph insertion. Modified: soc2012/gmiller/locking-head/ (props changed) soc2012/gmiller/locking-head/lib/libwitness/graph.c soc2012/gmiller/locking-head/lib/libwitness/lists.c Modified: soc2012/gmiller/locking-head/lib/libwitness/graph.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/graph.c Fri Jun 29 17:39:40 2012 (r238594) +++ soc2012/gmiller/locking-head/lib/libwitness/graph.c Fri Jun 29 18:48:03 2012 (r238595) @@ -73,9 +73,12 @@ static struct graph_node * lookup_node(void *lock) { - struct graph_node *node; + struct graph_node *node = NULL; + + if (root != NULL) { + node = scan_graph(root, lock); + } - node = scan_graph(root, lock); if (node == NULL) { node = malloc(sizeof(struct graph_node)); node->lock = lock; Modified: soc2012/gmiller/locking-head/lib/libwitness/lists.c ============================================================================== --- soc2012/gmiller/locking-head/lib/libwitness/lists.c Fri Jun 29 17:39:40 2012 (r238594) +++ soc2012/gmiller/locking-head/lib/libwitness/lists.c Fri Jun 29 18:48:03 2012 (r238595) @@ -27,7 +27,7 @@ #include "witness.h" -_Thread_local SLIST_HEAD(lock_head, lock_entry) lock_head = +static _Thread_local SLIST_HEAD(lock_head, lock_entry) lock_head = SLIST_HEAD_INITIALIZER(lock_head); // XXX: temporary debugging code @@ -56,8 +56,8 @@ SLIST_INSERT_HEAD(&lock_head, entry, lock_next); - if (insert_lock(entry, next) < 0) { - /* XXX: LoR */ + if (next != NULL && insert_lock(entry, next) < 0) { + puts("LoR detected."); } printf("inserted lock %p\n", lock); @@ -74,6 +74,7 @@ if (entry->lock == lock) { SLIST_REMOVE(&lock_head, entry, lock_entry, lock_next); free(entry); + break; } } From owner-svn-soc-all@FreeBSD.ORG Fri Jun 29 19:29:24 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 3AB6C1065672 for ; Fri, 29 Jun 2012 19:29:22 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 29 Jun 2012 19:29:22 +0000 Date: Fri, 29 Jun 2012 19:29:22 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120629192922.3AB6C1065672@hub.freebsd.org> Cc: Subject: socsvn commit: r238602 - in soc2012/jhagewood/diff: . diff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 19:29:24 -0000 Author: jhagewood Date: Fri Jun 29 19:29:20 2012 New Revision: 238602 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238602 Log: Modified: soc2012/jhagewood/diff/diff/diffreg.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/diff/diffreg.c ============================================================================== --- soc2012/jhagewood/diff/diff/diffreg.c Fri Jun 29 18:49:14 2012 (r238601) +++ soc2012/jhagewood/diff/diff/diffreg.c Fri Jun 29 19:29:20 2012 (r238602) @@ -94,6 +94,7 @@ # define TIMESPEC_NS(timespec) 0 #endif +#define MAX_CHECK 768 /* * diff - compare two files. */ @@ -1345,20 +1346,25 @@ } /* - * Checks if an open file is a text file. + * Checks if an open file is a text file. Looks at the first 3 kilobytes + * to see if there is a null character. If so, assumes that the files is + * binary. */ static int istextfile(FILE *f) { char buf[BUFSIZ]; - int cnt; + int cnt, check_size; if (aflag || f == NULL) return (1); rewind(f); fread(buf, 1, BUFSIZ, f); - if (cnt = memchr(buf, '\0', BUFSIZ) != NULL) { - printf("%d\n", cnt); + if (BUFSIZ >= MAX_CHECK) + check_size = MAX_CHECK; + else + check_size = BUFSIZ; + if (memchr(buf, '\0', check_size) != NULL) { return (0); } return (1); Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Fri Jun 29 18:49:14 2012 (r238601) +++ soc2012/jhagewood/diff/hagewood-diff.patch Fri Jun 29 19:29:20 2012 (r238602) @@ -674,7 +674,7 @@ extern char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c --- jhagewood/diff/diff-orig/diffreg.c 2012-06-28 18:13:23.286983517 -0400 -+++ jhagewood/diff/diff/diffreg.c 2012-06-28 18:13:23.374983516 -0400 ++++ jhagewood/diff/diff/diffreg.c 2012-06-29 15:23:03.842992142 -0400 @@ -62,15 +62,13 @@ * @(#)diffreg.c 8.1 (Berkeley) 6/6/93 */ @@ -695,7 +695,7 @@ #include #include -@@ -90,6 +88,12 @@ __FBSDID("$FreeBSD"); +@@ -90,6 +88,13 @@ __FBSDID("$FreeBSD"); #include "diff.h" #include "pathnames.h" @@ -705,10 +705,11 @@ +# define TIMESPEC_NS(timespec) 0 +#endif + ++#define MAX_CHECK 768 /* * diff - compare two files. */ -@@ -196,7 +200,7 @@ static void change(char *, FILE *, char +@@ -196,7 +201,7 @@ static void change(char *, FILE *, char static void sort(struct line *, int); static void print_header(const char *, const char *); static int ignoreline(char *); @@ -717,7 +718,7 @@ static int fetch(long *, int, int, FILE *, int, int); static int newcand(int, int, int); static int search(int *, int, int); -@@ -294,13 +298,13 @@ u_char cup2low[256] = { +@@ -294,13 +299,13 @@ u_char cup2low[256] = { int diffreg(char *ofile1, char *ofile2, int flags) { @@ -738,7 +739,7 @@ anychange = 0; lastline = 0; -@@ -353,7 +357,6 @@ diffreg(char *ofile1, char *ofile2, int +@@ -353,7 +358,6 @@ diffreg(char *ofile1, char *ofile2, int status |= 2; goto closem; } @@ -746,7 +747,7 @@ switch (files_differ(f1, f2, flags)) { case 0: goto closem; -@@ -365,7 +368,7 @@ diffreg(char *ofile1, char *ofile2, int +@@ -365,7 +369,7 @@ diffreg(char *ofile1, char *ofile2, int goto closem; } @@ -755,7 +756,7 @@ rval = D_BINARY; status |= 1; goto closem; -@@ -477,8 +480,8 @@ closem: +@@ -477,8 +481,8 @@ closem: static int files_differ(FILE *f1, FILE *f2, int flags) { @@ -766,7 +767,7 @@ if ((flags & (D_EMPTY1|D_EMPTY2)) || stb1.st_size != stb2.st_size || (stb1.st_mode & S_IFMT) != (stb2.st_mode & S_IFMT)) -@@ -503,9 +506,9 @@ files_differ(FILE *f1, FILE *f2, int fla +@@ -503,9 +507,9 @@ files_differ(FILE *f1, FILE *f2, int fla static FILE * opentemp(const char *file) { @@ -779,7 +780,7 @@ if (strcmp(file, "-") == 0) ifd = STDIN_FILENO; -@@ -541,7 +544,7 @@ opentemp(const char *file) +@@ -541,7 +545,7 @@ opentemp(const char *file) char * splice(char *dir, char *file) { @@ -788,7 +789,7 @@ if ((tail = strrchr(file, '/')) == NULL) tail = file; -@@ -555,8 +558,8 @@ static void +@@ -555,8 +559,8 @@ static void prepare(int i, FILE *fd, off_t filesize) { struct line *p; @@ -799,7 +800,7 @@ rewind(fd); -@@ -579,7 +582,7 @@ prepare(int i, FILE *fd, off_t filesize) +@@ -579,7 +583,7 @@ prepare(int i, FILE *fd, off_t filesize) static void prune(void) { @@ -808,7 +809,7 @@ for (pref = 0; pref < len[0] && pref < len[1] && file[0][pref + 1].value == file[1][pref + 1].value; -@@ -600,7 +603,7 @@ prune(void) +@@ -600,7 +604,7 @@ prune(void) static void equiv(struct line *a, int n, struct line *b, int m, int *c) { @@ -817,7 +818,7 @@ i = j = 1; while (i <= n && j <= m) { -@@ -629,7 +632,7 @@ equiv(struct line *a, int n, struct line +@@ -629,7 +633,7 @@ equiv(struct line *a, int n, struct line static int isqrt(int n) { @@ -826,7 +827,7 @@ if (n == 0) return (0); -@@ -647,9 +650,9 @@ isqrt(int n) +@@ -647,9 +651,9 @@ isqrt(int n) static int stone(int *a, int n, int *b, int *c) { @@ -839,7 +840,7 @@ const u_int bound = dflag ? UINT_MAX : MAX(256, isqrt(n)); k = 0; -@@ -705,7 +708,7 @@ newcand(int x, int y, int pred) +@@ -705,7 +709,7 @@ newcand(int x, int y, int pred) static int search(int *c, int k, int y) { @@ -848,7 +849,7 @@ if (clist[c[k]].y < y) /* quick look for typical case */ return (k + 1); -@@ -730,7 +733,7 @@ static void +@@ -730,7 +734,7 @@ static void unravel(int p) { struct cand *q; @@ -857,7 +858,7 @@ for (i = 0; i <= len[0]; i++) J[i] = i <= pref ? i : -@@ -748,9 +751,10 @@ unravel(int p) +@@ -748,9 +752,10 @@ unravel(int p) static void check(char *file1, FILE *f1, char *file2, FILE *f2) { @@ -871,7 +872,7 @@ rewind(f1); rewind(f2); j = 1; -@@ -766,7 +770,7 @@ check(char *file1, FILE *f1, char *file2 +@@ -766,7 +771,7 @@ check(char *file1, FILE *f1, char *file2 ixnew[j] = ctnew += skipline(f2); j++; } @@ -880,7 +881,7 @@ for (;;) { c = getc(f1); d = getc(f2); -@@ -781,6 +785,7 @@ check(char *file1, FILE *f1, char *file2 +@@ -781,6 +786,7 @@ check(char *file1, FILE *f1, char *file2 } ctold++; ctnew++; @@ -888,7 +889,7 @@ if (bflag && isspace(c) && isspace(d)) { do { if (c == '\n') -@@ -792,6 +797,7 @@ check(char *file1, FILE *f1, char *file2 +@@ -792,6 +798,7 @@ check(char *file1, FILE *f1, char *file2 break; ctnew++; } while (isspace(d = getc(f2))); @@ -896,7 +897,7 @@ } else if (wflag) { while (isspace(c) && c != '\n') { c = getc(f1); -@@ -801,31 +807,62 @@ check(char *file1, FILE *f1, char *file2 +@@ -801,31 +808,62 @@ check(char *file1, FILE *f1, char *file2 d = getc(f2); ctnew++; } @@ -974,7 +975,7 @@ if (chrtran[c] != chrtran[d]) { jackpot++; J[i] = 0; -@@ -872,7 +909,7 @@ static void +@@ -872,7 +910,7 @@ static void sort(struct line *a, int n) { struct line *ai, *aim, w; @@ -983,7 +984,7 @@ if (n == 0) return; -@@ -916,7 +953,7 @@ unsort(struct line *f, int l, int *b) +@@ -916,7 +954,7 @@ unsort(struct line *f, int l, int *b) static int skipline(FILE *f) { @@ -992,7 +993,7 @@ for (i = 1; (c = getc(f)) != '\n' && c != EOF; i++) continue; -@@ -926,7 +963,7 @@ skipline(FILE *f) +@@ -926,7 +964,7 @@ skipline(FILE *f) static void output(char *file1, FILE *f1, char *file2, FILE *f2, int flags) { @@ -1001,7 +1002,7 @@ rewind(f1); rewind(f2); -@@ -965,7 +1002,7 @@ output(char *file1, FILE *f1, char *file +@@ -965,7 +1003,7 @@ output(char *file1, FILE *f1, char *file #define c i0 if ((c = getc(f1)) == EOF) return; @@ -1010,7 +1011,7 @@ } #undef c } -@@ -980,6 +1017,7 @@ output(char *file1, FILE *f1, char *file +@@ -980,6 +1018,7 @@ output(char *file1, FILE *f1, char *file static void range(int a, int b, char *separator) { @@ -1018,7 +1019,7 @@ printf("%d", a > b ? b : a); if (a < b) printf("%s%d", separator, b); -@@ -988,6 +1026,7 @@ range(int a, int b, char *separator) +@@ -988,6 +1027,7 @@ range(int a, int b, char *separator) static void uni_range(int a, int b) { @@ -1026,7 +1027,7 @@ if (a < b) printf("%d,%d", a, b - a + 1); else if (a == b) -@@ -999,22 +1038,22 @@ uni_range(int a, int b) +@@ -999,22 +1039,22 @@ uni_range(int a, int b) static char * preadline(int fd, size_t len, off_t off) { @@ -1053,7 +1054,7 @@ ret = regexec(&ignore_re, line, 0, NULL, 0); free(line); -@@ -1032,8 +1071,8 @@ static void +@@ -1032,8 +1072,8 @@ static void change(char *file1, FILE *f1, char *file2, FILE *f2, int a, int b, int c, int d, int *pflags) { @@ -1064,7 +1065,7 @@ restart: if (format != D_IFDEF && a > b && c > d) -@@ -1113,15 +1152,15 @@ proceed: +@@ -1113,15 +1153,15 @@ proceed: case D_NORMAL: case D_EDIT: range(a, b, ","); @@ -1084,7 +1085,7 @@ break; case D_NREVERSE: if (a > b) -@@ -1137,7 +1176,7 @@ proceed: +@@ -1137,7 +1177,7 @@ proceed: if (format == D_NORMAL || format == D_IFDEF) { fetch(ixold, a, b, f1, '<', 1); if (a <= b && c <= d && format == D_NORMAL) @@ -1093,7 +1094,7 @@ } i = fetch(ixnew, c, d, f2, format == D_NORMAL ? '>' : '\0', 0); if (i != 0 && format == D_EDIT) { -@@ -1148,14 +1187,14 @@ proceed: +@@ -1148,14 +1188,14 @@ proceed: * it. We have to add a substitute command to change this * back and restart where we left off. */ @@ -1110,7 +1111,7 @@ if (inifdef) { printf("#endif /* %s */\n", ifdefname); inifdef = 0; -@@ -1165,8 +1204,8 @@ proceed: +@@ -1165,8 +1205,8 @@ proceed: static int fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile) { @@ -1121,7 +1122,7 @@ /* * When doing #ifdef's, copy down to current line -@@ -1177,7 +1216,7 @@ fetch(long *f, int a, int b, FILE *lb, i +@@ -1177,7 +1217,7 @@ fetch(long *f, int a, int b, FILE *lb, i /* print through if append (a>b), else to (nb: 0 vs 1 orig) */ nc = f[a > b ? b : a - 1] - curpos; for (i = 0; i < nc; i++) @@ -1130,7 +1131,7 @@ } if (a > b) return (0); -@@ -1197,12 +1236,12 @@ fetch(long *f, int a, int b, FILE *lb, i +@@ -1197,12 +1237,12 @@ fetch(long *f, int a, int b, FILE *lb, i fseek(lb, f[i - 1], SEEK_SET); nc = f[i] - f[i - 1]; if (format != D_IFDEF && ch != '\0') { @@ -1146,7 +1147,7 @@ } col = 0; for (j = 0, lastc = '\0'; j < nc; j++, lastc = c) { -@@ -1211,13 +1250,13 @@ fetch(long *f, int a, int b, FILE *lb, i +@@ -1211,13 +1251,13 @@ fetch(long *f, int a, int b, FILE *lb, i format == D_NREVERSE) warnx("No newline at end of file"); else @@ -1162,7 +1163,7 @@ } while (++col < newcol); } else { if (format == D_EDIT && j == 1 && c == '\n' -@@ -1229,10 +1268,10 @@ fetch(long *f, int a, int b, FILE *lb, i +@@ -1229,10 +1269,10 @@ fetch(long *f, int a, int b, FILE *lb, i * giving the caller an offset * from which to restart. */ @@ -1175,7 +1176,7 @@ col++; } } -@@ -1246,8 +1285,8 @@ fetch(long *f, int a, int b, FILE *lb, i +@@ -1246,8 +1286,8 @@ fetch(long *f, int a, int b, FILE *lb, i static int readhash(FILE *f) { @@ -1186,12 +1187,14 @@ sum = 1; space = 0; -@@ -1305,20 +1344,23 @@ readhash(FILE *f) +@@ -1305,20 +1345,28 @@ readhash(FILE *f) return (sum == 0 ? 1 : sum); } +/* -+ * Checks if an open file is a text file. ++ * Checks if an open file is a text file. Looks at the first 3 kilobytes ++ * to see if there is a null character. If so, assumes that the files is ++ * binary. + */ static int -asciifile(FILE *f) @@ -1200,7 +1203,7 @@ - char buf[BUFSIZ]; - int i, cnt; + char buf[BUFSIZ]; -+ int cnt; ++ int cnt, check_size; if (aflag || f == NULL) return (1); @@ -1211,14 +1214,17 @@ - if (!isprint(buf[i]) && !isspace(buf[i])) - return (0); + fread(buf, 1, BUFSIZ, f); -+ if (cnt = memchr(buf, '\0', BUFSIZ) != NULL) { -+ printf("%d\n", cnt); ++ if (BUFSIZ >= MAX_CHECK) ++ check_size = MAX_CHECK; ++ else ++ check_size = BUFSIZ; ++ if (memchr(buf, '\0', check_size) != NULL) { + return (0); + } return (1); } -@@ -1327,10 +1369,10 @@ asciifile(FILE *f) +@@ -1327,10 +1375,10 @@ asciifile(FILE *f) static char * match_function(const long *f, int pos, FILE *file) { @@ -1233,7 +1239,7 @@ lastline = pos; while (pos > last) { -@@ -1342,7 +1384,6 @@ match_function(const long *f, int pos, F +@@ -1342,7 +1390,6 @@ match_function(const long *f, int pos, F if (nc > 0) { buf[nc] = '\0'; buf[strcspn(buf, "\n")] = '\0'; @@ -1241,7 +1247,7 @@ if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') { if (begins_with(buf, "private:")) { if (!state) -@@ -1373,9 +1414,9 @@ static void +@@ -1373,9 +1420,9 @@ static void dump_context_vec(FILE *f1, FILE *f2) { struct context_vec *cvp = context_vec_start; @@ -1254,7 +1260,7 @@ if (context_vec_start > context_vec_ptr) return; -@@ -1390,8 +1431,8 @@ dump_context_vec(FILE *f1, FILE *f2) +@@ -1390,8 +1437,8 @@ dump_context_vec(FILE *f1, FILE *f2) if (pflag) { f = match_function(ixold, lowa-1, f1); if (f != NULL) { @@ -1265,7 +1271,7 @@ } } printf("\n*** "); -@@ -1478,9 +1519,9 @@ static void +@@ -1478,9 +1525,9 @@ static void dump_unified_vec(FILE *f1, FILE *f2) { struct context_vec *cvp = context_vec_start; @@ -1278,7 +1284,7 @@ if (context_vec_start > context_vec_ptr) return; -@@ -1491,19 +1532,19 @@ dump_unified_vec(FILE *f1, FILE *f2) +@@ -1491,19 +1538,19 @@ dump_unified_vec(FILE *f1, FILE *f2) lowc = MAX(1, cvp->c - context); upd = MIN(len[1], context_vec_ptr->d + context); @@ -1304,7 +1310,7 @@ /* * Output changes in "unified" diff format--the old and new lines -@@ -1551,16 +1592,43 @@ dump_unified_vec(FILE *f1, FILE *f2) +@@ -1551,16 +1598,43 @@ dump_unified_vec(FILE *f1, FILE *f2) static void print_header(const char *file1, const char *file2) { From owner-svn-soc-all@FreeBSD.ORG Fri Jun 29 20:12:26 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 196D2106566B for ; Fri, 29 Jun 2012 20:12:24 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 29 Jun 2012 20:12:24 +0000 Date: Fri, 29 Jun 2012 20:12:24 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120629201224.196D2106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238605 - soc2012/oleksandr/udf-head/sys/fs/udf2 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 20:12:26 -0000 Author: oleksandr Date: Fri Jun 29 20:12:23 2012 New Revision: 238605 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238605 Log: Fix style of return operator, remove unused code in udf_read_anchors, and add missing brackets Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vnops.c Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c Fri Jun 29 19:51:06 2012 (r238604) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c Fri Jun 29 20:12:23 2012 (r238605) @@ -176,13 +176,13 @@ error = VOP_IOCTL(devvp, MMCGETDISCINFO, di, FKIOCTL, NOCRED, td); if (error == 0) { udf_dump_discinfo(ump); - return 0; + return (0); } #if 0 /* disc partition support */ error = VOP_IOCTL(devvp, DIOCGPART, &dpart, FREAD, NOCRED, td); if (error) - return ENODEV; + return (ENODEV); #endif /* set up a disc info profile for partitions */ di->mmc_profile = 0x01; /* disc type */ @@ -208,7 +208,7 @@ di->first_track_last_session = di->last_track_last_session = 1; udf_dump_discinfo(ump); - return 0; + return (0); } @@ -227,12 +227,12 @@ if (class != MMC_CLASS_DISC) { /* tracknr specified in struct ti */ error = VOP_IOCTL(devvp, MMCGETTRACKINFO, ti, FKIOCTL, NOCRED, td); - return error; + return (error); } /* disc partition support */ if (ti->tracknr != 1) - return EIO; + return (EIO); /* create fake ti (TODO check for resized vnds) */ ti->sessionnr = 1; @@ -250,7 +250,7 @@ ti->last_recorded = ti->next_writable; ti->free_blocks = 0; - return 0; + return (0); } #if 0 @@ -261,7 +261,7 @@ int error; if (ump->discinfo.mmc_class == MMC_CLASS_DISC) - return 0; + return (0); /* * only CD burning normally needs setting up, but other disc types @@ -292,7 +292,7 @@ error = VOP_IOCTL(ump->devvp, MMCSETUPWRITEPARAMS, &mmc_writeparams, FKIOCTL, NOCRED); } - return error; + return (error); } @@ -304,11 +304,11 @@ DPRINTF(CALL, ("udf_synchronise_caches()\n")); if (ump->vfs_mountp->mnt_flag & MNT_RDONLY) - return 0; + return (0); /* discs are done now */ if (ump->discinfo.mmc_class == MMC_CLASS_DISC) - return 0; + return (0); memset(&mmc_op, 0, sizeof(struct mmc_op)); mmc_op.operation = MMC_OP_SYNCHRONISECACHE; @@ -316,7 +316,7 @@ /* ignore return code */ (void) VOP_IOCTL(ump->devvp, MMCOP, &mmc_op, FKIOCTL, NOCRED); - return 0; + return (0); } /* --------------------------------------------------------------------- */ @@ -362,7 +362,7 @@ trackinfo.tracknr = tracknr; error = udf_update_trackinfo(ump, &trackinfo); if (error) - return error; + return (error); if (trackinfo.sessionnr == args->sessionnr) break; @@ -387,11 +387,11 @@ if (*last_tracknr < *first_tracknr) { printf( "udf_search_tracks: sanity check on drive+disc failed, " "drive returned garbage\n"); - return EINVAL; + return (EINVAL); } /* assert(*last_tracknr >= *first_tracknr); */ - return 0; + return (0); } #if 0 @@ -511,7 +511,7 @@ /* update discinfo since it might have changed */ error = udf_update_discinfo(ump); if (error) - return error; + return (error); num_tracks = ump->discinfo.num_tracks; start_track = ump->discinfo.first_track; @@ -520,7 +520,7 @@ trackinfo.tracknr = start_track; error = udf_update_trackinfo(ump, &trackinfo); if (error) - return error; + return (error); /* copy results to our mount point */ ump->data_track = trackinfo; @@ -528,14 +528,14 @@ /* if not sequential, we're done */ if (num_tracks == 1) - return 0; + return (0); for (tracknr = start_track;tracknr <= num_tracks; tracknr++) { /* get track info */ trackinfo.tracknr = tracknr; error = udf_update_trackinfo(ump, &trackinfo); if (error) - return error; + return (error); /* * If this track is marked damaged, ask for repair. This is an @@ -555,7 +555,7 @@ /* reget track info */ error = udf_update_trackinfo(ump, &trackinfo); if (error) - return error; + return (error); } if ((trackinfo.flags & MMC_TRACKINFO_NWA_VALID) == 0) continue; @@ -583,12 +583,12 @@ } if ((ump->data_track.flags & MMC_TRACKINFO_NWA_VALID) == 0) - return EROFS; + return (EROFS); if ((ump->metadata_track.flags & MMC_TRACKINFO_NWA_VALID) == 0) - return EROFS; + return (EROFS); - return 0; + return (0); } #endif @@ -617,10 +617,10 @@ } if (sum != tag->cksum) { /* bad tag header checksum; this is not a valid tag */ - return EINVAL; + return (EINVAL); } - return 0; + return (0); } @@ -639,18 +639,18 @@ /* check payload CRC if applicable */ if (crc_len == 0) - return 0; + return (0); if (crc_len > max_length) - return EIO; + return (EIO); crc = udf_cksum(((uint8_t *) tag) + UDF_DESC_TAG_LENGTH, crc_len); if (crc != le16toh(tag->desc_crc)) { /* bad payload CRC; this is a broken tag */ - return EINVAL; + return (EINVAL); } - return 0; + return (0); } @@ -773,7 +773,7 @@ size = UDF_FID_SIZE + fid->l_fi + le16toh(fid->l_iu); size = (size + 3) & ~3; - return size; + return (size); } /* --------------------------------------------------------------------- */ @@ -831,7 +831,7 @@ if (!error) { /* blank terminator blocks are not allowed here */ if (*dst == NULL) - return ENOENT; + return (ENOENT); if (le16toh((*dst)->tag.id) != TAGID_ANCHOR) { error = ENOENT; free(*dst, M_UDFTEMP); @@ -839,7 +839,7 @@ } } - return error; + return (error); } void @@ -896,7 +896,7 @@ } if (error) { printf("UDF mount: reading disc geometry failed\n"); - return 0; + return (0); } track_start = first_track.track_start; @@ -941,43 +941,6 @@ int udf_read_anchors(struct udf_mount *ump) { -#if 0 - struct anchor_vdp **anchorsp; - int error, anch, ok, first_anchor; - uint32_t positions[4], track_start, track_end; - - track_start = ump->session_start; - track_end = ump->session_end; - - /* read anchors start+256, start+512, end-256, end */ - positions[0] = track_start+256; - if (track_end) { - positions[1] = track_end-256; - positions[2] = track_end; - } else { - positions[1] = 0; - positions[2] = 0; - } - positions[3] = track_start+512; /* [UDF 2.60/6.11.2] */ - /* XXX shouldn't +512 be prefered above +256 for compat with Roxio CD */ - - ok = 0; - anchorsp = ump->anchors; - first_anchor = 0; - if (ump->first_trackblank) - first_anchor = 1; - for (anch = first_anchor; anch < 4; anch++) { - if (positions[anch]) { - error = udf_read_anchor(ump, positions[anch], anchorsp); - if (!error) { - anchorsp++; - ok++; - } - } - } - - return ok; -#endif struct udf_args *args = &ump->mount_args; struct mmc_trackinfo first_track; struct mmc_trackinfo second_track; @@ -1005,7 +968,7 @@ } if (error) { printf("UDF mount: reading disc geometry failed\n"); - return 0; + return (0); } track_start = first_track.track_start; @@ -1063,7 +1026,7 @@ ump->first_possible_vat_location = track_start + 2; ump->last_possible_vat_location = track_end + last_track.packet_size; - return ok; + return (ok); } /* --------------------------------------------------------------------- */ @@ -1080,7 +1043,7 @@ if (udf_node == udf_node->ump->metadatabitmap_node) what = UDF_C_METADATA_SBM; - return what; + return (what); } @@ -1095,7 +1058,7 @@ if (udf_c_type == UDF_C_FIDS) vpart_num = ump->fids_part; - return vpart_num; + return (vpart_num); } #endif @@ -1221,9 +1184,10 @@ /* dscr is assigned into ump */ error = udf_process_vds_descriptor(ump, dscr); - if (error) + if (error) { free(dscr, M_UDFTEMP); break; + } /* assert((dscr_size % sector_size) == 0); */ len -= dscr_size; @@ -1384,7 +1348,7 @@ error = ENOENT; ump->logvol_integrity = lvint; - return error; + return (error); } #if 0 @@ -1541,7 +1505,7 @@ free(bufs, M_UDFTEMP); - return 0; + return (0); } @@ -1579,17 +1543,17 @@ if ((space < 3) && (lvflag & UDF_APPENDONLY_LVINT)) { /* don't allow this logvol to be opened */ /* TODO extent LVINT space if possible */ - return EROFS; + return (EROFS); } } if (space < 1) { if (lvflag & UDF_APPENDONLY_LVINT) - return EROFS; + return (EROFS); /* loose history by re-writing extents */ error = udf_loose_lvint_history(ump); if (error) - return error; + return (error); goto again; } @@ -1608,7 +1572,7 @@ sector, sector); DPRINTF(VOLUMES, ("writeout lvint : error = %d\n", error)); if (error) - return error; + return (error); /* advance write position */ trace->wpos++; space--; @@ -1627,7 +1591,7 @@ DPRINTF(VOLUMES, ("finished writing out logvol integrity descriptor " "successfull\n")); - return error; + return (error); } /* --------------------------------------------------------------------- */ @@ -1679,12 +1643,12 @@ printf( "UDF mount: error reading unallocated " "space bitmap\n"); - return EROFS; + return (EROFS); } } else { /* blank not allowed */ printf("UDF mount: blank unallocated space bitmap\n"); - return EROFS; + return (EROFS); } } @@ -1698,7 +1662,7 @@ len = le32toh(parthdr->unalloc_space_table.len); if (len) { printf("UDF mount: space tables not supported\n"); - return EROFS; + return (EROFS); } } @@ -1738,12 +1702,12 @@ printf( "UDF mount: error reading freed " "space bitmap\n"); - return EROFS; + return (EROFS); } } else { /* blank not allowed */ printf("UDF mount: blank freed space bitmap\n"); - return EROFS; + return (EROFS); } } @@ -1757,11 +1721,11 @@ len = le32toh(parthdr->freed_space_table.len); if (len) { printf("UDF mount: space tables not supported\n"); - return EROFS; + return (EROFS); } } - return 0; + return (0); } @@ -1829,7 +1793,7 @@ } } - return error_all; + return (error_all); } #endif @@ -1847,7 +1811,7 @@ /* only read in when metadata bitmap node is read in */ if (bitmap_node == NULL) - return 0; + return (0); if (bitmap_node->fe) { inflen = le64toh(bitmap_node->fe->inf_len); @@ -1862,7 +1826,7 @@ /* allocate space for bitmap */ dscr = malloc(inflen, M_UDFTEMP, M_WAITOK); /*M_CANFAIL was removed from third param*/ if (!dscr) - return ENOMEM; + return (ENOMEM); /* set vnode type to regular file or we can't read from it! */ bitmap_node->vnode->v_type = VREG; @@ -1899,13 +1863,13 @@ goto errorout; } - return 0; + return (0); errorout: free(dscr, M_UDFTEMP); printf( "UDF mount: error reading unallocated " "space bitmap for metadata partition\n"); - return EROFS; + return (EROFS); } @@ -1921,7 +1885,7 @@ /* only write out when metadata bitmap node is known */ if (bitmap_node == NULL) - return 0; + return (0); if (bitmap_node->fe) { inflen = le64toh(bitmap_node->fe->inf_len); @@ -1958,7 +1922,7 @@ printf( "Error writing out metadata partition unalloced " "space bitmap!\n"); - return error; + return (error); } #endif @@ -2244,7 +2208,7 @@ (ump->strategy == &udf_strat_rmw) ? "RMW" : "UNKNOWN!")); #endif /* signal its OK for now */ - return 0; + return (0); } /* --------------------------------------------------------------------- */ @@ -2305,7 +2269,7 @@ ump->logvol_integrity->lvint_next_unique_id = htole64(unique_id + 1); mutex_exit(&ump->logvol_mutex); - return unique_id; + return (unique_id); } @@ -2410,7 +2374,7 @@ fid->tag.desc_crc_len = htole16(fidsize - UDF_DESC_TAG_LENGTH); (void) udf_validate_tag_and_crc_sums((union dscrptr *) fid); - return fidsize; + return (fidsize); } #endif /* --------------------------------------------------------------------- */ @@ -2447,9 +2411,9 @@ /* checksum valid? */ spos = (uint16_t *) implext->data; if (le16toh(*spos) != udf_ea_cksum((uint8_t *) implext)) - return EINVAL; + return (EINVAL); } - return 0; + return (0); } static void @@ -2479,7 +2443,7 @@ uint8_t *pos; /* get mountpoint */ - sector_size = node->ump->sector_size; + sector_size = node->ump->discinfo.sector_size; /* get information from fe/efe */ if (node->fe) { @@ -2492,17 +2456,17 @@ /* something recorded here? */ if (l_ea == 0) - return ENOENT; + return (ENOENT); /* check extended attribute tag; what to do if it fails? */ error = udf_check_tag(eahdr); if (error) - return EINVAL; + return (EINVAL); if (le16toh(eahdr->tag.id) != TAGID_EXTATTR_HDR) - return EINVAL; + return (EINVAL); error = udf_check_tag_payload(eahdr, sizeof(struct extattrhdr_desc)); if (error) - return EINVAL; + return (EINVAL); /* looking for Ecma-167 attributes? */ offset = sizeof(struct extattrhdr_desc); @@ -2511,17 +2475,17 @@ if (sattr == 2048) { /* [4/48.10.8] */ offset = le32toh(eahdr->impl_attr_loc); if (offset == UDF_IMPL_ATTR_LOC_NOT_PRESENT) - return ENOENT; + return (ENOENT); } if (sattr == 65536) { /* [4/48.10.9] */ offset = le32toh(eahdr->appl_attr_loc); if (offset == UDF_APPL_ATTR_LOC_NOT_PRESENT) - return ENOENT; + return (ENOENT); } /* paranoia check offset and l_ea */ if (l_ea + offset >= sector_size - sizeof(struct extattr_entry)) - return EINVAL; + return (EINVAL); /* find our extended attribute */ l_ea -= offset; @@ -2534,7 +2498,7 @@ /* get complete attribute length and check for roque values */ a_l = le32toh(attrhdr->a_l); if ((a_l == 0) || (a_l > l_ea)) - return EINVAL; + return (EINVAL); if (attrhdr->type != sattr) goto next_attribute; @@ -2543,7 +2507,7 @@ if (attrhdr->type < 2048) { /* Ecma-167 attribute */ *offsetp = offset; *lengthp = a_l; - return 0; /* success */ + return (0); /* success */ } /* @@ -2557,7 +2521,7 @@ /* we have found our appl/implementation attribute */ *offsetp = offset; *lengthp = a_l; - return 0; /* success */ + return (0); /* success */ } next_attribute: @@ -2567,7 +2531,7 @@ offset += a_l; } /* not found */ - return ENOENT; + return (ENOENT); } @@ -2711,16 +2675,16 @@ error = udf_extattr_search_intern(vat_node, 2048, extstr, &offset, &a_l); if (error) - return error; + return (error); implext = (struct impl_extattr_entry *) (ea_start + offset); error = udf_impl_extattr_check(implext); if (error) - return error; + return (error); /* paranoia */ if (a_l != sizeof(*implext) -1 + le32toh(implext->iu_l) + sizeof(lvext)) - return EINVAL; + return (EINVAL); /* * we have found our "VAT LVExtension attribute. BUT due to a @@ -2742,7 +2706,7 @@ udf_calc_impl_extattr_checksum(implext); } - return 0; + return (0); } #if 0 @@ -2774,7 +2738,7 @@ error = udf_extattr_search_intern(vat_node, 2048, extstr, &offset, &a_l); if (error) - return error; + return (error); /* found, it existed */ /* paranoia */ @@ -2782,7 +2746,7 @@ error = udf_impl_extattr_check(implext); if (error) { DPRINTF(VOLUMES, ("VAT LVExtension bad on update\n")); - return error; + return (error); } /* it is correct */ @@ -2801,7 +2765,7 @@ memcpy(lvextpos, &lvext, sizeof(lvext)); - return 0; + return (0); } #endif /* --------------------------------------------------------------------- */ @@ -2813,11 +2777,11 @@ /* mutex_enter(&ump->allocate_mutex); */ if (offset + size > ump->vat_offset + ump->vat_entries * 4) - return EINVAL; + return (EINVAL); memcpy(blob, ump->vat_table + offset, size); /* mutex_exit(&ump->allocate_mutex); */ - return 0; + return (0); } #if 0 @@ -2837,7 +2801,7 @@ M_UDFTEMP, M_WAITOK | M_CANFAIL); if (!new_vat_table) { printf("udf_vat_write: can't extent VAT, out of mem\n"); - return ENOMEM; + return (ENOMEM); } ump->vat_table = new_vat_table; ump->vat_table_alloc_len += UDF_VAT_CHUNKSIZE; @@ -2845,7 +2809,7 @@ ump->vat_table_len = MAX(ump->vat_table_len, offset_high); memcpy(ump->vat_table + offset, blob, size); - return 0; + return (0); } /* --------------------------------------------------------------------- */ @@ -2925,7 +2889,7 @@ } free(raw_vat, M_UDFTEMP); - return error; /* success! */ + return (error); /* success! */ } @@ -2962,7 +2926,7 @@ printf("udf_writeout_vat: error writing VAT node!\n"); out: - return error; + return (error); } #endif @@ -2992,7 +2956,7 @@ /* vat_length is really 64 bits though impossible */ if (!vat_node) - return ENOENT; + return (ENOENT); /* get mount info */ ump = vat_node->ump; @@ -3021,7 +2985,7 @@ /* Check icb filetype! it has to be 0 or UDF_ICB_FILETYPE_VAT */ filetype = icbtag->file_type; if ((filetype != 0) && (filetype != UDF_ICB_FILETYPE_VAT)) - return ENOENT; + return (ENOENT); vat_table_alloc_len = ((vat_length + UDF_VAT_CHUNKSIZE-1) / UDF_VAT_CHUNKSIZE) @@ -3033,7 +2997,7 @@ if (vat_table == NULL) { printf("allocation of %d bytes failed for VAT\n", vat_table_alloc_len); - return ENOMEM; + return (ENOMEM); } #endif @@ -3137,7 +3101,7 @@ } free(raw_vat, M_UDFTEMP); - return error; + return (error); } /* --------------------------------------------------------------------- */ @@ -3205,7 +3169,7 @@ /* keep our VAT node around */ ump->vat_node = vat_node; - return error; + return (error); } /* --------------------------------------------------------------------- */ @@ -3244,9 +3208,9 @@ } if (ump->sparing_table) - return 0; + return (0); - return ENOENT; + return (ENOENT); } /* --------------------------------------------------------------------- */ @@ -3325,7 +3289,7 @@ } /* DPRINTFIF(VOLUMES, error, ("udf mount: failed to read " "metadata files\n")); */ - return error; + return (error); } /* --------------------------------------------------------------------- */ @@ -3353,19 +3317,19 @@ /* search and load VAT */ error = udf_search_vat(ump, mapping); if (error) - return ENOENT; + return (ENOENT); break; case UDF_VTOP_TYPE_SPARABLE : /* load one of the sparable tables */ error = udf_read_sparables(ump, mapping); if (error) - return ENOENT; + return (ENOENT); break; case UDF_VTOP_TYPE_META : /* load the associated file descriptors */ error = udf_read_metadata_nodes(ump, mapping); if (error) - return ENOENT; + return (ENOENT); break; default: break; @@ -3379,14 +3343,14 @@ if ((ump->vfs_mountp->mnt_flag & MNT_RDONLY) == 0) { error = udf_read_physical_partition_spacetables(ump); if (error) - return error; + return (error); /* also read in metadata partition spacebitmap if defined */ error = udf_read_metadata_partition_spacetable(ump); return error; } #endif - return 0; + return (0); } /* --------------------------------------------------------------------- */ @@ -3429,7 +3393,7 @@ break; if (dscr_type != TAGID_FSD) { free(dscr, M_UDFTEMP); - return ENOENT; + return (ENOENT); } /* @@ -3461,7 +3425,7 @@ /* there has to be one */ if (ump->fileset_desc == NULL) - return ENOENT; + return (ENOENT); DPRINTF(VOLUMES, ("FSD read in fine\n")); DPRINTF(VOLUMES, ("Updating fsd logical volume id\n")); @@ -3482,7 +3446,7 @@ ino = udf_get_node_id(dir_loc); error = udf_vget(mp, ino, LK_EXCLUSIVE, &rootdir_node); if (error) - return ENOENT; + return (ENOENT); /* aparently it read in fine */ @@ -3514,7 +3478,7 @@ vput(rootdir_node); } - return 0; + return (0); } /* --------------------------------------------------------------------- */ @@ -3542,7 +3506,7 @@ ino = (blkn + 1) | (part << 29); //printf("Raw blkno: %u, raw part: %u\n", icbptr->loc.lb_num, icbptr->loc.part_num); //printf("udf_get_node_id -- blkno: %u, part: %u, ino: %u\n", blkn, part, ino); - return ino; + return (ino); } int @@ -3561,7 +3525,7 @@ //printf("Raw blkno: %u, raw part: %u\n", icbptr->loc.lb_num, icbptr->loc.part_num); //printf("udf_get_node_longad -- blkno: %u, part: %u, ino: %u\n", blkn, part, ino2); - return 0; + return (0); } #if 0 @@ -3569,16 +3533,16 @@ udf_compare_icb(const struct long_ad *a, const struct long_ad *b) { if (le16toh(a->loc.part_num) < le16toh(b->loc.part_num)) - return -1; + return (-1); if (le16toh(a->loc.part_num) > le16toh(b->loc.part_num)) - return 1; + return (1); if (le32toh(a->loc.lb_num) < le32toh(b->loc.lb_num)) - return -1; + return (-1); if (le32toh(a->loc.lb_num) > le32toh(b->loc.lb_num)) - return 1; + return (1); - return 0; + return (0); } @@ -3588,7 +3552,7 @@ struct udf_node *a_node = RBTOUDFNODE(a); struct udf_node *b_node = RBTOUDFNODE(b); - return udf_compare_icb(&a_node->loc, &b_node->loc); + return (udf_compare_icb(&a_node->loc, &b_node->loc)); } @@ -3598,7 +3562,7 @@ struct udf_node *a_node = RBTOUDFNODE(a); const struct long_ad * const icb = key; - return udf_compare_icb(&a_node->loc, icb); + return (udf_compare_icb(&a_node->loc, icb)); } @@ -3634,11 +3598,11 @@ mutex_exit(&ump->ihash_lock); if (vget(vp, LK_EXCLUSIVE)) goto loop; - return udf_node; + return (udf_node); } mutex_exit(&ump->ihash_lock); - return NULL; + return (NULL); } @@ -3680,11 +3644,11 @@ /* disc appendable? */ if (ump->discinfo.disc_state == MMC_STATE_FULL) - return EROFS; + return (EROFS); /* already written here? if so, there should be an ISO VDS */ if (ump->discinfo.last_session_state == MMC_STATE_INCOMPLETE) - return 0; + return (0); /* * Check if the first track of the session is blank and if so, copy or @@ -3696,7 +3660,7 @@ trackinfo.tracknr = tracknr; error = udf_update_trackinfo(ump, &trackinfo); if (error) - return error; + return (error); udf_dump_trackinfo(&trackinfo); KASSERT(trackinfo.flags & (MMC_TRACKINFO_BLANK | MMC_TRACKINFO_RESERVED)); @@ -3716,13 +3680,13 @@ trackinfo.tracknr = tracknr; error = udf_update_trackinfo(ump, &trackinfo); if (error) - return error; + return (error); if (trackinfo.sessionnr == sessionnr) break; tracknr++; } if (trackinfo.sessionnr != sessionnr) - return ENOENT; + return (ENOENT); udf_dump_trackinfo(&trackinfo); @@ -3840,7 +3804,7 @@ /* synchronise device caches */ (void) udf_synchronise_caches(ump); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-soc-all@FreeBSD.ORG Fri Jun 29 21:15:55 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id AA595106564A for ; Fri, 29 Jun 2012 21:15:53 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 29 Jun 2012 21:15:53 +0000 Date: Fri, 29 Jun 2012 21:15:53 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120629211553.AA595106564A@hub.freebsd.org> Cc: Subject: socsvn commit: r238607 - soc2012/oleksandr/udf-head/sys/fs/udf2 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 21:15:55 -0000 Author: oleksandr Date: Fri Jun 29 21:15:53 2012 New Revision: 238607 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238607 Log: change field sector_size in struct udf_mount to appropriate field in mmc_discinfo, and remove unused fields in udf_mount Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf.h soc2012/oleksandr/udf-head/sys/fs/udf2/udf_readwrite.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vnops.c Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf.h ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf.h Fri Jun 29 20:15:00 2012 (r238606) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf.h Fri Jun 29 21:15:53 2012 (r238607) @@ -256,7 +256,6 @@ struct g_consumer *geomcp; struct bufobj *bo; struct mmc_discinfo discinfo; - uint32_t sector_size; struct udf_args mount_args; int flags; @@ -266,11 +265,6 @@ void *iconv_l2d; /* local to disk */ #endif - /* Used in mounting */ - uint32_t first_trackblank; - uint32_t session_start; - uint32_t session_end; - /* format descriptors */ /* kmutex_t logvol_mutex; */ /* Who needs locks... */ struct anchor_vdp *anchors[UDF_ANCHORS]; /* anchors to VDS */ Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_readwrite.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_readwrite.c Fri Jun 29 20:15:00 2012 (r238606) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_readwrite.c Fri Jun 29 21:15:53 2012 (r238607) @@ -261,7 +261,7 @@ uint32_t sector_size, blkinsect, fileblk, fileblkoff, numlsect, numb; uint8_t *pos; - sector_size = unode->ump->sector_size; + sector_size = unode->ump->discinfo.sector_size; blkinsect = sector_size / DEV_BSIZE; if (unode->fe) { @@ -336,7 +336,7 @@ uint32_t sector_size, blks; /* buf_offset; */ struct vnode *devvp = ump->devvp; - sector_size = ump->sector_size; + sector_size = ump->discinfo.sector_size; blks = btodb(sector_size); while (sectors > 0 && error == 0) { @@ -418,7 +418,7 @@ int sectors, dscrlen, i, error, sector_size; uint8_t *pos; - sector_size = ump->sector_size; + sector_size = ump->discinfo.sector_size; *dstp = dst = NULL; dscrlen = sector_size; Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c Fri Jun 29 20:15:00 2012 (r238606) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_subr.c Fri Jun 29 21:15:53 2012 (r238607) @@ -1970,7 +1970,7 @@ */ /* check logical volume sector size verses device sector size */ - if (le32toh(ump->logical_vol->lb_size) != ump->sector_size) { + if (le32toh(ump->logical_vol->lb_size) != ump->discinfo.sector_size) { printf("UDF mount: format violation, lb_size != sector size\n"); return (EINVAL); } @@ -3410,7 +3410,7 @@ dscr = NULL; /* continue to the next fsd */ - fsd_len -= ump->sector_size; + fsd_len -= ump->discinfo.sector_size; fsd_loc.loc.lb_num = htole32(le32toh(fsd_loc.loc.lb_num)+1); /* follow up to fsd->next_ex (long_ad) if its not null */ @@ -6469,7 +6469,7 @@ /* get extent and do some paranoia checks */ ump = node->ump; - sector_size = ump->sector_size; + sector_size = ump->discinfo.sector_size; if (fe) { inflen = le64toh(fe->inf_len); Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Fri Jun 29 20:15:00 2012 (r238606) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vfsops.c Fri Jun 29 21:15:53 2012 (r238607) @@ -522,8 +522,7 @@ } /* inspect sector size */ - ump->sector_size = cp->provider->sectorsize; - sector_size = ump->sector_size; + sector_size = ump->discinfo.sector_size; bshift = 1; while ((1 << bshift) < sector_size) bshift++; @@ -728,8 +727,8 @@ sbp->f_version = STATFS_VERSION; /* structure version number */ /*uint32_t f_type;*/ /* type of filesystem */ sbp->f_flags = mp->mnt_flag; /* copy of mount exported flags */ - sbp->f_bsize = ump->sector_size; /* filesystem fragment size */ - sbp->f_iosize = ump->sector_size; /* optimal transfer block size */ + sbp->f_bsize = ump->discinfo.sector_size; /* filesystem fragment size */ + sbp->f_iosize = ump->discinfo.sector_size; /* optimal transfer block size */ sbp->f_blocks = sizeblks; /* total data blocks in filesystem */ sbp->f_bfree = freeblks; /* free blocks in filesystem */ sbp->f_bavail = 0; /* free blocks avail to non-superuser */ Modified: soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vnops.c ============================================================================== --- soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vnops.c Fri Jun 29 20:15:00 2012 (r238606) +++ soc2012/oleksandr/udf-head/sys/fs/udf2/udf_vnops.c Fri Jun 29 21:15:53 2012 (r238607) @@ -231,12 +231,12 @@ n = min(file_size - uio->uio_offset, uio->uio_resid); - lbn = uio->uio_offset / udf_node->ump->sector_size; - on = uio->uio_offset % udf_node->ump->sector_size; - n = min(udf_node->ump->sector_size - on, uio->uio_resid); + lbn = uio->uio_offset / udf_node->ump->discinfo.sector_size; + on = uio->uio_offset % udf_node->ump->discinfo.sector_size; + n = min(udf_node->ump->discinfo.sector_size - on, uio->uio_resid); n = min(n, file_size - uio->uio_offset); - error = bread(vp, lbn, udf_node->ump->sector_size, NOCRED, &bp); - n = min(n, udf_node->ump->sector_size - bp->b_resid); + error = bread(vp, lbn, udf_node->ump->discinfo.sector_size, NOCRED, &bp); + n = min(n, udf_node->ump->discinfo.sector_size - bp->b_resid); if (!error) error = uiomove(bp->b_data + on, n, uio); @@ -442,7 +442,7 @@ else if (lsector == UDF_TRANS_ZERO) *ap->a_bnp = -1; /* zero the buffer */ else - *ap->a_bnp = lsector * (udf_node->ump->sector_size/DEV_BSIZE); + *ap->a_bnp = lsector * (udf_node->ump->discinfo.sector_size/DEV_BSIZE); /* set runlength of maximum block size */ if (ap->a_runp) @@ -480,7 +480,7 @@ /* assert(bp->b_blkno >= 0);*/ /* get sector size */ - lb_size = udf_node->ump->sector_size; + lb_size = udf_node->ump->discinfo.sector_size; /* calculate sector to start from */ from = bp->b_blkno; @@ -520,7 +520,7 @@ bufwait(bp); } else { /* bmap gives sector numbers. bio works with device blocks */ - bp->b_blkno = lsector * (udf_node->ump->sector_size/DEV_BSIZE); + bp->b_blkno = lsector * (udf_node->ump->discinfo.sector_size/DEV_BSIZE); bp->b_iooffset = dbtob(bp->b_blkno); BO_STRATEGY(bo, bp); } @@ -782,7 +782,7 @@ nchstats.ncs_2passes++; } - fid = malloc(ump->sector_size, M_UDFTEMP, M_WAITOK); + fid = malloc(ump->discinfo.sector_size, M_UDFTEMP, M_WAITOK); unix_name = malloc(MAXNAMLEN, M_UDFTEMP, M_WAITOK); lookuploop: while (offset < file_size) { @@ -967,9 +967,9 @@ /* directories should be at least a single block? */ if (blkssize != 0) - filesize = blkssize * ump->sector_size; + filesize = blkssize * ump->discinfo.sector_size; else - filesize = ump->sector_size; + filesize = ump->discinfo.sector_size; } /* fill in struct vattr with values from the node */ @@ -982,7 +982,7 @@ vap->va_fsid = dev2udev(ump->dev); /* vp->v_mount->mnt_stat.f_fsidx.__fsid_val[0]; */ vap->va_fileid = udf_get_node_id(&udf_node->loc); /* inode hash XXX */ vap->va_size = filesize; - vap->va_blocksize = ump->sector_size; /* wise? */ + vap->va_blocksize = ump->discinfo.sector_size; /* wise? */ /* access times */ udf_timestamp_to_timespec(ump, atime, &vap->va_atime); @@ -992,7 +992,7 @@ vap->va_gen = 1; /* no multiple generations yes (!?) */ vap->va_flags = 0; /* no flags */ - vap->va_bytes = blkssize * ump->sector_size; + vap->va_bytes = blkssize * ump->discinfo.sector_size; vap->va_filerev = 0; /* TODO file revision numbers? This was changed from a 1. */ vap->va_vaflags = 0; From owner-svn-soc-all@FreeBSD.ORG Fri Jun 29 21:32:11 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 9F9CE1065672 for ; Fri, 29 Jun 2012 21:32:09 +0000 (UTC) (envelope-from oleksandr@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 29 Jun 2012 21:32:09 +0000 Date: Fri, 29 Jun 2012 21:32:09 +0000 From: oleksandr@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120629213209.9F9CE1065672@hub.freebsd.org> Cc: Subject: socsvn commit: r238608 - soc2012/oleksandr/udf-head/sbin/mount_udf2 X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 21:32:11 -0000 Author: oleksandr Date: Fri Jun 29 21:32:08 2012 New Revision: 238608 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238608 Log: comment unused function Modified: soc2012/oleksandr/udf-head/sbin/mount_udf2/mount_udf.c Modified: soc2012/oleksandr/udf-head/sbin/mount_udf2/mount_udf.c ============================================================================== --- soc2012/oleksandr/udf-head/sbin/mount_udf2/mount_udf.c Fri Jun 29 21:15:53 2012 (r238607) +++ soc2012/oleksandr/udf-head/sbin/mount_udf2/mount_udf.c Fri Jun 29 21:32:08 2012 (r238608) @@ -63,7 +63,6 @@ #include #include "mntopts.h" -//#include "fs/udf2/udf_mount.h" #include "udf2/udf_mount.h" @@ -74,10 +73,10 @@ }; static int set_charset(char **, char **, const char *); -static void getlastblock(char *dev, struct udf_session_info *usi, - int session_num); +//static void getlastblock(char *dev, struct udf_session_info *usi, +// int session_num); static void usage(void); -static void print_session_info(char *dev, int session_num); +//static void print_session_info(char *dev, int session_num); int main(int argc, char **argv) @@ -112,9 +111,9 @@ if (optarg == endp || *endp != '\0') usage(); break; - case 'p': + /*case 'p': sessioninfo = 1; - break; + break; */ case '?': default: usage(); @@ -122,12 +121,13 @@ argc -= optind; argv += optind; +#if 0 if (sessioninfo) { if (argc != 1) usage(); print_session_info(argv[0], session_num); } - +#endif if (argc != 2) usage(); @@ -145,7 +145,7 @@ /* * Get session info from device */ - getlastblock(dev, &usi, session_num); +/* getlastblock(dev, &usi, session_num); */ /* * UDF file systems are not writeable. @@ -173,6 +173,7 @@ iov[i].iov_base = &udf_flags; iov[i++].iov_len = sizeof(udf_flags); +#if 0 iov[i].iov_base = "first_trackblank"; iov[i++].iov_len = sizeof("first_trackblank"); first_trackblank = 0; @@ -188,6 +189,7 @@ iov[i++].iov_len = sizeof("session_end_addr"); iov[i].iov_base = &usi.session_end_addr; iov[i++].iov_len = sizeof(uint32_t); +#endif if (udf_flags & UDFMNT_KICONV) { iov[i].iov_base = "cs_disk"; @@ -228,6 +230,7 @@ return (0); } +#if 0 static void getlastblock(char *dev, struct udf_session_info *usi, int session_num) { @@ -274,6 +277,7 @@ exit(0); } +#endif static void usage(void) From owner-svn-soc-all@FreeBSD.ORG Fri Jun 29 22:45:55 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 075FC106566B for ; Fri, 29 Jun 2012 22:45:53 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Fri, 29 Jun 2012 22:45:53 +0000 Date: Fri, 29 Jun 2012 22:45:53 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120629224553.075FC106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238614 - in soc2012/jhagewood/diff: . diff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 22:45:55 -0000 Author: jhagewood Date: Fri Jun 29 22:45:52 2012 New Revision: 238614 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238614 Log: Modified: soc2012/jhagewood/diff/TODO soc2012/jhagewood/diff/diff/diffreg.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/TODO ============================================================================== --- soc2012/jhagewood/diff/TODO Fri Jun 29 21:33:36 2012 (r238613) +++ soc2012/jhagewood/diff/TODO Fri Jun 29 22:45:52 2012 (r238614) @@ -26,8 +26,7 @@ - When using text files with non-ascii characters, diff will interpret them as binary files and output "Files [file1] and [file2] differ." Very important compatibility problem with GNU diff, which will diff files that aren't strictly ascii. - Error is associated with asciifile() in diffreg.c - - FIX: Changed name of asciifile() to istextfile() (more appropriate), and instead of checking if every character is ASCII, it checks the first 4 bytes - of the file to see if it is ELF format. If so, the file is considered a text file. + - FIX: Changed name of asciifile() to istextfile() (more appropriate), and instead of checking if every character is ASCII, it checks the first 32kb of data in the file for a null character. If a null character is found, diff assumes that the file is a text file. - With some files, modification times displayed in the timestamp for file1 are different than the time outputted by GNU diff. - The -ignore-*-* options need some work. - BUG: BSD diff seg faults when another longopt is used with '--side-by-side'. FIX: When passing args to sdiff for side-by-side mode, only the Modified: soc2012/jhagewood/diff/diff/diffreg.c ============================================================================== --- soc2012/jhagewood/diff/diff/diffreg.c Fri Jun 29 21:33:36 2012 (r238613) +++ soc2012/jhagewood/diff/diff/diffreg.c Fri Jun 29 22:45:52 2012 (r238614) @@ -94,7 +94,7 @@ # define TIMESPEC_NS(timespec) 0 #endif -#define MAX_CHECK 768 +#define MAX_CHECK 8192 /* * diff - compare two files. */ Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Fri Jun 29 21:33:36 2012 (r238613) +++ soc2012/jhagewood/diff/hagewood-diff.patch Fri Jun 29 22:45:52 2012 (r238614) @@ -674,7 +674,7 @@ extern char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c --- jhagewood/diff/diff-orig/diffreg.c 2012-06-28 18:13:23.286983517 -0400 -+++ jhagewood/diff/diff/diffreg.c 2012-06-29 15:23:03.842992142 -0400 ++++ jhagewood/diff/diff/diffreg.c 2012-06-29 18:43:59.638892095 -0400 @@ -62,15 +62,13 @@ * @(#)diffreg.c 8.1 (Berkeley) 6/6/93 */ @@ -705,7 +705,7 @@ +# define TIMESPEC_NS(timespec) 0 +#endif + -+#define MAX_CHECK 768 ++#define MAX_CHECK 8192 /* * diff - compare two files. */ From owner-svn-soc-all@FreeBSD.ORG Sat Jun 30 02:27:32 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 41C4C106566C for ; Sat, 30 Jun 2012 02:27:30 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sat, 30 Jun 2012 02:27:30 +0000 Date: Sat, 30 Jun 2012 02:27:30 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120630022730.41C4C106566C@hub.freebsd.org> Cc: Subject: socsvn commit: r238620 - in soc2012/jhagewood/diff: . diff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jun 2012 02:27:32 -0000 Author: jhagewood Date: Sat Jun 30 02:27:29 2012 New Revision: 238620 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238620 Log: Modified: soc2012/jhagewood/diff/diff/diffreg.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/diff/diffreg.c ============================================================================== --- soc2012/jhagewood/diff/diff/diffreg.c Sat Jun 30 01:40:29 2012 (r238619) +++ soc2012/jhagewood/diff/diff/diffreg.c Sat Jun 30 02:27:29 2012 (r238620) @@ -94,7 +94,8 @@ # define TIMESPEC_NS(timespec) 0 #endif -#define MAX_CHECK 8192 +#define MAX_CHECK 768 + /* * diff - compare two files. */ Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Sat Jun 30 01:40:29 2012 (r238619) +++ soc2012/jhagewood/diff/hagewood-diff.patch Sat Jun 30 02:27:29 2012 (r238620) @@ -674,7 +674,7 @@ extern char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c --- jhagewood/diff/diff-orig/diffreg.c 2012-06-28 18:13:23.286983517 -0400 -+++ jhagewood/diff/diff/diffreg.c 2012-06-29 18:43:59.638892095 -0400 ++++ jhagewood/diff/diff/diffreg.c 2012-06-29 22:27:15.024984607 -0400 @@ -62,15 +62,13 @@ * @(#)diffreg.c 8.1 (Berkeley) 6/6/93 */ @@ -695,7 +695,7 @@ #include #include -@@ -90,6 +88,13 @@ __FBSDID("$FreeBSD"); +@@ -90,6 +88,14 @@ __FBSDID("$FreeBSD"); #include "diff.h" #include "pathnames.h" @@ -705,11 +705,12 @@ +# define TIMESPEC_NS(timespec) 0 +#endif + -+#define MAX_CHECK 8192 ++#define MAX_CHECK 768 ++ /* * diff - compare two files. */ -@@ -196,7 +201,7 @@ static void change(char *, FILE *, char +@@ -196,7 +202,7 @@ static void change(char *, FILE *, char static void sort(struct line *, int); static void print_header(const char *, const char *); static int ignoreline(char *); @@ -718,7 +719,7 @@ static int fetch(long *, int, int, FILE *, int, int); static int newcand(int, int, int); static int search(int *, int, int); -@@ -294,13 +299,13 @@ u_char cup2low[256] = { +@@ -294,13 +300,13 @@ u_char cup2low[256] = { int diffreg(char *ofile1, char *ofile2, int flags) { @@ -739,7 +740,7 @@ anychange = 0; lastline = 0; -@@ -353,7 +358,6 @@ diffreg(char *ofile1, char *ofile2, int +@@ -353,7 +359,6 @@ diffreg(char *ofile1, char *ofile2, int status |= 2; goto closem; } @@ -747,7 +748,7 @@ switch (files_differ(f1, f2, flags)) { case 0: goto closem; -@@ -365,7 +369,7 @@ diffreg(char *ofile1, char *ofile2, int +@@ -365,7 +370,7 @@ diffreg(char *ofile1, char *ofile2, int goto closem; } @@ -756,7 +757,7 @@ rval = D_BINARY; status |= 1; goto closem; -@@ -477,8 +481,8 @@ closem: +@@ -477,8 +482,8 @@ closem: static int files_differ(FILE *f1, FILE *f2, int flags) { @@ -767,7 +768,7 @@ if ((flags & (D_EMPTY1|D_EMPTY2)) || stb1.st_size != stb2.st_size || (stb1.st_mode & S_IFMT) != (stb2.st_mode & S_IFMT)) -@@ -503,9 +507,9 @@ files_differ(FILE *f1, FILE *f2, int fla +@@ -503,9 +508,9 @@ files_differ(FILE *f1, FILE *f2, int fla static FILE * opentemp(const char *file) { @@ -780,7 +781,7 @@ if (strcmp(file, "-") == 0) ifd = STDIN_FILENO; -@@ -541,7 +545,7 @@ opentemp(const char *file) +@@ -541,7 +546,7 @@ opentemp(const char *file) char * splice(char *dir, char *file) { @@ -789,7 +790,7 @@ if ((tail = strrchr(file, '/')) == NULL) tail = file; -@@ -555,8 +559,8 @@ static void +@@ -555,8 +560,8 @@ static void prepare(int i, FILE *fd, off_t filesize) { struct line *p; @@ -800,7 +801,7 @@ rewind(fd); -@@ -579,7 +583,7 @@ prepare(int i, FILE *fd, off_t filesize) +@@ -579,7 +584,7 @@ prepare(int i, FILE *fd, off_t filesize) static void prune(void) { @@ -809,7 +810,7 @@ for (pref = 0; pref < len[0] && pref < len[1] && file[0][pref + 1].value == file[1][pref + 1].value; -@@ -600,7 +604,7 @@ prune(void) +@@ -600,7 +605,7 @@ prune(void) static void equiv(struct line *a, int n, struct line *b, int m, int *c) { @@ -818,7 +819,7 @@ i = j = 1; while (i <= n && j <= m) { -@@ -629,7 +633,7 @@ equiv(struct line *a, int n, struct line +@@ -629,7 +634,7 @@ equiv(struct line *a, int n, struct line static int isqrt(int n) { @@ -827,7 +828,7 @@ if (n == 0) return (0); -@@ -647,9 +651,9 @@ isqrt(int n) +@@ -647,9 +652,9 @@ isqrt(int n) static int stone(int *a, int n, int *b, int *c) { @@ -840,7 +841,7 @@ const u_int bound = dflag ? UINT_MAX : MAX(256, isqrt(n)); k = 0; -@@ -705,7 +709,7 @@ newcand(int x, int y, int pred) +@@ -705,7 +710,7 @@ newcand(int x, int y, int pred) static int search(int *c, int k, int y) { @@ -849,7 +850,7 @@ if (clist[c[k]].y < y) /* quick look for typical case */ return (k + 1); -@@ -730,7 +734,7 @@ static void +@@ -730,7 +735,7 @@ static void unravel(int p) { struct cand *q; @@ -858,7 +859,7 @@ for (i = 0; i <= len[0]; i++) J[i] = i <= pref ? i : -@@ -748,9 +752,10 @@ unravel(int p) +@@ -748,9 +753,10 @@ unravel(int p) static void check(char *file1, FILE *f1, char *file2, FILE *f2) { @@ -872,7 +873,7 @@ rewind(f1); rewind(f2); j = 1; -@@ -766,7 +771,7 @@ check(char *file1, FILE *f1, char *file2 +@@ -766,7 +772,7 @@ check(char *file1, FILE *f1, char *file2 ixnew[j] = ctnew += skipline(f2); j++; } @@ -881,7 +882,7 @@ for (;;) { c = getc(f1); d = getc(f2); -@@ -781,6 +786,7 @@ check(char *file1, FILE *f1, char *file2 +@@ -781,6 +787,7 @@ check(char *file1, FILE *f1, char *file2 } ctold++; ctnew++; @@ -889,7 +890,7 @@ if (bflag && isspace(c) && isspace(d)) { do { if (c == '\n') -@@ -792,6 +798,7 @@ check(char *file1, FILE *f1, char *file2 +@@ -792,6 +799,7 @@ check(char *file1, FILE *f1, char *file2 break; ctnew++; } while (isspace(d = getc(f2))); @@ -897,7 +898,7 @@ } else if (wflag) { while (isspace(c) && c != '\n') { c = getc(f1); -@@ -801,31 +808,62 @@ check(char *file1, FILE *f1, char *file2 +@@ -801,31 +809,62 @@ check(char *file1, FILE *f1, char *file2 d = getc(f2); ctnew++; } @@ -975,7 +976,7 @@ if (chrtran[c] != chrtran[d]) { jackpot++; J[i] = 0; -@@ -872,7 +910,7 @@ static void +@@ -872,7 +911,7 @@ static void sort(struct line *a, int n) { struct line *ai, *aim, w; @@ -984,7 +985,7 @@ if (n == 0) return; -@@ -916,7 +954,7 @@ unsort(struct line *f, int l, int *b) +@@ -916,7 +955,7 @@ unsort(struct line *f, int l, int *b) static int skipline(FILE *f) { @@ -993,7 +994,7 @@ for (i = 1; (c = getc(f)) != '\n' && c != EOF; i++) continue; -@@ -926,7 +964,7 @@ skipline(FILE *f) +@@ -926,7 +965,7 @@ skipline(FILE *f) static void output(char *file1, FILE *f1, char *file2, FILE *f2, int flags) { @@ -1002,7 +1003,7 @@ rewind(f1); rewind(f2); -@@ -965,7 +1003,7 @@ output(char *file1, FILE *f1, char *file +@@ -965,7 +1004,7 @@ output(char *file1, FILE *f1, char *file #define c i0 if ((c = getc(f1)) == EOF) return; @@ -1011,7 +1012,7 @@ } #undef c } -@@ -980,6 +1018,7 @@ output(char *file1, FILE *f1, char *file +@@ -980,6 +1019,7 @@ output(char *file1, FILE *f1, char *file static void range(int a, int b, char *separator) { @@ -1019,7 +1020,7 @@ printf("%d", a > b ? b : a); if (a < b) printf("%s%d", separator, b); -@@ -988,6 +1027,7 @@ range(int a, int b, char *separator) +@@ -988,6 +1028,7 @@ range(int a, int b, char *separator) static void uni_range(int a, int b) { @@ -1027,7 +1028,7 @@ if (a < b) printf("%d,%d", a, b - a + 1); else if (a == b) -@@ -999,22 +1039,22 @@ uni_range(int a, int b) +@@ -999,22 +1040,22 @@ uni_range(int a, int b) static char * preadline(int fd, size_t len, off_t off) { @@ -1054,7 +1055,7 @@ ret = regexec(&ignore_re, line, 0, NULL, 0); free(line); -@@ -1032,8 +1072,8 @@ static void +@@ -1032,8 +1073,8 @@ static void change(char *file1, FILE *f1, char *file2, FILE *f2, int a, int b, int c, int d, int *pflags) { @@ -1065,7 +1066,7 @@ restart: if (format != D_IFDEF && a > b && c > d) -@@ -1113,15 +1153,15 @@ proceed: +@@ -1113,15 +1154,15 @@ proceed: case D_NORMAL: case D_EDIT: range(a, b, ","); @@ -1085,7 +1086,7 @@ break; case D_NREVERSE: if (a > b) -@@ -1137,7 +1177,7 @@ proceed: +@@ -1137,7 +1178,7 @@ proceed: if (format == D_NORMAL || format == D_IFDEF) { fetch(ixold, a, b, f1, '<', 1); if (a <= b && c <= d && format == D_NORMAL) @@ -1094,7 +1095,7 @@ } i = fetch(ixnew, c, d, f2, format == D_NORMAL ? '>' : '\0', 0); if (i != 0 && format == D_EDIT) { -@@ -1148,14 +1188,14 @@ proceed: +@@ -1148,14 +1189,14 @@ proceed: * it. We have to add a substitute command to change this * back and restart where we left off. */ @@ -1111,7 +1112,7 @@ if (inifdef) { printf("#endif /* %s */\n", ifdefname); inifdef = 0; -@@ -1165,8 +1205,8 @@ proceed: +@@ -1165,8 +1206,8 @@ proceed: static int fetch(long *f, int a, int b, FILE *lb, int ch, int oldfile) { @@ -1122,7 +1123,7 @@ /* * When doing #ifdef's, copy down to current line -@@ -1177,7 +1217,7 @@ fetch(long *f, int a, int b, FILE *lb, i +@@ -1177,7 +1218,7 @@ fetch(long *f, int a, int b, FILE *lb, i /* print through if append (a>b), else to (nb: 0 vs 1 orig) */ nc = f[a > b ? b : a - 1] - curpos; for (i = 0; i < nc; i++) @@ -1131,7 +1132,7 @@ } if (a > b) return (0); -@@ -1197,12 +1237,12 @@ fetch(long *f, int a, int b, FILE *lb, i +@@ -1197,12 +1238,12 @@ fetch(long *f, int a, int b, FILE *lb, i fseek(lb, f[i - 1], SEEK_SET); nc = f[i] - f[i - 1]; if (format != D_IFDEF && ch != '\0') { @@ -1147,7 +1148,7 @@ } col = 0; for (j = 0, lastc = '\0'; j < nc; j++, lastc = c) { -@@ -1211,13 +1251,13 @@ fetch(long *f, int a, int b, FILE *lb, i +@@ -1211,13 +1252,13 @@ fetch(long *f, int a, int b, FILE *lb, i format == D_NREVERSE) warnx("No newline at end of file"); else @@ -1163,7 +1164,7 @@ } while (++col < newcol); } else { if (format == D_EDIT && j == 1 && c == '\n' -@@ -1229,10 +1269,10 @@ fetch(long *f, int a, int b, FILE *lb, i +@@ -1229,10 +1270,10 @@ fetch(long *f, int a, int b, FILE *lb, i * giving the caller an offset * from which to restart. */ @@ -1176,7 +1177,7 @@ col++; } } -@@ -1246,8 +1286,8 @@ fetch(long *f, int a, int b, FILE *lb, i +@@ -1246,8 +1287,8 @@ fetch(long *f, int a, int b, FILE *lb, i static int readhash(FILE *f) { @@ -1187,7 +1188,7 @@ sum = 1; space = 0; -@@ -1305,20 +1345,28 @@ readhash(FILE *f) +@@ -1305,20 +1346,28 @@ readhash(FILE *f) return (sum == 0 ? 1 : sum); } @@ -1224,7 +1225,7 @@ return (1); } -@@ -1327,10 +1375,10 @@ asciifile(FILE *f) +@@ -1327,10 +1376,10 @@ asciifile(FILE *f) static char * match_function(const long *f, int pos, FILE *file) { @@ -1239,7 +1240,7 @@ lastline = pos; while (pos > last) { -@@ -1342,7 +1390,6 @@ match_function(const long *f, int pos, F +@@ -1342,7 +1391,6 @@ match_function(const long *f, int pos, F if (nc > 0) { buf[nc] = '\0'; buf[strcspn(buf, "\n")] = '\0'; @@ -1247,7 +1248,7 @@ if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') { if (begins_with(buf, "private:")) { if (!state) -@@ -1373,9 +1420,9 @@ static void +@@ -1373,9 +1421,9 @@ static void dump_context_vec(FILE *f1, FILE *f2) { struct context_vec *cvp = context_vec_start; @@ -1260,7 +1261,7 @@ if (context_vec_start > context_vec_ptr) return; -@@ -1390,8 +1437,8 @@ dump_context_vec(FILE *f1, FILE *f2) +@@ -1390,8 +1438,8 @@ dump_context_vec(FILE *f1, FILE *f2) if (pflag) { f = match_function(ixold, lowa-1, f1); if (f != NULL) { @@ -1271,7 +1272,7 @@ } } printf("\n*** "); -@@ -1478,9 +1525,9 @@ static void +@@ -1478,9 +1526,9 @@ static void dump_unified_vec(FILE *f1, FILE *f2) { struct context_vec *cvp = context_vec_start; @@ -1284,7 +1285,7 @@ if (context_vec_start > context_vec_ptr) return; -@@ -1491,19 +1538,19 @@ dump_unified_vec(FILE *f1, FILE *f2) +@@ -1491,19 +1539,19 @@ dump_unified_vec(FILE *f1, FILE *f2) lowc = MAX(1, cvp->c - context); upd = MIN(len[1], context_vec_ptr->d + context); @@ -1310,7 +1311,7 @@ /* * Output changes in "unified" diff format--the old and new lines -@@ -1551,16 +1598,43 @@ dump_unified_vec(FILE *f1, FILE *f2) +@@ -1551,16 +1599,43 @@ dump_unified_vec(FILE *f1, FILE *f2) static void print_header(const char *file1, const char *file2) { From owner-svn-soc-all@FreeBSD.ORG Sat Jun 30 02:52:30 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 9CC601065670 for ; Sat, 30 Jun 2012 02:52:28 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sat, 30 Jun 2012 02:52:28 +0000 Date: Sat, 30 Jun 2012 02:52:28 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120630025228.9CC601065670@hub.freebsd.org> Cc: Subject: socsvn commit: r238621 - in soc2012/jhagewood/diff: . diff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jun 2012 02:52:30 -0000 Author: jhagewood Date: Sat Jun 30 02:52:27 2012 New Revision: 238621 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238621 Log: Modified: soc2012/jhagewood/diff/TODO soc2012/jhagewood/diff/diff/diff.c soc2012/jhagewood/diff/hagewood-diff.patch Modified: soc2012/jhagewood/diff/TODO ============================================================================== --- soc2012/jhagewood/diff/TODO Sat Jun 30 02:27:29 2012 (r238620) +++ soc2012/jhagewood/diff/TODO Sat Jun 30 02:52:27 2012 (r238621) @@ -11,8 +11,8 @@ --GTYPE-group-format IN PROGRESS Added options for various GTYPEs. --line-format IN PROGRESS Added new-line-format, old-line-format, and unchanged-line-format for compatibility --LTYPE-line-format INCOMPLETE ---from-file COMPLETE Calls exec1() twice with optarg as file input. BUG. ---to-file COMPLETE Calls exec1() twice with optarg as file input. BUG. +--from-file COMPLETE Checks for flag then calls diffreg() with input files diff'd against optarg. +--to-file COMPLETE Checks for flag then calls diffreg() with optarg diff'd against input files. --horizon-lines INCOMPLETE --speed-large-file INCOMPLETE --ignore-tab-expansion IN PROGRESS Functionality implemented in check(), needs debugging. (Same problem as --ignore-blank-lines?) Modified: soc2012/jhagewood/diff/diff/diff.c ============================================================================== --- soc2012/jhagewood/diff/diff/diff.c Sat Jun 30 02:27:29 2012 (r238620) +++ soc2012/jhagewood/diff/diff/diff.c Sat Jun 30 02:52:27 2012 (r238621) @@ -204,7 +204,7 @@ int main(int argc, char **argv) { - char *ep, **oargv, *args, *file1, *file2, *file3; + char *ep, **oargv, *args, *optfile; long l; int ch, lastch, gotstdin, prevoptind, newarg; int oargc, childstat; @@ -345,15 +345,11 @@ break; case OPT_FFILE: Toflag = 1; - file1 = argv[argc-2]; - file2 = argv[argc-1]; - file3 = optarg; + optfile3 = optarg; break; case OPT_TOFILE: Fromflag = 1; - file1 = argv[argc-2]; - file2 = argv[argc-1]; - file3 = optarg; + optfile = optarg; break; case OPT_CHGD_GF: case OPT_NEW_GF: @@ -416,44 +412,6 @@ } argc -= optind; argv += optind; - - /* - * Execute --to-file or --from-file by forking and executing diff - * with new input files. - * XXX to do- pass arguements - */ - if (Toflag || Fromflag) { - if (Toflag && Fromflag) { - (void)fprintf(stderr, "--from-file and --to-file both specified.\n"); - exit(2); - } - while ((ch = getopt(argc, argv, OPTIONS)) != -1) - strcat(args, ch); - childpid = fork(); - if (childpid < 0) { - (void)fprintf(stderr, "Error forking process.\n"); - exit(2); - } - if (childpid == 0) { - if (Toflag) - execl(_PATH_DIFF, _PATH_DIFF, args, file1, file3); - if (Fromflag) - execl(_PATH_DIFF, _PATH_DIFF, args, file3, file1); - exit(127); - } - if (childpid > 0) { - while (1) { - done = wait(&childstat); - if (done == 0) { - if (Toflag) - execl(_PATH_DIFF, _PATH_DIFF, file2, file3); - if (Fromflag) - execl(_PATH_DIFF, _PATH_DIFF, file3, file2); - exit(127); - } - } - } - } if (yflag) { /* remove y flag from args and call sdiff */ for (argv = oargv; argv && strcmp(*argv, "-y") != 0 && @@ -518,8 +476,26 @@ if (stat(argv[1], &stb2) < 0) err(2, "%s", argv[1]); } - print_status(diffreg(argv[0], argv[1], 0), argv[0], argv[1], - NULL); + /* Checks if --to-file or --from-file are specified */ + if (Toflag && Fromflag) { + (void)fprintf(stderr, "--from-file and --to-file both specified.\n"); + exit(2); + } + if (Toflag) { + print_status(diffreg(argv[0], optfile, 0), argv[0], optfile, + NULL); + print_status(diffreg(argv[1], optfile, 0), argv[1], optfile, + NULL); + } + if (Fromflag) { + print_status(diffreg(optfile, argv[0], 0), optfile, argv[0] + NULL); + print_status(diffreg(optfile, argv[1], 0), optfile, argv[1], + NULL); + } + else + print_status(diffreg(argv[0], argv[1], 0), argv[0], argv[1], + NULL); } exit(status); } Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Sat Jun 30 02:27:29 2012 (r238620) +++ soc2012/jhagewood/diff/hagewood-diff.patch Sat Jun 30 02:52:27 2012 (r238621) @@ -1,6 +1,6 @@ diff -rupN jhagewood/diff/diff-orig/diff.c jhagewood/diff/diff/diff.c --- jhagewood/diff/diff-orig/diff.c 2012-06-28 18:13:23.287983517 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-28 22:39:58.023958340 -0400 ++++ jhagewood/diff/diff/diff.c 2012-06-29 22:49:21.899973597 -0400 @@ -1,4 +1,4 @@ -/*- +/* @@ -246,7 +246,7 @@ - int ch, lastch, gotstdin, prevoptind, newarg; - int oargc; - -+ char *ep, **oargv, *args, *file1, *file2, *file3; ++ char *ep, **oargv, *args, *optfile; + long l; + int ch, lastch, gotstdin, prevoptind, newarg; + int oargc, childstat; @@ -273,21 +273,17 @@ case 'e': format = D_EDIT; break; -@@ -296,15 +343,52 @@ main(int argc, char **argv) +@@ -296,15 +343,48 @@ main(int argc, char **argv) case 'y': yflag = 1; break; + case OPT_FFILE: + Toflag = 1; -+ file1 = argv[argc-2]; -+ file2 = argv[argc-1]; -+ file3 = optarg; ++ optfile3 = optarg; + break; + case OPT_TOFILE: + Fromflag = 1; -+ file1 = argv[argc-2]; -+ file2 = argv[argc-1]; -+ file3 = optarg; ++ optfile = optarg; + break; + case OPT_CHGD_GF: + case OPT_NEW_GF: @@ -334,7 +330,7 @@ case OPT_STRIPCR: strip_cr=1; break; -@@ -328,20 +412,58 @@ main(int argc, char **argv) +@@ -328,20 +408,20 @@ main(int argc, char **argv) lastch = ch; newarg = optind != prevoptind; prevoptind = optind; @@ -344,44 +340,6 @@ argv += optind; - - if(yflag) { -+ -+ /* -+ * Execute --to-file or --from-file by forking and executing diff -+ * with new input files. -+ * XXX to do- pass arguements -+ */ -+ if (Toflag || Fromflag) { -+ if (Toflag && Fromflag) { -+ (void)fprintf(stderr, "--from-file and --to-file both specified.\n"); -+ exit(2); -+ } -+ while ((ch = getopt(argc, argv, OPTIONS)) != -1) -+ strcat(args, ch); -+ childpid = fork(); -+ if (childpid < 0) { -+ (void)fprintf(stderr, "Error forking process.\n"); -+ exit(2); -+ } -+ if (childpid == 0) { -+ if (Toflag) -+ execl(_PATH_DIFF, _PATH_DIFF, args, file1, file3); -+ if (Fromflag) -+ execl(_PATH_DIFF, _PATH_DIFF, args, file3, file1); -+ exit(127); -+ } -+ if (childpid > 0) { -+ while (1) { -+ done = wait(&childstat); -+ if (done == 0) { -+ if (Toflag) -+ execl(_PATH_DIFF, _PATH_DIFF, file2, file3); -+ if (Fromflag) -+ execl(_PATH_DIFF, _PATH_DIFF, file3, file2); -+ exit(127); -+ } -+ } -+ } -+ } + if (yflag) { /* remove y flag from args and call sdiff */ - for(argv=oargv; argv && strcmp(*argv, "-y") != 0; argv++); @@ -398,7 +356,7 @@ execv(_PATH_SDIFF, oargv); _exit(127); } -@@ -380,7 +502,10 @@ main(int argc, char **argv) +@@ -380,7 +460,10 @@ main(int argc, char **argv) set_argstr(oargv, argv); if (S_ISDIR(stb1.st_mode) && S_ISDIR(stb2.st_mode)) { if (format == D_IFDEF) @@ -410,7 +368,36 @@ diffdir(argv[0], argv[1]); } else { if (S_ISDIR(stb1.st_mode)) { -@@ -402,11 +527,10 @@ main(int argc, char **argv) +@@ -393,8 +476,26 @@ main(int argc, char **argv) + if (stat(argv[1], &stb2) < 0) + err(2, "%s", argv[1]); + } +- print_status(diffreg(argv[0], argv[1], 0), argv[0], argv[1], +- NULL); ++ /* Checks if --to-file or --from-file are specified */ ++ if (Toflag && Fromflag) { ++ (void)fprintf(stderr, "--from-file and --to-file both specified.\n"); ++ exit(2); ++ } ++ if (Toflag) { ++ print_status(diffreg(argv[0], optfile, 0), argv[0], optfile, ++ NULL); ++ print_status(diffreg(argv[1], optfile, 0), argv[1], optfile, ++ NULL); ++ } ++ if (Fromflag) { ++ print_status(diffreg(optfile, argv[0], 0), optfile, argv[0] ++ NULL); ++ print_status(diffreg(optfile, argv[1], 0), optfile, argv[1], ++ NULL); ++ } ++ else ++ print_status(diffreg(argv[0], argv[1], 0), argv[0], argv[1], ++ NULL); + } + exit(status); + } +@@ -402,11 +503,10 @@ main(int argc, char **argv) void * emalloc(size_t n) { @@ -423,7 +410,7 @@ if ((p = malloc(n)) == NULL) errx(2, NULL); return (p); -@@ -415,7 +539,7 @@ emalloc(size_t n) +@@ -415,7 +515,7 @@ emalloc(size_t n) void * erealloc(void *p, size_t n) { @@ -432,7 +419,7 @@ if (n == 0) errx(2, NULL); -@@ -431,13 +555,12 @@ erealloc(void *p, size_t n) +@@ -431,13 +531,12 @@ erealloc(void *p, size_t n) int easprintf(char **ret, const char *fmt, ...) { @@ -448,7 +435,7 @@ if (len < 0 || *ret == NULL) errx(2, NULL); return (len); -@@ -446,11 +569,12 @@ easprintf(char **ret, const char *fmt, . +@@ -446,11 +545,12 @@ easprintf(char **ret, const char *fmt, . char * estrdup(const char *str) { @@ -463,7 +450,7 @@ strlcpy(cp, str, len); return (cp); } -@@ -531,6 +655,7 @@ push_ignore_pats(char *pattern) +@@ -531,6 +631,7 @@ push_ignore_pats(char *pattern) void print_only(const char *path, size_t dirlen, const char *entry) { @@ -471,7 +458,7 @@ if (dirlen > 1) dirlen--; printf("Only in %.*s: %s\n", (int)dirlen, path, entry); -@@ -539,45 +664,46 @@ print_only(const char *path, size_t dirl +@@ -539,45 +640,46 @@ print_only(const char *path, size_t dirl void print_status(int val, char *path1, char *path2, char *entry) { @@ -529,7 +516,7 @@ break; } } -@@ -585,6 +711,7 @@ print_status(int val, char *path1, char +@@ -585,6 +687,7 @@ print_status(int val, char *path1, char void usage(void) { From owner-svn-soc-all@FreeBSD.ORG Sat Jun 30 03:47:11 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 52F79106566B for ; Sat, 30 Jun 2012 03:47:09 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sat, 30 Jun 2012 03:47:09 +0000 Date: Sat, 30 Jun 2012 03:47:09 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120630034709.52F79106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238624 - in soc2012/jhagewood: diff diff/diff diff3 mdocml X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jun 2012 03:47:11 -0000 Author: jhagewood Date: Sat Jun 30 03:47:08 2012 New Revision: 238624 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238624 Log: Modified: soc2012/jhagewood/diff/diff/diff.c soc2012/jhagewood/diff/diff/diffreg.c soc2012/jhagewood/diff/hagewood-diff.patch soc2012/jhagewood/diff3/hagewood-diff3.patch soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch Modified: soc2012/jhagewood/diff/diff/diff.c ============================================================================== --- soc2012/jhagewood/diff/diff/diff.c Sat Jun 30 02:11:53 2012 (r238623) +++ soc2012/jhagewood/diff/diff/diff.c Sat Jun 30 03:47:08 2012 (r238624) @@ -204,15 +204,15 @@ int main(int argc, char **argv) { - char *ep, **oargv, *args, *optfile; + char *ep, **oargv, *optfile; long l; int ch, lastch, gotstdin, prevoptind, newarg; - int oargc, childstat; - pid_t childpid, done; + int oargc; oargv = argv; oargc = argc; gotstdin = 0; + optfile = "\0"; lastch = '\0'; prevoptind = 1; @@ -345,7 +345,7 @@ break; case OPT_FFILE: Toflag = 1; - optfile3 = optarg; + optfile = optarg; break; case OPT_TOFILE: Fromflag = 1; @@ -482,18 +482,18 @@ exit(2); } if (Toflag) { - print_status(diffreg(argv[0], optfile, 0), argv[0], optfile, + print_status(diffreg(optfile, argv[0], 0), optfile, argv[0], NULL); - print_status(diffreg(argv[1], optfile, 0), argv[1], optfile, + print_status(diffreg(optfile, argv[1], 0), optfile, argv[1], NULL); } if (Fromflag) { - print_status(diffreg(optfile, argv[0], 0), optfile, argv[0] + print_status(diffreg(argv[0], optfile, 0), argv[0], optfile, NULL); - print_status(diffreg(optfile, argv[1], 0), optfile, argv[1], + print_status(diffreg(argv[1], optfile, 0), argv[1], optfile, NULL); } - else + if (!Toflag && !Fromflag) print_status(diffreg(argv[0], argv[1], 0), argv[0], argv[1], NULL); } Modified: soc2012/jhagewood/diff/diff/diffreg.c ============================================================================== --- soc2012/jhagewood/diff/diff/diffreg.c Sat Jun 30 02:11:53 2012 (r238623) +++ soc2012/jhagewood/diff/diff/diffreg.c Sat Jun 30 03:47:08 2012 (r238624) @@ -1365,9 +1365,11 @@ check_size = MAX_CHECK; else check_size = BUFSIZ; + /* + * XXX Currently returns NULL even for file with no NULL chars? if (memchr(buf, '\0', check_size) != NULL) { return (0); - } + }*/ return (1); } Modified: soc2012/jhagewood/diff/hagewood-diff.patch ============================================================================== --- soc2012/jhagewood/diff/hagewood-diff.patch Sat Jun 30 02:11:53 2012 (r238623) +++ soc2012/jhagewood/diff/hagewood-diff.patch Sat Jun 30 03:47:08 2012 (r238624) @@ -1,6 +1,6 @@ diff -rupN jhagewood/diff/diff-orig/diff.c jhagewood/diff/diff/diff.c ---- jhagewood/diff/diff-orig/diff.c 2012-06-28 18:13:23.287983517 -0400 -+++ jhagewood/diff/diff/diff.c 2012-06-29 22:49:21.899973597 -0400 +--- jhagewood/diff/diff-orig/diff.c 2012-06-30 03:36:16.000000000 -0400 ++++ jhagewood/diff/diff/diff.c 2012-06-30 03:46:55.000000000 -0400 @@ -1,4 +1,4 @@ -/*- +/* @@ -56,7 +56,7 @@ /* Options which exceed manageable alphanumeric assignments */ -@@ -69,84 +67,128 @@ enum +@@ -69,84 +67,128 @@ enum OPT_STRIPCR, OPT_NORMAL, OPT_LEFTC, @@ -237,7 +237,7 @@ NULL, }; char **help_strs = (char **)help_msg; -@@ -162,11 +204,12 @@ void read_excludes_file(char *); +@@ -162,14 +204,15 @@ void read_excludes_file(char *); int main(int argc, char **argv) { @@ -246,15 +246,18 @@ - int ch, lastch, gotstdin, prevoptind, newarg; - int oargc; - -+ char *ep, **oargv, *args, *optfile; ++ char *ep, **oargv, *optfile; + long l; + int ch, lastch, gotstdin, prevoptind, newarg; -+ int oargc, childstat; -+ pid_t childpid, done; ++ int oargc; + oargv = argv; oargc = argc; gotstdin = 0; ++ optfile = "\0"; + + lastch = '\0'; + prevoptind = 1; @@ -197,6 +240,7 @@ main(int argc, char **argv) break; case 'C': @@ -279,7 +282,7 @@ break; + case OPT_FFILE: + Toflag = 1; -+ optfile3 = optarg; ++ optfile = optarg; + break; + case OPT_TOFILE: + Fromflag = 1; @@ -380,18 +383,18 @@ + exit(2); + } + if (Toflag) { -+ print_status(diffreg(argv[0], optfile, 0), argv[0], optfile, ++ print_status(diffreg(optfile, argv[0], 0), optfile, argv[0], + NULL); -+ print_status(diffreg(argv[1], optfile, 0), argv[1], optfile, ++ print_status(diffreg(optfile, argv[1], 0), optfile, argv[1], + NULL); + } + if (Fromflag) { -+ print_status(diffreg(optfile, argv[0], 0), optfile, argv[0] ++ print_status(diffreg(argv[0], optfile, 0), argv[0], optfile, + NULL); -+ print_status(diffreg(optfile, argv[1], 0), optfile, argv[1], ++ print_status(diffreg(argv[1], optfile, 0), argv[1], optfile, + NULL); + } -+ else ++ if (!Toflag && !Fromflag) + print_status(diffreg(argv[0], argv[1], 0), argv[0], argv[1], + NULL); } @@ -516,7 +519,7 @@ break; } } -@@ -585,6 +687,7 @@ print_status(int val, char *path1, char +@@ -585,6 +687,7 @@ print_status(int val, char *path1, char void usage(void) { @@ -524,9 +527,34 @@ (void)fprintf(stderr, "usage: diff [-abdilpqTtw] [-I pattern] [-c | -e | -f | -n | -u]\n" " [-L label] file1 file2\n" +diff -rupN jhagewood/diff/diff-orig/diff.h jhagewood/diff/diff/diff.h +--- jhagewood/diff/diff-orig/diff.h 2012-06-30 03:36:16.000000000 -0400 ++++ jhagewood/diff/diff/diff.h 2012-06-30 03:36:16.000000000 -0400 +@@ -48,6 +48,8 @@ + #define D_NREVERSE 5 /* Reverse ed script with numbered + lines and no trailing . */ + #define D_BRIEF 6 /* Say if the files differ */ ++#define D_GF 7 /* Group format */ ++#define D_LF 8 /* Line format */ + + /* + * Output flags +@@ -75,9 +77,9 @@ struct excludes { + struct excludes *next; + }; + +-extern int aflag, bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag, +- sflag, tflag, Tflag, wflag; +-extern int Bflag, strip_cr, tabsize; ++extern int aflag, bflag, cflag, dflag, Eflag, Fromflag, iflag, lflag, Nflag, Pflag, pflag, rflag, ++ sflag, tflag, Tflag, Toflag, wflag; ++extern int Bflag, strip_cr, suppress_cl, tabsize; + extern int format, context, status; + extern char ignore_file_case; + extern char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; diff -rupN jhagewood/diff/diff-orig/diffdir.c jhagewood/diff/diff/diffdir.c ---- jhagewood/diff/diff-orig/diffdir.c 2012-06-28 18:13:23.287983517 -0400 -+++ jhagewood/diff/diff/diffdir.c 2012-06-28 18:13:23.375983516 -0400 +--- jhagewood/diff/diff-orig/diffdir.c 2012-06-30 03:36:16.000000000 -0400 ++++ jhagewood/diff/diff/diffdir.c 2012-06-30 03:36:16.000000000 -0400 @@ -20,14 +20,13 @@ #include @@ -634,34 +662,9 @@ strlcpy(path1 + plen1, dp->d_name, MAXPATHLEN - plen1); if (stat(path1, &stb1) != 0) { -diff -rupN jhagewood/diff/diff-orig/diff.h jhagewood/diff/diff/diff.h ---- jhagewood/diff/diff-orig/diff.h 2012-06-28 18:13:23.288983517 -0400 -+++ jhagewood/diff/diff/diff.h 2012-06-28 18:13:23.376983516 -0400 -@@ -48,6 +48,8 @@ - #define D_NREVERSE 5 /* Reverse ed script with numbered - lines and no trailing . */ - #define D_BRIEF 6 /* Say if the files differ */ -+#define D_GF 7 /* Group format */ -+#define D_LF 8 /* Line format */ - - /* - * Output flags -@@ -75,9 +77,9 @@ struct excludes { - struct excludes *next; - }; - --extern int aflag, bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag, -- sflag, tflag, Tflag, wflag; --extern int Bflag, strip_cr, tabsize; -+extern int aflag, bflag, cflag, dflag, Eflag, Fromflag, iflag, lflag, Nflag, Pflag, pflag, rflag, -+ sflag, tflag, Tflag, Toflag, wflag; -+extern int Bflag, strip_cr, suppress_cl, tabsize; - extern int format, context, status; - extern char ignore_file_case; - extern char *start, *ifdefname, *diffargs, *label[2], *ignore_pats; diff -rupN jhagewood/diff/diff-orig/diffreg.c jhagewood/diff/diff/diffreg.c ---- jhagewood/diff/diff-orig/diffreg.c 2012-06-28 18:13:23.286983517 -0400 -+++ jhagewood/diff/diff/diffreg.c 2012-06-29 22:27:15.024984607 -0400 +--- jhagewood/diff/diff-orig/diffreg.c 2012-06-30 03:36:16.000000000 -0400 ++++ jhagewood/diff/diff/diffreg.c 2012-06-30 03:44:30.000000000 -0400 @@ -62,15 +62,13 @@ * @(#)diffreg.c 8.1 (Berkeley) 6/6/93 */ @@ -727,7 +730,7 @@ anychange = 0; lastline = 0; -@@ -353,7 +359,6 @@ diffreg(char *ofile1, char *ofile2, int +@@ -353,7 +359,6 @@ diffreg(char *ofile1, char *ofile2, int status |= 2; goto closem; } @@ -735,7 +738,7 @@ switch (files_differ(f1, f2, flags)) { case 0: goto closem; -@@ -365,7 +370,7 @@ diffreg(char *ofile1, char *ofile2, int +@@ -365,7 +370,7 @@ diffreg(char *ofile1, char *ofile2, int goto closem; } @@ -1175,7 +1178,7 @@ sum = 1; space = 0; -@@ -1305,20 +1346,28 @@ readhash(FILE *f) +@@ -1305,20 +1346,30 @@ readhash(FILE *f) return (sum == 0 ? 1 : sum); } @@ -1206,13 +1209,15 @@ + check_size = MAX_CHECK; + else + check_size = BUFSIZ; ++ /* ++ * XXX Currently returns NULL even for file with no NULL chars? + if (memchr(buf, '\0', check_size) != NULL) { + return (0); -+ } ++ }*/ return (1); } -@@ -1327,10 +1376,10 @@ asciifile(FILE *f) +@@ -1327,10 +1378,10 @@ asciifile(FILE *f) static char * match_function(const long *f, int pos, FILE *file) { @@ -1227,7 +1232,7 @@ lastline = pos; while (pos > last) { -@@ -1342,7 +1391,6 @@ match_function(const long *f, int pos, F +@@ -1342,7 +1393,6 @@ match_function(const long *f, int pos, F if (nc > 0) { buf[nc] = '\0'; buf[strcspn(buf, "\n")] = '\0'; @@ -1235,7 +1240,7 @@ if (isalpha(buf[0]) || buf[0] == '_' || buf[0] == '$') { if (begins_with(buf, "private:")) { if (!state) -@@ -1373,9 +1421,9 @@ static void +@@ -1373,9 +1423,9 @@ static void dump_context_vec(FILE *f1, FILE *f2) { struct context_vec *cvp = context_vec_start; @@ -1248,7 +1253,7 @@ if (context_vec_start > context_vec_ptr) return; -@@ -1390,8 +1438,8 @@ dump_context_vec(FILE *f1, FILE *f2) +@@ -1390,8 +1440,8 @@ dump_context_vec(FILE *f1, FILE *f2) if (pflag) { f = match_function(ixold, lowa-1, f1); if (f != NULL) { @@ -1259,7 +1264,7 @@ } } printf("\n*** "); -@@ -1478,9 +1526,9 @@ static void +@@ -1478,9 +1528,9 @@ static void dump_unified_vec(FILE *f1, FILE *f2) { struct context_vec *cvp = context_vec_start; @@ -1272,7 +1277,7 @@ if (context_vec_start > context_vec_ptr) return; -@@ -1491,19 +1539,19 @@ dump_unified_vec(FILE *f1, FILE *f2) +@@ -1491,19 +1541,19 @@ dump_unified_vec(FILE *f1, FILE *f2) lowc = MAX(1, cvp->c - context); upd = MIN(len[1], context_vec_ptr->d + context); @@ -1298,7 +1303,7 @@ /* * Output changes in "unified" diff format--the old and new lines -@@ -1551,16 +1599,43 @@ dump_unified_vec(FILE *f1, FILE *f2) +@@ -1551,16 +1601,43 @@ dump_unified_vec(FILE *f1, FILE *f2) static void print_header(const char *file1, const char *file2) { @@ -1349,8 +1354,8 @@ + file2, buf2); } diff -rupN jhagewood/diff/diff-orig/pathnames.h jhagewood/diff/diff/pathnames.h ---- jhagewood/diff/diff-orig/pathnames.h 2012-06-28 18:13:23.281983517 -0400 -+++ jhagewood/diff/diff/pathnames.h 2012-06-28 18:13:23.374983516 -0400 +--- jhagewood/diff/diff-orig/pathnames.h 2012-06-30 03:36:16.000000000 -0400 ++++ jhagewood/diff/diff/pathnames.h 2012-06-30 03:36:16.000000000 -0400 @@ -23,4 +23,5 @@ #include Modified: soc2012/jhagewood/diff3/hagewood-diff3.patch ============================================================================== --- soc2012/jhagewood/diff3/hagewood-diff3.patch Sat Jun 30 02:11:53 2012 (r238623) +++ soc2012/jhagewood/diff3/hagewood-diff3.patch Sat Jun 30 03:47:08 2012 (r238624) @@ -1,6 +1,17 @@ +diff -rupN jhagewood/diff3/diff3-orig/Makefile jhagewood/diff3/diff3/Makefile +--- jhagewood/diff3/diff3-orig/Makefile 2012-06-30 03:36:16.000000000 -0400 ++++ jhagewood/diff3/diff3/Makefile 2012-06-30 03:36:16.000000000 -0400 +@@ -6,6 +6,6 @@ BINDIR= /usr/libexec + + beforeinstall: + install ${INSTALL_COPY}c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ +- ${.CURDIR}/diff3.ksh ${DESTDIR}/usr/bin/diff3 ++ ${.CURDIR}/diff3.sh ${DESTDIR}/usr/bin/diff3 + + .include diff -rupN jhagewood/diff3/diff3-orig/diff3prog.c jhagewood/diff3/diff3/diff3prog.c ---- jhagewood/diff3/diff3-orig/diff3prog.c 2012-06-28 18:13:23.389983516 -0400 -+++ jhagewood/diff3/diff3/diff3prog.c 2012-06-28 18:13:23.422983515 -0400 +--- jhagewood/diff3/diff3-orig/diff3prog.c 2012-06-30 03:36:16.000000000 -0400 ++++ jhagewood/diff3/diff3/diff3prog.c 2012-06-30 03:36:16.000000000 -0400 @@ -64,19 +64,23 @@ * @(#)diff3.c 8.1 (Berkeley) 6/6/93 */ @@ -455,14 +466,3 @@ + fprintf(stderr, "usage: diff3 %s file1 file2 file3\n", OPTIONS); exit(EXIT_FAILURE); } -diff -rupN jhagewood/diff3/diff3-orig/Makefile jhagewood/diff3/diff3/Makefile ---- jhagewood/diff3/diff3-orig/Makefile 2012-06-28 18:13:23.390983516 -0400 -+++ jhagewood/diff3/diff3/Makefile 2012-06-28 18:13:23.423983515 -0400 -@@ -6,6 +6,6 @@ BINDIR= /usr/libexec - - beforeinstall: - install ${INSTALL_COPY}c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \ -- ${.CURDIR}/diff3.ksh ${DESTDIR}/usr/bin/diff3 -+ ${.CURDIR}/diff3.sh ${DESTDIR}/usr/bin/diff3 - - .include Modified: soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch ============================================================================== --- soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch Sat Jun 30 02:11:53 2012 (r238623) +++ soc2012/jhagewood/mdocml/hagewood-mdocml-ns.patch Sat Jun 30 03:47:08 2012 (r238624) @@ -1,6 +1,6 @@ diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man.h jhagewood/mdocml/mdocml-1.12.1/man.h ---- jhagewood/mdocml/mdocml-1.12.1-orig/man.h 2012-06-28 18:13:23.821983512 -0400 -+++ jhagewood/mdocml/mdocml-1.12.1/man.h 2012-06-28 18:13:24.149983509 -0400 +--- jhagewood/mdocml/mdocml-1.12.1-orig/man.h 2012-06-30 03:36:17.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man.h 2012-06-30 03:36:17.000000000 -0400 @@ -43,6 +43,8 @@ enum mant { MAN_sp, MAN_nf, @@ -12,7 +12,7 @@ MAN_DT, diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man.h.orig jhagewood/mdocml/mdocml-1.12.1/man.h.orig --- jhagewood/mdocml/mdocml-1.12.1-orig/man.h.orig 1969-12-31 19:00:00.000000000 -0500 -+++ jhagewood/mdocml/mdocml-1.12.1/man.h.orig 2012-06-28 18:13:24.137983510 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man.h.orig 2012-06-30 03:36:17.000000000 -0400 @@ -0,0 +1,113 @@ +/* $Id: man.h,v 1.60 2012/01/03 15:16:24 kristaps Exp $ */ +/* @@ -128,8 +128,8 @@ + +#endif /*!MAN_H*/ diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c jhagewood/mdocml/mdocml-1.12.1/man_term.c ---- jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c 2012-06-28 18:13:23.808983512 -0400 -+++ jhagewood/mdocml/mdocml-1.12.1/man_term.c 2012-06-28 18:13:24.131983510 -0400 +--- jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c 2012-06-30 03:36:17.000000000 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man_term.c 2012-06-30 03:36:17.000000000 -0400 @@ -82,6 +82,8 @@ static int pre_alternate(DECL_ARGS); static int pre_ft(DECL_ARGS); static int pre_ign(DECL_ARGS); @@ -173,7 +173,7 @@ static int diff -rupN jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c.orig jhagewood/mdocml/mdocml-1.12.1/man_term.c.orig --- jhagewood/mdocml/mdocml-1.12.1-orig/man_term.c.orig 1969-12-31 19:00:00.000000000 -0500 -+++ jhagewood/mdocml/mdocml-1.12.1/man_term.c.orig 2012-06-28 18:13:24.146983510 -0400 ++++ jhagewood/mdocml/mdocml-1.12.1/man_term.c.orig 2012-06-30 03:36:17.000000000 -0400 @@ -0,0 +1,1117 @@ +/* $Id: man_term.c,v 1.127 2012/01/03 15:16:24 kristaps Exp $ */ +/* From owner-svn-soc-all@FreeBSD.ORG Sat Jun 30 03:48:24 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 488CD106566B for ; Sat, 30 Jun 2012 03:48:22 +0000 (UTC) (envelope-from jhagewood@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sat, 30 Jun 2012 03:48:22 +0000 Date: Sat, 30 Jun 2012 03:48:22 +0000 From: jhagewood@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120630034822.488CD106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238625 - soc2012/jhagewood/diff X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jun 2012 03:48:24 -0000 Author: jhagewood Date: Sat Jun 30 03:48:21 2012 New Revision: 238625 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238625 Log: Modified: soc2012/jhagewood/diff/TODO Modified: soc2012/jhagewood/diff/TODO ============================================================================== --- soc2012/jhagewood/diff/TODO Sat Jun 30 03:47:08 2012 (r238624) +++ soc2012/jhagewood/diff/TODO Sat Jun 30 03:48:21 2012 (r238625) @@ -17,7 +17,7 @@ --speed-large-file INCOMPLETE --ignore-tab-expansion IN PROGRESS Functionality implemented in check(), needs debugging. (Same problem as --ignore-blank-lines?) --width INCOMPLETE ---help IN PROGRESS Needs descriptions for the rest of the options and formatting. +--help COMPLETE Fix non-ascii character diffs COMPLETE Changed name of asciifile() to istextfile() and detects if file is binary. Test script COMPLETE From owner-svn-soc-all@FreeBSD.ORG Sat Jun 30 12:25:18 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 3167D10656B8 for ; Sat, 30 Jun 2012 12:25:16 +0000 (UTC) (envelope-from aleek@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sat, 30 Jun 2012 12:25:16 +0000 Date: Sat, 30 Jun 2012 12:25:16 +0000 From: aleek@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120630122516.3167D10656B8@hub.freebsd.org> Cc: Subject: socsvn commit: r238629 - in soc2012/aleek/beaglexm-armv6/sys: arm/ti arm/ti/am37x boot/fdt/dts X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jun 2012 12:25:18 -0000 Author: aleek Date: Sat Jun 30 12:25:15 2012 New Revision: 238629 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238629 Log: enabled sdma controller Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.h soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer_tc.c soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_prcm.c soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/files.am37x soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_sdma.c soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_sdmareg.h soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.h ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.h Sat Jun 30 07:52:06 2012 (r238628) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer.h Sat Jun 30 12:25:15 2012 (r238629) @@ -114,13 +114,6 @@ void omap3_gptimer_intr_filter_ack(struct omap3_gptimer_softc *sc); -static inline uint32_t -omap3_gptimer_readl(struct omap3_gptimer_softc *sc, bus_size_t off); - - -static inline void -omap3_gptimer_writel(struct omap3_gptimer_softc *sc, bus_size_t off, uint32_t val); - int omap3_gptimer_activate(struct omap3_gptimer_softc *sc, unsigned int flags, unsigned int time_us, void (*callback)(void *data), void *data); Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer_tc.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer_tc.c Sat Jun 30 07:52:06 2012 (r238628) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_gptimer_tc.c Sat Jun 30 12:25:15 2012 (r238629) @@ -66,17 +66,14 @@ #include #include +#define gptimer_read_4(reg) bus_read_4( sc->mem_res, reg ) +#define gptimer_write_4(reg, val) bus_write_4( sc->mem_res, reg, val ) + static struct omap3_gptimer_softc *g_omap3_gptimer_sc_tc = NULL; static struct omap3_gptimer_softc *g_omap3_gptimer_sc_et = NULL; static unsigned int delay_loops_per_us = 100; - -/** - * Timer for tick counting. This is used to measure time by CPU - */ -//static struct omap3_gptimer *omap3_gptimer_tc_tmr = NULL; - /** * Struct used by tc_init(), to init the timecounter */ @@ -121,7 +118,7 @@ * */ static int -omap3_calibrate_delay_loop(struct timecounter *tc) +omap3_calibrate_delay_loop(struct omap3_gptimer_softc *sc, struct timecounter *tc) { u_int oldirqstate; unsigned int start, end; @@ -133,7 +130,7 @@ start = omap3_gptimer_tc_get_timecount(tc); //__omap3_delay(10240); for (int usec=10240; usec > 0; usec--) - for (int32_t counts = 200; counts > 0; counts--) + //for (int32_t counts = 200; counts > 0; counts--) /* Prevent gcc from optimizing out the loop */ cpufunc_nullop(); @@ -145,7 +142,7 @@ nanosecs = ((uint64_t)(end - start) * 1000000000ULL) / tc->tc_frequency; delay_loops_per_us = (unsigned int)((uint64_t)(10240 * 1000) / nanosecs); - printf("OMAP3: delay loop calibrated to %u cycles\n", delay_loops_per_us); + device_printf( sc->sc_dev, "Delay loop calibrated to %u cycles\n", delay_loops_per_us); return (0); } @@ -185,7 +182,7 @@ if (!(sc->flags & OMAP3_GPTIMER_ACTIVATED_FLAG)) { ret = EINVAL; } else { - *cnt = omap3_gptimer_readl(sc, OMAP3_GPT_TCRR); + *cnt = gptimer_read_4(OMAP3_GPT_TCRR); ret = 0; } @@ -217,7 +214,7 @@ //OMAP3_GPTIMER_LOCK(sc); - omap3_gptimer_writel(sc, OMAP3_GPT_TCRR, cnt); + gptimer_write_4(OMAP3_GPT_TCRR, cnt); //OMAP3_GPTIMER_UNLOCK(sc); @@ -225,36 +222,6 @@ } -/** - * omap3_gptimer_readl - reads a 32-bit value from one of the timer registers - * @timer: Timer device context - * @off: The offset of a register from the timer register address range - * - * - * RETURNS: - * 32-bit value read from the register. - */ -static inline uint32_t -omap3_gptimer_readl(struct omap3_gptimer_softc *sc, bus_size_t off) -{ - return (bus_read_4(sc->mem_res, off)); -} - -/** - * omap3_gptimer_writel - writes a 32-bit value to one of the timer registers - * @timer: Timer device context - * @off: The offset of a register from the timer register address range - * @val: The value to write into the register - * - * - * RETURNS: - * nothing - */ -static inline void -omap3_gptimer_writel(struct omap3_gptimer_softc *sc, bus_size_t off, uint32_t val) -{ - bus_write_4(sc->mem_res, off, val); -} /** * omap_gptimer_get_freq - gets the frequency of an activated timer @@ -293,14 +260,14 @@ //OMAP3_GPTIMER_LOCK(sc); /* Determine if the pre-scalar is enabled and if so the prescaler value */ - tclr = omap3_gptimer_readl(sc, OMAP3_GPT_TCLR); + tclr = gptimer_read_4(OMAP3_GPT_TCLR); if (tclr & TCLR_PRE) prescaler = 1UL << (((tclr & TCLR_PTV_MASK) >> 2) + 1); else prescaler = 1; /* Get the reload count */ - tldr = omap3_gptimer_readl(sc, OMAP3_GPT_TLDR); + tldr = gptimer_read_4(OMAP3_GPT_TLDR); //OMAP3_GPTIMER_UNLOCK(sc); @@ -386,13 +353,13 @@ /* Reset the timer and poll on the reset complete flag */ if (sc->profile == OMAP_GPTIMER_PROFILE_OMAP3) { - omap3_gptimer_writel(sc, OMAP3_GPT_TIOCP_CFG, 0x2); + gptimer_write_4(OMAP3_GPT_TIOCP_CFG, 0x2); /* TODO: add a timeout */ - while ((omap3_gptimer_readl(sc, OMAP3_GPT_TISTAT) & 0x01) == 0x00) + while ((gptimer_read_4(OMAP3_GPT_TISTAT) & 0x01) == 0x00) continue; /* Clear the interrupt status */ - omap3_gptimer_writel(sc, OMAP3_GPT_TISR, TCAR | OVF | MAT); + gptimer_write_4(OMAP3_GPT_TISR, TCAR | OVF | MAT); } /* If the user supplied a zero value we set a free running timer */ @@ -430,33 +397,33 @@ /* Adjust the count and apply the prescaler */ tickcount >>= (prescaler + 1); - val = omap3_gptimer_readl(sc, OMAP3_GPT_TCLR); + val = gptimer_read_4(OMAP3_GPT_TCLR); val &= ~TCLR_PTV_MASK; val |= TCLR_PRE | (prescaler << 2); - omap3_gptimer_writel(sc, OMAP3_GPT_TCLR, val); + gptimer_write_4(OMAP3_GPT_TCLR, val); } /* Calculate the start value */ startcount = 0xFFFFFFFFUL - (uint32_t)(tickcount & 0xFFFFFFFFUL); - printf("%s, %d : freq64=%llu : tickcount=%llu : startcount=%u : time_us=%u\n", + device_printf( sc->sc_dev, "%s, %d : freq64=%llu : tickcount=%llu : startcount=%u : time_us=%u\n", __func__, __LINE__, freq64, tickcount, startcount, time_us); } /* Load the start value into the count register */ - omap3_gptimer_writel(sc, OMAP3_GPT_TCRR, startcount); + gptimer_write_4(OMAP3_GPT_TCRR, startcount); /* Enable autoload mode if configuring a periodic timer or system tick * timer. Also set the reload count to match the period tick count. */ if (flags & OMAP3_GPTIMER_PERIODIC_FLAG) { /* Enable auto reload */ - val = omap3_gptimer_readl(sc, OMAP3_GPT_TCLR); + val = gptimer_read_4(OMAP3_GPT_TCLR); val |= TCLR_AR; - omap3_gptimer_writel(sc, OMAP3_GPT_TCLR, val); + gptimer_write_4(OMAP3_GPT_TCLR, val); /* Set the reload value */ - omap3_gptimer_writel(sc, OMAP3_GPT_TLDR, startcount); + gptimer_write_4(OMAP3_GPT_TLDR, startcount); } /* If a callback function has been supplied setup a overflow interrupt */ @@ -475,9 +442,9 @@ /* Enable the overflow interrupts. */ if (sc->profile == OMAP_GPTIMER_PROFILE_OMAP3) { - val = omap3_gptimer_readl(sc, OMAP3_GPT_TIER); + val = gptimer_read_4(OMAP3_GPT_TIER); val |= OVF; - omap3_gptimer_writel(sc, OMAP3_GPT_TIER, val); + gptimer_write_4(OMAP3_GPT_TIER, val); } } @@ -510,9 +477,9 @@ //OMAP3_GPTIMER_LOCK(sc); - val = omap3_gptimer_readl(sc, OMAP3_GPT_TCLR); + val = gptimer_read_4(OMAP3_GPT_TCLR); val |= TCLR_ST; - omap3_gptimer_writel(sc, OMAP3_GPT_TCLR, val); + gptimer_write_4(OMAP3_GPT_TCLR, val); //OMAP3_GPTIMER_UNLOCK(sc); @@ -541,9 +508,9 @@ //OMAP3_GPTIMER_LOCK(sc); - val = omap3_gptimer_readl(sc, OMAP3_GPT_TCLR); + val = gptimer_read_4(OMAP3_GPT_TCLR); val &= ~TCLR_ST; - omap3_gptimer_writel(sc, OMAP3_GPT_TCLR, val); + gptimer_write_4(OMAP3_GPT_TCLR, val); //OMAP3_GPTIMER_UNLOCK(sc); @@ -594,9 +561,9 @@ /* Enable the overflow interrupts */ if (sc->profile == OMAP_GPTIMER_PROFILE_OMAP3) { - val = omap3_gptimer_readl(sc, OMAP3_GPT_TIER); + val = gptimer_read_4(OMAP3_GPT_TIER); val |= OVF; - omap3_gptimer_writel(sc, OMAP3_GPT_TIER, val); + gptimer_write_4(OMAP3_GPT_TIER, val); } //OMAP3_GPTIMER_UNLOCK(sc); @@ -623,11 +590,11 @@ /* Read the interrupt status flag and clear it */ /* Read the status and it with the enable flag */ - stat = omap3_gptimer_readl(sc, OMAP3_GPT_TISR); - stat &= omap3_gptimer_readl(sc, OMAP3_GPT_TIER); + stat = gptimer_read_4(OMAP3_GPT_TISR); + stat &= gptimer_read_4(OMAP3_GPT_TIER); /* Clear the status flag */ - omap3_gptimer_writel(sc, OMAP3_GPT_TISR, stat); + gptimer_write_4(OMAP3_GPT_TISR, stat); //OMAP3_GPTIMER_UNLOCK(sc); } @@ -686,11 +653,11 @@ if (sc->profile == OMAP_GPTIMER_PROFILE_OMAP3) { /* Read the status and it with the enable flag */ - stat = omap3_gptimer_readl(sc, OMAP3_GPT_TISR); - stat &= omap3_gptimer_readl(sc, OMAP3_GPT_TIER); + stat = gptimer_read_4(OMAP3_GPT_TISR); + stat &= gptimer_read_4(OMAP3_GPT_TIER); /* Clear the status flag */ - omap3_gptimer_writel(sc, OMAP3_GPT_TISR, stat); + gptimer_write_4(OMAP3_GPT_TISR, stat); } /* Store the callback details before releasing the lock */ @@ -820,7 +787,7 @@ tc_init(&omap3_gptimer_tc); /* Calibrate the delay loop */ - omap3_calibrate_delay_loop(&omap3_gptimer_tc); + omap3_calibrate_delay_loop( sc, &omap3_gptimer_tc); /* Restore interrupt state */ restore_interrupts(oldirqstate); Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_prcm.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_prcm.c Sat Jun 30 07:52:06 2012 (r238628) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_prcm.c Sat Jun 30 12:25:15 2012 (r238629) @@ -183,6 +183,9 @@ static int omap3_clk_generic_get_source_freq(struct ti_clock_dev *clkdev, unsigned int *freq); +static int +omap3_clk_alwayson_null_func(struct ti_clock_dev *clkdev); + static const struct ti_clk_details* omap3_clk_details(clk_ident_t id); @@ -306,9 +309,9 @@ OMAP3_GENERIC_CLOCK_DEV(I2C2_CLK), OMAP3_GENERIC_CLOCK_DEV(I2C3_CLK), +#endif /* sDMA */ OMAP3_ALWAYSON_CLOCK_DEV(SDMA_CLK), -#endif { INVALID_CLK_IDENT, NULL, NULL, NULL, NULL } }; @@ -767,11 +770,24 @@ return NULL; } - - - - - +/** + * omap3_clk_alwayson_null_func - dummy function for always on clocks + * @clkdev: pointer to the clock device structure (ignored) + * @mem_res: array of memory resources mapped when PRCM driver attached (ignored) + * + * + * + * LOCKING: + * Inherits the locks from the omap_prcm driver, no internal locking. + * + * RETURNS: + * Returns 0 on success or a positive error code on failure. + */ +static int +omap3_clk_alwayson_null_func(struct ti_clock_dev *clkdev) +{ + return (0); +} /** Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/files.am37x ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/files.am37x Sat Jun 30 07:52:06 2012 (r238628) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/files.am37x Sat Jun 30 12:25:15 2012 (r238629) @@ -3,9 +3,8 @@ arm/ti/aintc.c standard arm/ti/am37x/am37x_prcm.c standard arm/ti/am37x/am37x_gptimer_tc.c standard -#arm/ti/am37x/am37x_gptimer_et.c standard arm/ti/am37x/am37x_scm_padconf.c standard -arm/ti/ti_edma3.c standard +arm/ti/ti_sdma.c standard arm/ti/ti_mmchs.c optional mmc arm/ti/cpsw/if_cpsw.c optional cpsw arm/ti/am37x/am37x_early_uart.c standard Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_sdma.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_sdma.c Sat Jun 30 07:52:06 2012 (r238628) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_sdma.c Sat Jun 30 12:25:15 2012 (r238629) @@ -201,6 +201,17 @@ } /** + * ti_sdma_is_am37x_rev - returns true if H/W is from OMAP4 series + * @sc: DMA device context + * + */ +static inline int +ti_sdma_is_am37x_rev(struct ti_sdma_softc *sc) +{ + return (sc->sc_hw_rev == DMA4_AM37X_REV); +} + +/** * ti_sdma_intr - interrupt handler for all 4 DMA IRQs * @arg: ignored * @@ -1176,7 +1187,7 @@ sc->sc_hw_rev = ti_sdma_read_4(sc, DMA4_REVISION); device_printf(dev, "sDMA revision %08x\n", sc->sc_hw_rev); - if (!ti_sdma_is_omap4_rev(sc) && !ti_sdma_is_omap3_rev(sc)) { + if (!ti_sdma_is_omap4_rev(sc) && !ti_sdma_is_omap3_rev(sc) && !ti_sdma_is_am37x_rev(sc)) { device_printf(sc->sc_dev, "error - unknown sDMA H/W revision\n"); return (EINVAL); } @@ -1223,6 +1234,7 @@ if (err) panic("%s: Cannot register IRQ", device_get_name(dev)); + // @todo XXX sc shoudn't be stored globally /* Store the DMA structure globally ... this driver should never be unloaded */ ti_sdma_sc = sc; Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_sdmareg.h ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_sdmareg.h Sat Jun 30 07:52:06 2012 (r238628) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_sdmareg.h Sat Jun 30 12:25:15 2012 (r238629) @@ -127,5 +127,6 @@ */ #define DMA4_OMAP3_REV 0x00000040 #define DMA4_OMAP4_REV 0x00010900 +#define DMA4_AM37X_REV 0x00000050 #endif /* __TI_SDMAREG_H__ */ Modified: soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Sat Jun 30 07:52:06 2012 (r238628) +++ soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Sat Jun 30 12:25:15 2012 (r238629) @@ -137,6 +137,13 @@ clock-frequency = < 48000000 >; /* FIXME */ }; + sdma@48056000 { + compatible = "ti,sdma"; + reg = < 0x48056000 0x1000 >; + interrupts = < 12 13 14 15 >; + interrupt-parent = <&AINTC>; + }; + i2c0: i2c@48070000 { From owner-svn-soc-all@FreeBSD.ORG Sat Jun 30 14:05:23 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 18355106566B for ; Sat, 30 Jun 2012 14:05:21 +0000 (UTC) (envelope-from aleek@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sat, 30 Jun 2012 14:05:21 +0000 Date: Sat, 30 Jun 2012 14:05:21 +0000 From: aleek@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120630140521.18355106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r238631 - in soc2012/aleek/beaglexm-armv6/sys: arm/conf arm/ti arm/ti/am37x boot/fdt/dts X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jun 2012 14:05:23 -0000 Author: aleek Date: Sat Jun 30 14:05:20 2012 New Revision: 238631 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238631 Log: added gpio support fot am37x SoC Modified: soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_prcm.c soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_gpio.c soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Modified: soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM Sat Jun 30 13:17:21 2012 (r238630) +++ soc2012/aleek/beaglexm-armv6/sys/arm/conf/BEAGLEBOARD-XM Sat Jun 30 14:05:20 2012 (r238631) @@ -77,8 +77,8 @@ # MMC/SD/SDIO card slot support -#device mmc # mmc/sd bus -#device mmcsd # mmc/sd flash cards +device mmc # mmc/sd bus +device mmcsd # mmc/sd flash cards # Boot device is 2nd slice on MMC/SD card #options ROOTDEVNAME=\"ufs:mmcsd0s2\" @@ -99,7 +99,7 @@ #device am37x_pmic # AM335x Power Management IC (TPC65217) # GPIO -#device gpio +device gpio # USB support #device usb Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_prcm.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_prcm.c Sat Jun 30 13:17:21 2012 (r238630) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/am37x/am37x_prcm.c Sat Jun 30 14:05:20 2012 (r238631) @@ -286,16 +286,16 @@ OMAP3_GPTIMER_CLOCK_DEV(GPTIMER9_CLK), OMAP3_GPTIMER_CLOCK_DEV(GPTIMER10_CLK), OMAP3_GPTIMER_CLOCK_DEV(GPTIMER11_CLK), -#if 0 /* MMC device clocks (MMC1 and MMC2 can have different input clocks) */ OMAP3_GENERIC_CLOCK_DEV(MMC1_CLK), +#if 0 OMAP3_GENERIC_CLOCK_DEV(MMC2_CLK), OMAP3_GENERIC_CLOCK_DEV(MMC3_CLK), /* USB HS (high speed TLL, EHCI and OHCI) */ OMAP3_GENERIC_CLOCK_DEV(USBTLL_CLK), OMAP3_HSUSBHOST_CLOCK_DEV(USBHSHOST_CLK), - +#endif /* GPIO */ OMAP3_GENERIC_CLOCK_DEV(GPIO1_CLK), OMAP3_GENERIC_CLOCK_DEV(GPIO2_CLK), @@ -303,7 +303,7 @@ OMAP3_GENERIC_CLOCK_DEV(GPIO4_CLK), OMAP3_GENERIC_CLOCK_DEV(GPIO5_CLK), OMAP3_GENERIC_CLOCK_DEV(GPIO6_CLK), - +#if 0 /* I2C */ OMAP3_GENERIC_CLOCK_DEV(I2C1_CLK), OMAP3_GENERIC_CLOCK_DEV(I2C2_CLK), Modified: soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_gpio.c ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_gpio.c Sat Jun 30 13:17:21 2012 (r238630) +++ soc2012/aleek/beaglexm-armv6/sys/arm/ti/ti_gpio.c Sat Jun 30 14:05:20 2012 (r238631) @@ -69,7 +69,7 @@ /* Register definitions */ #define TI_GPIO_REVISION 0x0000 #define TI_GPIO_SYSCONFIG 0x0010 -#if defined(SOC_OMAP3) +#if defined(SOC_OMAP3) || defined(SOC_TI_AM37X) #define TI_GPIO_REVISION 0x0000 #define TI_GPIO_SYSCONFIG 0x0010 #define TI_GPIO_SYSSTATUS 0x0014 @@ -136,7 +136,7 @@ #endif /*Other SoC Specific definitions*/ -#if defined(SOC_OMAP3) +#if defined(SOC_OMAP3) || defined(SOC_TI_AM37X) #define MAX_GPIO_BANKS 6 #define FIRST_GPIO_BANK 1 #define PINS_PER_BANK 32 Modified: soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts ============================================================================== --- soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Sat Jun 30 13:17:21 2012 (r238630) +++ soc2012/aleek/beaglexm-armv6/sys/boot/fdt/dts/beagleboardxm.dts Sat Jun 30 14:05:20 2012 (r238631) @@ -144,6 +144,15 @@ interrupt-parent = <&AINTC>; }; + mmchs@4809c000 { + compatible = "ti,mmchs"; + reg =<0x4809c000 0x1000 >; + interrupts = <83>; + interrupt-parent = <&AINTC>; + mmchs-device-id = <0>; + }; + + i2c0: i2c@48070000 { From owner-svn-soc-all@FreeBSD.ORG Sat Jun 30 14:08:47 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 24C101065696 for ; Sat, 30 Jun 2012 14:08:45 +0000 (UTC) (envelope-from tzabal@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Sat, 30 Jun 2012 14:08:45 +0000 Date: Sat, 30 Jun 2012 14:08:45 +0000 From: tzabal@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120630140845.24C101065696@hub.freebsd.org> Cc: Subject: socsvn commit: r238632 - soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jun 2012 14:08:47 -0000 Author: tzabal Date: Sat Jun 30 14:08:44 2012 New Revision: 238632 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=238632 Log: Add the function clear_xml() that replaces the characters of the report that have special meaning in XML with the predefined entity references. 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 Jun 30 14:05:20 2012 (r238631) +++ soc2012/tzabal/client-side/akcrs-head/usr.sbin/crashreport/crashreport.sh Sat Jun 30 14:08:44 2012 (r238632) @@ -1,9 +1,9 @@ #!/bin/sh # -# Crashreport is a program that is responsible to locate, collect and send -# the debugging information of a FreeBSD kernel crash to a central machine -# that collects these reports for analysis from the FreeBSD community and -# the FreeBSD developers. +# Crashreport is a program that is responsible to locate, collect, form and +# transfer the debugging information of a FreeBSD kernel crash to a central +# machine that collects these reports for analysis from the FreeBSD community +# and the FreeBSD developers. # [ -f /etc/rc.conf ] && . /etc/rc.conf @@ -21,6 +21,28 @@ echo "${PROG}: Error: $*" 1>&2 } +# Replace the characters of the report that have special +# meaning in XML with the predefined entity references +clear_xml() +{ + local istag= + local linenumber=0 + while read line; do + istag='false' + linenumber=$((linenumber+1)) + echo "${line}" | egrep "${tags}" > /dev/null + if [ $? -eq 0 ]; then + istag='true' + fi + if [ "${istag}" == 'false' ]; then + echo "${line}" | grep '[&<>]' > /dev/null + if [ $? -eq 0 ]; then + sed -i '' "${linenumber}s/ /dev/null 2>&1 @@ -138,14 +160,16 @@ ## Form the report data=`mktemp /tmp/crashreport.XXXXXX` -tmp_file=`mktemp /tmp/crashreport.XXXXXX` -orig_IFS="${IFS}" -IFS=";" commands1="date/3;hostname/5;ostype/6;osrelease/7;version/8;machine/9" commands2="ps -axl;vmstat -s;vmstat -m;vmstat -z;vmstat -i;pstat -T;pstat -s;\ iostat;ipcs -a;ipcs -T;nfsstat;netstat -s;netstat -m;netstat -id;netstat -anr;\ netstat -anA;netstat -aL;fstat;dmesg;kernel config;ddb capture buffer" +tags="()|(
)|()|()|()\ +|()|(
)|()|()|()|()|()\ +|()|()|()|()" start=3 +orig_IFS="${IFS}" +IFS=";" echo "" > ${data} echo "" >> ${data} @@ -172,7 +196,10 @@ echo "" >> ${data} if [ "${type}" == 'vmcore' ]; then - # For: date, hostname, ostype, osrelease, version, machine + # A temporary-auxiliary file for the extraction + tmp_file=`mktemp /tmp/crashreport.XXXXXX` + + # For date, hostname, ostype, osrelease, version, machine for cmd in $commands1; do echo "" >> ${data} echo "" >> ${data} @@ -185,7 +212,7 @@ echo "" >> ${data} done - # Panic Message (panic) + # Panic Message echo "" >> ${data} echo "" >> ${data} echo "panic" >> ${data} @@ -197,7 +224,7 @@ echo "" >> ${data} echo "" >> ${data} - # Backtrace (bt from kgdb) + # Backtrace echo "" >> ${data} echo "" >> ${data} echo "backtrace" >> ${data} @@ -227,7 +254,7 @@ echo "" >> ${data} echo "" >> ${data} - # From ps -axl until end + # For ps -axl until end for cmd in $commands2; do echo "" >> ${data} echo "" >> ${data} @@ -242,10 +269,13 @@ echo "" >> ${data} echo "" >> ${data} done + + clear_xml + rm "${tmp_file}" else # A temporary directory for the contents of the textdump tmp_dir=`mktemp -d /tmp/crashreport.XXXXXX` - tar -xvf "${_dumpdir}/${_file}" -C "${tmp_dir}" + tar -xf "${_dumpdir}/${_file}" -C "${tmp_dir}" # A valid textdump can contain up to 5 files with the following names: # ddb.txt, config.txt, msgbuf.txt, panic.txt and version.txt @@ -255,7 +285,7 @@ while read line; do echo "${line}" | egrep '^.+> [a-z ]+$' > /dev/null if [ $? -eq 0 ]; then - if [ ${flag} == false ]; then + if [ "${flag}" == false ]; then flag='true' echo "" >> ${data} echo "" >> ${data} @@ -276,7 +306,7 @@ else echo "${line}" >> ${data} fi - done < ${orig_file} + done < "${tmp_dir}/ddb.txt" echo "" >> ${data} echo "" >> ${data} fi @@ -324,7 +354,8 @@ echo "" >> ${data} echo "" >> ${data} fi - + + clear_xml rm -r "${tmp_dir}" fi @@ -346,7 +377,7 @@ exit 1 fi -rm -f "${data}" "${tmp_file}" +rm -f "${data}" ## Send the report to the Central Collector machine