]> git.ozlabs.org Git - yaboot.git/blob - include/nonstd.h
Add more libc helper functions for e2fsprogs.
[yaboot.git] / include / nonstd.h
1 /*
2  *  nonstd.h - A collection of trivial wrappers to allow typical libraries
3  *             to work within the yaboot environment.
4  *
5  *  Copyright 2011 Tony Breeds, IBM Corporation
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2 of the License, or
10  *  (at your option) any later version.
11  *
12  *  This program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with this program; if not, write to the Free Software
19  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20  */
21
22 #ifndef NONSTD_H
23 #define NONSTD_H
24
25 /* Copied from asm-generic/errno-base.h */
26 #define EPERM            1      /* Operation not permitted */
27 #define EBADF            9      /* Bad file number */
28 #define EACCES          13      /* Permission denied */
29 #define EFAULT          14      /* Bad address */
30
31 typedef int FILE;
32
33 typedef unsigned int uid_t;
34 typedef int pid_t;
35 typedef unsigned int mode_t;
36 typedef int ssize_t;
37 typedef long long off64_t;
38 typedef long off_t;
39
40 struct stat;
41 struct stat64;
42 struct timezone;
43 struct timeval;
44 struct rlimit;
45 struct utsname;
46
47 extern FILE *stdout;
48 extern FILE *stderr;
49
50 int printf(const char *format, ...);
51 int fprintf(FILE *stream, const char *format, ...);
52 int fputs(const char *s, FILE *stream);
53 int fflush(FILE *stream);
54 char *getenv(const char *name);
55 int gethostname(char *name, size_t len);
56 int gettimeofday(struct timeval *tv, struct timezone *tz);
57 int * __errno_location(void);
58 unsigned int sleep(unsigned int seconds);
59 int rand(void);
60 void srand(unsigned int seed);
61 long int random(void);
62 void srandom(unsigned int seed);
63 uid_t geteuid(void);
64 uid_t getuid(void);
65 pid_t getpid(void);
66 int stat(const char *path, struct stat *buf);
67 int stat64(const char *path, struct stat *buf);
68 int fstat(int fd, struct stat *buf);
69 int fstat64(int fd, struct stat *buf);
70 int open(const char *pathname, int flags, mode_t mode);
71 int open64(const char *pathname, int flags, mode_t mode);
72 off_t lseek(int fd, off_t offset, int whence);
73 off64_t lseek64(int fd, off64_t offset, int whence);
74 ssize_t read(int fildes, void *buf, size_t nbyte);
75 int close(int fd);
76 void *calloc(size_t nmemb, size_t size);
77 void perror(const char *s);
78 void exit(int status);
79 int ioctl(int d, int request, ...);
80 size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
81 long sysconf(int name);
82 int getpagesize(void);
83 void qsort(void *base, size_t nmemb, size_t size,
84            int(*compar)(const void *, const void *));
85 ssize_t write(int fd, const void *buf, size_t count);
86 int fallocate(int fd, int mode, off_t offset, off_t len);
87 unsigned long long int strtoull(const char *nptr, char **endptr, int base);
88 int fsync(int fd);
89 int __open64_2(const char *pathname, int flags);
90 int __xstat64(int vers, const char *name, struct stat64 *buf);
91 int uname(struct utsname *buf);
92 int getrlimit(int resource, struct rlimit *rlim);
93 int setrlimit(int resource, const struct rlimit *rlim);
94 int __fxstat64(int vers, int fd, struct stat64 *buf);
95 #endif