bpo-30512: Add CAN Socket support for NetBSD (GH-30066)

This commit is contained in:
Thomas Klausner 2022-01-21 08:44:05 +01:00 committed by GitHub
parent cfadcc31ea
commit 40fcd16889
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 26 additions and 6 deletions

View file

@ -396,10 +396,13 @@ Constants
Many constants of these forms, documented in the Linux documentation, are Many constants of these forms, documented in the Linux documentation, are
also defined in the socket module. also defined in the socket module.
.. availability:: Linux >= 2.6.25. .. availability:: Linux >= 2.6.25, NetBSD >= 8.
.. versionadded:: 3.3 .. versionadded:: 3.3
.. versionchanged:: 3.11
NetBSD support was added.
.. data:: CAN_BCM .. data:: CAN_BCM
CAN_BCM_* CAN_BCM_*

View file

@ -264,6 +264,13 @@ os
(Contributed by Dong-hee Na in :issue:`44611`.) (Contributed by Dong-hee Na in :issue:`44611`.)
socket
------
* Add CAN Socket support for NetBSD.
(Contributed by Thomas Klausner in :issue:`30512`.)
sqlite3 sqlite3
------- -------

View file

@ -0,0 +1 @@
Add CAN Socket support for NetBSD.

View file

@ -7703,7 +7703,7 @@ PyInit__socket(void)
PyModule_AddIntMacro(m, SOL_CAN_RAW); PyModule_AddIntMacro(m, SOL_CAN_RAW);
PyModule_AddIntMacro(m, CAN_RAW); PyModule_AddIntMacro(m, CAN_RAW);
#endif #endif
#ifdef HAVE_LINUX_CAN_H #if defined(HAVE_LINUX_CAN_H) || defined(HAVE_NETCAN_CAN_H)
PyModule_AddIntMacro(m, CAN_EFF_FLAG); PyModule_AddIntMacro(m, CAN_EFF_FLAG);
PyModule_AddIntMacro(m, CAN_RTR_FLAG); PyModule_AddIntMacro(m, CAN_RTR_FLAG);
PyModule_AddIntMacro(m, CAN_ERR_FLAG); PyModule_AddIntMacro(m, CAN_ERR_FLAG);
@ -7718,9 +7718,11 @@ PyInit__socket(void)
PyModule_AddIntMacro(m, CAN_J1939); PyModule_AddIntMacro(m, CAN_J1939);
#endif #endif
#endif #endif
#ifdef HAVE_LINUX_CAN_RAW_H #if defined(HAVE_LINUX_CAN_RAW_H) || defined(HAVE_NETCAN_CAN_H)
PyModule_AddIntMacro(m, CAN_RAW_FILTER); PyModule_AddIntMacro(m, CAN_RAW_FILTER);
#ifdef CAN_RAW_ERR_FILTER
PyModule_AddIntMacro(m, CAN_RAW_ERR_FILTER); PyModule_AddIntMacro(m, CAN_RAW_ERR_FILTER);
#endif
PyModule_AddIntMacro(m, CAN_RAW_LOOPBACK); PyModule_AddIntMacro(m, CAN_RAW_LOOPBACK);
PyModule_AddIntMacro(m, CAN_RAW_RECV_OWN_MSGS); PyModule_AddIntMacro(m, CAN_RAW_RECV_OWN_MSGS);
#endif #endif

View file

@ -129,6 +129,8 @@ typedef int socklen_t;
#ifdef HAVE_LINUX_CAN_H #ifdef HAVE_LINUX_CAN_H
# include <linux/can.h> # include <linux/can.h>
#elif defined(HAVE_NETCAN_CAN_H)
# include <netcan/can.h>
#else #else
# undef AF_CAN # undef AF_CAN
# undef PF_CAN # undef PF_CAN
@ -253,7 +255,7 @@ typedef union sock_addr {
#ifdef HAVE_NETPACKET_PACKET_H #ifdef HAVE_NETPACKET_PACKET_H
struct sockaddr_ll ll; struct sockaddr_ll ll;
#endif #endif
#ifdef HAVE_LINUX_CAN_H #if defined(HAVE_LINUX_CAN_H) || defined(HAVE_NETCAN_CAN_H)
struct sockaddr_can can; struct sockaddr_can can;
#endif #endif
#ifdef HAVE_SYS_KERN_CONTROL_H #ifdef HAVE_SYS_KERN_CONTROL_H

3
configure vendored
View file

@ -8940,7 +8940,8 @@ done
# On Linux, can.h, can/bcm.h, can/j1939.h, can/raw.h require sys/socket.h # On Linux, can.h, can/bcm.h, can/j1939.h, can/raw.h require sys/socket.h
for ac_header in linux/can.h linux/can/bcm.h linux/can/j1939.h linux/can/raw.h # On NetBSD, netcan/can.h requires sys/socket.h
for ac_header in linux/can.h linux/can/bcm.h linux/can/j1939.h linux/can/raw.h netcan/can.h
do : do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" " ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "

View file

@ -2411,7 +2411,8 @@ AC_CHECK_HEADERS(linux/vm_sockets.h,,,[
]) ])
# On Linux, can.h, can/bcm.h, can/j1939.h, can/raw.h require sys/socket.h # On Linux, can.h, can/bcm.h, can/j1939.h, can/raw.h require sys/socket.h
AC_CHECK_HEADERS(linux/can.h linux/can/bcm.h linux/can/j1939.h linux/can/raw.h,,,[ # On NetBSD, netcan/can.h requires sys/socket.h
AC_CHECK_HEADERS(linux/can.h linux/can/bcm.h linux/can/j1939.h linux/can/raw.h netcan/can.h,,,[
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> #include <sys/socket.h>
#endif #endif

View file

@ -772,6 +772,9 @@
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */ /* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
#undef HAVE_NDIR_H #undef HAVE_NDIR_H
/* Define to 1 if you have the <netcan/can.h> header file. */
#undef HAVE_NETCAN_CAN_H
/* Define to 1 if you have the <netinet/in.h> header file. */ /* Define to 1 if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H #undef HAVE_NETINET_IN_H