This is the mail archive of the libc-alpha@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [Michael Deutschmann <michael@talamasca.wkpowerlink.com>] libc/1424: llseek symbol is attractive nuisance


>>>>> Michael Deutschmann writes:

 > On 25 Nov 1999, you wrote:
>> Andreas Schwab <schwab@suse.de> writes:
>> 
>> > -Wimplicit is your friend.  There are _many_ other functions in glibc that
>> > are not declared by default (all GNU extensions).  A program that compiles
>> > and links successfully is not necessarily correct.
>> 
>> Yup, will not be changed.

 > But an llseek() prototype *never* appears, even if _GNU_SOURCE is defined.
 > And this llseek symbol means that autoconf's usual test will show the
 > library as having "llseek" functionality, which it doesn't really. 

 > Remember that the missing prototype causes a calling-convention screwup,
 > which makes llseek() dangerous.  Think about what can happen when to an
 > fsck program if the seek function cannot be trusted... it did, I'm told.  
 > T'so now maintains that you guys are ivory-tower lunatics over it.

 > Can we at least get a "The llseek function is dangerous and should not 
 > be used." message?

Here's a patch.  I'm not happy with the text of the message.  Anybody
with a better idea?

Andreas


1999-12-29  Andreas Jaeger  <aj@suse.de>

	* sysdeps/unix/sysv/linux/llseek.c: Emit link time warning for
	llseek.
        Requested by Michael Deutschmann <michael@talamasca.wkpowerlink.com>.

============================================================
Index: sysdeps/unix/sysv/linux/llseek.c
--- sysdeps/unix/sysv/linux/llseek.c	1999/12/19 05:24:31	1.6
+++ sysdeps/unix/sysv/linux/llseek.c	1999/12/29 13:20:19
@@ -23,6 +23,11 @@
 #include <sysdep.h>
 #include <sys/syscall.h>
 
+/* llseek doesn't have a prototype.  Since the second parameter is a
+   64bit type, this results in wrong behaviour if no prototype is
+   provided.  */
+link_warning (llseek, "the `llseek' function is dangerous and should not be used.")
+
 extern int __syscall__llseek (int fd, off_t offset_hi, off_t offset_lo,
 			      loff_t *result, int whence);
 

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.rhein-neckar.de

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]