From owner-freebsd-bugs Mon Nov 6 1:30: 9 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 1D06037B4D7 for ; Mon, 6 Nov 2000 01:30:01 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id BAA48518; Mon, 6 Nov 2000 01:30:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: by hub.freebsd.org (Postfix, from userid 32767) id 4A66437B4CF; Mon, 6 Nov 2000 01:22:07 -0800 (PST) Message-Id: <20001106092207.4A66437B4CF@hub.freebsd.org> Date: Mon, 6 Nov 2000 01:22:07 -0800 (PST) From: kkanda@rc.m-kagaku.co.jp To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: gnu/22635: Why don't you use truncate(2) in libI77 Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 22635 >Category: gnu >Synopsis: Why don't you use truncate(2) in libI77 >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Mon Nov 06 01:30:00 PST 2000 >Closed-Date: >Last-Modified: >Originator: Katsuya KANDA >Release: FreeBSD 4.1-RELEASE i386 >Organization: Mitsubishi Chemical Corp. >Environment: FreeBSD izumo1 4.1-RELEASE FreeBSD 4.1-RELEASE #1: Tue Oct 10 20:24:40 JST 2000 katsuya@izumo1:/usr/src/sys/compile/IZUMO i386 >Description: LibI77 contains the truncation operation of files. Although FreeBSD has truncate(2) system call, the routine "t_runc" in endfile.c uses the copy-delete-recopy algorithm for file size truncation. This sometimes causes not only the lower performance but also the file system full. So the executables using f77(=g77) can not deal with a large sequential files which appear in large quantum chemistry, for example. "t_runc" routine seems to be used in backspace, close, endfile and rewind operations. "The Design and Implementation of the 4.4BSD" said that truncate(2) was introduced for Fortran's file operation.:-) >How-To-Repeat: The following fortran code causes file system full if the available disk space is smaller than 16MB. parameter (MX=1024*1024+1) real*8 a(MX) do i=1,MX a(i)=i enddo write(1)(a(i),i=1,MX) write(6,*)"write long file on 1" rewind 1 write(6,*)"rewind 1" write(1)(a(i),i=1,MX-1) write(6,*)"write short file on 1" rewind 1 write(6,*)"rewind 1" stop end >Fix: >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message