This is the mail archive of the
ecos-patches@sourceware.org
mailing list for the eCos project.
[PATCH] move cyg_posix_function_start() and _finish() from misc.cxx to pthread.cxx
- From: Alexander Neundorf <neundorf at kde dot org>
- To: ecos-patches at ecos dot sourceware dot org
- Date: Wed, 26 Oct 2005 21:22:09 +0200
- Subject: [PATCH] move cyg_posix_function_start() and _finish() from misc.cxx to pthread.cxx
- Reply-to: neundorf at kde dot org
Hi,
the functions cyg_posix_function_start() and _finish() from
compat/posix/current/src/misc.cxx deal with ASR handling and nothing else.
From checking the eCos code it seems the only two files which use ASRs are
pthread.cxx and signal.cxx in the POSIX package.
So IMO cyg_posix_function_start() and _finish() should be moved to
pthread.cxx, so that they are only compiled and used if they are actually
required. The attached patch does this and adjusts stdio and fileio
accordingly.
What do you think about this ?
Bye
Alex
--
Work: alexander.neundorf@jenoptik.com - http://www.jenoptik-los.de
Home: neundorf@kde.org - http://www.kde.org
alex@neundorf.net - http://www.neundorf.net
Index: compat/posix/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/compat/posix/current/ChangeLog,v
retrieving revision 1.49
diff -b -u -p -r1.49 ChangeLog
--- compat/posix/current/ChangeLog 23 Oct 2005 20:44:35 -0000 1.49
+++ compat/posix/current/ChangeLog 26 Oct 2005 19:10:09 -0000
@@ -1,3 +1,7 @@
+2005-10-26 Alexander Neundorf <neundorf@kde.org>
+ * src/misc.cxx, pthread.cxx: move cyg_posix_function_start() and
+ cyg_posix_function_finish() from misc.cxx to pthread.cxx
+
2005-10-23 Andrew Lunn <andrew.lunn@ascom.ch>
2005-10-18 Alexander Neundorf <neundorf@kde.org>
Index: compat/posix/current/include/export.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/compat/posix/current/include/export.h,v
retrieving revision 1.5
diff -b -u -p -r1.5 export.h
--- compat/posix/current/include/export.h 19 Mar 2003 14:17:23 -0000 1.5
+++ compat/posix/current/include/export.h 26 Oct 2005 19:10:09 -0000
@@ -78,6 +78,8 @@
#include <sched.h> // SCHED_*
+#ifdef CYGPKG_POSIX_PTHREAD
+
//=============================================================================
// POSIX API function management.
// These macros should be inserted near the start and all returns of
@@ -109,6 +111,8 @@ __externC void cyg_posix_deliver_signals
#define CYG_POSIX_DELIVER_SIGNALS cyg_posix_deliver_signals
#endif
+#endif //ifdef CYGPKG_POSIX_PTHREAD
+
//-----------------------------------------------------------------------------
#endif // ifndef CYGONCE_POSIX_EXPORT_H
// End of export.h
Index: compat/posix/current/src/misc.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/compat/posix/current/src/misc.cxx,v
retrieving revision 1.7
diff -b -u -p -r1.7 misc.cxx
--- compat/posix/current/src/misc.cxx 23 Oct 2005 20:44:36 -0000 1.7
+++ compat/posix/current/src/misc.cxx 26 Oct 2005 19:10:09 -0000
@@ -356,36 +356,6 @@ __externC pid_t getpgrp ( void ) { ret
__externC pid_t setsid ( void ) { errno = EPERM; return -1; }
__externC int setpgid ( pid_t pid, pid_t pgid ) { errno = ENOSYS; return -1; }
-//==========================================================================
-// Exports to other packages
-
-// -------------------------------------------------------------------------
-// POSIX API function entry
-
-__externC void cyg_posix_function_start()
-{
- Cyg_Thread *self = Cyg_Scheduler::get_current_thread();
-
- // Inhibit ASR delivery in this function until it returns.
-
- self->set_asr_inhibit();
-}
-
-// -------------------------------------------------------------------------
-
-__externC void cyg_posix_function_finish()
-{
- Cyg_Thread *self = Cyg_Scheduler::get_current_thread();
-
- // Re-allow ASR delivery.
-
- self->clear_asr_inhibit();
-
- // After clearing the inhibit flag, blip the scheduler lock
- // to get any pending ASRs delivered.
- Cyg_Scheduler::lock();
- Cyg_Scheduler::unlock();
-}
// -------------------------------------------------------------------------
// EOF misc.cxx
Index: compat/posix/current/src/pthread.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/compat/posix/current/src/pthread.cxx,v
retrieving revision 1.14
diff -b -u -p -r1.14 pthread.cxx
--- compat/posix/current/src/pthread.cxx 21 Nov 2003 10:53:11 -0000 1.14
+++ compat/posix/current/src/pthread.cxx 26 Oct 2005 19:10:09 -0000
@@ -227,6 +227,38 @@ static __inline__ void pthread_free( CYG
#endif
+//==========================================================================
+// Exports to other packages
+
+// -------------------------------------------------------------------------
+// POSIX API function entry
+
+__externC void cyg_posix_function_start()
+{
+ Cyg_Thread *self = Cyg_Scheduler::get_current_thread();
+
+ // Inhibit ASR delivery in this function until it returns.
+
+ self->set_asr_inhibit();
+}
+
+// -------------------------------------------------------------------------
+
+__externC void cyg_posix_function_finish()
+{
+ Cyg_Thread *self = Cyg_Scheduler::get_current_thread();
+
+ // Re-allow ASR delivery.
+
+ self->clear_asr_inhibit();
+
+ // After clearing the inhibit flag, blip the scheduler lock
+ // to get any pending ASRs delivered.
+ Cyg_Scheduler::lock();
+ Cyg_Scheduler::unlock();
+}
+
+
//-----------------------------------------------------------------------------
// pthread entry function.
// does some housekeeping and then calls the user's start routine.
Index: io/fileio/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/fileio/current/ChangeLog,v
retrieving revision 1.61
diff -b -u -p -r1.61 ChangeLog
--- io/fileio/current/ChangeLog 23 Oct 2005 20:45:11 -0000 1.61
+++ io/fileio/current/ChangeLog 26 Oct 2005 19:10:10 -0000
@@ -1,3 +1,7 @@
+2005-10-26 Alexander Neundorf <neundorf@kde.org>
+ * src/fio.h: use CYG_POSIX_FUNCTION_START/FINISH
+ only #ifdef CYGPKG_POSIX_PTHREAD instead of #ifdef CYGPKG_POSIX
+
2005-10-20 Andrew Lunn <andrew.lunn@ascom.ch>
* src/select.cxx: Needs sys/time.h for struct timeval.
Index: io/fileio/current/src/fio.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/io/fileio/current/src/fio.h,v
retrieving revision 1.12
diff -b -u -p -r1.12 fio.h
--- io/fileio/current/src/fio.h 22 Jan 2005 14:03:37 -0000 1.12
+++ io/fileio/current/src/fio.h 26 Oct 2005 19:10:10 -0000
@@ -91,7 +91,8 @@
//=============================================================================
// POSIX API support
-#ifdef CYGPKG_POSIX
+#ifdef CYGPKG_POSIX_PTHREAD
+
#include <pkgconf/posix.h>
#include <cyg/posix/export.h>
Index: language/c/libc/stdio/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/ChangeLog,v
retrieving revision 1.36
diff -b -u -p -r1.36 ChangeLog
--- language/c/libc/stdio/current/ChangeLog 30 Jul 2005 11:44:01 -0000 1.36
+++ language/c/libc/stdio/current/ChangeLog 26 Oct 2005 19:10:11 -0000
@@ -1,3 +1,7 @@
+2005-10-26 Alexander Neundorf <neundorf@kde.org>
+ * src/common/fileops.cxx: use CYG_POSIX_FUNCTION_START/FINISH
+ only #ifdef CYGPKG_POSIX_PTHREAD instead of #ifdef CYGPKG_POSIX
+
2005-07-22 Andrew Lunn <andrew.lunn@ascom.ch>
* src/common/fopen.cxx (fopen): Default the open mode to Read
Index: language/c/libc/stdio/current/src/common/fileops.cxx
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/src/common/fileops.cxx,v
retrieving revision 1.2
diff -b -u -p -r1.2 fileops.cxx
--- language/c/libc/stdio/current/src/common/fileops.cxx 15 Mar 2004 16:31:58 -0000 1.2
+++ language/c/libc/stdio/current/src/common/fileops.cxx 26 Oct 2005 19:10:11 -0000
@@ -77,7 +77,7 @@
// DEFINES
-#ifdef CYGPKG_POSIX
+#ifdef CYGPKG_POSIX_PTHREAD
# define CYG_STDIO_FUNCTION_START() CYG_POSIX_FUNCTION_START()
# define CYG_STDIO_FUNCTION_FINISH() CYG_POSIX_FUNCTION_FINISH()
#else