unxsysc.inc 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 2001 by Free Pascal development team
  5. Some calls for the unix unit.
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. ***********************************************************************}
  12. function fpNice(N:cint):cint;
  13. {
  14. Set process priority. A positive N means a lower priority.
  15. A negative N decreases priority.
  16. Doesn't exist in BSD. Linux emu uses setpriority in a construct as below:
  17. }
  18. begin
  19. fpNice:=do_syscall(Syscall_nr_nice,N);
  20. end;
  21. Function fpGetPriority(Which,Who:cint):cint;
  22. {
  23. Get Priority of process, process group, or user.
  24. Which : selects what kind of priority is used.
  25. can be one of the following predefined Constants :
  26. Prio_User.
  27. Prio_PGrp.
  28. Prio_Process.
  29. Who : depending on which, this is , respectively :
  30. Uid
  31. Pid
  32. Process Group id
  33. Errors are reported in linuxerror _only_. (priority can be negative)
  34. }
  35. begin
  36. if (which<prio_process) or (which>prio_user) then
  37. begin
  38. { We can save an interrupt here }
  39. fpgetpriority:=-1;
  40. fpsetErrno(ESysEinval);
  41. end
  42. else
  43. fpGetPriority:=do_syscall(syscall_nr_GetPriority,which,who);
  44. end;
  45. Function fpSetPriority(Which,Who,What:cint):cint;
  46. {
  47. Set Priority of process, process group, or user.
  48. Which : selects what kind of priority is used.
  49. can be one of the following predefined Constants :
  50. Prio_User.
  51. Prio_PGrp.
  52. Prio_Process.
  53. Who : depending on value of which, this is, respectively :
  54. Uid
  55. Pid
  56. Process Group id
  57. what : A number between -20 and 20. -20 is most favorable, 20 least.
  58. 0 is the default.
  59. }
  60. begin
  61. if ((which<prio_process) or (which>prio_user)) or ((what<-20) or (what>20)) then
  62. fpseterrno(ESyseinval) { We can save an interrupt here }
  63. else
  64. begin
  65. fpSetPriority:=do_syscall(Syscall_nr_Setpriority,which,who,what);
  66. end;
  67. end;
  68. Function fpLstat(path:pchar;Info:pstat):cint;
  69. {
  70. Get all information on a link (the link itself), and return it in info.
  71. }
  72. begin
  73. fpLStat:=do_syscall(syscall_nr_lstat,TSysParam(path),TSysParam(info));
  74. end;
  75. Function fpLstat(Filename: PathStr;Info:pstat):cint;
  76. {
  77. Get all information on a link (the link itself), and return it in info.
  78. }
  79. begin
  80. FileName:=FileName+#0;
  81. fpLStat:=do_syscall(syscall_nr_lstat,TSysParam(@filename[1]),TSysParam(info));
  82. end;
  83. Function fpSymlink(oldname,newname:pchar):cint;
  84. {
  85. We need this for erase
  86. }
  87. begin
  88. fpsymlink:=do_syscall(syscall_nr_symlink,TSysParam(oldname),TSysParam(newname));
  89. end;
  90. {
  91. $Log$
  92. Revision 1.4 2004-01-01 16:10:23 marco
  93. * fpreadlink(pathstr) moved to unxovl (since not platform specific),
  94. small fixes for "make all OPT='-dFPC_USE_LIBC'
  95. Revision 1.3 2003/11/13 13:11:55 marco
  96. * Linuxerror remove + hdr+log added
  97. }