All of lore.kernel.org
 help / color / mirror / Atom feed
From: enh <enh@google.com>
To: ltp@lists.linux.it
Subject: [LTP] [RFC PATCH 3/6] android: Add pty.h header
Date: Tue, 5 Sep 2017 12:09:45 -0700	[thread overview]
Message-ID: <CAJgzZopCb7WCgdDWN0LwBucUFqoxwiP6hDXsd_EFhQGBsr_hzg@mail.gmail.com> (raw)
In-Reply-To: <20170902005926.15923-4-petr.vorel@gmail.com>

this seems very wrong. if you're going to do something like this, i
think you should at least use __has_include_next and #include_next to
get the real header if it exists and only supply your own if not. (but
i'm not really sure what you're gaining here. you're turning a
compile-time failure on old API levels into a link-time failure? and
who exactly is running these tests on old versions of Android that
they can't change anyway?)

On Fri, Sep 1, 2017 at 5:59 PM, Petr Vorel <petr.vorel@gmail.com> wrote:
> Taken from Bionic, modified.
>
> Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
> ---
> I needed to add #include "versioning.h".
> I was tempted to use check
> #if defined(__ANDROID_API__) && __ANDROID_API__ >= 23
> instead of macro __INTRODUCED_IN(X) which causes warnings, but smaller delta won.
> ---
>  include/android/pty.h        | 46 ++++++++++++++++++++++++++++++++++++++++++++
>  include/android/versioning.h | 32 ++++++++++++++++++++++++++++++
>  2 files changed, 78 insertions(+)
>  create mode 100644 include/android/pty.h
>  create mode 100644 include/android/versioning.h
>
> diff --git a/include/android/pty.h b/include/android/pty.h
> new file mode 100644
> index 000000000..dbcaad225
> --- /dev/null
> +++ b/include/android/pty.h
> @@ -0,0 +1,46 @@
> +/*
> + * Copyright (C) 2014 The Android Open Source Project
> + * All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + *  * Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + *  * Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in
> + *    the documentation and/or other materials provided with the
> + *    distribution.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
> + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
> + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
> + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
> + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
> + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
> + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> + * SUCH DAMAGE.
> + */
> +
> +#ifndef _PTY_H
> +#define _PTY_H
> +
> +#include <sys/cdefs.h>
> +
> +#include <termios.h>
> +#include <sys/ioctl.h>
> +
> +#include "versioning.h"
> +
> +__BEGIN_DECLS
> +
> +int openpty(int* __master_fd, int* __slave_fd, char* __slave_name, const struct termios* __termios_ptr, const struct winsize* __winsize_ptr) __INTRODUCED_IN(23);
> +int forkpty(int* __master_fd, char* __slave_name, const struct termios* __termios_ptr, const struct winsize* __winsize_ptr) __INTRODUCED_IN(23);
> +
> +__END_DECLS
> +
> +#endif
> diff --git a/include/android/versioning.h b/include/android/versioning.h
> new file mode 100644
> index 000000000..4e1a1854c
> --- /dev/null
> +++ b/include/android/versioning.h
> @@ -0,0 +1,32 @@
> +/*
> + * Copyright (C) 2016 The Android Open Source Project
> + *
> + * Licensed under the Apache License, Version 2.0 (the "License");
> + * you may not use this file except in compliance with the License.
> + * You may obtain a copy of the License at
> + *
> + *      http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +
> +#ifndef ANDROID_VERSIONING_H
> +#define ANDROID_VERSIONING_H
> +
> +#define __INTRODUCED_IN(api_level) __attribute__((annotate("introduced_in=" #api_level)))
> +#define __INTRODUCED_IN_FUTURE __attribute__((annotate("introduced_in_future")))
> +#define __DEPRECATED_IN(api_level) __attribute__((annotate("deprecated_in=" #api_level)))
> +#define __REMOVED_IN(api_level) __attribute__((annotate("obsoleted_in=" #api_level)))
> +#define __INTRODUCED_IN_32(api_level) __attribute__((annotate("introduced_in_32=" #api_level)))
> +#define __INTRODUCED_IN_64(api_level) __attribute__((annotate("introduced_in_64=" #api_level)))
> +#define __INTRODUCED_IN_ARM(api_level) __attribute__((annotate("introduced_in_arm=" #api_level)))
> +#define __INTRODUCED_IN_X86(api_level) __attribute__((annotate("introduced_in_x86=" #api_level)))
> +#define __INTRODUCED_IN_MIPS(api_level) __attribute__((annotate("introduced_in_mips=" #api_level)))
> +
> +#define __VERSIONER_NO_GUARD __attribute__((annotate("versioner_no_guard")))
> +
> +#endif /* ANDROID_VERSIONING_H */
> --
> 2.14.0
>



-- 
Elliott Hughes - http://who/enh - http://jessies.org/~enh/
Android native code/tools questions? Mail me/drop by/add me as a reviewer.

  reply	other threads:[~2017-09-05 19:09 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-02  0:59 [LTP] [RFC PATCH 0/6] cve: fixes for Android Petr Vorel
2017-09-02  0:59 ` [LTP] [RFC PATCH 1/6] android: cve: Disable building cve-2017-5669 Petr Vorel
2017-09-05 17:47   ` enh
2017-09-05 21:30   ` Sandeep Patil
2017-09-06 13:17     ` Cyril Hrubis
2017-09-11 21:41     ` Petr Vorel
2017-09-12 18:21       ` enh
2017-09-12 21:27         ` Petr Vorel
2017-09-12 23:58           ` enh
2017-09-19 23:46             ` Sandeep Patil
2017-09-02  0:59 ` [LTP] [RFC PATCH 2/6] android: lib: Add missing include for tst_safe_pthread.h Petr Vorel
2017-09-05 19:07   ` enh
2017-09-02  0:59 ` [LTP] [RFC PATCH 3/6] android: Add pty.h header Petr Vorel
2017-09-05 19:09   ` enh [this message]
2017-09-02  0:59 ` [LTP] [RFC PATCH 4/6] android: cve: Fix build of most of the tests Petr Vorel
2017-09-06 13:20   ` Cyril Hrubis
2017-09-02  0:59 ` [LTP] [RFC PATCH 5/6] android: cve/stack_clash: Fix PAGE_MASK defined in <sys/user.h> Petr Vorel
2017-09-06 13:34   ` Cyril Hrubis
2017-09-02  0:59 ` [LTP] [RFC PATCH 6/6] android: cve/stack_clash: Fix warning Petr Vorel
2017-09-06 13:21   ` Cyril Hrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJgzZopCb7WCgdDWN0LwBucUFqoxwiP6hDXsd_EFhQGBsr_hzg@mail.gmail.com \
    --to=enh@google.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.