Re: [systemd-devel] [PATCH] selinux: fix selinux check for transient units

2013-11-16 Thread Lennart Poettering
On Thu, 14.11.13 15:43, Daniel J Walsh (dwa...@redhat.com) wrote:

 
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 On 11/14/2013 12:50 PM, Harald Hoyer wrote:
  On 11/05/2013 11:12 PM, Daniel J Walsh wrote:
  On 11/05/2013 12:22 PM, Lennart Poettering wrote:
  
  Ok lets add a check that checks for start on a service labeled with the
  remote process label, then we can add rules like
  
  allow systemd_logind_t self:service start
  
  Or we can make it simpler and have the local end check against the init_t
  process.
  
  allow systemd_logind_t init_t:service start;
  
  Which is probably a better solution, if we have no way of differentiating
  the services.
  
  Machineid usually runs as init_t now.
  
  systemd-run runs as the label of the process that executes it,  Usually 
  unconfined_t, and sysadm_t.
  
  
  has any solution been found for this?
  
  seems like one is needed for
  https://bugzilla.redhat.com/show_bug.cgi?id=1008864
  
 
 I guess the question I have is do you expect a patch from me?  Or are you guys
 working on it?  I would go with the checking based on process label.

I am hoping for a patch for this!

Thanks,

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [systemd-bugs] Russian translation for systemd

2013-11-16 Thread Zbigniew Jędrzejewski-Szmek
On Sat, Nov 16, 2013 at 01:34:26AM +0400, Sergey Ptashnick wrote:
 On 15.11.2013 22:07, Juliette Tux wrote:
  Hint2 -- I'm commiting alot, and the moment the new version is out, good
  developers usually make an announcement asking for renewed translation. Do
  you practice this at systemd?
 
 It's totally my fault. I had to post it in the summer, when Lennart told me
 to do this. I'm sorry.
 
  Hint3 -- do your job, do not steal others's job
 
 Collaboration is much better than stealing ;)
 
 But (please don't take offense), you're very superficial about the quality of
 the translation. We, translators, must think about the users who will read 
 this.
 No need to confuse them with such phrases as локальное имя системы (instead 
 of
 имя компьютера), часы реального времени (instead of аппаратные часы), 
 etc.
 Before beginning of our work, we need to understand the matter, and avoid
 misinterpretations.
 Also, we must not allow incorrect phrases that are typical for automated
 translation.
 
 I hope these little tips will be helpful and will hurt nobody.

Hi Julia, Sergey, (and Alexander),

once again, thank you for working on the translations, adding them has
been on the TODO list for ever. It's bad that some work was
duplicated, but unfortunately that happens all the time because of the
distributed development. I hope that once the translation goes in,
there'll be less chance of that.

Looking at your translations, I see some advantages to both. E.g.:
 #: ../src/hostname/org.freedesktop.hostname1.policy.in.h:1
 msgid Set host name
-msgstr Настройка имени компьютера
+msgstr Настроить имя системы

From the comments in this thread, компьютера is better than системы,
but OTOH, I like the active form Настроить better than Настройка. We
should pick the version that will be clearer and more intuitive for
the user. But I don't speak Russian, so I can't really judge this or
other matters. Can one of you prepare a merge of both translations,
picking the best parts?

Thanks,
Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] French translation for systemd

2013-11-16 Thread Zbigniew Jędrzejewski-Szmek
On Fri, Nov 15, 2013 at 04:02:27PM +0100, Sylvain Plantefeve wrote:
 Fixed.
 
 ---
 --- /dev/null
 +++ b/po/fr.po
 @@ -0,0 +1,397 @@
 +# French translations for systemd package
Applied, thanks.

Please note that your mailer line-wraps patches. This one was simple
to fix, because there were only additions, but it's a problem in other
cases.

Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] Fix RemainAfterExit services keeping a hold on console

2013-11-16 Thread Zbigniew Jędrzejewski-Szmek
On Thu, Nov 14, 2013 at 03:52:54PM +0100, Olivier Brunel wrote:
 When a service exits succesfully and has RemainAfterExit set, its hold
 on the console (in m-n_on_console) wasn't released since the unit state
 didn't change.
Applied, thanks.

Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [RFC] xyzctl-common

2013-11-16 Thread Peeters Simon
hello all,

During the sd_bus porting I noted that the *ctl tools (and
systemd-analyze) contain a lot of common boilerplate code.

So the basic idea is to split this boilerplate out into
xyzctl-common.[ch] so that f.ex the bottom hostnamectl.c would look
like:

...
static void help(void ) {...}

enum {
ARG_TRANSIENT = 0x100,
ARG_STATIC,
ARG_PRETTY,
};

static int parse_arg(int option, const char* arg) {
assert(option = 0);

switch (option) {
case ARG_TRANSIENT:
arg_transient = true;
break;

case ARG_PRETTY:
arg_pretty = true;
break;

case ARG_STATIC:
arg_static = true;
break;

default:
return -EINVAL;
}

return 1;
}

int main(int argc, char *argv[]) {

static const struct option options[] = {
{ transient, no_argument, NULL, ARG_TRANSIENT },
{ static,no_argument, NULL, ARG_STATIC},
{ pretty,no_argument, NULL, ARG_PRETTY},
{}
};
static const xyzctl_verb verbs[] = {
{ status,LESS,  1, show_status,   XYZCTL_USE_PAGER  },
{ set-hostname,  EQUAL, 2, set_hostname,  XYZCTL_USE_POLKIT },
{ set-icon-name, EQUAL, 2, set_icon_name, XYZCTL_USE_POLKIT },
{ set-chassis,   EQUAL, 2, set_chassis,   XYZCTL_USE_POLKIT },
{}
};
static const xyzctl_tool hostnamectl = {
help,
parse_arg,
XYZCTL_NO_USER,
options,
verbs
};

return xyzctl_main(hostnamectl, argc, argv);
}

it would use or-able flags to controll common functionality, i currently have:
enum verb_flags {
XYZCTL_NO_BUS = 1,
The execution of the verb does not require a bus connection.
The system will try to connect to the bus, but will ignore any errors,
and pass a NULL bus.
XYZCTL_USE_PAGER = 2,
Open a pager unless the user passes --no-pager
XYZCTL_USE_POLKIT = 4,
Starts the polkit agent unless the user passes --no-ask-password
XYZCTL_LOOP_ARGS = 8,
Executes the verb once for each argument.
This is usefull where
  $ xyzctl verb a b c
is the same as
  $ xyzctl verb a
  $ xyzctl verb b
  $ xyzctl verb c
};

enum tool_flags {
XYZCTL_NO_REMOTE = 1,
Do not allow the use of --host=HOST to connect to a remote host
XYZCTL_NO_MACHINE = 2,
Do not allow the use of --machine=CONTAINER to connect to a container
XYZCTL_NO_USER = 4,
Do not allow connection to the user bus by using --user
XYZCTL_CONNECT_SYSTEMD = 8,
connect directly to systemd's private socket.
}


As a proof of concept I ported hostnemctl and loginctl resulting in +-
360 lines less code


Does anybody have any comments on the basic idea and/or the proposed interface?


Simon
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [RFC] xyzctl-common

2013-11-16 Thread Zbigniew Jędrzejewski-Szmek
On Sat, Nov 16, 2013 at 07:41:13PM +0100, Peeters Simon wrote:
 hello all,
 
 During the sd_bus porting I noted that the *ctl tools (and
 systemd-analyze) contain a lot of common boilerplate code.
 
 So the basic idea is to split this boilerplate out into
 xyzctl-common.[ch] so that f.ex the bottom hostnamectl.c would look
 like:
 
 ...
 static void help(void ) {...}
 
 enum {
 ARG_TRANSIENT = 0x100,
 ARG_STATIC,
 ARG_PRETTY,
 };
 
 static int parse_arg(int option, const char* arg) {
 assert(option = 0);
 
 switch (option) {
 case ARG_TRANSIENT:
 arg_transient = true;
 break;
 
 case ARG_PRETTY:
 arg_pretty = true;
 break;
 
 case ARG_STATIC:
 arg_static = true;
 break;
 
 default:
 return -EINVAL;
 }
 
 return 1;
 }
 
 int main(int argc, char *argv[]) {
 
 static const struct option options[] = {
 { transient, no_argument, NULL, ARG_TRANSIENT },
 { static,no_argument, NULL, ARG_STATIC},
 { pretty,no_argument, NULL, ARG_PRETTY},
 {}
 };
 static const xyzctl_verb verbs[] = {
 { status,LESS,  1, show_status,   XYZCTL_USE_PAGER  
 },
 { set-hostname,  EQUAL, 2, set_hostname,  XYZCTL_USE_POLKIT 
 },
 { set-icon-name, EQUAL, 2, set_icon_name, XYZCTL_USE_POLKIT 
 },
 { set-chassis,   EQUAL, 2, set_chassis,   XYZCTL_USE_POLKIT 
 },
 {}
 };
 static const xyzctl_tool hostnamectl = {
 help,
 parse_arg,
 XYZCTL_NO_USER,
 options,
 verbs
 };
 
 return xyzctl_main(hostnamectl, argc, argv);
 }
 
 it would use or-able flags to controll common functionality, i currently have:
 enum verb_flags {
 XYZCTL_NO_BUS = 1,
 The execution of the verb does not require a bus connection.
 The system will try to connect to the bus, but will ignore any errors,
 and pass a NULL bus.
 XYZCTL_USE_PAGER = 2,
 Open a pager unless the user passes --no-pager
 XYZCTL_USE_POLKIT = 4,
 Starts the polkit agent unless the user passes --no-ask-password
 XYZCTL_LOOP_ARGS = 8,
 Executes the verb once for each argument.
 This is usefull where
   $ xyzctl verb a b c
 is the same as
   $ xyzctl verb a
   $ xyzctl verb b
   $ xyzctl verb c
I think that we do some sorting on the arguments and other operations
which mean that the behaviour for multiple args isn't usually
*exactly* the same as for one repeated. What exactly does this
flag mean?

 };
 
 enum tool_flags {
 XYZCTL_NO_REMOTE = 1,
 Do not allow the use of --host=HOST to connect to a remote host
 XYZCTL_NO_MACHINE = 2,
 Do not allow the use of --machine=CONTAINER to connect to a container
 XYZCTL_NO_USER = 4,
 Do not allow connection to the user bus by using --user
 XYZCTL_CONNECT_SYSTEMD = 8,
 connect directly to systemd's private socket.
 }
 
 
 As a proof of concept I ported hostnemctl and loginctl resulting in +-
 360 lines less code
 
 
 Does anybody have any comments on the basic idea and/or the proposed 
 interface?

If it makes things shorter, without making them much more complicated,
then it's probably a good idea. Can you post the full patch for 
loginctl and hostnamectl?

Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH 1/4] core/socket: use _cleanup_free_

2013-11-16 Thread Shawn Landden
---
 src/core/socket.c | 10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/core/socket.c b/src/core/socket.c
index 03b8f92..f505e4f 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -1475,7 +1475,7 @@ static void socket_enter_running(Socket *s, int cfd) {
 
 socket_set_state(s, SOCKET_RUNNING);
 } else {
-char *prefix, *instance = NULL, *name;
+_cleanup_free_ char *prefix = NULL, *instance = NULL, *name = 
NULL;
 Service *service;
 
 if (s-n_connections = s-max_connections) {
@@ -1503,14 +1503,11 @@ static void socket_enter_running(Socket *s, int cfd) {
 
 prefix = unit_name_to_prefix(UNIT(s)-id);
 if (!prefix) {
-free(instance);
 r = -ENOMEM;
 goto fail;
 }
 
 name = unit_name_build(prefix, instance, .service);
-free(prefix);
-free(instance);
 
 if (!name) {
 r = -ENOMEM;
@@ -1518,10 +1515,8 @@ static void socket_enter_running(Socket *s, int cfd) {
 }
 
 r = unit_add_name(UNIT_DEREF(s-service), name);
-if (r  0) {
-free(name);
+if (r  0)
 goto fail;
-}
 
 service = SERVICE(UNIT_DEREF(s-service));
 unit_ref_unset(s-service);
@@ -1530,7 +1525,6 @@ static void socket_enter_running(Socket *s, int cfd) {
 UNIT(service)-no_gc = false;
 
 unit_choose_id(UNIT(service), name);
-free(name);
 
 r = service_set_socket_fd(service, cfd, s);
 if (r  0)
-- 
1.8.4.3

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] core: support Distribute=n to distribute to n SO_REUSEPORT workers

2013-11-16 Thread Shawn
On Sat, Nov 16, 2013 at 7:38 AM, Zbigniew Jędrzejewski-Szmek
zbys...@in.waw.pl wrote:
 On Fri, Nov 15, 2013 at 08:22:14PM -0800, Shawn Landden wrote:
 v3: make each worker its own service
 v4: be less intrusive
 Hi Shawn,
 unfortunately this doesn't apply cleanly. Can you rebase?
thats because it is 3rd in a series, I will send the whole series
right after this email

 diff --git a/man/systemd.socket.xml b/man/systemd.socket.xml
 index 7c10c58..92a9275 100644
 --- a/man/systemd.socket.xml
 +++ b/man/systemd.socket.xml
 @@ -519,6 +519,15 @@
  /varlistentry

  varlistentry
 +termvarnameDistribute=/varname/term
 +listitemparaTakes an integer
 +value. If greater than one, systemd will 
 spawn
 +given number of instances of service each
 +listening to the same socket. This option 
 implies
 +varnameReuseport=/varname 
 above./para/listitem
 +/varlistentry
 +
 +varlistentry
  termvarnameSmackLabel=/varname/term
  
 termvarnameSmackLabelIPIn=/varname/term
  
 termvarnameSmackLabelIPOut=/varname/term
 diff --git a/src/core/dbus-socket.c b/src/core/dbus-socket.c
 index 60a8d05..4644007 100644
 --- a/src/core/dbus-socket.c
 +++ b/src/core/dbus-socket.c
 @@ -68,6 +68,7 @@
property name=\Listen\ type=\a(ss)\ access=\read\/\n
 \
property name=\Result\ type=\s\ access=\read\/\n\
property name=\ReusePort\ type=\b\ access=\read\/\n \
 +  property name=\Distribute\ type=\u\ access=\read\/\n \
property name=\SmackLabel\ type=\s\ access=\read\/\n \
property name=\SmackLabelIPIn\ type=\s\ 
 access=\read\/\n \
property name=\SmackLabelIPOut\ type=\s\ 
 access=\read\/\n \
 @@ -196,6 +197,7 @@ static const BusProperty bus_socket_properties[] = {
  { MessageQueueMessageSize, bus_property_append_long, x, 
 offsetof(Socket, mq_msgsize)  },
  { Result, bus_socket_append_socket_result,   s, 
 offsetof(Socket, result)  },
  { ReusePort,  bus_property_append_bool,  b, 
 offsetof(Socket, reuseport)   },
 +{ Distribute, bus_property_append_unsigned,  u, 
 offsetof(Socket, distribute)   },
  { SmackLabel, bus_property_append_string,s, 
 offsetof(Socket, smack),  true },
  { SmackLabelIPIn, bus_property_append_string,s, 
 offsetof(Socket, smack_ip_in),true },
  { SmackLabelIPOut,bus_property_append_string,s, 
 offsetof(Socket, smack_ip_out),   true },
 diff --git a/src/core/load-fragment-gperf.gperf.m4 
 b/src/core/load-fragment-gperf.gperf.m4
 index b64fdc9..4058a1f 100644
 --- a/src/core/load-fragment-gperf.gperf.m4
 +++ b/src/core/load-fragment-gperf.gperf.m4
 @@ -211,6 +211,7 @@ Socket.PassCredentials,  config_parse_bool,  
 0,
  Socket.PassSecurity, config_parse_bool,  0, 
 offsetof(Socket, pass_sec)
  Socket.TCPCongestion,config_parse_string,0, 
 offsetof(Socket, tcp_congestion)
  Socket.ReusePort,config_parse_bool,  0, 
 offsetof(Socket, reuseport)
 +Socket.Distribute,   config_parse_unsigned,  0, 
 offsetof(Socket, distribute)
  Socket.MessageQueueMaxMessages,  config_parse_long,  0, 
 offsetof(Socket, mq_maxmsg)
  Socket.MessageQueueMessageSize,  config_parse_long,  0, 
 offsetof(Socket, mq_msgsize)
  Socket.Service,  config_parse_socket_service,0, 
 0
 diff --git a/src/core/service.c b/src/core/service.c
 index 3da32a1..8fc55a0 100644
 --- a/src/core/service.c
 +++ b/src/core/service.c
 @@ -3663,7 +3663,6 @@ static void service_bus_query_pid_done(
  int service_set_socket_fd(Service *s, int fd, Socket *sock) {

  assert(s);
 -assert(fd = 0);

  /* This is called by the socket code when instantiating a new
   * service for a stream socket and the socket needs to be
 @@ -3678,8 +3677,10 @@ int service_set_socket_fd(Service *s, int fd, Socket 
 *sock) {
  if (s-state != SERVICE_DEAD)
  return -EAGAIN;

 -s-socket_fd = fd;
 -s-got_socket_fd = true;
 +if (fd = 0) {
 +s-socket_fd = fd;
 +s-got_socket_fd = true;
 +}

  unit_ref_set(s-accept_socket, UNIT(sock));

 diff --git a/src/core/service.h b/src/core/service.h
 index 

[systemd-devel] [PATCH 3/4] core: support Distribute=n to distribute to n SO_REUSEPORT workers

2013-11-16 Thread Shawn Landden
v3: make each worker its own service
v4: be less intrusive
v5: misc fixups
---
 TODO  |   3 -
 man/systemd.socket.xml|  11 
 src/core/dbus-socket.c|   2 +
 src/core/load-fragment-gperf.gperf.m4 |   1 +
 src/core/service.c|   7 +-
 src/core/service.h|   1 -
 src/core/socket.c | 119 +++---
 src/core/socket.h |   4 ++
 8 files changed, 89 insertions(+), 59 deletions(-)

diff --git a/TODO b/TODO
index efc7e2a..6067efb 100644
--- a/TODO
+++ b/TODO
@@ -80,8 +80,6 @@ Features:
 
 * rfkill,backlight: we probably should run the load tools inside of the udev 
rules so that the state is properly initialized by the time other software sees 
it
 
-* Add a new Distribute=$NUMBER key to socket units that makes use of 
SO_REUSEPORT to distribute network traffic on $NUMBER instances
-
 * tmpfiles: when applying ownership to /run/log/journal, also do this for the 
journal fails contained in it
 
 * we probably should replace the left-over uses of strv_append() and replace 
them by strv_push() or strv_extend()
@@ -259,7 +257,6 @@ Features:
 * teach ConditionKernelCommandLine= globs or regexes (in order to match 
foobar={no,0,off})
 
 * Support SO_REUSEPORT with socket activation:
-  - Let systemd maintain a pool of servers.
   - Use for seamless upgrades, by running the new server before stopping the
 old.
 
diff --git a/man/systemd.socket.xml b/man/systemd.socket.xml
index 7c10c58..4a2189b 100644
--- a/man/systemd.socket.xml
+++ b/man/systemd.socket.xml
@@ -519,6 +519,17 @@
 /varlistentry
 
 varlistentry
+termvarnameDistribute=/varname/term
+listitemparaTakes an integer
+value. Systemd will spawn
+given number of instances of service each
+listening to the same socket. Default is 0.
+Setting this requires corresponding service to
+be an instansiated service (name ends with 
literal@.service/literal).
+This option implies 
varnameReuseport=/varname above./para/listitem
+/varlistentry
+
+varlistentry
 termvarnameSmackLabel=/varname/term
 termvarnameSmackLabelIPIn=/varname/term
 
termvarnameSmackLabelIPOut=/varname/term
diff --git a/src/core/dbus-socket.c b/src/core/dbus-socket.c
index 60a8d05..4644007 100644
--- a/src/core/dbus-socket.c
+++ b/src/core/dbus-socket.c
@@ -68,6 +68,7 @@
   property name=\Listen\ type=\a(ss)\ access=\read\/\n\
   property name=\Result\ type=\s\ access=\read\/\n\
   property name=\ReusePort\ type=\b\ access=\read\/\n \
+  property name=\Distribute\ type=\u\ access=\read\/\n \
   property name=\SmackLabel\ type=\s\ access=\read\/\n \
   property name=\SmackLabelIPIn\ type=\s\ access=\read\/\n \
   property name=\SmackLabelIPOut\ type=\s\ access=\read\/\n \
@@ -196,6 +197,7 @@ static const BusProperty bus_socket_properties[] = {
 { MessageQueueMessageSize, bus_property_append_long, x, 
offsetof(Socket, mq_msgsize)  },
 { Result, bus_socket_append_socket_result,   s, 
offsetof(Socket, result)  },
 { ReusePort,  bus_property_append_bool,  b, 
offsetof(Socket, reuseport)   },
+{ Distribute, bus_property_append_unsigned,  u, 
offsetof(Socket, distribute)   },
 { SmackLabel, bus_property_append_string,s, 
offsetof(Socket, smack),  true },
 { SmackLabelIPIn, bus_property_append_string,s, 
offsetof(Socket, smack_ip_in),true },
 { SmackLabelIPOut,bus_property_append_string,s, 
offsetof(Socket, smack_ip_out),   true },
diff --git a/src/core/load-fragment-gperf.gperf.m4 
b/src/core/load-fragment-gperf.gperf.m4
index b64fdc9..4058a1f 100644
--- a/src/core/load-fragment-gperf.gperf.m4
+++ b/src/core/load-fragment-gperf.gperf.m4
@@ -211,6 +211,7 @@ Socket.PassCredentials,  config_parse_bool, 
 0,
 Socket.PassSecurity, config_parse_bool,  0,
 offsetof(Socket, pass_sec)
 Socket.TCPCongestion,config_parse_string,0,
 offsetof(Socket, tcp_congestion)
 Socket.ReusePort,config_parse_bool,  0,
 offsetof(Socket, reuseport)
+Socket.Distribute,   config_parse_unsigned,  0,
 offsetof(Socket, distribute)
 Socket.MessageQueueMaxMessages,  config_parse_long,   

[systemd-devel] [PATCH 4/4] core: lazy distribute for Distribute pools

2013-11-16 Thread Shawn Landden
---
 man/systemd.socket.xml| 9 +
 src/core/dbus-socket.c| 2 ++
 src/core/load-fragment-gperf.gperf.m4 | 1 +
 src/core/socket.c | 7 ++-
 src/core/socket.h | 1 +
 5 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/man/systemd.socket.xml b/man/systemd.socket.xml
index 4a2189b..fd6ec69 100644
--- a/man/systemd.socket.xml
+++ b/man/systemd.socket.xml
@@ -530,6 +530,15 @@
 /varlistentry
 
 varlistentry
+termvarnameLazyDistribute=/varname/term
+listitemparaTakes an boolean
+value. If true, Distribute=n workers will not 
be spawned
+simultameously, but one at a time while 
connections come it
+until n are running. Because of the nature of 
SO_REUSEPORT workers are
+spawned at an exponentially decreasing rate to 
the number of incoming connections./para/listitem
+/varlistentry
+
+varlistentry
 termvarnameSmackLabel=/varname/term
 termvarnameSmackLabelIPIn=/varname/term
 
termvarnameSmackLabelIPOut=/varname/term
diff --git a/src/core/dbus-socket.c b/src/core/dbus-socket.c
index 4644007..4e2a31d 100644
--- a/src/core/dbus-socket.c
+++ b/src/core/dbus-socket.c
@@ -69,6 +69,7 @@
   property name=\Result\ type=\s\ access=\read\/\n\
   property name=\ReusePort\ type=\b\ access=\read\/\n \
   property name=\Distribute\ type=\u\ access=\read\/\n \
+  property name=\LazyDistribute\ type=\b\ access=\read\/\n \
   property name=\SmackLabel\ type=\s\ access=\read\/\n \
   property name=\SmackLabelIPIn\ type=\s\ access=\read\/\n \
   property name=\SmackLabelIPOut\ type=\s\ access=\read\/\n \
@@ -198,6 +199,7 @@ static const BusProperty bus_socket_properties[] = {
 { Result, bus_socket_append_socket_result,   s, 
offsetof(Socket, result)  },
 { ReusePort,  bus_property_append_bool,  b, 
offsetof(Socket, reuseport)   },
 { Distribute, bus_property_append_unsigned,  u, 
offsetof(Socket, distribute)   },
+{ LazyDistribute, bus_property_append_bool,  b, 
offsetof(Socket, lazy_distribute)   },
 { SmackLabel, bus_property_append_string,s, 
offsetof(Socket, smack),  true },
 { SmackLabelIPIn, bus_property_append_string,s, 
offsetof(Socket, smack_ip_in),true },
 { SmackLabelIPOut,bus_property_append_string,s, 
offsetof(Socket, smack_ip_out),   true },
diff --git a/src/core/load-fragment-gperf.gperf.m4 
b/src/core/load-fragment-gperf.gperf.m4
index 4058a1f..a023b0e 100644
--- a/src/core/load-fragment-gperf.gperf.m4
+++ b/src/core/load-fragment-gperf.gperf.m4
@@ -212,6 +212,7 @@ Socket.PassSecurity, config_parse_bool, 
 0,
 Socket.TCPCongestion,config_parse_string,0,
 offsetof(Socket, tcp_congestion)
 Socket.ReusePort,config_parse_bool,  0,
 offsetof(Socket, reuseport)
 Socket.Distribute,   config_parse_unsigned,  0,
 offsetof(Socket, distribute)
+Socket.LazyDistribute,   config_parse_bool,  0,
 offsetof(Socket, lazy_distribute)
 Socket.MessageQueueMaxMessages,  config_parse_long,  0,
 offsetof(Socket, mq_maxmsg)
 Socket.MessageQueueMessageSize,  config_parse_long,  0,
 offsetof(Socket, mq_msgsize)
 Socket.Service,  config_parse_socket_service,0,
 0
diff --git a/src/core/socket.c b/src/core/socket.c
index 4d4627a..a85ae88 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -514,6 +514,11 @@ static void socket_dump(Unit *u, FILE *f, const char 
*prefix) {
 %sDistribute: %d\n,
  prefix, s-distribute);
 
+if (s-lazy_distribute)
+fprintf(f,
+%sLazyDistribute: %s\n,
+ prefix, yes_no(s-lazy_distribute));
+
 if (s-smack)
 fprintf(f,
 %sSmackLabel: %s\n,
@@ -1545,7 +1550,7 @@ static void socket_enter_running(Socket *s, int cfd) {
 
 if (s-n_connections  s-distribute)
 socket_enter_listening(s);
-} while (s-n_connections  s-distribute);
+} while (s-n_connections  s-distribute  
!(s-lazy_distribute));
 
 /* Notify 

[systemd-devel] [PATCH 2/4] core/socket: fix SO_REUSEPORT

2013-11-16 Thread Shawn Landden
---
 src/core/load-fragment-gperf.gperf.m4 | 1 +
 src/core/socket.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/core/load-fragment-gperf.gperf.m4 
b/src/core/load-fragment-gperf.gperf.m4
index e3025d2..b64fdc9 100644
--- a/src/core/load-fragment-gperf.gperf.m4
+++ b/src/core/load-fragment-gperf.gperf.m4
@@ -210,6 +210,7 @@ Socket.Broadcast,config_parse_bool, 
 0,
 Socket.PassCredentials,  config_parse_bool,  0,
 offsetof(Socket, pass_cred)
 Socket.PassSecurity, config_parse_bool,  0,
 offsetof(Socket, pass_sec)
 Socket.TCPCongestion,config_parse_string,0,
 offsetof(Socket, tcp_congestion)
+Socket.ReusePort,config_parse_bool,  0,
 offsetof(Socket, reuseport)
 Socket.MessageQueueMaxMessages,  config_parse_long,  0,
 offsetof(Socket, mq_maxmsg)
 Socket.MessageQueueMessageSize,  config_parse_long,  0,
 offsetof(Socket, mq_msgsize)
 Socket.Service,  config_parse_socket_service,0,
 0
diff --git a/src/core/socket.c b/src/core/socket.c
index f505e4f..751f20b 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -771,7 +771,7 @@ static void socket_apply_socket_options(Socket *s, int fd) {
 
 if (s-reuseport) {
 int b = s-reuseport;
-if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, b, sizeof(b)))
+if (setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, b, sizeof(b))  
0)
 log_warning_unit(UNIT(s)-id, SO_REUSEPORT failed: 
%m);
 }
 
-- 
1.8.4.3

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [systemd-bugs] Russian translation for systemd

2013-11-16 Thread Sergey Ptashnick
On 16.11.2013 20:40, Zbigniew Jędrzejewski-Szmek wrote:
 Can one of you prepare a merge of both translations,
 picking the best parts?

Done.
I also updated russian catalog for Journal (in according to commit 9444b1f2).
Julia, Alexander, any comments?
# translation of ru.po to Rissian
# Julia Dronova juliette@gmail.com, 2013.
# Sergey Ptashnick 0comff...@inbox.ru, 2013.
#
msgid 
msgstr 
Project-Id-Version: systemd\n
Report-Msgid-Bugs-To: 0comff...@inbox.ru\n
POT-Creation-Date: 2013-03-24 19:22+0300\n
PO-Revision-Date: 2013-11-17 01:30+0400\n
Last-Translator: Sergey Ptashnick 0comff...@inbox.ru\n
Language: ru\n
MIME-Version: 1.0\n
Content-Type: text/plain; charset=UTF-8\n
Content-Transfer-Encoding: 8bit\n

#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:1
msgid Set host name
msgstr Настроить имя компьютера

#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:2
msgid Authentication is required to set the local host name.
msgstr Чтобы настроить имя компьютера, необходимо пройти идентификацию.

#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:3
msgid Set static host name
msgstr Настроить статическое имя компьютера

#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:4
msgid Authentication is required to set the statically configured local host 
name, as well as the pretty host name.
msgstr Чтобы настроить статическое имя компьютера, а также его «красивое» имя, 
необходимо пройти идентификацию.

#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:5
msgid Set machine information
msgstr Настроить информацию о компьютере

#: ../src/hostname/org.freedesktop.hostname1.policy.in.h:6
msgid Authentication is required to set local machine information.
msgstr Чтобы настроить информацию о компьютере, необходимо пройти 
идентификацию.

#: ../src/locale/org.freedesktop.locale1.policy.in.h:1
msgid Set system locale
msgstr Настроить системную локаль

#: ../src/locale/org.freedesktop.locale1.policy.in.h:2
msgid Authentication is required to set the system locale.
msgstr Чтобы настроить системную локаль, необходимо пройти идентификацию.

#: ../src/locale/org.freedesktop.locale1.policy.in.h:3
msgid Set system keyboard settings
msgstr Настроить параметры клавиатуры

#: ../src/locale/org.freedesktop.locale1.policy.in.h:4
msgid Authentication is required to set the system keyboard settings.
msgstr Чтобы настроить параметры клавиатуры, необходимо пройти идентификацию.

#: ../src/login/org.freedesktop.login1.policy.in.h:1
msgid Allow applications to inhibit system shutdown
msgstr Разрешить приложениям устанавливать блокировку на выключение системы

#: ../src/login/org.freedesktop.login1.policy.in.h:2
msgid Authentication is required to allow an application to inhibit system 
shutdown.
msgstr Чтобы разрешить приложениям устанавливать блокировку на выключение 
системы, необходимо пройти идентификацию.

#: ../src/login/org.freedesktop.login1.policy.in.h:3
msgid Allow applications to delay system shutdown
msgstr Разрешить приложениям устанавливать задержку на выключение системы

#: ../src/login/org.freedesktop.login1.policy.in.h:4
msgid Authentication is required to allow an application to delay system 
shutdown.
msgstr Чтобы разрешить приложениям устанавливать задержку на выключение 
системы, необходимо пройти идентификацию.

#: ../src/login/org.freedesktop.login1.policy.in.h:5
msgid Allow applications to inhibit system sleep
msgstr Разрешить приложениям устанавливать блокировку на засыпание системы

#: ../src/login/org.freedesktop.login1.policy.in.h:6
msgid Authentication is required to allow an application to inhibit system 
sleep.
msgstr Чтобы разрешить приложениям устанавливать блокировку на засыпание 
системы, необходимо пройти идентификацию.

#: ../src/login/org.freedesktop.login1.policy.in.h:7
msgid Allow applications to delay system sleep
msgstr Разрешить приложениям устанавливать задержку на засыпание системы

#: ../src/login/org.freedesktop.login1.policy.in.h:8
msgid Authentication is required to allow an application to delay system 
sleep.
msgstr Чтобы разрешить приложениям устанавливать задержку на засыпание 
системы, необходимо пройти идентификацию.

#: ../src/login/org.freedesktop.login1.policy.in.h:9
msgid Allow applications to inhibit automatic system suspend
msgstr Разрешить приложениям устанавливать блокировку на автоматический 
переход системы в ждущий режим

#: ../src/login/org.freedesktop.login1.policy.in.h:10
msgid Authentication is required to allow an application to inhibit automatic 
system suspend.
msgstr Чтобы разрешить приложениям устанавливать блокировку на автоматический 
переход системы в ждущий режим, необходимо пройти идентификацию.

#: ../src/login/org.freedesktop.login1.policy.in.h:11
msgid Allow applications to inhibit system handling of the power key
msgstr Разрешить приложениям устанавливать блокировку обработки нажатий на 
кнопку выключения

#: ../src/login/org.freedesktop.login1.policy.in.h:12
msgid Authentication is required to allow an application to inhibit 

Re: [systemd-devel] [RFC] xyzctl-common

2013-11-16 Thread Peeters Simon
2013/11/16 Zbigniew Jędrzejewski-Szmek zbys...@in.waw.pl:
 On Sat, Nov 16, 2013 at 07:41:13PM +0100, Peeters Simon wrote:
 hello all,

 During the sd_bus porting I noted that the *ctl tools (and
 systemd-analyze) contain a lot of common boilerplate code.

 So the basic idea is to split this boilerplate out into
 xyzctl-common.[ch] so that f.ex the bottom hostnamectl.c would look
 like:

 ...
 static void help(void ) {...}

 enum {
 ARG_TRANSIENT = 0x100,
 ARG_STATIC,
 ARG_PRETTY,
 };

 static int parse_arg(int option, const char* arg) {
 assert(option = 0);

 switch (option) {
 case ARG_TRANSIENT:
 arg_transient = true;
 break;

 case ARG_PRETTY:
 arg_pretty = true;
 break;

 case ARG_STATIC:
 arg_static = true;
 break;

 default:
 return -EINVAL;
 }

 return 1;
 }

 int main(int argc, char *argv[]) {

 static const struct option options[] = {
 { transient, no_argument, NULL, ARG_TRANSIENT },
 { static,no_argument, NULL, ARG_STATIC},
 { pretty,no_argument, NULL, ARG_PRETTY},
 {}
 };
 static const xyzctl_verb verbs[] = {
 { status,LESS,  1, show_status,   XYZCTL_USE_PAGER 
  },
 { set-hostname,  EQUAL, 2, set_hostname,  
 XYZCTL_USE_POLKIT },
 { set-icon-name, EQUAL, 2, set_icon_name, 
 XYZCTL_USE_POLKIT },
 { set-chassis,   EQUAL, 2, set_chassis,   
 XYZCTL_USE_POLKIT },
 {}
 };
 static const xyzctl_tool hostnamectl = {
 help,
 parse_arg,
 XYZCTL_NO_USER,
 options,
 verbs
 };

 return xyzctl_main(hostnamectl, argc, argv);
 }

 it would use or-able flags to controll common functionality, i currently 
 have:
 enum verb_flags {
 XYZCTL_NO_BUS = 1,
 The execution of the verb does not require a bus connection.
 The system will try to connect to the bus, but will ignore any errors,
 and pass a NULL bus.
 XYZCTL_USE_PAGER = 2,
 Open a pager unless the user passes --no-pager
 XYZCTL_USE_POLKIT = 4,
 Starts the polkit agent unless the user passes --no-ask-password
 XYZCTL_LOOP_ARGS = 8,
 Executes the verb once for each argument.
 This is usefull where
   $ xyzctl verb a b c
 is the same as
   $ xyzctl verb a
   $ xyzctl verb b
   $ xyzctl verb c
 I think that we do some sorting on the arguments and other operations
 which mean that the behaviour for multiple args isn't usually
 *exactly* the same as for one repeated. What exactly does this
 flag mean?

what it does exactly:
instead of calling
  verb.dispatch(bus, argv_left, argc_left)
it does:
  for (int i = 1; i  argc_left; i++)
verb.dispatch(bus, (char *[]){argv_left[0], argv_left[i]}, 2);
an example use for it would be loginctl kill-session

In the beginning I tought this would be nice to have, but I am fine
with dropping this.

 };

 enum tool_flags {
 XYZCTL_NO_REMOTE = 1,
 Do not allow the use of --host=HOST to connect to a remote host
 XYZCTL_NO_MACHINE = 2,
 Do not allow the use of --machine=CONTAINER to connect to a container
 XYZCTL_NO_USER = 4,
 Do not allow connection to the user bus by using --user
 XYZCTL_CONNECT_SYSTEMD = 8,
 connect directly to systemd's private socket.
 }


 As a proof of concept I ported hostnemctl and loginctl resulting in +-
 360 lines less code


 Does anybody have any comments on the basic idea and/or the proposed 
 interface?

 If it makes things shorter, without making them much more complicated,
 then it's probably a good idea. Can you post the full patch for
 loginctl and hostnamectl?

I will do this tomorow.
on the calling side things get a lot simpler, the other side (the code
in xyzctl-common.c) is slightly more complex because it has to
dynamicly construct the options array for getopt_long, but I think it
is within reason.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] French translation for systemd

2013-11-16 Thread Sylvain Plantefeve
Thanks a lot!

Sorry for the line-wraps thing, I'm new to contributing patches, and did
not expect gmail to do that...

If you are also interested in the french translation of the journal's
catalog, please find it for review in attachment (I can't find the damn
setting to avoid line wrapping for now...).

Regards,




2013/11/16 Zbigniew Jędrzejewski-Szmek zbys...@in.waw.pl

 On Fri, Nov 15, 2013 at 04:02:27PM +0100, Sylvain Plantefeve wrote:
  Fixed.
 
  ---
  --- /dev/null
  +++ b/po/fr.po
  @@ -0,0 +1,397 @@
  +# French translations for systemd package
 Applied, thanks.

 Please note that your mailer line-wraps patches. This one was simple
 to fix, because there were only additions, but it's a problem in other
 cases.

 Zbyszek



systemd-fr.catalog
Description: Binary data
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] French translation for systemd

2013-11-16 Thread Ronny Chevalier
2013/11/17 Sylvain Plantefeve sylvain.plantef...@gmail.com:
 Thanks a lot!

 Sorry for the line-wraps thing, I'm new to contributing patches, and did not
 expect gmail to do that...
You can use git format-patch then git send-mail to send patches, and
avoid such issues.


 If you are also interested in the french translation of the journal's
 catalog, please find it for review in attachment (I can't find the damn
 setting to avoid line wrapping for now...).

 Regards,





 2013/11/16 Zbigniew Jędrzejewski-Szmek zbys...@in.waw.pl

 On Fri, Nov 15, 2013 at 04:02:27PM +0100, Sylvain Plantefeve wrote:
  Fixed.
 
  ---
  --- /dev/null
  +++ b/po/fr.po
  @@ -0,0 +1,397 @@
  +# French translations for systemd package
 Applied, thanks.

 Please note that your mailer line-wraps patches. This one was simple
 to fix, because there were only additions, but it's a problem in other
 cases.

 Zbyszek



 ___
 systemd-devel mailing list
 systemd-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/systemd-devel

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel