Skip to content

Commit 1139633

Browse files
committed
Remove commands unsupported by Mono.Unix on Linux
1 parent a7f7cc8 commit 1139633

File tree

2 files changed

+7
-16
lines changed

2 files changed

+7
-16
lines changed

Src/IronPython.Modules/fcntl.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ a file object.
4444

4545
public static int F_DUPFD => 0;
4646

47-
[PythonHidden(PlatformID.MacOSX)]
48-
[SupportedOSPlatform("linux")]
49-
public static int F_DUPFD_CLOEXEC => 1030;
50-
5147
[PythonHidden(PlatformID.MacOSX)]
5248
[SupportedOSPlatform("linux")]
5349
public static int F_EXLCK => 4;
@@ -68,10 +64,6 @@ a file object.
6864

6965
public static int F_GETOWN => RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? 5 : 9;
7066

71-
[PythonHidden(PlatformID.MacOSX)]
72-
[SupportedOSPlatform("linux")]
73-
public static int F_GETPIPE_SZ => 1032;
74-
7567
[PythonHidden(PlatformID.MacOSX)]
7668
[SupportedOSPlatform("linux")]
7769
public static int F_GETSIG => 11;
@@ -140,10 +132,6 @@ a file object.
140132

141133
public static int F_SETOWN => RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? 6 : 8;
142134

143-
[PythonHidden(PlatformID.MacOSX)]
144-
[SupportedOSPlatform("linux")]
145-
public static int F_SETPIPE_SZ => 1031;
146-
147135
[PythonHidden(PlatformID.MacOSX)]
148136
[SupportedOSPlatform("linux")]
149137
public static int F_SETSIG => 10;

Src/Scripts/generate_os_codes.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,18 +236,21 @@ def generate_common_O_flags(cw):
236236
# python3 -c 'import fcntl;print(dict(sorted((s, getattr(fcntl, s)) for s in dir(fcntl) if s.startswith("F_"))))'
237237
# Python 3.6.15 [GCC 12.2.0] on linux 6.10.14
238238
FD_commands_linux = {'F_ADD_SEALS': 1033, 'F_DUPFD': 0, 'F_DUPFD_CLOEXEC': 1030, 'F_EXLCK': 4, 'F_GETFD': 1, 'F_GETFL': 3, 'F_GETLEASE': 1025, 'F_GETLK': 5, 'F_GETLK64': 5, 'F_GETOWN': 9, 'F_GETPIPE_SZ': 1032, 'F_GETSIG': 11, 'F_GET_SEALS': 1034, 'F_NOTIFY': 1026, 'F_OFD_GETLK': 36, 'F_OFD_SETLK': 37, 'F_OFD_SETLKW': 38, 'F_RDLCK': 0, 'F_SEAL_GROW': 4, 'F_SEAL_SEAL': 1, 'F_SEAL_SHRINK': 2, 'F_SEAL_WRITE': 8, 'F_SETFD': 2, 'F_SETFL': 4, 'F_SETLEASE': 1024, 'F_SETLK': 6, 'F_SETLK64': 6, 'F_SETLKW': 7, 'F_SETLKW64': 7, 'F_SETOWN': 8, 'F_SETPIPE_SZ': 1031, 'F_SETSIG': 10, 'F_SHLCK': 8, 'F_UNLCK': 2, 'F_WRLCK': 1}
239+
# Unsupported by Mono.Unix 7.1.0-final.1.21458.1 on linux
240+
FD_commands_linux_unsupported = ['F_DUPFD_CLOEXEC', 'F_GETPIPE_SZ', 'F_SETPIPE_SZ']
239241
# Python 3.7.0 [Clang 4.0.1 ] on darwin 24.2.0
240242
FD_commands_darwin = {'F_DUPFD': 0, 'F_DUPFD_CLOEXEC': 67, 'F_FULLFSYNC': 51, 'F_GETFD': 1, 'F_GETFL': 3, 'F_GETLK': 7, 'F_GETOWN': 5, 'F_NOCACHE': 48, 'F_RDLCK': 1, 'F_SETFD': 2, 'F_SETFL': 4, 'F_SETLK': 8, 'F_SETLKW': 9, 'F_SETOWN': 6, 'F_UNLCK': 2, 'F_WRLCK': 3}
241243
# Unsupported by Mono.Unix 7.1.0-final.1.21458.1 on darwin
242-
FD_commands_darwin.pop('F_DUPFD_CLOEXEC')
243-
FD_commands_darwin.pop('F_FULLFSYNC')
244+
FD_commands_darwin_unsupported = ['F_DUPFD_CLOEXEC', 'F_FULLFSYNC']
244245

245246
def generate_FD_commands(cw):
246247
codeval = {}
247248
for name in FD_commands_linux:
248-
set_value(codeval, name, FD_commands_linux[name], linux_idx)
249+
if name not in FD_commands_linux_unsupported:
250+
set_value(codeval, name, FD_commands_linux[name], linux_idx)
249251
for name in FD_commands_darwin:
250-
set_value(codeval, name, FD_commands_darwin[name], darwin_idx)
252+
if name not in FD_commands_darwin_unsupported:
253+
set_value(codeval, name, FD_commands_darwin[name], darwin_idx)
251254
codeval = OrderedDict(sorted(codeval.items()))
252255
generate_codes(cw, codeval, 'public', str, unix_only=True)
253256

0 commit comments

Comments
 (0)