544403f3d1ad1591d724387b3106822542e09b12
[util-vserver.git] / lib / issupported.c
1 // $Id: issupported.c,v 1.4 2005/05/19 18:05:18 ensc Exp $    --*- c -*--
2
3 // Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
4 //  
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; version 2 of the License.
8 //  
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 // GNU General Public License for more details.
13 //  
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18
19 #ifdef HAVE_CONFIG_H
20 #  include <config.h>
21 #endif
22
23 #include "vserver.h"
24 #include "assert.h"
25
26 bool
27 vc_isSupported(vcFeatureSet feature)
28 {
29   int   ver = vc_get_version();
30   if (ver==-1) return false;
31
32   switch (feature) {
33     case vcFEATURE_COMPAT       :  return true;
34     case vcFEATURE_VSHELPER0    :  return ver >= 0x00010000 && ver < 0x00010010;
35     case vcFEATURE_VSHELPER     :  return ver >= 0x00010000;
36     case vcFEATURE_VKILL        :  return ver >= 0x00010004;
37     case vcFEATURE_RLIMIT       :  return ver >= 0x00010004;
38     case vcFEATURE_VINFO        :  return ver >= 0x00010010;
39     case vcFEATURE_VHI          :  return ver >= 0x00010010;
40     case vcFEATURE_IATTR        :  return ver >= 0x00010011;
41     case vcFEATURE_MIGRATE      :  return ver >= 0x00010012;
42     case vcFEATURE_NAMESPACE    :  return ver >= 0x00010012;
43     case vcFEATURE_VWAIT        :  return ver >= 0x00010025;
44     case vcFEATURE_SCHED        :  return ver >= 0x00020000;  // todo
45     default                     :  assert(false); 
46   }
47
48   return false;
49 }