Print this page
OS-4825 cgroup user agent should be launched from the kernel
Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/os/contract.c
          +++ new/usr/src/uts/common/os/contract.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
       24 + * Copyright 2016 Joyent, Inc.
  24   25   */
  25   26  
  26   27  /*
  27   28   * Contracts
  28   29   * ---------
  29   30   *
  30   31   * Contracts are a primitive which enrich the relationships between
  31   32   * processes and system resources.  The primary purpose of contracts is
  32   33   * to provide a means for the system to negotiate the departure from a
  33   34   * binding relationship (e.g. pages locked in memory or a thread bound
↓ open down ↓ 246 lines elided ↑ open up ↑
 280  281   * control.  Obviously, this "out" should only be employed by callers
 281  282   * who are sufficiently constrained in other ways (e.g. newproc).
 282  283   */
 283  284  int
 284  285  contract_ctor(contract_t *ct, ct_type_t *type, ct_template_t *tmpl, void *data,
 285  286      ctflags_t flags, proc_t *author, int canfail)
 286  287  {
 287  288          avl_index_t where;
 288  289          klwp_t *curlwp = ttolwp(curthread);
 289  290  
 290      -        ASSERT(author == curproc);
      291 +        /*
      292 +         * It's possible that author is not curproc if the zone is creating
      293 +         * a new process as a child of zsched.
      294 +         */
 291  295  
 292  296          mutex_init(&ct->ct_lock, NULL, MUTEX_DEFAULT, NULL);
 293  297          mutex_init(&ct->ct_reflock, NULL, MUTEX_DEFAULT, NULL);
 294  298          mutex_init(&ct->ct_evtlock, NULL, MUTEX_DEFAULT, NULL);
 295  299          ct->ct_id = id_alloc(contract_ids);
 296  300  
 297  301          cte_queue_create(&ct->ct_events, CTEL_CONTRACT, 20, 0);
 298  302          list_create(&ct->ct_vnodes, sizeof (contract_vnode_t),
 299  303              offsetof(contract_vnode_t, ctv_node));
 300  304  
↓ open down ↓ 2385 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX