Skip to content

Commit

Permalink
ckb2023 -> ckb 2nd hardfork
Browse files Browse the repository at this point in the history
  • Loading branch information
mohanson committed Nov 14, 2024
1 parent 48db1fe commit 32bf566
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/syscalls/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ pub struct SpawnArgs {
/// The parent process calls the Spawn system call, which creates a new process (a child process) that is an
/// independent ckb-vm instance. It's important to note that the parent process will not be blocked by the child
/// process as a result of this syscall.
/// Note: available after ckb2023.
/// Note: available after ckb 2nd hardfork.
///
/// # Arguments
///
Expand Down Expand Up @@ -629,7 +629,7 @@ pub fn spawn(
}

/// The syscall pauses until the execution of a process specified by pid has ended.
/// Note: available after ckb2023.
/// Note: available after ckb 2nd hardfork.
///
/// # Arguments
///
Expand All @@ -647,14 +647,14 @@ pub fn wait(pid: u64) -> Result<i8, SysError> {
}

/// This syscall is used to get the current process id. Root process ID is 0.
/// Note: available after ckb2023.
/// Note: available after ckb 2nd hardfork.
pub fn process_id() -> u64 {
unsafe { syscall(0, 0, 0, 0, 0, 0, 0, SYS_PROCESS_ID) }
}

/// This syscall create a pipe with read-write pair of file descriptions. The file descriptor with read permission is
/// located at fds[0], and the corresponding file descriptor with write permission is located at fds[1].
/// Note: available after ckb2023.
/// Note: available after ckb 2nd hardfork.
pub fn pipe() -> Result<(u64, u64), SysError> {
let mut fds: [u64; 2] = [0, 0];
let ret = unsafe { syscall(fds.as_mut_ptr() as u64, 0, 0, 0, 0, 0, 0, SYS_PIPE) };
Expand All @@ -667,7 +667,7 @@ pub fn pipe() -> Result<(u64, u64), SysError> {

/// This syscall reads data from a pipe via a file descriptor. The syscall Read attempts to read up to value pointed by
/// length bytes from file descriptor fd into the buffer, and the actual length of data read is returned.
/// Note: available after ckb2023.
/// Note: available after ckb 2nd hardfork.
pub fn read(fd: u64, buffer: &mut [u8]) -> Result<usize, SysError> {
let mut l: u64 = buffer.len() as u64;
let ret = unsafe {
Expand All @@ -693,7 +693,7 @@ pub fn read(fd: u64, buffer: &mut [u8]) -> Result<usize, SysError> {

/// This syscall writes data to a pipe via a file descriptor. The syscall Write writes up to value pointed by length
/// bytes from the buffer, and the actual length of data written is returned.
/// Note: available after ckb2023.
/// Note: available after ckb 2nd hardfork.
pub fn write(fd: u64, buffer: &[u8]) -> Result<usize, SysError> {
let mut l: u64 = buffer.len() as u64;
let ret = unsafe {
Expand All @@ -719,7 +719,7 @@ pub fn write(fd: u64, buffer: &[u8]) -> Result<usize, SysError> {

/// This syscall retrieves the file descriptors available to the current process, which are passed in from the parent
/// process. These results are copied from the inherited_fds parameter of the Spawn syscall.
/// Note: available after ckb2023.
/// Note: available after ckb 2nd hardfork.
pub fn inherited_fds(fds: &mut [u64]) -> u64 {
let mut l: u64 = fds.len() as u64;
unsafe {
Expand All @@ -739,7 +739,7 @@ pub fn inherited_fds(fds: &mut [u64]) -> u64 {

/// This syscall manually closes a file descriptor. After calling this, any attempt to read/write the file descriptor
/// pointed to the other end would fail.
/// Note: available after ckb2023.
/// Note: available after ckb 2nd hardfork.
pub fn close(fd: u64) -> Result<(), SysError> {
let ret = unsafe { syscall(fd, 0, 0, 0, 0, 0, 0, SYS_CLOSE) };
match ret {
Expand All @@ -759,7 +759,7 @@ pub fn close(fd: u64) -> Result<(), SysError> {
/// * `index` - index of cell
/// * `source` - source of cell
///
/// Note: available after ckb2023.
/// Note: available after ckb 2nd hardfork.
pub fn load_block_extension(
buf: &mut [u8],
offset: usize,
Expand Down

0 comments on commit 32bf566

Please sign in to comment.