public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/2, newlib] Prefix consistenly target-independent locks with __
@ 2017-01-24 16:05 Thomas Preudhomme
  2017-01-25 11:39 ` Corinna Vinschen
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Preudhomme @ 2017-01-24 16:05 UTC (permalink / raw)
  To: newlib

[-- Attachment #1: Type: text/plain, Size: 512 bytes --]

Hi,

With the patch to allow newlib's locking routine to be retargeted currently 
under discussion, we need to start thinking of locks as part of newlib's ABI 
since newlib depends on specific names being provided by the OS. This patch 
renames 2 locks so that they follow the same naming convention as other locks. 
It needs to be applied before the retargeting patch, while locks are still an 
internal consideration.

Newlib builds successfully with this change.

Ok for master branch?

Best regards,

Thomas

[-- Attachment #2: consistent_target_independent_locks.patch --]
[-- Type: text/x-patch, Size: 2779 bytes --]

diff --git a/newlib/libc/posix/telldir.c b/newlib/libc/posix/telldir.c
index caac4890bb504c7c515bf6f288fc33e7a255ddde..d4cf4a8c157b78d7c51f1ed2916ebd6e176bb39f 100644
--- a/newlib/libc/posix/telldir.c
+++ b/newlib/libc/posix/telldir.c
@@ -71,7 +71,7 @@ static long	dd_loccnt = 1;	/* Index of entry for sequential readdir's */
 static struct	ddloc *dd_hash[NDIRHASH];   /* Hash list heads for ddlocs */
 
 #ifdef HAVE_DD_LOCK
-__LOCK_INIT(static, dd_hash_lock);
+__LOCK_INIT(static, __dd_hash_lock);
 #endif
 
 /*
@@ -92,7 +92,7 @@ _DEFUN(telldir, (dirp),
 
 #ifdef HAVE_DD_LOCK
 	__lock_acquire_recursive(dirp->dd_lock);
-	__lock_acquire(dd_hash_lock);
+	__lock_acquire(__dd_hash_lock);
 #endif
 	index = dd_loccnt++;
 	lp->loc_index = index;
@@ -102,7 +102,7 @@ _DEFUN(telldir, (dirp),
 	lp->loc_next = dd_hash[LOCHASH(index)];
 	dd_hash[LOCHASH(index)] = lp;
 #ifdef HAVE_DD_LOCK
-	__lock_release(dd_hash_lock);
+	__lock_release(__dd_hash_lock);
 	__lock_release_recursive(dirp->dd_lock);
 #endif
 	return (index);
@@ -124,7 +124,7 @@ _DEFUN(_seekdir, (dirp, loc),
 	struct dirent *dp;
 
 #ifdef HAVE_DD_LOCK
-	__lock_acquire(dd_hash_lock);
+	__lock_acquire(__dd_hash_lock);
 #endif
 	if (loc != 0) {
 		prevlp = &dd_hash[LOCHASH(loc)];
@@ -137,7 +137,7 @@ _DEFUN(_seekdir, (dirp, loc),
 		}
 		if (lp == NULL) {
 #ifdef HAVE_DD_LOCK
-			__lock_release(dd_hash_lock);
+			__lock_release(__dd_hash_lock);
 #endif
 			return;
 		}
@@ -163,7 +163,7 @@ found:
 		dirp->dd_loc = 0;
 	}
 #ifdef HAVE_DD_LOCK
-	__lock_release(dd_hash_lock);
+	__lock_release(__dd_hash_lock);
 #endif
 }
 
@@ -175,7 +175,7 @@ _DEFUN(_cleanupdir, (dirp),
 	int i;
 
 #ifdef HAVE_DD_LOCK
-	__lock_acquire(dd_hash_lock);
+	__lock_acquire(__dd_hash_lock);
 #endif
 	for (i = 0; i < NDIRHASH; ++i) {
 		struct ddloc head;
@@ -200,7 +200,7 @@ _DEFUN(_cleanupdir, (dirp),
 		dd_hash[i] = head.loc_next;
 	}
 #ifdef HAVE_DD_LOCK
-	__lock_release(dd_hash_lock);
+	__lock_release(__dd_hash_lock);
 #endif
 
 }
diff --git a/newlib/libc/stdlib/quick_exit.c b/newlib/libc/stdlib/quick_exit.c
index 1d6fb231e138e7181520e0b1d4cc90fbf497ea52..34f41b737ad410badc4e42bbe1b723913c961dc7 100644
--- a/newlib/libc/stdlib/quick_exit.c
+++ b/newlib/libc/stdlib/quick_exit.c
@@ -44,7 +44,7 @@ struct quick_exit_handler {
 /**
  * Lock protecting the handlers list.
  */
-__LOCK_INIT(static, atexit_mutex);
+__LOCK_INIT(static, __atexit_mutex);
 /**
  * Stack of cleanup handlers.  These will be invoked in reverse order when
  */
@@ -60,10 +60,10 @@ at_quick_exit(void (*func)(void))
 	if (NULL == h)
 		return (1);
 	h->cleanup = func;
-	__lock_acquire(atexit_mutex);
+	__lock_acquire(__atexit_mutex);
 	h->next = handlers;
 	handlers = h;
-	__lock_release(atexit_mutex);
+	__lock_release(__atexit_mutex);
 	return (0);
 }
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/2, newlib] Prefix consistenly target-independent locks with __
  2017-01-24 16:05 [PATCH 1/2, newlib] Prefix consistenly target-independent locks with __ Thomas Preudhomme
@ 2017-01-25 11:39 ` Corinna Vinschen
  0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2017-01-25 11:39 UTC (permalink / raw)
  To: newlib

[-- Attachment #1: Type: text/plain, Size: 647 bytes --]

On Jan 24 16:05, Thomas Preudhomme wrote:
> Hi,
> 
> With the patch to allow newlib's locking routine to be retargeted currently
> under discussion, we need to start thinking of locks as part of newlib's ABI
> since newlib depends on specific names being provided by the OS. This patch
> renames 2 locks so that they follow the same naming convention as other
> locks. It needs to be applied before the retargeting patch, while locks are
> still an internal consideration.
> 
> Newlib builds successfully with this change.
> 
> Ok for master branch?

Pushed.

Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-25 11:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-24 16:05 [PATCH 1/2, newlib] Prefix consistenly target-independent locks with __ Thomas Preudhomme
2017-01-25 11:39 ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).