1 #include <u.h> 2 #include <libc.h> 3 4 char* strdup(char * s)5 strdup(char *s) 6 { 7 char *ns; 8 9 ns = malloc(strlen(s) + 1); 10 if(ns == 0) 11 return 0; 12 setmalloctag(ns, getcallerpc(&s)); 13 14 return strcpy(ns, s); 15 } 16