p9mod

package
v0.19.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Package p9mod is the native module "p9": the 9P file protocol of Plan 9 and Linux (TODO.md Q62), as a client and as a server, in both versions: 9P2000 and 9P2000.L.

use p9;
local c = p9::dial("tcp://localhost:5640");
for (local e in c->readdir("/")) println(e["name"], e["size"]);
println(c->read("/motd"));
c->close();

A server serves a tree the program builds, whose files hold a string or call a Kukel function when they are read or written, and directories of the local disk (read-only unless asked):

use p9; use events; use time;
local t = new p9::Tree();
t->file("/motd", "hello\n");
t->file("/time", fn() { return time::now()->format() + "\n"; });
t->file("/log", "", fn(data) { print(data); });
t->mount("/files", p9::disk("/srv/files"));
local s = p9::serve(t, "tcp://*:5640");
events::run();

9P2000.L is served and spoken with github.com/hugelgupf/p9, 9P2000 with 9fans.net/go/plan9. The build tag no9p leaves the module out (its code is in the files with the build constraint !no9p).

Index

Constants

View Source
const NetError = "NetError"

NetError is the kind of the exceptions for network problems: a server that cannot be reached, an address that cannot be listened on.

Variables

View Source
var Client = &native.Class{Name: "Client"}

Client is the class p9::Client: what p9::dial gives.

View Source
var Disk = &native.Class{Name: "Disk"}

Disk is the class p9::Disk: a directory of the local disk, for p9::serve and Tree::mount.

View Source
var Server = &native.Class{Name: "Server"}

Server is the class p9::Server: what p9::serve gives.

View Source
var Tree = &native.Class{Name: "Tree"}

Tree is the class p9::Tree: the directories and files a server serves.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL