From owner-freebsd-questions Fri Mar 7 7:26: 7 2003 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BC5ED37B401 for ; Fri, 7 Mar 2003 07:26:05 -0800 (PST) Received: from mired.org (ip68-97-54-220.ok.ok.cox.net [68.97.54.220]) by mx1.FreeBSD.org (Postfix) with SMTP id BCC8243F75 for ; Fri, 7 Mar 2003 07:26:04 -0800 (PST) (envelope-from mwm-dated-1047482763.9f03ea@mired.org) Received: (qmail 73560 invoked from network); 7 Mar 2003 15:26:03 -0000 Received: from localhost.mired.org (HELO guru.mired.org) (127.0.0.1) by localhost.mired.org with SMTP; 7 Mar 2003 15:26:03 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15976.47627.94120.968450@guru.mired.org> Date: Fri, 7 Mar 2003 09:26:03 -0600 To: "J. Seth Henry" Cc: questions@freebsd.org Subject: Re: Looking for POSIX programming resources In-Reply-To: <20030306150225.S940-100000@whitetower.gambrl01.md.comcast.net> References: <20030306150225.S940-100000@whitetower.gambrl01.md.comcast.net> X-Mailer: VM 7.07 under 21.1 (patch 14) "Cuyahoga Valley" XEmacs Lucid X-face: "5Mnwy%?j>IIV\)A=):rjWL~NB2aH[}Yq8Z=u~vJ`"(,&SiLvbbz2W`; h9L,Yg`+vb1>RG% *h+%X^n0EZd>TM8_IB;a8F?(Fb"lw'IgCoyM.[Lg#r\ From: Mike Meyer X-Delivery-Agent: TMDA/0.70 (Pensive) Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This really belongs on something like comp.lang.unix, but hey... In <20030306150225.S940-100000@whitetower.gambrl01.md.comcast.net>, J. Seth Henry 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). 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