[issue10141] SocketCan support

Vinay Sajip report at bugs.python.org
Fri Oct 7 16:55:33 CEST 2011


Vinay Sajip <vinay_sajip at yahoo.co.uk> added the comment:

I added the line in the suggested place:

#ifdef HAVE_LINUX_TIPC_H
# include <linux/tipc.h>
#endif

#ifdef HAVE_LINUX_CAN_H
#include <linux/socket.h>  /* the line I added - line 76 */
#include <linux/can.h>
#endif

#ifdef HAVE_LINUX_CAN_RAW_H
#include <linux/can/raw.h>
#endif

Strangely, it seems to make no difference! I copied out the actual gcc line from the make file and ran it from the command line to just pre-process:

gcc -pthread -fPIC -g -O0 -Wall -Wstrict-prototypes -IInclude -I. -I./Include -I/usr/local/include -I/home/vinay/projects/python/default -E /home/vinay/projects/python/default/Modules/socketmodule.c >/tmp/tmp.c

(I assume /usr/include is always searched, as it's not explicitly named in a -I parameter.)

Looking at the tmp.c file produced, here's the relevant section:

# 182 "/usr/include/linux/tipc.h" 3 4
struct sockaddr_tipc {
 unsigned short family;
 unsigned char addrtype;
 signed char scope;
 union {
  struct tipc_portid id;
  struct tipc_name_seq nameseq;
  struct {
   struct tipc_name name;
   __u32 domain;
  } name;
 } addr;
};
# 73 "/home/vinay/projects/python/default/Modules/socketmodule.h" 2




# 1 "/usr/include/linux/can.h" 1 3 4

After the tipc.h include, the can.h include comes next, as if I hadn't added the linux/socket.h line at all! What is this I don't even ...

I pasted the whole socketmodule.h file to a gist here:

https://gist.github.com/1270436

Tell me I'm not going mad!

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10141>
_______________________________________


More information about the Python-bugs-list mailing list