server_s.h

00001 /*
00002  * Copyright (c) 2005-2012 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.15 2007/06/04 16:30:58 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 <klone_conf.h>
00019 #include <sys/types.h>
00020 #ifdef HAVE_SYS_SELECT
00021 #include <sys/select.h>
00022 #endif
00023 #include <u/libu.h>
00024 #include "child.h"
00025 
00026 enum { SERVER_MAX_CHILD_COUNT = 1024 };
00027 
00028 struct server_s 
00029 {
00030     u_config_t *config;     /* server config                                */
00031     ppc_t *ppc;             /* parent procedure call                        */
00032     backends_t bes;         /* backend list                                 */
00033     klog_t *klog;           /* klog device                                  */
00034     talarm_t *al_klog_flush;/* klog flush alarm                             */
00035     children_t *children;   /* children list                                */
00036     fd_set rdfds, wrfds, exfds;
00037     const char *chroot;     /* server chroot dir                            */
00038     int uid, gid;           /* uid/gid used to run the server               */
00039     int hfd;                /* highest set fd in fd_sets                    */
00040     size_t nbackend;        /* # of servers                                 */
00041     size_t nchild;          /* # of child (only in prefork mode)            */
00042     size_t max_child;       /* max # of children                            */
00043     /* int fork_child;    *//* # of child to fork when possible             */
00044     int stop;               /* >0 will stop the loop                        */
00045     int model;              /* server model                                 */
00046     int klog_flush;         /* >0 will flush the klog                       */
00047     int reap_children;      /* >0 will reap children (waitpid)              */
00048     int allow_root;         /* >0 allow root as the owner of kloned process */
00049     int blind_chroot;       /* if blind chroot mode is enabled or disabled  */
00050 };
00051 
00052 int server_get_backend_by_id(server_t *s, int id, backend_t **pbe);
00053 int server_spawn_child(server_t *s, backend_t *be);
00054 int server_cb_klog_flush(talarm_t *a, void *arg);
00055 
00056 #endif

←Products
Copyright © 2005-2012 - KoanLogic S.r.l. - All rights reserved