Skip to content

Commit

Permalink
Merge pull request #6 from garlick/rhel7
Browse files Browse the repository at this point in the history
allow systemd to manage /var/run/powerman
  • Loading branch information
garlick committed Oct 23, 2015
2 parents 2072405 + fa32261 commit a3eef9a
Show file tree
Hide file tree
Showing 42 changed files with 470 additions and 456 deletions.
4 changes: 2 additions & 2 deletions META
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
##
Meta: 1
Name: powerman
Version: 2.3.23
Version: 2.3.24
Release: 1
Date: 2015-06-08
Date: 2015-10-23
8 changes: 8 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
=========================================================================
Release Notes for PowerMan version 2.3.24 23 Oct 2015
=========================================================================

* Don't pacakge /var/run/powerman; let systemd manage it [TOSS-2987]

* Cleanup: drop trailing whitespace

=========================================================================
Release Notes for PowerMan version 2.3.23 08 Jun 2015
=========================================================================
Expand Down
4 changes: 2 additions & 2 deletions httppower/httppower.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void get(CURL *h, char **av)
if (curl_easy_perform(h) != 0)
printf("Error: %s\n", errbuf);
curl_easy_setopt(h, CURLOPT_URL, "");
} else
} else
printf("Nothing to get!\n");

if (myurl)
Expand Down Expand Up @@ -154,7 +154,7 @@ int docmd(CURL *h, char **av)
get(h, av + 1);
else if (strcmp(av[0], "post") == 0)
post(h, av + 1);
else
else
printf("type \"help\" for a list of commands\n");
}
return rc;
Expand Down
6 changes: 3 additions & 3 deletions libcommon/argv.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
static char *_nextargv(char **strp, char *ignore)
{
char *str = *strp;
char *word;
char *word;
int len;
char *cpy = NULL;

Expand Down Expand Up @@ -93,11 +93,11 @@ char **argv_append(char **argv, char *s)
argv[argc - 1] = xstrdup(s);
argv[argc] = NULL;

return argv;
return argv;
}

/* Create a null-terminated argv array given a command line.
* Characters in the 'ignore' set are treated like white space.
* Characters in the 'ignore' set are treated like white space.
*/
char **argv_create(char *cmdline, char *ignore)
{
Expand Down
10 changes: 5 additions & 5 deletions libcommon/client_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#define CP_PROMPT "powerman> " /* prompt */
#define CP_VERSION "001 %s" CP_EOL

/*
/*
* Requests
*/
#define CP_HELP "help"
Expand All @@ -39,8 +39,8 @@
#define CP_TELEMETRY "telemetry"
#define CP_EXPRANGE "exprange"

/*
* Responses -
/*
* Responses -
* 1XX's are successes (indicates end of response)
* 2XX's are failures (indicates end of response)
* 3XX's are informational messages (more data coming)
Expand Down Expand Up @@ -101,6 +101,6 @@

#endif /* PM_CLIENT_PROTO_H */

/*
* vi:tabstop=4 shiftwidth=4 expandtab
/*
* vi:tabstop=4 shiftwidth=4 expandtab
*/
8 changes: 4 additions & 4 deletions libcommon/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,17 @@ void dbg_wrapped(unsigned long channel, const char *fmt, ...)
va_end(ap);

if (dbg_ttyvalid)
fprintf(stderr, "%s %s: %s\n",
fprintf(stderr, "%s %s: %s\n",
_time(), _channel_name(channel), buf);
else
syslog(LOG_DEBUG, "%s: %s",
syslog(LOG_DEBUG, "%s: %s",
_channel_name(channel), buf);
}
}

/*
* Convert memory to string, turning non-printable character into "C"
* representation.
* Convert memory to string, turning non-printable character into "C"
* representation.
* mem (IN) target memory
* len (IN) number of characters to convert
* RETURN string (caller must free)
Expand Down
6 changes: 3 additions & 3 deletions libcommon/pluglist.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ static Plug *_create_plug(char *name)

plug->name = xstrdup(name);
plug->node = NULL;

return plug;
}

Expand All @@ -90,7 +90,7 @@ PlugList pluglist_create(List plugnames)

/* create plug for each element of plugnames list */
if (plugnames) {
ListIterator itr;
ListIterator itr;
char *name;

itr = list_iterator_create(plugnames);
Expand Down Expand Up @@ -203,7 +203,7 @@ pl_err_t pluglist_map(PlugList pl, char *nodelist, char *pluglist)
hostlist_iterator_destroy(nitr);
hostlist_destroy(nhl);

/* We have a pluglist so we just map plugs to nodes.
/* We have a pluglist so we just map plugs to nodes.
*/
} else {
hostlist_t nhl = hostlist_create(nodelist);
Expand Down
6 changes: 3 additions & 3 deletions libcommon/pluglist.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ PlugList pluglist_create(List plugnames);
void pluglist_destroy(PlugList pl);

/* Assign node names to plugs. nodelist and pluglist are strings in compressed
* hostlist format (the degenerate case of which is a single name). pluglist
* can be NULL, indicating
* hostlist format (the degenerate case of which is a single name). pluglist
* can be NULL, indicating
* - if hardwired plugs, available plugs should be assigned to nodes in order
* - else (not hardwired), assume plug names are the same as node names.
*/
pl_err_t pluglist_map(PlugList pl, char *nodelist, char *pluglist);

/* Search PlugList for a Plug with matching plug name. Return pointer to Plug
/* Search PlugList for a Plug with matching plug name. Return pointer to Plug
* on success (points to actual list entry), or NULL on search failure.
* Only plugs with non-NULL node fields are returned.
*/
Expand Down
2 changes: 1 addition & 1 deletion libcommon/powerman.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef PM_POWERMAN_H
#define PM_POWERMAN_H

#define DAEMON_NAME "powermand"
#define DAEMON_NAME "powermand"
#define DFLT_PORT "10101"
#define DFLT_HOSTNAME "127.0.0.1"

Expand Down
14 changes: 7 additions & 7 deletions libcommon/xpoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ struct xpollfd {
};

#if HAVE_POLL
static short
static short
xflag2flag(short x)
{
short f = 0;
Expand All @@ -90,7 +90,7 @@ xflag2flag(short x)
return f;
}

static short
static short
flag2xflag(short f)
{
short x = 0;
Expand All @@ -114,7 +114,7 @@ flag2xflag(short f)
int
xpoll(xpollfd_t pfd, struct timeval *tv)
{
struct timeval tv_cpy, *tvp = NULL;
struct timeval tv_cpy, *tvp = NULL;
struct timeval start, end, delta;
int n;

Expand All @@ -123,7 +123,7 @@ xpoll(xpollfd_t pfd, struct timeval *tv)
if (gettimeofday(&start, NULL) < 0)
err_exit(TRUE, "gettimeofday");
tvp = &tv_cpy;
}
}

/* repeat poll if interrupted */
do {
Expand Down Expand Up @@ -165,7 +165,7 @@ xpollfd_t
xpollfd_create(void)
{
xpollfd_t pfd = (xpollfd_t)xmalloc(sizeof(struct xpollfd));

pfd->magic = XPOLLFD_MAGIC;
#if HAVE_POLL
pfd->ufds_size += XPOLLFD_ALLOC_CHUNK;
Expand Down Expand Up @@ -257,7 +257,7 @@ xpollfd_str(xpollfd_t pfd, char *str, int len)
str[fd] = 'I';
else if (revents & POLLOUT)
str[fd] = 'O';
}
}
if (fd > maxfd)
maxfd = fd;
}
Expand Down Expand Up @@ -301,7 +301,7 @@ xpollfd_revents(xpollfd_t pfd, int fd)
flags |= XPOLLOUT;
#endif
return flags;
}
}

/*
* vi:tabstop=4 shiftwidth=4 expandtab
Expand Down
146 changes: 73 additions & 73 deletions libcommon/xpty.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ static int tiocmp(struct termios *a, struct termios *b)
{
if ( memcmp(a->c_cc, b->c_cc, sizeof(a->c_cc)) == 0
&& a->c_cc[VTIME] == b->c_cc[VTIME]
&& a->c_iflag == b->c_iflag
&& a->c_iflag == b->c_iflag
&& a->c_oflag == b->c_oflag
&& a->c_cflag == b->c_cflag
&& a->c_lflag == b->c_lflag)
Expand Down Expand Up @@ -134,85 +134,85 @@ pid_t xforkpty(int *amaster, char *name, int len)
assert(strlen(name) < len);
}
#else
#if HAVE__DEV_PTMX
/* solaris style - this code initially borrowed from
#if HAVE__DEV_PTMX
/* solaris style - this code initially borrowed from
* http://bugs.mysql.com/bug.php?id=22429
*/
int master, slave;
char *slave_name;
master = open("/dev/ptmx", O_RDWR);
if (master < 0)
return -1;
if (grantpt (master) < 0) {
close (master);
return -1;
}
if (unlockpt (master) < 0) {
close (master);
return -1;
}
slave_name = ptsname (master);
if (slave_name == NULL) {
close (master);
return -1;
}
slave = open (slave_name, O_RDWR);
if (slave < 0) {
close (master);
return -1;
}
if (ioctl (slave, I_PUSH, "ptem") < 0
|| ioctl (slave, I_PUSH, "ldterm") < 0) {
close (slave);
close (master);
return -1;
}
int master, slave;
char *slave_name;

master = open("/dev/ptmx", O_RDWR);
if (master < 0)
return -1;
if (grantpt (master) < 0) {
close (master);
return -1;
}
if (unlockpt (master) < 0) {
close (master);
return -1;
}
slave_name = ptsname (master);
if (slave_name == NULL) {
close (master);
return -1;
}
slave = open (slave_name, O_RDWR);
if (slave < 0) {
close (master);
return -1;
}
if (ioctl (slave, I_PUSH, "ptem") < 0
|| ioctl (slave, I_PUSH, "ldterm") < 0) {
close (slave);
close (master);
return -1;
}
#elif HAVE__DEV_PTC
/* aix style */
int master, slave;
char *slave_name;

master = open("/dev/ptc", O_RDWR);
if (master < 0)
return -1;
if (grantpt (master) < 0) {
close (master);
return -1;
}
if (unlockpt (master) < 0) {
close (master);
return -1;
}
slave_name = ttyname (master);
if (slave_name == NULL) {
close (master);
return -1;
}
slave = open (slave_name, O_RDWR);
if (slave < 0) {
close (master);
return -1;
}
int master, slave;
char *slave_name;

master = open("/dev/ptc", O_RDWR);
if (master < 0)
return -1;
if (grantpt (master) < 0) {
close (master);
return -1;
}
if (unlockpt (master) < 0) {
close (master);
return -1;
}
slave_name = ttyname (master);
if (slave_name == NULL) {
close (master);
return -1;
}
slave = open (slave_name, O_RDWR);
if (slave < 0) {
close (master);
return -1;
}
#else
#error unknown pty master device path
#endif
if (amaster)
*amaster = master;
if (name)
strncpy (name, slave_name, len);
pid = fork ();
switch (pid) {
case -1: /* Error */
return -1;
case 0: /* Child */
close (master);
dup2 (slave, STDIN_FILENO);
dup2 (slave, STDOUT_FILENO);
dup2 (slave, STDERR_FILENO);
return 0;
default: /* Parent */
close (slave);
if (amaster)
*amaster = master;
if (name)
strncpy (name, slave_name, len);
pid = fork ();
switch (pid) {
case -1: /* Error */
return -1;
case 0: /* Child */
close (master);
dup2 (slave, STDIN_FILENO);
dup2 (slave, STDOUT_FILENO);
dup2 (slave, STDERR_FILENO);
return 0;
default: /* Parent */
close (slave);
break;
}
#endif
Expand Down
Loading

0 comments on commit a3eef9a

Please sign in to comment.