Date: Sun, 8 Feb 2015 21:58:26 +0000 (UTC) From: Jilles Tjoelker <jilles@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r278410 - stable/10/lib/libc/gen Message-ID: <201502082158.t18LwQb3028196@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jilles Date: Sun Feb 8 21:58:25 2015 New Revision: 278410 URL: https://svnweb.freebsd.org/changeset/base/278410 Log: MFC r277862: sem_post(): Fix and document semaphore value overflow error. The error code is per Austin Group issue #315. I provided different wording for the manual page change. Submitted by: pluknet Modified: stable/10/lib/libc/gen/sem_new.c stable/10/lib/libc/gen/sem_post.3 Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/gen/sem_new.c ============================================================================== --- stable/10/lib/libc/gen/sem_new.c Sun Feb 8 21:49:29 2015 (r278409) +++ stable/10/lib/libc/gen/sem_new.c Sun Feb 8 21:58:25 2015 (r278410) @@ -439,8 +439,10 @@ _sem_post(sem_t *sem) do { count = sem->_kern._count; - if (count + 1 > SEM_VALUE_MAX) - return (EOVERFLOW); + if (count + 1 > SEM_VALUE_MAX) { + errno = EOVERFLOW; + return (-1); + } } while(!atomic_cmpset_rel_int(&sem->_kern._count, count, count+1)); (void)usem_wake(&sem->_kern); return (0); Modified: stable/10/lib/libc/gen/sem_post.3 ============================================================================== --- stable/10/lib/libc/gen/sem_post.3 Sun Feb 8 21:49:29 2015 (r278409) +++ stable/10/lib/libc/gen/sem_post.3 Sun Feb 8 21:58:25 2015 (r278410) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 15, 2000 +.Dd January 28, 2015 .Dt SEM_POST 3 .Os .Sh NAME @@ -65,6 +65,9 @@ The .Fa sem argument points to an invalid semaphore. +.It Bq Er EOVERFLOW +The semaphore value would exceed +.Dv SEM_VALUE_MAX . .El .Sh SEE ALSO .Xr sem_getvalue 3 ,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502082158.t18LwQb3028196>