Subversion Repositories HelenOS

Rev

Rev 2590 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2590 Rev 2600
Line 36... Line 36...
36
 */
36
 */
37
 
37
 
38
#include <ipc/ipc.h>
38
#include <ipc/ipc.h>
39
#include <ipc/services.h>
39
#include <ipc/services.h>
40
#include <async.h>
40
#include <async.h>
-
 
41
#include <fibril.h>
41
#include <errno.h>
42
#include <errno.h>
42
#include <stdio.h>
43
#include <stdio.h>
43
#include <stdlib.h>
44
#include <stdlib.h>
44
#include <string.h>
45
#include <string.h>
45
#include <ctype.h>
46
#include <ctype.h>
Line 336... Line 337...
336
             * For now, take the futex unconditionally.
337
             * For now, take the futex unconditionally.
337
             * Oh yeah, serialization rocks.
338
             * Oh yeah, serialization rocks.
338
             * It will be up'ed in vfs_release_phone().
339
             * It will be up'ed in vfs_release_phone().
339
             */
340
             */
340
            futex_down(&fs->phone_futex);
341
            futex_down(&fs->phone_futex);
-
 
342
            /*
-
 
343
             * Avoid deadlock with other fibrils in the same thread
-
 
344
             * by disabling fibril preemption.
-
 
345
             */
-
 
346
            fibril_inc_sercount();
341
            return fs->phone;
347
            return fs->phone;
342
        }
348
        }
343
    }
349
    }
344
    futex_up(&fs_head_futex);
350
    futex_up(&fs_head_futex);
345
    return 0;
351
    return 0;
Line 351... Line 357...
351
 */
357
 */
352
void vfs_release_phone(int phone)
358
void vfs_release_phone(int phone)
353
{
359
{
354
    bool found = false;
360
    bool found = false;
355
 
361
 
-
 
362
    /*
-
 
363
     * Undo the fibril_inc_sercount() done in vfs_grab_phone().
-
 
364
     */
-
 
365
    fibril_dec_sercount();
-
 
366
   
356
    futex_down(&fs_head_futex);
367
    futex_down(&fs_head_futex);
357
    link_t *cur;
368
    link_t *cur;
358
    for (cur = fs_head.next; cur != &fs_head; cur = cur->next) {
369
    for (cur = fs_head.next; cur != &fs_head; cur = cur->next) {
359
        fs_info_t *fs = list_get_instance(cur, fs_info_t, fs_link);
370
        fs_info_t *fs = list_get_instance(cur, fs_info_t, fs_link);
360
        if (fs->phone == phone) {
371
        if (fs->phone == phone) {