where to find exit(int) function implementation

Vitalio D v.dol_s at hotmail.com
Wed Jan 10 15:38:12 UTC 2018

Indeed I'm interested in _exit syscall.

Thanks for response Yuri, but i'm a newbie and don't
see any PSEUDO marking in unistd.h at least.
What i see in unisrd.h is 

/* 1003.1-1990 */
void     _exit(int) __dead2;

__BEGIN_DECLS being defined in sys/sys/cdefs.h as exten "C" {
but no PSEUDO. Am i missing something?

From: Yuri Pankov <yuripv at gmx.com>
Sent: Wednesday, January 10, 2018 14:49
To: Matthias Apitz; Vitalio D
Cc: freebsd-questions at freebsd.org; owner-freebsd-questions at freebsd.org
Subject: Re: where to find exit(int) function implementation

On Wed, Jan 10, 2018 at 02:16:16PM +0100, Matthias Apitz:
> Am 10.01.2018 14:01, schrieb Vitalio D:
>> Hello,
>> How and where void _exit(int) is implemented? I've started
>> with exit(int) defined in exit.c un stdlib, but I've got stuck at
>> unistd.h where void _exit(int) __dead2;
>> After that I couldn't find anything by running
>> find /usr/src -name "*.c" -exec grep " _exit(int" /dev/null {} \;
> $ find /usr/src -name *.c | grep exit
> /usr/src/sys/kern/kern_exit.c
> /usr/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_onexit.c
> /usr/src/lib/libc/arm/aeabi/aeabi_atexit.c
> /usr/src/lib/libc/stdlib/cxa_thread_atexit.c
> /usr/src/lib/libc/stdlib/cxa_thread_atexit_impl.c
> /usr/src/lib/libc/stdlib/exit.c
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The original question was about _exit(2) syscall, not exit(3).

WRT the _exit(2), it's marked as "PSEUDO" and relevant PSEUDO macro is
defined in lib/libc/<arch>/SYS.h (if I'm reading it all correctly).

More information about the freebsd-questions mailing list