Ignore:
Timestamp:
Aug 22, 2018, 11:55:48 PM (3 years ago)
Author:
viala@…
Message:

Refactoring assert calling to conform with new assert macro.

Made with this command for the general case.
find ./kernel/ hal/ -name "*.c" | xargs sed -i -e '/assert(/ s/,[ ]*FUNCTION[ ]*,/,/'

And some done by hand.

File:
1 edited

Legend:

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

    r485 r492  
    132132    // initialize vmm as empty
    133133    error = vmm_init( process );
    134     assert( (error == 0) , __FUNCTION__ , "cannot initialize VMM\n" );
     134    assert( (error == 0) , "cannot initialize VMM\n" );
    135135 
    136136#if (DEBUG_PROCESS_REFERENCE_INIT & 1)
     
    175175                           &stdin_id );
    176176
    177         assert( (error == 0) , __FUNCTION__ , "cannot open stdin pseudo file" );
    178         assert( (stdin_id == 0) , __FUNCTION__ , "stdin index must be 0" );
     177        assert( (error == 0) , "cannot open stdin pseudo file" );
     178        assert( (stdin_id == 0) , "stdin index must be 0" );
    179179
    180180#if (DEBUG_PROCESS_REFERENCE_INIT & 1)
     
    193193                           &stdout_id );
    194194
    195         assert( (error == 0) , __FUNCTION__ , "cannot open stdout pseudo file" );
    196         assert( (stdout_id == 1) , __FUNCTION__ , "stdout index must be 1" );
     195        assert( (error == 0) , "cannot open stdout pseudo file" );
     196        assert( (stdout_id == 1) , "stdout index must be 1" );
    197197
    198198#if (DEBUG_PROCESS_REFERENCE_INIT & 1)
     
    211211                           &stderr_id );
    212212
    213         assert( (error == 0) , __FUNCTION__ , "cannot open stderr pseudo file" );
    214         assert( (stderr_id == 2) , __FUNCTION__ , "stderr index must be 2" );
     213        assert( (error == 0) , "cannot open stderr pseudo file" );
     214        assert( (stderr_id == 2) , "stderr index must be 2" );
    215215
    216216#if (DEBUG_PROCESS_REFERENCE_INIT & 1)
     
    330330    // reset local process vmm
    331331    error = vmm_init( local_process );
    332     assert( (error == 0) , __FUNCTION__ , "cannot initialize VMM\n");
     332    assert( (error == 0) , "cannot initialize VMM\n");
    333333
    334334    // reset process file descriptors array
     
    393393    pid_t       pid = process->pid;
    394394
    395         assert( (process->th_nr == 0) , __FUNCTION__ ,
     395        assert( (process->th_nr == 0) ,
    396396    "process %x in cluster %x has still active threads", pid , local_cxy );
    397397
     
    511511    assert( ((type == DELETE_ALL_THREADS ) ||
    512512             (type == BLOCK_ALL_THREADS )  ||
    513              (type == UNBLOCK_ALL_THREADS )), __FUNCTION__ , "illegal action type" );
     513             (type == UNBLOCK_ALL_THREADS )), "illegal action type" );
    514514             
    515515
     
    843843        xptr_t ref_xp = cluster_get_reference_process_from_pid( pid );
    844844
    845         assert( (ref_xp != XPTR_NULL) , __FUNCTION__ , "illegal pid\n" );
     845        assert( (ref_xp != XPTR_NULL) , "illegal pid\n" );
    846846
    847847        // allocate memory for local process descriptor
     
    10461046 
    10471047
    1048     assert( (process != NULL) , __FUNCTION__ , "process argument is NULL" );
    1049 
    1050     assert( (thread != NULL) , __FUNCTION__ , "thread argument is NULL" );
     1048    assert( (process != NULL) , "process argument is NULL" );
     1049
     1050    assert( (thread != NULL) , "thread argument is NULL" );
    10511051
    10521052    // take lock protecting th_tbl, depending on thread type:
     
    10891089    uint32_t count;  // number of threads in local process descriptor
    10901090
    1091     assert( (thread != NULL) , __FUNCTION__ , "thread argument is NULL" );
     1091    assert( (thread != NULL) , "thread argument is NULL" );
    10921092
    10931093    process_t * process = thread->process;
     
    11011101    count = process->th_nr;
    11021102
    1103     assert( (count > 0) , __FUNCTION__ , "process th_nr cannot be 0\n" );
     1103    assert( (count > 0) , "process th_nr cannot be 0\n" );
    11041104
    11051105    // remove thread from th_tbl[]
     
    11401140    ref_xp = hal_remote_lwd( XPTR( parent_process_cxy , &parent_process_ptr->ref_xp ) );
    11411141
    1142     assert( (parent_process_xp == ref_xp ) , __FUNCTION__ ,
     1142    assert( (parent_process_xp == ref_xp ) ,
    11431143    "parent process must be the reference process\n" );
    11441144
     
    12431243
    12441244    // check main thread LTID
    1245     assert( (LTID_FROM_TRDID(thread->trdid) == 0) , __FUNCTION__ ,
     1245    assert( (LTID_FROM_TRDID(thread->trdid) == 0) ,
    12461246    "main thread must have LTID == 0\n" );
    12471247
     
    14211421    }
    14221422
    1423     assert( false, __FUNCTION__, "we should not execute this code");
     1423    assert( false, "we should not execute this code");
    14241424 
    14251425        return 0;
     
    14911491        process = process_alloc();
    14921492       
    1493     assert( (process != NULL), __FUNCTION__,
     1493    assert( (process != NULL),
    14941494    "no memory for process descriptor in cluster %x\n", local_cxy  );
    14951495
     
    14971497    error = cluster_pid_alloc( process , &pid );
    14981498
    1499     assert( (error == 0), __FUNCTION__,
     1499    assert( (error == 0),
    15001500    "cannot allocate PID in cluster %x\n", local_cxy );
    15011501
    1502     assert( (pid == 1) , __FUNCTION__,
     1502    assert( (pid == 1) ,
    15031503    "process INIT must be first process in cluster 0\n" );
    15041504
     
    15181518                            &file_id );
    15191519
    1520         assert( (error == 0), __FUNCTION__,
     1520        assert( (error == 0),
    15211521    "failed to open file <%s>\n", CONFIG_PROCESS_INIT_PATH );
    15221522
     
    15251525        error = elf_load_process( file_xp , process );
    15261526
    1527         assert( (error == 0), __FUNCTION__,
     1527        assert( (error == 0),
    15281528    "cannot access .elf file <%s>\n", CONFIG_PROCESS_INIT_PATH );
    15291529
     
    15531553                                &thread );
    15541554
    1555         assert( (error == 0), __FUNCTION__,
     1555        assert( (error == 0),
    15561556    "cannot create main thread for <%s>\n", CONFIG_PROCESS_INIT_PATH );
    15571557
    1558     assert( (thread->trdid == 0), __FUNCTION__,
     1558    assert( (thread->trdid == 0),
    15591559    "main thread must have index 0 for <%s>\n", CONFIG_PROCESS_INIT_PATH );
    15601560
     
    16311631    txt_file_xp = hal_remote_lwd( XPTR( owner_cxy , &owner_ptr->fd_array.array[0] ) );
    16321632
    1633     assert( (txt_file_xp != XPTR_NULL) , __FUNCTION__ ,
     1633    assert( (txt_file_xp != XPTR_NULL) ,
    16341634    "process must be attached to one TXT terminal\n" );
    16351635
     
    16951695    }
    16961696
    1697     assert( false , __FUNCTION__ , "no free TXT terminal found" );
     1697    assert( false , "no free TXT terminal found" );
    16981698
    16991699    return -1;
     
    17121712
    17131713    // check process is in owner cluster
    1714     assert( (CXY_FROM_PID( process->pid ) == local_cxy) , __FUNCTION__ ,
     1714    assert( (CXY_FROM_PID( process->pid ) == local_cxy) ,
    17151715    "process descriptor not in owner cluster" );
    17161716
    17171717    // check terminal index
    17181718    assert( (txt_id < LOCAL_CLUSTER->nb_txt_channels) ,
    1719     __FUNCTION__ , "illegal TXT terminal index" );
     1719    "illegal TXT terminal index" );
    17201720
    17211721    // get pointers on TXT_RX[txt_id] chdev
     
    17611761    // check process descriptor in owner cluster
    17621762    process_pid = hal_remote_lw( XPTR( process_cxy , &process_ptr->pid ) );
    1763     assert( (CXY_FROM_PID( process_pid ) == process_cxy ) , __FUNCTION__ ,
     1763    assert( (CXY_FROM_PID( process_pid ) == process_cxy ) ,
    17641764    "process descriptor not in owner cluster" );
    17651765
     
    18111811
    18121812    // check owner cluster
    1813     assert( (process_cxy == CXY_FROM_PID( process_pid )) , __FUNCTION__,
     1813    assert( (process_cxy == CXY_FROM_PID( process_pid )) ,
    18141814    "process descriptor not in owner cluster\n" );
    18151815
     
    18641864
    18651865    // check owner cluster
    1866     assert( (process_cxy == CXY_FROM_PID( process_pid )) , __FUNCTION__,
     1866    assert( (process_cxy == CXY_FROM_PID( process_pid )) ,
    18671867    "process descriptor not in owner cluster\n" );
    18681868
     
    19221922
    19231923            // PANIC if KSH not found
    1924             assert( false , __FUNCTION__ , "KSH process not found for TXT %d" );
     1924            assert( false , "KSH process not found for TXT %d" );
    19251925
    19261926            return;
     
    19951995    // check owner cluster
    19961996    pid_t process_pid = hal_remote_lw( XPTR( process_cxy , &process_ptr->pid ) );
    1997     assert( (process_cxy == CXY_FROM_PID( process_pid )) , __FUNCTION__,
     1997    assert( (process_cxy == CXY_FROM_PID( process_pid )) ,
    19981998    "process descriptor not in owner cluster\n" );
    19991999
     
    20412041   
    20422042    assert( (txt_id < LOCAL_CLUSTER->nb_txt_channels) ,
    2043     __FUNCTION__ , "illegal TXT terminal index" );
     2043    "illegal TXT terminal index" );
    20442044
    20452045    // get pointers on TXT0 chdev
Note: See TracChangeset for help on using the changeset viewer.