Print this page
OS-4470 lxbrand unblocking signals in new threads must be atomic


 137 /*
 138  * normally we never want to write to stderr or stdout because it's unsafe
 139  * to make assumptions about the underlying file descriptors.  to protect
 140  * against writes to these file descriptors we go ahead and close them
 141  * our brand process initalization code.  but there are still occasions
 142  * where we are willing to make assumptions about our file descriptors
 143  * and write to them.  at thes times we should use one lx_msg() or
 144  * lx_msg_error()
 145  */
 146 extern void lx_msg(char *, ...);
 147 extern void lx_err(char *, ...);
 148 extern void lx_err_fatal(char *, ...);
 149 extern void lx_unsupported(char *, ...);
 150 
 151 struct ucontext;
 152 
 153 extern ucontext_t *lx_syscall_regs(void);
 154 extern uintptr_t lx_find_brand_sp(void);
 155 extern const ucontext_t *lx_find_brand_uc(void);
 156 


 157 extern char *lx_fd_to_path(int fd, char *buf, int buf_size);
 158 extern int lx_lpid_to_spair(pid_t, pid_t *, lwpid_t *);
 159 extern int lx_lpid_to_spid(pid_t, pid_t *);
 160 
 161 extern void lx_ptrace_init();
 162 extern int lx_ptrace_wait(siginfo_t *);
 163 extern void lx_ptrace_fork(void);
 164 extern void lx_ptrace_stop_if_option(int, boolean_t, ulong_t msg, ucontext_t *);
 165 extern void lx_ptrace_clone_begin(int, boolean_t);
 166 
 167 extern int lx_check_alloca(size_t);
 168 #define SAFE_ALLOCA(sz) (lx_check_alloca(sz) ? alloca(sz) : NULL)
 169 
 170 extern int ltos_at_flag(int lflag, int allow, boolean_t enforce);
 171 
 172 extern void lx_init_tsd(lx_tsd_t *);
 173 extern int lx_alloc_stack(void **, size_t *);
 174 extern void lx_install_stack(void *, size_t, lx_tsd_t *);
 175 extern void lx_free_stack(void);
 176 extern void lx_free_other_stacks(void);




 137 /*
 138  * normally we never want to write to stderr or stdout because it's unsafe
 139  * to make assumptions about the underlying file descriptors.  to protect
 140  * against writes to these file descriptors we go ahead and close them
 141  * our brand process initalization code.  but there are still occasions
 142  * where we are willing to make assumptions about our file descriptors
 143  * and write to them.  at thes times we should use one lx_msg() or
 144  * lx_msg_error()
 145  */
 146 extern void lx_msg(char *, ...);
 147 extern void lx_err(char *, ...);
 148 extern void lx_err_fatal(char *, ...);
 149 extern void lx_unsupported(char *, ...);
 150 
 151 struct ucontext;
 152 
 153 extern ucontext_t *lx_syscall_regs(void);
 154 extern uintptr_t lx_find_brand_sp(void);
 155 extern const ucontext_t *lx_find_brand_uc(void);
 156 
 157 extern void lx_jump_to_linux(ucontext_t *) __NORETURN;
 158 
 159 extern char *lx_fd_to_path(int fd, char *buf, int buf_size);
 160 extern int lx_lpid_to_spair(pid_t, pid_t *, lwpid_t *);
 161 extern int lx_lpid_to_spid(pid_t, pid_t *);
 162 
 163 extern void lx_ptrace_init();
 164 extern int lx_ptrace_wait(siginfo_t *);
 165 extern void lx_ptrace_fork(void);
 166 extern void lx_ptrace_stop_if_option(int, boolean_t, ulong_t msg, ucontext_t *);
 167 extern void lx_ptrace_clone_begin(int, boolean_t);
 168 
 169 extern int lx_check_alloca(size_t);
 170 #define SAFE_ALLOCA(sz) (lx_check_alloca(sz) ? alloca(sz) : NULL)
 171 
 172 extern int ltos_at_flag(int lflag, int allow, boolean_t enforce);
 173 
 174 extern void lx_init_tsd(lx_tsd_t *);
 175 extern int lx_alloc_stack(void **, size_t *);
 176 extern void lx_install_stack(void *, size_t, lx_tsd_t *);
 177 extern void lx_free_stack(void);
 178 extern void lx_free_other_stacks(void);