Skip to contentSkip to conversation

bug fix to include/linux/cn_proc.h for 2.6.16-rc5

PATCH Matt Helsley 4 participants 9 messages Mar 14, 2006 – Mar 28, 2006 Kernel janitors

lore
Share & tools
lore
#1 lore raw

Hi Narasimha,

Have you compile-tested this? Also, could you resend the patch to
[email protected]?

Technically, you're not supposed to #include headers from a kernel
in userspace. That said, I'd rather not include time.h if I don't have to -- then it may be easier for someone to build the userspace headers. I'll take a look at this.

All,
Please drop [email protected] from replies and use
[email protected] instead.

Thanks,
-Matt Helsley

Narasimha Sharoff <[email protected]>
03/13/2006 12:35 PM

To: [email protected]
cc: Matthew L Helsley/Beaverton/IBM@IBMUS
Subject: [PATCH] bug fix to include/linux/cn_proc.h for
2.6.16-rc5

Compilation fails for a test program which includes cn_proc.h for Process Event Notification. The Patch below fixes the issue.

Test Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <unistd.h>
#include <sys/socket.h>
#include <linux/connector.h>
#include <linux/netlink.h>
#include <linux/cn_proc.h>

main()

{
        printf("hello\n");
}

Results:
$gcc -o b b.c
In file included from cn_proc.h:29,

                 from b.c:13:

/usr/include/linux/time.h:18: error: redefinition of ?struct timeval?

Thanks
Narasimha

Signed-off-by [email protected]

--

include/linux/cn_proc.h | 1 -

 1 files changed, 1 deletion(-)

Index: linux-2.6.16-rc5/include/linux/cn_proc.h =================================--- linux-2.6.16-rc5.orig/include/linux/cn_proc.h +++ linux-2.6.16-rc5/include/linux/cn_proc.h
@@ -26,7 +26,6 @@
#define CN_PROC_H

#include <linux/types.h>
-#include <linux/time.h>
#include <linux/connector.h>

/*

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#2 lore raw
In reply to Matt Helsley

Matt,

Yes, i compile tested this. See the patch below. Note that the test uses the user space header /usr/include/linux/cn_proc.h which is the same as the one found at /usr/src/linux/include/linux.

Thanks
Narasimha

Quoted 67 lines · --- Matthew L Helsley

Hi Narasimha,

Have you compile-tested this? Also, could
you resend the patch to [email protected]?

Technically, you're not supposed to #include
headers from a kernel
in userspace. That said, I'd rather not include time.h if I don't have to
-- then it may be easier for someone to build the userspace headers. I'll
take a look at this.

All,
Please drop [email protected] from replies
and use
[email protected] instead.

Thanks,
-Matt Helsley

Narasimha Sharoff <[email protected]> 03/13/2006 12:35 PM

To: [email protected]
cc: Matthew L
Helsley/Beaverton/IBM@IBMUS
Subject: [PATCH] bug fix to
include/linux/cn_proc.h for
2.6.16-rc5

Compilation fails for a test program which includes cn_proc.h for Process Event Notification. The Patch below fixes the issue.

Test Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <unistd.h>
#include <sys/socket.h>
#include <linux/connector.h>
#include <linux/netlink.h>
#include <linux/cn_proc.h>

main()

{
        printf("hello\n");
}

Results:
$gcc -o b b.c
In file included from cn_proc.h:29,

                 from b.c:13:

/usr/include/linux/time.h:18: error: redefinition of ?struct timeval?

Thanks
Narasimha

Quoted 8 lines
Signed-off-by [email protected]

--

include/linux/cn_proc.h | 1 -

 1 files changed, 1 deletion(-)

Index: linux-2.6.16-rc5/include/linux/cn_proc.h

=================================> --- linux-2.6.16-rc5.orig/include/linux/cn_proc.h

Quoted 10 lines

+++ linux-2.6.16-rc5/include/linux/cn_proc.h

(quoted diff) +0 -1
@@ -26,7 +26,6 @@
 #define CN_PROC_H
 
 #include <linux/types.h>
-#include <linux/time.h>
 #include <linux/connector.h>
 
 /*
Quoted 8 lines

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
Kernel-janitors mailing list [email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#3 lore raw
In reply to Matt Helsley
Quoted 6 lines · Narasimha Sharoff

Matt,

Yes, i compile tested this. See the patch below. Note that the test uses the user space header /usr/include/linux/cn_proc.h which is the same as the one found at /usr/src/linux/include/linux.

This sounds like something is busted in userspace packaging. I would not expect these files to be identical. That just sounds like a workaround to the "don't include kernel files in userspace issue".

Thanks,
Nish

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#4 lore raw
In reply to Matt Helsley
Quoted 8 lines · Nishanth Aravamudan
Quoted 6 lines · Narasimha Sharoff

Matt,

Yes, i compile tested this. See the patch below. Note that the test uses the user space header /usr/include/linux/cn_proc.h which is the same as the one found at /usr/src/linux/include/linux.

Quoted 6 lines

This sounds like something is busted in userspace packaging. I would not expect these files to be identical. That just sounds like a workaround to the "don't include kernel files in userspace issue".

Thanks,
Nish

Narasimha,

Who packaged the headers? Is it a distro package? If so it may be
appropriate to contact them and point out the problem. I'd appreciate being cc'd just so I can track this.

Thanks for submitting a report.

Cheers,
-Matt Helsley

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#5 lore raw
In reply to Matt Helsley

If time.h need not be included in cn_proc.h, is there a reason not to apply this patch?

As i see, not having time.h in cn_proc.h resolves user space problem i am seeing. Kernel compilation seems to go ok (tried it on a ppc system,2.6.16-rc5).

I do not know how the header files end up in /usr/include/linux directory. Is there a standard process followed while packaging or is this distro specific? Can someone forward me a pointer?

Thanks
Narasimha

Quoted 30 lines · --- Matt Helsley
Quoted 1 line · Nishanth Aravamudan

On 13.03.2006 [23:17:04 -0800], Narasimha Sharoff

Quoted 5 lines · wrote:
Quoted 5 lines

Matt,

Yes, i compile tested this. See the patch below.
Note that the test uses the user space header
/usr/include/linux/cn_proc.h which is the same

as the

Quoted 3 lines
Quoted 1 line

one found at /usr/src/linux/include/linux.

This sounds like something is busted in userspace

packaging. I would not

Quoted 1 line

expect these files to be identical. That just

sounds like a workaround

Quoted 1 line

to the "don't include kernel files in userspace

issue".

Quoted 3 lines

Thanks,
Nish

Narasimha,

Who packaged the headers? Is it a distro package?
If so it may be
appropriate to contact them and point out the problem. I'd appreciate
being cc'd just so I can track this.

Quoted 6 lines

Thanks for submitting a report.

Cheers,
-Matt Helsley

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
Kernel-janitors mailing list [email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#6 lore raw
In reply to Matt Helsley
Quoted 2 lines · Narasimha Sharoff

If time.h need not be included in cn_proc.h, is there a reason not to apply this patch?

This only applies if there is no reason to include it *in the kernel*. The fact that it breaks an (arbitrary) userspace build is irrelevant (at least as far as KJ is concerned).

Quoted 3 lines

As i see, not having time.h in cn_proc.h resolves user space problem i am seeing. Kernel compilation seems to go ok (tried it on a ppc system,2.6.16-rc5).

I would suggest giving the kernel side justification only, then, as uerspace should not be using kernel headers directly anyways.

Quoted 3 lines

I do not know how the header files end up in /usr/include/linux directory. Is there a standard process followed while packaging or is this distro specific? Can someone forward me a pointer?

Distro specific, there's probably a package you can find that put the header there (apt-file search filename or dpkg -S filename can help on Debian-based distros). I would figure out why it's there (and if it should be). Complain to the connector folks about it, as well (or just bring it to their attention).

Thanks,
Nish

Quoted 48 lines

Thanks
Narasimha

Quoted 30 lines · --- Matt Helsley
Quoted 1 line · Nishanth Aravamudan

On 13.03.2006 [23:17:04 -0800], Narasimha Sharoff

Quoted 5 lines · wrote:
Quoted 5 lines

Matt,

Yes, i compile tested this. See the patch below.
Note that the test uses the user space header
/usr/include/linux/cn_proc.h which is the same

as the

Quoted 3 lines
Quoted 1 line

one found at /usr/src/linux/include/linux.

This sounds like something is busted in userspace

packaging. I would not

Quoted 1 line

expect these files to be identical. That just

sounds like a workaround

Quoted 1 line

to the "don't include kernel files in userspace

issue".

Quoted 3 lines

Thanks,
Nish

Narasimha,

Who packaged the headers? Is it a distro package?
If so it may be
appropriate to contact them and point out the problem. I'd appreciate
being cc'd just so I can track this.

Quoted 6 lines

Thanks for submitting a report.

Cheers,
-Matt Helsley

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Signature · 2 lines
Nishanth Aravamudan <[email protected]>
IBM Linux Technology Center

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#7 lore raw
In reply to Matt Helsley
Quoted 1 line · Nishanth Aravamudan

On 16.03.2006 [09:56:13 -0800], Narasimha Sharoff wrote:

<snip>

Quoted 9 lines
Quoted 3 lines

I do not know how the header files end up in /usr/include/linux directory. Is there a standard process followed while packaging or is this distro specific? Can someone forward me a pointer?

Distro specific, there's probably a package you can find that put the header there (apt-file search filename or dpkg -S filename can help on Debian-based distros). I would figure out why it's there (and if it should be). Complain to the connector folks about it, as well (or just bring it to their attention).

Perhaps contacting the package maintainer is the correct approach. Have
them remove the #include line from cn_proc.h.

cn_proc.h should be available to userspace in some form. The event
structures it sends to userspace are defined there. That structure includes a struct timespec as a timestamp.

The way I see it, this issue isn't related to connectors. It's related
to process events which send a timestamp with the event to userspace. It happens to use a connector to send the events. I included time.h because I needed the timespec struct and getnstimestamp().

Cheers,
-Matt Helsley

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#8 lore raw
In reply to Matt Helsley
Quoted 19 lines · Nishanth Aravamudan
Quoted 2 lines · Narasimha Sharoff

If time.h need not be included in cn_proc.h, is there a reason not to apply this patch?

This only applies if there is no reason to include it *in the kernel*. The fact that it breaks an (arbitrary) userspace build is irrelevant (at least as far as KJ is concerned).

Quoted 3 lines

As i see, not having time.h in cn_proc.h resolves user space problem i am seeing. Kernel compilation seems to go ok (tried it on a ppc system,2.6.16-rc5).

I would suggest giving the kernel side justification only, then, as uerspace should not be using kernel headers directly anyways.

Quoted 3 lines

I do not know how the header files end up in /usr/include/linux directory. Is there a standard process followed while packaging or is this distro specific? Can someone forward me a pointer?

Quoted 8 lines

Distro specific, there's probably a package you can find that put the header there (apt-file search filename or dpkg -S filename can help on Debian-based distros). I would figure out why it's there (and if it should be). Complain to the connector folks about it, as well (or just bring it to their attention).

Thanks,
Nish

OK, I looked into it and the #include <time.h> is cruft leftover from
an attempt to add a nanosecond-scale timestamp function to the kernel. I eventually stopped pushing that patch because I found a suitable replacement however I accidentally left #include<time.h> in cn_proc.h

I'll run some compile-tests with Narasimha's patch and then Ack it
assuming it doesn't break compilation.

Cheers,
-Matt Helsley

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors