Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site utah-cs.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxj!cbosgd!ihnp4!zehntel!hplabs!utah-cs!donn From: donn@utah-cs.UUCP (Donn Seeley) Newsgroups: net.unix-wizards,net.bugs.4bsd Subject: Re: Q: lseek returns long or int? (BSD 4.2) Message-ID: <3041@utah-cs.UUCP> Date: Sun, 23-Sep-84 07:40:02 EDT Article-I.D.: utah-cs.3041 Posted: Sun Sep 23 07:40:02 1984 Date-Received: Wed, 26-Sep-84 05:30:55 EDT References: <119@cybvax0.UUCP> <4327@utzoo.UUCP> Organization: University of Utah CS Dept Lines: 84 From henry@utzoo.UUCP (Henry Spencer): This is yet another piece of gratuitous brain-damage brought to you by the morons at Berkeley. ... This is yet another gratuitous insult from someone who should have better things to do. I have no illusions that a lecture on the joys of being constructive would be other than wasted breath (or keystrokes), so I will merely point out that if there weren't any constructive people, we wouldn't have Unix at all. It IS a bit ironic that this latest flap involves typing, since the Berkeley kernel is fairly obsessive in using typedefs to make types system-independent. For instance, the lseek() call has its own typedef, 'off_t', for representing the type of a file offset; this is surely a greater nod to portability than merely stamping the value as 'long'. At any rate the manual page chooses not to use this typedef, which is probably a mistake. It is easily corrected if one spends a minute or two looking at the situation (in man2/lseek.2): ------------------------------------------------------------------------ *** /tmp/,RCSt1023012 Sun Sep 23 05:17:09 1984 --- lseek.2 Sun Sep 23 04:56:28 1984 *************** *** 5,11 .SH SYNOPSIS .nf .ft B ! .ta 1.25i 1.6i #define L_SET 0 /* set the seek pointer */ #define L_INCR 1 /* increment the seek pointer */ #define L_XTND 2 /* extend the file size */ --- 5,16 ----- .SH SYNOPSIS .nf .ft B ! #include! #include ! .PP ! .nf ! .ft B ! .ta 1.25i 1.6i 1.8i #define L_SET 0 /* set the seek pointer */ #define L_INCR 1 /* increment the seek pointer */ #define L_XTND 2 /* extend the file size */ *************** *** 12,19 .PP .ft B pos = lseek(d, offset, whence) ! int pos; ! int d, offset, whence; .fi .ft R .SH DESCRIPTION --- 17,26 ----- .PP .ft B pos = lseek(d, offset, whence) ! off_t pos; ! int d; ! off_t offset; ! int whence; .fi .ft R .SH DESCRIPTION ------------------------------------------------------------------------ Despite this trivial problem, lseek.2 and the 4.2 manual entries in general are definitely a vast improvement over the earlier Berkeley versions, which usually failed to enumerate the errors which a call could return and sometimes even omitted the return values. Many things which used to be magic cookies in previous versions of the system, such as lseek()'s 'whence', are now clearly parameterized (perhaps influenced by USG Unixes). Efforts at improvement such as this should be commended, not sneered at. Waiting for a return to civility (but not holding my breath), Donn Seeley University of Utah CS Dept donn@utah-cs.arpa 40 46' 6"N 111 50' 34"W (801) 581-5668 decvax!utah-cs!donn