1d4419fce71d11ec8494525eca65e54d1aab51de6Elliott Hughes/*
2d4419fce71d11ec8494525eca65e54d1aab51de6Elliott Hughes * Copyright (C) 2011 The Android Open Source Project
3d4419fce71d11ec8494525eca65e54d1aab51de6Elliott Hughes *
4d4419fce71d11ec8494525eca65e54d1aab51de6Elliott Hughes * Licensed under the Apache License, Version 2.0 (the "License");
5d4419fce71d11ec8494525eca65e54d1aab51de6Elliott Hughes * you may not use this file except in compliance with the License.
6d4419fce71d11ec8494525eca65e54d1aab51de6Elliott Hughes * You may obtain a copy of the License at
7d4419fce71d11ec8494525eca65e54d1aab51de6Elliott Hughes *
8d4419fce71d11ec8494525eca65e54d1aab51de6Elliott Hughes *      http://www.apache.org/licenses/LICENSE-2.0
9d4419fce71d11ec8494525eca65e54d1aab51de6Elliott Hughes *
10d4419fce71d11ec8494525eca65e54d1aab51de6Elliott Hughes * Unless required by applicable law or agreed to in writing, software
11d4419fce71d11ec8494525eca65e54d1aab51de6Elliott Hughes * distributed under the License is distributed on an "AS IS" BASIS,
12d4419fce71d11ec8494525eca65e54d1aab51de6Elliott Hughes * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13d4419fce71d11ec8494525eca65e54d1aab51de6Elliott Hughes * See the License for the specific language governing permissions and
14d4419fce71d11ec8494525eca65e54d1aab51de6Elliott Hughes * limitations under the License.
15d4419fce71d11ec8494525eca65e54d1aab51de6Elliott Hughes */
16d4419fce71d11ec8494525eca65e54d1aab51de6Elliott Hughes
175d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughespackage android.system;
18d4419fce71d11ec8494525eca65e54d1aab51de6Elliott Hughes
19fe77f817b540f2a66c17486a618bb9083a22070eElliott Hughesimport libcore.util.Objects;
20fe77f817b540f2a66c17486a618bb9083a22070eElliott Hughes
21d4419fce71d11ec8494525eca65e54d1aab51de6Elliott Hughes/**
2234721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * Information returned by {@link Os#getpwnam} and {@link Os#getpwuid}. Corresponds to C's
2334721e8e0051258e87848bae25baf50722b4c76aElliott Hughes * {@code struct passwd} from {@code <pwd.h>}.
245d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes *
255d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes * @hide
26d4419fce71d11ec8494525eca65e54d1aab51de6Elliott Hughes */
27d4419fce71d11ec8494525eca65e54d1aab51de6Elliott Hughespublic final class StructPasswd {
28fe77f817b540f2a66c17486a618bb9083a22070eElliott Hughes  public final String pw_name;
29fe77f817b540f2a66c17486a618bb9083a22070eElliott Hughes  public final int pw_uid;
30fe77f817b540f2a66c17486a618bb9083a22070eElliott Hughes  public final int pw_gid;
31fe77f817b540f2a66c17486a618bb9083a22070eElliott Hughes  public final String pw_dir;
32fe77f817b540f2a66c17486a618bb9083a22070eElliott Hughes  public final String pw_shell;
33fe77f817b540f2a66c17486a618bb9083a22070eElliott Hughes
3434721e8e0051258e87848bae25baf50722b4c76aElliott Hughes  /**
3534721e8e0051258e87848bae25baf50722b4c76aElliott Hughes   * Constructs an instance with the given field values.
3634721e8e0051258e87848bae25baf50722b4c76aElliott Hughes   */
37fe77f817b540f2a66c17486a618bb9083a22070eElliott Hughes  public StructPasswd(String pw_name, int pw_uid, int pw_gid, String pw_dir, String pw_shell) {
38fe77f817b540f2a66c17486a618bb9083a22070eElliott Hughes    this.pw_name = pw_name;
39fe77f817b540f2a66c17486a618bb9083a22070eElliott Hughes    this.pw_uid = pw_uid;
40fe77f817b540f2a66c17486a618bb9083a22070eElliott Hughes    this.pw_gid = pw_gid;
41fe77f817b540f2a66c17486a618bb9083a22070eElliott Hughes    this.pw_dir = pw_dir;
42fe77f817b540f2a66c17486a618bb9083a22070eElliott Hughes    this.pw_shell = pw_shell;
43fe77f817b540f2a66c17486a618bb9083a22070eElliott Hughes  }
44d4419fce71d11ec8494525eca65e54d1aab51de6Elliott Hughes
45fe77f817b540f2a66c17486a618bb9083a22070eElliott Hughes  @Override public String toString() {
46fe77f817b540f2a66c17486a618bb9083a22070eElliott Hughes    return Objects.toString(this);
47fe77f817b540f2a66c17486a618bb9083a22070eElliott Hughes  }
48d4419fce71d11ec8494525eca65e54d1aab51de6Elliott Hughes}
49