Hello community, here is the log from the commit of package acpid for openSUSE:Factory checked in at Thu Jun 16 10:46:39 CEST 2011. -------- --- acpid/acpid.changes 2011-03-09 14:10:01.000000000 +0100 +++ /mounts/work_src_done/STABLE/acpid/acpid.changes 2011-06-15 22:33:31.000000000 +0200 @@ -1,0 +2,5 @@ +Sat May 21 16:09:14 UTC 2011 - vlado.paskov@gmail.com + +- Version update to 2.0.10 for systemd support + +------------------------------------------------------------------- calling whatdependson for head-i586 Old: ---- _service:download_url:acpid-2.0.9.tar.gz New: ---- _service:download_url:acpid-2.0.10.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ acpid.spec ++++++ --- /var/tmp/diff_new_pack.Kg5reC/_old 2011-06-16 10:46:20.000000000 +0200 +++ /var/tmp/diff_new_pack.Kg5reC/_new 2011-06-16 10:46:20.000000000 +0200 @@ -20,7 +20,7 @@ Name: acpid Url: http://tedfelix.com/linux/acpid-netlink.html -Version: 2.0.9 +Version: 2.0.10 Release: 1 License: GPLv2+ Group: System/Daemons ++++++ _service ++++++ --- /var/tmp/diff_new_pack.Kg5reC/_old 2011-06-16 10:46:20.000000000 +0200 +++ /var/tmp/diff_new_pack.Kg5reC/_new 2011-06-16 10:46:20.000000000 +0200 @@ -2,11 +2,11 @@ <service name="download_url"> <param name="protocol">http</param> <param name="host">tedfelix.com</param> - <param name="path">/linux/acpid-2.0.9.tar.gz</param> + <param name="path">/linux/acpid-2.0.10.tar.gz</param> </service> <service name="verify_file"> - <param name="file">_service:download_url:acpid-2.0.9.tar.gz</param> + <param name="file">_service:download_url:acpid-2.0.10.tar.gz</param> <param name="verifier">sha256</param> - <param name="checksum">f02a4931083ef52e6785c989d9d44720387c1d65a42bdcd364e3b06cd588ba65</param> + <param name="checksum">ef7e4ed2f3594dd02a50a92fc47dc0e1fea80c07fab8a5f3d1040ee76fae0acb</param> </service> </services> ++++++ _service:download_url:acpid-2.0.9.tar.gz -> _service:download_url:acpid-2.0.10.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/acpid-2.0.9/Changelog new/acpid-2.0.10/Changelog --- old/acpid-2.0.9/Changelog 2011-04-15 19:12:47.000000000 +0200 +++ new/acpid-2.0.10/Changelog 2011-05-17 19:05:33.000000000 +0200 @@ -1,3 +1,12 @@ +* Tue May 17 2011 Ted Felix http://www.tedfelix.com + - 2.0.10 release + - Fixed compiler warnings in kacpimon. (kacpimon/libnetlink.c) + (Michael Meskes) + - systemd support. The socket acpid creates to connect with clients can now + be passed as stdin (fd 0) at startup. (acpid.c sock.h sock.c acpid.8) + (Reiner Klussmeier) + - man page improvements (acpid.8) (Ted Felix) + * Fri Apr 15 2011 Ted Felix http://www.tedfelix.com - 2.0.9 release - Removed newlines from acpid_log() calls and modified acpid_log() to diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/acpid-2.0.9/Makefile new/acpid-2.0.10/Makefile --- old/acpid-2.0.9/Makefile 2011-03-12 17:06:19.000000000 +0100 +++ new/acpid-2.0.10/Makefile 2011-04-27 01:56:59.000000000 +0200 @@ -1,7 +1,7 @@ # Makefile for ACPI daemon # update these numbers for new releases -VERSION = 2.0.9 +VERSION = 2.0.10 OPT = -O2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/acpid-2.0.9/TESTPLAN new/acpid-2.0.10/TESTPLAN --- old/acpid-2.0.9/TESTPLAN 2011-03-19 03:37:20.000000000 +0100 +++ new/acpid-2.0.10/TESTPLAN 2011-05-02 23:54:40.000000000 +0200 @@ -4,10 +4,16 @@ - Run all these tests with valgrind to detect memory leaks. - It's best to test without a window manager running (such as GNOME or KDE) as they tend to handle acpi events on their own and override acpid. To bring down X on a system that is configured with a graphical login, there's usually an "init" script you can run. As an example, with Debian/GNOME, log off of your X/GNOME session, switch to another tty (e.g. Alt-Ctrl-F1), login, and do this: - sudo /etc/init.d/gdm stop - [need instructions for upstart, maybe this: sudo initctl gdm stop] -Now X is out of the way and you can test from the console. -- You can kill acpid with "sudo killall acpid". + sudo /etc/init.d/gdm stop + It's different if you are using upstart: + sudo initctl gdm stop + And systemd requires a different incantation: + [anyone care to enlighten me?] + Now X is out of the way and you can test from the console. +- You can kill acpid with "sudo killall acpid". Or if you are using upstart: + sudo initctl stop acpid + For systemd: + [anyone?] - To make testing more convenient, you can run acpid from a shell as "acpid -ld" to get maximum logging. Use Ctrl-C to stop acpid. Normal Paths diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/acpid-2.0.9/acpid.8 new/acpid-2.0.10/acpid.8 --- old/acpid-2.0.9/acpid.8 2010-01-26 04:03:22.000000000 +0100 +++ new/acpid-2.0.10/acpid.8 2011-05-03 03:50:50.000000000 +0200 @@ -54,6 +54,11 @@ for messages about which it cares. \fBacpid\fP will not close the client socket except in the case of a SIGHUP or \fBacpid\fP exiting. .PP +For faster startup, this socket can be passed in as stdin so that \fBacpid\fP +need not create the socket. In addition, if a socket is passed in as stdin, +\fBacpid\fP will not daemonize. It will be run in foreground. This behavior +is provided to support systemd(1). +.PP .B acpid will log all of its activities, as well as the stdout and stderr of any actions, to syslog. @@ -131,7 +136,7 @@ .IP /sbin/shutdown \-h now "Power button pressed" .PP -Now, when acpid is running, a press of the power button will cause the +Now, when \fBacpid\fP is running, a press of the power button will cause the rule in /etc/acpi/events/power to trigger the script in /etc/acpi/power.sh. The script will then shut down the system. .SH DEPENDENCIES @@ -154,7 +159,8 @@ .SH BUGS There are no known bugs. To file bug reports, see \fBAUTHORS\fP below. .SH SEE ALSO -regcomp(3), sh(1), socket(2), connect(2) +regcomp(3), sh(1), socket(2), connect(2), systemd(1), acpi_listen(8), +kacpimon(8) .SH AUTHORS Ted Felix (www.tedfelix.com) .br diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/acpid-2.0.9/acpid.c new/acpid-2.0.10/acpid.c --- old/acpid-2.0.9/acpid.c 2011-03-24 12:20:59.000000000 +0100 +++ new/acpid-2.0.10/acpid.c 2011-05-07 03:32:07.000000000 +0200 @@ -105,8 +105,9 @@ open_sock(); } - /* if we're running in foreground, we don't daemonize */ - if (!foreground) { + /* if we're running in the background, and we're not being started */ + /* by systemd */ + if (!foreground && !is_socket(STDIN_FILENO)) { if (daemonize() < 0) exit(EXIT_FAILURE); } @@ -393,7 +394,10 @@ } /* set up stdin, stdout, stderr to /dev/null */ - if (dup2(nullfd, STDIN_FILENO) != STDIN_FILENO) { + + /* don't redirect stdin if we're being sent a socket by systemd */ + if (!is_socket(STDIN_FILENO) && + dup2(nullfd, STDIN_FILENO) != STDIN_FILENO) { acpid_log(LOG_ERR, "dup2() stdin: %s", strerror(errno)); return -1; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/acpid-2.0.9/kacpimon/libnetlink.c new/acpid-2.0.10/kacpimon/libnetlink.c --- old/acpid-2.0.9/kacpimon/libnetlink.c 2008-11-14 00:36:54.000000000 +0100 +++ new/acpid-2.0.10/kacpimon/libnetlink.c 2011-04-26 22:31:44.000000000 +0200 @@ -441,7 +441,7 @@ nladdr.nl_groups = 0; while (1) { - int err, len, type; + int err, len; int l; status = fread(&buf, 1, sizeof(*h), rtnl); @@ -456,7 +456,6 @@ return 0; len = h->nlmsg_len; - type= h->nlmsg_type; l = len - sizeof(*h); if (l<0 || (unsigned)len>sizeof(buf)) { @@ -518,7 +517,7 @@ int addraw_l(struct nlmsghdr *n, int maxlen, const void *data, int len) { - if ((int)NLMSG_ALIGN(n->nlmsg_len) + NLMSG_ALIGN(len) > maxlen) { + if ((int)NLMSG_ALIGN(n->nlmsg_len) + (int)NLMSG_ALIGN(len) > maxlen) { fprintf(stderr, "addraw_l ERROR: message exceeded bound of %d\n",maxlen); return -1; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/acpid-2.0.9/sock.c new/acpid-2.0.10/sock.c --- old/acpid-2.0.9/sock.c 2011-03-24 20:54:55.000000000 +0100 +++ new/acpid-2.0.10/sock.c 2011-05-02 23:45:11.000000000 +0200 @@ -42,6 +42,16 @@ /* the number of non-root clients that are connected */ int non_root_clients; +/* determine if a file descriptor is in fact a socket */ +int +is_socket(int fd) +{ + int v; + socklen_t l = sizeof(int); + + return (getsockopt(fd, SOL_SOCKET, SO_TYPE, (char *)&v, &l) == 0); +} + /* accept a new client connection */ static void process_sock(int fd) @@ -103,56 +113,62 @@ int fd; struct connection c; - fd = ud_create_socket(socketfile); - if (fd < 0) { - acpid_log(LOG_ERR, "can't open socket %s: %s", - socketfile, strerror(errno)); - exit(EXIT_FAILURE); + /* if this is a socket passed in via stdin by systemd */ + if (is_socket(STDIN_FILENO)) { + fd = STDIN_FILENO; + } else { + /* create our own socket */ + fd = ud_create_socket(socketfile); + if (fd < 0) { + acpid_log(LOG_ERR, "can't open socket %s: %s", + socketfile, strerror(errno)); + exit(EXIT_FAILURE); + } + + if (chmod(socketfile, socketmode) < 0) { + close(fd); + acpid_log(LOG_ERR, "chmod() on socket %s: %s", + socketfile, strerror(errno)); + return; + } + + /* if we need to change the socket's group, do so */ + if (socketgroup) { + struct group *gr; + struct stat buf; + + gr = getgrnam(socketgroup); + if (!gr) { + acpid_log(LOG_ERR, "group %s does not exist", socketgroup); + exit(EXIT_FAILURE); + } + if (stat(socketfile, &buf) < 0) { + acpid_log(LOG_ERR, "can't stat %s: %s", + socketfile, strerror(errno)); + exit(EXIT_FAILURE); + } + if (chown(socketfile, buf.st_uid, gr->gr_gid) < 0) { + acpid_log(LOG_ERR, "can't chown %s: %s", + socketfile, strerror(errno)); + exit(EXIT_FAILURE); + } + } } - /* don't leak fds when execing */ - if (fcntl(fd, F_SETFD, FD_CLOEXEC) < 0) { + /* don't leak fds when execing */ + if (fcntl(fd, F_SETFD, FD_CLOEXEC) < 0) { close(fd); acpid_log(LOG_ERR, "fcntl() on socket %s for FD_CLOEXEC: %s", - socketfile, strerror(errno)); + socketfile, strerror(errno)); return; - } + } - /* avoid a potential hang */ - if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) { + /* avoid a potential hang */ + if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) { close(fd); acpid_log(LOG_ERR, "fcntl() on socket %s for O_NONBLOCK: %s", - socketfile, strerror(errno)); + socketfile, strerror(errno)); return; - } - - if (chmod(socketfile, socketmode) < 0) { - close(fd); - acpid_log(LOG_ERR, "chmod() on socket %s: %s", - socketfile, strerror(errno)); - return; - } - - /* if we need to change the socket's group, do so */ - if (socketgroup) { - struct group *gr; - struct stat buf; - - gr = getgrnam(socketgroup); - if (!gr) { - acpid_log(LOG_ERR, "group %s does not exist", socketgroup); - exit(EXIT_FAILURE); - } - if (stat(socketfile, &buf) < 0) { - acpid_log(LOG_ERR, "can't stat %s: %s", - socketfile, strerror(errno)); - exit(EXIT_FAILURE); - } - if (chown(socketfile, buf.st_uid, gr->gr_gid) < 0) { - acpid_log(LOG_ERR, "can't chown %s: %s", - socketfile, strerror(errno)); - exit(EXIT_FAILURE); - } } /* add a connection to the list */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/acpid-2.0.9/sock.h new/acpid-2.0.10/sock.h --- old/acpid-2.0.9/sock.h 2009-05-02 04:26:46.000000000 +0200 +++ new/acpid-2.0.10/sock.h 2011-04-27 01:49:32.000000000 +0200 @@ -29,6 +29,7 @@ extern int clientmax; extern int non_root_clients; +extern int is_socket(int fd); extern void open_sock(); #endif /* SOCK_H__ */ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org