summaryrefslogtreecommitdiffstats
path: root/posix1003_1/files_and_directories.rst
blob: 2e7dd1fbc242b3bf4a0f6fa6cdcd3742242ab547 (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
.. comment SPDX-License-Identifier: CC-BY-SA-4.0

Files and Directories
#####################

Directories
===========

Format of Directory Entries
---------------------------

Directory Operations
--------------------

.. code:: c

    struct dirent, Type, Implemented
    opendir(), Function, Implemented
    readdir(), Function, Implemented
    readdir_r(), Function, Implemented
    rewinddir(), Function, Implemented
    closedir(), Function, Implemented

Working Directory
=================

Change Current Working Directory
--------------------------------

.. code:: c

    chdir(), Function, Implemented

Get Working Directory Pathname
------------------------------

.. code:: c

    getcwd(), Function, Implemented

General File Creation
=====================

Open a File
-----------

.. code:: c

    open(), Function, Implemented
    O_RDONLY, Constant, Implemented
    O_WRONLY, Constant, Implemented
    O_RDWR, Constant, Implemented
    O_APPEND, Constant, Implemented
    O_CREAT, Constant, Implemented
    O_DSYNC, Constant, Unimplemented
    O_EXCL, Constant, Implemented
    O_NOCTTY, Constant, Implemented
    O_NONBLOCK, Constant, Implemented
    O_RSYNC, Constant, Unimplemented
    O_SYNC, Constant, Implemented
    O_TRUNC, Constant, Implemented

NOTE: In the newlib fcntl.h, O_SYNC is defined only if _POSIX_SOURCE is
not defined.  This seems wrong.

Create a New File or Rewrite an Existing One
--------------------------------------------

.. code:: c

    creat(), Function, Implemented

Set File Creation Mask
----------------------

.. code:: c

    umask(), Function, Implemented

Link to a File
--------------

.. code:: c

    link(), Function, Implemented

Special File Creation
=====================

Make a Directory
----------------

.. code:: c

    mkdir(), Function, Implemented

Make a FIFO Special File
------------------------

.. code:: c

    mkfifo(), Function, Untested Implementation

NOTE: mkfifo() is implemented but no filesystem supports FIFOs.

File Removal
============

Remove Directory Entries
------------------------

.. code:: c

    unlink(), Function, Implemented

Remove a Directory
------------------

.. code:: c

    rmdir(), Function, Implemented

Rename a File
-------------

.. code:: c

    rename(), Function, Partial Implementation

File Characteristics
====================

File Characteristics Header and Data Structure
----------------------------------------------

.. code:: c

    struct stat, Type, Implemented

<sys/stat.h> File Types
~~~~~~~~~~~~~~~~~~~~~~~

.. code:: c

    S_ISBLK(), Function, Implemented
    S_ISCHR(), Function, Implemented
    S_ISDIR(), Function, Implemented
    S_ISFIFO(), Function, Implemented
    S_ISREG(), Function, Implemented
    S_TYPEISMQ(), Function, Unimplemented
    S_TYPEISSEM(), Function, Unimplemented
    S_TYPEISSHM(), Function, Unimplemented

<sys/stat.h> File Modes
~~~~~~~~~~~~~~~~~~~~~~~

.. code:: c

    S_IRWXU, Constant, Implemented
    S_IRUSR, Constant, Implemented
    S_IWUSR, Constant, Implemented
    S_IXUSR, Constant, Implemented
    S_IRWXG, Constant, Implemented
    S_IRGRP, Constant, Implemented
    S_IWGRP, Constant, Implemented
    S_IXGRP, Constant, Implemented
    S_IRWXO, Constant, Implemented
    S_IROTH, Constant, Implemented
    S_IWOTH, Constant, Implemented
    S_IXOTH, Constant, Implemented
    S_ISUID, Constant, Implemented
    S_ISGID, Constant, Implemented

<sys/stat.h> Time Entries
~~~~~~~~~~~~~~~~~~~~~~~~~

Get File Status
---------------

.. code:: c

    stat(), Function, Implemented
    fstat(), Function, Implemented

Check File Accessibility
------------------------

.. code:: c

    access(), Function, Implemented

Change File Modes
-----------------

.. code:: c

    chmod(), Function, Implemented
    fchmod(), Function, Implemented

Change Owner and Group of a File
--------------------------------

.. code:: c

    chown(), Function, Implemented

Set File Access and Modification Times
--------------------------------------

.. code:: c

    struct utimbuf, Type, Implemented
    utime(), Function, Implemented

Truncate a File to a Specified Length
-------------------------------------

.. code:: c

    ftruncate(), Function, Implemented

Configurable Pathname Variable
==============================

Get Configurable Pathname Variables
-----------------------------------

.. code:: c

    pathconf(), Function, Implemented
    fpathconf(), Function, Implemented
    _PC_LINK_MAX, Constant, Implemented
    _PC_MAX_CANON, Constant, Implemented
    _PC_MAX_INPUT, Constant, Implemented
    _PC_MAX_INPUT, Constant, Implemented
    _PC_NAME_MAX, Constant, Implemented
    _PC_PATH_MAX, Constant, Implemented
    _PC_PIPE_BUF, Constant, Implemented
    _PC_ASYNC_IO, Constant, Implemented
    _PC_CHOWN_RESTRICTED, Constant, Implemented
    _PC_NO_TRUNC, Constant, Implemented
    _PC_PRIO_IO, Constant, Implemented
    _PC_SYNC_IO, Constant, Implemented
    _PC_VDISABLE, Constant, Implemented

NOTE: The newlib unistd.h and sys/unistd.h are installed and the
include search patch is used to get the right one.  There are
conflicts between the newlib unistd.h and RTEMS' version.

.. COMMENT: COPYRIGHT (c) 1988-2002.

.. COMMENT: On-Line Applications Research Corporation (OAR).

.. COMMENT: All rights reserved.