Re: [9fans] non-truncating create

2006-10-09 Thread Joel “chesky” Salomon
  Of tertiary interest: Is there a general use for a library function
  complain() that behaves identically to sysfatal(2) except for not
  terminating the program?
 
 Probably not.  The interesting part of sysfatal is the
 terminating the program, not the printing of the error.

Got it.  Complain() goes into my private library, together with emalloc  co. 
from back in June... ☺

--Joel



Re: [9fans] non-truncating create

2006-10-09 Thread Joel “chesky” Salomon
 Rc just tries the open, and if that fails, tries the create.
 It doesn't even bother looking at the error code.
 If the open failed due to permissions, so will the create.

Drawterm barfed on me and I lost the bit of code this suggested; when
I tried to recreate it I ended up checking for OTRUNC a few times.
Not pretty.

 Or use create with OEXCL if you really care.

Sort of the way create(2) calls create(5) first, then open(5) if that
failed?  My code now looks like:
o = create(oname, omode|OEXCL, ~0); /* fails if file exists */
if(o  0)
o = open(oname, omode);
if(o  0){
complain(can’t open %s for writing: %r, oname);
return;
}
which has no special-case code depending on OTRUNC being set or no.

I suppose I ought to look at /sys/src/cmd/rc to see how it’s really
done.  Mañana.

Thanks for the assist.

--Joel



[9fans] SPF implementation

2006-10-09 Thread Gabriel Diaz
HelloI saw on Wiki TODO a request to implement SPF antispam thing.If there is nobody alreading doing this, i will start it.slds.gabi


Re: [9fans] non-truncating create

2006-10-09 Thread Russ Cox

Rc says something like:

if ((fd = open(file, OWRITE))  0  (fd = create(file, OWRITE, 0666))  0) {
   complain(...);
   return;
}
seek(fd, 0, 2);

You don't really mean ~0 as the argument to create.

Russ


On 10/9/06, Joel chesky Salomon [EMAIL PROTECTED] wrote:

 Rc just tries the open, and if that fails, tries the create.
 It doesn't even bother looking at the error code.
 If the open failed due to permissions, so will the create.

Drawterm barfed on me and I lost the bit of code this suggested; when
I tried to recreate it I ended up checking for OTRUNC a few times.
Not pretty.

 Or use create with OEXCL if you really care.

Sort of the way create(2) calls create(5) first, then open(5) if that
failed?  My code now looks like:
o = create(oname, omode|OEXCL, ~0); /* fails if file exists */
if(o  0)
o = open(oname, omode);
if(o  0){
complain(can't open %s for writing: %r, oname);
return;
}
which has no special-case code depending on OTRUNC being set or no.

I suppose I ought to look at /sys/src/cmd/rc to see how it's really
done.  Mañana.

Thanks for the assist.

--Joel




Re: [9fans] scuzz doesn't like CD-RW?

2006-10-09 Thread geoff
Are you using CD-R or CD-RW media?  Have you tried scuzz -r
/dev/sdD0?

I've just hooked up a CD-R drive so I'll verify that that still works.



[9fans] Plan 9 in robotics

2006-10-09 Thread John Floren

Hi everyone

Is anyone currently using Plan 9 to control robots? It seems to me
that the O.S. is well-suited for interfacing with some of the devices
my robotics club uses (serial GPS, etc), and the networked aspect
would make it useful for communicating among distributed, one-function
modules (we are considering ARM processors for this).
Thanks

John Floren
--
Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn


Re: [9fans] Plan 9 in robotics

2006-10-09 Thread Skip Tavakkolian
 Is anyone currently using Plan 9 to control robots?

like styx-on-a-brick?
http://www.vitanuova.com/inferno/rcx_paper.html



Re: [9fans] non-truncating create

2006-10-09 Thread G. David Butler
And if you are interested in a much deeper discussion, look at the archives 
from 1999.

-Original Message-
From: Russ Cox [mailto:[EMAIL PROTECTED]
Sent: Monday, October 9, 2006 10:57 AM
To: 'Fans of the OS Plan 9 from Bell Labs'
Subject: Re: [9fans] non-truncating create

Rc says something like:

if ((fd = open(file, OWRITE))  0  (fd = create(file, OWRITE, 0666))  0) {
complain(...);
return;
}
seek(fd, 0, 2);

You don't really mean ~0 as the argument to create.

Russ


On 10/9/06, Joel chesky Salomon [EMAIL PROTECTED] wrote:
  Rc just tries the open, and if that fails, tries the create.
  It doesn't even bother looking at the error code.
  If the open failed due to permissions, so will the create.

 Drawterm barfed on me and I lost the bit of code this suggested; when
 I tried to recreate it I ended up checking for OTRUNC a few times.
 Not pretty.

  Or use create with OEXCL if you really care.

 Sort of the way create(2) calls create(5) first, then open(5) if that
 failed?  My code now looks like:
 o = create(oname, omode|OEXCL, ~0); /* fails if file exists */
 if(o  0)
 o = open(oname, omode);
 if(o  0){
 complain(can't open %s for writing: %r, oname);
 return;
 }
 which has no special-case code depending on OTRUNC being set or no.

 I suppose I ought to look at /sys/src/cmd/rc to see how it's really
 done.  Mañana.

 Thanks for the assist.

 --Joel







Re: [9fans] non-truncating create

2006-10-09 Thread Joel Salomon

On 10/9/06, G. David Butler [EMAIL PROTECTED] wrote:

And if you are interested in a much deeper discussion, look at the archives 
from 1999.


Looking at the subject headers at http://9fans.net/archive/1999, I'm
not seeing anything directly related to open or create.  Could you
please be a bit more specific?

--Joel


Re: [9fans] non-truncating create

2006-10-09 Thread Russ Cox

And if you are interested in a much deeper discussion,
look at the archives from 1999.


Actually it was 1998: http://9fans.net/archive/1998/02
especially http://9fans.net/archive/1998/02/17

We explicitly considered this when working on 9P2000
and added the OEXCL flag to create to address this problem.

Russ


Re: [9fans] pages in nroff

2006-10-09 Thread Scott Schwartz
Unix manpages these days are formatted for online viewing
just as you suggest, and it seems to work fine.

e.g. linux does:
   (echo .ll 10.6i;
echo .pl 1100i;
/usr/bin/gunzip -c '/usr/share/man/man1/date.1.gz';
echo;
echo .pl \n(nlu+10
   ) | /usr/bin/gtbl | /usr/bin/nroff -c -mandoc | /usr/bin/less -isr


RE: [9fans] scuzz doesn't like CD-RW?

2006-10-09 Thread cej
I can also burn ISO CD-RW on plan9 with that drive, I forgot to mention it.
The problem is that I can§t burn a tar file directly, i.e., without cdfs,
so I could read it thus:
tar tvf /dev/sdD0/data

aftr blanking the cd, I got rid of that 'bus timeout' message,
probe
ready
inquiry
rewind 

all work, but I still can't write

My problem is that I don't trust ISO-9660 and companion very much.
writing .tar instead of .iso using cdfs would probably work, but would force me 
to use the cdfs overhead. 

Reasoning is that if something goes wrong, I can get most of the data back from 
tar, not so from iso.

Thanks for the response,
best regards,

 ++pac


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: Monday, October 09, 2006 8:34 PM
To: 9fans@cse.psu.edu
Subject: Re: [9fans] scuzz doesn't like CD-RW?

I just burned a CD-R using a SCSI drive and cdfs.

I don't think I normally use scuzz to talk to CD drives, but

scuzz -r /dev/sd11
ready
inquiry

works.