11590Srgrimes################################################################################
255270Sjoe#
31590Srgrimes#  Version 2.x, Copyright (C) 2007-2013, Marcus Holland-Moritz <mhx@cpan.org>.
4299244Sjilles#  Version 1.x, Copyright (C) 1997, Graham Barr <gbarr@pobox.com>.
5299244Sjilles#
675084Sru#  This program is free software; you can redistribute it and/or
775084Sru#  modify it under the same terms as Perl itself.
8245312Sbrooks#
975084Sru################################################################################
101590Srgrimes
11245312Sbrookspackage IPC::SysV;
12245312Sbrooks
13245312Sbrooksuse strict;
14245312Sbrooksuse vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION $AUTOLOAD);
15275042Sbaptuse Carp;
16245312Sbrooksuse Config;
17299244Sjilles
18299244Sjillesrequire Exporter;
19299244Sjilles@ISA = qw(Exporter);
20299244Sjilles
211590Srgrimes$VERSION = '2.09';
22
23# To support new constants, just add them to @EXPORT_OK
24# and the C/XS code will be generated automagically.
25@EXPORT_OK = (qw(
26
27  GETALL GETNCNT GETPID GETVAL GETZCNT
28
29  IPC_ALLOC IPC_CREAT IPC_EXCL IPC_GETACL IPC_INFO IPC_LOCKED
30  IPC_M IPC_NOERROR IPC_NOWAIT IPC_PRIVATE IPC_R IPC_RMID
31  IPC_SET IPC_SETACL IPC_SETLABEL IPC_STAT IPC_W IPC_WANTED
32
33  MSG_EXCEPT MSG_FWAIT MSG_INFO MSG_LOCKED MSG_MWAIT MSG_NOERROR
34  MSG_QWAIT MSG_R MSG_RWAIT MSG_STAT MSG_W MSG_WAIT MSG_WWAIT
35
36  SEM_A SEM_ALLOC SEM_DEST SEM_ERR SEM_INFO SEM_ORDER SEM_R
37  SEM_STAT SEM_UNDO
38
39  SETALL SETVAL
40
41  SHMLBA
42
43  SHM_A SHM_CLEAR SHM_COPY SHM_DCACHE SHM_DEST SHM_ECACHE
44  SHM_FMAP SHM_HUGETLB SHM_ICACHE SHM_INFO SHM_INIT SHM_LOCK
45  SHM_LOCKED SHM_MAP SHM_NORESERVE SHM_NOSWAP SHM_R SHM_RDONLY
46  SHM_REMAP SHM_REMOVED SHM_RND SHM_SHARE_MMU SHM_SHATTR
47  SHM_SIZE SHM_STAT SHM_UNLOCK SHM_W
48
49  S_IRUSR S_IWUSR S_IXUSR S_IRWXU
50  S_IRGRP S_IWGRP S_IXGRP S_IRWXG
51  S_IROTH S_IWOTH S_IXOTH S_IRWXO
52
53  ENOSPC ENOSYS ENOMEM EACCES
54
55), qw(
56
57  ftok shmat shmdt memread memwrite
58
59));
60
61%EXPORT_TAGS = (
62  all => [@EXPORT, @EXPORT_OK],
63);
64
65sub AUTOLOAD
66{
67  my $constname = $AUTOLOAD;
68  $constname =~ s/.*:://;
69  die "&IPC::SysV::_constant not defined" if $constname eq '_constant';
70  my ($error, $val) = _constant($constname);
71  if ($error) {
72    my (undef, $file, $line) = caller;
73    die "$error at $file line $line.\n";
74  }
75  {
76    no strict 'refs';
77    *$AUTOLOAD = sub { $val };
78  }
79  goto &$AUTOLOAD;
80}
81
82BOOT_XS: {
83  # If I inherit DynaLoader then I inherit AutoLoader and I DON'T WANT TO
84  use XSLoader ();
85
86  XSLoader::load( 'IPC::SysV', $VERSION );
87
88}
89
901;
91
92__END__
93
94=head1 NAME
95
96IPC::SysV - System V IPC constants and system calls
97
98=head1 SYNOPSIS
99
100  use IPC::SysV qw(IPC_STAT IPC_PRIVATE);
101
102=head1 DESCRIPTION
103
104C<IPC::SysV> defines and conditionally exports all the constants
105defined in your system include files which are needed by the SysV
106IPC calls.  Common ones include
107
108  IPC_CREAT IPC_EXCL IPC_NOWAIT IPC_PRIVATE IPC_RMID IPC_SET IPC_STAT
109  GETVAL SETVAL GETPID GETNCNT GETZCNT GETALL SETALL
110  SEM_A SEM_R SEM_UNDO
111  SHM_RDONLY SHM_RND SHMLBA
112
113and auxiliary ones
114
115  S_IRUSR S_IWUSR S_IRWXU
116  S_IRGRP S_IWGRP S_IRWXG
117  S_IROTH S_IWOTH S_IRWXO
118
119but your system might have more.
120
121=over 4
122
123=item ftok( PATH )
124
125=item ftok( PATH, ID )
126
127Return a key based on PATH and ID, which can be used as a key for
128C<msgget>, C<semget> and C<shmget>. See L<ftok(3)>.
129
130If ID is omitted, it defaults to C<1>. If a single character is
131given for ID, the numeric value of that character is used.
132
133=item shmat( ID, ADDR, FLAG )
134
135Attach the shared memory segment identified by ID to the address
136space of the calling process. See L<shmat(2)>.
137
138ADDR should be C<undef> unless you really know what you're doing.
139
140=item shmdt( ADDR )
141
142Detach the shared memory segment located at the address specified
143by ADDR from the address space of the calling process. See L<shmdt(2)>.
144
145=item memread( ADDR, VAR, POS, SIZE )
146
147Reads SIZE bytes from a memory segment at ADDR starting at position POS.
148VAR must be a variable that will hold the data read. Returns true if
149successful, or false if there is an error. memread() taints the variable.
150
151=item memwrite( ADDR, STRING, POS, SIZE )
152
153Writes SIZE bytes from STRING to a memory segment at ADDR starting at
154position POS. If STRING is too long, only SIZE bytes are used; if STRING
155is too short, nulls are written to fill out SIZE bytes. Returns true if
156successful, or false if there is an error.
157
158=back
159
160=head1 SEE ALSO
161
162L<IPC::Msg>, L<IPC::Semaphore>, L<IPC::SharedMem>, L<ftok(3)>, L<shmat(2)>, L<shmdt(2)>
163
164=head1 AUTHORS
165
166Graham Barr <gbarr@pobox.com>,
167Jarkko Hietaniemi <jhi@iki.fi>,
168Marcus Holland-Moritz <mhx@cpan.org>
169
170=head1 COPYRIGHT
171
172Version 2.x, Copyright (C) 2007-2013, Marcus Holland-Moritz.
173
174Version 1.x, Copyright (c) 1997, Graham Barr.
175
176This program is free software; you can redistribute it and/or
177modify it under the same terms as Perl itself.
178
179=cut
180
181