Skip to content

Commit 9de95ad

Browse files
committed
Add rules for socket_type enum values
1 parent 2ade29a commit 9de95ad

3 files changed

Lines changed: 162 additions & 0 deletions

File tree

rules/socket/ir_unsafe.json

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,95 @@
88
"return_type": {
99
"type": "i32"
1010
}
11+
},
12+
"f10": {
13+
"body": [
14+
{
15+
"text": "libc::SOCK_NONBLOCK"
16+
}
17+
],
18+
"return_type": {
19+
"type": "i32"
20+
}
21+
},
22+
"f2": {
23+
"body": [
24+
{
25+
"text": "libc::SOCK_STREAM"
26+
}
27+
],
28+
"return_type": {
29+
"type": "i32"
30+
}
31+
},
32+
"f3": {
33+
"body": [
34+
{
35+
"text": "libc::SOCK_DGRAM"
36+
}
37+
],
38+
"return_type": {
39+
"type": "i32"
40+
}
41+
},
42+
"f4": {
43+
"body": [
44+
{
45+
"text": "libc::SOCK_RAW"
46+
}
47+
],
48+
"return_type": {
49+
"type": "i32"
50+
}
51+
},
52+
"f5": {
53+
"body": [
54+
{
55+
"text": "libc::SOCK_RDM"
56+
}
57+
],
58+
"return_type": {
59+
"type": "i32"
60+
}
61+
},
62+
"f6": {
63+
"body": [
64+
{
65+
"text": "libc::SOCK_SEQPACKET"
66+
}
67+
],
68+
"return_type": {
69+
"type": "i32"
70+
}
71+
},
72+
"f7": {
73+
"body": [
74+
{
75+
"text": "libc::SOCK_DCCP"
76+
}
77+
],
78+
"return_type": {
79+
"type": "i32"
80+
}
81+
},
82+
"f8": {
83+
"body": [
84+
{
85+
"text": "libc::SOCK_PACKET"
86+
}
87+
],
88+
"return_type": {
89+
"type": "i32"
90+
}
91+
},
92+
"f9": {
93+
"body": [
94+
{
95+
"text": "libc::SOCK_CLOEXEC"
96+
}
97+
],
98+
"return_type": {
99+
"type": "i32"
100+
}
11101
}
12102
}

rules/socket/src.cpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,39 @@
44
int f1() {
55
return MSG_NOSIGNAL;
66
}
7+
8+
int f2() {
9+
return SOCK_STREAM;
10+
}
11+
12+
int f3() {
13+
return SOCK_DGRAM;
14+
}
15+
16+
int f4() {
17+
return SOCK_RAW;
18+
}
19+
20+
int f5() {
21+
return SOCK_RDM;
22+
}
23+
24+
int f6() {
25+
return SOCK_SEQPACKET;
26+
}
27+
28+
int f7() {
29+
return SOCK_DCCP;
30+
}
31+
32+
int f8() {
33+
return SOCK_PACKET;
34+
}
35+
36+
int f9() {
37+
return SOCK_CLOEXEC;
38+
}
39+
40+
int f10() {
41+
return SOCK_NONBLOCK;
42+
}

rules/socket/tgt_unsafe.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,39 @@
11
unsafe fn f1() -> i32 {
22
libc::MSG_NOSIGNAL
33
}
4+
5+
unsafe fn f2() -> i32 {
6+
libc::SOCK_STREAM
7+
}
8+
9+
unsafe fn f3() -> i32 {
10+
libc::SOCK_DGRAM
11+
}
12+
13+
unsafe fn f4() -> i32 {
14+
libc::SOCK_RAW
15+
}
16+
17+
unsafe fn f5() -> i32 {
18+
libc::SOCK_RDM
19+
}
20+
21+
unsafe fn f6() -> i32 {
22+
libc::SOCK_SEQPACKET
23+
}
24+
25+
unsafe fn f7() -> i32 {
26+
libc::SOCK_DCCP
27+
}
28+
29+
unsafe fn f8() -> i32 {
30+
libc::SOCK_PACKET
31+
}
32+
33+
unsafe fn f9() -> i32 {
34+
libc::SOCK_CLOEXEC
35+
}
36+
37+
unsafe fn f10() -> i32 {
38+
libc::SOCK_NONBLOCK
39+
}

0 commit comments

Comments
 (0)