Skip to content

Commit da260f3

Browse files
committed
Socket module: add AF_PACKET and AF_UNIX constants
1 parent b4fc282 commit da260f3

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/PosixConstants.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ public final class PosixConstants {
132132
public static final MandatoryIntConstant AF_UNSPEC;
133133
public static final MandatoryIntConstant AF_INET;
134134
public static final MandatoryIntConstant AF_INET6;
135+
public static final OptionalIntConstant AF_PACKET;
136+
public static final MandatoryIntConstant AF_UNIX;
135137
public static final MandatoryIntConstant SOCK_DGRAM;
136138
public static final MandatoryIntConstant SOCK_STREAM;
137139
public static final MandatoryIntConstant INADDR_ANY;
@@ -354,6 +356,9 @@ public final class PosixConstants {
354356
AF_UNSPEC = reg.createMandatoryInt("AF_UNSPEC");
355357
AF_INET = reg.createMandatoryInt("AF_INET");
356358
AF_INET6 = reg.createMandatoryInt("AF_INET6");
359+
// Following two aren't really supported, but we can fail later:
360+
AF_PACKET = reg.createOptionalInt("AF_PACKET");
361+
AF_UNIX = reg.createMandatoryInt("AF_UNIX");
357362
SOCK_DGRAM = reg.createMandatoryInt("SOCK_DGRAM");
358363
SOCK_STREAM = reg.createMandatoryInt("SOCK_STREAM");
359364
INADDR_ANY = reg.createMandatoryInt("INADDR_ANY");
@@ -483,7 +488,7 @@ public final class PosixConstants {
483488
waitOptions = new IntConstant[]{WNOHANG, WUNTRACED};
484489
accessMode = new IntConstant[]{R_OK, W_OK, X_OK, F_OK};
485490
rtld = new IntConstant[]{RTLD_LAZY, RTLD_NOW, RTLD_GLOBAL, RTLD_LOCAL};
486-
socketFamily = new IntConstant[]{AF_UNSPEC, AF_INET, AF_INET6};
491+
socketFamily = new IntConstant[]{AF_UNSPEC, AF_INET, AF_INET6, AF_PACKET, AF_UNIX};
487492
socketType = new IntConstant[]{SOCK_DGRAM, SOCK_STREAM};
488493
ip4Address = new IntConstant[]{INADDR_ANY, INADDR_BROADCAST, INADDR_NONE, INADDR_LOOPBACK, INADDR_ALLHOSTS_GROUP, INADDR_MAX_LOCAL_GROUP, INADDR_UNSPEC_GROUP};
489494
gaiFlags = new IntConstant[]{AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST, AI_V4MAPPED, AI_ALL, AI_ADDRCONFIG, AI_IDN, AI_CANONIDN, AI_NUMERICSERV};

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/PosixConstantsLinux.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ static void getConstants(PosixConstants.Registry constants) {
125125
constants.put("AF_UNSPEC", 0);
126126
constants.put("AF_INET", 2);
127127
constants.put("AF_INET6", 10);
128+
constants.put("AF_PACKET", 17);
129+
constants.put("AF_UNIX", 1);
128130
constants.put("SOCK_DGRAM", 2);
129131
constants.put("SOCK_STREAM", 1);
130132
constants.put("INADDR_ANY", 0x00000000);

0 commit comments

Comments
 (0)