Mercurial > hgrepos > FreeBSD > ports > PyPy
annotate lang/pypy39/files/patch-rpython_rlib_rposix.py @ 128:9cc467368751
Move and/or copy some files from the old lang/pypy3 to lang/pypy39 and lang/pypy310
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Sun, 14 Jan 2024 12:11:20 +0100 |
| parents | lang/pypy3/files/patch-rpython_rlib_rposix.py@3b09db02a788 |
| children |
| rev | line source |
|---|---|
|
111
cf8f8a3eea6b
Allow to build PyPy3 v7.3.14 on FreeBSD 13.2.
Franz Glasner <fzglas.hg@dom66.de>
parents:
106
diff
changeset
|
1 --- rpython/rlib/rposix.py.orig 2023-12-24 19:15:32 UTC |
|
106
ffca34182746
Allow to build PyPy3 v7.3.11: PLIST changes and patches for os.sendmail() which is enabled now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
2 +++ rpython/rlib/rposix.py |
|
111
cf8f8a3eea6b
Allow to build PyPy3 v7.3.14 on FreeBSD 13.2.
Franz Glasner <fzglas.hg@dom66.de>
parents:
106
diff
changeset
|
3 @@ -214,6 +214,8 @@ else: |
|
cf8f8a3eea6b
Allow to build PyPy3 v7.3.14 on FreeBSD 13.2.
Franz Glasner <fzglas.hg@dom66.de>
parents:
106
diff
changeset
|
4 includes.append('sys/sysmacros.h') |
|
cf8f8a3eea6b
Allow to build PyPy3 v7.3.14 on FreeBSD 13.2.
Franz Glasner <fzglas.hg@dom66.de>
parents:
106
diff
changeset
|
5 if sys.platform.startswith('freebsd') or sys.platform.startswith('openbsd'): |
|
cf8f8a3eea6b
Allow to build PyPy3 v7.3.14 on FreeBSD 13.2.
Franz Glasner <fzglas.hg@dom66.de>
parents:
106
diff
changeset
|
6 includes.append('sys/ttycom.h') |
|
cf8f8a3eea6b
Allow to build PyPy3 v7.3.14 on FreeBSD 13.2.
Franz Glasner <fzglas.hg@dom66.de>
parents:
106
diff
changeset
|
7 + if sys.platform.startswith('freebsd') or sys.platform.startswith('openbsd'): |
|
cf8f8a3eea6b
Allow to build PyPy3 v7.3.14 on FreeBSD 13.2.
Franz Glasner <fzglas.hg@dom66.de>
parents:
106
diff
changeset
|
8 + includes.append('termios.h') |
|
cf8f8a3eea6b
Allow to build PyPy3 v7.3.14 on FreeBSD 13.2.
Franz Glasner <fzglas.hg@dom66.de>
parents:
106
diff
changeset
|
9 libraries = ['util'] |
|
cf8f8a3eea6b
Allow to build PyPy3 v7.3.14 on FreeBSD 13.2.
Franz Glasner <fzglas.hg@dom66.de>
parents:
106
diff
changeset
|
10 |
|
cf8f8a3eea6b
Allow to build PyPy3 v7.3.14 on FreeBSD 13.2.
Franz Glasner <fzglas.hg@dom66.de>
parents:
106
diff
changeset
|
11 eci = ExternalCompilationInfo( |
|
cf8f8a3eea6b
Allow to build PyPy3 v7.3.14 on FreeBSD 13.2.
Franz Glasner <fzglas.hg@dom66.de>
parents:
106
diff
changeset
|
12 @@ -3057,6 +3059,30 @@ if sys.platform.startswith('linux'): |
|
cf8f8a3eea6b
Allow to build PyPy3 v7.3.14 on FreeBSD 13.2.
Franz Glasner <fzglas.hg@dom66.de>
parents:
106
diff
changeset
|
13 """Passes offset==NULL; not support on all OSes""" |
|
106
ffca34182746
Allow to build PyPy3 v7.3.11: PLIST changes and patches for os.sendmail() which is enabled now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
14 res = c_sendfile(out_fd, in_fd, lltype.nullptr(_OFF_PTR_T.TO), count) |
|
ffca34182746
Allow to build PyPy3 v7.3.11: PLIST changes and patches for os.sendmail() which is enabled now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
15 return handle_posix_error('sendfile', res) |
|
111
cf8f8a3eea6b
Allow to build PyPy3 v7.3.14 on FreeBSD 13.2.
Franz Glasner <fzglas.hg@dom66.de>
parents:
106
diff
changeset
|
16 + |
|
106
ffca34182746
Allow to build PyPy3 v7.3.11: PLIST changes and patches for os.sendmail() which is enabled now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
17 +elif sys.platform.startswith('freebsd'): |
|
ffca34182746
Allow to build PyPy3 v7.3.11: PLIST changes and patches for os.sendmail() which is enabled now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
18 + # FreeBSD |
|
ffca34182746
Allow to build PyPy3 v7.3.11: PLIST changes and patches for os.sendmail() which is enabled now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
19 + # |
|
ffca34182746
Allow to build PyPy3 v7.3.11: PLIST changes and patches for os.sendmail() which is enabled now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
20 + # Please note that the implementation below is partial; |
|
ffca34182746
Allow to build PyPy3 v7.3.11: PLIST changes and patches for os.sendmail() which is enabled now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
21 + # the VOIDP is an iovec for sending headers and trailers which |
|
ffca34182746
Allow to build PyPy3 v7.3.11: PLIST changes and patches for os.sendmail() which is enabled now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
22 + # CPython uses for the headers and trailers argument, and it also |
|
ffca34182746
Allow to build PyPy3 v7.3.11: PLIST changes and patches for os.sendmail() which is enabled now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
23 + # has a flags argument. None of these are currently supported. |
|
ffca34182746
Allow to build PyPy3 v7.3.11: PLIST changes and patches for os.sendmail() which is enabled now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
24 + sendfile_eci = ExternalCompilationInfo(includes=["sys/socket.h"]) |
|
ffca34182746
Allow to build PyPy3 v7.3.11: PLIST changes and patches for os.sendmail() which is enabled now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
25 + _OFF_PTR_T = rffi.CArrayPtr(OFF_T) |
|
ffca34182746
Allow to build PyPy3 v7.3.11: PLIST changes and patches for os.sendmail() which is enabled now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
26 + # NB: the VOIDP is an struct sf_hdtr for sending headers and trailers |
|
ffca34182746
Allow to build PyPy3 v7.3.11: PLIST changes and patches for os.sendmail() which is enabled now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
27 + c_sendfile = rffi.llexternal('sendfile', |
|
ffca34182746
Allow to build PyPy3 v7.3.11: PLIST changes and patches for os.sendmail() which is enabled now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
28 + [rffi.INT, rffi.INT, OFF_T, rffi.SIZE_T, rffi.VOIDP, _OFF_PTR_T, rffi.INT], |
|
ffca34182746
Allow to build PyPy3 v7.3.11: PLIST changes and patches for os.sendmail() which is enabled now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
29 + rffi.INT, save_err=rffi.RFFI_SAVE_ERRNO, |
|
ffca34182746
Allow to build PyPy3 v7.3.11: PLIST changes and patches for os.sendmail() which is enabled now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
30 + compilation_info=sendfile_eci) |
|
ffca34182746
Allow to build PyPy3 v7.3.11: PLIST changes and patches for os.sendmail() which is enabled now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
31 + |
|
ffca34182746
Allow to build PyPy3 v7.3.11: PLIST changes and patches for os.sendmail() which is enabled now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
32 + def sendfile(out_fd, in_fd, offset, count): |
|
ffca34182746
Allow to build PyPy3 v7.3.11: PLIST changes and patches for os.sendmail() which is enabled now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
33 + with lltype.scoped_alloc(_OFF_PTR_T.TO, 1) as sbytes: |
|
ffca34182746
Allow to build PyPy3 v7.3.11: PLIST changes and patches for os.sendmail() which is enabled now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
34 + sbytes[0] = 0 # rffi.cast(OFF_T, count) |
|
ffca34182746
Allow to build PyPy3 v7.3.11: PLIST changes and patches for os.sendmail() which is enabled now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
35 + res = c_sendfile(in_fd, out_fd, offset, count, lltype.nullptr(rffi.VOIDP.TO), sbytes, 0) |
|
ffca34182746
Allow to build PyPy3 v7.3.11: PLIST changes and patches for os.sendmail() which is enabled now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
36 + if res != 0: |
|
ffca34182746
Allow to build PyPy3 v7.3.11: PLIST changes and patches for os.sendmail() which is enabled now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
37 + return handle_posix_error('sendfile', res) |
|
ffca34182746
Allow to build PyPy3 v7.3.11: PLIST changes and patches for os.sendmail() which is enabled now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
38 + res = sbytes[0] |
|
ffca34182746
Allow to build PyPy3 v7.3.11: PLIST changes and patches for os.sendmail() which is enabled now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
39 + return res |
|
111
cf8f8a3eea6b
Allow to build PyPy3 v7.3.14 on FreeBSD 13.2.
Franz Glasner <fzglas.hg@dom66.de>
parents:
106
diff
changeset
|
40 |
|
106
ffca34182746
Allow to build PyPy3 v7.3.11: PLIST changes and patches for os.sendmail() which is enabled now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
41 elif not _WIN32: |
|
ffca34182746
Allow to build PyPy3 v7.3.11: PLIST changes and patches for os.sendmail() which is enabled now.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
42 # Neither on Windows nor on Linux, so probably a BSD derivative of |
