This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Solaris should support constants like termios' FIONREAD
Type: enhancement Stage: resolved
Components: Versions: Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jcea Nosy List: jcea
Priority: normal Keywords: patch

Created on 2018-01-25 00:56 by jcea, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 5328 merged jcea, 2018-01-26 00:47
Messages (5)
msg310651 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2018-01-25 00:56
Solaris supports termios constants like FIONREAD with an appropiate "#include" in the C code. The main issue is that some names conflicts between System V and BSD personalities.

I could evaluate the situation and do a patch proposal for Python 3.7. We are still a week away of 3.7RC1 and this patch would affect only Solaris/derivatives.
msg310719 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2018-01-25 23:58
Solaris has two personalities: System V and BSD. This is not usually an issue but sometimes some constants have a different value in a mode or the other.

By default, when including <sys/ioctl.h> Solaris is in System V mode. We can force BSD mode defining symbol "BSD_COMP". This greatly expand the names available but, unfortunately, some values change.

The comment in <sys/ioctl.h> is quite clear:

"""
 *      There are some inherent problems in having a single file
 *      ioctl.h, with both System V and BSD flags. Introducing
 *      BSD flags into this file creates compilation problems
 *      with flags such as ECHO, NL1 etc., if termio.h and ioctl.h
 *      are included by the same file. Since these two files can
 *      be only included by System V applications, /usr/inclule/sys/ioctl.h
 *      will be System V mode and all the BSD flags will be turned off
 *      using #ifdef BSD_COMP. This file will also exist in
 *      /usr/ucbinclude/sys/ioctl.h for BSD applications but without the
 *      BSD flags turned off. System V appliactions can use ioctl.h without
 *      any changes, System V applications requiring BSD flags should
 *      -D BSD_COMP when compiling (and be warned about the common
 *      flags between System V and BSD) and BSD applications should
 *      use /usr/ucbinclude/sys/ioctl.h.
"""

Using "gcc -dM -E" we can observe defined symbols.

Ambiguous values when defininf "BSD_COMP" are: BS0, BS1, CR0, CR1, CR2, CR3, ECHO, FF0, FF1, FLUSHO, NL0, NL1, NOFLSH, PENDIN, TAB0, TAB1, TAB2, TOSTOP, XTABS.

Sounds quite important, actually.

Since I am no aiming to perfection, I would be satisfied making quite a few new symbols available, not all of them. A simple approach would be to include <sys/filio.h> and <sys/sockio.h>. In those header files there are only constants, not functions or data structures.

Just including those headers we get these new symbols (none overlapping other):

_FIO_COMPRESSED
_FIO_COUNT_FILLED
_FIO_GET_TOP_STATS
_FIO_SEEK_DATA
_FIO_SEEK_HOLE
_FIO_SET_LUFS_DEBUG
_FIO_SET_LUFS_ERROR
_FIOAI
_FIODIRECTIO
_FIOFFS
_FIOGDIO
_FIOGETMAXPHYS
_FIOGETSUPERBLOCK
_FIOIO
_FIOISBUSY
_FIOISLOG
_FIOISLOGOK
_FIOLFS
_FIOLFSS
_FIOLOGDISABLE
_FIOLOGENABLE
_FIOLOGRESET
_FIOOBSOLETE67
_FIOSATIME
_FIOSDIO
_FIOSNAPSHOTCREATE
_FIOSNAPSHOTCREATE_MULTI
_FIOSNAPSHOTDELETE
_FIOTUNE
_IO(x,y)
_IOR(x,y,t)
_IORN(x,y,t)
_IOW(x,y,t)
_IOWN(x,y,t)
_IOWR(x,y,t)
_IOWRN(x,y,t)
_SIOCSOCKFALLBACK
_SYS_FILIO_H
_SYS_IOCCOM_H
_SYS_SOCKIO_H
FIOASYNC
FIOCLEX
FIOGETOWN
FIONBIO
FIONCLEX
FIONREAD
FIOSETOWN
IF_UNITSEL
IOC_IN
IOC_INOUT
IOC_OUT
IOC_VOID
IOCPARM_MASK
O_SIOCGIFCONF
O_SIOCGLIFCONF
SIOCADDMULTI
SIOCADDRT
SIOCATMARK
SIOCDARP
SIOCDELMULTI
SIOCDELRT
SIOCDXARP
SIOCGARP
SIOCGDSTINFO
SIOCGENADDR
SIOCGENPSTATS
SIOCGETLSGCNT
SIOCGETNAME
SIOCGETPEER
SIOCGETPROP
SIOCGETSGCNT
SIOCGETSYNC
SIOCGETVIFCNT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IFMETRIC
SIOCSLIFMTU
SIOCSLIFMUXID
SIOCSLIFNAME
SIOCSLIFNETMASK
SIOCSLIFPREFIX
SIOCSLIFSUBNET
SIOCSLIFTOKEN
SIOCSLIFUSESRC
SIOCSLIFZONE
SIOCSLOWAT
SIOCSLSTAT
SIOCSMSFILTER
SIOCSPGRP
SIOCSPROMISC
SIOCSQPTR
SIOCSSDSTATS
SIOCSSESTATS
SIOCSXARP
SIOCTMYADDR
SIOCTMYSITE
SIOCTONLINK
SIOCUPPER
SIOCX25RCV
SIOCX25TBL
SIOCX25XMT
SIOCXPROTO

Not all those symbols are going to be exported in Python.
msg310722 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2018-01-26 00:16
After doing this change, I see FIVE new symbols in Python's termios:

"""
FIONREAD, FIONCLEX, FIOCLEX, FIOASYNC, FIONBIO.
"""

Good enough for now and me.
msg310723 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2018-01-26 00:40
With this change, a SmarOS native zone exports 206 symbols in Python termios. Before it export 201. By comparison, a Linux Ubuntu 16.04 Python provides 244 symbols.

Some references for the future:

http://www.verycomputer.com/168_45f4bd8c333a252f_1.htm
msg310946 - (view) Author: Jesús Cea Avión (jcea) * (Python committer) Date: 2018-01-28 13:00
New changeset f0a95f27c043e847a23940534fdfc53e1b3e31a1 by jcea in branch 'master':
bpo-32660: Solaris should support constants like termios' FIONREAD (#5328)
https://github.com/python/cpython/commit/f0a95f27c043e847a23940534fdfc53e1b3e31a1
History
Date User Action Args
2022-04-11 14:58:57adminsetgithub: 76841
2019-01-04 20:51:00cheryl.sabellasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2018-01-28 13:00:50jceasetmessages: + msg310946
2018-01-26 00:47:48jceasetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request5173
2018-01-26 00:40:47jceasetmessages: + msg310723
2018-01-26 00:16:47jceasetmessages: + msg310722
2018-01-25 23:58:39jceasetmessages: + msg310719
2018-01-25 00:56:59jceacreate