boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

unistd.h (3106B)


      1 /* -*-comment-start: "//";comment-end:""-*-
      2  * GNU Mes --- Maxwell Equations of Software
      3  * Copyright © 2017,2018,2024 Janneke Nieuwenhuizen <janneke@gnu.org>
      4  * Copyright © 2023 Timothy Sample <samplet@ngyro.com>
      5  *
      6  * This file is part of GNU Mes.
      7  *
      8  * GNU Mes is free software; you can redistribute it and/or modify it
      9  * under the terms of the GNU General Public License as published by
     10  * the Free Software Foundation; either version 3 of the License, or (at
     11  * your option) any later version.
     12  *
     13  * GNU Mes is distributed in the hope that it will be useful, but
     14  * WITHOUT ANY WARRANTY; without even the implied warranty of
     15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16  * GNU General Public License for more details.
     17  *
     18  * You should have received a copy of the GNU General Public License
     19  * along with GNU Mes.  If not, see <http://www.gnu.org/licenses/>.
     20  */
     21 #ifndef __MES_UNISTD_H
     22 #define __MES_UNISTD_H 1
     23 
     24 #if SYSTEM_LIBC
     25 #ifndef _GNU_SOURCE
     26 #define _GNU_SOURCE
     27 #endif
     28 #undef __MES_UNISTD_H
     29 #include_next <unistd.h>
     30 
     31 #else // ! SYSTEM_LIBC
     32 
     33 #if defined (BOOTSTRAP_WITH_POSIX)
     34 #define _POSIX_VERSION 199009L
     35 #endif
     36 
     37 #include <sys/types.h>
     38 #ifndef NULL
     39 #define NULL 0
     40 #endif
     41 
     42 #ifndef STDIN_FILENO
     43 #define	STDIN_FILENO  0
     44 #define	STDOUT_FILENO 1
     45 #define	STDERR_FILENO 2
     46 #endif // STDIN_FILENO
     47 
     48 #ifndef STDIN_FILE_NO
     49 #define	STDIN_FILE_NO  0
     50 #define	STDOUT_FILE_NO 1
     51 #define	STDERR_FILE_NO 2
     52 #endif // STDIN_FILE_NO
     53 
     54 #ifndef R_OK
     55 #define F_OK 0
     56 #define X_OK 1
     57 #define W_OK 2
     58 #define R_OK 4
     59 #endif
     60 
     61 #ifndef _PC_NAME_MAX
     62 #define _PC_NAME_MAX 3
     63 #endif
     64 #ifndef _PC_PATH_MAX
     65 #define _PC_PATH_MAX 4
     66 #endif
     67 
     68 int access (char const *s, int mode);
     69 unsigned int alarm (unsigned int seconds);
     70 int chdir (char const *file_name);
     71 int close (int fd);
     72 int execv (char const *file_name, char *const argv[]);
     73 int execl (char const *file_name, char const *arg, ...);
     74 int execlp (char const *file_name, char const *arg, ...);
     75 int execve (char const *file, char *const argv[], char *const env[]);
     76 int execvp (char const *file, char *const argv[]);
     77 int fork (void);
     78 int fsync (int filedes);
     79 char *getcwd (char *buf, size_t size);
     80 uid_t getuid (void);
     81 gid_t getgid (void);
     82 int setgid (gid_t newgid);
     83 int setuid (uid_t newuid);
     84 uid_t geteuid (void);
     85 gid_t getegid (void);
     86 pid_t getpgrp (void);
     87 pid_t getpid (void);
     88 pid_t getppid (void);
     89 int getpgid (pid_t pid);
     90 int isatty (int fd);
     91 int link (char const *old_name, char const *new_name);
     92 off_t lseek (int fd, off_t offset, int whence);
     93 long pathconf (char const *file_name, int parameter);
     94 int pipe (int filedes[2]);
     95 ssize_t read (int fd, void *buffer, size_t size);
     96 ssize_t readlink (char const *file_name, char *buffer, size_t size);
     97 char *realpath (char const *name, char *resolved);
     98 #if __SBRK_CHAR_PTRDIFF
     99 /* xmalloc in binutils <= 2.10.1 uses this old prototype */
    100 char *sbrk (ptrdiff_t delta);
    101 #else
    102 void *sbrk (intptr_t delta);
    103 #endif
    104 int symlink (char const *old_name, char const *new_name);
    105 int unlink (char const *file_name);
    106 ssize_t write (int filedes, void const *buffer, size_t size);
    107 
    108 #endif // ! SYSTEM_LIBC
    109 
    110 #endif // __MES_UNISTD_H