lkml.org 
[lkml]   [2006]   [Feb]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RFC][PATCH 04/20] pspace: Allow multiple instaces of the process id namespace
    On Mon, Feb 06, 2006 at 12:34:08PM -0700, Eric W. Biederman wrote:
    > -#define mk_pid(map, off) (((map) - pidmap_array)*BITS_PER_PAGE + (off))
    > +#define mk_pid(map, off) (((map) - pspace->pidmap)*BITS_PER_PAGE + (off))
    > #define find_next_offset(map, off) \

    mk_pid() should be:

    #define mk_pid(pspace, map, off) \
    (((map) - (pspace)->pidmap)*BITS_PER_PAGE + (off))

    or otherwise made an inline; pscape escaping like this shouldn't happen.


    On Mon, Feb 06, 2006 at 12:34:08PM -0700, Eric W. Biederman wrote:
    > +static struct pspace *new_pspace(struct task_struct *leader)
    > +{
    > + struct pspace *pspace, *parent;
    > + int i;
    > + size_t len;
    > + parent = leader->pspace;
    > + len = strlen(parent->name) + 10;
    > + pspace = kzalloc(sizeof(struct pspace) + len, GFP_KERNEL);
    > + if (!pspace)
    > + return NULL;
    > + atomic_set(&pspace->count, 1);
    > + pspace->flags = 0;
    > + pspace->nr_threads = 0;
    > + pspace->nr_processes = 0;
    > + pspace->last_pid = 0;
    > + pspace->min = RESERVED_PIDS;
    > + pspace->max = PID_MAX_DEFAULT;
    > + for (i = 0; i < PIDMAP_ENTRIES; i++) {
    > + atomic_set(&pspace->pidmap[i].nr_free, BITS_PER_PAGE);
    > + pspace->pidmap[i].page = NULL;
    > + }
    > + attach_any_pid(&pspace->child_reaper, leader, PIDTYPE_PID,
    > + parent, leader->wid);
    > + leader->pspace->nr_processes++;
    > + snprintf(pspace->name, len + 1, "%s/%d", parent->name, leader->wid);
    > +
    > + return pspace;
    > +}

    kzalloc() followed by zeroing ->flags et al by hand is redundant.


    -- wli
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2006-02-07 17:45    [W:0.021 / U:151.208 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site