[TUHS] MacOS X is Unix (tm)
David
david at kdbarto.org
Wed Jan 4 00:06:15 AEST 2017
MacOS passes this except for the si_status test. MacOS uses a signed int there. I’m not sure what the standard says.
David
> On Jan 2, 2017, at 3:31 AM, Joerg Schilling <schily at schily.net> wrote:
>
> David <david at kdbarto.org> wrote:
>
>> MacOS X is a certified Unix (tm) OS. Not Unix-Like.
>
> Given that MacOS X is not POSIX compliant, I would call it a UNIX-alike.
>
> Note that passing the certification tests unfortunately does not grant
> POSIX compliance :-(
>
> Try e.g. this program on Mac OS X:
>
> #include <stdlib.h>
> #include <unistd.h>
> #include <sys/wait.h>
> #include <stdio.h>
> /*
> * Non-standard compliant platforms may need
> * #include <signal.h> or something similar
> * in addition to the include files above.
> */
>
> int
> main()
> {
> siginfo_t si;
> pid_t pid;
> int ret;
>
> if ((pid = fork()) < 0)
> exit(1);
> if (pid == 0) {
> _exit(1234567890);
> }
> ret = waitid(P_PID, pid, &si, WEXITED);
> printf("ret: %d si_pid: %ld si_status: %d si_code: %d\n",
> ret,
> (long) si.si_pid, si.si_status, si.si_code);
> if (pid != si.si_pid)
> printf("si_pid in struct siginfo should be %ld but is %ld\n",
> (long) pid, (long) si.si_pid);
> if (si.si_status != 1234567890)
> printf("si_status in struct siginfo should be %d (0x%x) but is %d (0x%x)\n",
> 1234567890, 1234567890, si.si_status, si.si_status);
> if (si.si_code != CLD_EXITED)
> printf("si_code in struct siginfo should be %d (0x%x) but is %d (0x%x)\n",
> CLD_EXITED, CLD_EXITED, si.si_code, si.si_code);
> if (CLD_EXITED != 1)
> printf("CLD_EXITED is %d on this platform\n", CLD_EXITED);
> return (0);
> }
>
> Jörg
>
> --
> EMail:joerg at schily.net (home) Jörg Schilling D-13353 Berlin
> joerg.schilling at fokus.fraunhofer.de (work) Blog: http://schily.blogspot.com/
> URL: http://cdrecord.org/private/ http://sourceforge.net/projects/schilytools/files/
More information about the TUHS
mailing list