| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Preprocessor directives to support compilation on iOS/tvOS/watchOS were | ||
| added. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -92,6 +92,8 @@ | |
|
|
||
| #include <mach/mach.h> | ||
|
|
||
| #include "TargetConditionals.h" | ||
|
|
||
| #if defined(__has_builtin) | ||
| #if __has_builtin(__builtin_available) | ||
| #define HAVE_BUILTIN_AVAILABLE 1 | ||
| Expand Down Expand Up | @@ -376,6 +378,13 @@ corresponding Unix manual entries for more information on calls."); | |
| # define fsync _commit | ||
| #endif /* ! __WATCOMC__ || __QNX__ */ | ||
|
|
||
| // iOS/tvOS/watchOS *define* some POSIX methods, | ||
| // but raise a compiler error if they are used. | ||
| #if TARGET_OS_IPHONE | ||
| # undef HAVE_GETGROUPS | ||
|
Comment thread
Comment on lines
+381
to
+384
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityIf it's a compiler error, as opposed to a runtime error, then autoconf should be able to detect the problem. The comment should explain why that wasn't sufficient.
Sorry, something went wrong.
All reactions
|
||
| # undef HAVE_SYSTEM | ||
| #endif | ||
|
|
||
| /*[clinic input] | ||
| # one of the few times we lie about this name! | ||
| module os | ||
| Expand Down | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,10 @@ | ||
|
|
||
| /* UNIX password file access module */ | ||
|
|
||
| #ifdef __APPLE__ | ||
| # include "TargetConditionals.h" | ||
| #endif /* __APPLE__ */ | ||
|
|
||
| #include "Python.h" | ||
| #include "posixmodule.h" | ||
|
|
||
| Expand Down Expand Up | @@ -183,6 +187,22 @@ pwd_getpwuid(PyObject *module, PyObject *uidobj) | |
| if (nomem == 1) { | ||
| return PyErr_NoMemory(); | ||
| } | ||
|
|
||
| // iPhone has a "user" with UID 501, username "mobile"; but the simulator | ||
| // doesn't reflect this. Generate a simulated response. | ||
| #if TARGET_OS_SIMULATOR | ||
| if (uid == 501) { | ||
| struct passwd mp; | ||
| mp.pw_name = "mobile"; | ||
| mp.pw_passwd = "/smx7MYTQIi2M"; | ||
|
Comment thread
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityI see it's easy enough to Google, but there should still be a comment explaining what this value is and where it comes from.
Sorry, something went wrong.
All reactions
|
||
| mp.pw_uid = 501; | ||
| mp.pw_gid = 501; | ||
| mp.pw_gecos = "Mobile User"; | ||
| mp.pw_dir = "/var/mobile"; | ||
| mp.pw_shell = "/bin/sh"; | ||
| return mkpwent(module, &mp); | ||
| } | ||
| #endif | ||
| PyObject *uid_obj = _PyLong_FromUid(uid); | ||
| if (uid_obj == NULL) | ||
| return NULL; | ||
| Expand Down Expand Up | @@ -266,6 +286,22 @@ pwd_getpwnam_impl(PyObject *module, PyObject *name) | |
| PyErr_NoMemory(); | ||
| } | ||
| else { | ||
| // iPhone has a "user" with UID 501, username "mobile"; but the simulator | ||
| // doesn't reflect this. Generate a simulated response. | ||
| #if TARGET_OS_SIMULATOR | ||
| if (strcmp(name, "mobile") == 0) { | ||
| struct passwd mp; | ||
| mp.pw_name = "mobile"; | ||
| mp.pw_passwd = "/smx7MYTQIi2M"; | ||
| mp.pw_uid = 501; | ||
| mp.pw_gid = 501; | ||
| mp.pw_gecos = "Mobile User"; | ||
| mp.pw_dir = "/var/mobile"; | ||
| mp.pw_shell = "/bin/sh"; | ||
| retval = mkpwent(module, &mp); | ||
| goto out; | ||
| } | ||
| #endif | ||
| PyErr_Format(PyExc_KeyError, | ||
| "getpwnam(): name not found: %R", name); | ||
| } | ||
| Expand Down | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -6,6 +6,10 @@ | |
| #include "pycore_namespace.h" // _PyNamespace_New() | ||
| #include "pycore_runtime.h" // _Py_ID() | ||
|
|
||
| #ifdef __APPLE__ | ||
| # include "TargetConditionals.h" | ||
| #endif /* __APPLE__ */ | ||
|
|
||
| #include <time.h> // clock() | ||
| #ifdef HAVE_SYS_TIMES_H | ||
| # include <sys/times.h> // times() | ||
| Expand Down Expand Up | @@ -59,6 +63,10 @@ | |
| # define HAVE_CLOCK_GETTIME_RUNTIME 1 | ||
| #endif | ||
|
|
||
| // iOS/tvOS/watchOS *define* clock_settime, but it can't be used | ||
| #if TARGET_OS_IPHONE | ||
| # undef HAVE_CLOCK_SETTIME | ||
|
Comment thread
Comment on lines
+66
to
+68
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualitySame comment as above.
Sorry, something went wrong.
All reactions
|
||
| #endif | ||
|
|
||
| #define SEC_TO_NS (1000 * 1000 * 1000) | ||
|
|
||
| Expand Down | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -40,6 +40,16 @@ | |
| #endif | ||
|
|
||
|
|
||
| #ifdef __APPLE__ | ||
| # include "TargetConditionals.h" | ||
| #endif /* __APPLE__ */ | ||
|
|
||
| // iOS/tvOS/watchOS *define* some POSIX methods, | ||
| // but raise a compiler error if they are used. | ||
| #if TARGET_OS_IPHONE | ||
| # undef HAVE_GETENTROPY | ||
|
Comment thread
Comment on lines
+47
to
+50
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualitySame comment as above.
Sorry, something went wrong.
All reactions
|
||
| #endif | ||
|
|
||
| #ifdef Py_DEBUG | ||
| int _Py_HashSecret_Initialized = 0; | ||
| #else | ||
| Expand Down | ||
| Back | FazBrowse Home | New Git URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualitySame comment as above.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.