Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 1718 → Rev 1719

/uspace/trunk/ns/ns.c
81,8 → 81,6
ipcarg_t in_phone_hash; /**< Incoming phone hash. */
} hashed_service_t;
 
int static ping_phone;
 
static void *clockaddr = NULL;
static void *klogaddr = NULL;
 
106,9 → 104,8
{
ipc_call_t call;
ipc_callid_t callid;
char *as_area;
ipcarg_t retval, arg1, arg2;
ipcarg_t retval;
 
if (!hash_table_create(&ns_hash_table, NS_HASH_TABLE_CHAINS, 3, &ns_hash_table_ops)) {
return ENOMEM;
149,7 → 146,7
break;
}
if (! (callid & IPC_CALLID_NOTIFICATION)) {
ipc_answer_fast(callid, retval, arg1, arg2);
ipc_answer_fast(callid, retval, 0, 0);
}
}
}
257,6 → 254,7
assert(item);
free(hash_table_get_instance(item, hashed_service_t, link));
}
 
/**
* @}
*/
/uspace/trunk/fb/sysio.c
120,64 → 120,66
ipc_answer_fast(iid, ELIMIT, 0,0);
return;
}
client_connected = 1;
ipc_answer_fast(iid, 0, 0, 0); /* Accept connection */
while (1) {
callid = async_get_call(&call);
switch (IPC_GET_METHOD(call)) {
case IPC_M_PHONE_HUNGUP:
client_connected = 0;
ipc_answer_fast(callid,0,0,0);
return; /* Exit thread */
case FB_PUTCHAR:
c = IPC_GET_ARG1(call);
newrow = IPC_GET_ARG2(call);
newcol = IPC_GET_ARG3(call);
if (lastcol != newcol || lastrow!=newrow)
switch (IPC_GET_METHOD(call)) {
case IPC_M_PHONE_HUNGUP:
client_connected = 0;
ipc_answer_fast(callid, 0, 0, 0);
return; /* Exit thread */
case FB_PUTCHAR:
c = IPC_GET_ARG1(call);
newrow = IPC_GET_ARG2(call);
newcol = IPC_GET_ARG3(call);
if ((lastcol != newcol) || (lastrow != newrow))
curs_goto(newrow, newcol);
lastcol = newcol + 1;
lastrow = newrow;
sysput(c);
retval = 0;
break;
case FB_CURSOR_GOTO:
newrow = IPC_GET_ARG1(call);
newcol = IPC_GET_ARG2(call);
curs_goto(newrow, newcol);
lastcol = newcol + 1;
lastrow = newrow;
sysput(c);
retval = 0;
break;
case FB_CURSOR_GOTO:
newrow = IPC_GET_ARG1(call);
newcol = IPC_GET_ARG2(call);
curs_goto(newrow, newcol);
lastrow = newrow;
lastcol = newcol;
break;
case FB_GET_CSIZE:
ipc_answer_fast(callid, 0, HEIGHT, WIDTH);
continue;
case FB_CLEAR:
clrscr();
retval = 0;
break;
case FB_SET_STYLE:
fgcolor = IPC_GET_ARG1(call);
bgcolor = IPC_GET_ARG2(call);
if (fgcolor < bgcolor)
set_style(0);
else
set_style(7);
retval = 0;
break;
case FB_SCROLL:
i = IPC_GET_ARG1(call);
if (i > HEIGHT || i < -HEIGHT) {
retval = EINVAL;
lastrow = newrow;
lastcol = newcol;
retval = 0;
break;
}
scroll(i);
curs_goto(lastrow, lastcol);
retval = 0;
break;
 
default:
retval = ENOENT;
case FB_GET_CSIZE:
ipc_answer_fast(callid, 0, HEIGHT, WIDTH);
continue;
case FB_CLEAR:
clrscr();
retval = 0;
break;
case FB_SET_STYLE:
fgcolor = IPC_GET_ARG1(call);
bgcolor = IPC_GET_ARG2(call);
if (fgcolor < bgcolor)
set_style(0);
else
set_style(7);
retval = 0;
break;
case FB_SCROLL:
i = IPC_GET_ARG1(call);
if ((i > HEIGHT) || (i < -HEIGHT)) {
retval = EINVAL;
break;
}
scroll(i);
curs_goto(lastrow, lastcol);
retval = 0;
break;
default:
retval = ENOENT;
}
ipc_answer_fast(callid,retval,0,0);
ipc_answer_fast(callid, retval, 0, 0);
}
}
 
193,5 → 195,4
 
/**
* @}
*/
 
*/
/uspace/trunk/libc/include/err.h
26,7 → 26,7
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup libc
/** @addtogroup libc
* @{
*/
/** @file
35,12 → 35,13
#ifndef _libc__ERR_H_
#define _libc__ERR_H_
 
#define errx(status,fmt,...) { printf((fmt),##__VA_ARGS__);_exit(status);}
#define errx(status, fmt, ...) { \
printf((fmt), ##__VA_ARGS__); \
_exit(status); \
}
 
#endif
 
 
/** @}
/** @}
*/
/uspace/trunk/libc/include/libc.h
26,7 → 26,7
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup libc
/** @addtogroup libc
* @{
*/
/** @file
41,20 → 41,16
#define __SYSCALL0(id) __syscall(0, 0, 0, 0, id)
#define __SYSCALL1(id, p1) __syscall(p1, 0, 0, 0, id)
#define __SYSCALL2(id, p1, p2) __syscall(p1, p2, 0, 0, id)
#define __SYSCALL3(id, p1, p2, p3) __syscall(p1,p2,p3, 0, id)
#define __SYSCALL4(id, p1, p2, p3, p4) __syscall(p1,p2,p3,p4,id)
#define __SYSCALL3(id, p1, p2, p3) __syscall(p1, p2, p3, 0, id)
#define __SYSCALL4(id, p1, p2, p3, p4) __syscall(p1, p2, p3, p4, id)
 
extern void __main(void);
extern void __io_init(void);
extern void __exit(void);
extern sysarg_t __syscall(const sysarg_t p1, const sysarg_t p2,
const sysarg_t p3, const sysarg_t p4,
const syscall_t id);
extern sysarg_t __syscall(const sysarg_t p1, const sysarg_t p2, const sysarg_t p3, const sysarg_t p4, const syscall_t id);
 
 
#endif
 
 
/** @}
/** @}
*/
/uspace/trunk/libc/malloc/malloc.c
2930,10 → 2930,9
if (HAVE_MMAP &&
sp->size >= extra &&
!has_segment_link(m, sp)) { /* can't shrink if pinned */
size_t newsize = sp->size - extra;
/* Prefer mremap, fall back to munmap */
if ((CALL_MREMAP(sp->base, sp->size, newsize, 0) != MFAIL) ||
(CALL_MUNMAP(sp->base + newsize, extra) == 0)) {
if ((CALL_MREMAP(sp->base, sp->size, sp->size - extra, 0) != MFAIL) ||
(CALL_MUNMAP(sp->base + sp->size - extra, extra) == 0)) {
released = extra;
}
}
/uspace/trunk/libc/Makefile.toolchain
27,7 → 27,7
#
 
DEFS = -DARCH=$(ARCH)
CFLAGS = -fno-builtin -Werror-implicit-function-declaration -Wmissing-prototypes -O3 -nostdlib -nostdinc -I$(LIBC_PREFIX)/include
CFLAGS = -fno-builtin -Wall -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 -nostdlib -nostdinc -I$(LIBC_PREFIX)/include
LFLAGS = -M -N $(SOFTINT_PREFIX)/libsoftint.a
AFLAGS =
#-Werror
/uspace/trunk/libc/generic/time.c
26,7 → 26,7
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup libc
/** @addtogroup libc
* @{
*/
/** @file
73,9 → 73,7
if (!ktime) {
mapping = as_get_mappable_page(PAGE_SIZE);
/* Get the mapping of kernel clock */
res = ipc_call_sync_3(PHONE_NS, IPC_M_AS_AREA_RECV,
mapping, PAGE_SIZE, SERVICE_MEM_REALTIME,
NULL,&rights,NULL);
res = ipc_call_sync_3(PHONE_NS, IPC_M_AS_AREA_RECV, (sysarg_t) mapping, PAGE_SIZE, SERVICE_MEM_REALTIME, NULL, &rights, NULL);
if (res) {
printf("Failed to initialize timeofday memarea\n");
_exit(1);
117,7 → 115,5
}
 
 
/** @}
/** @}
*/
/uspace/trunk/libc/generic/ddi.c
26,7 → 26,7
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup libc
/** @addtogroup libc
* @{
*/
/** @file
69,7 → 69,6
*/
int iospace_enable(task_id_t id, void *ioaddr, unsigned long size)
{
task_id_t task_id;
ddi_ioarg_t arg;
 
arg.task_id = id;
89,7 → 88,5
}
 
 
/** @}
/** @}
*/
/uspace/trunk/libc/generic/cap.c
26,7 → 26,7
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup libc
/** @addtogroup libc
* @{
*/
/**
52,7 → 52,7
arg.value = (unsigned long long) id;
 
__SYSCALL2(SYS_CAP_GRANT, (sysarg_t) &arg, (sysarg_t) caps);
return __SYSCALL2(SYS_CAP_GRANT, (sysarg_t) &arg, (sysarg_t) caps);
}
 
/** Revoke capabilities from a task.
68,11 → 68,9
arg.value = (unsigned long long) id;
 
__SYSCALL2(SYS_CAP_REVOKE, (sysarg_t) &arg, (sysarg_t) caps);
return __SYSCALL2(SYS_CAP_REVOKE, (sysarg_t) &arg, (sysarg_t) caps);
}
 
 
/** @}
/** @}
*/
/uspace/trunk/libc/generic/as.c
26,7 → 26,7
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup libc
/** @addtogroup libc
* @{
*/
/** @file
75,7 → 75,7
}
 
static size_t heapsize = 0;
static size_t maxheapsize = (size_t)(-1);
static size_t maxheapsize = (size_t) (-1);
 
static void * last_allocated = 0;
 
92,24 → 92,29
{
int rc;
void *res;
/* Check for invalid values */
if (incr < 0 && -incr > heapsize)
return NULL;
/* Check for too large value */
if (incr > 0 && incr+heapsize < heapsize)
return NULL;
/* Check for too small values */
if (incr < 0 && incr+heapsize > heapsize)
return NULL;
/* Check for user limit */
if ((maxheapsize!=(size_t)(-1)) && (heapsize + incr)>maxheapsize) return NULL;
 
rc = as_area_resize(&_heap, heapsize + incr,0);
if ((maxheapsize != (size_t) (-1)) && (heapsize + incr) > maxheapsize)
return NULL;
rc = as_area_resize(&_heap, heapsize + incr, 0);
if (rc != 0)
return NULL;
/* Compute start of new area */
res = (void *)&_heap + heapsize;
res = (void *) &_heap + heapsize;
 
heapsize += incr;
 
119,9 → 124,9
/** Set maximum heap size and return pointer just after the heap */
void *set_maxheapsize(size_t mhs)
{
maxheapsize=mhs;
maxheapsize = mhs;
/* Return pointer to area not managed by sbrk */
return (void *)&_heap + maxheapsize;
return ((void *) &_heap + maxheapsize);
 
}
 
136,9 → 141,10
 
/* Set heapsize to some meaningful value */
if (maxheapsize == -1)
set_maxheapsize(ALIGN_UP(USER_ADDRESS_SPACE_SIZE_ARCH>>1,PAGE_SIZE));
set_maxheapsize(ALIGN_UP(USER_ADDRESS_SPACE_SIZE_ARCH >> 1, PAGE_SIZE));
if (!last_allocated)
last_allocated = ALIGN_UP((void *)&_heap + maxheapsize, PAGE_SIZE);
last_allocated = (void *) ALIGN_UP((void *) &_heap + maxheapsize, PAGE_SIZE);
sz = ALIGN_UP(sz, PAGE_SIZE);
res = last_allocated;
147,8 → 153,5
return res;
}
 
 
/** @}
/** @}
*/
/uspace/trunk/libc/generic/string.c
26,7 → 26,7
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup libc
/** @addtogroup libc
* @{
*/
/** @file
41,48 → 41,52
 
/* Dummy implementation of mem/ functions */
 
void * memset(void *s, int c, size_t n)
void *memset(void *s, int c, size_t n)
{
char *os = s;
while (n--)
*(os++) = c;
return s;
}
 
struct along {unsigned long n; } __attribute__ ((packed));
struct along {
unsigned long n;
} __attribute__ ((packed));
 
static void * unaligned_memcpy(void *dst, const void *src, size_t n)
static void *unaligned_memcpy(void *dst, const void *src, size_t n)
{
int i, j;
struct along *adst = dst;
const struct along *asrc = src;
 
for (i = 0; i < n/sizeof(unsigned long); i++)
for (i = 0; i < n / sizeof(unsigned long); i++)
adst[i].n = asrc[i].n;
for (j = 0; j < n%sizeof(unsigned long); j++)
((unsigned char *)(((unsigned long *) dst) + i))[j] = ((unsigned char *)(((unsigned long *) src) + i))[j];
for (j = 0; j < n % sizeof(unsigned long); j++)
((unsigned char *) (((unsigned long *) dst) + i))[j] = ((unsigned char *) (((unsigned long *) src) + i))[j];
return (char *)src;
return (char *) src;
}
 
void * memcpy(void *dst, const void *src, size_t n)
void *memcpy(void *dst, const void *src, size_t n)
{
int i, j;
 
if (((long)dst & (sizeof(long)-1)) || ((long)src & (sizeof(long)-1)))
if (((long) dst & (sizeof(long) - 1)) || ((long) src & (sizeof(long) - 1)))
return unaligned_memcpy(dst, src, n);
 
for (i = 0; i < n/sizeof(unsigned long); i++)
for (i = 0; i < n / sizeof(unsigned long); i++)
((unsigned long *) dst)[i] = ((unsigned long *) src)[i];
for (j = 0; j < n%sizeof(unsigned long); j++)
((unsigned char *)(((unsigned long *) dst) + i))[j] = ((unsigned char *)(((unsigned long *) src) + i))[j];
for (j = 0; j < n % sizeof(unsigned long); j++)
((unsigned char *) (((unsigned long *) dst) + i))[j] = ((unsigned char *) (((unsigned long *) src) + i))[j];
return (char *)src;
return (char *) src;
}
 
void * memmove(void *dst, const void *src, size_t n)
void *memmove(void *dst, const void *src, size_t n)
{
int i, j;
89,13 → 93,13
if (src > dst)
return memcpy(dst, src, n);
 
for (j = (n%sizeof(unsigned long))-1; j >= 0; j--)
((unsigned char *)(((unsigned long *) dst) + i))[j] = ((unsigned char *)(((unsigned long *) src) + i))[j];
for (j = (n % sizeof(unsigned long)) - 1; j >= 0; j--)
((unsigned char *) ((unsigned long *) dst))[j] = ((unsigned char *) ((unsigned long *) src))[j];
 
for (i = n/sizeof(unsigned long)-1; i >=0 ; i--)
for (i = n / sizeof(unsigned long) - 1; i >=0 ; i--)
((unsigned long *) dst)[i] = ((unsigned long *) src)[i];
return (char *)src;
return (char *) src;
}
 
 
107,25 → 111,24
{
size_t counter = 0;
 
while (str[counter] != 0) {
while (str[counter] != 0)
counter++;
}
 
return counter;
}
 
int strcmp(const char *a,const char *b)
int strcmp(const char *a, const char *b)
{
int c=0;
int c = 0;
while(a[c]&&b[c]&&(!(a[c]-b[c]))) c++;
while (a[c] && b[c] && (!(a[c] - b[c])))
c++;
return a[c]-b[c];
return (a[c] - b[c]);
}
 
 
 
/** Return pointer to the first occurence of character c in string
* @param str scanned string
* @param c searched character (taken as one byte)
134,8 → 137,8
char *strchr(const char *str, int c)
{
while (*str != '\0') {
if (*str == (char)c)
return (char *)str;
if (*str == (char) c)
return (char *) str;
str++;
}
 
152,12 → 155,12
char *retval = NULL;
 
while (*str != '\0') {
if (*str == (char)c)
retval = (char *)str;
if (*str == (char) c)
retval = (char *) str;
str++;
}
 
return (char *)retval;
return (char *) retval;
}
 
/** Convert string to a number.
209,7 → 212,7
 
while (*str) {
c = *str;
c = ( c >= 'a'? c-'a'+10:(c >= 'A'?c-'A'+10:(c <= '9'?c-'0':0xff)));
c = (c >= 'a' ? c - 'a' + 10 : (c >= 'A' ? c - 'A' + 10 : (c <= '9' ? c - '0' : 0xff)));
if (c > base) {
break;
}
235,7 → 238,7
}
if (endptr)
*endptr = (char *)str;
*endptr = (char *) str;
 
if (nptr == str) {
/*FIXME: errno = EINVAL*/
263,15 → 266,15
number = _strtoul(nptr, endptr, base, &sgn);
 
if (number > LONG_MAX) {
if ((sgn) && (number == (unsigned long)(LONG_MAX) + 1)) {
if ((sgn) && (number == (unsigned long) (LONG_MAX) + 1)) {
/* FIXME: set 0 to errno */
return number;
}
/* FIXME: set ERANGE to errno */
return (sgn?LONG_MIN:LONG_MAX);
return (sgn ? LONG_MIN : LONG_MAX);
}
return (sgn?-number:number);
return (sgn ? -number : number);
}
 
 
292,23 → 295,25
number = _strtoul(nptr, endptr, base, &sgn);
 
return (sgn?-number:number);
return (sgn ? -number : number);
}
 
char *strcpy(char *dest, const char *src)
{
while (*(dest++) = *(src++))
;
char *orig = dest;
while ((*(dest++) = *(src++)));
return orig;
}
 
char *strncpy(char *dest, const char *src, size_t n)
{
while ((*(dest++) = *(src++)) && --n)
;
char *orig = dest;
while ((*(dest++) = *(src++)) && --n);
return orig;
}
 
 
/** @}
/** @}
*/
/uspace/trunk/libc/generic/libc.c
25,15 → 25,16
* (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 lc Libc
* @brief HelenOS C library
* @{
* @}
*/
/** @addtogroup libc generic
* @ingroup lc
 
/** @addtogroup lc Libc
* @brief HelenOS C library
* @{
* @}
*/
/** @addtogroup libc generic
* @ingroup lc
* @{
*/
/** @file
*/
 
49,11 → 50,13
 
extern char _heap;
 
void _exit(int status) {
void _exit(int status)
{
thread_exit(status);
}
 
void __main(void) {
void __main(void)
{
psthread_data_t *pt;
 
(void) as_area_create(&_heap, 1, AS_AREA_WRITE | AS_AREA_READ);
62,19 → 65,18
__tcb_set(pt->tcb);
}
 
void __io_init(void) {
void __io_init(void)
{
open("stdin", 0);
open("stdout", 0);
open("stderr", 0);
}
 
void __exit(void) {
void __exit(void)
{
psthread_teardown(__tcb_get()->pst_data);
_exit(0);
}
 
 
/** @}
/** @}
*/
/uspace/trunk/libc/generic/psthread.c
26,7 → 26,7
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup libc
/** @addtogroup libc
* @{
*/
/** @file
51,7 → 51,6
static LIST_INITIALIZE(serialized_list);
static LIST_INITIALIZE(manager_list);
 
static void psthread_exit(void) __attribute__ ((noinline));
static void psthread_main(void);
 
static atomic_t psthread_futex = FUTEX_INITIALIZER;
191,7 → 190,7
*/
int psthread_join(pstid_t psthrid)
{
volatile psthread_data_t *pt, *mypt;
volatile psthread_data_t *pt;
volatile int retval;
 
/* Handle psthrid = Kernel address -> it is wait for call */
238,8 → 237,7
pt->flags = 0;
 
context_save(&pt->ctx);
context_set(&pt->ctx, FADDR(psthread_main), pt->stack, PSTHREAD_INITIAL_STACK_PAGES_NO*getpagesize(),
pt->tcb);
context_set(&pt->ctx, FADDR(psthread_main), pt->stack, PSTHREAD_INITIAL_STACK_PAGES_NO*getpagesize(), pt->tcb);
 
return (pstid_t )pt;
}
307,7 → 305,5
}
 
 
/** @}
/** @}
*/
/uspace/trunk/libc/generic/async.c
26,7 → 26,7
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup libc
/** @addtogroup libc
* @{
*/
/** @file
373,11 → 373,13
/* Setup thread local connection pointer */
PS_connection = (connection_t *)arg;
PS_connection->cthread(PS_connection->callid, &PS_connection->call);
/* Remove myself from connection hash table */
futex_down(&async_futex);
key = PS_connection->in_phone_hash;
hash_table_remove(&conn_hash_table, &key, 1);
futex_up(&async_futex);
/* Answer all remaining messages with ehangup */
while (!list_empty(&PS_connection->msg_queue)) {
msg = list_get_instance(PS_connection->msg_queue.next, msg_t, link);
389,6 → 391,8
}
if (PS_connection->close_callid)
ipc_answer_fast(PS_connection->close_callid, 0, 0, 0);
return 0;
}
 
/** Create new thread for a new connection
405,11 → 409,8
* opening the connection
* @return New thread id
*/
pstid_t async_new_connection(ipcarg_t in_phone_hash,ipc_callid_t callid,
ipc_call_t *call,
void (*cthread)(ipc_callid_t,ipc_call_t *))
pstid_t async_new_connection(ipcarg_t in_phone_hash,ipc_callid_t callid, ipc_call_t *call, void (*cthread)(ipc_callid_t, ipc_call_t *))
{
pstid_t ptid;
connection_t *conn;
unsigned long key;
 
514,9 → 515,10
 
while (1) {
if (psthread_schedule_next_adv(PS_FROM_MANAGER)) {
futex_up(&async_futex); /* async_futex is always held
* when entering manager thread
*/
futex_up(&async_futex);
/* async_futex is always held
* when entering manager thread
*/
continue;
}
futex_down(&async_futex);
546,6 → 548,8
 
handle_call(callid, &call);
}
return 0;
}
 
/** Function to start async_manager as a standalone thread
557,9 → 561,12
*/
static int async_manager_thread(void *arg)
{
futex_up(&async_futex); /* async_futex is always locked when entering
* manager */
futex_up(&async_futex);
/* async_futex is always locked when entering
* manager */
async_manager_worker();
return 0;
}
 
/** Add one manager to manager list */
585,6 → 592,7
return ENOMEM;
}
return 0;
}
 
/** IPC handler for messages in async framework
679,7 → 687,6
void async_wait_for(aid_t amsgid, ipcarg_t *retval)
{
amsg_t *msg = (amsg_t *) amsgid;
connection_t *conn;
 
futex_down(&async_futex);
if (msg->done) {
711,7 → 718,6
int async_wait_timeout(aid_t amsgid, ipcarg_t *retval, suseconds_t timeout)
{
amsg_t *msg = (amsg_t *) amsgid;
connection_t *conn;
 
/* TODO: Let it go through the event read at least once */
if (timeout < 0)
802,7 → 808,5
}
 
 
/** @}
/** @}
*/
/uspace/trunk/libc/generic/io/stream.c
27,7 → 27,7
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup libc
/** @addtogroup libc
* @{
*/
/** @file
73,7 → 73,7
if (async_req_2(streams[0].phone, CONSOLE_GETCHAR, 0, 0, &r0, &r1) < 0) {
return -1;
}
((char *)buf)[i++] = r0;
((char *) buf)[i++] = r0;
}
return i;
}
81,21 → 81,17
static ssize_t write_stdout(void *param, const void *buf, size_t count)
{
int i;
ipcarg_t r0,r1;
 
for (i = 0; i < count; i++)
async_msg(streams[1].phone, CONSOLE_PUTCHAR, ((const char *)buf)[i]);
async_msg(streams[1].phone, CONSOLE_PUTCHAR, ((const char *) buf)[i]);
return count;
}
 
 
 
static stream_t open_stdin(void)
{
stream_t stream;
int phoneid;
int res;
if (console_phone < 0) {
while ((console_phone = ipc_connect_me_to(PHONE_NS, SERVICE_CONSOLE, 0)) < 0) {
104,6 → 100,7
}
stream.r = read_stdin;
stream.w = NULL;
stream.param = 0;
stream.phone = console_phone;
113,7 → 110,6
static stream_t open_stdout(void)
{
stream_t stream;
int res;
 
if (console_phone < 0) {
while ((console_phone = ipc_connect_me_to(PHONE_NS, SERVICE_CONSOLE, 0)) < 0) {
121,9 → 117,11
}
}
stream.r = NULL;
stream.w = write_stdout;
stream.phone = console_phone;
stream.param = 0;
return stream;
}
 
139,6 → 137,7
 
while (((streams[c].w) || (streams[c].r)) && (c < FDS))
c++;
if (c == FDS)
return EMFILE;
156,10 → 155,13
streams[c].w = write_stderr;
return c;
}
if (!strcmp(fname, "null")) {
streams[c].w = write_null;
return c;
}
return -1;
}
 
 
189,7 → 191,5
}
 
 
/** @}
/** @}
*/
/uspace/trunk/libc/generic/err.c
26,7 → 26,7
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup libc
/** @addtogroup libc
* @{
*/
/** @file
35,14 → 35,13
#include <stdio.h>
#include <stdlib.h>
 
void errx (int __status, __const char *__format, ...)
/* TODO
void errx(int __status, __const char *__format, ...)
{
printf("TODO...errx\n");
_exit(0);
}
*/
 
 
/** @}
/** @}
*/
/uspace/trunk/libc/generic/mmap.c
26,7 → 26,7
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup libc
/** @addtogroup libc
* @{
*/
/** @file
36,11 → 36,8
#include <as.h>
#include <unistd.h>
 
void *mmap(void *start, size_t length, int prot, int flags, int fd,
off_t offset)
void *mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset)
{
int rc;
 
if (!start)
start = as_get_mappable_page(length);
58,7 → 55,5
}
 
 
/** @}
/** @}
*/