[systemd-devel] systemctl can't execute stop actually, when service is started by other way

2017-06-26 Thread ????
for example: service nscd
1.execute: systemctl stop nscd.service
  stop nscd process actually
2.execute: /usr/bin/nscd
  start nscd by shell command
3.execute: systemctl status nscd.service
  inactive(dead)
  systemctl can't know nscd is running
4.excute: systemctl stop nscd.service
  nscd process still exist, it seems that systemctl does not execute stop 
actually


How can I stop nscd.service by systemctl when it is started not by systemctl?


Why I need stop nscd.service by systemctl? 
Because when linux reboot or shut down, linux will auto stop service by 
'systemctl stop nscd.service'.
If 'systemctl stop nscd.service' does not stop service actually, my service 
will exit abnormally. That may lead data loss in my service.


Thank you very much___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Returning arrays from sd-bus methods

2017-06-26 Thread guhan balasubramanian
Hi Lennart,

Thank you for the reply. Please find my comments inline:

On Sat, Jun 24, 2017 at 12:55 AM, Lennart Poettering  wrote:

> On Fri, 23.06.17 20:45, guhan balasubramanian (guhan@gmail.com) wrote:
>
> > Hi,
> >
> > I'm currently trying out sd-bus methods for my application. I am in a
> > situation where I must accept an input and return a byte array based on
> the
> > input.
> >
> > In the vtable. the following declaration is present:
> > SD_BUS_METHOD("method_id", "x", "ay", method_1, 0)
> >
> > And inside the definition for method_1, for returning:
> > uint8_t b[2] = {0x01, 0x02};
> > sd_bus_reply_method_return(m, "ay", b);
>
> if you use sd_bus_reply_method_return() (or sd_bus_append()) the
> arguments to pass for an array is the array's size followed by the
> members. Hence, the following should do what you want:
>
> sd_bus_reply_method_return(m, "ay", 2, 0x01, 0x02);
>

This worked for me. But I had the following three questions based on this:

1. Would it be a good design to construct a va_list of the array elements
and pass it as the last argument in sd_bus_reply_method_return?

2. I wasn't able to find the definition for sd_bus_append, I think you
meant *sd_bus_message_append*() right? But, if I do that and append the
array, I wouldn't be able to use *sd_bus_reply_method_return* with the
correct type. I was able to achieve this on get-property, since
property_handlers wouldn't need a return.

I am not sure about how to handle this one. Would I be able to find a
reference code/doc for this?

3. Is there an API to pass the entire container (array in this case) for a
 method return?


> Lennart
>
> --
> Lennart Poettering, Red Hat
>


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