Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c791b08
sysdeps/badgeros: initial sysdeps
robotman2412 Dec 16, 2025
edcd14a
sysdeps/badgeros: add misc sysdeps
robotman2412 Dec 17, 2025
09ddedf
sysdeps/badgeros: fix startfiles
robotman2412 Dec 17, 2025
7db2256
sysdeps/badgeros: More BadgerOS ABI bits
robotman2412 Feb 2, 2026
84c58dd
sysdeps/badgeros: refactor
robotman2412 Feb 2, 2026
323afde
syscaps/badgeros: Implement more sysdeps
robotman2412 Feb 6, 2026
42de29c
sysdeps/badgeros: add __syscall_temp_write
robotman2412 Feb 10, 2026
92c6168
sysdeps/badgeros: Fix syscall definitions, fix sys_libc_log
robotman2412 Mar 13, 2026
9b54279
sysdeps/badgeros: Implement sys_read_entries
robotman2412 Mar 14, 2026
2cf49fb
sysdeps/badgeros: Sysdeps stat, read_entries and gettime
robotman2412 Mar 14, 2026
4d07199
sysdeps/badgeros: Change PID type, add sysmacros.h
robotman2412 Mar 14, 2026
cb57866
sysdeps/badgeros: Add stubs for get*id, add sigaction
robotman2412 Mar 15, 2026
3e60518
sysdeps/badgeros: Implement sysdeps get*id, sigaction and kill
robotman2412 Mar 16, 2026
4585026
sysdeps/badgeros: Change pid_t to i64
robotman2412 Mar 16, 2026
2614332
sysdeps/badgeros: Rename getid.h
robotman2412 Mar 17, 2026
f87ec20
sysdeps/badgeros: add sys_waitpid
robotman2412 Mar 17, 2026
1e5bb08
sysdeps/badgeros: Add file creation sysdeps
robotman2412 Mar 17, 2026
dc3b2c6
sysdeps/badgeros: add unlinkat, rmdir, dup and dup2
robotman2412 Mar 17, 2026
bd8635e
sysdeps/badgeros: signal masks and uname
robotman2412 Mar 18, 2026
b4ca9e9
sysdeps/badgeros: isatty, tcgetattr, tcsetattr
robotman2412 Mar 18, 2026
e783de4
sysdeps/badgeros: f?chdir and getcwd
robotman2412 Mar 18, 2026
18f0abf
sysdeps/badgeros: fcntl
robotman2412 Mar 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions abis/badgeros/blkcnt_t.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef _ABIBITS_BLKCNT_T_H
#define _ABIBITS_BLKCNT_T_H

#include <bits/types.h>

typedef __mlibc_int64 blkcnt_t;

#endif /* _ABIBITS_BLKCNT_T_H */
8 changes: 8 additions & 0 deletions abis/badgeros/blksize_t.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef _ABIBITS_BLKSIZE_T_H
#define _ABIBITS_BLKSIZE_T_H

#include <bits/types.h>

typedef __mlibc_int64 blksize_t;

#endif /* _ABIBITS_BLKCNT_T_H */
8 changes: 8 additions & 0 deletions abis/badgeros/clockid_t.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef _ABIBITS_CLOCKID_T_H
#define _ABIBITS_CLOCKID_T_H

#include <bits/types.h>

typedef __mlibc_int64 clockid_t;

#endif /* _ABIBITS_BLKCNT_T_H */
10 changes: 10 additions & 0 deletions abis/badgeros/dev_t.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

#ifndef _ABIBITS_DEV_T_H
#define _ABIBITS_DEV_T_H

#include <bits/types.h>

typedef __mlibc_uint64 dev_t;

#endif /* _ABIBITS_DEV_T_H */

156 changes: 156 additions & 0 deletions abis/badgeros/fcntl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
#ifndef _ABIBITS_FCNTL_H
#define _ABIBITS_FCNTL_H

#include <mlibc-config.h>
#include <abi-bits/pid_t.h>

// #define O_PATH

#define O_ACCMODE 0x03
// Note: If neither O_RDONLY nor O_WRONLY are specified, the kernel assumes read access was requested.
#define O_RDONLY 0x00000001
#define O_WRONLY 0x00000002
#define O_RDWR 0x00000003

#define O_CREAT 0x00000040
#define O_EXCL 0x00000080
#define O_NOCTTY 0x01000000
#define O_TRUNC 0x00000100
#define O_APPEND 0x00000004
#define O_NONBLOCK 0x00000200
#define O_CLOEXEC 0x00010000
// For __syscall_fs_dup: Use fncntl(F_DUPFD)-style FD selection; choose the next available instead of overwriting.
#define DUP2_FCNTL 0x00000800
// #define O_NOATIME

// #define O_DIRECT
#define O_DIRECTORY 0x00000010
#define O_NOFOLLOW 0x00000020

#define O_TMPFILE 0x00000400

// #define O_EXEC O_PATH
// #define O_SEARCH O_PATH
#define O_TTY_INIT 0

#define F_DUPFD 0
#define F_GETFD 1
#define F_SETFD 2
#define F_GETFL 3
#define F_SETFL 4

#define F_SETOWN 8
#define F_GETOWN 9
#define F_SETSIG 10
#define F_GETSIG 11

#if __INTPTR_WIDTH__ == 64

#define F_GETLK64 5
#define F_SETLK64 6
#define F_SETLKW64 7

#else /* __INTPTR_WIDTH__ == 64 */

#define F_GETLK64 12
#define F_SETLK64 13
#define F_SETLKW64 14

#endif

#define F_GETLK F_GETLK64
#define F_SETLK F_SETLK64
#define F_SETLKW F_SETLKW64

#define F_SETOWN_EX 15
#define F_GETOWN_EX 16

#define F_GETOWNER_UIDS 17

#define F_SETLEASE 1024
#define F_GETLEASE 1025
#define F_NOTIFY 1026
#define F_DUPFD_CLOEXEC 1030
#define F_SETPIPE_SZ 1031
#define F_GETPIPE_SZ 1032
#define F_ADD_SEALS 1033
#define F_GET_SEALS 1034

#define F_SEAL_SEAL 0x0001
#define F_SEAL_SHRINK 0x0002
#define F_SEAL_GROW 0x0004
#define F_SEAL_WRITE 0x0008

#define F_OFD_GETLK 36
#define F_OFD_SETLK 37
#define F_OFD_SETLKW 38

#define F_RDLCK 0
#define F_WRLCK 1
#define F_UNLCK 2

#define FD_CLOEXEC 0x00010000

#define AT_FDCWD -100
#define AT_SYMLINK_NOFOLLOW 0x100
#define AT_REMOVEDIR 0x200
#define AT_SYMLINK_FOLLOW 0x400
#define AT_EACCESS 0x200

#if defined(_GNU_SOURCE)
#define AT_NO_AUTOMOUNT 0x800
#define AT_EMPTY_PATH 0x1000
#endif

#if __MLIBC_LINUX_OPTION && defined(_GNU_SOURCE)

#define DN_ACCESS 1
#define DN_MODIFY 2
#define DN_CREATE 4
#define DN_DELETE 8
#define DN_RENAME 16
#define DN_ATTRIB 32
#define DN_MULTISHOT 0x80000000

#define AT_STATX_SYNC_AS_STAT 0x0000
#define AT_STATX_FORCE_SYNC 0x2000
#define AT_STATX_DONT_SYNC 0x4000
#define AT_STATX_SYNC_TYPE 0x6000

#endif /* __MLIBC_LINUX_OPTION && defined(_GNU_SOURCE) */

#if defined(_GNU_SOURCE) || __MLIBC_POSIX2024
struct f_owner_ex {
int type;
pid_t pid;
};
#endif /* defined(_GNU_SOURCE) || __MLIBC_POSIX2024 */

#define F_OWNER_TID 0
#define F_OWNER_PID 1
#define F_OWNER_PGRP 2

#define POSIX_FADV_NORMAL 0
#define POSIX_FADV_RANDOM 1
#define POSIX_FADV_SEQUENTIAL 2
#define POSIX_FADV_WILLNEED 3
#define POSIX_FADV_DONTNEED 4
#define POSIX_FADV_NOREUSE 5

#define S_IRWXU 0700
#define S_IRUSR 0400
#define S_IWUSR 0200
#define S_IXUSR 0100
#define S_IRWXG 070
#define S_IRGRP 040
#define S_IWGRP 020
#define S_IXGRP 010
#define S_IRWXO 07
#define S_IROTH 04
#define S_IWOTH 02
#define S_IXOTH 01
#define S_ISUID 04000
#define S_ISGID 02000
#define S_ISVTX 01000

#endif /* _ABIBITS_FCNTL_H */
12 changes: 12 additions & 0 deletions abis/badgeros/fd_set.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef _ABIBITS_FD_SET_H
#define _ABIBITS_FD_SET_H

#include <bits/types.h>

#define FD_SETSIZE 256

typedef struct {
__mlibc_uint8 fds_bits[FD_SETSIZE / 8];
} fd_set;

#endif /* _ABIBITS_FD_SET_H */
8 changes: 8 additions & 0 deletions abis/badgeros/fsblkcnt_t.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef _ABIBITS_FSBLKCNT_T_H
#define _ABIBITS_FSBLKCNT_T_H

#include <bits/types.h>

typedef __mlibc_uint64 fsblkcnt_t;

#endif /* _ABIBITS_FSBLKCNT_T_H */
8 changes: 8 additions & 0 deletions abis/badgeros/fsfilcnt_t.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef _ABIBITS_FSFILCNT_T_H
#define _ABIBITS_FSFILCNT_T_H

#include <bits/types.h>

typedef __mlibc_uint64 fsfilcnt_t;

#endif /* _ABIBITS_FSFILCNT_T_H */
21 changes: 21 additions & 0 deletions abis/badgeros/getid.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef _ABIBITS_BADGEROS_GETID_T_H
#define _ABIBITS_BADGEROS_GETID_T_H

#include <bits/types.h>

/* ID of calling process. */
#define _GETID_PID 0
/* ID of calling process' parent. */
#define _GETID_PPID 1
/* ID of calling thread. */
#define _GETID_TID 2
/* User ID of calling process. */
#define _GETID_UID 3
/* Effective user ID of calling process. */
#define _GETID_EUID 4
/* Group ID of calling process. */
#define _GETID_GID 5
/* Effective group ID of calling process. */
#define _GETID_EGID 6

#endif /* _ABIBITS_BADGEROS_GETID_T_H */
9 changes: 9 additions & 0 deletions abis/badgeros/nlink_t.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

#ifndef _ABIBITS_NLINK_T_H
#define _ABIBITS_NLINK_T_H

#include <sys/types.h>

typedef __mlibc_uint64 nlink_t;

#endif /* _ABIBITS_NLINK_T_H */
8 changes: 8 additions & 0 deletions abis/badgeros/pid_t.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef _ABIBITS_PID_T
#define _ABIBITS_PID_T

#include <bits/types.h>

typedef __mlibc_int64 pid_t;

#endif
8 changes: 8 additions & 0 deletions abis/badgeros/sigset_t.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef _ABIBITS_SIGSET_T_H
#define _ABIBITS_SIGSET_T_H

typedef struct {
unsigned long __sig[1024 / (8 * sizeof(long))];
} sigset_t;

#endif /* _ABIBITS_SIGSET_T_H */
73 changes: 73 additions & 0 deletions abis/badgeros/stat.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#ifndef _ABIBITS_STAT_H
#define _ABIBITS_STAT_H

#include <abi-bits/blkcnt_t.h>
#include <abi-bits/blksize_t.h>
#include <abi-bits/dev_t.h>
#include <abi-bits/gid_t.h>
#include <abi-bits/ino_t.h>
#include <abi-bits/mode_t.h>
#include <abi-bits/nlink_t.h>
#include <abi-bits/uid_t.h>
#include <bits/ansi/time_t.h>
#include <bits/ansi/timespec.h>
#include <bits/off_t.h>

#define S_IFMT 0x0F000
#define S_IFBLK 0x06000
#define S_IFCHR 0x02000
#define S_IFIFO 0x01000
#define S_IFREG 0x08000
#define S_IFDIR 0x04000
#define S_IFLNK 0x0A000
#define S_IFSOCK 0x0C000

#define S_IRWXU 0700
#define S_IRUSR 0400
#define S_IWUSR 0200
#define S_IXUSR 0100
#define S_IRWXG 070
#define S_IRGRP 040
#define S_IWGRP 020
#define S_IXGRP 010
#define S_IRWXO 07
#define S_IROTH 04
#define S_IWOTH 02
#define S_IXOTH 01
#define S_ISUID 04000
#define S_ISGID 02000
#define S_ISVTX 01000

#define S_IREAD S_IRUSR
#define S_IWRITE S_IWUSR
#define S_IEXEC S_IXUSR

#ifdef __cplusplus
extern "C" {
#endif

struct stat {
dev_t st_dev;
ino_t st_ino;
mode_t st_mode;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
dev_t st_rdev;
off_t st_size;
blksize_t st_blksize;
blkcnt_t st_blocks;
struct timespec st_atim;
struct timespec st_mtim;
struct timespec st_ctim;
};

#if defined(_DEFAULT_SOURCE) || defined(_LARGEFILE64_SOURCE)
#define stat64 stat
#endif

#ifdef __cplusplus
}
#endif

#endif /* _ABIBITS_STAT_H */
Loading