Asynchronous pipe I/O

2008-11-05 Thread rihad

Imagine this shell pipeline:

sh prog1 | sh prog2


As given above, prog1 blocks if prog2 hasn't yet read previously written 
data (actually, newline separated commands) or is busy. What I want is 
for prog1 to never block:


sh prog1 | buffer | sh prog2

I first thought that the aptly named misc/buffer port would do exactly 
what I wanted: buffering prog1 output for prog2 to read it at its 
earliest convenience. That way prog1 would never block (unless it hit 
buffer's memory limits). Alas, misc/buffer was originally designed for 
tape backups, and despite its author's stating its applicability to 
other uses:


"This is a program designed initially to speed up writing tapes on 
remote tape drives, but may be used as a general pipe buffering utility."



buffer never starts writing unless the limit given by -s is crossed, 
which is 10 kbytes by default and cannot be less than 496 bytes, which 
is too much for me. Ideally I want it to start writing immediately, 
whenever new data hits its pools. Unfortunately, the -p 0 option doesn't 
work either:


   -s size
Size in bytes of each block.  The  default  blocksize  is
10k  to match the normal output of the tar(1) program.

  -p percentage
Only start a write when the given percentage of the internal
queue is  full.   A  percentage around 75 often proves best.
Defaults to zero.

Wouldn't such an intermediary tool be a great way to boost performance 
for certain types of solutions?


Thanks for any tips (Sorry if this was an inappropriate place to ask)
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


running port as non-root

2007-11-30 Thread rihad

Hi, I'm trying to run the net/openradius port as non-root
by first changing /usr/local/etc/rc.d/openradius:

. /etc/rc.subr

name="openradius"
rcvar=`set_rcvar`

load_rc_config ${name}

: ${openradius_enable="NO"}
: ${openradius_flags="-o /var/log/openradius.log"}

-command=/usr/local/sbin/radiusd
+command=/usr/local/bin/sudo
+flags="-u radius /usr/local/sbin/radiusd"

run_rc_command "$1"

(Lines marked with -/+ were removed/added by me, respectively).

Then I add the radius user, allow it to run without sudo's asking for
the password, and finally start the thing up:
# pw useradd radius -d /nonexistent -s /usr/sbin/nologin
# visudo
# ... do the necessary chown/chmod on openradius logs/dictionaries ...
# /usr/local/etc/rc.d/openradius start

All fine so far: everything starts up fine and runs. The problem starts
here:
# /usr/local/etc/rc.d/openradius stop
openradius not running?
# ps -auxww | fgrep radiusd
radius 89300  0.0  0.0  3756  1588  ??  Is   10:56AM   0:00.00
/usr/local/sbin/radiusd
...

any built-in way to make "stop" work, without changing rc.d/ too much?

Thanks.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: rcNG shutdown

2006-01-06 Thread rihad

Oops, there's this /etc/rc.shutdown thing, sorry to bother you.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


rcNG shutdown

2006-01-06 Thread rihad
Hi. I can't seem to find the way FreeBSD deals with stopping the running 
rc.d services when shutting down/rebooting the machine. In Linux, for 
example, the shutdown command first switches to "runlevel" 0, triggering 
init to call the program for that event, which deals with shutting down 
the running services gracefully. I might be missing something obvious: 
in FreeBSD, are users expected to write their own programs for doing 
that? Something along the lines of (untested):


find /usr/local/etc/rc.d/ /etc/rc.d/ -mindepth 2 -print0 \
| xargs -0 -n1 -I% /usr/bin/command "%" stop
halt -p|reboot|whatever

?
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


ports security branch

2005-12-19 Thread rihad

Is there a security branch for the FreeBSD ports collection? Let's say,
I installed FreeBSD 6.0 together with all needed -RELEASE ports/packages
(i.e., those on the CD). Running security/portaudit after a while 
reveals that some of the installed packages have vulnerabilities. Am I
on my own to go grab the fresh ports tree, and upgrade the affected 
software, suffering all the intricacies of the move by myself? Debian

GNU/Linux has its security package updates, OpenBSD has a separately
maintained "errata" ports branch (it's very likely you still get to
download a newer release of the software, though).

Sorry if this is a bit OT. I've already asked this on freebsd-questions@ 
but they told me there's no such thing at all.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: ports security branch

2005-12-19 Thread rihad

Andrea Venturoli wrote:

rihad wrote:

FreeBSD only has a "current" port tree.

The port tree you call "-RELEASE" is simply "current" as it was at the 
time the base OS was released.




Yes, wrong wording here. I was aware of that "snapshot" thing happening,
just lazy to go check www.freebsd.org for the correct name. Thanks for
the nitpick.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


ports security branch

2005-12-19 Thread rihad
Is there a security branch for the FreeBSD ports collection?  Let's say, 
I installed FreeBSD 6.0 together with all needed -RELEASE 
ports/packages. Running security/portaudit after a while reveals that 
some of the installed packages have vulnerabilities. Am I on my own to 
go grab the fresh ports tree, and upgrade the affected software, 
suffering all the intricacies of the move by myself? Debian GNU/Linux 
has its security package updates, OpenBSD has a separately maintained 
"errata" ports branch (you still get to download a newer release of the 
software, though (IIRC)).


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"