source: trunk/athena/etc/busyd/busyd.c @ 11896

Revision 11896, 1.2 KB checked in by ghudson, 26 years ago (diff)
busyd, a daemon for answering larvnet status requests
RevLine 
[11896]1/* Copyright 1998 by the Massachusetts Institute of Technology.
2 *
3 * Permission to use, copy, modify, and distribute this
4 * software and its documentation for any purpose and without
5 * fee is hereby granted, provided that the above copyright
6 * notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting
8 * documentation, and that the name of M.I.T. not be used in
9 * advertising or publicity pertaining to distribution of the
10 * software without specific, written prior permission.
11 * M.I.T. makes no representations about the suitability of
12 * this software for any purpose.  It is provided "as is"
13 * without express or implied warranty.
14 */
15
16static const char rcsid[] = "$Id: busyd.c,v 1.1 1998-08-25 03:31:14 ghudson Exp $";
17
18#include <sys/types.h>
19#include <sys/socket.h>
20#include <netinet/in.h>
21#include <larv.h>
22
23int main(int argc, char **argv)
24{
25  struct sockaddr_in sin;
26  int sz = sizeof(sin);
27  char dummy;
28
29  /* We were run (we hope) from inetd.  Read the request packet to
30   * clear it from the queue.
31   */
32  if (recvfrom(0, &dummy, 1, 0, (struct sockaddr *) &sin, &sz) < 0)
33    return 1;
34
35  /* Now send the response. */
36  if (larv_send_status(0) == -1)
37    return 1;
38
39  return 0;
40}
Note: See TracBrowser for help on using the repository browser.