Re: [9fans] rc expression question

2017-03-31 Thread Skip Tavakkolian
something like this?

% xxx=`{echo test '-e '^$pathnames^' -o' 1 '!=' 1}
% $xxx


On Fri, Mar 31, 2017 at 5:31 PM dexen deVries 
wrote:

> given
> pathnames = ( foo/a.txt bar/b.txt baz/c.txt )
>
> how do i construct arguments to test(1) that test for existence of
> those files in one go?
>
> wanted:
> test -e foo/a.txt -o -e bar/b.txt -o -e baz/c.txt
>
> assuming the pathnames may contain space characters.
>
>


Re: [9fans] DNS

2017-03-31 Thread Skip Tavakkolian
Thanks! I should have checked the sources.



On Fri, Mar 31, 2017 at 6:28 PM  wrote:

> yes. raising Maxretries to > 5 in dnresolve.c fixes it. this parameter
> limits the chain of cname redirects.
>
> --
> cinap
>
>


Re: [9fans] DNS

2017-03-31 Thread cinap_lenrek
yes. raising Maxretries to > 5 in dnresolve.c fixes it. this parameter
limits the chain of cname redirects.

--
cinap



Re: [9fans] I just realized Linux supports 9p as a file system

2017-03-31 Thread Aram Hăvărneanu
Hardly.

-- 
Aram Hăvărneanu



[9fans] rc expression question

2017-03-31 Thread dexen deVries
given
pathnames = ( foo/a.txt bar/b.txt baz/c.txt )

how do i construct arguments to test(1) that test for existence of
those files in one go?

wanted:
test -e foo/a.txt -o -e bar/b.txt -o -e baz/c.txt

assuming the pathnames may contain space characters.



[9fans] pipe: bug or feature?

2017-03-31 Thread arisawa
Hello,

I have been playing with an experimental code on pipe.
the program read a file and write it to one end of pipe and then read it from 
another end of pipe.
the buffer for writing pipe is named buf0, and for reading pipe is named buf.
and I found the program does not finish unless sizeof(buf) > sizeof(buf0).
is this a bug or feature of pipe?

Kenji Arisawa

=== BEGIN a.c ===
#include 
#include 

char *argv0;

void
usage(void)
{
fprint(2,"usage: %s file\n",argv0);
exits("usage");
}

void
main(int argc, char *argv[])
{
int fd,pfd[2];
char buf[256];
char buf0[256];
/* need to be sizeof(buf) > sizeof(buf0)
 * but this condition is very curious to me */
int n;
char *file;
argv0 = argv[0];
argc--;argv++;
USED(argc);
if(argv[0] == nil)
usage();
file = argv[0];
fd = open(file,OREAD);
if(fd < 0)
sysfatal("no such file");

if(pipe(pfd) < 0)
sysfatal("pipe error");
print("pfd: %d %d\n",pfd[0],pfd[1]);

while((n = read(fd,buf0,sizeof(buf0))) > 0){
print("read: %d %s\n",n,file);
n = write(pfd[1],buf0,n);
print("write: %d\n",n);
}
close(pfd[1]);
while((n = read(pfd[0],buf,sizeof(buf))) > 0){
buf[n] = 0;
print("%d %s\n",n,buf);
}
print("%d\n",n);

exits(nil);
}
=== END a.c ===




[9fans] [ANN] shell scripts to install 9legacy patches

2017-03-31 Thread Kyohei Kadota
Hi fans.

I wrote shell scripts that install 9legacy patches to the system.

GitHub: https://github.com/lufia/9legacy-tool
Archive: http://lufia.org/plan9/src/9legacy-tool.tgz

To install stable patches and to update ape:

% 9legacy/init
% 9legacy/installall <{9legacy/stable}
% 9legacy/apply
% cd /sys/src/ape && mk lib.install

To discard all patches

% rm -r $home/lib/9legacy

Thanks.


Re: [9fans] Initial experience with Plan9 on Raspberry Pi

2017-03-31 Thread Richard Miller
> Does anyone know why the fscons prompt changes from 'prompt:' to 'main:'
> for second and subsequent commands.

A single fossil may be serving more than one file system.  The prompt
is to remind you which is the "current" one (ie the one which will be
acted on by commands which are not prefixed by "fsys ").

The 9pi image has only one fossil partition, which is called main.
To see its configuration:
  fossil/conf /dev/sdM0/fossil

> Any
> corrections/suggestions or pointers to useful alternative notes on this
> would be much appreciated.

Have you studied http://plan9.bell-labs.com/wiki/plan9/documentation/index.html
particularly the "Installation" and "Configuration" sections?  Most of it 
applies
to the raspberry pi exactly as for any other Plan 9 platform.

> changeuser: can't create user digbyt: '/mnt/keys/digbyt' permission denied
> term%
> 
> So I am wondering if there is something I need to start to make my Pi an
> authentication server?

The "permission denied" occurs because you haven't mounted keyfs(4), and
you need to use fossilcons(8) to add your username to group "adm" before
you can do that.

Have a look at 
http://plan9.bell-labs.com/wiki/plan9/Configuring_a_standalone_CPU_server
for a more complete picture.




[9fans] I just realized Linux supports 9p as a file system

2017-03-31 Thread Ryan Gonzalez
https://github.com/torvalds/linux/tree/master/fs/9p

--
Ryan (ライアン)
Yoko Shimomura > ryo (supercell/EGOIST) > Hiroyuki Sawano >> everyone else
http://refi64.com


Re: [9fans] coherence function in kernel (especially in raspberry pi port)

2017-03-31 Thread Charles Forsyth
On 28 March 2017 at 19:21, yoann padioleau  wrote:

> but I fail to understand the meaning of S and B.


Synchronisation Barrier


[9fans] Olimex TERES-A64

2017-03-31 Thread Skip Tavakkolian
FYI. This is an open source hardware and software DIY laptop. It would make
a good Plan 9 laptop/term.

[1] https://www.olimex.com/Products/DIY%20Laptop/KITS/
[2] https://github.com/OLIMEX/DIY-LAPTOP




[9fans] pipe: bug or feature?

2017-03-31 Thread arisawa
Hello,

I was playing with an experimental code on pipe and met with a problem which I 
don’t understand.

the program reads a file and writes it to one end of pipe and then reads it 
from another end of pipe.
the buffer for writing pipe is named buf0, and for reading pipe is named buf.
and I found the program does not finish unless sizeof(buf) > sizeof(buf0).
is this a bug or feature of pipe?

Kenji Arisawa

=== BEGIN a.c ===
#include 
#include 

char *argv0;

void
usage(void)
{
fprint(2,"usage: %s file\n",argv0);
exits("usage");
}

void
main(int argc, char *argv[])
{
int fd,pfd[2];
char buf[256];
char buf0[256];
/* need to be sizeof(buf) > sizeof(buf0)
 * but this condition is very curious to me */
int n;
char *file;
argv0 = argv[0];
argc--;argv++;
USED(argc);
if(argv[0] == nil)
usage();
file = argv[0];
fd = open(file,OREAD);
if(fd < 0)
sysfatal("no such file");

if(pipe(pfd) < 0)
sysfatal("pipe error");
print("pfd: %d %d\n",pfd[0],pfd[1]);

while((n = read(fd,buf0,sizeof(buf0))) > 0){
print("read: %d %s\n",n,file);
n = write(pfd[1],buf0,n);
print("write: %d\n",n);
}
close(pfd[1]);
while((n = read(pfd[0],buf,sizeof(buf))) > 0){
buf[n] = 0;
print("%d %s\n",n,buf);
}
print("%d\n",n);

exits(nil);
}
=== END a.c ===


Re: [9fans] coherence function in kernel (especially in raspberry pi

2017-03-31 Thread Richard Miller
Have a look at the ARM document "Barrier Litmus Tests and Cookbook",
and especially section 7.2 "Acquiring and Releasing a Lock".

After reading this document, I came to the conclusion that the
coherence() call in the unlock() function in port/taslock.c
belongs before zeroing the l->key instead of after it.  I made
the change only for the bcm kernel because I haven't researched
the memory semantics for all the other cpu architectures.  I
think it would probably be safe to make the change in ../port,
but someone else can make that decision.

I think it would also be safe to remove the coherence() call
after zeroing the l->key, but I kept it in for paranoia's sake.




Re: [9fans] DNS

2017-03-31 Thread Peter Hull
Doesn’t work quite right for me. It resolves a few steps and gets to
an IP address but it never prints out the “answer” between -
lines. If I do it for www.google.com then it does.
Also it prints some console messages - "no rr from dblookup; crapped out"
Pete



[9fans] Fwd: DNS

2017-03-31 Thread Skip Tavakkolian
It looks like 9fans messages are getting processed again.  I asked this a
couple of weeks ago.

-- Forwarded message -
From: Skip Tavakkolian 
Date: Mon, Mar 20, 2017 at 12:26 AM
Subject: DNS
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>


It seems Plan 9 dns can't resolve www.paypal.com correctly;  I'm not sure
why.

Can anyone with a 9front installation try this to see if it resolves to the
an IP address (i.e. see a final "answer" output)?

ndb/dnsdebug www.paypal.com

Thanks,
-Skip


[9fans] DNS

2017-03-31 Thread Skip Tavakkolian
It seems Plan 9 dns can't resolve www.paypal.com correctly;  I'm not sure
why.

Can anyone with a 9front installation try this to see if it resolves to the
an IP address (i.e. see a final "answer" output)?

ndb/dnsdebug www.paypal.com

Thanks,
-Skip


Re: [9fans] coherence function in kernel (especially in raspberry pi port)

2017-03-31 Thread Charles Forsyth
On 28 March 2017 at 19:21, yoann padioleau  wrote:

> For example I see this code in bcm/taslock.c
>
> coherence();
> l->key = 0;
> coherence();
>
> bcm/taslock.c seems actually mostly a copy paste of port/taslock.c
> with an extra call to coherence before the assignment above.
>

I've got that extra coherence call in port/taslock.c now (although my more
recent kernels use MCS locks exclusively)

You need to look at the full code fragment:

l->p = nil;
l->pc = 0;
l->m = nil;
coherence();
l->key = 0;
coherence();

assume coherence is a suitable barrier instruction on a given machine.
the calls are there to control the ordering (of stores in this case) as
seen by an observer,
which depends on the memory ordering model of a given processor or system
implementation.

the sequence is clearing references in the lock, to the Proc and the Mach
on which it's running.
we don't care about the order in which those stores are observed.
the first barrier ensures that all are observable before the critical store
to key that releases the Lock.

the second barrier ensures that once the lock is free, no further store can
be observed before
the lock-clearing store has been observed.

there is a general assumption in the system that any multiprocessor running
these kernels will have cache-coherency enabled across processors, although
that need not extend to devices (where the device drivers can do the little
dances needed to ensure coherent views of memory).


[9fans] Test, please ignore

2017-03-31 Thread Chris McGee
Test