From: "Metzger, Markus T" <markus.t.metzger@intel.com>
To: Yao Qi <qiyaoltc@gmail.com>
Cc: GDB Patches <gdb-patches@sourceware.org>
Subject: RE: [PATCH v2 1/7] common: add scoped_fd
Date: Tue, 13 Feb 2018 17:28:00 -0000 [thread overview]
Message-ID: <A78C989F6D9628469189715575E55B2369647D3E@IRSMSX104.ger.corp.intel.com> (raw)
In-Reply-To: <CAH=s-PMr4qeZ3JodCAtQy_Xh53pwHLEkf-7u2t8wWgj8NnU0Ag@mail.gmail.com>
Hello Yao,
> There is no such error with i686-w64-mingw32-g++ 5.3.1. Can we use "open"
> instead?
A fixed filename works most of the time but I'd rather use a temporary file if possible.
> > +/* Test that the file descriptor is closed. */ static void
> > +test_destroy () {
> > + char filename[] = "scoped_fd-selftest-XXXXXX";
> > + int fd = mkstemp (filename);
> > + SELF_CHECK (fd >= 0);
>
> Hi Markus,
> I failed to build this file with i686-w64-mingw32-g++ 4.8.2, shipped in Ubuntu
> 14.04.
>
> gdb/unittests/scoped_fd-selftests.c:37:29: error: ‘mkstemp’ was not declared in
> this scope
> int fd = mkstemp (filename);
> ^
This is supposed to be a glibc function. But it is guarded by some feature macros.
Quote from mkstemp(3): "
mkstemp():
_BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 500 || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
|| /* Since glibc 2.12: */ _POSIX_C_SOURCE >= 200112L
mkostemp(): _GNU_SOURCE
mkstemps(): _BSD_SOURCE || _SVID_SOURCE
mkostemps(): _GNU_SOURCE
"
Maybe the newer compiler is setting some macros automatically that the older compiler doesn't set.
Could you try setting, say, _POSIX_C_SOURCE or try using mkostemp() instead of mkstemp()?
If that doesn't help, I'll try to find a Ubuntu 14.04 to reproduce the issue.
thanks,
Markus.
> -----Original Message-----
> From: Yao Qi [mailto:qiyaoltc@gmail.com]
> Sent: 13 February 2018 17:48
> To: Metzger, Markus T <markus.t.metzger@intel.com>
> Cc: GDB Patches <gdb-patches@sourceware.org>
> Subject: Re: [PATCH v2 1/7] common: add scoped_fd
>
> On Fri, Jan 26, 2018 at 2:14 PM, Markus Metzger <markus.t.metzger@intel.com>
> wrote:
> > +
> > +/* Test that the file descriptor is closed. */ static void
> > +test_destroy () {
> > + char filename[] = "scoped_fd-selftest-XXXXXX";
> > + int fd = mkstemp (filename);
> > + SELF_CHECK (fd >= 0);
>
> Hi Markus,
> I failed to build this file with i686-w64-mingw32-g++ 4.8.2, shipped in Ubuntu
> 14.04.
>
> gdb/unittests/scoped_fd-selftests.c:37:29: error: ‘mkstemp’ was not declared in
> this scope
> int fd = mkstemp (filename);
> ^
> gdb/unittests/scoped_fd-selftests.c: In function ‘void
> selftests::scoped_fd::test_release()’:
> gdb/unittests/scoped_fd-selftests.c:56:29: error: ‘mkstemp’ was not declared in
> this scope
> int fd = mkstemp (filename);
> ^
>
> There is no such error with i686-w64-mingw32-g++ 5.3.1. Can we use "open"
> instead?
>
> --
> Yao (齐尧)
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
next prev parent reply other threads:[~2018-02-13 17:28 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-26 14:14 [PATCH v2 0/7] improve btrace enable error reporting Markus Metzger
2018-01-26 14:14 ` [PATCH v2 1/7] common: add scoped_fd Markus Metzger
2018-02-13 16:48 ` Yao Qi
2018-02-13 17:28 ` Metzger, Markus T [this message]
2018-02-14 15:22 ` Yao Qi
2018-02-14 17:26 ` Metzger, Markus T
2018-02-19 15:28 ` Metzger, Markus T
2018-02-20 10:12 ` Yao Qi
2018-02-20 10:46 ` Metzger, Markus T
2018-01-26 14:14 ` [PATCH v2 3/7] btrace: prepare for throwing exceptions when enabling btrace Markus Metzger
2018-01-26 14:14 ` [PATCH v2 5/7] btrace, gdbserver: remove the to_supports_btrace target method Markus Metzger
2018-02-24 16:51 ` Maciej W. Rozycki
2018-02-26 13:08 ` Metzger, Markus T
2018-02-26 19:30 ` Andreas Arnez
2018-02-26 21:58 ` Maciej W. Rozycki
2018-02-27 10:57 ` Metzger, Markus T
2018-02-27 15:32 ` Maciej W. Rozycki
2018-02-27 18:14 ` Metzger, Markus T
2018-02-28 10:29 ` Maciej W. Rozycki
2018-02-28 11:09 ` Maciej W. Rozycki
2018-02-28 11:24 ` Metzger, Markus T
2018-02-28 12:53 ` Metzger, Markus T
2018-02-28 15:55 ` Maciej W. Rozycki
2018-02-28 16:08 ` Eli Zaretskii
2018-02-28 12:00 ` Yao Qi
2018-02-28 16:27 ` Sergio Durigan Junior
2018-03-01 11:33 ` Metzger, Markus T
2018-03-01 19:27 ` Sergio Durigan Junior
2018-03-05 12:14 ` Yao Qi
[not found] ` <87lgf64i24.fsf@redhat.com>
2018-03-06 9:02 ` Yao Qi
2018-03-06 16:32 ` Sergio Durigan Junior
2018-03-01 19:34 ` Maciej W. Rozycki
2018-01-26 14:14 ` [PATCH v2 4/7] btrace, gdbserver: use exceptions to convey btrace enable/disable errors Markus Metzger
2018-01-26 14:14 ` [PATCH v2 6/7] btrace: improve enable error messages Markus Metzger
2018-01-26 14:14 ` [PATCH v2 2/7] common: add scoped_mmap Markus Metzger
2018-02-06 16:28 ` [PATCH v2 0/7] improve btrace enable error reporting Pedro Alves
2018-02-07 10:41 ` Metzger, Markus T
2018-02-07 12:11 ` Pedro Alves
2018-02-08 10:40 ` Metzger, Markus T
[not found] ` <9ce0c90a-5c71-0a7d-3779-f826369a95ec@redhat.com>
2018-02-08 13:49 ` Metzger, Markus T
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=A78C989F6D9628469189715575E55B2369647D3E@IRSMSX104.ger.corp.intel.com \
--to=markus.t.metzger@intel.com \
--cc=gdb-patches@sourceware.org \
--cc=qiyaoltc@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox