1 .TH SYSTEM 3 "$Revision: 1.7 $"
4 sys_open, sys_close, sys_read, sys_write, sys_reset, sys_access,
5 sys_modtime, sys_remove, sys_rename, sys_filesize, sys_chmode,
7 sys_break, sys_stop, sys_time \- system call interface
10 .B #include <system.h>
12 .B File *STDIN, *STDOUT, *STDERR;
14 .B int sys_open(path, flag, filep)
19 .B void sys_close(filep)
22 .B int sys_read(filep, bufptr, bufsiz, pnbytes)
25 .B int bufsiz, *pnbytes;
27 .B int sys_write(filep, bufptr, nbytes)
32 .B int sys_seek(filep, offset, whence, poffset)
38 .B int sys_reset(filep)
41 .B int sys_access(path, mode)
45 .B int sys_remove(path)
48 .B int sys_rename(path1, path2)
49 .B char *path1, *path2;
51 .B long sys_filesize(path)
54 .B int sys_chmode(path, mode)
61 .B int sys_unlock(name)
64 .B char *sys_break(incr)
72 .B long sys_modtime(path)
76 This package provides a rather system-independent set of "system" calls
77 primarily intended for use in compilers.
78 The include file contains a defined constant,
80 which gives the system-dependent block size.
83 gives the maximum number of open files in a process.
88 for sequential reading or writing, as specified by
92 a decsriptor for the opened file.
93 The allowed values for
99 open for rewriting (create
103 open for writing at the end (create
107 Created files are given read and write permission for its creator and
108 read permission for other users.
112 as null pointer opens a so-called anonymous file, which has no name and
113 disappears when it is closed or when the program exits.
114 It is possible to read the contents of an anonymous file by using
117 There are three normally open files with the following descriptors:
119 standard input file; opened as OP_READ
121 standard output file; opened as OP_APPEND
123 standard error file; opened as OP_APPEND
126 causes the open file known by
133 contiguous bytes to be read from the open file known by
135 into a piece of memory pointed at by
137 The number of bytes actually read is returned in
141 is set to 0 then the end-of-file is reached.
146 contiguous bytes from the memory pointed at by
148 onto the open file known by
150 A non-zero return value indicates that
152 are actually written.
155 sets the file pointer of
161 is 0, the pointer is set to
167 is 1, the pointer is set to its current location plus
172 is 2, the pointer is set to the size of the file plus
175 Upon succesful completion, the resulting pointer location is returned in
177 and 1 is returned. Otherwise, 0 is returned.
180 causes the open file known by
182 to be re-opened for reading (cf. open flag OP_READ).
183 This may be useful in reading anonymous files.
186 checks the given file
188 for accessibility according to
190 which is the result of
192 one or more of the following values:
194 file exists and is readable
196 file exists and is writable
198 file exists and is executable
202 as 0 tests whether the directories leading to the file can be searched and the
204 The return value is either 0 if the
205 file is not reachable, does not exist or if the access is not allowed,
206 or 1 if the indicated access is permitted.
209 returns the last-modified time of the file specified in
211 Any failure is indicated by a return value of \-1L.
217 It is supposed that, if the file is still open, the contents of
218 the file are available until the last
221 A non-zero return value indicates successful action whereas 0
222 indicates that the given file does not exist or cannot be removed.
229 A non-zero return value indicates successful action. If
231 exists, it is removed first.
235 returns the size in bytes of the
239 The value \-1L is returned if the size cannot be retrieved for some reason.
242 changes the file-protection mode of file
250 provide a mechanism for setting and clearing symbolic locks for external
252 This is done by creating and removing file
255 returns zero if the lock is already set and a non-zero value if the lock
256 did not exist and has been created.
258 returns a non-zero value if the lock did not exist or if the lock has been
260 Zero is returned otherwise.
261 The actions performed by these routines are atomic:
262 race conditions cannot
268 more bytes to the program's data space and returns a pointer to
269 the newly allocated area.
270 ILL_BREAK is returned in case of some error, due to a lack of space or
272 It is equivalent to the UNIX version 7
276 should be called when the process is terminated due to
277 the end of the program or some error.
278 This routine closes all open files and causes the program to
279 stop in a way specified by
281 which parameter has one of the following values:
283 normal termination, indicate successful completion
285 terminate the process with status
288 abort this process and produce a post-mortem dump
292 returns a long value that stands for the system's time.
293 Its return value is a long that stands for the time
294 since 00:00:00 GMT, Jan. 1, 1970, measured in seconds.
297 ~em/modules/h/system.h
298 ~em/modules/lib/libsystem.a
311 return a value of zero upon any failure and a non-zero
312 value if the call succeeds.
314 The current implementation does not allow the use of anonymous files.
322 with the proper mode has the same effect on non-anonymous files.
324 UNIX version 7 manual volume 1, chapter 2