Skip to content

Commit

Permalink
Merge branch 'main' into more-ioctl
Browse files Browse the repository at this point in the history
  • Loading branch information
SuchAFuriousDeath committed Feb 24, 2024
2 parents 7e7724e + d01b6d6 commit 0af3b74
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 17 deletions.
35 changes: 32 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,41 @@ on:
- main
concurrency: dev-${{ github.ref }}
jobs:
windows:
build-windows:
name: Build
uses: ./.github/workflows/ci-windows.yml
linux:
build-linux:
name: Build
uses: ./.github/workflows/ci-linux.yml
mac:
build-mac:
name: Build
uses: ./.github/workflows/ci-mac.yml
housekeep:
name: Housekeep
runs-on: ubuntu-latest
steps:
- name: Update PRs
run: |
import { Octokit } from 'octokit';
const octokit = new Octokit({ auth: '${{ secrets.GITHUB_TOKEN }}' });
const owner = '${{ github.event.repository.owner.login }}';
const repo = '${{ github.event.repository.name }}';
const resp = await octokit.request('GET /repos/{owner}/{repo}/pulls', {
owner,
repo,
base: '${{ github.ref_name }}',
sort: 'updated',
direction: 'desc',
per_page: 100,
});
for (const pull of resp.data) {
await octokit.request('POST /repos/{owner}/{repo}/issues/{issue_number}/labels', {
owner,
repo,
issue_number: pull.number,
labels: ['B-out-of-date'],
});
}
shell: node --input-type=module {0}
2 changes: 1 addition & 1 deletion src/kernel/src/errno.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ macro_rules! error_numbers {
};
)*

pub fn strerror_impl(num: NonZeroI32) -> &'static str {
fn strerror_impl(num: NonZeroI32) -> &'static str {
match num {
$( $name => $desc, )*
_ => todo!("strerror {num}", num = num.get()),
Expand Down
23 changes: 11 additions & 12 deletions src/kernel/src/signal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ mod set;
pub struct Signal(NonZeroI32);

impl Signal {
pub fn new(raw: i32) -> Option<Self> {
pub const fn new(raw: i32) -> Option<Self> {
match raw {
1..=SIG_MAXSIG => Some(Signal(unsafe { NonZeroI32::new_unchecked(raw) })),
_ => None,
Expand All @@ -27,13 +27,13 @@ macro_rules! signals {
($($name:ident($num:expr),)*) => {
$(
#[allow(dead_code)]
pub const $name: Signal = Signal(unsafe {
assert!($num > 0 && $num <= SIG_MAXSIG);
NonZeroI32::new_unchecked($num)
});
pub const $name: Signal = match Signal::new($num) {
Some(sig) => sig,
None => panic!(),
};
)*

pub fn strsignal_impl(sig: Signal) -> Cow<'static, str> {
fn strsignal_impl(sig: Signal) -> Cow<'static, str> {
match sig.0.get() {
$( $num => Cow::Borrowed(stringify!($name)), )*
_ => format!("{sig}", sig = sig.get()).into(),
Expand All @@ -43,8 +43,8 @@ macro_rules! signals {
}

// List of PS4 signals. The value must be the same as PS4 kernel.
#[rustfmt::skip]
signals!(

signals! {
SIGHUP(1),
SIGINT(2),
SIGQUIT(3),
Expand Down Expand Up @@ -78,7 +78,7 @@ signals!(
SIGUSR2(31),
SIGTHR(32),
SIGNONE(128),
);
}

pub fn strsignal(sig: Signal) -> Cow<'static, str> {
// This function is generated inside the macro `signals!`.
Expand Down Expand Up @@ -109,10 +109,9 @@ impl Iterator for SignalIter {
type Item = Signal;

fn next(&mut self) -> Option<Self::Item> {
if self.current <= SIG_MAXSIG {
let signal = Signal(unsafe { NonZeroI32::new_unchecked(self.current) });
if let Some(sig) = Signal::new(self.current) {
self.current += 1;
Some(signal)
Some(sig)
} else {
None
}
Expand Down
2 changes: 1 addition & 1 deletion src/kernel/src/signal/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl SignalSet {
/// An implementation of `_SIG_WORD`.
fn word(s: Signal) -> usize {
// This is safe because `Signal` is guaranteed to be non-negative.
unsafe { (Self::idx(s) >> 5).try_into().unwrap_unchecked() }
unsafe { (Self::idx(s) >> 5).try_into().unwrap() }
}

/// An implementation of `_SIG_BIT`.
Expand Down

0 comments on commit 0af3b74

Please sign in to comment.