diff options
Diffstat (limited to 'src/os/unix/freebsd/ngx_rfork_thread.h')
-rw-r--r-- | src/os/unix/freebsd/ngx_rfork_thread.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/os/unix/freebsd/ngx_rfork_thread.h b/src/os/unix/freebsd/ngx_rfork_thread.h new file mode 100644 index 000000000..bd500e1a4 --- /dev/null +++ b/src/os/unix/freebsd/ngx_rfork_thread.h @@ -0,0 +1,24 @@ +#ifndef _NGX_OS_THREAD_H_INCLUDED_ +#define _NGX_OS_THREAD_H_INCLUDED_ + + +typedef int ngx_os_tid_t; +typedef int ngx_tid_t; + + +extern char *ngx_stacks_start; +extern char *ngx_stacks_end; +extern size_t ngx_stack_size; + + +static inline ngx_tid_t ngx_gettid() +{ + char *sp; + + __asm__ ("mov %%esp,%0" : "=r" (sp)); + return (sp > ngx_stacks_end) ? 0: + (sp - ngx_stacks_start) / ngx_stack_size + 1; +} + + +#endif /* _NGX_OS_THREAD_H_INCLUDED_ */ |