Messages in this thread | | | Date | Sun, 17 Mar 2002 15:00:18 +0000 | From | Anton Altaparmakov <> | Subject | Re: fadvise syscall? |
| |
At 14:31 17/03/02, Simon Richter wrote: >On Sun, 17 Mar 2002, Anton Altaparmakov wrote: > > > All of what you are asking for exists in Windows and all the semantics are > > implemented through a very powerful open(2) equivalent. I don't see why we > > shouldn't do the same. It makes more sense to me than inventing yet another > > system call... > >It is easier for application writers to code: > >[...] >#ifdef HAVE_FADVISE > (void)fadvise(fd, FADV_STREAMING); >#endif >[...] > >Than to have a forest of #ifdefs to determine which O_* flags are >supported. After all, we still want our programs to run under Solaris. :-)
Ugh. Both of your suggestions look ugly. Using the O_* flags, you just need to have a compatibility header file which contains:
#ifndef HAVE_O_SEQUENTIAL # define O_SEQUENTIAL 0 #endif
Then in the code you just use O_SEQUENTIAL and if the system doesn't know about it it is optimised away at compile time.
Note how nicely this fits in with autoconf/automake where the ./configure script can test for O_SEQUENTIAL and if it is not there automatically define it to 0. That then means your code is completely free from these ugly #ifdefs.
Thanks for making your point as that is ANOTHER argument for using open(2) instead of fadvise() [1]. (-;
Cheers,
Anton
[1] Yeah, I know, one could also define fadvise() to nothing in the compat header file...
-- "I've not lost my mind. It's backed up on tape somewhere." - Unknown -- Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @) Linux NTFS Maintainer / WWW: http://linux-ntfs.sf.net/ ICQ: 8561279 / WWW: http://www-stu.christs.cam.ac.uk/~aia21/
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |