From: Jakub Jirutka Date: Sun, 25 Mar 2018 00:43:00 +0100 Subject: [PATCH] Add support for target aarch64-linux-musl This patch is backported for 0.24.2. Upstream-Issue: https://github.com/crystal-lang/crystal/pull/5861 --- /dev/null +++ b/src/lib_c/aarch64-linux-musl/c/arpa/inet.cr @@ -0,0 +1,9 @@ +require "../netinet/in" +require "../stdint" + +lib LibC + fun htons(x0 : UInt16T) : UInt16T + fun ntohs(x0 : UInt16T) : UInt16T + fun inet_ntop(x0 : Int, x1 : Void*, x2 : Char*, x3 : SocklenT) : Char* + fun inet_pton(x0 : Int, x1 : Char*, x2 : Void*) : Int +end --- /dev/null +++ b/src/lib_c/aarch64-linux-musl/c/dirent.cr @@ -0,0 +1,18 @@ +require "./sys/types" + +lib LibC + type DIR = Void + + struct Dirent + d_ino : InoT + d_off : OffT + d_reclen : UShort + d_type : Char + d_name : StaticArray(Char, 256) + end + + fun closedir(x0 : DIR*) : Int + fun opendir(x0 : Char*) : DIR* + fun readdir(x0 : DIR*) : Dirent* + fun rewinddir(x0 : DIR*) : Void +end --- /dev/null +++ b/src/lib_c/aarch64-linux-musl/c/dlfcn.cr @@ -0,0 +1,21 @@ +lib LibC + RTLD_LAZY = 1 + RTLD_NOW = 2 + RTLD_GLOBAL = 256 + RTLD_LOCAL = 0 + RTLD_DEFAULT = Pointer(Void).new(0) + RTLD_NEXT = Pointer(Void).new(-1) + + struct DlInfo + dli_fname : Char* + dli_fbase : Void* + dli_sname : Char* + dli_saddr : Void* + end + + fun dlclose(x0 : Void*) : Int + fun dlerror : Char* + fun dlopen(x0 : Char*, x1 : Int) : Void* + fun dlsym(x0 : Void*, x1 : Char*) : Void* + fun dladdr(x0 : Void*, x1 : DlInfo*) : Int +end --- /dev/null +++ b/src/lib_c/aarch64-linux-musl/c/errno.cr @@ -0,0 +1,83 @@ +lib LibC + E2BIG = 7 + EACCES = 13 + EADDRINUSE = 98 + EADDRNOTAVAIL = 99 + EAFNOSUPPORT = 97 + EAGAIN = 11 + EALREADY = 114 + EBADF = 9 + EBADMSG = 74 + EBUSY = 16 + ECANCELED = 125 + ECHILD = 10 + ECONNABORTED = 103 + ECONNREFUSED = 111 + ECONNRESET = 104 + EDEADLK = 35 + EDESTADDRREQ = 89 + EDOM = 33 + EDQUOT = 122 + EEXIST = 17 + EFAULT = 14 + EFBIG = 27 + EHOSTUNREACH = 113 + EIDRM = 43 + EILSEQ = 84 + EINPROGRESS = 115 + EINTR = 4 + EINVAL = 22 + EIO = 5 + EISCONN = 106 + EISDIR = 21 + ELOOP = 40 + EMFILE = 24 + EMLINK = 31 + EMSGSIZE = 90 + EMULTIHOP = 72 + ENAMETOOLONG = 36 + ENETDOWN = 100 + ENETRESET = 102 + ENETUNREACH = 101 + ENFILE = 23 + ENOBUFS = 105 + ENODEV = 19 + ENOENT = 2 + ENOEXEC = 8 + ENOLCK = 37 + ENOLINK = 67 + ENOMEM = 12 + ENOMSG = 42 + ENOPROTOOPT = 92 + ENOSPC = 28 + ENOSYS = 38 + ENOTCONN = 107 + ENOTDIR = 20 + ENOTEMPTY = 39 + ENOTRECOVERABLE = 131 + ENOTSOCK = 88 + ENOTSUP = LibC::EOPNOTSUPP + ENOTTY = 25 + ENXIO = 6 + EOPNOTSUPP = 95 + EOVERFLOW = 75 + EOWNERDEAD = 130 + EPERM = 1 + EPIPE = 32 + EPROTO = 71 + EPROTONOSUPPORT = 93 + EPROTOTYPE = 91 + ERANGE = 34 + EROFS = 30 + ESPIPE = 29 + ESRCH = 3 + ESTALE = 116 + ETIMEDOUT = 110 + ETXTBSY = 26 + EWOULDBLOCK = LibC::EAGAIN + EXDEV = 18 + ENODATA = 61 + ENOSR = 63 + ENOSTR = 60 + ETIME = 62 +end --- /dev/null +++ b/src/lib_c/aarch64-linux-musl/c/fcntl.cr @@ -0,0 +1,32 @@ +require "./sys/types" +require "./sys/stat" +require "./unistd" + +lib LibC + F_GETFD = 1 + F_SETFD = 2 + F_GETFL = 3 + F_SETFL = 4 + FD_CLOEXEC = 1 + O_CLOEXEC = 0o2000000 + O_CREAT = 0o100 + O_NOFOLLOW = 0o100000 + O_TRUNC = 0o1000 + O_APPEND = 0o2000 + O_NONBLOCK = 0o4000 + O_SYNC = 0o4010000 + O_RDONLY = 0o0 + O_RDWR = 0o2 + O_WRONLY = 0o1 + + struct Flock + l_type : Short + l_whence : Short + l_start : OffT + l_len : OffT + l_pid : PidT + end + + fun fcntl(x0 : Int, x1 : Int, ...) : Int + fun open(x0 : Char*, x1 : Int, ...) : Int +end --- /dev/null +++ b/src/lib_c/aarch64-linux-musl/c/iconv.cr @@ -0,0 +1,9 @@ +require "./stddef" + +lib LibC + type IconvT = Void* + + fun iconv(x0 : IconvT, x1 : Char**, x2 : SizeT*, x3 : Char**, x4 : SizeT*) : SizeT + fun iconv_close(x0 : IconvT) : Int + fun iconv_open(x0 : Char*, x1 : Char*) : IconvT +end --- /dev/null +++ b/src/lib_c/aarch64-linux-musl/c/netdb.cr @@ -0,0 +1,39 @@ +require "./netinet/in" +require "./sys/socket" +require "./stdint" + +lib LibC + AI_PASSIVE = 0x01 + AI_CANONNAME = 0x02 + AI_NUMERICHOST = 0x04 + AI_NUMERICSERV = 0x400 + AI_V4MAPPED = 0x08 + AI_ALL = 0x10 + AI_ADDRCONFIG = 0x20 + EAI_AGAIN = -3 + EAI_BADFLAGS = -1 + EAI_FAIL = -4 + EAI_FAMILY = -6 + EAI_MEMORY = -10 + EAI_NONAME = -2 + EAI_SERVICE = -8 + EAI_SOCKTYPE = -7 + EAI_SYSTEM = -11 + EAI_OVERFLOW = -12 + + struct Addrinfo + ai_flags : Int + ai_family : Int + ai_socktype : Int + ai_protocol : Int + ai_addrlen : SocklenT + ai_addr : Sockaddr* + ai_canonname : Char* + ai_next : Addrinfo* + end + + fun freeaddrinfo(x0 : Addrinfo*) : Void + fun gai_strerror(x0 : Int) : Char* + fun getaddrinfo(x0 : Char*, x1 : Char*, x2 : Addrinfo*, x3 : Addrinfo**) : Int + fun getnameinfo(x0 : Sockaddr*, x1 : SocklenT, x2 : Char*, x3 : SocklenT, x4 : Char*, x5 : SocklenT, x6 : Int) : Int +end --- /dev/null +++ b/src/lib_c/aarch64-linux-musl/c/netinet/in.cr @@ -0,0 +1,42 @@ +require "../sys/socket" +require "../stdint" + +lib LibC + IPPROTO_IP = 0 + IPPROTO_ICMP = 1 + IPPROTO_RAW = 255 + IPPROTO_TCP = 6 + IPPROTO_UDP = 17 + + alias InPortT = UInt16T + alias InAddrT = UInt32T + + struct InAddr + s_addr : InAddrT + end + + union In6AddrIn6Union + __s6_addr : StaticArray(UInt8T, 16) + __s6_addr16 : StaticArray(UInt16T, 8) + __s6_addr32 : StaticArray(UInt32T, 4) + end + + struct In6Addr + __in6_union : In6AddrIn6Union + end + + struct SockaddrIn + sin_family : SaFamilyT + sin_port : InPortT + sin_addr : InAddr + sin_zero : StaticArray(UInt8T, 8) + end + + struct SockaddrIn6 + sin6_family : SaFamilyT + sin6_port : InPortT + sin6_flowinfo : UInt32T + sin6_addr : In6Addr + sin6_scope_id : UInt32T + end +end --- /dev/null +++ b/src/lib_c/aarch64-linux-musl/c/netinet/tcp.cr @@ -0,0 +1,6 @@ +lib LibC + TCP_NODELAY = 1 + TCP_KEEPIDLE = 4 + TCP_KEEPINTVL = 5 + TCP_KEEPCNT = 6 +end --- /dev/null +++ b/src/lib_c/aarch64-linux-musl/c/pthread.cr @@ -0,0 +1,18 @@ +require "./sys/types" + +lib LibC + fun pthread_cond_broadcast(x0 : PthreadCondT*) : Int + fun pthread_cond_destroy(x0 : PthreadCondT*) : Int + fun pthread_cond_init(x0 : PthreadCondT*, x1 : PthreadCondattrT*) : Int + fun pthread_cond_signal(x0 : PthreadCondT*) : Int + fun pthread_cond_wait(x0 : PthreadCondT*, x1 : PthreadMutexT*) : Int + fun pthread_create(x0 : PthreadT*, x1 : PthreadAttrT*, x2 : Void* -> Void*, x3 : Void*) : Int + fun pthread_detach(x0 : PthreadT) : Int + fun pthread_join(x0 : PthreadT, x1 : Void**) : Int + fun pthread_mutex_destroy(x0 : PthreadMutexT*) : Int + fun pthread_mutex_init(x0 : PthreadMutexT*, x1 : PthreadMutexattrT*) : Int + fun pthread_mutex_lock(x0 : PthreadMutexT*) : Int + fun pthread_mutex_trylock(x0 : PthreadMutexT*) : Int + fun pthread_mutex_unlock(x0 : PthreadMutexT*) : Int + fun pthread_self : PthreadT +end --- /dev/null +++ b/src/lib_c/aarch64-linux-musl/c/signal.cr @@ -0,0 +1,40 @@ +require "./sys/types" +require "./time" + +lib LibC + SIGHUP = 1 + SIGINT = 2 + SIGQUIT = 3 + SIGILL = 4 + SIGTRAP = 5 + SIGIOT = LibC::SIGABRT + SIGABRT = 6 + SIGFPE = 8 + SIGKILL = 9 + SIGBUS = 7 + SIGSEGV = 11 + SIGSYS = 31 + SIGPIPE = 13 + SIGALRM = 14 + SIGTERM = 15 + SIGURG = 23 + SIGSTOP = 19 + SIGTSTP = 20 + SIGCONT = 18 + SIGCHLD = 17 + SIGTTIN = 21 + SIGTTOU = 22 + SIGIO = 29 + SIGXCPU = 24 + SIGXFSZ = 25 + SIGVTALRM = 26 + SIGUSR1 = 10 + SIGUSR2 = 12 + SIGWINCH = 28 + SIGPWR = 30 + SIGSTKFLT = 16 + SIGUNUSED = LibC::SIGSYS + + fun kill(x0 : PidT, x1 : Int) : Int + fun signal(x0 : Int, x1 : Int -> Void) : Int -> Void +end --- /dev/null +++ b/src/lib_c/aarch64-linux-musl/c/stddef.cr @@ -0,0 +1,3 @@ +lib LibC + alias SizeT = ULong +end --- /dev/null +++ b/src/lib_c/aarch64-linux-musl/c/stdint.cr @@ -0,0 +1,10 @@ +lib LibC + alias Int8T = SChar + alias Int16T = Short + alias Int32T = Int + alias Int64T = Long + alias UInt8T = Char + alias UInt16T = UShort + alias UInt32T = UInt + alias UInt64T = ULong +end --- /dev/null +++ b/src/lib_c/aarch64-linux-musl/c/stdio.cr @@ -0,0 +1,9 @@ +require "./sys/types" +require "./stddef" + +lib LibC + fun printf(x0 : Char*, ...) : Int + fun dprintf(fd : Int, format : Char*, ...) : Int + fun rename(x0 : Char*, x1 : Char*) : Int + fun snprintf(x0 : Char*, x1 : SizeT, x2 : Char*, ...) : Int +end --- /dev/null +++ b/src/lib_c/aarch64-linux-musl/c/stdlib.cr @@ -0,0 +1,25 @@ +require "./stddef" +require "./sys/wait" + +lib LibC + struct DivT + quot : Int + rem : Int + end + + fun atof(x0 : Char*) : Double + fun div(x0 : Int, x1 : Int) : DivT + fun exit(x0 : Int) : NoReturn + fun free(x0 : Void*) : Void + fun getenv(x0 : Char*) : Char* + fun malloc(x0 : SizeT) : Void* + fun mkstemp(x0 : Char*) : Int + fun mkstemps(x0 : Char*, x1 : Int) : Int + fun putenv(x0 : Char*) : Int + fun realloc(x0 : Void*, x1 : SizeT) : Void* + fun realpath(x0 : Char*, x1 : Char*) : Char* + fun setenv(x0 : Char*, x1 : Char*, x2 : Int) : Int + fun strtof(x0 : Char*, x1 : Char**) : Float + fun strtod(x0 : Char*, x1 : Char**) : Double + fun unsetenv(x0 : Char*) : Int +end --- /dev/null +++ b/src/lib_c/aarch64-linux-musl/c/string.cr @@ -0,0 +1,9 @@ +require "./stddef" + +lib LibC + fun memchr(x0 : Void*, c : Int, n : SizeT) : Void* + fun memcmp(x0 : Void*, x1 : Void*, x2 : SizeT) : Int + fun strcmp(x0 : Char*, x1 : Char*) : Int + fun strerror(x0 : Int) : Char* + fun strlen(x0 : Char*) : SizeT +end --- /dev/null +++ b/src/lib_c/aarch64-linux-musl/c/sys/mman.cr @@ -0,0 +1,31 @@ +require "./types" + +lib LibC + PROT_EXEC = 4 + PROT_NONE = 0 + PROT_READ = 1 + PROT_WRITE = 2 + MAP_FIXED = 0x10 + MAP_PRIVATE = 0x02 + MAP_SHARED = 0x01 + MAP_ANON = 0x20 + MAP_ANONYMOUS = LibC::MAP_ANON + MAP_FAILED = Pointer(Void).new(-1) + POSIX_MADV_DONTNEED = 0 + POSIX_MADV_NORMAL = 0 + POSIX_MADV_RANDOM = 1 + POSIX_MADV_SEQUENTIAL = 2 + POSIX_MADV_WILLNEED = 3 + MADV_DONTNEED = 4 + MADV_NORMAL = 0 + MADV_RANDOM = 1 + MADV_SEQUENTIAL = 2 + MADV_WILLNEED = 3 + MADV_HUGEPAGE = 14 + MADV_NOHUGEPAGE = 15 + + fun mmap(x0 : Void*, x1 : SizeT, x2 : Int, x3 : Int, x4 : Int, x5 : OffT) : Void* + fun mprotect(x0 : Void*, x1 : SizeT, x2 : Int) : Int + fun munmap(x0 : Void*, x1 : SizeT) : Int + fun madvise(x0 : Void*, x1 : SizeT, x2 : Int) : Int +end --- /dev/null +++ b/src/lib_c/aarch64-linux-musl/c/sys/select.cr @@ -0,0 +1,14 @@ +require "./types" +require "./time" +require "../time" +require "../signal" + +lib LibC + alias FdMask = ULong + + struct FdSet + fds_bits : StaticArray(ULong, 16) + end + + fun select(x0 : Int, x1 : FdSet*, x2 : FdSet*, x3 : FdSet*, x4 : Timeval*) : Int +end --- /dev/null +++ b/src/lib_c/aarch64-linux-musl/c/sys/socket.cr @@ -0,0 +1,65 @@ +require "./types" + +lib LibC + SOCK_DGRAM = 2 + SOCK_RAW = 3 + SOCK_SEQPACKET = 5 + SOCK_STREAM = 1 + SOL_SOCKET = 1 + SO_BROADCAST = 6 + SO_KEEPALIVE = 9 + SO_LINGER = 13 + SO_RCVBUF = 8 + SO_REUSEADDR = 2 + SO_REUSEPORT = 15 + SO_SNDBUF = 7 + PF_INET = 2 + PF_INET6 = 10 + PF_UNIX = LibC::PF_LOCAL + PF_UNSPEC = 0 + PF_LOCAL = 1 + AF_INET = LibC::PF_INET + AF_INET6 = LibC::PF_INET6 + AF_UNIX = LibC::AF_LOCAL + AF_UNSPEC = LibC::PF_UNSPEC + AF_LOCAL = LibC::PF_LOCAL + SHUT_RD = 0 + SHUT_RDWR = 2 + SHUT_WR = 1 + SOCK_CLOEXEC = 0o2000000 + + alias SocklenT = UInt + alias SaFamilyT = UShort + + struct Sockaddr + sa_family : SaFamilyT + sa_data : StaticArray(Char, 14) + end + + struct SockaddrStorage + ss_family : SaFamilyT + __ss_align : ULong + __ss_padding : StaticArray(Char, 112) + end + + struct Linger + l_onoff : Int + l_linger : Int + end + + fun accept(x0 : Int, x1 : Sockaddr*, x2 : SocklenT*) : Int + fun bind(x0 : Int, x1 : Sockaddr*, x2 : SocklenT) : Int + fun connect(x0 : Int, x1 : Sockaddr*, x2 : SocklenT) : Int + fun getpeername(x0 : Int, x1 : Sockaddr*, x2 : SocklenT*) : Int + fun getsockname(x0 : Int, x1 : Sockaddr*, x2 : SocklenT*) : Int + fun getsockopt(x0 : Int, x1 : Int, x2 : Int, x3 : Void*, x4 : SocklenT*) : Int + fun listen(x0 : Int, x1 : Int) : Int + fun recv(x0 : Int, x1 : Void*, x2 : SizeT, x3 : Int) : SSizeT + fun recvfrom(x0 : Int, x1 : Void*, x2 : SizeT, x3 : Int, x4 : Sockaddr*, x5 : SocklenT*) : SSizeT + fun send(x0 : Int, x1 : Void*, x2 : SizeT, x3 : Int) : SSizeT + fun sendto(x0 : Int, x1 : Void*, x2 : SizeT, x3 : Int, x4 : Sockaddr*, x5 : SocklenT) : SSizeT + fun setsockopt(x0 : Int, x1 : Int, x2 : Int, x3 : Void*, x4 : SocklenT) : Int + fun shutdown(x0 : Int, x1 : Int) : Int + fun socket(x0 : Int, x1 : Int, x2 : Int) : Int + fun socketpair(x0 : Int, x1 : Int, x2 : Int, x3 : StaticArray(Int, 2)) : Int +end --- /dev/null +++ b/src/lib_c/aarch64-linux-musl/c/sys/stat.cr @@ -0,0 +1,56 @@ +require "./types" +require "../time" + +lib LibC + S_IFMT = 0o170000 + S_IFBLK = 0o060000 + S_IFCHR = 0o020000 + S_IFIFO = 0o010000 + S_IFREG = 0o100000 + S_IFDIR = 0o040000 + S_IFLNK = 0o120000 + S_IFSOCK = 0o140000 + S_IRUSR = 0o400 + S_IWUSR = 0o200 + S_IXUSR = 0o100 + S_IRWXU = 0o700 + S_IRGRP = 0o040 + S_IWGRP = 0o020 + S_IXGRP = 0o010 + S_IRWXG = 0o070 + S_IROTH = 0o004 + S_IWOTH = 0o002 + S_IXOTH = 0o001 + S_IRWXO = 0o007 + S_ISUID = 0o4000 + S_ISGID = 0o2000 + S_ISVTX = 0o1000 + + struct Stat + st_dev : DevT + st_ino : InoT + st_mode : ModeT + st_nlink : NlinkT + st_uid : UidT + st_gid : GidT + st_rdev : DevT + __pad : ULong + st_size : OffT + st_blksize : BlksizeT + __pad2 : Int + st_blocks : BlkcntT + st_atim : Timespec + st_mtim : Timespec + st_ctim : Timespec + __unused : StaticArray(UInt, 2) + end + + fun chmod(x0 : Char*, x1 : ModeT) : Int + fun fstat(x0 : Int, x1 : Stat*) : Int + fun lstat(x0 : Char*, x1 : Stat*) : Int + fun mkdir(x0 : Char*, x1 : ModeT) : Int + fun mkfifo(x0 : Char*, x1 : ModeT) : Int + fun mknod(x0 : Char*, x1 : ModeT, x2 : DevT) : Int + fun stat(x0 : Char*, x1 : Stat*) : Int + fun umask(x0 : ModeT) : ModeT +end --- /dev/null +++ b/src/lib_c/aarch64-linux-musl/c/sys/syscall.cr @@ -0,0 +1,3 @@ +lib LibC + SYS_getrandom = 278 +end --- /dev/null +++ b/src/lib_c/aarch64-linux-musl/c/sys/time.cr @@ -0,0 +1,16 @@ +require "./types" + +lib LibC + struct Timeval + tv_sec : TimeT + tv_usec : SusecondsT + end + + struct Timezone + tz_minuteswest : Int + tz_dsttime : Int + end + + fun gettimeofday(x0 : Timeval*, x1 : Void*) : Int + fun utimes(path : Char*, times : Timeval[2]) : Int +end --- /dev/null +++ b/src/lib_c/aarch64-linux-musl/c/sys/times.cr @@ -0,0 +1,12 @@ +require "./types" + +lib LibC + struct Tms + tms_utime : ClockT + tms_stime : ClockT + tms_cutime : ClockT + tms_cstime : ClockT + end + + fun times(x0 : Tms*) : ClockT +end --- /dev/null +++ b/src/lib_c/aarch64-linux-musl/c/sys/types.cr @@ -0,0 +1,61 @@ +require "../stddef" +require "../stdint" + +lib LibC + alias BlkcntT = Long + alias BlksizeT = Int + alias ClockT = Long + alias ClockidT = Int + alias DevT = ULong + alias GidT = UInt + alias IdT = UInt + alias InoT = ULong + alias ModeT = UInt + alias NlinkT = UInt + alias OffT = Long + alias PidT = Int + + union PthreadAttrTU + __i : StaticArray(Int, 14) + __vi : StaticArray(Int, 14) + __s : StaticArray(ULong, 7) + end + + struct PthreadAttrT + __u : PthreadAttrTU + end + + union PthreadCondTU + __i : StaticArray(Int, 12) + __vi : StaticArray(Int, 12) + __p : StaticArray(Void*, 6) + end + + struct PthreadCondT + __u : PthreadCondTU + end + + struct PthreadCondattrT + __attr : UInt + end + + union PthreadMutexTU + __i : StaticArray(Int, 10) + __vi : StaticArray(Int, 10) + __p : StaticArray(Void*, 5) + end + + struct PthreadMutexT + __u : PthreadMutexTU + end + + struct PthreadMutexattrT + __attr : UInt + end + + type PthreadT = Void* + alias SSizeT = Long + alias SusecondsT = Long + alias TimeT = Long + alias UidT = UInt +end --- /dev/null +++ b/src/lib_c/aarch64-linux-musl/c/sys/un.cr @@ -0,0 +1,8 @@ +require "./socket" + +lib LibC + struct SockaddrUn + sun_family : SaFamilyT + sun_path : StaticArray(Char, 108) + end +end --- /dev/null +++ b/src/lib_c/aarch64-linux-musl/c/sys/wait.cr @@ -0,0 +1,8 @@ +require "./types" +require "../signal" + +lib LibC + WNOHANG = 1 + + fun waitpid(x0 : PidT, x1 : Int*, x2 : Int) : PidT +end --- /dev/null +++ b/src/lib_c/aarch64-linux-musl/c/termios.cr @@ -0,0 +1,120 @@ +require "./sys/types" + +lib LibC + VEOF = 4 + VEOL = 11 + VERASE = 2 + VINTR = 0 + VKILL = 3 + VMIN = 6 + VQUIT = 1 + VSTART = 8 + VSTOP = 9 + VSUSP = 10 + BRKINT = 0o000002 + ICRNL = 0o000400 + IGNBRK = 0o000001 + IGNCR = 0o000200 + IGNPAR = 0o000004 + INLCR = 0o000100 + INPCK = 0o000020 + ISTRIP = 0o000040 + IXANY = 0o004000 + IXOFF = 0o010000 + IXON = 0o002000 + PARMRK = 0o000010 + OPOST = 0o000001 + ONLCR = 0o000004 + OCRNL = 0o000010 + ONOCR = 0o000020 + ONLRET = 0o000040 + OFDEL = 0o000200 + OFILL = 0o000100 + CRDLY = 0o003000 + CR0 = 0o000000 + CR1 = 0o001000 + CR2 = 0o002000 + CR3 = 0o003000 + TABDLY = 0o014000 + TAB0 = 0o000000 + TAB1 = 0o004000 + TAB2 = 0o010000 + TAB3 = 0o014000 + BSDLY = 0o020000 + BS0 = 0o000000 + BS1 = 0o020000 + VTDLY = 0o040000 + VT0 = 0o000000 + VT1 = 0o040000 + FFDLY = 0o100000 + FF0 = 0o000000 + FF1 = 0o100000 + NLDLY = 0o000400 + NL0 = 0o000000 + NL1 = 0o000400 + B0 = 0o000000 + B50 = 0o000001 + B75 = 0o000002 + B110 = 0o000003 + B134 = 0o000004 + B150 = 0o000005 + B200 = 0o000006 + B300 = 0o000007 + B600 = 0o000010 + B1200 = 0o000011 + B1800 = 0o000012 + B2400 = 0o000013 + B4800 = 0o000014 + B9600 = 0o000015 + B19200 = 0o000016 + B38400 = 0o000017 + CSIZE = 0o000060 + CS5 = 0o000000 + CS6 = 0o000020 + CS7 = 0o000040 + CS8 = 0o000060 + CSTOPB = 0o000100 + CREAD = 0o000200 + PARENB = 0o000400 + PARODD = 0o001000 + HUPCL = 0o002000 + CLOCAL = 0o004000 + ECHO = 0o000010 + ECHOE = 0o000020 + ECHOK = 0o000040 + ECHONL = 0o000100 + ICANON = 0o000002 + IEXTEN = 0o100000 + ISIG = 0o000001 + NOFLSH = 0o000200 + TOSTOP = 0o000400 + TCSANOW = 0 + TCSADRAIN = 1 + TCSAFLUSH = 2 + TCIFLUSH = 0 + TCIOFLUSH = 2 + TCOFLUSH = 1 + TCIOFF = 2 + TCION = 3 + TCOOFF = 0 + TCOON = 1 + + alias CcT = Char + alias SpeedT = UInt + alias TcflagT = UInt + + struct Termios + c_iflag : TcflagT + c_oflag : TcflagT + c_cflag : TcflagT + c_lflag : TcflagT + c_line : CcT + c_cc : StaticArray(CcT, 32) + __c_ispeed : SpeedT + __c_ospeed : SpeedT + end + + fun tcgetattr(x0 : Int, x1 : Termios*) : Int + fun tcsetattr(x0 : Int, x1 : Int, x2 : Termios*) : Int + fun cfmakeraw(x0 : Termios*) : Void +end --- /dev/null +++ b/src/lib_c/aarch64-linux-musl/c/time.cr @@ -0,0 +1,37 @@ +require "./sys/types" + +lib LibC + CLOCK_MONOTONIC = 1 + CLOCK_REALTIME = 0 + + struct Tm + tm_sec : Int + tm_min : Int + tm_hour : Int + tm_mday : Int + tm_mon : Int + tm_year : Int + tm_wday : Int + tm_yday : Int + tm_isdst : Int + tm_gmtoff : Long + tm_zone : Char* + end + + struct Timespec + tv_sec : TimeT + tv_nsec : Long + end + + fun clock_gettime(x0 : ClockidT, x1 : Timespec*) : Int + fun clock_settime(x0 : ClockidT, x1 : Timespec*) : Int + fun gmtime_r(x0 : TimeT*, x1 : Tm*) : Tm* + fun localtime_r(x0 : TimeT*, x1 : Tm*) : Tm* + fun mktime(x0 : Tm*) : TimeT + fun tzset : Void + fun timegm(x0 : Tm*) : TimeT + + $daylight : Int + $timezone : Long + $tzname : StaticArray(Char*, 2) +end --- /dev/null +++ b/src/lib_c/aarch64-linux-musl/c/unistd.cr @@ -0,0 +1,41 @@ +require "./sys/types" +require "./stdint" + +lib LibC + F_OK = 0 + R_OK = 4 + W_OK = 2 + X_OK = 1 + SC_CLK_TCK = 2 + SC_NPROCESSORS_ONLN = 84 + + fun access(x0 : Char*, x1 : Int) : Int + fun chdir(x0 : Char*) : Int + fun chown(x0 : Char*, x1 : UidT, x2 : GidT) : Int + fun close(x0 : Int) : Int + fun dup2(x0 : Int, x1 : Int) : Int + fun _exit(x0 : Int) : NoReturn + fun execvp(x0 : Char*, x1 : Char**) : Int + @[ReturnsTwice] + fun fork : PidT + fun ftruncate(x0 : Int, x1 : OffT) : Int + fun getcwd(x0 : Char*, x1 : SizeT) : Char* + fun gethostname(x0 : Char*, x1 : SizeT) : Int + fun getpgid(x0 : PidT) : PidT + fun getpid : PidT + fun getppid : PidT + fun isatty(x0 : Int) : Int + fun lchown(x0 : Char*, x1 : UidT, x2 : GidT) : Int + fun link(x0 : Char*, x1 : Char*) : Int + fun lockf(x0 : Int, x1 : Int, x2 : OffT) : Int + fun lseek(x0 : Int, x1 : OffT, x2 : Int) : OffT + fun pipe(x0 : StaticArray(Int, 2)) : Int + fun read(x0 : Int, x1 : Void*, x2 : SizeT) : SSizeT + fun pread(x0 : Int, x1 : Void*, x2 : SizeT, x3 : OffT) : SSizeT + fun rmdir(x0 : Char*) : Int + fun symlink(x0 : Char*, x1 : Char*) : Int + fun syscall(x0 : Long, ...) : Long + fun sysconf(x0 : Int) : Long + fun unlink(x0 : Char*) : Int + fun write(x0 : Int, x1 : Void*, x2 : SizeT) : SSizeT +end