Skip to content

Commit

Permalink
Remove commands unsupported by Mono.Unix
Browse files Browse the repository at this point in the history
  • Loading branch information
BCSharp committed Jan 15, 2025
1 parent e55c278 commit a7f7cc8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 4 additions & 6 deletions Src/IronPython.Modules/fcntl.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.

Expand Down Expand Up @@ -44,16 +44,14 @@ a file object.

public static int F_DUPFD => 0;

public static int F_DUPFD_CLOEXEC => RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? 67 : 1030;
[PythonHidden(PlatformID.MacOSX)]
[SupportedOSPlatform("linux")]
public static int F_DUPFD_CLOEXEC => 1030;

[PythonHidden(PlatformID.MacOSX)]
[SupportedOSPlatform("linux")]
public static int F_EXLCK => 4;

[PythonHidden(PlatformID.Unix)]
[SupportedOSPlatform("macos")]
public static int F_FULLFSYNC => 51;

public static int F_GETFD => 1;

public static int F_GETFL => 3;
Expand Down
3 changes: 3 additions & 0 deletions Src/Scripts/generate_os_codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,9 @@ def generate_common_O_flags(cw):
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}
# Python 3.7.0 [Clang 4.0.1 ] on darwin 24.2.0
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}
# Unsupported by Mono.Unix 7.1.0-final.1.21458.1 on darwin
FD_commands_darwin.pop('F_DUPFD_CLOEXEC')
FD_commands_darwin.pop('F_FULLFSYNC')

def generate_FD_commands(cw):
codeval = {}
Expand Down

0 comments on commit a7f7cc8

Please sign in to comment.