• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 2 of the License, or
7  * (at your option) any later version.
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, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #include <sys/utsname.h>
19 #include "test.h"
20 #include "tst_kernel.h"
21 
tst_kernel_bits(void)22 int tst_kernel_bits(void)
23 {
24 	struct utsname buf;
25 	int kernel_bits;
26 
27 	if (uname(&buf)) {
28 		tst_brkm(TBROK | TERRNO, NULL, "uname()");
29 		return -1;
30 	}
31 
32 	kernel_bits = strstr(buf.machine, "64") ? 64 : 32;
33 
34 	tst_resm(TINFO, "uname.machine=%s kernel is %ibit",
35 	         buf.machine, kernel_bits);
36 
37 	return kernel_bits;
38 }
39