Re: Apache virtual hosts not working as expected - my website is redirected to the default virtual host
I found a solution and posted an answer there: https://stackoverflow.com/questions/53846031/apache-virtual-hosts-not-working-as-expected-my-website-is-redirected-to-the-d אורי u...@speedy.net On Fri, Dec 21, 2018 at 9:40 PM אורי wrote: > Hi, > > I have a problem with Apache configuration and I submitted a question on > Stack Overflow: > > > https://stackoverflow.com/questions/53846031/apache-virtual-hosts-not-working-as-expected-my-website-is-redirected-to-the-d > > In short, I can't setup a virtual host on http://www.speedysoftware.com/, > it leads to the default virtual host. > > I added a debugging URL - /_welcome.php, for example: > > http://www.speedysoft.com/_welcome.php (correct virtual host) > http://www.speedy-software.com/_welcome.php (correct virtual host) > http://www.speedysoftware.com/_welcome.php (default virtual host) > > In long, read the details on Stack Overflow. > > I'll appreciate your help. Except http://www.speedysoftware.com/, other > virtual hosts on this server work as expected. For example, > http://www.veganfriendly.co.il/. > > The name of the server (droplet) is www.speedysoftware.com, and this is > the reverse DNS for the IP address as far as I know. But I'm not sure if > this is the problem. I didn't try to change the name of the server and the > reverse DNS. > > Thanks, > אורי (Uri) > u...@speedy.net > > P.S. Uri is not my name, but you can't write אורי in latin letters. > ___ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
Apache virtual hosts not working as expected - my website is redirected to the default virtual host
Hi, I have a problem with Apache configuration and I submitted a question on Stack Overflow: https://stackoverflow.com/questions/53846031/apache-virtual-hosts-not-working-as-expected-my-website-is-redirected-to-the-d In short, I can't setup a virtual host on http://www.speedysoftware.com/, it leads to the default virtual host. I added a debugging URL - /_welcome.php, for example: http://www.speedysoft.com/_welcome.php (correct virtual host) http://www.speedy-software.com/_welcome.php (correct virtual host) http://www.speedysoftware.com/_welcome.php (default virtual host) In long, read the details on Stack Overflow. I'll appreciate your help. Except http://www.speedysoftware.com/, other virtual hosts on this server work as expected. For example, http://www.veganfriendly.co.il/. The name of the server (droplet) is www.speedysoftware.com, and this is the reverse DNS for the IP address as far as I know. But I'm not sure if this is the problem. I didn't try to change the name of the server and the reverse DNS. Thanks, אורי (Uri) u...@speedy.net P.S. Uri is not my name, but you can't write אורי in latin letters. ___ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
Re: How to signal kernel that shared library is not in use by any process anymore ?
Also if we are speaking Linux, the OS in general have very aggressive caching policy. Everything is remains in cache until it it fills up or it cleaned up externally. AFAIK there's no negative effects on performance. That is not touching the programming that I know little about. BR Evgeniy. On Fri, 21 Dec 2018, 18:18 Shachar Shemesh On 21/12/2018 16:20, Lev Olshvang wrote: > > > Hi All, > > I have an executable (C++) which is the exclusive user of the some shared > library that it uses only during the initialization phase. > > I would like to free memory used by this shared library, because I am running > on embedded system. > > How can I achieve this? > > I know that dlopen() will load shared library, and hope that following > dlclose() will free this lib memory. > > 1. Still I do not know what method should be used to make dynamic linker > look again into executable and resolve symbols of the newly appeared symbols ? > 2. And how to tell the dynamic linker ld-linux.so to postpone the symbol > resolution until dlopen() will load the library? > 3. Whether to compile and link executable with this library or leave > unresolved symbols? > > What you are asking for, as asked, is not possible. If you explain your > use case better, we might better understand what you're trying to do. > > > With that said, I think you should just link the library. > > > All the text segments of the library (i.e. - code) will be loaded with a > read only shared mapping. This means that if they are not used, they will > be unmapped the first time memory becomes constrained. If you do not use > them later on, they will simply not be loaded to memory. They will still be > mapped, but will not load your embedded system's memory in any significant > way. > > > Shachar > > ___ > Linux-il mailing list > Linux-il@cs.huji.ac.il > http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il > ___ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
Re: How to signal kernel that shared library is not in use by any process anymore ?
On 21/12/2018 16:20, Lev Olshvang wrote: Hi All, I have an executable (C++) which is the exclusive user of the some shared library that it uses only during the initialization phase. I would like to free memory used by this shared library, because I am running on embedded system. How can I achieve this? I know that dlopen() will load shared library, and hope that following dlclose() will free this lib memory. 1. Still I do not know what method should be used to make dynamic linker look again into executable and resolve symbols of the newly appeared symbols ? 2. And how to tell the dynamic linker ld-linux.so to postpone the symbol resolution until dlopen() will load the library? 3. Whether to compile and link executable with this library or leave unresolved symbols? What you are asking for, as asked, is not possible. If you explain your use case better, we might better understand what you're trying to do. With that said, I think you should just link the library. All the text segments of the library (i.e. - code) will be loaded with a read only shared mapping. This means that if they are not used, they will be unmapped the first time memory becomes constrained. If you do not use them later on, they will simply not be loaded to memory. They will still be mapped, but will not load your embedded system's memory in any significant way. Shachar ___ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
Re: How to signal kernel that shared library is not in use by any process anymore ?
On Fri, Dec 21, 2018 at 4:21 PM Lev Olshvang wrote: > > Hi All, > > I have an executable (C++) which is the exclusive user of the some shared > library that it uses only during the initialization phase. > > I would like to free memory used by this shared library, because I am > running on embedded system. > > How can I achieve this? > > I know that dlopen() will load shared library, and hope that following > dlclose() will free this lib memory. > According to the dlclose (2) man page: "The function dlclose() decrements the reference count on the dynamically loaded shared object referred to by handle. If the reference count drops to zero, then the object is unloaded. All shared objects that were automatically loaded when dlopen() was invoked on the object referred to by handle are recursively closed in the same manner. A successful return from dlclose() does not guarantee that the symbols associated with handle are removed from the caller's address space. In addition to references resulting from explicit dlopen() calls, a shared object may have been implicitly loaded (and reference counted) because of dependencies in other shared objects. Only when all references have been released can the shared object be removed from the address space." > 1. Still I do not know what method should be used to make dynamic linker > look again into executable and resolve symbols of the newly appeared > symbols ? > If you are using the dlopen/dlclose functions, you are responsible for symbol resolution for symbols provided by your shared object. After you get a handle from dlopen(), you need to call dlsym() in order to get a pointer to your symbol. You can then call that symbol when you need it. > 2. And how to tell the dynamic linker ld-linux.so to postpone the symbol > resolution until dlopen() will load the library? > When you use dlopen() your compilation shouldn't need to resolve any symbols from your dlopen()-ed libraries. > 3. Whether to compile and link executable with this library or leave > unresolved symbols? > You shouldn't have any unresolved symbols, nor should you link to your library during compilation. I guess the best thing is to show an example: Given the following library source (printint.c) : #include void printint(int num) { printf("Called with num=%d \n", num); } Create a shared object from it using gcc -shared -o libprintint.so printint.c Now consider the following test program (main.c) which uses printint with dlopen (removed most of the error handling for clarity here): --- #include typedef void printint(int num); int main(int argc, char *argv[]) { void *handle = NULL; handle = dlopen("./libprintint.so", RTLD_LAZY); if (handle == NULL ) { // use dlerror to find out what went wrong return -1; } printint *sym = NULL; sym = (printint*)dlsym(handle, "printint"); if (sym == NULL ) { // use dlerror to find out what went wrong return -1; } sym(argc); dlclose(handle); return 0; } -- You compile this program like this: gcc main.c -ldl -o a.out You can verify that the program doesn't dynamically link to libprintint.so by running "ldd ./a.out". When you run it with libprintit.so in the same directory it will load the shared library and call the correct function. > Waiting for your advises, > Lev. > > ___ > Linux-il mailing list > Linux-il@cs.huji.ac.il > http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il > ___ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
What to do if kernel_read() returns -EINTR?
Hi All, I need to do some calculation of file contents inside LSM hook. This LSM hook is in a process context, so I hope I can do I/O. ( I put might_sleep() inside hook to confirm I can sleep) I use kernel_read() to read file in chunks of 4K size. On several files, like libc, libm, I got -EINTR error. I tried to insert mdelay() or yield() before repeating kernel_read but still on every read attempt I got -EINTR. According to timestamp of printk, mdelay or yield() do not have any affect, next read happens 2-3 nsecs later. This error happens on libc, libm, ld-linux on 4.4 and 4.13 kernels. It did not happen on other libraries. What might be the solution for this problem ? ThnX, Lev ___ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
How to signal kernel that shared library is not in use by any process anymore ?
Hi All, I have an executable (C++) which is the exclusive user of the some shared library that it uses only during the initialization phase. I would like to free memory used by this shared library, because I am running on embedded system. How can I achieve this? I know that dlopen() will load shared library, and hope that following dlclose() will free this lib memory. 1. Still I do not know what method should be used to make dynamic linker look again into executable and resolve symbols of the newly appeared symbols ? 2. And how to tell the dynamic linker ld-linux.so to postpone the symbol resolution until dlopen() will load the library? 3. Whether to compile and link executable with this library or leave unresolved symbols? Waiting for your advises, Lev. ___ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il