1 /*
   2  * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.glass.ui.monocle;
  27 
  28 import java.nio.ByteBuffer;
  29 
  30 public class LinuxSystemShim {
  31 
  32     public static final int O_RDONLY = LinuxSystem.O_RDONLY;
  33     public static final int O_WRONLY = LinuxSystem.O_WRONLY;
  34     public static final int O_RDWR = LinuxSystem.O_RDWR;
  35     public static final int O_NONBLOCK = LinuxSystem.O_NONBLOCK;
  36     public static final int _SC_LONG_BIT = LinuxSystem._SC_LONG_BIT;
  37     public static final int FBIOGET_VSCREENINFO = LinuxSystem.FBIOGET_VSCREENINFO;
  38     public static final int FBIOPUT_VSCREENINFO = LinuxSystem.FBIOPUT_VSCREENINFO;
  39     public static final int FBIOPAN_DISPLAY = LinuxSystem.FBIOPAN_DISPLAY;
  40     public static final int FBIOBLANK = LinuxSystem.FBIOBLANK;
  41     public static final int FB_BLANK_UNBLANK = LinuxSystem.FB_BLANK_UNBLANK;
  42     public static final int FB_ACTIVATE_NOW = LinuxSystem.FB_ACTIVATE_NOW;
  43     public static final int FB_ACTIVATE_VBL = LinuxSystem.FB_ACTIVATE_VBL;
  44     public static final int I_FLUSH = LinuxSystem.I_FLUSH;
  45     public static final int FLUSHRW = LinuxSystem.FLUSHRW;
  46     public static final int ENXIO = LinuxSystem.ENXIO;
  47     public static final int EAGAIN = LinuxSystem.EAGAIN;
  48     public static final int RTLD_LAZY = LinuxSystem.RTLD_LAZY;
  49     public static final int RTLD_GLOBAL = LinuxSystem.RTLD_GLOBAL;
  50     public static final int S_IRWXU = LinuxSystem.S_IRWXU;
  51 
  52     public static final long PROT_READ = LinuxSystem.PROT_READ;
  53     public static final long PROT_WRITE = LinuxSystem.PROT_WRITE;
  54     public static final long MAP_PRIVATE = LinuxSystem.MAP_PRIVATE;
  55     public static final long MAP_ANONYMOUS = LinuxSystem.MAP_ANONYMOUS;
  56     public static final long MAP_SHARED = LinuxSystem.MAP_SHARED;
  57     public static final long MAP_FAILED = LinuxSystem.MAP_FAILED;
  58 
  59     public static void loadLibrary() {
  60         LinuxSystem.getLinuxSystem().loadLibrary();
  61     }
  62 
  63     public static void setenv(String key, String value, boolean overwrite) {
  64         LinuxSystem.getLinuxSystem().setenv(value, value, overwrite);
  65     }
  66 
  67     public static String getErrorMessage() {
  68         return LinuxSystem.getLinuxSystem().getErrorMessage();
  69     }
  70 
  71     public static int mkfifo(String pathname, int mode) {
  72         return LinuxSystem.getLinuxSystem().mkfifo(pathname, mode);
  73     }
  74 
  75     public static long write(long fd, ByteBuffer buf, int position, int limit) {
  76         return LinuxSystem.getLinuxSystem().write(fd, buf, limit, limit);
  77     }
  78 
  79     public static int close(long fd) {
  80         return LinuxSystem.getLinuxSystem().close(fd);
  81     }
  82 
  83     public static long open(String path, int flags) {
  84         return LinuxSystem.getLinuxSystem().open(path, flags);
  85     }
  86 
  87     public static int errno() {
  88         return LinuxSystem.getLinuxSystem().errno();
  89     }
  90 
  91     public static int ioctl(long fd, int request, long data) {
  92         return LinuxSystem.getLinuxSystem().ioctl(fd, request, fd);
  93     }
  94 
  95 }