Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions rules/poll/ir_unsafe.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"f1": {
"body": [
{
"text": "libc::poll("
},
{
"placeholder": {
"arg": 0,
"access": "read"
}
},
{
"text": ", "
},
{
"placeholder": {
"arg": 1,
"access": "read"
}
},
{
"text": " as ::libc::nfds_t, "
},
{
"placeholder": {
"arg": 2,
"access": "read"
}
},
{
"text": ")"
}
],
"params": {
"a0": {
"type": "*mut ::libc::pollfd",
"is_unsafe_pointer": true
},
"a1": {
"type": "u64"
},
"a2": {
"type": "i32"
}
},
"return_type": {
"type": "i32"
}
}
}
8 changes: 8 additions & 0 deletions rules/poll/src.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright (c) 2022-present INESC-ID.
// Distributed under the MIT license that can be found in the LICENSE file.

#include <poll.h>

int f1(struct pollfd *fds, nfds_t nfds, int timeout) {
return poll(fds, nfds, timeout);
}
6 changes: 6 additions & 0 deletions rules/poll/tgt_unsafe.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright (c) 2022-present INESC-ID.
// Distributed under the MIT license that can be found in the LICENSE file.

unsafe fn f1(a0: *mut ::libc::pollfd, a1: u64, a2: i32) -> i32 {
libc::poll(a0, a1 as ::libc::nfds_t, a2)
}
78 changes: 78 additions & 0 deletions rules/select/ir_unsafe.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"f1": {
"body": [
{
"text": "libc::select("
},
{
"placeholder": {
"arg": 0,
"access": "read"
}
},
{
"text": ", "
},
{
"placeholder": {
"arg": 1,
"access": "read"
}
},
{
"text": ", "
},
{
"placeholder": {
"arg": 2,
"access": "read"
}
},
{
"text": ", "
},
{
"placeholder": {
"arg": 3,
"access": "read"
}
},
{
"text": ", "
},
{
"placeholder": {
"arg": 4,
"access": "read"
}
},
{
"text": ")"
}
],
"params": {
"a0": {
"type": "i32"
},
"a1": {
"type": "*mut ::libc::fd_set",
"is_unsafe_pointer": true
},
"a2": {
"type": "*mut ::libc::fd_set",
"is_unsafe_pointer": true
},
"a3": {
"type": "*mut ::libc::fd_set",
"is_unsafe_pointer": true
},
"a4": {
"type": "*mut ::libc::timeval",
"is_unsafe_pointer": true
}
},
"return_type": {
"type": "i32"
}
}
}
9 changes: 9 additions & 0 deletions rules/select/src.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright (c) 2022-present INESC-ID.
// Distributed under the MIT license that can be found in the LICENSE file.

#include <sys/select.h>

int f1(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
struct timeval *timeout) {
return select(nfds, readfds, writefds, exceptfds, timeout);
}
12 changes: 12 additions & 0 deletions rules/select/tgt_unsafe.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright (c) 2022-present INESC-ID.
// Distributed under the MIT license that can be found in the LICENSE file.

unsafe fn f1(
a0: i32,
a1: *mut ::libc::fd_set,
a2: *mut ::libc::fd_set,
a3: *mut ::libc::fd_set,
a4: *mut ::libc::timeval,
) -> i32 {
libc::select(a0, a1, a2, a3, a4)
}
Loading
Loading