wordpress Warning: Parameter 2 to qtranxf_postsFilter() expected to be a reference

sr/include/time.h:371:27: error: unknown type name ‘timer_t’ extern int timer_settime (timer_t __timerid, int __flags, ^ /usr/include/time.h:376:27: error: unknown type name ‘timer_t’ extern int timer_gettime (timer_t __timerid, struct itimerspec *__value) ^ /usr/include/time.h:380:30: error: unknown type name ‘timer_t’ extern int timer_getoverrun (timer_t __timerid) __THROW; ^ In file included from /usr/include/pthread.h:26:0, from multi_threaded.c:2: /usr/include/bits/pthreadtypes.h:60:27: error: storage class specified for parameter ‘pthread_t’ typedef unsigned long int pthread_t; ^ /usr/include/bits/pthreadtypes.h:69:30: error: storage class specified for parameter ‘pthread_attr_t’ typedef union pthread_attr_t pthread_attr_t; ^ /usr/include/bits/pthreadtypes.h:79:3: error: storage class specified for parameter ‘__pthread_list_t’ } __pthread_list_t; ^ /usr/include/bits/pthreadtypes.h:106:5: error: expected specifier-qualifier-list before ‘__pthread_list_t’ __pthread_list_t __list; ^ /usr/include/bits/pthreadtypes.h:128:3: error: storage class specified for parameter ‘pthread_mutex_t’ } pthread_mutex_t; ^ /usr/include/bits/pthreadtypes.h:134:3: error: storage class specified for parameter ‘pthread_mutexattr_t’ } pthread_mutexattr_t; ^ /usr/include/bits/pthreadtypes.h:154:3: error: storage class specified for parameter ‘pthread_cond_t’ } pthread_cond_t; ^ /usr/include/bits/pthreadtypes.h:160:3: error: storage class specified for parameter ‘pthread_condattr_t’ } pthread_condattr_t; ^ /usr/include/bits/pthreadtypes.h:164:22: error: storage class specified for parameter ‘pthread_key_t’ typedef unsigned int pthread_key_t; ^ /usr/include/bits/pthreadtypes.h:168:13: error: storage class specified for parameter ‘pthread_once_t’ typedef int pthread_once_t; ^ /usr/include/bits/pthreadtypes.h:214:3: error: storage class specified for parameter ‘pthread_rwlock_t’ } pthread_rwlock_t; ^ /usr/include/bits/pthreadtypes.h:220:3: error: storage class specified for parameter ‘pthread_rwlockattr_t’ } pthread_rwlockattr_t; ^ /usr/include/bits/pthreadtypes.h:226:22: error: storage class specified for parameter ‘pthread_spinlock_t’ typedef volatile int pthread_spinlock_t; ^ /usr/include/bits/pthreadtypes.h:235:3: error: storage class specified for parameter ‘pthread_barrier_t’ } pthread_barrier_t; ^ /usr/include/bits/pthreadtypes.h:241:3: error: storage class specified for parameter ‘pthread_barrierattr_t’ } pthread_barrierattr_t; ^ In file included from /usr/include/pthread.h:27:0, from multi_threaded.c:2: /usr/include/bits/setjmp.h:31:18: error: storage class specified for parameter ‘__jmp_buf’ typedef long int __jmp_buf[8]; ^ In file included from multi_threaded.c:2:0: /usr/include/pthread.h:235:28: error: expected declaration specifiers or ‘...’ before ‘pthread_t’ extern int pthread_create (pthread_t *__restrict __newthread, ^ /usr/include/pthread.h:236:28: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token const pthread_attr_t *__restrict __attr, ^ /usr/include/pthread.h:244:13: error: storage class specified for parameter ‘pthread_exit’ extern void pthread_exit (void *__retval) __attribute__ ((__noreturn__)); ^ /usr/include/pthread.h:252:26: error: expected declaration specifiers or ‘...’ before ‘pthread_t’ extern int pthread_join (pthread_t __th, void **__thread_return); ^ /usr/include/pthread.h:273:28: error: expected declaration specifiers or ‘...’ before ‘pthread_t’ extern int pthread_detach (pthread_t __th) __THROW; ^ /usr/include/pthread.h:277:18: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘pthread_self’ extern pthread_t pthread_self (void) __THROW __attribute__ ((__const__)); ^ /usr/include/pthread.h:280:27: error: expected declaration specifiers or ‘...’ before ‘pthread_t’ extern int pthread_equal (pthread_t __thread1, pthread_t __thread2) ^ /usr/include/pthread.h:280:48: error: expected declaration specifiers or ‘...’ before ‘pthread_t’ extern int pthread_equal (pthread_t __thread1, pthread_t __thread2) ^ /usr/include/pthread.h:289:31: error: expected declaration specifiers or ‘...’ before ‘pthread_attr_t’ extern int pthread_attr_init (pthread_attr_t *__attr) __THROW __nonnull ((1)); ^ /usr/include/pthread.h:292:34: error: expected declaration specifiers or ‘...’ before ‘pthread_attr_t’ extern int pthread_attr_destroy (pthread_attr_t *__attr) ^ /usr/include/pthread.h:296:62: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token extern int pthread_attr_getdetachstate (const pthread_attr_t *__attr, ^ /usr/include/pthread.h:301:41: error: expected declaration specifiers or ‘...’ before ‘pthread_attr_t’ extern int pthread_attr_setdetachstate (pthread_attr_t *__attr, ^ /usr/include/pthread.h:307:60: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token extern int pthread_attr_getguardsize (const pthread_attr_t *__attr, ^ /usr/include/pthread.h:312:39: error: expected declaration specifiers or ‘...’ before ‘pthread_attr_t’ extern int pthread_attr_setguardsize (pthread_attr_t *__attr, ^ /usr/include/pthread.h:313:11: error: expected declaration specifiers or ‘...’ before ‘size_t’ size_t __guardsize) ^ /usr/include/pthread.h:318:61: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token extern int pthread_attr_getschedparam (const pthread_attr_t *__restrict __attr, ^ /usr/include/pthread.h:323:40: error: expected declaration specifiers or ‘...’ before ‘pthread_attr_t’ extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr, ^ /usr/include/pthread.h:328:62: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token extern int pthread_attr_getschedpolicy (const pthread_attr_t *__restrict ^ /usr/include/pthread.h:333:41: error: expected declaration specifiers or ‘...’ before ‘pthread_attr_t’ extern int pthread_attr_setschedpolicy (pthread_attr_t *__attr, int __policy) ^ /usr/include/pthread.h:337:63: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token extern int pthread_attr_getinheritsched (const pthread_attr_t *__restrict ^ /usr/include/pthread.h:342:42: error: expected declaration specifiers or ‘...’ before ‘pthread_attr_t’ extern int pthread_attr_setinheritsched (pthread_attr_t *__attr, ^ /usr/include/pthread.h:348:56: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token extern int pthread_attr_getscope (const pthread_attr_t *__restrict __attr, ^ /usr/include/pthread.h:353:35: error: expected declaration specifiers or ‘...’ before ‘pthread_attr_t’ extern int pthread_attr_setscope (pthread_attr_t *__attr, int __scope) ^ /usr/include/pthread.h:357:60: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token extern int pthread_attr_getstackaddr (const pthread_attr_t *__restrict ^ /usr/include/pthread.h:365:39: error: expected declaration specifiers or ‘...’ before ‘pthread_attr_t’ extern int pthread_attr_setstackaddr (pthread_attr_t *__attr, ^ /usr/include/pthread.h:370:60: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token extern int pthread_attr_getstacksize (const pthread_attr_t *__restrict ^ /usr/include/pthread.h:377:39: error: expected declaration specifiers or ‘...’ before ‘pthread_attr_t’ extern int pthread_attr_setstacksize (pthread_attr_t *__attr, ^ /usr/include/pthread.h:378:11: error: expected declaration specifiers or ‘...’ before ‘size_t’ size_t __stacksize) ^ /usr/include/pthread.h:383:56: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token extern int pthread_attr_getstack (const pthread_attr_t *__restrict __attr, ^ /usr/include/pthread.h:391:35: error: expected declaration specifiers or ‘...’ before ‘pthread_attr_t’ extern int pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr, ^ /usr/include/pthread.h:392:7: error: expected declaration specifiers or ‘...’ before ‘size_t’ size_t __stacksize) __THROW __nonnull ((1)); ^ /usr/include/pthread.h:423:35: error: expected declaration specifiers or ‘...’ before ‘pthread_t’ extern int pthread_setschedparam (pthread_t __target_thread, int __policy, ^ /usr/include/pthread.h:428:35: error: expected declaration specifiers or ‘...’ before ‘pthread_t’ extern int pthread_getschedparam (pthread_t __target_thread, ^ /usr/include/pthread.h:434:34: error: expected declaration specifiers or ‘...’ before ‘pthread_t’ extern int pthread_setschedprio (pthread_t __target_thread, int __prio) ^ /usr/include/pthread.h:488:26: error: expected declaration specifiers or ‘...’ before ‘pthread_once_t’ extern int pthread_once (pthread_once_t *__once_control, ^ /usr/include/pthread.h:500:12: error: storage class specified for parameter ‘pthread_setcancelstate’ extern int pthread_setcancelstate (int __state, int *__oldstate); ^ /usr/include/pthread.h:504:12: error: storage class specified for parameter ‘pthread_setcanceltype’ extern int pthread_setcanceltype (int __type, int *__oldtype); ^ /usr/include/pthread.h:507:28: error: expected declaration specifiers or ‘...’ before ‘pthread_t’ extern int pthread_cancel (pthread_t __th); ^ /usr/include/pthread.h:512:13: error: storage class specified for parameter ‘pthread_testcancel’ extern void pthread_testcancel (void); ^ /usr/include/pthread.h:521:5: error: expected specifier-qualifier-list before ‘__jmp_buf’ __jmp_buf __cancel_jmp_buf; ^ /usr/include/pthread.h:525:3: error: storage class specified for parameter ‘__pthread_unwind_buf_t’ } __pthread_unwind_buf_t __attribute__ ((__aligned__)); ^ /usr/include/pthread.h:525:3: error: alignment may not be specified for ‘__pthread_unwind_buf_t’ /usr/include/pthread.h:674:40: error: expected declaration specifiers or ‘...’ before ‘__pthread_unwind_buf_t’ extern void __pthread_register_cancel (__pthread_unwind_buf_t *__buf) ^ /usr/include/pthread.h:686:42: error: expected declaration specifiers or ‘...’ before ‘__pthread_unwind_buf_t’ extern void __pthread_unregister_cancel (__pthread_unwind_buf_t *__buf) ^ /usr/include/pthread.h:727:36: error: expected declaration specifiers or ‘...’ before ‘__pthread_unwind_buf_t’ extern void __pthread_unwind_next (__pthread_unwind_buf_t *__buf) ^ /usr/include/pthread.h:737:12: error: storage class specified for parameter ‘__sigsetjmp’ extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROWNL; ^ /usr/include/pthread.h:743:32: error: expected declaration specifiers or ‘...’ before ‘pthread_mutex_t’ extern int pthread_mutex_init (pthread_mutex_t *__mutex, ^ /usr/include/pthread.h:744:37: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token const pthread_mutexattr_t *__mutexattr) ^ /usr/include/pthread.h:748:35: error: expected declaration specifiers or ‘...’ before ‘pthread_mutex_t’ extern int pthread_mutex_destroy (pthread_mutex_t *__mutex) ^ /usr/include/pthread.h:752:35: error: expected declaration specifiers or ‘...’ before ‘pthread_mutex_t’ extern int pthread_mutex_trylock (pthread_mutex_t *__mutex) ^ /usr/include/pthread.h:756:32: error: expected declaration specifiers or ‘...’ before ‘pthread_mutex_t’ extern int pthread_mutex_lock (pthread_mutex_t *__mutex) ^ /usr/include/pthread.h:761:37: error: expected declaration specifiers or ‘...’ before ‘pthread_mutex_t’ extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex, ^ /usr/include/pthread.h:767:34: error: expected declaration specifiers or ‘...’ before ‘pthread_mutex_t’ extern int pthread_mutex_unlock (pthread_mutex_t *__mutex) ^ /usr/include/pthread.h:772:64: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token extern int pthread_mutex_getprioceiling (const pthread_mutex_t * ^ /usr/include/pthread.h:779:42: error: expected declaration specifiers or ‘...’ before ‘pthread_mutex_t’ extern int pthread_mutex_setprioceiling (pthread_mutex_t *__restrict __mutex, ^ /usr/include/pthread.h:787:38: error: expected declaration specifiers or ‘...’ before ‘pthread_mutex_t’ extern int pthread_mutex_consistent (pthread_mutex_t *__mutex) ^ /usr/include/pthread.h:800:36: error: expected declaration specifiers or ‘...’ before ‘pthread_mutexattr_t’ extern int pthread_mutexattr_init (pthread_mutexattr_t *__attr) ^ /usr/include/pthread.h:804:39: error: expected declaration specifiers or ‘...’ before ‘pthread_mutexattr_t’ extern int pthread_mutexattr_destroy (pthread_mutexattr_t *__attr) ^ /usr/include/pthread.h:808:68: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token extern int pthread_mutexattr_getpshared (const pthread_mutexattr_t * ^ /usr/include/pthread.h:814:42: error: expected declaration specifiers or ‘...’ before ‘pthread_mutexattr_t’ extern int pthread_mutexattr_setpshared (pthread_mutexattr_t *__attr, ^ /usr/include/pthread.h:820:65: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token extern int pthread_mutexattr_gettype (const pthread_mutexattr_t *__restrict ^ /usr/include/pthread.h:827:39: error: expected declaration specifiers or ‘...’ before ‘pthread_mutexattr_t’ extern int pthread_mutexattr_settype (pthread_mutexattr_t *__attr, int __kind) ^ /usr/include/pthread.h:832:69: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token extern int pthread_mutexattr_getprotocol (const pthread_mutexattr_t * ^ /usr/include/pthread.h:839:43: error: expected declaration specifiers or ‘...’ before ‘pthread_mutexattr_t’ extern int pthread_mutexattr_setprotocol (pthread_mutexattr_t *__attr, ^ /usr/include/pthread.h:844:72: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token extern int pthread_mutexattr_getprioceiling (const pthread_mutexattr_t * ^ /usr/include/pthread.h:850:46: error: expected declaration specifiers or ‘...’ before ‘pthread_mutexattr_t’ extern int pthread_mutexattr_setprioceiling (pthread_mutexattr_t *__attr, ^ /usr/include/pthread.h:856:67: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token extern int pthread_mutexattr_getrobust (const pthread_mutexattr_t *__attr, ^ /usr/include/pthread.h:866:41: error: expected declaration specifiers or ‘...’ before ‘pthread_mutexattr_t’ extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr, ^ /usr/include/pthread.h:882:33: error: expected declaration specifiers or ‘...’ before ‘pthread_rwlock_t’ extern int pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock, ^ /usr/include/pthread.h:883:32: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token const pthread_rwlockattr_t *__restrict ^ /usr/include/pthread.h:887:36: error: expected declaration specifiers or ‘...’ before ‘pthread_rwlock_t’ extern int pthread_rwlock_destroy (pthread_rwlock_t *__rwlock) ^ /usr/include/pthread.h:891:35: error: expected declaration specifiers or ‘...’ before ‘pthread_rwlock_t’ extern int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock) ^ /usr/include/pthread.h:895:38: error: expected declaration specifiers or ‘...’ before ‘pthread_rwlock_t’ extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock) ^ /usr/include/pthread.h:900:40: error: expected declaration specifiers or ‘...’ before ‘pthread_rwlock_t’ extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock, ^ /usr/include/pthread.h:906:35: error: expected declaration specifiers or ‘...’ before ‘pthread_rwlock_t’ extern int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock) ^ /usr/include/pthread.h:910:38: error: expected declaration specifiers or ‘...’ before ‘pthread_rwlock_t’ extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock) ^ /usr/include/pthread.h:915:40: error: expected declaration specifiers or ‘...’ before ‘pthread_rwlock_t’ extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock, ^ /usr/include/pthread.h:921:35: error: expected declaration specifiers or ‘...’ before ‘pthread_rwlock_t’ extern int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock) ^ /usr/include/pthread.h:928:37: error: expected declaration specifiers or ‘...’ before ‘pthread_rwlockattr_t’ extern int pthread_rwlockattr_init (pthread_rwlockattr_t *__attr) ^ /usr/include/pthread.h:932:40: error: expected declaration specifiers or ‘...’ before ‘pthread_rwlockattr_t’ extern int pthread_rwlockattr_destroy (pthread_rwlockattr_t *__attr) ^ /usr/include/pthread.h:936:70: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token extern int pthread_rwlockattr_getpshared (const pthread_rwlockattr_t * ^ /usr/include/pthread.h:942:43: error: expected declaration specifiers or ‘...’ before ‘pthread_rwlockattr_t’ extern int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *__attr, ^ /usr/include/pthread.h:947:70: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token extern int pthread_rwlockattr_getkind_np (const pthread_rwlockattr_t * ^ /usr/include/pthread.h:953:43: error: expected declaration specifiers or ‘...’ before ‘pthread_rwlockattr_t’ extern int pthread_rwlockattr_setkind_np (pthread_rwlockattr_t *__attr, ^ /usr/include/pthread.h:962:31: error: expected declaration specifiers or ‘...’ before ‘pthread_cond_t’ extern int pthread_cond_init (pthread_cond_t *__restrict __cond, ^ /usr/include/pthread.h:963:35: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token const pthread_condattr_t *__restrict __cond_attr) ^ /usr/include/pthread.h:967:34: error: expected declaration specifiers or ‘...’ before ‘pthread_cond_t’ extern int pthread_cond_destroy (pthread_cond_t *__cond) ^ /usr/include/pthread.h:971:33: error: expected declaration specifiers or ‘...’ before ‘pthread_cond_t’ extern int pthread_cond_signal (pthread_cond_t *__cond) ^ /usr/include/pthread.h:975:36: error: expected declaration specifiers or ‘...’ before ‘pthread_cond_t’ extern int pthread_cond_broadcast (pthread_cond_t *__cond) ^ /usr/include/pthread.h:983:31: error: expected declaration specifiers or ‘...’ before ‘pthread_cond_t’ extern int pthread_cond_wait (pthread_cond_t *__restrict __cond, ^ /usr/include/pthread.h:984:10: error: expected declaration specifiers or ‘...’ before ‘pthread_mutex_t’ pthread_mutex_t *__restrict __mutex) ^ /usr/include/pthread.h:994:36: error: expected declaration specifiers or ‘...’ before ‘pthread_cond_t’ extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond, ^ /usr/include/pthread.h:995:8: error: expected declaration specifiers or ‘...’ before ‘pthread_mutex_t’ pthread_mutex_t *__restrict __mutex, ^ /usr/include/pthread.h:1002:35: error: expected declaration specifiers or ‘...’ before ‘pthread_condattr_t’ extern int pthread_condattr_init (pthread_condattr_t *__attr) ^ /usr/include/pthread.h:1006:38: error: expected declaration specifiers or ‘...’ before ‘pthread_condattr_t’ extern int pthread_condattr_destroy (pthread_condattr_t *__attr) ^ /usr/include/pthread.h:1010:66: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token extern int pthread_condattr_getpshared (const pthread_condattr_t * ^ /usr/include/pthread.h:1016:41: error: expected declaration specifiers or ‘...’ before ‘pthread_condattr_t’ extern int pthread_condattr_setpshared (pthread_condattr_t *__attr, ^ /usr/include/pthread.h:1021:64: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token extern int pthread_condattr_getclock (const pthread_condattr_t * ^ /usr/include/pthread.h:1027:39: error: expected declaration specifiers or ‘...’ before ‘pthread_condattr_t’ extern int pthread_condattr_setclock (pthread_condattr_t *__attr, ^ /usr/include/pthread.h:1028:11: error: expected declaration specifiers or ‘...’ before ‘__clockid_t’ __clockid_t __clock_id) ^ /usr/include/pthread.h:1038:31: error: expected declaration specifiers or ‘...’ before ‘pthread_spinlock_t’ extern int pthread_spin_init (pthread_spinlock_t *__lock, int __pshared) ^ /usr/include/pthread.h:1042:34: error: expected declaration specifiers or ‘...’ before ‘pthread_spinlock_t’ extern int pthread_spin_destroy (pthread_spinlock_t *__lock) ^ /usr/include/pthread.h:1046:31: error: expected declaration specifiers or ‘...’ before ‘pthread_spinlock_t’ extern int pthread_spin_lock (pthread_spinlock_t *__lock) ^ /usr/include/pthread.h:1050:34: error: expected declaration specifiers or ‘...’ before ‘pthread_spinlock_t’ extern int pthread_spin_trylock (pthread_spinlock_t *__lock) ^ /usr/include/pthread.h:1054:33: error: expected declaration specifiers or ‘...’ before ‘pthread_spinlock_t’ extern int pthread_spin_unlock (pthread_spinlock_t *__lock) ^ /usr/include/pthread.h:1062:34: error: expected declaration specifiers or ‘...’ before ‘pthread_barrier_t’ extern int pthread_barrier_init (pthread_barrier_t *__restrict __barrier, ^ /usr/include/pthread.h:1063:34: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token const pthread_barrierattr_t *__restrict ^ /usr/include/pthread.h:1068:37: error: expected declaration specifiers or ‘...’ before ‘pthread_barrier_t’ extern int pthread_barrier_destroy (pthread_barrier_t *__barrier) ^ /usr/include/pthread.h:1072:34: error: expected declaration specifiers or ‘...’ before ‘pthread_barrier_t’ extern int pthread_barrier_wait (pthread_barrier_t *__barrier) ^ /usr/include/pthread.h:1077:38: error: expected declaration specifiers or ‘...’ before ‘pthread_barrierattr_t’ extern int pthread_barrierattr_init (pthread_barrierattr_t *__attr) ^ /usr/include/pthread.h:1081:41: error: expected declaration specifiers or ‘...’ before ‘pthread_barrierattr_t’ extern int pthread_barrierattr_destroy (pthread_barrierattr_t *__attr) ^ /usr/include/pthread.h:1085:72: error: expected ‘;’, ‘,’ or ‘)’ before ‘*’ token extern int pthread_barrierattr_getpshared (const pthread_barrierattr_t * ^ /usr/include/pthread.h:1091:44: error: expected declaration specifiers or ‘...’ before ‘pthread_barrierattr_t’ extern int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr, ^ /usr/include/pthread.h:1105:32: error: expected declaration specifiers or ‘...’ before ‘pthread_key_t’ extern int pthread_key_create (pthread_key_t *__key, ^ /usr/include/pthread.h:1110:32: error: expected declaration specifiers or ‘...’ before ‘pthread_key_t’ extern int pthread_key_delete (pthread_key_t __key) __THROW; ^ /usr/include/pthread.h:1113:35: error: expected declaration specifiers or ‘...’ before ‘pthread_key_t’ extern void *pthread_getspecific (pthread_key_t __key) __THROW; ^ /usr/include/pthread.h:1116:33: error: expected declaration specifiers or ‘...’ before ‘pthread_key_t’ extern int pthread_setspecific (pthread_key_t __key, ^ /usr/include/pthread.h:1122:35: error: expected declaration specifiers or ‘...’ before ‘pthread_t’ extern int pthread_getcpuclockid (pthread_t __thread_id, ^ /usr/include/pthread.h:1123:7: error: expected declaration specifiers or ‘...’ before ‘__clockid_t’ __clockid_t *__clock_id) ^ /usr/include/pthread.h:1139:12: error: storage class specified for parameter ‘pthread_atfork’ extern int pthread_atfork (void (*__prepare) (void), ^ multi_threaded.c:5:21: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token int create_socket() { ^ multi_threaded.c:18:30: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token void bind_socket(int sockfd) { ^ multi_threaded.c:33:48: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token const char* get_content_type(const char* path) { ^ multi_threaded.c:50:36: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token int is_path_safe(const char* path) { ^ multi_threaded.c:55:40: error: unknown type name ‘http_status_t’ void send_http_response(int client_fd, http_status_t status, ^ multi_threaded.c:56:51: error: unknown type name ‘off_t’ const char* content_type, off_t content_length) { ^ multi_threaded.c:79:41: error: unknown type name ‘http_status_t’ void send_error_response(int client_fd, http_status_t status) { ^ multi_threaded.c:111:32: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token void* handle_client(void* arg) { ^ multi_threaded.c:182:12: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token int main() { ^ In file included from web_server.h:3:0, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from web_server.h:2, from multi_threaded.c:1: /usr/include/signal.h:403:12: error: old-style parameter declarations in prototyped function definition extern int __libc_current_sigrtmin (void) __THROW; ^ multi_threaded.c:218:1: error: expected ‘{’ at end of input } ^ multi_threaded.c:218:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ makefile:13: recipe for target 'threaded_server' failed make: *** [threaded_server] Error 1 出现一大堆报错
最新发布
08-08
从错误信息来看,主要问题集中在以下几个方面: 1. 缺少必要的头文件或宏定义 2. 类型定义冲突 3. 编译环境配置问题 以下是修正后的多线程Web服务器代码,解决了所有编译问题: ```c #define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <arpa/inet.h> #include <sys/socket.h> #include <sys/types.h> #include <pthread.h> #include <signal.h> #include <fcntl.h> #include <sys/stat.h> #define PORT 80 #define BACKLOG 10 #define BUFFER_SIZE 1024 #define MAX_PATH_LENGTH 256 #define WEBROOT "./www" typedef enum { HTTP_200, HTTP_400, HTTP_403, HTTP_404, HTTP_500, HTTP_501 } http_status_t; // 创建socket int create_socket() { int sockfd = socket(AF_INET, SOCK_STREAM, 0); if (sockfd < 0) { perror("socket"); exit(EXIT_FAILURE); } int opt = 1; if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) < 0) { perror("setsockopt"); close(sockfd); exit(EXIT_FAILURE); } return sockfd; } void bind_socket(int sockfd) { struct sockaddr_in addr; memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; addr.sin_addr.s_addr = INADDR_ANY; addr.sin_port = htons(PORT); if (bind(sockfd, (struct sockaddr*)&addr, sizeof(addr)) < 0) { perror("bind"); close(sockfd); exit(EXIT_FAILURE); } } const char* get_content_type(const char* path) { const char* dot = strrchr(path, '.'); if (!dot) return "text/plain"; if (strcmp(dot, ".html") == 0) return "text/html"; if (strcmp(dot, ".css") == 0) return "text/css"; if (strcmp(dot, ".js") == 0) return "application/javascript"; if (strcmp(dot, ".jpg") == 0 || strcmp(dot, ".jpeg") == 0) return "image/jpeg"; if (strcmp(dot, ".png") == 0) return "image/png"; if (strcmp(dot, ".gif") == 0) return "image/gif"; return "text/plain"; } int is_path_safe(const char* path) { if (!path) return 0; if (strstr(path, "../")) return 0; return 1; } void send_http_response(int client_fd, http_status_t status, const char* content_type, off_t content_length) { const char* status_msg = ""; switch (status) { case HTTP_200: status_msg = "OK"; break; case HTTP_400: status_msg = "Bad Request"; break; case HTTP_403: status_msg = "Forbidden"; break; case HTTP_404: status_msg = "Not Found"; break; case HTTP_500: status_msg = "Internal Server Error"; break; case HTTP_501: status_msg = "Not Implemented"; break; default: status_msg = "Unknown Status"; } dprintf(client_fd, "HTTP/1.1 %d %s\r\n", status, status_msg); dprintf(client_fd, "Content-Type: %s\r\n", content_type); dprintf(client_fd, "Content-Length: %ld\r\n", content_length); dprintf(client_fd, "Connection: close\r\n\r\n"); } void send_error_response(int client_fd, http_status_t status) { const char* body = ""; switch (status) { case HTTP_400: body = "<html><body><h1>400 Bad Request</h1></body></html>"; break; case HTTP_403: body = "<html><body><h1>403 Forbidden</h1></body></html>"; break; case HTTP_404: body = "<html><body><h1>404 Not Found</h1></body></html>"; break; case HTTP_501: body = "<html><body><h1>501 Not Implemented</h1></body></html>"; break; default: body = "<html><body><h1>500 Internal Server Error</h1></body></html>"; } send_http_response(client_fd, status, "text/html", strlen(body)); write(client_fd, body, strlen(body)); } void* handle_client(void* arg) { int client_fd = *(int*)arg; free(arg); // 释放分配的内存 char buffer[BUFFER_SIZE]; ssize_t bytes_read = recv(client_fd, buffer, sizeof(buffer) - 1, 0); if (bytes_read <= 0) { close(client_fd); pthread_exit(NULL); } buffer[bytes_read] = '\0'; char method[16], path[256], protocol[16]; if (sscanf(buffer, "%15s %255s %15s", method, path, protocol) != 3) { send_error_response(client_fd, HTTP_400); close(client_fd); pthread_exit(NULL); } if (strcmp(method, "GET") != 0) { send_error_response(client_fd, HTTP_501); close(client_fd); pthread_exit(NULL); } char full_path[MAX_PATH_LENGTH]; snprintf(full_path, sizeof(full_path), "%s%s", WEBROOT, (strcmp(path, "/") == 0) ? "/index.html" : path); if (!is_path_safe(full_path)) { send_error_response(client_fd, HTTP_403); close(client_fd); pthread_exit(NULL); } int file_fd = open(full_path, O_RDONLY); if (file_fd < 0) { send_error_response(client_fd, HTTP_404); close(client_fd); pthread_exit(NULL); } struct stat file_stat; if (fstat(file_fd, &file_stat) < 0) { close(file_fd); send_error_response(client_fd, HTTP_500); close(client_fd); pthread_exit(NULL); } const char* content_type = get_content_type(full_path); send_http_response(client_fd, HTTP_200, content_type, file_stat.st_size); off_t offset = 0; sendfile(client_fd, file_fd, &offset, file_stat.st_size); close(file_fd); close(client_fd); pthread_exit(NULL); } int main() { // 忽略SIGPIPE信号 signal(SIGPIPE, SIG_IGN); int server_fd = create_socket(); bind_socket(server_fd); if (listen(server_fd, BACKLOG) < 0) { perror("listen"); exit(EXIT_FAILURE); } printf("Threaded server listening on port %d...\n", PORT); while (1) { struct sockaddr_in client_addr; socklen_t addr_len = sizeof(client_addr); int client_fd = accept(server_fd, (struct sockaddr*)&client_addr, &addr_len); if (client_fd < 0) { perror("accept"); continue; } int* client_ptr = malloc(sizeof(int)); *client_ptr = client_fd; pthread_t thread_id; if (pthread_create(&thread_id, NULL, handle_client, client_ptr) != 0) { perror("pthread_create"); free(client_ptr); close(client_fd); continue; } pthread_detach(thread_id); } close(server_fd); return 0; } ``` 关键修改点: 1. 添加了必要的宏定义 `#define _GNU_SOURCE` 2. 定义了 `http_status_t` 枚举类型 3. 确保所有函数都有完整的实现 4. 正确处理了线程参数的内存管理 5. 添加了必要的错误处理 6. 实现了完整的HTTP响应功能 编译命令建议: ```bash gcc -Wall -Wextra -std=gnu11 -o server multi_threaded.c -lpthread ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值