mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: RTC_RD_TIME
Date: Tue, 29 Aug 2017 21:43:28 -0400	[thread overview]
Message-ID: <20170830014328.GB19925@brightrain.aerifal.cx> (raw)
In-Reply-To: <CAKpSnp+h=YwfNmfMTVCftMhUPEDt8RqeZQDVLVCMLeex9DXLSQ@mail.gmail.com>

On Tue, Aug 29, 2017 at 10:28:14PM +0100, Jorge Almeida wrote:
> A function to read the hardware clock (the battery powered thingy in
> the motherboard):
> 
> (man 4 rtc)
> 
> void read_hw(struct rtc_time* rtctime){
>    int rtcfd=open("/dev/rtc0" , O_RDONLY);
>    ioctl(rtcfd, RTC_RD_TIME, rtctime);
>    close(rtcfd);
> }
> 
> (error checking omitted)
> 
> The problem:
> warning: overflow in implicit constant conversion [-Woverflow]
> 
> (an arrow pointing to RTC_RD_TIME)
> 
> The same program compiles without warnings with glibc and dietlibc.

I don't know any good fix. The problem is that the glibc (and others')
ioctl function has a signature mismatching the standard one, with an
unsigned argument instead of signed, and the macro values are outside
the range of signed int. Fortunately the warning is harmless but
obviously it can impact builds with -Werror or policy about warnings..

Rich


  reply	other threads:[~2017-08-30  1:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-29 21:28 RTC_RD_TIME Jorge Almeida
2017-08-30  1:43 ` Rich Felker [this message]
2017-08-30  6:35   ` RTC_RD_TIME Jorge Almeida
2017-08-30 12:55   ` RTC_RD_TIME Alexander Monakov
2017-08-30 15:20     ` RTC_RD_TIME Jorge Almeida
2017-08-30 16:42       ` RTC_RD_TIME Alexander Monakov

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=20170830014328.GB19925@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --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).