KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
dcload.h
Go to the documentation of this file.
1/* KallistiOS ##version##
2
3 dc/dcload.h
4 Copyright (C) 2025 Donald Haase
5*/
6
7/** \file dc/dcload.h
8 \brief Functions to access the system calls provided by dcload.
9 \ingroup dcload_syscalls
10
11 \author Donald Haase
12*/
13
14/** \defgroup dcload_syscalls dcload system calls
15 \brief API for dcload's system calls
16 \ingroup system_calls
17
18 This module encapsulates all the commands provided by dcload
19 via its syscall function.
20
21 @{
22*/
23
24#ifndef __DC_DCLOAD_H
25#define __DC_DCLOAD_H
26
27#include <sys/cdefs.h>
28__BEGIN_DECLS
29
30#include <fcntl.h>
31#include <stdint.h>
32#include <time.h>
33#include <unistd.h>
34#include <utime.h>
35#include <dirent.h>
36#include <sys/types.h>
37
62
63typedef int (*dcload_syscall_t)(dcload_cmd_t cmd, void *param1, void *param2, void *param3);
65
66/* Network (dcload-ip over KOS sockets) syscall backend. */
69
70ssize_t dcload_read(uint32_t hnd, uint8_t *data, size_t len);
71ssize_t dcload_write(uint32_t hnd, const uint8_t *data, size_t len);
72int dcload_open(const char *fn, int oflags, int mode);
73int dcload_close(uint32_t hnd);
74int dcload_creat(const char *path, mode_t mode);
75int dcload_link(const char *fn1, const char *fn2);
76int dcload_unlink(const char *fn);
77int dcload_chdir(const char *path);
78int dcload_chmod(const char *path, mode_t mode);
79off_t dcload_lseek(uint32_t hnd, off_t offset, int whence);
80
81/* dcload stat */
82typedef struct dcload_stat {
83 unsigned short st_dev;
84 unsigned short st_ino;
86 unsigned short st_nlink;
87 unsigned short st_uid;
88 unsigned short st_gid;
89 unsigned short st_rdev;
90 long st_size;
91 long atime;
93 long mtime;
95 long ctime;
99 long st_spare4[2];
101
102int dcload_fstat(int fildes, dcload_stat_t *buf);
103time_t dcload_time(void);
104int dcload_stat(const char *restrict path, dcload_stat_t *restrict buf);
105/* int dcload_utime(const char *path, const struct utimbuf *times); */
107void dcload_exit(void);
108int dcload_opendir(const char *fn);
109int dcload_closedir(uint32_t hnd);
110struct dirent *dcload_readdir(uint32_t hnd);
111uint32_t dcload_gethostinfo(uint32_t *ip, uint32_t *port);
112size_t dcload_gdbpacket(const char* in_buf, size_t in_size, char* out_buf, size_t out_size);
113int dcload_rewinddir(uint32_t hnd);
114
115/** @} */
116
117__END_DECLS
118
119#endif /* __DC_DCLOAD_H */
int mode
Definition 2ndmix.c:539
void hnd(const char *file, int line, const char *expr, const char *msg, const char *func)
Definition asserthnd.c:52
static struct @89 data[BARRIER_COUNT]
Directory entry functionality.
int dcload_close(uint32_t hnd)
ssize_t dcload_write(uint32_t hnd, const uint8_t *data, size_t len)
time_t dcload_time(void)
void dcload_exit(void)
int(* dcload_syscall_t)(dcload_cmd_t cmd, void *param1, void *param2, void *param3)
Definition dcload.h:63
int dcload_creat(const char *path, mode_t mode)
int dcload_chmod(const char *path, mode_t mode)
int dcload_fstat(int fildes, dcload_stat_t *buf)
uint32_t dcload_gethostinfo(uint32_t *ip, uint32_t *port)
int dcload_chdir(const char *path)
void dcload_syscall_set(dcload_syscall_t fn)
int dcload_stat(const char *restrict path, dcload_stat_t *restrict buf)
int dcload_syscall_net_init(void)
int dcload_closedir(uint32_t hnd)
dcload_cmd_t
Definition dcload.h:38
ssize_t dcload_read(uint32_t hnd, uint8_t *data, size_t len)
int dcload_opendir(const char *fn)
int dcload_link(const char *fn1, const char *fn2)
struct dirent * dcload_readdir(uint32_t hnd)
int dcload_open(const char *fn, int oflags, int mode)
off_t dcload_lseek(uint32_t hnd, off_t offset, int whence)
size_t dcload_gdbpacket(const char *in_buf, size_t in_size, char *out_buf, size_t out_size)
void dcload_syscall_net_shutdown(void)
int dcload_unlink(const char *fn)
int dcload_assignwrkmem(int *buf)
int dcload_rewinddir(uint32_t hnd)
@ DCLOAD_CREAT
Definition dcload.h:43
@ DCLOAD_EXIT
Definition dcload.h:54
@ DCLOAD_WRITE
Definition dcload.h:40
@ DCLOAD_READDIR
Definition dcload.h:57
@ DCLOAD_READ
Definition dcload.h:39
@ DCLOAD_FSTAT
Definition dcload.h:49
@ DCLOAD_LINK
Definition dcload.h:44
@ DCLOAD_CLOSEDIR
Definition dcload.h:56
@ DCLOAD_OPEN
Definition dcload.h:41
@ DCLOAD_ASSIGNWRKMEM
Definition dcload.h:53
@ DCLOAD_GETHOSTINFO
Definition dcload.h:58
@ DCLOAD_TIME
Definition dcload.h:50
@ DCLOAD_CHMOD
Definition dcload.h:47
@ DCLOAD_CLOSE
Definition dcload.h:42
@ DCLOAD_UNLINK
Definition dcload.h:45
@ DCLOAD_LSEEK
Definition dcload.h:48
@ DCLOAD_OPENDIR
Definition dcload.h:55
@ DCLOAD_UTIME
Definition dcload.h:52
@ DCLOAD_REWINDDIR
Definition dcload.h:60
@ DCLOAD_GDBPACKET
Definition dcload.h:59
@ DCLOAD_CHDIR
Definition dcload.h:46
@ DCLOAD_STAT
Definition dcload.h:51
Definition dcload.h:82
long st_blksize
Definition dcload.h:97
long st_blocks
Definition dcload.h:98
long st_spare1
Definition dcload.h:92
unsigned short st_uid
Definition dcload.h:87
long ctime
Definition dcload.h:95
unsigned short st_rdev
Definition dcload.h:89
long st_spare3
Definition dcload.h:96
unsigned short st_gid
Definition dcload.h:88
long st_size
Definition dcload.h:90
unsigned short st_dev
Definition dcload.h:83
unsigned short st_ino
Definition dcload.h:84
int st_mode
Definition dcload.h:85
unsigned short st_nlink
Definition dcload.h:86
long mtime
Definition dcload.h:93
long st_spare2
Definition dcload.h:94
long atime
Definition dcload.h:91
POSIX directory entry structure.
Definition dirent.h:62
KOS-implementation of select C11 and POSIX extensions.
KOS extension of Newlib's utime.h.