This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
Re: fileio w/o kernel
- From: Jani Monoses <jani at iv dot ro>
- To: Andrew Lunn <andrew at lunn dot ch>
- Cc: ecos-patches at ecos dot sourceware dot org
- Date: Wed, 17 Nov 2004 16:37:38 +0200
- Subject: Re: fileio w/o kernel
- References: <4194D255.4070004@iv.ro> <20041114140232.GB22395@lunn.ch>
>>Was there a reason for using a thread in fat/tests/fileio instead of
regular main startup?
Not that i can see. It works OK your way, which is the same as for
romfs, ramfs & jffs2. However, main() is only called by the kernel. If
you don't have a kernel you need to use cyg_start() or
cyg_user_start(). Since you are trying to make this work without the
kernel it makes sense to change this to cyg_start() not main. You
might want to change the tests in fat, ram, rom & jffs2 as well.
Actually, libc_startup works with nonkernel config too, it just add a little
overhead.
For socket its best to make use of CYG_TEST_NA().
Attached, and will commit if acked.
Jani
--- orig/packages/io/fileio/current/ChangeLog
+++ mod/packages/io/fileio/current/ChangeLog
@@ -1,3 +1,7 @@
+2004-11-17 Jani Monoses <jani@iv.ro>
+
+ * tests/socket.c: Allow building without kernel config.
+
2004-11-14 Andrew Lunn <andrew.lunn@ascom.ch>
* tests/fileio1.c: Start the test using cyg_user_start so that
--- orig/packages/io/fileio/current/tests/socket.c
+++ mod/packages/io/fileio/current/tests/socket.c
@@ -53,6 +53,21 @@
//
//==========================================================================
+#include <pkgconf/system.h>
+#include <pkgconf/isoinfra.h>
+
+#ifndef CYGINT_ISO_PTHREAD_IMPL
+# define NA_MSG "POSIX threads needed to run test"
+#elif !defined CYGPKG_NET
+# define NA_MSG "NET package needed to run test"
+#elif !defined CYGPKG_POSIX_SIGNALS
+# define NA_MSG "POSIX signals package needed to run test"
+#endif
+
+#include <cyg/infra/testcase.h>
+
+#ifndef NA_MSG
+
#include <pkgconf/hal.h>
#include <pkgconf/kernel.h>
#include <pkgconf/io_fileio.h>
@@ -66,8 +81,6 @@
#include <cyg/infra/testcase.h>
-#if defined(CYGPKG_NET) && defined(CYGPKG_POSIX)
-
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>