Sushant Nirwan wrote:
> I'm trying to create a new contract with the following code
...
> if ((tmpl_fd = open64("/system/contract/process/template",
O_RDWR)) == -1) {
...
> However, I'm getting an error "Can't create process contract
> template: [b]Invalid argument[/b]". According to the man pages of
> ct_tmpl_create() we have to pass the file descriptor of the
> templates, which is I'm doing.
Process contracts are only created implicitly on fork(). They cannot
be created explicitly using ct_tmpl_create(). From process(4):
CREATION
A process contract is created when an LWP that has an active
process contract template calls fork(2). Initially, the
child process created by fork() is the only resource managed
by the contract. When an LWP that does not have an active
process contract template calls fork(), the child process
created by fork() is added as a resource to the process con-
tract of which the parent was a member.
> When I go through the source code of contract I found that in file
> "...../usr/src/uts/commmon/os/contract.c" there is function
> ctmpl_create_inval() which is called at the time of calling
> ct_tmpl_create().
> But this function is always return EINVAL (invalid argument).
>
> Help me to sort out this problem, since ct_tmpl_create() is not
> implemented in any of the tools of open solaris.
ct_tmpl_create() is currently only used by device contracts.
See device_contract(4).
Dave
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code