-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1062 from MacroModel/next
Next
- Loading branch information
Showing
20 changed files
with
220 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#pragma once | ||
#include "unix_driver/syscall.h" |
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,67 @@ | ||
#pragma once | ||
|
||
namespace fast_io | ||
{ | ||
/* | ||
system calls | ||
01;0000001 /exit | ||
01;0000002 /fork | ||
01;0000003 /read | ||
01;0000004 /write | ||
01;0000005 /open | ||
01;0000006 /close | ||
01;0000007 /wait | ||
01;0000010 /creat | ||
01;0000011 /link | ||
01;0000012 /unlink | ||
01;0000013 /exec | ||
01;0000014 /chdir | ||
01;0000015 /time | ||
01;0000016 /makdir | ||
01;0000017 /chmod | ||
01;0000020 /chown | ||
01;0000021 /break | ||
01;0000022 /stat | ||
01;0000023 /seek | ||
01;0000024 /tell | ||
01;0000025 /mount | ||
01;0000026 /umount | ||
01;0000027 /setuid | ||
01;0000030 /getuid | ||
01;0000031 /stime | ||
01;0000034 /fstat | ||
01;0000036 /mdate | ||
01;0000037 /stty | ||
01;0000040 /gtty | ||
01;0000042 /nice | ||
01;0000060 /signal | ||
*/ | ||
namespace unix | ||
{ | ||
inline void exit(int status) noexcept | ||
{ | ||
__asm__ __volatile__( | ||
"mov %0, r2\n\t" | ||
"sys 1\n\t" | ||
: | ||
: "r"(status) | ||
: "memory", "cc"); | ||
} | ||
|
||
inline int write(int fd, char const *buf, int len) noexcept | ||
{ | ||
int ret; | ||
__asm__ __volatile__( | ||
"mov %1, r2\n\t" | ||
"mov %2, r3\n\t" | ||
"mov %3, r4\n\t" | ||
"sys 4\n\t" | ||
"mov r0, %0\n\t" | ||
: "=r"(ret) | ||
: "r"(fd), "r"(buf), "r"(len) | ||
: "memory", "cc"); | ||
return ret; | ||
} | ||
} // namespace unix | ||
} // namespace fast_io |
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
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 |
---|---|---|
@@ -1,2 +1,30 @@ | ||
#pragma once | ||
|
||
#if !defined(__MSDOS__) && !defined(__NEWLIB__) && !defined(__wasi__) && !defined(_PICOLIBC__) | ||
#include "basic.h" | ||
|
||
#include "posix/named_pipe.h" | ||
#include "posix/eventfd.h" | ||
#if (defined(_WIN32) && !defined(__WINE__)) || defined(__CYGWIN__) | ||
#include "win32/named_pipe_win32.h" | ||
#include "win32/rpc_nt.h" | ||
#include "win32/alpc_nt.h" | ||
#endif | ||
|
||
namespace fast_io | ||
{ | ||
#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__WINE__) | ||
#if !defined(_WIN32_WINDOWS) && (!defined(_WIN32_WINNT) || _WIN32_WINNT >= 0x600) | ||
// alpc | ||
#elif !defined(_WIN32_WINDOWS) | ||
// rpc | ||
#else | ||
// named pipe | ||
template <::std::integral char_type> | ||
using basic_native_ipc_observer = ::fast_io::basic_named_pipe_ipc_observer<char_type>; | ||
#endif | ||
#else | ||
// posix to do | ||
#endif | ||
} | ||
#endif |
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 |
---|---|---|
@@ -1 +1,6 @@ | ||
#pragma once | ||
|
||
namespace fast_io | ||
{ | ||
|
||
} |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
91 changes: 91 additions & 0 deletions
91
include/fast_io_hosted/process/ipc/win32/named_pipe_win32.h
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,91 @@ | ||
#pragma once | ||
|
||
namespace fast_io | ||
{ | ||
template <win32_family family, ::std::integral ch_type> | ||
class basic_win32_family_named_pipe_ipc_observer | ||
{ | ||
public: | ||
using native_handle_type = void *; | ||
using char_type = ch_type; | ||
using input_char_type = char_type; | ||
using output_char_type = char_type; | ||
native_handle_type handle{}; | ||
inline constexpr native_handle_type native_handle() const noexcept | ||
{ | ||
return handle; | ||
} | ||
inline explicit operator bool() const noexcept | ||
{ | ||
return handle != nullptr && handle != reinterpret_cast<void *>(static_cast<::std::ptrdiff_t>(-1)); | ||
} | ||
inline constexpr native_handle_type release() noexcept | ||
{ | ||
auto temp{handle}; | ||
handle = nullptr; | ||
return temp; | ||
} | ||
}; | ||
|
||
template <win32_family family, ::std::integral ch_type> | ||
inline constexpr bool operator==(basic_win32_family_named_pipe_ipc_observer<family, ch_type> a, | ||
basic_win32_family_named_pipe_ipc_observer<family, ch_type> b) noexcept | ||
{ | ||
return a.handle == b.handle; | ||
} | ||
|
||
#if __cpp_impl_three_way_comparison >= 201907L | ||
template <win32_family family, ::std::integral ch_type> | ||
inline constexpr auto operator<=>(basic_win32_family_named_pipe_ipc_observer<family, ch_type> a, | ||
basic_win32_family_named_pipe_ipc_observer<family, ch_type> b) noexcept | ||
{ | ||
return a.handle <=> b.handle; | ||
} | ||
#endif | ||
|
||
template <win32_family family, ::std::integral ch_type> | ||
class basic_win32_family_named_pipe_ipc : public basic_win32_family_named_pipe_ipc_observer<family, ch_type> | ||
{ | ||
public: | ||
using typename basic_win32_family_named_pipe_ipc_observer<family, ch_type>::char_type; | ||
using typename basic_win32_family_named_pipe_ipc_observer<family, ch_type>::input_char_type; | ||
using typename basic_win32_family_named_pipe_ipc_observer<family, ch_type>::output_char_type; | ||
using typename basic_win32_family_named_pipe_ipc_observer<family, ch_type>::native_handle_type; | ||
using basic_win32_family_named_pipe_ipc_observer<family, ch_type>::native_handle; | ||
|
||
inline explicit constexpr basic_win32_family_named_pipe_ipc() noexcept = default; | ||
|
||
inline constexpr basic_win32_family_named_pipe_ipc(basic_win32_family_named_pipe_ipc_observer<family, ch_type>) noexcept = delete; | ||
inline constexpr basic_win32_family_named_pipe_ipc &operator=(basic_win32_family_named_pipe_ipc_observer<family, ch_type>) noexcept = delete; | ||
|
||
}; | ||
|
||
|
||
template <::std::integral ch_type> | ||
using basic_win32_named_pipe_ipc_observer = basic_win32_family_named_pipe_ipc_observer<win32_family::native, ch_type>; | ||
template <::std::integral ch_type> | ||
using basic_win32_named_pipe_ipc_observer_ntw = basic_win32_family_named_pipe_ipc_observer<win32_family::wide_nt, ch_type>; | ||
template <::std::integral ch_type> | ||
using basic_win32_named_pipe_ipc_observer_9xa = basic_win32_family_named_pipe_ipc_observer<win32_family::ansi_9x, ch_type>; | ||
|
||
using win32_named_pipe_ipc_observer = basic_win32_named_pipe_ipc_observer<char>; | ||
using win32_named_pipe_ipc_observer_ntw = basic_win32_named_pipe_ipc_observer_ntw<char>; | ||
using win32_named_pipe_ipc_observer_9xa = basic_win32_named_pipe_ipc_observer_9xa<char>; | ||
|
||
using wwin32_named_pipe_ipc_observer = basic_win32_named_pipe_ipc_observer<wchar_t>; | ||
using wwin32_named_pipe_ipc_observer_ntw = basic_win32_named_pipe_ipc_observer_ntw<wchar_t>; | ||
using wwin32_named_pipe_ipc_observer_9xa = basic_win32_named_pipe_ipc_observer_9xa<wchar_t>; | ||
|
||
using u8win32_named_pipe_ipc_observer = basic_win32_named_pipe_ipc_observer<char8_t>; | ||
using u8win32_named_pipe_ipc_observer_ntw = basic_win32_named_pipe_ipc_observer_ntw<char8_t>; | ||
using u8win32_named_pipe_ipc_observer_9xa = basic_win32_named_pipe_ipc_observer_9xa<char8_t>; | ||
|
||
using u16win32_named_pipe_ipc_observer = basic_win32_named_pipe_ipc_observer<char16_t>; | ||
using u16win32_named_pipe_ipc_observer_ntw = basic_win32_named_pipe_ipc_observer_ntw<char16_t>; | ||
using u16win32_named_pipe_ipc_observer_9xa = basic_win32_named_pipe_ipc_observer_9xa<char16_t>; | ||
|
||
using u32win32_named_pipe_ipc_observer = basic_win32_named_pipe_ipc_observer<char32_t>; | ||
using u32win32_named_pipe_ipc_observer_ntw = basic_win32_named_pipe_ipc_observer_ntw<char32_t>; | ||
using u32win32_named_pipe_ipc_observer_9xa = basic_win32_named_pipe_ipc_observer_9xa<char32_t>; | ||
} // namespace fast_io | ||
|
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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 @@ | ||
#pragma once |
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