The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: kstailey@yahoo.com (Kenneth Stailey)
Subject: [TUHS] question about mkfs(8) and stdio
Date: Sun, 14 Dec 2003 11:11:20 -0800 (PST)	[thread overview]
Message-ID: <20031214191120.7737.qmail@web60506.mail.yahoo.com> (raw)

Did stdio buffering change over time?

If you look at an old BSD mkfs for cylinder-group style file systems (not 7th
Ed filesystems) you will see the super block backup loop does not fflush(stdio)
between printf()s

        printf("super-block backups (for fsck -b#) at:");
        for (cylno = 0; cylno < sblock.fs_ncg; cylno++) {
                initcg(cylno);
                if (cylno % 10 == 0)
                        printf("\n");
                printf(" %d,", fsbtodb(&sblock, cgsblock(&sblock, cylno)));
        }

but I have memories that the superblocks were printed out one at a time as if
fflush(stdout) was called between them rather than one line at a time with
line-buffered stdio.

At some point I thought "SysV must have broke this" since newfs would print out
a complete row of superblock numbers at once with a big delay between the rows
rather than each superblock number with a short delay between each number.

But when I go searching the oldest BSD code has no fflush(stdout) the way
modern FreeBSD does:

        for (cylno = 0; cylno < sblock.fs_ncg; cylno++) {
                initcg(cylno, utime);
                if (mfs)
                        continue;
                j = snprintf(tmpbuf, sizeof(tmpbuf), " %ld%s",
                    fsbtodb(&sblock, cgsblock(&sblock, cylno)),
                    cylno < (sblock.fs_ncg-1) ? "," : "" );
                if (i + j >= width) {
                        printf("\n");
                        i = 0;
                }
                i += j;
                printf("%s", tmpbuf);
                fflush(stdout);
        }

Did stdio buffering change over time so that line buffering became the default?

Thanks,
Ken


__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree


             reply	other threads:[~2003-12-14 19:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-14 19:11 Kenneth Stailey [this message]
2003-12-15  0:48 John Holden
2003-12-15  1:22 Michael Sokolov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20031214191120.7737.qmail@web60506.mail.yahoo.com \
    --to=kstailey@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).