PreviousUpNext

14.3.6  Posix_Io

The standard library Posix_Io api is a sub-API of the Posix_1003_1b API.

The above information is manually maintained and may contain errors.

api {    eqtype File_Descriptor ;
    eqtype Process_Id ;
    make_pipe : Void -> {infd:File_Descriptor,  outfd:File_Descriptor};
    dup : File_Descriptor -> File_Descriptor;
    dup2 : {new:File_Descriptor,  old:File_Descriptor} -> Void;
    close : File_Descriptor -> Void;
    read_vector : (File_Descriptor , Int)
                  -> vector_of_one_byte_unts::Vector;
    read_rw_vector : (File_Descriptor , rw_vector_slice_of_one_byte_unts::Slice)
                     -> Int;
    write_vector : (File_Descriptor , vector_slice_of_one_byte_unts::Slice)
                   -> Int;
    write_rw_vector : (File_Descriptor , rw_vector_slice_of_one_byte_unts::Slice)
                      -> Int;
    Whence  = SEEK_CUR | SEEK_END | SEEK_SET;
    package fd : api {
                     eqtype Flags ;
                     to_unt : Flags -> one_word_unt::Unt;
                     from_unt : one_word_unt::Unt -> Flags;
                     all : Flags;
                     flags : List(Flags ) -> Flags;
                     intersect : List(Flags ) -> Flags;
                     clear : (Flags , Flags) -> Flags;
                     all_set : (Flags , Flags) -> Bool;
                     any_set : (Flags , Flags) -> Bool;
                     cloexec : Flags;
                 };;
    package flags : api {
                        eqtype Flags ;
                        to_unt : Flags -> one_word_unt::Unt;
                        from_unt : one_word_unt::Unt -> Flags;
                        all : Flags;
                        flags : List(Flags ) -> Flags;
                        intersect : List(Flags ) -> Flags;
                        clear : (Flags , Flags) -> Flags;
                        all_set : (Flags , Flags) -> Bool;
                        any_set : (Flags , Flags) -> Bool;
                        append : Flags;
                        nonblock : Flags;
                        sync : Flags;
                        rsync : Flags;
                        dsync : Flags;
                    };;
    dupfd : {base:File_Descriptor,  old:File_Descriptor}
            -> File_Descriptor;
    getfd : File_Descriptor -> fd::Flags;
    setfd : (File_Descriptor , fd::Flags) -> Void;
    getfl : File_Descriptor
            -> (flags::Flags , ?.posix_common::Open_Mode);
    setfl : (File_Descriptor , flags::Flags) -> Void;
    lseek : (File_Descriptor , Int , Whence) -> Int;
    fsync : File_Descriptor -> Void;
    Lock_Type  = F_RDLCK | F_UNLCK | F_WRLCK;
    package flock : api {
                        Flock ;
                        flock : {len:Int,  ltype:Lock_Type, 
                                 pid:Null_Or(Process_Id ),  start:Int, 
                                 whence:Whence}
                                -> Flock;
                        ltype : Flock -> Lock_Type;
                        whence : Flock -> Whence;
                        start : Flock -> Int;
                        len : Flock -> Int;
                        pid : Flock -> Null_Or(Process_Id );
                    };;
    getlk : (File_Descriptor , flock::Flock) -> flock::Flock;
    setlk : (File_Descriptor , flock::Flock) -> flock::Flock;
    setlkw : (File_Descriptor , flock::Flock) -> flock::Flock;
    make_binary_reader : {blocking_mode:Bool,  fd:File_Descriptor, 
                          name:String}
                         -> binary_base_io::Reader;
    make_text_reader : {blocking_mode:Bool,  fd:File_Descriptor, 
                        name:String}
                       -> text_base_io::Reader;
    make_binary_writer : {append_mode:Bool,  blocking_mode:Bool, 
                          chunk_size:Int,  fd:File_Descriptor,  name:String}
                         -> binary_base_io::Writer;
    make_text_writer : {append_mode:Bool,  blocking_mode:Bool, 
                        chunk_size:Int,  fd:File_Descriptor,  name:String}
                       -> text_base_io::Writer;
};


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext