1 /*
2  * (c) 2008-2009 Alexander Warg <warg@os.inf.tu-dresden.de>
3  *     economic rights: Technische Universität Dresden (Germany)
4  * This file is part of TUD:OS and distributed under the terms of the
5  * GNU Lesser General Public License 2.1.
6  * Please see the COPYING-LGPL-2.1 file for details.
7  */
8 #include <l4/sys/kip.h>
9 #include <l4/util/kip.h>
10 
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <string.h>
14 
15 
16 L4_CV int
l4util_kip_kernel_is_ux(l4_kernel_info_t * k)17 l4util_kip_kernel_is_ux(l4_kernel_info_t *k)
18 {
19   const char *s = l4_kip_version_string(k);
20 
21   if (s && strstr(s, "(ux)"))
22     return 1;
23   return 0;
24 }
25 
26 L4_CV int
l4util_kip_kernel_has_feature(l4_kernel_info_t * k,const char * str)27 l4util_kip_kernel_has_feature(l4_kernel_info_t *k, const char *str)
28 {
29   const char *s = l4_kip_version_string(k);
30 
31   if (!s)
32     return 0;
33 
34   l4util_kip_for_each_feature(s)
35     {
36       if (strcmp(s, str) == 0)
37 	return 1;
38     }
39 
40   return 0;
41 }
42 
43 L4_CV unsigned long
l4util_kip_kernel_abi_version(l4_kernel_info_t * k)44 l4util_kip_kernel_abi_version(l4_kernel_info_t *k)
45 {
46   const char *s = l4_kip_version_string(k);
47 
48   if (!s)
49     return 0;
50 
51   l4util_kip_for_each_feature(s)
52     {
53       if (strncmp(s, "abiver:", 7) == 0)
54 	return strtoul(s + 7, NULL, 0);
55     }
56 
57   return 0;
58 }
59