[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Lost] [Patch] libc - Kleinere Fixes fürs Kompilieren von gcc



+ libc: stdint-Typen ergaenzt
+ libc: strncat-Deklaration ergaenzt
! libc: Diverse Prototypen korrigiert
Index: trunk/src/include/arch/i386/stdint.h
===================================================================
--- trunk.orig/src/include/arch/i386/stdint.h
+++ trunk/src/include/arch/i386/stdint.h
@@ -47,8 +47,32 @@ typedef unsigned int uint32_t;
 typedef unsigned long long uint64_t;
 
 
-typedef unsigned int uint_fast32_t;
+typedef int8_t int_least8_t;
+typedef int32_t int_least16_t;
+typedef int32_t int_least32_t;
+typedef int64_t int_least64_t;
+
+typedef uint8_t uint_least8_t;
+typedef uint32_t uint_least16_t;
+typedef uint32_t uint_least32_t;
+typedef uint64_t uint_least64_t;
+
+
+typedef int8_t int_fast8_t;
+typedef int32_t int_fast16_t;
+typedef int32_t int_fast32_t;
+typedef int64_t int_fast64_t;
+
+typedef uint8_t uint_fast8_t;
+typedef uint32_t uint_fast16_t;
+typedef uint32_t uint_fast32_t;
+typedef uint64_t uint_fast64_t;
+
+
 typedef unsigned int uintptr_t;
 typedef long int intptr_t;
 
+typedef int64_t intmax_t;
+typedef uint64_t uintmax_t;
+
 #endif
Index: trunk/src/include/inttypes.h
===================================================================
--- /dev/null
+++ trunk/src/include/inttypes.h
@@ -0,0 +1 @@
+#include <stdint.h>
Index: trunk/src/include/stdlib.h
===================================================================
--- trunk.orig/src/include/stdlib.h
+++ trunk/src/include/stdlib.h
@@ -44,14 +44,14 @@
 #define EXIT_FAILURE 1
 
 void exit(int result);
-void abort();
+void abort(void);
 int atexit(void (*function)(void));
 
 void* malloc(size_t size);
 void free(void* address);
 void* realloc(void* address, size_t size);
 void* calloc(size_t size, size_t count);
-void init_memory_manager();
+void init_memory_manager(void);
 
 long strtol(const char* str, char** endptr, int base);
 unsigned long strtoul(const char* str, char** endptr, int base);
Index: trunk/src/include/string.h
===================================================================
--- trunk.orig/src/include/string.h
+++ trunk/src/include/string.h
@@ -23,6 +23,7 @@ char* strchr(const char* str, int charac
 char* strrchr(const char* str, int character);
 
 char* strcat(char* dest, const char* src);
+char* strncat(char* dest, const char* src, size_t n);
 
 char* strtok(char* str, const char* delim);
 
Index: trunk/src/modules/include/stdio.h
===================================================================
--- trunk.orig/src/modules/include/stdio.h
+++ trunk/src/modules/include/stdio.h
@@ -69,7 +69,7 @@ int puts(const char* str);
 void perror(const char* message);
 
 int getc(FILE* io_res);
-int getchar();
+int getchar(void);
 int ungetc(int c, FILE* io_res);
 char* gets(char* dest);
 
@@ -96,7 +96,7 @@ FILE* fopen(const char* filename, const 
 FILE* fdopen(int fd, const char* mode);
 FILE* freopen(const char* filename, const char* mode, FILE* stream);
 int fclose(FILE* io_res);
-FILE* tmpfile();
+FILE* tmpfile(void);
 
 size_t fread(void* dest, size_t blocksize, size_t blockcount, FILE* io_res);
 int fgetc(FILE* io_res);
Index: trunk/src/modules/include/unistd.h
===================================================================
--- trunk.orig/src/modules/include/unistd.h
+++ trunk/src/modules/include/unistd.h
@@ -55,10 +55,10 @@ int isatty(int desc);
 #endif
 
 /// PID des aktuellen Prozesses auslesen
-pid_t getpid();
+pid_t getpid(void);
 
 /// PID des Elternprozesses auslesen
-pid_t getppid();
+pid_t getppid(void);
 
 /// Hardlink erstellen
 int link(const char* oldpath, const char* newpath);
@@ -111,7 +111,7 @@ int close(int fd);
 
 #ifndef CONFIG_LIBC_NO_STUBS
 /// Prozess klonen
-pid_t fork();
+pid_t fork(void);
 
 /// Pipe einrichten
 int pipe(int mode[2]);
Index: trunk/src/modules/lib/posix/stat.c
===================================================================
--- trunk.orig/src/modules/lib/posix/stat.c
+++ trunk/src/modules/lib/posix/stat.c
@@ -39,6 +39,13 @@
 #include <errno.h>
 
 /**
+ * Inodenummer niemals doppelt vergeben
+ * FIXME: Das ist natuerlich schwachsinn, aber gcc prueft so, ob zwei Dateien
+ * identisch sind.
+ */
+static ino_t inode_num = 0;
+
+/**
  * Modus einer Datei Aendern. Der Modus entscheidet unter anderem ueber
  * Zugriffsberechtigungen.
  *
@@ -101,6 +108,7 @@ static int lost_stat(FILE* f, struct sta
     }
     stat_buf->st_uid = 0;
     stat_buf->st_gid = 0;
+    stat_buf->st_ino = ++inode_num;
 
     return 0;
 }
@@ -135,6 +143,7 @@ int stat(const char* filename, struct st
         stat_buf->st_mode |= S_IFDIR;
         stat_buf->st_uid = 0;
         stat_buf->st_gid = 0;
+        stat_buf->st_ino = ++inode_num;
     } else {
         status = lost_stat(file, stat_buf);
         fclose(file);

Attachment: signature.asc
Description: This is a digitally signed message part.