[systemd-devel] question about socket activation

2017-12-29 Thread eshark
Hi, All
  I tried to test the socket activation by a simple foobar.socket and 
foobar.service, which are as the following:
  foobar.socket: 
   [Socket]
   ListenStream=/dev/socket/foobar


   [Install]
   WantedBy=sockets.target 


  foobar.service: 
   [Service]
   Type=simple
   ExecStart=/usr/bin/test-socket
  Restart=no


 I also wrote a simple program to connect to /dev/socket/foobar , in order 
to activitate the foobar.service.
When I ran the program,  the foobar.service  was started by systemd , and 
the foobar.socket changed from 'listening' state to 'running' state. 
 All works OK as expected,  but  when I killed the  test-socket,  it was 
started again by the systemd, even if I didn't run my program.
And from the system journal logs , I found  that
"
Line 2035: 31,29604,571630004,-;systemd[1]: foobar.socket got notified about 
service death (failed permanently: no)
Line 2038: 31,29605,571630065,-;systemd[1]: foobar.socket changed running -> 
listening
Line 2050: 31,29609,571632385,-;systemd[1]: Incoming traffic on foobar.socket
Line 2056: 28,29611,571633087,-;systemd[1]: Cannot add dependency job for unit 
systemd-bus-proxyd.socket, ignoring: Unit systemd-bus-proxyd.socket failed to 
load: No such file or directory.
Line 2056: 28,29611,571633087,-;systemd[1]: Cannot add dependency job for unit 
systemd-bus-proxyd.socket, ignoring: Unit systemd-bus-proxyd.socket failed to 
load: No such file or directory.
Line 2065: 31,29614,571633544,-;systemd[1]: foobar.socket changed listening -> 
running   
"
 It seems that immediately after the death of foobar.service,some unknown 
incoming traffic  on foobar.socket   made the foobar.service started again by 
the systemd .
  Could anyone give me some suggestion that  who connected to the foobar.socket 
 ?   Any idea about how to debug this problem  is very appreciated.


 Thanks a lot.___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] question about socket activation

2018-01-01 Thread eshark
The program source codes and the foobar.service , the foobar.socket are as the 
attachments.


Thanks for any suggestion! 






At 2017-12-29 16:19:35, "eshark"  wrote:

Hi, All
  I tried to test the socket activation by a simple foobar.socket and 
foobar.service, which are as the following:
  foobar.socket: 
   [Socket]
   ListenStream=/dev/socket/foobar


   [Install]
   WantedBy=sockets.target 


  foobar.service: 
   [Service]
   Type=simple
   ExecStart=/usr/bin/test-socket
  Restart=no


 I also wrote a simple program to connect to /dev/socket/foobar , in order 
to activitate the foobar.service.
When I ran the program,  the foobar.service  was started by systemd , and 
the foobar.socket changed from 'listening' state to 'running' state. 
 All works OK as expected,  but  when I killed the  test-socket,  it was 
started again by the systemd, even if I didn't run my program.
And from the system journal logs , I found  that
"
Line 2035: 31,29604,571630004,-;systemd[1]: foobar.socket got notified about 
service death (failed permanently: no)
Line 2038: 31,29605,571630065,-;systemd[1]: foobar.socket changed running -> 
listening
Line 2050: 31,29609,571632385,-;systemd[1]: Incoming traffic on foobar.socket
Line 2056: 28,29611,571633087,-;systemd[1]: Cannot add dependency job for unit 
systemd-bus-proxyd.socket, ignoring: Unit systemd-bus-proxyd.socket failed to 
load: No such file or directory.
Line 2056: 28,29611,571633087,-;systemd[1]: Cannot add dependency job for unit 
systemd-bus-proxyd.socket, ignoring: Unit systemd-bus-proxyd.socket failed to 
load: No such file or directory.
Line 2065: 31,29614,571633544,-;systemd[1]: foobar.socket changed listening -> 
running   
"
 It seems that immediately after the death of foobar.service,some unknown 
incoming traffic  on foobar.socket   made the foobar.service started again by 
the systemd .
  Could anyone give me some suggestion that  who connected to the foobar.socket 
 ?   Any idea about how to debug this problem  is very appreciated.


 Thanks a lot.




 #include 
#include 
#include 
#include 
#include 
#define UNIX_DOMAIN "/dev/socket/foobar"

#define CONTAINER_EXIT_PROP_NAME "sys.pagemanagerd.status"
#define HOST_EXIT_PROP_NAME "service.bootanim.exit"



int require_services(void)
{
int connect_fd;
int ret;
int i;
static struct sockaddr_un srv_addr;

connect_fd=socket(PF_UNIX,SOCK_STREAM,0);
if(connect_fd<0)
{
perror("cannot create communication socket");
return 1;
}
srv_addr.sun_family=AF_UNIX;
strcpy(srv_addr.sun_path,UNIX_DOMAIN);
ret=connect(connect_fd,(struct sockaddr*)&srv_addr,sizeof(srv_addr));
if(ret==-1)
{
perror("cannot connect to the server");
close(connect_fd);
return 0;
}
close(connect_fd);
return 0;
}

int main(void)
{
   require_services();
   sleep(10);
   return 0;
}


foobar.service
Description: Binary data


foobar.socket
Description: Binary data
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] question about BUS_MATCH_ARG_PATH

2015-06-10 Thread eshark




Sorry for forgetting attach the C file.


Best Regards,
Li Cheng



At 2015-06-10 20:35:11, eshar...@163.com wrote:

Hi, All,
 According to the DBus protocol, 
http://dbus.freedesktop.org/doc/dbus-specification.html 
   " An example argument path match is arg0path='/aa/bb/'. This would match 
messages with first arguments of '/', '/aa/', '/aa/bb/', '/aa/bb/cc/' and 
'/aa/bb/cc'. It would not match messages with first arguments of '/aa/b', '/aa' 
or even '/aa/bb'. "   
  
Then  I did a simple  test using the  attached  test-bus-kernel-bloom.c , 
and I found that  if  I used arg0path='/p1/p2/' , the callback function 
couldn't run when I sent emit signal with  '/' , '/p1/' , '/p1/p2/p3'.


   I traced into the codes , and modified bloom_add_prefixes() , then I can 
watch the signals with '/p1/p2/p3' , and '/p1/p2/' , but still cannot watch the 
signals with '/' or '/p1/'.


  Any recommendations are appreciated.   


 Thanks!




Best Regards,
Li Cheng




/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/

/***
  This file is part of systemd.

  Copyright 2013 Lennart Poettering

  systemd is free software; you can redistribute it and/or modify it
  under the terms of the GNU Lesser General Public License as published by
  the Free Software Foundation; either version 2.1 of the License, or
  (at your option) any later version.

  systemd is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public License
  along with systemd; If not, see .
***/

#include "util.h"
#include "log.h"

#include "sd-bus.h"
#include "bus-kernel.h"
#include "bus-util.h"

static int filter(sd_bus *b, sd_bus_message *m, void *userdata, sd_bus_error 
*ret_error) {
log_info("callback enter");
return 0;
}
static void test_one(
const char *path,
const char *interface,
const char *member,
bool as_list,
const char *arg0,
const char *match,
bool good) {

_cleanup_close_ int bus_ref = -1;
_cleanup_free_ char *name = NULL, *bus_name = NULL, *address = NULL;
_cleanup_bus_message_unref_ sd_bus_message *m = NULL;
sd_bus *a, *b;
int r;

assert_se(asprintf(&name, "deine-mutter-%u", (unsigned) getpid()) >= 0);

bus_ref = bus_kernel_create_bus(name, false, &bus_name);
if (bus_ref == -ENOENT)
exit(EXIT_TEST_SKIP);

assert_se(bus_ref >= 0);

address = strappend("kernel:path=", bus_name);
assert_se(address);

r = sd_bus_new(&a);
assert_se(r >= 0);

r = sd_bus_new(&b);
assert_se(r >= 0);

r = sd_bus_set_address(a, address);
assert_se(r >= 0);

r = sd_bus_set_address(b, address);
assert_se(r >= 0);

r = sd_bus_start(a);
assert_se(r >= 0);

r = sd_bus_start(b);
assert_se(r >= 0);

log_info("match: %s",match);
r = sd_bus_add_match(b, NULL, match, filter, NULL);
assert_se(r >= 0);

log_info("signal");

if (as_list)
r = sd_bus_emit_signal(a, path, interface, member, "as", 1, 
arg0);
else
r = sd_bus_emit_signal(a, path, interface, member, "s", arg0);
assert_se(r >= 0);

r = sd_bus_process(b, &m);
assert_se(r >= 0 && (good == !!m));

sd_bus_unref(a);
sd_bus_unref(b);
}

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

test_one("/service/a", "service.a.interface", 
"com_0yunos_0spms_0uninstall", false, "/p1/p2/", 
"type='signal',interface='service.a.interface',path='/service/a',member='com_0yunos_0spms_0uninstall',arg0path='/p1/p2/'",
 true);
return 0;
}
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] Can kdbus send signal to the source connection?

2015-06-15 Thread eshark
Hi, All,
   If I post this email to the wrong mail-list, please tell me, thank you.

   Now many JS applications implement the client and service in the same 
thread, so they share the same connection too.

However when the client or the service want to send signal to the other,  the 
receiver cannot get the signal because the kdbus driver 

won't broadcast the signal to the source connection.

  I've tried to simply allow the kdbus driver to send signal to all the 
connections including the source , but it seems not work OK.

I wonder that how I can make kdbus send signal to the source connection, or 
that this is impossible ?

Thanks a lot !


Best Regards,

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


Re: [systemd-devel] Can kdbus send signal to the source connection?

2015-06-16 Thread eshark
Hi,


At 2015-06-15 22:32:27, "Lennart Poettering"  wrote:
>On Mon, 15.06.15 19:05, eshark (eshar...@163.com) wrote:
>
>> Hi, All,
>>If I post this email to the wrong mail-list, please tell me, thank 
>> you.
>> 
>>Now many JS applications implement the client and service in the same 
>> thread, so they share the same connection too.
>> 
>> However when the client or the service want to send signal to the other,  
>> the receiver cannot get the signal because the kdbus driver 
>> 
>> won't broadcast the signal to the source connection.
>> 
>>   I've tried to simply allow the kdbus driver to send signal to all the 
>> connections including the source , but it seems not work OK.
>> 
>> I wonder that how I can make kdbus send signal to the source connection, or 
>> that this is impossible ?
>
>I am not dure I follow. Are you developing a native kdbus client

>library for JS? 
Yes, we already have a library based on DBus, and I'm migrating it to KDBus.


>
>Did I get this right, you have one bus connection per thread, but
>possibly both a kdbus client and its service run from the server, and
>you want broadcast msgs sent out from one to then also be matchable by

>the other?
Yes.  And I've tried removing the condition in kdbus_bus_broadcast(), as David  
said. 
But this modification caused that the network module of our system cannot work 
OK,  it's very strange ,
and I'm not familiar with the network module, so I  haven't find the root 
cause. 
Maybe it has nothing to do with KDBus? I am not sure.


>
>Can't you dispatch that locally? i.e. in addition to passing the msg
>to kdbus also enqueue it locallly along the kdbus fd, or so?
>
>But I am not sure I understand the problem fully...
>
>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] Can kdbus send signal to the source connection?

2015-06-16 Thread eshark
Hi,


At 2015-06-16 15:54:10, "David Herrmann"  wrote:
>Hi
>
>On Tue, Jun 16, 2015 at 9:35 AM, eshark  wrote:
>> Hi,
>>
>>
>> At 2015-06-15 22:32:27, "Lennart Poettering"  wrote:
>>>On Mon, 15.06.15 19:05, eshark (eshar...@163.com) wrote:
>>>
>>>> Hi, All,
>>>>If I post this email to the wrong mail-list, please tell me, thank
>>>> you.
>>>>
>>>>Now many JS applications implement the client and service in the
>>>> same thread, so they share the same connection too.
>>>>
>>>> However when the client or the service want to send signal to the other,
>>>> the receiver cannot get the signal because the kdbus driver
>>>>
>>>> won't broadcast the signal to the source connection.
>>>>
>>>>   I've tried to simply allow the kdbus driver to send signal to all
>>>> the connections including the source , but it seems not work OK.
>>>>
>>>> I wonder that how I can make kdbus send signal to the source connection,
>>>> or that this is impossible ?
>>>
>>>I am not dure I follow. Are you developing a native kdbus client
>>>library for JS?
>> Yes, we already have a library based on DBus, and I'm migrating it to KDBus.
>>
>>>
>>>Did I get this right, you have one bus connection per thread, but
>>>possibly both a kdbus client and its service run from the server, and
>>>you want broadcast msgs sent out from one to then also be matchable by
>>>the other?
>> Yes.  And I've tried removing the condition in kdbus_bus_broadcast(), as
>> David  said.
>> But this modification caused that the network module of our system cannot
>> work OK,  it's very strange ,
>> and I'm not familiar with the network module, so I  haven't find the root
>> cause.
>> Maybe it has nothing to do with KDBus? I am not sure.
>
>Can you be more specific, please? What do you mean by "network module

>of our systemd cannot work OK"?


Sorry.  Acctually  our network module cannot get ip by DHCP.  Our network 
module is
connman, which depends on libdbus.And the connman will connect to KDBus 
through the bus-proxyd, which is implemented in the libsystemd.


I have not traced into connman , so I'm not very clear about the root cause.


Thanks !


Li Cheng


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


Re: [systemd-devel] Can kdbus send signal to the source connection?

2015-06-16 Thread eshark
Hi,
   I'm so sorry for not giving you more details,  I'm a freshman here, but I'll 
try to do better in the future.
I will give the answers under each of the questions .

At 2015-06-16 18:54:23, "David Herrmann"  wrote:
>Hi
>
>On Tue, Jun 16, 2015 at 12:07 PM, eshark  wrote:
>> At 2015-06-16 15:54:10, "David Herrmann"  wrote:
>>>Can you be more specific, please? What do you mean by "network module
>>>of our systemd cannot work OK"?
>>
>

>Does this only happen with kdbus?
Yes.  It's OK with DBus.
>Does this only happen with you kdbus-patch to make broadcasts being
>sent to oneself?
Yes. Without modifying kdbus_bus_broadcast(),  I can always get the ip.
>Or does it happen with unmodified kdbus, too?
Never.
>What exactly changes?
I just commented out the following two lines in the kdbus_bus_broadc
// if (conn_dst->id == kmsg->msg.src_id)
//continue;


>Does everything work perfectly well without kdbus?
As for network, it did work well without my patch.


>Is the missing DHCP connectivity the only difference you see with kdbus?
Acctually, I  cannot connet to the device by "adb". But  I did run "netcfg" in 
the terminal, and eth0 didn't get ip as before.


>What kdbus version do you run?
kdbus-4.1-rc1
>What kdbus tree do you use?
https://git.kernel.org/cgit/linux/kernel/git/gregkh/char-misc.git/
>What systemd version do you use? (in case of git: which commit?)
systemd v219 
commit: d736e4f3e76daca4ab1b1fc444737e5ee20a27cd


>Did you pass --enable-kdbus to systemd?
Yes , I did.
>What upstream kernel version do you use?
3.10.33, we back-ported the kdbus to our kernel.


>Any obscure messages in the system-log that you didn't see before? 
From dmesg , I can see that the "systemd" process  calls kdbus_bus_broadcast() 
endlessly, and the condition " if (conn_dst->id == kmsg->msg.src_id)" is always 
true.
It seems that  when booting,  the "systemd " process enters a  dead loop by  
sending some signal to the source connection. 
So , systemd cannot boot any  service , including network.


Thanks!
Li Cheng 
>...
>
>Please try to paste as much information as possible. Otherwise, it's
>really a hassle to ask for each piece of information separately.
>
>Thanks
>David









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


Re: [systemd-devel] Can kdbus send signal to the source connection?

2015-06-17 Thread eshark
Hi,
 With my kdbus broadcast patch, I found that the "systemd" process would 
endlessly emit the signal "type=signal sender=:1.2 destination=n/a 
object=/org/freedesktop/systemd1/agent interface=org.freedesktop.systemd1.Agent 
member=Released ".What does this signal  mean ?


I searched the source codes, and found that systemd-cgroups-agent would  
send this signal. But from the log, systemd-cgroups-agent only send this signal 
several times , not endlessly.


And I cannot locate the place where "systemd" send such signal. 


Following are the logs:


<27>[3.633361@3] systemd-cgroups-agent[196]: Lch-sd_bus_emit_signal 
org.freedesktop.systemd1.Agent Released
<27>[3.633660@2] systemd-cgroups-agent[216]: Lch-sd_bus_emit_signal 
org.freedesktop.systemd1.Agent Released
<6>[3.633989@2] Lch-kdbus_bus_broadcast: conn_dst->id = 0x14, pid = 216, 
pid name = systemd-cgroups, tid = 216, tid name = systemd-cgroups
<30>[3.634008@2] systemd-cgroups-agent[216]: Lch-Sent message type=signal 
sender=n/a destination=n/a object=/org/freedesktop/systemd1/agent 
interface=org.freedesktop.systemd1.Agent member=Released cooki
e=1 reply_cookie=0 error=n/a
<30>[3.648452@0] systemd[1]: Lch-Got message type=signal sender=:1.2 
destination=n/a object=/org/freedesktop/systemd1/agent 
interface=org.freedesktop.systemd1.Agent member=Released cookie=1 reply_cookie
=0 error=n/a
<6>[3.650378@0] EXT4-fs (mmcblk0p9): re-mounted. Opts: (null)
<6>[3.652074@3] Lch-kdbus_bus_broadcast: conn_dst->id = 0x12, pid = 196, 
pid name = systemd-cgroups, tid = 196, tid name = systemd-cgroups
<30>[3.652220@3] systemd-cgroups-agent[196]: Lch-Sent message type=signal 
sender=n/a destination=n/a object=/org/freedesktop/systemd1/agent 
interface=org.freedesktop.systemd1.Agent member=Released cooki
e=1 reply_cookie=0 error=n/a
<6>[3.652284@3] Lch-kdbus_bus_broadcast: conn_dst->id = 0x2, pid = 1, pid 
name = systemd, tid = 1, tid name = systemd
<30>[3.653329@3] systemd[1]: Lch-Sent message type=signal sender=:1.2 
destination=n/a object=/org/freedesktop/systemd1/agent 
interface=org.freedesktop.systemd1.Agent member=Released cookie=1 reply_cooki
e=0 error=n/a


<30>[3.654166@3] systemd[1]: Lch-Got message type=signal sender=:1.20 
destination=n/a object=/org/freedesktop/systemd1/agent 
interface=org.freedesktop.systemd1.Agent member=Released cookie=1 reply_cooki
e=0 error=n/a
<6>[3.654642@3] Lch-kdbus_bus_broadcast: conn_dst->id = 0x2, pid = 1, pid 
name = systemd, tid = 1, tid name = systemd
<30>[3.654784@3] systemd[1]: Lch-Sent message type=signal sender=:1.20 
destination=n/a object=/org/freedesktop/systemd1/agent 
interface=org.freedesktop.systemd1.Agent member=Released cookie=1 reply_cook
ie=0 error=n/a
<30>[3.654958@3] systemd[1]: Lch-Got message type=signal sender=:1.18 
destination=n/a object=/org/freedesktop/systemd1/agent 
interface=org.freedesktop.systemd1.Agent member=Released cookie=1 reply_cooki
e=0 error=n/a
...


<6>[  809.109334@1] Lch-kdbus_bus_broadcast: conn_dst->id = 0x2, pid = 1, pid 
name = systemd, tid = 1, tid name = systemd
<30>[  809.109397@1] systemd[1]: Lch-Sent message type=signal sender=:1.2 
destination=n/a object=/org/freedesktop/systemd1/agent 
interface=org.freedesktop.systemd1.Agent member=Released cookie=1 reply_cooki
e=0 error=n/a
<30>[  809.109481@1] systemd[1]: Lch-Got message type=signal sender=:1.2 
destination=n/a object=/org/freedesktop/systemd1/agent 
interface=org.freedesktop.systemd1.Agent member=Released cookie=1 reply_cookie
=0 error=n/a
<6>[  809.109726@1] Lch-kdbus_bus_broadcast: conn_dst->id = 0x2, pid = 1, pid 
name = systemd, tid = 1, tid name = systemd
<30>[  809.109789@1] systemd[1]: Lch-Sent message type=signal sender=:1.2 
destination=n/a object=/org/freedesktop/systemd1/agent 
interface=org.freedesktop.systemd1.Agent member=Released cookie=1 reply_cooki
e=0 error=n/a
<30>[  809.109872@1] systemd[1]: Lch-Got message type=signal sender=:1.2 
destination=n/a object=/org/freedesktop/systemd1/agent 
interface=org.freedesktop.systemd1.Agent member=Released cookie=1 reply_cookie
=0 error=n/a






Thanks!
Li Cheng



At 2015-06-17 14:11:11, "eshark"  wrote:

Hi,
   I'm so sorry for not giving you more details,  I'm a freshman here, but I'll 
try to do better in the future.
I will give the answers under each of the questions .

At 2015-06-16 18:54:23, "David Herrmann"  wrote:
>Hi
>
>On Tue, Jun 16, 2015 at 12:07 PM, eshark  wrote:
>> At 2015-06-16 15:54:10, "David Herrmann"  wrote:
>>>Can you be more specific, please? What do you mean by "network module
>>>of our systemd cannot work OK"?
>>
>

>Does this only happen with kdbus?
Yes.  It's OK with DBus.
>Does this 

Re: [systemd-devel] Can kdbus send signal to the source connection?

2015-06-20 Thread eshark
Hi,
After removing /usr/lib/systemd/systemd-cgroups-agent,  all seems to work 
OK.


Thank you for your help!


Best Regards,
Li Cheng






At 2015-06-17 18:16:06, "eshark"  wrote:

Hi,
 With my kdbus broadcast patch, I found that the "systemd" process would 
endlessly emit the signal "type=signal sender=:1.2 destination=n/a 
object=/org/freedesktop/systemd1/agent interface=org.freedesktop.systemd1.Agent 
member=Released ".What does this signal  mean ?


I searched the source codes, and found that systemd-cgroups-agent would  
send this signal. But from the log, systemd-cgroups-agent only send this signal 
several times , not endlessly.


And I cannot locate the place where "systemd" send such signal. 


Following are the logs:


<27>[3.633361@3] systemd-cgroups-agent[196]: Lch-sd_bus_emit_signal 
org.freedesktop.systemd1.Agent Released
<27>[3.633660@2] systemd-cgroups-agent[216]: Lch-sd_bus_emit_signal 
org.freedesktop.systemd1.Agent Released
<6>[3.633989@2] Lch-kdbus_bus_broadcast: conn_dst->id = 0x14, pid = 216, 
pid name = systemd-cgroups, tid = 216, tid name = systemd-cgroups
<30>[3.634008@2] systemd-cgroups-agent[216]: Lch-Sent message type=signal 
sender=n/a destination=n/a object=/org/freedesktop/systemd1/agent 
interface=org.freedesktop.systemd1.Agent member=Released cooki
e=1 reply_cookie=0 error=n/a
<30>[3.648452@0] systemd[1]: Lch-Got message type=signal sender=:1.2 
destination=n/a object=/org/freedesktop/systemd1/agent 
interface=org.freedesktop.systemd1.Agent member=Released cookie=1 reply_cookie
=0 error=n/a
<6>[3.650378@0] EXT4-fs (mmcblk0p9): re-mounted. Opts: (null)
<6>[3.652074@3] Lch-kdbus_bus_broadcast: conn_dst->id = 0x12, pid = 196, 
pid name = systemd-cgroups, tid = 196, tid name = systemd-cgroups
<30>[3.652220@3] systemd-cgroups-agent[196]: Lch-Sent message type=signal 
sender=n/a destination=n/a object=/org/freedesktop/systemd1/agent 
interface=org.freedesktop.systemd1.Agent member=Released cooki
e=1 reply_cookie=0 error=n/a
<6>[3.652284@3] Lch-kdbus_bus_broadcast: conn_dst->id = 0x2, pid = 1, pid 
name = systemd, tid = 1, tid name = systemd
<30>[3.653329@3] systemd[1]: Lch-Sent message type=signal sender=:1.2 
destination=n/a object=/org/freedesktop/systemd1/agent 
interface=org.freedesktop.systemd1.Agent member=Released cookie=1 reply_cooki
e=0 error=n/a


<30>[3.654166@3] systemd[1]: Lch-Got message type=signal sender=:1.20 
destination=n/a object=/org/freedesktop/systemd1/agent 
interface=org.freedesktop.systemd1.Agent member=Released cookie=1 reply_cooki
e=0 error=n/a
<6>[3.654642@3] Lch-kdbus_bus_broadcast: conn_dst->id = 0x2, pid = 1, pid 
name = systemd, tid = 1, tid name = systemd
<30>[3.654784@3] systemd[1]: Lch-Sent message type=signal sender=:1.20 
destination=n/a object=/org/freedesktop/systemd1/agent 
interface=org.freedesktop.systemd1.Agent member=Released cookie=1 reply_cook
ie=0 error=n/a
<30>[3.654958@3] systemd[1]: Lch-Got message type=signal sender=:1.18 
destination=n/a object=/org/freedesktop/systemd1/agent 
interface=org.freedesktop.systemd1.Agent member=Released cookie=1 reply_cooki
e=0 error=n/a
...


<6>[  809.109334@1] Lch-kdbus_bus_broadcast: conn_dst->id = 0x2, pid = 1, pid 
name = systemd, tid = 1, tid name = systemd
<30>[  809.109397@1] systemd[1]: Lch-Sent message type=signal sender=:1.2 
destination=n/a object=/org/freedesktop/systemd1/agent 
interface=org.freedesktop.systemd1.Agent member=Released cookie=1 reply_cooki
e=0 error=n/a
<30>[  809.109481@1] systemd[1]: Lch-Got message type=signal sender=:1.2 
destination=n/a object=/org/freedesktop/systemd1/agent 
interface=org.freedesktop.systemd1.Agent member=Released cookie=1 reply_cookie
=0 error=n/a
<6>[  809.109726@1] Lch-kdbus_bus_broadcast: conn_dst->id = 0x2, pid = 1, pid 
name = systemd, tid = 1, tid name = systemd
<30>[  809.109789@1] systemd[1]: Lch-Sent message type=signal sender=:1.2 
destination=n/a object=/org/freedesktop/systemd1/agent 
interface=org.freedesktop.systemd1.Agent member=Released cookie=1 reply_cooki
e=0 error=n/a
<30>[  809.109872@1] systemd[1]: Lch-Got message type=signal sender=:1.2 
destination=n/a object=/org/freedesktop/systemd1/agent 
interface=org.freedesktop.systemd1.Agent member=Released cookie=1 reply_cookie
=0 error=n/a






Thanks!
Li Cheng



At 2015-06-17 14:11:11, "eshark"  wrote:

Hi,
   I'm so sorry for not giving you more details,  I'm a freshman here, but I'll 
try to do better in the future.
I will give the answers under each of the questions .

At 2015-06-16 18:54:23, "David Herrmann"  wrote:
>Hi
>
>On Tue, Jun 16, 2015 at 12:07 PM, eshark  wrote:
>> At 2015-06-16 15:54:10, "David Herrmann"  wrote:
>>>Can you be more specifi

[systemd-devel] Failed to run test-bus-zero-copy on ARM platform

2015-07-06 Thread eshark
 Hi, All,
My Software environment is : systemd v219 +  kdbus-4.1-rc1 + kernel_3.10
and my hardware platform is ARM CA9 quad core.

I failed to run the test-bus-zero-copy on my platform,  and then I 
traced into the issue ,
and found that the reason is that the padding  KDBU_ITEM_PAYLOAD_VEC will  fail 
to pass the 
access_ok() in kdbus_pool_slice_copy_iovec().

 In detail,in kdbus_msg_scan_items() , there is 
   "iov->iov_base = (char  __user *)zeros" ==> for example, the 
iov_base is 0xc0b1794c  on my platform
  and 
   "static const char * const zeros = "\0\0\0\0\0\0\0";"

But in slice->pool->f->f_op->aio_write() , that is 
generic_file_aio_write() , which calls  access_ok(access_flags, iv->iov_base, 
iv->iov_len);
And this will fail.

   However,  I can run test-bus-zero-copy successfully  in Fedora21 Virtual 
Machine which runs on x86-64 platform.
And  I run  systemd v219 +  kdbus-4.1-rc1 + kernel_3.18 in Fedora21 VM.

Could anyone give me some suggestion?
 
If  this isn't the right place to discuss this question , could you 
tell me where I can ask for help?


Thanks!


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


[systemd-devel] possible message leak in bus->wqueue ?

2015-08-07 Thread eshark
Hi, all
  If  some message went into bus->wqueue, and  failed to run  
ioctl(KDBUS_CMD_SEND) and returned  r < 0,
I found that this message will remain in the bus->wqueue.   If  the peer is  
killed for some reason, this message will fail to be sent and remain in the 
wqueu for ever.


Because in  dispatch_wqueue() ,  when bus_write_message() return r <0,   
dispatch_wqueue() will simply return this  "r " into the caller. 
And the wqueue is invisible to user application, so user application also 
cannot   remove this message to handle this error case.


 I wonder whether this is a problem, and if yes,  should we remove this message 
 in dispatch_wqueue() when  r < 0 ?




Thanks  a  lot !




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


[systemd-devel] question about sd_bus_slot_unref()

2015-08-31 Thread eshark

Hi, all


    I wonder why  the sd_bus_slot_unref() always returns NULL?  I expect that I 
can check whether the slot->n_ref ==0 by checking its return value.
That is


    _public_ sd_bus_slot* sd_bus_slot_unref(sd_bus_slot *slot) {

if (!slot)
return NULL;

assert(slot->n_ref > 0);

if (slot->n_ref > 1) {
slot->n_ref --;

//return NULL;
       retrun slot;   
  }

bus_slot_disconnect(slot);
free(slot->description);
free(slot);

return NULL;

}


 As the libsystem doesn't provide some API for the application to get the n_ref 
from the sd_bus_slot,  maybe we can provide the same feature this way?


Thanks!


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


[systemd-devel] misuse of _cleanup_free_ in bus_message_from_header() ?

2015-09-01 Thread eshark
Hi, All,

   I found that in bus-message.c  , the  bus_message_from_header() seems to 
misuse the _cleanup_free_ ,

   int bus_message_from_header()
   {
   
 _cleanup_free_  sd_bus_message *m = NULL;
  ==>
 _cleanup_bus_message_unref_  sd_bus_message *m = NULL;
   
   }

  Is it right?


   Thanks!

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


[systemd-devel] wrong return value when fork() fail in exec_spawn() ?

2015-11-25 Thread eshark

   Hi, all,

It seems that  the exec_spawn() will return 0 if fork() fails,  because  
that
return log_unit_error_errno(params->unit_id, errno, "Failed to 
fork: %m");
 will return -r eventually.  And here r = exec_context_load_environment() , 
which has 
 exited successfully.

   This may lead big trouble to the caller of  exec_spawn().  For example,  
mount_spawn(), which 
also calls exec_spawn(), will not goto fail but run continuelly in this case. 
Then the following unit_watch_pid()
will fail  at assert(pid >= 1);. 

   I also commit a patch to fix this problem, please help to review.
  
  Thanks a lot!

 Li Cheng

  

0001-core-execute-fix-fork-fail-handling-in-exec_spawn.patch
Description: Binary data
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] wrong return value when fork() fail in exec_spawn() ?

2015-11-26 Thread eshark

   Hi, all,

It seems that  the exec_spawn() will return 0 if fork() fails,  because  
that
return log_unit_error_errno(params->unit_id, errno, "Failed to 
fork: %m");
 will return -r eventually.  And here r = exec_context_load_environment() , 
which has 
 exited successfully.

   This may lead big trouble to the caller of  exec_spawn().  For example,  
mount_spawn(), which 
also calls exec_spawn(), will not goto fail but run continuelly in this case. 
Then the following unit_watch_pid()
will fail  at assert(pid >= 1);. 

   I also commit a patch to fix this problem, please help to review.
  
  Thanks a lot!

 Li Cheng

  

0001-core-execute-fix-fork-fail-handling-in-exec_spawn.patch
Description: Binary data
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] question about the conditions for bus_enter_closing()

2015-12-06 Thread eshark

Hi, All


         In the sd-bus.c, there are four conditions for calling the 
bus_enter_closing, as is: 

                        if (r == -ENOTCONN || r == -ECONNRESET || r == -EPIPE 
|| r == -ESHUTDOWN) {
                                   bus_enter_closing(bus);
                                   return -ECONNRESET;
                           }
   
         While working with kdbus in the kernel, the kdbus return -EPIPE  to 
the remote connection while the local connection dies, and sometimes the kdbus
also return -ECONNRESET when the local connection dies. 
  
         Thus, it seems unreasonable for the remote connection to enter 
BUS_CLOSING state when it gets -EPIPE or sometimes -ECONNRESET.


         If you agree with the above issues,  which is the better choice, to 
modify the conditions in the sd-bus.c , or to modify the errno in the kdbus 
kernel?

Because the kdbus kernel always return -EPIPE to the remote connection 
, so it is reasonable to remove the EPIPE from the sd-bus.c ?
  And becasue the kdbus kernel sometimes returen -ECONNRESET to the remote 
connection when the local connection dies, so it is reasonable to give a new 
errno for this case? such as EPERM or EHOSTUNREACH..


B.R.
Li Cheng


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


[systemd-devel] question about the conditions for bus_enter_closing()

2015-12-08 Thread eshark

Hi, All


         In the sd-bus.c, there are four conditions for calling the 
bus_enter_closing, as is: 

                        if (r == -ENOTCONN || r == -ECONNRESET || r == -EPIPE 
|| r == -ESHUTDOWN) {
                                   bus_enter_closing(bus);
                                   return -ECONNRESET;
                           }
   
         While working with kdbus in the kernel, the kdbus return -EPIPE  to 
the remote connection while the local connection dies, and sometimes the kdbus
also return -ECONNRESET when the local connection dies. 
  
         Thus, it seems unreasonable for the remote connection to enter 
BUS_CLOSING state when it gets -EPIPE or sometimes -ECONNRESET.


         If you agree with the above issues,  which is the better choice, to 
modify the conditions in the sd-bus.c , or to modify the errno in the kdbus 
kernel?

Because the kdbus kernel always return -EPIPE to the remote connection 
, so it is reasonable to remove the EPIPE from the sd-bus.c ?
  And becasue the kdbus kernel sometimes returen -ECONNRESET to the remote 
connection when the local connection dies, so it is reasonable to give a new 
errno for this case? such as EPERM or EHOSTUNREACH..


B.R.
Li Cheng


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