From patchwork Thu Dec 1 16:13:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Sherrill X-Patchwork-Id: 86096 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp766215qgi; Thu, 1 Dec 2016 08:13:46 -0800 (PST) X-Received: by 10.84.139.67 with SMTP id 61mr84289026plq.65.1480608826496; Thu, 01 Dec 2016 08:13:46 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id 2si696001pla.152.2016.12.01.08.13.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Dec 2016 08:13:46 -0800 (PST) Received-SPF: pass (google.com: domain of newlib-return-14182-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org; spf=pass (google.com: domain of newlib-return-14182-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=newlib-return-14182-patch=linaro.org@sourceware.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:from:subject:message-id:date:mime-version :content-type; q=dns; s=default; b=Tw+puUVeScqlXu2hpY+iu90LTGKKU H1OezoOREgjYsuf5huOB8bjZjB5RpxBZbJQKyx9qKaKCykTP6Vn6c3zI1403W3UO IkvniWhtDvjmRgq+SFWpQOJcV1OPlyCyowl7lk9if7PTwG0ckt626fA8cPB4V3lH +i6SnOrtQtC6wU= 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:to:from:subject:message-id:date:mime-version :content-type; s=default; bh=WrarNqZdGF3WRGa8bRJMdL/J1bY=; b=ELh DKK5l8luLuf7SXpQ8NPq+DJLgdjZcbYVPPB61gxweyJsmOeLmQa1YrwE6DHdBAfU gHLnMlQToJbKwOy2y+rSyMoqpIz6L/7et4ShnyPnK1V1Tileqy4FqlcJkYiPQR1O 2hAuVUJRkC+jKkf1ByGJfsu4RjFzVTo/rfHHxKWI= Received: (qmail 65030 invoked by alias); 1 Dec 2016 16:13:35 -0000 Mailing-List: contact newlib-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-owner@sourceware.org Delivered-To: mailing list newlib@sourceware.org Received: (qmail 64988 invoked by uid 89); 1 Dec 2016 16:13:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_20, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=4599, 1.8.3.1, 1831, Edition X-HELO: OARmail.OARCORP.com Received: from oarmail.oarcorp.com (HELO OARmail.OARCORP.com) (67.63.146.244) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 01 Dec 2016 16:13:24 +0000 Received: from [192.168.1.161] (192.168.1.161) by OARmail.OARCORP.com (192.168.2.2) with Microsoft SMTP Server (TLS) id 8.3.389.2; Thu, 1 Dec 2016 10:13:23 -0600 To: "newlib@sourceware.org" From: Joel Sherrill Subject: Adding POSIX 1003.26 posix_devctl() Message-ID: Date: Thu, 1 Dec 2016 10:13:22 -0600 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.0 MIME-Version: 1.0 Hi I am starting to add posix_devctl() support to RTEMS. The POSIX 1003.26 standard defines only this single method and the requirements boil down to the following: The posix_devctl() method is defined by POSIX 1003.26-2003. Aside from the single method, it adds the following requirements: 1. define _POSIX_26_VERSION to 200312L 2. add _SC_POSIX_26_VERSION in unistd.h. Return _POSIX_26_VERSION 3. application must define _POSIX_26_C_SOURCE to use posix_devctl(). 4. posix_devctl() is prototyped in 5. provide implementation of posix_devctl().:) Based on requirements 1,2 and 4, I think the new .h file and modifications to existing .h files need to be done in newlib. The implementation would go in RTEMS. I have attached an initial cut at the patch. I think it is close but it is untested. Comments and thoughts appreciated. Thanks. -- Joel Sherrill, Ph.D. Director of Research & Development joel.sherrill@OARcorp.com On-Line Applications Research Ask me about RTEMS: a free RTOS Huntsville AL 35806 Support Available (256) 722-9985 >From e3479d5680525c9db3d8a4e214ff135a1f527080 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 1 Dec 2016 09:46:32 -0600 Subject: [PATCH 2/2] Add per POSIX 1003.26-2003 --- newlib/libc/include/sys/features.h | 3 +++ newlib/libc/include/sys/unistd.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/newlib/libc/include/sys/features.h b/newlib/libc/include/sys/features.h index 93635ba..a23158c 100644 --- a/newlib/libc/include/sys/features.h +++ b/newlib/libc/include/sys/features.h @@ -366,6 +366,9 @@ extern "C" { /* UNIX98 added some new pthread mutex attributes */ #define _UNIX98_THREAD_MUTEX_ATTRIBUTES 1 +/* POSIX 1003.26-2003 defined device control method */ +#define _POSIX_26_VERSION 200312L + #endif /* XMK loosely adheres to POSIX -- 1003.1 */ diff --git a/newlib/libc/include/sys/unistd.h b/newlib/libc/include/sys/unistd.h index 143147d..1e273ff 100644 --- a/newlib/libc/include/sys/unistd.h +++ b/newlib/libc/include/sys/unistd.h @@ -459,6 +459,9 @@ int _EXFUN(unlinkat, (int, const char *, int)); #define _SC_LEVEL4_CACHE_SIZE 137 #define _SC_LEVEL4_CACHE_ASSOC 138 #define _SC_LEVEL4_CACHE_LINESIZE 139 +#ifdef _POSIX_26_VERSION +#define _SC_POSIX_26_VERSION 140 +#endif /* * pathconf values per IEEE Std 1003.1, 2008 Edition -- 1.8.3.1