llvm-mos-sdk
unistd.h
Go to the documentation of this file.
1 // Copyright 2024 LLVM-MOS Project
2 // Licensed under the Apache License, Version 2.0 with LLVM Exceptions.
3 // See https://github.com/llvm-mos/llvm-mos-sdk/blob/main/LICENSE for license
4 // information.
5 
6 // Originally from cc65. Modified from original version.
7 
8 /*****************************************************************************/
9 /* */
10 /* unistd.h */
11 /* */
12 /* Unix compatibility header file for cc65 */
13 /* */
14 /* */
15 /* */
16 /* (C) 2003-2011, Ullrich von Bassewitz */
17 /* Roemerstrasse 52 */
18 /* D-70794 Filderstadt */
19 /* EMail: uz@cc65.org */
20 /* */
21 /* */
22 /* This software is provided 'as-is', without any expressed or implied */
23 /* warranty. In no event will the authors be held liable for any damages */
24 /* arising from the use of this software. */
25 /* */
26 /* Permission is granted to anyone to use this software for any purpose, */
27 /* including commercial applications, and to alter it and redistribute it */
28 /* freely, subject to the following restrictions: */
29 /* */
30 /* 1. The origin of this software must not be misrepresented; you must not */
31 /* claim that you wrote the original software. If you use this software */
32 /* in a product, an acknowledgment in the product documentation would be */
33 /* appreciated but is not required. */
34 /* 2. Altered source versions must be plainly marked as such, and must not */
35 /* be misrepresented as being the original software. */
36 /* 3. This notice may not be removed or altered from any source */
37 /* distribution. */
38 /* */
39 /*****************************************************************************/
40 
41 
42 
43 #ifndef _UNISTD_H
44 #define _UNISTD_H
45 
46 
47 
48 /*****************************************************************************/
49 /* Data */
50 /*****************************************************************************/
51 
52 
53 
54 /* Predefined file handles */
55 #define STDIN_FILENO 0
56 #define STDOUT_FILENO 1
57 #define STDERR_FILENO 2
58 
59 /* WE need size_t */
60 typedef unsigned size_t;
61 
62 /* We need off_t if sys/types is not included */
63 typedef long int off_t;
64 
65 /*****************************************************************************/
66 /* Code */
67 /*****************************************************************************/
68 
69 
70 
71 /* Files */
72 int write(int fd, const void* buf, unsigned count);
73 int read(int fd, void* buf, unsigned count);
74 off_t lseek(int fd, off_t offset, int whence);
75 int unlink(const char* name); /* Same as remove() */
76 
77 /* Directories */
78 int chdir(const char* name);
79 char* getcwd(char* buf, size_t size);
80 int mkdir(const char* name, ...); /* May take a mode argument */
81 int rmdir(const char* name);
82 
83 /* Others */
84 unsigned sleep(unsigned seconds);
85 
86 /* End of unistd.h */
87 #endif
size_t
unsigned size_t
Definition: unistd.h:60
off_t
long int off_t
Definition: unistd.h:63
getcwd
char * getcwd(char *buf, size_t size)
seconds
uint8_t seconds
unlink
int unlink(const char *name)
count
const void uint16_t count
Definition: memory.h:58
read
int read(int fd, void *buf, unsigned count)
write
int write(int fd, const void *buf, unsigned count)
size
unsigned size
Definition: neslib.h:185
chdir
int chdir(const char *name)
sleep
unsigned sleep(unsigned seconds)
lseek
off_t lseek(int fd, off_t offset, int whence)
rmdir
int rmdir(const char *name)
mkdir
int mkdir(const char *name,...)