summaryrefslogtreecommitdiff
path: root/libpsx/include/fcntl.h
blob: d51faa1311a42c0cd6c84f8791e1b6e99ef47551 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
 * fcntl.h
 *
 * File control
 *
 * PSXSDK
 */

#ifndef _FCNTL_H
#define _FCNTL_H

#define O_RDONLY		1
#define O_WRONLY		2
#define O_NONBLOCK	4
/** Read locked, not shared. */
#define O_RDLOCK		16
/** Write locked, not shared. */
#define O_WRLOCK		32
#define O_RDWR		(O_RDONLY | O_WRONLY)
#define O_APPEND		256
#define O_CREAT		512
#define O_TRUNC		1024
/** Obviously, O_EXCL has no effect in the PSXSDK. */
#define O_EXCL		0

/** The following are PlayStation BIOS extensions. */

/** Set to scanning type. Real purpose unknown. */
#define O_SCAN		4096
/** Setup for remote command entry. Real purpose unknown. */
#define O_RCOM		8192
/**  No buffering and console interrupt */
#define O_NOBUF		16384
/** Asynchronous I/O mode */
#define O_NOWAIT		32768
/** Asynchronous I/O mode, alias */
#define O_ASYNC		O_NOWAIT

/**
 * These are standard C library file I/O functions provided by the PSX BIOS.
 * Filenames have to be specified in this way:
 * [device]:[filename]
 *
 * Where device specifies the device the file is on:
 * "tty:"		Console
 * "cdrom:"		CD-ROM
 * "buXX:"		Memory cards
 *
 * When using cdrom: as device, append file version (;1) to filename
 * Example: cdrom:README.TXT;1
 *
 * Subdirectory paths have to be specified with backslashes (\),
 * like MS-DOS. Read and write operations can be carried only in blocks. 
 * Blocks are 2048 bytes for the CD-ROM device, and 128 bytes for memory cards.
 */

// The third argument (file mode) makes no sense in PSXSDK,
// and will be ignored.

#define open(filename, flags, ...) \
	open(filename, flags)

/** In previous versions, the second argument for open()
     was named `mode'. That was incorrect; now it is correctly named `flags'.
*/

int open(const char *filename, int flags);
int read(int d, void *buf, int nbytes);
int close(int d);
int lseek(int fildes, int offset, int whence);

#endif