Os.hx 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Copyright (C)2005-2019 Haxe Foundation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
  7. * and/or sell copies of the Software, and to permit persons to whom the
  8. * Software is furnished to do so, subject to the following conditions:
  9. *
  10. * The above copyright notice and this permission notice shall be included in
  11. * all copies or substantial portions of the Software.
  12. *
  13. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  18. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  19. * DEALINGS IN THE SOFTWARE.
  20. */
  21. package lua.lib.luv;
  22. @:luaRequire("luv")
  23. extern class Os {
  24. @:native("os_homedir")
  25. public static function homedir():String;
  26. @:native("os_tmpdir")
  27. public static function tmpdir():String;
  28. @:native("os_get_passwd")
  29. public static function get_passwd():String;
  30. @:native("os_getenv")
  31. public static function getenv(env:String):String;
  32. @:native("os_setenv")
  33. public static function setenv(env:String, value:String):Void;
  34. @:native("os_unsetenv")
  35. public static function unsetenv(env:String):Void;
  36. @:native("os_gethostname")
  37. public static function gethostname():String;
  38. @:native("os_environ")
  39. public static function environ() : Table<String,String>;
  40. @:native("os_uname")
  41. public static function uname() : Uname;
  42. @:native("os_getpid")
  43. public static function getpid() : Int;
  44. @:native("os_getppid")
  45. public static function getppid() : Int;
  46. @:native("os_getpriority")
  47. public static function getpriority(pid :Int) : Int;
  48. @:native("os_setpriority")
  49. public static function setpriority(pid :Int, priority : Int) : Bool;
  50. }
  51. typedef Uname = {
  52. sysname : String,
  53. release : String,
  54. version : String,
  55. machine : String
  56. }