Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4013 → Rev 4014

/trunk/kernel/generic/include/string.h
26,7 → 26,7
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup generic
/** @addtogroup generic
* @{
*/
/** @file
/trunk/kernel/generic/src/main/kinit.c
32,7 → 32,7
 
/**
* @file
* @brief Kernel initialization thread.
* @brief Kernel initialization thread.
*
* This file contains kinit kernel thread which carries out
* high level system initialization.
80,8 → 80,8
static char alive[ALIVE_CHARS] = "-\\|/";
#endif
 
#define BOOT_PREFIX "boot:"
#define BOOT_PREFIX_LEN 5
#define BOOT_PREFIX "boot:"
#define BOOT_PREFIX_LEN 5
 
/** Kernel initialization thread.
*
97,15 → 97,15
#if defined(CONFIG_SMP) || defined(CONFIG_KCONSOLE)
thread_t *thread;
#endif
 
/*
* Detach kinit as nobody will call thread_join_timeout() on it.
*/
thread_detach(THREAD);
 
interrupts_disable();
 
#ifdef CONFIG_SMP
#ifdef CONFIG_SMP
if (config.cpu_count > 1) {
waitq_initialize(&ap_completion_wq);
/*
125,9 → 125,7
thread_join(thread);
thread_detach(thread);
}
#endif /* CONFIG_SMP */
#ifdef CONFIG_SMP
if (config.cpu_count > 1) {
count_t i;
143,7 → 141,6
thread_ready(thread);
} else
printf("Unable to create kcpulb thread for cpu" PRIc "\n", i);
 
}
}
#endif /* CONFIG_SMP */
152,7 → 149,7
* At this point SMP, if present, is configured.
*/
arch_post_smp_init();
 
#ifdef CONFIG_KCONSOLE
if (stdin) {
/*
179,17 → 176,19
printf("init[%" PRIc "].addr is not frame aligned\n", i);
continue;
}
 
/*
* Construct task name from the 'boot:' prefix and the
* name stored in the init structure (if any).
*/
 
char namebuf[TASK_NAME_BUFLEN], *name;
 
char namebuf[TASK_NAME_BUFLEN];
char *name;
name = init.tasks[i].name;
if (name[0] == '\0') name = "<unknown>";
 
if (name[0] == '\0')
name = "<unknown>";
ASSERT(TASK_NAME_BUFLEN >= BOOT_PREFIX_LEN);
strncpy(namebuf, BOOT_PREFIX, TASK_NAME_BUFLEN);
strncpy(namebuf + BOOT_PREFIX_LEN, name,
233,7 → 232,7
thread_usleep(10000);
}
}
 
#ifdef CONFIG_KCONSOLE
if (!stdin) {
thread_sleep(10);
/trunk/kernel/generic/src/lib/string.c
26,13 → 26,13
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup generic
/** @addtogroup generic
* @{
*/
 
/**
* @file
* @brief Miscellaneous functions.
* @brief Miscellaneous functions.
*/
 
#include <string.h>
47,13 → 47,13
* @param str NULL terminated string.
*
* @return Number of characters in str.
*
*/
size_t strlen(const char *str)
{
int i;
for (i = 0; str[i]; i++)
;
for (i = 0; str[i]; i++);
return i;
}
80,8 → 80,10
}
if (*src == *dst)
return 0;
if (!*src)
return -1;
return 1;
}
 
107,13 → 109,17
for (i = 0; (*src) && (*dst) && (i < len); src++, dst++, i++) {
if (*src < *dst)
return -1;
if (*src > *dst)
return 1;
}
if (i == len || *src == *dst)
return 0;
if (!*src)
return -1;
return 1;
}
 
125,36 → 131,38
* If 'src' is shorter than 'len', '\0' is inserted behind the
* last copied character.
*
* @param src Source string.
* @param src Source string.
* @param dest Destination buffer.
* @param len Size of destination buffer.
* @param len Size of destination buffer.
*
*/
void strncpy(char *dest, const char *src, size_t len)
{
unsigned int i;
 
for (i = 0; i < len; i++) {
if (!(dest[i] = src[i]))
return;
}
 
dest[i - 1] = '\0';
}
 
/** Find first occurence of character in string.
*
* @param s String to search.
* @param i Character to look for.
* @param s String to search.
* @param i Character to look for.
*
* @return Pointer to character in @a s or NULL if not found.
* @return Pointer to character in @a s or NULL if not found.
*/
extern char *strchr(const char *s, int i)
{
while (*s != '\0') {
if (*s == i) return (char *) s;
if (*s == i)
return (char *) s;
++s;
}
 
return NULL;
}