Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Mar 2003 09:26:03 -0600
From:      Mike Meyer <mwm-dated-1047482763.9f03ea@mired.org>
To:        "J. Seth Henry" <jshenry@comcast.net>
Cc:        questions@freebsd.org
Subject:   Re: Looking for POSIX programming resources
Message-ID:  <15976.47627.94120.968450@guru.mired.org>
In-Reply-To: <20030306150225.S940-100000@whitetower.gambrl01.md.comcast.net>
References:  <20030306150225.S940-100000@whitetower.gambrl01.md.comcast.net>

next in thread | previous in thread | raw e-mail | index | archive | help
This really belongs on something like comp.lang.unix, but hey...

In <20030306150225.S940-100000@whitetower.gambrl01.md.comcast.net>, J. Seth Henry <jshenry@comcast.net> typed:
> In summary, can anyone help me write code that:
> 1) puts my daemon to sleep, awaking only when either a timer has expired,
> data has arrived one of the controlled serial ports, or the user has
> invoked some interface from a script or command line utility.

Select on Posix. kqueue on FreeBSD is more flexible though.

> 2) Daemonizes my program (dissasociating itself from the terminal)

See the daemon function, though I'm not sure if it's
posix-compliant. The man page describes what it does, though.

> 3) Accepts commands and/or data from scripts or command line utilities.

popen is the call you want.

> 4) Call other programs, and pass them parameters.

popen if you want to read their output or send them input. system if
you don't. fork and exec* for absolute control.

> 5) Read the system clock.

time(3).

	<mike
-- 
Mike Meyer <mwm@mired.org>		http://www.mired.org/consulting.html
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15976.47627.94120.968450>