comparison pwm.h @ 19:5c6155c8e9b6

Handle signals Handled signals are generally blocked and only unblocked when doing blocking I/O, i.e. either when reading commands or printing results. A (possibly queued) signal will then interrupt I/O and can be dealt with in the main loop.
author Guido Berhoerster <guido+pwm@berhoerster.name>
date Fri, 01 Sep 2017 22:33:41 +0200
parents 1e39a251cbe9
children efef93e54c5f
comparison
equal deleted inserted replaced
18:1e39a251cbe9 19:5c6155c8e9b6
29 29
30 #ifndef PWM_LINE_MAX 30 #ifndef PWM_LINE_MAX
31 #define PWM_LINE_MAX 16384 31 #define PWM_LINE_MAX 16384
32 #endif /* !PWM_LINE_MAX */ 32 #endif /* !PWM_LINE_MAX */
33 33
34 #ifndef PWM_HISTORY_ENTRIES_MAX
35 #define PWM_HISTORY_ENTRIES_MAX 1024
36 #endif /* !PWM_HISTORY_MAX */
37
38 #ifndef PWM_HISTORY_LINES_MAX
39 #define PWM_HISTORY_LINES_MAX 256
40 #endif /* !PWM_HISTORY_LINES_MAX */
41
42 #ifndef PWM_HISTORY_MAX
43 #define PWM_HISTORY_MAX (PWM_HISTORY_LINES_MAX * PWM_LINE_MAX)
44 #endif /* !PWM_HISTORY_MAX */
45
34 struct pwm_ctx { 46 struct pwm_ctx {
35 const char *prev_cmd; 47 const char *prev_cmd;
36 char *errmsg; 48 char *errmsg;
37 char *filename; 49 char *filename;
38 struct pws3_file *file; 50 struct pws3_file *file;
41 unsigned int next_id; 53 unsigned int next_id;
42 char password[PWS3_MAX_PASSWORD_LEN + 1]; 54 char password[PWS3_MAX_PASSWORD_LEN + 1];
43 }; 55 };
44 56
45 void pwm_err(struct pwm_ctx *, char *, ...); 57 void pwm_err(struct pwm_ctx *, char *, ...);
58 void pwm_block_signals(void);
59 void pwm_unblock_signals(void);
46 int pwm_read_password(struct pwm_ctx *, int); 60 int pwm_read_password(struct pwm_ctx *, int);
47 61
48 #endif /* PWM_H */ 62 #endif /* PWM_H */