Ignore:
Timestamp:
May 3, 2018, 5:51:22 PM (4 years ago)
Author:
alain
Message:

1/ Fix a bug in the Multithreaded "sort" applicationr:
The pthread_create() arguments must be declared as global variables.
2/ The exit syscall can be called by any thread of a process..

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/syscalls/sys_barrier.c

    r23 r440  
    22 * sys_barrier.c - Access a POSIX barrier.
    33 *
    4  * authors       Alain Greiner (2016,2017)
     4 * authors       Alain Greiner (2016,2017,2018)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
     
    3737{
    3838        error_t      error;
    39     paddr_t      paddr;
     39    vseg_t     * vseg;
    4040 
    41     thread_t   * this = CURRENT_THREAD;
     41    thread_t   * this    = CURRENT_THREAD;
     42    process_t  * process = this->process;
    4243
    4344    // check vaddr in user vspace
    44         error = vmm_v2p_translate( false , vaddr , &paddr );
     45        error = vmm_get_vseg( process , (intptr_t)vaddr , &vseg );
     46
    4547        if( error )
    4648    {
    47         printk("\n[ERROR] in %s : illegal barrier virtual address = %x\n",
    48                __FUNCTION__ , (intptr_t)vaddr );
     49
     50#if DEBUG_SYSCALLS_ERROR
     51printk("\n[ERROR] in %s : unmapped barrier %x / thread %x / process %x\n",
     52__FUNCTION__ , (intptr_t)vaddr , this->trdid , process->pid );
     53vmm_display( process , false );
     54#endif
    4955        this->errno = error;
    5056        return -1;
     
    6167                    if( error )
    6268            {
    63                 printk("\n[ERROR] in %s : cannot create barrier = %x\n",
    64                        __FUNCTION__ , (intptr_t)vaddr );
     69
     70#if DEBUG_SYSCALLS_ERROR
     71printk("\n[ERROR] in %s : cannot create barrier %x / thread %x / process %x\n",
     72__FUNCTION__ , (intptr_t)vaddr , this->trdid , process->pid );
     73#endif
    6574                this->errno = error;
    6675                return -1;
     
    7584            if( barrier_xp == XPTR_NULL )     // user error
    7685            {
    77                 printk("\n[ERROR] in %s : barrier %x not registered\n",
    78                        __FUNCTION__ , (intptr_t)vaddr );
     86
     87#if DEBUG_SYSCALLS_ERROR
     88printk("\n[ERROR] in %s : barrier %x not registered / thread %x / process %x\n",
     89__FUNCTION__ , (intptr_t)vaddr , this->trdid , process->pid );
     90#endif
    7991                this->errno = EINVAL;
    8092                return -1;
     
    93105            if( barrier_xp == XPTR_NULL )     // user error
    94106            {
    95                 printk("\n[ERROR] in %s : barrier %x not registered\n",
    96                        __FUNCTION__ , (intptr_t)vaddr );
     107
     108#if DEBUG_SYSCALLS_ERROR
     109printk("\n[ERROR] in %s : barrier %x not registered / thread %x / process %x\n",
     110__FUNCTION__ , (intptr_t)vaddr , this->trdid , process->pid );
     111#endif
    97112                this->errno = EINVAL;
    98113                return -1;
Note: See TracChangeset for help on using the changeset viewer.