Some of the strings/structures are Dell OEM though.. so wasn't sure of the best 
place to put it. I don't want to split it between the two.  Also some of the 
dell oem commands use (will use) getsysinfo (I could make that common).

--jordan hargrave
Dell Enterprise Linux Engineering


> -----Original Message-----
> From: Al Chu [mailto:ch...@llnl.gov]
> Sent: Tuesday, August 07, 2012 11:13 PM
> To: Hargrave, Jordan
> Cc: ipmitool-devel@lists.sourceforge.net
> Subject: Re: [Ipmitool-devel] [PATCH] add support for delloem
> getsysinfo/setsysinfo (store OS information to BMC)
>
> On Tue, 2012-08-07 at 16:00 -0700, jordan_hargr...@dell.com wrote:
> > One of the new IPMI commands is the ability to store/retrieve
> nonvolatile strings to the BMC.
> > These strings will be displayed in the BMC/iDrac webserver to show
> the OS hostname, release and version.
>
> This is a standard IPMI command/mechanism.  It shouldn't be under
> "delloem".  Under "mc" seems to be the best option.
>
> Al
>
> > Index: doc/ipmitool.1
> > ===================================================================
> > RCS file: /cvsroot/ipmitool/ipmitool/doc/ipmitool.1,v
> > retrieving revision 1.48
> > diff -u -p -b -r1.48 ipmitool.1
> > --- doc/ipmitool.1      17 May 2012 15:52:35 -0000      1.48
> > +++ doc/ipmitool.1      7 Aug 2012 22:55:05 -0000
> > @@ -1277,6 +1277,22 @@ Ends the windbg session (SOL Deactivatio
> >
> >  Shows Extended SD Card information
> >  .RE
> > +.TP
> > +\fIgetsysinfo {os_name}|{primary_os_name}|{os_version}|{url}\fP
> > +.RS
> > +.br
> > +
> > +Retrieves system info from bmc for given argument
> > +.RE
> > +.TP
> > +\fIsetsysinfo\fP
> \fI{os_name}\fP|\fI{primary_os_name}\fP|\fI{os_version}\fP|\fI{url}\fP
> > +.RS
> > +<\fBstring\fR>
> > +.br
> > +
> > +Stores system info string to bmc for given argument
> > +
> > +.RE
> >  .RE
> >  .TP
> >  .TP
> > Index: lib/ipmi_delloem.c
> > ===================================================================
> > RCS file: /cvsroot/ipmitool/ipmitool/lib/ipmi_delloem.c,v
> > retrieving revision 1.16
> > diff -u -p -b -r1.16 ipmi_delloem.c
> > --- lib/ipmi_delloem.c  3 Aug 2012 17:07:07 -0000       1.16
> > +++ lib/ipmi_delloem.c  7 Aug 2012 22:55:05 -0000
> > @@ -238,6 +238,8 @@ static int ipmi_delloem_setled_main(stru
> >  static int ipmi_setled_state (struct ipmi_intf * intf, int bayId,
> int slotId, int state);
> >  static int ipmi_getdrivemap (struct ipmi_intf * intf, int b, int d,
> int f, int *bayId, int *slotId);
> >
> > +static int ipmi_delloem_sysinfo_main(struct ipmi_intf *intf, int
> argc, char ** argv);
> > +
> >  /*****************************************************************
> >  * Function Name:       ipmi_delloem_main
> >  *
> > @@ -292,6 +294,11 @@ ipmi_delloem_main(struct ipmi_intf * int
> >         {
> >          ipmi_delloem_vFlash_main (intf,argc,argv);
> >         }
> > +       else if (strncmp(argv[current_arg], "setsysinfo\0", 11) == 0
> ||
> > +                strncmp(argv[current_arg], "getsysinfo\0", 11) == 0)
> > +         {
> > +           ipmi_delloem_sysinfo_main (intf,argc,argv);
> > +         }
> >      else
> >      {
> >          usage();
> > @@ -323,6 +330,8 @@ static void usage(void)
> >      lprintf(LOG_NOTICE, "    setled");
> >      lprintf(LOG_NOTICE, "    powermonitor");
> >      lprintf(LOG_NOTICE, "    vFlash");
> > +    lprintf(LOG_NOTICE, "    setsysinfo");
> > +    lprintf(LOG_NOTICE, "    getsysinfo");
> >      lprintf(LOG_NOTICE, "");
> >      lprintf(LOG_NOTICE, "For help on individual commands type:");
> >      lprintf(LOG_NOTICE, "delloem <command> help");
> > @@ -5292,6 +5301,35 @@ ipmi_delloem_setled_main(struct ipmi_int
> >      return ipmi_setled_state (intf, bayId, slotId, mask);
> >  }
> >
> > +static int sysinfo_param(const char *str)
> > +{
> > +    if (!strcmp(str, "hostname"))
> > +       return 0x02;
> > +    if (!strcmp(str, "primary_os_name"))
> > +       return 0x03;
> > +    if (!strcmp(str, "os_name"))
> > +       return 0x04;
> > +    if (!strcmp(str, "os_version"))
> > +       return 0xe4;
> > +    return strtoul(str, 0, 16);
> > +}
> > +
> > +static void ipmi_sysinfo_usage()
> > +{
> > +       lprintf(LOG_NOTICE, "");
> > +       lprintf(LOG_NOTICE, "   getsysinfo
> (os_name|primary_os_name|os_version|url)");
> > +       lprintf(LOG_NOTICE, "      Retrieves system info from bmc for
> given argument");
> > +       lprintf(LOG_NOTICE, "   setsysinfo
> (os_name|primary_os_name|os_version|url)");
> > +       lprintf(LOG_NOTICE, "      Stores system Info for given
> argument to bmc");
> > +       lprintf(LOG_NOTICE, "");
> > +       lprintf(LOG_NOTICE, "   primary_os_name = primary operating
> system name");
> > +       lprintf(LOG_NOTICE, "   os_version = running version of
> operating system");
> > +       lprintf(LOG_NOTICE, "   os_name = operating system name");
> > +       lprintf(LOG_NOTICE, "   hostname = hostname of server");
> > +       lprintf(LOG_NOTICE, "   url = url of bmc webserver");
> > +
> > +       lprintf(LOG_NOTICE, "");
> > +}
> >
> >  /*****************************************************************
> >   * Function Name:       ipmi_getsysinfo
> > @@ -5329,6 +5367,12 @@ ipmi_getsysinfo(struct ipmi_intf * intf,
> >      data[2] = block;
> >      data[3] = set;
> >
> > +    // Format of get output is:
> > +    //   u8 param_rev
> > +    //   u8 selector
> > +    //   u8 encoding  bit[0-3];
> > +    //   u8 length
> > +    //   u8 data0[14]
> >      rsp = intf->sendrecv(intf, &req);
> >      if (rsp != NULL) {
> >          if (rsp->ccode == 0) {
> > @@ -5341,3 +5385,113 @@ ipmi_getsysinfo(struct ipmi_intf * intf,
> >      }
> >      return -1;
> >  }
> > +
> > +/*****************************************************************
> > + * Function Name:       ipmi_setsysinfo
> > + *
> > + * Description:         This function processes the IPMI Set System
> Info command
> > + * Input:               intf    - ipmi interface
> > + *                      len     - Length of buffer
> > + *                      buffer  - Pointer to buffer
> > + * Output:
> > + *
> > + * Return:              return code     0 - success
> > + *                         -1 - failure
> > + *                         other = IPMI ccode
> > + *
> > + ******************************************************************/
> > +static int
> > +ipmi_setsysinfo(struct ipmi_intf * intf, int len, void *buffer)
> > +{
> > +    struct ipmi_rs *rsp = NULL;
> > +    struct ipmi_rq req={0};
> > +
> > +    req.msg.netfn = IPMI_NETFN_APP;
> > +    req.msg.lun = 0;
> > +    req.msg.cmd = IPMI_SET_SYS_INFO;
> > +    req.msg.data_len = len;
> > +    req.msg.data = buffer;
> > +
> > +    // Format of set input:
> > +    //   u8 param rev
> > +    //   u8 selector
> > +    //   u8 data1[16]
> > +    rsp = intf->sendrecv(intf, &req);
> > +    if (rsp != NULL) {
> > +        return rsp->ccode;
> > +    }
> > +    return -1;
> > +}
> > +
> > +static int ipmi_delloem_sysinfo_main(struct ipmi_intf *intf, int
> argc, char ** argv)
> > +{
> > +    int param, isset;
> > +    char *str;
> > +    unsigned char  infostr[256], *pos;
> > +    unsigned char  paramdata[32];
> > +    int   j, set;
> > +
> > +    /* Is this a setsysinfo or getsysinfo */
> > +    isset = !strncmp(argv[current_arg], "setsysinfo\0",11);
> > +
> > +    current_arg++;
> > +    if (argc < current_arg) {
> > +       usage();
> > +        return -1;
> > +    }
> > +    if (argc == 1 || strcmp(argv[current_arg], "help") == 0 ||
> > +       argc < (isset ? current_arg+2 : current_arg+1)) {
> > +       ipmi_sysinfo_usage();
> > +       return 0;
> > +    }
> > +    memset(infostr, 0, sizeof(infostr));
> > +
> > +    // Parameters
> > +    //   1  = system firmware version
> > +    //   2  = system hostname
> > +    //   3  = primary operating system name (non-volatile)
> > +    //   4  = operating system name (volatile)
> > +    // 0xe3 = operating system version
> > +    param = sysinfo_param(argv[current_arg++]);
> > +
> > +    if (isset) {
> > +       str = argv[current_arg];
> > +       set = j = 0;
> > +       while (j < strlen(str)) {
> > +           memset(paramdata, 0, sizeof(paramdata));
> > +           paramdata[0] = param;
> > +           paramdata[1] = set;
> > +           if (set == 0) {
> > +             /* First block is special case */
> > +               paramdata[2] = 0;           // ascii encoding
> > +               paramdata[3] = strlen(str); // length;
> > +               strncpy(paramdata+4, str+j, 14);
> > +               j += 14;
> > +           } else {
> > +               strncpy(paramdata+2, str+j, 16);
> > +               j += 16;
> > +           }
> > +           if (ipmi_setsysinfo(intf, 18, paramdata))
> > +               break;
> > +           set++;
> > +       }
> > +    } else {
> > +       pos = infostr;
> > +
> > +       /* Read 4 blocks of data (64 bytes) */
> > +       for (set=0; set<4; set++) {
> > +           if (ipmi_getsysinfo(intf, param, set, 0, 18, paramdata))
> > +               break;
> > +           if (set == 0) {
> > +             /* First block is special case */
> > +               memcpy(pos, paramdata+4, 14);
> > +               pos += 14;
> > +           } else {
> > +               memcpy(pos, paramdata+2, 16);
> > +               pos += 16;
> > +           }
> > +       }
> > +       printf("%s\n", infostr);
> > +    }
> > +    return 0;
> > +}
> >
> > --jordan hargrave
> > Dell Enterprise Linux Engineering
> >
> >
> > > -----Original Message-----
> > > From: ipmitool-devel-requ...@lists.sourceforge.net
> [mailto:ipmitool-
> > > devel-requ...@lists.sourceforge.net]
> > > Sent: Tuesday, August 07, 2012 4:55 PM
> > > To: ipmitool-devel@lists.sourceforge.net
> > > Subject: Ipmitool-devel Digest, Vol 74, Issue 1
> > >
> > > Send Ipmitool-devel mailing list submissions to
> > >       ipmitool-devel@lists.sourceforge.net
> > >
> > > To subscribe or unsubscribe via the World Wide Web, visit
> > >       https://lists.sourceforge.net/lists/listinfo/ipmitool-devel
> > > or, via email, send a message with subject or body 'help' to
> > >       ipmitool-devel-requ...@lists.sourceforge.net
> > >
> > > You can reach the person managing the list at
> > >       ipmitool-devel-ow...@lists.sourceforge.net
> > >
> > > When replying, please edit your Subject line so it is more specific
> > > than "Re: Contents of Ipmitool-devel digest..."
> > >
> > >
> > > Today's Topics:
> > >
> > >    1. [PATCH] Added system support to ipmievd (Jan Safranek)
> > >    2. ipmitool 1.8.12 release  this week (Jim Mankovich)
> > >    3. Re: [PATCH] Added system support to ipmievd (Zdenek Styblik)
> > >    4. Re: ipmitool 1.8.12 release  this week (Carson Gaspar)
> > >    5. Re: ipmitool 1.8.12 release  this week (Jim Mankovich)
> > >    6. Re: ipmitool 1.8.12 release  this week (Jim Mankovich)
> > >
> > >
> > > -------------------------------------------------------------------
> ---
> > >
> > > Message: 1
> > > Date: Fri, 03 Aug 2012 15:10:11 +0200
> > > From: Jan Safranek <jsafr...@redhat.com>
> > > Subject: [Ipmitool-devel] [PATCH] Added system support to ipmievd
> > > To: ipmitool-devel@lists.sourceforge.net
> > > Message-ID:
> <20120803130546.21878.8419.st...@bublifuk.brq.redhat.com>
> > > Content-Type: text/plain; charset="utf-8"
> > >
> > > Hi,
> > >
> > > I've encountered some problems with running ipmievd under systemd -
> it
> > > does not
> > > understand the way how ipmievd forks and times out when starting
> the
> > > service.
> > > This patch adds 'Type=notify' support to ipmievd and systemd can
> start
> > > ipmievd with full error detection.
> > >
> > > See http://0pointer.de/public/systemd-man/sd_notify.html for
> details,
> > > how description, how ipmievd communicates with systemd. I copied
> > > appropriate
> > > Lennart's code to helper.c, it has very tolerant license.
> > > ---
> > >
> > >  configure.in              |    7 +++
> > >  include/ipmitool/helper.h |    2 +
> > >  lib/helper.c              |   99
> > > +++++++++++++++++++++++++++++++++++++++++++++
> > >  src/ipmievd.c             |    1
> > >  4 files changed, 109 insertions(+)
> > >
> > > diff --git a/configure.in b/configure.in
> > > index 680619c..fdb58e6 100644
> > > --- a/configure.in
> > > +++ b/configure.in
> > > @@ -496,6 +496,13 @@ AC_ARG_ENABLE([file-security],
> > >           AC_DEFINE(ENABLE_FILE_SECURITY, [1], [Define to 1 for
> extra
> > > file security.])
> > >       fi], [])
> > >
> > > +dnl Enable systemd integration
> > > +AC_ARG_ENABLE([systemd],
> > > +     [AC_HELP_STRING([--enable-systemd],
> > > +                     [enable systemd service type=notify support
> in
> > > ipmievd. ])],
> > > +     [if test "x$enable_systemd" != "xno"; then
> > > +         AC_DEFINE(ENABLE_SYSTEMD, [1], [Define to 1 if building
> for
> > > systemd.])
> > > +     fi], [])
> > >
> > >  AC_TRY_RUN([
> > >       #include <stdio.h>
> > > diff --git a/include/ipmitool/helper.h b/include/ipmitool/helper.h
> > > index bc2bc02..9c6de72 100644
> > > --- a/include/ipmitool/helper.h
> > > +++ b/include/ipmitool/helper.h
> > > @@ -85,6 +85,8 @@ void printbuf(const uint8_t * buf, int len, const
> > > char * desc);
> > >  uint8_t ipmi_csum(uint8_t * d, int s);
> > >  FILE * ipmi_open_file(const char * file, int rw);
> > >  void ipmi_start_daemon(struct ipmi_intf *intf);
> > > +void ipmi_notify_sd(char *state);
> > > +
> > >
> > >  #define ipmi_open_file_read(file)    ipmi_open_file(file, 0)
> > >  #define ipmi_open_file_write(file)   ipmi_open_file(file, 1)
> > > diff --git a/lib/helper.c b/lib/helper.c
> > > index fb10770..6809342 100644
> > > --- a/lib/helper.c
> > > +++ b/lib/helper.c
> > > @@ -604,3 +604,102 @@ ipmi_start_daemon(struct ipmi_intf *intf)
> > >       dup(0);
> > >       dup(0);
> > >  }
> > > +
> > > +/***
> > > +  Copyright 2010 Lennart Poettering
> > > +
> > > +  Permission is hereby granted, free of charge, to any person
> > > +  obtaining a copy of this software and associated documentation
> files
> > > +  (the "Software"), to deal in the Software without restriction,
> > > +  including without limitation the rights to use, copy, modify,
> merge,
> > > +  publish, distribute, sublicense, and/or sell copies of the
> Software,
> > > +  and to permit persons to whom the Software is furnished to do
> so,
> > > +  subject to the following conditions:
> > > +
> > > +  The above copyright notice and this permission notice shall be
> > > +  included in all copies or substantial portions of the Software.
> > > +
> > > +  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> > > +  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
> OF
> > > +  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> > > +  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
> HOLDERS
> > > +  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
> AN
> > > +  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
> IN
> > > +  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> > > +  SOFTWARE.
> > > +***/
> > > +#ifdef ENABLE_SYSTEMD
> > > +#include <sys/un.h>
> > > +#include <stddef.h>
> > > +#endif
> > > +
> > > +void
> > > +ipmi_notify_sd(char *state)
> > > +{
> > > +#if ENABLE_SYSTEMD
> > > +     int unset_environment = 0;
> > > +
> > > +        int fd = -1, r;
> > > +        struct msghdr msghdr;
> > > +        struct iovec iovec;
> > > +        const char *e;
> > > +     struct sockaddr_un un;
> > > +
> > > +        if (!state) {
> > > +                r = -EINVAL;
> > > +                goto finish;
> > > +        }
> > > +
> > > +        if (!(e = getenv("NOTIFY_SOCKET")))
> > > +                return;
> > > +
> > > +        /* Must be an abstract socket, or an absolute path */
> > > +        if ((e[0] != '@' && e[0] != '/') || e[1] == 0) {
> > > +                r = -EINVAL;
> > > +                goto finish;
> > > +        }
> > > +
> > > +        if ((fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0)) <
> 0) {
> > > +                r = -errno;
> > > +                goto finish;
> > > +        }
> > > +
> > > +        memset(&un, 0, sizeof(un));
> > > +        un.sun_family = AF_UNIX;
> > > +        strncpy(un.sun_path, e, sizeof(un.sun_path));
> > > +
> > > +        if (un.sun_path[0] == '@')
> > > +                un.sun_path[0] = 0;
> > > +
> > > +        memset(&iovec, 0, sizeof(iovec));
> > > +        iovec.iov_base = (char *)state;
> > > +        iovec.iov_len = strlen(state);
> > > +
> > > +        memset(&msghdr, 0, sizeof(msghdr));
> > > +        msghdr.msg_name = &un;
> > > +        msghdr.msg_namelen = offsetof(struct sockaddr_un,
> sun_path) +
> > > strlen(e);
> > > +
> > > +        if (msghdr.msg_namelen > sizeof(struct sockaddr_un))
> > > +                msghdr.msg_namelen = sizeof(struct sockaddr_un);
> > > +
> > > +        msghdr.msg_iov = &iovec;
> > > +        msghdr.msg_iovlen = 1;
> > > +
> > > +        if (sendmsg(fd, &msghdr, MSG_NOSIGNAL) < 0) {
> > > +                r = -errno;
> > > +                goto finish;
> > > +        }
> > > +
> > > +        r = 1;
> > > +
> > > +finish:
> > > +        if (unset_environment)
> > > +                unsetenv("NOTIFY_SOCKET");
> > > +
> > > +        if (fd >= 0)
> > > +                close(fd);
> > > +
> > > +        return;
> > > +#endif
> > > +}
> > > +
> > > diff --git a/src/ipmievd.c b/src/ipmievd.c
> > > index 19cdea6..136cc77 100644
> > > --- a/src/ipmievd.c
> > > +++ b/src/ipmievd.c
> > > @@ -766,6 +766,7 @@ ipmievd_main(struct ipmi_event_intf * eintf,
> int
> > > argc, char ** argv)
> > >               fprintf(fp, "%d\n", (int)getpid());
> > >               fclose(fp);
> > >       }
> > > +     ipmi_notify_sd("READY=1");
> > >
> > >       /* register signal handler for cleanup */
> > >       act.sa_handler = ipmievd_cleanup;
> > >
> > >
> > >
> > >
> > > ------------------------------
> > >
> > > Message: 2
> > > Date: Tue, 07 Aug 2012 13:56:06 -0600
> > > From: Jim Mankovich <jm...@hp.com>
> > > Subject: [Ipmitool-devel] ipmitool 1.8.12 release  this week
> > > To: "ipmitool-devel@lists.sourceforge.net"
> > >       <ipmitool-devel@lists.sourceforge.net>
> > > Message-ID: <502172d6.2080...@hp.com>
> > > Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> > >
> > > All,
> > >
> > > I've updated the ipmitool ChangeLog with information about what has
> > > changed since 1.8.11,
> > > tagged all the source files in the cvs tree with IPMITOOL_1_8_12,
> and
> > > changed the version
> > > in configure.in to 1.8.12.    I'm running some of my own regression
> > > tests and if all goes I'll make
> > > a 1.8.12 tar bundle available on on Thursday, Aug 9, 2012.    I
> decided
> > > not to do any kind of beta
> > > version since I  figured I could always just go ahead an cut a
> 1.8.13
> > > when and if problems are found
> > > and resolved in version 1.8.12.   I would like to avoid years
> between
> > > updates if at all possible.
> > >
> > > I would appreciate if folks could do some testing and report any
> issues
> > > they find when the tar bundle
> > > becomes available.   If you have a little time in the next couple
> of
> > > days and want to verify for me that
> > > what I tagged as 1.8.12 works and that the ChangeLog is reasonable,
> > > please check ipmitool out of
> > > the cvs repository by tag and let me know if I missed anything.
> > >
> > > Please take the time to  file Tracker Bugs as you find problems.
> > >
> > > Thanks in advance,
> > > Jim
> > >
> > > --
> > > -- Jim Mankovich | jm...@hp.com --
> > >
> > >
> > >
> > >
> > > ------------------------------
> > >
> > > Message: 3
> > > Date: Tue, 7 Aug 2012 22:21:46 +0200
> > > From: Zdenek Styblik <zdenek.styb...@gmail.com>
> > > Subject: Re: [Ipmitool-devel] [PATCH] Added system support to
> ipmievd
> > > To: Jan Safranek <jsafr...@redhat.com>
> > > Cc: ipmitool-devel@lists.sourceforge.net
> > > Message-ID:
> > >       <CAJbk2qtSB4bgTdvVGh4i3ib0-
> > > eks4orwsvcv83_mujaqgcj...@mail.gmail.com>
> > > Content-Type: text/plain; charset=UTF-8
> > >
> > > On Fri, Aug 3, 2012 at 3:10 PM, Jan Safranek <jsafr...@redhat.com>
> > > wrote:
> > > > Hi,
> > > >
> > > > I've encountered some problems with running ipmievd under systemd
> -
> > > it does not
> > > > understand the way how ipmievd forks and times out when starting
> the
> > > service.
> > > > This patch adds 'Type=notify' support to ipmievd and systemd can
> > > start
> > > > ipmievd with full error detection.
> > > >
> > > > See http://0pointer.de/public/systemd-man/sd_notify.html for
> details,
> > > > how description, how ipmievd communicates with systemd. I copied
> > > appropriate
> > > > Lennart's code to helper.c, it has very tolerant license.
> > >
> > > Hello,
> > >
> > > I'm wondering whether you're serious about the license bit or not.
> And
> > > if you are, I ask you to change it, release it, under BSD as
> ipmitool
> > > is released under BSD license.
> > >
> > > Thanks for understanding and eventual reply,
> > > Z.
> > >
> > > > ---
> > > >
> > > >  configure.in              |    7 +++
> > > >  include/ipmitool/helper.h |    2 +
> > > >  lib/helper.c              |   99
> > > +++++++++++++++++++++++++++++++++++++++++++++
> > > >  src/ipmievd.c             |    1
> > > >  4 files changed, 109 insertions(+)
> > > >
> > > > diff --git a/configure.in b/configure.in
> > > > index 680619c..fdb58e6 100644
> > > > --- a/configure.in
> > > > +++ b/configure.in
> > > > @@ -496,6 +496,13 @@ AC_ARG_ENABLE([file-security],
> > > >             AC_DEFINE(ENABLE_FILE_SECURITY, [1], [Define to 1 for
> > > extra file security.])
> > > >         fi], [])
> > > >
> > > > +dnl Enable systemd integration
> > > > +AC_ARG_ENABLE([systemd],
> > > > +       [AC_HELP_STRING([--enable-systemd],
> > > > +                       [enable systemd service type=notify
> support
> > > in ipmievd. ])],
> > > > +       [if test "x$enable_systemd" != "xno"; then
> > > > +           AC_DEFINE(ENABLE_SYSTEMD, [1], [Define to 1 if
> building
> > > for systemd.])
> > > > +       fi], [])
> > > >
> > > >  AC_TRY_RUN([
> > > >         #include <stdio.h>
> > > > diff --git a/include/ipmitool/helper.h
> b/include/ipmitool/helper.h
> > > > index bc2bc02..9c6de72 100644
> > > > --- a/include/ipmitool/helper.h
> > > > +++ b/include/ipmitool/helper.h
> > > > @@ -85,6 +85,8 @@ void printbuf(const uint8_t * buf, int len,
> const
> > > char * desc);
> > > >  uint8_t ipmi_csum(uint8_t * d, int s);
> > > >  FILE * ipmi_open_file(const char * file, int rw);
> > > >  void ipmi_start_daemon(struct ipmi_intf *intf);
> > > > +void ipmi_notify_sd(char *state);
> > > > +
> > > >
> > > >  #define ipmi_open_file_read(file)      ipmi_open_file(file, 0)
> > > >  #define ipmi_open_file_write(file)     ipmi_open_file(file, 1)
> > > > diff --git a/lib/helper.c b/lib/helper.c
> > > > index fb10770..6809342 100644
> > > > --- a/lib/helper.c
> > > > +++ b/lib/helper.c
> > > > @@ -604,3 +604,102 @@ ipmi_start_daemon(struct ipmi_intf *intf)
> > > >         dup(0);
> > > >         dup(0);
> > > >  }
> > > > +
> > > > +/***
> > > > +  Copyright 2010 Lennart Poettering
> > > > +
> > > > +  Permission is hereby granted, free of charge, to any person
> > > > +  obtaining a copy of this software and associated documentation
> > > files
> > > > +  (the "Software"), to deal in the Software without restriction,
> > > > +  including without limitation the rights to use, copy, modify,
> > > merge,
> > > > +  publish, distribute, sublicense, and/or sell copies of the
> > > Software,
> > > > +  and to permit persons to whom the Software is furnished to do
> so,
> > > > +  subject to the following conditions:
> > > > +
> > > > +  The above copyright notice and this permission notice shall be
> > > > +  included in all copies or substantial portions of the
> Software.
> > > > +
> > > > +  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
> KIND,
> > > > +  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
> WARRANTIES OF
> > > > +  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> > > > +  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
> > > HOLDERS
> > > > +  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
> IN AN
> > > > +  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
> IN
> > > > +  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE
> > > > +  SOFTWARE.
> > > > +***/
> > > > +#ifdef ENABLE_SYSTEMD
> > > > +#include <sys/un.h>
> > > > +#include <stddef.h>
> > > > +#endif
> > > > +
> > > > +void
> > > > +ipmi_notify_sd(char *state)
> > > > +{
> > > > +#if ENABLE_SYSTEMD
> > > > +       int unset_environment = 0;
> > > > +
> > > > +        int fd = -1, r;
> > > > +        struct msghdr msghdr;
> > > > +        struct iovec iovec;
> > > > +        const char *e;
> > > > +       struct sockaddr_un un;
> > > > +
> > > > +        if (!state) {
> > > > +                r = -EINVAL;
> > > > +                goto finish;
> > > > +        }
> > > > +
> > > > +        if (!(e = getenv("NOTIFY_SOCKET")))
> > > > +                return;
> > > > +
> > > > +        /* Must be an abstract socket, or an absolute path */
> > > > +        if ((e[0] != '@' && e[0] != '/') || e[1] == 0) {
> > > > +                r = -EINVAL;
> > > > +                goto finish;
> > > > +        }
> > > > +
> > > > +        if ((fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0)) <
> 0)
> > > {
> > > > +                r = -errno;
> > > > +                goto finish;
> > > > +        }
> > > > +
> > > > +        memset(&un, 0, sizeof(un));
> > > > +        un.sun_family = AF_UNIX;
> > > > +        strncpy(un.sun_path, e, sizeof(un.sun_path));
> > > > +
> > > > +        if (un.sun_path[0] == '@')
> > > > +                un.sun_path[0] = 0;
> > > > +
> > > > +        memset(&iovec, 0, sizeof(iovec));
> > > > +        iovec.iov_base = (char *)state;
> > > > +        iovec.iov_len = strlen(state);
> > > > +
> > > > +        memset(&msghdr, 0, sizeof(msghdr));
> > > > +        msghdr.msg_name = &un;
> > > > +        msghdr.msg_namelen = offsetof(struct sockaddr_un,
> sun_path)
> > > + strlen(e);
> > > > +
> > > > +        if (msghdr.msg_namelen > sizeof(struct sockaddr_un))
> > > > +                msghdr.msg_namelen = sizeof(struct sockaddr_un);
> > > > +
> > > > +        msghdr.msg_iov = &iovec;
> > > > +        msghdr.msg_iovlen = 1;
> > > > +
> > > > +        if (sendmsg(fd, &msghdr, MSG_NOSIGNAL) < 0) {
> > > > +                r = -errno;
> > > > +                goto finish;
> > > > +        }
> > > > +
> > > > +        r = 1;
> > > > +
> > > > +finish:
> > > > +        if (unset_environment)
> > > > +                unsetenv("NOTIFY_SOCKET");
> > > > +
> > > > +        if (fd >= 0)
> > > > +                close(fd);
> > > > +
> > > > +        return;
> > > > +#endif
> > > > +}
> > > > +
> > > > diff --git a/src/ipmievd.c b/src/ipmievd.c
> > > > index 19cdea6..136cc77 100644
> > > > --- a/src/ipmievd.c
> > > > +++ b/src/ipmievd.c
> > > > @@ -766,6 +766,7 @@ ipmievd_main(struct ipmi_event_intf * eintf,
> int
> > > argc, char ** argv)
> > > >                 fprintf(fp, "%d\n", (int)getpid());
> > > >                 fclose(fp);
> > > >         }
> > > > +       ipmi_notify_sd("READY=1");
> > > >
> > > >         /* register signal handler for cleanup */
> > > >         act.sa_handler = ipmievd_cleanup;
> > > >
> > > >
> > > > -----------------------------------------------------------------
> ----
> > > ---------
> > > > Live Security Virtual Conference
> > > > Exclusive live event will cover all the ways today's security and
> > > > threat landscape has changed and how IT managers can respond.
> > > Discussions
> > > > will include endpoint security, mobile security and the latest in
> > > malware
> > > > threats.
> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> > > > _______________________________________________
> > > > Ipmitool-devel mailing list
> > > > Ipmitool-devel@lists.sourceforge.net
> > > > https://lists.sourceforge.net/lists/listinfo/ipmitool-devel
> > >
> > >
> > >
> > > ------------------------------
> > >
> > > Message: 4
> > > Date: Tue, 07 Aug 2012 13:32:24 -0700
> > > From: Carson Gaspar <carson+ipmit...@taltos.org>
> > > Subject: Re: [Ipmitool-devel] ipmitool 1.8.12 release  this week
> > > To: ipmitool-devel@lists.sourceforge.net
> > > Message-ID: <50217b58.50...@taltos.org>
> > > Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> > >
> > > The code is full of gcc-isms:
> > >
> > >  From configure.in:
> > >
> > > CFLAGS="$CFLAGS -fno-strict-aliasing -Wreturn-type -Wno-unused-
> result
> > > -Wno-packed-bitfield-compat"
> > >
> > > In additon to the gcc-specific flags, it fails to build with the
> Studio
> > > compilers on Sol 11, spewing tons of errors similar to:
> > >
> > > "../include/ipmitool/ipmi_sel.h", line 156: cannot use an address
> to
> > > initialize a field of a packed struct (#pragma pack)
> > >
> > > (it also complains about pack(0) being illegal)
> > >
> > > If I force undef HAVE_PRAGMA_PACK, it dies at:
> > >
> > > "ipmi_mc.c", line 122: undefined symbol: name
> > >
> > > If ipmitool now _requires_ gcc (which is a terrible idea), it needs
> to
> > > document that prominently. If not, it needs to be written in C/C99,
> not
> > > using gcc's non-standard dialect.
> > >
> > > --
> > > Carson
> > >
> > >
> > >
> > >
> > > ------------------------------
> > >
> > > Message: 5
> > > Date: Tue, 07 Aug 2012 15:38:12 -0600
> > > From: Jim Mankovich <jm...@hp.com>
> > > Subject: Re: [Ipmitool-devel] ipmitool 1.8.12 release  this week
> > > To: ipmitool-devel@lists.sourceforge.net
> > > Message-ID: <50218ac4.5080...@hp.com>
> > > Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> > >
> > > Carson,
> > >
> > > It should  compile as it did before if the -W options on the CFLAGS
> are
> > > removed.
> > >
> > > I will remove the gcc dependent -W arguments from CFLAGS in
> > > configure.in
> > >
> > > Is there a way to get better compiler warning messages across all
> the
> > > compilers
> > > used to build ipmitool?
> > >
> > > Jim
> > >
> > > -- Jim Mankovich | jm...@hp.com --
> > >
> > > On 8/7/2012 2:32 PM, Carson Gaspar wrote:
> > > > The code is full of gcc-isms:
> > > >
> > > >   From configure.in:
> > > >
> > > > CFLAGS="$CFLAGS -fno-strict-aliasing -Wreturn-type -Wno-unused-
> result
> > > > -Wno-packed-bitfield-compat"
> > > >
> > > > In additon to the gcc-specific flags, it fails to build with the
> > > Studio
> > > > compilers on Sol 11, spewing tons of errors similar to:
> > > >
> > > > "../include/ipmitool/ipmi_sel.h", line 156: cannot use an address
> to
> > > > initialize a field of a packed struct (#pragma pack)
> > > >
> > > > (it also complains about pack(0) being illegal)
> > > >
> > > > If I force undef HAVE_PRAGMA_PACK, it dies at:
> > > >
> > > > "ipmi_mc.c", line 122: undefined symbol: name
> > > >
> > > > If ipmitool now _requires_ gcc (which is a terrible idea), it
> needs
> > > to
> > > > document that prominently. If not, it needs to be written in
> C/C99,
> > > not
> > > > using gcc's non-standard dialect.
> > > >
> > >
> > >
> > >
> > >
> > > ------------------------------
> > >
> > > Message: 6
> > > Date: Tue, 07 Aug 2012 15:54:47 -0600
> > > From: Jim Mankovich <jm...@hp.com>
> > > Subject: Re: [Ipmitool-devel] ipmitool 1.8.12 release  this week
> > > To: ipmitool-devel@lists.sourceforge.net
> > > Message-ID: <50218ea7.4040...@hp.com>
> > > Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> > >
> > > Carson,
> > >
> > > Does 1.8.11 compile without issue on Studio compilers on Sol 11?
> > >
> > > -- Jim Mankovich | jm...@hp.com --
> > >
> > > On 8/7/2012 2:32 PM, Carson Gaspar wrote:
> > > > The code is full of gcc-isms:
> > > >
> > > >   From configure.in:
> > > >
> > > > CFLAGS="$CFLAGS -fno-strict-aliasing -Wreturn-type -Wno-unused-
> result
> > > > -Wno-packed-bitfield-compat"
> > > >
> > > > In additon to the gcc-specific flags, it fails to build with the
> > > Studio
> > > > compilers on Sol 11, spewing tons of errors similar to:
> > > >
> > > > "../include/ipmitool/ipmi_sel.h", line 156: cannot use an address
> to
> > > > initialize a field of a packed struct (#pragma pack)
> > > >
> > > > (it also complains about pack(0) being illegal)
> > > >
> > > > If I force undef HAVE_PRAGMA_PACK, it dies at:
> > > >
> > > > "ipmi_mc.c", line 122: undefined symbol: name
> > > >
> > > > If ipmitool now _requires_ gcc (which is a terrible idea), it
> needs
> > > to
> > > > document that prominently. If not, it needs to be written in
> C/C99,
> > > not
> > > > using gcc's non-standard dialect.
> > > >
> > >
> > >
> > >
> > >
> > > ------------------------------
> > >
> > > -------------------------------------------------------------------
> ----
> > > -------
> > > Live Security Virtual Conference
> > > Exclusive live event will cover all the ways today's security and
> > > threat landscape has changed and how IT managers can respond.
> > > Discussions
> > > will include endpoint security, mobile security and the latest in
> > > malware
> > > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> > >
> > > ------------------------------
> > >
> > > _______________________________________________
> > > Ipmitool-devel mailing list
> > > Ipmitool-devel@lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/ipmitool-devel
> > >
> > >
> > > End of Ipmitool-devel Digest, Vol 74, Issue 1
> > > *********************************************
> >
> > ---------------------------------------------------------------------
> ---------
> > Live Security Virtual Conference
> > Exclusive live event will cover all the ways today's security and
> > threat landscape has changed and how IT managers can respond.
> Discussions
> > will include endpoint security, mobile security and the latest in
> malware
> > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> > _______________________________________________
> > Ipmitool-devel mailing list
> > Ipmitool-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/ipmitool-devel
> --
> Albert Chu
> ch...@llnl.gov
> Computer Scientist
> High Performance Systems Division
> Lawrence Livermore National Laboratory


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ipmitool-devel mailing list
Ipmitool-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipmitool-devel

Reply via email to