Loading...
 

IRIX libc

IRIX does not use a BSD or GNU-style libc, so this page aims to document differences, limitations, considerations and more when developing an application or porting to IRIX.

General

IRIX 6.5.22 and up are mostly C99/C++98 compliant, and can handle most properly formatted C and C++ code written to these specifications. Later versions of C and C++ may not have proper library support baked in.

mmap

IRIX's mmap() is notable because it lacks the flag MAP_ANON. The flag 0x1000 uses MAP_SGI_ANYADDR and that does NOT create an anonymous mapping.

The following example from sudo's code is an example of how to get around it:


static void *
mmap_anon(void *addr, size_t len, int prot, int flags, off_t offset)
{
#ifdef MAP_ANON
return mmap(addr, len, prot, flags | MAP_ANON, -1, offset);
#else
int fd;
if ((fd = open("/dev/zero", O_RDWR)) == -1)

return MAP_FAILED;
addr = mmap(addr, len, prot, flags, fd, offset);
close(fd);
return addr;
#endif
}


The entire commit for this is located here: https://github.com/sudo-project/sudo/commit/9d69c4a0220cd8ea27d407c3525f32bfdadff6a9