Subversion Repositories HelenOS

Rev

Rev 2678 | Rev 2693 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2678 Rev 2684
Line 1... Line 1...
1
/*
1
/*
2
 * Copyright (c) 2007 Jakub Jermar
2
 * Copyright (c) 2008 Jakub Jermar
3
 * All rights reserved.
3
 * All rights reserved.
4
 *
4
 *
5
 * Redistribution and use in source and binary forms, with or without
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
6
 * modification, are permitted provided that the following conditions
7
 * are met:
7
 * are met:
Line 182... Line 182...
182
    async_wait_for(req, &rc);
182
    async_wait_for(req, &rc);
183
    async_serialize_end();
183
    async_serialize_end();
184
    futex_up(&vfs_phone_futex);
184
    futex_up(&vfs_phone_futex);
185
    return (ssize_t) IPC_GET_ARG1(answer);
185
    return (ssize_t) IPC_GET_ARG1(answer);
186
}
186
}
-
 
187
 
-
 
188
off_t lseek(int fildes, off_t offset, int whence)
-
 
189
{
-
 
190
    int res;
-
 
191
    ipcarg_t rc;
-
 
192
 
-
 
193
    futex_down(&vfs_phone_futex);
-
 
194
    async_serialize_start();
-
 
195
    if (vfs_phone < 0) {
-
 
196
        res = vfs_connect();
-
 
197
        if (res < 0) {
-
 
198
            async_serialize_end();
-
 
199
            futex_up(&vfs_phone_futex);
-
 
200
            return res;
-
 
201
        }
-
 
202
    }
-
 
203
       
-
 
204
    off_t newoffs;
-
 
205
    rc = async_req_3_1(vfs_phone, VFS_SEEK, fildes, offset, whence,
-
 
206
        &newoffs);
-
 
207
 
-
 
208
    async_serialize_end();
-
 
209
    futex_up(&vfs_phone_futex);
-
 
210
 
-
 
211
    if (rc != EOK)
-
 
212
        return (off_t) -1;
-
 
213
   
-
 
214
    return newoffs;
-
 
215
}
-
 
216
 
187
/** @}
217
/** @}
188
 */
218
 */