Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add proc type #94

Merged
merged 1 commit into from Nov 25, 2016
Merged

Add proc type #94

merged 1 commit into from Nov 25, 2016

Conversation

xairy
Copy link
Collaborator

@xairy xairy commented Nov 25, 2016

No description provided.

@@ -55,6 +55,8 @@ rest of the type-options are type-specific:
"bytesize": similar to "len", but always denotes the size in bytes, type-options:
argname of the object
"vma": a pointer to a set of pages (used as input for mmap/munmap/mremap/madvise)
"proc": per process int, type-options:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please extend this description. It is very non-obvious type. I doubt that anybody expect me and you understand what it does.
A usage example may help.

@dvyukov
Copy link
Collaborator

dvyukov commented Nov 25, 2016

Please write some meaningful commit description. There are people who read them.
Also prefix commit with package name: "sys: add proc type".

@@ -732,6 +730,8 @@ func (r *randGen) generateArg(s *state, typ sys.Type) (arg *Arg, calls []*Call)
v = r.randRangeInt(a.RangeBegin, a.RangeEnd)
}
return constArg(a, v), nil
case *sys.ProcType:
return constArg(a, r.rand(int(a.ValuesPerProc) - 1)), nil
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why "- 1"? Does not look correct to me. Should crash if ValuesPerProc==1.

if valuesStartInt >= (1 << (size * 8)) {
failf("values starting from '%v' overflow desired type of size '%v'", valuesStartInt, size)
}
if valuesStartInt + 16 * valuesPerProcInt >= (1 << (size * 8)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alex uses 20 procs. Let's make the max 32. And check that procs parameter <= 32 in config package.

@@ -156,10 +156,10 @@ func (env *Env) Close() error {
// failed: true if executor has detected a kernel bug
// hanged: program hanged and was killed
// err0: failed to start process, or executor has detected a logical error
func (env *Env) Exec(p *prog.Prog) (output []byte, cov [][]uint32, errnos []int, failed, hanged bool, err0 error) {
func (env *Env) Exec(p *prog.Prog, pid int) (output []byte, cov [][]uint32, errnos []int, failed, hanged bool, err0 error) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pid should be an argument to ipc.MakeEnv.
We've discussed that we may need to pass pid to executor to setup network card, etc.
MakeEnv looks like the right place for pid long term.

@xairy
Copy link
Collaborator Author

xairy commented Nov 25, 2016

All done.

Note, that the old way to generate ports is still used when generating inaddrs.
I'll move it to syscall templates.

@dvyukov
Copy link
Collaborator

dvyukov commented Nov 25, 2016

looks good to me

@dvyukov dvyukov merged commit 52f7310 into google:master Nov 25, 2016
@xairy xairy deleted the proc-type branch May 30, 2017 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants