From 79d8b9ae755c7d4727fdb6a22d250854ca1ae450 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Fri, 4 Oct 2019 10:02:42 +0100 Subject: [PATCH] LibC: unistd.h should provide SEEK_SET etc. if stdio.h is not included (#629) Seems POSIX is odd and unistd also defines SEEK_SET if stdio.h This simply follows the pattern several other C libraries take of setting these macros to the same values in stdio if that header is not included. --- Libraries/LibC/unistd.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Libraries/LibC/unistd.h b/Libraries/LibC/unistd.h index da0d472d2b..6a879684e4 100644 --- a/Libraries/LibC/unistd.h +++ b/Libraries/LibC/unistd.h @@ -1,3 +1,10 @@ +/* standard symbolic constants and types + * + * values from POSIX standard unix specification + * + * https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html + */ + #pragma once #include @@ -12,6 +19,14 @@ __BEGIN_DECLS #define STDOUT_FILENO 1 #define STDERR_FILENO 2 +/* lseek whence values */ +#ifndef _STDIO_H /* also defined in stdio.h */ +#define SEEK_SET 0 /* from beginning of file. */ +#define SEEK_CUR 1 /* from current position in file. */ +#define SEEK_END 2 /* from the end of the file. */ +#endif + + extern char** environ; int get_process_name(char* buffer, int buffer_size);