[9fans] multiple acme instances with plan9port

362 views
Skip to first unread message

Ruslan Khusnullin

unread,
Nov 7, 2012, 9:55:34 AM11/7/12
to
Hi!

I'm using acme from plan9port on ubuntu linux.
I tried running multiple acmes in Inferno and it works fine, didn't try it in Plan9 but guess it works too.

When I try to start acme (having one instance running) I get an error:

; /usr/local/plan9/bin/acme
9pserve: announce unix!/tmp/ns.r.:0/acme: Address already in use
acme: can't post service: 9pserve failed

; namespace
/tmp/ns.r.:0

; ll `namespace
total 0
srwxr-xr-x 1 r r 0 Nov  7 12:23 acme=
srwxr-xr-x 1 r r 0 Nov  7 12:23 plumb=
srwx------ 1 r r 0 Nov  7 12:21 wmii=

How do you run multiple acme instances with plan9port? Is it possible at all (considering plan9port lacks true namespaces support)?

I need more than one acme because I have not very big display (19") but please don't suggest buying a bigger display ;)

Bence Fábián

unread,
Nov 7, 2012, 10:53:29 AM11/7/12
to
you can try this as a quick fix:

$ mkdir /tmp/ns2.r
$ NAMESPACE=/tmp/ns2.r acme

maybe write a wrapper script for it


2012/11/7 Ruslan Khusnullin <ruslan.k...@gmail.com>

Sergio Perticone

unread,
Nov 7, 2012, 10:57:40 AM11/7/12
to
On Wed, Nov 7, 2012 at 4:53 PM, Bence Fábián <beg...@gmail.com> wrote:
you can try this as a quick fix:

$ mkdir /tmp/ns2.r
$ NAMESPACE=/tmp/ns2.r acme

maybe write a wrapper script for it


But probably you should also take care to run (another instance?) of plumber(1) in the same namespace.

s.

Bence Fábián

unread,
Nov 7, 2012, 11:09:42 AM11/7/12
to
Yes. It's clumsy.
issuing "Local plumber" starts it.
you could try changing

fsys.c:124: if(post9pservice(p[0], "acme", mtpt) < 0)

to post acme.$pid instead of acme. it's fairly trivial, however might break
something. i don't have time to check it right now.
(there's a global var mainpid. i ithink it is set by the time of the post)


2012/11/7 Sergio Perticone <g4l...@gmail.com>

Sergio Perticone

unread,
Nov 7, 2012, 11:22:39 AM11/7/12
to
On Wed, Nov 7, 2012 at 5:09 PM, Bence Fábián <beg...@gmail.com> wrote:
Yes. It's clumsy.
issuing "Local plumber" starts it.
you could try changing

fsys.c:124: if(post9pservice(p[0], "acme", mtpt) < 0)

to post acme.$pid instead of acme. it's fairly trivial, however might break
something. i don't have time to check it right now.
(there's a global var mainpid. i ithink it is set by the time of the post)


It breaks programs that interact with acme. Something like: `echo hello | 9p write acme/$winid/body' won't work anymore. 

s.

Ethan Burns

unread,
Nov 7, 2012, 11:45:34 AM11/7/12
to
It's a work around, but when I need multiple acmes I use "ssh -X localhost" and open an acme from there.

Best,
Ethan

dexen deVries

unread,
Nov 7, 2012, 12:10:36 PM11/7/12
to
On Wednesday 07 of November 2012 18:55:34 Ruslan Khusnullin wrote:
> I'm using acme from plan9port on ubuntu linux.
> I tried running multiple acmes in Inferno and it works fine, didn't try it
> in Plan9 but guess it works too.


here's my dumb script:


#!/usr/bin/env rc

flag e +

NAMESPACE=`{namespace}^-2
mkdir -p `{namespace}
plumber || true
exec acme


cheers,
--
dx

Ruslan Khusnullin

unread,
Nov 8, 2012, 2:54:06 AM11/8/12
to
Thank you all,

I've ended up with this wrapper:
; cat $home/bin/acme; echo EOF
#!/usr/bin/rc

NAMESPACE = `{mktemp -d}
plumber >/dev/null >[2=1]
#font = $PLAN9/font/lucm/unicode.9.font
font = '/mnt/font/Droid Sans Mono/11a/font'
exec $PLAN9/bin/acme -ab -f $font -F $font $*

EOF

it works fine now letting me use as many acmes as I wish.

Though I lost my "-l $home/acme.dump" option in "exec acme" string
because it will certainly bring problems. I tried writing a test for
an acme running and skipping -l option if there is but it looked so
ugly that I dropped the idea, I write and click Load command when I
need it instead.

Also I don't use any programs interacting with acme so still not
having problems with isolated namespaces.

Mark van Atten

unread,
Nov 8, 2012, 4:48:39 AM11/8/12
to
Two years or so ago I found the script below, allowing you to start any number of instances of acme. E.g. if you name the script acme9 you use
acme9 -n 1, acme9 -n 2, etc., each of which can followed by the usual arguments you wish to pass on to acme.

Thanks to whomever wrote this.

Mark.


#!/bin/sh

[ "$1" = -n ] && { export NAMESPACE=/tmp/ns.$USER.$2; mkdir -p "$NAMESPACE"; shift; shift;
}
9p ls plumb/ >/dev/null 2>/dev/null || (cd /; 9 plumber)


exec acme "$@"
Reply all
Reply to author
Forward
0 new messages