/// import { PROT, MAP, IPC, FLAG, SHM, Ishmid_ds } from './platform'; import { number64, TAddress } from './types'; export declare function mmap(addr: number, length: number, prot: PROT, flags: MAP, fd: number, offset: number): number64; export declare function munmap(addr: Buffer, length: number): number; export declare function mprotect(addr: TAddress, len: number, prot: PROT): number; /** * @param key {number} * @param size {number} * @param shmflg {IPC|FLAG} If shmflg specifies both IPC_CREAT and IPC_EXCL and a shared memory segment already exists * for key, then shmget() fails with errno set to EEXIST. (This is analogous to the effect of the combination * O_CREAT | O_EXCL for open(2).) * @returns {number} `shmid` -- ID of the allocated memory, if positive. */ export declare function shmget(key: number, size: number, shmflg: IPC | FLAG): number; /** * @param shmid {number} ID returned by `shmget`. * @param shmaddr {number} Optional approximate address where to allocate memory, or NULL. * @param shmflg {SHM} * @returns {number} */ export declare function shmat(shmid: number, shmaddr?: number, shmflg?: SHM): number64; /** * @param shmaddr {number} * @returns {number} On success shmdt() returns 0; on error -1 is returned, and errno is set to indicate the cause of the error. */ export declare function shmdt(shmaddr: number): number; /** * Performs the control operation specified by cmd on the shared memory segment whose identifier is given in shmid. * * In `libc`: * * int shmctl(int shmid, int cmd, struct shmid_ds *buf); * * Reference: * * - http://linux.die.net/man/2/shmctl * * @param shmid {number} * @param cmd {defs.IPC|defs.SHM} * @param buf {Buffer|defs.shmid_ds|defs.NULL} Buffer of size `defs.shmid_ds.size` where kernel will write reponse, or * `defs.shmid_ds` structure that will be serialized for kernel to read data from, or 0 if no argument needed. * @returns {number} A successful IPC_INFO or SHM_INFO operation returns the index of the highest used entry in the * kernel's internal array recording information about all shared memory segments. (This information can be used * with repeated SHM_STAT operations to obtain information about all shared memory segments on the system.) A * successful SHM_STAT operation returns the identifier of the shared memory segment whose index was given in * shmid. Other operations return 0 on success. On error, -1 is returned, and errno is set appropriately. */ export declare function shmctl(shmid: number, cmd: IPC | SHM, buf?: Buffer | Ishmid_ds | number): number;