Skip to content

Commit dbf0e09

Browse files
sys_read_link: stub
Signed-off-by: Andy-Python-Programmer <[email protected]>
1 parent 5f9c6bb commit dbf0e09

File tree

5 files changed

+99
-67
lines changed

5 files changed

+99
-67
lines changed

bootstrap.yml

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,17 @@ sources:
9797
# Rust patched crates end
9898
# ---------------------------------------------------------------------------
9999

100-
# - name: python
101-
# subdir: 'bundled'
102-
# patch-path-strip: 1
103-
# git: 'https://github.com/python/cpython.git'
104-
# tag: 'v3.8.2'
105-
# version: '3.8.2'
106-
# tools_required:
107-
# - host-autoconf-v2.69
108-
# - host-automake-v1.16
109-
# regenerate:
110-
# - args: ['autoreconf', '-f', '-i']
100+
- name: python
101+
subdir: 'bundled'
102+
patch-path-strip: 1
103+
git: 'https://github.com/python/cpython.git'
104+
tag: 'v3.8.2'
105+
version: '3.8.2'
106+
tools_required:
107+
- host-autoconf-v2.69
108+
- host-automake-v1.16
109+
regenerate:
110+
- args: ['autoreconf', '-f', '-i']
111111

112112
tools:
113113
- name: host-autoconf-v2.69
@@ -211,16 +211,16 @@ tools:
211211
- '--root'
212212
- '@PREFIX@'
213213

214-
# - name: host-python
215-
# from_source: python
216-
# configure:
217-
# - args:
218-
# - '@THIS_SOURCE_DIR@/configure'
219-
# - '--prefix=@PREFIX@'
220-
# compile:
221-
# - args: ['make', '-j@PARALLELISM@']
222-
# install:
223-
# - args: ['make', 'install']
214+
- name: host-python
215+
from_source: python
216+
configure:
217+
- args:
218+
- '@THIS_SOURCE_DIR@/configure'
219+
- '--prefix=@PREFIX@'
220+
compile:
221+
- args: ['make', '-j@PARALLELISM@']
222+
install:
223+
- args: ['make', 'install']
224224

225225
- name: host-binutils
226226
from_source: binutils
@@ -618,34 +618,34 @@ packages:
618618
environ:
619619
DESTDIR: '@THIS_COLLECT_DIR@'
620620

621-
# - name: python
622-
# from_source: python
623-
# tools_required:
624-
# - host-gcc
625-
# - host-python
626-
# pkgs_required:
627-
# - mlibc
628-
# configure:
629-
# - args:
630-
# - '@THIS_SOURCE_DIR@/configure'
631-
# - '--host=x86_64-aero'
632-
# - '--build=x86_64-linux-gnu'
633-
# - '--prefix=/usr'
634-
# - '--enable-shared'
635-
# - '--with-sysroot=@SYSROOT_DIR@' # Set libtool's lt_sysroot.
636-
# - '--with-system-ffi'
637-
# - '--with-system-expat'
638-
# - '--disable-ipv6'
639-
# - '--without-ensurepip'
640-
# environ:
641-
# CONFIG_SITE: '@SOURCE_ROOT@/extra-files/python/python-config-site'
642-
# PKG_CONFIG_SYSROOT_DIR: '@BUILD_ROOT@/system-root'
643-
# PKG_CONFIG_LIBDIR: '@BUILD_ROOT@/system-root/usr/lib/pkgconfig:@BUILD_ROOT@/system-root/usr/share/pkgconfig'
644-
# build:
645-
# - args: ['make', '-j@PARALLELISM@']
646-
# - args: ['make', 'install']
647-
# environ:
648-
# DESTDIR: '@THIS_COLLECT_DIR@'
621+
- name: python
622+
from_source: python
623+
tools_required:
624+
- host-gcc
625+
- host-python
626+
pkgs_required:
627+
- mlibc
628+
configure:
629+
- args:
630+
- '@THIS_SOURCE_DIR@/configure'
631+
- '--host=x86_64-aero'
632+
- '--build=x86_64-linux-gnu'
633+
- '--prefix=/usr'
634+
- '--enable-shared'
635+
- '--with-sysroot=@SYSROOT_DIR@' # Set libtool's lt_sysroot.
636+
- '--with-system-ffi'
637+
- '--with-system-expat'
638+
- '--disable-ipv6'
639+
- '--without-ensurepip'
640+
environ:
641+
CONFIG_SITE: '@SOURCE_ROOT@/extra-files/python/python-config-site'
642+
PKG_CONFIG_SYSROOT_DIR: '@BUILD_ROOT@/system-root'
643+
PKG_CONFIG_LIBDIR: '@BUILD_ROOT@/system-root/usr/lib/pkgconfig:@BUILD_ROOT@/system-root/usr/share/pkgconfig'
644+
build:
645+
- args: ['make', '-j@PARALLELISM@']
646+
- args: ['make', 'install']
647+
environ:
648+
DESTDIR: '@THIS_COLLECT_DIR@'
649649

650650
- name: doomgeneric
651651
source:

patches/mlibc/mlibc.patch

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,29 @@
1-
From 4642a80de4f0c967d553e020347cf042d367c381 Mon Sep 17 00:00:00 2001
1+
From 9c5cf9aa5c8997984bdfb1f5973b5061755d5454 Mon Sep 17 00:00:00 2001
22
From: Andy-Python-Programmer <[email protected]>
33
Date: Thu, 10 Feb 2022 19:12:25 +1100
44
Subject: [PATCH] yes
55

66
Signed-off-by: Andy-Python-Programmer <[email protected]>
77
---
8-
.gitignore | 7 ++++++
9-
sysdeps/aero/generic/filesystem.cpp | 34 +++++++++++++++++++++++------
10-
sysdeps/aero/generic/signals.cpp | 8 +++++--
11-
sysdeps/aero/include/aero/syscall.h | 6 +++++
12-
4 files changed, 46 insertions(+), 9 deletions(-)
8+
.gitignore | 3 ++
9+
sysdeps/aero/generic/filesystem.cpp | 46 ++++++++++++++++++++++++-----
10+
sysdeps/aero/generic/signals.cpp | 8 +++--
11+
sysdeps/aero/include/aero/syscall.h | 7 +++++
12+
4 files changed, 54 insertions(+), 10 deletions(-)
1313

1414
diff --git a/.gitignore b/.gitignore
15-
index dbb35e8b..384b3395 100644
15+
index dbb35e8b..20c8d4c3 100644
1616
--- a/.gitignore
1717
+++ b/.gitignore
18-
@@ -8,3 +8,10 @@ subprojects/cxxshim
18+
@@ -8,3 +8,6 @@ subprojects/cxxshim
1919
subprojects/frigg
2020
.vscode
2121
.clang-format
2222
+
23-
+# clangd files
24-
+#
25-
+# * The compile commands json is usually generated by the build system
26-
+# if not, it can be constructed manually and should be in the root of
27-
+# of the project directory.
28-
+compile_commands.json
23+
+# clangd cache
24+
+.cache
2925
diff --git a/sysdeps/aero/generic/filesystem.cpp b/sysdeps/aero/generic/filesystem.cpp
30-
index 6a13f19c..69833ae5 100644
26+
index 6a13f19c..53223dc6 100644
3127
--- a/sysdeps/aero/generic/filesystem.cpp
3228
+++ b/sysdeps/aero/generic/filesystem.cpp
3329
@@ -1,3 +1,4 @@
@@ -82,7 +78,26 @@ index 6a13f19c..69833ae5 100644
8278
};
8379

8480
// The reclen is the size of the dirent struct, plus the size of the name.
85-
@@ -252,7 +273,6 @@ int sys_pselect(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
81+
@@ -214,7 +235,17 @@ int sys_open_dir(const char *path, int *handle) {
82+
}
83+
84+
int sys_rename(const char *path, const char *new_path) UNIMPLEMENTED("sys_rename")
85+
-int sys_readlink(const char *path, void *buffer, size_t max_size, ssize_t *length) UNIMPLEMENTED("sys_readlink")
86+
+
87+
+int sys_readlink(const char *path, void *buffer, size_t max_size, ssize_t *length) {
88+
+ auto result = syscall(SYS_READ_LINK, path, strlen(path), buffer, max_size);
89+
+
90+
+ if (result < 0) {
91+
+ return -result;
92+
+ }
93+
+
94+
+ *length = result;
95+
+ return 0;
96+
+}
97+
98+
int sys_dup(int fd, int flags, int *newfd) {
99+
auto result = syscall(SYS_DUP, fd, flags);
100+
@@ -252,7 +283,6 @@ int sys_pselect(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
86101
const struct timespec *timeout, const sigset_t *sigmask,
87102
int *num_events) {
88103
mlibc::infoLogger() << "sys_pselect() is not implemented" << frg::endlog;
@@ -111,10 +126,10 @@ index 3527370c..a6f69fff 100644
111126
} // namespace mlibc
112127
\ No newline at end of file
113128
diff --git a/sysdeps/aero/include/aero/syscall.h b/sysdeps/aero/include/aero/syscall.h
114-
index 07b1b51b..f6d7836d 100644
129+
index 07b1b51b..bd4d348d 100644
115130
--- a/sysdeps/aero/include/aero/syscall.h
116131
+++ b/sysdeps/aero/include/aero/syscall.h
117-
@@ -49,6 +49,12 @@
132+
@@ -49,6 +49,13 @@
118133
#define SYS_DUP 42
119134
#define SYS_FCNTL 43
120135
#define SYS_DUP2 44
@@ -124,6 +139,7 @@ index 07b1b51b..f6d7836d 100644
124139
+#define SYS_BECOME_ROOT 48
125140
+#define SYS_STAT 49
126141
+#define SYS_FSTAT 50
142+
+#define SYS_READ_LINK 51
127143

128144
// Invalid syscall used to trigger a log error in the kernel (as a hint)
129145
// so, that we can implement the syscall in the kernel.

src/aero_kernel/src/syscall/fs.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,3 +398,16 @@ pub fn stat(path: usize, path_size: usize, stat_struct: usize) -> Result<usize,
398398

399399
Ok(0)
400400
}
401+
402+
pub fn read_link(
403+
path: usize,
404+
path_size: usize,
405+
_buffer: usize,
406+
_buffer_size: usize,
407+
) -> Result<usize, AeroSyscallError> {
408+
let path = validate_str(path as *mut u8, path_size).ok_or(AeroSyscallError::EINVAL)?;
409+
let path = Path::new(path);
410+
411+
log::warn!("read_link: is a stub! (path={path:?})");
412+
Err(AeroSyscallError::EINVAL)
413+
}

src/aero_kernel/src/syscall/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
//! | 48 | ipc_become_root |
7373
//! | 49 | stat |
7474
//! | 50 | fstat |
75+
//! | 51 | read_link |
7576
7677
use core::mem::MaybeUninit;
7778

@@ -201,6 +202,7 @@ pub fn generic_do_syscall(
201202
SYS_FCNTL => fs::fcntl(b, c, d),
202203
SYS_STAT => fs::stat(b, c, d),
203204
SYS_FSTAT => fs::fstat(b, c),
205+
SYS_READ_LINK => fs::read_link(b, c, d, e),
204206

205207
SYS_SOCKET => net::socket(b, c, d),
206208
SYS_BIND => net::bind(b, c, d),

src/aero_syscall/src/consts.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ pub const SYS_IPC_DISCOVER_ROOT: usize = 47;
6969
pub const SYS_IPC_BECOME_ROOT: usize = 48;
7070
pub const SYS_STAT: usize = 49;
7171
pub const SYS_FSTAT: usize = 50;
72+
pub const SYS_READ_LINK: usize = 51;
7273

7374
// fcntl constants:
7475
pub const F_GETFD: usize = 3;

0 commit comments

Comments
 (0)