Serve local directories or an in-memory ramdisk over 9P2000, 9P2000.u, or 9P2000.L.
|
|
||
|---|---|---|
| src | release: v0.1.1 | |
| .gitignore | release: v0.1.0 | |
| build.zig | release: v0.1.1 | |
| build.zig.zon | release: v0.1.1 | |
| README.md | release: v0.1.1 | |
nineserve
Serve local directories or an in-memory ramdisk over 9P2000, 9P2000.u, or 9P2000.L.
Built on nine_p, nine_serve, nine_fs / nine_fs_host, and nine_vfs / nine_vfs_ram.
Usage
nineserve [-p port] [-l addr] [-d dialect] (-r|-w) [name=]path ...
nineserve [-p port] [-l addr] --ram [-m mem_limit] [-f file_limit]
Modes
Host filesystem
Serve one or more local directories over 9P. Each export maps a 9P name to a host path, with read-only or read-write access.
# Serve ./doc as /doc (read-only) and ./public as /pub (read-write)
nineserve -r doc -w pub=public
# Listen on all interfaces, port 9999
nineserve -l 0.0.0.0 -p 9999 -r share=/srv/share
A later -w/-r for the same name overrides the earlier entry.
Ramdisk
Serve an in-memory filesystem with configurable memory quota and per-file size limit. Supports file locking.
# 128 MiB ramdisk, max 16 MiB per file
nineserve --ram -m 128M -f 16M
# Default: 256 MiB total, 64 MiB per file
nineserve --ram
Ramdisk mode is mutually exclusive with host-filesystem exports.
Options
| Flag | Description | Default |
|---|---|---|
-p, --port |
TCP port | 564 (falls back to 9999) |
-l, --listen |
Listen address | localhost |
-d, --dialect |
Protocol: 9P2000, 9P2000.u, 9P2000.L |
9P2000.L |
-r, --read-only |
Export [name=]path read-only (repeatable) |
|
-w, --read-write |
Export [name=]path read-write (repeatable) |
|
--ram |
Ramdisk mode | |
-m, --mem-limit |
Ramdisk total memory limit | 256M |
-f, --file-limit |
Max file size (0 = unlimited) | 64M |
-h, --help |
Show help |
Size suffixes: K/k = KiB, M/m = MiB, G/g = GiB (plain integer = bytes).
Connecting
# With ninecp (interactive client)
ninecp localhost:564
# With Linux mount (9P2000.L)
mount -t 9p -o trans=tcp,port=564 localhost /mnt/9p
# With nine_fusefs3 (FUSE)
nine_fusefs3 localhost:564 /mnt/9p
Dependencies
- nine_p, nine_serve, nine_fs, nine_fs_host, nine_vfs_ram, clap