Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Tue, 29 Aug 2017 22:28:14 +0100
From: Jorge Almeida <jjalmeida@...il.com>
To: musl@...ts.openwall.com
Subject: RTC_RD_TIME

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.

Headers:

#define _DEFAULT_SOURCE
#include <unistd.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <time.h>
#include <linux/unistd.h>
#include <math.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <linux/vt.h>
#include <linux/rtc.h>
#include <fcntl.h>
#include <errno.h>
#include <stdio.h>

TIA

Jorge Almeida

Powered by blists - more mailing lists

Your e-mail address:

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.