2007-03-21 15:05:58 +01:00
|
|
|
#ifndef HWCLOCK_CLOCK_H
|
|
|
|
#define HWCLOCK_CLOCK_H
|
|
|
|
|
2006-12-07 00:25:39 +01:00
|
|
|
#include <stdio.h>
|
2006-12-07 00:25:44 +01:00
|
|
|
#include <stdlib.h>
|
2006-12-07 00:25:39 +01:00
|
|
|
#include <string.h>
|
misc: fix some warnings
sys-utils/prlimit.c: In function 'do_prlimit':
sys-utils/prlimit.c:367:16: warning: format '%ju' expects argument of type 'uintmax_t', but argument 2 has type 'rlim_t {aka long long unsigned int}' [-Wformat=]
printf("<%ju", new->rlim_cur);
lib/plymouth-ctrl.c: In function 'open_un_socket_and_connect':
lib/plymouth-ctrl.c:88:20: warning: passing argument 2 of 'connect' from incompatible pointer type [-Wincompatible-pointer-types]
ret = connect(fd, &su, offsetof(struct sockaddr_un, sun_path) + 1 + strlen(su.sun_path+1));
^
In file included from lib/plymouth-ctrl.c:35:0:
/usr/include/sys/socket.h:314:5: note: expected 'const struct sockaddr *' but argument is of type 'struct sockaddr_un *'
int connect (int, const struct sockaddr *, socklen_t);
login-utils/last.c: In function 'list':
login-utils/last.c:506:54: warning: pointer targets in passing argument 4 of 'dns_lookup' differ in signedness [-Wpointer-sign]
r = dns_lookup(domain, sizeof(domain), ctl->useip, p->ut_addr_v6);
^
login-utils/last.c:291:12: note: expected 'int32_t * {aka int *}' but argument is of type 'unsigned int *'
static int dns_lookup(char *result, int size, int useip, int32_t *a)
^~~~~~~~~~
In file included from sys-utils/hwclock-cmos.c:92:0:
sys-utils/hwclock.h:67:32: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration
extern double time_diff(struct timeval subtrahend, struct timeval subtractor);
misc-utils/test_uuidd.c: In function 'create_nthreads':
misc-utils/test_uuidd.c:187:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
proc->pid, (int) th->tid, th->index));
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-05-31 23:58:11 +02:00
|
|
|
#include <sys/time.h>
|
2006-12-07 00:25:39 +01:00
|
|
|
#include <time.h>
|
|
|
|
|
2009-10-16 01:37:09 +02:00
|
|
|
#include "c.h"
|
2017-12-24 15:38:58 -05:00
|
|
|
#include "debug.h"
|
2022-01-21 16:09:35 +01:00
|
|
|
#include "nls.h"
|
2017-12-24 15:38:58 -05:00
|
|
|
|
|
|
|
#define HWCLOCK_DEBUG_INIT (1 << 0)
|
|
|
|
#define HWCLOCK_DEBUG_RANDOM_SLEEP (1 << 1)
|
|
|
|
#define HWCLOCK_DEBUG_DELTA_VS_TARGET (1 << 2)
|
|
|
|
#define HWCLOCK_DEBUG_ALL 0xFFFF
|
|
|
|
|
|
|
|
UL_DEBUG_DECLARE_MASK(hwclock);
|
|
|
|
#define DBG(m, x) __UL_DBG(hwclock, HWCLOCK_DEBUG_, m, x)
|
|
|
|
#define ON_DBG(m, x) __UL_DBG_CALL(hwclock, HWCLOCK_DEBUG_, m, x)
|
2009-10-16 01:37:09 +02:00
|
|
|
|
2016-07-16 16:45:07 +01:00
|
|
|
struct hwclock_control {
|
|
|
|
char *date_opt;
|
|
|
|
char *adj_file_name;
|
2018-07-18 13:59:15 +02:00
|
|
|
double rtc_delay; /* --delay <seconds> */
|
2017-04-17 18:39:56 -04:00
|
|
|
#if defined(__linux__) && defined(__alpha__)
|
2017-07-14 15:51:47 -04:00
|
|
|
char *epoch_option;
|
2017-04-17 18:39:56 -04:00
|
|
|
#endif
|
2016-07-16 16:45:07 +01:00
|
|
|
#ifdef __linux__
|
|
|
|
char *rtc_dev_name;
|
|
|
|
#endif
|
2022-01-21 16:09:35 +01:00
|
|
|
char *param_get_option;
|
2022-01-21 16:09:43 +01:00
|
|
|
char *param_set_option;
|
2016-07-16 16:45:07 +01:00
|
|
|
unsigned int
|
|
|
|
hwaudit_on:1,
|
|
|
|
adjust:1,
|
|
|
|
show:1,
|
|
|
|
hctosys:1,
|
|
|
|
utc:1,
|
|
|
|
systohc:1,
|
2017-04-17 18:39:56 -04:00
|
|
|
#if defined(__linux__) && defined(__alpha__)
|
2016-07-16 16:45:07 +01:00
|
|
|
getepoch:1,
|
|
|
|
setepoch:1,
|
|
|
|
#endif
|
|
|
|
noadjfile:1,
|
|
|
|
local_opt:1,
|
|
|
|
directisa:1,
|
|
|
|
testing:1,
|
|
|
|
systz:1,
|
|
|
|
predict:1,
|
|
|
|
get:1,
|
|
|
|
set:1,
|
|
|
|
update:1,
|
2017-12-24 15:38:58 -05:00
|
|
|
universal:1, /* will store hw_clock_is_utc() return value */
|
2023-06-13 12:14:28 +02:00
|
|
|
vl_read:1,
|
|
|
|
vl_clear:1,
|
2017-12-24 15:38:58 -05:00
|
|
|
verbose:1;
|
2016-07-16 16:45:07 +01:00
|
|
|
};
|
|
|
|
|
2006-12-07 00:25:39 +01:00
|
|
|
struct clock_ops {
|
|
|
|
char *interface_name;
|
2011-07-24 17:35:43 +02:00
|
|
|
int (*get_permissions) (void);
|
2016-07-16 16:45:07 +01:00
|
|
|
int (*read_hardware_clock) (const struct hwclock_control *ctl, struct tm * tm);
|
|
|
|
int (*set_hardware_clock) (const struct hwclock_control *ctl, const struct tm * tm);
|
|
|
|
int (*synchronize_to_clock_tick) (const struct hwclock_control *ctl);
|
2018-07-18 13:59:15 +02:00
|
|
|
const char *(*get_device_path) (void);
|
2006-12-07 00:25:39 +01:00
|
|
|
};
|
|
|
|
|
2023-04-04 14:42:32 +00:00
|
|
|
extern const struct clock_ops *probe_for_cmos_clock(void);
|
|
|
|
extern const struct clock_ops *probe_for_rtc_clock(const struct hwclock_control *ctl);
|
2006-12-07 00:25:39 +01:00
|
|
|
|
|
|
|
/* hwclock.c */
|
2008-08-12 13:58:51 +02:00
|
|
|
extern double time_diff(struct timeval subtrahend, struct timeval subtractor);
|
2006-12-07 00:25:39 +01:00
|
|
|
|
|
|
|
/* rtc.c */
|
2017-04-17 18:39:56 -04:00
|
|
|
#if defined(__linux__) && defined(__alpha__)
|
2017-03-26 11:56:42 -04:00
|
|
|
extern int get_epoch_rtc(const struct hwclock_control *ctl, unsigned long *epoch);
|
2016-07-16 16:45:07 +01:00
|
|
|
extern int set_epoch_rtc(const struct hwclock_control *ctl);
|
2017-04-17 18:39:56 -04:00
|
|
|
#endif
|
2007-03-21 14:12:05 +01:00
|
|
|
|
2022-01-21 16:09:35 +01:00
|
|
|
struct hwclock_param {
|
|
|
|
int id;
|
|
|
|
const char *name;
|
|
|
|
const char *help;
|
|
|
|
};
|
|
|
|
|
2022-01-28 12:15:39 +01:00
|
|
|
extern const struct hwclock_param *get_hwclock_params(void);
|
2022-01-31 10:05:29 +01:00
|
|
|
extern int get_param_rtc(const struct hwclock_control *ctl,
|
|
|
|
const char *name, uint64_t *id, uint64_t *value);
|
|
|
|
extern int set_param_rtc(const struct hwclock_control *ctl, const char *name);
|
2022-01-21 16:09:35 +01:00
|
|
|
|
2023-06-13 12:14:28 +02:00
|
|
|
extern int rtc_vl_read(const struct hwclock_control *ctl);
|
|
|
|
extern int rtc_vl_clear(const struct hwclock_control *ctl);
|
|
|
|
|
2017-06-11 22:00:49 +02:00
|
|
|
extern void __attribute__((__noreturn__))
|
|
|
|
hwclock_exit(const struct hwclock_control *ctl, int status);
|
2007-03-21 15:05:58 +01:00
|
|
|
|
2019-11-07 09:02:23 +01:00
|
|
|
extern int parse_date(struct timespec *, char const *, struct timespec const *);
|
|
|
|
|
2011-07-24 17:35:43 +02:00
|
|
|
#endif /* HWCLOCK_CLOCK_H */
|