Deleted Added
full compact
devd.cc (247756) devd.cc (247758)
1/*-
2 * Copyright (c) 2002-2010 M. Warner Losh.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 49 unchanged lines hidden (view full) ---

58 */
59
60// TODO list:
61// o devd.conf and devd man pages need a lot of help:
62// - devd needs to document the unix domain socket
63// - devd.conf needs more details on the supported statements.
64
65#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2002-2010 M. Warner Losh.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 49 unchanged lines hidden (view full) ---

58 */
59
60// TODO list:
61// o devd.conf and devd man pages need a lot of help:
62// - devd needs to document the unix domain socket
63// - devd.conf needs more details on the supported statements.
64
65#include <sys/cdefs.h>
66__FBSDID("$FreeBSD: head/sbin/devd/devd.cc 247756 2013-03-04 02:21:15Z eadler $");
66__FBSDID("$FreeBSD: head/sbin/devd/devd.cc 247758 2013-03-04 02:21:19Z eadler $");
67
68#include <sys/param.h>
69#include <sys/socket.h>
70#include <sys/stat.h>
71#include <sys/sysctl.h>
72#include <sys/types.h>
73#include <sys/wait.h>
74#include <sys/un.h>

--- 380 unchanged lines hidden (view full) ---

455 sort_vector(_notify_list);
456}
457
458void
459config::open_pidfile()
460{
461 pid_t otherpid;
462
67
68#include <sys/param.h>
69#include <sys/socket.h>
70#include <sys/stat.h>
71#include <sys/sysctl.h>
72#include <sys/types.h>
73#include <sys/wait.h>
74#include <sys/un.h>

--- 380 unchanged lines hidden (view full) ---

455 sort_vector(_notify_list);
456}
457
458void
459config::open_pidfile()
460{
461 pid_t otherpid;
462
463 if (_pidfile == "")
463 if (_pidfile.empty())
464 return;
465 pfh = pidfile_open(_pidfile.c_str(), 0600, &otherpid);
466 if (pfh == NULL) {
467 if (errno == EEXIST)
468 errx(1, "devd already running, pid: %d", (int)otherpid);
469 warn("cannot open pid file");
470 }
471}

--- 51 unchanged lines hidden (view full) ---

523{
524 p->set_priority(prio);
525 _notify_list.push_back(p);
526}
527
528void
529config::set_pidfile(const char *fn)
530{
464 return;
465 pfh = pidfile_open(_pidfile.c_str(), 0600, &otherpid);
466 if (pfh == NULL) {
467 if (errno == EEXIST)
468 errx(1, "devd already running, pid: %d", (int)otherpid);
469 warn("cannot open pid file");
470 }
471}

--- 51 unchanged lines hidden (view full) ---

523{
524 p->set_priority(prio);
525 _notify_list.push_back(p);
526}
527
528void
529config::set_pidfile(const char *fn)
530{
531 _pidfile = string(fn);
531 _pidfile = fn;
532}
533
534void
535config::push_var_table()
536{
537 var_list *vl;
538
539 vl = new var_list();

--- 72 unchanged lines hidden (view full) ---

612 dst.append(src++, 1);
613 return;
614 }
615
616 // $var -> replace with value
617 do {
618 buffer.append(src++, 1);
619 } while (is_id_char(*src));
532}
533
534void
535config::push_var_table()
536{
537 var_list *vl;
538
539 vl = new var_list();

--- 72 unchanged lines hidden (view full) ---

612 dst.append(src++, 1);
613 return;
614 }
615
616 // $var -> replace with value
617 do {
618 buffer.append(src++, 1);
619 } while (is_id_char(*src));
620 dst.append(get_variable(buffer.c_str()));
620 dst.append(get_variable(buffer));
621}
622
623const string
624config::expand_string(const char *src, const char *prepend, const char *append)
625{
626 const char *var_at;
627 string dst;
628

--- 519 unchanged lines hidden ---
621}
622
623const string
624config::expand_string(const char *src, const char *prepend, const char *append)
625{
626 const char *var_at;
627 string dst;
628

--- 519 unchanged lines hidden ---