Skip to content

Commit

Permalink
Rename ckb_inherited_file_descriptors to ckb_inherited_fds
Browse files Browse the repository at this point in the history
  • Loading branch information
mohanson committed Sep 19, 2024
1 parent 009d80b commit a6a1f15
Show file tree
Hide file tree
Showing 31 changed files with 21 additions and 20 deletions.
5 changes: 3 additions & 2 deletions script/testdata/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ COMMON_CFLAGS := -O3 \
-I deps/ckb-c-stdlib/libc \
-I deps/ckb-c-stdlib/molecule \
-Wall -Werror \
-fno-builtin -nostdinc -nostartfiles \
-Wno-stringop-overflow
-fno-builtin -nostdinc -nostartfiles \
-Wno-stringop-overflow \
-Wno-array-bounds
# enable ckb-c-stdlib's printf
COMMON_CFLAGS += -DCKB_C_STDLIB_PRINTF -DCKB_C_STDLIB_PRINTF_BUFFER_SIZE=1024

Expand Down
Binary file modified script/testdata/cpop_lock
Binary file not shown.
Binary file modified script/testdata/debugger
Binary file not shown.
Binary file modified script/testdata/exec_configurable_callee
Binary file not shown.
Binary file modified script/testdata/infinite_loop
Binary file not shown.
Binary file modified script/testdata/load_arithmetic
Binary file not shown.
Binary file modified script/testdata/spawn_callee_exec_caller
Binary file not shown.
Binary file modified script/testdata/spawn_callee_strcat
Binary file not shown.
2 changes: 1 addition & 1 deletion script/testdata/spawn_callee_strcat.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ int main(int argc, char *argv[]) {
size_t content_size = (uint64_t)strlen(content);
uint64_t fds[2] = {0};
uint64_t length = countof(fds);
err = ckb_inherited_file_descriptors(fds, &length);
err = ckb_inherited_fds(fds, &length);
CHECK(err);
CHECK2(length == 2, ErrorCommon);
size_t content_size2 = content_size;
Expand Down
Binary file modified script/testdata/spawn_caller_current_cycles
Binary file not shown.
Binary file modified script/testdata/spawn_caller_out_of_cycles
Binary file not shown.
Binary file modified script/testdata/spawn_caller_strcat
Binary file not shown.
Binary file modified script/testdata/spawn_caller_strcat_wrap
Binary file not shown.
Binary file modified script/testdata/spawn_cases
Binary file not shown.
18 changes: 9 additions & 9 deletions script/testdata/spawn_cases.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ int child_simple_read_write() {
int err = 0;
uint64_t inherited_fds[2];
size_t inherited_fds_length = 2;
err = ckb_inherited_file_descriptors(inherited_fds, &inherited_fds_length);
err = ckb_inherited_fds(inherited_fds, &inherited_fds_length);
// read
for (size_t i = 0; i < 11; i++) {
uint8_t block[7] = {0};
Expand Down Expand Up @@ -76,7 +76,7 @@ int child_write_dead_lock() {
int err = 0;
uint64_t inherited_fds[3] = {0};
size_t inherited_fds_length = 3;
err = ckb_inherited_file_descriptors(inherited_fds, &inherited_fds_length);
err = ckb_inherited_fds(inherited_fds, &inherited_fds_length);
CHECK(err);
uint8_t data[10];
size_t data_length = sizeof(data);
Expand Down Expand Up @@ -174,7 +174,7 @@ int child_read_write_with_close() {
int err = 0;
uint64_t inherited_fds[2];
size_t inherited_fds_length = 2;
err = ckb_inherited_file_descriptors(inherited_fds, &inherited_fds_length);
err = ckb_inherited_fds(inherited_fds, &inherited_fds_length);
CHECK(err);

// read 100 bytes and close
Expand Down Expand Up @@ -235,20 +235,20 @@ int child_inherited_fds() {

// correct way to get fd length
size_t fds_length = 0;
err = ckb_inherited_file_descriptors(0, &fds_length);
err = ckb_inherited_fds(0, &fds_length);
CHECK2(fds_length == 10, -2);

// get part of fds
uint64_t fds[11] = {0};
fds_length = 1;
err = ckb_inherited_file_descriptors(fds, &fds_length);
err = ckb_inherited_fds(fds, &fds_length);
CHECK(err);
CHECK2(fds_length == 10, -2);
CHECK2(fds[0] == 2, -2);

// get all fds
fds_length = 10;
err = ckb_inherited_file_descriptors(fds, &fds_length);
err = ckb_inherited_fds(fds, &fds_length);
CHECK(err);
CHECK2(fds_length == 10, -2);
for (size_t i = 0; i < 10; i++) {
Expand Down Expand Up @@ -298,7 +298,7 @@ int child_read_then_close() {
int err = 0;
uint64_t fds[2] = {0};
uint64_t fds_length = 2;
err = ckb_inherited_file_descriptors(fds, &fds_length);
err = ckb_inherited_fds(fds, &fds_length);
CHECK(err);
uint8_t data[8];
size_t data_len = sizeof(data);
Expand Down Expand Up @@ -404,7 +404,7 @@ int child_write_closed_fd() {
int err = 0;
uint64_t inherited_fds[2];
size_t inherited_fds_length = 2;
err = ckb_inherited_file_descriptors(inherited_fds, &inherited_fds_length);
err = ckb_inherited_fds(inherited_fds, &inherited_fds_length);
CHECK(err);

uint8_t block[7] = {0};
Expand Down Expand Up @@ -459,7 +459,7 @@ int child_pid() {
int err = 0;
uint64_t fds[2] = {0};
uint64_t fds_length = 2;
err = ckb_inherited_file_descriptors(fds, &fds_length);
err = ckb_inherited_fds(fds, &fds_length);
CHECK(err);

// send pid
Expand Down
Binary file modified script/testdata/spawn_configurable_callee
Binary file not shown.
2 changes: 1 addition & 1 deletion script/testdata/spawn_configurable_callee.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ int main() {

uint64_t fds[2] = {0};
uint64_t fds_len = countof(fds);
err = ckb_inherited_file_descriptors(fds, &fds_len);
err = ckb_inherited_fds(fds, &fds_len);
CHECK(err);
CHECK2(fds_len == 2, ErrorCommon);

Expand Down
Binary file modified script/testdata/spawn_configurable_caller
Binary file not shown.
Binary file modified script/testdata/spawn_cycles
Binary file not shown.
2 changes: 1 addition & 1 deletion script/testdata/spawn_cycles.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ int main() {
case 4:
len = 2;
toc = tic();
err = ckb_inherited_file_descriptors(fds[cid][1], &len);
err = ckb_inherited_fds(fds[cid][1], &len);
CHECK(err);
toc = tic();
CHECK2(toc > cal_cycles_floor(1, 1, 0), ErrorCommon);
Expand Down
Binary file modified script/testdata/spawn_dag
Binary file not shown.
Binary file modified script/testdata/spawn_fuzzing
Binary file not shown.
2 changes: 1 addition & 1 deletion script/testdata/spawn_fuzzing.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ int child_entry() {
int err = 0;
uint64_t inherited_fds[2];
size_t inherited_fds_length = 2;
err = ckb_inherited_file_descriptors(inherited_fds, &inherited_fds_length);
err = ckb_inherited_fds(inherited_fds, &inherited_fds_length);
CHECK(err);
random_read_write(inherited_fds, 0);

Expand Down
Binary file modified script/testdata/spawn_huge_swap
Binary file not shown.
6 changes: 3 additions & 3 deletions script/testdata/spawn_huge_swap.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ int main() {
} else if (current_pid == 1) {
uint64_t inherited_fds[3];
size_t fds_len = 3;
err = ckb_inherited_file_descriptors(inherited_fds, &fds_len);
err = ckb_inherited_fds(inherited_fds, &fds_len);
CHECK(err);
uint8_t buf[1] = {0};
while (true) {
Expand All @@ -43,7 +43,7 @@ int main() {
} else if (current_pid == 2) {
uint64_t inherited_fds[3];
size_t fds_len = 3;
err = ckb_inherited_file_descriptors(inherited_fds, &fds_len);
err = ckb_inherited_fds(inherited_fds, &fds_len);
CHECK(err);
uint8_t buf[1] = {0};
while (true) {
Expand All @@ -62,4 +62,4 @@ int main() {

exit:
return err;
}
}
Binary file modified script/testdata/spawn_io_cycles
Binary file not shown.
2 changes: 1 addition & 1 deletion script/testdata/spawn_io_cycles.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ int child(ScriptArgs* args, uint8_t* buffer) {
int err = 0;
uint64_t inherited_fds[2];
size_t inherited_fds_length = 2;
err = ckb_inherited_file_descriptors(inherited_fds, &inherited_fds_length);
err = ckb_inherited_fds(inherited_fds, &inherited_fds_length);
CHECK(err);

uint64_t buf_len = args->io_size;
Expand Down
Binary file modified script/testdata/spawn_recursive
Binary file not shown.
Binary file modified script/testdata/spawn_saturate_memory
Binary file not shown.
2 changes: 1 addition & 1 deletion script/testdata/spawn_saturate_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ int main(int argc, const char* argv[]) {
dirty_all_pages();
uint64_t inherited_fds[2];
size_t inherited_fds_length = 2;
err = ckb_inherited_file_descriptors(inherited_fds, &inherited_fds_length);
err = ckb_inherited_fds(inherited_fds, &inherited_fds_length);
uint64_t length = MAX_MEMORY;
// Write a piece of data starting from address 0 with a size of 4M.
// It should not consume any memory.
Expand Down
Binary file modified script/testdata/spawn_times
Binary file not shown.

0 comments on commit a6a1f15

Please sign in to comment.