Advanced Programming in the UNIX® Environment

(lily) #1
ptg10805159

Appendix A Function Prototypes 865


ssize_t msgrcv(intmsqid,void *ptr,size_tnbytes,long type,intflag);
<sys/msg.h> p. 564
flag:IPC_NOWAIT, MSG_NOERROR
Returns: size of data portion of message if OK,−1 on error

int msgsnd(intmsqid,const void *ptr,size_tnbytes,intflag);
<sys/msg.h> p. 563
flag:IPC_NOWAIT
Returns: 0 if OK,−1 on error

int msync(void *addr,size_tlen,intflags);
<sys/mman.h> p. 528
flag:MS_ASYNC, MS_INVALIDATE, MS_SYNC
Returns: 0 if OK,−1 on error

int munmap(void *addr,size_tlen);
<sys/mman.h> p. 528
Returns: 0 if OK,−1 on error

int nanosleep(const struct timespec *reqtp,
struct timespec *remtp);
<time.h> p. 374
Returns: 0 if slept for requested time,−1 on error

int nice(intincr);
<unistd.h> p. 276
Returns: new nice value−NZEROif OK,−1 on error

uint32_t ntohl(uint32_tnetint32);
<arpa/inet.h> p. 594
Returns: 32-bit integer in host byte order

uint16_t ntohs(uint16_tnetint16);
<arpa/inet.h> p. 594
Returns: 16-bit integer in host byte order

int open(const char *path,intoflag,... /* mode_tmode*/ );
<fcntl.h> p. 62
oflag:O_RDONLY, O_WRONLY, O_RDWR, O_EXEC,
O_SEARCH;
O_APPEND, O_CLOEXEC, O_CREAT,
O_DIRECTORY, O_DSYNC, O_EXCL,
O_NOCTTY, O_NOFOLLOW, O_NONBLOCK,
O_RSYNC, O_SYNC, O_TRUNC, O_TTY_INIT
mode:S_IS[UG]ID, S_ISVTX,
S_I[RWX](USR|GRP|OTH)
Returns: file descriptor if OK,−1 on error
Platforms:O_FSYNCflag on FreeBSD 8.0 and Mac OS X 10.6.8
Free download pdf