From owner-freebsd-bugs Wed Mar 12 21:10:04 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id VAA05208 for bugs-outgoing; Wed, 12 Mar 1997 21:10:04 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id VAA05202; Wed, 12 Mar 1997 21:10:02 -0800 (PST) Date: Wed, 12 Mar 1997 21:10:02 -0800 (PST) Message-Id: <199703130510.VAA05202@freefall.freebsd.org> To: freebsd-bugs Cc: From: Stephen McKay Subject: Re: kern/2966: ftruncate() problem in FreeBSD 2.1.7-RELEASE i386 Reply-To: Stephen McKay Sender: owner-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk The following reply was made to PR kern/2966; it has been noted by GNATS. From: Stephen McKay To: j@uriah.heep.sax.de (J Wunsch) Cc: freebsd-gnats-submit@freebsd.org, syssgm@devetir.qld.gov.au Subject: Re: kern/2966: ftruncate() problem in FreeBSD 2.1.7-RELEASE i386 Date: Thu, 13 Mar 1997 14:56:45 +1000 (EST) j@uriah.heep.sax.de (J Wunsch) wrote: > [Rick Ace misuses ftruncate()] > > Rule #1: Thou shalt declare all your functions. > > ftruncate() takes an argument of type off_t. If you fail to declare > this function (and fail to cast the argument), you get what you > deserve. > > #include Is it time to special-case truncate() and ftruncate() in like lseek()? Ugly or not, it should reduce surprises. These 3 should be the only special ones. mmap() uses off_t, but you can't get by without , and that declares mmap() correctly. An other option is to include clever macro stuff in so that use of lseek, truncate, and ftruncate is impossible unless is also included. Actually, I'm just being silly here :-) though it can be done this way: In #ifndef _UNISTD_H_ #define truncate read_thine_C_book_novice #endif In #undef truncate int truncate __P((const char *, off_t)); :-) :-) Stephen.