summaryrefslogtreecommitdiff
path: root/libpsx/include/fcntl.h
diff options
context:
space:
mode:
authorXavi Del Campo <xavi.dcr@tutanota.com>2020-01-31 10:32:23 +0100
committerXavi Del Campo <xavi.dcr@tutanota.com>2020-01-31 10:32:23 +0100
commit7c24e9a9b02b04dcaf9507acb94091ea70a2c02d (patch)
treec28d0748652ad4b4222309e46e6cfc82c0906220 /libpsx/include/fcntl.h
parenta2b7b6bb1cc2f4a3258b7b2dbc92399d151f864d (diff)
downloadpsxsdk-7c24e9a9b02b04dcaf9507acb94091ea70a2c02d.tar.gz
Imported pristine psxsdk-20190410 from official repo
Diffstat (limited to 'libpsx/include/fcntl.h')
-rw-r--r--libpsx/include/fcntl.h72
1 files changed, 72 insertions, 0 deletions
diff --git a/libpsx/include/fcntl.h b/libpsx/include/fcntl.h
new file mode 100644
index 0000000..d51faa1
--- /dev/null
+++ b/libpsx/include/fcntl.h
@@ -0,0 +1,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