Rev 2699 | Rev 2707 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2699 | Rev 2700 | ||
---|---|---|---|
Line 93... | Line 93... | ||
93 | async_serialize_end(); |
93 | async_serialize_end(); |
94 | futex_up(&vfs_phone_futex); |
94 | futex_up(&vfs_phone_futex); |
95 | return (int) rc; |
95 | return (int) rc; |
96 | } |
96 | } |
97 | 97 | ||
98 | - | ||
99 | int open(const char *path, int oflag, ...) |
98 | static int _open(const char *path, int lflag, int oflag, ...) |
100 | { |
99 | { |
101 | int res; |
100 | int res; |
102 | ipcarg_t rc; |
101 | ipcarg_t rc; |
103 | ipc_call_t answer; |
102 | ipc_call_t answer; |
104 | aid_t req; |
103 | aid_t req; |
Line 111... | Line 110... | ||
111 | async_serialize_end(); |
110 | async_serialize_end(); |
112 | futex_up(&vfs_phone_futex); |
111 | futex_up(&vfs_phone_futex); |
113 | return res; |
112 | return res; |
114 | } |
113 | } |
115 | } |
114 | } |
116 | req = async_send_2(vfs_phone, VFS_OPEN, oflag, 0, &answer); |
115 | req = async_send_3(vfs_phone, VFS_OPEN, lflag, oflag, 0, &answer); |
117 | rc = ipc_data_write_start(vfs_phone, path, strlen(path)); |
116 | rc = ipc_data_write_start(vfs_phone, path, strlen(path)); |
118 | if (rc != EOK) { |
117 | if (rc != EOK) { |
119 | async_wait_for(req, NULL); |
118 | async_wait_for(req, NULL); |
120 | async_serialize_end(); |
119 | async_serialize_end(); |
121 | futex_up(&vfs_phone_futex); |
120 | futex_up(&vfs_phone_futex); |
Line 125... | Line 124... | ||
125 | async_serialize_end(); |
124 | async_serialize_end(); |
126 | futex_up(&vfs_phone_futex); |
125 | futex_up(&vfs_phone_futex); |
127 | return (int) IPC_GET_ARG1(answer); |
126 | return (int) IPC_GET_ARG1(answer); |
128 | } |
127 | } |
129 | 128 | ||
- | 129 | int open(const char *path, int oflag, ...) |
|
- | 130 | { |
|
- | 131 | return _open(path, L_FILE, oflag); |
|
- | 132 | } |
|
- | 133 | ||
130 | ssize_t read(int fildes, void *buf, size_t nbyte) |
134 | ssize_t read(int fildes, void *buf, size_t nbyte) |
131 | { |
135 | { |
132 | int res; |
136 | int res; |
133 | ipcarg_t rc; |
137 | ipcarg_t rc; |
134 | ipc_call_t answer; |
138 | ipc_call_t answer; |
Line 240... | Line 244... | ||
240 | DIR *opendir(const char *dirname) |
244 | DIR *opendir(const char *dirname) |
241 | { |
245 | { |
242 | DIR *dirp = malloc(sizeof(DIR)); |
246 | DIR *dirp = malloc(sizeof(DIR)); |
243 | if (!dirp) |
247 | if (!dirp) |
244 | return NULL; |
248 | return NULL; |
245 | dirp->fd = open(dirname, 0); /* TODO: must be a directory */ |
249 | dirp->fd = _open(dirname, L_DIRECTORY, 0); |
246 | if (dirp->fd < 0) { |
250 | if (dirp->fd < 0) { |
247 | free(dirp); |
251 | free(dirp); |
248 | return NULL; |
252 | return NULL; |
249 | } |
253 | } |
250 | return dirp; |
254 | return dirp; |