Date: Sun, 29 Apr 2012 11:04:31 +0000 (UTC) From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r234785 - in head: include sys/amd64/include sys/arm/include sys/i386/include sys/ia64/include sys/mips/include sys/powerpc/include sys/sparc64/include sys/sys Message-ID: <201204291104.q3TB4VbQ011280@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dim Date: Sun Apr 29 11:04:31 2012 New Revision: 234785 URL: http://svn.freebsd.org/changeset/base/234785 Log: 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 Modified: head/include/setjmp.h head/include/unistd.h head/sys/amd64/include/pcb.h head/sys/arm/include/pcb.h head/sys/i386/include/pcb.h head/sys/ia64/include/pcb.h head/sys/mips/include/pcb.h head/sys/powerpc/include/cpu.h head/sys/sparc64/include/pcb.h head/sys/sys/cdefs.h head/sys/sys/systm.h head/sys/sys/ucontext.h Modified: head/include/setjmp.h ============================================================================== --- head/include/setjmp.h Sun Apr 29 10:04:20 2012 (r234784) +++ head/include/setjmp.h Sun Apr 29 11:04:31 2012 (r234785) @@ -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 Modified: head/include/unistd.h ============================================================================== --- head/include/unistd.h Sun Apr 29 10:04:20 2012 (r234784) +++ head/include/unistd.h Sun Apr 29 11:04:31 2012 (r234785) @@ -479,7 +479,7 @@ char *getwd(char *); /* obsoleted by g 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 Modified: head/sys/amd64/include/pcb.h ============================================================================== --- head/sys/amd64/include/pcb.h Sun Apr 29 10:04:20 2012 (r234784) +++ head/sys/amd64/include/pcb.h Sun Apr 29 11:04:31 2012 (r234785) @@ -130,7 +130,7 @@ clear_pcb_flags(struct pcb *pcb, const u } void makectx(struct trapframe *, struct pcb *); -int savectx(struct pcb *); +int savectx(struct pcb *) __returns_twice; #endif Modified: head/sys/arm/include/pcb.h ============================================================================== --- head/sys/arm/include/pcb.h Sun Apr 29 10:04:20 2012 (r234784) +++ head/sys/arm/include/pcb.h Sun Apr 29 11:04:31 2012 (r234785) @@ -94,7 +94,7 @@ void makectx(struct trapframe *tf, struc #ifdef _KERNEL -void savectx(struct pcb *); +void savectx(struct pcb *) __returns_twice; #endif /* _KERNEL */ #endif /* !_MACHINE_PCB_H_ */ Modified: head/sys/i386/include/pcb.h ============================================================================== --- head/sys/i386/include/pcb.h Sun Apr 29 10:04:20 2012 (r234784) +++ head/sys/i386/include/pcb.h Sun Apr 29 11:04:31 2012 (r234785) @@ -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_ */ Modified: head/sys/ia64/include/pcb.h ============================================================================== --- head/sys/ia64/include/pcb.h Sun Apr 29 10:04:20 2012 (r234784) +++ head/sys/ia64/include/pcb.h Sun Apr 29 11:04:31 2012 (r234785) @@ -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 Modified: head/sys/mips/include/pcb.h ============================================================================== --- head/sys/mips/include/pcb.h Sun Apr 29 10:04:20 2012 (r234784) +++ head/sys/mips/include/pcb.h Sun Apr 29 11:04:31 2012 (r234785) @@ -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_ */ Modified: head/sys/powerpc/include/cpu.h ============================================================================== --- head/sys/powerpc/include/cpu.h Sun Apr 29 10:04:20 2012 (r234784) +++ head/sys/powerpc/include/cpu.h Sun Apr 29 11:04:31 2012 (r234785) @@ -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_ */ Modified: head/sys/sparc64/include/pcb.h ============================================================================== --- head/sys/sparc64/include/pcb.h Sun Apr 29 10:04:20 2012 (r234784) +++ head/sys/sparc64/include/pcb.h Sun Apr 29 11:04:31 2012 (r234785) @@ -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 */ Modified: head/sys/sys/cdefs.h ============================================================================== --- head/sys/sys/cdefs.h Sun Apr 29 10:04:20 2012 (r234784) +++ head/sys/sys/cdefs.h Sun Apr 29 11:04:31 2012 (r234785) @@ -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 Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Sun Apr 29 10:04:20 2012 (r234784) +++ head/sys/sys/systm.h Sun Apr 29 11:04:31 2012 (r234785) @@ -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); Modified: head/sys/sys/ucontext.h ============================================================================== --- head/sys/sys/ucontext.h Sun Apr 29 10:04:20 2012 (r234784) +++ head/sys/sys/ucontext.h Sun Apr 29 11:04:31 2012 (r234785) @@ -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, ...);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204291104.q3TB4VbQ011280>