-   Linux - General (
-   -   Is a call to a device a system call? (

HalfMadDad 02-17-2013 11:31 PM

Is a call to a device a system call?
Hi Everyone

I am not sure if I want to license my code under GPL. If I access a device such as a serial port, using the termios.h header(LGPL) I am not linking to the kernel am I ? Are all calls into the kernel carried out as system calls?

THanks for reading-Patrick

sevs 02-18-2013 12:48 AM

AFAIK system call is call to some kernel function. It is 0x80 interrupt number.
Here is a list of system calls for kernel version 2.2
I did not read this pdf yet but looks like it would be usefull.
For list of system calls on your system try

man 2 syscalls

jpollard 02-18-2013 10:37 AM

Headers include files are not copyrightable, they are only expressions of facts.

Linus has already declared that as long as you interface with the system through system calls, you are not bound by the GPL.

Run time libraries (libc and such for the most part) are LGPL, and are designed to separate your application code from the library. The "L" is for library. As long as you don't modify the library itself, you are again not bound by the LGPL.

The only time things get dicey with GPL is when you are writing a device driver. If your driver was originally developed for a different system (such as windows) you are not directly bound by the kernels GPL v2... AS LONG AS you don't use kernel symbols designated as GPLONLY.

For any definitive answer though - see a lawyer.

HalfMadDad 02-18-2013 11:49 AM

Thanks sevs, Thanks jpollard

I write terrible messages and tried to keep things short. I am going to risk boring people and go into a little more detail...

So I would like to control instrumentation with Linux via Ethernet, RS232 and GPIB. There is a GPIB Linux driver but it's not very good. I was thinking about reworking it, I am happy to keep it GPL. However I don't want my whole application to be GPL. I am wondering if I send data across these devices, am I doing so as a series of systems calls or will the use of GPL device drivers require the application to be GPL as well.

jpollard 02-18-2013 01:07 PM

As long as the driver implements the standard functions, you would be using the system calls which insulate your application from the kernel.

Data doesn't come into it. That would be like claiming that writing data to a disk suddenly makes the program writing to it the property of the disk manufacturer that owns the copyrights to the formatter attached to the disk.

sundialsvcs 02-18-2013 01:09 PM

There would be a "bright line" between your device driver and any application (yours, or someone else's) that uses that driver. I'm sure the Linux community would welcome a better GPIB driver. Your program that uses your driver, as any and every other program would use the same driver, has nothing to do with the driver itself.

To carry the notion to an extreme: "the mere fact that a program runs on the Linux operating system does not make that program free."

jpollard 02-18-2013 01:16 PM

One additional note - you might be using libusb for access. Libusb give C applications a way to interact both with USB drivers and directly to USB devices.

Libusb is LGPL, so using the shared library would also isolate your application from any GPL requirements.


As always, do not trust any legal information from the internet - always ask a lawyer, and preferably one that knows the GPL/LGPL and their interactions with other software. There are a number of snake oil lawyers that deliberately don't want to understand.

HalfMadDad 02-18-2013 02:20 PM

Thanks jpollard, Thanks sundialsvcs

I am all set. I don't have a clue about how to write a driver but I have purchased a couple of books and I will get started now, thanks!

sundialsvcs 02-18-2013 06:40 PM

"Use the Source, Luke!"

Install the kernel-source packages for whatever distro you are using. In them, you will find the source code to literally hundreds of working-and-tested device drivers. Among these, you are sure to find some that are quite similar to whatever you have in mind. Cabbage from these, mercilessly and unashamedly.

In the same manner, you will find working, tested source-code for /proc and /sys entries. The magician conceals the innermost workings of none of his tricks.

Books are quite valuable indeed. But keep the source-code close at hand. Use both resources. And remember that, when the time comes for you to embark upon your own particular project, you do not have to "start from scratch." No one actually does that anymore, I think; nor should they. "The hair-follicles that you save will be your own!"

jpollard 02-19-2013 07:13 AM

That is one of the reasons GPL works so well. Others can improve, and in returning yours improves.

And if your specific driver can become a general driver, then perhaps it could even get included in the kernel... Then even when other drivers get adjusted/updated, so will yours.

All times are GMT -5. The time now is 12:13 AM.