Skip to content

Commit fa8d296

Browse files
authored
Merge pull request #691 from uyjulian/libcglue_stub_20241204
Implement more functions in libcglue 20241204
2 parents 1712fd9 + f6b4570 commit fa8d296

File tree

5 files changed

+675
-19
lines changed

5 files changed

+675
-19
lines changed

ee/libcglue/Makefile

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,12 @@ PS2SDKAPI_OBJS = \
6262

6363
GLUE_OBJS = \
6464
__dummy_passwd.o \
65+
__dummy_group.o \
6566
__transform_errno.o \
6667
__transform64_errno.o \
6768
compile_time_check.o \
6869
_open.o \
70+
pipe.o \
6971
_close.o \
7072
_read.o \
7173
_write.o \
@@ -78,39 +80,69 @@ GLUE_OBJS = \
7880
_lseek.o \
7981
lseek64.o \
8082
chdir.o \
83+
fchdir.o \
84+
_mkdir.o \
8185
mkdir.o \
8286
rmdir.o \
8387
_link.o \
8488
_unlink.o \
8589
_rename.o \
90+
pause.o \
91+
getitimer.o \
92+
setitimer.o \
93+
sched_yield.o \
8694
_getpid.o \
95+
getppid.o \
8796
_kill.o \
97+
sigprocmask.o \
98+
sigaction.o \
8899
_fork.o \
100+
vfork.o \
89101
_wait.o \
102+
waitpid.o \
90103
_execve.o \
104+
_system.o \
91105
_sbrk.o \
92106
_gettimeofday.o \
93107
_times.o \
94108
ftime.o \
95109
clock_getres.o \
96110
clock_gettime.o \
97111
clock_settime.o \
112+
readv.o \
113+
writev.o \
98114
truncate.o \
115+
ftruncate.o \
116+
_symlink.o \
99117
symlink.o \
118+
_readlink.o \
100119
readlink.o \
101120
utime.o \
121+
utimes.o \
102122
fchown.o \
103123
getrandom.o \
104124
_getentropy.o \
105-
_isatty.o \
125+
umask.o \
106126
chmod.o \
107127
fchmod.o \
128+
_chown.o \
129+
chown.o \
108130
pathconf.o \
131+
fpathconf.o \
109132
fsync.o \
133+
sysconf.o \
134+
tcgetattr.o \
135+
tcsetattr.o \
136+
getlogin.o \
110137
getuid.o \
111138
geteuid.o \
139+
getgid.o \
140+
getegid.o \
112141
getpwuid.o \
113142
getpwnam.o \
143+
issetugid.o \
144+
getgrgid.o \
145+
getgrnam.o \
114146
libcglue_get_fd_info.o \
115147
ps2sdk_get_iop_fd.o \
116148
ps2sdk_get_iop_filename.o \

ee/libcglue/include/sys/termios.h

Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
/*
2+
# _____ ___ ____ ___ ____
3+
# ____| | ____| | | |____|
4+
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5+
#-----------------------------------------------------------------------
6+
# Copyright ps2dev - http://www.ps2dev.org
7+
# Licenced under Academic Free License version 2.0
8+
# Review ps2sdk README & LICENSE files for further details.
9+
*/
10+
11+
/**
12+
* @file
13+
* termios functions.
14+
*/
15+
16+
#ifndef __SYS_TERMIOS_H__
17+
#define __SYS_TERMIOS_H__
18+
19+
#ifdef _EE
20+
// For pid_t
21+
#include <sys/types.h>
22+
#endif
23+
24+
typedef unsigned char cc_t;
25+
typedef unsigned int speed_t;
26+
typedef unsigned int tcflag_t;
27+
28+
#define NCCS 32
29+
30+
struct termios {
31+
tcflag_t c_iflag;
32+
tcflag_t c_oflag;
33+
tcflag_t c_cflag;
34+
tcflag_t c_lflag;
35+
cc_t c_line;
36+
cc_t c_cc[NCCS];
37+
speed_t __c_ispeed;
38+
speed_t __c_ospeed;
39+
};
40+
41+
struct winsize {
42+
unsigned short ws_row, ws_col, ws_xpixel, ws_ypixel;
43+
};
44+
45+
#define VINTR 0
46+
#define VQUIT 1
47+
#define VERASE 2
48+
#define VKILL 3
49+
#define VEOF 4
50+
#define VTIME 5
51+
#define VMIN 6
52+
#define VSWTC 7
53+
#define VSTART 8
54+
#define VSTOP 9
55+
#define VSUSP 10
56+
#define VEOL 11
57+
#define VREPRINT 12
58+
#define VDISCARD 13
59+
#define VWERASE 14
60+
#define VLNEXT 15
61+
#define VEOL2 16
62+
63+
#define IGNBRK 0000001
64+
#define BRKINT 0000002
65+
#define IGNPAR 0000004
66+
#define PARMRK 0000010
67+
#define INPCK 0000020
68+
#define ISTRIP 0000040
69+
#define INLCR 0000100
70+
#define IGNCR 0000200
71+
#define ICRNL 0000400
72+
#define IUCLC 0001000
73+
#define IXON 0002000
74+
#define IXANY 0004000
75+
#define IXOFF 0010000
76+
#define IMAXBEL 0020000
77+
#define IUTF8 0040000
78+
79+
#define OPOST 0000001
80+
#define OLCUC 0000002
81+
#define ONLCR 0000004
82+
#define OCRNL 0000010
83+
#define ONOCR 0000020
84+
#define ONLRET 0000040
85+
#define OFILL 0000100
86+
#define OFDEL 0000200
87+
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_XOPEN_SOURCE)
88+
#define NLDLY 0000400
89+
#define NL0 0000000
90+
#define NL1 0000400
91+
#define CRDLY 0003000
92+
#define CR0 0000000
93+
#define CR1 0001000
94+
#define CR2 0002000
95+
#define CR3 0003000
96+
#define TABDLY 0014000
97+
#define TAB0 0000000
98+
#define TAB1 0004000
99+
#define TAB2 0010000
100+
#define TAB3 0014000
101+
#define BSDLY 0020000
102+
#define BS0 0000000
103+
#define BS1 0020000
104+
#define FFDLY 0100000
105+
#define FF0 0000000
106+
#define FF1 0100000
107+
#endif
108+
109+
#define VTDLY 0040000
110+
#define VT0 0000000
111+
#define VT1 0040000
112+
113+
#define B0 0000000
114+
#define B50 0000001
115+
#define B75 0000002
116+
#define B110 0000003
117+
#define B134 0000004
118+
#define B150 0000005
119+
#define B200 0000006
120+
#define B300 0000007
121+
#define B600 0000010
122+
#define B1200 0000011
123+
#define B1800 0000012
124+
#define B2400 0000013
125+
#define B4800 0000014
126+
#define B9600 0000015
127+
#define B19200 0000016
128+
#define B38400 0000017
129+
130+
#define B57600 0010001
131+
#define B115200 0010002
132+
#define B230400 0010003
133+
#define B460800 0010004
134+
#define B500000 0010005
135+
#define B576000 0010006
136+
#define B921600 0010007
137+
#define B1000000 0010010
138+
#define B1152000 0010011
139+
#define B1500000 0010012
140+
#define B2000000 0010013
141+
#define B2500000 0010014
142+
#define B3000000 0010015
143+
#define B3500000 0010016
144+
#define B4000000 0010017
145+
146+
#define CSIZE 0000060
147+
#define CS5 0000000
148+
#define CS6 0000020
149+
#define CS7 0000040
150+
#define CS8 0000060
151+
#define CSTOPB 0000100
152+
#define CREAD 0000200
153+
#define PARENB 0000400
154+
#define PARODD 0001000
155+
#define HUPCL 0002000
156+
#define CLOCAL 0004000
157+
158+
#define ISIG 0000001
159+
#define ICANON 0000002
160+
#define ECHO 0000010
161+
#define ECHOE 0000020
162+
#define ECHOK 0000040
163+
#define ECHONL 0000100
164+
#define NOFLSH 0000200
165+
#define TOSTOP 0000400
166+
#define IEXTEN 0100000
167+
168+
#define TCOOFF 0
169+
#define TCOON 1
170+
#define TCIOFF 2
171+
#define TCION 3
172+
173+
#define TCIFLUSH 0
174+
#define TCOFLUSH 1
175+
#define TCIOFLUSH 2
176+
177+
#define TCSANOW 0
178+
#define TCSADRAIN 1
179+
#define TCSAFLUSH 2
180+
181+
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
182+
#define EXTA 0000016
183+
#define EXTB 0000017
184+
#define CBAUD 0010017
185+
#define CBAUDEX 0010000
186+
#define CIBAUD 002003600000
187+
#define CMSPAR 010000000000
188+
#define CRTSCTS 020000000000
189+
190+
#define XCASE 0000004
191+
#define ECHOCTL 0001000
192+
#define ECHOPRT 0002000
193+
#define ECHOKE 0004000
194+
#define FLUSHO 0010000
195+
#define PENDIN 0040000
196+
#define EXTPROC 0200000
197+
198+
#define XTABS 0014000
199+
#endif
200+
201+
__BEGIN_DECLS
202+
203+
extern speed_t cfgetospeed (const struct termios *termios_p);
204+
extern speed_t cfgetispeed (const struct termios *termios_p);
205+
extern int cfsetospeed (struct termios *termios_p, speed_t speed);
206+
extern int cfsetispeed (struct termios *termios_p, speed_t speed);
207+
208+
extern int tcgetattr (int fildes, struct termios *termios_p);
209+
extern int tcsetattr (int fildes, int optional_actions, const struct termios *termios_p);
210+
211+
extern int tcgetwinsize (int fildes, struct winsize *gws);
212+
extern int tcsetwinsize (int fildes, const struct winsize *gws);
213+
214+
extern int tcsendbreak (int fildes, int len);
215+
extern int tcdrain (int fildes);
216+
extern int tcflush (int fildes, int action);
217+
extern int tcflow (int fildes, int action);
218+
219+
#ifdef _EE
220+
extern pid_t tcgetsid (int fildes);
221+
#endif
222+
223+
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
224+
extern void cfmakeraw(struct termios *termios_p);
225+
extern int cfsetspeed(struct termios *termios_p, speed_t speed);
226+
#endif
227+
228+
__END_DECLS
229+
230+
#endif

ee/libcglue/include/sys/uio.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
# _____ ___ ____ ___ ____
3+
# ____| | ____| | | |____|
4+
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5+
#-----------------------------------------------------------------------
6+
# Copyright ps2dev - http://www.ps2dev.org
7+
# Licenced under Academic Free License version 2.0
8+
# Review ps2sdk README & LICENSE files for further details.
9+
*/
10+
11+
#ifndef _SYS_UIO_H
12+
#define _SYS_UIO_H
13+
14+
// libsmb2 defines its own
15+
#if !defined(NEED_READV) && !defined(NEED_WRITEV)
16+
#include <sys/types.h>
17+
18+
__BEGIN_DECLS
19+
20+
/*
21+
* Per POSIX
22+
*/
23+
24+
struct iovec {
25+
void *iov_base;
26+
size_t iov_len;
27+
};
28+
29+
extern ssize_t readv(int fd, const struct iovec *iov, int iovcnt);
30+
extern ssize_t writev(int fd, const struct iovec *iov, int iovcnt);
31+
32+
__END_DECLS
33+
#endif
34+
35+
#endif

ee/libcglue/include/sys/utime.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
# _____ ___ ____ ___ ____
3+
# ____| | ____| | | |____|
4+
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5+
#-----------------------------------------------------------------------
6+
# Copyright ps2dev - http://www.ps2dev.org
7+
# Licenced under Academic Free License version 2.0
8+
# Review ps2sdk README & LICENSE files for further details.
9+
*/
10+
11+
#ifndef _SYS_UTIME_H
12+
#define _SYS_UTIME_H
13+
14+
#include <time.h>
15+
16+
__BEGIN_DECLS
17+
18+
/*
19+
* POSIX 1003.1b 5.6.6 Set File Access and Modification Times
20+
*/
21+
22+
struct utimbuf
23+
{
24+
time_t actime; /* Access time */
25+
time_t modtime; /* Modification time */
26+
};
27+
28+
extern int utime(const char *pathname, const struct utimbuf *times);
29+
30+
__END_DECLS
31+
32+
#endif /* _SYS_UTIME_H */

0 commit comments

Comments
 (0)