00001 /* 00002 * Copyright (c) 2005, 2006 by KoanLogic s.r.l. <http://www.koanlogic.com> 00003 * All rights reserved. 00004 * 00005 * This file is part of KLone, and as such it is subject to the license stated 00006 * in the LICENSE file which you have received as part of this distribution. 00007 * 00008 * $Id: server_s.h,v 1.14 2006/04/22 13:59:01 tat Exp $ 00009 */ 00010 00011 #ifndef _KLONE_SERVER_S_H_ 00012 #define _KLONE_SERVER_S_H_ 00013 #include <stdlib.h> 00014 #include <klone/ppc.h> 00015 #include <klone/backend.h> 00016 #include <klone/klog.h> 00017 #include <klone/timer.h> 00018 #include <sys/types.h> 00019 #include <sys/select.h> 00020 #include <u/libu.h> 00021 #include "child.h" 00022 00023 enum { SERVER_MAX_CHILD_COUNT = 1024 }; 00024 00025 struct server_s 00026 { 00027 u_config_t *config; /* server config */ 00028 ppc_t *ppc; /* parent procedure call */ 00029 backends_t bes; /* backend list */ 00030 klog_t *klog; /* klog device */ 00031 talarm_t *al_klog_flush;/* klog flush alarm */ 00032 children_t *children; /* children list */ 00033 fd_set rdfds, wrfds, exfds; 00034 const char *chroot; /* server chroot dir */ 00035 int uid, gid; /* uid/gid used to run the server */ 00036 int hfd; /* highest set fd in fd_sets */ 00037 size_t nbackend; /* # of servers */ 00038 size_t nchild; /* # of child (only in prefork mode) */ 00039 size_t max_child; /* max # of children */ 00040 /* int fork_child; *//* # of child to fork when possible */ 00041 int stop; /* >0 will stop the loop */ 00042 int model; /* server model */ 00043 int klog_flush; /* >0 will flush the klog */ 00044 int reap_children; /* >0 will reap children (waitpid) */ 00045 int allow_root; /* >0 allow root as the owner of kloned process */ 00046 int blind_chroot; /* if blind chroot mode is enabled or disabled */ 00047 }; 00048 00049 int server_get_backend_by_id(server_t *s, int id, backend_t **pbe); 00050 int server_spawn_child(server_t *s, backend_t *be); 00051 00052 #endif