Changeset 618 for trunk/kernel/kern


Ignore:
Timestamp:
Jan 17, 2019, 5:59:51 PM (6 years ago)
Author:
alain
Message:

fix a bug in process_destroy() : the vmm_destroy() must be called before
the PID release.

Location:
trunk/kernel/kern
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/kern/process.c

    r611 r618  
    44 * Authors  Ghassan Almaless (2008,2009,2010,2011,2012)
    55 *          Mohamed Lamine Karaoui (2015)
    6  *          Alain Greiner (2016,2017,2018)
     6 *          Alain Greiner (2016,2017,2018,2019)
    77 *
    88 * Copyright (c) UPMC Sorbonne Universites
     
    412412
    413413// check no more threads
    414 assert( (process->th_nr == 0) , "process %x in cluster %x contains threads", pid , local_cxy );
     414assert( (process->th_nr == 0),
     415"process %x in cluster %x contains threads", pid , local_cxy );
    415416
    416417#if DEBUG_PROCESS_DESTROY
     
    422423#endif
    423424
     425    // Destroy VMM
     426    vmm_destroy( process );
     427
     428#if (DEBUG_PROCESS_DESTROY & 1)
     429if( DEBUG_PROCESS_DESTROY < cycle )
     430printk("\n[%s] thread[%x,%x] destroyed VMM for process %x in cluster %x\n",
     431__FUNCTION__, this->process->pid, this->trdid, pid, local_cxy );
     432#endif
     433
    424434    // remove process from local_list in local cluster manager
    425435    cluster_process_local_unlink( process );
    426436
     437#if (DEBUG_PROCESS_DESTROY & 1)
     438if( DEBUG_PROCESS_DESTROY < cycle )
     439printk("\n[%s] thread[%x,%x] removed process %x in cluster %x from local list\n",
     440__FUNCTION__, this->process->pid, this->trdid, pid, local_cxy );
     441#endif
     442
    427443    // remove process from copies_list in owner cluster manager
    428444    cluster_process_copies_unlink( process );
     445
     446#if (DEBUG_PROCESS_DESTROY & 1)
     447if( DEBUG_PROCESS_DESTROY < cycle )
     448printk("\n[%s] thread[%x,%x] removed process %x in cluster %x from copies list\n",
     449__FUNCTION__, this->process->pid, this->trdid, pid, local_cxy );
     450#endif
    429451
    430452    // remove process from children_list
     
    447469        remote_queuelock_release( children_lock_xp );
    448470
     471#if (DEBUG_PROCESS_DESTROY & 1)
     472if( DEBUG_PROCESS_DESTROY < cycle )
     473printk("\n[%s] thread[%x,%x] removed process %x in cluster %x from children list\n",
     474__FUNCTION__, this->process->pid, this->trdid, pid, local_cxy );
     475#endif
     476
    449477        // release the process PID to cluster manager
    450478        cluster_pid_release( pid );
    451     }
    452 
    453     // FIXME close all open files and synchronize dirty [AG]
    454 
    455     // decrease refcount for bin file, root file and cwd file
    456         if( process->vfs_bin_xp  != XPTR_NULL ) vfs_file_count_down( process->vfs_bin_xp );
    457         if( process->vfs_root_xp != XPTR_NULL ) vfs_file_count_down( process->vfs_root_xp );
    458         if( process->cwd_xp      != XPTR_NULL ) vfs_file_count_down( process->cwd_xp );
    459 
    460     // Destroy VMM
    461     vmm_destroy( process );
     479
     480#if (DEBUG_PROCESS_DESTROY & 1)
     481if( DEBUG_PROCESS_DESTROY < cycle )
     482printk("\n[%s] thread[%x,%x] released process PID %x to pmgr in cluster %x\n",
     483__FUNCTION__, this->process->pid, this->trdid, pid, local_cxy );
     484#endif
     485
     486    }
     487
     488    // FIXME decrement the refcount on file pointer by vfs_bin_xp [AG]
     489    // FIXME close all open files [AG]
     490    // FIXME synchronize dirty files [AG]
    462491
    463492    // release memory allocated to process descriptor
  • trunk/kernel/kern/process.h

    r612 r618  
    115115 *    defined in the reference cluster, and are undefined in other clusters.
    116116 * 6) The <local_list>, <copies_list>, <th_tbl>, <th_nr>, <u_th_lock> or <k_th_lock> fields
    117  *    are specific n each cluster, and are defined in all process descriptors copies.
     117 *    are specific in each cluster, and are defined in all process descriptors copies.
    118118 * 7) The termination <flags> and <exit_status> are only defined in the reference cluster.
    119119 *    (The term_state format is defined in the shared_syscalls.h file ).
Note: See TracChangeset for help on using the changeset viewer.