---------z01886_boundary_sign
Content-Type: multipart/alternative; boundary="=_alternative 00679CB5852568CE_="
This is a multipart message in MIME format.
--=_alternative 00679CB5852568CE_=
Content-Type: text/plain; charset="us-ascii"
kenbo@iris.com writes:
> Using 2.3.99pre6-6, I noticed that SHMMAX has been moved to linux/shm.h
and
> that this file is only useable if you have __KERNEL__ defined, otherwise
> the headers it includes basically blow up due to symbols such as kdev_t
not
> getting defined. Was this on purpose? If not, maybe we can fix this,
> because otherwise app builders using shared memory and trying to honor
> system boundaries are going to have some problems.
Jeff Garzik <jgarzik@mandrakesoft.com> writes:
> Do not use kernel headers directly in userspace programs.
I'm trying to use as few "kernel" headers as I can, but I need to be able
to get the limits on shared memory before I create any segments - ie., I
need SHMMAX.
Christoph Rohland <cr@sap.com> writes:
> #include <sys/types.h>
> #include <linux/shm.h>
> main()
> {
> printf ("shmmax = %d\n", SHMMAX);
> }
>
> Works for me.
> BTW it is probably much better to check the runtime settings with
> shmctl(0, SHM_INFO, ...). The limits are all tuneable now.
The only problem with shmctl SHM_INFO is that it gives you information
about the shared memory in use, not about the limits; IPC_INFO looks
promising, but I cannot get that to compile for reasons similar to the
test case. Maybe it's something with my setups or my system somehow because even the
above test case fails - I'm running base Redhat 6.0 system with the
2.3.99pre5 patched to pre6-6 kernel and I get the following messages on
this test case (and /usr/src/linux points to the new kernel); I tried it
on another box with RH 6.1 and 2.3.99pre5 kernel and I get the same
results:
gcc -o foo -g foo.c
In file included from /usr/include/linux/sched.h:72,
from /usr/include/linux/mm.h:4,
from /usr/include/linux/shm.h:5,
from foo.c:3:
/usr/include/linux/time.h:69: warning: `FD_SET' redefined
/usr/include/sys/select.h:63: warning: this is the location of the
previous definition
/usr/include/linux/time.h:70: warning: `FD_CLR' redefined
/usr/include/sys/select.h:64: warning: this is the location of the
previous definition
/usr/include/linux/time.h:71: warning: `FD_ISSET' redefined
/usr/include/sys/select.h:65: warning: this is the location of the
previous definition
/usr/include/linux/time.h:72: warning: `FD_ZERO' redefined
/usr/include/sys/select.h:66: warning: this is the location of the
previous definition
In file included from /usr/include/linux/dcache.h:5,
from /usr/include/linux/fs.h:19,
from /usr/include/linux/capability.h:13,
from /usr/include/linux/binfmts.h:5,
from /usr/include/linux/sched.h:8,
from /usr/include/linux/mm.h:4,
from /usr/include/linux/shm.h:5,
from foo.c:3:
/usr/include/linux/mount.h:16: parse error before `kdev_t'
/usr/include/linux/mount.h:16: warning: no semicolon at end of struct or
union
/usr/include/linux/mount.h:21: parse error before `}'
In file included from /usr/include/linux/sched.h:13,
from /usr/include/linux/mm.h:4,
from /usr/include/linux/shm.h:5,
from foo.c:3:
/usr/include/linux/times.h:5: parse error before `clock_t'
/usr/include/linux/times.h:5: warning: no semicolon at end of struct or
union
/usr/include/linux/times.h:6: warning: data definition has no type or
storage class
/usr/include/linux/times.h:7: parse error before `tms_cutime'
/usr/include/linux/times.h:7: warning: data definition has no type or
storage class
/usr/include/linux/times.h:8: parse error before `tms_cstime'
/usr/include/linux/times.h:8: warning: data definition has no type or
storage class
In file included from /usr/include/linux/sched.h:14,
from /usr/include/linux/mm.h:4,
from /usr/include/linux/shm.h:5,
from foo.c:3:
/usr/include/linux/timex.h:159: field `time' has incomplete type
In file included from /usr/include/linux/sched.h:17,
from /usr/include/linux/mm.h:4,
from /usr/include/linux/shm.h:5,
from foo.c:3:
/usr/include/asm/semaphore.h:39: parse error before `wait_queue_head_t'
/usr/include/asm/semaphore.h:39: warning: no semicolon at end of struct or
union
/usr/include/asm/semaphore.h: In function `sema_init':
/usr/include/asm/semaphore.h:73: dereferencing pointer to incomplete type
/usr/include/asm/semaphore.h:74: dereferencing pointer to incomplete type
/usr/include/asm/semaphore.h:75: dereferencing pointer to incomplete type
/usr/include/asm/semaphore.h: At top level:
/usr/include/asm/semaphore.h:226: parse error before `wait_queue_head_t'
/usr/include/asm/semaphore.h:226: warning: no semicolon at end of struct
or union
/usr/include/asm/semaphore.h:227: warning: data definition has no type or
storage class
/usr/include/asm/semaphore.h: In function `init_rwsem':
/usr/include/asm/semaphore.h:255: dereferencing pointer to incomplete type
/usr/include/asm/semaphore.h:256: dereferencing pointer to incomplete type
/usr/include/asm/semaphore.h:257: dereferencing pointer to incomplete type
/usr/include/asm/semaphore.h:258: dereferencing pointer to incomplete type
/usr/include/asm/semaphore.h:259: dereferencing pointer to incomplete type
/usr/include/asm/semaphore.h: At top level:
/usr/include/asm/semaphore.h:268: parse error before `('
/usr/include/asm/semaphore.h:269: parse error before `('
/usr/include/asm/semaphore.h:270: parse error before `('
In file included from /usr/include/linux/signal.h:5,
from /usr/include/linux/sched.h:24,
from /usr/include/linux/mm.h:4,
from /usr/include/linux/shm.h:5,
from foo.c:3:
/usr/include/asm/siginfo.h:48: parse error before `clock_t'
/usr/include/asm/siginfo.h:48: warning: no semicolon at end of struct or
union
/usr/include/asm/siginfo.h:48: warning: no semicolon at end of struct or
union
/usr/include/asm/siginfo.h:49: warning: no semicolon at end of struct or
union
/usr/include/asm/siginfo.h:50: warning: data definition has no type or
storage class
/usr/include/asm/siginfo.h:62: parse error before `}'
/usr/include/asm/siginfo.h:62: warning: data definition has no type or
storage class
/usr/include/asm/siginfo.h:63: parse error before `}'
/usr/include/asm/siginfo.h:63: warning: data definition has no type or
storage class
In file included from /usr/include/linux/sched.h:72,
from /usr/include/linux/mm.h:4,
from /usr/include/linux/shm.h:5,
from foo.c:3:
/usr/include/linux/time.h:9: redefinition of `struct timespec'
/usr/include/linux/time.h:51: parse error before `suseconds_t'
/usr/include/linux/time.h:51: warning: no semicolon at end of struct or
union
/usr/include/linux/time.h:88: field `it_interval' has incomplete type
/usr/include/linux/time.h:89: field `it_value' has incomplete type
In file included from /usr/include/linux/sched.h:74,
from /usr/include/linux/mm.h:4,
from /usr/include/linux/shm.h:5,
from foo.c:3:
/usr/include/linux/resource.h:22: field `ru_utime' has incomplete type
/usr/include/linux/resource.h:23: field `ru_stime' has incomplete type
/usr/include/linux/mount.h:20: storage size of `mnt_list' isn't known
______________________
Firebirds rule, `stangs serve!
Kenneth "kenbo" Brunsen
Iris Associates
--=_alternative 00679CB5852568CE_=
Content-Type: text/html; charset="us-ascii"
<br><font size=2 face="Courier New">kenbo@iris.com writes:<br>
<br>
> Using 2.3.99pre6-6, I noticed that SHMMAX has been moved to linux/shm.h and<br>
> that this file is only useable if you have __KERNEL__ defined, otherwise<br>
> the headers it includes basically blow up due to symbols such as kdev_t not<br>
> getting defined. Was this on purpose? If not, maybe we can fix this,<br>
> because otherwise app builders using shared memory and trying to honor<br>
> system boundaries are going to have some problems.</font>
<br>
<br><font size=1 face="sans-serif"><b>Jeff Garzik <jgarzik@mandrakesoft.com></b></font><font size=2 face="sans-serif"> writes:</font>
<br><font size=2 face="sans-serif">> </font><font size=2 face="Courier New">Do not use kernel headers directly in userspace programs.</font>
<br>
<br><font size=2 face="sans-serif">I'm trying to use as few "kernel" headers as I can, but I need to be able to get the limits on shared memory before I create any segments - ie., I need SHMMAX.</font>
<br>
<br><font size=2 face="sans-serif">Christoph Rohland <cr@sap.com> writes:</font>
<br>
<br><font size=2 face="Courier New">> #include <sys/types.h><br>
> #include <linux/shm.h><br>
<br>
> main()<br>
> {<br>
> printf ("shmmax = %d\n", SHMMAX);<br>
> }</font>
<br><font size=2 face="Courier New">></font>
<br><font size=2 face="Courier New">> Works for me. <br>
<br>
> BTW it is probably much better to check the runtime settings with<br>
> shmctl(0, SHM_INFO, ...). The limits are all tuneable now.<br>
</font>
<br><font size=2 face="Courier New">The only problem with shmctl SHM_INFO is that it gives you information about the shared memory in use, not about the limits; IPC_INFO looks promising, but I cannot get that to compile for reasons similar to the test case. </font><font size=2 face="sans-serif">Maybe it's something with my setups or my system somehow because even the above test case fails - I'm running base Redhat 6.0 system with the 2.3.99pre5 patched to pre6-6 kernel and I get the following messages on this test case (and /usr/src/linux points to the new kernel); I tried it on another box with RH 6.1 and 2.3.99pre5 kernel and I get the same results:</font>
<br>
<br><font size=2 face="sans-serif">gcc -o foo -g foo.c</font>
<br>
<br><font size=2 face="Courier New">In file included from /usr/include/linux/sched.h:72,</font>
<br><font size=2 face="Courier New"> from /usr/include/linux/mm.h:4,</font>
<br><font size=2 face="Courier New"> from /usr/include/linux/shm.h:5,</font>
<br><font size=2 face="Courier New"> from foo.c:3:</font>
<br><font size=2 face="Courier New">/usr/include/linux/time.h:69: warning: `FD_SET' redefined</font>
<br><font size=2 face="Courier New">/usr/include/sys/select.h:63: warning: this is the location of the previous definition</font>
<br><font size=2 face="Courier New">/usr/include/linux/time.h:70: warning: `FD_CLR' redefined</font>
<br><font size=2 face="Courier New">/usr/include/sys/select.h:64: warning: this is the location of the previous definition</font>
<br><font size=2 face="Courier New">/usr/include/linux/time.h:71: warning: `FD_ISSET' redefined</font>
<br><font size=2 face="Courier New">/usr/include/sys/select.h:65: warning: this is the location of the previous definition</font>
<br><font size=2 face="Courier New">/usr/include/linux/time.h:72: warning: `FD_ZERO' redefined</font>
<br><font size=2 face="Courier New">/usr/include/sys/select.h:66: warning: this is the location of the previous definition</font>
<br><font size=2 face="Courier New">In file included from /usr/include/linux/dcache.h:5,</font>
<br><font size=2 face="Courier New"> from /usr/include/linux/fs.h:19,</font>
<br><font size=2 face="Courier New"> from /usr/include/linux/capability.h:13,</font>
<br><font size=2 face="Courier New"> from /usr/include/linux/binfmts.h:5,</font>
<br><font size=2 face="Courier New"> from /usr/include/linux/sched.h:8,</font>
<br><font size=2 face="Courier New"> from /usr/include/linux/mm.h:4,</font>
<br><font size=2 face="Courier New"> from /usr/include/linux/shm.h:5,</font>
<br><font size=2 face="Courier New"> from foo.c:3:</font>
<br><font size=2 face="Courier New">/usr/include/linux/mount.h:16: parse error before `kdev_t'</font>
<br><font size=2 face="Courier New">/usr/include/linux/mount.h:16: warning: no semicolon at end of struct or union</font>
<br><font size=2 face="Courier New">/usr/include/linux/mount.h:21: parse error before `}'</font>
<br><font size=2 face="Courier New">In file included from /usr/include/linux/sched.h:13,</font>
<br><font size=2 face="Courier New"> from /usr/include/linux/mm.h:4,</font>
<br><font size=2 face="Courier New"> from /usr/include/linux/shm.h:5,</font>
<br><font size=2 face="Courier New"> from foo.c:3:</font>
<br><font size=2 face="Courier New">/usr/include/linux/times.h:5: parse error before `clock_t'</font>
<br><font size=2 face="Courier New">/usr/include/linux/times.h:5: warning: no semicolon at end of struct or union</font>
<br><font size=2 face="Courier New">/usr/include/linux/times.h:6: warning: data definition has no type or storage class</font>
<br><font size=2 face="Courier New">/usr/include/linux/times.h:7: parse error before `tms_cutime'</font>
<br><font size=2 face="Courier New">/usr/include/linux/times.h:7: warning: data definition has no type or storage class</font>
<br><font size=2 face="Courier New">/usr/include/linux/times.h:8: parse error before `tms_cstime'</font>
<br><font size=2 face="Courier New">/usr/include/linux/times.h:8: warning: data definition has no type or storage class</font>
<br><font size=2 face="Courier New">In file included from /usr/include/linux/sched.h:14,</font>
<br><font size=2 face="Courier New"> from /usr/include/linux/mm.h:4,</font>
<br><font size=2 face="Courier New"> from /usr/include/linux/shm.h:5,</font>
<br><font size=2 face="Courier New"> from foo.c:3:</font>
<br><font size=2 face="Courier New">/usr/include/linux/timex.h:159: field `time' has incomplete type</font>
<br><font size=2 face="Courier New">In file included from /usr/include/linux/sched.h:17,</font>
<br><font size=2 face="Courier New"> from /usr/include/linux/mm.h:4,</font>
<br><font size=2 face="Courier New"> from /usr/include/linux/shm.h:5,</font>
<br><font size=2 face="Courier New"> from foo.c:3:</font>
<br><font size=2 face="Courier New">/usr/include/asm/semaphore.h:39: parse error before `wait_queue_head_t'</font>
<br><font size=2 face="Courier New">/usr/include/asm/semaphore.h:39: warning: no semicolon at end of struct or union</font>
<br><font size=2 face="Courier New">/usr/include/asm/semaphore.h: In function `sema_init':</font>
<br><font size=2 face="Courier New">/usr/include/asm/semaphore.h:73: dereferencing pointer to incomplete type</font>
<br><font size=2 face="Courier New">/usr/include/asm/semaphore.h:74: dereferencing pointer to incomplete type</font>
<br><font size=2 face="Courier New">/usr/include/asm/semaphore.h:75: dereferencing pointer to incomplete type</font>
<br><font size=2 face="Courier New">/usr/include/asm/semaphore.h: At top level:</font>
<br><font size=2 face="Courier New">/usr/include/asm/semaphore.h:226: parse error before `wait_queue_head_t'</font>
<br><font size=2 face="Courier New">/usr/include/asm/semaphore.h:226: warning: no semicolon at end of struct or union</font>
<br><font size=2 face="Courier New">/usr/include/asm/semaphore.h:227: warning: data definition has no type or storage class</font>
<br><font size=2 face="Courier New">/usr/include/asm/semaphore.h: In function `init_rwsem':</font>
<br><font size=2 face="Courier New">/usr/include/asm/semaphore.h:255: dereferencing pointer to incomplete type</font>
<br><font size=2 face="Courier New">/usr/include/asm/semaphore.h:256: dereferencing pointer to incomplete type</font>
<br><font size=2 face="Courier New">/usr/include/asm/semaphore.h:257: dereferencing pointer to incomplete type</font>
<br><font size=2 face="Courier New">/usr/include/asm/semaphore.h:258: dereferencing pointer to incomplete type</font>
<br><font size=2 face="Courier New">/usr/include/asm/semaphore.h:259: dereferencing pointer to incomplete type</font>
<br><font size=2 face="Courier New">/usr/include/asm/semaphore.h: At top level:</font>
<br><font size=2 face="Courier New">/usr/include/asm/semaphore.h:268: parse error before `('</font>
<br><font size=2 face="Courier New">/usr/include/asm/semaphore.h:269: parse error before `('</font>
<br><font size=2 face="Courier New">/usr/include/asm/semaphore.h:270: parse error before `('</font>
<br><font size=2 face="Courier New">In file included from /usr/include/linux/signal.h:5,</font>
<br><font size=2 face="Courier New"> from /usr/include/linux/sched.h:24,</font>
<br><font size=2 face="Courier New"> from /usr/include/linux/mm.h:4,</font>
<br><font size=2 face="Courier New"> from /usr/include/linux/shm.h:5,</font>
<br><font size=2 face="Courier New"> from foo.c:3:</font>
<br><font size=2 face="Courier New">/usr/include/asm/siginfo.h:48: parse error before `clock_t'</font>
<br><font size=2 face="Courier New">/usr/include/asm/siginfo.h:48: warning: no semicolon at end of struct or union</font>
<br><font size=2 face="Courier New">/usr/include/asm/siginfo.h:48: warning: no semicolon at end of struct or union</font>
<br><font size=2 face="Courier New">/usr/include/asm/siginfo.h:49: warning: no semicolon at end of struct or union</font>
<br><font size=2 face="Courier New">/usr/include/asm/siginfo.h:50: warning: data definition has no type or storage class</font>
<br><font size=2 face="Courier New">/usr/include/asm/siginfo.h:62: parse error before `}'</font>
<br><font size=2 face="Courier New">/usr/include/asm/siginfo.h:62: warning: data definition has no type or storage class</font>
<br><font size=2 face="Courier New">/usr/include/asm/siginfo.h:63: parse error before `}'</font>
<br><font size=2 face="Courier New">/usr/include/asm/siginfo.h:63: warning: data definition has no type or storage class</font>
<br><font size=2 face="Courier New">In file included from /usr/include/linux/sched.h:72,</font>
<br><font size=2 face="Courier New"> from /usr/include/linux/mm.h:4,</font>
<br><font size=2 face="Courier New"> from /usr/include/linux/shm.h:5,</font>
<br><font size=2 face="Courier New"> from foo.c:3:</font>
<br><font size=2 face="Courier New">/usr/include/linux/time.h:9: redefinition of `struct timespec'</font>
<br><font size=2 face="Courier New">/usr/include/linux/time.h:51: parse error before `suseconds_t'</font>
<br><font size=2 face="Courier New">/usr/include/linux/time.h:51: warning: no semicolon at end of struct or union</font>
<br><font size=2 face="Courier New">/usr/include/linux/time.h:88: field `it_interval' has incomplete type</font>
<br><font size=2 face="Courier New">/usr/include/linux/time.h:89: field `it_value' has incomplete type</font>
<br><font size=2 face="Courier New">In file included from /usr/include/linux/sched.h:74,</font>
<br><font size=2 face="Courier New"> from /usr/include/linux/mm.h:4,</font>
<br><font size=2 face="Courier New"> from /usr/include/linux/shm.h:5,</font>
<br><font size=2 face="Courier New"> from foo.c:3:</font>
<br><font size=2 face="Courier New">/usr/include/linux/resource.h:22: field `ru_utime' has incomplete type</font>
<br><font size=2 face="Courier New">/usr/include/linux/resource.h:23: field `ru_stime' has incomplete type</font>
<br><font size=2 face="Courier New">/usr/include/linux/mount.h:20: storage size of `mnt_list' isn't known</font>
<br><font size=2 face="sans-serif"><br>
______________________<br>
Firebirds rule, `stangs serve!<br>
<br>
Kenneth "kenbo" Brunsen<br>
Iris Associates</font>
--=_alternative 00679CB5852568CE_=--
---------z01886_boundary_sign
Content-Type: application/x-pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"
Content-Description: S/MIME Cryptographic Signature
MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAA
oIAwggHpMIIBk6ADAgECAiBgEHSiEKNTeK8MLM0jzl7RzyL9NQX15fYTNDqKYZYt
OTANBgkqhkiG9w0BAQQFADBGMQswCQYDVQQGEwJVUzENMAsGA1UECBMETUFTUzEN
MAsGA1UEChMESXJpczEZMBcGA1UEAxMQSXJpcyBJbnRlcm5ldCBDQTAeFw05OTAx
MjUyMjA2MDRaFw0wMTAxMjQyMjA1NDhaMEoxDTALBgNVBAoTBElyaXMxFDASBgNV
BAMTC0tlbiBCcnVuc2VuMSMwIQYJKoZIhvcNAQkBFhRLZW5fQnJ1bnNlbkBpcmlz
LmNvbTBpMA0GCSqGSIb3DQEBAQUAA1gAMFUCTzCnCUrgRjY0VncfdpGLvpM+snDM
kL9g+b4tW8cfGeguQVYcvJHcoGM1GeAfKYs6lHyRNDjIvW3SynqrccE1IFi2VAOD
f7uCHTd0ya2T9Q8CAko5ozwwOjARBgNVHQ4ECgQIRUSu5r15QeUwDwYDVR0PAQH/
BAUDAwewADAUBgtghkgBhvgOAgIDAgQFAwMHAAAwDQYJKoZIhvcNAQEEBQADQQBF
mwbHPAl+5HBPIygNHV2dX+TjURBrZJ4FYZEoTLXd7SqAlIR125j7jO4HWnNWZoax
2gQ4al3SM/CwPhZAK3VjMIIBfjCCASigAwIBAgIENj4SpzANBgkqhkiG9w0BAQQF
ADBGMQswCQYDVQQGEwJVUzENMAsGA1UECBMETUFTUzENMAsGA1UEChMESXJpczEZ
MBcGA1UEAxMQSXJpcyBJbnRlcm5ldCBDQTAeFw05ODExMDIwODE0MDBaFw0wODEw
MzAwODE0MDBaMEYxCzAJBgNVBAYTAlVTMQ0wCwYDVQQIEwRNQVNTMQ0wCwYDVQQK
EwRJcmlzMRkwFwYDVQQDExBJcmlzIEludGVybmV0IENBMFwwDQYJKoZIhvcNAQEB
BQADSwAwSAJBAMPgYytHIMQsQtd26xc5e3geI9nGrfrOmUndn5cZU7iRoNXbckB8
CmEbAzg4hKalAuaCOcgSw4+Sw2F1BMAZuGECAwEAATANBgkqhkiG9w0BAQQFAANB
AEkP1hZxjuKJHXMTLSa8M3Dty7ath5V5t2pHDQ2dHJbVZOtKFyciqvi1V0f08I/m
SP2bK+an4W+SQC4uwvv8Ip4AADGAMIIBiAIBATBqMEYxCzAJBgNVBAYTAlVTMQ0w
CwYDVQQIEwRNQVNTMQ0wCwYDVQQKEwRJcmlzMRkwFwYDVQQDExBJcmlzIEludGVy
bmV0IENBAiBgEHSiEKNTeK8MLM0jzl7RzyL9NQX15fYTNDqKYZYtOTAJBgUrDgMC
GgUAoIGrMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8X
DTAwMDQyNzE4NTE0M1owIwYJKoZIhvcNAQkEMRYEFAPFmRDajIt+Zo9uYmcKwUOx
5DWYMEwGCSqGSIb3DQEJDzE/MD0wBwYFKw4DAh0wDgYIKoZIhvcNAwICAgCAMAoG
CCqGSIb3DQMHMAcGBSsOAwIHMA0GCCqGSIb3DQMCAgEoMA0GCSqGSIb3DQEBAQUA
BE8tpu1JKQJOz1R00S0/x5iYhVew7ilDaB6jZnwmD3l4IEmasZ9lQboVlnTlUZSn
IswpONZ6yvM7NoFM5M9ejdduNdI7VwXPzTbP5deMZBblAAAAAAAAAAA=
---------z01886_boundary_sign--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/