Changeset 80cd7cd in mainline for uspace/app/kill/kill.c


Ignore:
Timestamp:
2011-01-13T20:58:24Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
87e373b
Parents:
eaef141 (diff), a613fea1 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/app/kill/kill.c

    reaef141 r80cd7cd  
    11/*
    2  * Copyright (c) 2009 Lukas Mejdrech
     2 * Copyright (c) 2010 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup arp
     29/** @addtogroup kill
    3030 * @{
    3131 */
    32 
    33 /** @file
    34  * ARP module functions.
    35  * The functions are used as ARP module entry points.
     32/**
     33 * @file Forcefully terminate a task.
    3634 */
    3735
    38 #ifndef NET_ARP_MODULE_H_
    39 #define NET_ARP_MODULE_H_
     36#include <errno.h>
     37#include <stdio.h>
     38#include <task.h>
     39#include <str_error.h>
    4040
    41 #include <ipc/ipc.h>
    42 #include <async.h>
     41#define NAME  "kill"
    4342
    44 extern int arp_initialize(async_client_conn_t);
    45 extern int arp_message_standalone(ipc_callid_t, ipc_call_t *, ipc_call_t *,
    46     int *);
     43static void print_syntax(void)
     44{
     45        printf("Syntax: " NAME " <task ID>\n");
     46}
    4747
    48 #endif
     48int main(int argc, char *argv[])
     49{
     50        char *eptr;
     51        task_id_t taskid;
     52        int rc;
     53
     54        if (argc != 2) {
     55                print_syntax();
     56                return 1;
     57        }
     58
     59        taskid = strtoul(argv[1], &eptr, 0);
     60        if (*eptr != '\0') {
     61                printf("Invalid task ID argument '%s'.\n", argv[1]);
     62                return 2;
     63        }
     64
     65        rc = task_kill(taskid);
     66        if (rc != EOK) {
     67                printf("Failed to kill task ID %" PRIu64 ": %s\n",
     68                    taskid, str_error(rc));
     69                return 3;
     70        }
     71
     72        return 0;
     73}
    4974
    5075/** @}
Note: See TracChangeset for help on using the changeset viewer.