1482a3fc5635ac431b8a7476d7fe3397af4c2e8ecElliott Hughes/*
2482a3fc5635ac431b8a7476d7fe3397af4c2e8ecElliott Hughes * Copyright (C) 2013 The Android Open Source Project
3482a3fc5635ac431b8a7476d7fe3397af4c2e8ecElliott Hughes *
4482a3fc5635ac431b8a7476d7fe3397af4c2e8ecElliott Hughes * Licensed under the Apache License, Version 2.0 (the "License");
5482a3fc5635ac431b8a7476d7fe3397af4c2e8ecElliott Hughes * you may not use this file except in compliance with the License.
6482a3fc5635ac431b8a7476d7fe3397af4c2e8ecElliott Hughes * You may obtain a copy of the License at
7482a3fc5635ac431b8a7476d7fe3397af4c2e8ecElliott Hughes *
8482a3fc5635ac431b8a7476d7fe3397af4c2e8ecElliott Hughes *      http://www.apache.org/licenses/LICENSE-2.0
9482a3fc5635ac431b8a7476d7fe3397af4c2e8ecElliott Hughes *
10482a3fc5635ac431b8a7476d7fe3397af4c2e8ecElliott Hughes * Unless required by applicable law or agreed to in writing, software
11482a3fc5635ac431b8a7476d7fe3397af4c2e8ecElliott Hughes * distributed under the License is distributed on an "AS IS" BASIS,
12482a3fc5635ac431b8a7476d7fe3397af4c2e8ecElliott Hughes * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13482a3fc5635ac431b8a7476d7fe3397af4c2e8ecElliott Hughes * See the License for the specific language governing permissions and
14482a3fc5635ac431b8a7476d7fe3397af4c2e8ecElliott Hughes * limitations under the License.
15482a3fc5635ac431b8a7476d7fe3397af4c2e8ecElliott Hughes */
16482a3fc5635ac431b8a7476d7fe3397af4c2e8ecElliott Hughes
175d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughespackage android.system;
18482a3fc5635ac431b8a7476d7fe3397af4c2e8ecElliott Hughes
19fe77f817b540f2a66c17486a618bb9083a22070eElliott Hughesimport libcore.util.Objects;
20fe77f817b540f2a66c17486a618bb9083a22070eElliott Hughes
21482a3fc5635ac431b8a7476d7fe3397af4c2e8ecElliott Hughes/**
22482a3fc5635ac431b8a7476d7fe3397af4c2e8ecElliott Hughes * Corresponds to C's {@code struct ucred}.
235d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes *
245d930cadc8f62aee5f18e7921296fe66a54f18abElliott Hughes * @hide
25482a3fc5635ac431b8a7476d7fe3397af4c2e8ecElliott Hughes */
26482a3fc5635ac431b8a7476d7fe3397af4c2e8ecElliott Hughespublic final class StructUcred {
2787231677f5fb2403ad39f5c778c76ad8d5592d99Tobias Thierer    /** The peer's process id. */
2887231677f5fb2403ad39f5c778c76ad8d5592d99Tobias Thierer    public final int pid;
29482a3fc5635ac431b8a7476d7fe3397af4c2e8ecElliott Hughes
3087231677f5fb2403ad39f5c778c76ad8d5592d99Tobias Thierer    /** The peer process' uid. */
3187231677f5fb2403ad39f5c778c76ad8d5592d99Tobias Thierer    public final int uid;
32482a3fc5635ac431b8a7476d7fe3397af4c2e8ecElliott Hughes
3387231677f5fb2403ad39f5c778c76ad8d5592d99Tobias Thierer    /** The peer process' gid. */
3487231677f5fb2403ad39f5c778c76ad8d5592d99Tobias Thierer    public final int gid;
35482a3fc5635ac431b8a7476d7fe3397af4c2e8ecElliott Hughes
3687231677f5fb2403ad39f5c778c76ad8d5592d99Tobias Thierer    public StructUcred(int pid, int uid, int gid) {
3787231677f5fb2403ad39f5c778c76ad8d5592d99Tobias Thierer        this.pid = pid;
3887231677f5fb2403ad39f5c778c76ad8d5592d99Tobias Thierer        this.uid = uid;
3987231677f5fb2403ad39f5c778c76ad8d5592d99Tobias Thierer        this.gid = gid;
4087231677f5fb2403ad39f5c778c76ad8d5592d99Tobias Thierer    }
41482a3fc5635ac431b8a7476d7fe3397af4c2e8ecElliott Hughes
4287231677f5fb2403ad39f5c778c76ad8d5592d99Tobias Thierer    @Override public String toString() {
4387231677f5fb2403ad39f5c778c76ad8d5592d99Tobias Thierer        return Objects.toString(this);
4487231677f5fb2403ad39f5c778c76ad8d5592d99Tobias Thierer    }
45482a3fc5635ac431b8a7476d7fe3397af4c2e8ecElliott Hughes}
46