this post was submitted on 19 Jul 2023
14 points (100.0% liked)

Plan9

240 readers
1 users here now

Discussions on the Plan9 operating system.

founded 1 year ago
MODERATORS
 

Lemmy uses the packages olowe.co/lemmy (source), which provides a io/fs filesystem interface to a Lemmy instance, and 9fans.net/go/acme to interact with acme. What you get is an Acme Mail inspired program for Lemmy. As you can see, it's a work in progress!

But it's been fun so far. Sorry that this isn't running on Plan 9 (running on OpenBSD). I'm on the road at the moment and don't have a way to connect to a server right now!

top 3 comments
sorted by: hot top controversial new old
[–] [email protected] 4 points 1 year ago (1 children)

This is awesome!

Since you're using 9fans packages, I assume that this works with plan9port though, isn't that right?

I was wondering about porting some of these things to native Plan 9 as well, especially the libdraw parts. So far there were successful attempts at using the filesystem interface with Lua (and at some point I managed to run Fennel atop Lua 5.4 to interact with libdraw), so adding Plan 9 support to these libraries shouldn't be too hard.

[–] [email protected] 2 points 1 year ago (1 children)

Since you’re using 9fans packages, I assume that this works with plan9port though, isn’t that right?

Yes this is running on plan9port on OpenBSD.

I was wondering about porting some of these things to native Plan 9 as well

That would be cool! And you wouldn't need to worry about the package 9fans.net/go/plan9 since that's all provided by the OS already.

Another idea I had was some kind of adapter to serve a io/fs filesystem over 9P if that makes sense?

[–] [email protected] 3 points 1 year ago

I think that anything in Plan 9 that involves a filesystem makes total sense. It's just too easy to just make a thin layer that works with files.

For instance, I was once building a GUI for a project in Plan 9 C, that communicated with the remote server using REST requests. All I had to do is use the webfs filesystem interface. It works somewhat like this:

  • You open /mnt/web/clone for reading and keep it open. Reading that file gives you a handle number for your connections.
  • Open /mnt/web/%d/ctl (%d being the handle number) for writing. Then you write a few textual information for your request, e.g. request get for the method, url https://my-website.com/ for URL, headers blabla for each header parameter, etc.
  • If you're sending data, set the contenttype through the ctl file as above, then write the request body to /mnt/web/%d/postbody.
  • Open /mnt/web/%d/body for reading. This action performs the actual request, and may take some time. Nevertheless, for your program, it is simply a blocking file operation.

I think this illustrates how simple Plan 9 can be, so I think it is possible to port most, if not every part of 9fans.net libraries to native Plan 9 by reimplementing a few functions to do file operations instead of using the plan9port binaries.