This commit is contained in:
kishiguro
2017-02-20 01:19:03 -08:00
parent d75ddd1a93
commit 07cd7d4e6e
2 changed files with 25 additions and 25 deletions

View File

@@ -12,28 +12,28 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package proc package process
import ( import (
"sync" "sync"
) )
type Proc struct { type Process struct {
Name string Name string
Vrf string Vrf string
Args []string Args []string
File string File string
} }
type ProcList map[string]*Proc type ProcessList map[string]*Process
var ( var (
ProcVrfMap = map[string]*ProcList{} ProcessVrfMap = map[string]*ProcessList{}
ProcMutex sync.RWMutex ProcessMutex sync.RWMutex
) )
func NewProc(name string, vrf string, args ...string) *Proc { func NewProcess(name string, vrf string, args ...string) *Process {
proc := &Proc{ proc := &Process{
Name: name, Name: name,
Vrf: vrf, Vrf: vrf,
Args: []string(args), Args: []string(args),
@@ -41,28 +41,28 @@ func NewProc(name string, vrf string, args ...string) *Proc {
return proc return proc
} }
func ProcRegister(proc *Proc) { func ProcessRegister(proc *Process) {
ProcMutex.Lock() ProcessMutex.Lock()
defer ProcMutex.Unlock() defer ProcessMutex.Unlock()
} }
func ProcUnregister(proc *Proc) { func ProcessUnregister(proc *Process) {
ProcMutex.Lock() ProcessMutex.Lock()
defer ProcMutex.Unlock() defer ProcessMutex.Unlock()
} }
func ProcUnregisterByCommand(name string) { func ProcessUnregisterByCommand(name string) {
ProcMutex.Lock() ProcessMutex.Lock()
defer ProcMutex.Unlock() defer ProcessMutex.Unlock()
} }
func ProcUnregisterByVrf() { func ProcessUnregisterByVrf() {
ProcMutex.Lock() ProcessMutex.Lock()
defer ProcMutex.Unlock() defer ProcessMutex.Unlock()
} }
func (proc *Proc) Start() { func (proc *Process) Start() {
} }
func (proc *Proc) Stop() { func (proc *Process) Stop() {
} }

View File

@@ -12,14 +12,14 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
package proc package process
import ( import (
"testing" "testing"
) )
func TestProcStart(t *testing.T) { func TestProcessStart(t *testing.T) {
args := []string{"-d", "-f"} args := []string{"-d", "-f"}
proc := NewProc("dhcp", "", args...) proc := NewProcess("dhcp", "", args...)
ProcRegister(proc) ProcessRegister(proc)
} }