[freenos] 5 new revisions pushed by nieklinn...@xxxxxxxxx on 2014-08-17 18:56 GMT

  • From: freenos@xxxxxxxxxxxxxx
  • To: freenos@xxxxxxxxxxxxx
  • Date: Sun, 17 Aug 2014 18:56:48 +0000

master moved from 0a8390677740 to c9c59d94f77d

5 new revisions:

Revision: f9e2531188d8
Author:   Niek Linnenbank <nieklinnenbank@xxxxxxxxx>
Date:     Sun Aug 17 18:01:48 2014 UTC
Log: Fixed cross compilation on x86_64 systems using a multilib GCC compile...
http://code.google.com/p/freenos/source/detail?r=f9e2531188d8

Revision: d7e4c2a03c68
Author:   Niek Linnenbank <nieklinnenbank@xxxxxxxxx>
Date:     Sun Aug 17 18:53:50 2014 UTC
Log:      Adding gitignore file to skip tracking generated files.
http://code.google.com/p/freenos/source/detail?r=d7e4c2a03c68

Revision: 43308c510e24
Author:   Niek Linnenbank <nieklinnenbank@xxxxxxxxx>
Date:     Sun Aug 17 18:54:16 2014 UTC
Log:      Adding creat() POSIX call to create new files.
http://code.google.com/p/freenos/source/detail?r=43308c510e24

Revision: 2f8552f7b813
Author:   Niek Linnenbank <nieklinnenbank@xxxxxxxxx>
Date:     Sun Aug 17 18:54:40 2014 UTC
Log:      Add the touch program to create new files.
http://code.google.com/p/freenos/source/detail?r=2f8552f7b813

Revision: c9c59d94f77d
Author:   Niek Linnenbank <nieklinnenbank@xxxxxxxxx>
Date:     Sun Aug 17 18:54:53 2014 UTC
Log: Implement write support for in-memory based filesystems (e.g. tmpfs)
http://code.google.com/p/freenos/source/detail?r=c9c59d94f77d

==============================================================================
Revision: f9e2531188d8
Author:   Niek Linnenbank <nieklinnenbank@xxxxxxxxx>
Date:     Sun Aug 17 18:01:48 2014 UTC
Log: Fixed cross compilation on x86_64 systems using a multilib GCC compiler.

http://code.google.com/p/freenos/source/detail?r=f9e2531188d8

Modified:
 /kernel/SConscript
 /kernel/X86/Kernel.cpp
 /kernel/X86/boot.S
 /kernel/X86/kernel.ld
 /kernel/X86/user.ld
 /site_scons/build.py

=======================================
--- /kernel/SConscript  Sun Aug  2 10:52:46 2009 UTC
+++ /kernel/SConscript  Sun Aug 17 18:01:48 2014 UTC
@@ -19,7 +19,7 @@

env = Prepare(target, [ 'libparse', 'liballoc', 'libposix', 'libexec', 'libc' ],
                      [ 'process', 'memory', 'filesystem' ])
-env['LINKFLAGS'] = ' -T kernel/X86/kernel.ld'
+env['LINKFLAGS'] = ' -T kernel/X86/kernel.ld -melf_i386'

 env.Program('kernel', [ 'X86/boot.S', 'X86/contextSwitch.S',
                        'Kernel.cpp',  'Main.cpp', 'Memory.cpp',
=======================================
--- /kernel/X86/Kernel.cpp      Sat Oct 24 20:14:36 2009 UTC
+++ /kernel/X86/Kernel.cpp      Sun Aug 17 18:01:48 2014 UTC
@@ -97,7 +97,7 @@
     /* Install PIT (i8253) IRQ handler. */
     hookInterrupt(IRQ(0), clocktick, 0);

-    /* Initialize TSS Segment. */
+    /* Initialize TSS Segment. */
     gdt[USER_TSS].limitLow    = sizeof(TSS) + (0xfff / 8);
     gdt[USER_TSS].baseLow     = ((Address) &kernelTss) & 0xffff;
     gdt[USER_TSS].baseMid     = (((Address) &kernelTss) >> 16) & 0xff;
=======================================
--- /kernel/X86/boot.S  Sat Sep  5 15:27:34 2009 UTC
+++ /kernel/X86/boot.S  Sun Aug 17 18:01:48 2014 UTC
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2009 Niek Linnenbank
- *
+ *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
@@ -19,7 +19,7 @@
 #include <FreeNOS/CPU.h>
 #include <FreeNOS/Memory.h>

-/* The size of our stack (16KB).  */
+/* The size of our stack (16KB).  */
 #define STACK_SIZE 0x4000

 /**
@@ -146,7 +146,7 @@
        movl $kernelPageTab, %ebx
        orl  $(PAGE_PRESENT | PAGE_RW | PAGE_PINNED), %ebx
        movl %ebx, (%eax)
-
+
        /* Identity map the first 4MB. */
        movl $kernelPageTab, %eax
        xorl %ebx, %ebx
=======================================
--- /kernel/X86/kernel.ld       Thu Jun 18 15:17:16 2009 UTC
+++ /kernel/X86/kernel.ld       Sun Aug 17 18:01:48 2014 UTC
@@ -16,6 +16,7 @@
  */

 ENTRY(_start)
+TARGET("elf32-i386")
 OUTPUT_FORMAT("elf32-i386")

 phys = 0x00100000;
@@ -25,6 +26,11 @@
 {
     . = 0x00100000;
     kernelStart = .;
+
+    /DISCARD/ :
+    {
+        *(.note.gnu.build-id)
+    }

     .text virt : AT(phys)
     {
@@ -48,14 +54,14 @@
        KEEP (*(.ctors))
        LONG(0)
         CTOR_END = .;
-
+
         DTOR_LIST = .;
        KEEP (*(SORT(.dtors.*)))
        KEEP (*(.dtors))
         LONG(0)
         DTOR_END = .;
        . += 4;
-
+
        initStart = .;
        KEEP (*(SORT(.init*)))
        initEnd   = .;
=======================================
--- /kernel/X86/user.ld Thu Jun 18 15:17:16 2009 UTC
+++ /kernel/X86/user.ld Sun Aug 17 18:01:48 2014 UTC
@@ -16,6 +16,7 @@
  */

 ENTRY(_entry)
+TARGET("elf32-i386")
 OUTPUT_FORMAT("elf32-i386")

 SECTIONS
=======================================
--- /site_scons/build.py        Sat Jun 27 22:52:58 2009 UTC
+++ /site_scons/build.py        Sun Aug 17 18:01:48 2014 UTC
@@ -42,7 +42,7 @@
                [ '-fno-rtti', '-fno-exceptions' ]),
     ('CPPFLAGS',  'Change target C preprocessor flags', '-Iinclude'),
     ('LINKFLAGS', 'Change the flags for the target linker',
-               [ '--whole-archive', '-nostdlib', '-T', 'kernel/X86/user.ld' ])
+ [ '--whole-archive', '-nostdlib', '-T', 'kernel/X86/user.ld', '-melf_i386' ])
 )

 #
@@ -67,17 +67,17 @@
 # Perform autoconf-a-like checks on the selected target compiler chain.
 #
 if not target.GetOption('clean'):
-
-    configure.TryCCFlag(target, '-fno-stack-protector')
+    configure.TryCCFlag(target, '-m32')
+    configure.TryCCFlag(target, '-fno-stack-protector')
     configure.TryCCFlag(target, '-O0')
     configure.TryCCFlag(target, '-g3')
     configure.TryCCFlag(target, '-Wall')
     configure.TryCCFlag(target, '-W')
     configure.TryCCFlag(target, '-Wno-unused-parameter')
-    configure.TryCCFlag(target, '-Werror')
     configure.TryCCFlag(target, '-fno-builtin')
     configure.TryCCFlag(target, '-nostdinc')
     configure.TryCCFlag(target, '-Wno-write-strings')
+    target['ASFLAGS'] = target['CCFLAGS']

 #
 # Command-line options for the host build chain.
@@ -87,7 +87,7 @@
     ('HOSTCC',       'Set the host C compiler to use',   'gcc'),
     ('HOSTCXX',      'Set the host C++ compiler to use', 'g++'),
     ('HOSTCCFLAGS',  'Change host C compiler flags',
-               [ '-O0', '-g3', '-Wall', '-Werror', '-Wno-write-strings' ]),
+               [ '-O0', '-g3', '-Wall', '-Wno-write-strings' ]),
     ('HOSTCXXFLAGS', 'Change host C++ compiler flags',
                [ '' ]),
     ('HOSTCPPFLAGS',  'Change host C preprocessor flags',

==============================================================================
Revision: d7e4c2a03c68
Author:   Niek Linnenbank <nieklinnenbank@xxxxxxxxx>
Date:     Sun Aug 17 18:53:50 2014 UTC
Log:      Adding gitignore file to skip tracking generated files.

http://code.google.com/p/freenos/source/detail?r=d7e4c2a03c68

Added:
 /.gitignore

=======================================
--- /dev/null
+++ /.gitignore Sun Aug 17 18:53:50 2014 UTC
@@ -0,0 +1,10 @@
+*.o
+*.a
+*.pyc
+include/Version.h
+config.log
+.sconf_temp
+.sconsign.dblite
+boot/boot.*
+host/
+include/FreeNOS

==============================================================================
Revision: 43308c510e24
Author:   Niek Linnenbank <nieklinnenbank@xxxxxxxxx>
Date:     Sun Aug 17 18:54:16 2014 UTC
Log:      Adding creat() POSIX call to create new files.

http://code.google.com/p/freenos/source/detail?r=43308c510e24

Added:
 /lib/libposix/sys/stat/creat.cpp
Modified:
 /lib/libposix/sys/stat.h

=======================================
--- /dev/null
+++ /lib/libposix/sys/stat/creat.cpp    Sun Aug 17 18:54:16 2014 UTC
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2014 Niek Linnenbank
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <API/IPCMessage.h>
+#include <FileSystemMessage.h>
+#include <FileType.h>
+#include <FileMode.h>
+#include <Config.h>
+#include "POSIXSupport.h"
+#include <errno.h>
+#include "sys/stat.h"
+
+int creat(const char *path, mode_t mode)
+{
+    FileSystemMessage msg;
+    ProcessID mnt = findMount(path);
+
+    /* Fill in the message. */
+    msg.action   = CreateFile;
+    msg.buffer   = (char *) path;
+    msg.filetype = RegularFile;
+    msg.mode     = (FileModes) (mode & FILEMODE_MASK);
+
+    /* Ask FileSystem to create the file for us. */
+    if (mnt)
+    {
+       IPCMessage(mnt, SendReceive, &msg, sizeof(msg));
+
+       /* Set errno. */
+       errno = msg.result;
+    }
+    else
+       errno = ENOENT;
+
+    /* Report result. */
+    return msg.result == ESUCCESS ? 0 : -1;
+}
=======================================
--- /lib/libposix/sys/stat.h    Thu Aug 13 20:18:29 2009 UTC
+++ /lib/libposix/sys/stat.h    Sun Aug 17 18:54:16 2014 UTC
@@ -277,6 +277,24 @@
  */
 extern C int mkdir(const char *path, mode_t mode);

+/**
+ * @brief Create a new file or rewrite an existing one
+ *
+ * The creat() function is redundant. Its services are also provided by
+ * the open() function. It has been included primarily for historical
+ * purposes since many existing applications depend on it. It is best
+ * considered a part of the C binding rather than a function that should
+ * be provided in other languages.
+ *
+ * @param path Full path to the file to create
+ * @param mode Initial access permissions for the file.
+ * @return Upon successful completion, these functions shall return 0.
+ *         Otherwise, these functions shall return -1 and set errno to
+ *         indicate the error. If -1 is returned, no file shall
+ *         be created.
+ */
+extern C int creat(const char *path, mode_t mode);
+
 /**
  * @}
  */

==============================================================================
Revision: 2f8552f7b813
Author:   Niek Linnenbank <nieklinnenbank@xxxxxxxxx>
Date:     Sun Aug 17 18:54:40 2014 UTC
Log:      Add the touch program to create new files.

http://code.google.com/p/freenos/source/detail?r=2f8552f7b813

Added:
 /bin/touch/Main.cpp
 /bin/touch/SConscript

=======================================
--- /dev/null
+++ /bin/touch/Main.cpp Sun Aug 17 18:54:40 2014 UTC
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2014 Niek Linnenbank
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+int touch(char *prog, char *path)
+{
+    int ret;
+
+    /* Attempt to creat() the file. */
+    if ((ret = creat(path, S_IRUSR|S_IWUSR)) < 0)
+    {
+        printf("%s: failed to open '%s': %s\r\n",
+                prog, path, strerror(errno));
+        return EXIT_FAILURE;
+    }
+    return EXIT_SUCCESS;
+}
+
+int main(int argc, char **argv)
+{
+    int ret = EXIT_SUCCESS, result;
+
+    /* Verify command-line arguments. */
+    if (argc < 2)
+    {
+       printf("usage: %s FILE1 FILE2 ...\r\n",
+               argv[0]);
+       return EXIT_FAILURE;
+    }
+    /* Touch all given files. */
+    for (int i = 0; i < argc - 1; i++)
+    {
+       /* Perform touch. */
+       result = touch(argv[0], argv[i + 1]);
+
+       /* Update exit code if needed. */
+       if (result > ret)
+       {
+           ret = result;
+       }
+    }
+    /* Done. */
+    return ret;
+}
=======================================
--- /dev/null
+++ /bin/touch/SConscript       Sun Aug 17 18:54:40 2014 UTC
@@ -0,0 +1,21 @@
+#
+# Copyright (C) 2009 Niek Linnenbank
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+from build import *
+
+env = Prepare(target, [ 'libcrt', 'liballoc', 'libposix', 'libexec', 'libc' ], [ 'filesystem' ]) +env.Program('touch', [ 'Main.cpp' ], LIBS = env['LIBS'], LIBPATH = env['LIBPATH'])

==============================================================================
Revision: c9c59d94f77d
Author:   Niek Linnenbank <nieklinnenbank@xxxxxxxxx>
Date:     Sun Aug 17 18:54:53 2014 UTC
Log: Implement write support for in-memory based filesystems (e.g. tmpfs)

http://code.google.com/p/freenos/source/detail?r=c9c59d94f77d

Modified:
 /bin/SConscript
 /srv/filesystem/PseudoFile.h

=======================================
--- /bin/SConscript     Fri Jun 26 21:17:51 2009 UTC
+++ /bin/SConscript     Sun Aug 17 18:54:53 2014 UTC
@@ -17,5 +17,5 @@

 SConscript(dirs = [ 'sh', 'ps', 'memstat', 'mount',
                    'bench', 'hostname', 'parse',
-                   'uname', 'cat', 'ls', 'stat',
+                   'uname', 'cat', 'ls', 'stat', 'touch',
                    'mknod', 'echo' ])
=======================================
--- /srv/filesystem/PseudoFile.h        Fri Sep  4 14:51:02 2009 UTC
+++ /srv/filesystem/PseudoFile.h        Sun Aug 17 18:54:53 2014 UTC
@@ -108,14 +108,45 @@
                /* How much bytes to copy? */
                Size bytes = this->size - offset > size ?
                                                   size : this->size - offset;
-
+
                /* Copy the buffers. */
                return buffer->write(this->buffer + offset, bytes);
            }
        }
+
+        /**
+         * Write bytes to the file.
+         * @param buffer Input/Output buffer to input bytes from.
+         * @param size Number of bytes to write, at maximum.
+         * @param offset Offset inside the file to start writing.
+         * @return Number of bytes written on success, Error on failure.
+         */
+        Error write(IOBuffer *buffer, Size size, Size offset)
+        {
+            /* Check for the buffer size. */
+            if (!this->buffer || this->size < (size + offset))
+            {
+                /* Allocate a new buffer and copy the old data */
+                char *new_buffer = new char[size+offset];
+                memset(new_buffer, 0, sizeof(new_buffer));
+
+                /* Inherit from the old buffer, if needed. */
+                if (this->buffer)
+                {
+                    memcpy(new_buffer, this->buffer, this->size);
+                    delete this->buffer;
+                }
+                /* Assign buffer */
+                this->buffer = new_buffer;
+                this->size = size+offset;
+            }
+            /* Copy the input data in the current buffer. */
+            buffer->read(this->buffer + offset, size);
+            return size;
+        }

     protected:
-
+
        /** Buffer from which we read. */
        char *buffer;
 };

Other related posts:

  • » [freenos] 5 new revisions pushed by nieklinn...@xxxxxxxxx on 2014-08-17 18:56 GMT - freenos