From patchwork Mon Feb 10 01:05:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1235586 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-109341-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha1 header.s=default header.b=VYLSlwas; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48G75J3hFYz9sRR for ; Mon, 10 Feb 2020 12:06:12 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; q=dns; s= default; b=URM12mKJFUjP4Omx1duZEoXMqD9uBA6iyKGUQuNKHcey2MDfCbA6A KMuyx8qxLDqNXg1i5F1HPA45LdjT/yrdwt8Zs6fMGjaVEpeclu4AD/nfEkZ/4Afr DXn8Fsfh+184ZYFhDAStJAhPkqQN5/3bf/D00QLQGY4++ZaIdi7EhE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; s=default; bh=ZOeE5sGqykW/vEiKui+sVwblwnw=; b=VYLSlwasELTjexpDjTBvlEs5gPil qonEUxTbcEh5w5hLWhmF2zP7whaPnZ9GWbvxZK0X1kbP2iKRacwMhLvYgDDfYSRG aChdBpo+veMQOCWtz+VEKDPv+59M5fCBRj5rXRRpdNesP9PG7/hkl91ZLdsTjMJW PfWuphnr8LQIU78= Received: (qmail 96530 invoked by alias); 10 Feb 2020 01:05:22 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 96397 invoked by uid 89); 10 Feb 2020 01:05:21 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_NEUTRAL autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1028, HContent-Transfer-Encoding:8bit X-HELO: hera.aquilenet.fr From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Samuel Thibault , commit-hurd@gnu.org Subject: [hurd,commited 05/10] htl: Add support for semaphore maximum value Date: Mon, 10 Feb 2020 02:05:03 +0100 Message-Id: <20200210010508.428251-5-samuel.thibault@ens-lyon.org> In-Reply-To: <20200210010508.428251-1-samuel.thibault@ens-lyon.org> References: <20200210010508.428251-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 --- sysdeps/htl/sem-post.c | 7 +++++++ sysdeps/mach/hurd/bits/local_lim.h | 3 +++ 2 files changed, 10 insertions(+) diff --git a/sysdeps/htl/sem-post.c b/sysdeps/htl/sem-post.c index 77f297314e..2e0be8fc49 100644 --- a/sysdeps/htl/sem-post.c +++ b/sysdeps/htl/sem-post.c @@ -30,6 +30,13 @@ __sem_post (sem_t *sem) if (sem->__value > 0) /* Do a quick up. */ { + if (sem->__value == SEM_VALUE_MAX) + { + __pthread_spin_unlock (&sem->__lock); + errno = EOVERFLOW; + return -1; + } + assert (sem->__queue == NULL); sem->__value++; __pthread_spin_unlock (&sem->__lock); diff --git a/sysdeps/mach/hurd/bits/local_lim.h b/sysdeps/mach/hurd/bits/local_lim.h index 348eee74bb..8e781e4965 100644 --- a/sysdeps/mach/hurd/bits/local_lim.h +++ b/sysdeps/mach/hurd/bits/local_lim.h @@ -41,3 +41,6 @@ /* The number of threads per process. */ #define _POSIX_THREAD_THREADS_MAX 64 + +/* Maximum value the semaphore can have. */ +#define SEM_VALUE_MAX (2147483647)