SHA256
1
0
forked from pool/systemd
systemd/1017-udev-use-usec_t-and-now.patch
Stephan Kulow 48af67da26 Accepting request 147673 from Base:System
- udev: path_id - handle Hyper-V devices
  add: 1008-udev-path_id-handle-Hyper-V-devices.patch
- keymap: Update the list of Samsung Series 9 models
  add: 1009-keymap-Update-the-list-of-Samsung-Series-9-models.patch
- keymap: Add Samsung 700T
  add: 1010-keymap-Add-Samsung-700T.patch
- libudev: avoid leak during realloc failure
  add: 1011-libudev-avoid-leak-during-realloc-failure.patch
- libudev: do not resolve $attr{device} symlinks
  add: 1012-libudev-do-not-resolve-attr-device-symlinks.patch
- libudev: validate 'udev' argument to udev_enumerate_new()
  add: 1013-libudev-validate-udev-argument-to-udev_enumerate_new.patch
- udev: fix whitespace
  add: 1014-udev-fix-whitespace.patch
- udev: properly handle symlink removal by 'change' event
  add: 1015-udev-properly-handle-symlink-removal-by-change-event.patch
- udev: builtin - do not fail builtin initialization if one of 
  them returns an error
  add: 1016-udev-builtin-do-not-fail-builtin-initialization-if-o.patch
- udev: use usec_t and now()
  add: 1017-udev-use-usec_t-and-now.patch 

  closing an non-existent dbus connection and getting assertion 
  failures. 
- udev: path_id - handle Hyper-V devices
  add: 1008-udev-path_id-handle-Hyper-V-devices.patch
- keymap: Update the list of Samsung Series 9 models
  add: 1009-keymap-Update-the-list-of-Samsung-Series-9-models.patch
- keymap: Add Samsung 700T
  add: 1010-keymap-Add-Samsung-700T.patch

OBS-URL: https://build.opensuse.org/request/show/147673
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=120
2013-01-10 14:20:01 +00:00

336 lines
14 KiB
Diff

Index: systemd-195/src/libudev/libudev-device-private.c
===================================================================
--- systemd-195.orig/src/libudev/libudev-device-private.c
+++ systemd-195/src/libudev/libudev-device-private.c
@@ -147,7 +147,7 @@ int udev_device_update_db(struct udev_de
}
if (udev_device_get_usec_initialized(udev_device) > 0)
- fprintf(f, "I:%llu\n", udev_device_get_usec_initialized(udev_device));
+ fprintf(f, "I:%llu\n", (unsigned long long)udev_device_get_usec_initialized(udev_device));
udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) {
if (!udev_list_entry_get_num(list_entry))
Index: systemd-195/src/libudev/libudev-device.c
===================================================================
--- systemd-195.orig/src/libudev/libudev-device.c
+++ systemd-195/src/libudev/libudev-device.c
@@ -67,7 +67,7 @@ struct udev_device {
struct udev_list sysattr_list;
struct udev_list tags_list;
unsigned long long int seqnum;
- unsigned long long int usec_initialized;
+ usec_t usec_initialized;
int timeout;
int devlink_priority;
int refcount;
@@ -262,7 +262,7 @@ static int udev_device_set_devtype(struc
return 0;
}
-static int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem)
+int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem)
{
free(udev_device->subsystem);
udev_device->subsystem = strdup(subsystem);
@@ -1286,7 +1286,7 @@ _public_ const char *udev_device_get_act
**/
_public_ unsigned long long int udev_device_get_usec_since_initialized(struct udev_device *udev_device)
{
- unsigned long long now_ts;
+ usec_t now_ts;
if (udev_device == NULL)
return 0;
@@ -1294,23 +1294,23 @@ _public_ unsigned long long int udev_dev
udev_device_read_db(udev_device, NULL);
if (udev_device->usec_initialized == 0)
return 0;
- now_ts = now_usec();
+ now_ts = now(CLOCK_MONOTONIC);
if (now_ts == 0)
return 0;
return now_ts - udev_device->usec_initialized;
}
-unsigned long long udev_device_get_usec_initialized(struct udev_device *udev_device)
+usec_t udev_device_get_usec_initialized(struct udev_device *udev_device)
{
return udev_device->usec_initialized;
}
-void udev_device_set_usec_initialized(struct udev_device *udev_device, unsigned long long usec_initialized)
+void udev_device_set_usec_initialized(struct udev_device *udev_device, usec_t usec_initialized)
{
char num[32];
udev_device->usec_initialized = usec_initialized;
- snprintf(num, sizeof(num), "%llu", usec_initialized);
+ snprintf(num, sizeof(num), "%llu", (unsigned long long)usec_initialized);
udev_device_add_property(udev_device, "USEC_INITIALIZED", num);
}
Index: systemd-195/src/libudev/libudev-private.h
===================================================================
--- systemd-195.orig/src/libudev/libudev-private.h
+++ systemd-195/src/libudev/libudev-private.h
@@ -48,6 +48,7 @@ struct udev_list_entry *udev_get_propert
/* libudev-device.c */
struct udev_device *udev_device_new(struct udev *udev);
mode_t udev_device_get_devnode_mode(struct udev_device *udev_device);
+int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem);
int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath);
int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode);
int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink);
@@ -66,8 +67,8 @@ void udev_device_set_is_initialized(stru
int udev_device_add_tag(struct udev_device *udev_device, const char *tag);
void udev_device_cleanup_tags_list(struct udev_device *udev_device);
int udev_device_get_timeout(struct udev_device *udev_device);
-unsigned long long udev_device_get_usec_initialized(struct udev_device *udev_device);
-void udev_device_set_usec_initialized(struct udev_device *udev_device, unsigned long long usec_initialized);
+usec_t udev_device_get_usec_initialized(struct udev_device *udev_device);
+void udev_device_set_usec_initialized(struct udev_device *udev_device, usec_t usec_initialized);
int udev_device_get_devlink_priority(struct udev_device *udev_device);
int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio);
int udev_device_get_watch_handle(struct udev_device *udev_device);
@@ -166,7 +167,5 @@ uid_t util_lookup_user(struct udev *udev
gid_t util_lookup_group(struct udev *udev, const char *group);
int util_resolve_subsys_kernel(struct udev *udev, const char *string,
char *result, size_t maxsize, int read_value);
-unsigned long long ts_usec(const struct timespec *ts);
-unsigned long long now_usec(void);
ssize_t print_kmsg(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
#endif
Index: systemd-195/src/libudev/libudev-util.c
===================================================================
--- systemd-195.orig/src/libudev/libudev-util.c
+++ systemd-195/src/libudev/libudev-util.c
@@ -691,23 +691,6 @@ uint64_t util_string_bloom64(const char
return bits;
}
-#define USEC_PER_SEC 1000000ULL
-#define NSEC_PER_USEC 1000ULL
-unsigned long long ts_usec(const struct timespec *ts)
-{
- return (unsigned long long) ts->tv_sec * USEC_PER_SEC +
- (unsigned long long) ts->tv_nsec / NSEC_PER_USEC;
-}
-
-unsigned long long now_usec(void)
-{
- struct timespec ts;
-
- if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0)
- return 0;
- return ts_usec(&ts);
-}
-
ssize_t print_kmsg(const char *fmt, ...)
{
int fd;
Index: systemd-195/src/udev/udev-event.c
===================================================================
--- systemd-195.orig/src/udev/udev-event.c
+++ systemd-195/src/udev/udev-event.c
@@ -48,7 +48,7 @@ struct udev_event *udev_event_new(struct
event->udev = udev;
udev_list_init(udev, &event->run_list, false);
event->fd_signal = -1;
- event->birth_usec = now_usec();
+ event->birth_usec = now(CLOCK_MONOTONIC);
event->timeout_usec = 30 * 1000 * 1000;
return event;
}
@@ -466,9 +466,9 @@ static void spawn_read(struct udev_event
int i;
if (event->timeout_usec > 0) {
- unsigned long long age_usec;
+ usec_t age_usec;
- age_usec = now_usec() - event->birth_usec;
+ age_usec = now(CLOCK_MONOTONIC) - event->birth_usec;
if (age_usec >= event->timeout_usec) {
log_error("timeout '%s'\n", cmd);
goto out;
@@ -554,9 +554,9 @@ static int spawn_wait(struct udev_event
int fdcount;
if (event->timeout_usec > 0) {
- unsigned long long age_usec;
+ usec_t age_usec;
- age_usec = now_usec() - event->birth_usec;
+ age_usec = now(CLOCK_MONOTONIC) - event->birth_usec;
if (age_usec >= event->timeout_usec)
timeout = 1000;
else
@@ -862,7 +862,7 @@ int udev_event_execute_rules(struct udev
if (event->dev_db != NULL && udev_device_get_usec_initialized(event->dev_db) > 0)
udev_device_set_usec_initialized(event->dev, udev_device_get_usec_initialized(event->dev_db));
else if (udev_device_get_usec_initialized(event->dev) == 0)
- udev_device_set_usec_initialized(event->dev, now_usec());
+ udev_device_set_usec_initialized(event->dev, now(CLOCK_MONOTONIC));
/* (re)write database file */
udev_device_update_db(dev);
Index: systemd-195/src/udev/udev-rules.c
===================================================================
--- systemd-195.orig/src/udev/udev-rules.c
+++ systemd-195/src/udev/udev-rules.c
@@ -47,7 +47,7 @@ struct uid_gid {
struct udev_rules {
struct udev *udev;
char **dirs;
- unsigned long long *dirs_ts_usec;
+ usec_t *dirs_ts_usec;
int resolve_names;
/* every key in the rules file becomes a token */
@@ -1691,7 +1691,7 @@ bool udev_rules_check_timestamp(struct u
if (stat(rules->dirs[i], &stats) < 0)
continue;
- if (rules->dirs_ts_usec[i] == ts_usec(&stats.st_mtim))
+ if (rules->dirs_ts_usec[i] == timespec_load(&stats.st_mtim))
continue;
/* first check */
@@ -1701,7 +1701,7 @@ bool udev_rules_check_timestamp(struct u
}
/* update timestamp */
- rules->dirs_ts_usec[i] = ts_usec(&stats.st_mtim);
+ rules->dirs_ts_usec[i] = timespec_load(&stats.st_mtim);
}
out:
return changed;
Index: systemd-195/src/udev/udev.h
===================================================================
--- systemd-195.orig/src/udev/udev.h
+++ systemd-195/src/udev/udev.h
@@ -41,8 +41,8 @@ struct udev_event {
gid_t gid;
struct udev_list run_list;
int exec_delay;
- unsigned long long birth_usec;
- unsigned long long timeout_usec;
+ usec_t birth_usec;
+ usec_t timeout_usec;
int fd_signal;
unsigned int builtin_run;
unsigned int builtin_ret;
Index: systemd-195/src/udev/udevadm-settle.c
===================================================================
--- systemd-195.orig/src/udev/udevadm-settle.c
+++ systemd-195/src/udev/udevadm-settle.c
@@ -47,9 +47,9 @@ static int adm_settle(struct udev *udev,
{ "help", no_argument, NULL, 'h' },
{}
};
- unsigned long long start_usec = now_usec();
- unsigned long long start = 0;
- unsigned long long end = 0;
+ usec_t start_usec = now(CLOCK_MONOTONIC);
+ usec_t start = 0;
+ usec_t end = 0;
int quiet = 0;
const char *exists = NULL;
unsigned int timeout = 120;
@@ -123,7 +123,7 @@ static int adm_settle(struct udev *udev,
start = 0;
end = 0;
}
- log_debug("start=%llu end=%llu current=%llu\n", start, end, kernel_seq);
+ log_debug("start=%llu end=%llu current=%llu\n", (unsigned long long)start, (unsigned long long)end, kernel_seq);
} else {
if (end > 0) {
log_error("seq-end needs seq-start parameter, ignoring\n");
@@ -199,9 +199,9 @@ static int adm_settle(struct udev *udev,
}
if (timeout > 0) {
- unsigned long long age_usec;
+ usec_t age_usec;
- age_usec = now_usec() - start_usec;
+ age_usec = now(CLOCK_MONOTONIC) - start_usec;
if (age_usec / (1000 * 1000) >= timeout) {
struct udev_list_entry *list_entry;
Index: systemd-195/src/udev/udevd.c
===================================================================
--- systemd-195.orig/src/udev/udevd.c
+++ systemd-195/src/udev/udevd.c
@@ -122,7 +122,7 @@ struct worker {
struct udev_monitor *monitor;
enum worker_state state;
struct event *event;
- unsigned long long event_start_usec;
+ usec_t event_start_usec;
};
/* passed from worker to main process */
@@ -378,7 +378,7 @@ out:
worker->monitor = worker_monitor;
worker->pid = pid;
worker->state = WORKER_RUNNING;
- worker->event_start_usec = now_usec();
+ worker->event_start_usec = now(CLOCK_MONOTONIC);
worker->event = event;
event->state = EVENT_RUNNING;
udev_list_node_append(&worker->node, &worker_list);
@@ -409,7 +409,7 @@ static void event_run(struct event *even
worker_ref(worker);
worker->event = event;
worker->state = WORKER_RUNNING;
- worker->event_start_usec = now_usec();
+ worker->event_start_usec = now(CLOCK_MONOTONIC);
event->state = EVENT_RUNNING;
return;
}
@@ -1381,7 +1381,7 @@ int main(int argc, char *argv[])
udev_list_node_init(&worker_list);
for (;;) {
- static unsigned long long last_usec;
+ static usec_t last_usec;
struct epoll_event ev[8];
int fdcount;
int timeout;
@@ -1452,7 +1452,7 @@ int main(int argc, char *argv[])
if (worker->state != WORKER_RUNNING)
continue;
- if ((now_usec() - worker->event_start_usec) > 30 * 1000 * 1000) {
+ if ((now(CLOCK_MONOTONIC) - worker->event_start_usec) > 30 * 1000 * 1000) {
log_error("worker [%u] %s timeout; kill it\n", worker->pid,
worker->event ? worker->event->devpath : "<idle>");
kill(worker->pid, SIGKILL);
@@ -1486,13 +1486,13 @@ int main(int argc, char *argv[])
}
/* check for changed config, every 3 seconds at most */
- if ((now_usec() - last_usec) > 3 * 1000 * 1000) {
+ if ((now(CLOCK_MONOTONIC) - last_usec) > 3 * 1000 * 1000) {
if (udev_rules_check_timestamp(rules))
reload = true;
if (udev_builtin_validate(udev))
reload = true;
- last_usec = now_usec();
+ last_usec = now(CLOCK_MONOTONIC);
}
/* reload requested, HUP signal received, rules changed, builtin changed */
@@ -1512,7 +1512,7 @@ int main(int argc, char *argv[])
dev = udev_monitor_receive_device(monitor);
if (dev != NULL) {
- udev_device_set_usec_initialized(dev, now_usec());
+ udev_device_set_usec_initialized(dev, now(CLOCK_MONOTONIC));
if (rules == NULL)
rules = udev_rules_new(udev, resolve_names);
if (event_queue_insert(dev) < 0)