diff options
Diffstat (limited to 'lib/posix/posix.nim')
-rw-r--r-- | lib/posix/posix.nim | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/lib/posix/posix.nim b/lib/posix/posix.nim index 9a18d0e17..35fe0a0df 100644 --- a/lib/posix/posix.nim +++ b/lib/posix/posix.nim @@ -14,7 +14,7 @@ ## This is a raw POSIX interface module. It does not not provide any ## convenience: cstrings are used instead of proper Nimrod strings and ## return codes indicate errors. If you want exceptions -## and a proper Nimrod-like interface, use the OS module. +## and a proper Nimrod-like interface, use the OS module or write a wrapper. ## Coding conventions: ## ALL types are named the same as in the POSIX standard except that they start @@ -60,7 +60,7 @@ const STDOUT_FILENO = 1 ## File number of stdout; type - Taiocb* {.importc: "struct aiocb", header: "<aio.h>".} = record + Taiocb* {.importc: "struct aiocb", header: "<aio.h>", final.} = object aio_fildes*: cint ## File descriptor. aio_offset*: TOff ## File offset. aio_buf*: pointer ## Location of buffer. @@ -69,14 +69,14 @@ type aio_sigevent*: TSigEvent ## Signal number and value. aio_lio_opcode: cint ## Operation to be performed. - TDIR* {.importc: "DIR", header: "<dirent.h>".} = record + TDIR* {.importc: "DIR", header: "<dirent.h>", final.} = object ## A type representing a directory stream. - Tdirent* {.importc: "struct dirent", header: "<dirent.h>".} = record + Tdirent* {.importc: "struct dirent", header: "<dirent.h>", final.} = object d_ino*: TIno ## File serial number. d_name*: array [0..255, char] ## Name of entry. - Tflock* {.importc: "flock", header: "<fcntl>".} = record + Tflock* {.importc: "flock", header: "<fcntl>", final.} = object l_type*: cshort ## Type of lock; F_RDLCK, F_WRLCK, F_UNLCK. l_whence*: cshort ## Flag for starting offset. l_start*: Toff ## Relative offset in bytes. @@ -84,13 +84,13 @@ type l_pid*: TPid ## Process ID of the process holding the lock; ## returned with F_GETLK. - Tfenv* {.importc: "fenv_t", header: "<fenv.h>".} = - record ## Represents the entire floating-point environment. The + Tfenv* {.importc: "fenv_t", header: "<fenv.h>", final.} = + object ## Represents the entire floating-point environment. The ## floating-point environment refers collectively to any ## floating-point status flags and control modes supported ## by the implementation. - Tfexcept* {.importc: "fexcept_t", header: "<fenv.h>".} = - record ## Represents the floating-point status flags collectively, + Tfexcept* {.importc: "fexcept_t", header: "<fenv.h>", final.} = + object ## Represents the floating-point status flags collectively, ## including any status the implementation associates with the ## flags. A floating-point status flag is a system variable ## whose value is set (but never cleared) when a floating-point @@ -100,25 +100,25 @@ type ## whose value may be set by the user to affect the subsequent ## behavior of floating-point arithmetic. - TFTW* {.importc: "struct FTW", header: "<ftw.h>".} = record + TFTW* {.importc: "struct FTW", header: "<ftw.h>", final.} = object base*: cint level*: cint - TGlob* {.importc: "glob_t", header: "<glob.h>".} = record + TGlob* {.importc: "glob_t", header: "<glob.h>", final.} = object gl_pathc*: int ## Count of paths matched by pattern. gl_pathv*: ptr cstring ## Pointer to a list of matched pathnames. gl_offs*: int ## Slots to reserve at the beginning of gl_pathv. - TGroup* {.importc: "struct group", header: "<grp.h>".} = record + TGroup* {.importc: "struct group", header: "<grp.h>", final.} = object gr_name*: cstring ## The name of the group. gr_gid*: TGid ## Numerical group ID. gr_mem*: cstringArray ## Pointer to a null-terminated array of character ## pointers to member names. - Ticonv* {.importc: "iconv_t", header: "<iconv.h>".} = - record ## Identifies the conversion from one codeset to another. + Ticonv* {.importc: "iconv_t", header: "<iconv.h>", final.} = + object ## Identifies the conversion from one codeset to another. - Tlconv* {.importc: "struct lconv", header: "<locale.h>".} = record + Tlconv* {.importc: "struct lconv", header: "<locale.h>", final.} = object currency_symbol*: cstring decimal_point*: cstring frac_digits*: char @@ -144,14 +144,14 @@ type p_sign_posn*: char thousands_sep*: cstring - TMqd* {.importc: "mqd_t", header: "<mqueue.h>".} = record - TMqAttr* {.importc: "struct mq_attr", header: "<mqueue.h>".} = record + TMqd* {.importc: "mqd_t", header: "<mqueue.h>", final.} = object + TMqAttr* {.importc: "struct mq_attr", header: "<mqueue.h>", final.} = object mq_flags*: int ## Message queue flags. mq_maxmsg*: int ## Maximum number of messages. mq_msgsize*: int ## Maximum message size. mq_curmsgs*: int ## Number of messages currently queued. - TPasswd* {.importc: "struct passwd", header: "<pwd.h>".} = record + TPasswd* {.importc: "struct passwd", header: "<pwd.h>", final.} = object pw_name*: cstring ## User's login name. pw_uid*: TUid ## Numerical user ID. pw_gid*: TGid ## Numerical group ID. @@ -198,7 +198,7 @@ type Tuid* {.importc: "uid_t", header: "<sys/types.h>".} = int Tuseconds* {.importc: "useconds_t", header: "<sys/types.h>".} = int - Tutsname* {.importc: "struct utsname", header: "<sys/utsname.h>".} = record + Tutsname* {.importc: "struct utsname", header: "<sys/utsname.h>", final.} = object sysname*, ## Name of this implementation of the operating system. nodename*, ## Name of this node within the communications ## network to which this node is attached, if any. @@ -207,15 +207,15 @@ type machine*: array [0..255, char] ## Name of the hardware type on which the ## system is running. - TSem* {.importc: "sem_t", header: "<semaphore.h>".} = record - Tipc_perm* {.importc: "struct ipc_perm", header: "<sys/ipc.h>".} = record + TSem* {.importc: "sem_t", header: "<semaphore.h>", final.} = object + Tipc_perm* {.importc: "struct ipc_perm", header: "<sys/ipc.h>", final.} = object uid*: tuid ## Owner's user ID. gid*: tgid ## Owner's group ID. cuid*: Tuid ## Creator's user ID. cgid*: Tgid ## Creator's group ID. mode*: TMode ## Read/write permission. - TStat* {.importc: "struct stat", header: "<sys/stat.h>".} = record + TStat* {.importc: "struct stat", header: "<sys/stat.h>", final.} = object st_dev*: TDev ## Device ID of device containing file. st_ino*: TIno ## File serial number. st_mode*: TMode ## Mode of file (see below). @@ -239,7 +239,7 @@ type st_blocks*: Tblkcnt ## Number of blocks allocated for this object. - TStatvfs* {.importc: "struct statvfs", header: "<sys/statvfs.h>".} = record + TStatvfs* {.importc: "struct statvfs", header: "<sys/statvfs.h>", final.} = object f_bsize*: int ## File system block size. f_frsize*: int ## Fundamental file system block size. f_blocks*: Tfsblkcnt ## Total number of blocks on file system in units of f_frsize. @@ -255,10 +255,10 @@ type f_namemax*: int ## Maximum filename length. Tposix_typed_mem_info* {.importc: "struct posix_typed_mem_info", - header: "<sys/mman.h>".} = record + header: "<sys/mman.h>", final.} = object posix_tmi_length*: int - Ttm* {.importc: "struct tm", header: "<time.h>".} = record + Ttm* {.importc: "struct tm", header: "<time.h>", final.} = object tm_sec*: cint ## Seconds [0,60]. tm_min*: cint ## Minutes [0,59]. tm_hour*: cint ## Hour [0,23]. @@ -268,10 +268,10 @@ type tm_wday*: cint ## Day of week [0,6] (Sunday =0). tm_yday*: cint ## Day of year [0,365]. tm_isdst*: cint ## Daylight Savings flag. - Ttimespec* {.importc: "struct timespec", header: "<time.h>".} = record + Ttimespec* {.importc: "struct timespec", header: "<time.h>", final.} = object tv_sec*: Ttime ## Seconds. tv_nsec*: int ## Nanoseconds. - titimerspec* {.importc: "struct itimerspec", header: "<time.h>".} = record + titimerspec* {.importc: "struct itimerspec", header: "<time.h>", final.} = object it_interval*: ttimespec ## Timer period. it_value*: ttimespec ## Timer expiration. @@ -279,19 +279,19 @@ type ## Possibly volatile-qualified integer type of an object that can be ## accessed as an atomic entity, even in the presence of asynchronous ## interrupts. - Tsigset* {.importc: "sigset_t", header: "<signal.h>".} = record + Tsigset* {.importc: "sigset_t", header: "<signal.h>", final.} = object - TsigEvent* {.importc: "struct sigevent", header: "<signal.h>".} = record + TsigEvent* {.importc: "struct sigevent", header: "<signal.h>", final.} = object sigev_notify*: cint ## Notification type. sigev_signo*: cint ## Signal number. sigev_value*: Tsigval ## Signal value. sigev_notify_function*: proc (x: TSigval) {.noconv.} ## Notification function. sigev_notify_attributes*: ptr Tpthreadattr ## Notification attributes. - TsigVal* {.importc: "union sigval", header: "<signal.h>".} = record + TsigVal* {.importc: "union sigval", header: "<signal.h>", final.} = object sival_ptr*: pointer ## pointer signal value; ## integer signal value not defined! - TSigaction* {.importc: "struct sigaction", header: "<signal.h>".} = record + TSigaction* {.importc: "struct sigaction", header: "<signal.h>", final.} = object sa_handler*: proc (x: cint) {.noconv.} ## Pointer to a signal-catching ## function or one of the macros ## SIG_IGN or SIG_DFL. @@ -300,16 +300,16 @@ type sa_flags*: cint ## Special flags. sa_sigaction*: proc (x: cint, y: var TSigInfo, z: pointer) {.noconv.} - TStack* {.importc: "stack_t", header: "<signal.h>".} = record + TStack* {.importc: "stack_t", header: "<signal.h>", final.} = object ss_sp*: pointer ## Stack base or pointer. ss_size*: int ## Stack size. ss_flags*: cint ## Flags. - TSigStack* {.importc: "struct sigstack", header: "<signal.h>".} = record + TSigStack* {.importc: "struct sigstack", header: "<signal.h>", final.} = object ss_onstack*: cint ## Non-zero when signal stack is in use. ss_sp*: pointer ## Signal stack pointer. - TsigInfo* {.importc: "siginfo_t", header: "<signal.h>".} = record + TsigInfo* {.importc: "siginfo_t", header: "<signal.h>", final.} = object si_signo*: cint ## Signal number. si_code*: cint ## Signal code. si_errno*: cint ## If non-zero, an errno value associated with @@ -324,7 +324,7 @@ type Tnl_item* {.importc: "nl_item", header: "<nl_types.h>".} = cint Tnl_catd* {.importc: "nl_catd", header: "<nl_types.h>".} = cint - Tsched_param* {.importc: "struct sched_param", header: "<sched.h>".} = record + Tsched_param* {.importc: "struct sched_param", header: "<sched.h>", final.} = object sched_priority*: cint sched_ss_low_priority*: cint ## Low scheduling priority for ## sporadic server. @@ -334,15 +334,15 @@ type sched_ss_max_repl*: cint ## Maximum pending replenishments for ## sporadic server. - Ttimeval* {.importc: "struct timeval", header: "<sys/select.h>".} = record + Ttimeval* {.importc: "struct timeval", header: "<sys/select.h>", final.} = object tv_sec*: ttime ## Seconds. tv_usec*: tsuseconds ## Microseconds. - Tfd_set* {.importc: "struct fd_set", header: "<sys/select.h>".} = record + Tfd_set* {.importc: "struct fd_set", header: "<sys/select.h>", final.} = object Tposix_spawnattr* {.importc: "posix_spawnattr_t", header: "<spawn.h>".} = cint Tposix_spawn_file_actions* {.importc: "posix_spawn_file_actions_t", header: "<spawn.h>".} = cint - Tmcontext* {.importc: "mcontext_t", header: "<ucontext.h>".} = record - Tucontext* {.importc: "ucontext_t", header: "<ucontext.h>".} = record + Tmcontext* {.importc: "mcontext_t", header: "<ucontext.h>", final.} = object + Tucontext* {.importc: "ucontext_t", header: "<ucontext.h>", final.} = object uc_link*: ptr Tucontext ## Pointer to the context that is resumed ## when this context returns. uc_sigmask*: Tsigset ## The set of signals that are blocked when this @@ -729,7 +729,7 @@ var GLOB_NOSORT* {.importc, header: "<glob.h>".}: cint ## Do not sort the pathnames returned. GLOB_ABORTED* {.importc, header: "<glob.h>".}: cint - ## The scan was stopped because GLOB_ERR was set or (*errfunc)() + ## The scan was stopped because GLOB_ERR was set or errfunc() ## returned non-zero. GLOB_NOMATCH* {.importc, header: "<glob.h>".}: cint ## The pattern does not match any existing pathname, and GLOB_NOCHECK |