Skip to content

Commit

Permalink
Minix Support
Browse files Browse the repository at this point in the history
  • Loading branch information
sambuc committed Nov 7, 2014
1 parent 055d5fa commit a95b153
Show file tree
Hide file tree
Showing 55 changed files with 1,267 additions and 22 deletions.
2 changes: 2 additions & 0 deletions external/mit/fontconfig/include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,13 @@
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
/* #undef HAVE_NDIR_H */

#if !defined(__minix)
/* Define to 1 if you have the 'posix_fadvise' function. */
#define HAVE_POSIX_FADVISE 1

/* Have POSIX threads */
#define HAVE_PTHREAD 1
#endif /* !defined(__minix) */

/* Have PTHREAD_PRIO_INHERIT. */
/* #undef HAVE_PTHREAD_PRIO_INHERIT */
Expand Down
2 changes: 2 additions & 0 deletions external/mit/libFS/include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1

#if !defined(__minix)
/* Support IPv6 for TCP connections */
#define IPv6 1
#endif /* !defined(__minix) */

/* Support os-specific local connections */
/* #undef LOCALCONN */
Expand Down
5 changes: 5 additions & 0 deletions external/mit/libX11/dist/src/UIThrStubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,12 @@ typedef pthread_t xthread_t;
#pragma weak tis_cond_signal = _Xthr_zero_stub_
#pragma weak tis_cond_broadcast = _Xthr_zero_stub_
#else
# if defined(__minix)
#define _MTHREADIFY_PTHREADS 1
#include <minix/mthread.h>
# else
#include <pthread.h>
# endif /* defined(__minix) */
typedef pthread_t xthread_t;
#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
xthread_t pthread_self() __attribute__ ((weak, alias ("_Xthr_self_stub_")));
Expand Down
2 changes: 2 additions & 0 deletions external/mit/libXfont/include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1

#if !defined(__minix)
/* Support IPv6 for TCP connections */
#define IPv6 1
#endif /* !defined(__minix) */

/* Support os-specific local connections */
/* #undef LOCALCONN */
Expand Down
6 changes: 4 additions & 2 deletions external/mit/libXxf86dga/dist/src/XF86DGA.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ MapPhysAddress(unsigned long address, unsigned long size)
vaddr = (void *)smem_create("XF86DGA", (char *)offset,
size + delta, SM_READ|SM_WRITE);
#else
#if !defined(__minix)
#ifndef MAP_FILE
#define MAP_FILE 0
#endif
Expand All @@ -562,6 +563,7 @@ MapPhysAddress(unsigned long address, unsigned long size)
MAP_FILE | MAP_SHARED, mapFd, (off_t)offset);
if (vaddr == (void *)-1)
return NULL;
#endif /* !defined(__minix) */
#endif

if (!vaddr) {
Expand Down Expand Up @@ -624,14 +626,14 @@ XF86DGADirectVideo(
if (enable & XF86DGADirectGraphics) {
#if !defined(ISC) && !defined(HAS_SVR3_MMAP) \
&& !(defined(Lynx) && defined(NO_MMAP)) \
&& !defined(__UNIXOS2__)
&& !defined(__UNIXOS2__) && !defined(__minix)
if (mp && mp->vaddr)
mprotect(mp->vaddr, mp->size + mp->delta, PROT_READ | PROT_WRITE);
#endif
} else {
#if !defined(ISC) && !defined(HAS_SVR3_MMAP) \
&& !(defined(Lynx) && defined(NO_MMAP)) \
&& !defined(__UNIXOS2__)
&& !defined(__UNIXOS2__) && !defined(__minix)
if (mp && mp->vaddr)
mprotect(mp->vaddr, mp->size + mp->delta, PROT_READ);
#elif defined(Lynx) && defined(NO_MMAP)
Expand Down
4 changes: 4 additions & 0 deletions external/mit/libXxf86dga/dist/src/XF86DGA2.c
Original file line number Diff line number Diff line change
Expand Up @@ -967,6 +967,7 @@ DGAMapPhysical(
#ifndef MAP_FILE
#define MAP_FILE 0
#endif
#if !defined(__minix)
if (!name)
name = DEV_MEM;
if ((pMap->fd = open(name, O_RDWR)) < 0)
Expand All @@ -976,6 +977,7 @@ DGAMapPhysical(
if (pMap->virtual == (void *)-1)
return False;
mprotect(pMap->virtual, size, PROT_READ | PROT_WRITE);
#endif /* !defined(__minix) */
#endif

return True;
Expand All @@ -996,7 +998,9 @@ DGAUnmapPhysical(DGAMapPtr pMap)
smem_remove("XF86DGA");
#else
if (pMap->virtual && pMap->virtual != (void *)-1) {
#if !defined(__minix)
mprotect(pMap->virtual,pMap->size, PROT_READ);
#endif /* ! defined(__minix) */
munmap(pMap->virtual, pMap->size);
pMap->virtual = 0;
}
Expand Down
5 changes: 5 additions & 0 deletions external/mit/libdrm/dist/intel/intel_bufmgr_fake.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@
#include <assert.h>
#include <errno.h>
#include <xf86drm.h>
#if !defined(__minix)
#include <pthread.h>
#else
#define _MTHREADIFY_PTHREADS 1
#include <minix/mthread.h>
#endif /* !defined(__minix) */
#include "intel_bufmgr.h"
#include "intel_bufmgr_priv.h"
#include "drm.h"
Expand Down
9 changes: 9 additions & 0 deletions external/mit/libdrm/dist/intel/intel_bufmgr_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@
#include <string.h>
#include <unistd.h>
#include <assert.h>
#if !defined(__minix)
#include <pthread.h>
#else
#define _MTHREADIFY_PTHREADS 1
#include <minix/mthread.h>
#endif /* !defined(__minix) */
#include <stddef.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
Expand Down Expand Up @@ -1062,9 +1067,13 @@ int drm_intel_gem_bo_map_gtt(drm_intel_bo *bo)
}

/* and mmap it */
#if !defined(__minix)
bo_gem->gtt_virtual = mmap(0, bo->size, PROT_READ | PROT_WRITE,
MAP_SHARED, bufmgr_gem->fd,
mmap_arg.offset);
#else
bo_gem->gtt_virtual = MAP_FAILED;
#endif /* !defined(__minix) */
if (bo_gem->gtt_virtual == MAP_FAILED) {
bo_gem->gtt_virtual = NULL;
ret = -errno;
Expand Down
4 changes: 4 additions & 0 deletions external/mit/libdrm/dist/radeon/radeon_bo_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,11 @@ static int bo_map(struct radeon_bo_int *boi, int write)
boi, boi->handle, r);
return r;
}
#if !defined(__minix)
ptr = mmap(0, args.size, PROT_READ|PROT_WRITE, MAP_SHARED, boi->bom->fd, args.addr_ptr);
#else
ptr = MAP_FAILED;
#endif /* !defined(__minix) */
if (ptr == MAP_FAILED)
return -errno;
bo_gem->priv_ptr = ptr;
Expand Down
5 changes: 5 additions & 0 deletions external/mit/libdrm/dist/radeon/radeon_cs_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#if !defined(__minix)
#include <pthread.h>
#else
#define _MTHREADIFY_PTHREADS 1
#include <minix/mthread.h>
#endif /* !defined(__minix) */
#include <sys/mman.h>
#include <sys/ioctl.h>
#include "radeon_cs.h"
Expand Down
2 changes: 1 addition & 1 deletion external/mit/libdrm/dist/xf86atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ typedef struct { uint_t atomic; } atomic_t;

#endif

#if defined(__NetBSD__) && !defined(HAS_ATOMIC_OPS) /* NetBSD */
#if (defined(__NetBSD__) || defined(__minix)) && !defined(HAS_ATOMIC_OPS) /* NetBSD */

#include <sys/atomic.h>
#define HAS_ATOMIC_OPS 1
Expand Down
4 changes: 4 additions & 0 deletions external/mit/libdrm/dist/xf86drm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,11 @@ int drmMap(int fd, drm_handle_t handle, drmSize size, drmAddressPtr address)

size = (size + pagesize_mask) & ~pagesize_mask;

#if !defined(__minix)
*address = mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, handle);
#else
*address = MAP_FAILED;
#endif /* !defined(__minix) */
if (*address == MAP_FAILED)
return -errno;
return 0;
Expand Down
2 changes: 2 additions & 0 deletions external/mit/libpciaccess/dist/src/common_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ pci_system_init( void )
err = pci_system_linux_sysfs_create();
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
err = pci_system_freebsd_create();
#elif defined(__minix)
err = pci_system_minix_create();
#elif defined(__NetBSD__)
err = pci_system_netbsd_create();
#elif defined(__OpenBSD__)
Expand Down
2 changes: 1 addition & 1 deletion external/mit/libpciaccess/dist/src/common_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
#define HTOLE_16(x) htole16(x)
#define HTOLE_32(x) htole32(x)

#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__)
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__minix)
#define LETOH_16(x) le16toh(x)
#define LETOH_32(x) le32toh(x)
#else
Expand Down
Loading

0 comments on commit a95b153

Please sign in to comment.