
Hello, The signature for openFD is openFd: FilePath -> OpenMode -> Maybe FileMode -> OpenFileFlags -> IO Fd I am currently reading http://www.haskell.org/ghc/docs/latest/html/libraries/unix/System-Posix-File... and diving down into links but can't find the definition of data type FileMode. ??? Basically I want to open in O_RDONLY filemode. Kind regards, Vasili

On Jan 30, 2008, at 23:05 , Galchin Vasili wrote:
Hello,
The signature for openFD is
openFd: FilePath -> OpenMode -> Maybe FileMode -> OpenFileFlags -> IO Fd
I am currently reading http://www.haskell.org/ghc/docs/latest/html/ libraries/unix/System-Posix-Files.html and diving down into links but can't find the definition of data type FileMode. ??? Basically I want to open in O_RDONLY filemode.
That's an OpenMode, not a FileMode. The FileMode values are at the top of System-Posix-Files.html and correspond to Unix open()'s third argument. (ownerReadMode, etc.) OpenMode is documented at the start of http://www.haskell.org/ghc/docs/latest/html/libraries/unix/System- Posix-IO.html . -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

I am trying to do the following on RedHat RHEL 5.0:
main = do
fs <- openFd "/dev/cdrom" ReadOnly (Just ???) defaultFileFlags
putStrLn (show fd)
what should (Just ???) be ???
Regards, Vasili
On Jan 30, 2008 11:10 PM, Brandon S. Allbery KF8NH
On Jan 30, 2008, at 23:05 , Galchin Vasili wrote:
Hello,
The signature for openFD is
openFd: FilePath -> OpenMode -> Maybe FileMode -> OpenFileFlags -> IO Fd
I am currently reading http://www.haskell.org/ghc/docs/latest/html/ libraries/unix/System-Posix-Files.html and diving down into links but can't find the definition of data type FileMode. ??? Basically I want to open in O_RDONLY filemode.
That's an OpenMode, not a FileMode. The FileMode values are at the top of System-Posix-Files.html and correspond to Unix open()'s third argument. (ownerReadMode, etc.) OpenMode is documented at the start of http://www.haskell.org/ghc/docs/latest/html/libraries/unix/System- Posix-IO.html .
-- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

i.e. only the Linux CDROM device driver in read-only mode....
V.
On Jan 30, 2008 11:23 PM, Galchin Vasili
I am trying to do the following on RedHat RHEL 5.0:
main = do fs <- openFd "/dev/cdrom" ReadOnly (Just ???) defaultFileFlags putStrLn (show fd)
what should (Just ???) be ???
Regards, Vasili
On Jan 30, 2008 11:10 PM, Brandon S. Allbery KF8NH
wrote: On Jan 30, 2008, at 23:05 , Galchin Vasili wrote:
Hello,
The signature for openFD is
openFd: FilePath -> OpenMode -> Maybe FileMode -> OpenFileFlags -> IO Fd
I am currently reading http://www.haskell.org/ghc/docs/latest/html/ libraries/unix/System-Posix-Files.html and diving down into links but can't find the definition of data type FileMode. ??? Basically I want to open in O_RDONLY filemode.
That's an OpenMode, not a FileMode. The FileMode values are at the top of System-Posix-Files.html and correspond to Unix open()'s third argument. (ownerReadMode, etc.) OpenMode is documented at the start of http://www.haskell.org/ghc/docs/latest/html/libraries/unix/System- Posix-IO.html .
-- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

On Jan 30, 2008, at 23:23 , Galchin Vasili wrote:
I am trying to do the following on RedHat RHEL 5.0:
main = do fs <- openFd "/dev/cdrom" ReadOnly (Just ???) defaultFileFlags putStrLn (show fd)
what should (Just ???) be ???
I think you can pass Nothing instead of a Just, since that argument is ignored when opening read only. If you feel you need to pass something, use nullFileMode. -- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH

MY bad!!!
I was trying to open "/dev/cdrom/" and not "dev/cdrom"!!! and hence
"/dev/cdrom/" was correctly treated as a directory ...
Vasili
On Jan 30, 2008 11:25 PM, Brandon S. Allbery KF8NH
On Jan 30, 2008, at 23:23 , Galchin Vasili wrote:
I am trying to do the following on RedHat RHEL 5.0:
main = do fs <- openFd "/dev/cdrom" ReadOnly (Just ???) defaultFileFlags putStrLn (show fd)
what should (Just ???) be ???
I think you can pass Nothing instead of a Just, since that argument is ignored when opening read only. If you feel you need to pass something, use nullFileMode.
-- brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu electrical and computer engineering, carnegie mellon university KF8NH
participants (2)
-
Brandon S. Allbery KF8NH
-
Galchin Vasili