From owner-svn-src-head@FreeBSD.ORG Mon Aug 5 01:35:16 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 30EA854A; Mon, 5 Aug 2013 01:35:16 +0000 (UTC) (envelope-from jbeich@tormail.org) Received: from outgoing.tormail.org (outgoing.tormail.org [82.221.96.22]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D5F5421AB; Mon, 5 Aug 2013 01:35:15 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=internal.tormail.org) by outgoing.tormail.org with esmtp (Exim 4.72) (envelope-from ) id 1V69hR-0006EL-RB; Mon, 05 Aug 2013 05:35:06 +0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tormail.org; s=tm; h=Message-Id:Date:X-TorMail-User:Content-Type:MIME-Version:References:In-Reply-To:Subject:Cc:To:From; bh=GnnXe7NCtM6ThPPZ8Wn3qAqb3KlNJjsW8H43xlHWJGY=; b=GaMbgY1q08WRElmNHV5F6yseKFUs6OcNMZxXgvBMMlKz+/GwwPKyB0xHSz2oN3PHArIud+0NC7UCSAVq2s+noKv9M/G421IuDRVwLD0R8EzGkVp3UWkkA4VwsQyY/KewV/zCQoRInCgEDxIo17/pGVioSehjtVgYlw3i1wkbrOw=; Received: from jbeich by internal.tormail.org with local (Exim 4.63) (envelope-from ) id 1V65V2-0001RI-Fu; Sun, 04 Aug 2013 21:06:05 +0000 From: Jan Beich To: Marcel Moolenaar Subject: Re: svn commit: r253862 - head/sys/boot/ficl In-Reply-To: <201308011806.r71I6xpd088690@svn.freebsd.org> (Marcel Moolenaar's message of "Thu, 1 Aug 2013 18:06:59 +0000 (UTC)") References: <201308011806.r71I6xpd088690@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain X-TorMail-User: jbeich Date: Sun, 04 Aug 2013 21:06:05 +0000 Message-Id: <1V65V2-0001RI-Fu@internal.tormail.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Aug 2013 01:35:16 -0000 Marcel Moolenaar writes: > + static union { > + struct dirent dirent; > + char buf[512]; > + } u; > + off_t off; > + int len; [...] > + /* > + * The readdirfd() function is specific to the loader environment. > + * We do the best we can to make freaddir work, but it's not at > + * all guaranteed. > + */ > + off = lseek(fd, 0LL, SEEK_CUR); > + len = getdents(fd, u.buf, sizeof(u.buf)); > + d = (len != -1) ? &u.dirent : NULL; > + if (d != NULL) > + lseek(fd, off + d->d_reclen, SEEK_SET); How did you test? I can't make the code work on amd64 using either ficl32 or ficl64. # r253862 ok> s" /bin" 0 fopen ok> dup freaddir . type cr -1 . ok> dup freaddir . type cr -1 sleep ok> dup freaddir . type cr -1 sleep ok> dup freaddir . type cr -1 sleep ok> dup freaddir . type cr -1 sleep # bin/172542 ok> s" /bin" 0 fopen ok> dup freaddir . type cr -1 . ok> dup freaddir . type cr -1 .. ok> dup freaddir . type cr -1 sleep ok> dup freaddir . type cr -1 domainname ok> dup freaddir . type cr -1 ps ok> dup freaddir . type cr -1 sync ok> dup freaddir . type cr -1 red # zfsloader (no '.' and '..' - zfs_readdir bug?) OK s" /bin" 0 fopen OK dup freaddir . type cr -1 cat OK dup freaddir . type cr -1 sh OK dup freaddir . type cr -1 chflags OK dup freaddir . type cr -1 chio OK dup freaddir . type cr -1 sleep OK dup freaddir . type cr -1 chmod Here's an example with a loop almost endless. # r253862 ok> s" /bin" lsdir . sleep sleep sleep ... \ list directory contents : lsdir ( dir -- ) 0 fopen begin dup freaddir while type cr repeat fclose ;