I have been getting these compiler errors when I am trying to create a self-made containers
warning: implicit declaration of function ‘sys_pivot_root’; did you mean ‘SYS_pivot_root’? [-Wimplicit-function-declaration]
TRY (sys_pivot_root(wd, "/dir/oldroot"));
And then I change sys_pivot_root into SYS_pivot_root then the following error message appears.
install_rootg.c:61:9: error: called object is not a function or function pointer
TRY (SYS_pivot_root(wd, "/dir/oldroot"));
and then I look into syscall.h to see if the function exists. I get the following line
asmlinkage long sys_pivot_root (const char __user * new_root, const char __user * put_old)
why am I getting these compiler errors? I haven't been able to resolve this for like a week now.
I include the header files in this exact order.
#define _GNU_SOURCE
#include <errno.h>
#include <stdio.h>
#include <sched.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <limits.h>
#include <sys/syscall.h>
#include <unistd.h>
#include <sys/mman.h>
any help would be appreciated. Thank you in advance!
I figured out, so there isn't such function already defined as pivot_root.
you can just call syscall(SYS_pivot_root, ...
and pivot_root is called.
look at the man page for the usage.
Related
I am unable to compile my code successfully due to undefined references.
I am using the STM32Cube IDE compiler which is based of atollic true studio.
The undefined references are due to headers not linking.
I have included the headers into my main program and have included them in the include path for the compiler.
#include "base64_codec_transport.h"
#include "line_buffer_transport.h"
#include "modem_ussd_transport.h"
#include "thingstream_transport.h"
#include "client_api.h"
#include "client_platform.h"
#include "client_set_callback.h"
#include "custom_modem_transport.h"
#include "debug_printf_core.h"
#include "log_client_transport.h"
#include "log_modem_transport.h"
#include "log_protocol_transport.h"
#include "log_transport.h"
#include "modem2_transport.h"
#include "modem_set_callback.h"
#include "modem_transport.h"
#include "predefined_topics.h"
#include "quectel_modem2_config.h"
#include "ring_buffer_transport.h"
#include "sdk_data.h"
#include "serial_transport.h"
#include "sim7600_modem2_config.h"
#include "transport_api.h"
#include "ublox_modem2_config.h"
The consol errors are below:
All these functions are defined in their respective headers as follows, to give one example.
#define line_buffer_transport_create Thingstream_createLineBufferTransport
which then points to
extern ThingstreamTransportResult Thingstream_line_buffer_deliver(ThingstreamTransport *self);
I have also rebuilt the index multiple times and still no success.
I don't know what else to do to solve this.
Here's my code:
#include <sys/types.h>
#include <stdio.h>
#include <dirent.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <time.h>
#include <sys/time.h>
#include <assert.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <signal.h>
int main(int argc, char** argv) {
sigignore(SIGTERM);
return 0;
}
Why do I get the following warning and how could I remove it?
implicit declaration of function ‘sigignore’
[-Wimplicit-function-declaration] sigignore(SIGTERM);
The program must be compiled like this: gcc -o foo.o foo.c.
Thanks
Man sigignore tells you to use #define _XOPEN_SOURCE 500 to enable sigignore. More on X/Open can be found here
The function you want to call has been marked as obsolete 15 years ago. The normal way to discourage people from using those functions (without actually breaking programs) is to have the implementation of the function left in the standard library, but remove the declaration from header files (or at least make it hard to enable).
Use sigaction or sigprocmask (depending on what you actually want to accomplish).
I am trying to recompile app_fax.c to app_fax.so (module used by asterisk to send/receive fax under 4PSA system) which needs a header file called 4psa_base.h
The reason I am recompiling this c program is because of a timeout setting inside the program that kills fax calls that last more than 30 minute. what I did was just change that value
I have looked everywhere for this file with no luck. its not anywhere that I can find it.
Is there anyone that may have any clue where to find this file?
Thanks,
Javid
I'm not sure which version of Asterisk you are using, but app_fax (which is not the preferred fax module in Asterisk) depends on spandsp. Looking at the source, it does not include the header file you're referring to:
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include <pthread.h>
#include <errno.h>
#include <tiffio.h>
#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES
#include <spandsp.h>
#include <spandsp/version.h>
#include "asterisk/lock.h"
#include "asterisk/file.h"
#include "asterisk/logger.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/app.h"
#include "asterisk/dsp.h"
#include "asterisk/module.h"
#include "asterisk/stasis.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/format_cache.h"
Is this a custom patch to Asterisk?
I have been able to remove almost all errors except these 5 errors in this C program (too long to paste so providing link).
http://codepad.org/AfqrDojN
The errors I receive are as follows:
I am using the following libraries:
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <dos.h>
#include <conio.h>
What could be the issue?
you are redefining the function remove that is already declared in
#include <stdio.h>
changing the name of your function to (for example) void myremove() will probably solve your problem.
I have this message error: storage size of 'start' isn't known when I compile my program. The error is here:
struct _timeb start, finish;
I make a header file when I've put declarations and prototypes
#include <stdio.h>
#include <stdlib.h>
#include <sys/timeb.h>
#include <time.h>
In my .c file, I put
#include "image.h"
#include <math.h>
This usually indicates that the description of the mentioned struct has not yet been encountered, and so you are trying to create a variable of a type the compiler doesn't yet know about. Likely you are missing a header:
#include <sys/timeb.h>