Date: Sun, 28 Aug 2016 03:50:04 +0300 From: Andrey Chernov <ache@freebsd.org> To: Konstantin Belousov <kib@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r304928 - in head/lib/libc: amd64/sys i386/sys sys Message-ID: <da2fc788-7d07-4f04-b237-6fd34e99e2b7@freebsd.org> In-Reply-To: <9bcf10db-de3f-33ce-e418-03ce3283ac90@freebsd.org> References: <201608272303.u7RN3N0D078505@repo.freebsd.org> <9bcf10db-de3f-33ce-e418-03ce3283ac90@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 28.08.2016 3:38, Andrey Chernov wrote: > On 28.08.2016 2:03, Konstantin Belousov wrote: >> Since ptrace(2) syscall can return -1 for non-error situations, libc >> wrappers set errno to 0 before performing the syscall, as the service >> to the caller. > > Both C99 and POSIX directly prohibits any standard function to set errno > to 0. ptrace() should either choose other errno to indicate non-error > situation or change return -1 to something else. > ...and don't touch errno. POSIX: "No function in this volume of POSIX.1-2008 shall set errno to zero." > On both i386 and amd64, the errno symbol was directly > referenced, which only works correctly in single-threaded process. POSIX: "For each thread of a process, the value of errno shall not be affected by function calls or assignments to errno by other threads."
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?da2fc788-7d07-4f04-b237-6fd34e99e2b7>