* Adding POSIX 1003.26 posix_devctl()
@ 2016-12-01 16:13 Joel Sherrill
2016-12-05 10:32 ` Corinna Vinschen
0 siblings, 1 reply; 2+ messages in thread
From: Joel Sherrill @ 2016-12-01 16:13 UTC (permalink / raw)
To: newlib
[-- Attachment #1: Type: text/plain, Size: 1092 bytes --]
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 <devctl.h>
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
[-- Attachment #2: 0002-Add-devctl.h-per-POSIX-1003.26-2003.patch --]
[-- Type: text/x-patch, Size: 1365 bytes --]
From e3479d5680525c9db3d8a4e214ff135a1f527080 Mon Sep 17 00:00:00 2001
From: Joel Sherrill <joel@rtems.org>
Date: Thu, 1 Dec 2016 09:46:32 -0600
Subject: [PATCH 2/2] Add <devctl.h> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Adding POSIX 1003.26 posix_devctl()
2016-12-01 16:13 Adding POSIX 1003.26 posix_devctl() Joel Sherrill
@ 2016-12-05 10:32 ` Corinna Vinschen
0 siblings, 0 replies; 2+ messages in thread
From: Corinna Vinschen @ 2016-12-05 10:32 UTC (permalink / raw)
To: newlib
[-- Attachment #1: Type: text/plain, Size: 1646 bytes --]
Hi Joel,
On Dec 1 10:13, Joel Sherrill wrote:
> 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 <devctl.h>
> 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.
One nit.
> --- 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
Do not #ifdef this definition. Just define it. It's either supported
by the implementation or not. We shopuld avoid different _SC_ macros
for different targets.
With that, please commit.
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:[~2016-12-05 10:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-01 16:13 Adding POSIX 1003.26 posix_devctl() Joel Sherrill
2016-12-05 10:32 ` 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).