| Index | Manual | Download | Source | Macros | Embedded word Case ins.
Sitemap | Links | Forum | Tests | Projects

# lins.htm
Structures
MMAP_ARG
TERMIO
TTYSIZE
WINSIZE
Symbols
Constants

This file can be included to program for Linux written in EuroAssembler.

It declares the most often used constant symbols and structures for
base core functions derived from Linux header files in `/usr/include/` directory.

    lins HEAD

↑ MMAP_ARG
  Table of parameters for dynamic memory allocation from 32bit Linux kernel.
  Used in `LinAPI old_mmap, ^MMAP_ARG_STRUCT`

  > Kernel function MMAP has six arguments. Instead of using EBP it requires indirect parameter transfer via this structure, whose address is provided to INT 0x80 in EBX.

Documented
  https://elixir.bootlin.com/linux/v2.6.35/source/mm/mmap.c#L1132

    MMAP_ARG STRUC
    .addr   D DWORD
    .len    D DWORD
    .prot   D DWORD
    .flags  D DWORD
    .fd     D DWORD
    .offset D DWORD
           ENDSTRUC MMAP_ARG

↑ TTYSIZE
  Terminal size structure. Used by `LinABI ioctl,0, 0x5413, TTYSIZE`.

    TTYSIZE STRUC
    .ts_lines D WORD  ; Number of lines on terminal.
    .ts_cols  D WORD  ; Number of columns on terminal.
          ENDSTRUC TTYSIZE

↑ WINSIZE
  Window size structure.

    WINSIZE STRUC
    .ws_row    D WORD   ; Rows in characters.
    .ws_col    D WORD   ; Columns in characters.
    .ws_xpixel D WORD   ; Horizontal size in pixels.
    .ws_ypixel D WORD   ; Vertical size in pixels.
          ENDSTRUC WINSIZE

↑ TERMIO
  Terminal input/output structure.

    TERMIO STRUC
    .c_iflag   D DWORD   ; input mode flags
    .c_oflag   D DWORD   ; output mode flags
    .c_cflag   D DWORD   ; control mode flags
    .c_lflag   D DWORD   ; local mode flags
               D 8*DWORD ; Unknown.
         ENDSTRUC TERMIO

↑ Constants
  Encoding of constant symbols used in LinAPI.
Documented
  manpages.ubuntu.com/manpages/cosmic/man7/inode.7.html

    ; Error numbers. See also Linux error codes.
    EPERM           =   1  ; 0xFFFF Operation not permitted.
    ENOENT          =   2  ; 0xFFFE No such file or directory.
    ESRCH           =   3  ; 0xFFFD No such process.
    EINTR           =   4  ; 0xFFFC Interrupted system call.
    EIO             =   5  ; 0xFFFB I/O error.
    ENXIO           =   6  ; 0xFFFA No such device or address.
    E2BIG           =   7  ; 0xFFF9 Argument list too long.
    ENOEXEC         =   8  ; 0xFFF8 Exec format error.
    EBADF           =   9  ; 0xFFF7 Bad file number.
    ECHILD          =  10  ; 0xFFF6 No child processes.
    EWOULDBLOCK     =  11  ; 0xFFF5 Operation would block.
    EAGAIN          =  11  ; 0xFFF5 Try again.
    ENOMEM          =  12  ; 0xFFF4 Out of memory.
    EACCES          =  13  ; 0xFFF3 Permission denied.
    EFAULT          =  14  ; 0xFFF2 Bad address.
    ENOTBLK         =  15  ; 0xFFF1 Block device required.
    EBUSY           =  16  ; 0xFFF0 Device or resource busy.
    EEXIST          =  17  ; 0xFFEF File exists.
    EXDEV           =  18  ; 0xFFEE Cross-device link.
    ENODEV          =  19  ; 0xFFED No such device.
    ENOTDIR         =  20  ; 0xFFEC Not a directory.
    EISDIR          =  21  ; 0xFFEB Is a directory.
    EINVAL          =  22  ; 0xFFEA Invalid argument.
    ENFILE          =  23  ; 0xFFE9 File table overflow.
    EMFILE          =  24  ; 0xFFE8 Too many open files.
    ENOTTY          =  25  ; 0xFFE7 Not a typewriter.
    ETXTBSY         =  26  ; 0xFFE6 Text file busy.
    EFBIG           =  27  ; 0xFFE5 File too large.
    ENOSPC          =  28  ; 0xFFE4 No space left on device.
    ESPIPE          =  29  ; 0xFFE3 Illegal seek.
    EROFS           =  30  ; 0xFFE2 Read-only file system.
    EMLINK          =  31  ; 0xFFE1 Too many links.
    EPIPE           =  32  ; 0xFFE0 Broken pipe.
    EDOM            =  33  ; 0xFFDF Math argument out of domain of func.
    ERANGE          =  34  ; 0xFFDE Math result not representable.
    EDEADLK         =  35  ; 0xFFDD Resource deadlock would occur.
    ENAMETOOLONG    =  36  ; 0xFFDC File name too long.
    ENOLCK          =  37  ; 0xFFDB No record locks available.
    ENOSYS          =  38  ; 0xFFDA Function not implemented.
    ENOTEMPTY       =  39  ; 0xFFD9 Directory not empty.
    ELOOP           =  40  ; 0xFFD8 Too many symbolic links encountered.
    ENOMSG          =  42  ; 0xFFD6 No message of desired type.
    EIDRM           =  43  ; 0xFFD5 Identifier removed.
    ECHRNG          =  44  ; 0xFFD4 Channel number out of range.
    EL2NSYNC        =  45  ; 0xFFD3 Level 2 not synchronized.
    EL3HLT          =  46  ; 0xFFD2 Level 3 halted.
    EL3RST          =  47  ; 0xFFD1 Level 3 reset.
    ELNRNG          =  48  ; 0xFFD0 Link number out of range.
    EUNATCH         =  49  ; 0xFFCF Protocol driver not attached.
    ENOCSI          =  50  ; 0xFFCE No CSI structure available.
    EL2HLT          =  51  ; 0xFFCD Level 2 halted.
    EBADE           =  52  ; 0xFFCC Invalid exchange.
    EBADR           =  53  ; 0xFFCB Invalid request descriptor.
    EXFULL          =  54  ; 0xFFCA Exchange full.
    ENOANO          =  55  ; 0xFFC9 No anode.
    EBADRQC         =  56  ; 0xFFC8 Invalid request code.
    EBADSLT         =  57  ; 0xFFC7 Invalid slot.
    EDEADLOCK       =  35  ; 0xFFDD Resource deadlock would occur.
    EBFONT          =  59  ; 0xFFC5 Bad font file format.
    ENOSTR          =  60  ; 0xFFC4 Device not a stream.
    ENODATA         =  61  ; 0xFFC3 No data available.
    ETIME           =  62  ; 0xFFC2 Timer expired.
    ENOSR           =  63  ; 0xFFC1 Out of streams resources.
    ENONET          =  64  ; 0xFFC0 Machine is not on the network.
    ENOPKG          =  65  ; 0xFFBF Package not installed.
    EREMOTE         =  66  ; 0xFFBE Object is remote.
    ENOLINK         =  67  ; 0xFFBD Link has been severed.
    EADV            =  68  ; 0xFFBC Advertise error.
    ESRMNT          =  69  ; 0xFFBB Srmount error.
    ECOMM           =  70  ; 0xFFBA Communication error on send.
    EPROTO          =  71  ; 0xFFB9 Protocol error.
    EMULTIHOP       =  72  ; 0xFFB8 Multihop attempted.
    EDOTDOT         =  73  ; 0xFFB7 RFS specific error.
    EBADMSG         =  74  ; 0xFFB6 Not a data message.
    EOVERFLOW       =  75  ; 0xFFB5 Value too large for defined data type.
    ENOTUNIQ        =  76  ; 0xFFB4 Name not unique on network.
    EBADFD          =  77  ; 0xFFB3 File descriptor in bad state.
    EREMCHG         =  78  ; 0xFFB2 Remote address changed.
    ELIBACC         =  79  ; 0xFFB1 Can not access a needed shared library.
    ELIBBAD         =  80  ; 0xFFB0 Accessing a corrupted shared library.
    ELIBSCN         =  81  ; 0xFFAF lib section in a.out corrupted.
    ELIBMAX         =  82  ; 0xFFAE Attempting to link in too many shared libraries.
    ELIBEXEC        =  83  ; 0xFFAD Cannot exec a shared library directly.
    EILSEQ          =  84  ; 0xFFAC Illegal byte sequence.
    ERESTART        =  85  ; 0xFFAB Interrupted system call should be restarted.
    ESTRPIPE        =  86  ; 0xFFAA Streams pipe error.
    EUSERS          =  87  ; 0xFFA9 Too many users.
    ENOTSOCK        =  88  ; 0xFFA8 Socket operation on non-socket.
    EDESTADDRREQ    =  89  ; 0xFFA7 Destination address required.
    EMSGSIZE        =  90  ; 0xFFA6 Message too long.
    EPROTOTYPE      =  91  ; 0xFFA5 Protocol wrong type for socket.
    ENOPROTOOPT     =  92  ; 0xFFA4 Protocol not available.
    EPROTONOSUPPORT =  93  ; 0xFFA3 Protocol not supported.
    ESOCKTNOSUPPORT =  94  ; 0xFFA2 Socket type not supported.
    EOPNOTSUPP      =  95  ; 0xFFA1 Operation not supported on transport endpoint.
    EPFNOSUPPORT    =  96  ; 0xFFA0 Protocol family not supported.
    EAFNOSUPPORT    =  97  ; 0xFF9F Address family not supported by protocol.
    EADDRINUSE      =  98  ; 0xFF9E Address already in use.
    EADDRNOTAVAIL   =  99  ; 0xFF9D Cannot assign requested address.
    ENETDOWN        = 100  ; 0xFF9C Network is down.
    ENETUNREACH     = 101  ; 0xFF9B Network is unreachable.
    ENETRESET       = 102  ; 0xFF9A Network dropped connection because of reset.
    ECONNABORTED    = 103  ; 0xFF99 Software caused connection abort.
    ECONNRESET      = 104  ; 0xFF98 Connection reset by peer.
    ENOBUFS         = 105  ; 0xFF97 No buffer space available.
    EISCONN         = 106  ; 0xFF96 Transport endpoint is already connected.
    ENOTCONN        = 107  ; 0xFF95 Transport endpoint is not connected.
    ESHUTDOWN       = 108  ; 0xFF94 Cannot send after transport endpoint shutdown.
    ETOOMANYREFS    = 109  ; 0xFF93 Too many references: cannot splice.
    ETIMEDOUT       = 110  ; 0xFF92 Connection timed out.
    ECONNREFUSED    = 111  ; 0xFF91 Connection refused.
    EHOSTDOWN       = 112  ; 0xFF90 Host is down.
    EHOSTUNREACH    = 113  ; 0xFF8F No route to host.
    EALREADY        = 114  ; 0xFF8E Operation already in progress.
    EINPROGRESS     = 115  ; 0xFF8D Operation now in progress.
    ESTALE          = 116  ; 0xFF8C Stale NFS file handle.
    EUCLEAN         = 117  ; 0xFF8B Structure needs cleaning.
    ENOTNAM         = 118  ; 0xFF8A Not a XENIX named type file.
    ENAVAIL         = 119  ; 0xFF89 No XENIX semaphores available.
    EISNAM          = 120  ; 0xFF88 Is a named type file.
    EREMOTEIO       = 121  ; 0xFF87 Remote I/O error.
    EDQUOT          = 122  ; 0xFF86 Quota exceeded.
    ENOMEDIUM       = 123  ; 0xFF85 No medium found.
    EMEDIUMTYPE     = 124  ; 0xFF84 Wrong medium type.
    ECANCELED       = 125  ; 0xFF83 Operation Canceled.
    ENOKEY          = 126  ; 0xFF82 Required key not available.
    EKEYEXPIRED     = 127  ; 0xFF81 Key has expired.
    EKEYREVOKED     = 128  ; 0xFF80 Key has been revoked.
    EKEYREJECTED    = 129  ; 0xFF7F Key was rejected by service.
    EOWNERDEAD      = 130  ; 0xFF7E Owner died.
    ENOTRECOVERABLE = 131  ; 0xFF7D State not recoverable.
    ERFKILL         = 132  ; 0xFF7C Operation not possible due to RF-kill.
    EHWPOISON       = 133  ; 0xFF7B Memory page has hardware error.

    ERR_MAX         = 4095 ; 0xF001 Number of possible error codes.

    ; IOCTL codes
    KDGKBMODE       = 0x4B44 ; Gets current keyboard mode.
    KDSKBMODE       = 0x4B45 ; Sets current keyboard mode.
    K_RAW           = 0x00   ; Keyboard modes:
    K_XLATE         = 0x01
    K_MEDIUMRAW     = 0x02
    K_UNICODE       = 0x03
    K_OFF           = 0x04
    KDGKBLED        = 0x4B64 ; Get LED flags (not lights).
    KDSKBLED        = 0x4B65 ; Set LED flags (not lights).
    K_SCROLLLOCK    = 0x01
    K_NUMLOCK       = 0x02
    K_CAPSLOCK      = 0x04
    K_NORMTAB       = 0x00
    K_SHIFTTAB      = 0x01
    K_ALTTAB        = 0x02
    K_ALTSHIFTTAB   = 0x03
    TCGETS          = 0x5401
    TCSETS          = 0x5402
    TCSETSW         = 0x5403
    TCSETSF         = 0x5404
    TCGETA          = 0x5405
    TCSETA          = 0x5406
    TCSETAW         = 0x5407
    TCSETAF         = 0x5408
    TCSBRK          = 0x5409
    TCXONC          = 0x540A
    TCFLSH          = 0x540B
    TIOCEXCL        = 0x540C
    TIOCNXCL        = 0x540D
    TIOCSCTTY       = 0x540E
    TIOCGPGRP       = 0x540F
    TIOCSPGRP       = 0x5410
    TIOCOUTQ        = 0x5411
    TIOCSTI         = 0x5412
    TIOCGWINSZ      = 0x5413 ; Gets terminal window size.
    TIOCSWINSZ      = 0x5414 ; Sets terminal window size.

    ; TERMIO.c_lflag bits:
    ISIG    = 0x0000001
    ICANON  = 0x0000002
    XCASE   = 0x0000004
    ECHO    = 0x0000008
    ECHOE   = 0x0000010
    ECHOK   = 0x0000020
    ECHONL  = 0x0000040
    NOFLSH  = 0x0000080
    TOSTOP  = 0x0000100
    ECHOCTL = 0x0000200
    ECHOPRT = 0x0000400
    ECHOKE  = 0x0000800
    FLUSHO  = 0x0001000
    PENDIN  = 0x0004000
    IEXTEN  = 0x0008000
    EXTPROC = 0x0010000

     ENDHEAD lins

▲Back to the top▲