Re: Is shared memory now only for use by the kernel in 2.3.x????

From: kenbo@iris.com
Date: Thu Apr 27 2000 - 13:50:59 EST


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



-
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/



This archive was generated by hypermail 2b29 : Sun Apr 30 2000 - 21:00:13 EST