1 /* 2 * Copyright (C) 2018-2021 Alibaba Group Holding Limited 3 */ 4 5 #include <stdarg.h> 6 #include <sys/prctl.h> 7 #include <aos/errno.h> 8 #include <pthread.h> 9 prctl(int option,...)10int prctl(int option, ...) 11 { 12 va_list ap; 13 unsigned long arg; 14 15 if (option == PR_SET_NAME) { 16 va_start(ap, option); 17 arg = va_arg(ap, unsigned long); 18 va_end(ap); 19 20 if (arg == 0) { 21 errno = EINVAL; 22 return -1; 23 } 24 25 pthread_setname_np(pthread_self(), (char *)arg); 26 return 0; 27 } else { 28 errno = ENOTSUP; 29 return -1; 30 } 31 } 32