Skip to content

Commit

Permalink
thanks tyfkda
Browse files Browse the repository at this point in the history
  • Loading branch information
kaashoek committed Aug 31, 2018
1 parent 3432551 commit 308a3b8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion forktest.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define N 1000

void
printf(int fd, char *s, ...)
printf(int fd, const char *s, ...)
{
write(fd, s, strlen(s));
}
Expand Down
2 changes: 1 addition & 1 deletion printf.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ printint(int fd, int xx, int base, int sgn)

// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
printf(int fd, const char *fmt, ...)
{
char *s;
int c, i, state;
Expand Down
11 changes: 6 additions & 5 deletions ulib.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "x86.h"

char*
strcpy(char *s, char *t)
strcpy(char *s, const char *t)
{
char *os;

Expand All @@ -24,7 +24,7 @@ strcmp(const char *p, const char *q)
}

uint
strlen(char *s)
strlen(const char *s)
{
int n;

Expand Down Expand Up @@ -68,7 +68,7 @@ gets(char *buf, int max)
}

int
stat(char *n, struct stat *st)
stat(const char *n, struct stat *st)
{
int fd;
int r;
Expand All @@ -93,9 +93,10 @@ atoi(const char *s)
}

void*
memmove(void *vdst, void *vsrc, int n)
memmove(void *vdst, const void *vsrc, int n)
{
char *dst, *src;
char *dst;
const char *src;

dst = vdst;
src = vsrc;
Expand Down
24 changes: 12 additions & 12 deletions user.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,33 @@ int fork(void);
int exit(void) __attribute__((noreturn));
int wait(void);
int pipe(int*);
int write(int, void*, int);
int write(int, const void*, int);
int read(int, void*, int);
int close(int);
int kill(int);
int exec(char*, char**);
int open(char*, int);
int mknod(char*, short, short);
int unlink(char*);
int open(const char*, int);
int mknod(const char*, short, short);
int unlink(const char*);
int fstat(int fd, struct stat*);
int link(char*, char*);
int mkdir(char*);
int chdir(char*);
int link(const char*, const char*);
int mkdir(const char*);
int chdir(const char*);
int dup(int);
int getpid(void);
char* sbrk(int);
int sleep(int);
int uptime(void);

// ulib.c
int stat(char*, struct stat*);
char* strcpy(char*, char*);
void *memmove(void*, void*, int);
int stat(const char*, struct stat*);
char* strcpy(char*, const char*);
void *memmove(void*, const void*, int);
char* strchr(const char*, char c);
int strcmp(const char*, const char*);
void printf(int, char*, ...);
void printf(int, const char*, ...);
char* gets(char*, int max);
uint strlen(char*);
uint strlen(const char*);
void* memset(void*, int, uint);
void* malloc(uint);
void free(void*);
Expand Down

0 comments on commit 308a3b8

Please sign in to comment.