Skip to content

Commit e123efb

Browse files
committed
OsCompat.write never returns EINTR, rather throws InterruptedIOException
This is effectively clean up for previous commit but we're keeping git history for reference.
1 parent 8e3b1c3 commit e123efb

File tree

5 files changed

+1
-38
lines changed

5 files changed

+1
-38
lines changed

os-compat/src/main/java/androidx/system/OsConstants.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,5 @@
1717

1818
interface OsConstants {
1919

20-
int getConstant(String name);
21-
2220
String errnoName(int errno);
2321
}

os-compat/src/main/java/androidx/system/OsConstantsApi21.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,6 @@
44

55
@RequiresApi(21)
66
final class OsConstantsApi21 implements OsConstants {
7-
@Override
8-
public int getConstant(String name) {
9-
switch (name) {
10-
case "EINTR":
11-
return android.system.OsConstants.EINTR;
12-
default:
13-
// Add used constants above as needed.
14-
try {
15-
return android.system.OsConstants.class.getDeclaredField(name).getInt(null);
16-
} catch (ReflectiveOperationException e) {
17-
throw new RuntimeException(e);
18-
}
19-
}
20-
}
21-
227
@Override
238
public String errnoName(int errno) {
249
return android.system.OsConstants.errnoName(errno);

os-compat/src/main/java/androidx/system/OsConstantsCompat.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ private OsConstantsCompat() {
3333
}
3434
}
3535

36-
public static final int EINTR = IMPL.getConstant("EINTR");
37-
3836
/**
3937
* Returns the string name of an errno value.
4038
* For example, "EACCES". See {@link Os#strerror} for human-readable errno descriptions.

os-compat/src/main/java/androidx/system/OsConstantsLibcore.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,6 @@
11
package androidx.system;
22

33
final class OsConstantsLibcore implements OsConstants {
4-
@Override
5-
public int getConstant(String name) {
6-
switch (name) {
7-
case "EINTR":
8-
return libcore.io.OsConstants.EINTR;
9-
default:
10-
// Add used constants above as needed.
11-
try {
12-
return libcore.io.OsConstants.class.getDeclaredField(name).getInt(null);
13-
} catch (ReflectiveOperationException e) {
14-
throw new RuntimeException(e);
15-
}
16-
}
17-
}
18-
194
@Override
205
public String errnoName(int errno) {
216
return libcore.io.OsConstants.errnoName(errno);

server/src/main/java/com/genymobile/scrcpy/IO.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import androidx.system.ErrnoException;
44
import androidx.system.OsCompat;
5-
import androidx.system.OsConstantsCompat;
65

76
import java.io.FileDescriptor;
87
import java.io.IOException;
@@ -19,9 +18,7 @@ public static void writeFully(FileDescriptor fd, ByteBuffer from) throws IOExcep
1918
OsCompat.write(fd, from);
2019
}
2120
} catch (ErrnoException e) {
22-
if (e.getErrno() != OsConstantsCompat.EINTR) {
23-
throw new IOException(e);
24-
}
21+
throw new IOException(e);
2522
}
2623
}
2724

0 commit comments

Comments
 (0)