Merge "Refactor StructCapUser{Header,Data} and StructLinger for API review" am: c1edd696c7

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1689828

Change-Id: I014f6f840cf781c342f625d7859a9363381d9301
This commit is contained in:
Nikita Iashchenko
2021-05-17 11:04:01 +00:00
committed by Automerger Merge Worker
2 changed files with 10 additions and 10 deletions

View File

@@ -21,8 +21,8 @@ import android.os.Trace;
import android.system.ErrnoException; import android.system.ErrnoException;
import android.system.Os; import android.system.Os;
import android.system.OsConstants; import android.system.OsConstants;
import android.system.StructCapUserData; import android.system.StructUserCapData;
import android.system.StructCapUserHeader; import android.system.StructUserCapHeader;
import android.util.Slog; import android.util.Slog;
import android.util.TimingsTraceLog; import android.util.TimingsTraceLog;
@@ -187,9 +187,9 @@ public class WrapperInit {
* capabilities, which may make it crash, but not exceed its allowances. * capabilities, which may make it crash, but not exceed its allowances.
*/ */
private static void preserveCapabilities() { private static void preserveCapabilities() {
StructCapUserHeader header = new StructCapUserHeader( StructUserCapHeader header = new StructUserCapHeader(
OsConstants._LINUX_CAPABILITY_VERSION_3, 0); OsConstants._LINUX_CAPABILITY_VERSION_3, 0);
StructCapUserData[] data; StructUserCapData[] data;
try { try {
data = Os.capget(header); data = Os.capget(header);
} catch (ErrnoException e) { } catch (ErrnoException e) {
@@ -199,9 +199,9 @@ public class WrapperInit {
if (data[0].permitted != data[0].inheritable || if (data[0].permitted != data[0].inheritable ||
data[1].permitted != data[1].inheritable) { data[1].permitted != data[1].inheritable) {
data[0] = new StructCapUserData(data[0].effective, data[0].permitted, data[0] = new StructUserCapData(data[0].effective, data[0].permitted,
data[0].permitted); data[0].permitted);
data[1] = new StructCapUserData(data[1].effective, data[1].permitted, data[1] = new StructUserCapData(data[1].effective, data[1].permitted,
data[1].permitted); data[1].permitted);
try { try {
Os.capset(header, data); Os.capset(header, data);

View File

@@ -45,8 +45,8 @@ import android.security.keystore2.AndroidKeyStoreProvider;
import android.system.ErrnoException; import android.system.ErrnoException;
import android.system.Os; import android.system.Os;
import android.system.OsConstants; import android.system.OsConstants;
import android.system.StructCapUserData; import android.system.StructUserCapData;
import android.system.StructCapUserHeader; import android.system.StructUserCapHeader;
import android.text.Hyphenator; import android.text.Hyphenator;
import android.util.EventLog; import android.util.EventLog;
import android.util.Log; import android.util.Log;
@@ -742,9 +742,9 @@ public class ZygoteInit {
OsConstants.CAP_BLOCK_SUSPEND OsConstants.CAP_BLOCK_SUSPEND
); );
/* Containers run without some capabilities, so drop any caps that are not available. */ /* Containers run without some capabilities, so drop any caps that are not available. */
StructCapUserHeader header = new StructCapUserHeader( StructUserCapHeader header = new StructUserCapHeader(
OsConstants._LINUX_CAPABILITY_VERSION_3, 0); OsConstants._LINUX_CAPABILITY_VERSION_3, 0);
StructCapUserData[] data; StructUserCapData[] data;
try { try {
data = Os.capget(header); data = Os.capget(header);
} catch (ErrnoException ex) { } catch (ErrnoException ex) {