Skip to content

Commit eaf0973

Browse files
committed
Add apple tvos support
1 parent b28132b commit eaf0973

34 files changed

+408
-107
lines changed

src/dir.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ impl Entry {
231231
target_os = "haiku",
232232
target_os = "illumos",
233233
target_os = "ios",
234+
target_os = "tvos",
234235
target_os = "l4re",
235236
target_os = "linux",
236237
target_os = "macos",

src/errno.rs

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ pub use self::consts::*;
99
cfg_if! {
1010
if #[cfg(any(target_os = "freebsd",
1111
target_os = "ios",
12+
target_os = "tvos",
1213
target_os = "macos"))] {
1314
unsafe fn errno_location() -> *mut c_int {
1415
libc::__error()
@@ -800,6 +801,7 @@ fn desc(errno: Errno) -> &'static str {
800801
target_os = "freebsd",
801802
target_os = "dragonfly",
802803
target_os = "ios",
804+
target_os = "tvos",
803805
target_os = "openbsd",
804806
target_os = "netbsd"
805807
))]
@@ -810,6 +812,7 @@ fn desc(errno: Errno) -> &'static str {
810812
target_os = "freebsd",
811813
target_os = "dragonfly",
812814
target_os = "ios",
815+
target_os = "tvos",
813816
target_os = "openbsd",
814817
target_os = "netbsd",
815818
target_os = "redox",
@@ -823,6 +826,7 @@ fn desc(errno: Errno) -> &'static str {
823826
target_os = "freebsd",
824827
target_os = "dragonfly",
825828
target_os = "ios",
829+
target_os = "tvos",
826830
target_os = "netbsd",
827831
target_os = "redox",
828832
target_os = "haiku"
@@ -834,6 +838,7 @@ fn desc(errno: Errno) -> &'static str {
834838
target_os = "freebsd",
835839
target_os = "dragonfly",
836840
target_os = "ios",
841+
target_os = "tvos",
837842
target_os = "openbsd",
838843
target_os = "netbsd",
839844
target_os = "haiku"
@@ -845,6 +850,7 @@ fn desc(errno: Errno) -> &'static str {
845850
target_os = "freebsd",
846851
target_os = "dragonfly",
847852
target_os = "ios",
853+
target_os = "tvos",
848854
target_os = "openbsd",
849855
target_os = "netbsd",
850856
target_os = "redox",
@@ -857,6 +863,7 @@ fn desc(errno: Errno) -> &'static str {
857863
target_os = "freebsd",
858864
target_os = "dragonfly",
859865
target_os = "ios",
866+
target_os = "tvos",
860867
target_os = "openbsd",
861868
target_os = "netbsd",
862869
target_os = "redox",
@@ -869,6 +876,7 @@ fn desc(errno: Errno) -> &'static str {
869876
target_os = "freebsd",
870877
target_os = "dragonfly",
871878
target_os = "ios",
879+
target_os = "tvos",
872880
target_os = "openbsd"
873881
))]
874882
ENOTRECOVERABLE => "State not recoverable",
@@ -878,6 +886,7 @@ fn desc(errno: Errno) -> &'static str {
878886
target_os = "freebsd",
879887
target_os = "dragonfly",
880888
target_os = "ios",
889+
target_os = "tvos",
881890
target_os = "openbsd"
882891
))]
883892
EOWNERDEAD => "Previous owner died",
@@ -887,6 +896,7 @@ fn desc(errno: Errno) -> &'static str {
887896
target_os = "freebsd",
888897
target_os = "dragonfly",
889898
target_os = "ios",
899+
target_os = "tvos",
890900
target_os = "openbsd",
891901
target_os = "netbsd",
892902
target_os = "aix",
@@ -901,6 +911,7 @@ fn desc(errno: Errno) -> &'static str {
901911
target_os = "freebsd",
902912
target_os = "dragonfly",
903913
target_os = "ios",
914+
target_os = "tvos",
904915
target_os = "aix",
905916
target_os = "openbsd",
906917
target_os = "netbsd"
@@ -912,6 +923,7 @@ fn desc(errno: Errno) -> &'static str {
912923
target_os = "freebsd",
913924
target_os = "dragonfly",
914925
target_os = "ios",
926+
target_os = "tvos",
915927
target_os = "aix",
916928
target_os = "openbsd",
917929
target_os = "netbsd",
@@ -924,6 +936,7 @@ fn desc(errno: Errno) -> &'static str {
924936
target_os = "freebsd",
925937
target_os = "dragonfly",
926938
target_os = "ios",
939+
target_os = "tvos",
927940
target_os = "openbsd",
928941
target_os = "netbsd",
929942
target_os = "redox",
@@ -939,6 +952,7 @@ fn desc(errno: Errno) -> &'static str {
939952
target_os = "freebsd",
940953
target_os = "dragonfly",
941954
target_os = "ios",
955+
target_os = "tvos",
942956
target_os = "openbsd",
943957
target_os = "netbsd",
944958
target_os = "redox",
@@ -954,6 +968,7 @@ fn desc(errno: Errno) -> &'static str {
954968
target_os = "freebsd",
955969
target_os = "dragonfly",
956970
target_os = "ios",
971+
target_os = "tvos",
957972
target_os = "aix",
958973
target_os = "openbsd",
959974
target_os = "netbsd",
@@ -966,6 +981,7 @@ fn desc(errno: Errno) -> &'static str {
966981
target_os = "freebsd",
967982
target_os = "dragonfly",
968983
target_os = "ios",
984+
target_os = "tvos",
969985
target_os = "openbsd",
970986
target_os = "netbsd"
971987
))]
@@ -976,6 +992,7 @@ fn desc(errno: Errno) -> &'static str {
976992
target_os = "freebsd",
977993
target_os = "dragonfly",
978994
target_os = "ios",
995+
target_os = "tvos",
979996
target_os = "openbsd",
980997
target_os = "netbsd"
981998
))]
@@ -986,6 +1003,7 @@ fn desc(errno: Errno) -> &'static str {
9861003
target_os = "freebsd",
9871004
target_os = "dragonfly",
9881005
target_os = "ios",
1006+
target_os = "tvos",
9891007
target_os = "openbsd",
9901008
target_os = "netbsd"
9911009
))]
@@ -996,6 +1014,7 @@ fn desc(errno: Errno) -> &'static str {
9961014
target_os = "freebsd",
9971015
target_os = "dragonfly",
9981016
target_os = "ios",
1017+
target_os = "tvos",
9991018
target_os = "openbsd",
10001019
target_os = "netbsd"
10011020
))]
@@ -1006,6 +1025,7 @@ fn desc(errno: Errno) -> &'static str {
10061025
target_os = "freebsd",
10071026
target_os = "dragonfly",
10081027
target_os = "ios",
1028+
target_os = "tvos",
10091029
target_os = "openbsd",
10101030
target_os = "netbsd"
10111031
))]
@@ -1016,6 +1036,7 @@ fn desc(errno: Errno) -> &'static str {
10161036
target_os = "freebsd",
10171037
target_os = "dragonfly",
10181038
target_os = "ios",
1039+
target_os = "tvos",
10191040
target_os = "openbsd",
10201041
target_os = "netbsd"
10211042
))]
@@ -1026,6 +1047,7 @@ fn desc(errno: Errno) -> &'static str {
10261047
target_os = "freebsd",
10271048
target_os = "dragonfly",
10281049
target_os = "ios",
1050+
target_os = "tvos",
10291051
target_os = "openbsd",
10301052
target_os = "netbsd"
10311053
))]
@@ -1037,33 +1059,39 @@ fn desc(errno: Errno) -> &'static str {
10371059
target_os = "dragonfly",
10381060
target_os = "ios",
10391061
target_os = "aix",
1062+
target_os = "tvos",
10401063
target_os = "openbsd",
10411064
target_os = "netbsd",
10421065
target_os = "redox"
10431066
))]
10441067
ECANCELED => "Operation canceled",
10451068

1046-
#[cfg(any(target_os = "macos", target_os = "ios"))]
1069+
#[cfg(any(
1070+
target_os = "macos",
1071+
target_os = "ios",
1072+
target_os = "tvos"
1073+
))]
10471074
EPWROFF => "Device power is off",
10481075

1049-
#[cfg(any(target_os = "macos", target_os = "ios"))]
1076+
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))]
10501077
EDEVERR => "Device error, e.g. paper out",
10511078

1052-
#[cfg(any(target_os = "macos", target_os = "ios"))]
1079+
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))]
10531080
EBADEXEC => "Bad executable",
10541081

1055-
#[cfg(any(target_os = "macos", target_os = "ios"))]
1082+
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))]
10561083
EBADARCH => "Bad CPU type in executable",
10571084

1058-
#[cfg(any(target_os = "macos", target_os = "ios"))]
1085+
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))]
10591086
ESHLIBVERS => "Shared library version mismatch",
10601087

1061-
#[cfg(any(target_os = "macos", target_os = "ios"))]
1088+
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))]
10621089
EBADMACHO => "Malformed Macho file",
10631090

10641091
#[cfg(any(
10651092
target_os = "macos",
10661093
target_os = "ios",
1094+
target_os = "tvos",
10671095
target_os = "netbsd",
10681096
target_os = "haiku"
10691097
))]
@@ -1073,6 +1101,7 @@ fn desc(errno: Errno) -> &'static str {
10731101
target_os = "macos",
10741102
target_os = "ios",
10751103
target_os = "aix",
1104+
target_os = "tvos",
10761105
target_os = "netbsd",
10771106
target_os = "redox"
10781107
))]
@@ -1081,6 +1110,7 @@ fn desc(errno: Errno) -> &'static str {
10811110
#[cfg(any(
10821111
target_os = "macos",
10831112
target_os = "ios",
1113+
target_os = "tvos",
10841114
target_os = "netbsd",
10851115
target_os = "haiku"
10861116
))]
@@ -1090,6 +1120,7 @@ fn desc(errno: Errno) -> &'static str {
10901120
target_os = "macos",
10911121
target_os = "ios",
10921122
target_os = "aix",
1123+
target_os = "tvos",
10931124
target_os = "netbsd",
10941125
target_os = "redox"
10951126
))]
@@ -1099,6 +1130,7 @@ fn desc(errno: Errno) -> &'static str {
10991130
target_os = "macos",
11001131
target_os = "ios",
11011132
target_os = "aix",
1133+
target_os = "tvos",
11021134
target_os = "netbsd",
11031135
target_os = "redox"
11041136
))]
@@ -1108,6 +1140,7 @@ fn desc(errno: Errno) -> &'static str {
11081140
target_os = "macos",
11091141
target_os = "ios",
11101142
target_os = "aix",
1143+
target_os = "tvos",
11111144
target_os = "netbsd",
11121145
target_os = "redox"
11131146
))]
@@ -1117,15 +1150,16 @@ fn desc(errno: Errno) -> &'static str {
11171150
target_os = "macos",
11181151
target_os = "ios",
11191152
target_os = "aix",
1153+
target_os = "tvos",
11201154
target_os = "illumos",
11211155
target_os = "solaris"
11221156
))]
11231157
EOPNOTSUPP => "Operation not supported on socket",
11241158

1125-
#[cfg(any(target_os = "macos", target_os = "ios"))]
1159+
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))]
11261160
ENOPOLICY => "No such policy registered",
11271161

1128-
#[cfg(any(target_os = "macos", target_os = "ios"))]
1162+
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))]
11291163
EQFULL => "Interface output queue is full",
11301164

11311165
#[cfg(target_os = "openbsd")]
@@ -1438,7 +1472,7 @@ mod consts {
14381472
}
14391473
}
14401474

1441-
#[cfg(any(target_os = "macos", target_os = "ios"))]
1475+
#[cfg(any(target_os = "macos", target_os = "tvos", target_os = "ios"))]
14421476
mod consts {
14431477
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
14441478
#[repr(i32)]

src/fcntl.rs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use libc::{self, c_int, c_uint, size_t, ssize_t};
66
target_os = "netbsd",
77
target_os = "macos",
88
target_os = "ios",
9+
target_os = "tvos",
910
target_os = "dragonfly",
1011
all(target_os = "freebsd", target_arch = "x86_64"),
1112
))]
@@ -20,6 +21,7 @@ use std::os::unix::io::RawFd;
2021
target_os = "netbsd",
2122
target_os = "macos",
2223
target_os = "ios",
24+
target_os = "tvos",
2325
target_os = "dragonfly",
2426
all(target_os = "freebsd", target_arch = "x86_64"),
2527
))]
@@ -107,6 +109,7 @@ libc_bitflags!(
107109
/// Implicitly follow each `write()` with an `fdatasync()`.
108110
#[cfg(any(target_os = "android",
109111
target_os = "ios",
112+
target_os = "tvos",
110113
target_os = "linux",
111114
target_os = "macos",
112115
target_os = "netbsd",
@@ -123,6 +126,7 @@ libc_bitflags!(
123126
#[cfg(any(target_os = "dragonfly",
124127
target_os = "freebsd",
125128
target_os = "ios",
129+
target_os = "tvos",
126130
target_os = "macos",
127131
target_os = "netbsd",
128132
target_os = "openbsd",
@@ -133,6 +137,7 @@ libc_bitflags!(
133137
#[cfg(any(target_os = "dragonfly",
134138
target_os = "freebsd",
135139
target_os = "ios",
140+
target_os = "tvos",
136141
all(target_os = "linux", not(target_env = "musl")),
137142
target_os = "macos",
138143
target_os = "netbsd",
@@ -190,6 +195,7 @@ libc_bitflags!(
190195
#[cfg(any(target_os = "dragonfly",
191196
target_os = "freebsd",
192197
target_os = "ios",
198+
target_os = "tvos",
193199
target_os = "macos",
194200
target_os = "netbsd",
195201
target_os = "openbsd",
@@ -501,13 +507,19 @@ pub enum FcntlArg<'a> {
501507
target_os = "freebsd"
502508
))]
503509
F_GET_SEALS,
504-
#[cfg(any(target_os = "macos", target_os = "ios"))]
510+
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos",))]
505511
F_FULLFSYNC,
506512
#[cfg(any(target_os = "linux", target_os = "android"))]
507513
F_GETPIPE_SZ,
508514
#[cfg(any(target_os = "linux", target_os = "android"))]
509515
F_SETPIPE_SZ(c_int),
510-
#[cfg(any(target_os = "netbsd", target_os = "dragonfly", target_os = "macos", target_os = "ios"))]
516+
#[cfg(any(
517+
target_os = "netbsd",
518+
target_os = "dragonfly",
519+
target_os = "macos",
520+
target_os = "ios",
521+
target_os = "tvos",
522+
))]
511523
F_GETPATH(&'a mut PathBuf),
512524
#[cfg(all(target_os = "freebsd", target_arch = "x86_64"))]
513525
F_KINFO(&'a mut PathBuf),
@@ -565,13 +577,19 @@ pub fn fcntl(fd: RawFd, arg: FcntlArg) -> Result<c_int> {
565577
target_os = "freebsd"
566578
))]
567579
F_GET_SEALS => libc::fcntl(fd, libc::F_GET_SEALS),
568-
#[cfg(any(target_os = "macos", target_os = "ios"))]
580+
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos",))]
569581
F_FULLFSYNC => libc::fcntl(fd, libc::F_FULLFSYNC),
570582
#[cfg(any(target_os = "linux", target_os = "android"))]
571583
F_GETPIPE_SZ => libc::fcntl(fd, libc::F_GETPIPE_SZ),
572584
#[cfg(any(target_os = "linux", target_os = "android"))]
573585
F_SETPIPE_SZ(size) => libc::fcntl(fd, libc::F_SETPIPE_SZ, size),
574-
#[cfg(any(target_os = "dragonfly", target_os = "netbsd", target_os = "macos", target_os = "ios"))]
586+
#[cfg(any(
587+
target_os = "dragonfly",
588+
target_os = "netbsd",
589+
target_os = "macos",
590+
target_os = "ios",
591+
target_os = "tvos"
592+
))]
575593
F_GETPATH(path) => {
576594
let mut buffer = vec![0; libc::PATH_MAX as usize];
577595
let res = libc::fcntl(fd, libc::F_GETPATH, buffer.as_mut_ptr());

src/features.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ mod os {
116116
target_os = "aix",
117117
target_os = "macos",
118118
target_os = "ios",
119+
target_os = "tvos",
119120
target_os = "fuchsia",
120121
target_os = "haiku",
121122
target_os = "solaris"

0 commit comments

Comments
 (0)