Skip to content

Commit 4efe691

Browse files
committed
Add apple tvos support
1 parent b28132b commit 4efe691

34 files changed

+404
-107
lines changed

src/dir.rs

+1
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

+39-9
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,35 @@ 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(target_os = "macos", target_os = "ios", target_os = "tvos"))]
10471070
EPWROFF => "Device power is off",
10481071

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

1052-
#[cfg(any(target_os = "macos", target_os = "ios"))]
1075+
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))]
10531076
EBADEXEC => "Bad executable",
10541077

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

1058-
#[cfg(any(target_os = "macos", target_os = "ios"))]
1081+
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))]
10591082
ESHLIBVERS => "Shared library version mismatch",
10601083

1061-
#[cfg(any(target_os = "macos", target_os = "ios"))]
1084+
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))]
10621085
EBADMACHO => "Malformed Macho file",
10631086

10641087
#[cfg(any(
10651088
target_os = "macos",
10661089
target_os = "ios",
1090+
target_os = "tvos",
10671091
target_os = "netbsd",
10681092
target_os = "haiku"
10691093
))]
@@ -1073,6 +1097,7 @@ fn desc(errno: Errno) -> &'static str {
10731097
target_os = "macos",
10741098
target_os = "ios",
10751099
target_os = "aix",
1100+
target_os = "tvos",
10761101
target_os = "netbsd",
10771102
target_os = "redox"
10781103
))]
@@ -1081,6 +1106,7 @@ fn desc(errno: Errno) -> &'static str {
10811106
#[cfg(any(
10821107
target_os = "macos",
10831108
target_os = "ios",
1109+
target_os = "tvos",
10841110
target_os = "netbsd",
10851111
target_os = "haiku"
10861112
))]
@@ -1090,6 +1116,7 @@ fn desc(errno: Errno) -> &'static str {
10901116
target_os = "macos",
10911117
target_os = "ios",
10921118
target_os = "aix",
1119+
target_os = "tvos",
10931120
target_os = "netbsd",
10941121
target_os = "redox"
10951122
))]
@@ -1099,6 +1126,7 @@ fn desc(errno: Errno) -> &'static str {
10991126
target_os = "macos",
11001127
target_os = "ios",
11011128
target_os = "aix",
1129+
target_os = "tvos",
11021130
target_os = "netbsd",
11031131
target_os = "redox"
11041132
))]
@@ -1108,6 +1136,7 @@ fn desc(errno: Errno) -> &'static str {
11081136
target_os = "macos",
11091137
target_os = "ios",
11101138
target_os = "aix",
1139+
target_os = "tvos",
11111140
target_os = "netbsd",
11121141
target_os = "redox"
11131142
))]
@@ -1117,15 +1146,16 @@ fn desc(errno: Errno) -> &'static str {
11171146
target_os = "macos",
11181147
target_os = "ios",
11191148
target_os = "aix",
1149+
target_os = "tvos",
11201150
target_os = "illumos",
11211151
target_os = "solaris"
11221152
))]
11231153
EOPNOTSUPP => "Operation not supported on socket",
11241154

1125-
#[cfg(any(target_os = "macos", target_os = "ios"))]
1155+
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))]
11261156
ENOPOLICY => "No such policy registered",
11271157

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

11311161
#[cfg(target_os = "openbsd")]
@@ -1438,7 +1468,7 @@ mod consts {
14381468
}
14391469
}
14401470

1441-
#[cfg(any(target_os = "macos", target_os = "ios"))]
1471+
#[cfg(any(target_os = "macos", target_os = "tvos", target_os = "ios"))]
14421472
mod consts {
14431473
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
14441474
#[repr(i32)]

src/fcntl.rs

+22-4
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

+1
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)