Main Page | Modules | Data Structures | File List | Data Fields | Related Pages

daemonize.h

00001 /***************************************************************************
00002  * CVSID: $Id: daemonize.h,v 1.21 2004/08/29 18:43:23 stefanb Exp $
00003  *
00004  * daemonize.h : Daemonize handler
00005  *
00006  * Copyright (C) 2004 Stefan Bambach, <sbambach@gmx.net>
00007  *
00008  * Licensed under the GNU General Public License 2.0
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023  *
00024  **************************************************************************/
00025 
00026 
00056 #ifndef __LIBSB_DAEMONIZE_H__
00057 #define __LIBSB_DAEMONIZE_H__
00058 
00059 
00060 #ifdef HAVE_CONFIG_H
00061 #  include <config.h>
00062 #endif
00063 
00064 
00065 #include <sys/types.h>
00066 #include <sys/stat.h>
00067 #include <unistd.h>
00068 #include <signal.h>
00069 #include <stdlib.h>
00070 
00071 
00072 #if defined(__cplusplus)
00073 extern "C" {
00074 #endif
00075 
00076 
00077 
00079 #define MAX_PIDDATA_LENGTH 16
00080 
00081 
00082     
00094 int sb_daemon_drop_privileges(void);
00095     
00096 
00097     
00106 int sb_daemon_no_corefile(void);
00107 
00108 
00109 
00120 int sb_daemon_is_started_by_init(void);
00121 
00122 
00123 
00133 int sb_daemon_is_started_by_inetd(void);
00134 
00135 
00136 
00144 int sb_daemon_is_started_by_root(void);
00145 
00146 
00147 
00157 int sb_daemon_is_started_suid(void);
00158 
00159 
00160 
00172 int sb_daemon_create_fd(int fd, int mode);
00173 
00174 
00175 
00188 int sb_daemon_change_user(uid_t uid, gid_t gid);
00189 
00190 
00191 
00200 int sb_daemon_detach(const char *rundir);
00201 
00202 
00203 
00211 int sb_daemon_init(const char *name,
00212                     const char *rundir,
00213                     const char *pidfile);
00214 
00215 
00216 
00222 int sb_daemon_is_running(const char *pidfile);
00223 
00224 
00225 
00231 int sb_daemon_destroy(const char *pidfile);
00232 
00233 
00234 
00243 int sb_daemon_pidfile_create_and_lock(const char *pidfile);
00244 
00245 
00246 
00252 int sb_daemon_pidfile_write(int fd);
00253 
00254 
00255 
00261 pid_t sb_daemon_pidfile_read(const char *pidfile);
00262 
00263 
00264 
00265 #if defined(__cplusplus)
00266 }
00267 #endif
00268 
00269 #endif
00270 
00271 

Generated on Wed Mar 30 13:43:26 2005 for Mntd by  doxygen 1.3.9.1