Re: O_DIRECT on stdin?

2005-11-07 Thread Alex Fraser
"Gordon Burditt" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > >I want to be able to read a HUGE file without having such a negative > >impact on the system's buffer cache. [snip] > Does O_DIRECT perhaps invoke some of the restrictions of "raw" > device files, where the current offs

Re: O_DIRECT on stdin?

2005-11-07 Thread Donn Cave
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > Here's some text from my open(2) manpage: > Transfer sizes, and the alignment of user buffer and file offset must > all > be multiples of the logical block size of the file system. Does that apply in the example he gave,

Re: O_DIRECT on stdin?

2005-11-07 Thread jepler
Here's some text from my open(2) manpage: Transfer sizes, and the alignment of user buffer and file offset must all be multiples of the logical block size of the file system. It's unlikely that in practice you can get Python's sys.stdin.read() or os.read() to reliably use a buffer that

Re: O_DIRECT on stdin?

2005-11-07 Thread Dan Stromberg
On Mon, 07 Nov 2005 20:42:50 +, Gordon Burditt wrote: >> [quoted text muted] > > Does O_DIRECT perhaps invoke some of the restrictions of "raw" > device files, where the current offset and transfer size must be a > multiple of some block size? (I don't see any mention of that in > FreeBSD's

Re: O_DIRECT on stdin?

2005-11-07 Thread Gordon Burditt
cntl.fcntl(sys.stdin.fileno(), fcntl.F_GETFL) > > flags |= os.O_DIRECT > fcntl.fcntl(sys.stdin.fileno(), fcntl.F_SETFL, flags) > except: > sys.stderr.write('Setting O_DIRECT on stdin attempted > but failed\n') >

Re: O_DIRECT on stdin?

2005-11-07 Thread Dan Stromberg
fcntl.fcntl(sys.stdin.fileno(), fcntl.F_SETFL, flags) except: sys.stderr.write('Setting O_DIRECT on stdin attempted but failed\n') else: sys.stderr.write('Setting O_DIRECT on stdin s

Re: O_DIRECT on stdin?

2005-11-07 Thread jepler
I think this is fcntl(..., F_SETFL, ...), so something like import os, fcntl, sys flags = fcntl.fcntl(sys.stdin.fileno(), fcntl.F_GETFL) flags |= os.O_DIRECT fcntl.fcntl(sys.stdin.fileno(), fcntl.F_SETFL, flags) Jeff pgpx52DBavw3Y.pgp Description: PGP signature -- http://m

Re: O_DIRECT on stdin?

2005-11-07 Thread Gordon Burditt
>Is there a way of setting O_DIRECT on a preexisting file like sys.stdin? > >Does C allow this sort of thing? There is no O_DIRECT or fcntl() in Standard C. fcntl() operates on an open file descriptor, and the file descriptor for stdin is 0. Two calls to fcntl(), one with F_GETFL and one with F_

O_DIRECT on stdin?

2005-11-07 Thread Dan Stromberg
Is there a way of setting O_DIRECT on a preexisting file like sys.stdin? Does C allow this sort of thing? Thanks! -- http://mail.python.org/mailman/listinfo/python-list