├── .github ├── FUNDING.yml ├── SECURITY.md └── workflows │ ├── aarch64.yml │ └── x86_64.yml ├── .gitignore ├── .gitmodules ├── .mailmap ├── AUTHORS ├── LICENSE ├── Makefile ├── README.md ├── apps ├── about.c ├── basename.c ├── beep.c ├── bim.c ├── bim.h ├── block-dev-stats.c ├── cal.c ├── calculator.c ├── cat-img.c ├── cat.c ├── chmod.c ├── chown.c ├── clear.c ├── color-picker.c ├── compositor.c ├── cp.c ├── cpu-name.krk ├── cpuwidget.c ├── crc32.c ├── cursor-off.c ├── date.c ├── dbg.c ├── demo.c ├── demo.krk ├── dhclient.c ├── dirname.c ├── drawlines.c ├── du.c ├── echo.c ├── env.c ├── esh.c ├── false.c ├── fetch.c ├── fgrep.c ├── file-browser.c ├── find-timezone.c ├── font-preview.c ├── font-tool.c ├── free.c ├── getty.c ├── glogin-provider.c ├── glogin.c ├── grep.c ├── groups.c ├── gsudo.c ├── gunzip.c ├── head.c ├── hello.c ├── help-browser.c ├── hexify.c ├── highlight-source.krk ├── hostname.c ├── ifconfig.c ├── imgviewer.c ├── init.c ├── insmod.c ├── irc.c ├── json-test.c ├── julia.c ├── kbd-test.c ├── kcmdline.c ├── kill.c ├── killall.c ├── krk_test_noise.krk ├── krk_yutani_test.krk ├── live-session.c ├── ln.c ├── login-loop.c ├── login.c ├── logname.c ├── ls.c ├── lspci.c ├── maybe-pdfviewer.krk ├── migrate.c ├── mines.krk ├── misaka-test.c ├── mixerctl.c ├── mkdir.c ├── mktemp.c ├── more.c ├── mount.c ├── msk.c ├── mv.c ├── netty.c ├── nproc.c ├── nslookup.c ├── nyancat.c ├── nyancat │ ├── animation.h │ └── telnet.h ├── package-manager.c ├── panel.c ├── path_demo.krk ├── piano.c ├── pidof.c ├── ping.c ├── plasma.c ├── play.c ├── polygons.c ├── pong.c ├── prompt_and_delete.krk ├── ps.c ├── pstree.c ├── pwd.c ├── qemu-display-hack.c ├── qemu-fwcfg.c ├── readelf.c ├── readlink.c ├── reboot.c ├── reload_desktop.sh ├── reset.c ├── rm.c ├── serial-console.c ├── session.c ├── set-resolution.c ├── set-wallpaper.sh ├── show-toasts.krk ├── show-tutorial.sh ├── showdialog.c ├── sleep.c ├── snow.c ├── sort.c ├── splash-log.c ├── stat.c ├── strace.c ├── strings.c ├── stty.c ├── sudo.c ├── sync.c ├── sysfunc.c ├── sysinfo.c ├── t_mbstowcs.c ├── tar.c ├── tee.c ├── terminal-font.h ├── terminal-palette.h ├── terminal-vga.c ├── terminal.c ├── test-badwrite.c ├── test-conf.c ├── test-fpclassify.c ├── test-localtime.c ├── test-lock.c ├── test-loop.c ├── test-printf.c ├── test-ptrace-syscall.c ├── test-sigsegv.c ├── test-sigsuspend.c ├── test-sigwait.c ├── test-syscall-sysret.c ├── test-tls.c ├── test-tty-read.c ├── test-udp-recv.krk ├── toaru_logo.h ├── toast.krk ├── toastd.c ├── toggle-abs-mouse.c ├── top.c ├── touch.c ├── true.c ├── tty.c ├── ttysize.c ├── tutorial.c ├── uname.c ├── ununicode.h ├── upload.krk ├── uptime.c ├── vga-palette.h ├── wallpaper-picker.c ├── wc.c ├── weather-configurator.c ├── weather-tool.c ├── which.c ├── whoami.c ├── yes.c ├── yutani-clipboard.c ├── yutani-kbd.c ├── yutani-query.c ├── yutani-test.c └── yutani-tty-pipe.c ├── base ├── etc │ ├── demo.conf │ ├── group │ ├── hostname │ ├── issue │ ├── master.passwd │ ├── motd │ ├── msk.conf │ ├── os-release │ ├── panel.menu │ ├── passwd │ ├── startup.d │ │ ├── 00_startuplog.sh │ │ ├── 01_migrate.sh │ │ ├── 02_hostname.sh │ │ ├── 03_tmpfs.sh │ │ ├── 04_modprobe.sh │ │ ├── 05_mountcd.sh │ │ ├── 40_dhcp.sh │ │ ├── 50_msk.sh │ │ └── 99_runstart.sh │ ├── sudoers │ └── weather.json ├── home │ ├── guest │ │ └── hello │ ├── local │ │ ├── .bim3rc │ │ ├── .eshrc │ │ ├── .wallpaper.conf │ │ ├── .yutanirc │ │ ├── Desktop │ │ │ ├── 0_file_browser.launcher │ │ │ ├── 1_terminal.launcher │ │ │ ├── 2_packages.launcher │ │ │ └── 3_read_me.launcher │ │ ├── README.md │ │ └── text_layout.krk │ └── root │ │ ├── .bimrc │ │ └── hello ├── lib │ └── .dummy └── usr │ ├── include │ ├── _cheader.h │ ├── alloca.h │ ├── arpa │ │ └── inet.h │ ├── assert.h │ ├── bits │ │ └── dirent.h │ ├── ctype.h │ ├── dirent.h │ ├── dlfcn.h │ ├── errno.h │ ├── fcntl.h │ ├── getopt.h │ ├── iconv.h │ ├── inttypes.h │ ├── kernel │ │ ├── arch │ │ │ ├── aarch64 │ │ │ │ ├── dtb.h │ │ │ │ ├── gic.h │ │ │ │ ├── pml.h │ │ │ │ ├── regs.h │ │ │ │ └── rpi.h │ │ │ └── x86_64 │ │ │ │ ├── acpi.h │ │ │ │ ├── cmos.h │ │ │ │ ├── irq.h │ │ │ │ ├── pml.h │ │ │ │ ├── ports.h │ │ │ │ └── regs.h │ │ ├── args.h │ │ ├── assert.h │ │ ├── elf.h │ │ ├── generic.h │ │ ├── gzip.h │ │ ├── hashmap.h │ │ ├── ksym.h │ │ ├── list.h │ │ ├── misc.h │ │ ├── mmu.h │ │ ├── mod │ │ │ ├── rtl.h │ │ │ ├── shell.h │ │ │ ├── snd.h │ │ │ └── sound.h │ │ ├── module.h │ │ ├── mouse.h │ │ ├── multiboot.h │ │ ├── mutex.h │ │ ├── net │ │ │ ├── e1000.h │ │ │ ├── eth.h │ │ │ ├── ipv4.h │ │ │ └── netif.h │ │ ├── pci.h │ │ ├── pipe.h │ │ ├── printf.h │ │ ├── process.h │ │ ├── procfs.h │ │ ├── ptrace.h │ │ ├── pty.h │ │ ├── ramdisk.h │ │ ├── ringbuffer.h │ │ ├── shm.h │ │ ├── signal.h │ │ ├── spinlock.h │ │ ├── string.h │ │ ├── symboltable.h │ │ ├── syscall.h │ │ ├── time.h │ │ ├── tmpfs.h │ │ ├── tokenize.h │ │ ├── tree.h │ │ ├── types.h │ │ ├── version.h │ │ ├── vfs.h │ │ └── video.h │ ├── libgen.h │ ├── libintl.h │ ├── limits.h │ ├── locale.h │ ├── math.h │ ├── memory.h │ ├── net │ │ └── if.h │ ├── netdb.h │ ├── netinet │ │ └── in.h │ ├── poll.h │ ├── pthread.h │ ├── pty.h │ ├── pwd.h │ ├── sched.h │ ├── setjmp.h │ ├── signal.h │ ├── stdint.h │ ├── stdio.h │ ├── stdlib.h │ ├── string.h │ ├── strings.h │ ├── sys │ │ ├── fswait.h │ │ ├── ioctl.h │ │ ├── mman.h │ │ ├── mount.h │ │ ├── param.h │ │ ├── ptrace.h │ │ ├── shm.h │ │ ├── signal.h │ │ ├── signal_defs.h │ │ ├── socket.h │ │ ├── stat.h │ │ ├── sysfunc.h │ │ ├── termios.h │ │ ├── time.h │ │ ├── times.h │ │ ├── types.h │ │ ├── uregs.h │ │ ├── utsname.h │ │ └── wait.h │ ├── syscall.h │ ├── syscall_nums.h │ ├── termio.h │ ├── termios.h │ ├── time.h │ ├── toaru │ │ ├── auth.h │ │ ├── button.h │ │ ├── confreader.h │ │ ├── decodeutf8.h │ │ ├── decorations.h │ │ ├── drawstring.h │ │ ├── graphics.h │ │ ├── hashmap.h │ │ ├── icon_cache.h │ │ ├── inflate.h │ │ ├── jpeg.h │ │ ├── json.h │ │ ├── kbd.h │ │ ├── list.h │ │ ├── markup.h │ │ ├── markup_text.h │ │ ├── menu.h │ │ ├── mouse.h │ │ ├── panel.h │ │ ├── pex.h │ │ ├── png.h │ │ ├── rline.h │ │ ├── spinlock.h │ │ ├── termemu.h │ │ ├── text.h │ │ ├── trace.h │ │ ├── tree.h │ │ ├── yutani-internal.h │ │ ├── yutani-server.h │ │ └── yutani.h │ ├── unistd.h │ ├── utime.h │ ├── va_list.h │ ├── wait.h │ └── wchar.h │ └── share │ ├── bim │ ├── site │ │ └── __init__.krk │ ├── syntax │ │ ├── __init__.krk │ │ ├── bash.krk │ │ ├── biminfo.krk │ │ ├── c.krk │ │ ├── conf.krk │ │ ├── css.krk │ │ ├── ctags.krk │ │ ├── diff.krk │ │ ├── dirent.krk │ │ ├── dlang.krk │ │ ├── docker.krk │ │ ├── doxygen.krk │ │ ├── esh.krk │ │ ├── gas.krk │ │ ├── git.krk │ │ ├── graphql.krk │ │ ├── groovy.krk │ │ ├── hosts.krk │ │ ├── issue.krk │ │ ├── java.krk │ │ ├── javascript.krk │ │ ├── json.krk │ │ ├── krk.krk │ │ ├── latex.krk │ │ ├── ld.krk │ │ ├── lisp.krk │ │ ├── lua.krk │ │ ├── make.krk │ │ ├── man.krk │ │ ├── markdown.krk │ │ ├── protobuf.krk │ │ ├── py.krk │ │ ├── rust.krk │ │ └── xml.krk │ └── themes │ │ ├── __init__.krk │ │ ├── ansi.krk │ │ ├── citylights.krk │ │ ├── light.krk │ │ ├── solarized.krk │ │ ├── strawberry.krk │ │ ├── sunsmoke.krk │ │ └── wombat.krk │ ├── cursor │ ├── drag.png │ ├── grab.png │ ├── ibeam.png │ ├── normal.png │ ├── point.png │ ├── resize-dlur.png │ ├── resize-horizontal.png │ ├── resize-uldr.png │ └── resize-vertical.png │ ├── fonts │ └── truetype │ │ └── dejavu │ │ ├── DejaVuSans-Bold.ttf │ │ ├── DejaVuSans-BoldOblique.ttf │ │ ├── DejaVuSans-Oblique.ttf │ │ ├── DejaVuSans.ttf │ │ ├── DejaVuSansMono-Bold.ttf │ │ ├── DejaVuSansMono-BoldOblique.ttf │ │ ├── DejaVuSansMono-Oblique.ttf │ │ └── DejaVuSansMono.ttf │ ├── games │ └── pong │ │ ├── ball.png │ │ ├── paddle-blue.png │ │ └── paddle-red.png │ ├── help │ ├── 0_index.trt │ ├── calculator.trt │ ├── file-browser.trt │ ├── help-browser.trt │ ├── package-manager.trt │ └── terminal.trt │ ├── icons │ ├── 16 │ │ ├── applications-generic.png │ │ ├── back.png │ │ ├── bookmark.png │ │ ├── calculator.png │ │ ├── check.png │ │ ├── clock.png │ │ ├── config.png │ │ ├── exit.png │ │ ├── file.png │ │ ├── folder.png │ │ ├── forward.png │ │ ├── help.png │ │ ├── home.png │ │ ├── menu-tick.png │ │ ├── mines.png │ │ ├── missing.png │ │ ├── new.png │ │ ├── open.png │ │ ├── package.png │ │ ├── refresh.png │ │ ├── save.png │ │ ├── star.png │ │ ├── up.png │ │ ├── utilities-terminal.png │ │ ├── weather-clouds.png │ │ ├── weather-humidity.png │ │ └── weather-pressure.png │ ├── 24 │ │ ├── mouse-relative.png │ │ ├── mouse-status.png │ │ ├── net-active.png │ │ ├── net-disconnected.png │ │ ├── volume-full.png │ │ ├── volume-low.png │ │ ├── volume-medium.png │ │ └── volume-mute.png │ ├── 48 │ │ ├── applications-generic.png │ │ ├── applications-painting.png │ │ ├── c.png │ │ ├── calculator.png │ │ ├── cd.png │ │ ├── clock.png │ │ ├── drawlines.png │ │ ├── exit.png │ │ ├── file.png │ │ ├── folder.png │ │ ├── font.png │ │ ├── gears.png │ │ ├── h.png │ │ ├── help.png │ │ ├── image.png │ │ ├── julia.png │ │ ├── krk.png │ │ ├── lock.png │ │ ├── mandelbrot.png │ │ ├── mines.png │ │ ├── network-jack-disconnected.png │ │ ├── network-jack.png │ │ ├── package-uninstalled.png │ │ ├── package.png │ │ ├── package_a.png │ │ ├── package_tar.png │ │ ├── package_targz.png │ │ ├── package_zip.png │ │ ├── pdf.png │ │ ├── plasma.png │ │ ├── py.png │ │ ├── sh.png │ │ ├── so.png │ │ ├── star.png │ │ ├── system-monitor.png │ │ ├── utilities-terminal.png │ │ └── wallpaper-picker.png │ ├── panel-shutdown.png │ └── weather │ │ ├── 01d.png │ │ ├── 01n.png │ │ ├── 02d.png │ │ ├── 02n.png │ │ ├── 03d.png │ │ ├── 03n.png │ │ ├── 04d.png │ │ ├── 04n.png │ │ ├── 09d.png │ │ ├── 09n.png │ │ ├── 10d.png │ │ ├── 10n.png │ │ ├── 11d.png │ │ ├── 11n.png │ │ ├── 13d.png │ │ ├── 13n.png │ │ ├── 50d.png │ │ └── 50n.png │ ├── logo_login.png │ ├── snowflake.bmp │ ├── ttk │ ├── blorp.wav │ ├── fancy │ │ ├── borders-active.png │ │ ├── borders-inactive.png │ │ ├── button-close.png │ │ ├── button-maximize.png │ │ ├── button-minimize.png │ │ └── button-unmaximize.png │ └── toast │ │ └── default.png │ ├── wallpaper.jpg │ └── wallpapers │ └── hanging.jpg ├── boot ├── README.md ├── boot.S ├── config.c ├── editor.c ├── editor.h ├── elf.h ├── iso9660.h ├── kbd.c ├── kbd.h ├── link.ld ├── mbr.S ├── menu.c ├── menu.h ├── multiboot.c ├── multiboot.h ├── options.h ├── platform.c ├── qemu.c ├── qemu.h ├── text.c ├── text.h ├── util.c ├── util.h └── video.c ├── build ├── aarch64.mk └── x86_64.mk ├── kernel ├── arch │ ├── aarch64 │ │ ├── arch.c │ │ ├── bootstub │ │ │ ├── bootstrap.S │ │ │ ├── link.ld │ │ │ └── main.c │ │ ├── context.S │ │ ├── dtb.c │ │ ├── entry.S │ │ ├── fwcfg.c │ │ ├── gic.c │ │ ├── irq.S │ │ ├── link.ld │ │ ├── main.c │ │ ├── mmu.c │ │ ├── pl011.c │ │ ├── rpi.c │ │ ├── rpi400 │ │ │ ├── fbterm.c │ │ │ ├── link.ld │ │ │ ├── main.c │ │ │ └── start.S │ │ ├── rpi_miniuart.c │ │ ├── smp.c │ │ ├── traceback.c │ │ └── virtio.c │ └── x86_64 │ │ ├── bootstrap.S │ │ ├── cmos.c │ │ ├── gdt.c │ │ ├── idt.c │ │ ├── irq.S │ │ ├── link.ld │ │ ├── main.c │ │ ├── mmu.c │ │ ├── pic.c │ │ ├── pit.c │ │ ├── ports.c │ │ ├── ps2hid.c │ │ ├── serial.c │ │ ├── smp.c │ │ └── user.c ├── audio │ └── snd.c ├── binfmt.c ├── generic.c ├── misc │ ├── args.c │ ├── assert.c │ ├── elf64.c │ ├── fbterm.c │ ├── gzip.c │ ├── hashmap.c │ ├── kprintf.c │ ├── ksym.c │ ├── list.c │ ├── malloc.c │ ├── pci.c │ ├── ringbuffer.c │ ├── string.c │ ├── tokenize.c │ └── tree.c ├── net │ ├── arp.c │ ├── eth.c │ ├── ipv4.c │ ├── loop.c │ ├── netif.c │ └── socket.c ├── sys │ ├── mutex.c │ ├── process.c │ ├── ptrace.c │ ├── shm.c │ ├── signal.c │ ├── syscall.c │ └── version.c ├── vfs │ ├── console.c │ ├── packetfs.c │ ├── pipe.c │ ├── portio.c │ ├── procfs.c │ ├── ramdisk.c │ ├── random.c │ ├── tarfs.c │ ├── tmpfs.c │ ├── tty.c │ ├── unixpipe.c │ ├── vfs.c │ └── zero.c └── video │ └── lfbvideo.c ├── lib ├── README.md ├── auth.c ├── button.c ├── confreader.c ├── decor-fancy.c ├── decorations.c ├── graphics.c ├── hashmap.c ├── icon_cache.c ├── inflate.c ├── jpeg.c ├── json.c ├── kbd.c ├── kuroko │ ├── _waitpid.c │ ├── _yutani2.c │ └── yutani_mainloop.krk ├── list.c ├── markup.c ├── markup_text.c ├── menu.c ├── panel_appmenu.c ├── panel_clock.c ├── panel_date.c ├── panel_logout.c ├── panel_network.c ├── panel_volume.c ├── panel_weather.c ├── panel_windowlist.c ├── pex.c ├── png.c ├── rline.c ├── rline_exp.c ├── termemu.c ├── text.c ├── tree.c └── yutani.c ├── libc ├── arch │ ├── aarch64 │ │ ├── bad.c │ │ ├── crt0.S │ │ ├── crti.S │ │ ├── crtn.S │ │ ├── memcpy.c │ │ ├── memset.c │ │ └── setjmp.c │ └── x86_64 │ │ ├── crt0.S │ │ ├── crti.S │ │ ├── crtn.S │ │ ├── math.c │ │ ├── memcpy.c │ │ ├── memset.c │ │ └── setjmp.c ├── assert │ └── assert.c ├── ctype │ ├── _ctype.c │ ├── isalnum.c │ ├── isalpha.c │ ├── isascii.c │ ├── iscntrl.c │ ├── isdigit.c │ ├── isgraph.c │ ├── islower.c │ ├── isprint.c │ ├── ispunct.c │ ├── isspace.c │ ├── isupper.c │ ├── isxdigit.c │ ├── tolower.c │ └── toupper.c ├── dirent │ ├── dir.c │ └── mkdir.c ├── dlfcn │ └── dlfcn.c ├── errno │ └── errorno.c ├── iconv │ └── iconv.c ├── ioctl │ └── ioctl.c ├── libgen │ ├── basename.c │ └── dirname.c ├── libintl │ └── libintl.c ├── locale │ ├── localeconv.c │ └── setlocale.c ├── main.c ├── math │ ├── bad.c │ └── math.c ├── poll │ └── poll.c ├── pthread │ ├── pthread.c │ └── pthread_rwlock.c ├── pty │ └── pty.c ├── pwd │ └── pwd.c ├── sched │ └── sched_yield.c ├── signal │ ├── kill.c │ ├── raise.c │ ├── sigaction.c │ ├── signal.c │ ├── sigpending.c │ ├── sigprocmask.c │ ├── sigset.c │ └── sigsuspend.c ├── stdio │ ├── perror.c │ ├── printf.c │ ├── puts.c │ ├── remove.c │ ├── rename.c │ ├── scanf.c │ ├── stdio.c │ ├── tmpfile.c │ └── tmpnam.c ├── stdlib │ ├── abort.c │ ├── atexit.c │ ├── atof.c │ ├── bsearch.c │ ├── div.c │ ├── getenv.c │ ├── labs.c │ ├── malloc.c │ ├── mbstowcs.c │ ├── mktemp.c │ ├── putenv.c │ ├── qsort.c │ ├── rand.c │ ├── realpath.c │ ├── setenv.c │ ├── strtod.c │ ├── strtoul.c │ └── system.c ├── string │ ├── memmove.c │ ├── str.c │ ├── strerror.c │ ├── strncmp.c │ ├── strncpy.c │ ├── strsignal.c │ └── strxfrm.c ├── strings │ └── strcasecmp.c ├── sys │ ├── fswait.c │ ├── mount.c │ ├── network.c │ ├── ptrace.c │ ├── reboot.c │ ├── shm.c │ ├── sysfunc.c │ ├── uname.c │ └── wait.c ├── time │ ├── clock.c │ ├── clock_gettime.c │ ├── ctime.c │ ├── gettimeofday.c │ ├── localtime.c │ ├── settimeofday.c │ ├── strftime.c │ ├── time.c │ └── times.c ├── unistd │ ├── access.c │ ├── alarm.c │ ├── chdir.c │ ├── chmod.c │ ├── chown.c │ ├── close.c │ ├── creat.c │ ├── dup2.c │ ├── execvp.c │ ├── exit.c │ ├── fcntl.c │ ├── fork.c │ ├── fstat.c │ ├── getcwd.c │ ├── getegid.c │ ├── geteuid.c │ ├── getgid.c │ ├── getgroups.c │ ├── getlogin.c │ ├── getopt.c │ ├── getopt_long.c │ ├── getpgrp.c │ ├── getpid.c │ ├── getuid.c │ ├── getwd.c │ ├── hostname.c │ ├── isatty.c │ ├── link.c │ ├── lseek.c │ ├── open.c │ ├── pathconf.c │ ├── pipe.c │ ├── pread.c │ ├── pwrite.c │ ├── read.c │ ├── readlink.c │ ├── rmdir.c │ ├── sbrk.c │ ├── setgid.c │ ├── setgroups.c │ ├── setpgid.c │ ├── setsid.c │ ├── setuid.c │ ├── sleep.c │ ├── stat.c │ ├── symlink.c │ ├── sync.c │ ├── truncate.c │ ├── ttyname.c │ ├── umask.c │ ├── unlink.c │ ├── usleep.c │ └── write.c ├── utime │ └── utime.c └── wchar │ ├── wcscat.c │ ├── wcscmp.c │ ├── wcscpy.c │ ├── wcslen.c │ ├── wcsncpy.c │ ├── wcstok.c │ ├── wcstol.c │ └── wcwidth.c ├── linker ├── README.md ├── link.ld └── linker.c ├── modules ├── ac97.c ├── ahci.c ├── ata.c ├── dospart.c ├── e1000.c ├── es1371.c ├── ext2.c ├── hda.c ├── i965.c ├── iso9660.c ├── pcspkr.c ├── piix4.c ├── test.c ├── vbox.c ├── vmware.c └── xhci.c └── util ├── __init__.krk ├── activate.sh ├── arch.sh ├── auto-dep.krk ├── bochsrc.txt ├── build-in-docker-aarch64.sh ├── build-in-docker.sh ├── build-toolchain.sh ├── createramdisk.py ├── docker ├── Dockerfile └── README.md ├── gen_wcwidth.krk ├── generate-release-notes.sh ├── gensym.krk ├── init.krk ├── libm.c ├── make-version ├── make_mbr.krk ├── mkdisk.sh ├── update-extents.krk └── valid-modules.sh /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [klange] 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.aux 2 | *.idx 3 | *.ilg 4 | *.ind 5 | *.log 6 | *.o 7 | *.a 8 | *.out 9 | *.pdf 10 | *.so 11 | *.swp 12 | *.swn 13 | *.toc 14 | *.ko 15 | *.pcap 16 | .gdb_history 17 | /ramdisk.tar 18 | /ramdisk.igz 19 | /misaka-kernel.64 20 | /misaka-kernel 21 | /kernel/symbols.S 22 | /util/build 23 | /util/local 24 | /util/cross 25 | /base/bin/* 26 | /base/usr/bin/* 27 | /base/usr/lib/* 28 | /base/lib/kuroko/* 29 | /base/usr/share/games/doom 30 | /.make/ 31 | /cdrom 32 | /fatbase 33 | /image.iso 34 | /boot/mbr.sys 35 | /bootstub 36 | /.arch 37 | /kernel8.img 38 | /kernel8.img.elf 39 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "util/binutils-gdb"] 2 | path = util/binutils-gdb 3 | url = ../../toaruos/binutils-gdb 4 | [submodule "util/gcc"] 5 | path = util/gcc 6 | url = ../../toaruos/gcc 7 | [submodule "kuroko"] 8 | path = kuroko 9 | url = ../../kuroko-lang/kuroko 10 | -------------------------------------------------------------------------------- /.mailmap: -------------------------------------------------------------------------------- 1 | K. Lange 2 | K. Lange 3 | K. Lange 4 | K. Lange 5 | K. Lange 6 | K. Lange 7 | K. Lange 8 | Markus Schober 9 | Mike Gerow 10 | Tianyi Wang 11 | Jozef Nagy <38380751+jozefnagyoff@users.noreply.github.com> 12 | Mai M. 13 | Ofek Lavie 14 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Maintainer and Author: 2 | 3 | K. Lange 4 | 5 | Major Contributors: 6 | 7 | Mike Gerow 8 | Dale Weiler 9 | Matt White 10 | Markus Schober 11 | 12 | Other Contributors: 13 | 14 | Adam DiCarlo 15 | David Hayman 16 | Fabien Siron 17 | Gil Mendes 18 | Ivailo Monev 19 | Josh Kilmer 20 | Lioncash 21 | Noah Rosamilia 22 | Ofek 23 | Patrick Lucas 24 | Peter Harliman Liem 25 | Shawn Anastasio 26 | Steve Jenson 27 | Tianyi Wang 28 | Tyler Bindon 29 | -------------------------------------------------------------------------------- /apps/basename.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief basename - print file name 3 | * 4 | * @copyright 5 | * This file is part of ToaruOS and is released under the terms 6 | * of the NCSA / University of Illinois License - see LICENSE.md 7 | * Copyright (C) 2018 K. Lange 8 | */ 9 | #include 10 | #include 11 | #include 12 | 13 | int main(int argc, char * argv[]) { 14 | if (argc < 2) { 15 | fprintf(stderr, "%s: expected argument\n", argv[0]); 16 | return 1; 17 | } 18 | 19 | char * c = basename(argv[1]); 20 | 21 | if (argc > 2) { 22 | char * suffix = argv[2]; 23 | char * found = strstr(c + strlen(c) - strlen(suffix), suffix); 24 | if (found && (found - c == (int)(strlen(c)-strlen(suffix)))) { 25 | *found = '\0'; 26 | } 27 | } 28 | 29 | fprintf(stdout, "%s\n", c); 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /apps/block-dev-stats.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief Show block device statistics, where available. 3 | * 4 | * Shows cache hit/miss/write counts for ATA devices, mostly. 5 | * 6 | * @copyright 7 | * This file is part of ToaruOS and is released under the terms 8 | * of the NCSA / University of Illinois License - see LICENSE.md 9 | * Copyright (C) 2021 K. Lange 10 | */ 11 | #include 12 | #include 13 | #include 14 | 15 | #include 16 | 17 | int main(int argc, char * argv[]) { 18 | if (argc < 2) return 1; 19 | 20 | int fd = open(argv[1],O_RDONLY); 21 | 22 | if (fd < 0) { 23 | fprintf(stderr, "open: %d\n", fd); 24 | return 2; 25 | } 26 | 27 | uint64_t stats[4] = {-1}; 28 | 29 | long res = ioctl(fd, 0x2A01234UL, &stats); 30 | 31 | if (res < 0) { 32 | fprintf(stderr, "ioctl: %ld\n", res); 33 | return 3; 34 | } 35 | 36 | fprintf(stderr, "hits:\t%zu\n", stats[0]); 37 | fprintf(stderr, "misses:\t%zu\n", stats[1]); 38 | fprintf(stderr, "evicts:\t%zu\n", stats[2]); 39 | fprintf(stderr, "writes:\t%zu\n", stats[3]); 40 | 41 | return 0; 42 | } 43 | -------------------------------------------------------------------------------- /apps/clear.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief clear - Clear the terminal 3 | * 4 | * Sends an escape code to clear the screen. Ideally, this should 5 | * come from a database of terminal escape codes (eg. terminfo), 6 | * but we don't have one of those yet, so just send a code that 7 | * makes sense for a lot of terminals. 8 | * 9 | * @copyright 10 | * This file is part of ToaruOS and is released under the terms 11 | * of the NCSA / University of Illinois License - see LICENSE.md 12 | * Copyright (C) 2013 K. Lange 13 | */ 14 | #include 15 | 16 | int main(int argc, char ** argv) { 17 | printf("\033[H\033[2J"); 18 | fflush(stdout); 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /apps/cursor-off.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief cursor-off - Disables the VGA text mode cursor. 3 | * 4 | * This is an old tool that calls a special system call 5 | * to change the VGA text-mode cursor position. The VGA 6 | * terminal renders its own cursor in software, so we 7 | * try to move the hardware cursor off screen so it doesn't 8 | * interfere with the rest of the terminal and look weird. 9 | * 10 | * @copyright 11 | * This file is part of ToaruOS and is released under the terms 12 | * of the NCSA / University of Illinois License - see LICENSE.md 13 | * Copyright (C) 2016-2018 K. Lange 14 | */ 15 | #include 16 | #include 17 | #include 18 | 19 | int main(int argc, char * argv[]) { 20 | int fd = open("/dev/port", O_RDWR); 21 | if (fd < 0) return 1; 22 | pwrite(fd, (unsigned char[]){14}, 1, 0x3D4); 23 | pwrite(fd, (unsigned char[]){0xFF}, 1, 0x3D5); 24 | pwrite(fd, (unsigned char[]){15}, 1, 0x3D4); 25 | pwrite(fd, (unsigned char[]){0xFF}, 1, 0x3D5); 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /apps/demo.krk: -------------------------------------------------------------------------------- 1 | import os, kuroko 2 | 3 | print('Kuroko',kuroko.version, kuroko.buildenv, kuroko.builddate) 4 | print('Running on:',os.uname()) 5 | -------------------------------------------------------------------------------- /apps/dirname.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief dirname - print directory name from path string 3 | * 4 | * @copyright 5 | * This file is part of ToaruOS and is released under the terms 6 | * of the NCSA / University of Illinois License - see LICENSE.md 7 | * Copyright (C) 2018 K. Lange 8 | */ 9 | #include 10 | #include 11 | #include 12 | 13 | int main(int argc, char * argv[]) { 14 | if (argc < 2) { 15 | fprintf(stderr, "%s: expected argument\n", argv[0]); 16 | return 1; 17 | } 18 | 19 | char * c = dirname(argv[1]); 20 | fprintf(stdout, "%s\n", c); 21 | return 0; 22 | } 23 | 24 | -------------------------------------------------------------------------------- /apps/false.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief false - returns a failure status code. 3 | * 4 | * @copyright 5 | * This file is part of ToaruOS and is released under the terms 6 | * of the NCSA / University of Illinois License - see LICENSE.md 7 | * Copyright (C) 2018 K. Lange 8 | */ 9 | int main() { 10 | return 1; 11 | } 12 | -------------------------------------------------------------------------------- /apps/groups.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief List group memberships. 3 | * @file apps/groups.c 4 | * 5 | * @copyright 6 | * This file is part of ToaruOS and is released under the terms 7 | * of the NCSA / University of Illinois License - see LICENSE.md 8 | * Copyright (C) 2021 K. Lange 9 | */ 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | int main(int argc, char ** argv) { 16 | /* First print our egid group */ 17 | struct passwd * p = getpwuid(getegid()); 18 | if (p) { 19 | fprintf(stdout, "%s ", p->pw_name); 20 | } 21 | /* Then get the group list. */ 22 | int groupCount = getgroups(0, NULL); 23 | if (groupCount) { 24 | gid_t * myGroups = malloc(sizeof(gid_t) * groupCount); 25 | groupCount = getgroups(groupCount, myGroups); 26 | for (int i = 0; i < groupCount; ++i) { 27 | p = getpwuid(myGroups[i]); 28 | if (p) { 29 | fprintf(stdout, "%s ", p->pw_name); 30 | } 31 | } 32 | } 33 | fprintf(stdout,"\n"); 34 | endpwent(); 35 | return 0; 36 | } 37 | 38 | -------------------------------------------------------------------------------- /apps/hello.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief hello - Prints "Hello, world." 3 | * 4 | * @copyright 5 | * This file is part of ToaruOS and is released under the terms 6 | * of the NCSA / University of Illinois License - see LICENSE.md 7 | * Copyright (C) 2011~2018 K. Lange 8 | */ 9 | #include 10 | 11 | int main(int argc, char * argv[]) { 12 | puts("Hello, world."); 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /apps/highlight-source.krk: -------------------------------------------------------------------------------- 1 | #!/bin/kuroko 2 | import fileio, syntax.highlighter, kuroko 3 | 4 | let code 5 | with fileio.open(kuroko.argv[-1]) as f: 6 | code = f.read() 7 | 8 | let highlighter = syntax.highlighter.KurokoHighlighter(code) 9 | 10 | highlighter.highlight() 11 | syntax.highlighter.toTerminal(highlighter.process()) 12 | -------------------------------------------------------------------------------- /apps/hostname.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief hostname - Prints or sets the system hostname. 3 | * 4 | * @copyright 5 | * This file is part of ToaruOS and is released under the terms 6 | * of the NCSA / University of Illinois License - see LICENSE.md 7 | * Copyright (C) 2013-2018 K. Lange 8 | */ 9 | #include 10 | #include 11 | #include 12 | 13 | int main(int argc, char * argv[]) { 14 | if ((argc > 1 && argv[1][0] == '-') || (argc < 2)) { 15 | char tmp[256] = {0}; 16 | gethostname(tmp, 255); 17 | printf("%s\n", tmp); 18 | return 0; 19 | } else { 20 | if (geteuid() != 0) { 21 | fprintf(stderr,"Must be root to set hostname.\n"); 22 | return 1; 23 | } else { 24 | sethostname(argv[1], strlen(argv[1])); 25 | FILE * file = fopen("/etc/hostname", "w"); 26 | if (!file) { 27 | return 1; 28 | } else { 29 | fprintf(file, "%s\n", argv[1]); 30 | fclose(file); 31 | return 0; 32 | } 33 | } 34 | } 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /apps/insmod.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief insmod - Load kernel module 3 | * 4 | * @copyright 5 | * This file is part of ToaruOS and is released under the terms 6 | * of the NCSA / University of Illinois License - see LICENSE.md 7 | * Copyright (C) 2016 K. Lange 8 | */ 9 | #include 10 | #include 11 | #include 12 | 13 | int main(int argc, char * argv[]) { 14 | if (argc < 2) { 15 | fprintf(stderr, "Usage: %s [ARGS...]\n", argv[0]); 16 | return 1; 17 | } 18 | int status = sysfunc(TOARU_SYS_FUNC_INSMOD, &argv[1]); 19 | if (status != 0) { 20 | fprintf(stderr, "%s: %s: %s\n", argv[0], argv[1], strerror(errno)); 21 | return status; 22 | } 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /apps/logname.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief Display the user's name, as returned by getlogin() 3 | * 4 | * @copyright 5 | * This file is part of ToaruOS and is released under the terms 6 | * of the NCSA / University of Illinois License - see LICENSE.md 7 | * Copyright (C) 2018 K. Lange 8 | */ 9 | #include 10 | #include 11 | 12 | int main(int argc, char ** argv) { 13 | char * name = getlogin(); 14 | if (!name) { 15 | fprintf(stderr, "%s: failed to determine login name\n", argv[0]); 16 | return 1; 17 | } 18 | 19 | fprintf(stdout, "%s\n", name); 20 | return 0; 21 | } 22 | 23 | -------------------------------------------------------------------------------- /apps/maybe-pdfviewer.krk: -------------------------------------------------------------------------------- 1 | #!/bin/kuroko 2 | import os 3 | import kuroko 4 | 5 | try: 6 | os.stat('/usr/bin/pdfviewer') 7 | os.execl('/usr/bin/pdfviewer','pdfviewer',kuroko.argv[1]) 8 | except os.OSError: 9 | if os.system('showdialog "PDF Viewer" "/usr/share/icons/48/pdf.png" "Do you want to install the PDF viewer from the Package Manager?"') == 0: 10 | os.system('terminal gsudo sh -c "msk update; msk install mupdf"') 11 | os.execl('/usr/bin/pdfviewer','pdfviewer',kuroko.argv[1]) 12 | -------------------------------------------------------------------------------- /apps/mount.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief Mount filesystems into the VFS 3 | * 4 | * @copyright 5 | * This file is part of ToaruOS and is released under the terms 6 | * of the NCSA / University of Illinois License - see LICENSE.md 7 | * Copyright (C) 2014-2018 K. Lange 8 | */ 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | int main(int argc, char ** argv) { 15 | if (argc < 4) { 16 | fprintf(stderr, "Usage: %s type device mountpoint\n", argv[0]); 17 | return 1; 18 | } 19 | 20 | int ret = mount(argv[2], argv[3], argv[1], 0, NULL); 21 | 22 | if (ret < 0) { 23 | fprintf(stderr, "%s: %s\n", argv[0], strerror(errno)); 24 | return ret; 25 | } 26 | 27 | return 0; 28 | } 29 | -------------------------------------------------------------------------------- /apps/nproc.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief Print the number of available processors. 3 | * 4 | * @copyright 5 | * This file is part of ToaruOS and is released under the terms 6 | * of the NCSA / University of Illinois License - see LICENSE.md 7 | * Copyright (C) 2021 K. Lange 8 | */ 9 | #include 10 | #include 11 | 12 | int main(int argc, char * argv[]) { 13 | printf("%d\n", sysfunc(TOARU_SYS_FUNC_NPROC, NULL)); 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /apps/nslookup.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief Perform DNS lookups. 3 | * 4 | * @copyright 5 | * This file is part of ToaruOS and is released under the terms 6 | * of the NCSA / University of Illinois License - see LICENSE.md 7 | * Copyright (C) 2016-2018 K. Lange 8 | */ 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | int main(int argc, char * argv[]) { 19 | if (argc < 2) return 1; 20 | 21 | struct hostent * host = gethostbyname(argv[1]); 22 | 23 | if (!host) { 24 | fprintf(stderr, "%s: not found\n", argv[1]); 25 | return 1; 26 | } 27 | 28 | char * addr = inet_ntoa(*(struct in_addr*)host->h_addr_list[0]); 29 | 30 | fprintf(stderr, "%s: %s\n", host->h_name, addr); 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /apps/pwd.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief Print the current working directory 3 | * 4 | * @copyright 5 | * This file is part of ToaruOS and is released under the terms 6 | * of the NCSA / University of Illinois License - see LICENSE.md 7 | * Copyright (C) 2018 K. Lange 8 | */ 9 | #include 10 | #include 11 | 12 | int main(int argc, char * argv[]) { 13 | char tmp[1024]; 14 | if (getcwd(tmp, 1023)) { 15 | puts(tmp); 16 | return 0; 17 | } else { 18 | return 1; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /apps/readlink.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief Examine symlinks and print the path they point to. 3 | * 4 | * @copyright 5 | * This file is part of ToaruOS and is released under the terms 6 | * of the NCSA / University of Illinois License - see LICENSE.md 7 | * Copyright (C) 2015 Mike Gerow 8 | */ 9 | #include 10 | #include 11 | #include 12 | 13 | #define MAX_LINK_SIZE 4096 14 | 15 | static char usage[] = 16 | "Usage: %s LINK\n"; 17 | 18 | int main(int argc, char * argv[]) { 19 | if (argc != 2) { 20 | fprintf(stderr, usage, argv[0]); 21 | exit(EXIT_FAILURE); 22 | } 23 | char * name = argv[1]; 24 | 25 | char buf[MAX_LINK_SIZE]; 26 | if (readlink(name, buf, sizeof(buf)) < 0) { 27 | //perror("link"); 28 | exit(EXIT_FAILURE); 29 | } 30 | fprintf(stdout, "%s\n", buf); 31 | exit(EXIT_SUCCESS); 32 | } 33 | -------------------------------------------------------------------------------- /apps/reboot.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief (Try to) reboot the system. 3 | * 4 | * Note that only root can syscall_reboot, and this doesn't 5 | * do any fancy setuid stuff. 6 | * 7 | * @copyright 8 | * This file is part of ToaruOS and is released under the terms 9 | * of the NCSA / University of Illinois License - see LICENSE.md 10 | * Copyright (C) 2013-2014 K. Lange 11 | */ 12 | #include 13 | #include 14 | 15 | int main(int argc, char ** argv) { 16 | if (syscall_reboot() < 0) { 17 | printf("%s: permission denied\n", argv[0]); 18 | } 19 | return 1; 20 | } 21 | -------------------------------------------------------------------------------- /apps/reload_desktop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/esh 2 | 3 | export-cmd DESKTOP cat /var/run/.wallpaper.pid 4 | 5 | if not empty? "$DESKTOP" then kill -SIGUSR2 $DESKTOP 6 | -------------------------------------------------------------------------------- /apps/reset.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief reset - make the terminal sane, and clear it 3 | * 4 | * Also clears scrollback! 5 | * 6 | * @copyright 7 | * This file is part of ToaruOS and is released under the terms 8 | * of the NCSA / University of Illinois License - see LICENSE.md 9 | * Copyright (C) 2018-2021 K. Lange 10 | */ 11 | #include 12 | #include 13 | 14 | int main(int argc, char * argv[]) { 15 | system("stty sane"); 16 | system("clear"); 17 | /* Clear scrollback as well */ 18 | printf("\033[3J"); 19 | fflush(stdout); 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /apps/set-wallpaper.sh: -------------------------------------------------------------------------------- 1 | #!/bin/esh 2 | 3 | if empty? "$1" then exec sh -c "echo 'usage: $0 WALLPAPER'" 4 | if not stat -Lq "$1" then exec sh -c "echo '$0: $1 does not exist'" 5 | 6 | export-cmd DESKTOP cat /var/run/.wallpaper.pid 7 | if empty? "$DESKTOP" then sh -c "echo '$0: No wallpaper running?'" 8 | 9 | echo "wallpaper=$1" > $HOME/.wallpaper.conf 10 | 11 | kill -SIGUSR1 $DESKTOP 12 | -------------------------------------------------------------------------------- /apps/show-tutorial.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | touch ~/.tutorial-shown 4 | sh -c "sleep 1; tutorial" & 5 | 6 | -------------------------------------------------------------------------------- /apps/sleep.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief sleep - Do nothing, efficiently. 3 | * 4 | * @copyright 5 | * This file is part of ToaruOS and is released under the terms 6 | * of the NCSA / University of Illinois License - see LICENSE.md 7 | * Copyright (C) 2013 K. Lange 8 | */ 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | int main(int argc, char ** argv) { 15 | int ret = 0; 16 | 17 | if (argc < 2) { 18 | fprintf(stderr, "%s: missing operand\n", argv[0]); 19 | return 1; 20 | } 21 | 22 | char * arg = strdup(argv[1]); 23 | 24 | float time = atof(arg); 25 | 26 | unsigned int seconds = (unsigned int)time; 27 | unsigned int subsecs = (unsigned int)((time - (float)seconds) * 100); 28 | 29 | ret = syscall_sleep(seconds, subsecs); 30 | 31 | return ret; 32 | } 33 | 34 | -------------------------------------------------------------------------------- /apps/sysfunc.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief Exceute "extended system function" syscalls. 3 | * 4 | * Most of these are deprecated, and the ones that are useful 5 | * to call manually are all behind other utilities. 6 | * 7 | * @copyright 8 | * This file is part of ToaruOS and is released under the terms 9 | * of the NCSA / University of Illinois License - see LICENSE.md 10 | * Copyright (C) 2013 K. Lange 11 | */ 12 | #include 13 | #include 14 | #include 15 | 16 | #include 17 | 18 | int main(int argc, char ** argv) { 19 | if (argc < 2) return 1; 20 | int ret = sysfunc(atoi(argv[1]), &argv[2]); 21 | if (ret < 0) { 22 | fprintf(stderr, "%s: %s\n", argv[0], strerror(errno)); 23 | } 24 | return ret; 25 | } 26 | -------------------------------------------------------------------------------- /apps/t_mbstowcs.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief Test tool for libc UTF8 decoding 3 | * 4 | * @copyright 5 | * This file is part of ToaruOS and is released under the terms 6 | * of the NCSA / University of Illinois License - see LICENSE.md 7 | * Copyright (C) 2018 K. Lange 8 | */ 9 | #include 10 | #include 11 | #include 12 | 13 | int main(int argc, char * argv[]) { 14 | size_t req = mbstowcs(NULL, argv[1], 0); 15 | wchar_t * dest = malloc(sizeof(wchar_t) * req); 16 | mbstowcs(dest, argv[1], req+1); 17 | 18 | for (size_t i = 0; i < req; ++i) { 19 | char tmp[8]; 20 | wchar_t in[] = {dest[i], L'\0'}; 21 | wcstombs(tmp, in, 8); 22 | fprintf(stdout, "U+%4x %s\n", dest[i], tmp); 23 | } 24 | 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /apps/test-badwrite.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief Test tool for examining a bug that was crashing the audio subsystem. 3 | * 4 | * @copyright 5 | * This file is part of ToaruOS and is released under the terms 6 | * of the NCSA / University of Illinois License - see LICENSE.md 7 | * Copyright (C) 2021 K. Lange 8 | */ 9 | #include 10 | #include 11 | #include 12 | 13 | int main(int argc, char * argv[]) { 14 | int fd = open("/dev/dsp",O_WRONLY); 15 | if (fd < 0) { 16 | fprintf(stderr, "failed to open dsp\n"); 17 | return 1; 18 | } 19 | return write(fd, &fd, -1); 20 | } 21 | -------------------------------------------------------------------------------- /apps/test-conf.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief Test tool for the INI confreader library. 3 | * 4 | * @copyright 5 | * This file is part of ToaruOS and is released under the terms 6 | * of the NCSA / University of Illinois License - see LICENSE.md 7 | * Copyright (C) 2018 K. Lange 8 | */ 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | int main(int argc, char * argv[]) { 15 | confreader_t * conf = confreader_load("/etc/demo.conf"); 16 | 17 | fprintf(stderr, "test 1\n"); 18 | assert(confreader_get(conf, "", "test") != NULL); 19 | assert(!strcmp(confreader_get(conf, "", "test"),"hello")); 20 | 21 | fprintf(stderr, "test 2\n"); 22 | assert(!strcmp(confreader_get(conf,"sec","tion"),"test")); 23 | 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /apps/test-fpclassify.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int main(int argc, char * argv[]) { 7 | if (argc < 2) return 1; 8 | 9 | union { 10 | double asFloat; 11 | uint64_t asInt; 12 | } bits; 13 | 14 | if (!strcmp(argv[1], "inf")) { 15 | bits.asFloat = INFINITY; 16 | } else if (!strcmp(argv[1], "nan")) { 17 | bits.asFloat = NAN; 18 | } else { 19 | bits.asFloat = strtod(argv[1], NULL); 20 | } 21 | 22 | printf("0x%016zx %d\n", bits.asInt, fpclassify(bits.asFloat)); 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /apps/test-localtime.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief Test tool for the libc localtime() function. 3 | * 4 | * @copyright 5 | * This file is part of ToaruOS and is released under the terms 6 | * of the NCSA / University of Illinois License - see LICENSE.md 7 | * Copyright (C) 2018-2021 K. Lange 8 | */ 9 | #include 10 | #include 11 | 12 | int main(int argc, char * argv[]) { 13 | time_t i = 1576000000; 14 | while (i < 2000000000) { 15 | struct tm * t = localtime(&i); 16 | 17 | if (t->tm_sec < 0 || t->tm_sec >= 60) fprintf(stderr, "Erroneous value at %ld: sec = %d\n", i, t->tm_sec); 18 | if (t->tm_min < 0 || t->tm_min >= 60) fprintf(stderr, "Erroneous value at %ld: min = %d\n", i, t->tm_min); 19 | if (t->tm_hour < 0 || t->tm_hour >= 24) fprintf(stderr, "Erroneous value at %ld (%s) hour = %d\n", i, asctime(t), t->tm_hour); 20 | 21 | i++; 22 | } 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /apps/test-loop.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief Spins in a loop. Useful for testing preemption, cpu usage. 3 | * 4 | * @copyright 5 | * This file is part of ToaruOS and is released under the terms 6 | * of the NCSA / University of Illinois License - see LICENSE.md 7 | * Copyright (C) 2018 K. Lange 8 | */ 9 | int main(int argc, char * argv[]) { 10 | while (1); 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /apps/test-printf.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief Test tool for libc printf formatters. 3 | * 4 | * @copyright 5 | * This file is part of ToaruOS and is released under the terms 6 | * of the NCSA / University of Illinois License - see LICENSE.md 7 | * Copyright (C) 2020-2021 K. Lange 8 | */ 9 | #include 10 | 11 | int main(int argc, char * argv[]) { 12 | printf("%.3d\n", 42); 13 | printf("%.10d\n", 12345); 14 | printf("%.1d\n", 0); 15 | printf("%.0d\n", 0); 16 | printf("%.0d\n", 1); 17 | printf("%.0d\n", 123); 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /apps/test-sigsegv.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief Test tool for producing segmentation faults. 3 | * 4 | * Useful for testing the debugger. 5 | * 6 | * @copyright 7 | * This file is part of ToaruOS and is released under the terms 8 | * of the NCSA / University of Illinois License - see LICENSE.md 9 | * Copyright (C) 2021 K. Lange 10 | */ 11 | #include 12 | #include 13 | 14 | int main(int argc, char * argv[]) { 15 | if (argc > 1) { 16 | fprintf(stderr, "%s\n", (char*)(uintptr_t)strtoul(argv[1],NULL,0)); 17 | } else { 18 | *(volatile int*)0x12345 = 42; 19 | } 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /apps/test-sigsuspend.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | void handler(int sig) { 8 | fprintf(stderr, "received %d\n", sig); 9 | } 10 | 11 | int main(int argc, char * argv[]) { 12 | signal(SIGINT, handler); 13 | signal(SIGWINCH, handler); 14 | 15 | sigset_t all, prev; 16 | sigfillset(&all); 17 | sigprocmask(SIG_SETMASK,&all,&prev); 18 | 19 | fprintf(stderr, "Ignoring signals and pausing for three seconds.\n"); 20 | sleep(3); 21 | fprintf(stderr, "Sleep is over, calling sigsuspend.\n"); 22 | 23 | int result = sigsuspend(&prev); 24 | fprintf(stderr, "result = %d, errno = %s\n", result, strerror(errno)); 25 | 26 | sigprocmask(SIG_SETMASK,&prev,NULL); 27 | fprintf(stderr, "Restoring mask\n"); 28 | 29 | return 0; 30 | } 31 | 32 | -------------------------------------------------------------------------------- /apps/test-sigwait.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | void handler(int sig) { 7 | fprintf(stderr, "received %d\n", sig); 8 | } 9 | 10 | int main(int argc, char * argv[]) { 11 | signal(SIGINT, handler); 12 | signal(SIGWINCH, handler); 13 | 14 | sigset_t mask; 15 | sigemptyset(&mask); 16 | sigaddset(&mask, SIGINT); 17 | sigprocmask(SIG_BLOCK, &mask, NULL); 18 | 19 | while (1) { 20 | int sig = 0; 21 | int result = sigwait(&mask, &sig); 22 | fprintf(stderr, "result = %d, sig = %d, errno = %s\n", result, sig, strerror(errno)); 23 | } 24 | 25 | return 0; 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /apps/test-syscall-sysret.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(int argc, char * argv[]){ 6 | long ret = 0; 7 | #ifdef __x86_64__ 8 | __asm__ __volatile__("syscall" : "=a"(ret) : "a"(SYS_WRITE), "D"(STDOUT_FILENO), "S"("Hello, world.\n"), "d"((long)14) : "rcx", "r11", "memory"); 9 | __asm__ __volatile__("syscall" : "=a"(ret) : "a"(SYS_WRITE), "D"(STDOUT_FILENO), "S"("Hello, world.\n"), "d"((long)14) : "rcx", "r11", "memory"); 10 | __asm__ __volatile__("syscall" : "=a"(ret) : "a"(SYS_WRITE), "D"(STDOUT_FILENO), "S"("Hello, world.\n"), "d"((long)14) : "rcx", "r11", "memory"); 11 | #endif 12 | 13 | return ret; 14 | } 15 | -------------------------------------------------------------------------------- /apps/test-udp-recv.krk: -------------------------------------------------------------------------------- 1 | #!/bin/kuroko 2 | import socket 3 | 4 | let s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) 5 | 6 | print("Binding to :1234") 7 | s.bind(('0.0.0.0',1234)) 8 | 9 | print("Waiting.") 10 | 11 | while True: 12 | print(s.recv(1024)) 13 | -------------------------------------------------------------------------------- /apps/touch.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief touch - Create or update file timestamps 3 | * 4 | * @copyright 5 | * This file is part of ToaruOS and is released under the terms 6 | * of the NCSA / University of Illinois License - see LICENSE.md 7 | * Copyright (C) 2013 K. Lange 8 | */ 9 | #include 10 | #include 11 | #include 12 | 13 | int main(int argc, char * argv[]) { 14 | if (argc < 2) { 15 | fprintf(stderr, "%s: argument expected\n", argv[0]); 16 | return 1; 17 | } 18 | 19 | int out = 0; 20 | for (int i = 1; i < argc; ++i) { 21 | FILE * f = fopen(argv[i], "a"); 22 | if (!f) { 23 | fprintf(stderr, "%s: %s: %s\n", argv[0], argv[i], strerror(errno)); 24 | out = 1; 25 | continue; 26 | } 27 | fclose(f); 28 | } 29 | 30 | return out; 31 | } 32 | -------------------------------------------------------------------------------- /apps/true.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief true - Return success code 3 | * 4 | * @copyright 5 | * This file is part of ToaruOS and is released under the terms 6 | * of the NCSA / University of Illinois License - see LICENSE.md 7 | * Copyright (C) 2018 K. Lange 8 | */ 9 | int main() { 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /apps/tty.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief tty - print terminal name 3 | * 4 | * @copyright 5 | * This file is part of ToaruOS and is released under the terms 6 | * of the NCSA / University of Illinois License - see LICENSE.md 7 | * Copyright (C) 2018 K. Lange 8 | */ 9 | #include 10 | #include 11 | 12 | int main(int argc, char * argv[]) { 13 | if (!isatty(STDIN_FILENO)) { 14 | fprintf(stdout, "not a tty\n"); 15 | return 1; 16 | } 17 | fprintf(stdout,"%s\n",ttyname(STDIN_FILENO)); 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /apps/upload.krk: -------------------------------------------------------------------------------- 1 | #!/bin/kuroko 2 | 3 | import socket 4 | import fileio 5 | 6 | import kuroko 7 | 8 | let b 9 | with fileio.open(kuroko.argv[1],'rb') as f: 10 | b = f.read() 11 | 12 | let endpoint = kuroko.argv[2] 13 | 14 | if ':' in endpoint: 15 | let x = endpoint.split(':') 16 | endpoint = (x[0], int(x[1])) 17 | 18 | print("Uploading",len(b),"byte(s) to",endpoint) 19 | 20 | let s = socket.socket() 21 | 22 | s.connect(endpoint) 23 | 24 | print("Connected...") 25 | 26 | s.send(b) 27 | 28 | print("Done.") 29 | 30 | -------------------------------------------------------------------------------- /apps/whoami.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief uses getpwuid and geteuid to retrieve the current user's name. 3 | * 4 | * @copyright 5 | * This file is part of ToaruOS and is released under the terms 6 | * of the NCSA / University of Illinois License - see LICENSE.md 7 | * Copyright (C) 2013-2021 K. Lange 8 | */ 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | int main(int argc, char ** argv) { 16 | struct passwd * p = getpwuid(geteuid()); 17 | if (!p) return 0; 18 | 19 | fprintf(stdout, "%s\n", p->pw_name); 20 | 21 | endpwent(); 22 | 23 | return 0; 24 | } 25 | 26 | -------------------------------------------------------------------------------- /apps/yes.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief yes - Continually print stuff 3 | * 4 | * Continually prints its first argument, followed by a newline. 5 | * 6 | * @copyright 7 | * This file is part of ToaruOS and is released under the terms 8 | * of the NCSA / University of Illinois License - see LICENSE.md 9 | * Copyright (C) 2013 K Lange 10 | */ 11 | #include 12 | 13 | int main(int argc, char * argv[]) { 14 | char * yes_string = "y"; 15 | if (argc > 1) { 16 | yes_string = argv[1]; 17 | } 18 | while (1) { 19 | printf("%s\n", yes_string); 20 | } 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /base/etc/demo.conf: -------------------------------------------------------------------------------- 1 | ; this is a comment 2 | test=hello 3 | 4 | [sec] 5 | tion=test 6 | 7 | ; this is also a comment 8 | -------------------------------------------------------------------------------- /base/etc/group: -------------------------------------------------------------------------------- 1 | root:x:0: 2 | adm:x:1:local 3 | dialout:x:2:local 4 | -------------------------------------------------------------------------------- /base/etc/hostname: -------------------------------------------------------------------------------- 1 | livecd 2 | -------------------------------------------------------------------------------- /base/etc/issue: -------------------------------------------------------------------------------- 1 | ToaruOS 2.2 \n \l 2 | 3 | -------------------------------------------------------------------------------- /base/etc/master.passwd: -------------------------------------------------------------------------------- 1 | root:toor:0:0:Administrator:/home/root:/bin/esh:fancy 2 | local:local:1000:1000:Local User:/home/local:/bin/esh:fancy 3 | guest:guest:1001:1001:Guest User:/home/guest:/bin/esh:fancy 4 | -------------------------------------------------------------------------------- /base/etc/motd: -------------------------------------------------------------------------------- 1 | 2 | Welcome to ToaruOS! 3 | 4 | ToaruOS is free software, released under the terms 5 | of the NCSA / University of Illinois License. 6 | 7 | https://toaruos.org https://github.com/klange/toaruos 8 | 9 | -------------------------------------------------------------------------------- /base/etc/msk.conf: -------------------------------------------------------------------------------- 1 | remote_order=cdrom,cdn,fallback 2 | 3 | [remotes] 4 | cdrom=/cdrom/extra 5 | local=http://192.168.11.2:8080 6 | fallback=http://toaruos.org/msk/2.0.x 7 | cdn=http://toaruos.sfo3.cdn.digitaloceanspaces.com/msk/2.0.x 8 | -------------------------------------------------------------------------------- /base/etc/os-release: -------------------------------------------------------------------------------- 1 | PRETTY_NAME="ToaruOS 2.2" 2 | NAME="ToaruOS" 3 | VERSION_ID="2.2.0" 4 | VERSION="2.2.0" 5 | ID=toaru 6 | HOME_URL="https://toaruos.org/" 7 | SUPPORT_URL="https://github.com/klange/toaruos" 8 | BUG_REPORT_URL="https://github.com/klange/toaruos" 9 | -------------------------------------------------------------------------------- /base/etc/panel.menu: -------------------------------------------------------------------------------- 1 | :_ 2 | &accessories,folder,Accessories 3 | &demos,folder,Demos 4 | &settings,folder,Settings 5 | - 6 | exec help-browser,help,Help Browser 7 | exec about,star,About ToaruOS 8 | log-out,exit,Log Out 9 | :accessories 10 | exec calculator,calculator,Calculator 11 | exec file-browser,folder,File Browser 12 | exec terminal,utilities-terminal,Terminal 13 | :demos 14 | &decorated,folder,Decorated 15 | &undecorated,folder,Undecorated 16 | :undecorated 17 | exec drawlines,drawlines,Draw Lines 18 | :decorated 19 | exec julia,julia,Julia Fractals 20 | exec mandelbrot,mandelbrot,Mandelbrot Explorer 21 | exec plasma,plasma,Plasma 22 | :settings 23 | exec gsudo package-manager,package,Package Manager 24 | exec wallpaper-picker,wallpaper-picker,Select Wallpaper 25 | exec cpuwidget,system-monitor,System Monitor 26 | -------------------------------------------------------------------------------- /base/etc/passwd: -------------------------------------------------------------------------------- 1 | root:x:0:0:Administrator:/home/root:/bin/esh:fancy 2 | adm:x:1:1:Administrators:/tmp:/bin/false:nope 3 | dialout:x:2:2:Serial Users:/tmp:/bin/false:nope 4 | local:x:1000:1000:Local User:/home/local:/bin/esh:fancy 5 | guest:x:1001:1001:Guest User:/home/guest:/bin/esh:fancy 6 | -------------------------------------------------------------------------------- /base/etc/startup.d/00_startuplog.sh: -------------------------------------------------------------------------------- 1 | #!/bin/esh 2 | 3 | # This daemonizes 4 | exec splash-log 5 | -------------------------------------------------------------------------------- /base/etc/startup.d/01_migrate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/esh 2 | 3 | if not kcmdline -q migrate then exit 0 4 | 5 | echo -n "Migrating filesystem..." >> /dev/pex/splash 6 | /bin/migrate 7 | -------------------------------------------------------------------------------- /base/etc/startup.d/02_hostname.sh: -------------------------------------------------------------------------------- 1 | #!/bin/esh 2 | 3 | export-cmd HOSTNAME cat /etc/hostname 4 | 5 | echo -n "Setting hostname..." > /dev/pex/splash 6 | 7 | if empty? "$HOSTNAME" then exec hostname "localhost" else exec hostname "$HOSTNAME" 8 | -------------------------------------------------------------------------------- /base/etc/startup.d/03_tmpfs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/esh 2 | 3 | echo -n "Mounting tmpfs..." > /dev/pex/splash 4 | mount tmpfs tmp,777 /tmp 5 | mount tmpfs var,755 /var 6 | mkdir /var/run 7 | -------------------------------------------------------------------------------- /base/etc/startup.d/04_modprobe.sh: -------------------------------------------------------------------------------- 1 | #!/bin/esh 2 | 3 | echo -n "Installing device driver modules..." > /dev/pex/splash 4 | 5 | # Only load this in virtualbox for now, as we're not 6 | # even sure we're doing the remapping correctly... 7 | if lspci -q 80EE:CAFE,8086:7000 then insmod /mod/piix4.ko 8 | 9 | # Add module descriptions here... 10 | if lspci -q 8086:2415 then insmod /mod/ac97.ko 11 | if lspci -q 1234:1111,15ad:07a0 then insmod /mod/vmware.ko 12 | if lspci -q 80EE:CAFE then insmod /mod/vbox.ko 13 | if lspci -q 8086:0046 then insmod /mod/i965.ko 14 | if lspci -q 1274:1371 then insmod /mod/es1371.ko 15 | 16 | if lspci -q 8086:100e,8086:1004,8086:100f,8086:10ea,8086:10d3 then insmod /mod/e1000.ko 17 | 18 | # Device drivers 19 | if lspci -q 8086:7111,8086:7010 then insmod /mod/ata.ko 20 | -------------------------------------------------------------------------------- /base/etc/startup.d/05_mountcd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/esh 2 | 3 | if not stat -Lq /dev/cdrom0 then exit 0 4 | 5 | echo -n "Mounting CD..." > /dev/pex/splash 6 | 7 | insmod /mod/iso9660.ko 8 | mount iso /dev/cdrom0 /cdrom 9 | 10 | # Does it look like it might be ours? 11 | if not stat -Lq /cdrom/bootcat then exit 0 12 | 13 | echo -e "icon=cd\nrun=cd /cdrom ; exec file-browser\ntitle=CD-ROM" > /home/local/Desktop/5_cdrom.launcher 14 | 15 | -------------------------------------------------------------------------------- /base/etc/startup.d/40_dhcp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/esh 2 | 3 | if kcmdline -q no-startup-dhcp then exit 0 4 | 5 | echo -n "Setting up network..." >> /dev/pex/splash 6 | /bin/dhclient 7 | -------------------------------------------------------------------------------- /base/etc/startup.d/50_msk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/esh 2 | 3 | if kcmdline -q no-startup-msk then exit 0 4 | 5 | echo -n "Checking for package updates..." >> /dev/pex/splash 6 | msk update & 7 | -------------------------------------------------------------------------------- /base/etc/startup.d/99_runstart.sh: -------------------------------------------------------------------------------- 1 | #!/bin/esh 2 | 3 | export-cmd START kcmdline -g start 4 | 5 | # We haven't actually hit a login yet, so make sure these are set here... 6 | export USER=root 7 | export HOME=/home/root 8 | 9 | export-cmd TZ_OFFSET find-timezone 10 | export-cmd GETTY_ARGS qemu-fwcfg opt/org.toaruos.gettyargs 11 | 12 | echo -n "Launching startup application..." > /dev/pex/splash 13 | echo -n "!quit" > /dev/pex/splash 14 | 15 | if equals? "$START" "--vga" then exec /bin/terminal-vga -l 16 | if equals? "$START" "--headless" then exec /bin/getty ${GETTY_ARGS} 17 | if empty? "$START" then exec /bin/compositor else exec /bin/compositor $START 18 | 19 | -------------------------------------------------------------------------------- /base/etc/sudoers: -------------------------------------------------------------------------------- 1 | local 2 | -------------------------------------------------------------------------------- /base/etc/weather.json: -------------------------------------------------------------------------------- 1 | { 2 | "city": "guess", 3 | "units": "metric", 4 | 5 | "--comment": "The key below is provided for use in ToaruOS for free from OpenWeatherMap.org. We must provide the key so that the weather widget can make API queries. Use of this key for other purposes is against OpenWeatherMap's terms of service.", 6 | "key": "78c832cfada2b0337f516891afb4f13b" 7 | } 8 | -------------------------------------------------------------------------------- /base/home/guest/hello: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/home/guest/hello -------------------------------------------------------------------------------- /base/home/local/.bim3rc: -------------------------------------------------------------------------------- 1 | ''' 2 | Sample config file for bim3 3 | ''' 4 | 5 | # Quirks work the same as they did in bim2, except for the obvious syntax change 6 | quirk('TERM','screen','no24bit','noitalic') 7 | quirk('TERM','xterm-256color','caninsert','canpaste','cansgrmouse') 8 | quirk('TERM','toaru-vga','no24bit','no256color') 9 | quirk('TERMINAL_EMULATOR','JetBrains','nobce') 10 | 11 | # checkprop() returns 0 if we _can_ do something, so 12 | # call it with 'not' to check capabilities... 13 | if not checkprop('can_unicode'): 14 | tabindicator('»') 15 | spaceindicator('·') 16 | 17 | # Themes are actually Kuroko functions now, but we load 18 | # them into a table like always for the :theme command 19 | theme('sunsmoke') 20 | 21 | # Non-string values are coerced into strings, so these commands 22 | # can take integer values. 23 | global.git(1) 24 | global.statusbar(1) 25 | global.autohidetabs(1) 26 | smartcomplete(1) 27 | -------------------------------------------------------------------------------- /base/home/local/.eshrc: -------------------------------------------------------------------------------- 1 | export PS1_TITLE="\[\e]1;\u@\h:\w\\007\e]2;\u@\h:\w\\007\]" 2 | export PS1_RIGHT="\[\\e[1m\e[38;5;59m\][\[\e[38;5;173m\]\d \[\e[38;5;167m\]\t\[\e[38;5;59m\]] \[\e[0m\]" 3 | export PS1_LEFT="${PS1_TITLE}\[\e[1m\e[38;5;221m\]\u\[\e[38;5;59m\]@\[\e[38;5;81m\]\h \[\e[38;5;167m\]\r\[\e[0m\]\w\U\\\$\[\e[0m\] " 4 | 5 | if equals? "$TERM" "toaru-vga" then export RLINE_THEME="default" else export RLINE_THEME="sunsmoke" 6 | 7 | if stat -Lq /usr/local/bin then export PATH="/usr/local/bin:$PATH" 8 | -------------------------------------------------------------------------------- /base/home/local/.wallpaper.conf: -------------------------------------------------------------------------------- 1 | ; this doesn't get loaded with the regular confreader 2 | wallpaper=/usr/share/wallpaper.jpg 3 | -------------------------------------------------------------------------------- /base/home/local/.yutanirc: -------------------------------------------------------------------------------- 1 | #!/bin/esh 2 | 3 | # Start wallpaper 4 | cd ~/Desktop 5 | file-browser --wallpaper & 6 | cd ~ 7 | 8 | # Start toast daemon 9 | toastd --really # Daemonizes 10 | 11 | # If we haven't shown the tutorial yet, show it. 12 | if not stat -q ~/.tutorial-shown then show-tutorial.sh 13 | 14 | # Login toast notifications 15 | show-toasts.krk & 16 | 17 | # Replace us with the panel 18 | exec panel --really 19 | -------------------------------------------------------------------------------- /base/home/local/Desktop/0_file_browser.launcher: -------------------------------------------------------------------------------- 1 | icon=folder 2 | run=cd ~ ; exec file-browser 3 | title=File Browser 4 | -------------------------------------------------------------------------------- /base/home/local/Desktop/1_terminal.launcher: -------------------------------------------------------------------------------- 1 | run=cd ~ ; exec terminal 2 | title=Terminal 3 | icon=utilities-terminal 4 | -------------------------------------------------------------------------------- /base/home/local/Desktop/2_packages.launcher: -------------------------------------------------------------------------------- 1 | run=exec gsudo package-manager 2 | title=Packages 3 | icon=package 4 | -------------------------------------------------------------------------------- /base/home/local/Desktop/3_read_me.launcher: -------------------------------------------------------------------------------- 1 | icon=file 2 | run=exec terminal bim ~/README.md 3 | title=Read Me 4 | -------------------------------------------------------------------------------- /base/home/root/.bimrc: -------------------------------------------------------------------------------- 1 | rundir /usr/share/bim/themes 2 | colorscheme ansi 3 | -------------------------------------------------------------------------------- /base/home/root/hello: -------------------------------------------------------------------------------- 1 | Hello, root. 2 | -------------------------------------------------------------------------------- /base/lib/.dummy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/lib/.dummy -------------------------------------------------------------------------------- /base/usr/include/_cheader.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef __cplusplus 4 | # define _Begin_C_Header extern "C" { 5 | # define _End_C_Header } 6 | #else 7 | # define _Begin_C_Header 8 | # define _End_C_Header 9 | #endif 10 | -------------------------------------------------------------------------------- /base/usr/include/alloca.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | 5 | _Begin_C_Header 6 | 7 | #ifdef __GNUC__ 8 | #define alloca(size) __builtin_alloca(size) 9 | #else 10 | #error alloca requested but this isn't gcc 11 | #endif 12 | 13 | _End_C_Header 14 | -------------------------------------------------------------------------------- /base/usr/include/arpa/inet.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | #include 5 | #include 6 | #include 7 | 8 | _Begin_C_Header 9 | 10 | #define INADDR_ANY (unsigned long int)0x0 11 | #define INADDR_BROADCAST (unsigned long int)0xFFffFFffUL 12 | 13 | #ifndef _KERNEL_ 14 | 15 | extern uint32_t htonl(uint32_t hostlong); 16 | extern uint16_t htons(uint16_t hostshort); 17 | extern uint32_t ntohl(uint32_t netlong); 18 | extern uint16_t ntohs(uint16_t netshort); 19 | 20 | #endif 21 | 22 | _End_C_Header 23 | -------------------------------------------------------------------------------- /base/usr/include/assert.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | 5 | _Begin_C_Header 6 | 7 | #ifndef NDEBUG 8 | extern void __assert_func(const char * file, int line, const char * func, const char * failedexpr); 9 | #define assert(statement) ((statement) ? (void)0 : __assert_func(__FILE__, __LINE__, __FUNCTION__, #statement)) 10 | #else 11 | #define assert(statement) ((void)0) 12 | #endif 13 | 14 | _End_C_Header 15 | -------------------------------------------------------------------------------- /base/usr/include/bits/dirent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | #include 5 | 6 | _Begin_C_Header 7 | 8 | typedef struct dirent { 9 | uint32_t d_ino; 10 | char d_name[256]; 11 | } dirent; 12 | 13 | typedef struct DIR { 14 | int fd; 15 | int cur_entry; 16 | } DIR; 17 | 18 | DIR * opendir (const char * dirname); 19 | int closedir (DIR * dir); 20 | struct dirent * readdir (DIR * dirp); 21 | 22 | _End_C_Header 23 | -------------------------------------------------------------------------------- /base/usr/include/ctype.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | 5 | _Begin_C_Header 6 | 7 | extern int isalnum(int c); 8 | extern int isalpha(int c); 9 | extern int isdigit(int c); 10 | extern int islower(int c); 11 | extern int isprint(int c); 12 | extern int isgraph(int c); 13 | extern int iscntrl(int c); 14 | extern int isgraph(int c); 15 | extern int ispunct(int c); 16 | extern int isspace(int c); 17 | extern int isupper(int c); 18 | extern int isxdigit(int c); 19 | 20 | extern int isascii(int c); 21 | 22 | extern int tolower(int c); 23 | extern int toupper(int c); 24 | 25 | /* Derived from newlib */ 26 | #define _U 01 27 | #define _L 02 28 | #define _N 04 29 | #define _S 010 30 | #define _P 020 31 | #define _C 040 32 | #define _X 0100 33 | #define _B 0200 34 | 35 | extern unsigned char _ctype_[256]; 36 | 37 | _End_C_Header 38 | -------------------------------------------------------------------------------- /base/usr/include/dirent.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | -------------------------------------------------------------------------------- /base/usr/include/dlfcn.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | 5 | _Begin_C_Header 6 | 7 | /* Currently unused... */ 8 | #define RTLD_LAZY (1 << 0) 9 | #define RTLD_NOW (1 << 1) 10 | #define RTLD_GLOBAL (1 << 2) 11 | 12 | #define RTLD_DEFAULT ((void*)0) 13 | 14 | /* Provided by ld.so, but also defined by libc.so for linking */ 15 | extern void * dlopen(const char *, int); 16 | extern int dlclose(void *); 17 | extern void * dlsym(void *, const char *); 18 | extern char * dlerror(void); 19 | 20 | _End_C_Header 21 | -------------------------------------------------------------------------------- /base/usr/include/getopt.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | 5 | _Begin_C_Header 6 | 7 | struct option { 8 | const char *name; 9 | int has_arg; 10 | int *flag; 11 | int val; 12 | }; 13 | 14 | extern char * optarg; 15 | extern int optind, opterr, optopt; 16 | 17 | extern int getopt_long(int argc, char * const argv[], const char *optstring, const struct option *longopts, int *longindex); 18 | 19 | #define no_argument 0 20 | #define required_argument 1 21 | #define optional_argument 2 /* Unsupported */ 22 | 23 | _End_C_Header 24 | -------------------------------------------------------------------------------- /base/usr/include/iconv.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | #include 5 | 6 | _Begin_C_Header 7 | 8 | typedef void * iconv_t; 9 | 10 | extern iconv_t iconv_open(const char *tocode, const char *fromcode); 11 | extern int iconv_close(iconv_t cd); 12 | extern size_t iconv(iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); 13 | 14 | _End_C_Header; 15 | -------------------------------------------------------------------------------- /base/usr/include/inttypes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | #include 5 | #include 6 | 7 | _Begin_C_Header 8 | #define PRIi8 "i" 9 | #define PRIi16 "i" 10 | #define PRIi32 "i" 11 | #define PRIi64 "li" 12 | 13 | #define PRIx8 "x" 14 | #define PRIx16 "x" 15 | #define PRIx32 "x" 16 | #define PRIx64 "lx" 17 | 18 | #define PRIu8 "u" 19 | #define PRIu16 "u" 20 | #define PRIu32 "u" 21 | #define PRIu64 "lu" 22 | 23 | #define PRId8 "d" 24 | #define PRId16 "d" 25 | #define PRId32 "d" 26 | #define PRId64 "ld" 27 | _End_C_Header 28 | -------------------------------------------------------------------------------- /base/usr/include/kernel/arch/aarch64/gic.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | struct irq_callback { 6 | int (*callback)(process_t * this, int irq, void *data); 7 | process_t * owner; 8 | void * data; 9 | struct irq_callback * next; 10 | }; 11 | 12 | extern volatile uint32_t * gic_regs; 13 | extern volatile uint32_t * gicc_regs; 14 | 15 | extern struct irq_callback * irq_callbacks[]; 16 | 17 | void gic_assign_interrupt(int irq, int (*callback)(process_t*,int,void*), void * data); 18 | void gic_map_pci_interrupt(const char * name, uint32_t device, int * int_out, int (*callback)(process_t*,int,void*), void * isr_addr); 19 | void gic_map_regs(uintptr_t rpi_tag); 20 | void gic_send_sgi(uint8_t intid, int target); 21 | -------------------------------------------------------------------------------- /base/usr/include/kernel/arch/aarch64/pml.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | union PML { 5 | struct { 6 | uint64_t present : 1; 7 | uint64_t table_page : 1; 8 | uint64_t attrindx:3; 9 | uint64_t ns:1; 10 | uint64_t ap:2; 11 | uint64_t sh:2; 12 | uint64_t af:1; 13 | uint64_t ng:1; 14 | uint64_t page:36; 15 | uint64_t reserved:4; 16 | uint64_t contiguous:1; 17 | uint64_t pxn:1; 18 | uint64_t uxn:1; 19 | uint64_t avail:4; 20 | uint64_t ignored:5; 21 | } bits; 22 | 23 | struct { 24 | uint64_t valid : 1; 25 | uint64_t table : 1; 26 | uint64_t next:46; 27 | uint64_t reserved:4; 28 | uint64_t ignored:7; 29 | uint64_t pxntable:1; 30 | uint64_t xntable:1; 31 | uint64_t aptable:2; 32 | uint64_t nstable:1; 33 | } table_bits; 34 | 35 | uint64_t raw; 36 | }; 37 | 38 | #define mmu_page_is_user_readable(p) (p->bits.ap & 1) 39 | #define mmu_page_is_user_writable(p) ((p->bits.ap & 1) && !(p->bits.ap & 2)) 40 | -------------------------------------------------------------------------------- /base/usr/include/kernel/arch/aarch64/regs.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | struct regs { 5 | uint64_t x30, user_sp; 6 | uint64_t x28, x29; 7 | uint64_t x26, x27; 8 | uint64_t x24, x25; 9 | uint64_t x22, x23; 10 | uint64_t x20, x21; 11 | uint64_t x18, x19; 12 | uint64_t x16, x17; 13 | uint64_t x14, x15; 14 | uint64_t x12, x13; 15 | uint64_t x10, x11; 16 | uint64_t x8, x9; 17 | uint64_t x6, x7; 18 | uint64_t x4, x5; 19 | uint64_t x2, x3; 20 | uint64_t x0, x1; 21 | }; 22 | 23 | -------------------------------------------------------------------------------- /base/usr/include/kernel/arch/aarch64/rpi.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | struct rpitag { 4 | uint32_t phys_addr; 5 | uint32_t x; 6 | uint32_t y; 7 | uint32_t s; 8 | uint32_t b; 9 | uint32_t size; 10 | uint32_t ramdisk_start; 11 | uint32_t ramdisk_end; 12 | }; 13 | 14 | void rpi_load_ramdisk(struct rpitag * tag, uintptr_t * ramdisk_phys_base, size_t * ramdisk_size); 15 | void rpi_set_cmdline(char ** args_out); 16 | -------------------------------------------------------------------------------- /base/usr/include/kernel/arch/x86_64/cmos.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | uint32_t read_cmos(void); 6 | -------------------------------------------------------------------------------- /base/usr/include/kernel/arch/x86_64/pml.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | union PML { 5 | struct { 6 | uint64_t present:1; 7 | uint64_t writable:1; 8 | uint64_t user:1; 9 | uint64_t writethrough:1; 10 | uint64_t nocache:1; 11 | uint64_t accessed:1; 12 | uint64_t _available1:1; 13 | uint64_t size:1; 14 | uint64_t global:1; 15 | uint64_t cow_pending:1; 16 | uint64_t _available2:2; 17 | uint64_t page:28; 18 | uint64_t reserved:12; 19 | uint64_t _available3:11; 20 | uint64_t nx:1; 21 | } bits; 22 | uint64_t raw; 23 | }; 24 | 25 | #define mmu_page_is_user_readable(p) (p->bits.user) 26 | #define mmu_page_is_user_writable(p) (p->bits.user && p->bits.writable) 27 | -------------------------------------------------------------------------------- /base/usr/include/kernel/arch/x86_64/ports.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | extern unsigned short inports(unsigned short _port); 5 | extern void outports(unsigned short _port, unsigned short _data); 6 | extern unsigned int inportl(unsigned short _port); 7 | extern void outportl(unsigned short _port, unsigned int _data); 8 | extern unsigned char inportb(unsigned short _port); 9 | extern void outportb(unsigned short _port, unsigned char _data); 10 | extern void outportsm(unsigned short port, unsigned char * data, unsigned long size); 11 | extern void inportsm(unsigned short port, unsigned char * data, unsigned long size); 12 | 13 | -------------------------------------------------------------------------------- /base/usr/include/kernel/arch/x86_64/regs.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /** 5 | * Register layout for interrupt context. 6 | */ 7 | struct regs { 8 | /* Pushed by common stub */ 9 | uintptr_t r15, r14, r13, r12; 10 | uintptr_t r11, r10, r9, r8; 11 | uintptr_t rbp, rdi, rsi, rdx, rcx, rbx, rax; 12 | 13 | /* Pushed by wrapper */ 14 | uintptr_t int_no, err_code; 15 | 16 | /* Pushed by interrupt */ 17 | uintptr_t rip, cs, rflags, rsp, ss; 18 | }; 19 | -------------------------------------------------------------------------------- /base/usr/include/kernel/args.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | int args_present(const char * karg); 4 | char * args_value(const char * karg); 5 | void args_parse(const char * arg); 6 | 7 | -------------------------------------------------------------------------------- /base/usr/include/kernel/assert.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | extern void __assert_failed(const char * file, int line, const char * func, const char * cond); 4 | #define assert(condition) do { if (!(condition)) __assert_failed(__FILE__,__LINE__,__func__,#condition); } while (0) 5 | -------------------------------------------------------------------------------- /base/usr/include/kernel/generic.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /** 4 | * @brief Initialize early subsystems. 5 | * 6 | * Should be called after the architecture-specific startup routine has 7 | * enabled all hardware required for tasking switching and memory management. 8 | * 9 | * Initializes the scheduler, shared memory subsystem, and virtual file system; 10 | * mounts generic device drivers, sets up the virtual /dev directory, parses 11 | * the architecture-provided kernel arguments, and enables scheduling by 12 | * launching the idle task and converting the current context to 'init'. 13 | */ 14 | void generic_startup(void); 15 | 16 | /** 17 | * @brief Starts init. 18 | * 19 | * Should be called after all architecture-specific initialization is completed. 20 | * Parses the boot arguments and executes /bin/init. 21 | */ 22 | int generic_main(void); 23 | -------------------------------------------------------------------------------- /base/usr/include/kernel/gzip.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief Kernel gzip decompressor 3 | * 4 | * This is a slimmed down version of libtoaru_inflate; it's an implementation 5 | * of the tinf algorithm for decompressing gzip/DEFLATE payloads, with a 6 | * very straightforward API: Point @c gzip_inputPtr at your gzip data, 7 | * point @c gzip_outputPtr where you want the output to go, and then 8 | * run @c gzip_decompress(). 9 | */ 10 | #pragma once 11 | 12 | #include 13 | 14 | extern int gzip_decompress(void); 15 | extern uint8_t * gzip_inputPtr; 16 | extern uint8_t * gzip_outputPtr; 17 | -------------------------------------------------------------------------------- /base/usr/include/kernel/ksym.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | extern void ksym_install(void); 6 | extern void ksym_bind(const char * symname, void * value); 7 | extern void * ksym_lookup(const char * symname); 8 | extern list_t * ksym_list(void); 9 | extern hashmap_t * ksym_get_map(void); 10 | -------------------------------------------------------------------------------- /base/usr/include/kernel/misc.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | size_t arch_cpu_mhz(void); 5 | 6 | const char * arch_get_cmdline(void); 7 | const char * arch_get_loader(void); 8 | 9 | void arch_pause(void); 10 | 11 | void arch_fatal(void); 12 | 13 | void arch_set_tls_base(uintptr_t tlsbase); 14 | long arch_reboot(void); 15 | 16 | void arch_fatal_prepare(void); 17 | void arch_dump_traceback(void); 18 | -------------------------------------------------------------------------------- /base/usr/include/kernel/mod/rtl.h: -------------------------------------------------------------------------------- 1 | #ifndef KERNEL_MOD_RTL_H 2 | #define KERNEL_MOD_RTL_H 3 | 4 | #endif 5 | -------------------------------------------------------------------------------- /base/usr/include/kernel/mod/sound.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #define SND_MAX_KNOBS 256 6 | #define SND_KNOB_NAME_SIZE 256 7 | #define SND_KNOB_MAX_VALUE UINT32_MAX 8 | 9 | #define SND_KNOB_MASTER 0 10 | #define SND_DEVICE_MAIN 0 11 | 12 | typedef struct snd_knob_list { 13 | uint32_t device; /* IN */ 14 | uint32_t num; /* OUT */ 15 | uint32_t ids[SND_MAX_KNOBS]; /* OUT */ 16 | } snd_knob_list_t; 17 | 18 | typedef struct snd_knob_info { 19 | uint32_t device; /* IN */ 20 | uint32_t id; /* IN */ 21 | char name[SND_KNOB_NAME_SIZE]; /* OUT */ 22 | } snd_knob_info_t; 23 | 24 | typedef struct snd_knob_value { 25 | uint32_t device; /* IN */ 26 | uint32_t id; /* IN */ 27 | uint32_t val; /* OUT for SND_MIXER_READ_KNOB, IN for SND_MIXER_WRITE_KNOB */ 28 | } snd_knob_value_t; 29 | 30 | 31 | /* IOCTLs */ 32 | #define SND_MIXER_GET_KNOBS 0 33 | #define SND_MIXER_GET_KNOB_INFO 1 34 | #define SND_MIXER_READ_KNOB 2 35 | #define SND_MIXER_WRITE_KNOB 3 36 | 37 | -------------------------------------------------------------------------------- /base/usr/include/kernel/module.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | struct Module { 6 | const char * name; 7 | int (*init)(int argc, char * argv[]); 8 | int (*fini)(void); 9 | }; 10 | 11 | struct LoadedModule { 12 | struct Module * metadata; 13 | uintptr_t baseAddress; 14 | size_t fileSize; 15 | size_t loadedSize; 16 | }; 17 | 18 | hashmap_t * modules_get_list(void); 19 | -------------------------------------------------------------------------------- /base/usr/include/kernel/mouse.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | typedef enum { 6 | LEFT_CLICK = 0x01, 7 | RIGHT_CLICK = 0x02, 8 | MIDDLE_CLICK = 0x04, 9 | 10 | MOUSE_SCROLL_UP = 0x10, 11 | MOUSE_SCROLL_DOWN = 0x20, 12 | } mouse_click_t; 13 | 14 | typedef struct { 15 | uint32_t magic; 16 | int32_t x_difference; 17 | int32_t y_difference; 18 | mouse_click_t buttons; 19 | } mouse_device_packet_t; 20 | 21 | #define MOUSE_MAGIC 0xFEED1234 22 | 23 | -------------------------------------------------------------------------------- /base/usr/include/kernel/mutex.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Mutex that sleeps... and can be owned across sleeping... 3 | * 4 | * @copyright 2014-2021 K. Lange 5 | * This file is part of ToaruOS and is released under the terms 6 | * of the NCSA / University of Illinois License - see LICENSE.md 7 | */ 8 | #include 9 | #include 10 | #include 11 | 12 | typedef struct { 13 | spin_lock_t inner_lock; 14 | volatile int status; 15 | process_t * owner; 16 | list_t * waiters; 17 | } sched_mutex_t; 18 | 19 | extern sched_mutex_t * mutex_init(const char * name); 20 | extern int mutex_acquire(sched_mutex_t * mutex); 21 | extern int mutex_release(sched_mutex_t * mutex); 22 | -------------------------------------------------------------------------------- /base/usr/include/kernel/pipe.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | typedef struct _pipe_device { 9 | uint8_t * buffer; 10 | size_t write_ptr; 11 | size_t read_ptr; 12 | size_t size; 13 | size_t refcount; 14 | list_t * wait_queue_readers; 15 | list_t * wait_queue_writers; 16 | int dead; 17 | list_t * alert_waiters; 18 | 19 | spin_lock_t lock_read; 20 | spin_lock_t lock_write; 21 | spin_lock_t alert_lock; 22 | spin_lock_t wait_lock; 23 | spin_lock_t ptr_lock; 24 | } pipe_device_t; 25 | 26 | fs_node_t * make_pipe(size_t size); 27 | int pipe_size(fs_node_t * node); 28 | int pipe_unsize(fs_node_t * node); 29 | 30 | -------------------------------------------------------------------------------- /base/usr/include/kernel/printf.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | __attribute__((format(__printf__,1,2))) 7 | extern int printf(const char *fmt, ...); 8 | extern size_t (*printf_output)(size_t, uint8_t *); 9 | __attribute__((format(__printf__,3,4))) 10 | extern int snprintf(char * str, size_t size, const char * format, ...); 11 | extern size_t xvasprintf(int (*callback)(void *, char), void * userData, const char * fmt, va_list args); 12 | 13 | __attribute__((format(__printf__,1,2))) 14 | extern int dprintf(const char *fmt, ...); 15 | extern void console_set_output(size_t (*output)(size_t,uint8_t*)); 16 | -------------------------------------------------------------------------------- /base/usr/include/kernel/procfs.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | typedef void (*procfs_populate_t)(fs_node_t * node); 6 | 7 | struct procfs_entry { 8 | intptr_t id; 9 | const char * name; 10 | procfs_populate_t func; 11 | }; 12 | 13 | extern int procfs_install(struct procfs_entry * entry); 14 | extern void procfs_initialize(void); 15 | extern int procfs_printf(fs_node_t * node, const char * fmt, ...); 16 | -------------------------------------------------------------------------------- /base/usr/include/kernel/ptrace.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | long ptrace_attach(pid_t pid); 4 | long ptrace_self(void); 5 | long ptrace_signal(int signal, int reason); 6 | long ptrace_continue(pid_t pid, int signum); 7 | -------------------------------------------------------------------------------- /base/usr/include/kernel/ramdisk.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | extern fs_node_t * ramdisk_mount(uintptr_t, size_t); 8 | -------------------------------------------------------------------------------- /base/usr/include/kernel/shm.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #define SHM_PATH_SEPARATOR "." 8 | 9 | /* Types */ 10 | struct shm_node; 11 | 12 | typedef struct { 13 | struct shm_node * parent; 14 | volatile uint8_t lock; 15 | ssize_t ref_count; 16 | size_t num_frames; 17 | uintptr_t *frames; 18 | } shm_chunk_t; 19 | 20 | typedef struct shm_node { 21 | char name[256]; 22 | shm_chunk_t * chunk; 23 | } shm_node_t; 24 | 25 | typedef struct { 26 | shm_chunk_t * chunk; 27 | uint8_t volatile lock; 28 | size_t num_vaddrs; 29 | uintptr_t *vaddrs; 30 | } shm_mapping_t; 31 | 32 | /* Syscalls */ 33 | extern void * shm_obtain(char * path, size_t * size); 34 | extern int shm_release(char * path); 35 | 36 | /* Other exposed functions */ 37 | extern void shm_install(void); 38 | extern void shm_release_all(process_t * proc); 39 | 40 | -------------------------------------------------------------------------------- /base/usr/include/kernel/signal.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #if defined(__x86_64__) 8 | #include 9 | #elif defined(__aarch64__) 10 | #include 11 | #else 12 | #error "no regs" 13 | #endif 14 | 15 | typedef struct { 16 | int signum; 17 | } signal_t; 18 | 19 | extern void fix_signal_stacks(void); 20 | extern int send_signal(pid_t process, int signal, int force_root); 21 | extern int group_send_signal(pid_t group, int signal, int force_root); 22 | extern void return_from_signal_handler(struct regs*); 23 | extern void process_check_signals(struct regs*); 24 | extern int signal_await(sigset_t awaited, int * sig); 25 | extern int handle_signal(process_t * proc, int signum, struct regs *r); 26 | -------------------------------------------------------------------------------- /base/usr/include/kernel/spinlock.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | typedef volatile struct { 8 | volatile int latch[1]; 9 | int owner; 10 | const char * func; 11 | } spin_lock_t; 12 | #define spin_init(lock) do { (lock).owner = 0; (lock).latch[0] = 0; (lock).func = NULL; } while (0) 13 | 14 | #ifdef __aarch64__ 15 | extern void arch_spin_lock_acquire(const char * name, spin_lock_t * lock, const char * func); 16 | extern void arch_spin_lock_release(spin_lock_t * lock); 17 | #define spin_lock(lock) arch_spin_lock_acquire(#lock, &lock, __func__) 18 | #define spin_unlock(lock) arch_spin_lock_release(&lock) 19 | #else 20 | #define spin_lock(lock) do { while (__sync_lock_test_and_set((lock).latch, 0x01)); (lock).owner = this_core->cpu_id+1; (lock).func = __func__; } while (0) 21 | #define spin_unlock(lock) do { (lock).func = NULL; (lock).owner = -1; __sync_lock_release((lock).latch); } while (0) 22 | #endif 23 | 24 | #include 25 | -------------------------------------------------------------------------------- /base/usr/include/kernel/symboltable.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | extern char kernel_symbols_start[]; 4 | extern char kernel_symbols_end[]; 5 | 6 | typedef struct { 7 | uintptr_t addr; 8 | char name[]; 9 | } kernel_symbol_t; 10 | 11 | 12 | -------------------------------------------------------------------------------- /base/usr/include/kernel/time.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | extern void relative_time(unsigned long, unsigned long, unsigned long *, unsigned long *); 6 | extern uint64_t now(void); 7 | extern uint64_t arch_perf_timer(void); 8 | -------------------------------------------------------------------------------- /base/usr/include/kernel/tmpfs.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | fs_node_t * tmpfs_create(char * name); 8 | 9 | struct tmpfs_file { 10 | spin_lock_t lock; 11 | char * name; 12 | int type; 13 | int mask; 14 | uid_t uid; 15 | uid_t gid; 16 | unsigned int atime; 17 | unsigned int mtime; 18 | unsigned int ctime; 19 | size_t length; 20 | size_t block_count; 21 | size_t pointers; 22 | uintptr_t * blocks; 23 | char * target; 24 | }; 25 | 26 | struct tmpfs_dir; 27 | 28 | struct tmpfs_dir { 29 | spin_lock_t lock; 30 | char * name; 31 | int type; 32 | int mask; 33 | int uid; 34 | int gid; 35 | unsigned int atime; 36 | unsigned int mtime; 37 | unsigned int ctime; 38 | list_t * files; 39 | struct tmpfs_dir * parent; 40 | }; 41 | 42 | -------------------------------------------------------------------------------- /base/usr/include/kernel/tokenize.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | int tokenize(char * str, const char * sep, char **buf); 4 | -------------------------------------------------------------------------------- /base/usr/include/kernel/types.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #define asm __asm__ 8 | #define volatile __volatile__ 9 | 10 | #define ALIGN (sizeof(size_t)) 11 | 12 | #define ONES ((size_t)-1/UCHAR_MAX) 13 | #define HIGHS (ONES * (UCHAR_MAX/2+1)) 14 | #define HASZERO(X) (((X)-ONES) & ~(X) & HIGHS) 15 | 16 | -------------------------------------------------------------------------------- /base/usr/include/kernel/version.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | extern const char * __kernel_name; 4 | extern const char * __kernel_version_format; 5 | 6 | extern int __kernel_version_major; 7 | extern int __kernel_version_minor; 8 | extern int __kernel_version_lower; 9 | 10 | extern const char * __kernel_version_suffix; 11 | extern const char * __kernel_version_codename; 12 | 13 | extern const char * __kernel_arch; 14 | 15 | extern const char * __kernel_build_date; 16 | extern const char * __kernel_build_time; 17 | 18 | extern const char * __kernel_compiler_version; 19 | 20 | -------------------------------------------------------------------------------- /base/usr/include/kernel/video.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define IO_VID_WIDTH 0x5001 4 | #define IO_VID_HEIGHT 0x5002 5 | #define IO_VID_DEPTH 0x5003 6 | #define IO_VID_ADDR 0x5004 7 | #define IO_VID_SIGNAL 0x5005 8 | #define IO_VID_SET 0x5006 9 | #define IO_VID_STRIDE 0x5007 10 | #define IO_VID_DRIVER 0x5008 11 | #define IO_VID_REINIT 0x5009 12 | 13 | struct vid_size { 14 | uint32_t width; 15 | uint32_t height; 16 | }; 17 | 18 | #ifdef _KERNEL_ 19 | extern void lfb_set_resolution(uint16_t x, uint16_t y); 20 | extern uint16_t lfb_resolution_x; 21 | extern uint16_t lfb_resolution_y; 22 | extern uint16_t lfb_resolution_b; 23 | extern uint32_t lfb_resolution_s; 24 | extern uint8_t * lfb_vid_memory; 25 | extern const char * lfb_driver_name; 26 | extern void (*lfb_resolution_impl)(uint16_t,uint16_t); 27 | extern int framebuffer_initialize(void); 28 | extern size_t lfb_memsize; 29 | #endif 30 | -------------------------------------------------------------------------------- /base/usr/include/libgen.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | 5 | _Begin_C_Header 6 | 7 | extern char * dirname(char * path); 8 | extern char * basename(char * path); 9 | 10 | _End_C_Header 11 | 12 | -------------------------------------------------------------------------------- /base/usr/include/libintl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | 5 | _Begin_C_Header 6 | 7 | extern char * gettext (const char * msgid); 8 | extern char * dgettext (const char * domainname, const char * msgid); 9 | extern char * dcgettext (const char * domainname, const char * msgid, int category); 10 | 11 | extern char * ngettext (const char * msgid, const char * msgid_plural, unsigned long int n); 12 | extern char * dngettext (const char * domainname, const char * msgid, const char * msgid_plural, unsigned long int n); 13 | extern char * dcngettext (const char * domainname, const char * msgid, const char * msgid_plural, unsigned long int n, int category); 14 | 15 | 16 | _End_C_Header 17 | -------------------------------------------------------------------------------- /base/usr/include/limits.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define _LITTLE_ENDIAN 4 | 5 | /* dummy */ 6 | -------------------------------------------------------------------------------- /base/usr/include/locale.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | 5 | _Begin_C_Header 6 | 7 | #define LC_ALL 0 8 | #define LC_COLLATE 1 9 | #define LC_CTYPE 2 10 | #define LC_MONETARY 3 11 | #define LC_NUMERIC 4 12 | #define LC_TIME 5 13 | #define LC_MESSAGES 6 14 | 15 | struct lconv { 16 | char * decimal_point; 17 | char * thousands_sep; 18 | char * grouping; 19 | char * int_curr_symbol; 20 | char * currency_symbol; 21 | char * mon_decimal_point; 22 | char * mon_thousands_sep; 23 | char * mon_grouping; 24 | char * positive_sign; 25 | char * negative_sign; 26 | char int_frac_digits; 27 | char frac_digits; 28 | char p_cs_precedes; 29 | char p_sep_by_space; 30 | char n_cs_precedes; 31 | char n_sep_by_space; 32 | char p_sign_posn; 33 | char n_sign_posn; 34 | }; 35 | 36 | extern struct lconv * localeconv(void); 37 | extern char * setlocale(int category, const char *locale); 38 | 39 | _End_C_Header 40 | -------------------------------------------------------------------------------- /base/usr/include/memory.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | -------------------------------------------------------------------------------- /base/usr/include/netinet/in.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include <_cheader.h> 3 | #include 4 | 5 | _Begin_C_Header 6 | 7 | typedef uint32_t in_addr_t; 8 | typedef uint16_t in_port_t; 9 | 10 | struct in_addr { 11 | in_addr_t s_addr; 12 | }; 13 | 14 | struct sockaddr_in { 15 | short sin_family; // e.g. AF_INET, AF_INET6 16 | unsigned short sin_port; // e.g. htons(3490) 17 | struct in_addr sin_addr; // see struct in_addr, below 18 | char sin_zero[8]; // zero this if you want to 19 | }; 20 | 21 | in_addr_t inet_addr(const char *cp); 22 | char *inet_ntoa(struct in_addr in); 23 | 24 | #define IP_TTL 2 25 | #define IP_RECVTTL 12 26 | 27 | _End_C_Header 28 | -------------------------------------------------------------------------------- /base/usr/include/poll.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | 5 | _Begin_C_Header 6 | 7 | #define POLLIN 0x0001 8 | #define POLLOUT 0x0002 9 | #define POLLRDHUP 0x0004 10 | #define POLLERR 0x0008 11 | #define POLLHUP 0x0010 12 | #define POLLNVAL 0x0020 13 | #define POLLPRI 0x0040 14 | 15 | typedef unsigned int nfds_t; 16 | 17 | struct pollfd { 18 | int fd; 19 | short events; 20 | short revents; 21 | }; 22 | 23 | extern int poll(struct pollfd * fds, nfds_t nfds, int timeout); 24 | 25 | _End_C_Header 26 | -------------------------------------------------------------------------------- /base/usr/include/pty.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | #include 5 | 6 | _Begin_C_Header 7 | extern int openpty(int * amaster, int * aslave, char * name, const struct termios *termp, const struct winsize * winp); 8 | _End_C_Header 9 | -------------------------------------------------------------------------------- /base/usr/include/pwd.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | #include 5 | #include 6 | 7 | _Begin_C_Header 8 | 9 | struct passwd { 10 | char * pw_name; // username 11 | char * pw_passwd; // password (not meaningful) 12 | uid_t pw_uid; // user id 13 | gid_t pw_gid; // group id 14 | char * pw_comment; // used for decoration settings in toaruos 15 | char * pw_gecos; // full name 16 | char * pw_dir; // home directory 17 | char * pw_shell; // shell 18 | }; 19 | 20 | struct passwd * fgetpwent(FILE * stream); 21 | 22 | struct passwd * getpwent(void); 23 | void setpwent(void); 24 | void endpwent(void); 25 | struct passwd * getpwnam(const char * name); 26 | struct passwd * getpwuid(uid_t uid); 27 | 28 | _End_C_Header 29 | -------------------------------------------------------------------------------- /base/usr/include/sched.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | 5 | _Begin_C_Header 6 | extern int sched_yield(void); 7 | _End_C_Header 8 | -------------------------------------------------------------------------------- /base/usr/include/setjmp.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | 5 | _Begin_C_Header 6 | 7 | /* i386 */ 8 | #ifdef __aarch64__ 9 | #define _JBLEN 32 10 | #else 11 | #define _JBLEN 9 12 | #endif 13 | 14 | typedef long long jmp_buf[_JBLEN]; 15 | 16 | extern void longjmp(jmp_buf j, int r); 17 | extern int setjmp(jmp_buf j); 18 | 19 | _End_C_Header 20 | -------------------------------------------------------------------------------- /base/usr/include/strings.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | #include 5 | 6 | _Begin_C_Header 7 | extern int strcasecmp(const char *s1, const char *s2); 8 | extern int strncasecmp(const char *s1, const char *s2, size_t n); 9 | _End_C_Header 10 | 11 | -------------------------------------------------------------------------------- /base/usr/include/sys/fswait.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | 5 | _Begin_C_Header 6 | extern int fswait(int count, int * fds); 7 | extern int fswait2(int count, int * fds, int timeout); 8 | extern int fswait3(int count, int * fds, int timeout, int * out); 9 | _End_C_Header 10 | -------------------------------------------------------------------------------- /base/usr/include/sys/ioctl.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #define IOCTLDTYPE 0x4F00 6 | 7 | #define IOCTL_DTYPE_UNKNOWN -1 8 | #define IOCTL_DTYPE_FILE 1 9 | #define IOCTL_DTYPE_TTY 2 10 | 11 | #define IOCTLTTYNAME 0x4F01 12 | #define IOCTLTTYLOGIN 0x4F02 13 | #define IOCTLSYNC 0x4F03 14 | 15 | #define IOCTL_PACKETFS_QUEUED 0x5050 16 | 17 | #define FIONBIO 0x4e424c4b 18 | 19 | -------------------------------------------------------------------------------- /base/usr/include/sys/mman.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /* Nothing here, we don't have an mmap implementation yet? */ 4 | -------------------------------------------------------------------------------- /base/usr/include/sys/mount.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | 5 | _Begin_C_Header 6 | extern int mount(char * source, char * target, char * type, unsigned long flags, void * data); 7 | _End_C_Header 8 | -------------------------------------------------------------------------------- /base/usr/include/sys/param.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #define __LITTLE_ENDIAN 1234 9 | #define __BIG_ENDIAN 4321 10 | #define __BYTE_ORDER __LITLE_ENDIAN 11 | 12 | #define BIG_ENDIAN __BIG_ENDIAN 13 | #define LITTLE_ENDIAN __LITTLE_ENDIAN 14 | #define BYTE_ORDER __BYTE_ORDER 15 | -------------------------------------------------------------------------------- /base/usr/include/sys/ptrace.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | #include 5 | 6 | _Begin_C_Header 7 | 8 | enum __ptrace_request { 9 | PTRACE_ATTACH, 10 | PTRACE_CONT, 11 | PTRACE_DETACH, 12 | PTRACE_TRACEME, 13 | PTRACE_GETREGS, 14 | PTRACE_PEEKDATA, 15 | PTRACE_SIGNALS_ONLY_PLZ, 16 | PTRACE_POKEDATA, 17 | PTRACE_SINGLESTEP, 18 | PTRACE_SETREGS 19 | }; 20 | 21 | enum __ptrace_event { 22 | PTRACE_EVENT_SYSCALL_ENTER, 23 | PTRACE_EVENT_SYSCALL_EXIT, 24 | PTRACE_EVENT_SINGLESTEP, 25 | }; 26 | 27 | #ifndef __kernel__ 28 | extern long ptrace(enum __ptrace_request request, pid_t pid, void * addr, void * data); 29 | #endif 30 | 31 | _End_C_Header 32 | -------------------------------------------------------------------------------- /base/usr/include/sys/shm.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | #include 5 | 6 | _Begin_C_Header 7 | extern void * shm_obtain(const char * path, size_t * size); 8 | extern int shm_release(const char * path); 9 | _End_C_Header 10 | 11 | -------------------------------------------------------------------------------- /base/usr/include/sys/sysfunc.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /** 3 | * The sysfunc interface is deprecated. Anything still using these 4 | * should be migrated to real system calls. The sysfunc interface 5 | * exists because it was annoying to add new syscall bindings to 6 | * newlib, but we're not using newlib anymore, so adding new system 7 | * calls should be easy. 8 | */ 9 | 10 | #include <_cheader.h> 11 | 12 | /* Privileged */ 13 | #define TOARU_SYS_FUNC_SYNC 3 14 | #define TOARU_SYS_FUNC_LOGHERE 4 15 | #define TOARU_SYS_FUNC_KDEBUG 7 16 | #define TOARU_SYS_FUNC_INSMOD 8 17 | 18 | /* Unpriviliged */ 19 | #define TOARU_SYS_FUNC_SETHEAP 9 20 | #define TOARU_SYS_FUNC_MMAP 10 21 | #define TOARU_SYS_FUNC_THREADNAME 11 22 | #define TOARU_SYS_FUNC_SETVGACURSOR 13 23 | #define TOARU_SYS_FUNC_SETGSBASE 14 24 | #define TOARU_SYS_FUNC_NPROC 15 25 | 26 | _Begin_C_Header 27 | extern int sysfunc(int command, char ** args); 28 | _End_C_Header 29 | 30 | -------------------------------------------------------------------------------- /base/usr/include/sys/time.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | #include 5 | 6 | _Begin_C_Header 7 | 8 | struct timeval { 9 | time_t tv_sec; /* seconds */ 10 | suseconds_t tv_usec; /* microseconds */ 11 | }; 12 | 13 | struct timezone { 14 | int tz_minuteswest; /* minutes west of Greenwich */ 15 | int tz_dsttime; /* type of DST correction */ 16 | }; 17 | 18 | extern int gettimeofday(struct timeval *p, void *z); 19 | extern int settimeofday(struct timeval *p, void *z); 20 | 21 | _End_C_Header 22 | -------------------------------------------------------------------------------- /base/usr/include/sys/times.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | #include 5 | 6 | _Begin_C_Header 7 | 8 | struct tms { 9 | clock_t tms_utime; 10 | clock_t tms_stime; 11 | clock_t tms_cutime; 12 | clock_t tms_cstime; 13 | }; 14 | 15 | extern clock_t times(struct tms *buf); 16 | 17 | _End_C_Header 18 | -------------------------------------------------------------------------------- /base/usr/include/sys/types.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | #include 5 | 6 | _Begin_C_Header 7 | 8 | typedef int gid_t; 9 | typedef int uid_t; 10 | typedef int dev_t; 11 | typedef int ino_t; 12 | typedef int mode_t; 13 | typedef int caddr_t; 14 | 15 | typedef unsigned short nlink_t; 16 | 17 | typedef unsigned long blksize_t; 18 | typedef unsigned long blkcnt_t; 19 | 20 | typedef long off_t; 21 | typedef long time_t; 22 | typedef long clock_t; 23 | 24 | #define __need_size_t 25 | #include 26 | 27 | typedef long ssize_t; 28 | 29 | typedef unsigned long useconds_t; 30 | typedef long suseconds_t; 31 | typedef int pid_t; 32 | 33 | #define FD_SETSIZE 64 /* compatibility with newlib */ 34 | typedef unsigned int fd_mask; 35 | typedef struct _fd_set { 36 | fd_mask fds_bits[1]; /* should be 64 bits */ 37 | } fd_set; 38 | 39 | _End_C_Header 40 | -------------------------------------------------------------------------------- /base/usr/include/sys/utsname.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | 5 | _Begin_C_Header 6 | #define _UTSNAME_LENGTH 256 7 | 8 | struct utsname { 9 | char sysname[_UTSNAME_LENGTH]; 10 | char nodename[_UTSNAME_LENGTH]; 11 | char release[_UTSNAME_LENGTH]; 12 | char version[_UTSNAME_LENGTH]; 13 | char machine[_UTSNAME_LENGTH]; 14 | char domainname[_UTSNAME_LENGTH]; 15 | }; 16 | 17 | 18 | #ifndef _KERNEL_ 19 | extern int uname(struct utsname *__name); 20 | #endif 21 | 22 | _End_C_Header 23 | -------------------------------------------------------------------------------- /base/usr/include/sys/wait.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | #include 5 | 6 | _Begin_C_Header 7 | 8 | #define WNOHANG 0x0001 9 | #define WUNTRACED 0x0002 10 | #define WSTOPPED 0x0004 11 | #define WNOKERN 0x0010 12 | 13 | /* This were taken from newlib, but they remain true */ 14 | #define WIFEXITED(w) (((w) & 0xff) == 0) 15 | #define WIFSIGNALED(w) (((w) & 0x7f) > 0 && (((w) & 0x7f) < 0x7f)) 16 | #define WIFSTOPPED(w) (((w) & 0xff) == 0x7f) 17 | #define WEXITSTATUS(w) (((w) >> 8) & 0xff) 18 | #define WTERMSIG(w) ((w) & 0x7f) 19 | #define WSTOPSIG WEXITSTATUS 20 | 21 | 22 | #ifndef _KERNEL_ 23 | extern pid_t wait(int*); 24 | extern pid_t waitpid(pid_t, int *, int); 25 | #endif 26 | 27 | _End_C_Header 28 | -------------------------------------------------------------------------------- /base/usr/include/termio.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | -------------------------------------------------------------------------------- /base/usr/include/termios.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | -------------------------------------------------------------------------------- /base/usr/include/toaru/button.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief Draws buttons. 3 | * 4 | * @copyright 5 | * This file is part of ToaruOS and is released under the terms 6 | * of the NCSA / University of Illinois License - see LICENSE.md 7 | * Copyright (C) 2018 K. Lange 8 | */ 9 | 10 | /* This definition will eventually change with the rest of the widget toolkit */ 11 | struct TTKButton { 12 | int x; 13 | int y; 14 | int width; 15 | int height; 16 | char * title; 17 | int hilight; 18 | }; 19 | 20 | extern void ttk_button_draw(gfx_context_t * ctx, struct TTKButton * button); 21 | -------------------------------------------------------------------------------- /base/usr/include/toaru/drawstring.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | #include 5 | 6 | _Begin_C_Header 7 | 8 | void draw_string(gfx_context_t * ctx, int x, int y, uint32_t _fg, char * str); 9 | int draw_string_width(char * str); 10 | 11 | _End_C_Header 12 | -------------------------------------------------------------------------------- /base/usr/include/toaru/icon_cache.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | #include 5 | 6 | _Begin_C_Header 7 | 8 | extern sprite_t * icon_get_16(const char * name); 9 | extern sprite_t * icon_get_48(const char * name); 10 | 11 | _End_C_Header 12 | 13 | -------------------------------------------------------------------------------- /base/usr/include/toaru/jpeg.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | #include 5 | 6 | _Begin_C_Header 7 | 8 | extern int load_sprite_jpg(sprite_t * sprite, char * filename); 9 | 10 | _End_C_Header 11 | -------------------------------------------------------------------------------- /base/usr/include/toaru/markup.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | #include 5 | 6 | _Begin_C_Header 7 | 8 | struct markup_tag { 9 | char * name; 10 | hashmap_t * options; 11 | }; 12 | 13 | struct markup_state; 14 | typedef int (*markup_callback_tag_open)(struct markup_state * self, void * user, struct markup_tag * tag); 15 | typedef int (*markup_callback_tag_close)(struct markup_state * self, void * user, char * tag_name); 16 | typedef int (*markup_callback_data)(struct markup_state * self, void * user, char * data); 17 | 18 | extern struct markup_state * markup_init(void * user, markup_callback_tag_open open, markup_callback_tag_close close, markup_callback_data data); 19 | extern int markup_free_tag(struct markup_tag * tag); 20 | extern int markup_parse(struct markup_state * state, char c); 21 | extern int markup_finish(struct markup_state * state); 22 | 23 | _End_C_Header 24 | -------------------------------------------------------------------------------- /base/usr/include/toaru/mouse.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | 5 | _Begin_C_Header 6 | 7 | typedef enum { 8 | LEFT_CLICK = 0x01, 9 | RIGHT_CLICK = 0x02, 10 | MIDDLE_CLICK = 0x04, 11 | 12 | MOUSE_SCROLL_UP = 0x10, 13 | MOUSE_SCROLL_DOWN = 0x20, 14 | } mouse_click_t; 15 | 16 | typedef struct { 17 | uint32_t magic; 18 | int32_t x_difference; 19 | int32_t y_difference; 20 | mouse_click_t buttons; 21 | } mouse_device_packet_t; 22 | 23 | #define MOUSE_MAGIC 0xFEED1234 24 | 25 | _End_C_Header 26 | -------------------------------------------------------------------------------- /base/usr/include/toaru/pex.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | #include 5 | #include 6 | 7 | _Begin_C_Header 8 | 9 | typedef struct pex_packet { 10 | uintptr_t source; 11 | size_t size; 12 | uint8_t data[]; 13 | } pex_packet_t; 14 | #define MAX_PACKET_SIZE 1024 15 | #define PACKET_SIZE (sizeof(pex_packet_t) + MAX_PACKET_SIZE) 16 | 17 | typedef struct pex_header { 18 | uintptr_t target; 19 | uint8_t data[]; 20 | } pex_header_t; 21 | 22 | extern size_t pex_send(FILE * sock, uintptr_t rcpt, size_t size, char * blob); 23 | extern size_t pex_broadcast(FILE * sock, size_t size, char * blob); 24 | extern size_t pex_listen(FILE * sock, pex_packet_t * packet); 25 | 26 | extern size_t pex_reply(FILE * sock, size_t size, char * blob); 27 | extern size_t pex_recv(FILE * sock, char * blob); 28 | extern size_t pex_query(FILE * sock); 29 | 30 | extern FILE * pex_bind(char * target); 31 | extern FILE * pex_connect(char * target); 32 | 33 | _End_C_Header 34 | -------------------------------------------------------------------------------- /base/usr/include/toaru/png.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | #include 5 | 6 | _Begin_C_Header 7 | 8 | extern int load_sprite_png(sprite_t * sprite, char * filename); 9 | 10 | _End_C_Header 11 | 12 | -------------------------------------------------------------------------------- /base/usr/include/toaru/spinlock.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef spin_lock 4 | static void spin_lock(int volatile * lock) { 5 | while(__sync_lock_test_and_set(lock, 0x01)) { 6 | syscall_yield(); 7 | } 8 | } 9 | 10 | static void spin_unlock(int volatile * lock) { 11 | __sync_lock_release(lock); 12 | } 13 | #endif 14 | 15 | -------------------------------------------------------------------------------- /base/usr/include/toaru/trace.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #ifndef TRACE 8 | #define TRACE(msg,...) do { \ 9 | struct timeval t; gettimeofday(&t, NULL); \ 10 | fprintf(stderr, "%06d.%06d [" TRACE_APP_NAME "] %s:%05d - " msg "\n", t.tv_sec, t.tv_usec, __FILE__, __LINE__, ##__VA_ARGS__); \ 11 | } while (0) 12 | #endif 13 | -------------------------------------------------------------------------------- /base/usr/include/utime.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | #include 5 | 6 | _Begin_C_Header 7 | 8 | struct utimbuf { 9 | time_t actime; 10 | time_t modtime; 11 | }; 12 | 13 | extern int utime(const char *filename, const struct utimbuf *times); 14 | 15 | _End_C_Header 16 | -------------------------------------------------------------------------------- /base/usr/include/va_list.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | 5 | _Begin_C_Header 6 | 7 | typedef __builtin_va_list va_list; 8 | #define va_start(ap,last) __builtin_va_start(ap, last) 9 | #define va_end(ap) __builtin_va_end(ap) 10 | #define va_arg(ap,type) __builtin_va_arg(ap,type) 11 | #define va_copy(dest, src) __builtin_va_copy(dest,src) 12 | 13 | _End_C_Header 14 | 15 | -------------------------------------------------------------------------------- /base/usr/include/wait.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include <_cheader.h> 4 | 5 | _Begin_C_Header 6 | int waitpid(int pid, int *status, int options); 7 | int wait(int *status); 8 | _End_C_Header 9 | -------------------------------------------------------------------------------- /base/usr/share/bim/site/__init__.krk: -------------------------------------------------------------------------------- 1 | import kuroko 2 | 3 | kuroko.module_paths.append('/lib/kuroko/') 4 | -------------------------------------------------------------------------------- /base/usr/share/bim/syntax/biminfo.krk: -------------------------------------------------------------------------------- 1 | from syntax import Highlighter, bind 2 | 3 | class BiminfoHighlighter(Highlighter): 4 | name = 'biminfo' 5 | extensions = ('.biminfo',) 6 | def calculate(self): 7 | if self.i == 0: 8 | if self[0] == '#': 9 | self.paint(-1, self.FLAG_COMMENT) 10 | else if self[0] == '>': 11 | self.paint(1, self.FLAG_KEYWORD) 12 | while self[0] != ' ': 13 | self.paint(1, self.FLAG_TYPE) 14 | self.skip() 15 | self.paint(-1, self.FLAG_NUMERAL) 16 | return None 17 | 18 | bind(BiminfoHighlighter) 19 | -------------------------------------------------------------------------------- /base/usr/share/bim/syntax/conf.krk: -------------------------------------------------------------------------------- 1 | from syntax import Highlighter, bind 2 | 3 | class ConfigHighlighter(Highlighter): 4 | name = "conf" 5 | extensions = ('.conf','.ini','.git/config','.cfg','.properties') 6 | spaces = True 7 | 8 | def calculate(self): 9 | if self.i == 0: 10 | if self[0] == ';': 11 | self.paintComment() 12 | else if self[0] == '#': 13 | self.paintComment() 14 | else if self[0] == '[': 15 | self.paint(1, self.FLAG_KEYWORD) 16 | while self[0] and self[0] != ']': 17 | self.paint(1, self.FLAG_KEYWORD) 18 | if self[0] == ']': 19 | self.paint(1, self.FLAG_KEYWORD) 20 | else: 21 | while self[0] and self[0] != '=': 22 | self.paint(1, self.FLAG_TYPE) 23 | return None 24 | 25 | bind(ConfigHighlighter) 26 | -------------------------------------------------------------------------------- /base/usr/share/bim/syntax/ctags.krk: -------------------------------------------------------------------------------- 1 | from syntax import Highlighter, bind 2 | 3 | class CtagsHighlighter(Highlighter): 4 | name = 'ctags' 5 | extensions = ('tags',) 6 | def calculate(): 7 | if self.i == 0: 8 | if self[0] == '!': 9 | return self.paintComment() 10 | while self[0] and self[0] != '\t': self.paint(1, self.FLAG_TYPE) 11 | if self[0] == '\t': self.skip() 12 | while self[0] and self[0] != '\t': self.paint(1, self.FLAG_NUMERAL) 13 | if self[0] == '\t': self.skip() 14 | while self[0] and not (self[0] == ';' and self[1] == '"'): self.paint(1, self.FLAG_KEYWORD) 15 | return None 16 | 17 | bind(CtagsHighlighter) 18 | -------------------------------------------------------------------------------- /base/usr/share/bim/syntax/diff.krk: -------------------------------------------------------------------------------- 1 | from syntax import Highlighter, bind 2 | 3 | class DiffHighlighter(Highlighter): 4 | name = 'diff' 5 | extensions = ('.patch','.diff') 6 | mapping = { 7 | '+': Highlighter.FLAG_DIFFPLUS, 8 | '-': Highlighter.FLAG_DIFFMINUS, 9 | '@': Highlighter.FLAG_TYPE, 10 | ' ': Highlighter.FLAG_KEYWORD, 11 | } 12 | def calculate(): 13 | if self.i == 0: 14 | let flag = self.mapping[self[0]] if self[0] in self.mapping else 0 15 | self.paint(-1, flag) 16 | return None 17 | 18 | bind(DiffHighlighter) 19 | -------------------------------------------------------------------------------- /base/usr/share/bim/syntax/dirent.krk: -------------------------------------------------------------------------------- 1 | ''' 2 | For highlighting bim's built-in directory browser. 3 | ''' 4 | from syntax import Highlighter, bind 5 | 6 | class DirentHighlighter(Highlighter): 7 | name = 'dirent' 8 | extensions = () 9 | def calculate(): 10 | if self.i == 0: 11 | if self[0] == '#': 12 | return self.paintComment() 13 | else if self[0] == 'd': 14 | self.paint(1, self.FLAG_COMMENT) 15 | self.paint(-1, self.FLAG_KEYWORD) 16 | else if self[0] == 'f': 17 | self.paint(1, self.FLAG_COMMENT) 18 | self.paint(-1, self.FLAG_NONE) 19 | return None 20 | 21 | bind(DirentHighlighter) 22 | -------------------------------------------------------------------------------- /base/usr/share/bim/syntax/hosts.krk: -------------------------------------------------------------------------------- 1 | from syntax import Highlighter, bind 2 | 3 | class HostsHighlighter(Highlighter): 4 | name = 'hosts' 5 | extensions = ('hosts',) 6 | 7 | def calculate(): 8 | if self.i == 0: 9 | if self[0] == '#': 10 | return self.paintComment() 11 | while self[0] != '\t' and self[0] != ' ' and self[0]: 12 | self.paint(1, self.FLAG_NUMERAL) 13 | while self[0]: 14 | self.paint(1, self.FLAG_TYPE) 15 | return None 16 | 17 | bind(HostsHighlighter) 18 | -------------------------------------------------------------------------------- /base/usr/share/bim/syntax/latex.krk: -------------------------------------------------------------------------------- 1 | from syntax import Highlighter, bind 2 | 3 | class LatexHighlighter(Highlighter): 4 | name = "latex" 5 | extensions = ('.tex',) 6 | spaces = True 7 | 8 | def calculate(self): 9 | while self[0]: 10 | if self[0] == '%': 11 | self.paintComment() 12 | return None 13 | else if self[0] == '\\': 14 | if self.isalpha(self[1]): 15 | self.paint(2, self.FLAG_KEYWORD) 16 | while self.isalpha(self[0]): 17 | self.paint(1, self.FLAG_KEYWORD) 18 | else: 19 | self.skip() 20 | else: 21 | self.skip() 22 | return None 23 | 24 | bind(LatexHighlighter) 25 | 26 | -------------------------------------------------------------------------------- /base/usr/share/bim/themes/__init__.krk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/bim/themes/__init__.krk -------------------------------------------------------------------------------- /base/usr/share/cursor/drag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/cursor/drag.png -------------------------------------------------------------------------------- /base/usr/share/cursor/grab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/cursor/grab.png -------------------------------------------------------------------------------- /base/usr/share/cursor/ibeam.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/cursor/ibeam.png -------------------------------------------------------------------------------- /base/usr/share/cursor/normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/cursor/normal.png -------------------------------------------------------------------------------- /base/usr/share/cursor/point.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/cursor/point.png -------------------------------------------------------------------------------- /base/usr/share/cursor/resize-dlur.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/cursor/resize-dlur.png -------------------------------------------------------------------------------- /base/usr/share/cursor/resize-horizontal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/cursor/resize-horizontal.png -------------------------------------------------------------------------------- /base/usr/share/cursor/resize-uldr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/cursor/resize-uldr.png -------------------------------------------------------------------------------- /base/usr/share/cursor/resize-vertical.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/cursor/resize-vertical.png -------------------------------------------------------------------------------- /base/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf -------------------------------------------------------------------------------- /base/usr/share/fonts/truetype/dejavu/DejaVuSans-BoldOblique.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/fonts/truetype/dejavu/DejaVuSans-BoldOblique.ttf -------------------------------------------------------------------------------- /base/usr/share/fonts/truetype/dejavu/DejaVuSans-Oblique.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/fonts/truetype/dejavu/DejaVuSans-Oblique.ttf -------------------------------------------------------------------------------- /base/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf -------------------------------------------------------------------------------- /base/usr/share/fonts/truetype/dejavu/DejaVuSansMono-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/fonts/truetype/dejavu/DejaVuSansMono-Bold.ttf -------------------------------------------------------------------------------- /base/usr/share/fonts/truetype/dejavu/DejaVuSansMono-BoldOblique.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/fonts/truetype/dejavu/DejaVuSansMono-BoldOblique.ttf -------------------------------------------------------------------------------- /base/usr/share/fonts/truetype/dejavu/DejaVuSansMono-Oblique.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/fonts/truetype/dejavu/DejaVuSansMono-Oblique.ttf -------------------------------------------------------------------------------- /base/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf -------------------------------------------------------------------------------- /base/usr/share/games/pong/ball.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/games/pong/ball.png -------------------------------------------------------------------------------- /base/usr/share/games/pong/paddle-blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/games/pong/paddle-blue.png -------------------------------------------------------------------------------- /base/usr/share/games/pong/paddle-red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/games/pong/paddle-red.png -------------------------------------------------------------------------------- /base/usr/share/help/0_index.trt: -------------------------------------------------------------------------------- 1 |

Welcome!

2 | 3 | Welcome to the Help Browser. This is a simple rich text document viewer. It is incomplete. 4 | To view the documentation for an application, select the "Contents" entry from the "Help" menu, when available. 5 | -------------------------------------------------------------------------------- /base/usr/share/help/calculator.trt: -------------------------------------------------------------------------------- 1 |

Calculator

2 | 3 | A simple calculator powered by Kuroko.
4 | Use the keyboard or the provided buttons to enter calculations as Kuroko expressions.
5 | Single-line statements such as imports are also supported. For more math functionality, import math. 6 | -------------------------------------------------------------------------------- /base/usr/share/help/file-browser.trt: -------------------------------------------------------------------------------- 1 |

File Browser

2 | 3 | Provides a graphical representation of the file system.
4 | 5 | Double click to navigate through directories or open files.
6 | 7 | A right-click context menu provides additional options. 8 | -------------------------------------------------------------------------------- /base/usr/share/help/help-browser.trt: -------------------------------------------------------------------------------- 1 |

Help Browser

2 | 3 | Displays HTML-escape markup files describing applications.
4 | This application is incomplete. A more featureful HTML rendering engine will eventually replace it. 5 | -------------------------------------------------------------------------------- /base/usr/share/help/package-manager.trt: -------------------------------------------------------------------------------- 1 |

Package Manager

2 | 3 | Graphical interface to the msk command-line utility.
4 | 5 | Double click packages to install them. Dependencies will be installed automatically. 6 | -------------------------------------------------------------------------------- /base/usr/share/help/terminal.trt: -------------------------------------------------------------------------------- 1 |

Terminal

2 | 3 | Terminal emulator providing extensive ANSI escape sequence support.
4 | 5 | Supports most xterm-compatible escape squences, as well as 24-bit color.
6 | 7 | Text display supports anti-aliased and bitmap fonts. 8 | -------------------------------------------------------------------------------- /base/usr/share/icons/16/applications-generic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/16/applications-generic.png -------------------------------------------------------------------------------- /base/usr/share/icons/16/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/16/back.png -------------------------------------------------------------------------------- /base/usr/share/icons/16/bookmark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/16/bookmark.png -------------------------------------------------------------------------------- /base/usr/share/icons/16/calculator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/16/calculator.png -------------------------------------------------------------------------------- /base/usr/share/icons/16/check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/16/check.png -------------------------------------------------------------------------------- /base/usr/share/icons/16/clock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/16/clock.png -------------------------------------------------------------------------------- /base/usr/share/icons/16/config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/16/config.png -------------------------------------------------------------------------------- /base/usr/share/icons/16/exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/16/exit.png -------------------------------------------------------------------------------- /base/usr/share/icons/16/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/16/file.png -------------------------------------------------------------------------------- /base/usr/share/icons/16/folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/16/folder.png -------------------------------------------------------------------------------- /base/usr/share/icons/16/forward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/16/forward.png -------------------------------------------------------------------------------- /base/usr/share/icons/16/help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/16/help.png -------------------------------------------------------------------------------- /base/usr/share/icons/16/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/16/home.png -------------------------------------------------------------------------------- /base/usr/share/icons/16/menu-tick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/16/menu-tick.png -------------------------------------------------------------------------------- /base/usr/share/icons/16/mines.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/16/mines.png -------------------------------------------------------------------------------- /base/usr/share/icons/16/missing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/16/missing.png -------------------------------------------------------------------------------- /base/usr/share/icons/16/new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/16/new.png -------------------------------------------------------------------------------- /base/usr/share/icons/16/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/16/open.png -------------------------------------------------------------------------------- /base/usr/share/icons/16/package.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/16/package.png -------------------------------------------------------------------------------- /base/usr/share/icons/16/refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/16/refresh.png -------------------------------------------------------------------------------- /base/usr/share/icons/16/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/16/save.png -------------------------------------------------------------------------------- /base/usr/share/icons/16/star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/16/star.png -------------------------------------------------------------------------------- /base/usr/share/icons/16/up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/16/up.png -------------------------------------------------------------------------------- /base/usr/share/icons/16/utilities-terminal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/16/utilities-terminal.png -------------------------------------------------------------------------------- /base/usr/share/icons/16/weather-clouds.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/16/weather-clouds.png -------------------------------------------------------------------------------- /base/usr/share/icons/16/weather-humidity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/16/weather-humidity.png -------------------------------------------------------------------------------- /base/usr/share/icons/16/weather-pressure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/16/weather-pressure.png -------------------------------------------------------------------------------- /base/usr/share/icons/24/mouse-relative.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/24/mouse-relative.png -------------------------------------------------------------------------------- /base/usr/share/icons/24/mouse-status.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/24/mouse-status.png -------------------------------------------------------------------------------- /base/usr/share/icons/24/net-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/24/net-active.png -------------------------------------------------------------------------------- /base/usr/share/icons/24/net-disconnected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/24/net-disconnected.png -------------------------------------------------------------------------------- /base/usr/share/icons/24/volume-full.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/24/volume-full.png -------------------------------------------------------------------------------- /base/usr/share/icons/24/volume-low.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/24/volume-low.png -------------------------------------------------------------------------------- /base/usr/share/icons/24/volume-medium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/24/volume-medium.png -------------------------------------------------------------------------------- /base/usr/share/icons/24/volume-mute.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/24/volume-mute.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/applications-generic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/applications-generic.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/applications-painting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/applications-painting.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/c.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/calculator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/calculator.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/cd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/cd.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/clock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/clock.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/drawlines.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/drawlines.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/exit.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/file.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/folder.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/font.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/font.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/gears.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/gears.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/h.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/help.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/image.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/julia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/julia.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/krk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/krk.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/lock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/lock.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/mandelbrot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/mandelbrot.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/mines.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/mines.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/network-jack-disconnected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/network-jack-disconnected.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/network-jack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/network-jack.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/package-uninstalled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/package-uninstalled.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/package.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/package.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/package_a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/package_a.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/package_tar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/package_tar.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/package_targz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/package_targz.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/package_zip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/package_zip.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/pdf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/pdf.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/plasma.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/plasma.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/py.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/py.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/sh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/sh.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/so.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/so.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/star.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/system-monitor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/system-monitor.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/utilities-terminal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/utilities-terminal.png -------------------------------------------------------------------------------- /base/usr/share/icons/48/wallpaper-picker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/48/wallpaper-picker.png -------------------------------------------------------------------------------- /base/usr/share/icons/panel-shutdown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/panel-shutdown.png -------------------------------------------------------------------------------- /base/usr/share/icons/weather/01d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/weather/01d.png -------------------------------------------------------------------------------- /base/usr/share/icons/weather/01n.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/weather/01n.png -------------------------------------------------------------------------------- /base/usr/share/icons/weather/02d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/weather/02d.png -------------------------------------------------------------------------------- /base/usr/share/icons/weather/02n.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/weather/02n.png -------------------------------------------------------------------------------- /base/usr/share/icons/weather/03d.png: -------------------------------------------------------------------------------- 1 | 02d.png -------------------------------------------------------------------------------- /base/usr/share/icons/weather/03n.png: -------------------------------------------------------------------------------- 1 | 02n.png -------------------------------------------------------------------------------- /base/usr/share/icons/weather/04d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/weather/04d.png -------------------------------------------------------------------------------- /base/usr/share/icons/weather/04n.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/weather/04n.png -------------------------------------------------------------------------------- /base/usr/share/icons/weather/09d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/weather/09d.png -------------------------------------------------------------------------------- /base/usr/share/icons/weather/09n.png: -------------------------------------------------------------------------------- 1 | 09d.png -------------------------------------------------------------------------------- /base/usr/share/icons/weather/10d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/weather/10d.png -------------------------------------------------------------------------------- /base/usr/share/icons/weather/10n.png: -------------------------------------------------------------------------------- 1 | 10d.png -------------------------------------------------------------------------------- /base/usr/share/icons/weather/11d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/weather/11d.png -------------------------------------------------------------------------------- /base/usr/share/icons/weather/11n.png: -------------------------------------------------------------------------------- 1 | 11d.png -------------------------------------------------------------------------------- /base/usr/share/icons/weather/13d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/weather/13d.png -------------------------------------------------------------------------------- /base/usr/share/icons/weather/13n.png: -------------------------------------------------------------------------------- 1 | 13d.png -------------------------------------------------------------------------------- /base/usr/share/icons/weather/50d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/icons/weather/50d.png -------------------------------------------------------------------------------- /base/usr/share/icons/weather/50n.png: -------------------------------------------------------------------------------- 1 | 50d.png -------------------------------------------------------------------------------- /base/usr/share/logo_login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/logo_login.png -------------------------------------------------------------------------------- /base/usr/share/snowflake.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/snowflake.bmp -------------------------------------------------------------------------------- /base/usr/share/ttk/blorp.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/ttk/blorp.wav -------------------------------------------------------------------------------- /base/usr/share/ttk/fancy/borders-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/ttk/fancy/borders-active.png -------------------------------------------------------------------------------- /base/usr/share/ttk/fancy/borders-inactive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/ttk/fancy/borders-inactive.png -------------------------------------------------------------------------------- /base/usr/share/ttk/fancy/button-close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/ttk/fancy/button-close.png -------------------------------------------------------------------------------- /base/usr/share/ttk/fancy/button-maximize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/ttk/fancy/button-maximize.png -------------------------------------------------------------------------------- /base/usr/share/ttk/fancy/button-minimize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/ttk/fancy/button-minimize.png -------------------------------------------------------------------------------- /base/usr/share/ttk/fancy/button-unmaximize.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/ttk/fancy/button-unmaximize.png -------------------------------------------------------------------------------- /base/usr/share/ttk/toast/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/ttk/toast/default.png -------------------------------------------------------------------------------- /base/usr/share/wallpaper.jpg: -------------------------------------------------------------------------------- 1 | wallpapers/hanging.jpg -------------------------------------------------------------------------------- /base/usr/share/wallpapers/hanging.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/klange/toaruos/1a551db5cf47aa8ae895983b2819d5ca19be53a3/base/usr/share/wallpapers/hanging.jpg -------------------------------------------------------------------------------- /boot/editor.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | extern int boot_edit; 4 | int boot_editor(void); 5 | -------------------------------------------------------------------------------- /boot/kbd.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define KBD_SCAN_DOWN 0x50 4 | #define KBD_SCAN_UP 0x48 5 | #define KBD_SCAN_LEFT 0x4B 6 | #define KBD_SCAN_RIGHT 0x4D 7 | #define KBD_SCAN_ENTER 0x1C 8 | #define KBD_SCAN_1 2 9 | #define KBD_SCAN_9 10 10 | 11 | int read_scancode(int); 12 | int read_key(int * c); 13 | 14 | -------------------------------------------------------------------------------- /boot/link.ld: -------------------------------------------------------------------------------- 1 | OUTPUT_FORMAT("binary") 2 | /*ENTRY(start) */ 3 | phys = 0x7c00; 4 | 5 | SECTIONS 6 | { 7 | . = 0x7c00; 8 | 9 | .text : 10 | { 11 | code = .; 12 | *(.text) 13 | } 14 | 15 | .rodata BLOCK(1) : ALIGN(1) 16 | { 17 | *(.rodata) 18 | } 19 | 20 | .data BLOCK(1) : ALIGN(1) 21 | { 22 | data = .; 23 | *(.data) 24 | } 25 | 26 | .bss BLOCK(1) : ALIGN(1) 27 | { 28 | PROVIDE(_bss_start = .); 29 | bss = .; 30 | *(COMMON) 31 | *(.bss) 32 | *(.stack) 33 | PROVIDE(_bss_end = .); 34 | } 35 | 36 | end = .; 37 | 38 | /DISCARD/ : 39 | { 40 | *(.comment) 41 | *(.eh_frame) 42 | *(.note.gnu.build-id) 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /boot/menu.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | extern int boot_mode; 4 | void show_menu(void); 5 | -------------------------------------------------------------------------------- /boot/qemu.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | int detect_qemu(void); 3 | -------------------------------------------------------------------------------- /boot/text.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | extern int txt_debug, x, y, attr; 4 | 5 | void move_cursor(int _x, int _y); 6 | void set_attr(int _attr); 7 | void print_(char * str); 8 | void print_hex_(unsigned int value); 9 | void print_int_(unsigned int value); 10 | void clear_(); 11 | 12 | void print_banner(char * str); 13 | 14 | #define print(s) do {if (txt_debug) {print_(s);}} while(0) 15 | #define clear() do {if (txt_debug) {clear_();}} while(0) 16 | #define print_hex(d) do {if (txt_debug) {print_hex_(d);}} while(0) 17 | 18 | -------------------------------------------------------------------------------- /boot/util.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief Utility functions. 3 | * 4 | * Kind of a barebones libc. 5 | * 6 | * @copyright 7 | * This file is part of ToaruOS and is released under the terms 8 | * of the NCSA / University of Illinois License - see LICENSE.md 9 | * Copyright (C) 2018-2021 K. Lange 10 | */ 11 | #include "util.h" 12 | 13 | int strcmp(const char * l, const char * r) { 14 | for (; *l == *r && *l; l++, r++); 15 | return *(unsigned char *)l - *(unsigned char *)r; 16 | } 17 | 18 | char * strchr(const char * s, int c) { 19 | while (*s) { 20 | if (*s == c) { 21 | return (char *)s; 22 | } 23 | s++; 24 | } 25 | return 0; 26 | } 27 | 28 | unsigned long strlen(const char *s) { 29 | unsigned long out = 0; 30 | while (*s) { 31 | out++; 32 | s++; 33 | } 34 | return out; 35 | } 36 | 37 | char * strcat(char *dest, const char *src) { 38 | char * end = dest; 39 | while (*end != '\0') { 40 | ++end; 41 | } 42 | while (*src) { 43 | *end = *src; 44 | end++; 45 | src++; 46 | } 47 | *end = '\0'; 48 | return dest; 49 | } 50 | 51 | -------------------------------------------------------------------------------- /kernel/arch/aarch64/bootstub/bootstrap.S: -------------------------------------------------------------------------------- 1 | .extern __bootstrap_stack_top 2 | .globl start 3 | start: 4 | ldr x30, =__bootstrap_stack_top 5 | mov sp, x30 6 | bl kmain 7 | hang: 8 | b hang 9 | -------------------------------------------------------------------------------- /kernel/arch/aarch64/bootstub/link.ld: -------------------------------------------------------------------------------- 1 | OUTPUT_FORMAT(elf64-littleaarch64) 2 | ENTRY(start) 3 | 4 | SECTIONS 5 | { 6 | . = 0x40100000; 7 | phys = .; 8 | 9 | .text BLOCK(4K) : ALIGN(4K) 10 | { 11 | *(.bootstrap) 12 | code = .; 13 | *(.text) 14 | } 15 | 16 | .rodata BLOCK(4K) : ALIGN(4K) 17 | { 18 | *(.rodata) 19 | } 20 | 21 | .data BLOCK(4K) : ALIGN(4K) 22 | { 23 | data = .; 24 | *(.data) 25 | *(.symbols) 26 | PROVIDE(kernel_symbols_start = .); 27 | PROVIDE(kernel_symbols_end = .); 28 | PROVIDE(bss_start = .); 29 | } 30 | 31 | .bss BLOCK(4K) : ALIGN(4K) 32 | { 33 | bss = .; 34 | *(COMMON) 35 | *(.bss) 36 | *(.stack) 37 | } 38 | 39 | /* Some built-in stack space... */ 40 | . = ALIGN(0x1000); 41 | . = . + 0x1000; 42 | __bootstrap_stack_top = .; 43 | 44 | end = .; 45 | 46 | /DISCARD/ : 47 | { 48 | *(.comment) 49 | *(.eh_frame) 50 | *(.note.gnu.build-id) 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /kernel/arch/aarch64/entry.S: -------------------------------------------------------------------------------- 1 | /** 2 | * @file kernel/arch/aarch64/entry.S 3 | * @brief Entrypoint stub. 4 | * 5 | * This gets us off of the bootstab's stack and onto 6 | * our own temporary stack, which we'll ideally switch 7 | * off of again when we start up the root process. 8 | */ 9 | .extern __bootstrap_stack_top 10 | .globl start 11 | start: 12 | ldr x30, =__bootstrap_stack_top 13 | mov sp, x30 14 | bl kmain 15 | hang: 16 | b hang 17 | 18 | 19 | -------------------------------------------------------------------------------- /kernel/arch/aarch64/link.ld: -------------------------------------------------------------------------------- 1 | OUTPUT_FORMAT(elf64-littleaarch64) 2 | ENTRY(start) 3 | 4 | SECTIONS 5 | { 6 | . = 0xffffffff80000000; 7 | phys = .; 8 | 9 | .text BLOCK(4K) : ALIGN(4K) 10 | { 11 | *(.bootstrap) 12 | code = .; 13 | *(.text) 14 | } 15 | 16 | .rodata BLOCK(4K) : ALIGN(4K) 17 | { 18 | *(.rodata) 19 | } 20 | 21 | .data BLOCK(4K) : ALIGN(4K) 22 | { 23 | data = .; 24 | *(.data) 25 | *(.symbols) 26 | PROVIDE(kernel_symbols_start = .); 27 | PROVIDE(kernel_symbols_end = .); 28 | PROVIDE(bss_start = .); 29 | } 30 | 31 | .bss BLOCK(4K) : ALIGN(4K) 32 | { 33 | bss = .; 34 | *(COMMON) 35 | *(.bss) 36 | *(.stack) 37 | } 38 | 39 | /* Some built-in stack space... */ 40 | . = ALIGN(0x1000); 41 | . = . + 0x4000; 42 | __bootstrap_stack_top = .; 43 | 44 | end = .; 45 | 46 | /DISCARD/ : 47 | { 48 | *(.comment) 49 | *(.eh_frame) 50 | *(.note.gnu.build-id) 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /kernel/arch/aarch64/rpi400/link.ld: -------------------------------------------------------------------------------- 1 | OUTPUT_FORMAT(elf64-littleaarch64) 2 | ENTRY(start) 3 | 4 | SECTIONS 5 | { 6 | . = 0x80000; 7 | phys = .; 8 | 9 | .text BLOCK(4K) : ALIGN(4K) 10 | { 11 | *(.bootstrap) 12 | code = .; 13 | *(.text) 14 | } 15 | 16 | .rodata BLOCK(4K) : ALIGN(4K) 17 | { 18 | *(.rodata) 19 | } 20 | 21 | .data BLOCK(4K) : ALIGN(4K) 22 | { 23 | data = .; 24 | *(.data) 25 | *(.symbols) 26 | PROVIDE(kernel_symbols_start = .); 27 | PROVIDE(kernel_symbols_end = .); 28 | PROVIDE(bss_start = .); 29 | } 30 | 31 | __bss_start = .; 32 | .bss BLOCK(4K) : ALIGN(4K) 33 | { 34 | bss = .; 35 | *(COMMON) 36 | *(.bss) 37 | *(.stack) 38 | } 39 | __bss_end = .; 40 | __bss_size = __bss_end - __bss_start; 41 | 42 | /* Some built-in stack space... */ 43 | . = ALIGN(0x1000); 44 | . = . + 0x1000; 45 | __bootstrap_stack_top = .; 46 | 47 | end = .; 48 | 49 | /DISCARD/ : 50 | { 51 | *(.comment) 52 | *(.eh_frame) 53 | *(.note.gnu.build-id) 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /kernel/arch/aarch64/rpi400/start.S: -------------------------------------------------------------------------------- 1 | .extern __bootstrap_stack_top 2 | .extern __bss_start 3 | .extern __bss_size 4 | 5 | .section ".bootstrap" 6 | .globl start 7 | start: 8 | ldr x30, =__bootstrap_stack_top 9 | mov x1, x4 10 | mov sp, x30 11 | ldr x5, =__bss_start 12 | ldr w6, =__bss_size 13 | 3: 14 | cbz w6, 4f 15 | str xzr, [x5], #8 16 | sub w6, w6, #1 17 | cbnz w6, 3b 18 | 4: 19 | bl kmain 20 | hang: 21 | b hang 22 | 23 | .section ".rodata" 24 | .align 12 25 | .globl _kernel_start 26 | _kernel_start: 27 | .incbin "misaka-kernel" 28 | .globl _kernel_end 29 | _kernel_end: 30 | 31 | .align 12 32 | .globl _ramdisk_start 33 | _ramdisk_start: 34 | .incbin "ramdisk.igz" 35 | .global _ramdisk_end 36 | _ramdisk_end: 37 | -------------------------------------------------------------------------------- /kernel/misc/assert.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file kernel/misc/assert.h 3 | * @brief Kernel assertion handler. 4 | * 5 | * @copyright 6 | * This file is part of ToaruOS and is released under the terms 7 | * of the NCSA / University of Illinois License - see LICENSE.md 8 | * Copyright (C) 2021 K. Lange 9 | */ 10 | #include 11 | #include 12 | #include 13 | 14 | void __assert_failed(const char * file, int line, const char * func, const char * cond) { 15 | arch_fatal_prepare(); 16 | dprintf("%s:%d (%s) Assertion failed: %s\n", file, line, func, cond); 17 | arch_dump_traceback(); 18 | arch_fatal(); 19 | } 20 | -------------------------------------------------------------------------------- /kernel/misc/tokenize.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file kernel/misc/tokenize.c 3 | * @brief Wrapper around strtok_r, used to turn strings into arrays. 4 | * 5 | * @copyright 6 | * This file is part of ToaruOS and is released under the terms 7 | * of the NCSA / University of Illinois License - see LICENSE.md 8 | * Copyright (C) 2015-2021 K. Lange 9 | */ 10 | #include 11 | #include 12 | 13 | int tokenize(char * str, const char * sep, char **buf) { 14 | char * pch_i; 15 | char * save_i; 16 | int argc = 0; 17 | pch_i = strtok_r(str,sep,&save_i); 18 | if (!pch_i) { return 0; } 19 | while (pch_i != NULL) { 20 | buf[argc] = (char *)pch_i; 21 | ++argc; 22 | pch_i = strtok_r(NULL,sep,&save_i); 23 | } 24 | buf[argc] = NULL; 25 | return argc; 26 | } 27 | -------------------------------------------------------------------------------- /lib/rline_exp.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @brief Dummy library to provide rline to Python, but 3 | * our Python port is currently on hold. 4 | * 5 | * This file is part of ToaruOS and is released under the terms 6 | * of the NCSA / University of Illinois License - see LICENSE.md 7 | * @copyright 2018-2021 K. Lange 8 | */ 9 | #include 10 | #include 11 | 12 | void * rline_exp_for_python(void * _stdin, void * _stdout, char * prompt) { 13 | 14 | rline_exp_set_prompts(prompt, "", strlen(prompt), 0); 15 | 16 | char * buf = malloc(1024); 17 | memset(buf, 0, 1024); 18 | 19 | rline_exp_set_syntax("python"); 20 | rline_exit_string = ""; 21 | rline(buf, 1024); 22 | rline_history_insert(strdup(buf)); 23 | rline_scroll = 0; 24 | 25 | return buf; 26 | } 27 | 28 | char * rline_exit_string; 29 | int rline_history_count; 30 | -------------------------------------------------------------------------------- /libc/arch/aarch64/crt0.S: -------------------------------------------------------------------------------- 1 | .global _start 2 | .type _start, %function 3 | 4 | _start: 5 | mov x4, x0 6 | adr x0, main 7 | mov x3, x0 8 | mov x0, x4 9 | bl pre_main 10 | -------------------------------------------------------------------------------- /libc/arch/aarch64/crti.S: -------------------------------------------------------------------------------- 1 | .global _init 2 | .section .init 3 | _init: 4 | stp x29,x30,[sp,-16]! 5 | mov x29,sp 6 | 7 | .global _fini 8 | .section .fini 9 | _fini: 10 | stp x29,x30,[sp,-16]! 11 | mov x29,sp 12 | 13 | -------------------------------------------------------------------------------- /libc/arch/aarch64/crtn.S: -------------------------------------------------------------------------------- 1 | .section .init 2 | ldp x29,x30,[sp],#16 3 | ret 4 | 5 | .section .fini 6 | ldp x29,x30,[sp],#16 7 | ret 8 | 9 | -------------------------------------------------------------------------------- /libc/arch/aarch64/memcpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | void * memcpy(void * restrict dest, const void * restrict src, size_t n) { 6 | uint64_t * d_64 = dest; 7 | const uint64_t * s_64 = src; 8 | 9 | for (; n >= 8; n -= 8) { 10 | *d_64++ = *s_64++; 11 | } 12 | 13 | uint32_t * d_32 = (void*)d_64; 14 | const uint32_t * s_32 = (const void*)s_64; 15 | 16 | for (; n >= 4; n -= 4) { 17 | *d_32++ = *s_32++; 18 | } 19 | 20 | uint8_t * d = (void*)d_32; 21 | const uint8_t * s = (const void*)s_32; 22 | 23 | for (; n > 0; n--) { 24 | *d++ = *s++; 25 | } 26 | 27 | return dest; 28 | } 29 | -------------------------------------------------------------------------------- /libc/arch/aarch64/memset.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void * memset(void * dest, int c, size_t n) { 4 | size_t i = 0; 5 | for ( ; i < n; ++i ) { 6 | ((char *)dest)[i] = c; 7 | } 8 | return dest; 9 | } 10 | -------------------------------------------------------------------------------- /libc/arch/x86_64/crt0.S: -------------------------------------------------------------------------------- 1 | .global _start 2 | 3 | _start: 4 | movq $main, %rcx 5 | and $0xFFFFFFFFFFFFFFF0, %rsp 6 | call pre_main /* call pre_main */ 7 | 8 | 9 | -------------------------------------------------------------------------------- /libc/arch/x86_64/crti.S: -------------------------------------------------------------------------------- 1 | .global _init 2 | .section .init 3 | _init: 4 | push %rbp 5 | movq %rsp, %rbp 6 | 7 | .global _fini 8 | .section .fini 9 | _fini: 10 | push %rbp 11 | movq %rsp, %rbp 12 | -------------------------------------------------------------------------------- /libc/arch/x86_64/crtn.S: -------------------------------------------------------------------------------- 1 | .section .init 2 | pop %rbp 3 | ret 4 | 5 | .section .fini 6 | pop %rbp 7 | ret 8 | 9 | -------------------------------------------------------------------------------- /libc/arch/x86_64/memcpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void * memcpy(void * restrict dest, const void * restrict src, size_t n) { 4 | asm volatile("cld; rep movsb" 5 | : "=c"((int){0}) 6 | : "D"(dest), "S"(src), "c"(n) 7 | : "flags", "memory"); 8 | return dest; 9 | } 10 | -------------------------------------------------------------------------------- /libc/arch/x86_64/memset.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void * memset(void * dest, int c, size_t n) { 4 | asm volatile("cld; rep stosb" 5 | : "=c"((int){0}) 6 | : "rdi"(dest), "a"(c), "c"(n) 7 | : "flags", "memory", "rdi"); 8 | return dest; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /libc/assert/assert.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void __assert_func(const char * file, int line, const char * func, const char * failedexpr) { 5 | fprintf(stderr, "Assertion failed in %s:%d (%s): %s\n", file, line, func, failedexpr); 6 | exit(1); 7 | } 8 | -------------------------------------------------------------------------------- /libc/ctype/_ctype.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | unsigned char _ctype_[256]= { 4 | _C, _C, _C, _C, _C, _C, _C, _C, 5 | _C, _C|_S, _C|_S, _C|_S, _C|_S, _C|_S, _C, _C, 6 | _C, _C, _C, _C, _C, _C, _C, _C, 7 | _C, _C, _C, _C, _C, _C, _C, _C, 8 | _S|_B, _P, _P, _P, _P, _P, _P, _P, 9 | _P, _P, _P, _P, _P, _P, _P, _P, 10 | _N, _N, _N, _N, _N, _N, _N, _N, 11 | _N, _N, _P, _P, _P, _P, _P, _P, 12 | _P, _U|_X, _U|_X, _U|_X, _U|_X, _U|_X, _U|_X, _U, 13 | _U, _U, _U, _U, _U, _U, _U, _U, 14 | _U, _U, _U, _U, _U, _U, _U, _U, 15 | _U, _U, _U, _P, _P, _P, _P, _P, 16 | _P, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L, 17 | _L, _L, _L, _L, _L, _L, _L, _L, 18 | _L, _L, _L, _L, _L, _L, _L, _L, 19 | _L, _L, _L, _P, _P, _P, _P, _C 20 | }; 21 | -------------------------------------------------------------------------------- /libc/ctype/isalnum.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int isalnum(int c) { 4 | return isalpha(c) || isdigit(c); 5 | } 6 | -------------------------------------------------------------------------------- /libc/ctype/isalpha.c: -------------------------------------------------------------------------------- 1 | int isalpha(int c) { 2 | return ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')); 3 | } 4 | -------------------------------------------------------------------------------- /libc/ctype/isascii.c: -------------------------------------------------------------------------------- 1 | int isascii(int c) { 2 | return (c <= 0x7f); 3 | } 4 | -------------------------------------------------------------------------------- /libc/ctype/iscntrl.c: -------------------------------------------------------------------------------- 1 | int iscntrl(int c) { 2 | return ((c >= 0 && c <= 0x1f) || (c == 0x7f)); 3 | } 4 | -------------------------------------------------------------------------------- /libc/ctype/isdigit.c: -------------------------------------------------------------------------------- 1 | int isdigit(int c) { 2 | return (c >= '0' && c <= '9'); 3 | } 4 | -------------------------------------------------------------------------------- /libc/ctype/isgraph.c: -------------------------------------------------------------------------------- 1 | int isgraph(int c) { 2 | return (c >= '!' && c <= '~'); 3 | } 4 | -------------------------------------------------------------------------------- /libc/ctype/islower.c: -------------------------------------------------------------------------------- 1 | int islower(int c) { 2 | return (c >= 'a' && c <= 'z'); 3 | } 4 | -------------------------------------------------------------------------------- /libc/ctype/isprint.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int isprint(int c) { 4 | return isgraph(c) || c == ' '; 5 | } 6 | -------------------------------------------------------------------------------- /libc/ctype/ispunct.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int ispunct(int c) { 4 | return isgraph(c) && !isalnum(c); 5 | } 6 | -------------------------------------------------------------------------------- /libc/ctype/isspace.c: -------------------------------------------------------------------------------- 1 | int isspace(int c) { 2 | return (c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v' || c == ' '); 3 | } 4 | -------------------------------------------------------------------------------- /libc/ctype/isupper.c: -------------------------------------------------------------------------------- 1 | int isupper(int c) { 2 | return (c >= 'A' && c <= 'Z'); 3 | } 4 | -------------------------------------------------------------------------------- /libc/ctype/isxdigit.c: -------------------------------------------------------------------------------- 1 | int isxdigit(int c) { 2 | return ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F')); 3 | } 4 | -------------------------------------------------------------------------------- /libc/ctype/tolower.c: -------------------------------------------------------------------------------- 1 | int tolower(int c) { 2 | if (c >= 'A' && c <= 'Z') { 3 | return c - 'A' + 'a'; 4 | } 5 | return c; 6 | } 7 | -------------------------------------------------------------------------------- /libc/ctype/toupper.c: -------------------------------------------------------------------------------- 1 | int toupper(int c) { 2 | if (c >= 'a' && c <= 'z') { 3 | return c - 'a' + 'A'; 4 | } 5 | return c; 6 | } 7 | 8 | -------------------------------------------------------------------------------- /libc/dirent/mkdir.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | DEFN_SYSCALL2(mkdir, SYS_MKDIR, char *, unsigned int); 7 | 8 | int mkdir(const char *pathname, mode_t mode) { 9 | __sets_errno(syscall_mkdir((char *)pathname, mode)); 10 | } 11 | -------------------------------------------------------------------------------- /libc/dlfcn/dlfcn.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Stub library for providing dlopen, dlclose, dlsym. 3 | */ 4 | 5 | #include 6 | 7 | static char * error = "dlopen functions not available"; 8 | 9 | void * __attribute__((weak)) dlopen(const char * filename, int flags) { 10 | return NULL; 11 | } 12 | 13 | int __attribute__((weak)) dlclose(void * handle) { 14 | return -1; 15 | } 16 | 17 | void * dlsym(void * handle, const char * symbol) { 18 | return NULL; 19 | } 20 | 21 | char * dlerror(void) { 22 | return error; 23 | } 24 | 25 | int __cxa_atexit(void (*fn)(void *), void * arg, void *d) { 26 | return 0; 27 | } 28 | 29 | void __ld_symbol_table(void) { } 30 | void __ld_objects_table(void) { } 31 | -------------------------------------------------------------------------------- /libc/errno/errorno.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int errno = 0; 4 | -------------------------------------------------------------------------------- /libc/iconv/iconv.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | struct _iconv_state { 6 | char *tocode; 7 | char *fromcode; 8 | }; 9 | 10 | iconv_t iconv_open(const char *tocode, const char *fromcode) { 11 | errno = EINVAL; 12 | return (iconv_t)-1; 13 | 14 | #if 0 15 | struct _iconv_state * state = malloc(sizeof(struct _iconv_state)); 16 | 17 | state->tocode = strdup(tocode); 18 | state->fromcode = strdup(fromcode); 19 | 20 | return (iconv_t)state; 21 | #endif 22 | } 23 | 24 | int iconv_close(iconv_t cd) { 25 | struct _iconv_state * state = (struct _iconv_state*)cd; 26 | 27 | free(state->tocode); 28 | free(state->fromcode); 29 | 30 | free(cd); 31 | 32 | return 0; 33 | } 34 | 35 | size_t iconv(iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) { 36 | return -1; 37 | } 38 | -------------------------------------------------------------------------------- /libc/libgen/basename.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | char * basename(char * path) { 6 | char * s = path; 7 | char * c = NULL; 8 | do { 9 | while (*s == '/') { 10 | *s = '\0'; s++; 11 | if (!*s) goto _done; 12 | } 13 | c = s; 14 | s = strchr(c,'/'); 15 | } while (s); 16 | 17 | _done: 18 | 19 | if (!c) { 20 | return "/"; 21 | } 22 | 23 | return c; 24 | } 25 | -------------------------------------------------------------------------------- /libc/libgen/dirname.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | char * dirname(char * path) { 6 | int has_slash = 0; 7 | char * c = path; 8 | while (*c) { 9 | if (*c == '/') { 10 | has_slash = 1; 11 | } 12 | c++; 13 | } 14 | if (!has_slash) { 15 | return "."; 16 | } 17 | 18 | c--; 19 | while (*c == '/') { 20 | *c = '\0'; 21 | if (c == path) break; 22 | c--; 23 | } 24 | 25 | if (c == path) { 26 | return "/"; 27 | } 28 | 29 | /* All trailing slashes are cleared out */ 30 | while (*c != '/') { 31 | *c = '\0'; 32 | if (c == path) break; 33 | c--; 34 | } 35 | 36 | if (c == path) { 37 | if (*c == '/') return "/"; 38 | return "."; 39 | } 40 | 41 | while (*c == '/') { 42 | if (c == path) return "/"; 43 | *c = '\0'; 44 | c--; 45 | } 46 | 47 | return path; 48 | } 49 | -------------------------------------------------------------------------------- /libc/libintl/libintl.c: -------------------------------------------------------------------------------- 1 | /* Stub. */ 2 | #include 3 | 4 | char * gettext (const char * msgid) { 5 | return (char*)msgid; 6 | } 7 | 8 | char * dgettext (const char * domainname, const char * msgid) { 9 | return (char*)msgid; 10 | } 11 | 12 | char * dcgettext (const char * domainname, const char * msgid, int category) { 13 | return (char*)msgid; 14 | } 15 | 16 | char * ngettext (const char * msgid, const char * msgid_plural, unsigned long int n) { 17 | if (n != 1) return (char*)msgid_plural; 18 | return (char*)msgid; 19 | } 20 | 21 | char * dngettext (const char * domainname, const char * msgid, const char * msgid_plural, unsigned long int n) { 22 | if (n != 1) return (char*)msgid_plural; 23 | return (char*)msgid; 24 | } 25 | 26 | char * dcngettext (const char * domainname, const char * msgid, const char * msgid_plural, unsigned long int n, int category) { 27 | if (n != 1) return (char*)msgid_plural; 28 | return (char*)msgid; 29 | } 30 | -------------------------------------------------------------------------------- /libc/locale/localeconv.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static struct lconv _en_US = { 4 | .decimal_point = ".", 5 | .thousands_sep = ",", 6 | .grouping = "\x03\x03", 7 | .int_curr_symbol = "USD ", 8 | .currency_symbol = "$", 9 | .mon_decimal_point = ".", 10 | .mon_thousands_sep = ",", 11 | .mon_grouping = "\x03\x03", 12 | .positive_sign = "+", 13 | .negative_sign = "-", 14 | .int_frac_digits = 2, 15 | .frac_digits = 2, 16 | .p_cs_precedes = 1, 17 | .p_sep_by_space = 0, 18 | .n_cs_precedes = 1, 19 | .n_sep_by_space = 0, 20 | .p_sign_posn = 1, 21 | .n_sign_posn = 1, 22 | }; 23 | 24 | struct lconv * localeconv(void) { 25 | return &_en_US; 26 | } 27 | -------------------------------------------------------------------------------- /libc/locale/setlocale.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char * setlocale(int category, const char *locale) { 5 | return "en_US"; 6 | } 7 | 8 | -------------------------------------------------------------------------------- /libc/pty/pty.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | DEFN_SYSCALL5(openpty, SYS_OPENPTY, int *, int *, char *, void *, void *); 8 | 9 | int openpty(int * amaster, int * aslave, char * name, const struct termios *termp, const struct winsize * winp) { 10 | __sets_errno(syscall_openpty(amaster,aslave,name,(struct termios *)termp,(struct winsize *)winp)); 11 | } 12 | -------------------------------------------------------------------------------- /libc/sched/sched_yield.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | DEFN_SYSCALL0(yield, SYS_YIELD); 7 | 8 | int sched_yield(void) { 9 | __sets_errno(syscall_yield()); 10 | } 11 | -------------------------------------------------------------------------------- /libc/signal/kill.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | DEFN_SYSCALL2(kill, SYS_KILL, int, int); 7 | 8 | int kill(int pid, int sig) { 9 | __sets_errno(syscall_kill(pid, sig)); 10 | } 11 | 12 | -------------------------------------------------------------------------------- /libc/signal/raise.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int raise(int sig) { 5 | return kill(getpid(), sig); 6 | } 7 | -------------------------------------------------------------------------------- /libc/signal/sigaction.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | DEFN_SYSCALL3(sigaction, SYS_SIGACTION, int, struct sigaction*, struct sigaction*); 7 | 8 | int sigaction(int signum, struct sigaction *act, struct sigaction *oldact) { 9 | __sets_errno(syscall_sigaction(signum, act, oldact)); 10 | } 11 | 12 | -------------------------------------------------------------------------------- /libc/signal/signal.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | DEFN_SYSCALL2(signal, SYS_SIGNAL, int, void *); 6 | 7 | /* XXX This syscall interface is screwy, doesn't allow for good errno handling */ 8 | sighandler_t signal(int signum, sighandler_t handler) { 9 | return (sighandler_t)syscall_signal(signum, (void *)handler); 10 | } 11 | -------------------------------------------------------------------------------- /libc/signal/sigpending.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | DEFN_SYSCALL1(sigpending, SYS_SIGPENDING, sigset_t *); 7 | 8 | int sigpending(sigset_t * set) { 9 | __sets_errno(syscall_sigpending(set)); 10 | } 11 | 12 | 13 | -------------------------------------------------------------------------------- /libc/signal/sigprocmask.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | DEFN_SYSCALL3(sigprocmask, SYS_SIGPROCMASK, int, const sigset_t * restrict, sigset_t* restrict); 8 | 9 | int sigprocmask(int how, const sigset_t * restrict set, sigset_t * restrict oset) { 10 | __sets_errno(syscall_sigprocmask(how,set,oset)); 11 | } 12 | -------------------------------------------------------------------------------- /libc/signal/sigset.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int sigemptyset(sigset_t * set) { 7 | *set = 0; 8 | return 0; 9 | } 10 | 11 | int sigfillset(sigset_t * set) { 12 | memset(set, 0xFF, sizeof(sigset_t)); 13 | return 0; 14 | } 15 | 16 | int sigaddset(sigset_t * set, int signum) { 17 | if (signum > NUMSIGNALS) return -EINVAL; 18 | *set |= (1UL << signum); 19 | return 0; 20 | } 21 | 22 | int sigdelset(sigset_t * set, int signum) { 23 | if (signum > NUMSIGNALS) return -EINVAL; 24 | *set &= ~(1UL << signum); 25 | return 0; 26 | } 27 | 28 | int sigismember(sigset_t * set, int signum) { 29 | if (signum > NUMSIGNALS) return -EINVAL; 30 | return !!(*set & (1UL << signum)); 31 | } 32 | -------------------------------------------------------------------------------- /libc/signal/sigsuspend.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | DEFN_SYSCALL1(sigsuspend, SYS_SIGSUSPEND,const sigset_t *); 8 | 9 | int sigsuspend(const sigset_t * restrict set) { 10 | __sets_errno(syscall_sigsuspend(set)); 11 | } 12 | 13 | DEFN_SYSCALL2(sigwait,SYS_SIGWAIT,const sigset_t *,int *); 14 | 15 | int sigwait(const sigset_t * set, int * sig) { 16 | int res; 17 | do { 18 | res = syscall_sigwait(set,sig); 19 | } while (res == -EINTR); 20 | 21 | if (res < 0) { 22 | res = -res; 23 | errno = res; 24 | } 25 | 26 | return res; 27 | } 28 | -------------------------------------------------------------------------------- /libc/stdio/perror.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void perror(const char *s) { 5 | fprintf(stderr, "%s: %s\n", s, strerror(errno)); 6 | } 7 | -------------------------------------------------------------------------------- /libc/stdio/puts.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int puts(const char *s) { 5 | /* eof? */ 6 | fwrite(s, 1, strlen(s), stdout); 7 | fwrite("\n", 1, 1, stdout); 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /libc/stdio/remove.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int remove(const char * pathname) { 5 | /* TODO directories */ 6 | return unlink(pathname); 7 | } 8 | -------------------------------------------------------------------------------- /libc/stdio/rename.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* TODO */ 4 | 5 | int rename(const char * oldpath, const char * newpath) { 6 | /* Unsupported */ 7 | return -1; 8 | } 9 | -------------------------------------------------------------------------------- /libc/stdio/tmpfile.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | FILE * tmpfile(void) { 5 | static int tmpfile_num = 1; 6 | 7 | char tmp[100]; 8 | sprintf(tmp, "/tmp/tmp%d.%d", getpid(), tmpfile_num++); 9 | 10 | FILE * out = fopen(tmp, "w+b"); 11 | 12 | unlink(tmp); 13 | 14 | return out; 15 | } 16 | -------------------------------------------------------------------------------- /libc/stdio/tmpnam.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | static char _internal[L_tmpnam]; 5 | 6 | char * tmpnam(char * s) { 7 | static int tmp_id = 1; 8 | 9 | if (!s) { 10 | s = _internal; 11 | } 12 | 13 | sprintf(s, "/tmp/tmp%d.%d", getpid(), tmp_id++); 14 | 15 | return s; 16 | } 17 | -------------------------------------------------------------------------------- /libc/stdlib/abort.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void abort(void) { 5 | syscall_exit(-1); 6 | __builtin_unreachable(); 7 | } 8 | -------------------------------------------------------------------------------- /libc/stdlib/atexit.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static void (*_atexit_handlers[32])(void) = {NULL}; 4 | static int _atexit_count = 0; 5 | 6 | void _handle_atexit(void) { 7 | if (!_atexit_count) return; 8 | do { 9 | _atexit_count--; 10 | _atexit_handlers[_atexit_count](); 11 | } while (_atexit_count); 12 | } 13 | 14 | int atexit(void (*h)(void)) { 15 | if (_atexit_count == ATEXIT_MAX) return 1; 16 | _atexit_handlers[_atexit_count++] = h; 17 | return 0; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /libc/stdlib/atof.c: -------------------------------------------------------------------------------- 1 | /* Really bad atof */ 2 | 3 | #include 4 | 5 | double atof(const char * nptr) { 6 | return strtod(nptr, NULL); 7 | } 8 | -------------------------------------------------------------------------------- /libc/stdlib/bsearch.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void *bsearch(const void *key, const void *base, size_t nmemb, size_t size, 4 | int (*compar)(const void *, const void *)) { 5 | /* Stupid naive implementation */ 6 | const char * b = base; 7 | size_t i = 0; 8 | while (i < nmemb) { 9 | const void * a = b; 10 | if (!compar(key,a)) return (void *)a; 11 | i++; 12 | b += size; 13 | } 14 | return NULL; 15 | } 16 | -------------------------------------------------------------------------------- /libc/stdlib/div.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | div_t div(int numerator, int denominator) { 4 | div_t out; 5 | out.quot = numerator / denominator; 6 | out.rem = numerator % denominator; 7 | 8 | if (numerator >= 0 && out.rem < 0) { 9 | out.quot++; 10 | out.rem -= denominator; 11 | } else if (numerator < 0 && out.rem > 0) { 12 | out.quot--; 13 | out.rem += denominator; 14 | } 15 | 16 | return out; 17 | } 18 | 19 | ldiv_t ldiv(long numerator, long denominator) { 20 | ldiv_t out; 21 | out.quot = numerator / denominator; 22 | out.rem = numerator % denominator; 23 | 24 | if (numerator >= 0 && out.rem < 0) { 25 | out.quot++; 26 | out.rem -= denominator; 27 | } else if (numerator < 0 && out.rem > 0) { 28 | out.quot--; 29 | out.rem += denominator; 30 | } 31 | 32 | return out; 33 | } 34 | -------------------------------------------------------------------------------- /libc/stdlib/getenv.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | extern char ** environ; 5 | 6 | char * getenv(const char *name) { 7 | char ** e = environ; 8 | size_t len = strlen(name); 9 | while (*e) { 10 | char * t = *e; 11 | if (strstr(t, name) == *e) { 12 | if (t[len] == '=') { 13 | return &t[len+1]; 14 | } 15 | } 16 | e++; 17 | } 18 | return NULL; 19 | } 20 | -------------------------------------------------------------------------------- /libc/stdlib/labs.c: -------------------------------------------------------------------------------- 1 | long int labs(long int j) { 2 | return (j < 0) ? -j : j; 3 | } 4 | -------------------------------------------------------------------------------- /libc/stdlib/mktemp.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | char * mktemp(char * template) { 9 | if (strstr(template + strlen(template)-6, "XXXXXX") != template + strlen(template) - 6) { 10 | errno = EINVAL; 11 | return NULL; 12 | } 13 | static int _i = 0; 14 | char tmp[7] = {0}; 15 | sprintf(tmp,"%04d%02d", getpid(), _i++); 16 | memcpy(template + strlen(template) - 6, tmp, 6); 17 | return template; 18 | } 19 | 20 | int mkstemp(char * template) { 21 | mktemp(template); 22 | return open(template, O_RDWR | O_CREAT, 0600); 23 | } 24 | -------------------------------------------------------------------------------- /libc/stdlib/rand.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | static uint32_t x = 123456789; 6 | static uint32_t y = 362436069; 7 | static uint32_t z = 521288629; 8 | static uint32_t w = 88675123; 9 | 10 | int rand(void) { 11 | uint32_t t; 12 | 13 | t = x ^ (x << 11); 14 | x = y; y = z; z = w; 15 | w = w ^ (w >> 19) ^ t ^ (t >> 8); 16 | 17 | return (w & RAND_MAX); 18 | } 19 | 20 | void srand(unsigned int seed) { 21 | x = 123456789 ^ (seed << 16) ^ (seed >> 16); 22 | y = 362436069; 23 | z = 521288629; 24 | w = 88675123; 25 | } 26 | -------------------------------------------------------------------------------- /libc/stdlib/setenv.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int setenv(const char *name, const char *value, int overwrite) { 5 | if (!overwrite) { 6 | char * tmp = getenv(name); 7 | if (tmp) 8 | return 0; 9 | } 10 | char * tmp = malloc(strlen(name) + strlen(value) + 2); 11 | *tmp = '\0'; 12 | strcat(tmp, name); 13 | strcat(tmp, "="); 14 | strcat(tmp, value); 15 | return putenv(tmp); 16 | } 17 | -------------------------------------------------------------------------------- /libc/stdlib/system.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | int system(const char * command) { 8 | char * args[] = { 9 | "/bin/sh", 10 | "-c", 11 | (char *)command, 12 | NULL, 13 | }; 14 | pid_t pid = fork(); 15 | if (!pid) { 16 | execvp(args[0], args); 17 | exit(1); 18 | __builtin_unreachable(); /* With -ffreestanding, gcc doesn't realize exit() doesn't return. */ 19 | } else { 20 | int status; 21 | waitpid(pid, &status, 0); 22 | return WEXITSTATUS(status); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /libc/string/strncmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int strncmp(const char *s1, const char *s2, size_t n) { 4 | if (n == 0) return 0; 5 | 6 | while (n-- && *s1 == *s2) { 7 | if (!n || !*s1) break; 8 | s1++; 9 | s2++; 10 | } 11 | return (*(unsigned char *)s1) - (*(unsigned char *)s2); 12 | } 13 | -------------------------------------------------------------------------------- /libc/string/strncpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char * strncpy(char * dest, const char * src, size_t n) { 4 | char * out = dest; 5 | while (n > 0) { 6 | if (!*src) break; 7 | *out = *src; 8 | ++out; 9 | ++src; 10 | --n; 11 | } 12 | for (int i = 0; i < (int)n; ++i) { 13 | *out = '\0'; 14 | ++out; 15 | } 16 | return out; 17 | } 18 | -------------------------------------------------------------------------------- /libc/string/strxfrm.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /** 4 | * We only really support the "C" locale, so this is always 5 | * just a dumb memcpy. 6 | */ 7 | size_t strxfrm(char *dest, const char *src, size_t n) { 8 | size_t i = 0; 9 | while (*src && i < n) { 10 | *dest = *src; 11 | dest++; 12 | src++; 13 | i++; 14 | } 15 | if (i < n) { 16 | *dest = '\0'; 17 | } 18 | return i; 19 | } 20 | -------------------------------------------------------------------------------- /libc/strings/strcasecmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int strcasecmp(const char * s1, const char * s2) { 5 | for (; tolower(*s1) == tolower(*s2) && *s1; s1++, s2++); 6 | return *(unsigned char *)s1 - *(unsigned char *)s2; 7 | } 8 | 9 | int strncasecmp(const char *s1, const char *s2, size_t n) { 10 | if (n == 0) return 0; 11 | 12 | while (n-- && tolower(*s1) == tolower(*s2)) { 13 | if (!n || !*s1) break; 14 | s1++; 15 | s2++; 16 | } 17 | return (unsigned int)tolower(*s1) - (unsigned int)tolower(*s2); 18 | } 19 | -------------------------------------------------------------------------------- /libc/sys/fswait.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | DEFN_SYSCALL2(fswait, SYS_FSWAIT, int, int *); 7 | DEFN_SYSCALL3(fswait2, SYS_FSWAIT2, int, int *,int); 8 | DEFN_SYSCALL4(fswait3, SYS_FSWAIT3, int, int *, int, int *); 9 | 10 | int fswait(int count, int * fds) { 11 | __sets_errno(syscall_fswait(count, fds)); 12 | } 13 | 14 | int fswait2(int count, int * fds, int timeout) { 15 | __sets_errno(syscall_fswait2(count, fds, timeout)); 16 | } 17 | 18 | int fswait3(int count, int * fds, int timeout, int * out) { 19 | __sets_errno(syscall_fswait3(count, fds, timeout, out)); 20 | } 21 | -------------------------------------------------------------------------------- /libc/sys/mount.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | DEFN_SYSCALL5(mount, SYS_MOUNT, char *, char *, char *, unsigned long, void *); 6 | 7 | int mount(char * source, char * target, char * type, unsigned long flags, void * data) { 8 | __sets_errno(syscall_mount(source, target, type, flags, data)); 9 | } 10 | 11 | -------------------------------------------------------------------------------- /libc/sys/ptrace.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | DEFN_SYSCALL4(ptrace, SYS_PTRACE, int, int, void *, void *); 7 | 8 | long ptrace(enum __ptrace_request request, pid_t pid, void * addr, void * data) { 9 | __sets_errno(syscall_ptrace(request,pid,addr,data)); 10 | } 11 | -------------------------------------------------------------------------------- /libc/sys/reboot.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | DEFN_SYSCALL0(reboot, SYS_REBOOT); 6 | 7 | /* TODO: define reboot() */ 8 | -------------------------------------------------------------------------------- /libc/sys/shm.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | DEFN_SYSCALL2(shm_obtain, SYS_SHM_OBTAIN, const char *, size_t *); 5 | DEFN_SYSCALL1(shm_release, SYS_SHM_RELEASE, const char *); 6 | 7 | void * shm_obtain(const char * path, size_t * size) { 8 | return (void *)syscall_shm_obtain(path, size); 9 | } 10 | 11 | int shm_release(const char * path) { 12 | return syscall_shm_release(path); 13 | } 14 | -------------------------------------------------------------------------------- /libc/sys/sysfunc.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | DEFN_SYSCALL2(sysfunc, SYS_SYSFUNC, int, char **); 7 | 8 | extern int sysfunc(int command, char ** args) { 9 | __sets_errno(syscall_sysfunc(command, args)); 10 | } 11 | -------------------------------------------------------------------------------- /libc/sys/uname.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | DEFN_SYSCALL1(uname, SYS_UNAME, void *); 6 | 7 | int uname(struct utsname *__name) { 8 | return syscall_uname((void *)__name); 9 | } 10 | -------------------------------------------------------------------------------- /libc/sys/wait.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | DEFN_SYSCALL3(waitpid, SYS_WAITPID, int, int *, int); 6 | 7 | int waitpid(int pid, int *status, int options) { 8 | /* XXX: status, options? */ 9 | __sets_errno(syscall_waitpid(pid, status, options)); 10 | } 11 | 12 | int wait(int *status) { 13 | return waitpid(-1, status, 0); 14 | } 15 | -------------------------------------------------------------------------------- /libc/time/clock.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | clock_t clock(void) { 5 | struct tms timeValues; 6 | times(&timeValues); 7 | return timeValues.tms_utime; 8 | } 9 | -------------------------------------------------------------------------------- /libc/time/clock_gettime.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int clock_getres(clockid_t clk_id, struct timespec *res) { 6 | if (clk_id < 0 || clk_id > 1) { 7 | errno = EINVAL; 8 | return -1; 9 | } 10 | 11 | res->tv_sec = 0; 12 | res->tv_nsec = 1000; 13 | return 0; 14 | } 15 | 16 | int clock_gettime(clockid_t clk_id, struct timespec *tp) { 17 | if (clk_id < 0 || clk_id > 1) { 18 | errno = EINVAL; 19 | return -1; 20 | } 21 | struct timeval t; 22 | gettimeofday(&t, NULL); 23 | 24 | tp->tv_sec = t.tv_sec; 25 | tp->tv_nsec = t.tv_usec * 1000; 26 | 27 | return 0; 28 | } 29 | -------------------------------------------------------------------------------- /libc/time/ctime.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* 5 | * TODO: Also supposed to set tz values... 6 | */ 7 | char * ctime(const time_t * timep) { 8 | return asctime(localtime(timep)); 9 | } 10 | -------------------------------------------------------------------------------- /libc/time/gettimeofday.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | DEFN_SYSCALL2(gettimeofday, SYS_GETTIMEOFDAY, void *, void *); 6 | 7 | int gettimeofday(struct timeval *p, void *z){ 8 | return syscall_gettimeofday(p,z); 9 | } 10 | 11 | -------------------------------------------------------------------------------- /libc/time/settimeofday.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | DEFN_SYSCALL2(settimeofday, SYS_SETTIMEOFDAY, void *, void *); 6 | 7 | int settimeofday(struct timeval *p, void *z){ 8 | return syscall_settimeofday(p,z); 9 | } 10 | 11 | 12 | -------------------------------------------------------------------------------- /libc/time/time.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | time_t time(time_t * out) { 5 | struct timeval p; 6 | gettimeofday(&p, NULL); 7 | if (out) { 8 | *out = p.tv_sec; 9 | } 10 | return p.tv_sec; 11 | } 12 | 13 | double difftime(time_t a, time_t b) { 14 | return (double)(a - b); 15 | } 16 | -------------------------------------------------------------------------------- /libc/time/times.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | DEFN_SYSCALL1(times, SYS_TIMES, struct tms *); 7 | 8 | clock_t times(struct tms * buf) { 9 | __sets_errno(syscall_times(buf)); 10 | } 11 | 12 | -------------------------------------------------------------------------------- /libc/unistd/access.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | DEFN_SYSCALL2(access, SYS_ACCESS, char *, int); 7 | 8 | int access(const char *pathname, int mode) { 9 | int result = syscall_access((char *)pathname, mode); 10 | if (result < 0) { 11 | errno = ENOENT; /* XXX */ 12 | return -1; 13 | } 14 | return result; 15 | } 16 | 17 | -------------------------------------------------------------------------------- /libc/unistd/alarm.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern char * _argv_0; 4 | 5 | unsigned int alarm(unsigned int seconds) { 6 | fprintf(stderr, "%s: alarm requested (%d seconds)\n", _argv_0, seconds); 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /libc/unistd/chdir.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | DEFN_SYSCALL1(chdir, SYS_CHDIR, char *); 7 | 8 | int chdir(const char *path) { 9 | __sets_errno(syscall_chdir((char*)path)); 10 | } 11 | 12 | -------------------------------------------------------------------------------- /libc/unistd/chmod.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | DEFN_SYSCALL2(chmod, SYS_CHMOD, char *, int); 7 | 8 | int chmod(const char *path, mode_t mode) { 9 | __sets_errno(syscall_chmod((char *)path, mode)); 10 | } 11 | 12 | -------------------------------------------------------------------------------- /libc/unistd/chown.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | DEFN_SYSCALL3(chown, SYS_CHOWN, char *, int, int); 7 | 8 | int chown(const char * pathname, uid_t owner, gid_t group) { 9 | __sets_errno(syscall_chown((char*)pathname,owner,group)); 10 | } 11 | 12 | -------------------------------------------------------------------------------- /libc/unistd/close.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | DEFN_SYSCALL1(close, SYS_CLOSE, int); 6 | 7 | int close(int file) { 8 | return syscall_close(file); 9 | } 10 | -------------------------------------------------------------------------------- /libc/unistd/creat.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int creat(const char *path, mode_t mode) { 5 | return open(path, O_WRONLY|O_CREAT|O_TRUNC, mode); 6 | } 7 | -------------------------------------------------------------------------------- /libc/unistd/dup2.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | DEFN_SYSCALL2(dup2, SYS_DUP2, int, int); 6 | 7 | int dup2(int oldfd, int newfd) { 8 | return syscall_dup2(oldfd, newfd); 9 | } 10 | 11 | int dup(int oldfd) { 12 | return dup2(oldfd, -1); 13 | } 14 | -------------------------------------------------------------------------------- /libc/unistd/exit.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void exit(int val) { 5 | _handle_atexit(); 6 | _exit(val); 7 | } 8 | -------------------------------------------------------------------------------- /libc/unistd/fcntl.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int fcntl(int fd, int cmd, ...) { 4 | switch (cmd) { 5 | case F_GETFD: 6 | return 0; 7 | case F_SETFD: 8 | return 0; 9 | } 10 | return -1; 11 | } 12 | -------------------------------------------------------------------------------- /libc/unistd/fork.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | DEFN_SYSCALL0(fork, SYS_FORK); 6 | 7 | pid_t fork(void) { 8 | return syscall_fork(); 9 | } 10 | -------------------------------------------------------------------------------- /libc/unistd/fstat.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | DEFN_SYSCALL2(stat, SYS_STAT, int, void *); 8 | 9 | int fstat(int file, struct stat *st) { 10 | __sets_errno(syscall_stat(file, st)); 11 | } 12 | -------------------------------------------------------------------------------- /libc/unistd/getcwd.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | DEFN_SYSCALL2(getcwd, SYS_GETCWD, char *, size_t); 7 | 8 | char *getcwd(char *buf, size_t size) { 9 | if (!buf) buf = malloc(size); 10 | return (char *)syscall_getcwd(buf, size); 11 | } 12 | 13 | -------------------------------------------------------------------------------- /libc/unistd/getegid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | DEFN_SYSCALL0(getegid, SYS_GETEGID); 6 | 7 | gid_t getegid(void) { 8 | return syscall_getegid(); 9 | } 10 | 11 | -------------------------------------------------------------------------------- /libc/unistd/geteuid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | DEFN_SYSCALL0(geteuid, SYS_GETEUID); 6 | 7 | uid_t geteuid(void) { 8 | return syscall_geteuid(); 9 | } 10 | -------------------------------------------------------------------------------- /libc/unistd/getgid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | DEFN_SYSCALL0(getgid, SYS_GETGID); 6 | 7 | gid_t getgid(void) { 8 | return syscall_getgid(); 9 | } 10 | 11 | -------------------------------------------------------------------------------- /libc/unistd/getgroups.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | DEFN_SYSCALL2(getgroups, SYS_GETGROUPS, int, gid_t *); 7 | 8 | int getgroups(int size, gid_t list[]) { 9 | __sets_errno(syscall_getgroups(size, list)); 10 | } 11 | 12 | -------------------------------------------------------------------------------- /libc/unistd/getlogin.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | static char _name[64]; /* NAME_MAX ? */ 8 | 9 | char * getlogin(void) { 10 | 11 | int tty = STDIN_FILENO; 12 | if (!isatty(tty)) { 13 | tty = STDOUT_FILENO; 14 | if (!isatty(tty)) { 15 | tty = STDERR_FILENO; 16 | if (!isatty(tty)) { 17 | errno = ENOTTY; 18 | return NULL; 19 | } 20 | } 21 | } 22 | 23 | char * name = ttyname(tty); 24 | if (!name) return NULL; 25 | 26 | /* Get the owner */ 27 | struct stat statbuf; 28 | stat(name, &statbuf); 29 | 30 | struct passwd * passwd = getpwuid(statbuf.st_uid); 31 | 32 | if (!passwd) return NULL; 33 | if (!passwd->pw_name) return NULL; 34 | 35 | memcpy(_name, passwd->pw_name, strlen(passwd->pw_name)); 36 | return _name; 37 | } 38 | -------------------------------------------------------------------------------- /libc/unistd/getopt.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | char * optarg = NULL; 5 | int optind = 1; 6 | int opterr = 1; 7 | int optopt = 0; 8 | 9 | int getopt(int argc, char * const argv[], const char * optstring) { 10 | return getopt_long(argc, argv, optstring, NULL, 0); 11 | } 12 | -------------------------------------------------------------------------------- /libc/unistd/getpgrp.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int getpgrp() { 4 | return getpgid(0); 5 | } 6 | -------------------------------------------------------------------------------- /libc/unistd/getpid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | DEFN_SYSCALL0(getpid, SYS_GETPID); 7 | 8 | pid_t getpid(void) { 9 | return syscall_getpid(); 10 | } 11 | 12 | pid_t getppid(void) { 13 | errno = ENOTSUP; 14 | return -1; 15 | } 16 | -------------------------------------------------------------------------------- /libc/unistd/getuid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | DEFN_SYSCALL0(getuid, SYS_GETUID); 6 | 7 | uid_t getuid(void) { 8 | return syscall_getuid(); 9 | } 10 | 11 | -------------------------------------------------------------------------------- /libc/unistd/getwd.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char *getwd(char *buf) { 4 | return getcwd(buf, 256); 5 | } 6 | -------------------------------------------------------------------------------- /libc/unistd/hostname.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | DEFN_SYSCALL1(sethostname, SYS_SETHOSTNAME, char *); 7 | DEFN_SYSCALL1(gethostname, SYS_GETHOSTNAME, char *); 8 | 9 | int gethostname(char * name, size_t len) { 10 | (void)len; /* TODO */ 11 | __sets_errno(syscall_gethostname(name)); 12 | } 13 | 14 | int sethostname(const char * name, size_t len) { 15 | (void)len; /* TODO */ 16 | __sets_errno(syscall_sethostname((char*)name)); 17 | } 18 | -------------------------------------------------------------------------------- /libc/unistd/isatty.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int isatty(int fd) { 6 | int dtype = ioctl(fd, IOCTLDTYPE, NULL); 7 | if (dtype == IOCTL_DTYPE_TTY) return 1; 8 | errno = EINVAL; 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /libc/unistd/link.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | // TODO: 5 | // We have a system call for this? 6 | int link(const char *old, const char *new) { 7 | errno = EMLINK; 8 | return -1; 9 | } 10 | -------------------------------------------------------------------------------- /libc/unistd/lseek.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | DEFN_SYSCALL3(seek, SYS_SEEK, int, long, int); 7 | 8 | off_t lseek(int file, off_t ptr, int dir) { 9 | __sets_errno(syscall_seek(file,ptr,dir)); 10 | } 11 | 12 | -------------------------------------------------------------------------------- /libc/unistd/open.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | DEFN_SYSCALL3(open, SYS_OPEN, const char *, int, int); 10 | 11 | int open(const char *name, int flags, ...) { 12 | va_list argp; 13 | int mode = 0; 14 | int result; 15 | va_start(argp, flags); 16 | if (flags & O_CREAT) mode = va_arg(argp, int); 17 | va_end(argp); 18 | 19 | result = syscall_open(name, flags, mode); 20 | if (result == -1) { 21 | /* Not sure this is necessary */ 22 | if (flags & O_CREAT) { 23 | errno = EACCES; 24 | } else { 25 | errno = ENOENT; 26 | } 27 | } else if (result < 0) { 28 | errno = -result; 29 | result = -1; 30 | } 31 | return result; 32 | } 33 | 34 | -------------------------------------------------------------------------------- /libc/unistd/pathconf.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | long pathconf(const char *path, int name) { 7 | switch (name) { 8 | case _PC_PATH_MAX: 9 | return PATH_MAX; 10 | default: 11 | errno = EINVAL; 12 | return -1; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /libc/unistd/pipe.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | DEFN_SYSCALL1(pipe, SYS_PIPE, int *); 7 | 8 | int pipe(int fildes[2]) { 9 | __sets_errno(syscall_pipe((int *)fildes)); 10 | } 11 | -------------------------------------------------------------------------------- /libc/unistd/pread.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | DEFN_SYSCALL4(pread, SYS_PREAD, int, void *, size_t, off_t); 7 | 8 | ssize_t pread(int fd, void *buf, size_t count, off_t offset) { 9 | __sets_errno(syscall_pread(fd,buf,count,offset)); 10 | } 11 | 12 | -------------------------------------------------------------------------------- /libc/unistd/pwrite.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | DEFN_SYSCALL4(pwrite, SYS_PWRITE, int, const void *, size_t, off_t); 7 | 8 | ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset) { 9 | __sets_errno(syscall_pwrite(fd,buf,count,offset)); 10 | } 11 | 12 | -------------------------------------------------------------------------------- /libc/unistd/read.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | DEFN_SYSCALL3(read, SYS_READ, int, char *, size_t); 7 | 8 | ssize_t read(int file, void *ptr, size_t len) { 9 | __sets_errno(syscall_read(file,ptr,len)); 10 | } 11 | -------------------------------------------------------------------------------- /libc/unistd/readlink.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | DEFN_SYSCALL3(readlink, SYS_READLINK, char *, char *, int); 7 | 8 | ssize_t readlink(const char * name, char * buf, size_t len) { 9 | __sets_errno(syscall_readlink((char*)name, buf, len)); 10 | } 11 | 12 | -------------------------------------------------------------------------------- /libc/unistd/rmdir.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int rmdir(const char *pathname) { 5 | errno = ENOTSUP; 6 | return -1; 7 | } 8 | -------------------------------------------------------------------------------- /libc/unistd/sbrk.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | DEFN_SYSCALL1(sbrk, SYS_SBRK, int); 6 | 7 | void *sbrk(intptr_t increment) { 8 | return (void *)syscall_sbrk(increment); 9 | } 10 | -------------------------------------------------------------------------------- /libc/unistd/setgid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | DEFN_SYSCALL1(setgid, SYS_SETGID, unsigned int); 7 | 8 | int setgid(gid_t uid) { 9 | __sets_errno(syscall_setgid(uid)); 10 | } 11 | 12 | -------------------------------------------------------------------------------- /libc/unistd/setgroups.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | DEFN_SYSCALL2(setgroups, SYS_SETGROUPS, int, const gid_t *); 7 | 8 | int setgroups(int size, const gid_t list[]) { 9 | __sets_errno(syscall_setgroups(size, list)); 10 | } 11 | 12 | 13 | -------------------------------------------------------------------------------- /libc/unistd/setpgid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | DEFN_SYSCALL2(setpgid, SYS_SETPGID, int, int); 7 | DEFN_SYSCALL1(getpgid, SYS_GETPGID, int); 8 | 9 | int setpgid(pid_t pid, pid_t pgid) { 10 | __sets_errno(syscall_setpgid((int)pid,(int)pgid)); 11 | } 12 | 13 | pid_t getpgid(pid_t pid) { 14 | __sets_errno(syscall_getpgid((int)pid)); 15 | } 16 | 17 | -------------------------------------------------------------------------------- /libc/unistd/setsid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | DEFN_SYSCALL0(setsid, SYS_SETSID); 7 | 8 | pid_t setsid(void) { 9 | __sets_errno(syscall_setsid()); 10 | } 11 | 12 | -------------------------------------------------------------------------------- /libc/unistd/setuid.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | DEFN_SYSCALL1(setuid, SYS_SETUID, unsigned int); 7 | 8 | int setuid(uid_t uid) { 9 | __sets_errno(syscall_setuid(uid)); 10 | } 11 | -------------------------------------------------------------------------------- /libc/unistd/sleep.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | unsigned int sleep(unsigned int seconds) { 4 | syscall_sleep(seconds, 0); 5 | return 0; 6 | } 7 | 8 | -------------------------------------------------------------------------------- /libc/unistd/stat.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | DEFN_SYSCALL2(statf, SYS_STATF, char *, void *); 8 | DEFN_SYSCALL2(lstat, SYS_LSTAT, char *, void *); 9 | 10 | int stat(const char *file, struct stat *st){ 11 | int ret = syscall_statf((char *)file, (void *)st); 12 | if (ret >= 0) { 13 | return ret; 14 | } else { 15 | errno = -ret; 16 | memset(st, 0x00, sizeof(struct stat)); 17 | return -1; 18 | } 19 | } 20 | 21 | int lstat(const char *path, struct stat *st) { 22 | int ret = syscall_lstat((char *)path, (void *)st); 23 | if (ret >= 0) { 24 | return ret; 25 | } else { 26 | errno = -ret; 27 | memset(st, 0x00, sizeof(struct stat)); 28 | return -1; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /libc/unistd/symlink.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | DEFN_SYSCALL2(symlink, SYS_SYMLINK, const char *, const char *); 8 | 9 | int symlink(const char *target, const char *name) { 10 | __sets_errno(syscall_symlink(target, name)); 11 | } 12 | 13 | -------------------------------------------------------------------------------- /libc/unistd/sync.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | void sync(void) { 6 | /* TODO */ 7 | } 8 | 9 | -------------------------------------------------------------------------------- /libc/unistd/truncate.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int truncate(const char * path, off_t length) { 6 | errno = EINVAL; 7 | return -1; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /libc/unistd/ttyname.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | static char _tty_name[30]; /* only needs to hold /dev/pty/ttyXXXXXXX */ 7 | 8 | char * ttyname(int fd) { 9 | 10 | if (!isatty(fd)) { 11 | errno = ENOTTY; 12 | return NULL; 13 | } 14 | 15 | ioctl(fd, IOCTLTTYNAME, _tty_name); 16 | 17 | return _tty_name; 18 | } 19 | 20 | int ttyname_r(int fd, char * buf, size_t buflen) { 21 | if (!isatty(fd)) return ENOTTY; 22 | if (buflen < 30) return ERANGE; 23 | ioctl(fd, IOCTLTTYNAME, buf); 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /libc/unistd/umask.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | DEFN_SYSCALL1(umask, SYS_UMASK, int); 6 | 7 | mode_t umask(mode_t mask) { 8 | return syscall_umask(mask); 9 | } 10 | -------------------------------------------------------------------------------- /libc/unistd/unlink.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | DEFN_SYSCALL1(unlink, SYS_UNLINK, char *); 7 | 8 | int unlink(const char * pathname) { 9 | __sets_errno(syscall_unlink((char *)pathname)); 10 | } 11 | -------------------------------------------------------------------------------- /libc/unistd/usleep.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | DEFN_SYSCALL2(sleep, SYS_SLEEP, unsigned long, unsigned long); 6 | 7 | int usleep(useconds_t usec) { 8 | syscall_sleep((usec / 10000) / 1000, (usec / 10000) % 1000); 9 | return 0; 10 | } 11 | 12 | -------------------------------------------------------------------------------- /libc/unistd/write.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | DEFN_SYSCALL3(write, SYS_WRITE, int, char *, size_t); 7 | 8 | ssize_t write(int file, const void *ptr, size_t len) { 9 | __sets_errno(syscall_write(file,(char *)ptr,len)); 10 | } 11 | -------------------------------------------------------------------------------- /libc/utime/utime.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int utime(const char *filename, const struct utimbuf *times) { 5 | /* Unimplemented */ 6 | errno = ENOTSUP; 7 | return -1; 8 | } 9 | -------------------------------------------------------------------------------- /libc/wchar/wcscat.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | wchar_t * wcscat(wchar_t *dest, const wchar_t *src) { 5 | wchar_t * end = dest; 6 | while (*end != 0) { 7 | ++end; 8 | } 9 | while (*src) { 10 | *end = *src; 11 | end++; 12 | src++; 13 | } 14 | *end = 0; 15 | return dest; 16 | } 17 | 18 | wchar_t * wcsncat(wchar_t *dest, const wchar_t * src, size_t n) { 19 | wchar_t * end = dest; 20 | size_t c = 0; 21 | while (*end != 0) { 22 | ++end; 23 | } 24 | while (*src && c < n) { 25 | *end = *src; 26 | end++; 27 | src++; 28 | c++; 29 | } 30 | *end = 0; 31 | return dest; 32 | } 33 | -------------------------------------------------------------------------------- /libc/wchar/wcscmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int wcscmp(const wchar_t *l, const wchar_t *r) { 4 | for (; *l == *r && *l; l++, r++); 5 | return *(unsigned int *)l - *(unsigned int *)r; 6 | } 7 | 8 | int wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n) { 9 | if (n == 0) return 0; 10 | 11 | while (n-- && *s1 == *s2) { 12 | if (!n || !*s1) break; 13 | s1++; 14 | s2++; 15 | } 16 | return (*s1) - (*s2); 17 | } 18 | -------------------------------------------------------------------------------- /libc/wchar/wcscpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | wchar_t * wcscpy(wchar_t * restrict dest, const wchar_t * restrict src) { 4 | wchar_t * out = dest; 5 | for (; (*dest=*src); src++, dest++); 6 | return out; 7 | } 8 | -------------------------------------------------------------------------------- /libc/wchar/wcslen.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | size_t wcslen(const wchar_t * s) { 4 | size_t out = 0; 5 | while (*s) { 6 | out++; 7 | s++; 8 | } 9 | return out; 10 | } 11 | -------------------------------------------------------------------------------- /libc/wchar/wcsncpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | wchar_t * wcsncpy(wchar_t * dest, const wchar_t * src, size_t n) { 4 | wchar_t * out = dest; 5 | while (n > 0) { 6 | *dest = *src; 7 | if (!*src) break; 8 | dest++; 9 | src++; 10 | n--; 11 | } 12 | return out; 13 | } 14 | -------------------------------------------------------------------------------- /linker/link.ld: -------------------------------------------------------------------------------- 1 | ENTRY(_start) 2 | 3 | SECTIONS 4 | { 5 | . = 0x3F000000; 6 | phys = .; 7 | 8 | .text BLOCK(4K) : ALIGN(4K) 9 | { 10 | code = .; 11 | *(.text) 12 | } 13 | 14 | .rodata BLOCK(4K) : ALIGN(4K) 15 | { 16 | *(.rodata) 17 | } 18 | 19 | .data BLOCK(4K) : ALIGN(4K) 20 | { 21 | *(.data) 22 | } 23 | 24 | .bss BLOCK(4K) : ALIGN(4K) 25 | { 26 | *(COMMON) 27 | *(.bss) 28 | } 29 | 30 | .eh_frame BLOCK(4K) : ALIGN(4K) { 31 | *(.eh_frame) 32 | } 33 | 34 | .init_array : { 35 | PROVIDE_HIDDEN (__init_array_start = .); 36 | *(.init_array); 37 | PROVIDE_HIDDEN (__init_array_end = .); 38 | } 39 | 40 | end = .; 41 | 42 | /DISCARD/ : 43 | { 44 | *(.comment) 45 | *(.note.gnu.build-id) 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /util/activate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 3 | export PATH="$DIR/local/bin:$PATH" 4 | export TOOLCHAIN="$DIR" 5 | echo "$PATH" 6 | 7 | -------------------------------------------------------------------------------- /util/arch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 3 | 4 | if [ -e "$DIR/../.arch" ]; then 5 | cat "$DIR/../.arch" 6 | exit 0 7 | fi 8 | 9 | echo "x86_64" 10 | -------------------------------------------------------------------------------- /util/build-in-docker-aarch64.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Give other users access to /root 4 | # (We probably should have just built the build tools somewhere else...) 5 | chmod o+x /root 6 | chmod -R o+rw /root/gcc_local/bin 7 | 8 | # Who owns this directory? 9 | NEWUID=`stat -c '%u' .` 10 | 11 | if [[ "$NEWUID" == "0" ]]; then 12 | echo "Are you running this on Docker for Mac? Owner UID is 0, going to use 501 instead." 13 | NEWUID=501 14 | fi 15 | 16 | # Create a fake user with this name 17 | useradd -u $NEWUID local 18 | 19 | # Map the build tools 20 | ln -s /root/gcc_local util/local 21 | 22 | # Run make as local 23 | runuser -u local -- sh -c 'make ARCH=aarch64 base/lib/libc.so && make ARCH=aarch64 -j4' || exit 1 24 | 25 | # Remove the build tools 26 | rm util/local 27 | 28 | 29 | -------------------------------------------------------------------------------- /util/build-in-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Give other users access to /root 4 | # (We probably should have just built the build tools somewhere else...) 5 | chmod o+x /root 6 | chmod -R o+rw /root/gcc_local/bin 7 | 8 | # Who owns this directory? 9 | NEWUID=`stat -c '%u' .` 10 | 11 | if [[ "$NEWUID" == "0" ]]; then 12 | echo "Are you running this on Docker for Mac? Owner UID is 0, going to use 501 instead." 13 | NEWUID=501 14 | fi 15 | 16 | # Create a fake user with this name 17 | useradd -u $NEWUID local 18 | 19 | # Map the build tools 20 | ln -s /root/gcc_local util/local 21 | 22 | # Run make as local 23 | runuser -u local -- sh -c 'make base/lib/libc.so && make -j4' || exit 1 24 | 25 | # Remove the build tools 26 | rm util/local 27 | 28 | -------------------------------------------------------------------------------- /util/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:20.04 2 | 3 | ENV DEBIAN_FRONTEND=noninteractive 4 | 5 | RUN apt-get update \ 6 | && apt-get install -y build-essential python3 xorriso genext2fs mtools gnu-efi git automake autoconf wget libgmp-dev libmpfr-dev libmpc-dev flex bison texinfo dosfstools \ 7 | && rm -rf /var/lib/apt/lists/* /var/cache/apt/apt-file/* 8 | -------------------------------------------------------------------------------- /util/docker/README.md: -------------------------------------------------------------------------------- 1 | 1. Build the base image from the Dockerfile. 2 | 3 | ```bash 4 | docker build . 5 | ``` 6 | 7 | 2. Run the docker image with `-it bash`. 8 | 9 | 3. Clone the repository over `https`: 10 | 11 | ```bash 12 | cd 13 | git clone --recurse-submodules https://github.com/toaruos/misaka 14 | cd misaka 15 | util/build-toolchain.sh 16 | cd util/build/binutils 17 | while [[ -e confdir3/confdir3 ]]; do mv confdir3/confdir3 confdir3a; rmdir confdir3; mv confdir3a confdir3; done; rmdir confdir3 18 | cd ../../.. 19 | mv local /root/gcc_local 20 | cd /root 21 | rm -rf misaka 22 | ``` 23 | 24 | -------------------------------------------------------------------------------- /util/gensym.krk: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env kuroko 2 | ''' 3 | @brief Generate symbol table. 4 | ''' 5 | import fileio 6 | 7 | let size = 'quad' 8 | 9 | def extern(sym): 10 | print(f'.extern {sym}') 11 | print(f'.type {sym}, @function') 12 | 13 | def entry(sym): 14 | print(f'.{size} {sym}') 15 | print(f'.asciz "{sym}"') 16 | 17 | let ignore = ['abs','kernel_symbols_start','kernel_symbols_end','_GLOBAL_OFFSET_TABLE_'] 18 | let source = (x.strip() for x in fileio.stdin.readlines()) 19 | let symbols = set(x.split()[0] for x in source if not x.endswith(':')) 20 | let lines = sorted(x for x in symbols if x not in ignore) 21 | 22 | 23 | print('.section .symbols') 24 | print() 25 | for name in lines: 26 | extern(name) 27 | 28 | print('.global kernel_symbols_start') 29 | print('kernel_symbols_start:') 30 | print() 31 | for name in lines: 32 | entry(name) 33 | 34 | print('.global kernel_symbols_end') 35 | print('kernel_symbols_end:') 36 | -------------------------------------------------------------------------------- /util/init.krk: -------------------------------------------------------------------------------- 1 | #!/bin/kuroko 2 | import os 3 | import kuroko 4 | 5 | let serial = os.open('/dev/ttyS1',os.O_RDWR) 6 | if serial == 0: 7 | os.dup(serial) 8 | os.dup(serial) 9 | 10 | # Say hello 11 | let uname = os.uname() 12 | print(f"Test script running on {uname['sysname']} {uname['release']} {uname['version']} ({uname['machine']}), Kuroko {kuroko.version}") 13 | 14 | print("====") 15 | 16 | # Perform tests 17 | os.system("/bin/insmod /mod/ahci.ko") 18 | 19 | # Reboot 20 | print("====") 21 | print('Tests completed, exiting.') 22 | os.execv('/bin/reboot',['/bin/reboot']) 23 | -------------------------------------------------------------------------------- /util/libm.c: -------------------------------------------------------------------------------- 1 | /* Stub */ 2 | -------------------------------------------------------------------------------- /util/make-version: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | VERSION=`git rev-parse --short HEAD` 4 | 5 | X=$(git status -s | grep -q '^.M') 6 | if [ $? -eq 0 ]; then 7 | VERSION="$VERSION-dirty" 8 | fi 9 | 10 | echo -n $VERSION 11 | -------------------------------------------------------------------------------- /util/make_mbr.krk: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env kuroko 2 | from util import ISO 3 | 4 | let image = ISO('image.iso') 5 | let cdfile = image.get_file('/boot.sys') 6 | 7 | print(f'--defsym BOOT_FILE_SIZE={cdfile.extent_length_lsb} --defsym BOOT_FILE_OFFSET={cdfile.extent_start_lsb * 2048}') 8 | 9 | -------------------------------------------------------------------------------- /util/valid-modules.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 3 | 4 | for mod in $DIR/../modules/*.c; do 5 | fgrep -q "@package $1" "$mod" || continue 6 | echo -n $mod | sed s'#.*/\([^/]*\)\.c#\1 #' 7 | done 8 | 9 | echo 10 | --------------------------------------------------------------------------------