From 95236481372dcee2e62a4f225400600658b9432b Mon Sep 17 00:00:00 2001 From: "KJK::Hyperion" Date: Fri, 17 May 2002 01:37:15 +0000 Subject: [PATCH] SysV IPC headers svn path=/trunk/; revision=2956 --- posix/include/sys/ipc.h | 23 ++++++++++++++++++++++- posix/include/sys/msg.h | 23 ++++++++++++++++++++++- posix/include/sys/resource.h | 8 +++++++- posix/include/sys/sem.h | 31 ++++++++++++++++++++++++++++++- posix/include/sys/shm.h | 23 ++++++++++++++++++++++- posix/include/sys/time.h | 7 ++++++- posix/include/sys/wait.h | 30 +++++++++++++++++++++++++++++- 7 files changed, 138 insertions(+), 7 deletions(-) diff --git a/posix/include/sys/ipc.h b/posix/include/sys/ipc.h index 00798cc59b0..771a128c440 100644 --- a/posix/include/sys/ipc.h +++ b/posix/include/sys/ipc.h @@ -1,4 +1,4 @@ -/* $Id: ipc.h,v 1.2 2002/02/20 09:17:56 hyperion Exp $ +/* $Id: ipc.h,v 1.3 2002/05/17 01:37:15 hyperion Exp $ */ /* * sys/ipc.h @@ -30,10 +30,31 @@ /* OBJECTS */ /* TYPES */ +struct ipc_perm +{ + uid_t uid; /* owner's user ID */ + gid_t gid; /* owner's group ID */ + uid_t cuid; /* creator's user ID */ + gid_t cgid; /* creator's group ID */ + mode_t mode; /* read/write permission */ +}; /* CONSTANTS */ +/* Mode bits */ +#define IPC_CREAT (0x00000200) /* Create entry if key does not exist */ +#define IPC_EXCL (0x00000400) /* Fail if key exists */ +#define IPC_NOWAIT (0x00000800) /* Error if request must wait */ + +/* Keys */ +#define IPC_PRIVATE (0xFFFFFFFF) /* Private key */ + +/* Control commands */ +#define IPC_RMID (1) /* Remove identifier */ +#define IPC_SET (2) /* Set options */ +#define IPC_STAT (3) /* Get options */ /* PROTOTYPES */ +key_t ftok(const char *, int); /* MACROS */ diff --git a/posix/include/sys/msg.h b/posix/include/sys/msg.h index ae97d2aad5a..af0ff0488c7 100644 --- a/posix/include/sys/msg.h +++ b/posix/include/sys/msg.h @@ -1,4 +1,4 @@ -/* $Id: msg.h,v 1.2 2002/02/20 09:17:56 hyperion Exp $ +/* $Id: msg.h,v 1.3 2002/05/17 01:37:15 hyperion Exp $ */ /* * sys/msg.h @@ -26,14 +26,35 @@ #define __SYS_SOCKET_H_INCLUDED__ /* INCLUDES */ +#include /* OBJECTS */ /* TYPES */ +typedef unsigned int msgqnum_t; /* Used for the number of messages in the message queue */ +typedef unsigned int msglen_t; /* Used for the number of bytes allowed in a message queue */ + +struct msqid_ds +{ + struct ipc_perm msg_perm; /* operation permission structure */ + msgqnum_t msg_qnum; /* number of messages currently on queue */ + msglen_t msg_qbytes; /* maximum number of bytes allowed on queue */ + pid_t msg_lspid; /* process ID of last msgsnd() */ + pid_t msg_lrpid; /* process ID of last msgrcv() */ + time_t msg_stime; /* time of last msgsnd() */ + time_t msg_rtime; /* time of last msgrcv() */ + time_t msg_ctime; /* time of last change */ +}; /* CONSTANTS */ +/* Message operation flag */ +#define MSG_NOERROR (0x00001000) /* No error if big message */ /* PROTOTYPES */ +int msgctl(int, int, struct msqid_ds *); +int msgget(key_t, int); +ssize_t msgrcv(int, void *, size_t, long int, int); +int msgsnd(int, const void *, size_t, int); /* MACROS */ diff --git a/posix/include/sys/resource.h b/posix/include/sys/resource.h index 0a13abaca95..7e9d8d185e8 100644 --- a/posix/include/sys/resource.h +++ b/posix/include/sys/resource.h @@ -1,4 +1,4 @@ -/* $Id: resource.h,v 1.2 2002/02/20 09:17:56 hyperion Exp $ +/* $Id: resource.h,v 1.3 2002/05/17 01:37:15 hyperion Exp $ */ /* * sys/resource.h @@ -26,10 +26,16 @@ #define __SYS_RESOURCE_H_INCLUDED__ /* INCLUDES */ +#include /* OBJECTS */ /* TYPES */ +struct rusage +{ + struct timeval ru_utime; /* user time used */ + struct timeval ru_stime; /* system time used */ +}; /* CONSTANTS */ diff --git a/posix/include/sys/sem.h b/posix/include/sys/sem.h index d117684c758..e2c6def187a 100644 --- a/posix/include/sys/sem.h +++ b/posix/include/sys/sem.h @@ -1,4 +1,4 @@ -/* $Id: sem.h,v 1.2 2002/02/20 09:17:56 hyperion Exp $ +/* $Id: sem.h,v 1.3 2002/05/17 01:37:15 hyperion Exp $ */ /* * sys/sem.h @@ -26,14 +26,43 @@ #define __SYS_SEM_H_INCLUDED__ /* INCLUDES */ +#include /* OBJECTS */ /* TYPES */ +struct semid_ds +{ + struct ipc_perm sem_perm; /* operation permission structure */ + unsigned short int sem_nsems; /* number of semaphores in set */ + time_t sem_otime; /* last semop time */ + time_t sem_ctime; /* last time changed by semctl() */ +}; + +struct sembuf +{ + unsigned short int sem_num; /* semaphore number */ + short int sem_op; /* semaphore operation */ + short int sem_flg; /* operation flags */ +}; /* CONSTANTS */ +/* Semaphore operation flags */ +#define SEM_UNDO (0x00001000) /* Set up adjust on exit entry */ + +/* Command definitions for the function semctl() */ +#define GETNCNT (1) /* Get semncnt */ +#define GETPID (2) /* Get sempid */ +#define GETVAL (3) /* Get semval */ +#define GETALL (4) /* Get all cases of semval */ +#define GETZCNT (5) /* Get semzcnt */ +#define SETVAL (6) /* Set semval */ +#define SETALL (7) /* Set all cases of semval */ /* PROTOTYPES */ +int semctl(int, int, int, ...); +int semget(key_t, int, int); +int semop(int, struct sembuf *, size_t); /* MACROS */ diff --git a/posix/include/sys/shm.h b/posix/include/sys/shm.h index cbdb6a1ff74..30967a2b850 100644 --- a/posix/include/sys/shm.h +++ b/posix/include/sys/shm.h @@ -1,4 +1,4 @@ -/* $Id: shm.h,v 1.2 2002/02/20 09:17:56 hyperion Exp $ +/* $Id: shm.h,v 1.3 2002/05/17 01:37:15 hyperion Exp $ */ /* * sys/shm.h @@ -30,10 +30,31 @@ /* OBJECTS */ /* TYPES */ +typedef unsigned short shmatt_t; + +struct shmid_ds +{ + struct ipc_perm shm_perm; /* operation permission structure */ + size_t shm_segsz; /* size of segment in bytes */ + pid_t shm_lpid; /* process ID of last shared memory operation */ + pid_t shm_cpid; /* process ID of creator */ + shmatt_t shm_nattch; /* number of current attaches */ + time_t shm_atime; /* time of last shmat() */ + time_t shm_dtime; /* time of last shmdt() */ + time_t shm_ctime; /* time of last change by shmctl() */ +}; /* CONSTANTS */ +#define SHM_RDONLY (0x00000200) /* Attach read-only (else read-write). */ +#define SHM_RND (0x00000400) /* Round attach address to SHMLBA. */ + +#define SHMLBA (4096) /* Segment low boundary address multiple. */ /* PROTOTYPES */ +void *shmat(int, const void *, int); +int shmctl(int, int, struct shmid_ds *); +int shmdt(const void *); +int shmget(key_t, size_t, int); /* MACROS */ diff --git a/posix/include/sys/time.h b/posix/include/sys/time.h index e13d4584c1d..65664ec9dc9 100644 --- a/posix/include/sys/time.h +++ b/posix/include/sys/time.h @@ -1,4 +1,4 @@ -/* $Id: time.h,v 1.2 2002/02/20 09:17:56 hyperion Exp $ +/* $Id: time.h,v 1.3 2002/05/17 01:37:15 hyperion Exp $ */ /* * sys/time.h @@ -30,6 +30,11 @@ /* OBJECTS */ /* TYPES */ +struct timeval +{ + time_t tv_sec; /* seconds */ + suseconds_t tv_usec; /* microseconds */ +}; /* CONSTANTS */ diff --git a/posix/include/sys/wait.h b/posix/include/sys/wait.h index bc6122c3de6..080c180f1af 100644 --- a/posix/include/sys/wait.h +++ b/posix/include/sys/wait.h @@ -1,4 +1,4 @@ -/* $Id: wait.h,v 1.2 2002/02/20 09:17:56 hyperion Exp $ +/* $Id: wait.h,v 1.3 2002/05/17 01:37:15 hyperion Exp $ */ /* * sys/wait.h @@ -26,16 +26,44 @@ #define __SYS_WAIT_H_INCLUDED__ /* INCLUDES */ +#include +#include /* OBJECTS */ /* TYPES */ +typedef enum __tagidtype_t +{ + P_ALL, + P_PID, + P_PGID +} idtype_t; /* CONSTANTS */ +/* Possible values for the options argument to waitid() */ +#define WEXITED (0x00000001) /* Wait for processes that have exited */ +#define WSTOPPED (0x00000002) /* Status will be returned for any child that has stopped upon receipt of a signal */ +#define WNOWAIT (0x00000004) /* Keep the process whose status is returned in infop in a waitable state */ + +#define WCONTINUED (0x00000008) /* Status will be returned for any child that was stopped and has been continued */ +#define WNOHANG (0x00000010) /* Return immediately if there are no children to wait for */ +#define WUNTRACED (0x00000020) /* Report status of stopped child process */ /* PROTOTYPES */ +pid_t wait(int *); +pid_t wait3(int *, int, struct rusage *); +int waitid(idtype_t, id_t, siginfo_t *, int); +pid_t waitpid(pid_t, int *, int); /* MACROS */ +/* Macros for analysis of process status values */ +#define WEXITSTATUS(__STATUS__) (1) /* Return exit status */ +#define WIFCONTINUED(__STATUS__) (1) /* True if child has been continued */ +#define WIFEXITED(__STATUS__) (1) /* True if child exited normally */ +#define WIFSIGNALED(__STATUS__) (1) /* True if child exited due to uncaught signal */ +#define WIFSTOPPED(__STATUS__) (1) /* True if child is currently stopped */ +#define WSTOPSIG(__STATUS__) (1) /* Return signal number that caused process to stop */ +#define WTERMSIG(__STATUS__) (1) /* Return signal number that caused process to terminate */ #endif /* __SYS_WAIT_H_INCLUDED__ */ -- 2.17.1