diff --git a/klib/src/platform/linux/linux.def b/klib/src/platform/linux/linux.def new file mode 100644 index 00000000000..dd7044c673c --- /dev/null +++ b/klib/src/platform/linux/linux.def @@ -0,0 +1,33 @@ +package = platform.linux +headers = aio.h aliases.h a.out.h argp.h argz.h cpio.h crypt.h \ + ctype.h envz.h error.h execinfo.h fmtmsg.h fpu_control.h \ + fstab.h _G_config.h gconv.h glob.h gnu-versions.h \ + gshadow.h iconv.h ieee754.h ifaddrs.h langinfo.h \ + libintl.h libio.h mcheck.h monetary.h mqueue.h \ + nl_types.h nss.h obstack.h printf.h pty.h re_comp.h \ + spawn.h stab.h stdc-predef.h stdio_ext.h syscall.h \ + tar.h ttyent.h ulimit.h ustat.h utmpx.h \ + values.h wait.h wordexp.h \ + arpa/ftp.h arpa/inet.h arpa/nameser_compat.h \ + arpa/nameser.h arpa/telnet.h arpa/tftp.h \ + sys/acct.h sys/auxv.h sys/bitypes.h sys/cdefs.h \ + sys/debugreg.h sys/dir.h sys/errno.h \ + sys/eventfd.h sys/fanotify.h sys/fcntl.h \ + sys/file.h sys/fsuid.h sys/gmon.h sys/gmon_out.h \ + sys/io.h sys/kdaemon.h sys/kd.h sys/mount.h \ + sys/msg.h sys/mtio.h sys/param.h sys/pci.h sys/perm.h \ + sys/personality.h sys/prctl.h sys/procfs.h sys/profil.h \ + sys/raw.h sys/reboot.h sys/reg.h sys/resource.h \ + sys/sem.h sys/sendfile.h sys/signalfd.h sys/signal.h \ + sys/socket.h sys/socketvar.h sys/soundcard.h sys/statfs.h \ + sys/statvfs.h sys/stropts.h sys/swap.h sys/syscall.h \ + sys/sysctl.h sys/syslog.h sys/sysmacros.h sys/termios.h \ + sys/timeb.h sys/timerfd.h sys/timex.h sys/ttychars.h \ + sys/ttydefaults.h sys/types.h sys/ucontext.h sys/uio.h \ + sys/ultrasound.h sys/un.h sys/unistd.h sys/user.h \ + sys/ustat.h sys/utsname.h sys/vfs.h sys/vlimit.h \ + sys/vt.h sys/vtimes.h sys/xattr.h + +compilerOpts = -D_GNU_SOURCE + +linkerOpts = -ldl diff --git a/klib/src/platform/linux/posix.def b/klib/src/platform/linux/posix.def new file mode 100644 index 00000000000..df969e68445 --- /dev/null +++ b/klib/src/platform/linux/posix.def @@ -0,0 +1,30 @@ +package = platform.posix +headers = alloca.h ar.h assert.h byteswap.h complex.h dirent.h dlfcn.h elf.h endian.h err.h errno.h fcntl.h \ + features.h fenv.h fnmatch.h fts.h ftw.h getopt.h grp.h inttypes.h lastlog.h libgen.h limits.h \ + link.h locale.h malloc.h math.h memory.h mntent.h netdb.h paths.h poll.h \ + pthread.h pwd.h regex.h resolv.h sched.h search.h semaphore.h setjmp.h sgtty.h signal.h \ + stdatomic.h stdint.h stdio.h stdlib.h string.h strings.h syslog.h termio.h termios.h thread_db.h \ + time.h uchar.h ucontext.h unistd.h utime.h utmp.h wchar.h wctype.h xlocale.h zconf.h zlib.h \ + net/ethernet.h net/if.h net/if_arp.h net/if_packet.h net/route.h \ + netinet/ether.h netinet/icmp6.h netinet/if_ether.h netinet/in.h netinet/in_systm.h \ + netinet/ip.h netinet/ip6.h netinet/ip_icmp.h netinet/tcp.h netinet/udp.h \ + netpacket/packet.h \ + sys/epoll.h sys/inotify.h sys/ioctl.h sys/ipc.h sys/klog.h sys/mman.h sys/poll.h sys/ptrace.h \ + sys/queue.h sys/select.h sys/shm.h sys/stat.h sys/sysinfo.h \ + sys/time.h sys/times.h sys/wait.h + +compilerOpts = -D_GNU_SOURCE +linkerOpts = -ldl -lz + +--- +// cinterop -target linux -def klib/src/platform/linux/posix.def -o platform.posix.klib + +// Wrapper to access errno variable. +static int posix_errno() { + return errno; +} + +// Wrapper to access h_errno variable. +static int posix_h_errno() { + return h_errno; +}