Make improvements

- This change fixes a bug that allowed unbuffered printf() output (to
  streams like stderr) to be truncated. This regression was introduced
  some time between now and the last release.

- POSIX specifies all functions as thread safe by default. This change
  works towards cleaning up our use of the @threadsafe / @threadunsafe
  documentation annotations to reflect that. The goal is (1) to use
  @threadunsafe to document functions which POSIX say needn't be thread
  safe, and (2) use @threadsafe to document functions that we chose to
  implement as thread safe even though POSIX didn't mandate it.

- Tidy up the clock_gettime() implementation. We're now trying out a
  cleaner approach to system call support that aims to maintain the
  Linux errno convention as long as possible. This also fixes bugs that
  existed previously, where the vDSO errno wasn't being translated
  properly. The gettimeofday() system call is now a wrapper for
  clock_gettime(), which reduces bloat in apps that use both.

- The recently-introduced improvements to the execute bit on Windows has
  had bugs fixed. access(X_OK) on a directory on Windows now succeeds.
  fstat() will now perform the MZ/#! ReadFile() operation correctly.

- Windows.h is no longer included in libc/isystem/, because it confused
  PCRE's build system into thinking Cosmopolitan is a WIN32 platform.
  Cosmo's Windows.h polyfill was never even really that good, since it
  only defines a subset of the subset of WIN32 APIs that Cosmo defines.

- The setlongerjmp() / longerjmp() APIs are removed. While they're nice
  APIs that are superior to the standardized setjmp / longjmp functions,
  they weren't superior enough to not be dead code in the monorepo. If
  you use these APIs, please file an issue and they'll be restored.

- The .com appending magic has now been removed from APE Loader.
This commit is contained in:
Justine Tunney 2023-10-02 19:25:19 -07:00
parent b99512ac58
commit ff77f2a6af
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
226 changed files with 708 additions and 2657 deletions

View file

@ -4,18 +4,44 @@
Python 3
https://docs.python.org/3/license.html │
*/
#include "libc/isystem/windows.h"
#include "libc/nt/registry.h"
#include "third_party/python/Include/abstract.h"
#include "third_party/python/Include/ceval.h"
#include "third_party/python/Include/listobject.h"
#include "third_party/python/Include/longobject.h"
#include "third_party/python/Include/modsupport.h"
#include "third_party/python/Include/object.h"
#include "third_party/python/Include/objimpl.h"
#include "third_party/python/Include/pyerrors.h"
#include "third_party/python/Include/pyhash.h"
#include "third_party/python/Include/pymacro.h"
#include "third_party/python/Include/structmember.h"
#undef NULL
#define NULL 0
#define BOOL bool32
#define DWORD32 uint32_t
#define HKEY int64_t
#define ULONG uint32_t
#define ACCESS_MASK ULONG
#define REGSAM ACCESS_MASK
#define HKEY_CLASSES_ROOT kNtHkeyClassesRoot
#define HKEY_CURRENT_USER kNtHkeyCurrentUser
#define HKEY_LOCAL_MACHINE kNtHkeyLocalMachine
#define HKEY_USERS kNtHkeyUsers
#define HKEY_PERFORMANCE_DATA kNtHkeyPerformanceData
#define HKEY_PERFORMANCE_TEXT kNtHkeyPerformanceText
#define HKEY_PERFORMANCE_NLSTEXT kNtHkeyPerformanceNlstext
#define HKEY_CURRENT_CONFIG kNtHkeyCurrentConfig
#define HKEY_DYN_DATA kNtHkeyDynData
#define HKEY_CURRENT_USER_LOCAL_SETTINGS kNtHkeyCurrentUserLocalSettings
#define KEY_READ kNtKeyRead
#define KEY_WRITE kNtKeyWrite
#define KEY_EXECUTE kNtKeyExecute
#define KEY_ALL_ACCESS kNtKeyAllAccess
/* clang-format off */
/*