/branches/dynload/uspace/lib/libc/include/string.h |
---|
64,6 → 64,9 |
extern long int strtol(const char *, char **, int); |
extern unsigned long strtoul(const char *, char **, int); |
extern char * strtok_r(char *, const char *, char **); |
extern char * strtok(char *, const char *); |
#endif |
/** @} |
/branches/dynload/uspace/lib/libc/include/udebug.h |
---|
0,0 → 1,58 |
/* |
* Copyright (c) 2008 Jiri Svoboda |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/** @addtogroup libc |
* @{ |
*/ |
/** @file |
*/ |
#ifndef LIBC_UDEBUG_H_ |
#define LIBC_UDEBUG_H_ |
#include <kernel/udebug/udebug.h> |
#include <sys/types.h> |
#include <libarch/types.h> |
typedef sysarg_t thash_t; |
int udebug_begin(int phoneid); |
int udebug_end(int phoneid); |
int udebug_set_evmask(int phoneid, udebug_evmask_t mask); |
int udebug_thread_read(int phoneid, void *buffer, size_t n, |
size_t *copied, size_t *needed); |
int udebug_mem_read(int phoneid, void *buffer, uintptr_t addr, size_t n); |
int udebug_args_read(int phoneid, thash_t tid, sysarg_t *buffer); |
int udebug_go(int phoneid, thash_t tid, udebug_event_t *ev_type, |
sysarg_t *val0, sysarg_t *val1); |
int udebug_stop(int phoneid, thash_t tid); |
#endif |
/** @} |
*/ |
/branches/dynload/uspace/lib/libc/include/ipc/ipc.h |
---|
288,6 → 288,10 |
extern int ipc_data_write_receive(ipc_callid_t *callid, size_t *size); |
extern int ipc_data_write_finalize(ipc_callid_t callid, void *dst, size_t size); |
#include <task.h> |
extern int ipc_connect_kbox(task_id_t id); |
#endif |
/** @} |
/branches/dynload/uspace/lib/libc/include/ipc/loader.h |
---|
39,6 → 39,7 |
typedef enum { |
LOADER_HELLO = IPC_FIRST_USER_METHOD, |
LOADER_GET_TASKID, |
LOADER_SET_PATHNAME, |
LOADER_SET_ARGS, |
LOADER_RUN |
/branches/dynload/uspace/lib/libc/generic/task.c |
---|
133,6 → 133,7 |
char *pa; |
size_t pa_len; |
task_id_t task_id; |
pa = absolutize(path, &pa_len); |
if (!pa) |
151,6 → 152,18 |
if (rc != EOK) |
return 0; |
/* Get task ID. */ |
req = async_send_0(phone_id, LOADER_GET_TASKID, &answer); |
rc = ipc_data_read_start(phone_id, &task_id, sizeof(task_id)); |
if (rc != EOK) { |
async_wait_for(req, NULL); |
goto error; |
} |
async_wait_for(req, &retval); |
if (retval != EOK) |
goto error; |
/* Send program pathname */ |
req = async_send_0(phone_id, LOADER_SET_PATHNAME, &answer); |
rc = ipc_data_write_start(phone_id, (void *)pa, pa_len); |
175,7 → 188,7 |
/* Success */ |
ipc_hangup(phone_id); |
return 1; |
return task_id; |
/* Error exit */ |
error: |
/branches/dynload/uspace/lib/libc/generic/string.c |
---|
1,5 → 1,7 |
/* |
* Copyright (c) 2005 Martin Decky |
* Copyright (C) 1998 by Wes Peters <wes@softweyr.com> |
* Copyright (c) 1988, 1993 The Regents of the University of California. |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
396,5 → 398,52 |
return (char *) memcpy(ret, s1, len); |
} |
/* Ported from FBSD strtok.c 8.1 (Berkeley) 6/4/93 */ |
char * strtok_r(char *s, const char *delim, char **last) |
{ |
char *spanp, *tok; |
int c, sc; |
if (s == NULL && (s = *last) == NULL) |
return (NULL); |
cont: |
c = *s++; |
for (spanp = (char *)delim; (sc = *spanp++) != 0;) { |
if (c == sc) |
goto cont; |
} |
if (c == 0) { /* no non-delimiter characters */ |
*last = NULL; |
return (NULL); |
} |
tok = s - 1; |
for (;;) { |
c = *s++; |
spanp = (char *)delim; |
do { |
if ((sc = *spanp++) == c) { |
if (c == 0) |
s = NULL; |
else |
s[-1] = '\0'; |
*last = s; |
return (tok); |
} |
} while (sc != 0); |
} |
} |
/* Ported from FBSD strtok.c 8.1 (Berkeley) 6/4/93 */ |
char * strtok(char *s, const char *delim) |
{ |
static char *last; |
return (strtok_r(s, delim, &last)); |
} |
/** @} |
*/ |
/branches/dynload/uspace/lib/libc/generic/ipc.c |
---|
909,6 → 909,18 |
{ |
return ipc_answer_2(callid, EOK, (ipcarg_t) dst, (ipcarg_t) size); |
} |
#include <kernel/syscall/sysarg64.h> |
/** Connect to a task specified by id. |
*/ |
int ipc_connect_kbox(task_id_t id) |
{ |
sysarg64_t arg; |
arg.value = (unsigned long long) id; |
return __SYSCALL1(SYS_IPC_CONNECT_KBOX, (sysarg_t) &arg); |
} |
/** @} |
*/ |
/branches/dynload/uspace/lib/libc/generic/udebug.c |
---|
0,0 → 1,92 |
/* |
* Copyright (c) 2008 Jiri Svoboda |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/** @addtogroup libc |
* @{ |
*/ |
/** @file |
*/ |
#include <udebug.h> |
#include <sys/types.h> |
#include <syscall.h> |
#include <ipc/ipc.h> |
#include <async.h> |
int udebug_begin(int phoneid) |
{ |
return async_req_1_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_BEGIN); |
} |
int udebug_end(int phoneid) |
{ |
return async_req_1_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_END); |
} |
int udebug_set_evmask(int phoneid, udebug_evmask_t mask) |
{ |
return async_req_2_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_SET_EVMASK, |
mask); |
} |
int udebug_thread_read(int phoneid, void *buffer, size_t n, |
size_t *copied, size_t *needed) |
{ |
unsigned dest_addr; |
return async_req_3_3(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_THREAD_READ, |
(sysarg_t)buffer, n, &dest_addr, copied, needed); |
} |
int udebug_mem_read(int phoneid, void *buffer, uintptr_t addr, size_t n) |
{ |
return async_req_4_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_MEM_READ, |
(sysarg_t)buffer, addr, n); |
} |
int udebug_args_read(int phoneid, thash_t tid, sysarg_t *buffer) |
{ |
return async_req_3_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_ARGS_READ, |
tid, (sysarg_t)buffer); |
} |
int udebug_go(int phoneid, thash_t tid, udebug_event_t *ev_type, |
sysarg_t *val0, sysarg_t *val1) |
{ |
return async_req_2_3(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_GO, |
tid, (sysarg_t)ev_type, (sysarg_t)val0, (sysarg_t)val1); |
} |
int udebug_stop(int phoneid, thash_t tid) |
{ |
return async_req_2_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_STOP, |
tid); |
} |
/** @} |
*/ |
/branches/dynload/uspace/lib/libc/Makefile |
---|
80,6 → 80,7 |
generic/err.c \ |
generic/stdlib.c \ |
generic/mman.c \ |
generic/udebug.c \ |
generic/vfs/vfs.c \ |
generic/vfs/canonify.c |