-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement
enif_select
and add select
and mkfifo
to file functions
`enif_select` is an API that allows nifs to use `select(2)` or equivalent, paving the way for nif-based drivers. `enif_select` depends on platform implementations and this PR only implements it on generic_unix platform, using `sys_poll_event` select-like function, namely `kqueue(2)` or `poll(2)`. As a result, `enif_select` does not exactly behaves like `select(2)` and this is documented. For testing, add `mkfifo` and `select` to POSIX file functions. Signed-off-by: Paul Guyot <[email protected]>
- Loading branch information
Showing
17 changed files
with
820 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
/* | ||
* This file is part of AtomVM. | ||
* | ||
* Copyright 2023 Paul Guyot <[email protected]> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later | ||
*/ | ||
|
||
%readonly-tables | ||
%define lookup-function-name defaultatom_in_word_set | ||
%pic | ||
|
||
%{ | ||
#include <defaultatom.h> | ||
%} | ||
%% | ||
"\005false", FALSE_ATOM_INDEX | ||
"\004true", TRUE_ATOM_INDEX | ||
"\002ok", OK_ATOM_INDEX | ||
"\005error", ERROR_ATOM_INDEX | ||
"\011undefined", UNDEFINED_ATOM_INDEX | ||
"\006badarg", BADARG_ATOM_INDEX | ||
"\010badarith", BADARITH_ATOM_INDEX | ||
"\010badarity", BADARITY_ATOM_INDEX | ||
"\006badfun", BADFUN_ATOM_INDEX | ||
"\014system_limit", SYSTEM_LIMIT_ATOM_INDEX | ||
"\017function_clause", FUNCTION_CLAUSE_ATOM_INDEX | ||
"\012try_clause", TRY_CLAUSE_ATOM_INDEX | ||
"\015out_of_memory", OUT_OF_MEMORY_ATOM_INDEX | ||
"\010overflow", OVERFLOW_ATOM_INDEX | ||
"\005flush", FLUSH_ATOM_INDEX | ||
"\011heap_size", HEAP_SIZE_ATOM_INDEX | ||
"\006latin1", LATIN1_ATOM_INDEX | ||
"\015max_heap_size", MAX_HEAP_SIZE_ATOM_INDEX | ||
"\006memory", MEMORY_ATOM_INDEX | ||
"\021message_queue_len", MESSAGE_QUEUE_LEN_ATOM_INDEX | ||
"\004puts", PUTS_ATOM_INDEX | ||
"\012stack_size", STACK_SIZE_ATOM_INDEX | ||
"\015min_heap_size", MIN_HEAP_SIZE_ATOM_INDEX | ||
"\015process_count", PROCESS_COUNT_ATOM_INDEX | ||
"\012port_count", PORT_COUNT_ATOM_INDEX | ||
"\012atom_count", ATOM_COUNT_ATOM_INDEX | ||
"\023system_architecture", SYSTEM_ARCHITECTURE_ATOM_INDEX | ||
"\010wordsize", WORDSIZE_ATOM_INDEX | ||
"\010decimals", DECIMALS_ATOM_INDEX | ||
"\012scientific", SCIENTIFIC_ATOM_INDEX | ||
"\007compact", COMPACT_ATOM_INDEX | ||
"\010badmatch", BADMATCH_ATOM_INDEX | ||
"\013case_clause", CASE_CLAUSE_ATOM_INDEX | ||
"\011if_clause", IF_CLAUSE_ATOM_INDEX | ||
"\005throw", THROW_ATOM_INDEX | ||
"\013low_entropy", LOW_ENTROPY_ATOM_INDEX | ||
"\013unsupported", UNSUPPORTED_ATOM_INDEX | ||
"\004used", USED_ATOM_INDEX | ||
"\003all", ALL_ATOM_INDEX | ||
"\005start", START_ATOM_INDEX | ||
"\005undef", UNDEF_ATOM_INDEX | ||
"\010vm_abort", VM_ABORT_ATOM_INDEX | ||
"\004link", LINK_ATOM_INDEX | ||
"\007monitor", MONITOR_ATOM_INDEX | ||
"\006normal", NORMAL_ATOM_INDEX | ||
"\004DOWN", DOWN_ATOM_INDEX | ||
"\007process", PROCESS_ATOM_INDEX | ||
"\007nocatch", NOCATCH_ATOM_INDEX | ||
"\020refc_binary_info", REFC_BINARY_INFO_ATOM_INDEX | ||
"\006noproc", NOPROC_ATOM_INDEX | ||
"\011trap_exit", TRAP_EXIT_ATOM_INDEX | ||
"\004EXIT", EXIT_ATOM_INDEX | ||
"\006badmap", BADMAP_ATOM_INDEX | ||
"\006badkey", BADKEY_ATOM_INDEX | ||
"\004none", NONE_ATOM_INDEX | ||
"\012io_request", IO_REQUEST_ATOM_INDEX | ||
"\010io_reply", IO_REPLY_ATOM_INDEX | ||
"\011put_chars", PUT_CHARS_ATOM_INDEX | ||
"\004exit", LOWERCASE_EXIT_ATOM_INDEX | ||
"\016atomvm_version", ATOMVM_VERSION_ATOM_INDEX | ||
"\006second", SECOND_ATOM_INDEX | ||
"\013millisecond", MILLISECOND_ATOM_INDEX | ||
"\013microsecond", MICROSECOND_ATOM_INDEX | ||
"\010infinity", INFINITY_ATOM_INDEX | ||
"\015timeout_value", TIMEOUT_VALUE_ATOM_INDEX | ||
"\007machine", MACHINE_ATOM_INDEX | ||
"\015avm_floatsize", AVM_FLOATSIZE_ATOM_INDEX | ||
"\006append", APPEND_ATOM_INDEX | ||
"\016private_append", PRIVATE_APPEND_ATOM_INDEX | ||
"\006binary", BINARY_ATOM_INDEX | ||
"\007integer", INTEGER_ATOM_INDEX | ||
"\006little", LITTLE_ATOM_INDEX | ||
"\006native", NATIVE_ATOM_INDEX | ||
"\006string", STRING_ATOM_INDEX | ||
"\004utf8", UTF8_ATOM_INDEX | ||
"\005utf16", UTF16_ATOM_INDEX | ||
"\005utf32", UTF32_ATOM_INDEX | ||
"\011badrecord", BADRECORD_ATOM_INDEX | ||
"\004copy", COPY_ATOM_INDEX | ||
"\005reuse", REUSE_ATOM_INDEX | ||
"\017ensure_at_least", ENSURE_AT_LEAST_ATOM_INDEX | ||
"\016ensure_exactly", ENSURE_EXACTLY_ATOM_INDEX | ||
"\004skip", SKIP_ATOM_INDEX | ||
"\010get_tail", GET_TAIL_ATOM_INDEX | ||
"\003=:=", EQUAL_COLON_EQUAL_ATOM_INDEX | ||
"\006signed", SIGNED_ATOM_INDEX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.