Annotate

teal-src/util/pposix.d.tl @ 12763:d26eefe98d09

util.dbuffer: Add efficient shortcuts for discard() in certain cases If the buffer is already empty, nothing to do. If we're throwing away the whole buffer, we can just empty it and avoid read_chunk() (which in turn may collapse()). These shortcuts are much more efficient.
author Matthew Wild <mwild1@gmail.com>
date Tue, 11 Oct 2022 11:37:55 +0100
parent 11656:c368b4f6ee04
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11432
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
1 local record pposix
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
2 enum syslog_facility
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
3 "auth"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
4 "authpriv"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
5 "cron"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
6 "daemon"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
7 "ftp"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
8 "kern"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
9 "local0"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
10 "local1"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
11 "local2"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
12 "local3"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
13 "local4"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
14 "local5"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
15 "local6"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
16 "local7"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
17 "lpr"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
18 "mail"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
19 "syslog"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
20 "user"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
21 "uucp"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
22 end
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
23
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
24 enum syslog_level
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
25 "debug"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
26 "info"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
27 "notice"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
28 "warn"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
29 "error"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
30 end
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
31
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
32 enum ulimit_resource
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
33 "CORE"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
34 "CPU"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
35 "DATA"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
36 "FSIZE"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
37 "NOFILE"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
38 "STACK"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
39 "MEMLOCK"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
40 "NPROC"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
41 "RSS"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
42 "NICE"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
43 end
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
44
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
45 enum ulimit_unlimited
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
46 "unlimited"
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
47 end
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
48
11459
86904555bffc teal: Use new integer support in Teal 0.13.0
Kim Alvefur <zash@zash.se>
parents: 11432
diff changeset
49 type ulimit_limit = integer | ulimit_unlimited
11432
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
50
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
51 record utsname
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
52 sysname : string
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
53 nodename : string
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
54 release : string
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
55 version : string
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
56 machine : string
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
57 domainname : string
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
58 end
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
59
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
60 record memoryinfo
11459
86904555bffc teal: Use new integer support in Teal 0.13.0
Kim Alvefur <zash@zash.se>
parents: 11432
diff changeset
61 allocated : integer
86904555bffc teal: Use new integer support in Teal 0.13.0
Kim Alvefur <zash@zash.se>
parents: 11432
diff changeset
62 allocated_mmap : integer
86904555bffc teal: Use new integer support in Teal 0.13.0
Kim Alvefur <zash@zash.se>
parents: 11432
diff changeset
63 used : integer
86904555bffc teal: Use new integer support in Teal 0.13.0
Kim Alvefur <zash@zash.se>
parents: 11432
diff changeset
64 unused : integer
86904555bffc teal: Use new integer support in Teal 0.13.0
Kim Alvefur <zash@zash.se>
parents: 11432
diff changeset
65 returnable : integer
11432
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
66 end
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
67
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
68 abort : function ()
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
69
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
70 daemonize : function () : boolean, string
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
71
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
72 syslog_open : function (ident : string, facility : syslog_facility)
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
73 syslog_close : function ()
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
74 syslog_log : function (level : syslog_level, src : string, msg : string)
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
75 syslog_setminlevel : function (level : syslog_level)
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
76
11459
86904555bffc teal: Use new integer support in Teal 0.13.0
Kim Alvefur <zash@zash.se>
parents: 11432
diff changeset
77 getpid : function () : integer
86904555bffc teal: Use new integer support in Teal 0.13.0
Kim Alvefur <zash@zash.se>
parents: 11432
diff changeset
78 getuid : function () : integer
86904555bffc teal: Use new integer support in Teal 0.13.0
Kim Alvefur <zash@zash.se>
parents: 11432
diff changeset
79 getgid : function () : integer
11432
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
80
11459
86904555bffc teal: Use new integer support in Teal 0.13.0
Kim Alvefur <zash@zash.se>
parents: 11432
diff changeset
81 setuid : function (uid : integer | string) : boolean, string -- string|integer
86904555bffc teal: Use new integer support in Teal 0.13.0
Kim Alvefur <zash@zash.se>
parents: 11432
diff changeset
82 setgid : function (uid : integer | string) : boolean, string
86904555bffc teal: Use new integer support in Teal 0.13.0
Kim Alvefur <zash@zash.se>
parents: 11432
diff changeset
83 initgroups : function (user : string, gid : integer) : boolean, string
11432
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
84
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
85 umask : function (umask : string) : string
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
86
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
87 mkdir : function (dir : string) : boolean, string
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
88
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
89 setrlimit : function (resource : ulimit_resource, soft : ulimit_limit, hard : ulimit_limit) : boolean, string
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
90 getrlimit : function (resource : ulimit_resource) : boolean, ulimit_limit, ulimit_limit
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
91 getrlimit : function (resource : ulimit_resource) : boolean, string
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
92
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
93 uname : function () : utsname
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
94
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
95 setenv : function (key : string, value : string) : boolean
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
96
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
97 meminfo : function () : memoryinfo
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
98
11459
86904555bffc teal: Use new integer support in Teal 0.13.0
Kim Alvefur <zash@zash.se>
parents: 11432
diff changeset
99 atomic_append : function (f : FILE, s : string) : boolean, string, integer
11432
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
100
11656
c368b4f6ee04 util.pposix: Bind isatty(3)
Kim Alvefur <zash@zash.se>
parents: 11459
diff changeset
101 isatty : function(FILE) : boolean
c368b4f6ee04 util.pposix: Bind isatty(3)
Kim Alvefur <zash@zash.se>
parents: 11459
diff changeset
102
11459
86904555bffc teal: Use new integer support in Teal 0.13.0
Kim Alvefur <zash@zash.se>
parents: 11432
diff changeset
103 ENOENT : integer
11432
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
104 _NAME : string
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
105 _VESRION : string
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
106 end
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
107
113f3912c7cb util: Add Teal interface definition files
Kim Alvefur <zash@zash.se>
parents:
diff changeset
108 return pposix