ftp.nice.ch/pub/next/developer/resources/classes/misckit/MiscKit.1.10.0.NIHS.b.gnutar.gz#/LocalDeveloper/Headers/misckit/Miscdaemon.h

This is Miscdaemon.h in view mode; [Download] [Up]

/*  Functions to turn a program into a daemon, handle signals, manage
 *  a log file facility, and do memory allocation checking.
 *
 *  Copyright (c) 1994 Christopher J. Kane.
 *
 *  This software is subject to the terms of the MiscKit license
 *  agreement. Refer to the license document included with the
 *  MiscKit distribution for these terms.
 *
 *  Version 1.0 (24 March 1994)
 */

#if !defined(_DAEMON_H)
#define _DAEMON_H 1
#include <sys/types.h>
#include <sys/syslog.h>

#if defined(_AIX)
	#include <sys/select.h>
#endif

/* Imported variables (must be exported from elsewhere in a program) */

/* now declared statically inside Miscdaemon.c:
	extern int debug;
	Use the accessor functions below: */
	
int Misc_daemon_debug();
void Misc_daemon_set_debug(int flag);

/* Exported variables */

extern int daemon_pid;
extern char *daemon_name;
extern char *daemon_host;

/* Exported functions */

void daemonize(char *prog_name, char *log_fn, int log_facility, char *safe_dir,
		char *lockf_dir, fd_set *ignfds, int loghup_sig, int *ignsigs);
#define daemon_alloc(SIZE) _daemon_alloc(SIZE, __FILE__, __LINE__)
#define daemon_free(BLOCK) _daemon_free(BLOCK, __FILE__, __LINE__)
void daemon_log(int prio, ...);
void daemon_exit(int exit_val);

/* Exported macros */

#define daemon_assert(E) ((!debug || (E)) ? (void)0 : \
	daemon_log(LOG_DEBUG, "%s:%d: assertion \"" #E "\" failed", \
	__FILE__, __LINE__), daemon_exit(2))

#endif /* _DAEMON_H */

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.