Add a convenience macro for the returns_twice attribute, and apply it to

the prototypes of the appropriate functions (getcontext, savectx,
setjmp, sigsetjmp and vfork).

MFC after:	2 weeks
This commit is contained in:
Dimitry Andric 2012-04-29 11:04:31 +00:00
parent 3d388f0798
commit 460378bf13
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=234785
12 changed files with 20 additions and 14 deletions

View file

@ -46,16 +46,16 @@
__BEGIN_DECLS
#if __BSD_VISIBLE || __XSI_VISIBLE >= 600
void _longjmp(jmp_buf, int) __dead2;
int _setjmp(jmp_buf);
int _setjmp(jmp_buf) __returns_twice;
#endif
void longjmp(jmp_buf, int) __dead2;
#if __BSD_VISIBLE
void longjmperror(void);
#endif
int setjmp(jmp_buf);
int setjmp(jmp_buf) __returns_twice;
#if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE
void siglongjmp(sigjmp_buf, int) __dead2;
int sigsetjmp(sigjmp_buf, int);
int sigsetjmp(sigjmp_buf, int) __returns_twice;
#endif
__END_DECLS

View file

@ -479,7 +479,7 @@ char *getwd(char *); /* obsoleted by getcwd() */
useconds_t
ualarm(useconds_t, useconds_t);
int usleep(useconds_t);
pid_t vfork(void);
pid_t vfork(void) __returns_twice;
#endif
#if __BSD_VISIBLE

View file

@ -130,7 +130,7 @@ clear_pcb_flags(struct pcb *pcb, const u_int flags)
}
void makectx(struct trapframe *, struct pcb *);
int savectx(struct pcb *);
int savectx(struct pcb *) __returns_twice;
#endif

View file

@ -94,7 +94,7 @@ void makectx(struct trapframe *tf, struct pcb *pcb);
#ifdef _KERNEL
void savectx(struct pcb *);
void savectx(struct pcb *) __returns_twice;
#endif /* _KERNEL */
#endif /* !_MACHINE_PCB_H_ */

View file

@ -84,7 +84,7 @@ struct pcb {
struct trapframe;
void makectx(struct trapframe *, struct pcb *);
void savectx(struct pcb *);
void savectx(struct pcb *) __returns_twice;
#endif
#endif /* _I386_PCB_H_ */

View file

@ -65,10 +65,10 @@ struct trapframe;
void makectx(struct trapframe *, struct pcb *);
void restorectx(struct pcb *) __dead2;
int swapctx(struct pcb *old, struct pcb *new);
int swapctx(struct pcb *old, struct pcb *new) __returns_twice;
void ia32_restorectx(struct pcb *);
void ia32_savectx(struct pcb *);
void ia32_savectx(struct pcb *) __returns_twice;
#endif

View file

@ -78,7 +78,7 @@ struct pcb
extern struct pcb *curpcb; /* the current running pcb */
void makectx(struct trapframe *, struct pcb *);
int savectx(struct pcb *);
int savectx(struct pcb *) __returns_twice;
#endif
#endif /* !_MACHINE_PCB_H_ */

View file

@ -99,6 +99,6 @@ void fork_trampoline(void);
void swi_vm(void *);
/* XXX the following should not be here. */
void savectx(struct pcb *);
void savectx(struct pcb *) __returns_twice;
#endif /* _MACHINE_CPU_H_ */

View file

@ -55,7 +55,7 @@ struct pcb {
#ifdef _KERNEL
void makectx(struct trapframe *tf, struct pcb *pcb);
int savectx(struct pcb *pcb);
int savectx(struct pcb *pcb) __returns_twice;
#endif
#endif /* !LOCORE */

View file

@ -293,6 +293,12 @@
#define __nonnull(x)
#endif
#if __GNUC_PREREQ__(4, 1)
#define __returns_twice __attribute__((__returns_twice__))
#else
#define __returns_twice
#endif
/* XXX: should use `#if __STDC_VERSION__ < 199901'. */
#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
#define __func__ NULL

View file

@ -153,7 +153,7 @@ struct uio;
struct _jmp_buf;
struct trapframe;
int setjmp(struct _jmp_buf *);
int setjmp(struct _jmp_buf *) __returns_twice;
void longjmp(struct _jmp_buf *, int) __dead2;
int dumpstatus(vm_offset_t addr, off_t count);
int nullop(void);

View file

@ -71,7 +71,7 @@ struct ucontext4 {
__BEGIN_DECLS
int getcontext(ucontext_t *);
int getcontext(ucontext_t *) __returns_twice;
ucontext_t *getcontextx(void);
int setcontext(const ucontext_t *);
void makecontext(ucontext_t *, void (*)(void), int, ...);