Skip to content

Commit bddd6e2

Browse files
various changes to make xeyes work
honestly, couldnt give a fuck to create seperate commit for each change. so good.
1 parent fe1ec2b commit bddd6e2

File tree

16 files changed

+297
-256
lines changed

16 files changed

+297
-256
lines changed

bootstrap.yml

Lines changed: 93 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -442,61 +442,61 @@ tools:
442442
- args: ['ninja', 'install']
443443

444444
packages:
445-
- name: ripgrep
446-
source:
447-
subdir: bundled
448-
git: 'https://github.com/BurntSushi/ripgrep.git'
449-
tag: '12.1.1'
450-
version: '12.1.1'
451-
tools_required:
452-
- host-cargo
453-
sources_required:
454-
- rust-patched-libs
455-
pkgs_required:
456-
- mlibc
457-
configure:
458-
- args: ['cp', '-r', '@THIS_SOURCE_DIR@/.', '@THIS_BUILD_DIR@']
459-
# cc: https://github.com/rust-lang/cargo/issues/10283
460-
# - args: ['python3', '@SOURCE_ROOT@/tools/cargo-inject-patches.py', '@THIS_SOURCE_DIR@/Cargo.toml']
461-
build:
462-
- args: ['python3', '@SOURCE_ROOT@/tools/cargo-inject-patches.py', './Cargo.toml']
463-
- args:
464-
- 'cargo'
465-
- 'install'
466-
- '--locked'
467-
- '--path'
468-
- '.'
469-
- '--root'
470-
- '@THIS_COLLECT_DIR@/usr'
471-
- '-j@PARALLELISM@'
445+
# - name: ripgrep
446+
# source:
447+
# subdir: bundled
448+
# git: 'https://github.com/BurntSushi/ripgrep.git'
449+
# tag: '12.1.1'
450+
# version: '12.1.1'
451+
# tools_required:
452+
# - host-cargo
453+
# sources_required:
454+
# - rust-patched-libs
455+
# pkgs_required:
456+
# - mlibc
457+
# configure:
458+
# - args: ['cp', '-r', '@THIS_SOURCE_DIR@/.', '@THIS_BUILD_DIR@']
459+
# # cc: https://github.com/rust-lang/cargo/issues/10283
460+
# # - args: ['python3', '@SOURCE_ROOT@/tools/cargo-inject-patches.py', '@THIS_SOURCE_DIR@/Cargo.toml']
461+
# build:
462+
# - args: ['python3', '@SOURCE_ROOT@/tools/cargo-inject-patches.py', './Cargo.toml']
463+
# - args:
464+
# - 'cargo'
465+
# - 'install'
466+
# - '--locked'
467+
# - '--path'
468+
# - '.'
469+
# - '--root'
470+
# - '@THIS_COLLECT_DIR@/usr'
471+
# - '-j@PARALLELISM@'
472472

473-
- name: hex
474-
source:
475-
subdir: bundled
476-
git: 'https://github.com/sitkevij/hex'
477-
tag: 'v0.4.2'
478-
version: '0.4.2'
479-
tools_required:
480-
- host-cargo
481-
sources_required:
482-
- rust-patched-libs
483-
pkgs_required:
484-
- mlibc
485-
configure:
486-
# cc: https://github.com/rust-lang/cargo/issues/10283
487-
# - args: ['python3', '@SOURCE_ROOT@/tools/cargo-inject-patches.py', '@THIS_SOURCE_DIR@/Cargo.toml']
488-
- args: ['cp', '-r', '@THIS_SOURCE_DIR@/.', '@THIS_BUILD_DIR@']
489-
build:
490-
- args: ['python3', '@SOURCE_ROOT@/tools/cargo-inject-patches.py', './Cargo.toml']
491-
- args:
492-
- 'cargo'
493-
- 'install'
494-
- '--locked'
495-
- '--path'
496-
- '.'
497-
- '--root'
498-
- '@THIS_COLLECT_DIR@/usr'
499-
- '-j@PARALLELISM@'
473+
# - name: hex
474+
# source:
475+
# subdir: bundled
476+
# git: 'https://github.com/sitkevij/hex'
477+
# tag: 'v0.4.2'
478+
# version: '0.4.2'
479+
# tools_required:
480+
# - host-cargo
481+
# sources_required:
482+
# - rust-patched-libs
483+
# pkgs_required:
484+
# - mlibc
485+
# configure:
486+
# # cc: https://github.com/rust-lang/cargo/issues/10283
487+
# # - args: ['python3', '@SOURCE_ROOT@/tools/cargo-inject-patches.py', '@THIS_SOURCE_DIR@/Cargo.toml']
488+
# - args: ['cp', '-r', '@THIS_SOURCE_DIR@/.', '@THIS_BUILD_DIR@']
489+
# build:
490+
# - args: ['python3', '@SOURCE_ROOT@/tools/cargo-inject-patches.py', './Cargo.toml']
491+
# - args:
492+
# - 'cargo'
493+
# - 'install'
494+
# - '--locked'
495+
# - '--path'
496+
# - '.'
497+
# - '--root'
498+
# - '@THIS_COLLECT_DIR@/usr'
499+
# - '-j@PARALLELISM@'
500500

501501
# - name: bat
502502
# source:
@@ -541,33 +541,53 @@ packages:
541541
- args: ['mkdir', '-p', '@THIS_COLLECT_DIR@/usr/bin']
542542
- args: ['cp', '@THIS_BUILD_DIR@/qjs', '@THIS_COLLECT_DIR@/usr/bin/qjs']
543543

544-
- name: sd
544+
# - name: sd
545+
# source:
546+
# subdir: bundled
547+
# git: 'https://github.com/chmln/sd'
548+
# tag: 'v0.7.6'
549+
# version: '0.7.6'
550+
# tools_required:
551+
# - host-cargo
552+
# sources_required:
553+
# - rust-patched-libs
554+
# pkgs_required:
555+
# - mlibc
556+
# configure:
557+
# - args: ['cp', '-r', '@THIS_SOURCE_DIR@/.', '@THIS_BUILD_DIR@']
558+
# # cc: https://github.com/rust-lang/cargo/issues/10283
559+
# # - args: ['python3', '@SOURCE_ROOT@/tools/cargo-inject-patches.py', '@THIS_SOURCE_DIR@/Cargo.toml']
560+
# build:
561+
# - args: ['python3', '@SOURCE_ROOT@/tools/cargo-inject-patches.py', './Cargo.toml']
562+
# - args:
563+
# - 'cargo'
564+
# - 'install'
565+
# - '--locked'
566+
# - '--path'
567+
# - '.'
568+
# - '--root'
569+
# - '@THIS_COLLECT_DIR@/usr'
570+
# - '-j@PARALLELISM@'
571+
572+
- name: socket_test
545573
source:
546574
subdir: bundled
547-
git: 'https://github.com/chmln/sd'
548-
tag: 'v0.7.6'
549-
version: '0.7.6'
575+
git: 'https://github.com/streaksu/socket_test'
576+
branch: 'main'
550577
tools_required:
551-
- host-cargo
552-
sources_required:
553-
- rust-patched-libs
578+
- host-gcc
554579
pkgs_required:
555580
- mlibc
556581
configure:
557582
- args: ['cp', '-r', '@THIS_SOURCE_DIR@/.', '@THIS_BUILD_DIR@']
558-
# cc: https://github.com/rust-lang/cargo/issues/10283
559-
# - args: ['python3', '@SOURCE_ROOT@/tools/cargo-inject-patches.py', '@THIS_SOURCE_DIR@/Cargo.toml']
560583
build:
561-
- args: ['python3', '@SOURCE_ROOT@/tools/cargo-inject-patches.py', './Cargo.toml']
562-
- args:
563-
- 'cargo'
564-
- 'install'
565-
- '--locked'
566-
- '--path'
567-
- '.'
568-
- '--root'
569-
- '@THIS_COLLECT_DIR@/usr'
570-
- '-j@PARALLELISM@'
584+
- args: ['make', '-j@PARALLELISM@']
585+
environ:
586+
CC: "x86_64-aero-gcc"
587+
- args: ['make', 'install']
588+
environ:
589+
PREFIX: '/usr'
590+
DESTDIR: '@THIS_COLLECT_DIR@'
571591

572592
- name: mlibc-headers
573593
from_source: mlibc

bootstrap/xorg.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ packages:
658658
CFLAGS: '-Wno-error=array-bounds -O0 -g -pipe'
659659
build:
660660
- args: ['make', '-j@PARALLELISM@']
661-
- args: ['make', 'install-strip']
661+
- args: ['make', 'install']
662662
environ:
663663
DESTDIR: '@THIS_COLLECT_DIR@'
664664
- args: ['mkdir', '-p', '@THIS_COLLECT_DIR@/etc/X11']

src/aero_kernel/src/arch/x86_64/signals.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,6 @@ pub fn sigreturn(stack: &mut InterruptStack) -> usize {
170170
*stack = signal_frame.frame;
171171

172172
if signal_frame.restart_syscall != u64::MAX {
173-
#[cfg(feature = "syslog")]
174-
log::debug!(
175-
"sigreturn: restarting {} syscall",
176-
aero_syscall::syscall_as_str(signal_frame.restart_syscall as _)
177-
);
178-
179173
stack.iret.rip -= SYSCALL_INSTRUCTION_SIZE;
180174
}
181175

src/aero_kernel/src/arch/x86_64/time.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ fn pit_irq_handler(_stack: &mut InterruptStack) {
111111

112112
if value % PIT_FREQUENCY_HZ == 0 {
113113
UPTIME_SEC.fetch_add(1, Ordering::Relaxed); // Increment uptime seconds
114+
crate::syscall::check_timers();
114115
}
115116
}
116117

src/aero_kernel/src/fs/ext2/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use spin::RwLock;
3232
use crate::fs::block::BlockDeviceInterface;
3333
use crate::fs::cache::CachedINode;
3434
use crate::fs::ext2::disk::{FileType, SuperBlock};
35-
use crate::mem::paging::{FrameAllocator, PhysFrame, FRAME_ALLOCATOR};
35+
use crate::mem::paging::{FrameAllocator, PhysFrame, VirtAddr, FRAME_ALLOCATOR};
3636

3737
use crate::socket::unix::UnixSocket;
3838
use crate::socket::SocketAddr;
@@ -505,17 +505,17 @@ impl INodeInterface for INode {
505505
return Err(FileSystemError::NotSupported);
506506
}
507507

508-
fn accept(&self, address: Option<&mut SocketAddr>) -> super::Result<Arc<UnixSocket>> {
508+
fn accept(&self, address: Option<(VirtAddr, &mut u32)>) -> super::Result<Arc<UnixSocket>> {
509509
if let Some(proxy) = self.proxy.as_ref() {
510510
return proxy.accept(address);
511511
}
512512

513513
return Err(FileSystemError::NotSupported);
514514
}
515515

516-
fn recv(&self, message_header: &mut MessageHeader) -> super::Result<usize> {
516+
fn recv(&self, message_header: &mut MessageHeader, non_block: bool) -> super::Result<usize> {
517517
if let Some(proxy) = self.proxy.as_ref() {
518-
return proxy.recv(message_header);
518+
return proxy.recv(message_header, non_block);
519519
}
520520

521521
return Err(FileSystemError::NotSupported);

src/aero_kernel/src/fs/file_table.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub struct FileHandle {
4545
// We need to store the `offset` behind an Arc since when the file handle
4646
// is duplicated, the `offset` needs to be in sync with the parent.
4747
pub offset: Arc<AtomicUsize>,
48-
pub flags: OpenFlags,
48+
pub flags: RwLock<OpenFlags>,
4949
pub fd_flags: Mutex<FdFlags>,
5050
}
5151

@@ -56,7 +56,7 @@ impl FileHandle {
5656
fd,
5757
inode: inode.clone(),
5858
offset: Arc::new(AtomicUsize::new(0)),
59-
flags,
59+
flags: RwLock::new(flags),
6060
fd_flags: Mutex::new(FdFlags::empty()),
6161
}
6262
}
@@ -123,16 +123,16 @@ impl FileHandle {
123123
}
124124

125125
pub fn duplicate(&self, dupfd: usize, flags: OpenFlags) -> super::Result<Arc<FileHandle>> {
126-
let flags = self.flags | flags;
126+
let flags = *self.flags.read() | flags;
127127
let new = Arc::new(Self {
128128
fd: dupfd,
129129
inode: self.inode.clone(),
130130
offset: self.offset.clone(),
131-
flags,
131+
flags: RwLock::new(flags),
132132
fd_flags: Mutex::new(self.fd_flags.lock().clone()),
133133
});
134134

135-
new.inode.inode().open(flags)?;
135+
new.inode.inode().open(flags, new.clone())?;
136136

137137
Ok(new)
138138
}
@@ -266,7 +266,7 @@ impl FileTable {
266266
let handle = handle.duplicate(new_fd, flags)?;
267267
let old = files[new_fd].take().unwrap();
268268

269-
old.inode.inode().close(old.flags);
269+
old.inode.inode().close(*old.flags.read());
270270
files[new_fd] = Some(handle);
271271

272272
Ok(0x00)
@@ -301,15 +301,15 @@ impl FileTable {
301301
if let Some((i, f)) = files.iter_mut().enumerate().find(|e| e.1.is_none()) {
302302
let handle = Arc::new(FileHandle::new(i, dentry, flags));
303303

304-
handle.inode.inode().open(flags)?;
304+
handle.inode.inode().open(flags, handle.clone())?;
305305
*f = Some(handle);
306306

307307
Ok(i)
308308
} else if files.len() < 256 {
309309
let fd = files.len();
310310
let handle = Arc::new(FileHandle::new(fd, dentry, flags));
311311

312-
handle.inode.inode().open(flags)?;
312+
handle.inode.inode().open(flags, handle.clone())?;
313313
files.push(Some(handle));
314314

315315
Ok(fd)
@@ -326,7 +326,7 @@ impl FileTable {
326326

327327
if let Some(file) = files.get_mut(fd) {
328328
if let Some(handle) = file {
329-
handle.inode.inode().close(handle.flags);
329+
handle.inode.inode().close(*handle.flags.read());
330330
*file = None;
331331

332332
return true;

src/aero_kernel/src/fs/inode.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use alloc::vec::Vec;
3030
use intrusive_collections::UnsafeRef;
3131
use spin::Once;
3232

33-
use crate::mem::paging::PhysFrame;
33+
use crate::mem::paging::{PhysFrame, VirtAddr};
3434
use crate::socket::unix::UnixSocket;
3535
use crate::socket::SocketAddr;
3636
use crate::userland::scheduler;
@@ -42,6 +42,7 @@ use super::cache::Cacheable;
4242
use super::cache::CachedINode;
4343
use super::cache::{DirCacheItem, INodeCacheItem};
4444
use super::devfs::DevINode;
45+
use super::file_table::FileHandle;
4546
use super::{FileSystem, FileSystemError, Result};
4647

4748
static DIR_CACHE_MARKER: AtomicUsize = AtomicUsize::new(0x00);
@@ -70,7 +71,7 @@ impl Drop for PollTable {
7071
bitflags::bitflags! {
7172
pub struct PollFlags: usize {
7273
/// The associated file is available for read operations.
73-
const IN = 1 << 1;
74+
const IN = 1 << 1;
7475
/// The associated file is available for write operations.
7576
const OUT = 1 << 2;
7677
/// Error condition happened on the associated file descriptor.
@@ -192,7 +193,7 @@ pub trait INodeInterface: Send + Sync {
192193
Err(FileSystemError::NotSupported)
193194
}
194195

195-
fn open(&self, _flags: OpenFlags) -> Result<()> {
196+
fn open(&self, _flags: OpenFlags, _handle: Arc<FileHandle>) -> Result<()> {
196197
Ok(())
197198
}
198199

@@ -239,11 +240,11 @@ pub trait INodeInterface: Send + Sync {
239240
Err(SyscallError::ENOTSOCK)
240241
}
241242

242-
fn accept(&self, _address: Option<&mut SocketAddr>) -> Result<Arc<UnixSocket>> {
243+
fn accept(&self, _address: Option<(VirtAddr, &mut u32)>) -> Result<Arc<UnixSocket>> {
243244
Err(FileSystemError::NotSocket)
244245
}
245246

246-
fn recv(&self, _message_header: &mut MessageHeader) -> Result<usize> {
247+
fn recv(&self, _message_header: &mut MessageHeader, _non_block: bool) -> Result<usize> {
247248
Err(FileSystemError::NotSocket)
248249
}
249250

src/aero_kernel/src/fs/pipe.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use alloc::sync::Arc;
66
use crate::utils::buffer::Buffer;
77
use crate::utils::sync::{BlockQueue, Mutex};
88

9+
use super::file_table::FileHandle;
910
use super::inode::{INodeInterface, PollFlags, PollTable};
1011

1112
pub struct Pipe {
@@ -37,7 +38,7 @@ impl Pipe {
3738
}
3839

3940
impl INodeInterface for Pipe {
40-
fn open(&self, flags: OpenFlags) -> super::Result<()> {
41+
fn open(&self, flags: OpenFlags, _handle: Arc<FileHandle>) -> super::Result<()> {
4142
// Write end of the pipe:
4243
if flags.contains(OpenFlags::O_WRONLY) {
4344
self.num_writers.fetch_add(1, Ordering::SeqCst);

0 commit comments

Comments
 (0)