Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 May 2017 07:51:36 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r317895 - stable/11/lib/libc/gen
Message-ID:  <201705070751.v477paIX016253@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Sun May  7 07:51:36 2017
New Revision: 317895
URL: https://svnweb.freebsd.org/changeset/base/317895

Log:
  MFC r317606:
  Style.

Modified:
  stable/11/lib/libc/gen/sem_new.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/gen/sem_new.c
==============================================================================
--- stable/11/lib/libc/gen/sem_new.c	Sun May  7 01:31:42 2017	(r317894)
+++ stable/11/lib/libc/gen/sem_new.c	Sun May  7 07:51:36 2017	(r317895)
@@ -77,24 +77,26 @@ struct sem_nameinfo {
 
 static pthread_once_t once = PTHREAD_ONCE_INIT;
 static pthread_mutex_t sem_llock;
-static LIST_HEAD(,sem_nameinfo) sem_list = LIST_HEAD_INITIALIZER(sem_list);
+static LIST_HEAD(, sem_nameinfo) sem_list = LIST_HEAD_INITIALIZER(sem_list);
 
 static void
-sem_prefork()
+sem_prefork(void)
 {
 	
 	_pthread_mutex_lock(&sem_llock);
 }
 
 static void
-sem_postfork()
+sem_postfork(void)
 {
+
 	_pthread_mutex_unlock(&sem_llock);
 }
 
 static void
-sem_child_postfork()
+sem_child_postfork(void)
 {
+
 	_pthread_mutex_unlock(&sem_llock);
 }
 
@@ -116,10 +118,8 @@ sem_check_validity(sem_t *sem)
 
 	if (sem->_magic == SEM_MAGIC)
 		return (0);
-	else {
-		errno = EINVAL;
-		return (-1);
-	}
+	errno = EINVAL;
+	return (-1);
 }
 
 int
@@ -142,13 +142,16 @@ sem_t *
 _sem_open(const char *name, int flags, ...)
 {
 	char path[PATH_MAX];
-
 	struct stat sb;
 	va_list ap;
-	struct sem_nameinfo *ni = NULL;
-	sem_t *sem = NULL;
-	int fd = -1, mode, len, errsave;
-	int value = 0;
+	struct sem_nameinfo *ni;
+	sem_t *sem, tmp;
+	int errsave, fd, len, mode, value;
+
+	ni = NULL;
+	sem = NULL;
+	fd = -1;
+	value = 0;
 
 	if (name[0] != '/') {
 		errno = EINVAL;
@@ -213,8 +216,6 @@ _sem_open(const char *name, int flags, .
 			goto error;
 	}
 	if (sb.st_size < sizeof(sem_t)) {
-		sem_t tmp;
-
 		tmp._magic = SEM_MAGIC;
 		tmp._kern._count = value;
 		tmp._kern._flags = USYNC_PROCESS_SHARED | SEM_NAMED;
@@ -222,8 +223,8 @@ _sem_open(const char *name, int flags, .
 			goto error;
 	}
 	flock(fd, LOCK_UN);
-	sem = (sem_t *)mmap(NULL, sizeof(sem_t), PROT_READ|PROT_WRITE,
-		MAP_SHARED|MAP_NOSYNC, fd, 0);
+	sem = mmap(NULL, sizeof(sem_t), PROT_READ | PROT_WRITE,
+	    MAP_SHARED | MAP_NOSYNC, fd, 0);
 	if (sem == MAP_FAILED) {
 		sem = NULL;
 		if (errno == ENOMEM)
@@ -277,12 +278,11 @@ _sem_close(sem_t *sem)
 				_pthread_mutex_unlock(&sem_llock);
 				return (0);
 			}
-			else
-				break;
+			break;
 		}
 	}
 
-	if (ni) {
+	if (ni != NULL) {
 		LIST_REMOVE(ni, next);
 		_pthread_mutex_unlock(&sem_llock);
 		munmap(sem, sizeof(*sem));
@@ -342,7 +342,8 @@ _sem_getvalue(sem_t * __restrict sem, in
 static __inline int
 usem_wake(struct _usem2 *sem)
 {
-	return _umtx_op(sem, UMTX_OP_SEM2_WAKE, 0, NULL, NULL);
+
+	return (_umtx_op(sem, UMTX_OP_SEM2_WAKE, 0, NULL, NULL));
 }
 
 static __inline int
@@ -436,6 +437,7 @@ int
 _sem_timedwait(sem_t * __restrict sem,
 	const struct timespec * __restrict abstime)
 {
+
 	return (_sem_clockwait_np(sem, CLOCK_REALTIME, TIMER_ABSTIME, abstime,
 	    NULL));
 };
@@ -443,7 +445,8 @@ _sem_timedwait(sem_t * __restrict sem,
 int
 _sem_wait(sem_t *sem)
 {
-	return _sem_timedwait(sem, NULL);
+
+	return (_sem_timedwait(sem, NULL));
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201705070751.v477paIX016253>