def SigSetType : NamedType<"sigset_t">; def SigSetPtrType : PtrType; def ConstSigSetPtrType : ConstType; def RestrictedSigSetType : RestrictedPtrType; def ConstRestrictedSigSetType : ConstType; def StructSigaction : NamedType<"struct sigaction">; def StructSigactionPtr : PtrType; def ConstStructSigactionPtr : ConstType; def RestrictedStructSigactionPtr : RestrictedPtrType; def ConstRestrictedStructSigactionPtr : ConstType; def PThreadStartT : NamedType<"__pthread_start_t">; def POSIX : StandardSpec<"POSIX"> { PtrType CharPtr = PtrType; RestrictedPtrType RestrictedCharPtr = RestrictedPtrType; RestrictedPtrType CharRestrictedDoublePtr = RestrictedPtrType; ConstType ConstCharPtr = ConstType; ConstType ConstRestrictedCharPtr = ConstType; NamedType ModeTType = NamedType<"mode_t">; NamedType OffTType = NamedType<"off_t">; NamedType SSizeTType = NamedType<"ssize_t">; NamedType PThreadAttrTType = NamedType<"pthread_attr_t">; PtrType PThreadAttrTPtr = PtrType; RestrictedPtrType RestrictedPThreadAttrTPtr = RestrictedPtrType; ConstType ConstPThreadAttrTPtr = ConstType; ConstType ConstRestrictedPThreadAttrTPtr = ConstType; NamedType PThreadMutexAttrTType = NamedType<"pthread_mutexattr_t">; PtrType PThreadMutexAttrTPtr = PtrType; RestrictedPtrType RestrictedPThreadMutexAttrTPtr = RestrictedPtrType; ConstType ConstPThreadMutexAttrTPtr = ConstType; ConstType ConstRestrictedPThreadMutexAttrTPtr = ConstType; NamedType PThreadMutexTType = NamedType<"pthread_mutex_t">; PtrType PThreadMutexTPtr = PtrType; RestrictedPtrType RestrictedPThreadMutexTPtr = RestrictedPtrType; ConstType ConstPThreadMutexTPtr = ConstType; ConstType ConstRestrictedPThreadMutexTPtr = ConstType; NamedType PThreadTType = NamedType<"pthread_t">; PtrType PThreadTPtr = PtrType; RestrictedPtrType RestrictedPThreadTPtr = RestrictedPtrType; HeaderSpec Errno = HeaderSpec< "errno.h", [ Macro<"E2BIG">, Macro<"EACCES">, Macro<"EADDRINUSE">, Macro<"EADDRNOTAVAIL">, Macro<"EAFNOSUPPORT">, Macro<"EAGAIN">, Macro<"EALREADY">, Macro<"EBADF">, Macro<"EBADMSG">, Macro<"EBUSY">, Macro<"ECANCELED">, Macro<"ECHILD">, Macro<"ECONNABORTED">, Macro<"ECONNREFUSED">, Macro<"ECONNRESET">, Macro<"EDEADLK">, Macro<"EDESTADDRREQ">, Macro<"EDQUOT">, Macro<"EEXIST">, Macro<"EFAULT">, Macro<"EFBIG">, Macro<"EHOSTUNREACH">, Macro<"EIDRM">, Macro<"EINPROGRESS">, Macro<"EINTR">, Macro<"EINVAL">, Macro<"EIO">, Macro<"EISCONN">, Macro<"EISDIR">, Macro<"ELOOP">, Macro<"EMFILE">, Macro<"EMLINK">, Macro<"EMSGSIZE">, Macro<"EMULTIHOP">, Macro<"ENAMETOOLONG">, Macro<"ENETDOWN">, Macro<"ENETRESET">, Macro<"ENETUNREACH">, Macro<"ENFILE">, Macro<"ENOBUFS">, Macro<"ENODATA">, Macro<"ENODEV">, Macro<"ENOENT">, Macro<"ENOEXEC">, Macro<"ENOLCK">, Macro<"ENOLINK">, Macro<"ENOMEM">, Macro<"ENOMSG">, Macro<"ENOPROTOOPT">, Macro<"ENOSPC">, Macro<"ENOSR">, Macro<"ENOSTR">, Macro<"ENOSYS">, Macro<"ENOTCONN">, Macro<"ENOTDIR">, Macro<"ENOTEMPTY">, Macro<"ENOTRECOVERABLE">, Macro<"ENOTSOCK">, Macro<"ENOTSUP">, Macro<"ENOTTY">, Macro<"ENXIO">, Macro<"EOPNOTSUPP">, Macro<"EOVERFLOW">, Macro<"EOWNERDEAD">, Macro<"EPERM">, Macro<"EPIPE">, Macro<"EPROTO">, Macro<"EPROTONOSUPPORT">, Macro<"EPROTOTYPE">, Macro<"EROFS">, Macro<"ESPIPE">, Macro<"ESRCH">, Macro<"ESTALE">, Macro<"ETIME">, Macro<"ETIMEDOUT">, Macro<"ETXTBSY">, Macro<"EWOULDBLOCK">, Macro<"EXDEV">, ], [], // Types [], // Enumerations [] // Functions >; HeaderSpec FCntl = HeaderSpec< "fcntl.h", [], // Macros [ModeTType], [], // Enumerations [ FunctionSpec< "creat", RetValSpec, [ArgSpec, ArgSpec] >, FunctionSpec< "open", RetValSpec, [ArgSpec, ArgSpec, ArgSpec] >, FunctionSpec< "openat", RetValSpec, [ArgSpec, ArgSpec, ArgSpec, ArgSpec] >, ] >; HeaderSpec SysMMan = HeaderSpec< "sys/mman.h", [ // TODO: Add a facility to bunch macros into bitwise-or-able groups. // POSIX requires it, so such thing should be captured in this spec. Macro<"PROT_EXEC">, Macro<"PROT_NONE">, Macro<"PROT_READ">, Macro<"PROT_WRITE">, Macro<"MAP_FIXED">, Macro<"MAP_PRIVATE">, Macro<"MAP_SHARED">, Macro<"MAP_FAILED">, ], [ SizeTType, OffTType, ], [], // Enumerations [ FunctionSpec< "mmap", RetValSpec, [ArgSpec, ArgSpec, ArgSpec, ArgSpec, ArgSpec, ArgSpec] >, FunctionSpec< "munmap", RetValSpec, [ArgSpec, ArgSpec] >, ] >; HeaderSpec Signal = HeaderSpec< "signal.h", [], // Macros [ SigSetType, StructSigaction, ], [], // Enumerations [ FunctionSpec< "sigaction", RetValSpec, [ArgSpec, ArgSpec, ArgSpec] >, FunctionSpec< "sigdelset", RetValSpec, [ArgSpec, ArgSpec] >, FunctionSpec< "sigprocmask", RetValSpec, [ArgSpec, ArgSpec, ArgSpec] >, FunctionSpec< "sigemptyset", RetValSpec, [ArgSpec] >, FunctionSpec< "sigaddset", RetValSpec, [ArgSpec, ArgSpec] >, FunctionSpec< "sigfillset", RetValSpec, [ArgSpec] >, ] >; HeaderSpec UniStd = HeaderSpec< "unistd.h", [], // Macros [ OffTType, SSizeTType, SizeTType, ], [], // Enumerations [ FunctionSpec< "close", RetValSpec, [ArgSpec] >, FunctionSpec< "fsync", RetValSpec, [ArgSpec] >, FunctionSpec< "lseek", RetValSpec, [ArgSpec, ArgSpec, ArgSpec] >, FunctionSpec< "read", RetValSpec, [ArgSpec, ArgSpec, ArgSpec] >, FunctionSpec< "rmdir", RetValSpec, [ArgSpec] >, FunctionSpec< "unlink", RetValSpec, [ArgSpec] >, FunctionSpec< "unlinkat", RetValSpec, [ArgSpec, ArgSpec, ArgSpec] >, FunctionSpec< "write", RetValSpec, [ArgSpec, ArgSpec, ArgSpec] >, ] >; HeaderSpec StdLib = HeaderSpec< "stdlib.h", [], // Macros [], // Types [], // Enumerations [ FunctionSpec< "getenv", RetValSpec, [ArgSpec] >, ] >; HeaderSpec String = HeaderSpec< "string.h", [ Macro<"NULL">, ], [ SizeTType, ], [], // Enumerations [ FunctionSpec< "memccpy", RetValSpec, [ArgSpec, ArgSpec, ArgSpec, ArgSpec] >, FunctionSpec< "mempcpy", RetValSpec, [ArgSpec, ArgSpec, ArgSpec] >, FunctionSpec< "stpcpy", RetValSpec, [ArgSpec, ArgSpec] >, FunctionSpec< "stpncpy", RetValSpec, [ArgSpec, ArgSpec, ArgSpec] >, FunctionSpec< "strnlen", RetValSpec, [ArgSpec, ArgSpec] >, FunctionSpec< "strtok_r", RetValSpec, [ArgSpec, ArgSpec, ArgSpec] >, ] >; HeaderSpec CType = HeaderSpec< "ctype.h", [], // Macros [], // Types [], // Enumerations [ FunctionSpec< "isascii", RetValSpec, [ArgSpec] >, ] >; HeaderSpec SysStat = HeaderSpec< "sys/stat.h", [], // Macros [ModeTType], // Types [], // Enumerations [ FunctionSpec< "mkdir", RetValSpec, [ArgSpec, ArgSpec] >, FunctionSpec< "mkdirat", RetValSpec, [ArgSpec, ArgSpec, ArgSpec] >, ] >; HeaderSpec PThread = HeaderSpec< "pthread.h", [], // Macros [PThreadAttrTType, PThreadMutexAttrTType, PThreadMutexTType, PThreadStartT, PThreadTType], // Types [], // Enumerations [ FunctionSpec< "pthread_attr_init", RetValSpec, [ArgSpec] >, FunctionSpec< "pthread_attr_destroy", RetValSpec, [ArgSpec] >, FunctionSpec< "pthread_attr_getdetachstate", RetValSpec, [ArgSpec, ArgSpec] >, FunctionSpec< "pthread_attr_setdetachstate", RetValSpec, [ArgSpec, ArgSpec] >, FunctionSpec< "pthread_attr_getguardsize", RetValSpec, [ArgSpec, ArgSpec] >, FunctionSpec< "pthread_attr_setguardsize", RetValSpec, [ArgSpec, ArgSpec] >, FunctionSpec< "pthread_attr_getstacksize", RetValSpec, [ArgSpec, ArgSpec] >, FunctionSpec< "pthread_attr_setstacksize", RetValSpec, [ArgSpec, ArgSpec] >, FunctionSpec< "pthread_attr_getstack", RetValSpec, [ArgSpec, ArgSpec, ArgSpec] >, FunctionSpec< "pthread_attr_setstack", RetValSpec, [ArgSpec, ArgSpec, ArgSpec] >, FunctionSpec< "pthread_create", RetValSpec, [ArgSpec, ArgSpec, ArgSpec, ArgSpec] >, FunctionSpec< "pthread_join", RetValSpec, [ArgSpec, ArgSpec] >, FunctionSpec< "pthread_detach", RetValSpec, [ArgSpec] >, FunctionSpec< "pthread_self", RetValSpec, [ArgSpec] >, FunctionSpec< "pthread_equal", RetValSpec, [ArgSpec, ArgSpec] >, FunctionSpec< "pthread_mutexattr_init", RetValSpec, [ArgSpec] >, FunctionSpec< "pthread_mutexattr_destroy", RetValSpec, [ArgSpec] >, FunctionSpec< "pthread_mutexattr_gettype", RetValSpec, [ArgSpec, ArgSpec] >, FunctionSpec< "pthread_mutexattr_settype", RetValSpec, [ArgSpec, ArgSpec] >, FunctionSpec< "pthread_mutexattr_getrobust", RetValSpec, [ArgSpec, ArgSpec] >, FunctionSpec< "pthread_mutexattr_setrobust", RetValSpec, [ArgSpec, ArgSpec] >, FunctionSpec< "pthread_mutexattr_getpshared", RetValSpec, [ArgSpec, ArgSpec] >, FunctionSpec< "pthread_mutexattr_setpshared", RetValSpec, [ArgSpec, ArgSpec] >, FunctionSpec< "pthread_mutexattr_getprotocol", RetValSpec, [ArgSpec, ArgSpec] >, FunctionSpec< "pthread_mutexattr_setprotocol", RetValSpec, [ArgSpec, ArgSpec] >, FunctionSpec< "pthread_mutexattr_getprioceiling", RetValSpec, [ArgSpec, ArgSpec] >, FunctionSpec< "pthread_mutexattr_setprioceiling", RetValSpec, [ArgSpec, ArgSpec] >, FunctionSpec< "pthread_mutex_init", RetValSpec, [ArgSpec, ArgSpec] >, FunctionSpec< "pthread_mutex_destroy", RetValSpec, [ArgSpec] >, FunctionSpec< "pthread_mutex_lock", RetValSpec, [ArgSpec] >, FunctionSpec< "pthread_mutex_unlock", RetValSpec, [ArgSpec] >, ] >; HeaderSpec StdIO = HeaderSpec< "stdio.h", [], // Macros [], // Types [], // Enumerations [ FunctionSpec< "flockfile", RetValSpec, [ArgSpec] >, FunctionSpec< "funlockfile", RetValSpec, [ArgSpec] >, ] >; let Headers = [ CType, Errno, FCntl, PThread, Signal, StdIO, StdLib, SysMMan, SysStat, UniStd, String ]; }