Elliott Hughes | 7341b9e | 2011-03-24 13:51:38 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Elliott Hughes | 5d930ca | 2014-04-23 17:53:37 -0700 | [diff] [blame] | 17 | package android.system; |
Elliott Hughes | 7341b9e | 2011-03-24 13:51:38 -0700 | [diff] [blame] | 18 | |
Elliott Hughes | fe77f81 | 2014-04-29 17:59:30 -0700 | [diff] [blame] | 19 | import libcore.util.Objects; |
| 20 | |
Elliott Hughes | 7341b9e | 2011-03-24 13:51:38 -0700 | [diff] [blame] | 21 | /** |
| 22 | * Information returned by uname(2). Corresponds to C's |
Elliott Hughes | 1c039d7 | 2011-05-04 16:04:04 -0700 | [diff] [blame] | 23 | * {@code struct utsname} from |
Elliott Hughes | 7341b9e | 2011-03-24 13:51:38 -0700 | [diff] [blame] | 24 | * <a href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_utsname.h.html"><sys/utsname.h></a> |
Elliott Hughes | 5d930ca | 2014-04-23 17:53:37 -0700 | [diff] [blame] | 25 | * |
| 26 | * @hide |
Elliott Hughes | 7341b9e | 2011-03-24 13:51:38 -0700 | [diff] [blame] | 27 | */ |
| 28 | public final class StructUtsname { |
Elliott Hughes | fe77f81 | 2014-04-29 17:59:30 -0700 | [diff] [blame] | 29 | /** The OS name, such as "Linux". */ |
| 30 | public final String sysname; |
Elliott Hughes | 7341b9e | 2011-03-24 13:51:38 -0700 | [diff] [blame] | 31 | |
Elliott Hughes | fe77f81 | 2014-04-29 17:59:30 -0700 | [diff] [blame] | 32 | /** The machine's unqualified name on some implementation-defined network. */ |
| 33 | public final String nodename; |
Elliott Hughes | 7341b9e | 2011-03-24 13:51:38 -0700 | [diff] [blame] | 34 | |
Elliott Hughes | fe77f81 | 2014-04-29 17:59:30 -0700 | [diff] [blame] | 35 | /** The OS release, such as "2.6.35-27-generic". */ |
| 36 | public final String release; |
Elliott Hughes | 7341b9e | 2011-03-24 13:51:38 -0700 | [diff] [blame] | 37 | |
Elliott Hughes | fe77f81 | 2014-04-29 17:59:30 -0700 | [diff] [blame] | 38 | /** The OS version, such as "#48-Ubuntu SMP Tue Feb 22 20:25:29 UTC 2011". */ |
| 39 | public final String version; |
Elliott Hughes | 7341b9e | 2011-03-24 13:51:38 -0700 | [diff] [blame] | 40 | |
Elliott Hughes | fe77f81 | 2014-04-29 17:59:30 -0700 | [diff] [blame] | 41 | /** The machine architecture, such as "armv7l" or "x86_64". */ |
| 42 | public final String machine; |
Elliott Hughes | 7341b9e | 2011-03-24 13:51:38 -0700 | [diff] [blame] | 43 | |
Elliott Hughes | fe77f81 | 2014-04-29 17:59:30 -0700 | [diff] [blame] | 44 | public StructUtsname(String sysname, String nodename, String release, String version, String machine) { |
| 45 | this.sysname = sysname; |
| 46 | this.nodename = nodename; |
| 47 | this.release = release; |
| 48 | this.version = version; |
| 49 | this.machine = machine; |
| 50 | } |
| 51 | |
| 52 | @Override public String toString() { |
| 53 | return Objects.toString(this); |
| 54 | } |
Elliott Hughes | 7341b9e | 2011-03-24 13:51:38 -0700 | [diff] [blame] | 55 | } |