mailing list of musl libc
 help / color / mirror / code / Atom feed
From: 程智星 <zhixing@nj.iscas.ac.cn>
To: musl@lists.openwall.com
Subject: [musl] Re: Re: On the redefinition of stdin, stdout, etc. in stdio. h
Date: Mon, 3 Jul 2023 08:37:17 +0800 (GMT+08:00)	[thread overview]
Message-ID: <266b8af9.3c84.189192eb083.Coremail.zhixing@nj.iscas.ac.cn> (raw)
In-Reply-To: <20230629092151.GA10969@openwall.com>

hi,friend:

I have a question to ask:

1. The stdin and stdout are redefined in the stdio. h file in the Musl source code, as follows:

extern FILE *const stdin;
extern FILE *const stdout;
extern FILE *const stderr;

#define stdin  (stdin)
#define stdout (stdout)
#define stderr (stderr)
but,In glibc, they are only redefined as themselves, as follows:

/* Standard streams.  */
extern FILE *stdin;             /* Standard input stream.  */
extern FILE *stdout;            /* Standard output stream.  */
extern FILE *stderr;            /* Standard error output stream.  */
/* C89/C99 say they're macros.  Make them happy.  */
#define stdin stdin
#define stdout stdout
#define stderr stderr
Based on what considerations we will make this change? 

2. Based on the above modifications, I will report the following errors when compiling packages such as lcr and lxc using Musl as the basic library for yocto embedded compilation:
 -o json/.libs/liblxc_la-json_common.o
| In file included from ../../../lxc-4.0.3/src/lxc/json/read-file.h:5,
|                  from ../../../lxc-4.0.3/src/lxc/json/defs.c:6:
| ../../../lxc-4.0.3/src/lxc/json/defs.c: In function 'make_defs_hook':
| ../../../lxc-4.0.3/src/lxc/json/defs.c:86:26: error: expected identifier before '(' token
|    86 |                 if (ctx-&gt;stderr &gt; 0)
|       |                          ^~~~~~
| ../../../lxc-4.0.3/src/lxc/json/defs.c:87:34: error: expected identifier before '(' token
|    87 |                     fprintf(ctx-&gt;stderr, "WARNING: unknown key found: %s\n", tree-&gt;u.object.keys[i]);
|       |                                  ^~~~~~
| ../../../lxc-4.0.3/src/lxc/json/defs.c:87:21: error: too few arguments to function 'fprintf'
|    87 |                     fprintf(ctx-&gt;stderr, "WARNING: unknown key found: %s\n", tree-&gt;u.object.keys[i]);
|       |                     ^~~~~~~
| In file included from ../../../lxc-4.0.3/src/lxc/json/read-file.h:5,
|                  from ../../../lxc-4.0.3/src/lxc/json/defs.c:6:


Is there a solution to this error report; I tried to synchronize their definitions in the Musl source code with those in Glibc, and there was no problem compiling images. Can it be modified to be consistent with glibc?



Looking forward to your reply!

       reply	other threads:[~2023-07-03  0:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1688024729.28262.ezmlm@lists.openwall.com>
     [not found] ` <20230629092151.GA10969@openwall.com>
2023-07-03  0:37   ` 程智星 [this message]
2023-07-03  2:30     ` Rich Felker

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=266b8af9.3c84.189192eb083.Coremail.zhixing@nj.iscas.ac.cn \
    --to=zhixing@nj.iscas.ac.cn \
    --cc=musl@lists.openwall.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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).