FreeNOS
unistd.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2009 Niek Linnenbank
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __LIBPOSIX_UNISTD_H
19#define __LIBPOSIX_UNISTD_H
20
21#include <Macros.h>
22#include <stdio.h>
23#include "sys/types.h"
24
38#define _POSIX_VERSION 200809L
39
45#define _POSIX2_VERSION 200809L
46
55extern C pid_t getpid();
56
62extern C pid_t getppid();
63
79extern C ssize_t read(int fildes, void *buf, size_t nbyte);
80
97extern C ssize_t write(int fildes, const void *buf, size_t nbyte);
98
108extern C int close(int fildes);
109
129extern C off_t lseek(int fildes, off_t offset, int whence);
130
140extern C int forkexec(const char *path, const char *argv[]);
141
152extern C int spawn(Address program, Size programSize, const char *argv[]);
153
171extern C int gethostname(char *name, size_t namelen);
172
189extern C char *getcwd(char *buf, size_t size);
190
205extern C int chdir(const char *path);
206
212extern C int unlink(const char *path);
213
221extern C unsigned int sleep(unsigned int seconds);
222
228#endif /* __LIBPOSIX_UNISTD_H */
C int gethostname(char *name, size_t namelen)
Get name of current host.
C unsigned int sleep(unsigned int seconds)
Sleep for the specified number of seconds.
Definition sleep.cpp:23
C int forkexec(const char *path, const char *argv[])
Create a new process and execute program.
Definition forkexec.cpp:27
C pid_t getpid()
Get the process ID.
Definition getpid.cpp:21
C int unlink(const char *path)
Remove a file from the filesystem.
Definition unlink.cpp:24
C int close(int fildes)
Close a file descriptor.
Definition close.cpp:22
C off_t lseek(int fildes, off_t offset, int whence)
Move the read/write file offset.
Definition lseek.cpp:22
ProcessID pid_t
Used for process IDs and process group IDs.
Definition types.h:32
C ssize_t read(int fildes, void *buf, size_t nbyte)
Read from a file.
Definition read.cpp:22
slong ssize_t
Used for a count of bytes or an error indication.
Definition types.h:38
sint off_t
Used for file sizes.
Definition types.h:59
C int spawn(Address program, Size programSize, const char *argv[])
Create a new process using in-memory image.
Definition spawn.cpp:29
C int chdir(const char *path)
Change working directory.
Definition chdir.cpp:27
C ssize_t write(int fildes, const void *buf, size_t nbyte)
Write on a file.
Definition write.cpp:22
C char * getcwd(char *buf, size_t size)
Get the pathname of the current working directory.
Definition getcwd.cpp:24
C pid_t getppid()
Get parent process ID.
Definition getppid.cpp:21
unsigned long Address
A memory address.
Definition Types.h:131
unsigned int Size
Any sane size indicator cannot go negative.
Definition Types.h:128
#define C
Used to define external C functions.
Definition Macros.h:134