Rev 3908 | Rev 3987 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3908 | Rev 3983 | ||
|---|---|---|---|
| Line 247... | Line 247... | ||
| 247 | */ |
247 | */ |
| 248 | return (unative_t) copy_to_uspace(uspace_task_id, &TASK->taskid, |
248 | return (unative_t) copy_to_uspace(uspace_task_id, &TASK->taskid, |
| 249 | sizeof(TASK->taskid)); |
249 | sizeof(TASK->taskid)); |
| 250 | } |
250 | } |
| 251 | 251 | ||
| - | 252 | /** Syscall for setting the task name. |
|
| - | 253 | * |
|
| - | 254 | * The name simplifies identifying the task in the task list. |
|
| - | 255 | * |
|
| - | 256 | * @param name The new name for the task. (typically the same |
|
| - | 257 | * as the command used to execute it). |
|
| - | 258 | * |
|
| - | 259 | * @return 0 on success or an error code from @ref errno.h. |
|
| - | 260 | */ |
|
| - | 261 | unative_t sys_task_set_name(const char *uspace_name, size_t name_len) |
|
| - | 262 | { |
|
| - | 263 | int rc; |
|
| - | 264 | char namebuf[TASK_NAME_BUFLEN]; |
|
| - | 265 | ||
| - | 266 | /* Cap length of name and copy it from userspace. */ |
|
| - | 267 | ||
| - | 268 | if (name_len > TASK_NAME_BUFLEN - 1) |
|
| - | 269 | name_len = TASK_NAME_BUFLEN - 1; |
|
| - | 270 | ||
| - | 271 | rc = copy_from_uspace(namebuf, uspace_name, name_len); |
|
| - | 272 | if (rc != 0) |
|
| - | 273 | return (unative_t) rc; |
|
| - | 274 | ||
| - | 275 | namebuf[name_len] = '\0'; |
|
| - | 276 | strcpy(TASK->name, namebuf); |
|
| - | 277 | ||
| - | 278 | return EOK; |
|
| - | 279 | } |
|
| - | 280 | ||
| 252 | /** Find task structure corresponding to task ID. |
281 | /** Find task structure corresponding to task ID. |
| 253 | * |
282 | * |
| 254 | * The tasks_lock must be already held by the caller of this function and |
283 | * The tasks_lock must be already held by the caller of this function and |
| 255 | * interrupts must be disabled. |
284 | * interrupts must be disabled. |
| 256 | * |
285 | * |