예제 #1
0
func main() {
	var err error
	var tm *Time
	var ntm *InfTime
	var s *srv.Fsrv

	flag.Parse()
	user := go9p.OsUsers.Uid2User(os.Geteuid())
	root := new(srv.File)
	err = root.Add(nil, "/", user, nil, go9p.DMDIR|0555, nil)
	if err != nil {
		goto error
	}

	tm = new(Time)
	err = tm.Add(root, "time", go9p.OsUsers.Uid2User(os.Geteuid()), nil, 0444, tm)
	if err != nil {
		goto error
	}
	ntm = new(InfTime)
	err = ntm.Add(root, "inftime", go9p.OsUsers.Uid2User(os.Geteuid()), nil, 0444, ntm)
	if err != nil {
		goto error
	}

	s = srv.NewFileSrv(root)
	s.Dotu = true

	if *debug {
		s.Debuglevel = 1
	}
	if *debugall {
		s.Debuglevel = 2
	}

	s.Start(s)
	err = s.StartNetListener("tcp", *addr)
	if err != nil {
		goto error
	}

	return

error:
	log.Println(fmt.Sprintf("Error: %s", err))
}
예제 #2
0
func main() {
	var err error
	var cl *Clone
	var s *srv.Fsrv

	flag.Parse()
	user := go9p.OsUsers.Uid2User(os.Geteuid())
	root = new(srv.File)
	err = root.Add(nil, "/", user, nil, go9p.DMDIR|0777, nil)
	if err != nil {
		goto error
	}

	cl = new(Clone)
	err = cl.Add(root, "clone", go9p.OsUsers.Uid2User(os.Geteuid()), nil, 0444, cl)
	if err != nil {
		goto error
	}

	s = srv.NewFileSrv(root)
	s.Dotu = true

	if *debug {
		s.Debuglevel = 1
	}

	s.Start(s)
	err = s.StartNetListener("tcp", *addr)
	if err != nil {
		goto error
	}
	return

error:
	log.Println(fmt.Sprintf("Error: %s", err))
}