1 /*
2  *   cdda - CD Digital Audio support
3  *
4  *   Copyright (C) 1993-2004  Ti Kan
5  *   E-mail: xmcd@amb.org
6  *
7  *   This program is free software; you can redistribute it and/or modify
8  *   it under the terms of the GNU General Public License as published by
9  *   the Free Software Foundation; either version 2 of the License, or
10  *   (at your option) any later version.
11  *
12  *   This program is distributed in the hope that it will be useful,
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *   GNU General Public License for more details.
16  *
17  *   You should have received a copy of the GNU General Public License
18  *   along with this program; if not, write to the Free Software
19  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  */
21 #ifndef __SYSVIPC_H__
22 #define __SYSVIPC_H__
23 
24 #ifndef lint
25 static char *_sysvipc_h_ident_ = "@(#)sysvipc.h	7.49 04/03/17";
26 #endif
27 
28 #ifdef CDDA_SYSVIPC
29 
30 #include <sys/ipc.h>
31 #include <sys/shm.h>
32 #include <sys/sem.h>
33 
34 /* Shared memory keys */
35 #define	SHMKEY			1111	/* Base key for shared memory */
36 #define	SEMKEY			2222	/* Base key for semaphores */
37 
38 #if defined(_SUNOS4) || defined(sgi) || defined(__bsdi__) || \
39     defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || \
40     (defined(_LINUX) && !defined(_SEM_SEMUN_UNDEFINED))
41 
42 /* These platforms (incorrectly) pre-defines "union semun" when
43  * <sys/sem.h> is included.
44  */
45 
46 #else
47 
48 /* Semaphore arg */
49 union semun {
50 	int		val;
51 	struct semid_ds	*buf;
52 	unsigned short	*array;
53 };
54 
55 #endif
56 
57 typedef union semun	semun_t;
58 
59 /* Shared memory and semaphore permissions */
60 #ifdef HAS_EUID
61 #define IPC_PERMS	0600
62 #else
63 #define IPC_PERMS	0666
64 #endif
65 
66 
67 /* Function prototypes */
68 extern word32_t	cdda_sysvipc_capab(void);
69 extern void	cdda_sysvipc_preinit(void);
70 extern bool_t	cdda_sysvipc_init(curstat_t *s);
71 extern void	cdda_sysvipc_halt(di_dev_t *, curstat_t *);
72 extern bool_t	cdda_sysvipc_play(di_dev_t *, curstat_t *,
73 				  sword32_t, sword32_t);
74 extern bool_t	cdda_sysvipc_pause_resume(di_dev_t *, curstat_t *, bool_t);
75 extern bool_t	cdda_sysvipc_stop(di_dev_t *, curstat_t *);
76 extern int	cdda_sysvipc_vol(di_dev_t *, curstat_t *, int, bool_t);
77 extern bool_t	cdda_sysvipc_chroute(di_dev_t *, curstat_t *);
78 extern void	cdda_sysvipc_att(curstat_t *);
79 extern void	cdda_sysvipc_outport(void);
80 extern bool_t	cdda_sysvipc_getstatus(di_dev_t *, curstat_t *, cdstat_t *);
81 extern void	cdda_sysvipc_debug(word32_t);
82 extern void	cdda_sysvipc_info(char *);
83 extern int	cdda_sysvipc_initipc(cd_state_t *);
84 extern void	cdda_sysvipc_waitsem(int, int);
85 extern void	cdda_sysvipc_postsem(int, int);
86 extern void	cdda_sysvipc_yield(void);
87 extern void	cdda_sysvipc_kill(thid_t, int);
88 
89 #else
90 
91 #define cdda_sysvipc_capab		NULL
92 #define cdda_sysvipc_preinit		NULL
93 #define cdda_sysvipc_init		NULL
94 #define cdda_sysvipc_halt		NULL
95 #define cdda_sysvipc_play		NULL
96 #define cdda_sysvipc_pause_resume	NULL
97 #define cdda_sysvipc_stop		NULL
98 #define cdda_sysvipc_vol		NULL
99 #define cdda_sysvipc_chroute		NULL
100 #define cdda_sysvipc_att		NULL
101 #define cdda_sysvipc_outport		NULL
102 #define cdda_sysvipc_getstatus		NULL
103 #define cdda_sysvipc_debug		NULL
104 #define cdda_sysvipc_info		NULL
105 #define cdda_sysvipc_initipc		NULL
106 #define cdda_sysvipc_waitsem		NULL
107 #define cdda_sysvipc_postsem		NULL
108 #define cdda_sysvipc_yield		NULL
109 #define cdda_sysvipc_kill		NULL
110 
111 #endif	/* CDDA_SYSVIPC */
112 
113 #endif	/* __SYSVIPC_H__ */
114 
115