PreviousUpNext

15.4.1117  src/lib/std/src/posix-1003.1b/posix-error.pkg

## posix-error.pkg

# Compiled by:
#     src/lib/std/src/standard-core.sublib

# Package for POSIX error codes.
# This is a subpackage of the POSIX 1003.1 based
# 'Posix' package
#
#     src/lib/std/src/posix-1003.1b/posix-1003-1b.pkg



stipulate
    package host_unt=  host_unt_guts;                                   # host_unt_guts                         is from   src/lib/std/src/bind-sysword-32.pkg
    package ci      =  mythryl_callable_c_library_interface;            # mythryl_callable_c_library_interface  is from   src/lib/std/src/unsafe/mythryl-callable-c-library-interface.pkg
herein

    package posix_error {
        #
        System_Error = Int;                                             #  = PreBasis::System_Error 


        fun cfun  fun_name
            =
            ci::find_c_function { lib_name => "posix_error",  fun_name };                       # posix_error                           def in    src/c/lib/posix-error/cfun-list.h


        stipulate
            my list_errors:  Void -> List(ci::System_Constant)
                =
                cfun "listerrors";                                      # listerrors                            def in    src/c/lib/posix-error/listerrors.c
        herein
            my errors                                                   # <errno.h> stuff like:  EACCESS, EAGAIN, EWOULDBLOCK ...  -- see src/c/lib/posix-error/tbl-errno.c
                =
                list_errors ();
        end;


        fun os_val s
            =
            #1 (ci::bind_system_constant (s, errors));


        fun syserror s
            =
            case (ci::find_system_constant (s, errors))
                #
                THE (e, _) =>  THE e;
                NULL       =>  NULL;
            esac;


        my errmsg:    Int -> String              =   cfun "errmsg";                     # errmsg                def in    src/c/lib/posix-error/errmsg.c
        my geterror:  Int -> ci::System_Constant =   cfun "geterror";                   # geterror              def in    src/c/lib/posix-error/geterror.c

        fun to_unt   i =  host_unt::from_int i;
        fun from_unt w =  host_unt::to_int w;


        fun error_msg i
            =
            errmsg i;


        fun error_name err
            =
            #2 (geterror err);


        toobig        = os_val "toobig";
        acces         = os_val "acces";
        again         = os_val "again";
        badf          = os_val "badf";
        badmsg        = os_val "badmsg";
        busy          = os_val "busy";
        canceled      = os_val "canceled";
        child         = os_val "child";
        deadlk        = os_val "deadlk";
        dom           = os_val "dom";
        exist         = os_val "exist";
        fault         = os_val "fault";
        fbig          = os_val "fbig";
        inprogress    = os_val "inprogress";
        intr          = os_val "intr";
        inval         = os_val "inval";
        io            = os_val "io";
        isdir         = os_val "isdir";
        loop          = os_val "loop";
        mfile         = os_val "mfile";
        mlink         = os_val "mlink";
        msgsize       = os_val "msgsize";
        name_too_long = os_val "nametoolong";
        nfile         = os_val "nfile";
        nodev         = os_val "nodev";
        noent         = os_val "noent";
        noexec        = os_val "noexec";
        nolck         = os_val "nolck";
        nomem         = os_val "nomem";
        nospc         = os_val "nospc";
        nosys         = os_val "nosys";
        notdir        = os_val "notdir";
        notempty      = os_val "notempty";
        notsup        = os_val "notsup";
        notty         = os_val "notty";
        nxio          = os_val "nxio";
        perm          = os_val "perm";
        pipe          = os_val "pipe";
        range         = os_val "range";
        rofs          = os_val "rofs";
        spipe         = os_val "spipe";
        srch          = os_val "srch";
        xdev          = os_val "xdev";

    }; #  package posix_error 
end;



Comments and suggestions to: bugs@mythryl.org

PreviousUpNext