On 24 January 2018 at 11:58, Greg V <greg@unrelenting.technology> wrote:
>>> >>> +#ifndef __FreeBSD__ >> >> mkstemp does exist on FreeBSD, right? If so you can drop this guard >> and simplify the one in os_create_anonymous_file(). > > The guard is there because this function (create_tmpfile_cloexec) goes > unused on FreeBSD. os_create_anonymous_file uses shm_open, which does not > take a filename. > I could've used shm_open inside create_tmpfile_cloexec but that would cause > compiler warnings about unused arguments… > > I guess I'll just merge create_tmpfile_cloexec into > os_create_anonymous_file, it's currently separated for no good reason. I was thinking that FreeBSD can fallback to create_tmpfile_cloexec, if shm_open fails. Skimming through shm_open and mk{o,}stemp manuals - they are both POSIX 2001 standard (kind of, mkostemp is a GNU extension). Can't we use one across all platforms? Unused variables/arguments can be annotated with the UNUSED/MAYBE_UNUSED macros. I won't merge the two functions through. As is they're shorter and easier to read - plus the compiler can inline things where needed. Thanks Emil _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev